malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   using vi = vector<int>;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int t = 1;     cin >> t;     vi v(t);     for (int i = 0; i < t; i++) {       cin >> v[i];     }     int m = t;     priority_queue<int> qi;     for (int i = 0; i < t; i++) {       if (v[i] == m) {         m--;         cout << v[i] <<    ;         while (!qi.empty() && (qi.top() == m)) {           m--;           cout << qi.top() <<    ;           qi.pop();         }       } else         qi.push(v[i]);       cout <<   n ;     }     cerr <<   ntime taken :   << (float)clock() / CLOCKS_PER_SEC <<   secs           << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int s, v1, v2, p1, p2;     scanf( %d%d%d%d%d , &s, &v1, &v2, &p1, &p2);     if (v1 * s + p1 * 2 < v2 * s + p2 * 2) printf( First n );     if (v1 * s + p1 * 2 > v2 * s + p2 * 2) printf( Second n );     if (v1 * s + p1 * 2 == v2 * s + p2 * 2) printf( Friendship n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, d;     cin >> n >> d;     vector<int> a(n);     for (int i = 0; i < n; ++i) cin >> a[i];     int ans = 2;     for (int i = 1; i < n; ++i) {       if (a[i] - a[i - 1] > 2 * d)         ans += 2;       else if (a[i] - a[i - 1] == 2 * d)         ++ans;     }     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MOD = 1000000007;   const int N = 10;   int n, k;   int a[1005];   int main() {     ios_base::sync_with_stdio(false);     cin >> n >> k;     int nn = n;     for (int i = 0; i < k; i++) {       cin >> a[i];       while (a[i] >= 4 && nn > 0) {         a[i] -= 4;         nn--;       }     }     int n2 = n * 2 + nn;     for (int i = 0; i < k; i++) {       while (a[i] >= 2 && n2 > 0) {         a[i] -= 2;         n2--;       }     }     int sum = 0;     for (int i = 0; i < k; i++) {       sum += a[i];     }     if (sum > nn + n2) {       cout <<  NO  << endl;     } else {       cout <<  YES  << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long int n;     scanf( %ld , &n);     long long int a[n], i, x = 0, b[n], j;     for (i = 0; i < n; i++) {       scanf( %lld , &a[i]);     }     b[0] = 1;     for (i = n - 2, j = 1; i >= 0; i--, j++) {       if (a[i] < a[i + 1]) {         b[j] = b[j - 1] + 1;       } else         b[j] = 1;     }     sort(b, b + n);     printf( %lld n , b[n - 1]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       int n;       cin >> n;       vector<long long int> v(n);       for (long long int &x : v) cin >> x;       for (int i = 0; i < n; i++) {         if (i % 2)           v[i] = -abs(v[i]);         else           v[i] = abs(v[i]);         cout << v[i] <<    ;       }       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     char c[100005];     scanf( %s , c);     vector<char> v;     int count[26];     int instk[26];     memset(count, 0, sizeof(count));     memset(instk, 0, sizeof(instk));     int find = 0;     for (int i = 0; c[i] != 0; i++) count[c[i] -  a ]++;     while (count[find] == 0) find++;     for (int i = 0; c[i] != 0; i++) {       v.push_back(c[i]);       count[c[i] -  a ]--;       while (count[find] == 0) find++;       while (!v.empty() && v.back() -  a  <= find) {         printf( %c , v.back());         v.pop_back();       }     }     while (!v.empty()) {       printf( %c , v.back());       v.pop_back();     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     cin.tie(NULL);     int t;     cin >> t;     while (t--) {       long long a, b, x, y;       cin >> a >> b >> x >> y;       long long distX = x - a, distY = y - b;       cout << distX * distY + 1 <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2005;   int n, m;   int id[N * 2][N * 2];   map<int, int> mp;   vector<int> l[N * 2], e[N * 2];   vector<int> ord;   pair<int, int> a[N];   int dp[N * 2][N * 2];   pair<int, int> DP[N * 2][N * 2];   void type(int i, int j) {     if (DP[i][j].second == 0) {       if (i != 0) printf( %d  , i);       return;     }     if (DP[i][j].first) {       type(i, a[DP[i][j].second].first);       type(DP[i][j].second, a[DP[i][j].second].second);     } else       type(i, DP[i][j].second);   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       int x, y;       scanf( %d%d , &x, &y);       a[i] = make_pair(x - y, x + y);       mp[x - y] = 1;       mp[x + y] = 1;     }     for (map<int, int>::iterator it = mp.begin(); it != mp.end(); it++)       it->second = ++m;     for (int i = 1; i <= n; i++) {       a[i] = make_pair(mp[a[i].first], mp[a[i].second]);       id[a[i].first][a[i].second] = i;       e[a[i].second].push_back(i);       l[a[i].second - a[i].first + 1].push_back(i);     }     a[0] = make_pair(1, m);     l[m].push_back(0);     for (int _ = 1; _ <= m; _++)       for (int __ = 0; __ < l[_].size(); __++) {         int i = l[_][__];         for (int j = a[i].first; j <= a[i].second; j++) {           dp[i][j] = dp[i][j - 1];           DP[i][j] = make_pair(0, j - 1);           for (int k = 0; k < e[j].size(); k++) {             int p = e[j][k];             if (a[p].first >= a[i].first &&                 dp[i][j] < dp[i][a[p].first] + dp[p][a[p].second]) {               dp[i][j] = dp[i][a[p].first] + dp[p][a[p].second];               DP[i][j] = make_pair(1, p);             }           }         }         for (int j = a[i].first; j <= a[i].second; j++) dp[i][j]++;       }     printf( %d n , dp[0][m] - 1);     type(0, m);     puts(  );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e6 + 5;   const long long mod = 998244353;   long long ksm(long long a, long long b) {     long long ans = 1LL;     while (b) {       if (b & 1) ans = ans * a % mod;       a = a * a % mod;       b >>= 1;     }     return ans;   }   int a[N], c[N], tmp[N], ans, tot;   bool vis[N];   bool judge(int x, int y) {     for (int i = 1; i <= x; i++) {       int t = i;       bool flag = 0;       for (int j = 1; j <= y; j++) {         if (c[tmp[t]] != c[tmp[i]]) {           flag = 1;           break;         }         t = (t + x - 1) % tot + 1;       }       if (!flag) return 1;     }     return 0;   }   void dfs(int x) {     tot = 0;     tmp[++tot] = x;     vis[x] = 1;     for (int i = a[x]; i != x; i = a[i]) tmp[++tot] = i, vis[i] = 1;     for (int i = 1; i * i <= tot; i++) {       if (tot % i == 0) {         if (judge(i, tot / i)) {           ans = min(ans, i);           return;         }         if (judge(tot / i, i)) ans = min(ans, tot / i);       }     }   }   void solve() {     int n;     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     for (int i = 1; i <= n; i++) scanf( %d , &c[i]);     ans = INT_MAX;     for (int i = 1; i <= n; i++)       if (!vis[i]) dfs(i);     for (int i = 1; i <= n; i++) vis[i] = 0;     printf( %d n , ans);   }   int main() {     int _;     scanf( %d , &_);     while (_--) solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<int> dvsr;   void get(long long n) {     for (int i = 1; i <= sqrt(n); i++) {       if (n % i == 0) {         dvsr.push_back(i);         if (i != n / i) dvsr.push_back(n / i);       }     }   }   int main() {     std::ios::sync_with_stdio(false);     cin.tie(NULL);     long long a, b;     cin >> a >> b;     if (a == b) {       cout << 0;       return 0;     }     if (a > b) swap(a, b);     long long df = b - a;     get(df);     set<pair<long long, long long> > s;     for (auto it : dvsr) {       if (a % it == 0 and b % it == 0) {         s.insert({(a * b) / it, 0});       } else {         long long dif = it * (b / it + 1) - b;         long long x = a + dif, y = b + dif;         s.insert({(x * y) / it, dif});       }     }     long long ans = b;     auto i1 = s.begin();     cout << i1->second;   }
#include<bits/stdc++.h>   using namespace std;   #define int long long   #define fast_io ios_base::sync_with_stdio(0);cin.tie(0)    #define mod 1e9 + 7   #define pb push_back   #define vi vector<int>      int32_t main(){       fast_io;       int t;cin>>t;       while(t--){           int n;cin>>n;           set<int> s;           vi arr(n);           for(int i=0;i<n;i++){               int x;cin>>x;               arr[i] = x;               s.insert(x);           }           sort(arr.rbegin(),arr.rend());           int z = arr[n-1];           int ans = 0;           for(int i=0;i<n;i++){               if(arr[i]!=z){                   ans++;               }           }           cout<<ans<<endl;       }       return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     string str;     cin >> str;     set<char> a;     for (int i = 0; i < n; i++) {       a.insert(tolower(str[i]));     }     if (a.size() == 26) {       cout <<  YES  << endl;     } else {       cout <<  NO  << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     long long int h, m;     cin >> h >> m;     long long int t = h * 60 + m;     long long int a = 1440 - t;     cout << a << endl;   }   int32_t main() {     ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);     long long int t = 1;     cin >> t;     while (t--) solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 2010;   int T, n, m, vis[maxn], cnt[maxn];   char s[maxn];   bitset<maxn> b[maxn];   queue<pair<int, int>> Q;   int main() {     scanf( %d , &T);     while (T--) {       scanf( %d %d , &n, &m);       for (int i = 1; i <= n; i++) {         b[i].reset(), vis[i] = 0;       }       for (int i = 1; i <= m; i++) {         scanf( %s , s + 1), cnt[i] = 0;         for (int j = 1; j <= n; j++) {           if (s[j] ==  1 ) cnt[i]++;         }         if (cnt[i] == 1) continue;         for (int j = 1; j <= n; j++) {           if (s[j] ==  1 ) b[j].set(i);         }       }       for (int i = 1; i <= n; i++) {         for (int j = 1; j <= n; j++)           if (i ^ j) {             if ((b[i] & b[j]) == b[i]) Q.emplace(i, j);           }       }       vector<pair<int, int>> E;       while (!Q.empty()) {         int u = Q.front().first, v = Q.front().second;         Q.pop();         if (vis[u] || vis[v]) continue;         vis[u] = 1, E.emplace_back(u, v);         for (int i = 1; i <= m; i++) {           if (b[u][i]) cnt[i]--;         }         for (int i = 1; i <= m; i++)           if (cnt[i] == 1) {             cnt[i] = 0;             for (int j = 1; j <= n; j++)               if (b[j][i] && !vis[j]) {                 b[j][i] = 0;                 for (int k = 1; k <= n; k++)                   if (j ^ k && !vis[k]) {                     if ((b[j] & b[k]) == b[j]) Q.emplace(j, k);                   }               }           }       }       if (E.size() < n - 1) {         puts( NO );         continue;       }       puts( YES );       for (auto p : E) {         printf( %d %d n , p.first, p.second);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int oo = (int)1e9 + 9;   bool cmp(const pair<int, int> &a, const pair<int, int> &b) {     return a.first < b.first;   }   int main() {     int n, m;     cin >> n >> m;     vector<pair<int, int> > k(n);     for (int(i) = (0); (i) < (n); ++(i)) {       cin >> k[i].first >> k[i].second;     }     sort(((k).begin()), ((k).end()), cmp);     double ans = oo;     for (int(i) = (0); (i) < (n); ++(i)) {       ans = min(ans, (double)k[i].first / (double)k[i].second);     }     ans *= (double)m;     cout << fixed << setprecision(8) << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long inf = 1000 * 1000 * 1000;   const long long inf64 = 1ll * inf * inf;   const long long mod = 1e9 + 7;   mt19937 rng(0);   long long binpow(long long a, long long p, long long mod = 998244353) {     if (p == 0) return 1;     if (p % 2 == 0) {       long long t = binpow(a, p / 2);       return t * t % mod;     } else {       return binpow(a, p - 1) * a % mod;     }   }   long long invert(long long x) { return binpow(x, 998244351); }   pair<long long, long long> add(pair<long long, long long> a,                                  pair<long long, long long> b) {     pair<long long, long long> ans;     ans.first = a.first * b.second + b.first * a.second;     ans.second = a.second * b.second;     ans.first %= 998244353;     ans.second %= 998244353;     return ans;   }   pair<long long, long long> multi(pair<long long, long long> a,                                    pair<long long, long long> b) {     return {a.first * b.first % 998244353, a.second * b.second % 998244353};   }   void run() {     long long n;     cin >> n;     vector<vector<long long>> a(n);     vector<vector<long long>> poses(1e6 + 10);     for (long long i = 0; i < n; i++) {       long long k;       cin >> k;       a[i].resize(k);       for (long long j = 0; j < k; j++) {         cin >> a[i][j];         poses[a[i][j]].push_back(i);       }     }     pair<long long, long long> ans = {0, 1};     for (long long i = 0; i < n; ++i) {       pair<long long, long long> t = {1, n};       for (long long k = 0; k < a[i].size(); ++k) {         pair<long long, long long> r = {1, a[i].size()};         pair<long long, long long> e = {poses[a[i][k]].size(), n};         ans = add(ans, multi(multi(t, r), e));       }     }     cout << ans.first * invert(ans.second) % 998244353;   }   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long t = 1;     for (long long i = 0; i < t; i++) {       run();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<long long> X;   map<long long, pair<int, long long> > M;   pair<int, long long> go(long long x) {     if (x <= 1) return {x, x};     if (M.find(x) != M.end()) return M[x];     int i = upper_bound(X.begin(), X.end(), x) - X.begin() - 1;     int p1, p2;     long long q1, q2;     pair<int, long long> P1;     P1 = go(x - X[i]);     p1 = P1.first;     q1 = P1.second;     P1 = go(X[i] - 1);     p2 = P1.first;     q2 = P1.second;     return M[x] = max(make_pair(p1 + 1, q1 + X[i]), {p2, q2});   }   int main() {     for (int i = 0; i <= 1e5 + 7; ++i) X.push_back(1LL * i * i * i);     long long x;     cin >> x;     pair<int, long long> Ans;     Ans = go(x);     cout << Ans.first <<     << Ans.second <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   long long int mod = 1000000007;   int main() {     ios_base ::sync_with_stdio(false);     cin.tie(NULL);     long long int n;     cin >> n;     if (n == 1) {       cout << 2;       return 0;     }     if (n == 2) {       cout << 3;       return 0;     }     long long int curr = 2, line = 3, to = 2;     while (to < n) {       line++;       to += curr;       if (to >= n) {         cout << line;         return 0;       }       line++;       to += (curr);       curr++;       if (to >= n) {         cout << line;         return 0;       }     }   }
#include <bits/stdc++.h>   using namespace std;   ifstream in( in.txt );   ofstream out( out.txt );   long long a[1000006], b[1000006];   long long fortza(long long n, long long put) {     if (!put) return 1;     if (put == 1) return n;     if (put & 1) return (fortza((n * n) % 998244353, put / 2) * n) % 998244353;     return fortza((n * n) % 998244353, put / 2) % 998244353;   }   int main() {     long long n, k, i, j, x;     cin >> n;     for (i = 1; i <= n; ++i) {       cin >> k;       for (j = 1; j <= k; ++j) {         cin >> x;         b[x] = (b[x] + fortza((k * n) % 998244353, 998244353 - 2)) % 998244353;         ++a[x];       }     }     n = fortza(n, 998244353 - 2);     for (i = 1, x = 0; i <= 1000006 - 6; ++i)       x = (x + (a[i] * ((n * b[i]) % 998244353)) % 998244353) % 998244353;     cout << x;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int x1, y1, z, x, y;     cin >> x1 >> y1 >> z;     x = x1 - y1 + z;     y = x1 - y1 - z;     if (x > 0 && y > 0)       cout <<  +             <<   n ;     else if (x < 0 && y < 0)       cout <<  -             <<   n ;     else if (x == 0 && y == 0)       cout <<  0             <<   n ;     else       cout <<  ?             <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 3e5 + 10, lgN = 29, INF = 2e9;   int read() {     int x = 0, f = 1;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       x = x * 10 + ch -  0 ;       ch = getchar();     }     return x * f;   }   struct segTree {     struct node {       int l, r, w, flg;     } sgt[N * lgN];     int p = 0, rt[N] = {0};     void insert(int &i, int b, int e, int k, int x) {       sgt[++p] = sgt[i];       i = p;       if (b == e) {         sgt[i].w = sgt[i].w ? min(sgt[i].w, x) : x;         return;       }       int mid = (b + e) >> 1;       if (k <= mid)         insert(sgt[i].l, b, mid, k, x);       else         insert(sgt[i].r, mid + 1, e, k, x);       sgt[i].w = max(sgt[sgt[i].l].w, sgt[sgt[i].r].w);     }     int query(int i, int b, int e, int l, int r) {       if (e < l || r < b) return 0;       if (i == 0) return INF;       if (l <= b && e <= r) return sgt[i].w;       int mid = (b + e) >> 1, lc = sgt[i].l, rc = sgt[i].r;       return max(query(lc, b, mid, l, r), query(rc, mid + 1, e, l, r));     }     void walk(int i, int b, int e, int dep) {       if (!i) return;       int mid = (b + e) >> 1, lc = sgt[i].l, rc = sgt[i].r;       if (b != e) walk(lc, b, mid, dep + 1);       for (int i = 0; i < dep; i++) printf(    );       printf( %d[%d,%d]w=%d n , i, b, e, sgt[i].w);       if (b != e) walk(rc, mid + 1, e, dep + 1);     }   } t;   struct seg {     int l, r, p;   } a[N];   bool comp(seg a, seg b) { return a.l < b.l; }   int n, m, k, rt[N];   int bin(int x) {     int l = 1, r = k, ret = -1;     while (l <= r) {       int mid = (l + r) >> 1;       if (a[mid].l >= x)         ret = mid, r = mid - 1;       else         l = mid + 1;     }     return ret;   }   int main() {     n = read();     m = read();     k = read();     for (int i = 1; i <= k; i++) {       a[i].l = read();       a[i].r = read();       a[i].p = read();     }     sort(a + 1, a + k + 1, comp);     t.sgt[0].w = INF;     for (int i = k; i; i--) {       rt[i] = rt[i + 1];       t.insert(rt[i], 1, n, a[i].p, a[i].r);     }     for (int i = 1; i <= m; i++) {       int a = read(), b = read(), x = read(), y = read();       int lb = bin(x);       if (lb == -1 || t.query(rt[lb], 1, n, a, b) > y)         printf( no n );       else         printf( yes n );       fflush(stdout);     }   }
#include <bits/stdc++.h>   using namespace std;   long long N, K;   long long Top, Bot, H[200005], cnt[200005];   long long hcnt[200005];   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cin >> N >> K;     Top = 0, Bot = 2e5;     for (int i = 0; i <= N - 1; i++) {       cin >> H[i];       cnt[H[i]]++;       Top = max(Top, H[i]);       Bot = min(Bot, H[i]);     }     long long curc = 0;     for (int i = Top; i >= 1; i--) {       curc += cnt[i];       hcnt[i] += curc;     }     long long cutt = 0;     int ans = 0;     for (int i = Top; i >= Bot + 1; i--) {       if (cutt + hcnt[i] > K) {         ans++;         cutt = hcnt[i];       } else         cutt += hcnt[i];     }     if (cutt) ans++;     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n;   int main() {     ios::sync_with_stdio(false), cin.tie(0);     cin >> n;     long long a = (n + 2) * (n + 1) * n / 6,               b = (n + 4) * (n + 3) * (n + 2) * (n + 1) * n / 120;     cout << a * b;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long maxn = 1005, maxk = 12;   string s, t;   long long d[maxn][maxn][maxk][2];   long long n, m, k;   int main() {     ios_base::sync_with_stdio(false);     cin >> n >> m >> k >> s >> t;     for (long long i = 0; i <= n; i++) {       for (long long j = 0; j <= m; j++) {         for (long long z = 0; z <= k; z++) {           long long temp = max(d[i][j][z][0], d[i][j][z][1]);           d[i + 1][j][z][0] = max(d[i + 1][j][z][0], temp);           d[i][j + 1][z][0] = max(d[i][j + 1][z][0], temp);           if (s[i] == t[j]) {             d[i + 1][j + 1][z + 1][1] =                 max(d[i + 1][j + 1][z + 1][1], d[i][j][z][0] + 1);             if (z > 0) {               d[i + 1][j + 1][z][1] =                   max(d[i + 1][j + 1][z][1], d[i][j][z][1] + 1);             }           }         }       }     }     cout << *max_element(d[n][m][0], d[n][m][k] + 2) << endl;   }
#include <bits/stdc++.h>   using namespace std;   signed main() {     long long int n, i, m, k, x, pc = 0, c = 0;     cin >> n >> m >> k;     long long int p, f;     queue<long long int> q;     for (i = 0; i < m; i++) {       cin >> x;       q.push(x - 1);     }     x = 0;     while (!q.empty()) {       f = q.front();       p = (f - c) / k;       while (!q.empty() && ((q.front() - c) / k) == p) {         pc++;         q.pop();       }       c = pc;       x++;     }     cout << x;   }
#include <bits/stdc++.h>   using namespace std;   int n, a, b, ed;   double p, M;   long long T;   vector<pair<double, double> > v;   pair<double, double> sta[100004];   double cros(pair<double, double> a, pair<double, double> b) {     return (b.second - a.second) / (a.first - b.first);   }   double r[100004], ret;   double mat[35][3][3], cur[3];   int main() {     scanf( %d%I64d , &n, &T);     for (int i = 0; i < n; i++) {       scanf( %d%d%lf , &a, &b, &p);       M = max(M, p * b);       v.push_back(make_pair(p, -p * a));     }     sort(v.begin(), v.end());     for (int i = 0; i < n; i++) {       if (i > 0 && v[i].first == v[i - 1].first) continue;       v[i].second *= -1;       while (ed > 1 && cros(sta[ed - 1], sta[ed]) > cros(sta[ed], v[i])) ed--;       sta[++ed] = v[i];     }     for (int i = 1; i < ed; i++) r[i] = cros(sta[i], sta[i + 1]);     r[ed] = 1e18 + 114;     double lst = 0;     long long t1 = 0;     for (int i = 1; i <= ed; i++) {       if (t1 == T || (t1 * M - lst) >= r[i]) continue;       mat[0][0][0] = 1 - sta[i].first, mat[0][0][1] = 0, mat[0][0][2] = 0;       mat[0][1][0] = sta[i].first * M, mat[0][1][1] = 1, mat[0][1][2] = 0;       mat[0][2][0] = sta[i].second, mat[0][2][1] = 1, mat[0][2][2] = 1;       for (int j = 1; j <= 33; j++) {         for (int i1 = 0; i1 < 3; i1++)           for (int j1 = 0; j1 < 3; j1++) {             mat[j][i1][j1] = 0;             for (int k = 0; k < 3; k++)               mat[j][i1][j1] += mat[j - 1][i1][k] * mat[j - 1][k][j1];           }       }       for (int j = 33; j >= 0; j--) {         if (t1 + (1ll << j) >= T) continue;         cur[0] = lst, cur[1] = t1, cur[2] = 1;         ret = 0;         for (int k = 0; k < 3; k++) ret += cur[k] * mat[j][k][0];         if (M * (t1 + (1ll << j)) - ret < r[i]) lst = ret, t1 += (1ll << j);       }       cur[0] = lst, cur[1] = t1, cur[2] = 1;       lst = 0;       for (int j = 0; j < 3; j++) lst += cur[j] * mat[0][j][0];       t1++;     }     printf( %.6lf , lst);   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     string s;     cin >> s;     string ans;     ans += s[0];     for (int i = 1; i <= s.length() - 2; i = i + 2) {       ans += s[i];     }     ans += s[s.length() - 1];     cout << ans;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long test;     cin >> test;     while (test--) {       solve();       cout <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, a[101], t = 0;     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> a[i];       t += a[i];     }     int ans = 0;     for (int j = 1; j <= 5; j++) {       int k = t + j, i = 0;       while (k) {         k--;         if (!k) break;         i = ((i + 1) % (n + 1));       }       if (i != 0) ans++;     }     cout << ans << endl;     return 0;   }