malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   vector<int> v[3001];   int size1[3001];   map<vector<int>, int> mm;   long dis[3001][3001];   void dijkstra(int n) {     priority_queue<vector<int>> pq;     vector<int> p(3, 0), p1(3);     p[0] = 0;     p[2] = 1;     pq.push(p);     long size = 1;     while (size) {       p = pq.top();       pq.pop();       --size;       if ((dis[p[2]][p[1]] > p[0]) && (dis[p[2]][p[1]] != 0)) {         continue;       }       if (p[2] == n) return;       for (int i = 0; i < size1[p[2]]; ++i) {         p1[0] = p[1];         p1[1] = p[2];         p1[2] = v[p[2]][i];         if (mm[p1] == 1) continue;         if ((dis[p1[2]][p1[1]] < dis[p[2]][p[1]] - 1) ||             (dis[p1[2]][p1[1]] == 0)) {           dis[p1[2]][p1[1]] = dis[p[2]][p[1]] - 1;           p1[0] = dis[p1[2]][p1[1]];           pq.push(p1);           ++size;           if ((p1[2] == n) && (p1[0] == -1)) return;         }       }     }   }   int main() {     int n, m, a, b, c, k;     cin >> n >> m >> k;     vector<int> arr(3);     for (int i = 0; i < m; ++i) {       scanf( %d %d , &a, &b);       v[a].emplace_back(b);       size1[a]++;       v[b].emplace_back(a);       size1[b]++;     }     for (int i = 0; i < k; ++i) {       scanf( %d %d %d , &arr[0], &arr[1], &arr[2]);       mm[arr] = 1;     }     dijkstra(n);     long maxim = 0;     int maximindex = 0;     for (int i = 1; i <= n; ++i) {       if (dis[n][i] == 0) {         continue;       }       if ((dis[n][i] > maxim) || (maxim == 0)) {         maxim = dis[n][i];         maximindex = i;       }     }     if (maxim == 0) {       cout <<  -1  << endl;       return 0;     }     int i = n;     int j = maximindex;     stack<int> s;     s.push(i);     long ans = 1;     int size2 = 1;     i = maximindex;     maxim++;     while (maxim < 0) {       for (int j = 1; j <= n; ++j) {         if (dis[i][j] == 0) continue;         if (dis[i][j] == maxim) {           maximindex = j;           break;         }       }       ++ans;       s.push(i);       ++size2;       maxim++;       i = maximindex;     }     cout << ans << endl;     cout <<  1           <<    ;     while (size2) {       printf( %d  , s.top());       s.pop();       --size2;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int t, a[2000 + 10][2000 + 10], ans[2000 + 10][2000 + 10], viz[30];   pair<int, int> fs[30], ls[30];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> t;     while (t--) {       int n, m, l = 0;       pair<int, int> aux = {0, 0};       cin >> n >> m;       for (int i = 1; i <= 26; i++) viz[i] = 0, fs[i] = {0, 0}, ls[i] = {0, 0};       for (int i = 1; i <= n; i++) {         string s;         cin >> s;         for (int j = 0; j < m; j++) {           if (s[j] >=  a  && s[j] <=  z )             a[i][j + 1] = s[j] -  a  + 1;           else             a[i][j + 1] = 0;         }       }       for (int ch = 1; ch <= 26; ch++)         for (int i = 1; i <= n && !viz[ch]; i++)           for (int j = 1; j <= m && !viz[ch]; j++)             if (a[i][j] == ch) {               viz[ch] = 1;               fs[ch] = {i, j};               int j1 = j + 1, i1 = i + 1, ok = 0;               while (j1 <= m) {                 if (a[i][j1] == ch) ok = 1, ls[ch] = {i, j1};                 j1++;               }               while (i1 <= n) {                 if (a[i1][j] == ch) ok = 1, ls[ch] = {i1, j};                 i1++;               }               if (!ok) ls[ch] = fs[ch];               l = ch;               aux = fs[ch];             }       for (int i = 1; i <= l; i++) {         if (!fs[i].first) {           fs[i] = aux;           ls[i] = aux;         }         for (int i1 = fs[i].first; i1 <= ls[i].first; i1++)           for (int j1 = fs[i].second; j1 <= ls[i].second; j1++) ans[i1][j1] = i;       }       int ok = 1;       for (int i = 1; i <= n; i++)         for (int j = 1; j <= m; j++)           if (ans[i][j] != a[i][j]) ok = 0;       for (int i = 1; i <= n; i++)         for (int j = 1; j <= m; j++) a[i][j] = ans[i][j] = 0;       if (!ok) {         cout <<  NO  <<   n ;         continue;       }       cout <<  YES  <<   n ;       cout << l <<   n ;       for (int i = 1; i <= l; i++)         cout << fs[i].first <<     << fs[i].second <<     << ls[i].first <<                  << ls[i].second <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   const int N = 35;   int n, m;   int A[N][N], F[N][N];   int main() {     scanf( %d , &n);     m = (n + 1) >> 1;     int ans = 0;     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++) {         scanf( %d , &A[i][j]);         ans += A[i][j];       }     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++) F[i][j] = 1;     for (int stat = 0; stat < 1 << m; stat++) {       int sum = 0;       for (int i = 1; i <= m; i++) {         F[m][i] = (stat >> (i - 1) & 1) ? -1 : 1;         sum += (A[m][i] * F[m][i]);       }       for (int i = m + 1; i <= n; i++) {         F[m][i] = F[m][i - m] * F[m][m];         sum += (A[m][i] * F[m][i]);       }       for (int i = 1; i < m; i++) {         int s, ti = i + m;         for (int j = 0; j < 2; j++, F[i][m] *= -1) {           F[i + m][m] = F[i][m] * F[m][m];           int t = (A[i][m] * F[i][m]) + (A[i + m][m] * F[i + m][m]);           for (int k = 1; k < m; k++) {             int tk = k + m;             F[i][tk] = F[i][k] * F[i][m];             F[ti][k] = F[i][k] * F[m][k];             F[ti][tk] = F[i][tk] * F[m][tk];             t += fabs((A[i][k] * F[i][k]) + (A[i][tk] * F[i][tk]) +                       (A[ti][k] * F[ti][k]) + (A[ti][tk] * F[ti][tk]));           }           if (!j || t > s) s = t;         }         sum += s;       }       if (sum > ans) ans = sum;     }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 9e2 + 1;   int n, m, g[maxn], G, o1[maxn], o2[maxn], deg[maxn];   vector<int> e[maxn], e_s[maxn], r_e_s[maxn], topo, ans, wow[maxn];   vector<pair<int, int> > edge, res;   bool mark[maxn];   map<int, int> is[maxn];   void dfs(int v) {     mark[v] = 1;     for (auto u : e[v]) {       if (is[v][u] == 0) {         e_s[v].push_back(u);         r_e_s[u].push_back(v);         is[v][u] = 1;         is[u][v] = 1;       }       if (mark[u] == 0) {         dfs(u);       }     }   }   void topol(int v) {     mark[v] = 1;     for (auto u : e_s[v]) {       if (mark[u] == 0) {         topol(u);       }     }     topo.push_back(v);   }   void col(int v) {     mark[v] = 1;     g[v] = G;     o2[G] = v;     for (auto u : r_e_s[v]) {       if (mark[u] == 0) {         col(u);       }     }     return;   }   void Last_one(int v) {     mark[v] = 1;     for (auto u : wow[v]) {       if (mark[u] == 0) {         Last_one(u);       }     }     if (deg[v] == 1) {       ans.push_back(v);     }     return;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cin >> n >> m;     if (n == 2) {       cout << -1 << endl;       return 0;     }     for (int i = 0; i < m; i++) {       int t1, t2;       cin >> t1 >> t2;       e[t1].push_back(t2);       e[t2].push_back(t1);       edge.push_back({t1, t2});     }     dfs(1);     for (int i = 1; i <= n; i++) {       mark[i] = 0;     }     topol(1);     for (int i = 1; i <= n; i++) {       mark[i] = 0;     }     reverse(topo.begin(), topo.end());     G = 1;     for (auto u : topo) {       if (mark[u] == 0) {         o1[G] = u;         col(u);         G++;       }     }     for (auto tmp : edge) {       if (g[tmp.first] != g[tmp.second]) {         deg[g[tmp.first]]++;         deg[g[tmp.second]]++;         wow[g[tmp.first]].push_back(g[tmp.second]);         wow[g[tmp.second]].push_back(g[tmp.first]);       }     }     if (G == 3) {       ans.push_back(1);       ans.push_back(2);     } else {       for (int i = 1; i <= n; i++) {         mark[i] = 0;       }       for (int i = 1; i < G; i++) {         if (deg[i] >= 2) {           Last_one(i);           break;         }       }     }     for (int i = 0; i < ((int)ans.size() + 1) / 2; i++) {       int t1 = ans[i];       int t2 = ans[i + (ans.size()) / 2];       if (is[o1[t1]][o1[t2]] == 0) {         res.push_back({o1[t1], o1[t2]});       } else {         res.push_back({o2[t1], o2[t2]});       }     }     cout << res.size() << endl;     for (auto u : res) {       cout << u.first <<      << u.second << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long N, K;   long long num[3000];   long long OAO[3000];   bool test(long long c) {     for (long long Ni = 0; Ni <= N; Ni++) {       OAO[Ni] = Ni;       for (long long Nj = 0; Nj < Ni; Nj++) {         if (Ni != N && abs(num[Ni] - num[Nj]) > (long long)(c) * (Ni - Nj))           continue;         OAO[Ni] = min(OAO[Ni], OAO[Nj] + Ni - Nj - 1);       }     }     if (OAO[N] > K)       return false;     else       return true;   }   int main() {     scanf( %I64d %I64d , &N, &K);     long long p = 0;     for (long long Ni = 0; Ni < N; Ni++) {       scanf( %I64d , &num[Ni]);       if (Ni) p = max(p, (long long)abs(num[Ni] - num[Ni - 1]));     }     long long l = -1, r = p, mid;     while (l + 1 != r) {       mid = (l + r) / 2;       if (test(mid))         r = mid;       else         l = mid;     }     printf( %I64d n , r);   }
#include <bits/stdc++.h>   using namespace std;   int regions[100000][4];   string name[100000][3];   void compareScore(int regionNo, int score, string str) {     if (score >= regions[regionNo][0]) {       string tempName1 = name[regionNo][0];       string tempName2 = name[regionNo][1];       int tempScore1 = regions[regionNo][0];       int tempScore2 = regions[regionNo][1];       regions[regionNo][0] = score;       name[regionNo][0] = str;       regions[regionNo][1] = tempScore1;       regions[regionNo][2] = tempScore2;       name[regionNo][1] = tempName1;       name[regionNo][2] = tempName2;     } else if (score >= regions[regionNo][1]) {       string tempName2 = name[regionNo][1];       int tempScore2 = regions[regionNo][1];       regions[regionNo][1] = score;       name[regionNo][1] = str;       regions[regionNo][2] = tempScore2;       name[regionNo][2] = tempName2;     } else if (score >= regions[regionNo][2]) {       regions[regionNo][2] = score;       name[regionNo][2] = str;     }     if (!name[regionNo][1].empty() && !name[regionNo][2].empty() &&         regions[regionNo][1] == regions[regionNo][2]) {       regions[regionNo][3] = -1;     } else {       regions[regionNo][3] = 1;     }   }   void solve(int n, int m) {     for (int i = 0; i < n; i++) {       string str;       int regionNo, score;       cin >> str >> regionNo >> score;       compareScore(regionNo, score, str);     }     for (int i = 1; i <= m; i++) {       if (regions[i][3] == 1) {         cout << name[i][0] <<     << name[i][1] << endl;       } else {         cout <<  ?  << endl;       }     }   }   int main() {     int n, m;     cin >> n >> m;     solve(n, m);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   signed main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long t;     cin >> t;     while (t--) {       long long n, sum = 0;       cin >> n;       vector<long long> v(n), ans, odd;       for (long long i = 0; i < n; i++) {         cin >> v[i];         if (v[i] % 2 == 0) {           ans.push_back(i);         } else           odd.push_back(i);         sum += v[i];       }       long long count = 0;       for (long long i = 2; i * i <= sum; i++) {         if (sum % i == 0) count++;       }       if (count > 0) {         cout << n << endl;         for (long long i = 0; i < n; i++) cout << i + 1 <<    ;       } else {         cout << n - 1 << endl;         odd.pop_back();         for (long long i = 0; i < ans.size(); i++) {           cout << ans[i] + 1 <<    ;         }         for (long long i = 0; i < odd.size(); i++) {           cout << odd[i] + 1 <<    ;         }       }       cout << endl;     }   }
#include <bits/stdc++.h>   int main() {     int n;     char a[20];     scanf(  %d , &n);     scanf(  %s , a);     char num[10];     for (int i = 2; i < 10; i++) {       int c = 0;       for (int j = 0; a[j]; j++)         if (a[j] >= i +  0 ) c++;       num[i] = c;     }     if (num[7] > 0) {       for (int i = 2; i < 7; i++) {         num[i] -= num[7];       }       while (num[7]--) printf( 7 );     }     if (num[5] > 0) {       for (int i = 2; i < 5; i++) {         num[i] -= num[5];       }       while (num[5]--) printf( 5 );     }     num[3] += num[6];     num[3] += num[9] * 2;     num[2] += num[6];     num[2] += num[4] * 2;     num[2] += num[8] * 3;     num[2] -= num[3];     while (num[3]--) printf( 3 );     while (num[2]--) printf( 2 );     printf(  n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INFINITE = (int)(0xffffffff >> 2);   int n;   int gs[600];   int dp[600][600];   int run(int l, int r) {     if (l > r) return 0;     if (l == r) return 1;     if (dp[l][r] != INFINITE) {       return dp[l][r];     }     dp[l][r] = min(dp[l][r], run(l + 1, r) + 1);     for (int k = l + 2; k <= r; k++) {       if (gs[l] == gs[k]) {         dp[l][r] = min(dp[l][r], run(l + 1, k - 1) + run(k + 1, r));       }     }     if (gs[l] == gs[l + 1]) {       dp[l][r] = min(dp[l][r], run(l + 2, r) + 1);       return dp[l][r];     }     return dp[l][r];   }   int main() {     cin >> n;     for (int i = 1; i <= n; i++) cin >> gs[i];     for (int i = 0; i < 600; i++) {       int *row = dp[i];       for (int j = 0; j < 600; j++) {         row[j] = INFINITE;       }     }     cout << run(1, n) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void err(istream_iterator<string> it) { cerr << endl; }   template <typename T, typename... Args>   void err(istream_iterator<string> it, T a, Args... args) {     cerr << *it <<   =   << a <<   ,  ;     err(++it, args...);   }   namespace fastIO {   bool IOerror = 0;   inline char nc() {     static char buf[100000], *p1 = buf + 100000, *pend = buf + 100000;     if (p1 == pend) {       p1 = buf;       pend = buf + fread(buf, 1, 100000, stdin);       if (pend == p1) {         IOerror = 1;         return -1;       }     }     return *p1++;   }   inline bool blank(char ch) {     return ch ==     || ch ==   n  || ch ==   r  || ch ==   t ;   }   inline void read(int &x) {     char ch;     while (blank(ch = nc()))       ;     if (IOerror) return;     for (x = ch -  0 ; (ch = nc()) >=  0  && ch <=  9 ; x = x * 10 + ch -  0 )       ;   }   }  // namespace fastIO   using namespace fastIO;   const double PI = acos(-1.0);   const double eps = 1e-8;   const int maxn = 3e5 + 7;   const int N = 1e4 + 10;   const int mod = 998244353;   long long qp(long long b, long long n) {     long long r = 1;     if (n < 0) n += mod - 1;     b %= mod;     for (; n; n >>= 1, b = b * b % mod)       if (n & 1) r = r * b % mod;     return r;   }   int sgn(double x) {     if (x < -eps) return -1;     return x > eps ? 1 : 0;   }   int n;   long long dp[3][N];   long long sum[N], suf[N];   int a[N];   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; ++i) scanf( %d , &a[i]);     sort(a + 1, a + 1 + n);     long long _c2 = (n * (n - 1) / 2);     for (int i = 1; i <= n; ++i) {       for (int j = i + 1; j <= n; ++j) {         dp[0][a[j] - a[i]]++;       }     }     for (int i = 1; i <= n; ++i) {       for (int j = i + 1; j <= n; ++j) {         dp[1][a[j] - a[i]]++;       }     }     for (int i = 1; i <= 10000; ++i) {       for (int j = 1; j < i; ++j) {         int k = i - j;         dp[2][i] += dp[0][j] * dp[1][k];       }       sum[i] = sum[i - 1] + dp[2][i];     }     double ans = 0;     for (int i = 10000; i >= 1; --i) {       ans += sum[i - 1] * dp[0][i];     }     printf( %.12lf n , 1.0 * ans / _c2 / _c2 / _c2);   }
#include <bits/stdc++.h>   using namespace std;   const int oo = 2139063143;   const int N = 1010000;   const int P = 1000000007;   const long double eps = 1e-7;   template <typename T>   inline void sc(T &x) {     x = 0;     static int p;     p = 1;     static char c;     c = getchar();     while (!isdigit(c)) {       if (c ==  - ) p = -1;       c = getchar();     }     while (isdigit(c)) {       x = (x << 1) + (x << 3) + (c - 48);       c = getchar();     }     x *= p;   }   template <typename T>   inline void print(T x) {     if (x < 0) putchar( - ), x = -x;     if (x >= 10) print(x / 10);     putchar(x % 10 +  0 );   }   template <typename T>   inline void pr(T x) {     print(x), putchar(  n );   }   template <typename T1, typename T2>   void chkmax(T1 &A, T2 B) {     A = A >= B ? A : B;   }   template <typename T1, typename T2>   void chkmin(T1 &A, T2 B) {     A = A <= B ? A : B;   }   const long double PI = acos(-1);   int n, m;   struct po {     long double x, y;     po(long double xx = 0, long double yy = 0) { x = xx, y = yy; }   } a[N], s[N];   po operator+(po A, po B) { return po(A.x + B.x, A.y + B.y); }   po operator-(po A, po B) { return po(A.x - B.x, A.y - B.y); }   long double operator*(po A, po B) { return A.x * B.y - A.y * B.x; }   po operator*(po A, long double B) { return po(A.x * B, A.y * B); }   po operator*(long double B, po A) { return po(A.x * B, A.y * B); }   long double triangle(po A, po B, po C) { return abs((B - A) * (C - A)) / 2; }   long double area() {     long double g = a[n] * a[1];     for (int i = 1; i < n; i++) g += a[i] * a[i + 1];     return abs(g) / 2;   }   po core(po A, po B, po C) { return (A + B + C) * (1. / 3); }   po O;   void core() {     long double S = area();     for (int i = 2; i < n; i++)       O = O + (triangle(a[1], a[i], a[i + 1]) / S) * core(a[1], a[i], a[i + 1]);   }   long double S(long double A) { return A * A; }   long double getlen(po A) { return sqrt(S(A.x) + S(A.y)); }   long double len[N], b[N];   long double atan2(po A) { return atan2(A.y, A.x); }   po rotate(po A, long double x) {     long double s = sin(x), c = cos(x);     return po(A.x * c - A.y * s, A.x * s + A.y * c);   }   int ia = 1, ib = 2;   po A, B, p;   po getpos(int i) { return O + rotate(s[i], b[0] - b[ia]); }   int main() {     sc(n), sc(m);     for (int i = 1; i <= n; i++) {       int x, y;       sc(x), sc(y);       a[i] = po(x, y);     }     core();     for (int i = 1; i <= n; i++)       s[i] = a[i] - O, len[i] = getlen(s[i]), b[i] = atan2(s[i]);     b[0] = atan2(po(0, 1));     A = a[1], B = a[2];     bool fg = 0;     while (m--) {       int op, x, y;       sc(op), sc(x);       if (op == 1) {         sc(y);         if (ia == x) swap(ia, ib), swap(A, B);         O = po(A.x, A.y - len[ia]);         ib = y, B = getpos(ib);         fg = 1;       } else {         if (fg)           p = getpos(x), printf( %.9Lf %.9Lf n , p.x, p.y);         else           printf( %.9Lf %.9Lf n , a[x].x, a[x].y);       }     }     return 0;   }
#include <bits/stdc++.h>   int n, k, a, b, p, na;   std::vector<int> avg;   long long f(int l, int r) {     auto it1 = std::upper_bound(avg.begin(), avg.end(), r);     auto it2 = std::lower_bound(avg.begin(), avg.end(), l);     if (it2 != avg.end())       na = it1 - it2;     else       na = 0;     long long ans;     if (na)       ans = 1LL * b * na * (r - l + 1);     else       ans = a;     if (na && r != l)       ans = std::min(ans, f(l, (l + r) / 2) + f((l + r) / 2 + 1, r));     return ans;   }   int main() {     scanf( %d%d%d%d , &n, &k, &a, &b);     for (int i = 0; i < k; i++) {       scanf( %d , &p);       avg.push_back(p - 1);     }     std::sort(avg.begin(), avg.end());     printf( %lld n , f(0, (1 << n) - 1));     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void fast() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);   }   const long long INFll = 1ll * 1000000000 * 1000000000;   const long double PI =       3.141592653589793238462643383279502884197169399375105820974944;   int mul(int a, int b, int mod = 1000000007) { return int(a * 1ll * b % mod); }   int norm(int a, int mod = 1000000007) {     while (a >= mod) a -= mod;     while (a < 0) a += mod;     return a;   }   int powmod(int x, int y, int mod = 1000000007) {     int res = 1;     while (y > 0) {       if (y & 1) res = mul(res, x, mod);       x = mul(x, x, mod);       y = y >> 1;     }     return res;   }   int inv(int a, int mod = 1000000007) { return powmod(a, mod - 2); }   int main() {     fast();     int n;     cin >> n;     vector<int> dp((1 << 22), -1), a(n);     for (int i = 0; i < n; i++) {       cin >> a[i];       dp[a[i]] = a[i];     }     int p = (1 << 22);     for (int i = 0; i < p; i++) {       if (dp[i] != -1)         for (int j = 0; j < 22; j++) {           if ((i & (1 << j)) == 0) {             dp[i | (1 << j)] = dp[i];           }         }     }     for (int i = 0; i < n; i++) {       cout << dp[(1 << 22) - 1 - a[i]] <<    ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};   const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1},             ddy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};   const int nx[8] = {1, 2, 2, 1, -1, -2, -2, -1},             ny[8] = {-2, -1, 1, 2, 2, 1, -1, -2};   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     int t = 1;     cin >> t;     while (t--) {       int n, k;       string s;       cin >> n >> k >> s;       bool ans = true;       for (int i = 0; i < k; i++) {         bool ze = true, on = true;         for (int j = i; j < n; j += k) {           if (s[j] ==  0 ) on = false;           if (s[j] ==  1 ) ze = false;         }         if (ze && !on) {           for (int j = i; j < n; j += k) s[j] =  0 ;         }         if (!ze && on) {           for (int j = i; j < n; j += k) s[j] =  1 ;         }         if (!ze && !on) {           ans = false;         }       }       int ze = 0, on = 0, qu = 0;       for (int i = 0; i < k; i++) {         if (s[i] ==  0 ) ze += 1;         if (s[i] ==  1 ) on += 1;         if (s[i] ==  ? ) qu += 1;       }       if (ze > k / 2 || on > k / 2) ans = false;       cout << (ans ?  YES  :  NO );     done:;       cout <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   inline void io() {}   int main() {     ios_base::sync_with_stdio(false);     cin.tie();     cout.tie();     cout << fixed << setprecision(8);     long long int n, a, b, c = 0, k;     cin >> a >> b >> n;     for (int i = 0; i < 10; i++) {       if (((a * 10) + i) % b == 0) {         c++;         k = (a * 10) + i;         break;       }     }     if (c == 1) {       cout << k;       for (int i = 1; i < n; i++) {         cout <<  0 ;       }     } else {       cout <<  -1 ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, pos;     cin >> n;     int arr[n + 1];     for (int i = 1; i <= n; i++) {       cin >> pos;       arr[pos] = i;     }     for (int i = 1; i <= n; i++) cout << arr[i] <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       long long int a, b, n;       cin >> a >> b >> n;       long long int cnt = 0;       while (1) {         if (b > a) {           a += b;           cnt++;         } else {           b += a;           cnt++;         }         if (a > n || b > n) break;       }       cout << cnt << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, k;     cin >> n >> k;     vector<int> joy;     while (n > 0) {       int f, t;       cin >> f >> t;       if (t > k) f = f - t + k;       joy.push_back(f);       n--;     }     sort(joy.begin(), joy.end());     cout << joy.back();   }