#include using namespace std; using Int = long long; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a>n>>k; vector p(n); iota(p.begin(),p.end(),0); for(int i=0;i>x>>y; x--;y--; swap(p[x],p[y]); } vector a(n); for(int i=0;i>a[i]; vector r(n); for(int i=0;i b(n); for(int i=0;i xs,ys; while(1){ int flg=0; for(int i=0;i+1b[i+1]){ xs.emplace_back(i); ys.emplace_back(i+1); swap(b[i],b[i+1]); flg=1; break; } } if(flg) continue; break; } int l=xs.size(); cout<