malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     vector<int> p(n);     for (int i = 0; i < n; ++i) {       cin >> p[i];     }     vector<int> f(n + 1, 0);     for (int& x : p) {       f[x] = f[x - 1] + 1;     }     cout << n - *max_element(f.begin(), f.end());   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int n, h, l = 0, c = 0, a = 0, b = 0, d;     cin >> n >> h;     while (n--) {       cin >> d;       c += d;       if (c > a)         a = c;       else if (c < b)         b = c;     }     l -= b;     h -= a;     d = h - l + 1;     if (d < 0) d = 0;     cout << d;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double eps = 1e-9;   const double PI = acos(-1.0);   const long long int mod = 1e9 + 9;   const int MAXN = 1e6 + 5;   long long int fpow(long long int x, long long int y) {     long long int res = 1;     while (y > 0) {       if (y & 1) res = (res % mod * x % mod) % mod;       x = (x % mod * x % mod) % mod;       y = y / 2;     }     return res;   }   void cp() {     int n, m;     cin >> n >> m;     long long int total = (fpow(2, m) - 1 + mod) % mod;     long long int ans = 1;     for (int i = 0; i < n; i++) {       long long int me = me = (total - i + mod) % mod;       ans = (ans % mod * me % mod) % mod;     }     cout << ans;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     int t;     t = 1;     while (t--) {       cp();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int i, m, x = 0, n, a[1000], j;   int main() {     cin >> n;     for (i = 0; i < n; i++) cin >> a[i];     for (i = 0; i < n; i++) {       m = 1;       for (j = i - 1; j >= 0; j--)         if (a[j] <= a[j + 1])           ++m;         else           break;       for (j = i + 1; j < n; j++)         if (a[j] <= a[j - 1])           ++m;         else           break;       x = max(x, m);     }     cout << x;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   double ans = 0;   void calc(vector<int> arr, int d, double p) {     if (d == 0) {       int tmp = 0;       for (int i = 0; i < n; ++i) {         for (int j = 0; j < i; ++j) {           if (arr[j] > arr[i]) {             tmp++;           }         }       }       ans += double(tmp) * p;       return;     }     for (int i = 0; i < n; ++i) {       for (int j = i; j < n; ++j) {         vector<int> xxx = arr;         reverse(xxx.begin() + min(i, j), xxx.begin() + max(i, j) + 1);         calc(xxx, d - 1, p / (n * (n + 1) / 2));       }     }   }   int main() {     int dep;     cin >> n >> dep;     vector<int> vec(n);     for (int i = 0; i < n; ++i) {       scanf( %d , &vec[i]);     }     calc(vec, dep, 1);     printf( %.10lf n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int n, p, i, j, val, sum = 0, ans = 0;     scanf( %lld %lld , &n, &p);     long long int a[n];     for (i = 0; i < n; i++) {       scanf( %lld , &a[i]);       sum += a[i];     }     sum %= p;     val = 0;     for (i = 0; i < n - 1; i++) {       val += a[i];       val %= p;       if (sum - val >= 0) {         if (sum > ans) ans = sum;       } else {         ans = sum + p;         break;       }     }     printf( %lld , ans);     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize ( O3 )   #pragma GCC optimize ( Ofast )   using namespace std;      #define int int64_t   #define SQ(a) (a)*(a)      const int INF = 1e15;      int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);        int n, m;     cin >> n >> m;        vector<vector<pair<int, int>>> g(n);     for (int i = 0, a, b, c; i < m; i++) {       cin >> a >> b >> c;       a--, b--;       g[a].push_back({b, c});       g[b].push_back({a, c});     }        vector<int> deven(n, INF);     vector<vector<int>> dodd(51, vector<int> (n, INF));        deven[0] = 0;     priority_queue<array<int, 3>> Q; // {dist, v, (-1 OR w_last)}     Q.push({0, 0, -1});        vector<vector<bool>> vis(52, vector<bool> (n));     while (!Q.empty()) {       int d = -Q.top()[0];       int v =  Q.top()[1];       int lw=  Q.top()[2];       Q.pop();          if (vis[lw + 1][v])         continue;       vis[lw + 1][v] = true;          if (lw == -1) { // even steps         for (auto [u, w] : g[v]) {           if (dodd[w][u] > d) {             dodd[w][u] = d;             Q.push({-d, u, w});           }         }       } else {         for (auto [u, w] : g[v]) {           if (deven[u] > d + SQ(lw + w)) {             deven[u] = d + SQ(lw + w);             Q.push({-deven[u], u, -1});           }         }       }     }        for (int i = 0; i < n; i++)       cout << (deven[i] == INF ? -1 : deven[i]) <<    ;     cout <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   int main(int argc, const char* argv[]) {     int n;     cin >> n;     int a[n];     int b[n];     for (int i = 0; i < n; i++) {       cin >> a[i];     }     for (int i = 0; i < n; i++) {       cin >> b[i];     }     long long mx = 0;     for (int i = 0; i < n; i++) {       for (int j = 0; j < n; j++) {         long long an = 0;         long long bn = 0;         for (int t = i; t <= j; t++) {           an = an | a[t];           bn = bn | b[t];         }         if (an + bn > mx) {           mx = an + bn;         }       }     }     cout << mx;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 0x3f3f3f3f;   const int mod = 1e9 + 7;   const int N = 1e5 + 5;   long long a[N], b[N];   long long n, h;   bool cmp(int a, int b) { return a > b; }   long long judge(int index) {     for (int i = 0; i <= index; i++) {       b[i] = a[i];     }     sort(b, b + index + 1, cmp);     long long sum;     if (index % 2 == 0)       sum = b[index], index--;     else       sum = 0;     for (int i = 0; i <= index; i += 2) {       sum += b[i];     }     if (sum <= h)       return 1;     else       return 0;   }   int main() {     std::ios::sync_with_stdio(false);     cin >> n >> h;     for (int i = 0; i < n; i++) {       cin >> a[i];     }     int l = 0, r = n - 1;     long long res;     while (l <= r) {       int mid = (l + r) / 2;       if (judge(mid)) {         l = mid + 1;         res = mid;       } else {         r = mid - 1;       }     }     cout << res + 1 <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   signed long long int a[100000 + 5], b[100000 + 5];   int n, m;   signed long long int func(signed long long int x) {     signed long long int ans = 0;     for (int i = 1; i <= n; ++i) {       if (a[i] < x) ans += x - a[i];     }     for (int i = 1; i <= m; ++i) {       if (x < b[i]) ans += b[i] - x;     }     return ans;   }   signed long long int ter(signed long long int i, signed long long int j) {     if (i == j) return i;     if (j - i == 2) {       signed long long int mi = j - 1;       if (func(mi) < func(i) && func(mi) < func(j)) return mi;       if (func(i) < func(j) && func(i) < func(mi)) return i;       return j;     }     signed long long int l, r;     l = i + (j - i) / 3;     r = j - (j - i) / 3;     if (func(l) > func(r))       return ter(l, j);     else       return ter(i, r);   }   int main() {     cin >> n >> m;     for (int i = 1; i <= n; ++i) cin >> a[i];     for (int i = 1; i <= m; ++i) cin >> b[i];     cout << func(ter(0, 2 * 1000000007 + 1));   }
#include <bits/stdc++.h>   using namespace std;   int n;   int a[120000];   void query(int L, int R) {     int M = (L + R) / 2;     printf( ? %d n , M);     fflush(stdout);     printf( ? %d n , n / 2 + M);     fflush(stdout);     scanf( %d %d , a + M, a + M + n / 2);     if (a[M] == a[n / 2 + M]) {       printf( ! %d n , M);       fflush(stdout);       return;     }     if (((a[M + n / 2] - a[M]) < 0) ^ ((a[L + n / 2] - a[L]) < 0))       query(L, M);     else       query(M, R);   }   int main() {     scanf( %d , &n);     if (n % 4) {       printf( ! -1 n );       fflush(stdout);       return 0;     }     printf( ? 1 n );     fflush(stdout);     printf( ? %d n , n / 2 + 1);     fflush(stdout);     scanf( %d %d , a + 1, a + n / 2 + 1);     if (a[1] == a[n / 2 + 1]) {       printf( ! %d n , 1);       fflush(stdout);       return 0;     }     printf( ? %d n , n / 2);     fflush(stdout);     printf( ? %d n , n);     fflush(stdout);     scanf( %d %d , a + n / 2, a + n);     if (a[n / 2] == a[n]) {       printf( ! %d n , n / 2);       fflush(stdout);       return 0;     }     query(1, n / 2);   }
#include <bits/stdc++.h>   using namespace std;   long long readi() {     long long input = 0;     char c =    ;     while (c <  - ) {       c = getchar();     }     bool negative = false;     if (c ==  - ) {       negative = true;       c = getchar();     }     while (c >=  0 ) {       input = 10 * input + (c -  0 );       c = getchar();     }     if (negative) {       input = -input;     }     return input;   }   void printi(long long output) {     if (output == 0) {       putchar( 0 );       return;     }     if (output < 0) {       putchar( - );       output = -output;     }     int aout[20];     int ilen = 0;     while (output) {       aout[ilen] = ((output % 10));       output /= 10;       ilen++;     }     for (int i = ilen - 1; i >= 0; i--) {       putchar(aout[i] +  0 );     }     return;   }   string reads() {     string input =   ;     char c =    ;     while (c <=    ) {       c = getchar();     }     while (c >    ) {       input += c;       c = getchar();     }     return input;   }   void prints(string output) {     for (int i = 0; i < output.length(); i++) {       putchar(output[i]);     }     return;   }   long long getrand() {     long long rand1 = (rand() % 536870912);     long long rand2 = (rand() % 536870912);     return (rand1 * 536870912ll + rand2);   }   int N;   long long arr[5][1010];   bool bad[1010];   int ans;   long long scalar(long long a, long long b, long long c) {     long long res = 0ll;     for (long long i = 0; i < 5; i++) {       res += ((arr[i][b] - arr[i][a]) * (arr[i][c] - arr[i][a]));     }     return res;   }   int32_t main() {     srand(time(NULL));     cout << fixed << setprecision(10);     cerr << fixed << setprecision(10);     ios_base::sync_with_stdio(false);     if (fopen( cf850a.in ,  r )) {       freopen( cf850a.in ,  r , stdin);     }     cin >> N;     for (int i = 0; i < N; i++) {       for (int j = 0; j < 5; j++) {         cin >> arr[j][i];       }     }     if (N >= 100) {       cout <<  0 n ;       return 0;     }     for (int i = 0; i < N; i++) {       for (int j = 0; j < N; j++) {         if (j == i) {           continue;         }         for (int k = j + 1; k < N; k++) {           if (k == i) {             continue;           }           if (scalar(i, j, k) > 0) {             bad[i] = true;           }         }       }     }     for (int i = 0; i < N; i++) {       if (!bad[i]) {         ans++;       }     }     cout << ans <<   n ;     for (int i = 0; i < N; i++) {       if (!bad[i]) {         cout << i + 1 <<   n ;       }     }     return 0;   }
#include <bits/stdc++.h>   void mergesort(char z[], int left, int right) {     char temp[1000];     if (left >= right) {       return;     }     int mid = (left + right) / 2;     mergesort(z, left, mid);     mergesort(z, mid + 1, right);     int lenl = mid;     int lenr = right;     int i = left, j = mid + 1, k = left;     while (i <= lenl && j <= lenr) {       if (z[i] >= z[j]) {         temp[k] = z[i];         k++;         i++;       } else {         temp[k] = z[j];         k++;         j++;       }     }     while (i <= lenl) {       temp[k] = z[i];       k++;       i++;     }     while (j <= lenr) {       temp[k] = z[j];       k++;       j++;     }     for (int i = left; i <= right; i++) {       z[i] = temp[i];     }   }   int main() {     int a, b, c, d, e, f, g, h;     char z[1000];     scanf( %d , &a);     getchar();     for (int i = 0; i < a; i++) {       scanf( %s , z);       getchar();       b = strlen(z);       mergesort(z, 0, b - 1);       if (b == 1) {         printf( YES n );       } else {         for (int j = 0; j < b - 1; j++) {           if ((z[j] - z[j + 1]) == 1) {           } else {             printf( NO n );             break;           }           if (j == b - 2) {             printf( YES n );           }         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m;   string s;   vector<int> q;   int mo[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};   int h, w;   int data(int x, int y) {     int tmp = 0;     for (int i = 0; i < x - 1; i++) tmp += mo[i];     return tmp + y;   }   int cal(int x, int y, int z) { return x * 60 * 60 + y * 60 + z; }   int getpos(string s) {     int p = data((s[5] -  0 ) * 10 + s[6] -  0 , (s[8] -  0 ) * 10 + s[9] -  0 );     int res = (p - 1) * 24 * 60 * 60;     res += cal((s[11] -  0 ) * 10 + s[12] -  0 , (s[14] -  0 ) * 10 + s[15] -  0 ,                (s[17] -  0 ) * 10 + s[18] -  0 );     return res;   }   int main() {     cin >> n >> m;     h = 0;     getline(cin, s);     while (getline(cin, s)) {       int t = getpos(s);       q.push_back(t);       while (h < q.size() && t - q[h] >= n) h++;       if (q.size() - h >= m) {         for (int i = 0; i <= 18; i++) cout << s[i];         cout << endl;         return 0;       }     }     cout << -1 << endl;     return 0;   }
#include <bits/stdc++.h>   template <typename _Tp>   void read(_Tp &x) {     char ch(getchar());     bool f(false);     while (!isdigit(ch)) f |= ch == 45, ch = getchar();     x = ch & 15, ch = getchar();     while (isdigit(ch)) x = x * 10 + (ch & 15), ch = getchar();     if (f) x = -x;   }   template <typename _Tp, typename... Args>   void read(_Tp &t, Args &...args) {     read(t);     read(args...);   }   const int N = 100005, mod = 1000000007;   template <typename _Tp1, typename _Tp2>   inline void add(_Tp1 &a, _Tp2 b) {     (a += b) >= mod && (a -= mod);   }   template <typename _Tp1, typename _Tp2>   inline void sub(_Tp1 &a, _Tp2 b) {     (a -= b) < 0 && (a += mod);   }   long long ksm(long long a, long long b = mod - 2) {     long long res = 1;     while (b) {       if (b & 1) res = res * a % mod;       a = a * a % mod, b >>= 1;     }     return res;   }   long long fac[N], inv[N], ifac[N];   void init() {     fac[0] = fac[1] = inv[0] = inv[1] = ifac[0] = ifac[1] = 1;     for (int i = 2; i < N; ++i)       fac[i] = fac[i - 1] * i % mod,       inv[i] = inv[mod % i] * (mod - mod / i) % mod,       ifac[i] = ifac[i - 1] * inv[i] % mod;   }   inline long long C(int n, int m) {     return n < m || m < 0 ? 0 : fac[n] * ifac[m] % mod * ifac[n - m] % mod;   }   int f[N];   std::map<int, int> mp;   int cnt[N], pw[N];   int main() {     init();     int n, k;     read(n, k);     for (int i = 0; i <= n; ++i) pw[i] = ksm(k - 1, i);     f[0] = 0;     for (int i = 0; i < n; ++i)       f[i + 1] = (1LL * (k - 1) * i % mod * f[i] % mod + 1) * inv[n - i] % mod;     for (int i = 1; i <= n; ++i) add(f[i], f[i - 1]);     int a = 0, s = 0;     for (int i = 1, x; i <= n; ++i) {       read(x);       if (x != -1)         ++mp[x];       else         ++a;     }     for (auto it : mp) ++cnt[it.second];     cnt[0] += k - mp.size();     for (int i = 0; i <= n; ++i)       if (cnt[i]) {         int tmp = 0;         for (int j = 0; j <= a; ++j)           add(tmp, 1LL * f[i + j] * C(a, j) % mod * pw[a - j] % mod);         add(s, 1LL * tmp * cnt[i] % mod);       }     s = ksm(k, mod - 1 - a) * s % mod;     printf( %lld n , 1LL * (f[n] - s + mod) * n % mod);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, bx, x;     long long X = 0;     cin >> n >> bx;     for (int i = 1; i <= n; i++) {       cin >> x;       X += x * pow(bx, n - i);     }     int m, by, y;     long long Y = 0;     cin >> m >> by;     for (int i = 1; i <= m; i++) {       cin >> y;       Y += y * pow(by, m - i);     }     if (X == Y) {       cout <<  = ;       return 0;     }     if (X > Y) {       cout <<  > ;       return 0;     }     cout <<  < ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long x;     cin >> x;     while (x--) {       string str;       cin >> str;       long long n, b, m, v, finl, finl2;       finl2 = 0;       v = 0;       b = 0;       m = 0;       v = 0;       for (n = 0; n < str.size(); n++) {         finl = (int)str[n] - 48;         if (finl == 0)           b++;         else if (finl % 2 == 0)           m++;         finl2 = finl + finl2;       }       if (finl2 % 3 == 0) v = 1;       if (b >= 2 && v == 1 || b >= 1 && m >= 1 && v == 1)         cout <<  red ;       else         cout <<  cyan ;       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, si, mi, t;     cin >> n;     for (int i = 0; i < n; i++) {       cin >> t;       if (t == 1) {         si = i;       }       if (t == n) {         mi = i;       }     }     if (si < mi) {       cout << max(mi, n - 1 - si);     } else {       cout << max(si, n - 1 - mi);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 50005;   long long num[maxn];   int main() {     long long sum = 0, ans = 0;     int n;     scanf( %d , &n);     for (int i = 0; i < n; i++) cin >> num[i], sum += num[i];     if (n == 0) {       cout <<  0  << endl;       return 0;     }     sum = sum / n;     for (int i = 0; i < n - 1; i++) {       if (num[i] < sum) {         ans += sum - num[i];         num[i + 1] -= (sum - num[i]);       } else if (num[i] > sum) {         ans += num[i] - sum;         num[i + 1] += num[i] - sum;       }       num[i] = sum;     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void mohammed() {     ios::sync_with_stdio(0);     ios_base::sync_with_stdio(0);     cin.tie(0), cout.tie(0);   }   int main() {     mohammed();     int n, x, y;     map<int, int> mp;     cin >> n;     for (int i = 0; i < n; i++) {       cin >> x >> y;       mp[x]++;       mp[y + 1]--;     }     x = 0;     for (map<int, int>::iterator it = mp.begin(); it != mp.end(); it++) {       it->second += x;       if (it->second > 2) return cout <<  NO n , 0;       x = it->second;     }     cout <<  YES n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, k;   long long l;   long long mo = 998244353;   long long A[4005][4005][2];   long long B[4005];   long long a, b;   long long f(long long x, long long y) {     long long mid = 1;     while (y) {       if (y & 1) {         mid = mid * x % mo;       }       x = x * x % mo;       y >>= 1;     }     return mid;   }   int main() {     cin >> n >> k >> l;     A[0][0][0] = 1;     for (int i = 0; i <= 2 * n; i++) {       for (int j = 0; j <= i; j++) {         A[i + 1][j + 1][0] = (A[i + 1][j + 1][0] + A[i][j][0]) % mo;         A[i + 1][j + 1][1] = (A[i + 1][j + 1][1] + A[i][j][1]) % mo;         if (j) {           A[i + 1][j - 1][0] = (A[i + 1][j - 1][0] + A[i][j][0] * j) % mo;           A[i + 1][j - 1][1] = (A[i + 1][j - 1][1] + A[i][j][1] * j) % mo;         }         if (j >= k) {           A[i + 1][j][1] = (A[i + 1][j][1] + A[i][j][0]) % mo;         }       }     }     B[0] = 1;     for (int i = 1; i <= n * 2 + 1; i++) {       B[i] = B[i - 1] * i % mo;     }     a = A[2 * n + 1][0][1] * B[n] % mo * f(2, n) % mo;     b = f(B[2 * n + 1], mo - 2) * l % mo;     cout << a * b % mo << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int MAX_N = (int)2e5 + 7;   long long dp[MAX_N];   long long num[MAX_N][2];   long long dist[MAX_N][2];   vector<int> a[MAX_N];   long long ans = 0;   void go(int v, int pr = -1) {     ++num[v][0];     for (int to : a[v]) {       if (to == pr) continue;       go(to, v);       for (int i = 0; i < 2; ++i)         for (int j = 0; j < 2; ++j) {           ans += dist[v][i] * num[to][j] + dist[to][j] * num[v][i];           if (!i && !j) {             ans += num[to][j] * num[v][i];           }         }       num[v][0] += num[to][1];       dist[v][0] += dist[to][1];       num[v][1] += num[to][0];       dist[v][1] += dist[to][0] + num[to][0];     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     int n;     cin >> n;     for (int i = 0; i < n - 1; ++i) {       int x, y;       cin >> x >> y;       --x;       --y;       a[x].push_back(y);       a[y].push_back(x);     }     go(0);     cout << ans <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   const int maxlongint = 2147483647;   const int inf = 1000000000;   int main() {     int a, b, c, d, e, f, ans = 0, k = -1, n1, n2;     cin >> a >> b >> c >> d >> e >> f;     ans = a * b + c * d + e * f;     for (n1 = 1; n1 <= 1000; n1++)       if (n1 * n1 == ans) {         k = n1;         break;       }     if (k == -1) {       cout << -1 << endl;       return 0;     }     if (b == k) swap(a, b);     if (d == k) swap(c, d);     if (f == k) swap(e, f);     if (a == k && c == k && e == k) {       cout << k << endl;       for (n1 = 1; n1 <= b; n1++) {         for (n2 = 1; n2 <= k; n2++) putchar( A );         printf(  n );       }       for (n1 = 1; n1 <= d; n1++) {         for (n2 = 1; n2 <= k; n2++) putchar( B );         printf(  n );       }       for (n1 = 1; n1 <= f; n1++) {         for (n2 = 1; n2 <= k; n2++) putchar( C );         printf(  n );       }       return 0;     }     int sd = 0;     if (c == k) {       sd = 1;       swap(a, c);       swap(b, d);     } else if (e == k) {       sd = 2;       swap(a, e);       swap(b, f);     }     if (a != k) {       cout << -1 << endl;       return 0;     }     if (d == k - b) swap(c, d);     if (f == k - b) swap(e, f);     if (c != k - b || e != k - b) {       cout << -1 << endl;       return 0;     }     {       cout << k << endl;       for (n1 = 1; n1 <= b; n1++) {         for (n2 = 1; n2 <= k; n2++) putchar( A  + sd);         printf(  n );       }       for (n1 = 1; n1 <= k - b; n1++) {         if (sd != 1)           for (n2 = 1; n2 <= d; n2++) putchar( B );         else           for (n2 = 1; n2 <= d; n2++) putchar( A );         if (sd != 2)           for (n2 = 1; n2 <= f; n2++) putchar( C );         else           for (n2 = 1; n2 <= f; n2++) putchar( A );         printf(  n );       }       return 0;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     vector<int> v(n);     multiset<int> list;     for (int i = 0; i < n; i++) {       cin >> v[i];     }     for (int i = 0; i < n; i++) {       int x;       cin >> x;       list.insert(x);     }     for (int i = 0; i < n; ++i) {       auto current = list.lower_bound(n - v[i]);       if (current == list.end()) {         current = list.begin();       }       cout << (v[i] + *current) % n <<    ;       list.erase(current);     }   }