malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m;     cin >> n;     vector<int> a(n, 0);     for (int i = 0; i < n; i++) cin >> a[i];     cin >> m;     vector<int> b(m, 0);     for (int i = 0; i < m; i++) cin >> b[i];     int count = 0;     sort(a.begin(), a.end());     sort(b.begin(), b.end());     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         if (abs(a[i] - b[j]) <= 1) {           count++;           b[j] = INT_MAX;           break;         }       }     }     cout << count <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline int add(int a, int b, int c) {     a += b;     if (a >= c)       a -= c;     else if (a < 0)       a += c;     return a;   }   inline int mul(int a, int b, int c) { return (long long)a * b % c; }   int pow(int a, long long b, int c) {     int res = 1;     for (; b; b /= 2) {       if (b % 2) res = mul(res, a, c);       a = mul(a, a, c);     }     return res;   }   int main() {     int t;     scanf( %d , &t);     while (t--) {       int k, p;       long long l, r;       scanf( %d%I64d%I64d%d , &k, &l, &r, &p);       if (p == 2) {         printf( %d n , !(k % 2));         continue;       }       int prod = 1;       if (k % p) {         int e = pow(2, l, p - 1);         int t = pow(k, e, p);         if (t == 1)           prod = pow(2, r - l + 1, p);         else {           int inv = pow(add(t, -1, p), p - 2, p);           int num =               add(pow(t, add(pow(2, r - l + 1, p - 1), -1, p - 1), p), -1, p);           prod = add(mul(t, mul(num, inv, p), p), 1, p);         }       }       if (k % 2)         prod = mul(prod, pow(2, add(l % (p - 1), -(r % (p - 1)), p - 1), p), p);       printf( %d n , prod);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct milk {     int x, num;     bool operator<(const milk &mm) const { return x < mm.x; }   } b[1000010];   int a[1000010], n, m, k;   bool ok(int p2) {     int p1 = 1, now = 0;     while (p1 <= n || p2 <= m) {       if ((p1 <= n && a[p1] < now) || (p2 <= m && b[p2].x < now)) return 0;       for (int i = 1; i <= k; i++)         if (p1 <= n && (p2 > m || a[p1] < b[p2].x))           p1++;         else           p2++;       now++;     }     return 1;   }   int main() {     int l, r, mid;     scanf( %d%d%d , &n, &m, &k);     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     for (int i = 1; i <= m; i++) {       scanf( %d , &b[i].x);       b[i].num = i;     }     sort(a + 1, a + n + 1);     sort(b + 1, b + m + 1);     if (!ok(m + 1)) {       printf( -1 n );       return 0;     }     l = 1;     r = m + 1;     while (l < r) {       mid = (l + r) / 2;       if (ok(mid))         r = mid;       else         l = mid + 1;     }     printf( %d n , m - l + 1);     for (int i = l; i <= m; i++) printf( %d%c , b[i].num, i == m ?   n  :    );   }
#include <bits/stdc++.h>   using namespace std;   long long gcd(long long x, long long y) {     if (y == 0) return x;     return gcd(y, x % y);   }   void O_o() {     ios::sync_with_stdio(0);     ios_base::sync_with_stdio(0);     cin.tie(0), cout.tie(0);   }   bool prime(int n, int i) {     if (i == n) return true;     if (n % i == 0) return false;     prime(n, i + 1);   }   int arr[1000005], arr1[1000005];   unsigned long long sum = 0;   int main() {     O_o();     int n, s, m;     cin >> n;     for (int i = 1;; i *= 2) {       if (i < 1000005)         arr1[i] = 1;       else         break;     }     for (int i = 1;; i *= 2) {       if (i == n) {         s = ((i * 2) - 1);         break;       } else if (i > n) {         s = i - 1;         break;       }     }     m = n++;     for (int i = 0; i < int(n); i++) {       if (arr[s - m] == 0 && arr[m] == 0) arr[s - m] = m, arr[m] = s - m;       if (arr1[m] == 1) s = m - 1;       if (m == 0) break;       m--;     }     for (int i = 0; i < int(n); i++) sum += (arr[i] ^ i);     cout << sum <<   n ;     for (int i = 0; i < int(n); i++) cout << arr[i] <<    ;     cout <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   bool umin(T& a, const T& b) {     return a > b ? a = b, true : false;   }   template <class T>   bool umax(T& a, const T& b) {     return a < b ? a = b, true : false;   }   template <long long sz>   using tut = array<long long, sz>;   const long long N = 3e5 + 5;   const long long mod = 1e9 + 7;   const long long inf = 1e18;   const long double Pi = acos(-1);   const long long MX = 2e16;   long long n, m, k, t, q, ans, res, a[N];   long long in[N][2], cc[N], cnt[N][2];   long long par[N], sz[N];   vector<long long> edges[N];   string s;   void dfs(long long u) {     cnt[u][cc[u]]++;     for (auto x : edges[u]) {       if (in[x][1] == -1) continue;       long long to = in[x][0] + in[x][1] - u;       if (~cc[to]) continue;       cc[to] = cc[u] ^ (s[x] ==  0 );       dfs(to);     }   }   long long f(long long x) { return (par[x] == x ? x : par[x] = f(par[x])); }   void add(long long a, long long s0, long long s1) {     a = f(a);     res -= min(cnt[a][0], cnt[a][1]);     cnt[a][0] += s0, cnt[a][1] += s1;     res += min(cnt[a][0], cnt[a][1]);   }   void merge(long long a, long long b) {     a = f(a), b = f(b);     if (a == b) return;     if (sz[b] > sz[a]) swap(a, b);     add(a, cnt[b][0], cnt[b][1]);     add(b, -cnt[b][0], -cnt[b][1]);     sz[a] += sz[b], par[b] = a;   }   void solve(long long t_case) {     cin >> n >> k >> s;     s =  $  + s;     memset(in, -1, sizeof in), memset(cc, -1, sizeof cc);     for (long long i = 0; i < k; i++) {       sz[i] = 1, par[i] = i;       long long c;       cin >> c;       for (long long j = 0; j < c; j++) {         long long x;         cin >> x, edges[i].push_back(x);         if (~in[x][0])           in[x][1] = i;         else           in[x][0] = i;       }     }     for (long long i = 0; i < k; i++) {       if (~cc[i]) continue;       cc[i] = 0, dfs(i);     }     for (long long i = 1; i <= n; i++) {       long long c0 = in[i][0], c1 = in[i][1];       if (~c0 && c1 == -1) {         if (s[i] ==  0 ) {           if (cc[c0])             add(c0, mod, 0);           else             add(c0, 0, mod);         } else {           if (cc[c0])             add(c0, 0, mod);           else             add(c0, mod, 0);         }       }       if (~c0 && ~c1) {         merge(c0, c1);       }       cout << res <<   n ;     }   }   signed main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     if (0) {       long long t;       cin >> t;       for (long long t_case = 1; t_case <= t; t_case++) solve(t_case);     } else       solve(1);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long lucky[1024 * 4];   long long fact[14];   int cnt;   void func(long long cur, int pos, int maxpos) {     if (pos == maxpos) {       lucky[++cnt] = cur * 10 + 4;       lucky[++cnt] = cur * 10 + 7;       return;     }     func(cur * 10 + 4, pos + 1, maxpos);     func(cur * 10 + 7, pos + 1, maxpos);   }   void pre() {     cnt = 0;     for (int d = 1; d <= 10; d++) {       func(0, 1, d);     }     sort(lucky, lucky + cnt);     fact[0] = 1;     for (int i = 1; i < 14; i++) fact[i] = i * fact[i - 1];   }   long long n, k;   void in() { cin >> n >> k; }   int arr[14] = {0};   int brr[14] = {0};   void rec(int p, long long k, int coun) {     if (coun == p) return;     int b = (k + fact[p - 1 - coun] - 1) / fact[p - 1 - coun];     int c = 0;     for (int i = 0; i < 14; i++) {       if (brr[i] == 0) c++;       if (b == c) {         brr[i] = 1;         arr[coun] = i;         rec(p, k - fact[p - 1 - coun] * (b - 1), coun + 1);         break;       }     }     return;   }   bool luck(long long q) {     for (int i = 0; i < cnt; i++) {       if (lucky[i] == q) return true;       if (lucky[i] > q) return false;     }     return false;   }   void solve() {     int p = 0;     while (fact[p] < k) p++;     if (n < 14 && k > fact[n]) {       cout << -1 << endl;       return;     }     rec(p, k, 0);     for (int i = 0; i < p; i++) {       arr[i] += n - p + 1;     }     int ans = 1;     while (lucky[ans] <= n - p) {       ans++;     }     ans--;     for (long long i = n - p + 1; i <= n; i++) {       if (luck(i) && luck(arr[i - n - 1 + p])) ans++;     }     cout << ans << endl;   }   int main() {     pre();     in();     solve();   }
#include <bits/stdc++.h>   const int MAXINT = 2147483640;   const long long MAXLL = 9223372036854775800LL;   const long long MAXN = 1e6;   const double eps = 1e-9;   const long long mod = 1e9 + 7;   using namespace std;   long long binpow(long long a, long long n) {     long long ans = 1;     while (n) {       if (n & 1) ans *= a;       a *= a;       n >>= 1;     }     return ans;   }   long long n;   char a[MAXN], b[MAXN];   int main() {     srand(time(0));     ios_base::sync_with_stdio(0);     cin.tie(0);     ;     cin >> n;     long long ans1 = 0, ans0 = 0;     for (int i = 1; i <= n; ++i) {       cin >> a[i];       if (a[i] ==  1 )         ans1++;       else         ans0++;     }     for (int i = 1; i <= n; ++i) {       cin >> b[i];     }     long long ans = 0;     for (int i = 1; i <= n; ++i) {       if (a[i] ==  0  && b[i] ==  0 ) {         ans += ans1;         ans0--;       }       if (a[i] ==  1  && b[i] ==  0 ) {         ans += ans0;         ans1--;       }     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     int a[n];     for (int i = 0; i < n; i++) {       cin >> a[i];     }     int count = 0;     for (int i = 1; i < n - 1; i++) {       if ((a[i - 1] - a[i]) * (a[i + 1] - a[i]) > 0) {         count++;       }     }     cout << count << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct item {     int id, savetime, destructiontime, value;   };   struct state {     int bestval, besttime;     vector<int> items;   };   int n;   item arr[101];   state dp[101][2001];   int itemidx[101][2001];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     int n;     cin >> n;     for (int i = 1; i <= n; ++i) {       arr[i].id = i;       cin >> arr[i].savetime >> arr[i].destructiontime >> arr[i].value;     }     sort(arr + 1, arr + n + 1, [](const item& a, const item& b) {       return a.destructiontime < b.destructiontime;     });     for (int i = 0; i <= 2000; ++i) {       dp[0][i] = {0, 0, {}};     }     for (int idx = 1; idx <= n; ++idx) {       for (int t = 0; t <= 2000; ++t) {         if (t > 0)           dp[idx][t] = dp[idx][t - 1];         else           dp[idx][t] = {0, 0, {}};         if (dp[idx - 1][t].bestval > dp[idx][t].bestval) {           dp[idx][t] = dp[idx - 1][t];         }         if (t >= arr[idx].savetime && t < arr[idx].destructiontime &&             dp[idx - 1][t - arr[idx].savetime].bestval + arr[idx].value >                 dp[idx][t].bestval) {           dp[idx][t] = dp[idx - 1][t - arr[idx].savetime];           dp[idx][t].bestval += arr[idx].value;           dp[idx][t].besttime += arr[idx].savetime;           dp[idx][t].items.emplace_back(idx);         }       }     }     state beststate = dp[n][2000];     cout << accumulate(beststate.items.begin(), beststate.items.end(), 0,                        [](int prev, int idx) { return prev + arr[idx].value; })          << endl;     cout << beststate.items.size() << endl;     for (int idx : beststate.items) {       cout << arr[idx].id <<    ;     }     cout << endl;   }
#include <bits/stdc++.h>   #pragma GCC optimize( Ofast,no-stack-protector,unroll-loops,fast-math )   #pragma GCC target( sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx )   using namespace std;   const long long maxn = 1e5 + 20;   const long long inf = (long long)2e9;   const long double pi = asin(1) * 2;   const long double eps = 1e-8;   const long long mod = (long long)1e9 + 7;   const long long ns = 97;   mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());   long long dp[maxn], tin[maxn], up[maxn], was[maxn], used[maxn];   vector<long long> g[maxn], ans, order;   long long timer = 0, flag = 1;   void dfs(long long v) {     used[v] = 1;     tin[v] = timer++;     dp[v] = tin[up[v]];     for (auto& u : g[v]) {       if (!used[u]) dfs(u);       dp[v] = min(dp[v], dp[u]);       if (dp[u] < tin[v] && dp[u] != tin[up[v]]) flag = 0;     }     if (dp[v] < tin[up[v]]) flag = 0;     order.push_back(v);   }   void dfs2(long long v) {     used[v] = 1;     for (auto& u : g[v])       if (!used[u]) dfs2(u);     if (was[v]) ans.push_back(v);   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     cout.tie(nullptr);     long long n, m;     cin >> n >> m;     for (long long i = 0; i < m; ++i) {       long long a, b;       cin >> a >> b;       --a, --b;       g[a].push_back(b);       used[b] = 1;     }     for (long long i = 0; i < n; ++i) {       cin >> up[i];       --up[i];       was[up[i]] = 1;     }     vector<long long> roots;     for (long long i = 0; i < n; ++i)       if (!used[i]) roots.push_back(i);     for (auto& x : used) x = 0;     for (auto& x : roots) dfs(x);     if (!flag) {       cout << -1;       exit(0);     }     for (auto& x : used) x = 0;     reverse(order.begin(), order.end());     for (long long i = 0; i < n; ++i)       if (!used[i]) dfs2(i);     cout << (long long)ans.size() <<   n ;     for (auto& x : ans) cout << x + 1 <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   string a, b;   long long int mp[10];   long long int x[20];   bool solve(long long int idx, bool isSmall) {     if (idx == b.size()) {       return true;     }     long long int start = b[idx] -  0 ;     if (isSmall) start = 9;     for (long long int j = start; j >= 0; j--) {       if (mp[j] > 0) {         mp[j]--;         x[idx] = j;         bool flag = false;         if (isSmall) flag = true;         if (j < start) flag = true;         bool temp = solve(idx + 1, flag);         if (temp) return true;         mp[j]++;       }     }     return false;   }   int main() {     cin >> a >> b;     if (b.size() > a.size()) {       sort(a.rbegin(), a.rend());       cout << a << endl;       return 0;     } else {       for (long long int i = 0; i < a.size(); i++) {         mp[a[i] -  0 ]++;       }       solve(0, false);       for (long long int i = 0; i < b.size(); i++) {         cout << x[i];       }       cout << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int i, j, k, n, t = 1;     while (t--) {       cin >> n;       vector<long> v(n), b(n), ans(n, 0);       for (i = 0; i < n; i++) {         cin >> v[i];         b[i] = v[i];       }       for (i = n - 2; i >= 0; i--) {         if (b[i + 1] >= v[i]) ans[i] = 1 + b[i + 1] - v[i];         b[i] = max(b[i], b[i + 1]);       }       for (i = 0; i < n; i++) {         cout << ans[i] <<    ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxx = 3e5 + 100;   string s;   int n;   int main() {     while (scanf( %d , &n) != EOF) {       cin >> s;       int len = s.length();       int flag = 0;       int i;       for (i = 1; i < len; i++) {         if (s[i] < s[i - 1]) {           flag = 1;           break;         }       }       if (flag == 0)         cout <<  NO  << endl;       else         cout <<  YES  << endl << i <<     << i + 1 << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e7 + 10;   int n;   vector<string> a;   vector<pair<pair<int, int>, int> > pos;   char s[N];   int main() {     scanf( %d , &n);     for (int i = (0); i < (n); i++) {       int m;       string t;       cin >> t;       a.push_back(t);       scanf( %d , &m);       for (int j = (0); j < (m); j++) {         int at;         scanf( %d , &at);         at--;         pos.push_back(make_pair(make_pair(at, -(int)a[i].size()), i));       }     }     sort(pos.begin(), pos.end());     int p = 0;     for (int i = (0); i < ((int)pos.size()); i++) {       int at = pos[i].first.first, len = -pos[i].first.second, id = pos[i].second;       while (p < at) s[p++] =  a ;       if (p >= at && p < at + len) {         for (int j = (p - at); j < (len); j++) s[p++] = a[id][j];       }     }     printf( %s n , s);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     string second;     long long n, i, m, ans = 0, j, k, sum = 0;     cin >> m;     n = m;     vector<long long> b(m / 2), a(n);     for (i = 0; i < n / 2; i++) cin >> b[i];     a[0] = 0;     a[n - 1] = b[0];     for (i = 1; i < m / 2; i++) {       long long diff = 0;       if (b[i] > a[n - i]) diff = b[i] - a[n - i];       if (diff < a[i - 1]) diff = a[i - 1];       a[i] = diff;       a[n - i - 1] = b[i] - diff;     }     for (i = 0; i < a.size(); i++) cout << a[i] <<    ;   }   int main() {     ios_base ::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long t;     solve();   }
#include <bits/stdc++.h>   using namespace std;   int n, k;   long long m;   long long ten[1005], f[1005][105][2];   int MAIN() {     scanf( %d%d%lld , &n, &k, &m);     ten[0] = 1;     for (int i = 1; i < 1005; ++i) {       ten[i] = ten[i - 1] * 10 % k;     }     f[0][0][0] = 1;     for (int i = 0; i < n; ++i) {       for (int j = 0; j < k; ++j) {         for (int s = 0; s < 2; ++s) {           for (int x = 0; x < 10; ++x) {             if (i == n - 1 && x == 0) {               continue;             }             int next_k = (ten[i] * x + j) % k;             int next_s = (s || (x != 0 && next_k == 0)) ? 1 : 0;             f[i + 1][next_k][next_s] =                 (f[i + 1][next_k][next_s] + f[i][j][s]) % m;           }         }       }     }     long long ans = 0;     for (int i = 0; i < k; ++i) {       ans = ans + f[n][i][1];     }     ans %= m;     printf( %lld n , ans);     return 0;   }   int main() {     ios ::sync_with_stdio(false);     cout << fixed << setprecision(16);     return MAIN();   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1000 + 10;   int ans = 0, n;   int a, b, c;   void cbh(int uuu, int len) {     if (len == n) return;     if (uuu == 1) {       if (a < b)         ans += a, cbh(2, len + 1);       else         ans += b, cbh(3, len + 1);     } else if (uuu == 2) {       if (a < c)         ans += a, cbh(1, len + 1);       else         ans += c, cbh(3, len + 1);     } else {       if (b < c)         ans += b, cbh(1, len + 1);       else         ans += c, cbh(2, len + 1);     }   }   int main() {     scanf( %d%d%d%d , &n, &a, &b, &c);     if (n <= 1) {       puts( 0 );       return 0;     }     cbh(1, 1);     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   int main() {     int n;     std::cin >> n;     int max_x = 0;     std::vector<int> v(n, 0);     for (int i = 0; i < n; ++i) {       std::cin >> v[i];     }     for (const auto& elem : v) {       int tmp = elem + max_x;       if (tmp > max_x) max_x = tmp;       std::cout << tmp <<    ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int MIN(int a, int b) {     int x = (b > a) ? a : b;     return x;   }   int MAX(int a, int b) {     int x = (b < a) ? a : b;     return x;   }   const int size = 1000007;   const long long modulo = 1000000007;   const long long inf = 1e18;   const double eps = 1e-6;   long long t, n, p, m, b[4000], k, n25, n50, n100;   bool flg[1000][1000];   int a[100009];   int main() {     while (cin >> n >> m) {       long long ase = n * 100 + m * 10;       long long cnt = 0;       while (ase >= 220) {         if (cnt % 2 == 0) {           if (n >= 2) {             n--;             n--;             if (m >= 2) {               m -= 2;               cnt++;             }           } else {             int less = 220 - (n * 100);             int j = less / m;             n = 0;             m = m - j;             cnt++;           }           ase -= 220;         } else {           if (m >= 22) {             m -= 22;             cnt++;           } else {             if (m >= 12) {               m -= 12;               n--;               cnt++;             } else if (m >= 2) {               m -= 2;               n -= 2;               cnt++;             }           }           ase -= 220;         }       }       if (cnt % 2 == 0)         cout <<  Hanako n ;       else         cout <<  Ciel n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int mod = 998244353;   long long int dx[] = {0, 0, 1, -1};   long long int dy[] = {1, -1, 0, 0};   long long int m = 0, n, res, k, ans = 0, nbcycle = 0;   string s2 =  zero , ch =   , s, t, s1 =   ;   set<pair<long long int, long long int> > st;   vector<pair<string, long long int> > vm;   vector<pair<long long int, pair<long long int, long long int> > > vvv;   vector<pair<long long int, long long int> > vv, vv2;   vector<long long int> v[300005], v2;   long long int dp[505][505][2], a[5005];   long long int pal[505][505];   long long int solve(long long int i, long long int j, long long int flag) {     if (i == j) return 1;     if (i > j) return flag;     long long int &ret = dp[i][j][flag];     if (ret != -1) return ret;     long long int ans = min(1 + solve(i + 1, j, 0), 1 + solve(i, j - 1, 0));     for (long long int k = i + 1; k <= j; k++) {       if (a[i] == a[k])         ans = min(ans, solve(i + 1, k - 1, 1) + solve(k + 1, j, 0));     }     return ret = ans;   }   int main() {     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);     long long int i = 0, x, y, z, j = 0, q, mm = 0, mx = -1e9, idx = 0, ok = 0,                   l = 0, r = 0, negatif = 0, positif = 0, l1, r1, d;     set<pair<long long int, long long int> >::iterator it, it1;     cin >> n;     for (i = 1; i <= n; i++) {       cin >> a[i];       pal[i][i] = 1;     }     memset(dp, -1, sizeof(dp));     cout << solve(1, n, 0);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct Timer {     Timer() { beg = clock(); }     ~Timer() {}     clock_t beg;   };   int main() {     ios_base::sync_with_stdio(false);     int n, d, h;     cin >> n >> d >> h;     if (d < h) {       cout << -1 << endl;       return 0;     }     if (d == 1 && h == 1) {       if (n == 2) {         cout << 1 <<     << 2 << endl;       } else {         cout << -1 << endl;       }       return 0;     }     if (2 * h < d) {       cout << -1 << endl;       return 0;     }     if (n < d + 1) {       cout << -1 << endl;       return 0;     }     for (int i = 0; i < h; ++i) {       cout << i + 1 <<     << i + 2 << endl;     }     if (d - h > 0) {       cout << 1 <<     << h + 2 << endl;     }     for (int i = 0; i < d - h - 1; ++i) {       cout << i + h + 2 <<     << i + h + 3 << endl;     }     for (int i = 0; i < n - d - 1; ++i) {       cout << h <<     << i + d + 2 << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       int n;       cin >> n;       int arr[n];       set<int> s;       for (int i = 0; i < n; i++) {         int temp;         cin >> temp;         s.insert(temp);       }       if (s.size() != n)         cout <<  YES n ;       else         cout <<  NO  << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int gcd(int x, int y) {     if (!y) return x;     return gcd(y, x % y);   }   bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {     return (a.second < b.second);   }   bool sortbysecinrev(const pair<int, int> &a, const pair<int, int> &b) {     return (a.second > b.second);   }   bool sortbysize(string &s1, string &s2) { return s1.size() < s2.size(); }   bool sortinrev(const pair<int, int> &a, const pair<int, int> &b) {     return (a.first > b.first);   }   bool sortcol(const vector<int> &v1, const vector<int> &v2) {     return v1[0] < v2[0];   }   long long proceed() {     long long l, r, m, i, mn = 1e15, a;     cin >> l >> r >> m;     for (i = l; i <= r; ++i) {       if (i <= m) {         long long x = m % i;         if (x < mn) mn = x, a = i;       }       long long y = i - m % i;       if (y < mn) mn = y, a = i;     }     (m + mn) % a == 0 ? cout << a <<     << l <<     << l + mn <<   n                        : cout << a <<     << l + mn <<     << l <<   n ;     return 0;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     ;     int t = 1, i = 0;     cin >> t;     while (t--) {       proceed();     }     return 0;   }