malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int maxn = 3e5;   int l = 0;   int r = 0;   int res = 0;   int f[maxn + 11][55];   int a[maxn + 11];   int cnt[maxn + 11];   void add(int x) {     if (!cnt[a[x]]) res++;     cnt[a[x]]++;   }   void del(int x) {     cnt[a[x]]--;     if (!cnt[a[x]]) res--;   }   int calc(int L, int R) {     while (r < R) add(++r);     while (r > R) del(r--);     while (l > L) add(--l);     while (l < L) del(l++);     return res;   }   void solve(int k, int l, int r, int al, int ar) {     int mid = (l + r) >> 1;     if (l > r || al > ar) return;     int ind = 0;     for (int i = al; i <= min(ar, mid - 1); i++) {       if (f[i][k - 1] + calc(i + 1, mid) > f[mid][k]) {         f[mid][k] = f[i][k - 1] + calc(i + 1, mid);         ind = i;       }     }     solve(k, l, mid - 1, al, ind);     solve(k, mid + 1, r, ind, ar);   }   int main() {     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);     int n, k;     cin >> n >> k;     for (int i = 1; i <= n; i++) cin >> a[i];     for (int i = 1; i <= k; i++) solve(i, 1, n, 0, n);     cout << f[n][k] << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int a[100][3];     int n = 0;     cin >> n;     for (int i = 0; i < n; i++) {       for (int j = 0; j < 3; j++) {         cin >> a[i][j];       }     }     int s = 1;     int m = 0;     int f = 0;     int cou = 0;     int back = 0;     for (int k = 0; k < n; k++) {       if (a[k][0] == s && a[k][1] != back) {         back = s;         s = a[k][1];         m += a[k][2];         cou++;         k = -1;       }       if (k == n - 1) {         for (int k2 = 0; k2 < n; k2++) {           if (a[k2][1] == s && a[k2][0] != back) {             back = s;             s = a[k2][0];             f += a[k2][2];             cou++;             k = -1;             k2 = n;           }         }       }       if (cou == n) {         k = n;       }     }     if (m > f)       cout << f << endl;     else       cout << m << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int power(long long int first, long long int n) {     if (n == 0)       return 1;     else if (n % 2 == 0) {       long long int second = power(first, n / 2);       return second * second;     } else       return first * power(first, n - 1);   }   int strTOint(string s) {     stringstream ss;     int first;     ss << s;     ss >> first;     return first;   }   double geo_dist(int a, int b, int c, int d) {     double dd = (double)(a - c) * (a - c) + (b - d) * (b - d);     double r = sqrt(dd) + 1e-9;     return r;   }   long long int bigmod(long long int a, long long int p, long long int m) {     if (p == 0) return 1 % m;     if (p % 2 == 0) {       long long int second = bigmod(a, p / 2, m);       return (second * second) % m;     } else {       return (a * bigmod(a, p - 1, m)) % m;     }   }   long long int first, second, d, g;   void ext_gcd(long long int a, long long int b) {     if (b == 0) {       first = 1;       second = 0;       d = a;       return;     }     ext_gcd(b, a % b);     long long int x1 = second;     long long int y1 = first - (a / b) * second;     first = x1;     second = y1;   }   long long int modInv(long long int a, long long int m) {     ext_gcd(a, m);     first %= m;     if (first < 0) first += m;     return first;   }   int fx[] = {0, 0, -1, 1, -1, 1, 1, -1};   int fy[] = {1, -1, 0, 0, 1, 1, -1, -1};   map<string, int> mp;   vector<pair<int, int> > adj[1000];   vector<int> v;   int main() {     long long int n, m;     cin >> n >> m;     long long int a, b, c, d, e, a1, b1, c1, d1, e1;     long long int sum = 0;     int j = 0;     a = n / 5;     a1 = m / 5;     a *= a1;     sum += a;     for (int i = 1; i <= 4; i++) {       j = 5 - i;       j %= 5;       a = n / 5;       if (n % 5 >= i) a++;       a1 = m / 5;       if (m % 5 >= j) a1++;       a *= a1;       sum += a;     }     cout << sum << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);     int n, m, m1, arr[9] = {0}, num = 0, num1 = 0;     cin >> n >> m, m1 = m;     if (n == 1 && m == 0)       cout <<  0 0 ;     else if (9 * n < m || m == 0)       cout <<  -1 -1 ;     else {       num1 = 1;       while (m - (num1) > (n - 1) * 9) num1++;       cout << num1;       num += num1;       num1 = 0;       for (int i = 1; i < n; i++) {         while (m - (num1 + num) > (n - (i + 1)) * 9) num1++;         cout << num1;         num += num1;         num1 = 0;       }       num = 0;       cout <<    ;       for (int i = 8; i >= 0; i--) {         arr[i] = m1 / (i + 1);         m1 %= (i + 1);         num += arr[i];       }       for (int i = 8; i >= 0; i--)         while (arr[i]--) cout << i + 1;       while (num < n) cout <<  0 , num++;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int piles[105];   int main() {     int n;     cin >> n;     vector<int> A(n);     for (int i = 0; i < n; ++i) cin >> A[i];     sort(A.begin(), A.end());     for (int i = 0; i < n; ++i) {       bool flag = false;       for (int j = 0; j <= A[i]; ++j)         if (piles[j]) {           --piles[j];           ++piles[j + 1];           flag = true;           break;         }       if (!flag) piles[1] += 1;     }     int cnt = 0;     for (int i = 1; i < 105; ++i) cnt += piles[i];     cout << cnt;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 10005;   long long int p[N], s[N], n, c;   long long int dp[2][N];   int main() {     cin >> n >> c;     for (int i = 0; i < n; i++) cin >> p[i];     for (int i = 0; i < n; i++) cin >> s[i];     dp[0][0] = p[0];     dp[0][1] = s[0];     int row = 1;     for (int i = 1; i < n; i++) {       for (int j = 0; j <= i + 1; j++) {         dp[row][j] = (long long)(1e18);         if (j != i + 1) dp[row][j] = dp[1 - row][j] + j * c + p[i];         if (j != 0) dp[row][j] = min(dp[row][j], dp[1 - row][j - 1] + s[i]);       }       row = 1 - row;     }     row = 1 - row;     long long ansa = (long long)(1e18);     for (int j = 0; j <= n; j++) ansa = min(ansa, dp[row][j]);     cout << ansa << endl;     return 0;   }
#include <bits/stdc++.h>   std::set<int> s;   std::vector<bool> wh;   bool push(int n) {     for (int it = 1; it < 32; ++it) {       if (!wh[n >> it]) {         s.erase(n);         wh[n] = false;         s.insert(n >> it);         wh[n >> it] = true;         return true;       }     }     return false;   }   void solution() {     int n, temp;     scanf( %d , &n);     wh.resize(1000000001, false);     wh[0] = true;     while (n-- > 0) {       scanf( %d , &temp);       s.insert(temp);       wh[temp] = true;     }     while (push(*(s.rbegin())))       ;     for (auto it : s) {       printf( %d  , it);     }   }   int main() {     solution();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int Array[10005];   int main() {     int N, m, i, j, l, r, x, Count;     scanf( %d%d , &N, &m);     for (i = 1; i <= N; i++) scanf( %d , Array + i);     for (i = 1; i <= m; i++) {       Count = 0;       scanf( %d%d%d , &l, &r, &x);       for (j = l; j <= r; j++) {         if (Array[j] < Array[x]) Count++;       }       if (Count == x - l)         puts( Yes );       else         puts( No );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int M = 105;   const int MOD = 1e6 + 3;   struct matrix {     int val[M][M];     int n;     matrix(int nn, int x = 0) {       n = nn;       for (int i = 0; i < n; i++)         for (int j = 0; j < n; j++)           if (i != j)             val[i][j] = 0;           else             val[i][j] = x;     }     int* operator[](int x) { return val[x]; }     matrix operator*(matrix b) {       matrix ans(n, 0);       for (int i = 0; i < n; i++)         for (int j = 0; j < n; j++)           for (int k = 0; k < n; k++)             ans[i][k] += 1LL * val[i][j] * b[j][k] % MOD, ans[i][k] %= MOD;       return ans;     }   };   matrix operator^(matrix a, long long b) {     matrix ans(a.n, 1);     while (b) {       if (b & 1) ans = ans * a;       a = a * a;       b >>= 1;     }     return ans;   }   int main() {     long long n;     int w, h;     cin >> n >> w >> h;     matrix mat(w + 1, 0);     for (int i = 0; i < w; i++) mat[i][i + 1] = 1;     int k = 1;     for (int i = w; i >= 0; i--) {       mat[w][i] = k;       k = 1LL * k * h % MOD;     }     mat = mat ^ n;     cout << (mat[w][w - 1] + mat[w][w]) % MOD <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct re {     int x, y;   };   int n, K, f[2001][2001];   char mp[2001][2001];   vector<re> A, B, zy[4001];   string Ans;   void upd(int &x, int y) {     if (y <= K) {       if (x == -1) x = y;       if (y < x) x = y;     }   }   int main() {     scanf( %d%d , &n, &K);     for (int i = 1; i <= n; ++i) scanf( %s , mp[i] + 1);     for (int i = 1; i <= n; ++i)       for (int j = 1; j <= n; ++j) {         f[i][j] = -1;         zy[i + j - 1].push_back((re){i, j});       }     if (mp[1][1] ==  a ) {       Ans.push_back( a );       A.push_back((re){1, 1});       f[1][1] = 0;     } else {       if (K >= 1) {         Ans.push_back( a );         A.push_back((re){1, 1});         f[1][1] = 1;       } else {         Ans.push_back(mp[1][1]);         A.push_back((re){1, 1});         f[1][1] = 0;       }     }     for (int i = 2; i <= 2 * n - 1; ++i) {       char Min =  z ;       for (auto u : A) {         if (f[u.x][u.y] + 1 <= K) Min =  a ;         if (u.x + 1 <= n) Min = min(Min, mp[u.x + 1][u.y]);         if (u.y + 1 <= n) Min = min(Min, mp[u.x][u.y + 1]);       }       Ans.push_back(Min);       for (auto u : A) {         if (u.x + 1 <= n) {           upd(f[u.x + 1][u.y], f[u.x][u.y] + (mp[u.x + 1][u.y] != Min));         }         if (u.y + 1 <= n) {           upd(f[u.x][u.y + 1], f[u.x][u.y] + (mp[u.x][u.y + 1] != Min));         }       }       for (auto u : zy[i])         if (f[u.x][u.y] != -1) B.push_back(u);       swap(A, B);       B.clear();     }     printf( %s n , Ans.c_str());     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int mxn = 1e5 + 100;   int a[mxn], b[mxn], c[mxn];   set<int> mp;   void add(int x) {     if (c[x] == 0)       mp.insert(b[x]);     else if (c[x] == 1)       mp.erase(b[x]);     c[x]++;   }   void remove(int x) {     if (c[x] == 2)       mp.insert(b[x]);     else if (c[x] == 1)       mp.erase(b[x]);     c[x]--;   }   int main() {     int n, k, m;     scanf( %d%d , &n, &k);     for (int i = 1; i <= n; i++) scanf( %d , a + i), b[i - 1] = a[i];     sort(b, b + n), m = unique(b, b + n) - b;     for (int i = 1; i <= n; i++) {       a[i] = lower_bound(b, b + m, a[i]) - b;       add(a[i]);       if (i >= k) {         if (mp.empty())           puts( Nothing );         else           printf( %d n , *mp.rbegin());         remove(a[i - k + 1]);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     long long n;     cin >> t;     while (t--) {       cin >> n;       if (n % 2) {         if ((n / 2) & 1) {           cout << n + 1 << endl;         } else {           cout << 2 * n + 1 << endl;         }       } else {         cout << 4 * n + 1 << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline long long read() {     char c = getchar();     long long f = 1, x = 0;     while (c <  0  || c >  9 ) {       if (c ==  - ) f = -1;       c = getchar();     }     while (c >=  0  && c <=  9 ) {       x = (x << 1) + (x << 3) + (c ^  0 );       c = getchar();     }     return x * f;   }   long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }   char s[3];   char b[3];   int main() {     scanf( %s , s + 1);     long long flag = 0;     long long ff = 0, f = 0, fff = 0;     long long n = read();     for (int i = 1; i <= n; i++) {       memset(b,   0 , sizeof(b));       scanf( %s , b + 1);       if (b[1] == s[1] && b[2] == s[2]) {         fff = 1;       }       if (b[1] == s[2] && b[2] == s[1]) {         flag = 1;       }       if (b[2] == s[1]) {         f = 1;       }       if (b[1] == s[2]) {         ff = 1;       }     }     if (flag != 0 || ff + f == 2 || fff == 1) {       printf( YES n );     } else {       printf( NO n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long inf = (1LL << 60) - 1;   int dx[] = {-1, 1, 0, 0};   int dy[] = {0, 0, -1, 1};   void solve() {     long long n, x, y, k, c = 0;     cin >> n >> x >> y;     for (long long i = 0; i < n; i++) {       cin >> k;       if (k <= x) c++;     }     if (x > y)       cout << n <<   n ;     else       cout << (c + 1) / 2 <<   n ;   }   int main() {     ios::sync_with_stdio(0);     cout.tie(0);     ;     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     cin.tie(NULL);     cout.tie(NULL);     ios_base::sync_with_stdio(false);     int arr[4];     for (int i = 0; i < 4; i++) cin >> arr[i];     int a, b;     cin >> a >> b;     sort(arr, arr + 4);     if (arr[0] > b)       cout << b - a + 1 << endl;     else if (arr[0] > a)       cout << arr[0] - a << endl;     else       cout << 0 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int ans = -1;     int n, dol, cent, s, i;     cin >> n >> s;     for (i = 0; i < n; i++) {       cin >> dol >> cent;       if (s > dol && cent != 0 && 100 - cent > ans) ans = 100 - cent;       if (s >= dol && cent == 0 && ans == -1) ans = 0;     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int tree[270000 * 4];   int t;   char opt;   void insert(long long x) {     if (x == 0) {       ++tree[2];       return;     }     int num = x % 10;     x /= 10;     num = (num % 2 == 0 ? 0 : 1);     int root = (num == 0 ? 2 : 3);     ++tree[root];     while (x) {       num = x % 10;       x /= 10;       num = (num % 2 == 0 ? 0 : 1);       root = (num == 0 ? root * 2 : root * 2 + 1);       ++tree[root];     }   }   void erase(long long x) {     if (x == 0) {       --tree[2];       return;     }     int num = x % 10;     x /= 10;     num = (num % 2 == 0 ? 0 : 1);     int root = (num == 0 ? 2 : 3);     --tree[root];     while (x) {       num = x % 10;       x /= 10;       num = (num % 2 == 0 ? 0 : 1);       root = (num == 0 ? root * 2 : root * 2 + 1);       --tree[root];     }   }   void query(string s) {     stack<int> stk;     int lens = s.length(), beg = 0;     for (int i = 0; i < lens; ++i)       if (s[i] !=  0  || i == lens - 1) {         beg = i;         break;       }     for (int i = beg; i < lens; ++i) stk.push(s[i] -  0 );     int now = stk.top();     stk.pop();     int root = (now == 0 ? 2 : 3);     int ans = tree[root];     while (!stk.empty()) {       now = stk.top();       stk.pop();       root = (now == 0 ? root * 2 : root * 2 + 1);       ans = min(tree[root], ans);     }     while (beg) {       root *= 2;       ans -= tree[root + 1];       --beg;     }     while (tree[root * 2] || tree[root * 2 + 1]) {       root *= 2;       ans -= tree[root + 1];     }     cout << ans << endl;   }   int main() {     cin >> t;     for (int i = 1; i <= t; ++i) {       cin >> opt;       if (opt ==  + ) {         long long x;         cin >> x;         insert(x);       } else if (opt ==  - ) {         long long x;         cin >> x;         erase(x);       } else {         string s;         cin >> s;         query(s);       }     }   }
#include <bits/stdc++.h>   using namespace std;   long long ans, tot, n;   long long a[105];   void update(long long d) {     long long sum = 0;     for (int i = 1; i <= n; i++) sum += (a[i] - 1) / d + 1;     if (sum * d <= tot) ans = max(ans, d);   }   int main() {     long long k;     scanf( %lld %lld , &n, &k);     for (int i = 1; i <= n; i++) {       scanf( %lld , &a[i]);       tot += a[i];     }     tot += k;     for (long long i = 1; i * i <= tot - 1; i++) {       update(i);       update(tot / i);     }     printf( %lld n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 0x3f3f3f3f;   const int N = 2100;   int a[N][N], b[N][N], d[N][N];   int c[N], n, tag = -1, res[N];   void print() {     cout << -1;     exit(0);   }   int cnt = 0;   void solve(int id, int T) {     if (T) {       for (int i = 1; i <= n; i++) {         if (i == tag) continue;         if (d[i][id] != c[i]) res[i]++;       }     } else {       for (int i = 1; i <= n; i++) {         if (i == tag) continue;         if (d[i][id] != 0) res[i]++;       }     }   }   int main() {     std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);     cin >> n;     char ch;     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++) cin >> ch, a[i][j] = ch -  0 ;     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++) cin >> ch, b[i][j] = ch -  0 ;     for (int i = 1; i <= n; i++) cin >> ch, c[i] = ch -  0 ;     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++) d[i][j] = a[i][j] ^ b[i][j];     for (int i = 1; i <= n; i++)       if (c[i]) tag = i;     if (tag == -1) {       bool f = 0;       for (int i = 1; i <= n; i++)         for (int j = 1; j <= n; j++)           if (d[i][j]) f = 1;       if (f) print();     }     for (int i = 1; i <= n; i++)       if (d[tag][i]) cnt++;     for (int i = 1; i <= n; i++) solve(i, d[tag][i]);     for (int i = 1; i <= n; i++) {       if (res[i]) {         cnt++;         for (int j = 1; j <= n; j++) d[i][j] ^= c[j];       }     }     for (int j = 1; j <= n; j++) {       int C = 0;       bool f = 0;       for (int i = 1; i <= n; i++) {         if ((d[i][j] && c[i] == 0) || (!d[i][j] && c[i])) f = 1;         if (d[i][j]) C++;       }       if (C && f) print();     }     cout << cnt <<   n ;     for (int i = 1; i <= n; i++)       if (res[i]) cout <<  row   << i - 1 <<   n ;     for (int i = 1; i <= n; i++)       if (d[tag][i]) cout <<  col   << i - 1 <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int cambio;     cin >> cambio;     vector<int> hansel;     int madera = 0;     int piedra = 0;     int ladrillo;     for (int i = 0; cambio > i; i++) {       int gretel;       cin >> gretel;       piedra = piedra + gretel;       hansel.push_back(gretel);     }     sort(hansel.begin(), hansel.end());     for (int i = 0; i < cambio; i++) {       madera = madera + hansel[i];       piedra = piedra - hansel[i];       if (madera >= piedra) {         ladrillo = cambio - i;         break;       }     }     cout << ladrillo;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline int mod(int a, int k) { return (a % k + k) % k; }   int main() {     int n, k, v;     cin >> n >> k >> v;     vector<int> a(1 + n, 0);     int ss = 0;     for (int i = 1; i <= n; ++i) {       cin >> a[i];       ss += a[i];     }     if (ss < v) {       cout <<  NO n ;       return 0;     }     int target = v % k;     vector<vector<pair<int, int>>> dp(1 + n, vector<pair<int, int>>(k, {0, 0}));     dp[0][0] = {-1, 0};     for (int i = 1; i <= n; ++i) {       for (int j = 0; j < k; ++j) {         auto var1 = dp[i - 1][mod(j - a[i], k)];         auto var2 = dp[i - 1][j];         if (var1.first && var2.first) {           if (var1.second + a[i] % k > var2.second) {             dp[i][j] = {2, var1.second + a[i] % k};           } else {             dp[i][j] = {1, var2.second};           }         } else if (var1.first) {           dp[i][j] = {2, var1.second + a[i] % k};         } else if (var2.first) {           dp[i][j] = {1, var2.second};         }       }     }     if (dp[n][target].first == 0) {       cout <<  NO n ;       return 0;     }     if (n == 1 && a[1] != v) {       cout <<  NO n ;       return 0;     }     cout <<  YES n ;     int x = -1;     int y = -1;     int curr = n;     int rem1 = target;     while (curr > 0) {       if (dp[curr][rem1].first == 2) {         if (x == -1) {           x = curr;           rem1 = mod(rem1 - a[curr], k);         } else {           if (a[curr] > 0) {             cout << (a[curr] - 1) / k + 1 <<     << curr <<     << x <<   n ;           }           a[x] += a[curr];           rem1 = mod(rem1 - a[curr], k);           a[curr] = 0;         }       } else {         if (y == -1) {           y = curr;         } else {           if (a[curr] > 0) {             cout << (a[curr] - 1) / k + 1 <<     << curr <<     << y <<   n ;           }           a[y] += a[curr];           a[curr] = 0;         }       }       --curr;     }     if (y == -1) {       if (x == 1) {         y = 2;       } else {         y = 1;       }     }     if (x == -1) {       if (y == 1) {         x = 2;       } else {         x = 1;       }     }     if (x != -1) {       if (a[x] < v) {         cout << (v - a[x]) / k <<     << y <<     << x <<   n ;       } else if (a[x] > v) {         cout << (a[x] - v) / k <<     << x <<     << y <<   n ;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long n, k;     cin >> n >> k;     long long l = 1, u = n, mid;     while (l <= u) {       mid = (l + u) / 2;       long long sum = (mid * (mid + 1)) / 2;       sum = sum - (n - mid);       if (sum == k) {         cout << n - mid << endl;         break;       } else if (sum < k) {         l = mid + 1;       } else         u = mid - 1;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long t;     cin >> t;     while (t--) {       long long n, k;       cin >> n >> k;       long long arr[n];       for (long long i = 0; i < n; i++) cin >> arr[i];       long long x = 0;       vector<long long> v;       map<long long, long long> mp;       for (long long i = 0; i < n; i++) {         if (mp.find(arr[i]) == mp.end()) {           v.push_back(arr[i]);           mp[arr[i]] = 1;           x++;         }       }       if (x > k)         cout << -1 << endl;       else {         long long x = 0;         while (v.size() < k) {           v.push_back(v[x]);           x++;         }         vector<long long> w;         long long j = 0, l = 0;         while (j < n) {           if (arr[j] == v[l]) {             w.push_back(arr[j]);             j++;             l++;           } else {             w.push_back(v[l]);             l++;           }           l %= v.size();         }         cout << w.size() << endl;         for (long long i = 0; i < w.size(); i++) cout << w[i] <<    ;         cout << endl;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int answer();   int main() {     long long t;     t = 1;     while (t--) {       answer();     }     return 0;   }   int answer() {     string k;     cin >> k;     int sup[10] = {2, 7, 2, 3, 3, 4, 2, 5, 1, 2};     if (k.size() > 1) {       cout << sup[k[0] -  0 ] * sup[k[1] -  0 ] << endl;     } else {       cout << sup[k[0] -  0 ] << endl;     }     return 0;   }
#include <bits/stdc++.h>   int main() {     double n, m;     scanf( %lf %lf , &m, &n);     double ans = 0;     for (int i = 1; i <= m; i++) {       ans += pow(i / m, n);     }     ans = m - ans + 1;     printf( %.10lf , ans);     return 0;   }