malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long t;     cin >> t;     while (t--) {       long long n;       cin >> n;       n = 4 * n;       for (long long i = 0; i < (n / 4); i++) {         cout << n - (2 * i) <<    ;       }       cout << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   const int N = 100020, mo = 1e9 + 7;   int n, second[N], x, y, cnt, dfn[N], vis[N];   int dot[N], size;   int l[N], r[N];   long long ans = 1;   set<pair<int, int> > L[N], R[N];   struct Dot {     int x, y;   } s[N];   inline void read(int &x) {     x = 0;     char c = getchar();     int f = 1;     while (c <  0  || c >  9 ) {       if (c ==  - ) f = -1;       c = getchar();     }     while (c >=  0  && c <=  9 ) {       x = 10 * x + c -  0 ;       c = getchar();     }     x *= f;   }   inline int LS() {     sort(second + 1, second + n + 1);     int l = 0;     for (int i = 1; i <= n; i++)       if (i == 1 || second[i] != second[i - 1]) second[++l] = second[i];     return l;   }   inline void dfs(int u) {     if (u > n || u < 1) return;     vis[u] = cnt;     dot[++size] = u;     set<pair<int, int> >::iterator it = L[s[u].x].find(pair<int, int>(s[u].y, u));     it++;     if (!vis[(*it).second]) dfs((*it).second);     it--;     it--;     if (!vis[(*it).second]) dfs((*it).second);     it = R[s[u].y].find(pair<int, int>(s[u].x, u));     it++;     if (!vis[(*it).second]) dfs((*it).second);     it--;     it--;     if (!vis[(*it).second]) dfs((*it).second);   }   inline int power(long long a, int n) {     long long ans = 1;     while (n) {       if (n & 1) ans = (ans * a % mo);       a = (a * a % mo);       n >>= 1;     }     return ans;   }   int main() {     read(n);     for (int i = 1; i <= n; i++) read(s[i].x), read(s[i].y);     for (int i = 1; i <= n; i++) second[i] = s[i].x;     int X = LS();     for (int i = 1; i <= n; i++)       s[i].x = lower_bound(second + 1, second + X + 1, s[i].x) - second;     for (int i = 1; i <= n; i++) second[i] = s[i].y;     int Y = LS();     for (int i = 1; i <= n; i++)       s[i].y = lower_bound(second + 1, second + Y + 1, s[i].y) - second;     vis[n + 1] = 1e9;     for (int i = 1; i <= n; i++)       L[i].insert(pair<int, int>(0, n + 1)),           L[i].insert(pair<int, int>(n + 1, n + 1));     for (int i = 1; i <= n; i++)       R[i].insert(pair<int, int>(0, n + 1)),           R[i].insert(pair<int, int>(n + 1, n + 1));     for (int i = 1; i <= n; i++) {       L[s[i].x].insert(pair<int, int>(s[i].y, i));       R[s[i].y].insert(pair<int, int>(s[i].x, i));     }     for (int i = 1; i <= n; i++)       if (!vis[i]) {         size = 0;         cnt++;         dfs(i);         int num = 0;         bool flag = 0;         for (int j = 1; j <= size; j++) {           if (l[s[dot[j]].x] || r[s[dot[j]].y]) flag = 1;           num += (!l[s[dot[j]].x]) + (!r[s[dot[j]].y]);           l[s[dot[j]].x] = 1;           r[s[dot[j]].y] = 1;         }         int x = power(2, num);         if (size < num) x--;         if (x < 0) x += mo;         ans = ans * x % mo;       }     printf( %lld , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool notprime[1000010];   int sumprime[1000010];   void fun() {     for (int i = 2; i <= 1000000; i++) {       if (notprime[i] == 0) {         for (int j = i * 2; j <= 1000000; j += i) {           notprime[j] = 1;         }       }     }   }   void sum() {     sumprime[1] = 0;     for (int i = 2; i <= 1000000; i++) {       sumprime[i] = sumprime[i - 1] + (!notprime[i]);     }   }   int main() {     int n, x;     scanf( %d , &n);     fun();     sum();     while (n--) {       scanf( %d , &x);       int sum = sumprime[x] - sumprime[(int)sqrt(x)] + 1;       printf( %d n , sum);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, i, j;   string s[103];   bool ktra1() {     if (n % 3 == 0) {       static int chk[1000];       fill_n(chk, 1000, 0);       for (int i = 1; i <= n / 3; ++i) {         for (int j = 1; j <= m; ++j) {           chk[s[i][j]]++;         }       }       if (chk[s[1][1]] != m * n / 3) return false;       for (int i = n / 3 + 1; i <= 2 * n / 3; ++i) {         for (int j = 1; j <= m; ++j) {           chk[s[i][j]]++;         }       }       if (chk[s[n / 3 + 1][1]] != m * n / 3) return false;       for (int i = 2 * n / 3 + 1; i <= n; ++i) {         for (int j = 1; j <= m; ++j) {           chk[s[i][j]]++;         }       }       if (chk[s[n][1]] != m * n / 3) return false;     } else       return false;     return true;   }   bool ktra2() {     if (m % 3 == 0) {       static int chk[1000];       fill_n(chk, 1000, 0);       for (int j = 1; j <= m / 3; ++j) {         for (int i = 1; i <= n; ++i) {           chk[s[i][j]]++;         }       }       if (chk[s[1][1]] != m * n / 3) return false;       for (int j = m / 3 + 1; j <= 2 * m / 3; ++j) {         for (int i = 1; i <= n; ++i) {           chk[s[i][j]]++;         }       }       if (chk[s[1][m / 3 + 1]] != m * n / 3) return false;       for (int j = 2 * m / 3 + 1; j <= m; ++j) {         for (int i = 1; i <= n; ++i) {           chk[s[i][j]]++;         }       }       if (chk[s[1][m]] != m * n / 3) return false;     } else       return false;     return true;   }   int main() {     cin >> n >> m;     for (int i = 1; i <= n; ++i) cin >> s[i], s[i] =     + s[i];     if (ktra1() || ktra2())       cout <<  YES ;     else       cout <<  NO ;   }
#include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   #pragma GCC target( avx,avx2,fma )   using namespace std;   int main() {     {       long long n, m, k, p, s, k1, p1;       cin >> n >> m >> s;       if (s == 1) {         cout << n * m;         return 0;       }       k = (n - 1) % s + 1;       k1 = n / s;       if (n % s != 0) k1++;       k = k1 * k;       p = (m - 1) % s + 1;       p1 = m / s;       if (m % s != 0) p1++;       p = p1 * p;       cout << p * k;       cout <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct point {     int x, y, idx;     long double at;     bool operator<(const point &other) const { return at < other.at; }   };   point p[123123];   int main() {     int n;     scanf( %d n , &n);     for (auto(i) = (0); (i) < (n); (i)++) {       int a, b;       scanf( %d %d n , &a, &b);       p[i].x = a;       p[i].y = b;       p[i].idx = i;       p[i].at = atan2(b, a);     }     sort(p, p + n);     long double kek = 123123;     int good1, good2;     for (auto(i) = (1); (i) < (n); (i)++) {       if (kek - p[i].at + p[i - 1].at > 1e-21) {         kek = p[i].at - p[i - 1].at;         good1 = p[i - 1].idx;         good2 = p[i].idx;       }     }     p[0].at += 2 * 3.1415926535897932384;     if (kek - p[0].at + p[n - 1].at > 1e-21) {       good1 = p[0].idx;       good2 = p[n - 1].idx;     }     printf( %d %d n , good1 + 1, good2 + 1);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool primeFactor(int n) {     if (n == 2 || n == 3) return true;     int sum = 1, two = 0, cnt;     while (!(n % 2)) {       return false;     }     for (int i = 3; i <= sqrt(n); i += 2) {       while (!(n % i)) {         return false;       }     }     return true;   }   int main() {     ios_base::sync_with_stdio(0);     ;     int n, i, j, k, m, x, y, z;     int prime[] = {2,  3,  5,  7,  11, 13, 17, 19, 23, 29, 31, 37, 41,                    43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97};     cin >> n;     if (n == 3) {       cout << 1 << endl << 3 << endl;       exit(0);     } else if (n == 5) {       cout << 2 << endl << 2 <<     << 3 << endl;       exit(0);     }     m = n - 4;     for (i = m; i >= 0; i -= 2) {       if (primeFactor(i)) {         z = i;         break;       }     }     int zz = z;     y = n - z;     for (i = y; i >= 0; i--) {       if (n - zz - i > 1 && primeFactor(i)) {         z = i;         if (binary_search(prime, prime + 25, n - zz - z)) {           y = i;           x = n - zz - z;           break;         }       }     }     cout << 3 << endl;     cout << x <<     << y <<     << zz << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e2 + 7;   const int inf = 0x3f3f3f3f;   int t, n;   int a[maxn];   char s[maxn];   int main() {     cin >> t;     while (t--) {       scanf( %s , s + 1);       n = strlen(s + 1);       int ou = 0, sum = 0, zero = 0;       int mark = -1;       for (int i = 1; i <= n; i++) {         int num = s[i] -  0 ;         if (num == 0) {           zero = 1;           mark = i;         }         sum += num;       }       if (sum % 3 != 0 || zero == 0) {         printf( cyan n );         continue;       }       if (sum == 0) {         printf( red n );         continue;       }       for (int i = 1; i <= n; i++) {         int num = s[i] -  0 ;         if (num % 2 == 0 && i != mark) {           ou = 1;           break;         }       }       if (ou == 1) {         printf( red n );         continue;       } else {         printf( cyan n );         continue;       }     }   }
#include <bits/stdc++.h>   #pragma comment(linker,  /stack:200000000 )   #pragma GCC optimize( Ofast )   #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native )   using namespace std;   char _;   inline long long powmod(long long x, long long n, long long _mod) {     long long res = 1;     while (n) {       if (n & 1) res = (res * x) % _mod;       x = (x * x) % _mod;       n >>= 1;     }     return res;   }   int n;   int a[2000006];   int b[2000006];   int seen[2000006];   vector<int> factors(int x) {     vector<int> ret;     for (int i = 2; i * i <= x; i++) {       if (x % i == 0) {         ret.push_back(i);         while (x % i == 0) x /= i;       }     }     if (x > 1) ret.push_back(x);     return ret;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n;     for (int i = 1; i < n + 1; ++i) cin >> a[i];     int cur = 1;     while (cur <= n) {       vector<int> f = factors(a[cur]);       bool ok = true;       for (int i = 0; i < int((f).size()); ++i) {         if (seen[f[i]]) {           ok = false;           break;         }       }       if (!ok) break;       b[cur] = a[cur];       cur++;       for (int i = 0; i < int((f).size()); ++i) seen[f[i]] = 1;     }     if (cur <= n) {       for (int i = a[cur] + 1;; i++) {         vector<int> f = factors(i);         bool ok = true;         for (int j = 0; j < int((f).size()); ++j) {           if (seen[f[j]]) {             ok = false;             break;           }         }         if (ok) {           b[cur] = i;           for (int j = 0; j < int((f).size()); ++j) {             seen[f[j]] = 1;           }           cur++;           break;         }       }     }     if (cur <= n) {       vector<int> v;       for (int i = 2;; i++) {         if (cur + int((v).size()) > 1e5 + 5) break;         if (seen[i]) continue;         vector<int> f = factors(i);         bool ok = true;         for (int j = 0; j < int((f).size()); ++j)           if (seen[f[j]]) {             ok = false;             break;           }         if (ok) {           v.push_back(i);           for (int j = 0; j < int((f).size()); ++j) seen[f[j]] = 1;         }       }       int i = 0;       while (cur <= n) {         b[cur++] = v[i++];       }     }     for (int i = 1; i < n + 1; ++i) cout << b[i] <<    ;     cout <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, p, ans, v;   void wczytaj(int x) {     string slowo;     cin >> slowo;     if (x != n) wczytaj(x + 1);     if (slowo.size() > 4) {       ans += v * p;       ans += p / 2;       v *= 2;       ++v;     } else {       ans += v * p;       v *= 2;     }   }   int main() {     cin >> n >> p;     wczytaj(1);     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t-- > 0) {       int n;       cin >> n;       int a;       int f[51] = {0};       for (int i = 0; i < 2 * n; i++) {         cin >> a;         if (f[a] == 0) {           f[a]++;           cout << a <<    ;         }       }       std::cout <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int nmax = 32;   int n, arr[nmax];   vector<int> output, current;   bool been[2 * nmax][2 * nmax * nmax][nmax];   void dfs(int people, int sum, int position) {     if (position > n) {       if (people * (people - 1) / 2 == sum) {         if (output.size() == 0)           output = current;         else if (output.size() > current.size())           output = current;       }       return;     }     if (been[people][sum][position]) return;     been[people][sum][position] = 1;     int take_now = 1;     for (; take_now * arr[position] + sum >=            (people + take_now) * (people + take_now - 1) / 2;          take_now++) {       current.push_back(arr[position]);       dfs(people + take_now, take_now * arr[position] + sum, position + 1);     }     for (int i = 1; i < take_now; i++) {       current.pop_back();     }   }   pair<int, int> work[2 * nmax];   bool cmp(pair<int, int> a, pair<int, int> b) { return a.second < b.second; }   int out[2 * nmax][2 * nmax];   int main() {     scanf( %i , &n);     for (int i = 1; i <= n; i++) scanf( %i , &arr[i]);     sort(arr + 1, arr + n + 1);     dfs(0, 0, 1);     if (output.size() == 0) {       printf( =( );       return 0;     }     printf( %i n , output.size());     for (int i = 1; i <= output.size(); i++) work[i] = {i, output[i - 1]};     for (int steps = output.size(); steps >= 1; steps--) {       sort(work + 1, work + steps + 1, cmp);       assert(work[steps].second < steps);       int who = work[steps].first;       for (int j = 1; j <= work[steps].second; j++) out[who][work[j].first] = 1;       for (int j = work[steps].second + 1; j < steps; j++) {         assert(work[j].second);         work[j].second--;         out[work[j].first][who] = 1;       }     }     for (int i = 1; i <= output.size(); i++) {       for (int j = 1; j <= output.size(); j++) printf( %i , out[i][j]);       printf(  n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int manx = 1e5 + 100;   const int INF = 0x3f3f3f3f;   int main() {     int n, a[200], b[200], cnt = 0, numb1 = 0;     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d , &a[i]);       if (a[i]) cnt++;     }     for (int i = 1; i <= n; i++) {       scanf( %d , &b[i]);       if (b[i]) {         if (a[i])           cnt--;         else           numb1++;       }     }     if (!cnt)       printf( -1 n );     else       printf( %d n , numb1 / cnt + 1);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long n;     int k;     cin >> n >> k;     long l = 1, r = n;     while (l < r) {       long m = l + (r - l) / 2;       long s = 0, v = m;       while (v != 0) {         s += v;         v /= k;       }       if (s >= n)         r = m;       else         l = m + 1;     }     cout << l << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename P, typename Q>   ostream& operator<<(ostream& os, pair<P, Q> p) {     os <<  (  << p.first <<  ,  << p.second <<  ) ;     return os;   }   int main(int argc, char* argv[]) {     ios_base::sync_with_stdio(0);     cin.tie(0);     int n;     long long int k;     while (cin >> n >> k) {       deque<int> q;       for (int i = 0; i < n; ++i) {         int a;         cin >> a;         q.push_back(a);       }       int x = n;       while (true) {         int a = q.front();         q.pop_front();         int b = q.front();         q.pop_front();         int cnt = 1;         int c = max(a, b);         q.push_back(min(a, b));         while (cnt < min<long long int>(n, k)) {           if (c < q.front()) {             break;           }           ++cnt;           q.push_back(q.front());           q.pop_front();         }         if (min<long long int>(n, k) == cnt) {           x = c;           break;         }         q.push_front(c);       }       cout << x << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 200010, M = 500010;   int h[N], e[M * 2], nex[M * 2], idx, n, m, nodea, nodeb, sz;   int col[N];   void add(int x, int y) {     e[idx] = y;     nex[idx] = h[x];     h[x] = idx++;   }   bool dfs1(int u) {     col[u] = 1;     sz++;     for (int i = h[u]; ~i; i = nex[i]) {       int v = e[i];       if (v == nodea) continue;       if (v == nodeb || col[v] == 2) return false;       if (col[v] == 0) {         if (!dfs1(v)) return false;       }     }     return true;   }   bool dfs2(int u) {     col[u] = -1;     sz++;     for (int i = h[u]; ~i; i = nex[i]) {       int v = e[i];       if (v == nodeb) continue;       if (v == nodea || col[v] == 1 || col[v] == 2) return false;       if (col[v] == 0) {         if (!dfs2(v)) return false;       }     }     return true;   }   void modify(int u) {     col[u] = 2;     for (int i = h[u]; ~i; i = nex[i]) {       int v = e[i];       if (col[v] == 2 || v == nodea || v == nodeb)         continue;       else         modify(v);     }   }   int main() {     int T;     cin >> T;     while (T--) {       scanf( %d%d%d%d , &n, &m, &nodea, &nodeb);       for (int i = 0; i <= n; ++i) h[i] = -1, col[i] = 0;       idx = 0;       for (int i = 1; i <= m; ++i) {         int x, y;         scanf( %d%d , &x, &y);         add(x, y);         add(y, x);       }       int cnta = 0, cntb = 0;       for (int i = h[nodea]; ~i; i = nex[i]) {         int v = e[i];         sz = 0;         if (col[v] == 0 && v != nodeb) {           if (dfs1(v))             cnta += sz;           else             modify(v);         }       }       for (int i = h[nodeb]; ~i; i = nex[i]) {         int v = e[i];         sz = 0;         if (col[v] == 0 && v != nodea) {           if (dfs2(v))             cntb += sz;           else             modify(v);         }       }       cout << 1ll * cnta * cntb << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, d[100005], sd[100005][3], f[2 * 100005];   int Find(int x) { return f[x] == x ? x : f[x] = Find(f[x]); }   void link(int a, int b) {     int x = Find(a), y = Find(b);     if (x != y) f[x] = y;   }   int main(void) {     cin >> n >> m;     for (int i = 0; i < n; ++i) cin >> d[i];     for (int i = 0; i < m; ++i) {       int x;       cin >> x;       for (int j = 0; j < x; ++j) {         int dr;         cin >> dr;         dr--;         sd[dr][++sd[dr][0]] = i;       }     }     for (int i = 0; i < 2 * m; ++i) f[i] = i;     for (int i = 0; i < n; ++i) {       if (d[i])         link(sd[i][1], sd[i][2]), link(sd[i][1] + m, sd[i][2] + m);       else         link(sd[i][1], sd[i][2] + m), link(sd[i][1] + m, sd[i][2]);     }     for (int i = 0; i < m; ++i)       if (Find(i) == Find(i + m)) {         cout <<  NO ;         return 0;       }     cout <<  YES ;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1005;   char st[maxn][maxn];   char tmp[maxn][maxn];   int row[maxn], rs;   int col[maxn], cs;   int n, m;   void init() {     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; i++) scanf( %s , st[i] + 1);   }   void work() {     rs = 0;     for (int i = 1; i <= n; i++) {       bool flag = 0;       for (int j = 1; j <= m && !flag; j++)         if (st[i][j] ==  #  && st[i][j - 1] ==  #  && st[i][j + 1] ==  # )           flag = 1;       if (flag) row[rs++] = i;     }     cs = 0;     for (int j = 1; j <= m; j++) {       bool flag = 0;       for (int i = 1; i <= n && !flag; i++)         if (st[i][j] ==  #  && st[i - 1][j] ==  #  && st[i + 1][j] ==  # )           flag = 1;       if (flag) col[cs++] = j;     }     if (rs > 4) {       row[2] = row[rs - 2], row[3] = row[rs - 1];       rs = 4;     }     if (cs > 4) {       col[2] = col[cs - 2], col[3] = col[cs - 1];       cs = 4;     }   }   bool Same() {     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++)         if (st[i][j] != tmp[i][j]) return 0;     return 1;   }   bool Paint(int x1, int x2, int y1, int y2) {     for (int i = x1; i <= x2; i++) {       if (st[i][y1] !=  #  || st[i][y2] !=  # ) return 0;       tmp[i][y1] = tmp[i][y2] =  # ;     }     for (int i = y1; i <= y2; i++) {       if (st[x1][i] !=  #  || st[x2][i] !=  # ) return 0;       tmp[x1][i] = tmp[x2][i] =  # ;     }     return 1;   }   void print() {     for (int x1 = 0; x1 < rs; x1++)       for (int x2 = x1 + 1; x2 < rs; x2++)         if ((row[x2]) - (row[x1]) > 1)           for (int y1 = 0; y1 < cs; y1++)             for (int y2 = y1 + 1; y2 < cs; y2++)               if ((col[y2]) - (col[y1]) > 1)                 for (int x3 = 0; x3 < rs; x3++)                   for (int x4 = x1 + 1; x4 < rs; x4++)                     if ((row[x4]) - (row[x3]) > 1)                       for (int y3 = 0; y3 < cs; y3++)                         for (int y4 = y3 + 1; y4 < cs; y4++)                           if ((col[y4]) - (col[y3]) > 1) {                             memset(tmp,  . , sizeof(tmp));                             if (!Paint((row[x1]), (row[x2]), (col[y1]),                                        (col[y2])) ||                                 !Paint((row[x3]), (row[x4]), (col[y3]),                                        (col[y4])))                               continue;                             if (Same()) {                               printf( YES n%d %d %d %d n%d %d %d %d n , (row[x1]),                                      (col[y1]), (row[x2]), (col[y2]), (row[x3]),                                      (col[y3]), (row[x4]), (col[y4]));                               return;                             }                           }     puts( NO );   }   int main() {     init();     work();     print();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 150005;   int a[MAXN];   int num[MAXN];   bool vis[MAXN];   int n, m, ans;   int main() {     memset(vis, 0, sizeof(vis));     memset(num, 0, sizeof(num));     scanf( %d , &n);     for (int i = 0; i < n; i++) {       scanf( %d , &a[i]);       num[a[i]]++;     }     sort(a, a + n);     m = unique(a, a + n) - a;     ans = 0;     for (int i = m - 1; i >= 0; i--) {       for (int j = 1; j >= -1 && num[a[i]] > 0; j--) {         if (a[i] + j > 0 && !vis[a[i] + j]) {           vis[a[i] + j] = true;           num[a[i]]--;           ans++;         }       }     }     printf( %d , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   pair<long long, long long> a[5];   long long k;   int main() {     for (long long i = 1, _b = (2); i <= _b; i++)       cin >> a[i].first >> a[i].second;     cin >> k;     sort(a + 1, a + 2 + 1);     if (a[1].second < a[2].first) return cout << 0, 0;     long long res = min(a[2].second, a[1].second) - a[2].first + 1;     if (k >= a[2].first && k <= min(a[1].second, a[2].second)) res--;     cout << res;   }
#include <bits/stdc++.h>   using namespace std;   bool debug = 1;   int main() {     long long k;     vector<long long> v;     scanf( %lld , &k);     string s;     cin >> s;     long long sum = 0;     for (int i = 0; i < (s.size()); i++) {       v.push_back(s[i] -  0 );       sum += v[i];     }     sort(v.begin(), v.end());     int i = 0;     long long ans = 0;     while (i < v.size() and sum < k) {       sum += (9 - v[i]);       i++;       ans++;     }     printf( %lld n , ans);     return 0;   }