malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   inline long long getnum() {     char c = getchar();     long long num, sign = 1;     for (; c <  0  || c >  9 ; c = getchar())       if (c ==  - ) sign = -1;     for (num = 0; c >=  0  && c <=  9 ;) {       c -=  0 ;       num = num * 10 + c;       c = getchar();     }     return num * sign;   }   int A[540][540][12];   int main() {     int n = getnum();     A[1][1][0] = 1;     for (int i = 1; i <= 9; i++) {       int l = 1 << i;       int fx = l, fy = 1;       int sx = l, sy = l;       int tx = 1, ty = l;       l /= 2;       for (int j = 1; j <= l; j++) {         for (int k = 1; k <= l; k++) {           A[j][k][i] = A[j][k][i - 1];           A[fx][fy][i] = A[j][k][i - 1];           A[sx][sy][i] = A[j][k][i - 1];           A[tx][ty][i] = 1 - A[j][k][i - 1];           fy++, sy--, ty--;         }         fx--, sx--, tx++;         fy = 1, sy = l * 2, ty = l * 2;       }     }     int l = 1 << n;     for (int i = 1; i <= l; i++) {       for (int j = 1; j <= l; j++) {         if (A[i][j][n])           putchar( + );         else           putchar( * );       }       putchar(  n );     }   }
#include <bits/stdc++.h>   using namespace std;   long long a[100005], n, cont[100005];   int main() {     cin >> n;     for (int i = 0; i < n; i++) cin >> a[i], cont[50 + a[i]]++;     long long res = 0;     for (int i = 0; i <= 10; i++) {       if (i == 0) {         long long x = cont[50];         res += (x * (x - 1)) / 2;       } else {         res += cont[50 + i] * cont[50 - i];       }     }     cout << res << endl;   }
#include <bits/stdc++.h>   using namespace std;   int S, l[100], r[100], N, w[200];   double a[100], b[100], f[100][100], ans[100];   void init() {     scanf( %d , &N);     for (int i = 1; i <= N; i++)       scanf( %d%d , &l[i], &r[i]), w[++S] = l[i], w[++S] = r[i];   }   void calc(int p, int L, int R) {     int t = 0, bg = 0;     memset(f, 0, sizeof(f)), f[0][0] = 1.0 * (R - L) / (r[p] - l[p]);     for (int i = 1; i <= N; i++)       if (i != p) {         double s = r[i] - l[i], x, y;         if (r[i] <= L) {           bg++;           continue;         } else if (R <= l[i])           continue;         else           x = (L - l[i]) / s, y = (R - L) / s;         t++;         for (int j = t; j >= 0; j--)           for (int k = t - j; k >= 0; k--) {             f[j][k] *= 1 - x - y;             if (j) f[j][k] += f[j - 1][k] * x;             if (k) f[j][k] += f[j][k - 1] * y;           }       }     for (int i = 0; i + bg < N; i++)       for (int j = 0; i + bg + j < N; j++)         ans[i + bg + 1] += f[i][j] / (j + 1),             ans[i + bg + j + 2] -= f[i][j] / (j + 1);   }   void doit() {     sort(w + 1, w + S + 1);     for (int i = 1; i <= N; i++) {       memset(ans, 0, sizeof(ans));       for (int j = 1; j <= S; j++)         if ((j == 1 || w[j] != w[j - 1]) && l[i] <= w[j - 1] && w[j] <= r[i])           calc(i, w[j - 1], w[j]);       for (int j = 1; j <= N; j++)         printf( %.9lf%c , ans[j] += ans[j - 1], j == N ?   n  :    );     }   }   int main() {     init();     doit();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long n;     int m;     cin >> n >> m;     long long cnt = 0;     if (m == 1) {       cout << n * n << endl;       return 0;     }     if (m < n) {       for (int i = 1; i <= m; i++)         for (int j = 1; j <= m; j++)           if ((i * i + j * j) % m == 0) cnt++;       long long mul = n / m;       mul = mul * mul;       cnt *= mul;       long long index = (n / m) * m;       index++;       if (index <= n) {         long long cnt1 = 0;         for (long long i = index; i <= n; i++)           for (long long j = 1; j <= m; j++) {             long long i1 = i % m;             long long j1 = j % m;             if ((i1 * i1 + j1 * j1) % m == 0) cnt1++;           }         mul = n / m;         mul *= 2;         cnt1 *= mul;         cnt += cnt1;         for (long long i = index; i <= n; i++)           for (long long j = index; j <= n; j++) {             long long i1 = i % m;             long long j1 = j % m;             if ((i1 * i1 + j1 * j1) % m == 0) cnt++;           }       }     } else {       for (int i = 1; i <= n; i++)         for (int j = 1; j <= n; j++)           if ((i * i + j * j) % m == 0) cnt++;     }     cout << cnt << endl;     return 0;   }
#include <bits/stdc++.h>   const long double eps = 1e-10;   const int MOD = 1000000007;   using namespace std;   int a[200005], K, n;   int main() {     scanf( %d %d , &n, &K);     for (int i = 0; i < n; ++i) scanf( %d , a + i);     sort(a, a + n);     int ret = 0;     for (int i = 0; i < n - 1; ++i) {       int b = a[i] + K;       int low = i + 1, high = n;       while (low <= high) {         int mid = (low + high) >> 1;         if (a[mid] == a[i]) {           low = mid + 1;           continue;         }         if (a[mid] > a[i] && a[mid] <= b) {           ++ret;           break;         } else {           high = mid - 1;         }       }     }     printf( %d n , n - ret);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 501;   int n, vis[maxn][maxn], a[maxn][maxn], x, y, s, cnt;   char p[3000010];   int d[4][2] = {0, 1, 1, 0, -1, 0, 0, -1};   bool J(int x, int y, int i) {     while (true) {       x += d[i][0];       y += d[i][1];       if (!x || !y || x > n || y > n) return 0;       if (vis[x][y]) return 0;       if (a[x][y]) return 1;     }   }   void dfs(int x, int y) {     if (!a[x][y]) p[cnt++] =  1 , s++;     vis[x][y] = 1;     for (int i = 0; i < 4; i++)       if (J(x, y, i)) {         p[cnt++] = (!i ?  R  : i == 1 ?  D  : i == 2 ?  U  :  L );         dfs(x + d[i][0], y + d[i][1]);         p[cnt++] = (!i ?  L  : i == 1 ?  U  : i == 2 ?  D  :  R );       }     p[cnt++] =  2 , s--;   }   int main() {     scanf( %d%d%d , &n, &x, &y);     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++) scanf( %d , &a[i][j]), s += a[i][j];     dfs(x, y);     p[cnt++] = 0;     if (s)       printf( NO n );     else       printf( YES n%s n , p);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long fact_a[1000005];   long long factorial() {     fact_a[0] = fact_a[1] = 1;     for (long long i = 2; i < 1000005; i++) fact_a[i] = (fact_a[i - 1] * i);   }   long long power(long long x, long long n) {     long long result = 1;     while (n > 0) {       if (n % 2 == 1) result = result * x;       x = x * x;       n = n / 2;     }     return result;   }   long long nCr(long long n, long long r) {     if (n < r) return 0LL;     if (n == r) return 1LL;     long long ans = fact_a[n];     ans = (ans * power(fact_a[r], 1000000007 - 2)) % 1000000007;     ans = (ans * power(fact_a[n - r], 1000000007 - 2)) % 1000000007;     return ans;   }   long long prime[1000005];   void sieve() {     prime[1000005] = {0};     for (long long i = 2; i < 1000005; i++) {       if (prime[i] == 0) {         for (long long j = i * i; j < 1000005; j += i) {           prime[j] = 1;         }       }     }   }   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long tc;     cin >> tc;     while (tc--) {       long long n, k;       cin >> n;       long long a[n];       set<long long> s;       for (long long i = 0; i < n; i++) {         cin >> a[i];         s.insert(a[i]);       }       if (s.size() == 1)         cout << n <<   n ;       else         cout << 1 <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     string s, t;     cin >> s;     size_t a, b, c, d, n;     n = s.length();     t.reserve(n);     a = s.find( 0 );     b = s.find( 1 );     c = s.find( 2 );     d = c;     for (size_t i = 0; i < n; i++) {       if (a < d) {         t +=  0 ;         a = s.find( 0 , a + 1);       } else if (b < n) {         t +=  1 ;         b = s.find( 1 , b + 1);       } else {         if (a < c) {           t +=  0 ;           a = s.find( 0 , a + 1);         } else {           t +=  2 ;           c = s.find( 2 , c + 1);         }       }     }     cout << t;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     long long n;     long long a[2];     cin >> a[0] >> a[1];     sort(a, a + 2);     n = 2 * a[0];     if (n < a[1]) {       n = a[1];     }     n *= n;     cout << n << endl;   }   int main() {     int t;     cin >> t;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int i, j;     char a[100010];     scanf( %s , &a);     int n = strlen(a);     int b = 10 * (a[n - 2] -  0 ) + (a[n - 1] -  0 );     if (b % 4 == 0)       cout <<  4 ;     else       cout <<  0 ;     return 0;   }
#include <bits/stdc++.h>   #pragma comment(linker,  /stack:256000000 )   using namespace std;   int main() {     int n;     cin >> n;     if (n % 2 == 0) {       puts( -1 );     } else {       for (int(i) = 0; (i) < (n); (i)++) printf( %d  , i);       printf(  n );       for (int(i) = 0; (i) < (n); (i)++) printf( %d  , i);       printf(  n );       for (int(i) = 0; (i) < (n); (i)++) printf( %d  , 2 * i % n);       printf(  n );     }     return 0;   }
#include <bits/stdc++.h>   long long max(long long a, long long b) { return a > b ? a : b; }   long long min(long long a, long long b) { return a < b ? a : b; }   void swap(long long &a, long long &b) {     long long tmp = a;     a = b;     b = tmp;   }   long long lowbit(long long &x) { return x & (-x); }   void read(long long &x) {     x = 0;     char ch = getchar(), c = ch;     while (ch <  0  || ch >  9 ) c = ch, ch = getchar();     while (ch <=  9  && ch >=  0 ) x = x * 10 + ch -  0 , ch = getchar();     if (c ==  - ) x = -x;   }   const long long INF = 0x3f3f3f3f3f3f3f3f;   const long long MAXN = 300000 + 10;   const long long MAXM = 10;   long long dp[MAXN][MAXM + 10], n, m, k, a[MAXN];   int main() {     read(n), read(m), read(k);     long long ans = 0;     for (long long i = 1; i <= n; ++i) read(a[i]);     for (int i = 0; i <= n; ++i)       for (int j = 0; j < m; ++j) dp[i][j] = -INF;     dp[0][m - 1] = 0;     for (long long i = 1; i <= n; ++i)       for (long long j = 0; j < m; ++j) {         if (j == 0)           dp[i][j] = max(dp[i - 1][m - 1] + a[i], a[i]) - k;         else           dp[i][j] = dp[i - 1][j - 1] + a[i];         ans = max(ans, dp[i][j]);       }     printf( %I64d , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   inline bool getmin(T *a, const T &b) {     if (b < *a) {       *a = b;       return true;     }     return false;   }   template <class T>   inline bool getmax(T *a, const T &b) {     if (b > *a) {       *a = b;       return true;     }     return false;   }   template <class T>   inline void read(T *a) {     char c;     while (isspace(c = getchar())) {     }     bool flag = 0;     if (c ==  - )       flag = 1, *a = 0;     else       *a = c - 48;     while (isdigit(c = getchar())) *a = *a * 10 + c - 48;     if (flag) *a = -*a;   }   const int mo = 1000000007;   template <class T>   T pow(T a, T b, int c = mo) {     T res = 1;     for (T i = 1; i <= b; i <<= 1, a = 1LL * a * a % c)       if (b & i) res = 1LL * res * a % c;     return res;   }   const int inf = 1000000000;   const int N = 210000;   struct node {     int p, nextt, w;   } edge[N];   int cnt;   int head[N];   void ae(int a, int b, int c) {     edge[++cnt].p = b;     edge[cnt].nextt = head[a];     edge[cnt].w = c;     head[a] = cnt;   }   queue<int> q;   int d[N], tmp[N];   int n, m;   int bfs(int u) {     static vector<int> v;     v.clear();     d[u] = 0;     while (!q.empty()) q.pop();     q.push(u);     int ans = 0, num = 0;     while (!q.empty()) {       int u = q.front();       q.pop();       ans += d[u];       v.push_back(u);       ++num;       for (int k = head[(u)]; k; k = edge[k].nextt) {         int v = edge[k].p;         if (d[v] != -1 && (d[u] ^ d[v]) != edge[k].w)           return inf;         else if (d[v] == -1) {           d[v] = (d[u] ^ edge[k].w);           q.push(v);         }       }     }     for (int i = (0); i <= (num - 1); ++i)       if (num - ans < ans) d[v[i]] ^= 1;     return min(ans, num - ans);   }   int solve() {     for (int i = (1); i <= (n); ++i) d[i] = -1;     int ans = 0;     for (int i = (1); i <= (n); ++i)       if (d[i] == -1) {         int x = bfs(i);         if (x == inf)           return inf;         else           ans += x;       }     return ans;   }   int main() {     cin >> n >> m;     for (int i = (1); i <= (m); ++i) {       int x, y;       string s;       cin >> x >> y >> s;       int z = 0;       if (s ==  R ) z = 1;       ae(x, y, z);       ae(y, x, z);     }     int ans = solve();     for (int i = (1); i <= (n); ++i) tmp[i] = d[i];     for (int i = (1); i <= (n); ++i)       for (int k = head[(i)]; k; k = edge[k].nextt) edge[k].w ^= 1;     int x = solve();     if (x < ans) {       ans = x;       for (int i = (1); i <= (n); ++i) tmp[i] = d[i];     }     if (ans == inf) {       cout << -1 << endl;     } else {       cout << ans << endl;       for (int i = (1); i <= (n); ++i)         if (tmp[i]) printf( %d  , i);       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[100], n, m, x, h, ans, l, r;   int main() {     cin >> n;     for (int i = 0; i < n; i++) {       cin >> x;       a[x]++;     }     for (int i = 1; i <= 50; i++) {       if (a[i] == 0) continue;       if (a[i] > n / 2) {         cout <<  Bob ;         return 0;       }       break;     }     cout <<  Alice ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 1e9;   const int maxn = 2e5 + 10;   int N, K;   int L[105], R[105];   struct min_segtree {     int tree[maxn * 3];     void init() {       for (int i = 0; i <= 2 * 2 * N + 2048; ++i) tree[i] = INF;     }     void update(int l, int r, int pos, int id, int val) {       if (l > r || pos < l || pos > r) return;       if (l == pos && pos == r) {         tree[id] = val;         return;       }       int mid = (l + r) >> 1;       if (pos <= mid)         update(l, mid, pos, id << 1, val);       else         update(mid + 1, r, pos, id << 1 | 1, val);       tree[id] = min(tree[id << 1], tree[id << 1 | 1]);     }     int query(int l, int r, int x, int y, int id) {       if (l > r || x > y || r < x || l > y) return INF;       if (l <= x && y <= r) return tree[id];       int mid = (x + y) >> 1;       if (r <= mid) return query(l, r, x, mid, id << 1);       if (l > mid) return query(l, r, mid + 1, y, id << 1 | 1);       return min(query(l, r, x, mid, id << 1),                  query(l, r, mid + 1, y, id << 1 | 1));     }   } DP[105];   int main() {     scanf( %d %d , &N, &K);     int i, j, lim = 2 * N;     for (i = 1; i <= K; ++i) scanf( %d %d , &L[i], &R[i]);     for (i = 0; i <= K; ++i) {       DP[i].init();     }     DP[0].update(0, lim, 0, 1, 0);     for (i = 1; i <= K; ++i) {       for (j = 0; j <= lim && j <= R[i]; ++j) {         int zero = (j - R[i] + R[i - 1] >= 0)                        ? DP[i - 1].query(j - R[i] + R[i - 1], j - R[i] + R[i - 1],                                          0, lim, 1)                        : INF;         int one =             1 + DP[i - 1].query(max(0, R[i - 1] - j),                                 min(lim, R[i - 1] - j + R[i] - L[i]), 0, lim, 1);         int two = 2 + DP[i - 1].query(max(0, j - R[i] + R[i - 1]),                                       min(lim, j - R[i] + R[i - 1] + R[i] - L[i]),                                       0, lim, 1);         DP[i].update(0, lim, j, 1, min(zero, min(one, two)));       }     }     if (R[K] - N < 0 || DP[K].query(R[K] - N, R[K] - N, 0, lim, 1) >= INF) {       printf( Hungry n );     } else {       printf( Full n%d n , DP[K].query(R[K] - N, R[K] - N, 0, lim, 1));     }   }
#include <bits/stdc++.h>   using namespace std;   const long double pi = acos(-1);   const int N = 2e5;   long long gi() {     long long w = 0;     bool q = 1;     char c = getchar();     while ((c <  0  || c >  9 ) && c !=  - ) c = getchar();     if (c ==  - ) q = 0, c = getchar();     while (c >=  0  && c <=  9 ) w = w * 10 + c -  0 , c = getchar();     return q ? w : -w;   }   int main() {     long long n = gi(), m = gi(), a = gi(), d = gi(), last = 0, k, x, y, ans = 0,               u = d / a + 1;     while (m--) {       k = gi();       x = max(last / a + 1, 1LL);       y = min(k / a, n);       if (x <= y) {         ans += (y - x) / u + 1;         last = (x + (y - x) / u * u) * a + d;       }       if (last < k) last = k + d, ans++;     }     x = max(last / a + 1, 1LL);     if (x <= n) ans += (n - x) / u + 1;     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class P, class Q>   inline bool mmin(P &a, Q b) {     if (a > b) {       a = b;       return true;     }     return false;   }   template <class P, class Q>   inline bool mmax(P &a, Q b) {     if (a < b) {       a = b;       return true;     }     return false;   }   const int MAXn = 400 + 5, INF = 1000;   int n;   vector<pair<int, int> > adj[MAXn];   vector<int> son[MAXn];   int par[MAXn], siz[MAXn];   int dp[MAXn][MAXn];   int cur[MAXn][MAXn], upd[MAXn][MAXn];   bool mark[MAXn];   int nxt[MAXn];   inline void calcDP(int x) {     int m = ((int)son[x].size());     cur[m][0] = 0;     for (int j = 1; j < siz[x]; ++j) cur[m][j] = INF;     int s = 0;     for (int i = m - 1; i >= 0; --i) {       s += siz[son[x][i]];       for (int j = 0; j <= s; ++j) {         cur[i][j] = INF;         for (int k = 0; k <= j && k <= siz[son[x][i]]; ++k)           if (j - k <= s - siz[son[x][i]] &&               mmin(cur[i][j], cur[i + 1][j - k] + dp[son[x][i]][k]))             upd[i][j] = k;       }     }   }   void DFS(int x) {     siz[x] = 1;     for (int i = 0; i < ((int)adj[x].size()); ++i) {       int y = adj[x][i].first;       if (y != par[x]) {         son[x].push_back(y);         par[y] = x;         DFS(y);         siz[x] += siz[y];       }     }     calcDP(x);     dp[x][0] = 1;     for (int j = 1; j <= siz[x]; ++j) dp[x][j] = cur[0][j - 1];   }   void DFS2(int x, int k) {     if (!k) return;     mark[x] = 1;     if (k == 1) return;     calcDP(x);     int y = k - 1;     for (int i = 0; i < ((int)son[x].size()); ++i) {       nxt[son[x][i]] = upd[i][y];       y -= upd[i][y];     }     y = k - 1;     for (int i = 0; i < ((int)son[x].size()); ++i) {       DFS2(son[x][i], nxt[son[x][i]]);       y -= nxt[son[x][i]];     }   }   int main() {     ios_base::sync_with_stdio(false);     int k;     cin >> n >> k;     for (int i = 0; i < n - 1; ++i) {       int x, y;       cin >> x >> y;       --x;       --y;       adj[x].push_back(pair<int, int>(y, i + 1));       adj[y].push_back(pair<int, int>(x, i + 1));     }     fill(dp[0], dp[n], INF);     DFS(0);     int mn = dp[0][k], ind = 0;     for (int i = 1; i < n; ++i)       if (mmin(mn, dp[i][k] + 1)) ind = i;     DFS2(ind, k);     vector<int> v;     for (int i = 0; i < n; ++i)       for (int j = 0; j < ((int)adj[i].size()); ++j)         if (adj[i][j].first > i && (mark[i] ^ mark[adj[i][j].first]))           v.push_back(adj[i][j].second);     cout << ((int)v.size()) << endl;     for (int i = 0; i < ((int)v.size()); ++i) cout << v[i] <<    ;     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int x, y, z, q, w, e;     cin >> x >> y >> z >> q >> w >> e;     int leg = 0;     int el = 0;     leg = abs(x - y) * q;     el = 3 * e + abs(x - z) * w + abs(y - x) * w;     if (el <= leg) {       cout <<  YES ;     } else {       cout <<  NO ;     }   }
#include <bits/stdc++.h>   using namespace std;   string solve(string s, int t) {     while (t--) {       for (int i = s.size() - 1; i >= 1; i--) {         if (s[i] ==  G  && s[i - 1] ==  B ) {           swap(s[i], s[i - 1]);           i--;         }       }     }     return s;   }   int main() {     int n, t;     cin >> n >> t;     string s;     cin >> s;     cout << solve(s, t);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 0x3f3f3f3f;   const long long linf = 0x3f3f3f3fLL;   int main() {     int n;     scanf( %d , &n);     if (n < 10)       puts( 1 );     else {       int aux = n;       while (aux >= 10) {         aux /= 10;       }       int num = aux + 1;       aux = n;       while (aux >= 10) {         aux /= 10;         num *= 10;       }       printf( %d n , num - n);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   void checkmax(T &t, T x) {     if (x > t) t = x;   }   template <class T>   void checkmin(T &t, T x) {     if (x < t) t = x;   }   template <class T>   void _checkmax(T &t, T x) {     if (t == -1 || x > t) t = x;   }   template <class T>   void _checkmin(T &t, T x) {     if (t == -1 || x < t) t = x;   }   int main() {     int n, num, flag;     double dou, sum, sub;     while (cin >> n) {       sum = num = flag = 0;       for (int i = 0; i < (2 * n); ++i) {         scanf( %lf , &dou);         sub = ceil(dou) - dou;         sum += sub;         if (sub < 10e-4 && sub > -10e-4) num++;       }       sum -= n - num;       if (num == 0)         printf( %.3lf n , fabs(sum));       else {         for (int i = 0; i < (num); ++i) {           if (fabs(sum) > fabs(sum - 1))             sum = sum - 1;           else {             printf( %.3lf n , fabs(sum));             flag = 1;             break;           }         }         if (!flag) printf( %.3lf n , fabs(sum));       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long a[200005], b[200005], c[200005], mod = 998244353, ans = 0;   int main() {     long long n;     cin >> n;     c[1] = c[n] = (long long)n;     for (long long i = 2; i <= n / 2; i++) {       c[i] = (n - i + 1) * i;       c[n - i + 1] = c[i];     }     if (n % 2 == 1) {       c[n / 2 + 1] = (n - n / 2) * (n / 2 + 1);     }     for (int i = 1; i <= n; i++) {       cin >> a[i];       a[i] *= (long long)c[i];     }     for (int i = 1; i <= n; i++) {       cin >> b[i];     }     sort(a + 1, a + n + 1);     sort(b + 1, b + n + 1, [](long long x, long long y) { return x > y; });     for (int i = 1; i <= n; i++) {       long long tmp = (a[i] % mod * b[i] % mod) % mod;       ans = (ans + tmp) % mod;     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     double n, k, m, l, a, b, f, d;     cin >> n >> k;     long long kek = n;     double cnt1 = 0, cnt2 = 0;     while (kek % 2 == 0) {       kek /= 2;       cnt1++;     }     kek = n;     while (kek % 5 == 0) {       kek /= 5;       cnt2++;     }     cout.precision(0);     cout << fixed;     cnt1 = max(0.0, k - cnt1);     cnt2 = max(0.0, k - cnt2);     cout << n * pow(2, cnt1) * pow(5, cnt2);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int k, n;   int a[2201];   int main() {     cin >> n >> k;     for (int i = 1; i <= n; i++) {       cin >> a[i];     }     sort(a + 1, a + n + 1);     int ans = 0;     for (int i = 1; i <= k; i++) {       ans += a[i];     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[100004];   int main() {     int n, no;     cin >> n >> a[0];     a[0] = (a[0] - 1) % 2;     for (int i = 1; i < n; i++) {       cin >> no;       a[i] = (a[i - 1] + (no - 1)) % 2;     }     for (int i = 0; i < n; i++) {       if (a[i] == 1) {         cout <<  1 n ;       } else         cout <<  2 n ;     }     return 0;   }