malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 5040;   double dp[MAXN][3], fail[MAXN];   double p[MAXN], f[MAXN];   int t[MAXN];   int main() {     int n, T;     scanf( %d%d , &n, &T);     for (int i = 1; i <= n; i++) {       int x;       scanf( %d%d , &x, &t[i]);       p[i] = x * 1.0 / 100;     }     dp[0][0] = 1;     for (int i = 0; i <= n; i++) f[i] = 1, fail[i] = 0;     for (int i = 1; i <= n; i++)       for (int j = 1; j <= t[i]; j++) f[i] *= (1 - p[i]);     double sum = 0;     if (t[1] == 1) {       sum = 1;       dp[1][1] = 1;     } else {       sum += p[1];       dp[1][1] = p[1];       fail[1] = (1 - p[1]);       for (int i = 2; i <= t[1]; i++) {         dp[i][1] = fail[i - 1] * p[1];         sum += dp[i][1];         fail[i] = fail[i - 1] * (1 - p[1]);       }       dp[t[1]][1] += f[1];       sum += f[1];     }     for (int j = 2; j <= n; j++) {       memset(fail, 0, sizeof(fail));       for (int i = 0; i <= T; i++) dp[i][j % 2] = 0;       for (int i = j; i <= T; i++) {         dp[i][j % 2] = fail[i - 1] * p[j] + dp[i - 1][(j - 1) % 2] * p[j];         fail[i] = fail[i - 1] * (1 - p[j]) + dp[i - 1][(j - 1) % 2] * (1 - p[j]);         if (i - (j - 1) >= t[j]) {           dp[i][j % 2] += dp[i - t[j]][(j - 1) % 2] * f[j];           fail[i] -= dp[i - t[j]][(j - 1) % 2] * f[j];         }         sum += dp[i][j % 2];       }     }     printf( %.6f n , sum);   }
#include <bits/stdc++.h>   using namespace std;   int main() {     char str[510];     int n, i;     bool rec[27];     while (cin >> str) {       int flag = 0, faill = 0;       memset(rec, 0, sizeof(rec));       int t = strlen(str);       if (str[0] !=  a ) faill = 1;       rec[1] = 1;       rec[0] = 1;       int sum = 1;       for (i = 0; i < t; i++) {         if (rec[str[i] -  a  + 1] == 0) {           rec[str[i] -  a  + 1] = 1;           for (int j = i - 1; j >= 1; j--) {             if (str[j] > str[i]) {               faill = 1;               break;             }           }         }       }       for (int i = 26; i >= 1; i--) {         if (flag == 1 && rec[i] == 0) {           faill = 1;           break;         }         if (rec[i]) flag = 1;       }       if (faill)         cout <<  NO  << endl;       else         cout <<  YES  << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long INF = 0x3fffffff;   double a, b, c, d;   int main() {     while (cin >> a >> b >> c >> d) {       double l = 0, r = 2000000000.0;       double a1, a2, b1, b2, c1, c2, d1, d2;       double m1, m2, min1, min2;       for (int i = 0; i < 10000; i++) {         double mid = (l + r) / 2;         a1 = a + mid, a2 = a - mid;         b1 = b + mid, b2 = b - mid;         c1 = c + mid, c2 = c - mid;         d1 = d + mid, d2 = d - mid;         min1 = min(min(a1 * d1, a1 * d2), min(a2 * d1, a2 * d2));         min2 = min(min(b1 * c1, b1 * c2), min(b2 * c1, b2 * c2));         m1 = max(max(a1 * d1, a1 * d2), max(a2 * d1, a2 * d2));         m2 = max(max(b1 * c1, b1 * c2), max(b2 * c1, b2 * c2));         if (min1 <= m2 && min2 <= m1)           r = mid;         else           l = mid;       }       printf( %.10lf n , l);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int min(int a, int b) {     if (a > b) {       return b;     } else {       return a;     }   }   int max(int a, int b) {     if (a > b) {       return a;     } else {       return b;     }   }   int main() {     int n, x0;     int a, b;     int d, f;     cin >> n >> x0 >> a >> b;     if (a > b) {       d = b;       f = a;     } else {       d = a;       f = b;     }     int temp1;     int temp2;     for (int i = 1; i != n; i++) {       cin >> a >> b;       if (a > b) {         temp1 = a;         a = b;         b = temp1;       }       if (a > d) {         if (a > f) {           cout << -1;           return 0;         }         d = a;       }       if (b < f) {         if (b < d) {           cout << -1;           return 0;         }         f = b;       }     }     if (x0 >= d && x0 <= f) {       cout << 0;     } else {       if (x0 < d) {         cout << d - x0;       } else {         cout << x0 - f;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, leaf, po;   vector<int> v[100005];   int main() {     scanf( %d , &n);     for (int i = (2); i <= (n); i++) {       int a, b;       scanf( %d %d , &a, &b);       v[a].push_back(b);       v[b].push_back(a);     }     for (int i = (1); i <= (n); i++)       if (v[i].size() == 1) leaf++;     po = 1;     for (int i = (1); i <= (n - leaf); i++) po = (po + po) % 1000000007;     printf( %d n , (1LL * po * (n - leaf) + 2LL * po * leaf) % 1000000007);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, t, x, y;     int ar = 0;     int al = 0;     int br = 0;     int bl = 0;     cin >> n;     for (int i = 0; n > i; i++) {       cin >> t;       cin >> x;       cin >> y;       if (t == 1) {         ar += x;         al += y;       } else {         br += x;         bl += y;       }     }     if (ar >= al) {       cout <<  LIVE  << endl;     } else {       cout <<  DEAD  << endl;     }     if (br >= bl) {       cout <<  LIVE  << endl;     } else {       cout <<  DEAD  << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, a[2 * 2005], pos[2 * 2005], dp[2 * 2005][2 * 2005];   int call(int p, int len) {     if (p > 2 * n) return len == n;     if (len < n) return 0;     int &ret = dp[p][len];     if (~ret) return ret;     ret = call(p + pos[p], len);     ret += call(p + pos[p], len - pos[p]);     return ret;   }   int main() {     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);     int tc;     cin >> tc;     while (tc--) {       cin >> n;       for (int i = 1; i <= 2 * n; i++) {         cin >> a[i];       }       for (int i = 1; i <= 2 * n; i++) {         int cnt = 1;         for (int j = i + 1; j <= 2 * n; j++) {           if (a[i] > a[j])             cnt++;           else             break;         }         pos[i] = cnt;       }       for (int i = 1; i <= 2 * n; i++)         for (int j = 1; j <= 2 * n; j++) dp[i][j] = -1;       if (call(1, 2 * n))         cout <<  YES n ;       else         cout <<  NO n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 1e9 + 7;   const long long INF = 4 * (long long)1e18 + 7;   const long double eps = 1e-9;   signed main() {     if (false) {       freopen( output.txt ,  w , stdout);       freopen( input.txt ,  r , stdin);     }     ios_base::sync_with_stdio(false);     int n;     cin >> n;     vector<int> arr(n);     for (int i = 0; i < n; i++) {       cin >> arr[i];     }     vector<vector<int>> dp(5, vector<int>(n, -1));     for (int i = 0; i < 5; i++) {       dp[i][0] = -2;     }     for (int i = 0; i < n - 1; i++) {       for (int j = 0; j < 5; j++) {         if (dp[j][i] != -1) {           if (arr[i + 1] > arr[i]) {             for (int m = j + 1; m < 5; m++) {               dp[m][i + 1] = j;             }           } else if (arr[i + 1] < arr[i]) {             for (int m = 0; m < j; m++) {               dp[m][i + 1] = j;             }           } else {             for (int m = 0; m < 5; m++) {               if (m == j) continue;               dp[m][i + 1] = j;             }           }         }       }     }     vector<int> ans;     for (int j = 0; j < 5; j++) {       if (dp[j][n - 1] != -1) {         int type = j;         for (int i = n - 1; i >= 0; i--) {           ans.push_back(type + 1);           type = dp[type][i];         }         break;       }     }     if (ans.size() == 0) {       cout << -1 << endl;     } else {       for (int i = n - 1; i >= 0; i--) {         cout << ans[i] <<    ;       }       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     int n;     cin >> n;     string s;     cin >> s;     map<char, vector<int>> ma;     for (int i = 0; i < n; i++) {       ma[s[i]].push_back(i + 1);     }     int m;     cin >> m;     vector<int> ans;     while (m--) {       string s1;       cin >> s1;       map<char, int> m1;       for (int i = 0; i < s1.size(); i++) {         m1[s1[i]]++;       }       int a = -1;       for (auto &i : ma) {         if (m1.find(i.first) != m1.end()) {           int b = m1[i.first];           a = max(a, i.second[b - 1]);         }       }       ans.push_back(a);     }     for (int i = 0; i < ans.size(); i++) {       cout << ans[i] <<   n ;     }   }   int main() {     ios::sync_with_stdio(0);     int t = 1;     while (t--) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   pair<long long, long long> t[4 * 200009];   long long a[200009], lazy[4 * 200009], ans[200009];   void build(long long v, long long tl, long long tr) {     if (tl == tr) {       t[v] = {a[tl], tl};     } else {       long long tm = (tl + tr) / 2;       build(v * 2, tl, tm);       build(v * 2 + 1, tm + 1, tr);       if (t[v * 2].first < t[v * 2 + 1].first ||           (t[v * 2].first == t[v * 2 + 1].first &&            t[v * 2].second > t[v * 2 + 1].second))         t[v] = t[v * 2];       else         t[v] = t[v * 2 + 1];     }   }   void push(long long v) {     t[v * 2].first += lazy[v];     lazy[v * 2] += lazy[v];     t[v * 2 + 1].first += lazy[v];     lazy[v * 2 + 1] += lazy[v];     lazy[v] = 0;   }   void update(long long v, long long tl, long long tr, long long l, long long r,               long long addend) {     if (l > r) return;     if (l == tl && tr == r) {       t[v].first += addend;       lazy[v] += addend;     } else {       push(v);       long long tm = (tl + tr) / 2;       update(v * 2, tl, tm, l, min(r, tm), addend);       update(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r, addend);       if (t[v * 2].first < t[v * 2 + 1].first ||           (t[v * 2].first == t[v * 2 + 1].first &&            t[v * 2].second > t[v * 2 + 1].second))         t[v] = t[v * 2];       else         t[v] = t[v * 2 + 1];     }   }   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long n;     cin >> n;     long long i = 1;     while (i <= n) cin >> a[i++];     build(1, 1, n);     i = 1;     long long x;     while (i <= n) {       x = t[1].second;       ans[x] = i;       update(1, 1, n, x + 1, n, -i);       update(1, 1, n, x, x, 1e13);       i++;     }     i = 1;     while (i <= n) {       cout << ans[i] <<    ;       i++;     }   }
#include <bits/stdc++.h>   using namespace std;   inline void read(int &x) {     x = 0;     int f = 1;     char ch = getchar();     while (ch != 45 && (ch >  9  || ch <  0 )) ch = getchar();     if (ch == 45) {       f = -1, ch = getchar();     }     while (ch <=  9  && ch >=  0 ) {       x = x * 10 + ch - 48;       ch = getchar();     }     x *= f;   }   int i, j, k, n, s, t, m, flag = 1, ans;   const int N = 2e5 + 10, mod = 1e9 + 7;   int fa[N], e[N][3], col[N], p[N], type[N];   int find(int x) {     if (x == fa[x]) return x;     return fa[x] = find(fa[x]);   }   void merge(int u, int v) {     u = find(u), v = find(v);     if (v > u) swap(u, v);     if (u == v) return;     fa[u] = v;   }   signed main() {     memset(type, -1, sizeof(type));     read(n), read(m);     for (i = 1; i <= n; i++) fa[i] = i, fa[i + n] = i + n;     for (i = 1; i <= m; i++) {       read(e[i][1]), read(e[i][2]), read(col[i]);       if (e[i][1] > e[i][2]) swap(e[i][1], e[i][2]);       if (e[i][1] == 1) {         type[e[i][2]] = col[i];         continue;       }       if (col[i] == 1)         merge(e[i][1], e[i][2]), merge(e[i][1] + n, e[i][2] + n);       else         merge(e[i][1], e[i][2] + n), merge(e[i][1] + n, e[i][2]);     }     for (i = 1; i <= n; i++) {       if (type[i] == -1) continue;       if (type[find(i + n)] == -1) type[find(i + n)] = type[i] ^ 1;       if (type[find(i + n)] == type[i]) flag = 0;       if (type[find(i)] == -1) type[find(i)] = type[i];       if (type[find(i)] != type[i]) flag = 0;     }     for (i = 1; i <= n; i++) {       if (find(i) == find(i + n)) flag = 0;     }     for (i = 2; i <= n; i++) {       if (find(i) != i) continue;       ans++;       if (type[find(i + n)] != -1 || type[i] != -1) ans--;       type[i] = 1;     }     if (flag == 0) {       printf( 0 n );       return 0;     }     int now = 1;     for (i = 1; i <= ans; i++) now = now * 2 % mod;     cout << now << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool lambs[101];   int main() {     int n, m;     cin >> n >> m;     while (n--) {       int x;       cin >> x;       while (x--) {         int y;         cin >> y;         lambs[y] = true;       }     }     for (int i = 1; i < m + 1; i++)       if (lambs[i] == false) {         cout <<  NO ;         return 0;       }     cout <<  YES ;     return 0;   }
#include <bits/stdc++.h>   const long long seed = 131;   const int N = 1000010;   char ac[N], bc[N];   int main() {     int n;     scanf( %d%s%s , &n, ac, bc), n--;     for (int i = 0; i < n; i++) {       if (bc[i] ==  N )         bc[i] =  S ;       else if (bc[i] ==  S )         bc[i] =  N ;       else if (bc[i] ==  E )         bc[i] =  W ;       else         bc[i] =  E ;     }     unsigned long long ha = 0, hb = 0, pow = 1;     for (int l = 1; l <= n; l++) {       ha += ac[n - l] * pow;       hb *= 131, hb += bc[n - l];       pow *= 131;       if (ha == hb) {         printf( NO n );         return 0;       }     }     printf( YES n );     return 0;   }
#include <bits/stdc++.h>   int n, m;   int table[(1 << 20) + 10];   int lowbit[(1 << 20) + 10];   int ba[35][35];   int cost[35][35];   int same[35][35];   char st[35][35];   int min(int x, int y) {     if (x < y)       return x;     else       return y;   }   int main() {     int i, a, j;     scanf( %d%d n , &n, &m);     for (i = 1; i <= n; i++) {       scanf( %s n , st[i] + 1);     }     for (i = 1; i <= n; i++) {       for (a = 1; a <= m; a++) {         scanf( %d , &ba[i][a]);       }     }     for (i = 1; i <= n; i++) {       for (a = 1; a <= m; a++) {         int coma = 0;         for (j = 1; j <= n; j++) {           if (st[i][a] == st[j][a]) {             same[i][a] |= 1 << (j - 1);             cost[i][a] += ba[j][a];             if (coma < ba[j][a]) coma = ba[j][a];           }         }         cost[i][a] -= coma;       }     }     for (i = 1; i <= 1 << n; i++) {       table[i] = 100000000;       for (a = 1; a <= n; a++) {         if (i >> (a - 1) & 1) {           lowbit[i] = a;           break;         }       }     }     table[0] = 0;     for (a = 1; a < 1 << n; a++) {       for (i = 1; i <= m; i++) {         table[a] =             min(table[a], table[a ^ (1 << (lowbit[a] - 1))] + ba[lowbit[a]][i]);         table[a] = min(table[a],                        table[a & (a ^ same[lowbit[a]][i])] + cost[lowbit[a]][i]);       }     }     printf( %d n , table[(1 << n) - 1]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 702, M = 4900005;   int main() {     int n, m, a[55], b, i, j, ans, cnt;     while (scanf( %d , &n) == 1) {       for (i = 1; i <= n; i++) scanf( %d , a + i);       scanf( %d , &m);       for (i = 1, ans = 0; i <= m; i++) {         scanf( %d , &b);         for (j = 1; j <= n; j++)           if (b % a[j] == 0) {             if (b / a[j] > ans) {               ans = b / a[j];               cnt = 1;             } else if (b / a[j] == ans)               cnt++;           }       }       printf( %d n , cnt);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAX = (int)1e5 + 55;   const int INF = (int)1e9 + 77;   const int MOD = (int)1e9 + 7;   const double PI = 2 * acos(0.0);   const double EPS = 1e-7;   const int N = (int)1e5 + 5;   vector<vector<int>> adj;   pair<int, int> cost[N];   int mn;   bool vis[N];   long long ans;   void dfs(int u) {     if (vis[u]) return;     vis[u] = 1;     mn = min(mn, cost[u].first);     for (int v : adj[u]) dfs(v);   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int n, m;     cin >> n >> m;     adj.resize(n + 1);     for (int i = 1; i <= n; ++i) {       int x;       cin >> x;       cost[i] = {x, i};     }     for (int i = 0; i < m; ++i) {       int x, y;       cin >> x >> y;       adj[x].push_back(y);       adj[y].push_back(x);     }     for (int i = 1; i <= n; ++i) {       int cur = cost[i].second;       if (vis[cur]) continue;       mn = INF;       dfs(cur);       ans += mn;     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct node {     int a, b, c, ty;   } a[100010];   struct Tnode {     int x, f, tag, ls, rs;   } t[3000000];   int n, m, k, K, ans, rt, tot;   bool cmp(node x, node y) { return x.a < y.a; }   int getfull(int l, int r) {     int s = 0;     l--;     for (int j = 1; j <= k; j <<= 1)       s |= (((r / j - l / j) - (j * 2 <= k ? (r / j / 2 - l / j / 2) : 0)) & 1) *            j;     return s;   }   void update(int n) {     if (t[n].tag)       t[n].x = t[n].f;     else       t[n].x = t[t[n].ls].x ^ t[t[n].rs].x;   }   void modify(int &n, int l, int r, int L, int R, int k) {     if (!n) n = ++tot, t[n].f = getfull(l, r);     if ((L <= l) && (r <= R))       t[n].tag += k;     else {       int mid = (l + r) >> 1;       if (L <= mid) modify(t[n].ls, l, mid, L, R, k);       if (mid < R) modify(t[n].rs, mid + 1, r, L, R, k);     }     update(n);   }   void work() {     scanf( %d %d %d , &n, &m, &k);     for (K = 1; K * 2 <= k; K <<= 1)       ;     for (int i = 1, A, B, C, D; i <= m; i++) {       scanf( %d %d %d %d , &A, &B, &C, &D);       a[i] = (node){A, B, D, 1}, a[i + m] = (node){C + 1, B, D, -1};     }     sort(a + 1, a + 2 * m + 1, cmp);     for (int i = 1; i <= 2 * m; i++) {       if (a[i - 1].a != a[i].a) {         int x = getfull(a[i - 1].a, a[i].a - 1), y = t[rt].x, sx = 0, sy = 0, s;         for (int j = K; j; j >>= 1) {           s = -sx * sy, sx += (x & j) > 0, sy += (y & j) > 0, s += sx * sy;           if (s & 1) ans ^= j;         }       }       modify(rt, 1, n, a[i].b, a[i].c, a[i].ty);     }     puts(ans ?  Hamed  :  Malek );   }   int main() {     work();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 * 4;   inline int get() {     int x;     cin >> x;     return x;   }   inline long long getlong() {     long long x;     cin >> x;     return x;   }   inline string getString() {     string s;     cin >> s;     return s;   }   template <typename T>   inline vector<T> getvector(int len) {     vector<T> a(len);     for (auto &it : a) cin >> it;     return a;   }   inline vector<int> getvector(int len) {     vector<int> a(len);     for (auto &it : a) cin >> it;     return a;   }   inline vector<pair<int, int>> getvector_andPairCnt(int len) {     vector<pair<int, int>> a(len);     int i = 1;     for (auto &it : a) {       it.second = i;       i++;       cin >> it.first;     }     return a;   }   double power_log(double power, double val) { return log(val) / log(power); }   template <typename T>   int sqr(T x) {     return x * x;   }   template <typename T>   ostream &operator<<(ostream &os, const vector<T> &v) {     for (auto it : v) os << it <<    ;     os <<   n ;     return os;   }   template <typename T, typename H>   inline vector<pair<T, H>> getvector_andBiPair(int len) {     vector<pair<T, H>> a(len);     int i = 1;     for (auto &it : a) {       cin >> it.first >> it.second;     }     return a;   }   template <typename T>   inline set<T> vector_to_set(const vector<T> &vec) {     set<T> s;     for (auto &it : vec) s.insert(it);     return s;   }   int main() {     int n = get(), k = get();     vector<pair<int, int>> arr(n);     for (auto &it : arr) cin >> it.first;     for (auto &it : arr) cin >> it.second;     sort(arr.begin(), arr.end(), [](pair<int, int> l, pair<int, int> r) {       return l.first - l.second < r.first - r.second;     });     int ans = 0;     bool can = true;     for (int i = 1; i <= n; i++) {       if (i > k && arr[i - 1].first > arr[i - 1].second) {         can = false;       }       if (can)         ans += arr[i - 1].first;       else         ans += arr[i - 1].second;     }     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   const int MAX_N = 1000, INDEX = 1;   int n, type[MAX_N + INDEX];   string team[MAX_N + INDEX], city[MAX_N + INDEX];   bool isUsed[MAX_N + INDEX];   void get(int ind) {     isUsed[ind] = true;     for (int i = 1; i <= n; i++) {       if (i != ind) {         if (team[i][0] == team[ind][0] && team[i][1] == team[ind][1] &&             team[i][2] == city[ind][0]) {           type[i] = 1;           if (!isUsed[i]) {             get(i);           }         }       }     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie();     cout.tie();     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> team[i] >> city[i];     }     for (int i = 1; i <= n; i++) {       for (int j = i + 1; j <= n; j++) {         if (team[i][0] == team[j][0] && team[i][1] == team[j][1] &&             team[i][2] == team[j][2]) {           type[i] = 1, type[j] = 1;         }       }     }     for (int i = 1; i <= n; i++) {       if (type[i] == 1 && !isUsed[i]) {         get(i);       }     }     for (int i = 1; i <= n; i++) {       for (int j = i + 1; j <= n; j++) {         if (team[i][0] == team[j][0] && team[i][1] == team[j][1]) {           if (team[i][2] == team[j][2] && type[i] == 0 && type[j] == 0) {             cout <<  NO  << endl;             return 0;           }           if (team[i][2] == city[j][0] && type[i] == 0 && type[j] == 1) {             cout <<  NO  << endl;             return 0;           }           if (city[i][0] == team[j][2] && type[i] == 1 && type[j] == 0) {             cout <<  NO  << endl;             return 0;           }           if (city[i][0] == city[j][0] && type[i] == 1 && type[j] == 1) {             cout <<  NO  << endl;             return 0;           }         }       }     }     cout <<  YES  << endl;     for (int i = 1; i <= n; i++) {       if (type[i] == 0) {         cout << team[i][0] << team[i][1] << team[i][2] <<   n ;       }       if (type[i] == 1) {         cout << team[i][0] << team[i][1] << city[i][0] <<   n ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int N;   bool check(int k) {     int p = (int)ceil(sqrt(k));     for (int i = 2; i <= p; ++i)       if (k % i == 0) return 1;     return 0;   }   int main() {     cin >> N;     int x = 200, y = x + N;     for (;; ++x, ++y)       if (check(x) && check(y)) return printf( %d %d n , y, x), 0;     return 0;   }