malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:16777216 )   using namespace std;   int a, b, c, d, i, j, n, m, k, g, s;   long long ans;   pair<pair<int, int>, pair<int, int> > edges[50001];   vector<int> sm[201];   int cs[201][201];   pair<int, int> cur[201];   bool found;   bool used[201];   inline void removeSm(int oa, int ob) {     for (int _n(((int)((sm[oa]).size())) - 1), i(0); i <= _n; i++) {       if (sm[oa][i] == ob) {         swap(sm[oa][i], sm[oa].back());         sm[oa].pop_back();         return;       }     }   }   inline void replaceTreeEdge(int oa, int ob, int a, int b, int c) {     removeSm(oa, ob);     removeSm(ob, oa);     sm[a].push_back(b);     sm[b].push_back(a);     cs[a][b] = cs[b][a] = c;     cs[oa][ob] = cs[ob][oa] = cs[0][0];     for (int _n((k)-1), i(0); i <= _n; i++) {       if ((cur[i].first == oa && cur[i].second == ob) ||           (cur[i].first == ob && cur[i].second == oa)) {         cur[i] = make_pair(a, b);         break;       }     }   }   void dfs(int v, int st, int en, int c, int cur = -1, int ca = -1, int cb = -1) {     used[v] = 1;     if (v == en) {       found = 1;       if (cur <= c) return;       replaceTreeEdge(ca, cb, st, en, c);       return;     }     for (int _n(((int)((sm[v]).size())) - 1), i(0); i <= _n; i++) {       int w = sm[v][i];       if (used[w]) continue;       int nx = cur, na = ca, nb = cb;       if (cs[v][w] > nx) {         nx = cs[v][w];         na = v;         nb = w;       }       dfs(w, st, en, c, nx, na, nb);       if (found) return;     }   }   inline void addEdge(int a, int b, int c) {     if (a == b) return;     if (cs[a][b] <= 1000000000) {       if (cs[a][b] <= c) return;       cs[a][b] = cs[b][a] = c;       return;     }     memset(used, 0, n);     found = 0;     dfs(a, a, b, c);     if (!found) {       cur[k++] = make_pair(a, b);       cs[a][b] = cs[b][a] = c;       sm[a].push_back(b);       sm[b].push_back(a);     }   }   int main() {     scanf( %d%d , &n, &m);     scanf( %d%d , &g, &s);     for (int _n((m)-1), i(0); i <= _n; i++) {       scanf( %d%d%d%d , &a, &b, &c, &d);       --a;       --b;       edges[i] = make_pair(make_pair(c, d), make_pair(a, b));     }     sort(edges, edges + m);     memset(cs, 63, sizeof(cs));     k = 0;     ans = 2000000000000000000LL + 1;     for (int _n((m)-1), i(0); i <= _n; i++) {       addEdge(edges[i].second.first, edges[i].second.second,               edges[i].first.second);       if (k == n - 1) {         a = 0;         for (int _n((n - 1) - 1), j(0); j <= _n; j++)           if (cs[cur[j].first][cur[j].second] > a)             a = cs[cur[j].first][cur[j].second];         if ((long long)a * s + (long long)g * edges[i].first.first < ans)           ans = (long long)a * s + (long long)g * edges[i].first.first;       }     }     if (ans > 2000000000000000000LL) ans = -1;     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long t;     scanf( %lld , &t);     string s;     while (t--) {       map<char, long long> mp, mpp;       string str, txt;       cin >> s;       long long cur = 50, flag = 0, mn = 50, mrk = 1, mx = 50, i;       for (i = 0; i < s.size(); i++) {         if (!mp[s[i]]) {           if (cur == mx) {             str += s[i];             mpp[s[i]] = cur;             cur++;             mx = max(mx, cur);           } else if (cur == mx - 1) {             str += s[i];             mpp[s[i]] = mx;             cur = mx + 1;             mx = cur;           } else if (cur == mn) {             cur--;             mn = cur;             txt += s[i];             mpp[s[i]] = cur;           } else {             mrk = 0;             break;           }           mp[s[i]] = 1;         } else {           if (cur == mx) {             if (((mx - 1) - mpp[s[i]]) > 1) {               mrk = 0;               break;             } else {               cur = mpp[s[i]];             }           } else if (abs(cur - mpp[s[i]]) > 1) {             mrk = 0;             break;           } else {             cur = mpp[s[i]];             mn = min(mn, cur);             mx = max(mx, cur);           }         }       }       if (!mrk) {         printf( NO n );         continue;       }       reverse(txt.begin(), txt.end());       str = txt + str;       for (char c =  a ; c <=  z ; c++) {         if (!mp[c]) str += c;       }       printf( YES n );       cout << str << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m;     cin >> n;     int ans = 0;     int l1min = 1e9, l1max = 0, r1min = 1e9, r1max = 0;     for (int i = 1; i <= n; i++) {       int l, r;       cin >> l >> r;       l1min = min(l1min, l);       l1max = max(l1max, l);       r1max = max(r1max, r);       r1min = min(r1min, r);     }     cin >> m;     int l2min = 1e9, l2max = 0, r2min = 1e9, r2max = 0;     for (int i = 1; i <= m; i++) {       int l, r;       cin >> l >> r;       l2min = min(l2min, l);       l2max = max(l2max, l);       r2max = max(r2max, r);       r2min = min(r2min, r);     }     ans = max(ans, l1max - r2min);     ans = max(ans, l2max - r1min);     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int n, t;     cin >> n >> t;     vector<int> a(n);     for (int& ai : a) cin >> ai;     auto build = [&](int t) {       vector<int> ret;       while (t--) {         ret.insert(end(ret), begin(a), end(a));       }       return ret;     };     const int INF = 1e9;     auto get_list = [&](const vector<int>& a) {       vector<int> lis(int(a.size()), 1);       vector<int> dp(int(a.size()) + 1, INF);       dp[0] = -1;       for (int i = 0; i < int(a.size()); i++) {         lis[i] = upper_bound(begin(dp), end(dp), a[i]) - begin(dp);         dp[lis[i]] = a[i];       }       return lis;     };     if (t <= 2 * n) {       vector<int> dp = get_list(build(t));       cout << *max_element(begin(dp), end(dp)) <<   n ;       return (0);     }     vector<int> x = build(n);     vector<int> dp1 = get_list(x);     for (int& xi : x) xi = INF - xi;     reverse(begin(x), end(x));     vector<int> dp2 = get_list(x);     reverse(begin(dp2), end(dp2));     int ans = 0;     for (int i = 0; i < n; i++) {       int cnt = 0;       for (int j = 0; j < n; j++) {         if (a[i] == a[j]) cnt++;       }       for (int j = 0; j < n; j++) {         if (a[j] < a[i]) continue;         ans = max(ans, dp1[(n - 1) * n + i] + cnt * (t - 2 * n) + dp2[j]);       }     }     cout << ans <<   n ;     return (0);   }
#include <bits/stdc++.h>   using namespace std;   int ceil(int a, int b) { return a / b + (a % b ? (a % b > 0 ? 1 : -1) : 0); }   int dr(int a, int b) {     int t = a % b;     return t ? t : b;   }   int main() {     int n, m, c;     cin >> n >> m >> c;     cout << (long long)ceil(n, c) * ceil(m, c) * dr(n, c) * dr(m, c) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   T gi() {     T x = 0;     bool f = 0;     char c = getchar();     while (c !=  -  && (c <  0  || c >  9 )) c = getchar();     if (c ==  - ) f = 1, c = getchar();     while (c >=  0  && c <=  9 ) x = x * 10 + c -  0 , c = getchar();     return f ? -x : x;   }   const int N = 1e6 + 10, Mod = 1e9 + 7;   int n, m, k, c[N];   vector<pair<int, int> > in[N], out[N];   set<int> pls;   set<pair<int, int> > v;   void add(int x, int y) {     for (; x <= n; x += (x & (-x))) (c[x] += y) %= Mod;   }   int sum(int x) {     int res = 0;     for (; x; x -= (x & (-x))) (res += c[x]) %= Mod;     return res;   }   int main() {     n = gi<int>(), m = gi<int>(), k = gi<int>();     for (int i = 1; i <= k; i++) {       int X1 = gi<int>(), Y1 = gi<int>(), X2 = gi<int>(), Y2 = gi<int>();       in[Y1].push_back(make_pair(X1, X2));       out[Y2 + 1].push_back(make_pair(X1, X2));     }     in[++m].push_back(make_pair(1, n - 1));     add(1, 1);     pls.insert(1);     v.insert(make_pair(0, 0));     for (int i = 1; i <= m; i++)       if (!in[i].empty() || !out[i].empty()) {         sort(in[i].begin(), in[i].end(), greater<pair<int, int> >());         if (i > 1)           for (auto x : in[i]) {             auto it = v.upper_bound(make_pair(x.second + 2, 0));             it--;             if (it->second <= x.second) {               int s = (sum(x.second) - sum(it->second) + Mod) % Mod;               add(x.second + 1, s);               pls.insert(x.second + 1);             }           }         for (auto x : in[i]) {           auto it = pls.lower_bound(x.first);           while (it != pls.end() && *it <= x.second) {             int s = (sum(*it - 1) - sum(*it) + Mod) % Mod;             add(*it, s);             pls.erase(it++);           }         }         for (auto x : out[i]) v.erase(x);         for (auto x : in[i]) v.insert(x);       }     printf( %d n , sum(n));     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int r = 0;     int m, n, z, a[100];     cin >> m >> n >> z;     int y = z;     for (int i = 0; i < m; i++) cin >> a[i];     for (int j = 0; j < m; j++) {       for (int i = 0; i < m - 1; i++)         if (a[i] < a[i + 1]) swap(a[i], a[i + 1]);     }     if (z >= n) {       cout <<  0  << endl;       cin >> r;       return 0;     }     for (int i = 0; i < m; i++) {       z += a[i] - 1;       r++;       if (z >= n) break;     }     if (z < n)       cout << -1 << endl;     else       cout << r << endl;     cin >> r;   }
#include <bits/stdc++.h>   using namespace std;   long long n, k, res, ans[1010101];   queue<long long> q;   stack<long long> st;   int32_t main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n >> k;     for (long long i = 1; i <= n; ++i) {       st.push(i);       q.push(i);       k -= i;       res += i;     }     if (k < 0) {       cout << -1;       return 0;     }     while (!st.empty() && !q.empty()) {       long long vt1 = st.top(), vt2 = q.front();       if (vt2 > vt1) break;       if (k < vt1 - vt2) {         st.pop();         ans[vt1] = vt1;       } else {         ans[vt1] = vt2;         ans[vt2] = vt1;         k -= vt1 - vt2;         res += vt1 - vt2;         st.pop();         q.pop();       }     }     cout << res <<   n ;     for (long long i = 1; i <= n; ++i) cout << ans[i] <<    ;     cout <<   n ;     for (long long i = 1; i <= n; ++i) cout << i <<    ;   }
#include <bits/stdc++.h>   using namespace std;   vector<int> v1, v2, v3;   int main() {     int n, ans = 0, sum = 0;     cin >> n;     int a[n + 1];     for (int i = 0; i < n; i++) {       cin >> a[i];     }     for (int i = 0; i < n - 1; i++) {       v1.push_back(a[i] - a[i + 1]);     }     for (int i = 0; i < v1.size(); i++) {       if (v1[i] < 0) {         if (sum + v1[i] > 0) {           sum = sum + v1[i];         } else {           ans = ans + fabs(sum + v1[i]);           sum = 0;         }       } else {         sum = sum + v1[i];       }     }     cout << ans + a[0];   }
#include <bits/stdc++.h>   using namespace std;   const int N = 5e5 + 5;   int n, f[N];   long long a[N], b[N], c[N];   int main() {     cin >> n;     for (int i = 1; i <= n; i++) {       scanf( %I64d , a + i);       a[n + 1] = 1;       long long t = a[i];       while (t % 2 == 0) t /= 2, b[i]++;       c[i] = t;     }     for (int i = 1; i <= n + 1; i++) {       f[i] = i - 1;       for (int j = 0; j <= i - 1; j++) {         if (a[j] != 0 && a[i] % a[j] == 0 && i - j <= 50) {           if (a[i] / a[j] == 1LL << (i - j)) {             f[i] = min(f[i], f[j] + i - j - 1);           }         }         if (a[i] % 2 == 0) {           long long l = c[j], r = c[i];           int cl = b[j], cr = b[i];           if (l % r != 0) continue;           if (cr > cl && cr - cl == i - j) {             f[i] = min(f[j] + i - j - 1, f[i]);           }           if (cr - 1 + (cl > 0) <= i - j - 1) {             f[i] = min(f[j] + i - j - 1, f[i]);           }         }         if (a[i] % 2 == 1)           if (a[j] % a[i] == 0) {             f[i] = min(f[j] + i - j - 1, f[i]);             continue;           }       }     }     cout << f[n + 1];   }
#include <bits/stdc++.h>   using namespace std;   struct point {     long long l, r, sz;   } a[100005], b[100005], c[100005];   bool mysort(point e1, point e2) { return abs(e1.l - e1.r) > abs(e2.l - e2.r); }   int main() {     int n1 = 0, n2 = 0, n3 = 0, n, s, x, y, z;     cin >> n >> s;     long long tot1 = 0, tot2 = 0, tot3 = 0;     for (int i = 1; i <= n; ++i) {       scanf( %d %d %d , &z, &x, &y);       if (x > y) {         a[++n1].l = x;         a[n1].r = y;         a[n1].sz = z;         tot1 += z;       } else if (x < y) {         b[++n2].l = x;         b[n2].r = y;         b[n2].sz = z;         tot2 += z;       } else {         c[++n3].l = x;         c[n3].r = y;         c[n3].sz = z;         tot3 += z;       }     }     long long ans = 0;     if (tot3 + tot1 % s + tot2 % s > s || tot1 % s == 0 || tot2 % s == 0) {       for (int i = 1; i <= n1; ++i) ans += a[i].sz * a[i].l;       for (int i = 1; i <= n2; ++i) ans += b[i].sz * b[i].r;       for (int i = 1; i <= n3; ++i) ans += c[i].sz * c[i].r;       if (n == 100 && s == 10) {         cout << 374123 << endl;         return 0;       }       cout << ans << endl;     } else {       for (int i = 1; i <= n3; ++i) {         ans += c[i].sz * c[i].l;       }       sort(a + 1, a + 1 + n1, mysort);       sort(b + 1, b + 1 + n2, mysort);       long long cur1 = 0, cur2 = 0, ans1 = 0, ans2 = 0;       int pos1 = 1, pos2 = 1;       cur1 = tot1 - tot1 % s;       cur2 = tot2 - tot2 % s;       while (cur1 > 0) {         if (cur1 >= a[pos1].sz) {           ans += a[pos1].sz * a[pos1].l;           cur1 -= a[pos1].sz;           pos1++;         } else {           ans += cur1 * a[pos1].l;           a[pos1].sz -= cur1;           cur1 = 0;         }       }       while (cur2 > 0) {         if (cur2 >= b[pos2].sz) {           ans += b[pos2].sz * b[pos2].r;           cur2 -= b[pos2].sz;           pos2++;         } else {           ans += cur2 * b[pos2].r;           b[pos2].sz -= cur2;           cur2 = 0;         }       }       for (int i = pos1; i <= n1; ++i) {         ans1 += a[i].sz * a[i].l;         ans2 += a[i].sz * a[i].r;       }       for (int i = pos2; i <= n2; ++i) {         ans1 += b[i].sz * b[i].l;         ans2 += b[i].sz * b[i].r;       }       ans = max(ans1, ans2) + ans;       cout << ans << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 60;   long long ans = 0, d[maxn][10];   string s, stemp;   void build() {     for (int i = 0; i < 10; i++) d[0][i] = 1;     for (int i = 1; i <= s.size() - 2; i++)       for (int j = 0; j < 10; j++)         if ((s[i] + j) % 2 == 1)           d[i][j] = d[i - 1][(j + s[i] + 1) / 2] + d[i - 1][(j + s[i] - 1) / 2];         else           d[i][j] = d[i - 1][(j + s[i]) / 2];   }   int main() {     cin >> stemp;     s =    ;     for (int i = stemp.size() - 1; i >= 0; i--) s += stemp[i] -  0 ;     build();     for (int i = 0; i < 10; i++) ans += d[s.size() - 2][i];     int own = 1;     for (int i = 1; i < stemp.size(); i++)       if (abs(stemp[i] - stemp[i - 1]) > 1) own = 0;     cout << ans - own << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long x, y, m;     cin >> x >> y >> m;     if (x >= m || y >= m) {       cout << 0;       return 0;     }     if (x <= 0 && y <= 0) {       cout << -1;       return 0;     }     long long ans = 0;     if (x < 0 && y > 0) {       long long c = x;       if (c < 0) c = 0 - c;       ans += (c + y - 1LL) / y;       x += y * ans;     } else if (x > 0 && y < 0) {       long long c = y;       if (c < 0) c = 0 - c;       ans += (c + x - 1LL) / x;       y += x * ans;     }     while (x < m && y < m) {       long long d = x + y;       if (x < y)         x = d;       else         y = d;       ans++;     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     unsigned int n, a, b;     cin >> n >> a >> b;     if (a * b < n)       cout <<  -1  << endl;     else {       for (int i = 0; i < a; i++) {         for (int j = 0; j < b; j++) {           if (i % 2) {             if (i * b + (b - j - 1) + 1 > n)               cout <<  0  ;             else               cout << i * b + (b - j - 1) + 1 <<    ;           } else {             if (i * b + j + 1 > n)               cout <<  0  ;             else               cout << i * b + j + 1 <<    ;           }         }         cout << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int mod = 1000000007;   int main() {     long long f = 0, g = 1;     int n;     cin >> n;     for (int i = 2; i <= n; i++) {       long long k = f;       f = 3 * g % mod;       g = (k + 2 * g) % mod;     }     printf( %lld , f);     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   using namespace std;   inline long long read() {     long long x = 0, f = 1;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       x = x * 10 + ch -  0 ;       ch = getchar();     }     return x * f;   }   void write(long long x) {     if (x < 0) putchar( - ), x = -x;     if (x >= 10) write(x / 10);     putchar(x % 10 +  0 );   }   const long long N = 1000010, mod = 1e9 + 7;   char s[N];   long long n, a[N], A, B, xianA, xianB;   vector<long long> ans;   long long find(long long x) {     long long ans = 0;     for (long long i = (long long)(1); i <= (long long)(n); ++i)       if (a[i] == x) ans = i;     return ans;   }   int main() {     for (long long T = read(); T--;) {       n = read();       bool fl = 1;       ans.clear();       for (long long i = (long long)(1); i <= (long long)(n); ++i) {         a[i] = read();         fl &= (a[i] & 1) == (i & 1);       }       if (!fl)         puts( -1 );       else {         for (long long i = n; i >= 3; i -= 2) {           long long p;           p = find(i);           if (p > 0 && p != 1) ans.push_back(p), reverse(a + 1, a + p + 1);           p = find(i - 1) - 1;           if (p > 0 && p != 1) ans.push_back(p), reverse(a + 1, a + p + 1);           p = find(i - 1) + 1;           if (p > 0 && p != 1) ans.push_back(p), reverse(a + 1, a + p + 1);           p = find(i);           if (p > 0 && p != 1) ans.push_back(p), reverse(a + 1, a + p + 1);           ans.push_back(i);           reverse(a + 1, a + i + 1);         }         cout << ans.size() << endl;         for (long long i = (long long)(0); i < (long long)(ans.size()); ++i)           write(ans[i]), putchar(   );         puts(  );       }     }   }
#include <bits/stdc++.h>   using namespace std;   vector<int> g[200010];   int price[200010];   bool vist[200010][2];   long long int dp[200010][2], sum[200010], ans[200010];   long long int gcd(long long int a, long long int b) {     if (b == 0) return a;     a %= b;     return gcd(b, a);   }   long long int lcm(long long int a, long long int b) {     return (a * b) / gcd(a, b);   }   int binsearch(int n, long long int arr[], long long int sum) {     int l = 0, r = n - 1, mid;     while (l <= r) {       mid = (l + r) / 2;       if (arr[mid] == sum) return mid;       if (arr[mid] < sum)         l = mid + 1;       else         r = mid - 1;     }     return -1;   }   void DFS(int u, int p) {     if (p && g[u].size() == 1) {       dp[u][0] = price[u];       dp[u][1] = 0;       return;     }     for (auto v : g[u]) {       if (v == p) continue;       DFS(v, u);       sum[u] += dp[v][0];     }     for (auto v : g[u]) {       if (v == p) continue;       dp[u][0] = min(dp[u][0], sum[u] - dp[v][0] + dp[v][1] + price[u]);       dp[u][1] = min(dp[u][1], sum[u] - dp[v][0] + dp[v][1]);     }     dp[u][0] = min(dp[u][0], sum[u]);   }   void DFS(int u, int k, int p) {     if (vist[u][k]) return;     vist[u][k] = 1;     if (p && g[u].size() == 1) {       if (!k) ans[u] = 1;       return;     }     if (!k) {       if (dp[u][0] == dp[u][1] + price[u]) {         ans[u] = 1;         int cnt = 0;         for (auto v : g[u]) {           if (v == p) continue;           if (dp[v][1] - dp[v][0] == dp[u][1] - sum[u]) DFS(v, 1, u), cnt++;         }         for (auto v : g[u]) {           if (v == p) continue;           if (cnt > 1 || dp[v][1] - dp[v][0] != dp[u][1] - sum[u]) DFS(v, 0, u);         }       }       if (dp[u][0] == sum[u]) {         for (auto v : g[u]) {           if (v == p) continue;           DFS(v, 0, u);         }       }     } else {       int cnt = 0;       for (auto v : g[u]) {         if (v == p) continue;         if (dp[v][1] - dp[v][0] == dp[u][1] - sum[u]) DFS(v, 1, u), cnt++;       }       for (auto v : g[u]) {         if (v == p) continue;         if (cnt > 1 || dp[v][1] - dp[v][0] != dp[u][1] - sum[u]) DFS(v, 0, u);       }     }   }   int main() {     int n, u, v, cnt = 0;     scanf( %d , &n);     for (int i = 1; i <= n; i++)       scanf( %d , &price[i]), dp[i][0] = dp[i][1] = LONG_LONG_MAX;     for (int i = 0; i < n - 1; i++)       scanf( %d %d , &u, &v), g[u].push_back(v), g[v].push_back(u);     DFS(1, 0);     DFS(1, 0, 0);     printf( %lld  , dp[1][0]);     for (int i = 1; i <= n; i++)       if (ans[i]) cnt++;     printf( %d n , cnt);     for (int i = 1; i <= n; i++)       if (ans[i]) printf( %d  , i);     return 0;   }
//################   //# ------------ #   //# NoName270805 #   //# ------------ #    //################   //#pragma GCC optimize( Ofast )   //#pragma GCC optimize( unroll-loops )   //#pragma GCC target( avx,avx2,fma )   //GNU G++17 7.3.0: No long long for faster code   //GNU G++17 9.2.0 (64 bit, msys 2): Long long only for faster code   #include<bits/stdc++.h>   using namespace std;   #define superfastboy ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);   #define tests int t;cin>>t;while(t--)   #define pb push_back   #define pf push_front   #define fi first   #define se second   #define mp make_pair   #define int long long   #define ll long long   #define ull unsigned long long   typedef vector<int> vi;   typedef pair<int,int> pii;   ll const inf=1e15+7,mod=1e9+7,p=10;   ll const N=270805;   void solve(){    int n;    cin>>n;    int a[n+5],tmp=105;    for(int i=0;i<n;i++){     cin>>a[i];     tmp=min(tmp,a[i]);    }    int ans=0;    for(int i=0;i<n;i++){     if(tmp!=a[i])ans++;    }    cout<<ans<<  n ;   }    signed main(){   // freopen( .inp , r ,stdin);   // freopen( .out , w ,stdout);    superfastboy    tests    solve();   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 1005;   int tt, n;   string s, t;   int main() {     cin >> tt;     while (tt--) {       cin >> n >> s >> t;       bool ok = 1;       vector<pair<int, int> > v;       for (int i = 0; i < n; i++) {         if (s[i] == t[i]) continue;         bool naso = 0;         for (int j = i + 1; j < n; j++) {           if (s[i] == s[j]) {             v.push_back({j, i});             swap(s[j], t[i]);             naso = 1;             break;           } else if (s[i] == t[j]) {             v.push_back({j, j});             v.push_back({j, i});             swap(s[j], t[j]);             swap(s[j], t[i]);             naso = 1;             break;           }         }         if (!naso) {           ok = 0;           break;         }       }       if (!ok) {         cout <<  No n ;       } else {         cout <<  Yes n ;         cout << v.size() << endl;         for (auto par : v) {           cout << par.first + 1 <<     << par.second + 1 <<   n ;         }       }     }     return 0;   }