malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   long long n, arr[100001];   string s;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cin >> n;     for (int i = 0; i < n; i++) {       cin >> arr[i];     }     cin >> s;     bool gotwater = false;     long long curt = 0, energy = 0, totwalk = 0;     for (int i = 0; i < n; i++) {       if (s[i] ==  L ) {         curt += arr[i];         if (energy < arr[i]) {           long long diff = arr[i] - energy;           if (gotwater)             curt += diff * 3;           else             curt += diff * 5;           energy += diff;         }         energy -= arr[i];       } else {         energy += arr[i];         if (s[i] ==  W ) {           gotwater = true;           curt += arr[i] * 3;         } else {           curt += arr[i] * 5;           totwalk += arr[i] * 2;         }       }       totwalk = min(totwalk, energy);     }     if (energy > 0) {       curt -= totwalk * 2;       curt -= (energy - totwalk);     }     cout << curt;   }
#include <bits/stdc++.h>   using namespace std;   long long mod = 1000000000 + 7;   int main() {     long long a, b;     cin >> a >> b;     long long ans = 0;     for (long long r = 1; r < b; ++r) {       long long tmp = (a * (a + 1) / 2) % mod;       tmp = (tmp * r) % mod;       tmp = (tmp * b) % mod;       tmp = (tmp + (a * r) % mod) % mod;       ans = (ans + tmp) % mod;     }     if (ans < 0) ans += mod;     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long a[101010];   long long l, r, pref[101010];   long long ans, cnt, sum, max1, min1, ali;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     long long n;     string s;     cin >> n;     while (n--) {       cin >> l >> r;       if (l >= r)         cout << r << endl;       else {         min1 = r / l;         max1 = r % l;         ans = ((min1 + 1) * (min1 + 1)) * max1;         ans += (min1 * min1) * (l - max1);         cout << ans << endl;       }     }   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using ull = unsigned long long;   using pii = pair<int, int>;   const int mod = 998244353;   const int maxn = 2e5 + 10;   struct edge {     int st, ed;     int w;     bool operator<(const edge &b) const { return w < b.w; }     edge() {}     edge(int st, int ed, int w) : st(st), ed(ed), w(w) {}   };   edge e[maxn];   int vet[805];   ll dis[805][805];   int temp[805], cnt;   int main() {     int n, m, k;     scanf( %d %d %d , &n, &m, &k);     for (int i = 0; i < m; ++i) {       int x, y, w;       scanf( %d %d %d , &x, &y, &w);       e[i] = edge(x, y, w);     }     sort(e, e + m);     for (int i = 0; i < min(m, k); ++i) {       temp[cnt++] = e[i].st;       temp[cnt++] = e[i].ed;     }     sort(temp, temp + cnt);     cnt = unique(temp, temp + cnt) - temp;     memset(dis, 0x3f, sizeof(dis));     for (int i = 0; i < min(m, k); ++i) {       int x, y;       x = lower_bound(temp, temp + cnt, e[i].st) - temp;       y = lower_bound(temp, temp + cnt, e[i].ed) - temp;       dis[x][y] = min(dis[x][y], (ll)e[i].w);       dis[y][x] = dis[x][y];     }     for (int a = 0; a < cnt; ++a) {       for (int i = 0; i < cnt; ++i) {         for (int j = i + 1; j < cnt; ++j) {           dis[i][j] = min(dis[i][j], dis[i][a] + dis[a][j]);           dis[j][i] = dis[i][j];         }       }     }     vector<ll> ans;     for (int i = 0; i < cnt; ++i) {       for (int j = i + 1; j < cnt; ++j) ans.push_back(dis[i][j]);     }     sort(ans.begin(), ans.end());     printf( %lld n , ans[k - 1]);   }
#include <bits/stdc++.h>   using namespace std;   long long int check(long long int a) {     if (a >= 1000000000 + 7) a %= 1000000000 + 7;     return a;   }   long long int check2(long long int a) {     if (a > 0) return a;     long long int b = a / 1000000000 + 7;     a -= b * 1000000000 + 7;     if (a < 0) a += 1000000000 + 7;     return a;   }   long long int exp(long long int a, long long int n) {     if (n == 0) return 1;     if (n == 1) return check(a);     long long int b = exp(a, n / 2);     if (n % 2 == 0) return check(b * b);     return check(b * check(b * a));   }   int arr[4][4];   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     for (int i = 0; i < 4; i++)       for (int j = 0; j < 4; j++) cin >> arr[i][j];     for (int i = 0; i < 4; i++) {       if (arr[i][3] == 1)         for (int j = 0; j < 3; j++)           if (arr[i][j] == 1) {             cout <<  YES ;             return 0;           }     }     for (int i = 0; i < 4; i++) {       for (int j = 0; j < 3; j++) {         int k = (i + 1 + j) % 4;         if (arr[i][3] == 1 && arr[i][3] == arr[k][j]) {           cout <<  YES ;           return 0;         }       }     }     cout <<  NO ;     return 0;   }
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:33554432 )   using namespace std;   const double PI = 2 * acos(0.0);   const double EPS = 1e-8;   const int INF = (1 << 30) - 1;   int n;   string s;   vector<int> p;   set<int> ans;   void add01(char c1, char c2, int a, int b) {     for (int i = 0; i < a; ++i) s[p[i]] = c1;     for (int i = 0; i < b; ++i) s[p[a + i]] = c2;   }   int getans() {     int i = n - 1;     while (s[i] !=  0 ) --i;     int j = n - 1;     while (s[j] !=  1 ) --j;     if (i < j)       return 1;     else       return 2;   }   void printbin(int n) { cout << n / 2 << n % 2 << endl; }   int main() {     cin >> s;     if ((int)((s).size()) % 2 == 1) s =  0  + s;     n = (int)((s).size());     int cnt = 0, cnt1 = 0, cnt0 = 0;     for (int i = 0; i < n; ++i)       if (s[i] ==  ? ) {         ++cnt;         p.push_back(i);       } else if (s[i] ==  1 )         ++cnt1;       else if (s[i] ==  0 )         ++cnt0;     if (cnt0 >= cnt1 + cnt + 2) {       cout <<  00 ;       return 0;     }     if (cnt1 >= cnt0 + cnt + 2) {       cout <<  11 ;       return 0;     }     if (cnt0 + cnt >= cnt1 + 2) ans.insert(0);     if (cnt1 + cnt >= cnt0 + 2) ans.insert(3);     add01( 0 ,  1 , n / 2 - cnt0, n / 2 - cnt1);     ans.insert(getans());     add01( 1 ,  0 , n / 2 - cnt1, n / 2 - cnt0);     ans.insert(getans());     for (set<int>::iterator i = ans.begin(); i != ans.end(); ++i) printbin(*i);     return 0;   };
#include <bits/stdc++.h>   using namespace std;   const int maxn = 2 * 100000 + 10;   int _min(int a, int b) {     if (a < b)       return a;     else       return b;   }   int _max(int a, int b) {     if (a > b)       return a;     else       return b;   }   char s[1005];   int col[4] = {0};   int row[4] = {0};   int main() {     scanf( %s , s);     int len = strlen(s);     for (int i = 0; i < len; i++) {       if (s[i] ==  0 ) {         for (int j = 0; j < 4; j++) {           if (col[j] == 0) {             col[j] = 1;             printf( %d %d n , 1, j + 1);             break;           }         }       } else {         for (int j = 0; j < 4; j++) {           if (row[j] == 0) {             row[j] = 1;             if (j == 0) printf( 3 1 n );             if (j == 1) printf( 3 3 n );             if (j == 2) printf( 4 1 n );             if (j == 3) printf( 4 3 n );             break;           }         }       }       int flag = 0;       for (int j = 0; j < 4; j++) {         if (col[j] == 0) {           flag = 1;           break;         }       }       if (flag == 0) {         for (int j = 0; j < 4; j++) col[j] = 0;       }       if (row[0] == 1 && row[1] == 1) {         row[0] = 0;         row[1] = 0;       }       if (row[2] == 1 && row[3] == 1) {         row[2] = 0;         row[3] = 0;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, v, t, p, cnt1, cnt2, x;   vector<pair<int, int>> k, c;   vector<int> ans;   void add(bool sm) {     v--;     if (sm) {       x += k[cnt1].first;       ans.push_back(k[cnt1++].second);     } else {       x += c[cnt2].first;       ans.push_back(c[cnt2++].second);       v--;     }   }   void solve() {     cin >> n >> v;     for (int i = 0; i < n; ++i) {       cin >> t >> p;       t--;       if (t) {         c.push_back({p, i + 1});       } else {         k.push_back({p, i + 1});       }     }     sort(k.begin(), k.end());     sort(c.begin(), c.end());     reverse(k.begin(), k.end());     reverse(c.begin(), c.end());     while ((v >= 1 && cnt1 < k.size()) || (v >= 2 && cnt2 < c.size())) {       add((cnt2 == c.size() || v == 1) || (k[cnt1].first > c[cnt2].first) ||           (cnt1 < k.size() - 1 &&            k[cnt1].first + k[cnt1 + 1].first > c[cnt2].first));     }     cout << x << endl;     for (int i = 0; i < ans.size(); ++i) {       cout << ans[i] <<    ;     }     cout << endl;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     map<long long int, long long int> mpp;     long long int n;     cin >> n;     for (long long int i = 0; i < n; i++) {       long long int x;       cin >> x;       mpp[__builtin_popcount(x)]++;     }     long long int ans = 0;     for (auto p : mpp) {       ans += (p.second) * (p.second - 1) / 2;     }     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   int N, T, K;   int a[200333];   int lo[200333], hi[200333];   int mid[200333];   int main() {     scanf( %d%d%d , &N, &T, &K);     for (int i = 1; i <= T; i++) scanf( %d , &a[i]);     K = N - K - 1;     for (int t = 1; t < T; t++) hi[t] = min(a[t], a[t + 1]);     for (int t = 1; t < T; t++) lo[t] = 1;     int hiSum = 0;     for (int t = 1; t < T; t++) hiSum += hi[t];     int loSum = 0;     for (int t = 1; t < T; t++) loSum += lo[t];     bool possible = loSum <= K && K <= hiSum;     if (!possible) {       puts( -1 );       exit(0);     }     for (int t = 1; t <= T; t++) {       mid[t] = lo[t];       K -= lo[t];     }     for (int t = 1; K; t++) {       int val = min(K, hi[t] - mid[t]);       K -= val;       mid[t] += val;     }     printf( %d n , N);     for (int v = 2; v <= 1 + a[1]; v++) printf( %d %d n , 1, v);     int uStart = 2;     for (int t = 1; t < T; t++) {       int u = uStart;       int upCnt = mid[t] - 1;       for (int v = uStart + a[t]; v < uStart + a[t] + a[t + 1]; v++) {         printf( %d %d n , u, v);         if (upCnt) {           upCnt--;           u++;         }       }       uStart = uStart + a[t];     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int M = 1005;   int parent[2 * M];   vector<pair<pair<int, int>, pair<int, int> > > edges;   void init() {     for (int i = 0; i < 2 * M; i++) parent[i] = i;   }   int find(int u) {     if (u == parent[u]) return u;     return parent[u] = find(parent[u]);   }   void un(int u, int v) {     u = find(u);     v = find(v);     parent[u] = v;   }   int main() {     int n, m, q;     scanf( %d %d %d , &n, &m, &q);     for (int i = 1; i <= m; i++) {       int a, b, c;       scanf( %d %d %d , &a, &b, &c);       edges.push_back(make_pair(make_pair(c, i), make_pair(a, b)));     }     sort(edges.begin(), edges.end(),          greater<pair<pair<int, int>, pair<int, int> > >());     while (q--) {       int l, r;       scanf( %d %d , &l, &r);       int ans = -1;       init();       for (int i = 0; i < edges.size(); i++) {         int c = edges[i].first.first;         int id = edges[i].first.second;         int u = edges[i].second.first;         int v = edges[i].second.second;         if (id < l || id > r) continue;         if (find(u) == find(v)) {           ans = c;           break;         }         un(u, v + n);         un(u + n, v);       }       printf( %d n , ans);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   long long qp(long long x, long long y) {     long long r = 1;     for (; y; y >>= 1, x = x * x % 1000000007ll)       if (y & 1) r = r * x % 1000000007ll;     return r;   }   long long c[1000010];   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       int x;       scanf( %d , &x);       if (~x) c[x]++;     }     long long r = 0;     for (int i = 1; i < 10010; i++)       r = (r + qp(2, c[i]) - 1 + 1000000007ll) % 1000000007ll;     cout << (qp(2, n - 1) - 1 - r + 1000000007ll) % 1000000007ll;   }
#include <bits/stdc++.h>   using namespace std;   const long long MOD = 1000000007;   long long Pot(long long a, long long b) {     if (b == 0) return 1;     if (b % 2 == 0) {       long long x = Pot(a, b / 2);       return x * x % MOD;     } else       return Pot(a, b - 1) * a % MOD;   }   long long Inv(long long x) { return Pot(x, MOD - 2); }   int main() {     ios_base::sync_with_stdio(0);     string s;     long long n, k;     cin >> s >> k;     n = s.size();     long long odp = 0;     for (long long i = 0; i < n; ++i) {       if (s[i] ==  0  || s[i] ==  5 ) {         long long pot1 = Pot(2, n * k) - 1;         if (pot1 < 0) pot1 += MOD;         long long pot2 = Pot(2, n) - 1;         if (pot2 < 0) pot2 += MOD;         long long il = Pot(2, i) * pot1 % MOD;         il = (il * Inv(pot2)) % MOD;         odp = (odp + il) % MOD;       }     }     cout << odp;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, i, j;   int main() {     ios::sync_with_stdio(false);     cin >> n;     cout << 3 * n / 2 <<   n ;     for (i = 2; i <= n; i += 2) cout << i <<    ;     for (i = 1; i <= n; i += 2) cout << i <<    ;     for (i = 2; i <= n; i += 2) cout << i <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int gi() {     char cc = getchar();     int cn = 0, flus = 1;     while (cc <  0  || cc >  9 ) {       if (cc ==  - ) flus = -flus;       cc = getchar();     }     while (cc >=  0  && cc <=  9 ) cn = cn * 10 + cc -  0 , cc = getchar();     return cn * flus;   }   const int N = 2e5 + 5;   struct E {     int to, next;   } e[N << 1];   int n, cnt, A, B, head[N];   void add(int x, int y) {     e[++cnt] = (E){y, head[x]}, head[x] = cnt, e[++cnt] = (E){x, head[y]},     head[y] = cnt;   }   void Dfs(int x, int fa, int dep) {     (dep ^ 1) ? ++A : ++B;     for (register int i = head[x]; i; i = e[i].next)       if (e[i].to ^ fa) Dfs(e[i].to, x, dep ^ 1);   }   signed main() {     n = gi();     int x, y;     for (register int i = (2); i <= (n); ++i) x = gi(), y = gi(), add(x, y);     Dfs(1, 1, 0);     cout << min(A, B) - 1 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   static char a[55][55];   bool vis[55][55];   bool dfs(int i, int j, int px, int py, int n, int m) {     bool flag = false;     if (i > n || j > m) return false;     if (i == 0 || j == 0) return false;     vis[i][j] = 1;     int xi[] = {1, 0, -1, 0};     int yi[] = {0, -1, 0, 1};     for (int k = 0; k < 4; k++) {       int x = xi[k] + i;       int y = yi[k] + j;       if (x == px && y == py) continue;       if (a[x][y] == a[i][j]) {         if (vis[x][y]) {           return true;         } else           flag = dfs(x, y, i, j, n, m);         if (flag) {           return true;         }       }     }     return false;   }   int main() {     int n, m;     char ch;     scanf( %d%d , &n, &m);     memset(a,  . , sizeof(a));     for (int i = 1; i <= n; i++) {       scanf( %c , &ch);       for (int j = 1; j <= m; j++) {         scanf( %c , &a[i][j]);       }     }     memset(vis, 0, sizeof(vis));     bool flag = false;     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= m; j++) {         if (vis[i][j] == true)           continue;         else           flag = dfs(i, j, 0, 0, n, m);         if (flag) break;       }       if (flag) break;     }     if (flag)       printf( Yes );     else       printf( No );   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   string tos(T a) {     stringstream ss;     string ret;     ss << a;     ss >> ret;     return ret;   }   int n, a;   vector<int> arr;   int main() {     while (cin >> n) {       arr.clear();       for (int(i) = (0); (i) < (n); (i)++) {         cin >> a;         arr.push_back(a);       }       int boro = *max_element((arr).begin(), (arr).end());       if (boro == 1) {         sort(arr.begin(), arr.end());         arr[arr.size() - 1] = 2;       } else {         for (int(i) = (0); (i) < (n); (i)++) {           if (arr[i] == boro) {             arr[i] = 1;             break;           }         }         sort(arr.begin(), arr.end());       }       for (int(i) = (0); (i) < (n); (i)++) {         if (i) cout <<    ;         cout << arr[i];       }       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 105000;   int n, m;   int tin[MAXN], tout[MAXN];   vector<int> g[MAXN];   vector<int> gr[MAXN];   vector<int> gg[MAXN];   vector<int> vv;   bool used[MAXN];   int sz[MAXN];   int cursize;   int p[MAXN];   bool has[MAXN];   int ans;   void dfs(int v) {     used[v] = true;     for (int i = 0; i < (int)g[v].size(); i++) {       int to = g[v][i];       if (!used[to]) dfs(to);     }     vv.push_back(v);   }   void dfs2(int v, int par) {     used[v] = true;     p[v] = par;     sz[par]++;     for (int i = 0; i < (int)gr[v].size(); i++) {       int to = gr[v][i];       if (!used[to]) dfs2(to, par);     }   }   void dfs3(int v) {     used[v] = true;     has[v] = true;     for (int i = 0; i < (int)gg[v].size(); i++) {       int to = gg[v][i];       if (!used[to]) dfs3(to);     }   }   void dfs4(int v) {     used[v] = true;     cursize++;     for (int i = 0; i < (int)gg[v].size(); i++) {       int to = gg[v][i];       if (!used[to]) dfs4(to);     }   }   int main() {     scanf( %d %d , &n, &m);     for (int i = 1; i <= m; i++) {       int from, to;       scanf( %d %d , &from, &to);       g[from].push_back(to);       gr[to].push_back(from);       gg[from].push_back(to);       gg[to].push_back(from);     }     for (int i = 1; i <= n; i++) {       if (!used[i]) {         dfs(i);       }     }     memset(used, 0, sizeof(used));     for (int i = 1; i <= n; i++) {       int cur = vv[n - i];       if (!used[cur]) {         dfs2(cur, cur);         if (sz[cur] > 1) {           has[cur] = true;         }       }     }     memset(used, 0, sizeof(used));     for (int i = 1; i <= n; i++)       if (!used[i] && has[i]) {         dfs3(i);       }     memset(used, 0, sizeof(used));     for (int i = 1; i <= n; i++) {       if (!used[i]) {         cursize = 0;         dfs4(i);         if (has[i])           ans += cursize;         else           ans += cursize - 1;       }     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s;     cin >> s;     long long n = s.size() / 2 + s.size() % 2;     long long x = n;     cout << s[x - 1];     for (long long t = 1; t <= 100; t++) {       if (x + t - 1 < s.size()) cout << s[x + t - 1];       if (x - t - 1 >= 0) cout << s[x - t - 1];     }     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   #pragma GCC optimization( unroll-loops )   using namespace std;   template <typename T>   ostream& operator<<(ostream& out, vector<T>& a) {     for (auto& p : a) out << p <<    ;     return out;   }   template <typename T>   istream& operator>>(istream& inp, vector<T>& a) {     for (auto& p : a) inp >> p;     return inp;   }   signed main() {     ios::sync_with_stdio(false);     cin.tie(0), cout.tie(0);     cout.precision(20);     srand((signed)time(NULL));     long long n = 0, ans = 0;     cin >> n;     vector<pair<long long, long long>> arr(n);     for (auto& p : arr) cin >> p.first >> p.second;     map<long long, long long> gx, gy;     for (long long i = 0; i < n; i++) {       ans += gx[arr[i].first] + gy[arr[i].second];       gx[arr[i].first]++, gy[arr[i].second]++;     }     map<pair<long long, long long>, long long> gg;     for (long long i = 0; i < n; i++) gg[arr[i]]++;     for (auto& p : gg) ans -= p.second * (p.second - 1) / 2;     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   namespace math {   template <typename T>   T gcd(T a, T b) {     if (a < 0) a = -a;     if (b < 0) b = -b;     while (b > 0) {       T r = a % b;       a = b;       b = r;     }     return a;   }   }  // namespace math   template <typename C>   int SZ(const C& c) {     return (int)c.size();   }   template <size_t n, class... Types>   struct TupleHashHelper {     static std::size_t calc(const std::tuple<Types...>& t) {       using std::size_t;       std::hash<typename std::tuple_element<n - 1, std::tuple<Types...>>::type>           elemHash;       return elemHash(std::get<n - 1>(t)) +              31013 * TupleHashHelper<n - 1, Types...>::calc(t);     }   };   template <class... Types>   struct TupleHashHelper<0, Types...> {     static std::size_t calc(const std::tuple<Types...>&) { return 0; }   };   template <class... Types>   struct TupleHash {     std::size_t operator()(const std::tuple<Types...>& t) const {       static const size_t n = std::tuple_size<std::tuple<Types...>>::value;       return TupleHashHelper<n, Types...>::calc(t);     }   };   class Solution {    public:     void solve(std::istream& in, std::ostream& out) {       int n;       in >> n;       vector<int> x(n), y(n);       for (int i = 0; i < n; ++i) in >> x[i] >> y[i];       unordered_map<tuple<int, int, int>, set<int>, TupleHash<int, int, int>>           lines;       for (int i = 0; i < n; ++i)         for (int j = i + 1; j < n; ++j) {           using math::gcd;           int a = y[j] - y[i], b = x[i] - x[j];           int c = -a * x[i] - b * y[i];           int d = gcd(gcd(a, b), c);           if (a < 0) {             a = -a;             b = -b;             c = -c;           } else if (a == 0 && b < 0) {             b = -b;             c = -c;           }           auto t = make_tuple(a / d, b / d, c / d);           lines[t].insert(i);           lines[t].insert(j);         }       long long res = (long long)n * (n - 1) * (n - 2) / 6;       for (const auto& p : lines) {         long long s = SZ(p.second);         res -= s * (s - 1) * (s - 2) / 6;       }       out << res << endl;     }   };   void solve(std::istream& in, std::ostream& out) {     out << std::setprecision(12);     Solution solution;     solution.solve(in, out);   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     istream& in = cin;     ostream& out = cout;     solve(in, out);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline int toInt(string s) {     int v;     istringstream sin(s);     sin >> v;     return v;   }   template <class T>   inline string toString(T x) {     ostringstream sout;     sout << x;     return sout.str();   }   template <class T>   inline T sqr(T x) {     return x * x;   }   const double EPS = 1e-10;   const double PI = acos(-1.0);   const int dx[] = {-1, 1, 0, 0};   const int dy[] = {0, 0, 1, -1};   int n, k, ret;   bool us[11];   int main() {     cin >> n >> k;     for (int i = (0); i < (n); ++i) {       string s;       bool f = true;       cin >> s;       for (int j = (0); j < (10); ++j) us[j] = false;       for (int j = (0); j < (s.size()); ++j) us[s[j] -  0 ] = true;       for (int j = (0); j < (k + 1); ++j)         if (!us[j]) f = false;       ret += f;     }     cout << ret << endl;     return 0;   }
#include <bits/stdc++.h>   int main() {     long long l3, l4, l5;     std::cin >> l3 >> l4 >> l5;     long double pi = 3.141592653589793238462643383279;     long double v3 = 1.0 / 3.0 * l3 * l3 * sqrtl(3.0) / 4.0 * l3 * sqrtl(2.0 / 3);     long double v4 = 1.0 / 3.0 * l4 * l4 * l4 * sqrtl(2) / 2;     long double v5 = 1.0 / 3.0 * l5 * l5 * sqrtl(25 + 10 * sqrtl(5)) / 4 * l5 *                      sqrtl(4 * sinl(pi / 5) * sinl(pi / 5) - 1) /                      (2 * sinl(pi / 5));     std::cout.precision(10);     return std::cout << std::fixed << v3 + v4 + v5, 0;   }
#include <bits/stdc++.h>   using namespace std;   long long p2(long long x) { return x * x; }   int main() {     long long n;     cin >> n;     if (n <= 2)       cout << -1 << endl;     else if (!(n % 2))       cout << (n * n) / 4 - 1 <<     << (n * n) / 4ll + 1ll << endl;     else       cout << (n * n - 1) / 2ll <<     << (n * n + 1) / 2ll << endl;     return 0;   }