malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int inf = 2000000005;   const int maxt = (1 << 20) + 5;   int all[maxt], dp[2][maxt];   int best[30], a[30][30];   int mask[30][30], cost[30][30];   char str[30][30];   int n, m;   int main() {     scanf( %d%d , &n, &m);     for (int i = 0; i < n; i++) scanf( %s , str[i]), best[i] = inf;     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++)         scanf( %d , &a[i][j]), best[i] = min(best[i], a[i][j]);     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         bool ok = true;         for (int k = 0; k < n; k++)           if (k != i && str[i][j] == str[k][j]) ok = false;         if (ok) best[i] = 0;       }     }     for (int j = 0; j < m; j++) {       for (int c = 0; c < 26; c++) {         mask[j][c] = 0;         cost[j][c] = 0;         int maxc = 0, cnt = 0;         for (int i = 0; i < n; i++)           if (str[i][j] -  a  == c) {             mask[j][c] |= 1 << i;             cost[j][c] += a[i][j];             maxc = max(maxc, a[i][j]);             cnt++;           }         cost[j][c] -= maxc;         if (cnt < 2) mask[j][c] = -1;       }     }     for (int i = 0; i < 1 << n; i++) dp[0][i] = dp[1][i] = inf;     int nw = 0, ls = 1;     dp[nw][0] = 0;     for (int j = 0; j < m; j++)       for (int c = 0; c < 26; c++)         if (mask[j][c] != -1) {           swap(nw, ls);           memcpy(dp[nw], dp[ls], sizeof dp[ls]);           for (int i = 0; i < 1 << n; i++) {             dp[nw][i | mask[j][c]] =                 min(dp[nw][i | mask[j][c]], dp[ls][i] + cost[j][c]);           }         }     for (int i = 0; i < 1 << n; i++) {       all[i] = 0;       for (int j = 0; j < n; j++)         if ((i >> j) & 1)           ;         else           all[i] += best[j];     }     int ans = inf;     for (int i = 0; i < 1 << n; i++) ans = min(ans, all[i] + dp[nw][i]);     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, a[111], maxx;   int main() {     cin >> n >> m;     for (int i = 0; i < n; ++i) cin >> a[i];     maxx = a[0];     for (int i = 1; i < n; ++i) maxx = max(maxx, a[i]);     int tot = 0;     for (int i = 0; i < n; ++i) tot += maxx - a[i];     int res2 = maxx + m;     m -= tot;     if (m < 0) m = 0;     int res1 = maxx + m / n;     if (m % n) ++res1;     cout << res1 <<     << res2;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long int N = 1e5 + 5;   const long long int M = 1e9 + 7;   queue<pair<long long int, long long int> > pq;   vector<long long int> v;   map<long long int, long long int> mpp;   set<pair<long long int, long long int> > st;   long long int a[N], h[N], indx[N][2];   long long int val[N];   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     long long int n, l;     cin >> n;     string s;     cin >> s;     long long int a = 0;     long long int b = 0;     for (int i = int(0); i <= int(n - 1); i++) {       if (s[i] ==  8 ) a++;     }     long long int x = n / 11;     if (a < x)       cout << a;     else       cout << x;   }
#include <bits/stdc++.h>   #pragma GCC optimize( Ofast,no-stack-protector,unroll-loops )   #pragma GCC optimize( no-stack-protector,fast-math )   using namespace std;   const long long N = 2e5 + 100, OO = 1e9 + 7, T = 1e6 + 10, M = 1e9 + 7,                   P = 6151, SQ = 280, lg = 20;   long long n;   long long pw(long long x, long long y) {     if (y == 0) return 1;     long long cnt = pw(x, y / 2);     cnt = (cnt * cnt) % n;     cnt = (cnt * (y % 2 == 1 ? x : 1)) % n;     return cnt;   }   int32_t main() {     ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);     cin >> n;     if (n == 1) return cout <<  YES n1 , 0;     if (n == 4) return cout <<  YES n1 n3 n2 n4 n , 0;     for (long long i = 2; i * i <= n; i++)       if (n % i == 0) return cout <<  NO , 0;     cout <<  YES n ;     long long zr = 1;     for (long long i = 1; i < n; i++) {       long long cnt = i * pw(zr, n - 2) % n;       cout << cnt <<   n ;       zr = (zr * cnt) % n;     }     cout << n <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, q = 0, s = 0, t = 0;     cin >> n;     for (int k = 1; k <= n; k++) {       cin >> q;       if (q == 1) {         if (t == 1)           s++;         else {           t++;           s++;         }       } else {         if (t == 1) {           t--;           s++;         }       }     }     if (t == 0 && s != 0) s--;     cout << s;     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   #pragma GCC target( avx,avx2,fma )   using namespace std;   const int mod1 = 1000000007;   long long gcd(long long a, long long b) {     long long c = a % b;     while (c != 0) {       a = b;       b = c;       c = a % b;     }     return b;   }   long long issub(string a, string b) {     if (a.find(b) != string::npos)       return 1;     else       return 0;   }   long long expo(long long a, long long b) {     long long res = 1;     while (b > 0) {       if (b & 1) res = res * a % mod1;       a = a * a % mod1;       b >>= 1;     }     return res;   }   int32_t lcm(long long n1, long long n2) {     long long max = (n1 > n2) ? n1 : n2;     do {       if (max % n1 == 0 && max % n2 == 0) {         return max;       } else         ++max;     } while (true);   }   string operator*(string a, unsigned long long b) {     string output =   ;     while (b--) output += a;     return output;   }   bool isPerfectSquare(long long n) {     for (long long i = 1; i * i <= n; i++) {       if ((n % i == 0) && (n / i == i)) {         return true;       }     }     return false;   }   int32_t main() {     ios_base::sync_with_stdio(false), cin.tie(NULL);     ;     long long t, a = 0, x;     cin >> t;     map<long long, long long> m;     for (long long i = 0; i < t; i++) {       cin >> x;       m[x]++;       a = max(a, m[x]);     }     cout << a;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 1e9 + 9;   const int Mod = 1e9 + 7;   inline int dcmp(double x) {     if (fabs(x) <= 1e-9) return 0;     return x < 0 ? -1 : 1;   }   inline int scan() {     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;   }   inline long long scan(long long x) {     int f = 1;     char ch = getchar();     x = 0;     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 Point {     int x, y, id;     Point(int x = 0, int y = 0) : x(x), y(y) {}     Point operator-(const Point &a) const { return Point(x - a.x, y - a.y); }     Point operator*(const long long &a) const { return Point(x * a, y * a); }     Point operator+(const Point &a) const { return Point(x + a.x, y + a.y); }     bool operator==(const Point &a) const {       return dcmp(x - a.x) == 0 && dcmp(y - a.y) == 0;     }     bool operator<(const Point &a) const {       if (x == a.x) return y < a.y;       return x < a.x;     }     void read() { scanf( %d%d , &x, &y); }     void out() { cout << x <<     << y << endl; }   };   double Dot(Point a, Point b) { return a.x * b.x + a.y * b.y; }   double dis(Point a) { return sqrt(Dot(a, a)); }   long long Cross(Point a, Point b) { return a.x * 1LL * b.y - a.y * 1LL * b.x; }   bool chk(Point p1, Point p2, Point p3, Point p) {     return abs(Cross(p2 - p, p1 - p)) + abs(Cross(p3 - p, p2 - p)) +                abs(Cross(p1 - p, p3 - p)) ==            abs(Cross(p2 - p1, p3 - p1));   }   int n, k, ti;   int a[200005], vis[200005];   void solve() {     n = scan();     k = scan();     for (int i = 1; i <= n; i++) a[i] = scan();     memset(vis, 0, sizeof(vis));     sort(a + 1, a + 1 + n);     for (int i = 1; i <= n; i++) {       ti = i;       while (ti - 1) {         ti--;         if (vis[ti]) break;         if (a[ti] + k < a[i]) break;         if (a[ti] < a[i])           vis[ti] = 1;         else           break;       }     }     ti = 0;     for (int i = 1; i <= n; i++) {       if (!vis[i]) ti++;     }     cout << ti << endl;   }   int main() {     int t = 1;     for (int i = 1; i <= t; i++) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   long long int dp[3005][3005];   int a[3005];   int tree[3005 * 3005][2];   int cnt = 0;   long long int check(int t) {     return !((a[t - 3] == 0 && a[t - 2] == 0 && a[t - 1] == 1 && a[t] == 1) ||              (a[t - 3] == 0 && a[t - 2] == 1 && a[t - 1] == 0 && a[t] == 1) ||              (a[t - 3] == 1 && a[t - 2] == 1 && a[t - 1] == 1 && a[t] == 0) ||              (a[t - 3] == 1 && a[t - 2] == 1 && a[t - 1] == 1 && a[t] == 1));   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d , &a[i]);     }     for (int i = 1; i <= n; i++)       for (int j = i - 1; j <= n; j++) {         if (j < i)           dp[i][j] = 1;         else {           for (int k = 1; k <= min(j, (check(j) ? 4 : 3)); k++)             dp[i][j] = (dp[i][j] + dp[i][j - k]) % 1000000007;         }       }     long long int ans = 0;     for (int i = 1; i <= n; i++) {       int p = 0;       for (int j = i; j >= 1; j--) {         if (tree[p][a[j]])           p = tree[p][a[j]];         else {           ans = (ans + dp[j][i]) % 1000000007;           tree[p][a[j]] = cnt += 1;           p = tree[p][a[j]];         }       }       printf( %d n , ans);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   #pragma GCC optimize( O2,no-stack-protector,unroll-loops,fast-math )   const long long maxn = 1e5 + 10, maxm = 5e2 + 10, lg = 21, mod = 1e9 + 7,                   inf = 1e18;   long long n, m, s;   long double dp[101][maxn], ps[maxn];   int main() {     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);     cin >> n >> m;     if (m == 1) return cout << 1, 0;     dp[0][0] = m - 1;     fill(ps, ps + maxn, m - 1);     for (int i = 1; i <= n; i++) {       long long x;       cin >> x;       s += x;       for (int j = 1; j <= n * m; j++)         dp[i][j] = (ps[j - 1] - (j - m - 1 >= 0 ? ps[j - m - 1] : 0) -                     (j - x >= 0 ? dp[i - 1][j - x] : 0)) /                    (m - 1);       ps[0] = 0;       for (int j = 1; j <= n * m; j++) ps[j] = ps[j - 1] + dp[i][j];     }     cout << fixed << setprecision(18) << ps[s - 1] + 1;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int32_t main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     long long n, p;     cin >> n >> p;     long long ans = 5 * 5000000;     for (long long i = 1; i <= 5000000; i++) {       long long left = n - p * i;       if (left < 1)         continue;       else {         long long k = __builtin_popcount(left);         if (k <= i and left >= i) {           cout << i;           return 0;         }       }     }     cout << -1;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long N = 1e5 + 7;   long long n, a[N], cnt[N];   int32_t main() {     cin >> n;     for (long long i = 0; i < n; i++) cin >> a[i], cnt[a[i]]++;     for (long long i = 1; i < N; i++)       if (cnt[i] > 0) {         if (cnt[i] > n / 2)           cout <<  Bob ;         else           cout <<  Alice ;         return 0;       }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int mod = 1e9 + 7;   const int N = 410;   int cnt[N];   int temp[N];   long long cost[N][N];   long long dp[N][N];   long long n, m, k;   const long long INF = (1LL) << 60;   vector<int> v[200];   int main() {     while (cin >> n >> m >> k) {       memset(dp, 0, sizeof(dp));       for (int i = 0; i < N; i++)         for (int j = 0; j < N; j++) {           cost[i][j] = INF;           dp[i][j] = INF;         }       for (long long i = 0; i < m; i++) {         long long l, r, c;         cin >> l >> r >> c;         cost[l - 1][r] = min(cost[l - 1][r], c);       }       for (long long i = 0; i <= n; i++)         for (long long j = n; j >= i; j--) {           cost[i][j - 1] = min(cost[i][j - 1], cost[i][j]);           cost[i + 1][j] = min(cost[i + 1][j], cost[i][j]);         }       dp[0][0] = 0;       for (long long i = 1; i <= n; i++) {         for (long long j = 0; j <= i; j++) {           dp[i][j] = dp[i - 1][j];           for (long long k = 0; k < i; k++) {             if (j - i + k >= 0)               dp[i][j] = min(dp[i][j], dp[k][j - i + k] + cost[k][i]);           }         }       }       long long ans = INF;       for (long long i = k; i <= n; i++) ans = min(ans, dp[n][i]);       if (ans == INF)         cout << -1 << endl;       else         cout << ans << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int dp[1005];   long long ncr[1005][1005];   int ones(int n);   void calc_ncr();   int main() {     string n;     int k;     cin >> n;     cin >> k;     calc_ncr();     dp[1] = 0;     for (int i(2); i < (1001); i++) {       dp[i] = dp[ones(i)] + 1;     }     long long res = 0, num_ones = 0;     int len = n.length();     if (k == 0) {       cout <<  1 n ;       return 0;     }     for (int i(0); i < (len); i++) {       if (n[i] ==  0 ) {         continue;       }       int j = max(num_ones, 1LL);       while (j < 1000) {         if (dp[j] == k - 1) {           res = (res + ncr[len - i - 1][j - num_ones]) % 1000000007;           if (i == 0 && k == 1) {             res = (res + 1000000007 - 1) % 1000000007;           }         }         j++;       }       num_ones++;     }     int count = 0;     for (int i(0); i < (len); i++) {       if (n[i] ==  1 ) {         count++;       }     }     if (dp[count] == k - 1) {       res = (res + 1) % 1000000007;     }     cout << res <<   n ;     return 0;   }   int ones(int n) {     int count = 0;     while (n) {       if (n % 2 == 1) {         count++;       }       n /= 2;     }     return count;   }   void calc_ncr() {     for (int i(0); i < (1001); i++) {       ncr[i][0] = 1;     }     for (int i(1); i < (1001); i++) {       for (int j(1); j < (i + 1); j++) {         ncr[i][j] = (ncr[i - 1][j - 1] + ncr[i - 1][j]) % 1000000007;       }     }   }
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:1024000000,1024000000 )   using namespace std;   int const maxn = 3000005;   string st[maxn];   int ab[200], ac[200], ad[200];   char b[maxn], c[maxn], d[maxn];   int main() {     cin >> b >> c;     int lenc = strlen(c);     for (int i = 0; i < lenc; i++) {       ac[c[i] -  a ]++;     }     int tw = 0, t = 0;     int lenb = strlen(b);     for (int i = 0; i < lenb; i++) {       if (b[i] ==  ? )         tw++;       else         ab[b[i] -  a ]++;     }     while (tw > 0) {       for (int i = 0; i < 26; i++) {         if (tw == 0) break;         if (ab[i] >= ac[i]) {           ab[i] -= ac[i];         } else {           if (tw >= ac[i] - ab[i]) {             tw -= ac[i] - ab[i];             ad[i] += ac[i] - ab[i];             ab[i] = 0;           } else {             ad[0] += tw;             tw = 0;           }         }       }     }     for (int i = 0; i < 26; i++) {       for (int j = 0; j < ad[i]; j++) {         d[t++] = (char)(i +  a );       }     }     t = 0;     for (int i = 0; i < lenb; i++) {       if (b[i] ==  ? ) {         cout << d[t++];       } else         cout << b[i];     }     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 7;   int a[N], n;   double f(double x) {     double sum = 0, mn = 0, mx = 0, ans = 0;     for (int i = 0; i < n; i++) {       mn = min(mn, sum);       mx = max(mx, sum);       sum += a[i] - x;       ans = max(ans, abs(sum - mn));       ans = max(ans, abs(sum - mx));     }     return ans;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n;     for (int i = 0; i < n; i++) cin >> a[i];     double l = -1e4 - 7, r = 1e4 + 7;     int t = 230;     while (t--) {       double mid1 = (2 * r + l) / 3;       double mid2 = (2 * l + r) / 3;       if (f(mid1) < f(mid2))         l = mid2;       else         r = mid1;     }     cout << setprecision(9) << fixed << f(l) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, ans;   int a[6][6];   int convert(char c) {     if (c ==  R ) return 1;     if (c ==  G ) return 2;     if (c ==  B ) return 3;     if (c ==  Y ) return 4;     if (c ==  W ) return 5;   }   void xuly(int state) {     int i, j, dem, c1, c2;     bool val[10], col[10];     int temp[15];     dem = 0;     for (i = 0; i < 5; i++)       if (state & (1 << i)) {         dem++;         val[i + 1] = true;       } else         val[i + 1] = false;     for (i = 5; i < 10; i++)       if (state & (1 << i)) {         dem++;         col[i - 4] = true;       } else         col[i - 4] = false;     memset(temp, 0, sizeof(temp));     for (i = 1; i <= 5; i++)       for (j = 1; j <= 5; j++)         if (a[i][j]) {           if (val[i] && col[j]) continue;           if (val[i])             temp[i]++;           else if (col[j])             temp[j + 5]++;           else             temp[11]++;         }     for (i = 1; i <= 11; i++)       if (temp[i] > 1) return;     ans = min(ans, dem);   }   void solve() {     int i, j;     ans = 10;     for (i = 0; i < (1 << 11); i++) xuly(i);     cout << ans << endl;   }   void input() {     int i;     char s[10];     scanf( %d , &n);     memset(a, 0, sizeof(a));     for (i = 0; i < n; i++) {       scanf( %s , &s);       a[convert(s[0])][s[1] -  0 ]++;     }     solve();   }   int main() {     input();     fclose(stdin);     fclose(stdout);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main(int argc, char const *argv[]) {     int a;     int b;     int dado[] = {1, 2, 3, 4, 5, 6};     cin >> a >> b;     int r1, r2, r3;     r1 = r2 = r3 = 0;     for (int i = 0; i < 6; ++i)       abs(dado[i] - a)<abs(dado[i] - b) ? r1++ : abs(dado[i] - a)> abs(dado[i] -                                                                        b)           ? r2++           : r3++;     cout << r1 <<     << r3 <<     << r2 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long unsigned int combi(long unsigned int a) {     if (a == 0 || a == 1) return 0;     return ((a * (a - 1)) / 2);   }   int main() {     int n = 0;     cin >> n;     char arr[n];     int letras[26];     char temp = 0;     long unsigned int res = 0;     for (int i = 0; i < 26; i++) {       letras[i] = 0;     }     for (int i = 0; i < n; i++) {       cin >> temp;       cin.ignore(256,   n );       letras[temp - 97]++;     }     for (int i = 0; i < 26; i++) {       res += (combi(letras[i] - (letras[i] / 2)) + (combi(letras[i] / 2)));     }     printf( %lu , res);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T, typename U>   bool ckmin(T &a, U b) {     return b < a ? a = b, true : false;   }   template <typename T, typename U>   bool ckmax(T &a, U b) {     return b > a ? a = b, true : false;   }   int tt;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cin >> tt;     while (tt--) {       int n, x, y, un = -1;       cin >> n >> x >> y;       set<int> second;       vector<int> v(n, 0), res(n, -1);       map<int, vector<int>> m;       vector<pair<int, vector<int>>> a, b;       for (int i = 0; i < n; ++i) {         cin >> v[i];         v[i]--;         m[v[i]].push_back(i);       }       for (int i = 0; i <= n; ++i) second.insert(i);       for (auto i : v) {         if (second.find(i) != second.end()) second.erase(i);       }       un = (*second.begin());       for (auto i : m) a.push_back(i);       sort(a.begin(), a.end(),            [](const pair<int, vector<int>> &a, const pair<int, vector<int>> &b) {              return (int)(a.second).size() < (int)(b.second).size();            });       int cnt = 0, pp = 0;       map<int, vector<int>> tmp;       while (cnt < n - x) {         if ((int)(a[pp].second).size()) {           tmp[a[pp].first].push_back(a[pp].second.back());           a[pp].second.pop_back();           cnt++;         }         pp++;         if (pp >= (int)(a).size()) pp -= (int)(a).size();       }       for (auto i : tmp) {         b.push_back(i);       }       for (auto i : a) {         for (auto j : i.second) {           res[j] = i.first;         }       }       vector<pair<int, int>> xx, yy;       for (auto i : b) {         for (auto j : i.second) {           xx.push_back(make_pair(i.first, j));           yy.push_back(make_pair(i.first, j));         }       }       rotate(yy.begin(), yy.begin() + ((int)(yy).size() / 2), yy.end());       vector<int> store;       for (int i = 0; i < (int)(yy).size(); ++i) {         if (xx[i].first == yy[i].first) store.push_back(i);       }       if ((int)(store).size() > n - y) {         cout <<  NO n ;         continue;       }       for (auto i : store) {         xx[i].first = un;         res[yy[i].second] = un;       }       int rem = n - y - (int)(store).size();       for (int i = 0; i < (int)(yy).size(); ++i) {         if (rem && xx[i].first != un) {           rem--;           xx[i].first = un;           res[yy[i].second] = un;         } else {           res[yy[i].second] = xx[i].first;         }       }       cout <<  YES n ;       for (auto i : res) cout << i + 1 <<    ;       cout <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int inf = (int)1e9 * 2;   int n, m, ind;   long long L[55], M[55], R[55], A[55], ans = -inf, un;   bool all = 1;   vector<int> a[55];   void calc() {     for (int i = 0; i < n; i++) {       R[i] = M[i] = L[i] = -inf;       for (int j = 0; j < a[i].size(); j++) {         A[i] += (long long)a[i][j];         if (A[i] > L[i]) L[i] = A[i];       }       long long sum = 0;       for (int j = a[i].size() - 1; j >= 0; j--) {         sum += (long long)a[i][j];         if (sum > R[i]) R[i] = sum;       }       sum = 0;       for (int j = 0; j < a[i].size(); j++) {         sum = max(sum + (long long)a[i][j], (long long)a[i][j]);         M[i] = max(M[i], sum);       }     }   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 0; i < n; i++) {       int l;       scanf( %d , &l);       for (int j = 0; j < l; j++) {         int x;         scanf( %d , &x);         a[i].push_back(x);       }     }     calc();     for (int i = 0; i < m; i++) {       scanf( %d , &ind), ind--;       ans = max(un + L[ind], ans);       un = max(un + A[ind], R[ind]);       ans = max(ans, M[ind]);     }     printf( %I64d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   double calc(pair<double, double> v1, pair<double, double> v2) {     double dx = v1.first - v2.first;     double dy = v1.second - v2.second;     return sqrt(dx * dx + dy * dy);   }   int main() {     int a, b, c;     scanf( %d%d%d , &a, &b, &c);     double x1, y1, x2, y2;     scanf( %lf%lf%lf%lf , &x1, &y1, &x2, &y2);     double dist = fabs(x1 - x2) + fabs(y1 - y2);     if (a == 0 || b == 0) {       printf( %.10f n , dist);       return 0;     }     vector<pair<double, double>> v1, v2;     double xl1 = (-1.0 * c - 1.0 * b * y1) / a;     double yl1 = (-1.0 * c - 1.0 * a * x1) / b;     v1.push_back({xl1, y1});     v1.push_back({x1, yl1});     double xl2 = (-1.0 * c - 1.0 * b * y2) / a;     double yl2 = (-1.0 * c - 1.0 * a * x2) / b;     v2.push_back({xl2, y2});     v2.push_back({x2, yl2});     for (auto p1 : v1)       for (auto p2 : v2)         dist =             min(dist, calc(p1, p2) + fabs(x1 - p1.first) + fabs(y1 - p1.second) +                           fabs(x2 - p2.first) + fabs(y2 - p2.second));     printf( %.10f n , dist);   }
#include <bits/stdc++.h>   using namespace std;   bool isPrime(int n) {     for (int i = 2; i < int(sqrt(n) + 1); i++)       if (n % i == 0) return 0;     return 1;   }   int main() {     int n;     cin >> n;     if (isPrime(n)) return !(cout << 1 <<   n );     if (n & 1) {       if (isPrime(n - 2))         cout << 2 <<   n ;       else         cout << 3 <<   n ;     } else       cout << 2 <<   n ;     return 0;   }