malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   bool sortbysec(const pair<int, int> a, const pair<int, int> b) {     return a.second < b.second;   }   int main() {     string s1;     cin >> s1;     string s2;     cin >> s2;     bool flag = false;     string ans =   0 ;     for (int i = 0; i < s1.length(); i++) {       if (int(s1[i]) < int(s2[i])) flag = true;     }     if (s1.length() != s2.length()) flag = true;     if (flag == false) {       for (int i = 0; i < s1.length(); i++) {         if (int(s1[i]) == int(s2[i]))           ans +=  z ;         else if (int(s1[i]) > int(s2[i]))           ans += s2[i];       }     }     if (flag == true)       cout <<  -1  << endl;     else       cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct dragon {     int sila;     int dodatek;   };   bool operator<(dragon A, dragon B) { return A.sila < B.sila; }   int main() {     int s, n;     cin >> s >> n;     vector<dragon> D(n);     for (int i = 0; i < n; i++) {       cin >> D[i].sila >> D[i].dodatek;     }     sort(D.begin(), D.end());     for (int p = 0; p < n; p++) {       if (s > D[p].sila)         s += D[p].dodatek;       else {         cout <<  NO  << endl;         return 0;       }     }     cout <<  YES  << endl;   }
#include <bits/stdc++.h>   using namespace std;   long long qpow(long long x, long long k, long long mod) {     long long ret = 1;     while (k) {       if (k & 1) {         ret = ret * x;         ret = ret % mod;       }       x = x * x;       x = x % mod;       k = (k >> 1);     }     return ret;   }   const int Maxn = 1005;   const int md = 998244353;   int n, m;   int a[Maxn][Maxn];   long long e[Maxn][Maxn];   long long inv[Maxn * Maxn];   long long cnt[2][Maxn];   int r, c;   vector<pair<int, pair<int, int> > > vv;   void pre() {     for (int i = 1; i < Maxn * Maxn; i++) {       inv[i] = qpow(i, md - 2, md);     }   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= m; j++) {         scanf( %d , a[i] + j);         vv.push_back(pair<int, pair<int, int> >(a[i][j], pair<int, int>(i, j)));       }     }     scanf( %d%d , &r, &c);     pre();     sort((vv).begin(), (vv).end());     long long sume = 0, sumx = 0, sumx2 = 0, sumy = 0, sumy2 = 0, ans = 0;     for (int i = 0, j = 0; i < vv.size(); i++) {       if (i && vv[i].first != vv[i - 1].first) {         for (; j < i; j++) {           long long nx = vv[j].second.first, ny = vv[j].second.second;           sume = (sume + e[nx][ny]) % md;           sumx = (sumx + nx) % md;           sumx2 = (sumx2 + nx * nx) % md;           sumy = (sumy + ny) % md;           sumy2 = (sumy2 + ny * ny) % md;         }       }       long long x = vv[i].second.first, y = vv[i].second.second;       long long tmp = (sume + sumx2 + sumy2 - sumx * x * 2 - sumy * y * 2) % md;       if (j) tmp = (tmp * inv[j] + x * x + y * y) % md;       if (tmp < 0) tmp += md;       e[x][y] = tmp;     }     printf( %lld n , e[r][c]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, a[100050], cnt = 0;   int main() {     cin >> n;     for (int i = 0; i < n; i++) cin >> a[i];     sort(a, a + n);     for (int i = 0; i < n; i++)       if (a[i] > cnt) cnt++;     cout << cnt + 1;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using namespace std;   int main() {     int N;     cin >> N;     pair<char, int> list[N];     for (int i = 0; i < N; i++) cin >> list[i].first >> list[i].second;     int initial = 0;     set<int> presents;     for (int i = 0; i < N; i++) {       int count = 0;       char sign = list[i].first;       int id = list[i].second;       if (sign ==  + ) {         presents.insert(id);       } else if (sign ==  - ) {         if (presents.count(id)) {           presents.erase(id);         } else           initial++;       } else         assert(false);     }     presents.clear();     int maxi = initial;     int count = initial;     for (int i = 0; i < N; i++) {       char sign = list[i].first;       int id = list[i].second;       if (sign ==  + ) {         count++;         presents.insert(id);       } else if (sign ==  - ) {         count--;         if (presents.count(id)) presents.erase(id);       }       maxi = max(maxi, count);     }     cout << maxi << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int rozmiar_kubelka = 356;   int n, m;   vector<int> her;   vector<pair<char, int> > mov;   int dp[(1 << 20)];   void policz() {     dp[0] = 0;     int a = 1;     for (; a < (1 << m); a++) {       int c = __builtin_popcount(a);       c = m - c;       auto akt = mov[c];       if (akt.second == 1)         dp[a] = -1000000000;       else         dp[a] = 1000000000;       if (akt == make_pair( p , 1)) {         int it = 0;         for (int i = 1; true; i *= 2) {           if (i & a) {             dp[a] = dp[a ^ i] + her[it];             break;           }           it++;         }       }       if (akt == make_pair( p , 2)) {         int it = 0;         for (int i = 1; true; i *= 2) {           if (i & a) {             dp[a] = dp[a ^ i] - her[it];             break;           }           it++;         }       }       if (akt == make_pair( b , 1)) {         int it = m - 1;         for (int i = 1; i <= a; i *= 2) {           it--;           if (i & a) {             dp[a] = max(dp[a], dp[a ^ i]);           }         }       }       if (akt == make_pair( b , 2)) {         int it = m - 1;         for (int i = 1; i <= a; i *= 2) {           it--;           if (i & a) {             dp[a] = min(dp[a], dp[a ^ i]);           }         }       }     }   }   int main() {     vector<int> vec;     scanf( %d , &n);     for (int i = 0; i < (n); ++i) {       int a;       scanf( %d , &a);       vec.push_back(a);     }     scanf( %d , &m);     sort(vec.begin(), vec.end());     for (int i = ((int)(n)) - 1; i >= (n - m); --i) her.push_back(vec[i]);     for (int i = 0; i < (m); ++i) {       char p;       int a;       scanf( %c%c%d , &p, &p, &a);       mov.push_back({p, a});     }     policz();     printf( %d , dp[(1 << m) - 1]);   }
#include <bits/stdc++.h>   using namespace std;   mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     long long t;     cin >> t;     for (long long _ = 0; _ < t; ++_) {       long long n;       cin >> n;       vector<long long> a(n + 1);       for (long long i = 0; i < n; ++i) {         cin >> a[i];       }       long long l = a[0];       long long r = n;       long long cur = l;       string ans =  Yes ;       for (long long i = 0; i < n; ++i) {         if (a[i] != cur) {           ans =  No ;         }         ++cur;         if (a[i] == r) {           r = l - 1;           l = a[i + 1];           cur = l;         }       }       cout << ans << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char str[1000];   int main() {     int n, k;     while (scanf( %d %d , &n, &k) == 2) {       scanf( %s , str + 1);       int left = k - 1;       int right = n - k;       int di;       if (right >= left) {         di = 1;         for (int i = k; i > 1; i--) printf( LEFT n );       } else {         di = 2;         for (int i = k; i < n; i++) printf( RIGHT n );       }       if (di == 1) {         for (int i = 1; i <= n; i++) {           printf( PRINT %c n , str[i]);           if (i != n) printf( RIGHT n );         }       } else {         for (int i = n; i >= 1; i--) {           printf( PRINT %c n , str[i]);           if (i != 1) printf( LEFT n );         }       }       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int gcd(int a, int b) {     if (b == 0) return a;     return gcd(b, a % b);   }   int main() {     ios::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int a, b, c, d;     cin >> a >> b >> c >> d;     if (a * d < c * b) {       int g = gcd(b * c - a * d, b * c);       cout << ((b * c - a * d) / g) <<  /  << (b * c / g) << endl;     } else {       int g = gcd(a * d - b * c, a * d);       cout << ((a * d - b * c) / g) <<  /  << (a * d / g) << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int x, y;     long double maxd = 0.00000000;     long long int ans = 0;     long long int n;     cin >> n;     while (n--) {       long long int a, b;       cin >> a >> b;       ans = max(ans, (a + b));     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int i, j, x[2][4], y[2][4];     pair<int, int> p[2][4];     for (j = 0; j < 2; j++) {       for (i = 0; i < 4; i++) {         cin >> x[j][i] >> y[j][i];         p[j][i] = {x[j][i], y[j][i]};       }     }     sort(p[0], p[0] + 4);     sort(p[1], p[1] + 4);     int a = p[1][0].first + p[1][0].second, b = p[1][2].first + p[1][2].second;     int c = p[1][1].second - p[1][1].first, d = p[1][2].second - p[1][1].first;     set<pair<int, int>> s;     for (i = -100; i <= 100; i++) {       for (j = -100; j <= 100; j++) {         if (i + j >= a && i + j <= b && j - i >= c && j - i <= d) {           s.insert({i, j});         }       }     }     a = p[0][0].first, b = p[0][0].second, c = p[0][3].first, d = p[0][3].second;     for (i = a; i <= c; i++) {       for (j = b; j <= d; j++) {         pair<int, int> q = {i, j};         if (s.count(q)) {           cout <<  YES  << endl;           return 0;         }       }     }     cout <<  NO  << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 0x3f3f3f3f;   const int maxn = 1e5 + 5;   const int mod = 1e9 + 7;   vector<int> v[26];   int main() {     int n;     cin >> n;     string s;     cin >> s;     for (int i = 0; i < n; i++) v[s[i] -  a ].push_back(i);     int m;     cin >> m;     while (m--) {       string s2;       cin >> s2;       int t[26];       memset(t, 0, sizeof(t));       for (int i = 0; i < s2.size(); i++) t[s2[i] -  a ]++;       int ans = -1;       for (int i = 0; i < 26; i++) {         if (t[i]) ans = max(ans, v[i][t[i] - 1] + 1);       }       cout << ans << endl;     }     return 0;   }
#include <bits/stdc++.h>   const int N = 100005;   int solve(int n, int k, int cnt[]) {     if (k == n || cnt[0] == 0 || cnt[1] == 0) {       return 1 - cnt[1] % 2;     }     if ((n - k) / 2 < cnt[0] && (n - k) / 2 < cnt[1]) {       if ((n - k) % 2 == 0)         return 1;       else         return 0;     }     if ((n - k) / 2 >= cnt[0]) {       return 1 - k % 2;     }     return 1;   }   int main() {     int n, k;     scanf( %d%d , &n, &k);     int cnt[2];     cnt[0] = cnt[1] = 0;     for (int i = 0; i < n; i++) {       int tmp;       scanf( %d , &tmp);       cnt[tmp % 2]++;     }     printf( %s , solve(n, k, cnt) ?  Daenerys  :  Stannis );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main(){    int T; cin >> T;     long long A[114514];     while(T--){     int N; cin >> N;      long long S = 0;      for(int i = 0; i < N; i++){      cin >> A[i]; S += A[i];      }     sort(A, A+N, greater<long long>());      if(S == 0) cout << 0 <<   n ;      else cout << max({A[1] * (N-1) - S, A[0] * (N-1) - S, N-2 - (S-1) % (N-1)}) <<   n ;     }   }
#include <bits/stdc++.h>   #define ll long long int   #define vi vector<int>   #define vll vector<long long int>   #define MAX(a, b) ((a) > (b) ? (a) : (b))   #define MIN(a, b) ((a) < (b) ? (a) : (b))   #define ABS(x) ((x) < 0 ? -(x) : (x))   #define setpr(x, y) cout << fixed << setprecision(x) << y   #define tr(x) cout << (#x) <<   =   << (x) <<   n ;   using namespace std;   void solver(void);   ll MOD = 1e9 + 7;   double pi = 2 * acos(0.0);   //vector<vector<ll>> mat( n , vector<ll> (m, 0));      int main()   {       cin.tie(NULL);       ios_base::sync_with_stdio(false);       int t;       cin >> t;       while (t--)           solver();   }   void solver(void)   {       //input       ll n;       cin >> n;       vll v(n);       for (ll i = 0; i < n; i++)       {           v[i] = i + 1;       }       if (n % 2 == 0)       {              for (ll i = 0; i < n - 1; i = i + 2)           {               swap(v[i], v[i + 1]);           }       }       else       {           for (ll i = 0; i <= n - 3; i = i + 2)           {               swap(v[i], v[i + 1]);           }           swap(v[n - 2], v[n - 1]);       }       for (ll i = 0; i < n; i++)       {           cout << v[i] <<    ;       }       cout <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 200005;   long long a[maxn];   int n;   long long k;   long long d[maxn];   int main() {     cin >> n >> k;     for (int i = 1; i <= n; i++) scanf( %I64d , &a[i]);     long long sum = 0;     int num = 0;     for (int i = 1; i <= n; i++) {       d[i] = sum - (a[i] * (n - i) * (i - num - 1));       if (d[i] < k) {         printf( %d n , i);         num++;       } else         sum += a[i] * (i - num - 1);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool check(string s) {     int count = 0;     for (char el : s) {       if (el ==  ( ) {         count++;       } else {         count--;       }       if (count < 0) return false;     }     return true;   }   void solve() {     int n;     cin >> n;     string s;     cin >> s;     if (s[0] ==  )  || s[s.size() - 1] ==  (  || s.size() % 2) {       cout <<  :(  << endl;       return;     }     int in = 0, out = 0;     for (char el : s) {       in += (el ==  ( );       out += (el ==  ) );     }     if (in > n / 2 || out > n / 2) {       cout <<  :(  << endl;       return;     }     int first = (n / 2) - in;     int second = (n / 2) - out;     int count = 0;     for (int i = 0; i < n; i++) {       if (s[i] ==  ? ) {         if (first > 0) {           s[i] =  ( ;           first--;           count++;         } else {           s[i] =  ) ;           second--;           count--;         }       } else if (s[i] ==  ( ) {         count++;       } else {         count--;       }       if (count == 0 && i != n - 1) {         cout <<  :(  << endl;         return;       } else if (count < 0) {         cout <<  :(  << endl;         return;       }     }     cout << (check(s) ? s :  :( ) << endl;   }   int main() { solve(); }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, i, j;     cin >> n;     vector<int> ct[n + 1];     for (i = 0; i < 2 * n; i++) {       int x;       cin >> x;       ct[x].push_back(i);     }     int p1 = 0, p2 = 0;     long long ans = 0;     for (i = 1; i <= n; i++) {       ans += min(abs(ct[i][0] - p1) + abs(ct[i][1] - p2),                  abs(ct[i][0] - p2) + abs(ct[i][1] - p1));       p1 = ct[i][0];       p2 = ct[i][1];     }     cout << ans << endl;   }
#include <bits/stdc++.h>   const int N = 1e6 + 7;   const int INF = 0x3f3f3f3f;   const int mod = 1e9 + 7;   const double eps = 1e-7;   using namespace std;   int a[N], s[N];   map<int, int> asum, ssum;   map<int, vector<int> > pos;   map<int, int> size;   int main() {     int n, m, k, S;     cin >> m >> k >> n >> S;     for (int i = 1; i <= m; i++) {       scanf( %d , a + i);       asum[a[i]]++;     }     for (int i = 1; i <= S; i++) {       scanf( %d , s + i);       ssum[s[i]]++;     }     for (int i = 1; i <= m; i++) {       if (ssum[a[i]] > 0) {         pos[a[i]].push_back(i);       }     }     for (auto x : ssum) {       if (asum[x.first] < x.second) {         puts( -1 );         return 0;       }     }     for (auto x : pos) {       size[x.first] = x.second.size();     }     int p, q, l, r, minl, maxr;     bool f;     bool flag = 1;     for (int num = 1; num <= n; num++) {       p = (num - 1) * k;       f = 0;       minl = INF;       maxr = -1;       for (auto x : pos) {         q = upper_bound(x.second.begin(), x.second.end(), p) - x.second.begin();         if (q + ssum[x.first] > size[x.first]) {           f = 1;           break;         }         minl = min(minl, x.second[q]);         maxr = max(maxr, x.second[q + ssum[x.first] - 1]);       }       if (f) break;       if (m - maxr < (n - num) * k)         continue;       else {         printf( %d n , max(0, maxr - p - k));         int cnt = maxr - p;         bool ff = 1;         for (int i = p + 1; i <= maxr; i++) {           if (cnt <= k) break;           if (ssum[a[i]] == 0) {             printf( %s%d , ff ?    :    , i);             cnt--;             ff = 0;           } else {             ssum[a[i]]--;           }         }         cout << endl;         flag = 0;         break;       }     }     if (flag) puts( -1 );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   long long mypow(long long base, long long exp) {     long long res = 1;     while (exp) {       if (exp & 1) res = (res * base) % mod;       exp >>= 1, base = (base * base) % mod;     }     return res;   }   long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }   long long mult(long long a, long long b) {     if (a < 0) {       a += mod;     }     if (b < 0) {       b += mod;     }     return ((a % mod) * (b % mod)) % mod;   }   long long add(long long a, long long b) {     if (a < 0) {       a += mod;     }     if (b < 0) {       b += mod;     }     return (a % mod + b % mod) % mod;   }   long long sub(long long a, long long b) {     if (a < 0) {       a += mod;     }     if (b < 0) {       b += mod;     }     return (a % mod + mod - b % mod) % mod;   }   void err(istream_iterator<string> it) {}   template <typename T, typename... Args>   void err(istream_iterator<string> it, T a, Args... args) {     cerr << *it <<   =   << a <<   |  ;     err(++it, args...);   }   const long long inf = 1e18;   const int nax = 1e5 + 5;   void SolveTestCase() {     long long n;     cin >> n;     long long a[n];     long long sum = 0;     for (long long i = 0; i < n; i++) {       cin >> a[i];       sum += a[i];     }     long long sum2 = 0;     for (long long i = 0; i < n; i++) {       sum2 += a[i];       if (sum2 >= (sum + 1) / 2) {         cout << i + 1;         break;       }     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int t = 1;     for (long long i = 0; i < t; i++) {       SolveTestCase();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxN = 1000 * 1000 + 5;   bool mark[4][maxN];   int n, m, comp;   inline void dfs(int x, int y) {     if (mark[x][y]) return;     mark[x][y] = true;     if (x == 0 && y == 1) mark[3][1] = true;     if (x == 0 && y == m) mark[1][1] = true;     if (x == 1 && y == 1) mark[0][m] = true;     if (x == 1 && y == n) mark[2][m] = true;     if (x == 2 && y == 1) mark[3][n] = true;     if (x == 2 && y == m) mark[1][n] = true;     if (x == 3 && y == m) mark[2][1] = true;     if (x == 3 && y == 1) mark[0][1] = true;     if (x == 0) {       int dr = m - y;       int dl = y - 1;       int dd = n - 1;       int xr = 1 + min(dr, dd), yr = y + min(dr, dd);       int xl = 1 + min(dl, dd), yl = y - min(dl, dd);       (xr == n) ? dfs(2, yr) : dfs(1, xr);       (xl == n) ? dfs(2, yl) : dfs(3, xl);     }     if (x == 2) {       int dr = m - y;       int dl = y - 1;       int du = n - 1;       int xr = n - min(dr, du), yr = y + min(dr, du);       int xl = n - min(dl, du), yl = y - min(dl, du);       (xr == 1) ? dfs(0, yr) : dfs(1, xr);       (xl == 1) ? dfs(0, yl) : dfs(3, xl);     }     if (x == 1) {       int dd = n - y;       int du = y - 1;       int dl = m - 1;       int xu = y - min(du, dl), yu = m - min(du, dl);       int xd = y + min(dd, dl), yd = m - min(dd, dl);       (yu == 1) ? dfs(3, xu) : dfs(0, yu);       (yd == 1) ? dfs(3, xd) : dfs(2, yd);     }     if (x == 3) {       int dd = n - y;       int du = y - 1;       int dr = m - 1;       int xu = y - min(du, dr), yu = 1 + min(du, dr);       int xd = y + min(dd, dr), yd = 1 + min(dd, dr);       (yu == m) ? dfs(1, xu) : dfs(0, yu);       (yd == m) ? dfs(1, xd) : dfs(2, yd);     }   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i <= m; i++) {       if (!mark[0][i]) {         comp++;         dfs(0, i);       }       if (!mark[2][i]) {         comp++;         dfs(2, i);       }     }     for (int i = 1; i <= n; i++) {       if (!mark[1][i]) {         comp++;         dfs(1, i);       }       if (!mark[3][i]) {         comp++;         dfs(3, i);       }     }     printf( %d n , comp);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 100;   const long double INF = 2e30;   struct node {     int id;     long double da, db, len;     node(int _id = 0, long double _da = 0, long double _db = 0,          long double _len = 0) {       id = _id;       da = _da;       db = _db;       len = _len;     }   };   node a[maxn];   int n;   double ax, ay, bx, by, tx, ty;   double x[maxn], y[maxn];   long double len[maxn], da[maxn], db[maxn];   bool cmpb(node a, node b) {     long double ans1 = a.db - a.len;     long double ans2 = b.db - b.len;     return ans1 < ans2;   }   bool cmpa(node a, node b) {     long double ans1 = a.da - a.len;     long double ans2 = b.da - b.len;     return ans1 < ans2;   }   void solve() {     long double sum = 0;     for (int i = 0; i < n; i++) {       a[i].id = i;       long double dx, dy;       dx = ax - x[i];       dy = ay - y[i];       a[i].da = sqrt(dx * dx + dy * dy);       dx = bx - x[i];       dy = by - y[i];       a[i].db = sqrt(dx * dx + dy * dy);       dx = tx - x[i];       dy = ty - y[i];       a[i].len = sqrt(dx * dx + dy * dy);       sum += a[i].len * 2;       len[i] = a[i].len;       da[i] = a[i].da;       db[i] = a[i].db;     }     long double ans = INF;     sort(a, a + n, cmpb);     for (int i = 0; i < n; i++) {       if (n > 1) {         int id = a[0].id;         if (i == id) {           id = a[1].id;         }         long double tmp = sum - len[i] + da[i] - len[id] + db[id];         ans = min(ans, tmp);       }       long double tmp = sum - len[i] + da[i];       ans = min(ans, tmp);     }     sort(a, a + n, cmpa);     for (int i = 0; i < n; i++) {       if (n > 1) {         int id = a[0].id;         if (i == id) {           id = a[1].id;         }         long double tmp = sum - len[i] + db[i] - len[id] + da[id];         ans = min(ans, tmp);       }       long double tmp = sum - len[i] + db[i];       ans = min(ans, tmp);     }     printf( %.14f n , (double)ans);   }   int main() {     while (scanf( %lf%lf%lf%lf%lf%lf , &ax, &ay, &bx, &by, &tx, &ty) != EOF) {       scanf( %d , &n);       for (int i = 0; i < n; i++) {         scanf( %lf%lf , &x[i], &y[i]);       }       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long a, b, n;   long long power(long long b, long long p) {     if (p == 0) return 1;     long long ret = power(b, p / 2);     ret *= ret;     if (p & 1) ret *= b;     return ret;   }   long long check(long long x) { return a * power(x, n); }   int main() {     cin >> a >> b >> n;     if (b == 0) {       cout << 0 <<   n ;       return 0;     }     if (a == 0) {       cout <<  No solution             <<   n ;       return 0;     }     if (b % a) {       cout <<  No solution             <<   n ;       return 0;     }     long long x = pow(abs(b / a), 1.0 / n) + 0.5;     if (check(x) != b) x *= -1;     if (check(x) != b) {       cout <<  No solution             <<   n ;       return 0;     }     cout << x <<   n ;     return 0;   }
#include <bits/stdc++.h>   int ma[100005];   int main() {     int n, k;     scanf( %d%d , &n, &k);     for (int i = 1; i <= k + 1; i++) {       if (i & 1)         printf( %d  , i / 2 + 1);       else         printf( %d  , k + 2 - i / 2);     }     int s = (k + 1) / 2 + 1;     int e = k + 2 - (k + 1) / 2;     for (int i = s + 1; i < e - 1; i++) {       printf( %d  , i);     }     for (int i = k + 2; i <= n; i++) {       printf( %d  , i);     }     if (s + 1 <= e - 1) printf( %d n , e - 1);     return 0;   }