malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <iostream>   #include <algorithm>   #include <vector>   #include <cmath>      using namespace std;         int main()   {       int t = 0;          cin>>t;       for(int i = 0; i < t; i++)       {           int n = 0;           cin>>n;           int v[100] = {0};           for(int j = 0; j < n; j++) cin>>v[j];              if(v[0] == n && v[n-1] == 1)           {               cout<<3<<  n ;              }           else if(v[0] != 1 && v[n-1] != n)           {               cout<<2<<  n ;           }           else if(v[0] == 1 && v[n-1] != n)           {               cout<<1<<  n ;           }           else if(v[0] != 1 && v[n-1] == n)           {               cout<<1<<  n ;           }           else           {               bool d = false;               for(int j = 0; j < n; j++)               {                   if(v[j] != j+1)                   {                       d = true;                       break;                   }               }               if(!d) cout<<0<<   ;               else cout<<1<<   ;           }       }          return 0;   }
#include <bits/stdc++.h>   template <typename T>   inline void read(T &x) {     bool b = 0;     char c;     while (!isdigit(c = getchar()) && c !=  - )       ;     if (c ==  - ) c = getchar(), b = 1;     x = c - 48;     while (isdigit(c = getchar())) x = x * 10 + c - 48;     if (b) x = -x;   }   void reads(std ::string &s) {     char c;     while (!isalpha(c = getchar()))       ;     s += c;     while (isalpha(c = getchar())) s += c;   }   using namespace std;   const int N = 1e5 + 11;   int m;   long long n, f[N], ans[50], last[50];   string s;   int main() {     ios_base::sync_with_stdio(0);     cout.tie(0);     if (fopen( m                 .inp ,                r )) {       freopen(            m             .inp ,            r , stdin);     }     read(m);     long long lastl = 0, lastr = 0;     int chl, chr;     for (int ii = 1; ii <= m; ii++) {       s =  # ;       reads(s);       n = s.size() - 1;       for (int i = 0; i < 26; i++) ans[i] = 0;       for (int i = 1; i <= n; i++) {         if (s[i] == s[i - 1])           f[i] = f[i - 1];         else           f[i] = 0;         f[i]++;         ans[s[i] -  a ] = max(ans[s[i] -  a ], f[i]);       }       long long l = 1, r = f[n];       for (int i = 2; i <= n; i++) {         if (f[i] == 1) break;         l = f[i];       }       if (s[1] == s[n] && last[s[1] -  a ] > 0)         ans[s[1] -  a ] = l + r + 1;       else         ans[s[1] -  a ] = l + (last[s[1] -  a ] > 0),                    ans[s[n] -  a ] = r + (last[s[n] -  a ] > 0);       if (l == n) ans[s[1] -  a ] = last[s[1] -  a ] + (last[s[1] -  a ] + 1) * l;       if (s[1] == chl) l = lastl + (lastl + 1) * l;       if (s[n] == chr) r = lastr + (lastr + 1) * r;       for (int i = 0; i < 26; i++) {         int ooooo = 0;         if (last[i]) ooooo = 1;         last[i] = ans[i];         if (!last[i]) last[i] = ooooo;       }       chl = s[1] -  a ;       chr = s[n] -  a ;       lastl = l;       lastr = r;     }     long long res = max(lastl, lastr);     for (int i = 0; i < 26; i++) res = max(res, last[i]);     cout << res;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e3 + 7;   const long long mod = 998244353;   mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());   int n, s, d;   unsigned long long ok[N];   unsigned long long d1[(1 << 20)], d2[(1 << 10)], a[N];   unordered_map<unsigned long long, int> m;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     for (int i = 0; i < N; i++) ok[i] = rng();     cin >> n >> s >> d;     for (int i = 0; i < s; i++) {       int len;       cin >> len;       for (int j = 1; j <= len; j++) {         int x;         cin >> x;         a[i] ^= ok[x];       }     }     int c = min(20, s);     for (int i = 0; i < c; i++) {       for (int j = 0; j < (1 << i); j++) {         d1[(1 << i) + j] = (d1[j] ^ a[i]);       }     }     for (int i = 0; i < s - c; i++) {       for (int j = 0; j < (1 << i); j++) {         d2[j + (1 << i)] = (d2[j] ^ a[i + c]);       }     }     for (int i = 0; i < (1 << c); i++) {       unsigned long long res = d1[i];       if (m.find(res) == m.end()) {         m[res] = __builtin_popcount(i);       } else {         m[res] = min(m[res], __builtin_popcount(i));       }     }     for (int i = 1; i <= d; i++) {       int len;       cin >> len;       unsigned long long a = 0;       for (int j = 1; j <= len; j++) {         int x;         cin >> x;         a ^= ok[x];       }       int ans = 1e9;       for (int j = 0; j < (1 << s - c); j++) {         auto c = (a ^ d2[j]);         if (m.find(c) != m.end()) {           ans = min(ans, m[c] + __builtin_popcount(j));         }       }       cout << (ans == 1e9 ? -1 : ans) <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e6 + 20;   int n, x, y, a[maxn], o = 0;   int main() {     cin >> n >> x >> y;     for (int i = 0; i < n; i++) cin >> a[i];     for (int i = 0; i < n; i++) {       for (int j = max(0, i + x - 1); j < i; j++) {         if (a[j] < a[i]) {           o = 1;           break;         }       }       for (int j = i + 1; j < min(y + i + 1, n); j++) {         if (a[j] < a[i]) {           o = 1;           break;         }       }       if (o == 0) {         cout << i + 1 << endl;         return 0;       }       o = 0;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   bool sortinrev(const pair<int, int> &a, const pair<int, int> &b) {     return (a.first > b.first);   }   bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {     return (a.second < b.second);   }   long long int power(long long int x, long long int y, long long int p) {     long long int res = 1;     x = x % p;     while (y > 0) {       if (y & 1) res = (res * x) % p;       y = y >> 1;       x = (x * x) % p;     }     return res;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     double x1, x2, y1, y2, r;     cin >> r >> x1 >> y1 >> x2 >> y2;     double d = sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));     double a = d / (2 * r);     int b;     if ((int)a * 2 * r == d)       b = 0;     else       b = 1;     if (b == 0)       cout << (int)a;     else       cout << (int)a + 1;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2e3;   int n, h, aa[N + 2], vis[2][N + 1][N + 1][2];   double p, dp[2][N + 1][N + 1][2];   double dfs(int s1, int lo, int hi, int s2) {     if (vis[s1][lo][hi][s2]) return dp[s1][lo][hi][s2];     vis[s1][lo][hi][s2] = 1;     if (lo > hi) return 0;     double here = 0;     int em;     if (s1 == 0)       em = min(aa[lo] - aa[lo - 1], h);     else       em = min(aa[lo] - aa[lo - 1] - h, h);     here += 0.5 * p * em + 0.5 * p * dfs(0, lo + 1, hi, s2);     em = aa[lo] + h;     int i;     for (i = lo + 1; i <= hi; i++) {       if (aa[i] >= em) break;       em = aa[i] + h;     }     if (i > hi) {       if (s2 == 1)         em = min(em, aa[hi + 1]);       else         em = min(em, aa[hi + 1] - h);     }     em -= aa[lo];     here += 0.5 * (1.0 - p) * em + 0.5 * (1.0 - p) * dfs(1, i, hi, s2);     if (s2 == 1)       em = min(aa[hi + 1] - aa[hi], h);     else       em = min(aa[hi + 1] - aa[hi] - h, h);     here += 0.5 * (1.0 - p) * em + 0.5 * (1.0 - p) * dfs(s1, lo, hi - 1, 1);     em = aa[hi] - h;     for (i = hi - 1; i >= lo; i--) {       if (aa[i] <= em) break;       em = aa[i] - h;     }     if (i < lo) {       if (s1 == 0)         em = max(em, aa[lo - 1]);       else         em = max(em, aa[lo - 1] + h);     }     em = aa[hi] - em;     here += 0.5 * p * em + 0.5 * p * dfs(s1, lo, i, 0);     return dp[s1][lo][hi][s2] = here;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cin >> n >> h >> p;     for (int i = 1; i <= n; i++) cin >> aa[i];     sort(aa + 1, aa + n + 1);     aa[0] = -1e9, aa[n + 1] = 1e9;     cout << setprecision(9) << fixed << dfs(0, 1, n, 1) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     int n1, n2, n3 = 0;     bool flagm = true, flagr = true;     while (n--) {       cin >> n1 >> n2;       if (n3 < n2 && n3 != 0) flagm = false;       if (n1 != n2) flagr = false;       n3 = n2;     }     if (!flagr)       cout <<  rated ;     else if (flagr && !flagm)       cout <<  unrated ;     else       cout <<  maybe ;   }
#include <bits/stdc++.h>   using namespace std;   int k[3], t[3];   int n;   long long a[100000];   long long was[100000];   int main() {     scanf( %d %d %d , &k[0], &k[1], &k[2]);     scanf( %d %d %d , &t[0], &t[1], &t[2]);     scanf( %d , &n);     for (int i = 0; i < n; i++) {       scanf( %I64d , &a[i]);       was[i] = a[i];     }     for (int i = 0; i < 3; i++) {       for (int j = 0; j < k[i]; j++) {         int pos = j;         long long finished = -1000000;         if (pos >= n) break;         while (pos < n) {           a[pos] = finished = max(finished + t[i], a[pos] + t[i]);           pos += k[i];         }       }     }     long long res = a[0] - was[0];     for (int i = 1; i < n; i++)       if (res < a[i] - was[i]) res = a[i] - was[i];     printf( %I64d n , res);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using LL = long long;   using VI = vector<int>;   const int inf = 2e9;   LL calc(set<int>& st, int L, int R) {     VI a;     for (int i = L;;) {       a.push_back(i);       if (i == R) break;       if (st.upper_bound(i) != st.end() && *st.upper_bound(i) < R)         i = *st.upper_bound(i);       else         i = R;     }     int ans = 0;     for (int i = 0; i + 1 < a.size(); i++) ans = max(ans, a[i + 1] - a[i]);     return ans;   }   int main() {     int n;     cin >> n;     set<int> a, b, c;     for (int i = 0; i < n; i++) {       int x;       char ch;       scanf( %d %c , &x, &ch);       if (ch ==  B ) a.insert(x);       if (ch ==  R ) b.insert(x);       if (ch ==  P ) c.insert(x);     }     int B = 0, R = 0;     int mn = inf, mx = -inf;     if (a.size()) mn = min(mn, *a.begin()), mx = max(mx, *--a.end());     if (c.size()) mn = min(mn, *c.begin()), mx = max(mx, *--c.end());     if (mn != inf) B = mx - mn;     mn = inf, mx = -inf;     if (b.size()) mn = min(mn, *b.begin()), mx = max(mx, *--b.end());     if (c.size()) mn = min(mn, *c.begin()), mx = max(mx, *--c.end());     if (mn != inf) R = mx - mn;     LL ans = (LL)B + R;     if (!B || !R || c.empty()) {       cout << ans << endl;       return 0;     }     for (auto i = c.begin(); ++i != c.end(); i++) {       auto j = i;       i--;       LL g = (*j - *i) - calc(a, *i, *j) - calc(b, *i, *j);       if (g < 0) ans += g;     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 0x3f3f3f3f;   const int N = 1e6 + 10;   const int mod = 998244353;   int m, n, k = 0, flag = 0, cnt = 0;   int a[N], ans[N];   long long pow2[N];   bool did[N];   int main() {     ios::sync_with_stdio(false);     cin >> n >> k;     ;     for (int i = 0; i < n; i++) {       cin >> a[i];       if (a[i] <= k && !flag) {         cnt++;         did[i] = 1;       }       if (a[i] > k) flag = 1;     }     flag = 0;     for (int i = n - 1; i >= 0; i--) {       if (a[i] <= k && !flag && !did[i]) cnt++;       if (a[i] > k) flag = 1;     }     cout << cnt << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 100;   int cost[N][2], timee, tmm, num, clr, n;   char ha, arr[25];   string tm1, tm2;   int main() {     scanf(  %s , &arr);     tm1 = arr;     scanf(  %s%d , &arr, &n);     tm2 = arr;     while (n--) {       scanf( %d %c%d %c , &timee, &tmm, &num, &clr);       if (clr ==  y ) {         if (tmm ==  h ) {           cost[num][0]++;         } else {           cost[num][1]++;         }       } else {         if (tmm ==  h ) {           cost[num][0] += 2;         } else {           cost[num][1] += 2;         }       }       if (cost[num][0] > 1) {         cout << tm1 <<     << num <<     << timee <<   n ;         cost[num][0] = -1e9;       }       if (cost[num][1] > 1) {         cout << tm2 <<     << num <<     << timee <<   n ;         cost[num][1] = -1e9;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   set<string> setao;   string s;   const int N = 10010;   int pd[N][4], n;   char solve(int k, int last) {     if (k == n) return 1;     if (n - k == 1 or k > n) return 0;     if (pd[k][last] != -1) return pd[k][last];     string ant;     for (int i = last; i >= 1; i--) {       ant.push_back(s[k - i]);     }     string x;     for (int i = 0; i < 2; i++) x.push_back(s[k + i]);     char flag = 0;     if (x != ant) {       if (solve(k + 2, 2)) {         setao.insert(x);         flag = 1;       }     }     if (n - k > 2) {       x.push_back(s[k + 2]);       if (x != ant) {         if (solve(k + 3, 3)) {           setao.insert(x);           flag = 1;         }       }     }     return pd[k][last] = flag;   }   int main(void) {     memset(pd, -1, sizeof pd);     cin >> s;     n = s.size();     for (int i = 5; i < n; i++) {       solve(i, 0);     }     printf( %d n , (int)setao.size());     for (set<string>::iterator it = setao.begin(); it != setao.end(); it++) {       cout << *it << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int ara[1000000];   int wow[7 * 22000];   void make_wow(int x) {     int xx;     int l;     int k = 1;     stack<int> s;     for (int i = 1; i <= x; i++) {       xx = i;       while (xx != 0) {         l = xx % 10;         xx /= 10;         s.push(l);       }       while (!s.empty()) {         wow[k++] = s.top();         s.pop();       }     }   }   int find_block(int x, int b) {     for (int i = 1; i <= b; i++) {       if (ara[i] >= x) return i - 1;     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int q;     cin >> q;     int k = 1;     int i = 1;     int b = 1;     long long int sum = 0, x, lb;     while (ara[b - 1] <= 1000000000) {       sum += log10(i++) + 1;       ara[b] = ara[b - 1] + sum;       b++;     }     make_wow(b);     while (q--) {       cin >> x;       cout << wow[x - ara[find_block(x, b)]] << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   map<long long, vector<long long>> M;   bool res[100010];   int main() {     long long n;     long long k;     cin >> n >> k;     long long S = 0;     for (long long i = 1; i <= n; i++) {       long long a;       cin >> a;       M[a].push_back(i);       S += a;     }     if (S < k) {       cout <<  -1 ;       return (0);     }     if (S == k) return (0);     long long lv_prev = 0;     long long tmp = n;     map<long long, vector<long long>>::iterator it = M.begin();     while (true) {       long long lv = it->first;       if (k >= (lv - lv_prev) * tmp) {         k -= ((lv - lv_prev) * tmp);         tmp -= it->second.size();       } else         break;       it++;       lv_prev = lv;     }     long long dlt = k / tmp + lv_prev;     k %= tmp;     vector<pair<long long, long long>> V;     for (; it != M.end(); it++) {       for (long long i = 0; i < it->second.size(); i++) {         V.push_back(make_pair(it->second[i], it->first - dlt));       }     }     sort(V.begin(), V.end());     cout <<   ;     for (int i = 0; i < k; i++) {       V[i].second -= 1;       V.push_back(V[i]);     }     for (int i = k; i < V.size(); i++)       if (V[i].second > 0) cout << V[i].first <<    ;   exit:     return (0);   }
#include <bits/stdc++.h>   using namespace std;   int indeg[510], vis[510], indeg1[510], vis1[510];   int n, m;   vector<vector<int> > adj(510);   int check(int x) {     int i, c, p;     queue<int> q;     for (i = 0; i < n; i++) {       vis1[i] = vis[i];       indeg1[i] = indeg[i];     }     indeg1[x]--;     q.push(x);     c = 1;     while (!q.empty()) {       p = q.front();       q.pop();       for (i = 0; i < adj[p].size(); i++) {         indeg1[adj[p][i]]--;         if (indeg1[adj[p][i]] == 0 && vis1[adj[p][i]] == 0) {           vis1[adj[p][i]] = 1;           c++;           q.push(adj[p][i]);         }       }     }     return c;   }   int toposort() {     int i, c = 0, j, p;     queue<int> q;     vector<int> v;     for (i = 0; i < n; i++) {       indeg[i] = 0;       vis[i] = 0;     }     for (i = 0; i < n; i++) {       for (j = 0; j < adj[i].size(); j++) {         indeg[adj[i][j]]++;       }     }     for (i = 0; i < n; i++) {       if (indeg[i] == 0) {         q.push(i);         vis[i] = 1;         c++;       }     }     while (!q.empty()) {       p = q.front();       q.pop();       for (i = 0; i < adj[p].size(); i++) {         indeg[adj[p][i]]--;         if (indeg[adj[p][i]] == 0 && vis[adj[p][i]] == 0) {           vis[adj[p][i]] = 1;           c++;           q.push(adj[p][i]);         }       }     }     if (c == n) {       cout <<  YES  << endl;       exit(0);     } else {       for (i = 0; i < n; i++) {         if (indeg[i] == 1) {           v.push_back(i);         }       }       if (v.size() == 0) {         cout <<  NO  << endl;         exit(0);       } else {         for (i = 0; i < v.size(); i++)           if (check(v[i]) + c == n) {             cout <<  YES  << endl;             exit(0);           }         cout <<  NO  << endl;         exit(0);       }     }   }   int main() {     std::ios::sync_with_stdio(false);     int u, v, i;     cin >> n >> m;     for (i = 0; i < m; i++) {       cin >> u >> v;       u--;       v--;       adj[u].push_back(v);     }     toposort();   }
#include <bits/stdc++.h>   using namespace std;   const double EPS = 1e-9;   long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }   template <typename t1>   t1 gcd(t1 a, t1 b) {     return b == 0 ? a : gcd(b, a % b);   }   template <typename t1>   t1 lcm(t1 a, t1 b) {     return a * (b / gcd(a, b));   }   int main() {     string s;     while (cin >> s) {       stack<char> st;       int len = s.length();       int count = 0;       int flag = 0;       for (int i = 0; i < len; i++) {         char x = s[i];         if (x ==  <  || x ==  (  || x ==  {  || x ==  [ ) {           st.push(x);         } else {           if (st.empty()) {             flag = 1;             break;           }           char y = st.top();           if (y ==  <  && x ==  > ) {             st.pop();           } else if (y ==  (  && x ==  ) ) {             st.pop();           } else if (y ==  [  && x ==  ] ) {             st.pop();           } else if (y ==  {  && x ==  } ) {             st.pop();           } else {             count++;             st.pop();           }         }       }       if (!st.empty()) flag = 1;       if (flag)         cout <<  Impossible  << endl;       else         cout << count << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   mt19937 dadi(chrono::high_resolution_clock::now().time_since_epoch().count());   const int N = 100 + 5, K = 1e3 + 5;   int n, m, k, w[N], p[K], cnt[N][K];   struct game {     int u, v, t;   } a[K];   inline int add(int u, int v) {     shuffle(p, p + k, dadi);     int mx1 = *max_element(cnt[u], cnt[u] + k);     int mx2 = *max_element(cnt[v], cnt[v] + k);     for (int i = 0; i < k; i++)       if (cnt[u][p[i]] < mx1 && cnt[v][p[i]] < mx2) return p[i];     for (int i = 0; i < k; i++)       if (cnt[u][p[i]] < mx1 || cnt[v][p[i]] < mx2) return p[i];     return p[0];   }   inline void read_input() {     cin >> n >> m >> k;     for (int i = 0; i < n; i++) cin >> w[i];     for (int i = 0; i < m; i++) {       cin >> a[i].u >> a[i].v;       a[i].u--, a[i].v--;     }   }   inline void solve() {     for (iota(p, p + k, 0); true; memset(cnt, 0, sizeof cnt)) {       bool flag = true;       for (int i = 0; i < m; i++) {         cnt[a[i].u][a[i].t = add(a[i].u, a[i].v)]++;         cnt[a[i].v][a[i].t++]++;       }       for (int i = 0; i < n; i++)         flag &=             *max_element(cnt[i], cnt[i] + k) - *min_element(cnt[i], cnt[i] + k) <             3;       if (flag) break;     }   }   inline void write_output() {     for (int i = 0; i < m; i++) cout << a[i].t << endl;   }   int main() {     ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);     read_input(), solve(), write_output();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int k, m = 1e9, a, b, n, i;   int main() {     scanf( %d , &n);     for (i = 0; i < n; i++) {       scanf( %d%d , &a, &b);       m = min(m, b);       k += m * a;     }     printf( %d n , k);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   #define rep(i, a, b) for(int i=a; i<=b; i++)   #define repd(i, a, b) for(int i=a; i>=b; i--)   #define vi vector<int>   #define vll vector<long long>   #define pii pair<int,int>   #define pll pair<long long,long long>   #define pb push_back   #define fr first   #define sc second   #define vb vector<bool>      typedef long long ll;   typedef unsigned long long ull;      /*struct cmp {       bool operator()(const pair<int, pii> &p1, const pair<int, pii> &p2) {           return p1.fr > p2.fr;       }   };*/      void google(){    static int tc=1;    cout<< Case # <<tc<< :  ;    tc++;   }      int n;      void solve(int tc = 1) {        vi v(n);    for(int i=0;i<n;i++) cin>>v[i];        int cnt=0;    ll h=0;    priority_queue<ll> q;    for(int i=0;i<n;i++){     h+=v[i];     if(v[i]<0){      q.push(-v[i]);     }     cnt++;     if(h<0){      int val=q.top();      q.pop();      cnt--;      h+=val;     }     // cout<<cnt<<   <<h<<endl;    }        cout<<cnt<<endl;   }      int main() {   /*#ifndef ONLINE_JUDGE       freopen( input.txt ,  r , stdin);       freopen( output.txt ,  w , stdout);   #endif*/       ios::sync_with_stdio(false);       cin.tie(0);       //cout << setprecision(16) << fixed;       int t = 1;       // cin >> t;       int tc=0;       while (t--) {        cin>>n;           tc++;           solve(tc);       }   }
#include <bits/stdc++.h>   using namespace std;   long long mod = 1e9 + 7;   long long a[1000005], b[1000005];   long long nine[100], t[100];   int main() {     int n, k;     t[0] = 1LL;     for (int i = (1); i <= (10); i++) t[i] = (t[i - 1] * 10LL) % mod;     nine[1] = 9LL;     for (int i = (2); i <= (10); i++) nine[i] = (nine[i - 1] * 10 + 9) % mod;     long long ans = 1;     scanf( %d , &(n));     scanf( %d , &(k));     for (int i = (1); i <= (n / k); i++) scanf( %lld , &(a[i]));     for (int i = (1); i <= (n / k); i++) scanf( %lld , &(b[i]));     t[0] = 0;     nine[0] = 9;     for (int i = (1); i <= (n / k); i++) {       long long f = ((t[k] - 1) / a[i]) + 1;       f %= mod;       long long ss = b[i];       long long temp = 0;       long long st = ss * t[k - 1];       long long e = st + nine[k - 1];       if (k == 1) st = b[i];       if (k == 1) e = st;       temp = ((e / a[i]) - ((st - 1) / a[i]));       if (st == 0) temp = e / a[i] + 1;       f -= temp;       if (f < mod) f += mod;       ans = (ans * f) % mod;     }     cout << ans % mod << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, i, x1, y1, x2, y2, j, k, sum = 0;     int a[101][101];     memset(a, 0, sizeof(a));     scanf( %d , &n);     for (i = 0; i < n; i++) {       scanf( %d%d%d%d , &x1, &y1, &x2, &y2);       for (k = x1; k <= x2; k++)         for (j = y1; j <= y2; j++) a[k][j]++;     }     for (i = 1; i <= 100; i++)       for (j = 1; j <= 100; j++) sum += a[i][j];     printf( %d n , sum);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int spend(int x) {     int b, total, cash_back, left;     cash_back = x / 10;     b = cash_back * 10;     left = x - b + cash_back;     if (cash_back < 1) {       return left;     }     return b + spend(left);   }   int main() {     int testcase;     cin >> testcase;     int burles[testcase];     for (int i = 0; i < testcase; ++i) {       cin >> burles[i];       cout << spend(burles[i]);       cout << endl;     }     return 0;   }