malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int nm = 100010;   int n, k;   long long x[nm], y[nm];   set<pair<long long, int> > ngang, doc;   vector<int> xoa1, xoa2, xoa3, xoa4;   int main() {     scanf( %d%d , &n, &k);     for (int i = 1; i <= n; ++i) {       int a, b, c, d;       scanf( %d%d%d%d , &a, &b, &c, &d);       x[i] = a + c;       y[i] = b + d;       ngang.insert(make_pair(y[i], i));       doc.insert(make_pair(x[i], i));     }     long long res = LONG_LONG_MAX;     for (int a = 0; a <= k; ++a) {       for (int i = 1; i <= a; ++i) {         int u = ngang.begin()->second;         xoa1.push_back(u);         ngang.erase(ngang.begin());         doc.erase(make_pair(x[u], u));       }       for (int b = 0; a + b <= k; ++b) {         for (int i = 1; i <= b; ++i) {           multiset<pair<long long, int> >::iterator it = ngang.end();           it--;           int u = it->second;           xoa2.push_back(u);           ngang.erase(it);           doc.erase(make_pair(x[u], u));         }         for (int c = 0; a + b + c <= k; ++c) {           for (int i = 1; i <= c; ++i) {             int u = doc.begin()->second;             xoa3.push_back(u);             doc.erase(doc.begin());             ngang.erase(make_pair(y[u], u));           }           int d = k - a - b - c;           for (int i = 1; i <= d; ++i) {             multiset<pair<long long, int> >::iterator it = doc.end();             it--;             int u = it->second;             xoa4.push_back(u);             doc.erase(it);             ngang.erase(make_pair(y[u], u));           }           multiset<pair<long long, int> >::iterator it = ngang.end();           it--;           long long A = it->first - ngang.begin()->first;           if (A & 1) A++;           if (A == 0) A = 2;           it = doc.end();           it--;           long long B = it->first - doc.begin()->first;           if (B & 1) B++;           if (B == 0) B = 2;           res = min(res, A * B);           for (int i = int(xoa4.size()) - 1; i >= 0; --i) {             int u = xoa4[i];             xoa4.pop_back();             doc.insert(make_pair(x[u], u));             ngang.insert(make_pair(y[u], u));           }           for (int i = int(xoa3.size()) - 1; i >= 0; --i) {             int u = xoa3[i];             xoa3.pop_back();             doc.insert(make_pair(x[u], u));             ngang.insert(make_pair(y[u], u));           }         }         for (int i = int(xoa2.size()) - 1; i >= 0; --i) {           int u = xoa2[i];           xoa2.pop_back();           doc.insert(make_pair(x[u], u));           ngang.insert(make_pair(y[u], u));         }       }       for (int i = int(xoa1.size()) - 1; i >= 0; --i) {         int u = xoa1[i];         xoa1.pop_back();         doc.insert(make_pair(x[u], u));         ngang.insert(make_pair(y[u], u));       }     }     printf( %I64d n , res / 4);   }
#include <bits/stdc++.h>   using namespace std;   int used[111111];   multiset<int> g[111111];   multiset<int> vertex;   vector<int> ans;   void dfs(int v) {     used[v] = 1;     vertex.erase(v);     ans.push_back(v);     for (auto i = g[v].begin(); i != g[v].end(); ++i)       if (!used[*i]) vertex.insert(*i);     if (vertex.size()) dfs(*vertex.begin());   }   int main() {     int n, m;     cin >> n >> m;     for (int i = 0; i < m; i++) {       int x, y;       cin >> x >> y;       g[x - 1].insert(y - 1);       g[y - 1].insert(x - 1);     }     dfs(0);     for (int i = 0; i < ans.size(); i++) cout << ans[i] + 1 <<    ;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, t;     cin >> n >> t;     if (t == 10) {       if (n == 1) {         cout <<  -1 ;       } else {         for (int i = 0; i < n - 1; i++) {           cout <<  1 ;         }         cout <<  0 ;       }     } else {       for (int i = 0; i < n; i++) {         cout << t;       }       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 200005;   char a[N], b[N];   string arrange(string s) {     int n = s.size();     if (n & 1)       return s;     else {       int m = n / 2;       string s1 = s.substr(0, m), s2 = s.substr(m, m);       s1 = arrange(s1);       s2 = arrange(s2);       if (s1.compare(s2) <= 0)         return s1 + s2;       else         return s2 + s1;     }   }   int main() {     scanf( %s , a);     scanf( %s , b);     const char *ans = arrange(a) == arrange(b) ?  YES  :  NO ;     printf( %s n , ans);     return 0;   }
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:16777216 )   using namespace std;   int a[2 * 100010] = {0};   int check(int x, int n) {     if (x == 1) return 0;     int cur = 0, ans = 0;     while (cur < a[n - 1]) {       cur += x;       int pos = lower_bound(a, a + n, cur) - a;       if (pos > 0 && a[pos - 1] >= x) ans = max(ans, a[pos - 1] % x);     }     return ans;   }   int Solve(int n) {     int ans = 0, m = 1;     sort(a, a + n);     for (int i = 1; i < n; i++)       if (a[m - 1] != a[i]) a[m++] = a[i];     for (int i = 0; i < m; i++) ans = max(ans, check(a[i], m));     return ans;   }   int main() {     int n;     scanf( %d , &n);     for (int i = 0; i < n; i++) scanf( %d , &a[i]);     printf( %d n , Solve(n));     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 0x7f7f7f7f;   int BigMod(long long int B, long long int P, long long int M) {     long long int R = 1;     while (P > 0) {       if (P % 2 == 1) R = (R * B) % M;       P /= 2;       B = (B * B) % M;     }     return (int)R;   }   long long int maxDivide(long long int a, long long int b) {     while (a % b == 0) a = a / b;     return a;   }   long long int isUgly(long long int no) {     no = maxDivide(no, 2);     no = maxDivide(no, 3);     no = maxDivide(no, 5);     return (no == 1) ? 1 : 0;   }   long long int myXOR(long long int x, long long int y) {     long long int res = 0;     for (long long int i = 31; i >= 0; i--) {       bool b1 = x & (1 << i);       bool b2 = y & (1 << i);       bool xoredBit = (b1 & b2) ? 0 : (b1 | b2);       res <<= 1;       res |= xoredBit;     }     return res;   }   long long int ar[110];   int main() {     long long int n, m, a, b, c, x, y;     cin >> n >> m;     x = 0;     for (long long int i = 1; i <= n; i++) {       cin >> ar[i];     }     y = 0;     for (long long int i = 1; i <= m; i++) {       cin >> a >> b;       x = 0;       for (long long int j = a; j <= b; j++) {         x += ar[j];       }       if (x > 0) y += x;     }     cout << y << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int h1, m1, h2, m2, s1, s2, h, m;     scanf( %d:%d , &h1, &m1);     scanf( %d:%d , &h2, &m2);     s1 = h1 * 60 + m1;     s2 = h2 * 60 + m2;     m = (s1 + s2) / 2;     h = m / 60;     m = m % 60;     printf( %02d:%02d n , h, m);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     {       int s, v1, v2, t1, t2;       cin >> s >> v1 >> v2 >> t1 >> t2;       int time1, time2;       time1 = (s * v1) + (2 * t1);       time2 = (s * v2) + (2 * t2);       if (time1 < time2)         cout <<  First  << endl;       else if (time2 < time1)         cout <<  Second  << endl;       else         cout <<  Friendship  << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long inf = 1e18;   const int N = 1e6 + 20;   vector<int> v[N];   map<int, int> mp, ml, mr;   long long n, m, k, a[N], b[N], f[N];   int num[N];   long long did[N];   string s;   long long s1, s2, ans, flag, tot, t, sum;   int cnt;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cin >> n >> m >> k;     long long x;     for (int i = 0; i < m; i++) {       cin >> x;       if (x == 0) return cout << -1, 0;       did[x] = 1;     }     for (int i = 1; i <= k; i++) cin >> a[i];     int cnt = 0;     for (int i = 0; i <= n; i++) {       if (did[i])         num[i] = num[i - 1] + 1;       else         num[i] = 0;       cnt = max(cnt, num[i]);     }     long long ans = inf;     for (int i = cnt + 1; i <= k; i++) {       long long sum = 0;       for (int j = 0; j < n; j += i) {         if (did[j]) {           j -= num[j];         }         sum++;       }       ans = min(ans, a[i] * sum);     }     if (ans >= inf)       cout << -1;     else       cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   long long n, m, q, t, x, y, b, c, d;   string s1, s2;   long long a[3];   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cin >> n;     for (int i = 0; i < n; i++) {       cin >> s1 >> s2;       int l1 = s1.length();       int l2 = s2.length();       int j = 0, k = 0;       int ok = 1;       int lastok = -1;       while (j < l1 && k < l2) {         if (s1[j] == s2[k]) {           j++;           k++;           lastok++;         } else if (k && s2[k] == s2[k - 1]) {           int tmp = k;           while (tmp < l2 && s2[tmp] == s2[k]) tmp++;           if (tmp == l2) {             ok = 0;             break;           }           lastok = tmp - 1;           k = tmp;         } else if (lastok == k - 1) {           ok = 0;           break;         }       }       if (j < l1) ok = 0;       while (k < l2) {         if (k && s2[k] != s2[k - 1]) {           ok = 0;           break;         }         k++;       }       cout << (ok ?  YES  :  NO ) << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 500010;   int n, m;   int pos[maxn];   int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};   inline void read(int &k) {     int f = 1;     k = 0;     char c = getchar();     while (c <  0  || c >  9 ) c ==  -  && (f = -1), c = getchar();     while (c <=  9  && c >=  0 ) k = k * 10 + c -  0 , c = getchar();     k *= f;   }   bool check(int i, int j) {     int x = (i - 1) / m + 1, y = (i - 1) % m + 1, x2 = (j - 1) / m + 1,         y2 = (j - 1) % m + 1;     for (int k = 0; k < 4; k++)       if (x + dx[k] == x2 && y + dy[k] == y2) return 1;     return 0;   }   bool dfs(int i) {     if (i == n * m + 1) return 1;     int x = (i - 1) / m + 1, y = (i - 1) % m + 1;     for (int j = i; j <= n * m; j++) {       swap(pos[i], pos[j]);       if (x != 1 && check(pos[i], pos[(x - 2) * m + y])) continue;       if (y != 1 && check(pos[i], pos[(x - 1) * m + y - 1])) continue;       if (dfs(i + 1)) return 1;       swap(pos[i], pos[j]);     }     return 0;   }   int main() {     read(n);     read(m);     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++) pos[(i - 1) * m + j] = (i - 1) * m + j;     if (!dfs(1)) return puts( NO ), 0;     puts( YES );     for (int i = 1; i <= n; i++, puts(  ))       for (int j = 1; j <= m; j++) printf( %d  , pos[(i - 1) * m + j]);   }
#include <bits/stdc++.h>   using namespace std;   int dx[] = {0, 0, -1, 1};   int dy[] = {1, -1, 0, 0};   int main() {     int n;     char mp[100][100];     cin >> n;     for (int i = 0; i < n; ++i) cin >> mp[i];     auto isin = [&](int x) { return x >= 0 && x < n; };     auto isok = [&](int x, int y) {       for (int i = 0; i < 4; ++i) {         if (isin(x + dx[i]) && isin(y + dy[i])) {           if (mp[x + dx[i]][y + dy[i]] !=  . ) return 0;         } else           return 0;       }       mp[x][y] =  # ;       for (int i = 0; i < 4; ++i) {         mp[x + dx[i]][y + dy[i]] =  # ;       }       return 1;     };     for (int i = 0; i < n; ++i) {       for (int j = 0; j < n; ++j) {         if (mp[i][j] ==  . ) {           isok(i, j);         }       }     }     for (int i = 0; i < n; ++i) {       for (int j = 0; j < n; ++j) {         if (mp[i][j] ==  . ) {           cout <<  NO  << endl;           return 0;         }       }     }     cout <<  YES  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 5005;   vector<int> adj[N];   bool visited[N];   bool reach[N];   pair<int, int> has[N];   int cnt = 0;   void dfs(int s) {     if (!visited[s]) {       visited[s] = 1;       reach[s] = 1;       for (int i = 0; i < adj[s].size(); i++) {         dfs(adj[s][i]);       }     }   }   void dfs2(int s, int a) {     if (!visited[s]) {       visited[s] = 1;       if (reach[s] == 0) has[a].first++;       for (int i = 0; i < adj[s].size(); i++) {         dfs2(adj[s][i], a);       }     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int n, m, s;     cin >> n >> m >> s;     s--;     for (int i = 0; i < m; i++) {       int a, b;       cin >> a >> b;       a--;       b--;       adj[a].push_back(b);     }     dfs(s);     for (int i = 0; i < n; i++) {       has[i].second = i;     }     for (int i = 0; i < n; i++) {       if (!reach[i]) {         memset(visited, 0, sizeof(visited));         dfs2(i, i);       }     }     sort(has, has + N);     reverse(has, has + N);     int ans = 0;     cnt = 0;     memset(visited, 0, sizeof(visited));     for (int i = 0; i < n; i++) {       if (!reach[has[i].second]) {         dfs(has[i].second);         memset(visited, 0, sizeof(visited));         ans++;       }     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     vector<unsigned long long> v;     char x2[] =  47 ;     do {       v.push_back(stoi(x2));     } while (next_permutation(x2, x2 + 2));     char x4[] =  4477 ;     do {       v.push_back(stoi(x4));     } while (next_permutation(x4, x4 + 4));     char x6[] =  444777 ;     do {       v.push_back(stoi(x6));     } while (next_permutation(x6, x6 + 6));     char x8[] =  44447777 ;     do {       v.push_back(stoi(x8));     } while (next_permutation(x8, x8 + 8));     v.push_back(4444477777);     sort(v.begin(), v.end());     string s;     cin >> s;     unsigned long long q = stoi(s);     if (q <= v[0]) {       cout << v[0];       return 0;     } else       for (int i = 0; i < v.size() - 1; i++)         if (q == v[i + 1] || (q > v[i] && q < v[i + 1])) {           cout << v[i + 1];           return 0;         }     cout << v[98];     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char a[100][1000] = {0};   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     long long int t;     cin >> t;     while (t--) {       long long int n, m, x, y;       cin >> n >> m >> x >> y;       for (long long int i = 1; i <= n; i++) {         for (long long int j = 1; j <= m; j++) {           cin >> a[i][j];         }       }       long long int ans = 0;       for (long long int i = 1; i <= n; i++) {         for (long long int j = 1; j <= m; j++) {           if (a[i][j] ==  . ) {             long long int pos = j;             for (long long int k = j; k <= m; k++) {               if (a[i][k] ==  . ) {                 pos = k;               } else {                 break;               }             }             long long int temp = pos - j + 1;             ans += min(temp * x, (temp / 2) * y + x * (temp % 2 == 1));             j = pos;           }         }       }       cout << ans << endl;     }     return 0;   }
#include <bits/stdc++.h>   const int inf = int(1e9);   const int mod = inf + 7;   const double PI = acos(-1.0);   using namespace std;   const int N = 1e5 + 155;   template <typename T>   inline void read(T& x) {     x = 0;     int 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();     }     x *= f;   }   string toForm(char c, bool ok) {     string ans =   ;     ans += char(60);     if (!ok) ans += char(47);     ans += (c);     ans += char(62);     return ans;   }   void solve() {     string s;     cin >> s;     int cnt = 0;     for (int i = 1; i < s.size(); i++) {       if (s[i] !=  <  && s[i] !=  >  && s[i] !=  / ) {         if (s[i - 1] !=  / ) {           for (int i = 0; i < cnt; ++i) cout <<     ;           cout << toForm(s[i], true);           cout <<   n ;           cnt++;         } else {           for (int i = 0; i < cnt - 1; ++i) cout <<     ;           cout << toForm(s[i], false);           cout <<   n ;           cnt--;         }       }     }   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int t = 1;     while (t--) solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 111111;   const int oo = (int)(1e9);   int MOD = 1000000007;   const long double PI = 3.141592653589793;   template <typename TT>   void read(TT &x) {     char ch;     for (ch = getchar(); ch >  9  || ch <  0 ; ch = getchar())       ;     for (x = 0; ch >=  0  && ch <=  9 ; ch = getchar()) x = x * 10 + ch - 48;   }   vector<pair<int, int> > A[2];   int n, a[111111], v[111111], nt[111111];   void work(vector<pair<int, int> > &B, vector<pair<int, int> > &C) {     C.clear();     sort(B.begin(), B.end());     for (int i = B.size() - 1; i >= 0; i--) {       int x = B[i].first, y = B[i].second;       if (v[x] + v[y] > 0) continue;       v[y] = 1;       while (v[nt[x]]) nt[x] = nt[nt[x]];       if (nt[x] < n && a[x] > a[nt[x]]) C.push_back(make_pair(x, nt[x]));     }   }   void Init() {     scanf( %d , &n);     ;     for (int i = 0; i < n; i++) scanf( %d , &a[i]);     ;     for (int i = 0; i < n; i++) {       nt[i] = i + 1;       if (nt[i] < n && a[i] > a[nt[i]]) A[0].push_back(make_pair(i, nt[i]));     }     int k = 0, ans = 0;     memset(v, 0, sizeof(v));     ;     while (A[k].size()) {       ans++;       work(A[k], A[1 - k]);       k = 1 - k;     }     printf( %d , ans);     ;   }   int main() {     Init();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 3e5 + 15;   vector<int> g[N];   int n, m, b[N], r[N], a[N], res;   void dfs(int v, int pa) {     if (a[v] == 1)       r[v]++;     else if (a[v] == 2)       b[v]++;     for (int i : g[v]) {       if (i == pa) continue;       dfs(i, v);       b[v] += b[i];       r[v] += r[i];     }   }   int main() {     ios::sync_with_stdio(false);     cin >> n;     for (int i = 0; i < n; i++) cin >> a[i];     for (int i = 0; i < n - 1; i++) {       int x, y;       cin >> x >> y;       x--, y--;       g[x].push_back(y);       g[y].push_back(x);     }     dfs(0, -1);     for (int i = 1; i < n; i++) {       if (b[i] && r[i]) continue;       int blue = b[0] - b[i], red = r[0] - r[i];       if (((!blue) && red) || (blue && (!red))) {         res++;       }     }     cout << res << endl;   }
#include <bits/stdc++.h>   using namespace std;   int modi = 1e9 + 7;   unsigned long long gcd(unsigned long long a, unsigned long long b) {     return !b ? a : gcd(b, a % b);   }   int main() {     ios::sync_with_stdio(false);     int n;     cin >> n;     for (int i = 0; i < n; i++) {       int x;       cin >> x;       string str =   ;       if (x % 2 == 1) {         str +=  7 ;         x -= 3;       }       while (x > 1) {         str +=  1 ;         x -= 2;       }       cout << str << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxx = 800010;   int t, n, m, k, b, u;   int ans = 0, total = 0, cnt = 0;   int a[maxx], sum[maxx];   struct no {     int num, l, r;     bool operator<(const no &X) const { return r < X.r; }   };   priority_queue<no> q;   struct node {     int num;     int l;     int r;   } s[maxx];   bool cmp(node a, node b) { return a.l < b.l; }   int main() {     scanf( %d%d , &n, &k);     for (register int i = 1; i <= n; i++) {       scanf( %d%d , &s[i].l, &s[i].r);       sum[s[i].l]++;       sum[s[i].r + 1]--;       s[i].num = i;     }     sort(s + 1, s + n + 1, cmp);     cnt = 1;     for (register int i = 1; i <= 200000; i++) {       while (cnt <= n && s[cnt].l <= i) {         q.push(no{s[cnt].num, s[cnt].l, s[cnt].r});         cnt++;       }       sum[i] += sum[i - 1];       while (sum[i] > k) {         a[++total] = q.top().num;         sum[i]--;         sum[q.top().r + 1]++;         q.pop();       }     }     sort(a + 1, a + total + 1);     printf( %d n , total);     for (register int i = 1; i <= total; i++) printf( %d  , a[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long min(long long a, long long b) { return (a < b) ? a : b; }   long long max(long long a, long long b) { return (a > b) ? a : b; }   int main() {     long long t, n, m, i, j, k = 0, p = 0;     cin >> n;     string s, q, r;     cin >> s;     p = s.size();     if (p % n != 0) {       for (i = 0; i < p / n + 1; i++) {         r +=  1 ;         for (j = 1; j < n; j++) r +=  0 ;       }       cout << r << endl;       return 0;     }     for (i = 0; i < p; i++)       if (s[i] !=  9 ) break;     if (i == p) {       for (i = 0; i < p + n; i++) {         if (i % n == 0)           r +=  1 ;         else           r +=  0 ;       }       cout << r << endl;       return 0;     }     for (i = n; i < p; i++) {       if (s[i] > s[i % n]) break;       if (s[i] < s[i % n]) break;     }     if (i == p || s[i] > s[i % n]) {       k = 1;       for (i = n - 1; i >= 0; i--) {         m = (s[i] - 48 + k);         k = m / 10;         s[i] = m % 10 + 48;         if (k == 0) break;       }       for (i = n; i < p; i++) s[i] = s[i % n];       cout << s << endl;       return 0;     }     for (i = n; i < p; i++) s[i] = s[i % n];     cout << s << endl;   }
#include <bits/stdc++.h>   using namespace std;   void Solve() {     long long T;     cin >> T;     while (T--) {       long long b, w;       cin >> b >> w;       if (b > w * 3 + 1 || w > b * 3 + 1) {         cout <<  NO n ;         continue;       }       cout <<  YES n ;       long long x = 2, y = 2;       while (b && w) {         cout << x <<     << y++ <<   n ;         cout << x <<     << y++ <<   n ;         b--, w--;       }       if (b) {         cout <<  2 1 n ;         b--;         x = 1, y = 2;         while (b) {           cout << x <<     << y <<   n ;           b--;           if (b) {             cout << x + 2 <<     << y <<   n ;             b--;           }           y += 2;         }       }       if (w) {         cout << x <<     << y <<   n ;         w--;         x = 1, y = 3;         while (w) {           cout << x <<     << y <<   n ;           w--;           if (w) {             cout << x + 2 <<     << y <<   n ;             w--;           }           y += 2;         }       }     }   }   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     Solve();     return 0;   }
#include <bits/stdc++.h>   int main() {     int n, a, b, c, sum = 0, i, j;     int d[10001] = {0};     scanf( %d %d %d %d , &n, &a, &b, &c);     for (i = 0; i <= a / 2; i++) d[i]++;     for (i = a / 2; i >= 0; i--) {       for (j = 1; j <= b && i + j <= n; j++) {         d[i + j]++;       }     }     for (i = 0; i <= c; i++) {       if (n - i * 2 >= 0) sum += d[n - i * 2];     }     printf( %d n , sum);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<pair<string, string>> taken;   int main() {     int n;     scanf( %d , &n);     int ans = 0;     for (int i = 1; i <= n; ++i) {       string s, t;       cin >> s >> t;       bool flag = 1;       for (auto [x, y] : taken) {         if (x == s && y == t) {           flag = 0;           break;         }       }       if (flag) {         ans++;         taken.push_back({s, t});       }     }     printf( %d n , ans);   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long m, s = -1, l = 1, r = 1e18;     cin >> m;     while (l <= r) {       long long as = 0, i;       long long mid = (l + r) / 2;       for (i = 2; i * i * i <= mid; i++) as += mid / (i * i * i);       if (as == m) s = mid;       if (as >= m)         r = mid - 1;       else         l = mid + 1;     }     cout << s;   }