malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     long long n;     cin >> n;     string s;     while (1) {       if (n % 7 == 0) {         n = n / 7;         for (long long i = 0; i < n; i++) s.push_back( 7 );         break;       } else {         if (n > 0) {           s.push_back( 4 );           n -= 4;         } else {           cout << -1;           return 0;         }       }     }     if (s.empty())       cout << -1;     else       cout << s;   }
#include <bits/stdc++.h>   using namespace std;   char s[1000050];   int max(int x, int y) { return (x > y) ? x : y; }   int main() {     scanf( %s , &s);     int len = strlen(s);     int cnt = 1, j;     int result = 1;     for (int i = len; i < 2 * len; i++) {       s[i] = s[i - len];     }     len = 2 * len;     for (int i = 0; i < len; i = j) {       for (j = i + 1; j < len; j++) {         if (s[j] == s[j - 1]) {           break;         }       }       result = max(result, j - i);     }     if (result > len / 2) {       result = len / 2;     }     printf( %d n , result);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     unsigned long long n, k;     cin >> n >> k;     unsigned long long r = 1, l = 0, num = n, mid;     for (int i = 0; i < n; i++) {       r <<= 1;     }     mid = (l + r) >> 1;     while (mid != k) {       --num;       if (mid > k)         r = mid;       else         l = mid;       mid = (l + r) >> 1;     }     cout << num;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long MOD = 1e9 + 7;   const long long MX = 2e5 + 5;   const long long INF = 1e18;   const long double PI = acos((long double)-1);   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long tc;     cin >> tc;     while (tc--) {       long long n, k;       bool imposs = false;       cin >> n >> k;       set<long long> powers;       for (int i = (1); i <= (n); i++) {         long long x;         cin >> x;         long long cnt = 0;         while (x) {           if (imposs) break;           long long a = x % k;           if (a > 1) imposs = true;           if (a && powers.count(cnt))             imposs = true;           else if (a)             powers.insert(cnt);           x /= k;           cnt++;           if (imposs) break;         }       }       if (imposs)         cout <<  NO n ;       else         cout <<  YES n ;     }   }
#include <bits/stdc++.h>   using namespace std;   #define int long long   #define pb push_back   #define mp make_pair   #define lb lower_bound   #define up upper_bound   #define sz(h) (int)h.size()   #define all(h) h.begin(), h.end()   #define mod 1000000007   #define mod1 998244353   #define MAX 2000010   #define cas(t) cout <<  Case #  << t <<  :  ;   struct hash_pair   { // use pair as key in unordered_map<pair<int,int>,int,hash_pair>;          template <class T1, class T2>          size_t operator()(const pair<T1, T2> &p) const          {              auto hash1 = hash<T1>{}(p.first);              auto hash2 = hash<T2>{}(p.second);              return hash1 ^ hash2;       }   };   signed main()   {       ios_base::sync_with_stdio(false);       cin.tie(NULL);   #ifndef ONLINE_JUDGE       //freopen( input.txt ,  r , stdin);       //freopen( output.txt ,  w , stdout);       //freopen( input.txt ,  w , stdout);   #endif       int tt = 1;       cin >> tt;       for (int t = 1; t <= tt; t++)       {           int a, b;           cin >> a >> b;           int u = 0;           int down = 0;           int left = 0;           int right = 0;           string s;           cin >> s;           for (auto i : s)           {               if (i ==  U )                   u++;               if (i ==  D )                   down++;               if (i ==  L )                   left++;               if (i ==  R )                   right++;           }           int fxl = -down;           int fxu = u;           int fyu = right;           int fyl = -left;           if (a <= fyu and fyl <= a and b <= fxu and b >= fxl)               cout <<  YES n ;           else               cout <<  NO n ;       }   }
#include <bits/stdc++.h>   using namespace std;   struct bottle {     int number;     double len;     double lento;     double diflen;   } a[100005], b[100005];   int cmp(bottle a, bottle b) {     if (a.diflen > b.diflen) return 1;     return 0;   }   int main() {     double x1, y1, x2, y2, c1, c2, x, y;     scanf( %lf %lf %lf %lf %lf %lf , &x1, &y1, &x2, &y2, &c1, &c2);     int n;     scanf( %d , &n);     for (int i = 0; i < n; i++) {       scanf( %lf %lf , &x, &y);       a[i].len = sqrt(pow(x1 - x, 2) + pow(y1 - y, 2));       b[i].len = sqrt(pow(x2 - x, 2) + pow(y2 - y, 2));       a[i].lento = sqrt(pow(x - c1, 2) + pow(y - c2, 2));       b[i].lento = sqrt(pow(x - c1, 2) + pow(y - c2, 2));       a[i].diflen = a[i].lento - a[i].len;       b[i].diflen = b[i].lento - b[i].len;       a[i].number = i;       b[i].number = i;     }     sort(a, a + n, cmp);     sort(b, b + n, cmp);     double length = a[0].len + b[0].len + a[0].lento + b[0].lento;     int mark1 = a[0].number, mark2 = b[0].number;     if (a[0].diflen < 0 || b[0].diflen < 0) {       if (a[0].diflen > b[0].diflen) {         mark2 = -1;         length = a[0].len + a[0].lento;       } else {         mark1 = -1;         length = b[0].len + b[0].lento;       }     }     if (a[0].number == b[0].number && mark1 != -1 && mark2 != -1) {       if (a[1].diflen < 0 || b[1].diflen < 0) {         if (a[1].diflen < 0 && b[1].diflen < 0) {           if (a[0].diflen > b[0].diflen) {             mark2 = -1;             mark1 = a[0].number;             length = a[0].len + a[0].lento;           } else {             mark1 = -1;             mark2 = b[0].number;             length = b[0].len + b[0].lento;           }         } else if (a[1].diflen < 0) {           if ((a[0].diflen + b[1].diflen) > b[0].diflen) {             mark1 = a[0].number;             mark2 = b[1].number;             length = a[0].len + b[1].len + a[0].lento + b[1].lento;           } else {             mark1 = -1;             mark2 = b[0].number;             length = b[0].len + b[0].lento;           }         } else if (b[1].diflen < 0) {           if ((b[0].diflen + a[1].diflen) > a[0].diflen) {             mark1 = a[1].number;             mark2 = b[0].number;             length = a[1].len + b[0].len + a[1].lento + b[0].lento;           } else {             mark1 = a[0].number;             mark2 = -1;             length = a[0].len + a[0].lento;           }         }       } else if ((a[0].diflen + b[1].diflen) > (a[1].diflen + b[0].diflen)) {         length = a[0].len + b[1].len + a[0].lento + b[1].lento;         mark1 = a[0].number;         mark2 = b[1].number;       } else {         length = a[1].len + b[0].len + a[1].lento + b[0].lento;         mark1 = a[1].number;         mark2 = b[0].number;       }     }     for (int i = 0; i < n; i++) {       if (a[i].number != mark1 && a[i].number != mark2) {         length += a[i].lento * 2;       }     }     printf( %.12lf n , length);   }
#include <bits/stdc++.h>   using namespace std;   vector<int> d;   int countDivisors(int n) {     if (d[n] != 0) return d[n];     int res = 0;     for (int i = 1; i * i <= n; i++) {       if (n % i == 0) {         if (n / i == i)           res++;         else           res += 2;       }     }     d[n] = res;     return res;   }   void solve() {     int a, b, c;     cin >> a >> b >> c;     d = vector<int>(a * b * c + 1, 0);     int ans = 0;     for (auto i = (1); i < (a + 1); i++)       for (auto j = (1); j < (b + 1); j++)         for (auto k = (1); k < (c + 1); k++) ans += countDivisors(i * j * k);     cout << ans % 1073741824 <<   n ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int t = 1;     while (t--) solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long a, b, m, ans = 0;     scanf( %I64d%I64d%I64d , &a, &b, &m);     if (a >= m || b >= m)       printf( 0 n );     else if (a <= 0 && b <= 0)       printf( -1 n );     else {       if (a < 0 || b < 0) {         if (a > b) swap(a, b);         ans = -a / b;         a += b * ans;       }       while (a < m && b < m) {         if (a > b) swap(a, b);         ans++;         a += b;       }       printf( %I64d n , ans);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   void chkMax(T &x, T y) {     if (y > x) x = y;   }   template <typename T>   void chkMin(T &x, T y) {     if (y < x) x = y;   }   template <typename T>   void inline read(T &x) {     int f = 1;     x = 0;     char s = getchar();     while (s <  0  || s >  9 ) {       if (s ==  - ) f = -1;       s = getchar();     }     while (s <=  9  && s >=  0 ) x = x * 10 + (s ^ 48), s = getchar();     x *= f;   }   const int N = 55;   int n;   struct E {     int a, b;   } e[N];   bool operator<(const E &x, const E &y) {     if (x.a == y.a) return x.b > y.b;     return x.a > y.a;   };   long double f[N], g[N], s[N];   bool inline chk(long double mid) {     for (int i = 1; i <= n; i++) f[i] = -9e18;     for (int i = 1; i <= n; i++) {       s[i] = s[i - 1] + e[i].b * mid - e[i].a;     }     f[0] = 0;     for (int i = 1; i <= n; i++) {       int j = i;       while (j < n && e[j + 1].a == e[i].a) j++;       memcpy(g, f, sizeof f);       for (int j = 0; j <= n; j++) f[j] = -9e18;       int l = j - i + 1;       for (int j = 0; j <= n; j++) {         if (g[j] <= -9e18) continue;         for (int k = 0; k <= l; k++) {           int re = l - k;           if (re > j) continue;           chkMax(f[j - re + k], g[j] + s[i + k - 1] - s[i - 1]);         }       }       i = j;     }     for (int i = 0; i <= n; i++) {       if (f[i] >= 0) return 1;     }     return 0;   }   int main() {     read(n);     for (int i = 1; i <= n; i++) read(e[i].a);     for (int i = 1; i <= n; i++) read(e[i].b);     sort(e + 1, e + 1 + n);     long double l = 0, r = 1e8, eps = 1e-10;     while (r - l > eps) {       long double mid = (l + r) / 2;       if (chk(mid))         r = mid;       else         l = mid;     }     printf( %lld n , (long long)(r * 1000 + 0.99999));     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using namespace std;   long long m = 33554431;   long long bigmod(long long b, long long p) {     if (p == 0) return 1;     if (p % 2 == 0) {       long long temp = bigmod(b, p / 2);       return (temp * temp) % m;     }     return (bigmod(b, p - 1) * (b % m)) % m;   }   bool XX(pair<int, double> a, pair<int, double> b) {     return a.second < b.second;   }   int main() {     int n, m;     cin >> n >> m;     vector<pair<int, double> > vec(n);     for (int i = 0; i < n; i++) {       scanf( %d %lf , &vec[i].first, &vec[i].second);     }     sort(vec.begin(), vec.end(), XX);     vector<int> ans;     for (int i = 0; i < n; i++) {       if (ans.empty() || ans.back() <= vec[i].first)         ans.push_back(vec[i].first);       else         *upper_bound(ans.begin(), ans.end(), vec[i].first) = vec[i].first;     }     cout << n - ans.size() << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAX = 200005;   pair<int, int> a[MAX];   int bin_Upper(vector<pair<int, int> >& a, int l, int r, int x, int last) {     int m = (l + r) / 2;     if (l > r) return last;     if (x > a[m].second) return bin_Upper(a, m + 1, r, x, last);     if (x <= a[m].second) return bin_Upper(a, l, m - 1, x, m);   }   int main() {     int n, q, cmd, p, x;     cin >> n;     for (int i = 0; i < n; i++) {       cin >> a[i].first;       a[i].second = 0;     }     cin >> q;     vector<pair<int, int> > stak;     for (int k = 1; k <= q; k++) {       cin >> cmd;       if (cmd == 1) {         cin >> p >> x;         a[p - 1] = {x, k};       } else {         cin >> x;         while (!stak.empty() && stak.back().first <= x) stak.pop_back();         stak.push_back({x, k});       }     }     for (int i = 0; i < n; i++) {       int temp = bin_Upper(stak, 0, stak.size() - 1, a[i].second, -1);       if (temp == -1 || stak[temp].first <= a[i].first)         cout << a[i].first <<    ;       else         cout << stak[temp].first <<    ;     }     return 0;   }
#include <bits/stdc++.h>   int max(int a, int b) { return a > b ? a : b; }   long long int min(long long int a, long long int b) { return a < b ? a : b; }   int main() {     using namespace std;     int t, a, b;     cin >> t;     while (t--) {       cin >> a >> b;       cout << min(min(a, b), (a + b) / 3) << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     while (n--) {       string s;       cin >> s;       while (s.size() && s[0] ==  0 ) {         s.erase(s.begin());       }       while (s.size() && s[(int)s.size() - 1] ==  0 ) {         s.erase(s.begin() + (int)s.size() - 1);       }       int cnt = 0;       for (auto x : s) cnt += (x ==  0 );       cout << cnt << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char pic[105][105];   int vis[105][105];   int disx[] = {-1, 1, 0, 0};   int disy[] = {0, 0, -1, 1};   struct node {     int ro, lo, len;     node() {}     node(int rr, int ll, int le) {       ro = rr;       lo = ll;       len = le;     }   };   int main() {     int n, m;     cin >> n >> m;     vector<node> ve;     for (int i = 0; i < n; i++) cin >> pic[i];     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         if (pic[i][j] ==  * ) {           int tot = 105, cnt;           for (int k = 0; k < 4; k++) {             cnt = 0;             for (int h = 1; h <= n; h++) {               int xx = i + disx[k] * h;               int yy = j + disy[k] * h;               if (xx >= 0 && xx < n && yy >= 0 && yy < m && pic[xx][yy] ==  * ) {                 cnt++;               } else                 break;             }             if (cnt != 0)               tot = min(tot, cnt);             else {               tot = 105;               break;             }           }           if (tot != 105) {             for (int k = 0; k < 4; k++) {               for (int h = 1; h <= tot; h++) {                 int xx = i + disx[k] * h;                 int yy = j + disy[k] * h;                 if (xx >= 0 && xx < n && yy >= 0 && yy < m && pic[xx][yy] ==  * )                   vis[xx][yy]++;               }             }             vis[i][j]++;             ve.push_back(node(i + 1, j + 1, tot));           }         }       }     }     bool flag = true;     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         if (pic[i][j] ==  * ) {           if (vis[i][j] == 0) {             flag = false;             break;           }         }       }       if (!flag) break;     }     if (!flag)       cout << -1 << endl;     else {       cout << ve.size() << endl;       for (int i = 0; i < ve.size(); i++) {         cout << ve[i].ro <<     << ve[i].lo <<     << ve[i].len << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m, x, y;     cin >> n >> m;     pair<int, pair<int, int> > arr[n];     int arr1[n], arr2[n];     for (int i = 0; i < n; ++i) cin >> arr1[i];     for (int i = 0; i < n; ++i) cin >> arr2[i];     for (int i = 0; i < n; ++i) {       arr[i].second.first = arr1[i];       arr[i].second.second = arr2[i];       arr[i].first = arr[i].second.first - arr[i].second.second;     }     sort(arr, arr + n);     long long sum = 0;     if (n == m) {       for (int i = 0; i < n; ++i) sum += arr[i].second.first;       cout << sum << endl;       return 0;     }     for (int i = 0; i < n; ++i) {       if (m > 0) {         sum += arr[i].second.first;         --m;       } else {         if (arr[i].second.first > arr[i].second.second)           sum += arr[i].second.second;         else           sum += arr[i].second.first;       }     }     cout << sum << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long double eps = 1e-9;   const int inf = (1 << 30) - 1;   int n, m, it;   bool a[250][250];   int u[250][250], lx, ly, rx, ry, k;   const int dx[8] = {-1, -1, -1, 0, 0, 1, 1, 1};   const int dy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};   void go(int vx, int vy) {     if (u[vx][vy]) return;     u[vx][vy] = it;     lx = min(lx, vx);     rx = max(rx, vx);     ly = min(ly, vy);     ry = max(ry, vy);     ++k;     for (int i = 0; i < 8; ++i) {       int x = vx + dx[i];       int y = vy + dy[i];       if (0 <= x && x < n && 0 <= y && y < m)         if (a[x][y] == 1) go(x, y);     }   }   bool check1(int x, int y) {     if (k < 4) return 0;     if (rx - lx != ry - ly) return 0;     int tmp = 0;     for (int i = lx; i <= rx; ++i) {       if (!u[i][ly] || !u[i][ry]) return 0;       tmp += 2;     }     for (int i = ly + 1; i < ry; ++i) {       if (!u[lx][i] || !u[rx][i]) return 0;       tmp += 2;     }     if (tmp == k)       return 1;     else       return 0;   }   bool check2(int x, int y) {     if (k < 4) return 0;     if (rx - lx != ry - ly) return 0;     if (ry - y != y - ly) return 0;     int tmp = 0;     int x1 = x;     int y1 = y;     int x2 = lx + y - ly;     int y2 = ly;     for (int i = 0; i <= y - ly; ++i) {       if (!u[x1 + i][y1 + i] || !u[x2 + i][y2 + i]) return 0;       tmp += 2;     }     tmp -= 4;     x1 = x2;     y1 = y2;     x2 = rx;     y2 = y;     for (int i = 0; i <= y - ly; ++i) {       if (!u[x1 - i][y1 + i] || !u[x2 - i][y2 + i]) return 0;       tmp += 2;     }     if (tmp == k)       return 1;     else       return 0;   }   void Work() {     scanf( %d%d , &n, &m);     for (int i = 0; i < n; ++i)       for (int j = 0; j < m; ++j) {         char ch;         scanf(  %c , &ch);         a[i][j] = ch ==  1 ;       }     for (int i = 0; i < n; ++i)       for (int j = 0; j < m; ++j) u[i][j] = 0;     it = 0;     int res = 0;     for (int i = 0; i < n; ++i)       for (int j = 0; j < m; ++j)         if (a[i][j] && !u[i][j]) {           k = 0;           ++it;           lx = rx = i;           ly = ry = j;           go(i, j);           if (check1(i, j) || check2(i, j)) ++res;         }     printf( %d n , res);   }   int main() {     int T;     scanf( %d , &T);     while (T--) Work();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long vp(pair<int, int> a, pair<int, int> b) {     return (long long)a.first * b.second - (long long)a.second * b.first;   }   pair<int, int> mn(pair<int, int> a, pair<int, int> b) {     return make_pair(a.first - b.first, a.second - b.second);   }   int main() {     srand(239);     int n, m;     scanf( %d %d , &n, &m);     if (m == 3) {       if (n > 4) {         printf( -1 n );         return 0;       }       if (n == 3) {         printf( 0 0 n0 1 n1 0 n );         return 0;       }       if (n == 4) {         printf( 0 0 n0 3 n3 0 n1 1 n );         return 0;       }       assert(false);     }     int R1 = 1e7;     int R2 = 2e7;     vector<pair<int, int> > v;     for (int i = 0; i < m; i++) {       v.push_back(           make_pair(R1 * cos(M_PI * 2 * i / m), R1 * sin(M_PI * 2 * i / m)));       if (i < n - m)         v.push_back(make_pair(R2 * cos(M_PI * 2 * i / m + M_PI * 0.0001),                               R2 * sin(M_PI * 2 * i / m + M_PI * 0.0001)));     }     while (1) {       bool good = true;       for (int i = 0; i < n; i++) {         for (int j = i + 1; j < n; j++) {           for (int k = j + 1; k < n; k++) {             if (vp(mn(v[i], v[k]), mn(v[j], v[k])) == 0) {               v[k].first += rand() % 10;               v[k].second += rand() % 10;               good = false;             }           }         }       }       if (good) break;     }     assert((int)(v).size() == n);     for (int i = 0; i < n; i++) {       printf( %d %d n , v[i].first, v[i].second);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<long long> data;   long long a, b, h, w, n, t, minVal;   inline void swap(int &a, int &b) {     int tmp = a;     a = b;     b = tmp;   }   inline int mini(int a, int b) { return a < b ? a : b; }   bool cmp(long long a, long long b) { return a > b; }   int dfs(int crt, long long th, long long tw) {     if (th >= a && tw >= b || th >= b && tw >= a) return crt;     if (crt >= 34 || crt >= data.size()) return -1;     if (data[crt] == minVal) {       while (th < a) {         th *= minVal;         crt++;       }       while (tw < b) {         tw *= minVal;         crt++;       }       return crt <= data.size() ? crt : -1;     } else {       int reta = 0, retb = 0;       if (th < 100000) reta = dfs(crt + 1, th * data[crt], tw);       if (tw < 100000) retb = dfs(crt + 1, th, tw * data[crt]);       if (reta <= 0 && retb <= 0) return -1;       if (reta <= 0) return retb;       if (retb <= 0) return reta;       return mini(reta, retb);     }   }   int main(void) {     ios::sync_with_stdio(false);     cin.tie(NULL);     cin >> a >> b >> h >> w >> n;     if (a > b) swap(a, b);     if (h > w) swap(h, w);     if (h >= a && w >= b) {       printf( 0 n );       return 0;     }     for (int i = 0; i < n; i++) {       cin >> t;       data.push_back(t);     }     sort(data.begin(), data.end(), cmp);     minVal = data[mini(33, data.size() - 1)];     printf( %d n , mini(dfs(0, h, w), dfs(0, w, h)));     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int imax = 1e9 + 7;   const long long lmax = 1e18;   const int maxn = 2005;   int P[maxn], C[maxn], A[maxn];   vector<int> adj[maxn];   vector<int> dfs(int cur) {     vector<int> ans(0), v(0);     for (int next : adj[cur]) {       v = dfs(next);       ans.insert(ans.end(), v.begin(), v.end());     }     if (((int)ans.size()) < C[cur]) {       cout <<  NO n ;       exit(0);     }     ans.insert(ans.begin() + C[cur], cur);     return ans;   }   int calc() {     int i, n;     cin >> n;     for (i = 0; i < maxn; ++i) adj[i].clear();     for (i = 1; i < n + 1; ++i) {       cin >> P[i] >> C[i];       adj[P[i]].push_back(i);     }     vector<int> v = dfs(adj[0][0]);     for (i = 0; i < ((int)v.size()); ++i) {       A[v[i]] = i + 1;     }     cout <<  YES n ;     for (i = 1; i < n + 1; ++i) cout << A[i] <<    n [i == n];     return 0;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     calc();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void fastIO() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.precision(20);   }   long long A[100006];   long long B[100006];   long long C[100006];   long long rev(long long a, long long b) { return a > b; }   int main() {     fastIO();     vector<long long> V;     set<long long> S;     set<long long>::iterator it;     map<string, long long> M;     map<string, long long>::iterator it1;     long long a, b, c;     long long n, m;     long long cnt = 0, cntr = 0, sum = 0, ans = 1;     long long p, q, r;     long long v = 1;     long long check = 0;     long long x, y, z;     long long Max = 0, Min = INT_MAX;     string s, s1[100006], s2[100006], s3, s4;     cin >> n >> m;     for (int i = 0; i < n; i++) cin >> A[i];     sort(A, A + n);     for (int i = 0; i < n; i++) {       sum += (A[i] * m--);       if (m == 0) m = 1;     }     cout << sum << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());   const long long inf = 1e17 + 7;   string first(long long num) {     string second =   ;     for (long long i = 0; i < num; i++) second +=  * ;     return second;   }   signed main() {     cin.tie(0);     cout.tie(0);     ios_base::sync_with_stdio(0);     cout.precision(10);     map<string, long long> a;     a[ void ] = 0;     long long n;     cin >> n;     while (n--) {       string type, st, to;       cin >> type >> st;       long long l = st.find_first_not_of( & );       long long r = st.find_last_not_of( * );       long long cnt = st.size() - r - 1 - l;       string temp = st.substr(l, r - l + 1);       if (type ==  typeof ) {         if (a.find(temp) == a.end() || a[temp] + min(0ll, cnt) < 0)           cout <<  errtype  << endl;         else           cout <<  void  << first(a[temp] + cnt) << endl;       } else {         cin >> to;         if (a.find(temp) == a.end() || a[temp] < 0)           a[to] = -1;         else           a[to] = a[temp] + cnt;       }     }   }