malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int INF = 1e9 + 7;   const int mod = 1e9 + 7;   long long int powmod(long long int a, long long int b) {     long long int res = 1;     a %= mod;     assert(b >= 0);     for (; b; b >>= 1) {       if (b & 1) res = res * a % mod;       a = a * a % mod;     }     return res;   }   int nxt() {     int x;     scanf( %d , &x);     return x;   }   class FenwickTree {    public:     vector<int> ft;     FenwickTree(int n) { ft.assign(n + 1, 0); }     int rsq(int b) {       int sum = 0;       for (; b; b -= (b & (-b))) sum += ft[b];       return sum;     }     int rsq(int a, int b) { return rsq(b) - (a == 1 ? 0 : rsq(a - 1)); }     void adjust(int k, int v) {       for (; k < (int)ft.size(); k += (k & (-k))) ft[k] += v;     }   };   void cnt(int l, int r) {}   void add(int l) {}   void rmv(int l) {}   int main() {     long long int n, k;     cin >> n >> k;     vector<int> a(n), b(n);     for (int i = 0; i < n; i++) {       a[i] = nxt();       b[i] = a[i];     }     sort((b).begin(), (b).end());     for (int i = 0; i < n; i++) {       a[i] = lower_bound((b).begin(), (b).end(), a[i]) - b.begin() + 1;     }     FenwickTree ft(n), ft2(n);     long long int cnt = 0;     for (int i = 0; i < n; i++) {       cnt += (long long int)ft2.rsq(a[i] + 1, n);       ft2.adjust(a[i], 1);     }     if (cnt <= k) {       printf( %lld n , n * (n - 1) / 2);       return 0;     }     int pr = 0;     long long int tmp = cnt;     cnt = 0;     for (int i = 0; i < n; i++) {       tmp += ft.rsq(a[i] + 1, n);       tmp += ft2.rsq(a[i] - 1);       ft.adjust(a[i], 1);       while (tmp > k && pr <= n - 1) {         tmp -= ft.rsq(a[pr] + 1, n);         tmp -= ft2.rsq(a[pr] - 1);         ft2.adjust(a[pr], -1);         pr++;       }       cnt += max(0LL, n - pr);     }     printf( %lld n , cnt);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int mod = 1000000007;   const int maxn = 1e5 + 15;   const int inf = 1e9;   const int maxe = 200000;   vector<int> vec[maxn];   int small[maxn];   int same[maxn];   int a[maxn];   int N;   void init(int n) {     for (int i = 1; i <= n; i++)       for (int j = i; j <= n; j += i) vec[j].push_back(i);     for (int i = 1; i <= n; i++) {       small[i] = lower_bound(a, a + N, i) - a;       same[i] = upper_bound(a, a + N, i) - a - small[i];     }   }   long long powmod(long long a, long long b, long long mod) {     long long ans = 1;     while (b) {       if (b & 1) ans = ans * a % mod;       a = a * a % mod;       b = b / 2;     }     return ans;   }   int main() {     int maxx = 0;     ;     scanf( %d , &N);     for (int i = 0; i < N; i++) {       scanf( %d , &a[i]);       maxx = max(maxx, a[i]);     }     sort(a, a + N);     init(maxx);     long long sum = 1;     for (int i = maxx; i > 1; i--) {       long long ans = 1;       int len = vec[i].size();       for (int j = 0; j < len - 1; j++) {         int now = vec[i][j];         int next = vec[i][j + 1];         int cnt = small[next] - small[now];         ans = ans * powmod(j + 1, cnt, mod) % mod;       }       int cnt = N - small[vec[i][len - 1]];       ans = ans *             ((powmod(len, cnt, mod) - powmod(len - 1, cnt, mod) + mod) % mod) %             mod;       sum = (sum + ans) % mod;     }     printf( %lld n , sum);   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 100;   vector<int> v[maxn];   int childsNo[maxn];   double expected_finish_time[maxn];   void dfs_calc_number_of_childs(int vert, int par) {     for (int i = 0; i < v[vert].size(); i++) {       int child = v[vert][i];       if (child != par) {         dfs_calc_number_of_childs(child, vert);         childsNo[vert] += childsNo[child];       }     }     childsNo[vert] += 1;   }   void dfs_calc_expected_finish_time(int vert, int par) {     for (int i = 0; i < v[vert].size(); i++) {       int child = v[vert][i];       if (child != par) {         expected_finish_time[child] =             expected_finish_time[vert] + 1 +             (childsNo[vert] - childsNo[child] - 1) / 2.0;         dfs_calc_expected_finish_time(child, vert);       }     }   }   int main() {     int n;     cin >> n;     for (int i = 2; i <= n; i++) {       int p;       cin >> p;       v[p].push_back(i);       v[i].push_back(p);     }     dfs_calc_number_of_childs(1, -1);     expected_finish_time[1] = 1;     dfs_calc_expected_finish_time(1, -1);     for (int i = 1; i <= n; i++) cout << expected_finish_time[i] <<    ;     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char op;   char s[200100];   int n;   int ans;   char c;   int tam;   set<char> good, bad;   set<char>::iterator it;   bool ok = false;   int main() {     scanf( %d , &n);     for (int i = 0; i < n; ++i) {       scanf(  %c %s , &op, s);       tam = strlen(s);       if (!ok) {         if (op ==  . ) {           for (int j = 0; j < tam; ++j) {             good.insert(s[j]);             if (bad.count(s[j])) {               bad.erase(s[j]);             }           }         }         if (op ==  ! ) {           if (bad.size() == 0) {             for (int j = 0; j < tam; ++j) {               if (!good.count(s[j])) {                 bad.insert(s[j]);               }             }             for (char j =  a ; j <=  z ; ++j) {               if (!bad.count(j)) {                 good.insert(j);               }             }           } else {             set<char> aux;             for (int j = 0; j < tam; ++j) {               aux.insert(s[j]);             }             vector<char> rem;             for (it = bad.begin(); it != bad.end(); ++it) {               if (!aux.count(*it)) {                 rem.push_back(*it);               }             }             for (int i = 0; i < rem.size(); ++i) {               bad.erase(rem[i]);               good.insert(rem[i]);             }             for (char j =  a ; j <=  z ; ++j) {               if (!bad.count(j) && !aux.count(j)) {                 good.insert(j);               }             }           }         }         if (op ==  ? ) {           good.insert(s[0]);           if (bad.count(s[0])) {             bad.erase(s[0]);           }         }         if (bad.size() == 1) {           ok = true;           c = *bad.begin();         } else if (good.size() == 25) {           for (char j =  a ; j <=  z ; ++j) {             if (!good.count(j)) {               ok = true;               c = j;               break;             }           }         }       } else {         if (op ==  ! ) ans++;         if (op ==  ?  && i < n - 1) ans++;       }     }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   int x[5001];   int ans[5001][5001];   int init() {     int i, j;     for (i = 1; i <= n; i++) ans[i][1] = x[i];     for (j = 2; j <= n; j++) {       for (i = 1; i + j - 1 <= n; i++)         ans[i][j] = ans[i][j - 1] ^ ans[i + 1][j - 1];     }     for (j = 2; j <= n; j++)       for (i = 1; i + j - 1 <= n; i++)         ans[i][j] = max(max(ans[i][j], ans[i][j - 1]), ans[i + 1][j - 1]);     return 0;   }   int main() {     int i;     cin >> n;     for (i = 1; i <= n; i++) cin >> x[i];     init();     int j, k, p, q;     cin >> k;     while (k--) {       cin >> p >> q;       cout << ans[p][q - p + 1] << endl;     }     return 0;   }
#include<bits/stdc++.h>   #define ll long long   #define ull unsigned long long   #define pii pair<int,int>   using namespace std;   long long mod=1000000007;   ll gcd(ll a, ll b)    {        if (b == 0)            return a;        return gcd(b, a % b);    }    void solve()   {       ll n;cin>>n;       ll a[n];       ll sum=0;       for(int i=0;i<n;i++) cin>>a[i],sum+=a[i];       sort(a,a+n);       ll req=(sum+n-2)/(n-1);      // cout<<req<<   ;       ll ans=req*(n-1);       if(req<a[n-1]) ans=a[n-1]*(n-1);       cout<<ans-sum<<endl;   }   int main()   {       ios_base::sync_with_stdio(false);       cin.tie(0);cout.tie(0);       int t;cin>>t;       while(t--)       {           solve();       }       return 0;   }
#include <bits/stdc++.h>   int inp() {     char c = getchar();     while (c <  0  || c >  9 ) c = getchar();     int sum = 0;     while (c >=  0  && c <=  9 ) {       sum = sum * 10 + c -  0 ;       c = getchar();     }     return sum;   }   struct Node {     int l;     int r;     int id;   } s[200010];   int a[200010];   long long cnt[1000010], ans, res[200010];   bool cmp(Node a, Node b) {     if ((a.l / 450) == (b.l / 450)) {       if ((a.l / 450) & 1) return a.r < b.r;       return a.r > b.r;     }     return a.l < b.l;   }   void add(long long x) {     x = a[x];     ans -= (cnt[x] * cnt[x]) * x;     cnt[x]++;     ans += (cnt[x] * cnt[x]) * x;   }   void del(long long x) {     x = a[x];     ans -= (cnt[x] * cnt[x]) * x;     cnt[x]--;     ans += (cnt[x] * cnt[x]) * x;   }   int main() {     int n = inp();     int m = inp();     for (int i = 1; i <= n; i++) a[i] = inp();     for (int i = 1; i <= m; i++) {       s[i].l = inp();       s[i].r = inp();       s[i].id = i;     }     std::sort(s + 1, s + m + 1, cmp);     int l = 1;     int r = 0;     for (int i = 1; i <= m; i++) {       while (l > s[i].l) add(--l);       while (r < s[i].r) add(++r);       while (l < s[i].l) del(l++);       while (r > s[i].r) del(r--);       res[s[i].id] = ans;     }     for (int i = 1; i <= m; i++) printf( %lld n , res[i]);   }
#include <bits/stdc++.h>   using namespace std;   const int NMAX = 300000;   const double eps = 1e-6;   double sy, a, b;   int n, q;   double L[NMAX], R[NMAX];   double sum[NMAX];   int dcmp(double x, double y) {     if (fabs(x - y) < eps) return 0;     if (x > y) return 1;     return -1;   }   int bin_search(double x) {     int l = 1, r = n, ret = 0;     while (l <= r) {       int mid = (l + r) / 2;       if (dcmp(x, R[mid]) >= 0) {         ret = mid;         l = mid + 1;       } else         r = mid - 1;     }     return ret;   }   int main() {     scanf( %lf%lf%lf , &sy, &a, &b);     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %lf%lf , &L[i], &R[i]);       sum[i] = sum[i - 1] + R[i] - L[i];     }     scanf( %d , &q);     while (q--) {       double x0, y0, x1, x2;       scanf( %lf%lf , &x0, &y0);       if (dcmp(x0, a) == 0)         x1 = a;       else {         double k = (y0 - sy) / (x0 - a);         x1 = a - sy / k;       }       if (dcmp(x0, b) == 0)         x2 = b;       else {         double k = (y0 - sy) / (x0 - b);         x2 = b - sy / k;       }       int r1 = bin_search(x1);       int r2 = bin_search(x2);       double ans = (sum[r2] - sum[r1]);       if (r1 + 1 <= n && dcmp(L[r1 + 1], x1) < 0) ans -= x1 - L[r1 + 1];       if (r2 + 1 <= n && dcmp(L[r2 + 1], x2) < 0) ans += x2 - L[r2 + 1];       printf( %.15lf n , (b - a) * ans / (x2 - x1));     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline long long int gcd(long long int a, long long int b) {     return b ? gcd(b, a % b) : a;   }   inline long long int fast_pow(long long int a, long long int b,                                 long long int mod) {     long long int res = 1;     a %= mod;     while (b > 0) {       if (b & 1) res = res * a % mod;       b >>= 1;       a = a * a % mod;     }     return res;   }   inline bool isPrime(long long int a) {     for (long long int i = 2; i * i <= a; i++)       if (a % i == 0) return 0;     return 1;   }   int n, a, b, c, ans, cnt, anss = INT_MAX;   string person1, likes, person2, temp;   pair<string, string> arr[42];   map<string, int> nametoidx;   vector<string> per;   int main() {     ios::sync_with_stdio(0);     cin.tie(NULL);     nametoidx[ Anka ] = 0;     nametoidx[ Chapay ] = 1;     nametoidx[ Cleo ] = 2;     nametoidx[ Troll ] = 3;     nametoidx[ Dracul ] = 4;     nametoidx[ Snowy ] = 5;     nametoidx[ Hexadecimal ] = 6;     cin >> n;     for (int i = 0; i < n; i++) {       cin >> person1 >> likes >> person2;       arr[i] = make_pair(person1, person2);     }     cin >> a >> b >> c;     for (int i = 0; i < 5; i++) {       for (int j = 0; j < 5 - i; j++) {         int t = max(a / (i + 1), max(b / (j + 1), c / (5 - i - j))) -                 min(a / (i + 1), min(b / (j + 1), c / (5 - i - j)));         temp =   ;         if (anss > t) {           per.clear();           anss = t;           for (int k = 0; k < i + 1; k++) temp +=  0 ;           for (int k = 0; k < j + 1; k++) temp +=  1 ;           for (int k = 0; k < 5 - i - j; k++) temp +=  2 ;           per.push_back(temp);         } else if (anss == t) {           for (int k = 0; k < i + 1; k++) temp +=  0 ;           for (int k = 0; k < j + 1; k++) temp +=  1 ;           for (int k = 0; k < 5 - i - j; k++) temp +=  2 ;           per.push_back(temp);         }       }     }     cout << anss <<    ;     for (int j = 0; j < per.size(); j++) {       temp = per[j];       do {         cnt = 0;         for (int i = 0; i < n; i++) {           if (temp[nametoidx[arr[i].first]] == temp[nametoidx[arr[i].second]])             cnt++;         }         ans = max(ans, cnt);       } while (next_permutation(temp.begin(), temp.end()));     }     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 5, MOD = 1e9 + 7;   const double EPS = 1e-9;   double PI = acos(-1);   double square(long long x) {     double ret = double(x) * double(x);     return ret;   }   vector<pair<double, int> > V;   double deg(double x) { return (x * 180) / PI; }   double mod(double x) {     while (x < 0) x += 2 * PI;     while (x >= 2 * PI) x -= 2 * PI;     return x;   }   int main() {     int n;     long long x0, y0, v, T, d, x, y, r;     cin >> x0 >> y0 >> v >> T;     double dist = v * T;     double start = 0, ans = 0;     int cntr = 0;     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> x >> y >> r;       x -= x0, y -= y0;       double d = sqrt(square(x) + square(y));       if (d <= r) {         cout <<  1.000000000 n ;         return 0;       }       if (dist >= d - r) {         double angle;         if (square(x) + square(y) - square(r) <= square(dist))           angle = asin(r / d);         else           angle = acos((square(dist) + square(x) + square(y) - square(r)) /                        (2 * dist * d));         angle += EPS;         double slope = atan2(y, x);         double a = mod(slope - angle), b = mod(slope + angle);         V.push_back({a, 1});         V.push_back({b, -1});         if (a > b) cntr++;       }     }     sort(V.begin(), V.end());     for (auto v : V) {       if (v.second == 1) {         if (cntr == 0) start = v.first;         cntr++;       } else {         if (cntr == 1) ans += (v.first - start);         cntr--;       }     }     if (cntr > 0) ans += 2 * PI - start;     ans = ans / (2 * PI);     cout << setprecision(10) << fixed << ans << endl;   }
#include <bits/stdc++.h>   long long CMB[50][50];   void computeCMB() {     for (long long i = 0; i < 50; ++i) {       CMB[i][0] = 1;       for (long long j = 1; j <= i; ++j) {         CMB[i][j] = CMB[i - 1][j - 1] + CMB[i - 1][j];       }     }   }   long long n;   long long pathsFrom(long long i, long long j) {     long long steps = (n - i) + (n - j);     long long v = (n - i);     return CMB[steps][v];   }   long long V[25 + 1][25 + 1];   long long maxPath(long long x, long long y) {     long long sum = 0;     while (x < n) sum += V[x][y], ++x;     while (y < n) sum += V[x][y], ++y;     return sum;   }   long long minCost(long long X, long long Y) {     long long sum = 0;     long long x = 1, y = 1;     while (y < Y) sum += V[x][y], ++y;     while (x < X) sum += V[x][y], ++x;     return sum;   }   int32_t main() {     std::ios_base::sync_with_stdio(false);     std::cin.tie(NULL);     std::cout.tie(NULL);     computeCMB();     std::cin >> n;     for (long long j = n - 1, v = 0; j >= 1; --j) {       for (long long i = 2; i <= n; ++i) {         v += pathsFrom(i, j + 1);         V[i][j] = v - maxPath(i, j + 1) - minCost(i, j);       }     }     for (long long i = 1; i <= n; ++i) {       for (long long j = 1; j <= n; ++j) {         std::cout << V[i][j] <<    ;       }       std::cout << std::endl;       std::cout.flush();     }     long long q;     std::cin >> q;     for (long long i = 0, k; i < q; ++i) {       std::cin >> k;       long long x = 1, y = 1;       long long weight = 0;       for (long long ln = 0; ln < 2 * n - 1; ++ln) {         std::cout << x <<     << y << std::endl;         std::cout.flush();         long long v = maxPath(x, y + 1);         if (y == n || weight + v < k) {           ++x;         } else {           ++y;         }         weight += V[x][y];       }     }     return 0;   }
#include <bits/stdc++.h>   using vi = std::vector<long long int>;   using vvi = std::vector<vi>;   using pii = std::pair<long long int, long long int>;   using vpii = std::vector<pii>;   using vvpii = std::vector<vpii>;   using namespace std;   const long long int N = 2e6 + 10;   const long long int inf = 1e18 + 10;   const long long int M = 1e9 + 7;   const long double Pi = 3.14159265;   long long int n, b, k, x, a[N];   long long int mul(long long int a, long long int b) {     return ((a % M) * (b % M)) % M;   }   long long int add(long long int a, long long int b) {     return ((a % M) + (b % M)) % M;   }   vvi p(vvi a, vvi b) {     vvi x(n, vi(n, 0));     for (long long int i = 0; i <= n - 1; i++)       for (long long int j = 0; j <= n - 1; j++)         for (long long int k = 0; k <= n - 1; k++)           x[i][j] = add(x[i][j], mul(a[i][k], b[k][j]));     return x;   }   vvi matrix_power_final(vvi A, long long int x) {     vvi result(n, vi(n, 0));     for (long long int i = 0; i <= n - 1; i++) result[i][i] = 1;     while (x) {       if (x & 1) result = p(result, A);       A = p(A, A);       x = x / 2;     }     return result;   }   void solve() {     cin >> n >> b >> k >> x;     vvi v(x, vi(x, 0));     for (long long int i = 1; i <= n; i++) {       cin >> a[i];     }     for (long long int i = 1; i <= n; i++) {       for (long long int j = 0; j <= x - 1; j++) {         a[i] %= x;         v[j][(j * 10 + a[i]) % x]++;       }     }     n = x;     v = matrix_power_final(v, b);     cout << v[0][k];   }   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     solve();     long long int xx = 0;     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( O3 )   #pragma GCC optimize( unroll-loops )   #pragma GCC target( avx2 )   using namespace std;   const int MOD = 1000 * 1000 * 1000 + 7;   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int a, b, x1, y1, x2, y2;     cin >> a >> b >> x1 >> y1 >> x2 >> y2;     int x1_ = x1 + y1;     int y1_ = x1 - y1;     int x2_ = x2 + y2;     int y2_ = x2 - y2;     x1 = x1_ / (2 * a);     if (x1_ > 0) x1++;     x2 = x2_ / (2 * a);     if (x2_ > 0) x2++;     y1 = y1_ / (2 * b);     if (y1_ > 0) y1++;     y2 = y2_ / (2 * b);     if (y2_ > 0) y2++;     cout << max(abs(y2 - y1), abs(x1 - x2)) <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<int> a[200005], b;   set<int> c1;   int n, k, p, f[200005], x[200005], c[200005], c2[200005];   int getdeepth(int i) {     for (vector<int>::iterator j = a[i].begin(); j != a[i].end(); j++)       if ((*j) != f[i]) {         f[*j] = i;         int x = getdeepth(*j);         c[i] += c[*j];         if (c[*j] >= k) return x;       }     return i;   }   void getdeepth1(int i) {     for (vector<int>::iterator j = a[i].begin(); j != a[i].end(); j++)       if ((*j) != f[i]) getdeepth1(*j);     if (c2[i]) b.push_back(i), c1.erase(i);   }   int main() {     cin.sync_with_stdio(false);     cout.sync_with_stdio(false);     cin >> n >> k;     for (int i = 1, j, l; i < n; i++) {       cin >> j >> l;       a[j].push_back(l);       a[l].push_back(j);     }     for (int i = 1, j; i <= 2 * k; i++) {       cin >> j;       c[j] = c2[j] = 1;       c1.insert(j);     }     p = getdeepth(1);     getdeepth1(p);     for (set<int>::iterator i = c1.begin(); i != c1.end(); i++) b.push_back(*i);     cout << 1 << endl << p << endl;     for (int i = 0; i < k; i++)       cout << b[i] <<     << b[i + k] <<     << p << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, val[200100], m;   set<pair<int, int> > s[200100];   struct opt {     int tp, x, y;   } q[200100];   inline void read(int &x) {     x = 0;     register char c = getchar();     while (c >  9  || c <  0 ) c = getchar();     while (c >=  0  && c <=  9 )       x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();   }   inline void print(int x) {     if (x <= 9)       putchar( 0  + x);     else       print(x / 10), putchar( 0  + x % 10);   }   void ins(int x, pair<int, int> k) {     while (x) s[x].insert(k), x -= x & -x;   }   void del(int x, pair<int, int> k) {     while (x) s[x].erase(k), x -= x & -x;   }   pair<int, int> ask(int x, pair<int, int> k) {     pair<int, int> res = make_pair(0x3f3f3f3f, 0x3f3f3f3f);     while (x <= m) res = min(res, *s[x].lower_bound(k)), x += x & -x;     return res;   }   int main() {     read(n);     for (register int i = 1; i <= n; i++) {       char str[10];       scanf( %s , str), read(q[i].x), read(q[i].y);       if (str[0] ==  a ) q[i].tp = 1;       if (str[0] ==  r ) q[i].tp = 2;       if (str[0] ==  f ) q[i].tp = 3, q[i].x++, q[i].y++;       val[++m] = q[i].y;     }     sort(val + 1, val + m + 1), m = unique(val + 1, val + m + 1) - val + 1;     for (int i = 1; i <= m; i++) s[i].insert(make_pair(0x3f3f3f3f, 0x3f3f3f3f));     for (register int i = 1; i <= n; i++) {       if (q[i].tp == 1)         ins(lower_bound(val + 1, val + m, q[i].y) - val,             make_pair(q[i].x, q[i].y));       if (q[i].tp == 2)         del(lower_bound(val + 1, val + m, q[i].y) - val,             make_pair(q[i].x, q[i].y));       if (q[i].tp == 3) {         register pair<int, int> tmp =             ask(lower_bound(val + 1, val + m, q[i].y) - val,                 make_pair(q[i].x, q[i].y));         if (tmp == make_pair(0x3f3f3f3f, 0x3f3f3f3f))           putchar( - ), putchar( 1 ), putchar(  n );         else           print(tmp.first), putchar(   ), print(tmp.second), putchar(  n );       }     }     return 0;   }
#include <bits/stdc++.h>   template <typename T, typename U>   inline void swap(T &a, U &b) {     a = a ^ b;     b = a ^ b;     a = a ^ b;   }   inline void swap(int &a, int &b) {     a = a ^ b;     b = a ^ b;     a = a ^ b;   }   inline void swap(long long &a, long long &b) {     a = a ^ b;     b = a ^ b;     a = a ^ b;   }   template <typename T, typename U>   inline void smax(T &a, U b) {     if (b > a) a = b;   }   template <typename T, typename U>   inline void smin(T &a, U b) {     if (b < a) a = b;   }   inline int gcd(int a, int b) {     if (a < b) swap(a, b);     while (b > 0) {       a %= b;       swap(a, b);     }     return a;   }   long long nchose(int a, int b) {     long long ans = 1;     smax(a, b - a);     int p = 2;     for (int i = (b - a + 1); i <= (b); i++) {       ans *= (long long)i;       while (p <= a && ans % p == 0) ans /= p++;     }     return ans;   }   using namespace std;   static long long MOD = 1000000009;   string s, t;   int main() {     cin >> s >> t;     sort(s.begin(), s.end());     for (char &i : s) {       if (i !=  0 ) {         swap(i, s[0]);         break;       }     }     if (s == t) {       cout <<  OK ;     } else {       cout <<  WRONG_ANSWER ;     }   }