swap.cpp:3:9: error: 'pair' does not name a type
3 | typedef pair<int, int> pi;
| ^~~~
swap.cpp:6:5: error: 'pi' was not declared in this scope
6 | map<pi,int> bes;
| ^~
swap.cpp:6:11: error: template argument 1 is invalid
6 | map<pi,int> bes;
| ^
swap.cpp:6:11: error: template argument 3 is invalid
swap.cpp:6:11: error: template argument 4 is invalid
swap.cpp:7:10: error: 'MX' was not declared in this scope
7 | int n, p[MX];
| ^~
swap.cpp: In function 'int get(int, int)':
swap.cpp:10:13: error: request for member 'count' in 'bes', which is of non-class type 'int'
10 | if (bes.count({ind,y})) return bes[{ind,y}];
| ^~~~~
swap.cpp:10:47: error: invalid types 'int[<brace-enclosed initializer list>]' for array subscript
10 | if (bes.count({ind,y})) return bes[{ind,y}];
| ^
swap.cpp:13:17: error: 'p' was not declared in this scope
13 | if (y > p[2*ind]) return 2*ind;
| ^
swap.cpp:16:17: error: 'p' was not declared in this scope
16 | if (y < min(p[2*ind],p[2*ind+1])) return bes[{ind,y}] = ind;
| ^
swap.cpp:16:57: error: invalid types 'int[<brace-enclosed initializer list>]' for array subscript
16 | if (y < min(p[2*ind],p[2*ind+1])) return bes[{ind,y}] = ind;
| ^
swap.cpp:17:9: error: 'p' was not declared in this scope
17 | if (p[2*ind] < min(y,p[2*ind+1])) return bes[{ind,y}] = get(2*ind,y);
| ^
swap.cpp:17:57: error: invalid types 'int[<brace-enclosed initializer list>]' for array subscript
17 | if (p[2*ind] < min(y,p[2*ind+1])) return bes[{ind,y}] = get(2*ind,y);
| ^
swap.cpp:18:20: error: 'p' was not declared in this scope
18 | int mn = min(y,p[2*ind]);
| ^
swap.cpp:20:40: error: invalid types 'int[<brace-enclosed initializer list>]' for array subscript
20 | if (mn == y) return bes[{ind,y}] = get(2*ind,y);
| ^
swap.cpp:21:27: error: invalid types 'int[<brace-enclosed initializer list>]' for array subscript
21 | return bes[{ind,y}] = get(2*ind+1,y);
| ^
swap.cpp:23:40: error: invalid types 'int[<brace-enclosed initializer list>]' for array subscript
23 | if (mn == y) return bes[{ind,y}] = get(2*ind+1,y);
| ^
swap.cpp:24:27: error: invalid types 'int[<brace-enclosed initializer list>]' for array subscript
24 | return bes[{ind,y}] = get(2*ind,y);
| ^
swap.cpp: In function 'void solve(int)':
swap.cpp:31:13: error: 'p' was not declared in this scope
31 | if (p[ind] > p[2*ind]) swap(p[ind],p[2*ind]);
| ^
swap.cpp:35:9: error: 'p' was not declared in this scope
35 | if (p[ind] < min(p[2*ind],p[2*ind+1])) {
| ^
swap.cpp:44:41: error: 'mx' was not declared in this scope; did you mean 'mn'?
44 | p[2*ind] = mn, p[2*ind+1] = mx;
| ^~
| mn
swap.cpp:46:24: error: 'mx' was not declared in this scope; did you mean 'mn'?
46 | p[2*ind] = mx, p[2*ind+1] = mn;
| ^~
| mn
swap.cpp: In function 'int main()':
swap.cpp:55:25: error: 'p' was not declared in this scope
55 | FOR(i,1,n+1) cin >> p[i];
| ^
swap.cpp:57:26: error: 'p' was not declared in this scope
57 | FOR(i,1,n+1) cout << p[i] << " ";
| ^