malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   inline char gc() {     static char buf[100000], *p1 = buf, *p2 = buf;     return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2)                ? EOF                : *p1++;   }   inline long long read() {     long long x = 0;     char ch = getchar();     bool positive = 1;     for (; !isdigit(ch); ch = getchar())       if (ch ==  - ) positive = 0;     for (; isdigit(ch); ch = getchar()) x = x * 10 + ch -  0 ;     return positive ? x : -x;   }   inline void write(long long a) {     if (a < 0) {       a = -a;       putchar( - );     }     if (a >= 10) write(a / 10);     putchar( 0  + a % 10);   }   inline void writeln(long long a) {     write(a);     puts(  );   }   inline void wri(long long a) {     write(a);     putchar(   );   }   inline unsigned long long rnd() {     return ((unsigned long long)rand() << 30 ^ rand()) << 4 | rand() % 4;   }   const int N = 150005;   long double l[N], r[N];   struct data {     long long p, t, id;   } a[N], b[N];   int n;   long long T;   bool cmp(data a, data b) { return a.p < b.p; }   bool cmpt(data a, data b) {     long long A = (long long)a.t * b.p, B = (long long)b.t * a.p;     return A == B ? a.p < b.p : A < B;   }   bool check(long double c) {     long long sum = 0;     for (int i = 1, j; i <= n; i = j) {       j = i + 1;       while (j <= n && a[j].t * a[i].p == a[i].t * a[j].p) j++;       for (int k = (int)(i); k <= (int)(j - 1); k++)         r[a[k].id] = (1 - c * (sum + a[k].t) / T) * a[k].p;       for (int k = (int)(i); k <= (int)(j - 1); k++) sum += a[k].t;       for (int k = (int)(i); k <= (int)(j - 1); k++)         l[a[k].id] = (1 - c * sum / T) * a[k].p;     }     int dq = n;     long double mn = 1e100;     for (int i = (int)(n); i >= (int)(1); i--) {       while (b[dq].p > b[i].p) {         mn = min(mn, l[b[dq--].id]);       }       if (mn <= r[b[i].id]) return 0;     }     return 1;   }   int main() {     n = read();     for (int i = (int)(1); i <= (int)(n); i++) a[a[i].id = i].p = read();     for (int i = (int)(1); i <= (int)(n); i++) T += (a[i].t = read());     for (int i = (int)(1); i <= (int)(n); i++) b[i] = a[i];     sort(a + 1, a + n + 1, cmpt);     sort(b + 1, b + n + 1, cmp);     long double l = 0, r = 1;     for (int i = (int)(1); i <= (int)(80); i++) {       long double mid = (l + r) / 2;       if (check(mid))         l = mid;       else         r = mid;     }     printf( %.10f , (double)l);   }
#include<bits/stdc++.h>   using namespace std;      int check(vector<long long> a) {    for (int i = 0; i + 1 < a.size(); i++) {     if (a[i] > a[i + 1]) {      return 0;     }     a[i + 1] -= a[i];     a[i] = 0;    }    if (a.back() == 0)     return 1;    return 0;   }      void solve() {    int n;    cin >> n;    vector<long long> a(n);    for (int i = 0; i < n; i++) {     cin >> a[i];    }    if (check(a)) {     cout <<  YES n ;     return;    }    if (n == 1) {     cout <<  NO n ;     return;    }    swap(a[0], a[1]);    if (check(a)) {     cout <<  YES n ;     return;    }    swap(a[0], a[1]);    swap(a[n - 2], a[n - 1]);    if (check(a)) {     cout <<  YES n ;     return;    }    swap(a[n - 2], a[n - 1]);    vector<long long> p(n), s(n);    vector<long long> b = a;    p[0] = b[0];    for (int i = 1; i < n; i++) {     if (p[i - 1] == -1 || b[i - 1] > b[i]) {      p[i] = -1;     } else {      b[i] -= b[i - 1];      b[i - 1] = 0;      p[i] = b[i];     }    }    b = a;    s[n - 1] = b[n - 1];    for (int i = n - 2; i >= 0; i--) {     if (s[i + 1] == -1 || b[i + 1] > b[i]) {      s[i] = -1;     } else {      b[i] -= b[i + 1];      b[i + 1] = 0;      s[i] = b[i];     }    }    for (int i = 1; i + 2 < n; i++) {     vector<long long> c = {p[i - 1], a[i], a[i + 1], s[i + 2]};     if (p[i - 1] == -1 || s[i + 2] == -1) {      continue;     }     swap(c[1], c[2]);     if (check(c)) {      cout <<  YES n ;      return;     }    }    cout <<  NO n ;   }      int main() {    ios_base::sync_with_stdio(false);    cin.tie(0);    cout.tie(0);    int t;    cin >> t;    while (t--) {     solve();    }   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 7;   set<int> a[N], b[N];   int maxa[N << 2], minb[N << 2];   int badv = 0;   bool bad(int v, int l, int r) {     if (l == r) {       return a[l].size() && b[l].size() && *a[l].rbegin() >= *b[l].begin();     } else {       return maxa[v * 2 + 2] >= minb[v * 2 + 1];     }   }   void relax(int v) {     maxa[v] = max(maxa[v * 2 + 1], maxa[v * 2 + 2]);     minb[v] = min(minb[v * 2 + 1], minb[v * 2 + 2]);   }   void upd_a(int v, int l, int r, int x, int y) {     if (l == r) {       badv -= bad(v, l, r);       if (a[x].find(y) == a[x].end())         a[x].insert(y);       else         a[x].erase(y);       if (a[x].empty())         maxa[v] = -N;       else         maxa[v] = *a[x].rbegin();       badv += bad(v, l, r);       return;     }     badv -= bad(v, l, r);     int m = (l + r) >> 1;     if (x <= m)       upd_a(v * 2 + 1, l, m, x, y);     else       upd_a(v * 2 + 2, m + 1, r, x, y);     relax(v);     badv += bad(v, l, r);   }   void upd_b(int v, int l, int r, int x, int y) {     if (l == r) {       badv -= bad(v, l, r);       if (b[x].find(y) == b[x].end())         b[x].insert(y);       else         b[x].erase(y);       if (b[x].empty())         minb[v] = N;       else         minb[v] = *b[x].begin();       badv += bad(v, l, r);       return;     }     badv -= bad(v, l, r);     int m = (l + r) >> 1;     if (x <= m)       upd_b(v * 2 + 1, l, m, x, y);     else       upd_b(v * 2 + 2, m + 1, r, x, y);     relax(v);     badv += bad(v, l, r);   }   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     for (int i = 0; i < (N << 2); ++i) {       maxa[i] = -N;       minb[i] = N;     }     int n, m, q;     cin >> n >> m >> q;     while (q--) {       int x, y;       cin >> x >> y;       --x;       --y;       if (x & 1) {         upd_a(0, 0, N, x / 2, y / 2);       } else {         upd_b(0, 0, N, x / 2, y / 2);       }       if (badv == 0)         cout <<  YES  <<   n ;       else         cout <<  NO  <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int a, b, c;     cin >> a >> b >> c;     long long ans = 0;     for (int i = 1; i < min(b, c); i++) {       ans += a;       a++;     }     ans *= 2;     for (int i = min(b, c); i <= max(b, c); i++) {       ans += a;     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long int N = 1e5;   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long int tc = 1;     for (long long int T = 1; T <= tc; T++) {       long long int n;       cin >> n;       string s;       cin >> s;       long long int cnt = 0, flag = 0;       for (long long int i = 0; i < n - 1; i++) {         if (s[i] == s[i + 1] and s[i] !=  ? ) {           flag = 1;           break;         }       }       if (flag) {         cout <<  No n ;         return 0;       }       if (s[0] ==  ?  or s[n - 1] ==  ? ) {         cout <<  Yes n ;         return 0;       }       long long int tot = 0, ok = 0;       char start =  $ , end =  $ ;       for (long long int i = 0; i < n; i++) {         if (s[i] !=  ?  and flag == 0) {           start = s[i];         } else if (s[i] ==  ? ) {           cnt++;           flag = 1;         } else {           end = s[i];           if (cnt == 1) {             if (start == end) {               ok = 1;               break;             }           } else {             ok = 1;             break;           }           start = end;           cnt = 0;           flag = 0;         }       }       if (ok)         cout <<  Yes n ;       else         cout <<  No n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int bs(vector<int>& a, int que) {     auto it = lower_bound(a.begin(), a.end(), que);     if (*it == que) {       return it - a.begin();     }     return -1;   }   bool isprime(int x) {     if (x == 2) return true;     if (x < 2) return false;     for (int i = 2; i * i <= x; i++)       if (x % i == 0) return false;     if (x == 0) return false;     return true;   }   int main() {     int n;     cin >> n;     int a[10001];     for (int i = 1; i <= n; i++) {       cin >> a[i];     }     vector<int> sol;     sol.push_back(a[n]);     for (int i = n; i >= 2; i--) {       if (a[i] == 1) {         sol.push_back(a[i - 1]);       }     }     reverse(sol.begin(), sol.end());     cout << sol.size() << endl;     for (int i = 0; i <= sol.size() - 1; i++) {       cout << sol[i] <<    ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long int n, k;     cin >> n >> k;     set<long long int> s;     map<long long int, long long int> mp;     long long int x;     for (long long int i = 0; i < n; i++) {       cin >> x;       s.insert(x);       mp[x] = i + 1;     }     if (s.size() < k) {       cout <<  NO  << endl;       return 0;     } else {       cout <<  YES  << endl;       map<long long int, long long int>::iterator it;       long long int c = 0;       for (it = mp.begin(); it != mp.end(); it++) {         if (c != k) {           cout << it->second <<    ;           c++;         } else           break;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char a[2000][1000];   int main() {     int n, s;     cin >> n;     int nowx = 0, nowy = 1000;     int miny = 1000, maxy = 1000;     for (int i = 0; i < n; i++) {       cin >> s;       for (int j = nowx; j < nowx + s; j++)         if (i % 2 == 0)           a[nowy][j] =  / , maxy = max(maxy, nowy++);         else           a[--nowy][j] =     , miny = min(miny, nowy);       nowx += s;     }     for (int i = maxy; i >= miny; i--, cout << endl)       for (int j = 0; j < nowx; j++)         if (a[i][j])           cout << a[i][j];         else           cout <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     priority_queue<pair<unsigned long long int, int> > matches;     unsigned long long int n;     int m;     unsigned long long int a;     int b;     unsigned long long int max = 0;     cin >> n >> m;     for (int i = 0; i < m; i++) {       cin >> a >> b;       pair<int, unsigned long long int> d;       d.first = b;       d.second = a;       matches.push(d);     }     while (matches.size() != 0 && m != 0) {       pair<int, unsigned long long int> d = matches.top();       if (d.second > n) {         max += n * d.first;         n = 0;       } else {         max += d.second * d.first;         n -= d.second;       }       matches.pop();     }     cout << max << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   int v[2][1000000 + 10];   void solve(int n, int p) {     if (n == 0) {       v[p][0] = 0;       return;     }     if (!(n & (n + 1))) {       for (int i = 0; i <= n; ++i) {         v[p][i] = n - i;       }     } else {       int two = 1;       while (two * 2 < n + 1) two *= 2;       solve(n - two, p ^ 1);       for (int i = 0; i <= n - two; ++i) {         v[p][i] = two + v[p ^ 1][i];       }       int cur = two;       for (int i = two; i <= n; ++i) {         --cur;         v[p][i] = cur;       }       for (int i = n - two + 1; i < two; ++i) {         --cur;         v[p][i] = cur;       }     }   }   int main() {     cin >> n;     long long s = 0;     for (int i = 0; i <= n; ++i) s += i;     cout << s + s << endl;     solve(n, 0);     for (int i = 0; i <= n; ++i) {       printf( %d  , v[0][i]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(0);     int n;     scanf( %d , &n);     vector<int> game(n + 1);     game[0] = game[1] = game[2] = 0;     vector<int> res(n + 1, -1);     for (int i = 3; i <= n; i++) {       int ok[300001];       memset(ok, 0, sizeof(0));       for (int j = 2; i - (j * (j - 1)) / 2 >= 0; j++) {         int x = i - ((j) * (j - 1)) / 2;         if (x % j == 0) {           x /= j;           int Xor = 0;           for (int k = 0; k < j; k++) {             Xor ^= game[x + k];           }           ok[Xor] = i;           if (Xor == 0 && res[i] == -1) {             res[i] = j;           }         }       }       int r = 0;       while (ok[r] == i) r++;       game[i] = r;       if (game[i] == 0) res[i] = -1;     }     printf( %d n , res[n]);   }
#include <bits/stdc++.h>   using namespace std;   int A[100005], P[100005];   int other_end[100005];   long long ans[100005], seg[100005];   int main() {     int n;     cin >> n;     for (int i = 1; i <= n; ++i) scanf( %d , &A[i]);     for (int i = 1; i <= n; ++i) scanf( %d , &P[i]);     long long res = 0;     for (int i = n; i >= 1; --i) {       ans[i] = res;       int pos = P[i];       long long sum = A[pos];       int l = pos, r = pos;       if (other_end[pos - 1] != 0) {         l = other_end[pos - 1];         sum += seg[l];       }       if (other_end[pos + 1] != 0) {         sum += seg[pos + 1];         r = other_end[pos + 1];       }       other_end[l] = r;       other_end[r] = l;       seg[l] = sum;       if (sum > res) res = sum;     }     for (int i = 1; i <= n; ++i) cout << ans[i] << endl;     return 0;   }
#include <bits/stdc++.h>   #pragma comment(linker, ”/ STACK : 38777216“   using namespace std;   const int N = 100005;   const int inf = 1000 * 1000 * 1000;   const int mod = 1000 * 1000 * 1000 + 7;   string s;   int a, b, c, d, t;   int main() {     cin >> t >> s;     if (t % 4 != 0) {       cout <<  ===  << endl;       return 0;     }     t /= 4;     for (int i = 0; i < 4 * t; i++) {       if (s[i] ==  A ) a++;       if (s[i] ==  C ) b++;       if (s[i] ==  G ) c++;       if (s[i] ==  T ) d++;     }     if (a > t || b > t || c > t || d > t) {       cout <<  ===  << endl;       return 0;     }     a = t - a;     b = t - b;     c = t - c;     d = t - d;     for (int i = 0; i < 4 * t; i++) {       if (s[i] !=  ? ) continue;       if (a > 0) {         s[i] =  A ;         a--;         continue;       }       if (b > 0) {         s[i] =  C ;         b--;         continue;       }       if (c > 0) {         s[i] =  G ;         c--;         continue;       }       s[i] =  T ;       d--;     }     cout << s << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct node {     int degree;     int xorsum;   };   struct Edge {     int src, des;   };   struct node virtex[100000];   vector<struct Edge> edge;   vector<struct Edge>::iterator it;   queue<int> que;   int main() {     struct Edge temp;     int n, d, s, i, src, des;     cin >> n;     for (i = 0; i < n; i++) {       cin >> virtex[i].degree >> virtex[i].xorsum;     }     for (i = 0; i < n; i++) {       if (virtex[i].degree == 1) {         que.push(i);       }     }     while (!que.empty()) {       src = que.front();       que.pop();       if (virtex[src].degree == 1) {         des = virtex[src].xorsum;         temp.src = src;         temp.des = des;         edge.push_back(temp);         virtex[des].degree--;         virtex[des].xorsum ^= src;         if (virtex[des].degree == 1) {           que.push(des);         }       }     }     cout << edge.size() << endl;     it = edge.begin();     while (it != edge.end()) {       cout << it->src <<     << it->des << endl;       it++;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1000010;   int cnt[N];   int a, b, n;   void genPrime() {     for (int i = 2; i < N; ++i) cnt[i] = 1;     for (int i = 2; i <= 1000; ++i)       if (cnt[i])         for (int j = i * i; j < N; cnt[j] = 0, j += i)           ;     for (int i = 1; i < N; ++i) cnt[i] += cnt[i - 1];   }   bool chk(int x) {     for (int i = a; i + x - 1 <= b; ++i) {       int j = i + x - 1;       if (cnt[j] - cnt[i - 1] < n) return false;     }     return true;   }   int main() {     int i, j, k;     genPrime();     scanf( %d%d%d , &a, &b, &n);     if (cnt[b] - cnt[a - 1] < n) {       printf( -1 n );       return 0;     }     int low = 1, up = b - a + 1;     while (up > low) {       int mid = (up + low) / 2;       if (chk(mid))         up = mid;       else         low = mid + 1;     }     printf( %d n , up);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 20;   int n;   int a[N];   int b[N];   vector<string> ans;   int get(int s, int e) {     int res = 0;     for (int i = s; i < e; ++i) {       res = res * 10 + b[i];     }     return res;   }   string getstr(int x, int y, int z, int l) {     string s =   ;     for (int i = 0; i < x; ++i) {       s += b[i] +  0 ;     }     s +=  . ;     for (int i = x; i < y; ++i) {       s += b[i] +  0 ;     }     s +=  . ;     for (int i = y; i < z; ++i) {       s += b[i] +  0 ;     }     s +=  . ;     for (int i = z; i < l; ++i) {       s += b[i] +  0 ;     }     return s;   }   int check(int x, int y, int z, int l) {     if (x > 3) return 0;     if (y - x > 3) return 0;     if (z - y > 3) return 0;     if (l - z > 3) return 0;     if (b[0] == 0 && x != 1 || b[x] == 0 && y - x != 1 ||         b[y] == 0 && z - y != 1 || b[z] == 0 && l - z != 1) {       return 0;     }     int num[4] = {get(0, x), get(x, y), get(y, z), get(z, l)};     for (int i = 0; i < 4; ++i) {       if (num[i] < 0 || num[i] >= 256) {         return 0;       }     }     return 1;   }   int cntsplit(int l) {     int res = 0;     for (int i = 1; i < l; ++i) {       if (i - 0 > 3) break;       for (int j = i + 1; j < l && j <= i + 3; ++j) {         if (j - i > 3) break;         for (int k = j + 1; k < l && k <= j + 3; ++k) {           if (k - j > 3) break;           if (check(i, j, k, l)) {             ans.push_back(getstr(i, j, k, l));             ++res;           }         }       }     }     return res;   }   int cnt(int d) {     int l = 2 * d;     int res = 0;     for (int i = 0; i < d; ++i) {       b[l - i - 1] = b[i];     }     res += cntsplit(l);     --l;     for (int i = 0; i < d - 1; ++i) {       b[l - i - 1] = b[i];     }     res += cntsplit(l);     return res;   }   void dfs(int d, int msk) {     if (msk == (1 << n) - 1) {       cnt(d);     }     if (d >= 6) return;     for (int i = 0; i < n; ++i) {       b[d] = a[i];       dfs(d + 1, msk | (1 << i));     }   }   int main() {     scanf( %d , &n);     for (int i = 0; i < n; ++i) {       scanf( %d , a + i);     }     if (n > 6) {       puts( 0 );       return 0;     }     dfs(0, 0);     printf( %d n , ans.size());     for (int i = 0; i < ans.size(); ++i) {       printf( %s n , ans[i].c_str());     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 5e3 + 9;   const int M = 5e4 + 9;   long long read() {     long long x = 0, op = 1;     char c = getchar();     while (!isdigit(c)) {       if (c ==  - ) op = -1;       c = getchar();     }     while (isdigit(c)) x = x * 10 + c - 48, c = getchar();     return x * op;   }   signed main() {     int T = read();     while (T--) {       int n = read();       if (n & 1) n--;       cout << n / 2 + 1 <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int fx[8] = {0, -1, -1, -1, 0, 1, 1, 1};   const int fy[8] = {1, 1, 0, -1, -1, -1, 0, 1};   const int maxn = 310;   int vis[maxn][maxn][8][30];   int v[maxn][maxn];   int step[40];   queue<pair<int, int> > q;   pair<int, int> mkstate(int x, int y, int d, int t) {     return make_pair(x * 10000 + y, d * 10000 + t);   }   int main() {     int n;     cin >> n;     for (int i = 0; i < n; i++) cin >> step[i];     while (!q.empty()) q.pop();     q.push(mkstate(155, 155, 0, 0));     vis[155][155][0][0] = true;     while (!q.empty()) {       pair<int, int> t = q.front();       q.pop();       int x = t.first / 10000;       int y = t.first % 10000;       int d = t.second / 10000;       int th = t.second % 10000;       for (int i = 0; i < step[th]; i++) {         v[x + fx[d] * i][y + fy[d] * i] = 1;       }       int nx = x + fx[d] * (step[th] - 1);       int ny = y + fy[d] * (step[th] - 1);       int d1 = (d + 1) % 8;       int x1 = nx + fx[d1];       int y1 = ny + fy[d1];       int d2 = (d - 1 + 8) % 8;       int x2 = nx + fx[d2];       int y2 = ny + fy[d2];       pair<int, int> t1 = mkstate(x1, y1, d1, th + 1);       pair<int, int> t2 = mkstate(x2, y2, d2, th + 1);       if (th + 1 < n && !vis[x1][y1][d1][th + 1]) {         q.push(t1);         vis[x1][y1][d1][th + 1] = true;       }       if (th + 1 < n && !vis[x2][y2][d2][th + 1]) {         q.push(t2);         vis[x2][y2][d2][th + 1] = true;       }     }     int ans = 0;     for (int i = 0; i < maxn; i++) {       for (int j = 0; j < maxn; j++) {         if (v[i][j]) ans++;       }     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void exitall() {     cout << -1;     exit(0);   }   int main() {     ios::sync_with_stdio(false);     int n;     long long d;     cin >> n >> d;     vector<long long> v(n);     for (int i = 0; i < n; ++i) {       cin >> v[i];     }     long long mx = 0;     int ans = 0;     int lst = -1;     long long b = 0;     for (int i = 0; i < n; ++i) {       if (v[i] == 0) {         if (lst >= 0) {           if (b >= 0) continue;           if (-b <= d - mx) {             mx -= b;             b = 0;           } else {             ans++;             b = 0;             lst = i;             mx = 0;           }         } else {           if (b < 0) {             ans++;             b = 0;             mx = 0;             lst = i;           }         }       } else         mx = max(mx, b = b + v[i]);       if (b > d) {         cout << -1;         return 0;       }     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     vector<pair<int, int> > v;     for (int i = (int)0; i < (int)(n); i++) {       int second = 0;       int a;       for (int j = (int)0; j < (int)(4); j++) {         cin >> a;         second += a;       }       v.push_back(make_pair(-second, i));     }     sort(v.begin(), v.end());     for (int i = (int)0; i < (int)(n); i++)       if (v[i].second == 0) cout << i + 1 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char s[10000];   int main() {     int n;     cin >> n;     for (int i = 1; i <= n; ++i) {       cin >> s;       bool t = 0;       for (int i = 1; s[i]; ++i) {         if (!isdigit(s[i]) && isdigit(s[i - 1])) {           t = 1;           break;         }       }       if (t == 0) {         int c = 0, j;         for (j = 0; !isdigit(s[j]); ++j) {           c = 26 * c + s[j] -  A  + 1;         }         int r = 0;         for (; s[j]; ++j) {           r = 10 * r + s[j] -  0 ;         }         cout <<  R  << r <<  C  << c << endl;       } else {         int r = 0;         int j;         for (j = 1; isdigit(s[j]); ++j) {           r = r * 10 + s[j] -  0 ;         }         int c = 0;         for (++j; s[j]; ++j) {           c = 10 * c + s[j] -  0 ;         }         int z = 0;         while (c) {           s[z++] = c % 26 +  A  - 1;           if (s[z - 1] <  A ) {             s[z - 1] =  Z ;             c = c - 26;           }           c = c / 26;         }         for (int k = z - 1; k >= 0; --k) putchar(s[k]);         cout << r << endl;       }     }     return 0;   }