malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     int a[n], i;     for (i = 0; i < n; i++) {       cin >> a[i];     }     if (n == 1) {       cout << 1;       return 0;     }     int lmarr[n + 1], rmarr[n + 1];     lmarr[0] = INT_MIN;     rmarr[n] = INT_MAX;     for (i = 0; i < n; i++) {       lmarr[i + 1] = max(a[i], lmarr[i]);     }     for (i = n - 1; i >= 0; i--) {       rmarr[i] = min(rmarr[i + 1], a[i]);     }     int count = 1;     for (i = 1; i < n; i++) {       if (lmarr[i] <= rmarr[i]) {         count++;       }     }     cout << count;   }
#include <bits/stdc++.h>   template <typename T>   inline void read(T &x) {     x = 0;     char c = getchar();     while (!isdigit(c)) c = getchar();     while (isdigit(c)) x = x * 10 + (c ^ 48), c = getchar();   }   using namespace std;   int n, m;   struct Edge {     int u, v, w, id;     Edge() {}     Edge(int jzp, int zzz, int lsr, int chr) {       u = jzp, v = zzz, w = lsr, id = chr;     }   } E[301000], Ev[301000];   bool cmp(const Edge &a, const Edge &b) { return a.w < b.w; }   int stkx[301000], stky[301000], stop, siz[301000], oddcnt, fath[301000];   int find(int cur) { return fath[cur] == cur ? cur : find(fath[cur]); }   inline void merge(int x, int y) {     x = find(x), y = find(y);     if (x == y) return;     if (siz[x] > siz[y]) swap(x, y);     stkx[++stop] = x, stky[stop] = y;     if (siz[x] & 1) --oddcnt;     if (siz[y] & 1) --oddcnt;     siz[y] += siz[x];     fath[x] = y;     if (siz[y] & 1) ++oddcnt;   }   inline void cancl(int x, int y) {     fath[x] = x;     if (siz[y] & 1) --oddcnt;     siz[y] -= siz[x];     if (siz[x] & 1) ++oddcnt;     if (siz[y] & 1) ++oddcnt;   }   int st[301000], ed[301000];   int ans[301000];   int h[301000], ltot;   void sol(int l, int r, int d, int u) {     if (l > r) return;     int memo = stop, mid = (l + r) >> 1;     for (int i = l; i <= mid; ++i) {       if (E[i].w <= d) merge(E[i].u, E[i].v);     }     int memo_ = stop;     if (!oddcnt) {       ans[mid] = d;     } else {       for (int i = d + 1; i <= u; ++i) {         for (int j = st[i]; j <= ed[i]; ++j) {           if (Ev[j].id <= mid) merge(Ev[j].u, Ev[j].v);         }         if (!oddcnt) {           ans[mid] = i;           break;         }       }     }     if (!ans[mid]) {       while (stop != memo_) cancl(stkx[stop], stky[stop]), --stop;       sol(mid + 1, r, d, u);       while (stop != memo) cancl(stkx[stop], stky[stop]), --stop;       return;     } else {       while (stop != memo_) cancl(stkx[stop], stky[stop]), --stop;       sol(mid + 1, r, d, ans[mid]);       while (stop != memo) cancl(stkx[stop], stky[stop]), --stop;       for (int i = d + 1; i <= ans[mid]; ++i) {         for (int j = st[i]; j <= ed[i]; ++j) {           if (Ev[j].id < l) merge(Ev[j].u, Ev[j].v);         }       }       sol(l, mid - 1, ans[mid], u);       while (stop != memo) cancl(stkx[stop], stky[stop]), --stop;       return;     }   }   int main() {     read(n), read(m);     for (int i = 1; i <= n; ++i) siz[i] = 1, fath[i] = i;     oddcnt = n;     for (int i = 1; i <= m; ++i) {       int u, v, w;       read(u), read(v), read(w);       h[i] = w;       Ev[i] = Edge(u, v, w, i);     }     sort(h + 1, h + 1 + m);     ltot = unique(h + 1, h + 1 + m) - h - 1;     for (int i = 1; i <= m; ++i)       Ev[i].w = lower_bound(h + 1, h + 1 + ltot, Ev[i].w) - h;     memcpy(E, Ev, sizeof(Ev));     sort(Ev + 1, Ev + 1 + m, cmp);     for (int i = 1; i <= m; ++i)       if (Ev[i].w != Ev[i - 1].w) ed[Ev[i - 1].w] = i - 1, st[Ev[i].w] = i;     ed[Ev[m].w] = m;     sol(1, m, 1, ltot);     h[0] = -1;     for (int i = 1; i <= m; ++i) printf( %d n , h[ans[i]]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long modpow(long long a, long long b,                    long long mod = (long long)(1e9 + 7)) {     if (!b) return 1;     a %= mod;     return modpow(a * a % mod, b / 2, mod) * (b & 1 ? a : 1) % mod;   }   mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());   const int DEBUG = 1;   const int mxn = 2e5 + 7;   int n, k;   int dsu[mxn], sz[mxn], mini[mxn], maxi[mxn];   bool ac[mxn];   string ans;   int a[mxn], b[mxn];   void init() {     for (int i = 0; i < mxn; i++)       ac[i] = 0, dsu[i] = i, sz[i] = 1, mini[i] = i, maxi[i] = i;   }   int root(int i) { return dsu[i] = dsu[i] == i ? i : root(dsu[i]); }   void merge(int i, int j) {     if (!(0 <= i && i <= n - 1) || !(0 <= j && j <= n - 1)) return;     i = root(i);     j = root(j);     if (i == j) return;     if (sz[i] < sz[j]) swap(i, j);     dsu[j] = i;     sz[i] += sz[j];     (mini[i]) = min((mini[i]), (mini[j]));     (maxi[i]) = max((maxi[i]), (maxi[j]));   }   void activate(int i) {     ac[i] = 1;     if (i && ac[i - 1]) merge(i, i - 1);     if ((0 <= i + 1 && i + 1 <= n - 1) && ac[i + 1]) merge(i, i + 1);   }   void solve() {     scanf( %d , &n);     scanf( %d , &k);     for (int i = 0; i < n; i++) scanf( %d , &a[i]);     init();     ans = string(n,    );     for (int i = 0; i < n; i++) b[--a[i]] = i;     int t = 0;     for (int i = n - 1; i >= 0; i--)       if (!ac[b[i]]) {         activate(b[i]);         ans[b[i]] =  1  + t;         int cnt = k, j = b[i];         while (cnt-- && j < n) {           if (ac[j]) j = maxi[root(j)] + 1;           if (j >= n) break;           activate(j);           ans[j++] =  1  + t;         }         cnt = k;         j = b[i];         while (cnt-- && j >= 0) {           if (ac[j]) j = mini[root(j)] - 1;           if (j < 0) break;           activate(j);           ans[j--] =  1  + t;         }         t ^= 1;       }     cout << ans << endl;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline int Abs(int x) { return x > 0 ? x : -x; }   set<int> peo;   set<int>::iterator p1, p2;   bool vis[200050], boy[200050];   char s[200050];   int a[200050];   struct node {     int l, r;     int val;     node(int a = 0, int b = 0, int c = 0) : l(a), r(b), val(c) {}     bool operator<(const node &x) const {       if (val != x.val) return x.val > val;       if (x.l != l) return x.l > l;       return x.r > r;     }   };   set<node> myset;   set<node>::iterator it;   vector<node> ans;   void work() {     while (myset.size()) {       it = myset.begin();       node u = *it;       myset.erase(it);       if (vis[u.l] || vis[u.r]) continue;       vis[u.l] = vis[u.r] = 1;       ans.push_back(u);       p1 = peo.find(u.l);       if (p1 == peo.begin()) {         peo.erase(p1);         peo.erase(u.r);         continue;       }       p2 = peo.find(u.r);       p2++;       if (p2 == peo.end()) {         peo.erase(p1);         peo.erase(u.r);         continue;       }       p1--;       peo.erase(u.l);       peo.erase(u.r);       u.l = *p1;       u.r = *p2;       if (boy[u.l] == boy[u.r]) continue;       u.val = Abs(a[u.l] - a[u.r]);       myset.insert(u);     }   }   int n;   int main() {     int i, j;     while (cin >> n) {       myset.clear();       peo.clear();       scanf( %s , s + 1);       for (i = 1; i <= n; i++) scanf( %d , &a[i]);       boy[1] = (s[1] ==  B );       for (i = 1; i <= n; i++) {         peo.insert(i);         boy[i + 1] = (s[i + 1] ==  B );         if (i < n && boy[i] != boy[i + 1])           myset.insert(node(i, i + 1, Abs(a[i] - a[i + 1])));       }       memset(vis, 0, sizeof vis);       ans.clear();       work();       cout << ans.size() << endl;       for (i = 0; i < ans.size(); i++) printf( %d %d n , ans[i].l, ans[i].r);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct custom_hash {     static uint64_t splitmix64(uint64_t x) {       x += 0x9e3779b97f4a7c15;       x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;       x = (x ^ (x >> 27)) * 0x94d049bb133111eb;       return x ^ (x >> 31);     }     size_t operator()(uint64_t x) const {       static const uint64_t FIXED_RANDOM =           chrono::steady_clock::now().time_since_epoch().count();       return splitmix64(x + FIXED_RANDOM);     }   };   const long long MOD = 1e9 + 7;   const long long INF = 1e9 + 8;   const double pi = 3.14159265359;   long long binpow(long long a, long long b, long long m) {     a %= m;     long long res = 1;     while (b > 0) {       if (b & 1) res = res * a % m;       a = a * a % m;       b >>= 1;     }     return res;   }   long long inverse(long long x) { return binpow(x, MOD - 2, MOD); }   void solve() {     long long n, x;     cin >> n >> x;     if (n <= 2) {       cout << 1 << endl;       return;     }     cout << (n - 3) / x + 2 << endl;   }   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(0), cout.tie(0);     long long t;     cin >> t;     while (t--) solve();     cerr <<  Time elapsed :   << 1.0 * clock() / CLOCKS_PER_SEC <<   sec  n  ;   }
#include <bits/stdc++.h>   using namespace std;   long long num[100010];   int main() {     int n, q, req;     while (~scanf( %d%d%d , &n, &q, &req)) {       bool res[100010];       res[0] = true;       res[n + 1] = true;       for (int i = 1; i <= n; i++) {         scanf( %d , &num[i]);         if (num[i] <= req)           res[i] = true;         else           res[i] = false;       }       int qiu = 0;       bool flag = true;       for (int i = 1; i <= n; i++) {         if (flag == true && res[i] == false) {           qiu++;           flag = false;         }         if (res[i] == true) flag = true;       }       for (int i = 0; i < q; i++) {         int cur;         scanf( %d , &cur);         if (cur == 0) {           cout << qiu << endl;         } else {           int a;           long long b;           scanf( %d%lld , &a, &b);           num[a] += b;           if (res[a] == true && num[a] > req) {             res[a] = false;             if (res[a - 1] == false && res[a + 1] == false) qiu--;             if (res[a - 1] == true && res[a + 1] == true) qiu++;           }         }       }     }   }
#include <bits/stdc++.h>   using namespace std;   const long long int mod = 1e9 + 7;   long long int t, n, m;   set<long long int> vis;   queue<long long int> q;   vector<long long int> temp, v[500005], g[500005];   int main() {     ios_base::sync_with_stdio(0);     cin.tie(NULL);     cout.tie(NULL);     long long int i, j, k, x, y;     cin >> n >> m;     for (i = 1; i <= m; i++) {       cin >> x >> y;       g[x].push_back(y);       g[y].push_back(x);     }     for (i = 1; i <= n; i++) {       sort(g[i].begin(), g[i].end());       vis.insert(i);     }     long long int comp = 0;     for (i = 1; i <= n; i++) {       if (vis.find(i) == vis.end())         continue;       else         x = i;       vis.erase(x);       q.push(x);       comp++;       while (!q.empty()) {         x = q.front();         q.pop();         v[comp].push_back(x);         temp.clear();         for (auto it : vis) {           if (!binary_search(g[x].begin(), g[x].end(), it)) {             temp.push_back(it);             q.push(it);           }         }         for (auto it : temp) vis.erase(it);       }     }     cout << comp <<   n ;     for (i = 1; i <= comp; i++) {       cout << v[i].size() <<    ;       for (auto it : v[i]) cout << it <<    ;       cout <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double pi = acos(-1);   const int N = (int)1e6 + 7, mod = 1000000007, M = 2e9, lvl = 21;   char s[N];   int n, c[10], x[4] = {1, 6, 8, 9};   vector<int> base, a;   void push(int x) {     a.push_back(x / 100);     x %= 100;     a.push_back(x / 10);     x %= 10;     a.push_back(x);   }   bool div7() {     if (a.size() <= 4) {       int ret = a.back();       a.pop_back();       if (a.empty()) return ret % 7 == 0;       ret += a.back() * 10;       a.pop_back();       if (a.empty()) return ret % 7 == 0;       ret += a.back() * 100;       a.pop_back();       if (a.empty()) return ret % 7 == 0;       ret += a.back() * 1000;       a.pop_back();       if (a.empty()) return ret % 7 == 0;     }     int t = a.back() * 2, bg;     a.pop_back();     bg = a.back();     a.pop_back();     bg += a.back() * 10;     a.pop_back();     bg += a.back() * 100;     a.pop_back();     push(bg - t);     return div7();   }   void print() {     for (int i : base) printf( %d , i);     for (int i = 0; i < 4; i++) printf( %d , x[i]);     while (c[0]--) printf( 0 );     exit(0);   }   int main() {     scanf( %s , s);     n = strlen(s);     for (int i = 0; i < n; i++) c[s[i] -  0 ]++;     c[1]--;     c[6]--;     c[8]--;     c[9]--;     for (int i = 1; i <= 9; i++) {       while (c[i]--) base.push_back(i);     }     do {       a.clear();       for (int i : base) a.push_back(i);       for (int i = 0; i < 4; i++) a.push_back(x[i]);       if (div7()) print();       n++;     } while (next_permutation(x, x + 4));     puts( 0 );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, num;     scanf( %d , &n);     int f = 0;     int pre = 0;     bool ans = 1;     for (int i = 0; i < n; i++) {       scanf( %d , &num);       if ((f == 1 && num > pre) || (f == 2 && num >= pre)) ans = 0;       if (num == pre) f = 1;       if (num < pre) f = 2;       pre = num;     }     if (ans)       printf( YES n );     else       printf( NO n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int t;     cin >> t;     while (t--) {       int n, k;       cin >> n >> k;       vector<int> a(n, 0);       for (int i = 0; i < n; i++) cin >> a[i];       vector<int> prev(n, 0);       prev[0] = 0;       int m = -1;       int s = 0;       int l = 0;       int r = 0;       for (int i = 1; i < n - 1; i++) {         if (a[i] > a[i + 1] && a[i - 1] < a[i]) {           s++;         }         prev[i] = s;       }       for (int i = n - 1; i >= k - 1; i--) {         if (prev[i - 1] - prev[i - k + 1] >= m) {           m = prev[i - 1] - prev[i - k + 1];           l = i - k + 1;         }       }       cout << m + 1 <<     << l + 1 << endl;     }   }
#include <bits/stdc++.h>   long long mod = 1e9 + 7, mod2 = 998244353;   const int N = int(3e5) + 999;   using namespace std;   long long fac[10000000];   long long gcd(long long x, long long y) {     if (y == 0) return x;     return gcd(y, x % y);   }   long long fexp(long long a, long long b, long long m) {     long long ans = 1;     while (b) {       if (b & 1) ans = ans * a % m;       b /= 2;       a = a * a % m;     }     return ans;   }   long long inverse(long long a, long long p) { return fexp(a, p - 2, p); }   long long ncr(long long n, long long r, long long p) {     if (r == 0) return 1;     return (fac[n] * inverse(fac[n - r], p) % p * inverse(fac[r], p) % p) % p;   }   vector<long long> za(string s) {     long long n = s.size();     vector<long long> z(n);     long long x = 0, y = 0, p = 0;     for (long long i = 1; i < n; i++) {       z[i] = max(p, min(z[i - x], y - i + 1));       while (i + z[i] < n && s[z[i]] == s[i + z[i]]) {         x = i;         y = i + z[i];         z[i]++;       }     }     return z;   }   void subset(long long a[], long long k) {     for (int i = 1; i < pow(2, k); i++) {       for (int j = 0; j < k; j++) {         if (i & 1 << j) {           cout << a[j] <<    ;         }       }       cout << endl;     }   }   vector<long long> pr(string s) {     long long n = s.length();     vector<long long> pi(n);     for (int i = 1; i < n; i++) {       int j = pi[i - 1];       while (j > 0 && s[i] != s[j]) j = pi[j - 1];       if (s[i] == s[j]) j++;       pi[i] = j;     }     return pi;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     long long n, val;     cin >> n;     long long a[n], c1 = 0, c2 = 0, ans = 0, t = 0;     for (long long i = 0; i < n; i++) {       cin >> a[i];       if (t % 2 == 0)         c1++;       else         c2++;       if (a[i] < 0) t++;       if (t % 2 == 0)         ans += c1;       else         ans += c2;     }     cout << n * (n + 1) / 2 - ans <<     << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T, typename U>   inline void chkmax(T& x, U y) {     if (x < y) x = y;   }   template <typename T, typename U>   inline void chkmin(T& x, U y) {     if (y < x) x = y;   }   int main() {     int h, m, s, A, B;     scanf( %d%d%d%d%d , &h, &m, &s, &A, &B);     double a = h % 12 + 1.0 * m / 60 + 1.0 * s / 3600;     double b = 0.2 * m + 1.0 * s / 300;     double c = 0.2 * s;     for (int i = 0; i < 2; i++) {       bool flg = 1;       for (int x = A; x != B; x = x % 12 + 1) {         if (x % 12 <= a && a <= x % 12 + 1) flg = 0;         if (x % 12 <= b && b <= x % 12 + 1) flg = 0;         if (x % 12 <= c && c <= x % 12 + 1) flg = 0;       }       if (flg) return puts( yes ), 0;       swap(A, B);     }     puts( no );     return 0;   }
#include <bits/stdc++.h>   using namespace std;      int main() {    ios_base::sync_with_stdio(false);    cin.tie(NULL);        long long int T;    cin>>T;    while(T--)    {     string S;     cin>>S;          long long int A[100];     long long int x=0;     long long int val=0;     long long int N=S.length();          long long int first,mid,last;     A[0]=0;A[1]=0;A[2]=0;     string str=  ;          for(long long int i=0;i<N;i++)     {         char c;         c=S[i];         if(c== ? )         A[x]++;         else          {             str+=c;             x++;         }              }             // cout<<A[0]<<   <<A[1]<<   <<A[2]<<endl;     if(str== () )     {        val=1;                       }     else if(str== )( )     {         if((A[0]>=1)&&(A[2]>=1))         {             val=1;         }     }          if(val==0)     cout<< NO <<endl;     else if(val==1&&(N%2==0))     cout<< YES <<endl;     else     cout<< NO <<endl;                 }    return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1005;   const int inf = 1000 * 1000 * 1000;   const int mod = 1000 * 1000 * 1000 + 7;   mt19937 myrand(chrono::steady_clock::now().time_since_epoch().count());   int n, s, d;   bitset<N> a[(1 << 20) + 2];   bitset<N> b[(1 << 10) + 2];   bitset<N> mas[33];   bitset<N> A;   int cnt[(1 << 20) + 2];   unordered_map<bitset<N>, int> mp;   int main() {     cin >> n >> s >> d;     for (int i = 1; i <= s; i++) {       int c;       scanf( %d , &c);       mas[i] = 0;       while (c--) {         int a;         scanf( %d , &a);         mas[i][a] = 1;       }     }     int x = min(s, 20);     int y = s - x;     cnt[0] = 0;     for (int i = 1; i < (1 << 20); i++) {       for (int j = 0; j < 20; j++) {         if ((i >> j) & 1) {           cnt[i]++;         }       }     }     b[0] = 0;     mp[b[0]] = 0;     for (int i = 1; i < (1 << x); i++) {       int pos;       for (int j = 0; j < x; j++) {         if ((i >> j) & 1) {           pos = j;           break;         }       }       b[i] = b[i ^ (1 << pos)] ^ mas[pos + 1];       if (mp.find(b[i]) == mp.end()) {         mp[b[i]] = cnt[i];       } else {         mp[b[i]] = min(mp[b[i]], cnt[i]);       }     }     a[0] = 0;     for (int i = 1; i < (1 << y); i++) {       int pos;       for (int j = 0; j < y; j++) {         if ((i >> j) & 1) {           pos = j;           break;         }       }       a[i] = a[i ^ (1 << pos)] ^ mas[pos + 1 + x];     }     while (d--) {       int c;       scanf( %d , &c);       A = 0;       while (c--) {         int a;         scanf( %d , &a);         A[a] = 1;       }       int answ = inf;       for (int i = 0; i < (1 << y); i++) {         if (mp.find(A ^ a[i]) != mp.end()) {           answ = min(answ, cnt[i] + mp[A ^ a[i]]);         }       }       if (answ == inf) answ = -1;       printf( %d n , answ);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       int n, i, k = 0;       cin >> n;       int a[n];       map<int, int> m;       set<int> s;       for (i = 0; i < n; i++) {         cin >> a[i];         m[a[i]]++;         k = max(k, m[a[i]]);       }       for (i = 0; i < n; i++) s.insert(a[i]);       int mx = s.size();       int ans = max(min(mx - 1, k), min(mx, k - 1));       cout << ans <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     ;     int n, t;     cin >> t;     while (t--) {       cin >> n;       for (int i = 0; i < n; i++) {         cout << n - i <<    ;       }       cout <<   n ;     }   }
#include <bits/stdc++.h>   struct help {     long int money;     long int friends;   };   void fusion_sort(struct help *p, long int n);   void bablesort(struct help *p, long int n);   int main() {     long int n, m;     scanf( %ld %ld , &n, &m);     struct help *p = (struct help *)malloc(sizeof(struct help) * n);     for (int i = 0; i < n; i++) scanf( %ld %ld , &p[i].money, &p[i].friends);     if (n == 1) {       printf( %ld , p[0].friends);       return 0;     }     if (n > 1000)       fusion_sort(p, n);     else       bablesort(p, n);     unsigned long long max_friend = 0;     unsigned long long cur_sum = 0;     for (int b = 0, e = 0; e < n;)       if (p[e].money - p[b].money >= m) {         if (cur_sum > max_friend) {           max_friend = cur_sum;         }         cur_sum -= p[b].friends;         b++;       } else {         cur_sum += p[e].friends;         e++;       }     if (cur_sum > max_friend) max_friend = cur_sum;     printf( %lld , max_friend);     return 0;   }   void fusion_sort(struct help *p, long int n) {     if (n > 2) {       fusion_sort(p, n / 2);       fusion_sort((p + n / 2), n / 2 + n % 2);     }     struct help temp;     for (int i = 0, j = n / 2; i < j && j < n; i++)       if (p[i].money > p[j].money) {         temp.friends = p[j].friends;         temp.money = p[j].money;         for (int k = j; k > i; k--) {           p[k].friends = p[k - 1].friends;           p[k].money = p[k - 1].money;         }         p[i].friends = temp.friends;         p[i].money = temp.money;         j++;       }   }   void bablesort(struct help *p, long int n) {     long int fr;     long int mo;     while (n > 1) {       for (int i = 0; i < n - 1; i++)         if (p[i].money > p[i + 1].money) {           fr = p[i].friends;           mo = p[i].money;           p[i].friends = p[i + 1].friends;           p[i].money = p[i + 1].money;           p[i + 1].friends = fr;           p[i + 1].money = mo;         }       n--;     }   }