{"similarity_score": 0.9373899119295437, "equal_cnt": 14, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 14, "bug_source_code": "/***\n \n                                Bismillahir Rahmanir Rahim\n                                Rabbi Zidni Ilma\n                                Author : Saidur Rahman\n                                Department of CSE, City University, Bangladesh.\n \n***/\n\n#include<bits/stdc++.h>\nusing namespace std;\n\n\ntypedef         long long           ll;\n#define         endl                \"\\n\"\n#define         ff                  first\n#define         sf                  scanf\n#define         pf                  printf\n#define         ss                  second\nconst           int                 MAX=1e8;\n#define         log_out             return 0\n#define         pb                  push_back\n#define         log_in              int main()\n#define         PI                  acos(-1.0)\n#define         vi                  vector<int>\n#define         newline             printf(\"\\n\")\n#define         pri                 pair<int,int>\n#define         sff(a)              scanf(\"%d\",&a)\n#define         NO                  printf(\"NO\\n\")\n#define         no                  printf(\"no\\n\")\n#define         No                  printf(\"No\\n\")\n#define         YES                 printf(\"YES\\n\")\n#define         Yes                 printf(\"Yes\\n\")\n#define         yes                 printf(\"yes\\n\")\n#define         sfl(a)              scanf(\"%lld\",&a)\n#define         sfl(a)              scanf(\"%lld\",&a)\n#define         pff(a)              printf(\"%d\\n\",a)\n#define         pfl(a)              printf(\"%lld\\n\",a)\n#define         sfff(a,b)           scanf(\"%d%d\",&a,&b)\n\n#define         f0(i,b)             for(int i=0;i<(b);i++)\n#define         sfll(a,b)           scanf(\"%lld%lld\",&a,&b)\n#define         sffff(a,b,c)        scanf(\"%d%d%d\",&a,&b,&c)\n#define         clock_start         clock_t tStart = clock()\n#define         sflll(a,b,c)        scanf(\"%lld%lld%lld\",&a,&b,&c)\n#define         input               freopen(\"input.txt\", \"r\", stdin)\n#define         output              freopen(\"output.txt\", \"w\", stdout)\n#define         watch(x)            cout << (#x) << \" is \" << (x) << endl\n#define         show_time           printf(\"Time taken: %.3fs\\n\", (double)(clock() - tStart) / CLOCKS_PER_SEC)\n\nint         ToggleBit (int n, int X)    { return n ^ (1 << X); }\nint         SetBit (int n, int X)       { return n | (1 << X); }\nint         ClearBit (int n, int X)     { return n & ~(1 << X); }\nbool        CheckBit (int n, int X)     { return (bool)(n & (1 << X)); }\n\n\n\n/******************************** Code Starts From Here **********************************/\n\n\nlog_in\n{\n   \n #ifndef ONLINE_JUDGE \n    input;\n    output;\n#endif\n    ll n, m;\n    sfll(n, m);\n    ll mn1=INT_MAX, mn2 = INT_MAX,x;\n    {\n        for (int i = 0; i < n;i++)\n        {\n            sfl(x);\n            mn1 = min(x, mn1);\n        }\n        for (int i = 0; i < m;i++)\n        {\n            sfl(x);\n            mn2 = min(x, mn2);\n        }\n        mn1 != mn2 ? pf(\"%lld%lld\", min(mn1, mn2), max(mn1, mn2)) : pff(mn2);\n    }\n    log_out;\n}\n", "lang": "GNU C++17", "bug_code_uid": "25d607d5a32722ec050b4834f3d54e54", "src_uid": "3a0c1b6d710fd8f0b6daf420255d76ee", "apr_id": "eee4a22fca94e73c8ae7dc4296da0e63", "difficulty": 900, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.4163197335553705, "equal_cnt": 12, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 12, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n\n\ntypedef unsigned long long int lli;\n\nlli gcd(lli a,lli b)\n{\n\tif(a==0)\n\t\treturn b;\n\treturn gcd(b%a,a);\n}\n\nint main()\n{\n\tlli l,r,x,y;\n\tcin>>l>>r>>x>>y;\n\tvector<lli> v;\n\tfor(lli i=l;i<=r;i++)\n\t{\n\t\tv.push_back(i);\n\t}\n\tlli count1=0;\n\tfor(size_t i=0;i<v.size()-1;i++)\n\t{\n\t\tfor(size_t j=i;j<v.size();j++)\n\t\t{\n\t\t\tlli a,b;\n\t\t\ta=v[i];\n\t\t\tb=v[j];\n\t\t\tlli g=gcd(a,b);\n\t\t\tlli lcm=(a*b)/g;\n\t\t\tif(g==x&&lcm==y)\n\t\t\t{\n\t\t\t\tif(a==b)\n\t\t\t\t\tcount1++;\n\t\t\t\telse\n\t\t\t\t\tcount1=count1+2;\n\t\t\t}\n\t\t}\n\t}\n\tcout<<count1<<endl;\n}", "lang": "GNU C++14", "bug_code_uid": "47de7a2c06af05731ff40aeb3eeb2653", "src_uid": "d37dde5841116352c9b37538631d0b15", "apr_id": "9d2ab24ce1bf8ded15a327153e66b6b0", "difficulty": 1600, "tags": ["math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9357429718875502, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "#pragma optimize(\"Ofast\")\n#include<bits/stdc++.h>\n#include<ext/pb_ds/assoc_container.hpp>\nusing namespace std;\nusing namespace __gnu_pbds;\n#define int long long\nconst int inf=0x3f3f3f3f;\nconst double eps=1e-6;\nconst int mod=998244353;\ntypedef long long ll;\nint modpow(int x,int y,int md=mod){if(y==0)return 1;int ret=modpow(x,y>>1,md);ret=(ll)ret*ret%md;if(y&1)ret=(ll)ret*x%md;return ret;}\nint n,k,l;\ngp_hash_table<int,int>Inv;\nint dp[2][2005],c[2005][2005],b[23333],pre[23333],suf[23333],_[23333],sz;\nvoid calc(){\n\tint tmp=1;\n\tpre[0]=1;suf[sz+1]=1;\n\tfor(int i=1;i<=sz;i++)pre[i]=pre[i-1]*b[i]%mod;\n\tfor(int i=sz;i>=1;i--)suf[i]=suf[i+1]*b[i]%mod;\n\tfor(int i=1;i<=sz;i++)tmp=(tmp*b[i])%mod;\n\tint inv=modpow(tmp,mod-2);\n\tfor(int i=1;i<=sz;i++)_[i]=(inv*pre[i-1]%mod*suf[i+1]%mod);\n\tfor(int i=1;i<=sz;i++)Inv[b[i]]=_[i];\n}\ninline int inv(int x){x%=mod;return x?Inv[x]:0;}\ninline void add(int &x,int y){x=(x+y)%mod;}\nsigned main(){\n\tc[0][0]=1;dp[0][0]=1;\n\tcin>>n>>k>>l;\n\tfor(int i=0;i<=n;i++)\n\t\tfor(int j=0;j<=i;j++)\n\t\t\tif(i||j)c[i][j]=((!i?0:c[i-1][j]*(i-j))+(!j?0:c[i][j-1])),c[i][j]%=mod;\n//\twhile(1){int x,y;cin>>x>>y;cout<<c[x][y]<<endl;}\n\tint ans=0;\n\tfor(int i=0;i<=n+n;i++){\n\t\tfor(int j=0;j<=n&&j<=i&&j<=(n+n-i);j++){\n\t\t\tint right=(i-j)/2,left=(i+j)/2;\n\t\t\tleft=n-left;right=n-right;\n\t\t\tint Left=!left?0ll:c[right][left-1],Right=(left==right)?0ll:c[right-1][left]*j;\n\t\t\tLeft%=mod;Right%=mod;\n\t\t\tif(Left+Right)b[++sz]=(Left+Right)%mod;\n\t\t}\n\t}\n\tcalc();\n\tfor(int i=0;i<=n+n;i++){\n\t\tfor(int j=0;j<=n&&j<=i&&j<=(n+n-i);j++){\n\t\t\tif(!dp[i&1][j])continue;\n\t\t\tint right=(i-j)/2,left=(i+j)/2;\n\t\t\tleft=n-left;right=n-right;\n\t\t\tint Left=!left?0ll:c[right][left-1],Right=(left==right)?0ll:c[right-1][left]*j;\n\t\t\tLeft%=mod;Right%=mod;\n\t\t\tadd(dp[(i+1)&1][j+1],dp[i&1][j]*(Left)%mod*inv(Left+Right)%mod);\n\t\t\tif(j)add(dp[(i+1)&1][j-1],dp[i&1][j]*(Right)%mod*inv(Left+Right)%mod);\n\t\t\tif(j>=k)ans+=dp[i&1][j],ans%=mod;\n\t\t}memset(dp[i&1],0,sizeof dp[i&1]);\n\t}\n\tans=ans*l%mod*modpow(n+n+1,mod-2)%mod;\n\tcout<<ans<<endl;\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "93142af11f6d27cc8d420bac5ffbcb11", "src_uid": "c9e79e83928d5d034123ebc3b2f5e064", "apr_id": "c96f9b32bdcdb82d715f66ffb380f10b", "difficulty": 2600, "tags": ["dp", "math", "combinatorics", "probabilities"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9969650986342944, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include <stdio.h>\n#include <iostream>\n#include <algorithm>\n#include <string>\n#include <vector>\n#include <math.h>\n\n#pragma warning (disable:4996)\n\nusing namespace std;\n\nint main()\n{\n\tfreopen(\"input.txt\", \"rt\", stdin);\n\tfreopen(\"output.txt\", \"wt\", stdout);\n\tlong long int n, i, j, c[10], flag;\n\tcin >> n;\n\twhile (n % 10 == 0) {\n\t\tn = n / 10;\n\t}\n\ti = n;\n\tj = 1;\n\twhile (i / 10 != 0) {\n\t\ti = i / 10;\n\t\t++j;\n\t}\n\tc[0] = n % 10;\n\tflag = 0;\n\tfor (i = 1; i < j; ++i) {\n\t\tn = n / 10;\n\t\tc[i] = n % 10;\n\t}\n\tfor (i = 0; i < j / 2 && flag == 0; i++) {\n\t\tif (c[i] != c[j - i - 1]) {\n\t\t\tflag = -1;\n\t\t}\n\t}\n\tif (flag == 0) {\n\t\tcout << \"YES\";\n\t}\n\telse {\n\t\tcout << \"NO\" ;\n\t}\n}", "lang": "MS C++", "bug_code_uid": "d95bb1981c6f312a1fdccdee601bb9e7", "src_uid": "d82278932881e3aa997086c909f29051", "apr_id": "34730b3629c0ec786a5d342ef34b5c35", "difficulty": 900, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.5129265770423992, "equal_cnt": 10, "replace_cnt": 5, "delete_cnt": 5, "insert_cnt": 0, "fix_ops_cnt": 10, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint main()\n{\n    int a,p=0,q=0;\n    cin>>a;\n    string s;\n    for(int i=0;i<a;i++)\n    {\n        cin>>s[i];\n        if(s[i]=='x')\n        {\n            p++;\n        }\n        else\n        {\n            if(p<=2)\n            p=0;\n        }\n    }\n   // cout<<p<<endl;\n   if(p==a)\n   {\n       cout<<a-2<<endl;\n       return 0;\n   }\n    if(p>2&&p<a)\n    {\n        for(int i=1;i<=p;i++)\n        {\n            p=p-i;\n            if(p==2)\n            {\n                cout<<i<<endl;\n            }\n        }\n    }\n    else\n    {\n        cout<<\"0\"<<endl;\n    }\n\n    return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "3999aac1fcfa1c6974bea35bc02b88ad", "src_uid": "8de14db41d0acee116bd5d8079cb2b02", "apr_id": "0ac642d9a824aa55de00ab02c9d0c007", "difficulty": 800, "tags": ["strings", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9127954360228199, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include<iostream>\n#include<vector>\n#include<algorithm>\nusing namespace std;\n\n\nint main() {\n\tint n;\n\tcin >> n;\n\tint a[101],dp[101];\n\tint ones = 0;\n\tfor (int i = 0; i < n; i++) {\n\t\tcin >> a[i];\n\t\tones += a[i];\n\t}\n\tdp[0] = 0;\n\t//Construction of DP\n\tfor (int i = 0; i < n; i++) {\n\t\tif (a[i] == 1)\n\t\t\tdp[i + 1] = dp[i] - 1;\n\t\telse// a[i] == 0\n\t\t\tdp[i + 1] = dp[i] + 1;\n\t}\n\n\t//Kayf mas\n\tint best = 0;\n\tfor (int i = 0; i < n; i++) {\n\t\tfor (int j = i; j < n; j++) {\n\t\t\tint cur = dp[j + 1] - dp[i];\n\t\t\tbest = max(best, cur);\n\t\t}\n\t}\n\n\tcout << best + ones;\n\n\treturn 0;\n}", "lang": "MS C++", "bug_code_uid": "9a1f46e8e2c683de88c474b06605290d", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "apr_id": "fcc61f41a6bd3721821699ffbabbbf5c", "difficulty": 1200, "tags": ["dp", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.3209549071618037, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\nint arr[2];\nstring a[2]={\"\"};\nint main()\n{\n    int x,y;\n    cin>>x>>y;\n    cout<<x/(y*2)<<endl;\n    return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "f09fc90a68978c027b566ad8f1a17f81", "src_uid": "7853e03d520cd71571a6079cdfc4c4b0", "apr_id": "689d29f3a9bd51e6d7f20b75f118559c", "difficulty": 1000, "tags": ["math", "constructive algorithms", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9982035928143712, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <bits/stdc++.h>\n     \n#define all(A) begin(A), end(A)\n#define rall(A) rbegin(A), rend(A)\n#define sz(A) int(A.size())\n#define pb push_back\n#define mp make_pair\n     \nusing namespace std;\n     \ntypedef long long ll;\ntypedef pair <int, int> pii;\ntypedef pair <ll, ll> pll;\ntypedef vector <int> vi;\ntypedef vector <ll> vll;\ntypedef vector <pii> vpii;\ntypedef vector <pll> vpll;\n\nconst int ONES = 1 << 6 + 1;\n\nint n, m;\nint dp[ONES][ONES][ONES][42];\n\nint take (int mask, vi bits) {\n  for (int p: bits) {\n    if (not (0 <= p and p < n)) continue;\n    mask = mask & (~(1 << p));\n  }\n  return mask;\n}\n\nint rec (int mask1, int mask2, int mask3, int pos) {\n  int r = pos / m;\n  int c = pos % m;\n  if (pos == n * m + m - 1) return 0;\n  if (r == n) {\n    return rec(mask2, mask3, (1 << n) - 1, c + 1);\n  }\n  if (dp[mask1][mask2][mask3][pos] != -1) return dp[mask1][mask2][mask3][pos];\n  int ret = INT_MAX;\n  if ((mask1 >> r) & 1) {\n    ret = min(ret, 1 + rec(take(mask1, {r - 1, r, r + 1}), take(mask2, {r}), mask3, pos + m));\n    ret = min(ret, 1 + rec(take(mask1, {r, r + 1, r + 2}), take(mask2, {r + 1}), mask3, pos + m));\n    ret = min(ret, 1 + rec(take(mask1, {r}), take(mask2, {r - 1, r, r + 1}), take(mask3, {r}), pos + m));\n  } else {\n    ret = rec(mask1, mask2, mask3, pos + m);\n  }\n  return dp[mask1][mask2][mask3][pos] = ret;\n}\n\nint main () {\n  ios::sync_with_stdio(false); cin.tie(0);\n  memset(dp, -1, sizeof dp);\n  cin >> n >> m;\n  if (n > m) swap(n, m);\n  if (n == 1) cout << n * m - (m + 2) / 3 << '\\n';\n  else if (n == 2) cout << n * m - (m / 2) - 1 << '\\n';\n  else cout << n * m - rec((1 << n) - 1, (1 << n) - 1, (1 << n) - 1, 0) << '\\n';\n  return (0);\n}\n", "lang": "GNU C++14", "bug_code_uid": "b3364816e3c9ec436d79e5c77a0ecf35", "src_uid": "097674b4dd696b30e102938f71dd39b9", "apr_id": "c43fcdeb566132970b3ae3043b6c4da1", "difficulty": 2100, "tags": ["dp", "bitmasks", "dsu"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.3701923076923077, "equal_cnt": 13, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 13, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint main()\n{\n        int a,b,c,d,x,y;\n        cin>>a>>b>>c>>d>>x>>y;\n      if(c%(a+x)==0 &&d%(b+y)==0)\n   return cout<<\"YES\"<<endl,0;\nelse       if(c%(a+x)==0 &&d%(b-y)==0)\n  return cout<<\"YES\"<<endl,0;\nelse       if(c%(a-x)==0 &&d%(b+y)==0)\n   return cout<<\"YES\"<<endl,0;\n         if(c%(a-x)==0 &&d%(b-y)==0)\nreturn  cout<<\"YES\"<<endl,0;\nelse cout<<\"NO\"<<endl;\n\n\n}\n", "lang": "GNU C++14", "bug_code_uid": "3503376bed93d1e93d7dc3875ed92016", "src_uid": "1c80040104e06c9f24abfcfe654a851f", "apr_id": "f2b52683f60324dc2591e6339cd63d2d", "difficulty": 1200, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9952153110047847, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include<iostream>\n#include<algorithm>\nusing namespace std;\n\nint n,i,r,m;\n\nint main()\n{cin>>n;\n for(i=2;i<=sqrt(n);i++)\n   if(n%i==0){\n     m=min(n/i-n,m);\n     r=i;\n   }\n cout<<r<<' '<<n/r<<endl;\n return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "fcc455e69259626a7e62b133c046b449", "src_uid": "f52af273954798a4ae38a1378bfbf77a", "apr_id": "e3896611969382194e600e5ee328f192", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.7744360902255639, "equal_cnt": 12, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint main()\n{\n\tint n;\n\tcin>>n;\n\tif(n%2==0)\n\tcout<<\"YES\";\n\telse\n\tcout<<\"NO\";\n}", "lang": "GNU C++11", "bug_code_uid": "e651e55a2fbdf64cbb0eb7df50bae1ab", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "53f40443b9652384878f51a8a555cad1", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.584192439862543, "equal_cnt": 15, "replace_cnt": 5, "delete_cnt": 8, "insert_cnt": 2, "fix_ops_cnt": 15, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint main()\n{\n    int a[3],x,y;\n    cin>>a[1]>>a[2]>>a[3];\n    sort(a+1,a+1+4);\n    x=a[2]-a[1];\n    y=a[3]-a[2];\n    cout<<x+y;\n\n}\n\n", "lang": "GNU C++17", "bug_code_uid": "c3a170dceb8a29113c53e6862c5ddb94", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "apr_id": "3112b8890bd809574cd740bb43073a2e", "difficulty": 800, "tags": ["math", "sortings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.27395237216171314, "equal_cnt": 30, "replace_cnt": 18, "delete_cnt": 8, "insert_cnt": 3, "fix_ops_cnt": 29, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n\n#define INF 100000000\n#define MX 500005\n#define MM 200005\nint P[MM], val[MX], root[MX];\nbool chk[300005], vis[MM];\nvector<int> adj[MM], Arr, S[MX];\n\nint N, M, Q;\nint L[MM], R[MM], st[MM], en[MM], pos[MM];\nbool noRoot[MX], op[MX];\n\nstruct Edge {\n\tint s, e;\n\tvoid in() { cin >> s >> e; s --, e --; }\n} E[300005];\n\nvoid dfs(int u, int n) {\n\troot[u] = n;\n\tvis[u] = 1;\n\tS[n].push_back(u);\n\tfor(auto i : adj[u]) if(chk[i] == false) {\n\t\tint v = E[i].s + E[i].e - u;\n\t\tif(!vis[v]) dfs(v, n);\n\t}\n}\n\nint find_root(int u) {\n\tif(root[u] == u) return u;\n\treturn root[u] = find_root(root[u]);\n}\n\nvoid dfs1(int u) {\n\tif(L[u - N] == 0 && R[u - N] == 0) {\n\t\tst[u - N] = Arr.size();\n\t\tfor(auto v : S[u]) Arr.push_back(v);\n\t\ten[u - N] = Arr.size() - 1;\n\t}\n\telse {\n\t\tdfs1(L[u - N]), dfs1(R[u - N]);\n\t\tst[u - N] = min(st[L[u - N] - N], st[R[u - N] - N]);\n\t\ten[u - N] = max(en[L[u - N] - N], en[R[u - N] - N]);\n\t}\n}\n\nstruct WinnerTree {\n\tint v[MX * 4];\n\tint n;\n\tvoid build(int an) {\n\t\tint i;\n\t\tfor (n = 1; n < an; n *= 2);\n\t\tfor (i = 0; i < an; i++) v[n + i] = P[Arr[i]];\n\t\tfor (i = an; i < n; i++) v[n + i] = P[Arr[0]];\n\t\tfor (i = n - 1; i > 0; i--) v[i] = max(v[i * 2], v[i * 2 + 1]);\n\t}\n\tvoid up(int i, int val) {\n\t\ti += n;\n\t\tv[i] = val;\n\t\tfor (i /= 2; i; i /= 2) v[i] = max(v[i * 2], v[i * 2 + 1]);\n\t}\n\tint get(int st, int en) {\n\t\tint rlt = 0;\n\t\tst += n, en += n;\n\t\twhile (st < en) {\n\t\t\tif (st & 1) rlt = max(rlt, v[st]);\n\t\t\tif (en & 1) rlt = max(rlt, v[en - 1]);\n\t\t\tst = (st + 1) / 2;\n\t\t\ten /= 2;\n\t\t}\n\t\treturn rlt;\n\t}\n} WT;\n\nint main() {\n//\tfreopen(\"in.txt\", \"r\", stdin);\n\t\n\tios::sync_with_stdio(0);\n\tcin.tie(0); cout.tie(0);\n\t\n\tcin >> N >> M >> Q;\n\tfor(int i = 0; i < N; i ++) cin >> P[i];\n\tfor(int i = 0; i < M; i ++) {\n\t\tE[i].in();\n\t\tadj[E[i].s].push_back(i);\n\t\tadj[E[i].e].push_back(i);\n\t}\n\tfor(int i = 0; i < Q; i ++) {\n\t\tint tp;\n\t\tcin >> tp >> val[i]; val[i] --;\n\t\top[i] = tp - 1;\n\t\tif(op[i]) chk[val[i]] = 1;\n\t}\n\tfor(int i = 0; i < MX; i ++) root[i] = i;\n\tint n = N;\n\tfor(int i = 0; i < N; i ++) if(!vis[i]) {\n\t\tn ++;\n\t\tdfs(i, n);\n\t}\n\tfor(int i = Q - 1; i >= 0; i --) if(op[i] == 1) {\n\t\tfor(int j = i + 1; op[j] == 0 && j < Q; j ++) {\n\t\t\tint u = val[j];\n\t\t\tval[j] = find_root(u);\n\t\t}\n\t\tint u = E[val[i]].s, v = E[val[i]].e;\n\t\tint rtu = find_root(u), rtv = find_root(v);\n\t\tif(rtu == rtv) continue;\n\t\tn ++;\n\t\tL[n - N] = rtu, R[n - N] = rtv;\n\t\troot[rtu] = n, root[rtv] = n;\n\t\tnoRoot[rtu] = 1, noRoot[rtv] = 1;\n\t}\n\tfor(int i = 0; i < Q && !op[i]; i ++) {\n\t\tint u = val[i];\n\t\tval[i] = find_root(u);\n\t} \n\t\t\n\tfor(int i = N + 1; i <= n; i ++) if(!noRoot[i]) dfs1(i);\n\tassert(Arr.size() == N);\n\tfor(int i = 0; i < N; i ++) pos[P[Arr[i]]] = i;\n\t\t\n\tWT.build(N);\n\tfor(int i = 0; i < Q; i ++) if(op[i] == 0) {\n\t\tint s = st[val[i] - N], e = en[val[i] - N];\n\t\tint ans = WT.get(s, e + 1);\n\t\tcout << ans << endl;\n\t\tif(ans == 0) continue;\n\t\tint p = pos[ans];\n\t\tWT.up(p, 0);\n\t}\n\t\n\treturn 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "7f3ccf363f7e89658180dba3353418c9", "src_uid": "ad014bde729222db14f38caa521e4167", "apr_id": "e41759b6ed043c1949776b02161a4a1f", "difficulty": 2600, "tags": ["dsu", "data structures", "implementation", "graphs", "trees"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.35860159224645205, "equal_cnt": 11, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 10, "bug_source_code": "#include <iostream>\n#include <map>\n#include <vector>\n#include <set>\n#include <cstdio>\n#include <algorithm>\n#include <cstring>\nusing namespace std;\n#define x first\n#define y second\n#define pb push_back\n#define int long long \ntypedef long double ld;\nconst int MAXN = 1e5 + 7;\nint delt[MAXN];\nint a[MAXN];\nint t[4 * MAXN];\nint dp[MAXN];\nint get(int v, int tl, int tr, int l, int r) {\n\tif (tr < l || r < tl)\n\t\treturn 0;\n\telse if (l <= tl && tr <= r)\n\t\treturn t[v];\n\telse {\n\t\tint tm = (tl + tr) / 2;\n\t\treturn max(get(2 * v, tl, tm, l, r), get(2 * v + 1, tm + 1, tr, l, r));\n\t}\n}\nint upd(int v, int tl, int tr, int p, int vl) {\n\tif (tl == tr) \n\t\tt[v] = max(t[v], vl);\n\telse {\n\t\tint tm = (tl + tr) / 2;\n\t\tif (p <= tm)\n\t\t\tupd(2 * v, tl, tm, p, vl);\n\t\telse\n\t\t\tupd(2 * v + 1, tm + 1, tr, p, vl);\n\t\tt[v] = max(t[2 * v], t[2 * v + 1]);\n\t}\n}\nvoid solve() {\n\tint n, m;\n\tcin >> n >> m;\n\tfor (int i = 0; i < n; ++i) {\n\t\tint a, b;\n\t\tcin >> a >> b;\n\t\t--a;\n\t\t++delt[a];\n\t\t--delt[b];\n\t}\n\tint sum = 0, ans = 0;\n\tfor (int i = 0; i < m; ++i) {\n\t\tsum += delt[i];\n\t\ta[i] = sum;\n\t\tdp[i] = 1;\n\t\tif (a[i]) \n\t\t\tdp[i] = get(1, 0, MAXN - 1, 0, a[i]) + 1;\n\t\tupd(1, 0, MAXN - 1, a[i], dp[i]);\n\t\tans = max(ans, dp[i]);\n\t}\n\tcout << ans;\n}\nsigned main() {\n\tfreopen(\"A.in\", \"r\", stdin);\n\tfreopen(\"A.out\", \"w\", stdout);\n\tios_base::sync_with_stdio(false);\n\n\tsolve();\n\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "9acb972321f87c42f94ccf75f750b824", "src_uid": "ce8350be138ce2061349d7f9224a5aaf", "apr_id": "9f08a001c4186c80bc88ba221cf33877", "difficulty": 1900, "tags": ["data structures", "dp", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.7507746790615316, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "#include <bits/stdc++.h>\n\nusing namespace std;\n\n#define forn(i, n) for (int i = 0; i < (n); i++)\n#define pb push_back\n#define sz(a) int(a.size())\n#define x first\n#define y second\n\ntypedef long long ll;\ntypedef long double ld;\n\nconst int N = 1e6 + 9;\nconst char C = 'a';\n\nint dp1[N], dp2[N], t[N*4], a[N], op[N], cl[N], mx1[N], mx2[N];\n\nvoid precount(int n) {\n        int cur = 0;\n        forn(i, n) {\n                cur += op[i];\n                a[i] = cur;\n                cur -= cl[i];\n        }\n}\n\nint range_max(int v, int t_l, int t_r, int l, int r) {\n        if (l > r)\n                return 0;\n        if (l == t_l && r == t_r) \n                return t[v];\n        int t_m = (t_l + t_r)/2;\n        return max(range_max(v*2, t_l, t_m, l, min(r, t_m)),\n                range_max(v*2 + 1, t_m + 1, t_r, max(t_m + 1, l), r));\n}\n\nvoid update(int v, int l, int r, int pos, int val) {\n        if (l == r) {\n                t[v] = max(t[v], val);\n                return;\n        }\n        int m = (l + r)/2;\n        if (pos <= m)\n                update(v*2, l, m, pos, val);\n        else\n                update(v*2 + 1, m + 1, r, pos, val);\n        t[v] = max(t[v*2], t[v*2 + 1]);\n}\n\nvoid count_dp(int dp[], int n) {\n        fill(t, t + N*4, 0);\n        forn(i, n) {\n                dp[i] = range_max(1, 0, n - 1, 0, a[i]) + 1;\n                update(1, 0, n - 1, a[i], dp[i]);\n        }\n}\n\nint main() {\n\tios::sync_with_stdio(0);\n        int n, m, l, r, ans = 0;\n        cin >> m >> n;\n        forn(i, m) {\n                cin >> l >> r;\n                l--;\n                r--;\n                op[l]++;\n                cl[r]++;\n        }\n        precount(n);\n        count_dp(dp1, n);\n        reverse(a, a + n);\n        count_dp(dp2, n);\n        mx1[0] = dp1[0];\n        mx2[0] = dp2[0];\n        for (int i = 1; i < n; i++) {\n                mx1[i] = mx1[i - 1];\n                mx2[i] = mx2[i - 1];\n                mx1[i] = max(mx1[i], dp1[i]);\n                mx2[i] = max(mx2[i], dp2[i]);\n        }\n        reverse(mx2, mx2 + n);\n        forn(i, n) {\n                ans = max(ans, mx1[i] + mx2[i] - 1);\n        }\n        cout << ans;\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "549b45e876d9cf2d623a0969bf6a688e", "src_uid": "ce8350be138ce2061349d7f9224a5aaf", "apr_id": "76294c1f1991f47db508986813921d63", "difficulty": 1900, "tags": ["data structures", "dp", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8534975802903652, "equal_cnt": 13, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\n\n#define fi first\n#define se second\n#define all(v) v.begin(), v.end()\n#define sz size()\n#define endl \"\\n\"\n#define pb push_back\n#define pp pop_back\n#define mp make_pair\n#define REP(I,n) for(int I = 0; I < n; I++)\n#define REP_1(I,n) for(int I = 1; I <= n; I++)\n#define w(t) int t; cin>>t; while(t--)\n\n#define MOD 1000000007\n#define INF 1e9 + 7\n\nvoid __print(int x) {cerr << x;}\nvoid __print(long x) {cerr << x;}\nvoid __print(long long x) {cerr << x;}\nvoid __print(unsigned x) {cerr << x;}\nvoid __print(unsigned long x) {cerr << x;}\nvoid __print(unsigned long long x) {cerr << x;}\nvoid __print(float x) {cerr << x;}\nvoid __print(double x) {cerr << x;}\nvoid __print(long double x) {cerr << x;}\nvoid __print(char x) {cerr << '\\'' << x << '\\'';}\nvoid __print(const char *x) {cerr << '\\\"' << x << '\\\"';}\nvoid __print(const string &x) {cerr << '\\\"' << x << '\\\"';}\nvoid __print(bool x) {cerr << (x ? \"true\" : \"false\");}\n\ntemplate<typename T, typename V>\nvoid __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}\ntemplate<typename T>\nvoid __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? \",\" : \"\"), __print(i); cerr << \"}\";}\nvoid _print() {cerr << \"]\\n\";}\ntemplate <typename T, typename... V>\nvoid _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << \", \"; _print(v...);}\n#ifndef ONLINE_JUDGE\n#define debug(x...) cerr << \"[\" << #x << \"] = [\"; _print(x)\n#else\n#define debug(x...)\n#endif\n\ntypedef vector<int> vi;\ntypedef vector<long long> vll;\ntypedef vector<string> vs;\ntypedef map<int,int> mii;\ntypedef map<string,int> msi;\ntypedef map<int,string> mis;\ntypedef set<int> si;\ntypedef set<string> ss;\n\ntypedef long long ll;\n\ntemplate<class T>\nistream &operator>>(istream &in,vector<T> &arr) {\n\tfor(auto &x : arr)\n\t\tin>>x;\n\treturn in;\n}\nbool sortbysec(pair<int,int> a,pair<int,int> b) {\n\tif(a.second == b.second)\n\t\tif(a.first>b.first)\n\t\t\treturn true;\n\t\telse\n\t\t\treturn false;\n\treturn a.second>b.second;\n}\nvoid solve() {\n\tint n;\n\tcin>>n;\n\tlong long int arr[n];\n\tREP(i,n) {\n\t\tcin>>arr[i];\n\t}\n\tbool temp[1000]={false};\n\tsort(arr,arr+n,greater<int>());\n\tlong long int count = 0;\n\tREP(i,n) {\n\t\tif(i==0)\n\t\t\tcount += arr[i];\n\t\telse {\n\t\t\tif(arr[i]==arr[i-1]) {\n\t\t\t\tarr[i]--;\n\t\t\t}\t\n\t\t\tif(temp[arr[i]]==false) {\n\t\t\t\tcount += arr[i];\n\t\t\t\ttemp[arr[i]]=true;\n\t\t\t}\n\t\t}\n\t}\n\tcout<<count<<endl;\n}\nint main() {\n\tios_base::sync_with_stdio(false); \n\tcin.tie(NULL);\n\tsolve();\n}", "lang": "GNU C++17", "bug_code_uid": "6ff228c4a766efb09feefe8774443a60", "src_uid": "3c4b2d1c9440515bc3002eddd2b89f6f", "apr_id": "011036f838b9248135929d6649e7e7ce", "difficulty": 1100, "tags": ["greedy", "sortings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.997002997002997, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include <bits/stdc++.h>\n\nusing namespace std;\ntypedef long long LL;\n\n#define MAXN 2501\n\nvector<int> cache[MAXN];\n\nint main() {\n    //freopen(\"input.txt\", \"rt\", stdin);\n    //freopen(\"output.txt\", \"wt\", stdout);\n    \n    int n;\n    scanf(\"%d\", &n);\n    for (int i = 0; i <= n; i++) {\n        int idx = (i ^ 0);\n        cache[idx].push_back(i);\n    }\n\n    int ans = 0;\n    for (int a = 1; a <= n - 2; a++) {\n        for (int b = a; b <= n-1; b++) {\n            int idx = (a ^ b);\n            //if (a == 3 && b == 5) \n                //printf(\"idx = %d\\n\", idx);\n            for (vector<int>::iterator it = cache[idx].begin();\n                    it != cache[idx].end(); ++it) {\n                int c = *it;\n                //if (a == 3 && b == 5) \n                    //printf(\"%d\\n\", c);\n                if (c >= b && a + b > c) {\n                    //printf(\"%d %d %d\\n\", a, b, c);\n                    ans++;\n                }\n            }\n        }\n    }\n\n    printf(\"%d\\n\", ans);\n    return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "b90e7811b316f45418e8dcdaeb377f93", "src_uid": "838f2e75fdff0f13f002c0dfff0b2e8d", "apr_id": "fd534b5e57db914ccc3967f3c6d517ed", "difficulty": 1300, "tags": ["brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.7982391782831988, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "#include<bits/stdc++.h>\n#define ll long long int\n#define fill(a,v) memset(a,v,sizeof a)\n#define mp make_pair\n#define pb push_back\n#define ff first\n#define ss second\nusing namespace std;\nll i,j,n;\nll vis[2501][2501];\nint main()\n{\n\tios_base::sync_with_stdio(0);\n\tcin.tie(0);\n\tcin>>n;\n\tll ans=0;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tfor(j=1;j<=n;j++)\n\t\t{\n\t\t\tll c=i^j;\n\n\t\t\tif(vis[i][j] || vis[j][i]  || vis[c][i] || vis[i][c] || vis[j][c] || vis[c][j] )\n\t\t\t\tcontinue;\n\n\t\t\tvis[i][j]=1;\n\t\t\tvis[j][i]=1;\n\t\t\tvis[c][i]=1;\n\t\t\tvis[i][c]=1;\n\t\t\tvis[j][c]=1;\n\t\t\tvis[c][j]=1;\n\t\t\tif(c==0 || c>n)\n\t\t\t\tcontinue;\n\t\t\tdouble s,area;\n\t\t\ts=(double)(i+j+c)/2.0;\n\t\t\t//printf(\"%lf\\n\",s);\n\t\t\tarea=sqrt(s*(s-i)*(s-j)*(s-c));\n\t\t\tif(area>0)\n\t\t\t{\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\t}\n\tcout<<ans;\n  return 0;\n  }\n", "lang": "GNU C++11", "bug_code_uid": "c5e4bf6b0cb877b781c2aa07d8d710bd", "src_uid": "838f2e75fdff0f13f002c0dfff0b2e8d", "apr_id": "205c450a994d10f04bb324d475f6868a", "difficulty": 1300, "tags": ["brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8415159345391904, "equal_cnt": 15, "replace_cnt": 9, "delete_cnt": 5, "insert_cnt": 1, "fix_ops_cnt": 15, "bug_source_code": "#include <cassert>\n#include <climits>\n#include <cstring>\n#include <cstdlib>\n#include <cstdio>\n#include <cctype>\n#include <cmath>\n#include <algorithm>\n#include <iostream>\n#include <iomanip>\n#include <sstream>\n#include <string>\n#include <vector>\n#include <deque>\n#include <queue>\n#include <stack>\n#include <set>\n#include <map>\n#define IO ios_base::sync_with_stdio(false); cin.tie(0);\n\nusing namespace std;\n\ndouble l, d, v, g, r, p = 0, t = 0;\nint on[1024], light = 1;\n\nint main() { IO\n  cout << fixed << setprecision(8);\n  \n  cin>>l>>d>>v>>g>>r;\n  \n  on[0] = 1;\n  for (int i = 1, st = 1; i < 1024; ++i) {\n    if (!light) {\n      for (int j = 0; j < r; ++j) {\n        on[i + j] = 0;\n      }\n      i += r - 1;\n    } else {\n      for (int j = 0; j < g; ++j) {\n        on[i + j] = 1;\n      }\n      i += g - 1;\n    }\n    light ^= 1;\n  }\n  t = d / v;\n  int it = (int)(d / v);\n\n  if (it == t) {\n    if (on[it]) {\n      cout << l / v << \"\\n\";\n    } else {\n      cout << t + r + (l - d) / v << \"\\n\";\n    }\n  } else {\n    if (on[it + 1]) {\n      cout << l / v << \"\\n\";\n    } else {\n      double w = r - (t - it);\n      cout << t + w + (l - d) / v << \"\\n\";\n    }\n  }\n  return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "62c6d18171b8d868644098b1004fdd51", "src_uid": "e4a4affb439365c843c9f9828d81b42c", "apr_id": "134efb441fd5fd34f62d4eeb742f7603", "difficulty": 1500, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.3699731903485255, "equal_cnt": 19, "replace_cnt": 12, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 19, "bug_source_code": "#include<iostream>\n#include<cstdio>\n#include<cstring>\nusing namespace std;\nchar  a[105];\nint main()\n{\n\tint i=1,j=1,cun,jishu=1,ge=0;\n\twhile((a[i++]=getchar())!=' ');\n\tfor(;j<=(i-1);)\n\t{\n\t\tfor(int c=j+1;c<=(i-1);c++)\n\t\t{\n\t\t\tif(a[c]!=a[j])\n\t\t\t{\n                j=c;\n                jishu=1;\n                break;\n            }\n\t\t\tif(a[c]==a[j])\n\t\t\t{\n\t\t\t\tjishu+=1;\n\t\t\t}\n\t\t}\n\t\tif(jishu%2==0)\n\t\t{\n\t\t\tge+=1;\n\t\t}\n\t}\n\tcout<<ge<<endl;\n\treturn 0;\n} ", "lang": "GNU C++11", "bug_code_uid": "85c977a782daa57e3d620bf46f0ded12", "src_uid": "8b26ca1ca2b28166c3d25dceb1f3d49f", "apr_id": "015396cafd1dae6079cc18fe85a16cec", "difficulty": null, "tags": ["implementation", "two pointers"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6206373292867982, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n\nint main()\n{\n\tint n,m;\n\tcin>>n>>m;\n\n\tint a[n],b[m];\n\tint amin,bmin;\n\n\tamin=INT_MAX;\n\tbmin=INT_MAX;\n\t//first check for any common\n\tvector<int> v(10,0);\n\n\tfor(int i=0;i<n;i++) \n\t\t{\n\t\t\tcin>>a[i];\n\t\t\tif(a[i]<amin)\n\t\t\t\tamin=a[i];\n\n\t\t\tv[a[i]]=1;\n\n\t\t}\n\n\tfor(int i=0;i<m;i++) \n\t{\n\t\t\tcin>>b[i];\n\t\t\tif(b[i]<bmin)\n\t\t\t\tbmin=b[i];\n\n\t\t\tif(v[b[i]]==1)\n\t\t\t{\n\t\t\t\tcout<<b[i]<<endl;\n\t\t\t\treturn 0;\n\t\t\t}\n\t}\n\n\n\tif(amin==bmin) cout<<amin<<endl;\n\telse if(amin<bmin) cout<<amin<<bmin<<endl;\n\telse cout<<bmin<<amin<<endl;\n\n\n}", "lang": "GNU C++", "bug_code_uid": "db589b2f2f70e1a8cc8e363192d31f7e", "src_uid": "3a0c1b6d710fd8f0b6daf420255d76ee", "apr_id": "a7cbf6f49d37b093f2028f5325d08b80", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.2218370883882149, "equal_cnt": 15, "replace_cnt": 8, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 15, "bug_source_code": "#include <bits/stdc++.h>\n#define N 100002\nusing namespace std;\nint n,m;\nlong long as=0;\n#define P 1000000007\nint main() {\n\tcin>>n>>m;\n\tfor (int i=1;i<=n;i++)\n\t\tfor (int j=1;j<=m;j++) {\n\t\t\tint x=(i+1)/2,y=(j+1)/2;\n\t\t\tas=(as+4LL*(1LL*i*i*j*j%P-2LL*x*y*(i*j-x*y)%P))%P;\n\t\t\t//cout<<i<<' '<<j<<' '<<i*i*j*j-2*x*y*(i*j-x*y)<<endl;\n\t\t}\n\t\n\tfor (int i=1;i<=n;i++)\n\t\tfor (int j=1;j<=m;j++)\n\t\t\tas=(as-4LL*(n-i+1)*(m-j+1)%P*(2LL*__gcd(i,j)-1))%P;\n\tas=1LL*as*((P+1)/2)%P;\n\t//cout<<as<<endl;\n\tint un=0;\n\tfor (int i=0;i<=n;i++)\n\t\tfor (int j=i+2;j<=n;j+=2) ++un;\n\tfor (int i=1;i<=m;i++) {\n\t\tint x=m-i+1;\n\t\tif (i&1) {\n\t\t\tas=(as+2LL*x*un%P*(i+1))%P;\n\t\t}\n\t\telse as=(as+2LL*x*(n*(n+1)/2)%P*(i+1))%P;\n\t}\n\t//cout<<as<<' '<<un<<endl;\n\tint um=0;\n\tfor (int i=0;i<=m;i++)\n\t\tfor (int j=i+2;j<=m;j+=2) ++um;\n\tfor (int i=1;i<=n;i++) {\n\t\tint x=n-i+1;\n\t\tif (i&1) {\n\t\t\tas=(as+2LL*x*um%P*(i+1))%P;\n\t\t}\n\t\telse as=(as+2LL*x*(m*(m+1)/2)%P*(i+1))%P;\n\t}\n\tfor (int i=1;i<=n;i++)\n\t\tfor (int j=1;j<=m;j++)\n\t\t\tif (i%2==0 || j%2==0) as=(as-4LL*(n-i+1)*(m-j+1))%P;//cout<<' '<<n-i+1<<' '<<j<<endl;\n\t//cout<<as<<' '<<um<<endl;\n\tcout<<((as*6LL%P)+P)%P<<endl;\n\treturn 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "faf5218deeb5fa91c1b9446c86461995", "src_uid": "984788e4b4925c15c9c6f31e42f2f8fa", "apr_id": "be513f13c6c85dbd9e2543a90609e0c9", "difficulty": 2500, "tags": ["geometry", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9402756508422665, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "#include<iostream>\nusing namespace std;\nint main()\n{\n   char ch[101],h[]=\"hello\";\n   int i,j,t,k;\n   cin>>ch;\n   t=0;\n   for(i=0;ch[i]!='\\0';i++)\n   {\n      \n      if(ch[i]==h[t])\n      {\n         k=i;\n         t++;\n         while(h[t]!='\\0')\n         {\n         for(j=k+1;ch[j]!='\\0';j++)\n         {\n            if(ch[j]==h[t])\n            {\n               t++;\n               k=j;\n               break;\n            }\n         }\n         }\n         if(h[t]=='\\0')\n         {\n            cout<<\"\\nYES\";\n            break;\n         }\n         \n      }\n   }\n   if(h[t]!='\\0')\n   {\n      cout<<endl<<\"NO\";\n      \n   }\n\n   return 0;\n}", "lang": "GNU C++", "bug_code_uid": "aeccfc9313d1b42a75a14b6a6c2bffbb", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "apr_id": "5950b088e1dd0dc2084856f093439878", "difficulty": 1000, "tags": ["strings", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9820359281437125, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "#include<iostream>\nusing namespace std;\nint main()\n{\n   char ch[101],h[]=\"hello\";\n   int i,j,t,k,c=0;\n   cin>>ch;\n   t=0;\n   for(i=0;ch[i]!='\\0';i++)\n   {\n      \n      if(ch[i]==h[t])\n      {\n         k=i;\n         t++;\n         while(h[t]!='\\0'&&ch[j]!='\\0')\n         {\n            \n         for(j=k+1;ch[j]!='\\0';j++)\n         {\n            if(ch[j]==h[t])\n            {\n               t++;\n               k=j;\n               break;\n            }\n         }\n         }\n         if(h[t]=='\\0')\n         {\n            cout<<\"\\nYES\";\n            break;\n         }\n         \n      }\n   }\n   if(h[t]!='\\0')\n   {\n      cout<<endl<<\"NO\";\n      \n   }\n\n   return 0;\n}", "lang": "GNU C++", "bug_code_uid": "828778a0dd909256b5e002c02eef1457", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "apr_id": "5950b088e1dd0dc2084856f093439878", "difficulty": 1000, "tags": ["strings", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9949341438703141, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include <iostream>\n\nusing namespace std;\nchar s[100005];\nint sol,i,j,cnt[11],used[11];\nint main()\n{\n    cin>>s;\n    for(i=0,j=10;s[i];)\n    {\n        if(s[i]=='?')cnt[10]++;\n        if('A'<=s[i]&&s[i]<='J'&&!used[s[i]-'A'])\n        {\n            cnt[j--]++;\n            used[s[i]-'A']=1;\n        }\n    }\n    if(s[0]<'0'||'9'<s[i]){cnt[10]--;cnt[9]++;}\n    sol=1;\n    for(i=0;i<10;i++)\n        for(;cnt[i];cnt[i]--)sol*=i;\n    cout<<sol;\n    for(;cnt[10];cnt[10]--)cout<<'0';\n    return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "7ee7e479c0193bb9c3aef0c86618e187", "src_uid": "d3c10d1b1a17ad018359e2dab80d2b82", "apr_id": "44b2c5371a96c8ed9bbf45ff402fe682", "difficulty": 1100, "tags": ["greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6890243902439024, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nlong long int factorial(long long int n) {\n    if(n == 1)\n        return 1;\n    else \n        return n * factorial(n-1);\n}\nint main() {\n    long long int n,m;\n    cin>>n>>m;\n    long long int k1 = factorial(n);\n    long long int k2 = factorial(m);\n    if(k1 > k2)\n        cout<<k1;\n    else\n        cout<<k2;\n}", "lang": "GNU C++14", "bug_code_uid": "54111374df27a9c5f91cfd459576a535", "src_uid": "7bf30ceb24b66d91382e97767f9feeb6", "apr_id": "02d4bafff92a898509cf68ca43f49c08", "difficulty": 800, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.7413945278022948, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "#include <bits/stdc++.h>\n\nusing namespace std;\n\nint main() {\n    int ta, tb, a, b, h, m, l, r;\n    char c;\n    cin >> a >> ta;\n    cin >> b >> tb;\n    cin >> h >> c >> m;\n    l = h * 60 + m + 1;\n    r = h * 60 + m + ta - 1;\n    int auto_l = 5 * 60;\n    int auto_r = 5 * 60;\n    int ans = 0;\n    while (1) {\n        int cur_l = auto_r + 1;\n        int cur_r = auto_r + tb - 1;\n        if (max(cur_l, l) <= min(cur_r, r)) {\n            ans++;\n        }\n        auto_r += b;\n        if (auto_r > r) {\n            break;\n        }\n        if (auto_r > 23 * 60 + 59) {\n            auto_r = 0;\n        }\n    }\n    cout << ans << endl;\n}", "lang": "GNU C++11", "bug_code_uid": "ac5f90ed23b673901724f6e6136e8a6f", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "apr_id": "8d41b163361075c5d1ef8642040cfd7c", "difficulty": 1600, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.7246315789473684, "equal_cnt": 20, "replace_cnt": 15, "delete_cnt": 4, "insert_cnt": 0, "fix_ops_cnt": 19, "bug_source_code": "#include <cstdio>\n#include <string.h>\n#include <cmath>\n#include <vector>\ntypedef long long ll;\nconst ll INF=1000000007;\nll m;\nll wei[15];\nll geshu[15];\nll z[10];\nll c(ll a, ll b)\n{\n  ll ans=1;\n  for(ll k=a;k>a-b;k--)\n  {\n    ans=ans*k;\n  }\n  for(ll k=1;k<=b;k++)\n  {\n    ans=ans/k;\n  }\n  return ans;\n}\nll q[15][15];\nll qqq[7];\nll z1=0;\nll b;\nvoid dfs(ll depth)\n{\n  ll k;\n   if(depth<b)\n   {\n    for(ll i=1;i<=6;i++)\n    {\n      qqq[i]++;\n      dfs(depth+1);\n      qqq[i]--;\n    }\n   }\n   else\n   {\n    k=1;\n    int g[10];\n    memset(g,0,sizeof(g));\n    for(ll i=1;i<=6;i++)\n    {\n      g[qqq[i]]++;\n    }\n    for(ll i=0;i<=b;i++)\n    {\n      for(ll j=0;j<g[i];j++)\n      {\n        k=(k*(geshu[i]-j))%INF;\n      }\n    }\n    z1=(z1+k)%INF;\n   }\n}\nll suan(ll a)\n{\n  z1=0;\n  memset(qqq,0,sizeof(qqq));\n  dfs(0);\n  ll k=(geshu[a]*z1)%INF;\n  return k;\n}\nint main()\n{\n  scanf(\"%I64d\",&m);\n  ll s=m;\n  ll num=0;\n  ll w=1;\n  memset(q,0,sizeof(q));\n  memset(geshu,0,sizeof(geshu));\n  memset(z,0,sizeof(z));\n  while(s!=0)\n  {\n    ll k=s%10;\n    wei[w]=k;\n    s=s/10;\n    num++;\n    w++;\n  }\n  for(ll i=1;i<=9;i++)\n  {\n    for(ll j=0;j<=i;j++)\n    {\n      ll a1=ll(pow(double(8),double(i-j)));\n      ll a2=ll(pow(double(2),double(j)));\n      q[i][j]=c(i,j)*a1*a2;\n    }\n  }\n  ll ans=0;\n  ll qian=0; \n  if(m==1000000000)\n  {\n       for(int i=1;i<=9;i++)\n       {\n        wei[i]=9;\n       }\n       num--;\n  }\n  for(int i=num;i>1;i--)\n  {\n    for(int j=0;j<=i;j++)\n    {\n      if(wei[i]>4&&wei[i]<=7)\n      {\n        geshu[j+qian+1]+=q[i-1][j];\n        geshu[j+qian]+=q[i-1][j]*(wei[i]-1);\n      }\n      if(wei[i]>7)\n      {\n        geshu[j+qian+1]+=q[i-1][j]*2;\n        geshu[j+qian]+=q[i-1][j]*(wei[i]-2);\n      }\n      if(wei[i]<=4)\n      {\n        geshu[j+qian]+=q[i-1][j]*(wei[i]);\n      }\n    }\n    if(wei[i]==4||wei[i]==7)\n    {\n      qian++;\n    }\n  } \n      if(wei[1]>=4&&wei[1]<7)\n      {\n        geshu[qian+1]+=1;\n        geshu[qian]+=wei[1];\n      }\n      if(wei[1]>=7)\n      {\n        geshu[qian+1]+=2;\n        geshu[qian]+=(wei[1]-1);\n\n      }\n      if(wei[1]<4)\n      {\n        geshu[qian]+=(wei[1]+1);\n      }\n   if(m==1000000000)\n   {\n    geshu[0]++;\n   }\n  geshu[0]--;\n  for(ll i=1;i<=num;i++)\n  {\n     for(ll j=0;j<i;j++)\n     {\n      b=j;\n     ans=(ans+suan(i))%INF;\n     }\n  }\n  printf(\"%I64d\\n\",ans);  while(1);\n  return 0;\n}", "lang": "GNU C++", "bug_code_uid": "4ba168d0ec901c1e73aee13a57bf4297", "src_uid": "656ed7b1b80de84d65a253e5d14d62a9", "apr_id": "94949e5e5ee48936a50c7917de55a041", "difficulty": 1900, "tags": ["brute force", "dp", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9985443959243085, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\nint main(){\n\tlong double l,d,v,g,r;\n\tcin >> l >> d >> v >> g >> r;\n\tlong double p = d / v;\n\twhile(p >= 0){\n\t\tp = p - (g + r);\n\t}\n\tp += g + r;\n\tif(p <= g)cout << fixed << setprecision(10) << l / v << endl;\n\telse cout << fixed << setprecision(10) << double(r + g - p + (l) / v) << endl; \n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "d351b6c504aadf5b89f001b260202c54", "src_uid": "e4a4affb439365c843c9f9828d81b42c", "apr_id": "857f3ad01a84ece3229fc75413d2dd85", "difficulty": 1500, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.8320926385442514, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "#include <iostream>\n \nusing namespace std;\n \nint main()\n{\n    int n,i,s1=0,s2=0;\n    cin>>n;\n    char a[n];\n    for(i=0;i<n;i++)\n        cin>>a[i];\n    for(i=0;i<n-1;)\n    {\n        if(a[i]=='S' && a[i+1]=='S')\n        {\n            continue;\n            i++;\n        }\n        if(a[i]=='F' && a[i+1]=='F')\n        {\n            continue;\n            i++;\n        }\n        if(a[i]=='S' && a[i+1]=='F')\n        {\n            s1++;\n            i=i+2;\n        }\n        if(a[i]=='F' && a[i+1]=='S')\n        {\n            s2++;\n            i=i+2;\n        }\n    }\n    if(s1>s2)\n        cout<<\"YES\";\n    else\n        cout<<\"NO\";\n    return 0;\n}", "lang": "GNU C++14", "bug_code_uid": "707f49e71842b952b32a3d491e974b69", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "apr_id": "b6af32b3690d71444bdeac3a5469c477", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.06957013574660634, "equal_cnt": 18, "replace_cnt": 16, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 18, "bug_source_code": "#include <iostream>\n#include <stdio.h>\n#include <algorithm>\n#include <vector>\n#include <queue>\nusing namespace std;\n\n#define fi(a,b,c) for(int a=b;a<=c;a++)\n#define fo(a,b,c) for(int a=b;a>=c;a--)\n#define long long long\n#define pii pair<int,int>\n#define mp make_pair\n\nconst int N = 2e6+9;\n\nstruct String{\n  string s;\n  int pos;\n\n  bool operator< (String b) const{\n    if (s.length() < b.s.length())\n      return true;\n    if (s.length() > b.s.length())\n      return false;\n    return (s < b.s) || (s == b.s && pos > b.pos);\n  }\n};\n\nstruct Node{\n  vector<int> pos;\n  Node *p[2];\n\n  Node () {\n    p[0] = p[1] = NULL;\n    pos.clear();\n  }\n} trie;\n\nstruct Position{\n  int cost, pos;\n  Node *pos_trie;\n  Position (){}\n  Position (int cost_, int pos_, Node *pos_trie_){\n    cost = cost_, pos = pos_, pos_trie = pos_trie_;\n  }\n};\n\nstruct Query{\n  int l, r, pos;\n  string s;\n\n  bool operator< (Query b) const{\n    return (s.length() > b.s.length()) || (s.length() == b.s.length() && pos < b.pos);\n  }\n};\n\nstruct IT{\n  int c[N];\n  pii mx[N*4];\n\n  IT(){\n    fi(i,0,N-1)\n      c[i] = 0;\n    fi(i,0,4*N-1)\n      mx[i] = mp(0,0);\n  }\n\n  void Build(int k, int l, int r){\n    if (l == r){\n      mx[k] = mp(c[l],l);\n      return;\n    }\n\n    int mid = l+r>>1;\n    Build(k<<1, l, mid);\n    Build(k<<1|1, mid+1, r);\n    if (mx[k<<1].first > mx[k<<1|1].first)\n      mx[k] = mx[k<<1];\n    else\n      mx[k] = mx[k<<1|1];\n  }\n\n  void Update(int k, int l, int r, int x){\n    if (r < x || x < l) return;\n\n    if (l == r){\n      mx[k] = mp(c[l],l);\n      return;\n    }\n\n    int mid = l+r>>1;\n    Update(k<<1, l, mid, x);\n    Update(k<<1|1, mid+1, r, x);\n    if (mx[k<<1].first > mx[k<<1|1].first)\n      mx[k] = mx[k<<1];\n    else\n      mx[k] = mx[k<<1|1];\n  }\n\n  pii Get(int k, int l, int r, int x, int y){\n    if (r < x || y < l) return mp(0,0);\n\n    if (x <= l && r <= y)\n      return mx[k];\n\n    int mid = l+r>>1;\n    pii res1 = Get(k<<1, l, mid, x, y);\n    pii res2 = Get(k<<1|1, mid+1, r, x, y);\n    if (res1.first > res2.first)\n      return res1;\n    else\n      return res2;\n  }\n} it;\n\nstring str[N];\nint n, q;\nint ans[N];\nString s[N];\nQuery qu[N];\nNode *pc[N];\nNode *pos_zero_trie[N];\nvector<Position> list_[N];\ndeque<int> cango;\n\nvoid Init(){\n  Node *p = &trie;\n  pos_zero_trie[1000001] = &trie;\n  fo(i,1000000,s[1].s.length()){\n    p->p[0] = new Node();\n    p = p->p[0];\n    pos_zero_trie[i] = p;\n  }\n}\n\nvoid Update_List(int x){\n  int len = s[x].s.length();\n  Node *p = pos_zero_trie[len+1];\n  fi(l,0,len-1){\n    int i = len-l;\n    int ch = s[x].s[l]-'0';\n    if (p->p[ch] == NULL)\n      p->p[ch] = new Node();\n    p = p->p[ch];\n    list_[i].push_back(Position(x,s[x].pos,p));\n  }\n}\n\nvoid Add(int x){\n  int len = str[x].length();\n  Node *p = pos_zero_trie[len+1];\n  fi(i,0,len-1){\n    int ch = str[x][i]-'0';\n    p = p->p[ch];\n    p->pos.push_back(x);\n  }\n}\n\nint Find(int l_, int r_, Node *p){\n  if (p->pos.empty()) return -1;\n  int l = -1, r = p->pos.size();\n  while (l+1<r){\n    int mid = l+r>>1;\n    if (p->pos[mid] < l_)\n      l = mid;\n    else\n      r = mid;\n  }\n\n  if (r == p->pos.size() || p->pos[r] > r_)\n    return -1;\n  else\n    return p->pos[r];\n}\n\nint Get(int l, int r, string s, Node *p){\n  fi(i,0,s.length()-1){\n    int ch = s[i]-'0'^1;\n    if (p->p[ch] == NULL || Find(l, r, p->p[ch]) == -1)\n      ch ^= 1;\n    p = p->p[ch];\n  }\n  return Find(l, r, p);\n}\n\nint Get_(int l, int r, string s, Node *p){\n  while (!cango.empty()) cango.pop_back();\n\n  Node *tmpp = p;\n  int len = 0;\n  fi(i,1,s.length()){\n    if (tmpp->p[1] != NULL && Find(l, r, tmpp->p[1]) != -1 && len < s.length())\n      cango.push_back(len);\n    if (tmpp->p[0] == NULL)\n      break;\n    tmpp = tmpp->p[0]; len++;\n  }\n\n  len = 0;\n  fi(i,0,s.length()-1){\n    int ch = s[i]-'0'^1;\n    if (ch == 0 && len != -1){\n      while (!cango.empty() && len >= cango.front())\n        cango.pop_front();\n      if (cango.empty())\n        ch = 1, len = -1;\n    }\n\n    if (ch == 1 || len == -1)\n      if (p->p[ch]\n           == NULL || Find(l, r, p->p[ch]) == -1)\n        ch ^= 1;\n\n    if (ch) len = -1;\n    if (len != -1)\n      len++;\n    p = p->p[ch];\n  }\n\n  return Find(l,r,p);\n}\n\nmain(){\n  cin >> n >> q;\n  fi(i,1,n){\n    cin >> str[i];\n    s[i].s = str[i];\n    s[i].pos = i;\n  }\n\n  sort(s+1,s+1+n);\n  Init();\n\n  fi(i,1,n)\n    Update_List(i);\n  fi(i,1,n)\n    Add(i);\n\n  fi(i,1,q){\n    cin >> qu[i].l >> qu[i].r >> qu[i].s;\n    qu[i].pos = i;\n  }\n  sort(qu+1,qu+1+q);\n\n  fi(i,1,n)\n    pc[i] = NULL;\n\n  int len = 0;\n  fi(i,1,q){\n    if (qu[i].s.length()+1 != len){\n      if (len != 0){\n        fi(j,0,(int)list_[len].size()-1){\n          it.c[list_[len][j].pos] = 0;\n          pc[list_[len][j].pos] = NULL;\n          it.Update(1,1,n,list_[len][j].pos);\n        }\n      }\n\n      len = qu[i].s.length()+1;\n      fi(j,0,(int)list_[len].size()-1){\n        it.c[list_[len][j].pos] = list_[len][j].cost;\n        pc[list_[len][j].pos] = list_[len][j].pos_trie;\n        it.Update(1,1,n,list_[len][j].pos);\n      }\n    }\n\n    if (qu[i].l == qu[i].r){\n      ans[qu[i].pos] = qu[i].l;\n      continue;\n    }\n    pii mx = it.Get(1,1,n,qu[i].l,qu[i].r);\n    if (mx.first != 0)\n      ans[qu[i].pos] = Get(qu[i].l, qu[i].r, qu[i].s, pc[mx.second]);\n    else\n      ans[qu[i].pos] = Get_(qu[i].l, qu[i].r, qu[i].s, pos_zero_trie[len]);\n  }\n\n  fi(i,1,q)\n    cout << ans[i] << \"\\n\";\n}\n", "lang": "GNU C++11", "bug_code_uid": "1a972692eed3bd5f9ce89b75c0af00b2", "src_uid": "185ff90a8b0ae0e2b75605f772589410", "apr_id": "c2184b28c495d992db0aef63ea987af4", "difficulty": 2100, "tags": ["brute force", "dp", "math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.5313092979127134, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "#include<bits/stdc++.h>\n#define ll long long \n#define ld long double\n#define X first\n#define Y second\n#define pb push_back\n#define max_el(x) max_element(x.begin(),x.end())-x.begin()\n#define min_el(x) min_element(x.begin(),x.end())-x.begin()\n#define mp make_pair\n#define endl '\\n'\n#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);\nusing namespace std;\n\nvector<vector<int> > ans;\n\nint f(int a, int b, int c, vector<vector<int> > dp ){\n\tif(a==0 && b==0 && c==0){\n\t\tans = dp;\n\t\treturn 1;\n\t}\n\telse if(a<0 || b<0 || c<0){\n\t\treturn 0;\n\t}\n\telse{\n\t\tvector<vector<int> > tmp;\n\t\ttmp = dp;\n\t\ttmp[0][1]++;\n\t\tint k = f(a-1,b-1,c,tmp);\n\t\ttmp= dp;\n\t\ttmp[1][2]++;\n\t\tk= max(k,f(a,b-1,c-1,tmp));\n\t\ttmp = dp;\n\t\ttmp[2][0]++;\n\t\tk = max(k,f(a-1,b,c-1,tmp)); \n\t\treturn k;\n\t}\n}\n\nint main(){\n\tint a,b,c;\n\tcin>>a>>b>>c;\n\tvector<vector<int> > dp(3,vector<int>(3));\n\tif(f(a,b,c,dp)==1){\n\t\tcout<<ans[0][1]<<\" \"<<ans[1][2]<<\" \"<<ans[2][0]<<endl;\n\t}\n\telse{\n\t\tcout<<\"Impossible\\n\";\n\t}\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "38ec802cecd464184c4cf06864561a16", "src_uid": "b3b986fddc3770fed64b878fa42ab1bc", "apr_id": "e4ee36593ad657d89009d87297f3c96c", "difficulty": 1200, "tags": ["graphs", "math", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6051136363636364, "equal_cnt": 10, "replace_cnt": 4, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "#include<bits/stdc++.h>\n#define ll long long \n#define ld long double\n#define X first\n#define Y second\n#define pb push_back\n#define max_el(x) max_element(x.begin(),x.end())-x.begin()\n#define min_el(x) min_element(x.begin(),x.end())-x.begin()\n#define mp make_pair\n#define endl '\\n'\n#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);\nusing namespace std;\n\nint u,v,w;\n\nint f(int a, int b, int c, int x, int y, int z){\n\tif(a==0 && b==0 && c==0){\n\t\tu = x;v=y;w=z;\n\t\treturn 1;\n\t}\n\telse if(a<0 || b<0 || c<0){\n\t\treturn 0;\n\t}\n\telse{\n\t\tint k = f(a-1,b-1,c,x+1,y,z);\n\t\tk= max(k,f(a,b-1,c-1,x,y+1,z));\n\t\tk = max(k,f(a-1,b,c-1,x,y,z+1)); \n\t\treturn k;\n\t}\n}\n\nint main(){\n\tint a,b,c;\n\tcin>>a>>b>>c;\n\t\n\tif(f(a,b,c,0,0,0)==1){\n\t\tcout<<u<<\" \"<<v<<\" \"<<w<<endl; \n\t}\n\telse{\n\t\tcout<<\"Impossible\\n\";\n\t}\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "0ccc12dace5e42efad9fc7c23507c509", "src_uid": "b3b986fddc3770fed64b878fa42ab1bc", "apr_id": "e4ee36593ad657d89009d87297f3c96c", "difficulty": 1200, "tags": ["graphs", "math", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.7176470588235294, "equal_cnt": 15, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 14, "bug_source_code": "#include<iostream>\n#include<algorithm>\nusing namespace std;\nint main()\n{\n\tint a[3],s=0;\n\tcin>>a[1]>>a[2]>>a[3];\n\tsort(a+1,a+4);\n\ts+=a[2]-a[1];\n\ts+=a[3]-a[2];\n\treturn 0;\n}", "lang": "GNU C++", "bug_code_uid": "918e5116d2b607376d43b032c7bb8c3d", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "apr_id": "4128a9edc44666353c506abff2ff341f", "difficulty": 800, "tags": ["math", "sortings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6136783733826248, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "#include<iostream>\n#include<algorithm>\nusing namespace std;\nlong long reflection(long long a){\n\tint argham;\n\tlong long ref;\n\tfor(long long i=1;i<1000000000;i*=10){\n\t\tif(a>=i)\n\t\t\tcontinue;\n\t\telse{\n\t\t\tref=i-1;\n\t\t\tbreak;\n\t\t}\n\n\t}\n\treturn ((ref-a)*a);\n}\nint main(){\n\tint i,t,m,n,j,k;\n\tlong long l,r;\n\tlong long maxx=0;\n\tcin>>l>>r;\n\tfor(i=l;i<=r;i++){\n\t\tmaxx=max(maxx,reflection(i));\n\t}\n\tcout<<maxx<<endl;\n}", "lang": "MS C++", "bug_code_uid": "949cae460f6f6b127ba4912c29c5e8ad", "src_uid": "2c4b2a162563242cb2f43f6209b59d5e", "apr_id": "924b9d52ba599bd2c07c89ffc8c984dd", "difficulty": 1600, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9453590192644483, "equal_cnt": 17, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 17, "bug_source_code": "#include<bits/stdc++.h>\n \n#define X first\n#define Y second\n#define eb push_back\n#define pb pop_back\n#define mp make_pair\n#define siz(a) int(a.size())\n//for traversing the container (bcoz we cannot access linked list etc with direct index)\n//c stands for container and it for iterator\n#define tr(c, it) \\\n\t\tfor(typeof(c.begin()) it=c.begin() ; it != c.end() ; it++)\n\t\t\n#define all(c) c.begin(), c.end()\n#define present(container, element) (container.find(element) != container.end()) //whether the element is present in the container\n \n#define trace2(x, y)             cout <<#x<<\": \"<<x<<\" | \"<<#y<<\": \"<<y<< endl;\n#define trace3(x, y, z)          cout <<#x<<\": \"<<x<<\" | \"<<#y<<\": \"<<y<<\" | \"<<#z<<\": \"<<z<<endl;\n#define trace4(a, b, c, d)       cout <<#a<<\": \"<<a<<\" | \"<<#b<<\": \"<<b<<\" | \"<<#c<<\": \"<<c<<\" | \"<<#d<<\": \"<<d<<endl;\n#define trace5(a, b, c, d, e)    cout <<#a<<\": \"<<a<<\" | \"<<#b<<\": \"<<b<<\" | \"<<#c<<\": \"<<c<<\" | \"<<#d<<\": \"<<d<<\" | \"<<#e<<\": \"<<e<<endl;\n#define scan(x) scanf(\"%lld\", &x)\n#define print(x) printf(\"%lld\", x)\n#define pN printf(\"\\n\");\n//#define mod (((ll)1000000000) * ((ll)1000000000))\nusing namespace std;\n \ntypedef   long long  int ll;\ntypedef unsigned long long int ull;\ntypedef vector < int > vi;\ntypedef vector < vi > vvi;\ntypedef vector < ll > vll;\ntypedef vector < vll > vvll;\ntypedef pair < int , int > ii;\nconst ll mod=1e9+7;\nconst ll mod2=1e9+9;\nconst ll maxn = 1e6+10;\nconst int root=1e7+5;\nconst long long inf = 1e18 + 18;\ndouble pie4=3.1415926535;\n//dont do silly mistake as always-\n//1-read question properly(dont miss single line)\n//2-check maximum array size\t \n//3-int or long long int or ull or sort(a+1,a+n+1)-indexing\n//4-do u understand question correctly(shampoo)?\n//5-MOST IMP-BE CALM YOU CAN DO:)\n//6-think edge case or corner case before submitting.\nll a[40] ;\nvector<ll>v,v1 ;\n\t\n\t\nint main() {\n\t\n\tll n,m,i,j,ans=0,x ;\n\t\n\t\n\tios_base::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);\n\t\n\tcin >> n >> m ;\n\t\n\tfor(i=0;i<n;i++){\n\t\t\n\t\tcin >>a[i] ;\n\t\t\n\t\ta[i]%=m ;\n\t}\n\t\n\tx = min(n,ll(20));\n\t\n\tfor(i=1;i<(1<<x);i++){\n\t\t\n\t\tans = 0 ;\n\t\tfor(j=0;j<x;j++){\n\t\t\t\n\t\t\tif(i & 1<<j){\n\t\t\tans+=a[j];\n\t\t\tans%=m ;\n\t\t}\n\t\t\n\t//\ttrace2(i,ans);\n\t\tv.eb(ans);\n\t}\n}\t\t\n\t\tx = max(ll(0),n-x);\n\n\t\tfor(i=1;i<(1<<x);i++){\n\t\t\n\t\tans = 0 ;\n\t\t\n\t\tfor(j=0;j<x;j++){\n\t\t\t\n\t\t\tif(i & 1<<j){\n\t\t\tans+=a[j];\n\t\t\tans%=m ;\n\t\t}\n\t\t\n\t\tv1.eb(ans);\n\t}\n    }\n    \n    v.eb(0);\n    v1.eb(0);\n    \n    sort(v.begin(),v.end());\n\tsort(v1.begin(),v1.end());\n\t\n\tv.erase(unique(v.begin(),v.end()),v.end());\n\tv1.erase(unique(v1.begin(),v1.end()),v1.end());\n\t\n\tvector<ll>::iterator it1 ;\n\t\n\tfor(auto it:v){\n\t\t\n\t    it1 = upper_bound(v1.begin(),v1.end(),max(ll(0),m-it-1)) ;\n\t\t\n\t\tif(it1!=v1.begin())\n\t\tit1--;\n\t\t\n\t\tans = max(ans,it + *it1);\n\t}\n\t\n\tfor(auto it:v1){\n\t\t\n\t    it1 = upper_bound(v.begin(),v.end(),max(ll(0),m-it-1)) ;\n\t\t\n\t\tif(it1!=v1.begin())\n\t\tit1--;\n\t\t\n\t\tans = max(ans,it + *it1);\n\t}\t\n\t\n\tcout<<ans<<endl;\n}\n\t\t\n", "lang": "GNU C++11", "bug_code_uid": "ad6fe3ad96d27eeab6cc883aa8272f35", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "apr_id": "663e2036a87966f45023d875b2b72072", "difficulty": 1800, "tags": ["divide and conquer", "meet-in-the-middle", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.07109252483010978, "equal_cnt": 13, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 13, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\n#define ll long long\nvoid read(int &x)\n{\n\tx=0; char ch=getchar();int sign=1;\n\tfor(;!isdigit(ch);ch=getchar()) if(ch=='-') sign=-1;\n\tfor(;isdigit(ch);ch=getchar()) x=(x<<1)+(x<<3)+ch-48;\n\tx*=sign;\n}\nint n,m,maxx,a[5000],ans,sl[50000000],cnt,sl1[50000000],cnt1;\nmap<ll,int > q1;\nmap<ll,int > q2;\nvoid dfs(int x)\n{\n\tif(x>n/2) \n\t{\n\tif(q1[ans]!=1)\n\t{\n\tsl[++cnt]=ans;\n\tq1[ans]=1;\n\t}\n\treturn;\n\t}\n\tint anss=ans;\n\tans=(ans+a[x])%m;\n\tdfs(x+1);\n\tans=anss;\n\tdfs(x+1);\n}\nvoid dfs1(int x)\n{\n\tif(x>n) \n\t{\n\tif(q2[ans]!=1)\n\t{\n\tsl1[++cnt1]=ans;\n\tq2[ans]=1;\n\t}\n\treturn;\n\t}\n\tint anss=ans;\n\tans=(ans+a[x])%m;\n\tdfs1(x+1);\n\tans=anss;\n\tdfs1(x+1);\n}\nint main()\n{\n\tread(n);read(m);\n\tfor(int i=1;i<=n;i++)\n\tread(a[i]);\n\tdfs(1);\n\tdfs1(n/2+1);\n\tfor(int i=1;i<=cnt;i++)\n\tfor(int j=1;j<=cnt1;j++)\n\t{\n\t\tif((sl[i]+sl1[j])%m>maxx)\n\t\tmaxx=(sl[i]+sl1[j])%m;\n\t}\n\tcout<<maxx;\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "39c9949eec876aceafe1b0a548ac940e", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "apr_id": "aadd4a900f4d18b20dc17109437d1fe4", "difficulty": 1800, "tags": ["divide and conquer", "meet-in-the-middle", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.536969696969697, "equal_cnt": 17, "replace_cnt": 15, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 17, "bug_source_code": "#include <bits/stdc++.h>\n\n#define pb push_back\n#define mp make_pair\n#define F first\n#define S second\n\n#ifndef LOCAL\n#define cerr if(0)cerr\n#endif // LOCAL\n\nusing namespace std;\n\ntypedef unsigned long long ll;\ntypedef vector<int> vi;\ntypedef pair<int, int> pii;\ntypedef long double ld;\n\nconst int INF = int(1e9);\nconst long long INFll = 1ll * INF * INF;\nconst long double ldINF = 1e+018;\nconst long double EPS = 0.000000001;\nconst int base = INF;\nconst int sdx[4] = {0, 1, 0, -1};\nconst int sdy[4] = {1, 0, -1, 0};\n\nint main() {\n    ios_base::sync_with_stdio(0);\n#ifdef LOCAL\n    freopen(\"input.txt\", \"r\", stdin);\n    freopen(\"output.txt\", \"w\", stdout);\n#endif\n    int a, b, x, y;\n    cin >> a >> b >> x >> y;\n    string s;\n    cin >> s;\n    int h = (s[0] - '0') * 10 + (s[1] - '0');\n    int m = (s[3] - '0') * 10 + (s[4] - '0');\n    //cout << h << ' ' << m << endl;\n    int f1 = h + (b / 60);\n    int f2 = m + b % 60;\n    f1 += (f2 / 60);\n    f2 %= 60;\n    f1 %= 24;\n    int cur1 = 5, cur2 = 0;\n    int ans = 0;\n    //cout << f1 << ' ' << f2 << endl;\n    while (cur1 <= f1 || cur2 < f2) {\n        //cout << cur1 << ' ' << cur2 << endl;\n        int t1, t2;\n        t1 = cur1 + (y / 60);\n        t2 = cur2 + y % 60;\n        t1 += (t2 / 60);\n        t2 %= 60;\n        t1 %= 24;\n        bool f = true;\n        if ((t1 > h || (t1 == h && t2 > m)) && (t1 < f1 || (t1 == f1 && t2 < f2)) && t1 >= 5) {\n            ans++;\n           // cout << \"+1\" << endl;\n        }\n        else {\n            if ((cur1 > h || (cur1 == h && cur2 >= m)) && (cur1 < f1 || (cur1 == f1 && cur2 < f2)) && cur1 >= 5) {\n                //cout << \"+1\" << endl;\n                ans++;\n            }\n        }\n        cur1 += (x / 60);\n        cur2 += (x % 60);\n        cur1 += (cur2 / 60);\n        cur2 %= 60;\n        cur1 %= 24;\n    }\n    cout << ans << endl;\n    return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "291cb656a3ec4d58a0bb01860131daac", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "apr_id": "1ec16fca6c3a153d6801b15076d29bfb", "difficulty": 1600, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9975111996017919, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include <algorithm>\n#include <numeric>\n#include <cmath>\n#include <cstdlib>\n#include <cstring>\n#include <ctime>\n#include <iostream>\n#include <sstream>\n#include <map>\n#include <queue>\n#include <set>\n#include <stack>\n#include <string>\n#include <vector>\n#include <stdio.h>\ntypedef long long ll;\n#define mset(a, val) memset(a, val, sizeof(a))\n#define up(i, s, t) for (ll i = (s); i < (t); i += 1)\n#define down(i, s, t) for (ll i = (s); i > (t); i -= 1)\n#define rd1(a) scanf(\"%d\", &a)\n#define rd2(a, b) scanf(\"%d %d\", &a, &b)\n#define rd3(a, b, c) scanf(\"%d %d %d\", &a, &b, &c)\n#define rd4(a, b, c, d) scanf(\"%d %d %d %d\", &a, &b, &c, &d)\n#define pii pair<int, int>\n\nusing namespace std;\nconst int MAXINT = 0x70707070;\nconst ll MAXLONG = (ll) 1 << 60;\nconst int MAXN = 105;\n\nint arr[MAXN];\nint n, k, x;\n\nint calc(int s, int t) {\n\tqueue<pii> qs, qt;\n\tint idx = s;\n\twhile (idx >= 0) {\n\t\tint nxt = idx - 1;\n\t\twhile (nxt >= 0 && arr[nxt] == arr[idx]) nxt --;\n\n\t\tqs.push(make_pair(arr[idx], idx - nxt));\n\t\tidx = nxt;\n\t}\n\n\tidx = t;\n\twhile (idx < n) {\n\t\tint nxt = t + 1;\n\t\twhile (nxt < n && arr[nxt] == arr[idx]) nxt ++;\n\t\t\n\t\tqt.push(make_pair(arr[idx], nxt - idx));\n\t\tidx = nxt;\n\t}\n\n\tint res = 0;\n\twhile (!qs.empty() && !qs.empty()) {\n\t\tpii ps = qs.front(), pt = qt.front();\n\t\tqs.pop();\n\t\tqt.pop();\n\n\t\tif (ps.first != pt.first) break;\n\n\t\tif (ps.second + pt.second < 3) break;\n\n\t\tres += ps.second + pt.second;\n\t}\n\n\treturn res;\n}\n\nint main () {\n    #ifndef ONLINE_JUDGE\n        freopen(\"input.txt\", \"r\", stdin);\n        freopen(\"output.txt\", \"w\", stdout);\n    #endif\n\n\twhile (rd3(n, k, x) != -1) {\n\t\tup(i, 0, n) {\n\t\t\trd1(arr[i]);\n\t\t}\n\n\t\tint idx = 0;\n\t\tint res = 0;\n\t\twhile (idx < n) {\n\t\t\tif (arr[idx] != x) {\n\t\t\t\tidx ++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t\tint nxt = idx + 1;\n\t\t\twhile (nxt < n && arr[nxt] == arr[idx]) nxt ++;\n\n\t\t\tint cntx = nxt - idx;\n\t\t\tif (cntx < 2) {\n\t\t\t\tidx = nxt;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tint once = calc(idx - 1, nxt);\n\t\t\tres = max(res, once + 2);\n\t\t\tidx = nxt;\n\t\t}\n\n\t\tcout << res << endl;\n\t}\n    return 0;\n}", "lang": "MS C++", "bug_code_uid": "95a594650233efd5bb949dbe91ab7d81", "src_uid": "d73d9610e3800817a3109314b1e6f88c", "apr_id": "63a9cd86955266202b86297832af1e91", "difficulty": 1400, "tags": ["brute force", "two pointers"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9988576650673978, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "/*input\n97 31 9984524\n*/\n\n#include <iostream>\n#include <vector>\n#include <cstdio>\n#include <cmath>\n#include <cstring>\n#include <string>\n#include <cassert>\n#include <algorithm>\n#include <cstdlib>\n#include <numeric>\n#include <climits>\n#include <fstream>\n\nusing namespace std;\n\n#define FOR(i, a, b) for (int i = a; i <= b; ++i)\n#define FORA(i, a) for (auto &i : a)\n#define FORB(i, a, b) for (int i = a; i >= b; --i)\n#define SZ(a) ((int) a.size())\n#define ALL(a) begin(a), end(a)\n\ntypedef long long ll;\ntypedef pair<int, int> pii;\ntypedef pair<ll, ll> pll;\ntypedef vector<int> vi;\ntypedef vector<ll> vl;\n#define fi first\n#define se second\n\nconst int MOD = 998244353;\n\n#define div divv\nint add(int a, int b) { a += b; if (a >= MOD) a -= MOD; return a; }\nint sub(int a, int b) { a -= b; if (a < 0) a += MOD; return a; }\nint mul(int a, int b) { return (long long) a * b % MOD; }\nint qpow(int a, int p)\n{\n\tint ans = 1;\n\twhile (p) {\n\t\tif (p & 1) ans = mul(ans, a);\n\t\ta = mul(a, a);\n\t\tp >>= 1;\n\t}\n\treturn ans;\n}\nint inv(int a) { return qpow(a, MOD - 2); }\nint div(int a, int b) { return mul(a, inv(b)); }\n\n// start of code\n\n\nconst int MAXN = 2009;\nint fact[MAXN], invFact[MAXN], pow2[MAXN], N, k, l;\nint nCk(int a, int b) { return mul(fact[a], mul(invFact[a - b], invFact[b])); }\n\nsigned main()\n{\n\tios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);\n\n\tfact[0] = 1; FOR(i, 1, MAXN - 1) fact[i] = mul(fact[i-1], i);\n\tinvFact[MAXN - 1] = inv(fact[MAXN - 1]); FORB(i, MAXN-1, 1) invFact[i-1] = mul(invFact[i], i);\n\tpow2[0] = 1; FOR(i, 1, MAXN - 1) pow2[i] = mul(pow2[i-1], 2);\n\n\tcin >> N >> k >> l;\n\n\tint ans = 0;\n\tFOR(i, 0, 2*N) for (int j = i; j >= k; j -= 2) {\n\t\tif (i + j > 2*N) continue;\n \t\tint x = 1;\n \t\tx = mul(x, nCk(i, j));\n \t\tx = mul(x, nCk(2*N - i, j));\n\t\tx = mul(x, fact[i - j]);\n\t\tx = mul(x, fact[2 * N - j - i]);\n\t\tx = mul(x, fact[j]);\n\t\tx = mul(x, pow2[j]);\n\t\tx = mul(x, invFact[(i - j) / 2]);\n\t\tx = mul(x, invFact[(2 * N - j - i) / 2]);\n\t\t// cout << i << ' ' << j << \": \" << div(mul(fact[N], x), pow2[N]) << endl;\n\t\tans = add(ans, x);\n\t}\n\tans = mul(ans, fact[N]);\n\tans = div(ans, fact[2*N]);\n\tans = div(ans, 2*N + 1);\n\tans = mul(ans, l % MOD);\n\n\tcout << ans << endl;\n\n\treturn 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "a49324b31a1dbe3d1e3a8ac21ac6188e", "src_uid": "c9e79e83928d5d034123ebc3b2f5e064", "apr_id": "91bf3988cf1ce22dbb037f3d5aa354a1", "difficulty": 2600, "tags": ["dp", "math", "combinatorics", "probabilities"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.6353510895883777, "equal_cnt": 17, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 13, "fix_ops_cnt": 16, "bug_source_code": "#include <bits/stdc++.h>\n\nusing namespace std;\n\nint main()\n{\n    int n;\n    cin >> n;\n    vector<int> v(n);\n    vector<int> v2(n);\n    for (int i = 0; i < n; i++)\n        cin >> v[i];\n    bool b = true;\n    int mx,p;\n    for (int i = 1; i < v.size(); i++)\n        if (abs(v[i - 1] - v[i]) > 1)\n        {\n            cout << \"NO\";\n            return 0;\n        }\n    while (b && v.size() > 1)\n    {\n        mx = -1;\n        for (int i = 0; i < v.size(); i++)\n        {\n            v2[i] = v[i];\n            if (v[i] > mx)\n            {\n                mx = v[i];\n                p = i;\n            }\n        }\n        v.clear();\n        for (int i = 0; i < n; i++)\n            if (i != p)\n                v.push_back(v2[i]);\n\n        for (int i = 1; i < v.size(); i++)\n            if (abs(v[i - 1] - v[i]) > 1)\n            {\n                cout << \"NO\";\n                return 0;\n            }\n\n        b = false;\n        for (int i = 1; i < v.size(); i++)\n            if (v[i - 1] > v[i])\n            {\n                b = true;\n            }\n    }\n    cout << \"YES\";\n    return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "45a988fb9609df83a5e9af5737de37b7", "src_uid": "704d0ae50bccaa8bc49319812ae0be45", "apr_id": "4c57d06c88c882f610ecc4f9eb62cf8a", "difficulty": 1600, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9306154449235594, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "#include<iostream>\n\n#ifdef _MSC_VER\n#  include <intrin.h>\n#  define __builtin_popcount __popcnt\nstatic uint32_t __inline __builtin_clz(uint32_t x) {\n\tunsigned long r = 0;\n\t_BitScanReverse(&r, x);\n\treturn (31 - r);\n}\n#endif\n\nusing namespace std;\n\n#define FOR(i, a, b) for(int i = a; i < b; i++)\n#define FORd(i, a, b) for(int i = a; i >= b; i--)\n\nint n, ans;\nchar arr[100 + 5];\n\nint main()\n{\n\tcin >> n;\n\tfor (int i = 0; i < n; i++) cin >> arr[i];\n\n\tarr[n] = '~';\n\n\tint i = 0;\n\twhile (arr[i] != '~') {\n\t\tif (arr[i] == 'L') {\n\t\t\tint j = i + 1;\n\t\t\twhile (arr[j] != '~') {\n\t\t\t\tif (arr[j] == 'R') {\n\t\t\t\t\tarr[i] = ' ';\n\t\t\t\t\tarr[j] = ' ';\n\t\t\t\t\tans += 2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (arr[i] == 'R') {\n\t\t\tint j = i + 1;\n\t\t\twhile (arr[j] != '~') {\n\t\t\t\tif (arr[j] == 'L') {\n\t\t\t\t\tarr[i] = ' ';\n\t\t\t\t\tarr[j] = ' ';\n\t\t\t\t\tans += 2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (arr[i] == 'U') {\n\t\t\tint j = i + 1;\n\t\t\twhile (arr[j] != '~') {\n\t\t\t\tif (arr[j] == 'D') {\n\t\t\t\t\tarr[i] = ' ';\n\t\t\t\t\tarr[j] = ' ';\n\t\t\t\t\tans += 2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (arr[i] == 'D') {\n\t\t\tint j = i + 1;\n\t\t\twhile (arr[j] != '~') {\n\t\t\t\tif (arr[j] == 'U') {\n\t\t\t\t\tarr[i] = ' ';\n\t\t\t\t\tarr[j] = ' ';\n\t\t\t\t\tans += 2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\ti++;\n\t}\n\tcout << ans << endl;\n\n\n\treturn 0;\n}", "lang": "MS C++ 2017", "bug_code_uid": "85d7812d86f5243f2f2eafff3647334f", "src_uid": "b9fa2bb8001bd064ede531a5281cfd8a", "apr_id": "71179123e7adef804415e5cc3ceb3aa7", "difficulty": 1000, "tags": ["greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9976958525345622, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\n\nint main(){\n\tfreopen(\"test.txt\", \"r\", stdin);\n\tint n, a, i, j, arr[26];\n\tdouble ans = 0;\n\tscanf(\"%d\", &n);\n\tfor(i = 0; i < n; i++){\n\t\tscanf(\"%d\", &a);\n\t\tfor(j = 0; j < i; j++){\n\t\t\tif(a == arr[j]){\n\t\t\t\ta--;\n\t\t\t\tif(!a) break;\n\t\t\t\tj = -1;\n\t\t\t}\n\t\t}\n\t\tarr[i] = a;\n\t\t//printf(\"%d \", arr[i]);\n\t\tans += a;\n\t\t//printf(\"%.0f\\n\", ans);\n\t}\n\t//if(ans <= 0) ans = 1;\n\tprintf(\"%.0f\", ans);\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "eac33788b68af98e911156825b40aee8", "src_uid": "3c4b2d1c9440515bc3002eddd2b89f6f", "apr_id": "740568e1bc1a7ffef4fadfd96e17c8cd", "difficulty": 1100, "tags": ["greedy", "sortings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.859375, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 6, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "//two pointers\n#include <bits/stdc++.h>\n#include<iostream>\n#include<string>\nusing namespace std;\n#define f(i,n) for(int i = 0 ; i < n ; i++)\nint main() {\n\t\n\t\n\t\tstring str;\n\t\tgetline(cin,str);\n\t\t\n\t\t\t\n\t\t\n\t\tint count = 0, value = 1, n = str.length();\n\t\t\n\t\tif (n == 1){\n\t\t\t\n\t\t\tcout<<0;\n\t\t\tabort();\n\t\t\t\n\t\t\t}\n\t\t\t\t\n\t\t\tf(i,n){\n\t\t\t\t\n\t\t\t\tif(str[i]==str[i+1]){\n\t\t\t\t\t\n\t\t\t\t\tvalue++;\n\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(str[i]!=str[i+1]){\n\t\t\t\t\t\n\t\t\t\t\tif(value%2==0){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tvalue=1;\n\t\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tvalue=1;\n\t\t\t\t\t\t}\t\n\t\t\t\t\t\n\t\t\t\t\t}\t\n\t\t\t\t\n\t\t\t}\n\t\t\n\t\t\n\t\tcout<<count;\n\t\t\n}\n\n", "lang": "Clang++17 Diagnostics", "bug_code_uid": "e9ae616a8e24d032d702e405aa98e2ce", "src_uid": "8b26ca1ca2b28166c3d25dceb1f3d49f", "apr_id": "9ae6f8619897a8f4237e1af1dd96211f", "difficulty": null, "tags": ["implementation", "two pointers"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.8763808521830615, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "#include <iostream>\n#include<algorithm>\n#include<vector>\n#include<string>\nusing namespace std;\n\nint main()\n{\n    int ne; cin>>ne;\n    string num;\n    vector<int> ans;\n    cin>>num;\n    for(int i=0;i<(int)num.size();++i){\n        ne = (int)num[i]-48;\n        if(ne==1)\n            continue;\n        if((ne%2)!=0)\n            ans.push_back(ne);\n        else{\n            if(ne==6){\n                ans.push_back(3);\n                ans.push_back(5);\n            }else{\n                while(ne%2==0){\n                    ne /=2;\n                    ans.push_back(2);\n                }\n                if(((int)num[i]-48)-1>1)\n                  ans.push_back(((int)num[i]-48)-1);\n            }\n        }\n    }\n    sort(ans.begin(),ans.end(),greater<int>());\n    for(int j=0;j<(int)ans.size();++j){\n        cout<<ans[j];\n    }\n    return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "a5526a95de5c027625231f9766d6afc2", "src_uid": "60dbfc7a65702ae8bd4a587db1e06398", "apr_id": "a6b8e8bceadd44e3e3050e0bb83f14e8", "difficulty": 1400, "tags": ["greedy", "math", "sortings"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.5541855937702791, "equal_cnt": 23, "replace_cnt": 15, "delete_cnt": 1, "insert_cnt": 6, "fix_ops_cnt": 22, "bug_source_code": "// iostream is too mainstream\n#include <cstdio>\n// bitch please\n#include <iostream>\n#include <vector>\n#include <set>\n#include <map>\n#include <string>\n#include <queue>\n#include <stack>\n#include <algorithm>\n#include <cmath>\n#include <iomanip>\n#define dibs reserve\n#define OVER9000 1234567890\n#define patkan 9\n#define tisic 47\n#define soclose 1e-9\n#define pi 3.1415926535898\n#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)\n#define chocolate win\n#define ff first\n#define ss second\n#define abs(x) ((x < 0)?-(x):(x))\n#define uint unsigned int\n// mylittlepony\nusing namespace std;\n\nint main() {\n\tcin.sync_with_stdio(0);\n\tint N,sx,sy,dx,dy,T;\n\tcin >> N >> sx >> sy >> dx >> dy >> T;\n\n\tint dv =dy-dx, dp =sy-sx;\n\tsx--, sy--;\n\tint x1 =sx+sy+2+dx+sx, x2 =sx;\n\tfor(int i =2; i <= T; i++) {\n\t\tint x =4*x1-x2+2+dp+(dv+1)*(i-1);\n\t\tx2 =x1;\n\t\tx1 =x;}\n\tcout << x1%N+1 << \" \" << 1+(x1+dp+T*dv)%N << \"\\n\";\n\treturn 0;}\n\n// look at my code\n// my code is amazing\n", "lang": "GNU C++0x", "bug_code_uid": "0fd49ce371822dc2d1e3635ecf6484c3", "src_uid": "ee9fa8be2ae05a4e831a4f608c0cc785", "apr_id": "013ff5f0f32ae12e1dc5e19c5f4d7679", "difficulty": 2300, "tags": ["matrices", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8970850684116597, "equal_cnt": 12, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 11, "bug_source_code": "#include <algorithm>\n#include <iostream>\n#include <utility>\n#include <cstdlib>\n#include <cstring>\n#include <fstream>\n#include <iomanip>\n#include <cassert>\n#include <vector>                              \n#include <string>\n#include <cstdio>\n#include <cmath>\n#include <queue>\n#include <ctime>\n#include <stack>\n#include <set>                                                          \n#include <map>\n \nusing namespace std;\n \n#define ll long long\n#define ull unsigned ll                                                \n#define inf 1000000000\n#define INF 1000000000000000000ll\n#define mp make_pair                                                                                 \n#define pb push_back                                                 \n#define F first\n#define S second\n\nint n, sx, sy, dx, dy;\nll t;\nvoid add(int &x, int y){\n\tif((x += y) >= n)\n\t\tx -= n;\n}\n\nstruct matrix {\n\tint a[8][8];\n\tvoid clear(){\n\t\tmemset(a, 0, sizeof a);\n\t}\n\tvoid operator *= (matrix &b){\t\n\t\tmatrix c;\n\t\tc.clear();\n\t\tfor(int i = 1;i <= 6;++ i)\t\n\t\t\tfor(int j = 1;j <= 6;++ j)\n\t\t\t\tfor(int k = 1;k <= 6;++ k)\n\t\t\t\t\tadd(c.a[i][j], (a[i][k] * 1ll * b.a[k][j]) % n);\n\t\tfor(int i = 1;i <= 6;++ i)\t\n\t\t\tfor(int j = 1;j <= 6;++ j)\n\t\t\t\ta[i][j] = c.a[i][j];\n\t} \n}res, a;\n\nint main(){\t                      \n//\tfreopen (\"in\",\"r\",stdin);                                   \n//\tfreopen (\"out\",\"w\",stdout);\n\tcin >> n >> sx >> sy >> dx >> dy >> t;\n\t-- sx;\n\t-- sy;\n\ta.a[1][1] = 2; a.a[1][2] = 1; a.a[1][3] = 1; a.a[1][4] = 0; a.a[1][5] = 1; a.a[1][6] = 2;\n\ta.a[2][1] = 1; a.a[2][2] = 2; a.a[2][3] = 0; a.a[2][4] = 1; a.a[2][5] = 1; a.a[2][6] = 2;\n\ta.a[3][1] = 1; a.a[3][2] = 1; a.a[3][3] = 1; a.a[3][4] = 0; a.a[3][5] = 1; a.a[3][6] = 2;\n\ta.a[4][1] = 1; a.a[4][2] = 1; a.a[4][3] = 0; a.a[4][4] = 1; a.a[4][5] = 1; a.a[4][6] = 2;\n\ta.a[5][1] = 0; a.a[5][2] = 0; a.a[5][3] = 0; a.a[5][4] = 0; a.a[5][5] = 1; a.a[5][6] = 1;\n\ta.a[6][1] = 0; a.a[6][2] = 0; a.a[6][3] = 0; a.a[6][4] = 0; a.a[6][5] = 0; a.a[6][6] = 1;\n\tres.clear();\n\tfor(int i = 1;i <= 6;++ i)\n\t\tres.a[i][i] = 1;\n\t-- t;\n\twhile(t){\n\t\tif(t & 1)\n\t\t\tres *= a;\n\t\ta *= a;\n\t\tt >>= 1;\n\t}\n\tint X = 0, Y = 0;\n\tfor(int i = 1;i <= 6;++ i)\n\t\tadd(X, (sx * 1ll * res.a[1][i]) % n);\n\tfor(int i = 1;i <= 6;++ i)\n\t\tadd(Y, (sy * 1ll * res.a[2][i]) % n);\n\tX = (X + n) % n;\n\tY = (Y + n) % n;\n\tprintf(\"%d %d\\n\", Y + 1, X + 1);\n\treturn 0;\n}", "lang": "GNU C++", "bug_code_uid": "ca484a214bcbef9752fc800567c1e584", "src_uid": "ee9fa8be2ae05a4e831a4f608c0cc785", "apr_id": "0dafbf777da6a022df3535fc1cbe02f1", "difficulty": 2300, "tags": ["matrices", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.40816326530612246, "equal_cnt": 22, "replace_cnt": 9, "delete_cnt": 10, "insert_cnt": 3, "fix_ops_cnt": 22, "bug_source_code": "#include<cstdio>\n#include<cstdlib>\n#include<iostream>\n\nusing namespace std;\nint main(){\n\tlong long a[3]={0,1,2},m,n;\n\tfreopen(\"shellgame.in\",\"w\",stdin);\n\tfreopen(\"shellgame.out\",\"r\",stdout);\n\tscanf(\"%lld %lld\",&n,&m);\n\tn=n%6;\n\t\n\twhile(n)\n\t{if(n) \n\t{swap(a[0],a[1]);\n\tn--;}\n\t\t\n\tif(n)\n\t{swap(a[1],a[2]);\n\tn--;}\n\t\t\n\t}\n\tprintf(\"%lld\",a[m]);\n\t\n\t}", "lang": "GNU C++11", "bug_code_uid": "7c5b8d6abb37ff2c6de66c12822c57b0", "src_uid": "7853e03d520cd71571a6079cdfc4c4b0", "apr_id": "b7d02515f92164fa375c6794723ee009", "difficulty": 1000, "tags": ["math", "constructive algorithms", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.43107769423558895, "equal_cnt": 7, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint a[10][10]={{0,1,2},{1,0,2},{1,2,0},{2,1,0},{2,0,1},{0,2,1},{0,1,2}},m,n;\nint main()\n{\n\tscanf(\"%d%d\",&m,&n);\n\tprintf(\"%d\",a[m][n]);\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "0e430d84d2fc0416ea2c5dc84b2aadeb", "src_uid": "7853e03d520cd71571a6079cdfc4c4b0", "apr_id": "e8d07116503c2635222c5e14d6c8c3c7", "difficulty": 1000, "tags": ["math", "constructive algorithms", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6863572433192686, "equal_cnt": 8, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 7, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\n\n\nint main()\n{\n    int n, cnt=0;\n    string str;\n    cin>>n;\n    for(int i=0; i<n; i++)\n    {\n        cin>>str[i];\n    }\n    for(int i=0; i<n; i++)\n    {\n        if(str[i]=='x' && str[i+1]=='x' && str[i+2]=='x')\n        {\n            cnt++;\n        }\n    }\n    cout<<cnt<<endl;\n\n\n    return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "fa3a27fb7e7cd06d231ca4cb0be69d0c", "src_uid": "8de14db41d0acee116bd5d8079cb2b02", "apr_id": "54d35a50d7980c6a9f9c4e5723d30ed7", "difficulty": 800, "tags": ["strings", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.8896396396396397, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "//MSSV 1751086\n//Name Huynh Cong Nguyen\n//Ex Between the Offices\n\n#include <iostream>\nusing namespace std;\n#include <math.h>\n#include <cmath>\n#include <stdlib.h>\nint main()\n{\n  char a,b;\n  int n,i,x,y;\n  cin>>n;\n  i=1;\n  a=0;\n  b=0;\n  while (i<=n)\n  {\n  \tcin>>b;\n  \tif ((a=='S')&&(b=='F'))\n  \tx=x+1;\n  \telse if ((a=='F')&&(b=='S'))\n  \ty=y+1;\n  \ta=b;\n  }\n  if (x>y)\n  cout<<\"YES\";\n  else \n  cout<<\"NO\";\n  }\n  \t\n  \n  \n  \n", "lang": "GNU C++", "bug_code_uid": "f8bfaa124a5a8737128f909f4eeee03c", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "apr_id": "1ac5725df5ee381500e1e39a37abadf7", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9487731381833836, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "#include<string>\n#include<stdio.h>\n#include<string.h>\n#include<algorithm>\n#define N 11000\n#define mod 1000000007\nusing namespace std;\ntypedef long long ll;\nint val[N],L[N],R[N],cnt[4],tot;\nint f[N][4];\nint mex(int x,int y)\n{\n\tif(x!=0&&y!=0)\n\t\treturn 0;\n\tif(x!=1&&y!=1)\n\t\treturn 1;\n\treturn 2;\n}\nint getRK(int x)\n{\n\tint l,r,mid;\n\tl=0,r=0x3f3f3f3f;\n\twhile(l<=r)\n\t{\n\t\tmid=l+r>>1;\n\t\tif(mid-mid/3<=x)\n\t\t\tl=mid+1;\n\t\telse\n\t\t\tr=mid-1;\n\t}\n\treturn r;\n}\nint main()\n{\n\tint n,m,i,j,k,temp,last,ans;\n\tscanf(\"%d%d\",&n,&m);\n\tL[tot=1]=0,R[tot]=2;\n\tm--;\n\tcnt[0]=m+m-1;\n\tfor(i=3,j=1,k=1;i<=m;i=last+1)\n\t{\n\t\t//\u4e0b\u4e00\u4e2aj\uff0c\u4e0b\u4e00\u4e2ak\n\t\tlast=min(m,min(R[j]*3+2,temp=getRK(R[k])));\n\t\tif(last<i)\tcontinue;\n\t\ttot++;\n\t\tL[tot]=i;\n\t\tR[tot]=last;\n\t\tval[tot]=mex(val[j],val[k]);\n\t\tcnt[val[tot]]=(cnt[val[tot]]+(ll)(m-i+1+m-last+1)*(last-i+1)/2%mod)%mod;\n\t\tif(last==R[j]*3+2)\n\t\t\tj++;\n\t\tif(last==temp)\n\t\t\tk++;\n\t}\n\tf[0][0]=1;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tfor(j=0;j<4;j++)\n\t\t{\n\t\t\tfor(k=0;k<4;k++)\n\t\t\t{\n\t\t\t\tf[i][j]+=(ll)f[i-1][k]*cnt[j^k]%mod;\n\t\t\t\tif(f[i][j]>=mod)\n\t\t\t\t\tf[i][j]-=mod;\n\t\t\t}\n\t\t}\n\t}\n\tans=((ll)f[n][1]+f[n][2]+f[n][3])%mod;\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "3aef6fe2230c7da75bd09d4a5c222167", "src_uid": "c03b6379e9d186874ac3d97c6968fbd0", "apr_id": "1087ea93d2b90deb26f52c8ea90e2e8a", "difficulty": 2600, "tags": ["dp", "games"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.7231620039037086, "equal_cnt": 24, "replace_cnt": 18, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 23, "bug_source_code": "#include <cstdio>\n#include <cstdlib>\n#include <cmath>\n#include <algorithm>\n#include <iostream>\n#include <cstring>\n#include <vector>\n#include <string>\n#include <cassert>\n#include <ctime>\n#include <set>\n#include <map>\n\nusing namespace std;\n\n#ifdef WIN32\n\t#define LLD \"%I64d\"\n#else\n\t#define LLD \"%lld\"\n#endif\n\n\ntypedef long long ll;\ntypedef pair<int, int> pii;\ntypedef vector<int> vi;\ntypedef vector<vi> vvi;\ntypedef vector<bool> vb;\ntypedef vector<vb> vvb;\ntypedef vector<ll> vll;\ntypedef vector<vll> vvll;\n\n#define TASKNAME \"text\"\n#define pb push_back\n#define mp make_pair\n#define EPS (1E-9)\n#define INF ((int)1E9)\n#define sqr(x) ((x) * (x))\n#define eprintf(...) fprintf(stderr, __VA_ARGS__)\n#define sz(x) ((int)(x).size())\n    \nconst int maxp = (int)1e3;\nint nym[maxp];\n\nvoid countNyms() {\n\tnym[0] = nym[1] = nym[2] = 0;\n\tfor (int i = 3; i < maxp; i++) {\n\t\tint ns[2] = {nym[i / 3], nym[i - i / 3]};\n\t\tsort(ns, ns + 2);\n\t\tif (ns[0])\n\t\t\tnym[i] = 0;\n\t\telse {\n\t\t\tnym[i] = ns[1] == 1 ? 2 : 1; \n\t\t}\n\t}\n\t\n// \tfor (int i = 1; i < maxp; i++)\n// \t\tprintf(\"%d\\n\", nym[i]);\n}\n\nconst int MOD = (int)1e9 + 7;\nvoid add(int &x, int toadd) {\n\tif ((x += toadd) >= MOD)\n\t\tx -= MOD;\n}\n\nint mult(int a, int b) {\n\treturn (ll)a * b % MOD;\n}\n\nint mpower(int x, int pw) {\n\tint res = 1;\n\tfor (; pw; pw >>= 1) {\n\t\tif (pw & 1)\n\t\t\tres = mult(res, x);\n\t\tx = mult(x, x);\n\t}\n\treturn res;\n}\n\nint inv(int x) {\n\treturn mpower(x, MOD - 2);\n}\n\nconst int maxn = (int)1e3;\nint C[maxn + 1][maxn + 1];\n\nint main() {     \n\t#ifdef DEBUG\n\t\tfreopen(TASKNAME\".in\", \"r\", stdin);\n\t\tfreopen(TASKNAME\".out\", \"w\", stdout);\n\t#endif\n\t\n\tcountNyms();\n\t{\n\t\tmemset(C, 0, sizeof(C));\n\t\tfor (int n = 0; n <= maxn; n++) {\n\t\t\tC[n][0] = C[n][n] = 1;\n\t\t\tfor (int k = 1; k < n; k++)\n\t\t\t\tC[n][k] = C[n - 1][k - 1], add(C[n][k], C[n - 1][k]);\n\t\t}\n\t}\n\t\n\tint n, p;\n\twhile (scanf(\"%d%d\", &n, &p) >= 1) {\n\t\tassert(p <= maxp);\n\t\t\n\t\tint cnt[3] = {0, 0, 0};\n\t\tfor (int i = 1; i < p; i++)\n\t\t\tadd(cnt[nym[i]], p - i);\n\t\teprintf(\"%d %d %d\\n\", cnt[0], cnt[1], cnt[2]);\n\t\t\n\t\tint ans = cnt[0];\n\t\tadd(ans, cnt[1]);\n\t\tadd(ans, cnt[2]);\n\t\tans = mpower(ans, n);\n\t\t\n// \t\teprintf(\"%d\\n\", ans);\n\t\tfor (int a = 0; a <= n; a += 2)\n\t\t\tfor (int b = 0; b <= n - a; b += 2) {\n\t\t\t\tint c = n - a - b;\n// \t\t\t\teprintf(\"%d %d %d\\n\", c, a, b);\n\t\t\t\tint tmp = mult(C[n][a], C[n - a][b]);\n\t\t\t\ttmp = mult(tmp, mpower(cnt[0], c));\n\t\t\t\ttmp = mult(tmp, mpower(cnt[1], a));\n\t\t\t\ttmp = mult(tmp, mpower(cnt[2], b));\n// \t\t\t\teprintf(\"tmp = %d\\n\", tmp);\n\t\t\t\tadd(ans, MOD - tmp);\n\t\t\t}\n\t\tprintf(\"%d\\n\", ans);\n// \t\tbreak;\n\t}\t\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "5ed0eb6d7e20d99451a33729c2e25abe", "src_uid": "c03b6379e9d186874ac3d97c6968fbd0", "apr_id": "8d5ce78605acadc9dfb420129fede050", "difficulty": 2600, "tags": ["dp", "games"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9417322834645669, "equal_cnt": 24, "replace_cnt": 18, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 23, "bug_source_code": "/*\nDate: 2014/11/24 08:47:17 Monday\nAuthor: xllend3\n*/\n/*\n#include<algorithm>\n#include<iostream>\n#include<cstring>\n#include<cstdlib>\n#include<complex>\n#include<cstdio>\n#include<string>\n#include<vector>\n#include<queue>\n#include<cmath>\n#include<stack>\n#include<map>\n#include<set>\n*/\n#include<bits/stdc++.h>\nusing namespace std;\n#define x first\n#define y second\n#define mp make_pair\n#define ph push\n#define pb push_back\n#define REP(i,a,n) for(int _tmp=n,i=a;i<=_tmp;++i)\n#define DEP(i,a,n) for(int _tmp=n,i=a;i>=_tmp;--i)\n#define rep(i,a,n) for(int i=(a);i<=(n);++i)\n#define dep(i,a,n) for(int i=(a);i>=(n);--i)\n#define ALL(x,S) for(__typeof((S).end()) x=S.begin();x!=S.end();x++)\n#define eps 1e-8\n#define pi 3.1415926535897\n#define sqr(x) ((x)*(x))\n#define MAX(a,b) a=max(a,b)\n#define MIN(a,b) a=min(a,b)\n#define SZ(x) ((int)(x).size())\n#define CPY(a,b) memcpy(a,b,sizeof(a))\n#define CLR(a) memset(a,0,sizeof(a))\n#define POSIN(x,y) (1<=(x)&&(x)<=n&&1<=(y)&&(y)<=m)\n#define all(x) (x).begin(),(x).end()\n#define COUT(S,x) cout<<fixed<<setprecision(x)<<S<<endl\ntypedef long long ll;\ntypedef double lf;\ntypedef pair<int,int> pii;\ntypedef pair<ll,ll> pll;\ntypedef pair<lf,lf> pff;\ntypedef complex<double> CD;\nconst int inf=0x20202020;\nconst int mod=1000000007;\ntemplate<class T> inline void read(T&x){bool fu=0;char c;for(c=getchar();c<=32;c=getchar());if(c=='-')fu=1,c=getchar();for(x=0;c>32;c=getchar())x=x*10+c-'0';if(fu)x=-x;};\ntemplate<class T> inline void read(T&x,T&y){read(x);read(y);}\ntemplate<class T> inline void read(T&x,T&y,T&z){read(x);read(y);read(z);}\ntemplate<class T> inline void read(T&x,T&y,T&z,T&q){read(x);read(y);read(z);read(q);}\nconst int DX[]={1,0,-1,0},DY[]={0,1,0,-1};\nll powmod(ll a,ll b) {ll res=1;a%=mod;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}\nll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}\nll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}\n//*******************************************\n\nconst int N=111111,M=111111;\nint l,m,n,t,C,r;\nint pos[N],sg[N];\nll sum[9],f[N][4];\nll calc(ll x,ll y){\n\treturn (m+m-x-y)*(y-x+1)/2%mod;\n}\nint main()\n{\n\t//ios::sync_with_stdio(false);\n#ifdef LOCAL\n\tfreopen(\"CF273E.in\",\"r\",stdin);//freopen(\"CF273E.out\",\"w\",stdout);\n#endif\n\tscanf(\"%d%d\",&n,&m);\n\tpos[1]=2;l=r=t=1;rep(x,2,m){\n\t\tif(pos[x-1]>=m)break;int p=pos[x-1]+1;\n\t\tif(pos[l]<p/3)l++;\n\t\tif(pos[r]<p-p/3)r++;\n\t\tpos[x]=min(pos[l]*3+2,pos[r]*3/2);\n\t\trep(i,0,2)if(i!=sg[l]&&i!=sg[r]){sg[x]=i;break;}\n\t\tt=x;\n\t}MIN(pos[t],m-1);\n\trep(i,1,t)sum[sg[i]]=(sum[sg[i]]+calc(pos[i-1]+1,pos[i]))%mod;\n\t//printf(\"%lld %lld %lld\\n\",sum[0],sum[1],sum[2]);\n\tf[0][0]=1;\n\trep(i,1,n)rep(j,0,3)rep(k,0,3)f[i][j]=(f[i][j]+f[i-1][k]*sum[k^j])%mod;\n\tprintf(\"%I64d\\n\",(f[n][1]+f[n][2]+f[n][3])%mod);\n\treturn 0;\n}", "lang": "GNU C++", "bug_code_uid": "17c0b844a05155928a27e3553fa2646d", "src_uid": "c03b6379e9d186874ac3d97c6968fbd0", "apr_id": "dbeb6e9c0896d24bc54aba0734021c8b", "difficulty": 2600, "tags": ["dp", "games"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9905052560189895, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "/*\nDate: 2014/11/24 08:47:17 Monday\nAuthor: xllend3\n*/\n/*\n#include<algorithm>\n#include<iostream>\n#include<cstring>\n#include<cstdlib>\n#include<complex>\n#include<cstdio>\n#include<string>\n#include<vector>\n#include<queue>\n#include<cmath>\n#include<stack>\n#include<map>\n#include<set>\n*/\n#include<bits/stdc++.h>\nusing namespace std;\n#define x first\n#define y second\n#define mp make_pair\n#define ph push\n#define pb push_back\n#define REP(i,a,n) for(int _tmp=n,i=a;i<=_tmp;++i)\n#define DEP(i,a,n) for(int _tmp=n,i=a;i>=_tmp;--i)\n#define rep(i,a,n) for(int i=(a);i<=(n);++i)\n#define dep(i,a,n) for(int i=(a);i>=(n);--i)\n#define ALL(x,S) for(__typeof((S).end()) x=S.begin();x!=S.end();x++)\n#define eps 1e-8\n#define pi 3.1415926535897\n#define sqr(x) ((x)*(x))\n#define MAX(a,b) a=max(a,b)\n#define MIN(a,b) a=min(a,b)\n#define SZ(x) ((int)(x).size())\n#define CPY(a,b) memcpy(a,b,sizeof(a))\n#define CLR(a) memset(a,0,sizeof(a))\n#define POSIN(x,y) (1<=(x)&&(x)<=n&&1<=(y)&&(y)<=m)\n#define all(x) (x).begin(),(x).end()\n#define COUT(S,x) cout<<fixed<<setprecision(x)<<S<<endl\ntypedef long long ll;\ntypedef double lf;\ntypedef pair<int,int> pii;\ntypedef pair<ll,ll> pll;\ntypedef pair<lf,lf> pff;\ntypedef complex<double> CD;\nconst int inf=0x20202020;\nconst int mod=1000000007;\ntemplate<class T> inline void read(T&x){bool fu=0;char c;for(c=getchar();c<=32;c=getchar());if(c=='-')fu=1,c=getchar();for(x=0;c>32;c=getchar())x=x*10+c-'0';if(fu)x=-x;};\ntemplate<class T> inline void read(T&x,T&y){read(x);read(y);}\ntemplate<class T> inline void read(T&x,T&y,T&z){read(x);read(y);read(z);}\ntemplate<class T> inline void read(T&x,T&y,T&z,T&q){read(x);read(y);read(z);read(q);}\nconst int DX[]={1,0,-1,0},DY[]={0,1,0,-1};\nll powmod(ll a,ll b) {ll res=1;a%=mod;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}\nll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}\nll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}\n//*******************************************\n\nconst int N=111111,M=111111;\nint l,m,n,t,C,r;\nint pos[N],sg[N];\nll sum[9],f[N][4];\nll calc(ll x,ll y){\n    return (m+m-x-y)*(y-x+1)/2%mod;\n}\nint main()\n{\n    //ios::sync_with_stdio(false);\n#ifdef LOCAL\n    freopen(\"CF273E.in\",\"r\",stdin);freopen(\"CF273E.out\",\"w\",stdout);\n#endif\n    scanf(\"%d%d\",&n,&m);\n    pos[1]=2;l=r=t=1;rep(x,2,m){\n        //printf(\"%d %d %d %d\\n\",pos[l],pos[r],pos[x-1],sg[x-1]);\n        if(pos[x-1]>=m)break;int p=pos[x-1]+1;\n        if(pos[l]<p/3)l++;\n        if(pos[r]<p-p/3)r++;\n        pos[x]=min(pos[l]*3+2,pos[r]*3/2);\n        rep(i,0,2)if(i!=sg[l]&&i!=sg[r]){sg[x]=i;break;}\n        if(sg[x]==sg[x-1])pos[x-1]=pos[x],x--;\n        t=x;\n    }MIN(pos[t],m-1);\n    rep(i,1,t)sum[sg[i]]=(sum[sg[i]]+calc(pos[i-1]+1,pos[i]))%mod;\n    //printf(\"%lld %lld %lld\\n\",sum[0],sum[1],sum[2]);\n    f[0][0]=1;\n    rep(i,1,n)rep(j,0,3)rep(k,0,3)f[i][j]=(f[i][j]+f[i-1][k]*sum[k^j])%mod;\n    printf(\"%I64d\\n\",(f[n][1]+f[n][2]+f[n][3])%mod);\n    return 0;\n}", "lang": "GNU C++", "bug_code_uid": "9f7d705e72fb69096215ec1bf979b964", "src_uid": "c03b6379e9d186874ac3d97c6968fbd0", "apr_id": "dbeb6e9c0896d24bc54aba0734021c8b", "difficulty": 2600, "tags": ["dp", "games"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9114982578397213, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "#include<iostream>\nusing namespace std;\nint main(){\n          int a,b;\n          cin>>a>>b;\n          int diff=0,same=0;\n          while(a!=0 || b!=0){\n                    if(a>0 && b>0){\n                              diff=diff+1;\n                              a--;\n                              b--;\n                    }\n                    else if(a== 0 && b>1){\n                              same=same+1;\n                              b-=2;\n                    }\n                    else if(a>1 && b==0){\n                              same = same+1;\n                              a-=2;\n                    }\n          }\n          cout<<diff<<\" \"<<same;\n          return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "90d8573f1a7f5693784b0cc8d736320f", "src_uid": "775766790e91e539c1cfaa5030e5b955", "apr_id": "1d2177e5f8533bb299720fb2751ae75c", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.3287671232876712, "equal_cnt": 15, "replace_cnt": 14, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 15, "bug_source_code": "#include <iostream>\n#include <algorithm>\n\nusing namespace std;\n\nlong long reflection(long long x,long long y);\nlong long div (int x);\n\nint main(){\n\tlong long l;\n\tlong long r;\n\tcin>>l;\n\tcin>>r;\n\tlong long d=div(l);\n\tbool check1=true;\n\tbool check2=true;\n\tif(l>(d/2)){\n\t\tcheck1=false;\n\t}\n\tif(r<(div(r)/2)-1){\n\t\tcheck2=false;\n\t}\n\tif(div(r)==r*10){\n\t\tcout<<r*(reflection(r,div(r)));\n\t}\t\t\t\n\telse{\n\t\tlong long Max=0;\n\t\tlong long i=l;\n\t\twhile(d<r*10){\n\t\t\tif(i>=d){\n\t\t\t\td=d*10;\n\t\t\t\tcheck1=true;\n\t\t\t}\n\t\t\tif((i==(d/2))&&(check1==true)){\n\t\t\t\tMax=max(Max,i*(i-1));\n\t\t\t}\n\t\t\tif((i==(d/2)-1)&&(check1==true)){\n\t\t\t\tMax=max(Max,i*(i+1));\n\t\t\t}\n\t\t\tif((check1==false)&&(i==l)){\n\t\t\t\tMax=max(Max,i*reflection(i,d));\n\t\t\t}\n\t\t\tif((i==r)&&(check2==false)){\n\t\t\t\tMax=max(Max,i*reflection(i,d));\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\tcout<<Max;\n\t}\n}\nlong long reflection(long long x,long long y){\n\tlong long s=(y-1)-x;\n\treturn s;\n}\nlong long div(int x){\n\tlong long temp=10;\n\twhile(temp<=x){\n\t\ttemp=temp*10;\n\t}\n\treturn temp;\n}\n", "lang": "GNU C++", "bug_code_uid": "14a4d605ab0aef18679d74ef673f113f", "src_uid": "2c4b2a162563242cb2f43f6209b59d5e", "apr_id": "941bf1aef4b63f5875283810194c6b6d", "difficulty": 1600, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.37952559300873906, "equal_cnt": 10, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\nint main(){\n\tint a,b ;\n\tcin>>a>>b;\n\tvector<int > reflection;\n\t long long  int k;\n\t long long int t=10;\n\t if(a==b){\n\t \tt=1;\n\t \twhile(t<=a){\n\t \t\tt*=10;\n\t \t}\n\t \tcout<<(t-1-a)*a;\n\t \treturn 0;\n\t }\n\tfor(int i=a ;i<=b; i++){\n\t\tt=1;\n       while(t<=i){\n       \tt*= 10 ;\n       }\n       reflection.push_back((t-1-i)*i);\n\n   }\n\t\n\tcout<<reflection[max_element(reflection.begin(), reflection.end()) - reflection.begin()];\n}\n", "lang": "GNU C++", "bug_code_uid": "277f359bb611cb8b05fafc809750454e", "src_uid": "2c4b2a162563242cb2f43f6209b59d5e", "apr_id": "f1b657aba99cdf83a8cb665c63e62474", "difficulty": 1600, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.23636363636363636, "equal_cnt": 20, "replace_cnt": 15, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 20, "bug_source_code": "#include<vector>\n#include<string.h>\n#include<iostream>\n#include<cmath>\n#include<algorithm>\nusing namespace std;\nint cei(int n,int k)\n{\n    if(n%k==0)return n/k;\n    else return n/k+1;\n}\nint main()\n{\n    int p;\n    char t[16];\n    cin>>p;\n    cin>>t;\n    int t1=p;\n    vector<int>v;\n    for(int i=0;i<t1;i++){\n        int q=t[i]-'0';\n        if(q%2==0){\n                if(q-1>1)v.push_back(q-1);\n            while(q%2==0){\n                q/=2;\n                v.push_back(2);\n            }\n        }\n        if(q!=1 && q!=0)\n        v.push_back(q);\n    }\n    sort(v.begin(),v.end());\n    int u=v.size();\n    for(int j=u-1;j>=0;j--)cout<<v[j];\n}\n", "lang": "GNU C++11", "bug_code_uid": "c1983f3e10291f02c7fd9c89fac32c3c", "src_uid": "60dbfc7a65702ae8bd4a587db1e06398", "apr_id": "ede2b571995695422586a407eafbeb4f", "difficulty": 1400, "tags": ["greedy", "math", "sortings"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9083263246425568, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\n#define int long long\nsigned main()\n{\n    int n;\n    cin>>n;\nstring s;\n    cin>>s;\n    sort(s.begin(),s.end());\n    for(int i=0;i<s.size();i++)\n    {\n        if(s[i]=='4')\n        {\n            s[i]='0';\n            s.insert(i,\"223\");}\n            if(s[i]=='6')\n                s.insert(i,\"35\");\n        if(s[i]=='8')\n       {s[i]='0';\n       s.insert(i,\"2227\");}\n    }\n     sort(s.begin(),s.end());\n     for(int i=s.size()-1;i>=0;i--)\n        if((s[i]!='0')&&(s[i]!='1'))\n        cout<<s[i];\n}\n", "lang": "GNU C++11", "bug_code_uid": "f75182cffbf61bea4fffce1f372a9cb9", "src_uid": "60dbfc7a65702ae8bd4a587db1e06398", "apr_id": "b88486ba12176abe23a013add9e21320", "difficulty": 1400, "tags": ["greedy", "math", "sortings"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.2384737678855326, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "#include <iostream>\nusing namespace std;\nint main() {\n\tlong x, y;\n\tcin >> x >> y;\n\tlong factx = 1;\n\tlong facty = 1;\n\tfor (int i = 1; i <= x; i++)\n\t\tfactx *= i;\n\tfor (int q = 1; q<= y; q++)\n\t\tfacty *= q;\n\t\n\tlong maxRemainder = 0;\n\tif (factx < facty)\n\t\tmaxRemainder = factx;\n\telse if (facty < factx)\n\t\tmaxRemainder = facty;\n\telse\n\t\tmaxRemainder = factx;\n\n\tcout << maxRemainder<<endl;\n\n\n\n\n}\n", "lang": "GNU C++14", "bug_code_uid": "d1265083d7b8efdac1fed7cd25bd5a21", "src_uid": "7bf30ceb24b66d91382e97767f9feeb6", "apr_id": "b79bffab9aec8eb20377349a5e21c768", "difficulty": 800, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.762962962962963, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "#include<iostream>\n#define ll long long\nusing namespace std;\nll a[3000];\nint main()\n{\n\tll n,i,j;\n\tcin>>n;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tfor(j=i+1;j<=n;j++)\n\t\t{\n\t\t\tll c=(i^j);\n\t\t\tif(c>=j && i+j>c)\n\t\t\ta[(i^j)]=1;\n\t\t}\n\t}\n\tll ans=0;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\t//cout<<a[i]<<\" \";\n\t\tif(a[i]==1)\n\t\t\tans++;\n\t}\n\tcout<<ans;\n}", "lang": "GNU C++", "bug_code_uid": "fdac39adbc91d2e012268ccae5e2d568", "src_uid": "838f2e75fdff0f13f002c0dfff0b2e8d", "apr_id": "3f495aa8fc815c3a6083a4a8e7ef0eda", "difficulty": 1300, "tags": ["brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9931707317073171, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#include <iostream>\n#include <math.h>\nusing namespace std;\n\nint main(int argc, char** argv) {\n\tlong long ch;\n\tcin>>ch;\n\tch%=360;\n\tif((ch>-45)&&(ch<=45)) cout<<0;\n\tif((ch>45)&&(ch<=45+90)) cout<<1;\n\tif((ch>45+90)&&(ch<=45+180)) cout<<2;\n\tif((ch>45+180)&&(ch<45+180+90)) cout<<3;\n\tif((ch>=45+180+90)&&(ch<=45+180+180)) cout<<0;\n\t\n\tif((ch>-45-90)&&(ch=<-45)) cout<<3;\n\tif((ch>-45-180)&&(ch=<-45-90)) cout<<2;\n\tif((ch>-45-180-90)&&(ch<-45-180)) cout<<1;\n\tif((ch>=-45-180-180)&&(ch<=-45-180-90)) cout<<0;\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "baeb8506ef22b1f43e9c446a228a12b9", "src_uid": "509db9cb6156b692557ba874a09f150e", "apr_id": "cf32e66af6fa57833552af1eafaf22d2", "difficulty": 1800, "tags": ["geometry", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9235294117647059, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "#include <iostream>\n\nusing namespace std;\n\nint main()\n{\n  int w;\n  cin>>w;\n  if (w>2)\n  \n  {\n  if (w%2==0 )\n  cout<<\"YES\";\n  else \n  cout<<\"no\";\n}\n    return 0;\n}\n", "lang": "MS C++", "bug_code_uid": "638610a2a969b8279c1ba793ba01f3db", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "c06b30cf40085fe3e1cf221bb71856b9", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.9738551207327227, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <algorithm>\n#include <cassert>\n#include <iostream>\n#include <vector>\nusing namespace std;\n\nconst int MOD = 998244353;\n\nlong long mod_inv(long long a, long long m = MOD) {\n    return a == 1 ? 1 : m - mod_inv(m % a, a) * m / a;\n}\n\nint mod_add(int a, int b) {\n    int sum = a + b;\n    return sum >= MOD ? sum - MOD : sum;\n}\n\nint mod_sub(int a, int b) {\n    int diff = a - b;\n    return diff < 0 ? diff + MOD : diff;\n}\n\n// Note: can change these to int to save memory, but beware of overflow.\nvector<long long> factorial, inv_factorial;\nvector<long long> inv;\n\nvoid prepare_factorials(int max) {\n    inv.assign(max + 1, 1);\n\n    for (int i = 2; i <= max; i++)\n        inv[i] = (long long) inv[MOD % i] * (MOD - MOD / i) % MOD;\n\n    factorial.resize(max + 1);\n    inv_factorial.resize(max + 1);\n    factorial[0] = inv_factorial[0] = 1;\n\n    for (int i = 1; i <= max; i++) {\n        factorial[i] = (long long) i * factorial[i - 1] % MOD;\n        inv_factorial[i] = (long long) inv[i] * inv_factorial[i - 1] % MOD;\n    }\n}\n\nlong long choose(int n, int r) {\n    assert(0 <= r && r <= n);\n    return (long long) factorial[n] * inv_factorial[r] % MOD * inv_factorial[n - r] % MOD;\n}\n\nlong long choose(int n, int r) {\n    assert(0 <= r && r <= n);\n    return (long long) factorial[n] * inv_factorial[r] % MOD * inv_factorial[n - r] % MOD;\n}\n\nlong long ways_to_distribute(int score, int players) {\n    if (score <= 0 || players <= 0)\n        return score == 0 ? 1 : 0;\n\n    return choose(score + players - 1, score);\n}\n\n// Counts the number of ways to distribute sum points to players such that they are all < me\nlong long ways_to_distribute_bounded(int players, int me, int sum) {\n    int total = 0;\n\n    for (int p = 0; p <= players; p++) {\n        int ways = choose(players, p) * ways_to_distribute(sum - me * p, players) % MOD;\n\n        if (p % 2 == 0)\n            total = mod_add(total, ways);\n        else\n            total = mod_sub(total, ways);\n    }\n\n    return total;\n}\n\nint main() {\n    int P, S, R;\n    cin >> P >> S >> R;\n    prepare_factorials(S + P);\n\n    if (P == 1) {\n        cout << 1 << '\\n';\n        return 0;\n    }\n\n    if (S == 0) {\n        cout << inv[P] << '\\n';\n        return 0;\n    }\n\n    long long total = 0, denominator = 0;\n\n    for (int me = R; me <= S; me++) {\n        long long ways = ways_to_distribute(S - me, P - 1);\n        denominator = (denominator + ways) % MOD;\n\n        if (me > S - me) {\n            total = (total + ways) % MOD;\n            continue;\n        }\n\n        if (me * P < S)\n            continue;\n\n        int max_same = S / me;\n        assert(max_same >= 2 && max_same <= P);\n\n        for (int same = max_same; same > 0; same--) {\n            // Count ways to distribute S - same * me points to P - same players where everybody < me\n            long long less_than = ways_to_distribute_bounded(P - same, me, S - same * me);\n            total = (total + less_than * choose(P - 1, same - 1) % MOD * inv[same]) % MOD;\n        }\n    }\n\n    total %= MOD;\n    total = total * mod_inv(denominator) % MOD;\n    cout << total << '\\n';\n}\n", "lang": "GNU C++14", "bug_code_uid": "743d8d7e3988a0b20e6317077b106491", "src_uid": "609195ef4a970c62a8210dafe118580e", "apr_id": "cb2a2b478db0060afddab1b119e659d7", "difficulty": 2500, "tags": ["dp", "math", "combinatorics", "probabilities"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.9969918349806618, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nnamespace mine\n{\n    typedef long long ll;\n    #define pr pair<int,int>\n    #define FR first\n    #define SE second\n    #define MP make_pair\n    #define PB push_back\n    #define vc vector\n    #define all(x) (x).begin(),(x).end()\n    #define sz(x) ((int)(x).size())\n    #define bin(x) (1ll<<(x))\n    #define GG(x) if(x) {puts(\"error\");exit(666);}\n    #define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)\n    #define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)\n    ll qread()\n    {\n        ll ans=0,f=1;char c=getchar();\n        while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}\n        while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();\n        return ans*f;\n    }\n    void write(ll num)\n    {\n        if(num<0) putchar('-'),num=-num;\n        if(num>=10) write(num/10);\n        putchar('0'+num%10);\n    }\n    void write1(ll num){write(num);putchar(' ');}\n    void write2(ll num){write(num);putchar('\\n');}\n    template<typename T> void chmax(T &x,const T y) {x=(x>y?x:y);}\n    template<typename T> void chmin(T &x,const T y) {x=(x<y?x:y);}\n    ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}\n\n    const int INF=0x3f3f3f3f;\n    const int MOD=998244353;\n    inline int mm(const int x){return x>=MOD?x-MOD:x;}\n    inline void add(int &x,const int y){x=mm(x+y);}\n    inline ll qpower(ll x,ll e,int mod=MOD){ll ans=1;GG(e<0)while(e){if(e&1)ans=ans*x%mod;x=x*x%mod;e>>=1;}return ans;}\n    ll invm(ll x){return qpower(x,MOD-2);}\n    const int N=1e4+10;\n\n\tll fac[N],facinv[N];ll C(int n,int m){return n<0 or n<m or m<0?0:fac[n]*facinv[m]%MOD*facinv[n-m]%MOD;}\n\tint f(int sum,int n,int mx)\n\t{\n\t\tint ans=0;if(n==0) return sum==0;\n\t\tfo(i,0,min(n,mx==0?n:sum/mx)) add(ans, (i&1?MOD-1:1)*C(n,i)%MOD*C(sum-i*mx+n-1,n-1)%MOD );\n\t\treturn ans;\n\t}\n    void main()\n    {\n    \tfac[0]=1;fo(i,1,N-1) fac[i]=fac[i-1]*i%MOD;\n    \tfacinv[N-1]=invm(fac[N-1]);fd(i,N-2,0) facinv[i]=facinv[i+1]*(i+1)%MOD;\n    \t\n//    \tint T=qread();\n//    \twhile(T--)\n    \t{\n    \t\tint n=qread(),sum=qread(),mii=qread();\n        \tif(n==1){puts(\"1\");continue;}\n\t        int fz=mm(C(sum+n-1,n-1)+MOD-f(sum,n,mii));\n\t        int fm=C(sum-mii+n-1,n-1);\n\t\t\twrite2(fz*invm(n)%MOD*invm(fm)%MOD);\n\t\t}\n    }\n};//(ans+MOD)%MOD\nsigned main()\n{\n//\tfreopen(\"z.txt\",\"r\",stdin);\n    // freopen(\"a.out\",\"w\",stdout);\n    srand(time(0));\n    mine::main();\n}", "lang": "GNU C++14", "bug_code_uid": "16c9cc30454951a9375badccc4c27d1f", "src_uid": "609195ef4a970c62a8210dafe118580e", "apr_id": "ce63b6eb7f2143e582fb040560183ac3", "difficulty": 2500, "tags": ["dp", "math", "combinatorics", "probabilities"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8863275039745628, "equal_cnt": 8, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include <iostream>\n#include <vector>\n#include <cstdlib>\n#include <cmath>\n#include <vector>\n#include <string>\n#include <set>\n#include <algorithm>\n#include <map>\n#include <queue>\n#include <clocale>\n#include <bitset>\n#include <cstring>\n#include <memory.h>\n#include <numeric>\n#include <iomanip>\n#include <stack>\n#include <list>\n\nusing namespace std;\n\n#pragma comment (linker, \"/STACK:667177216\")\n#define ll long long\n#define LL long long\n#define ull unsigned long long\n#define ld long double\n#define all(x) (x).begin(),(x).end()\n#define rall(x) (x).rbegin(),(x).rend()\n#define pb push_back\nconst ll mod = 1000000007;\n#define INF (int)(2e9)\n#define LINF (ll)(4e18)\n#define forit(mas) for(auto(it)=(mas).begin();(it)!=(mas).end();(it)++)\n#define pii pair<int,int>\n\nll D[2010][2010];\nll weight[2010];\nll wet[2010];\nll umb[2010];\n\nint main() {\n\n#ifdef _DEBUG\n\tfreopen(\"input.txt\", \"r\", stdin);\n\tfreopen(\"output.txt\", \"w\", stdout);\n#endif\n\tios::sync_with_stdio(false);\n\tcin.tie(0);\n\tint n;\n\tcin >> n;\n\tstring s;\n\tcin >> s;\n\tvector<int>mas;\n\tint mx = 0;\n\tfor (int i = 0; i < n - 1; i++) {\n\t\tif (s[i] == 'x') mx++;\n\t\telse {\n\t\t\tmas.push_back(mx);\n\t\t\tmx = 0;\n\t\t}\n\t}\n\tsort(rall(mas));\n\tint v = mas[0];\n\tif (v < 3) {\n\t\tcout << 0;\n\t\treturn 0;\n\t}\n\tcout << v - 2;\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "93a24d5f59b85f5c66dc9ab7f38c7d80", "src_uid": "8de14db41d0acee116bd5d8079cb2b02", "apr_id": "e3d7d14dd1a311d2d1be4831a6268612", "difficulty": 800, "tags": ["strings", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8950276243093923, "equal_cnt": 7, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 6, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\n\n#define ll long long;\n\nint main(){\n    ll n,sum=0;\n    cin>>n;\n    for(int i=2;i<n-1;i++){\n        sum+=i*(i+1);\n    }\n    cout<<sum<<endl;\n}", "lang": "GNU C++17", "bug_code_uid": "613fc5a819a458d1ed5ab1e6406240f7", "src_uid": "1bd29d7a8793c22e81a1f6fd3991307a", "apr_id": "5c434c04b602e4525b6f7e5afaaf76dd", "difficulty": 1200, "tags": ["dp", "math", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.6443148688046647, "equal_cnt": 17, "replace_cnt": 10, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 16, "bug_source_code": "#include <algorithm>\n#include <iostream>\n#include <vector>\n\nvoid find(int depth, int n, int m, int a, int b, int curr, std::vector<int>* result) {\n/*\n    for (int i = 0; i < depth; ++i) {\n        std::cout << \"  \";\n    }\n\n    std::cout << \"Call: \" <<  n << \" \" << curr << std::endl;\n*/\n    if (n <= 0) {\n        result->push_back(curr);\n//        std::cout << curr << std::endl;\n        return;\n    }\n\n    find(depth + 1, n - 1, m, a, b, curr + a, result);\n    find(depth + 1, n - m, m, a, b, curr + b, result);\n}\n\nint main() {\n    int n, m, a, b;\n\n    std::cin >> n;\n    std::cin >> m;\n    std::cin >> a;\n    std::cin >> b;\n\n    std::vector<int> result;\n    \n    find(0, n, m, a, b, 0, &result);\n    /*\n    for (int index = 0; index < result.size(); ++index) {\n        std::cout << result[index] << \" \";\n    }\n    std::cout << std::endl;\n    */\n    auto answer = std::min_element(result.begin(), result.end());\n    std::cout << *answer << std::endl;\n/*\n    if (n <= m && n * a >= b) {\n        std::cout << b << std::endl;\n        return 0;\n    }\n\n    if (static_cast<float>(b / m) >= a) {\n        std::cout << n * a << std::endl;\n        return 0;\n    }\n\n    int result = 0;\n\n    while (n > m) {\n        result += b;\n        n -= m;\n    }\n\n    if (n > 0) {\n        result += n * a;\n    }\n    std::cout << result << std::endl;\n*/\n    return 0;\n}\n", "lang": "GNU C++0x", "bug_code_uid": "afa788772996140cb41172a1c797124b", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "apr_id": "7007071c7b2830d81b84cfd8f532dcff", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8945035460992907, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "#include <iostream>\n#include <string>\n#include <sstream>\n#include <algorithm>\nusing namespace std;\n\nint dp[11][2000];\nint num[11];\nint c[11];\nint d[11];\n\nint main() {\n    int n, m, c0, d0;\n    cin >> m >> n >> c0 >> d0;\n    for (int i = 1; i <= n; i++) {\n        int a, b;\n        cin >> a >> b;\n        num[i] = a / b;\n        cin >> c[i] >> d[i];\n    }\n\n    memset(dp, -1, sizeof(dp));\n\n    dp[0][0] = 0;\n    for (int j = 1; j <= c0 && j * c0 <= m; j++) {\n        dp[0][j * c0] = j * d0;\n    }\n\n    for (int i = 0; i < n; i++) {\n        for (int j = 0; j <= m; j++) {\n            if (dp[i][j] != -1) {\n                for (int t = 0; t <= num[i + 1]; t++) {\n                    int ww = j + t * c[i + 1];\n                    if (ww > m) {\n                        break;\n                    }\n                    dp[i + 1][ww] = max(dp[i + 1][ww], dp[i][j] + t * d[i + 1]);\n                }\n            }\n        }\n    }\n    \n    int ans = 0;\n    for (int i = 0; i <= m; i++) {\n        ans = max(ans, dp[n][i]);\n    }\n    cout << ans << endl;\n    return 0;\n}", "lang": "GNU C++", "bug_code_uid": "2c260eb898271bc9770bf340c03df13a", "src_uid": "4e166b8b44427b1227e0f811161d3a6f", "apr_id": "fb5f83b9a20f206f9fda0b2f1e85dbc7", "difficulty": 1700, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.5714285714285714, "equal_cnt": 13, "replace_cnt": 5, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 12, "bug_source_code": "#include<iostream>\nusing namespace std;\nint main()\n{\n\tint w;\n\tcin>>w;\n\tif(w%2==0)\n\t{\n\tcout<<\"YES\"<<endl;\n\t}\n\telse\n\treturn 0;\t\n}", "lang": "GNU C++11", "bug_code_uid": "516d907771c96d6cc2a599cd9a64e9a8", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "efd2f53848c4a98c33f52466ae08844e", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.4779874213836478, "equal_cnt": 20, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 7, "fix_ops_cnt": 19, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint main()\n{\n\tstring n;\n\tcin>>n;\n\tif(n[n.size()-1]&1)cout<<\"NO\";\n\telse cout<<\"YES\";\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "0805e7dcd94b492e16adbbc05dc37d8d", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "efd2f53848c4a98c33f52466ae08844e", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9991755976916735, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <bits/stdc++.h>\n\nusing namespace std;\n\n#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)\n#define pb push_back\n#define all(x) (x).begin(),(x).end()\n#define rall(x) (x).rbegin(),(x).rend()\n#define ll long long\n#define pii pair <int, int>\n#define pll pair <ll, ll>\n#define fi first\n#define se second\n\nconst int N = 1200000;\n\nint b[N];\nvector <int> e[N];\nint main() {\n    fast;\n    string s = \"\";\n    for(int i = 0; i < 40000; i++){\n        s += '1' + s;\n    }\n    int n;\n    cin >> n;\n    if(n - 2 > 0 and (n - 2) % 2 == 0) cout << \"YES\";\n    else cout << \"NO\";\n    return 0;\n    return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "02e419950478cd3784079121f7aa1de9", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "0c634b55096906f5940d528039e37e04", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.3436669619131975, "equal_cnt": 11, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "#include<iostream>\n#include<cstdio>\n#include<cstring>\n#include<algorithm>\nusing namespace std;\nchar str[101000];\nint main(){\n\tfgets(str,100999,stdin);\n\tint i = 0;\n\twhile(!(str[i]=='\\n'||str[i]=='/0')){\n\t\tif(str[i]=='?')putchar('1');\n\t\telse if(str[i]<='J'&&str[i]>='A')putchar(str[i]-'A'+'0');\n\t\telse putchar(str[i]);\n\t}\n\treturn 0;\n}\n", "lang": "MS C++", "bug_code_uid": "c7a73ca176240b3f34a60002adfc7946", "src_uid": "d3c10d1b1a17ad018359e2dab80d2b82", "apr_id": "8dbe3534b9c827b48d5f60660c44fac8", "difficulty": 1100, "tags": ["greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8941836019621584, "equal_cnt": 10, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 10, "bug_source_code": "/******************************************************************************\n\n                              Online C++ Compiler.\n               Code, Compile, Run and Debug C++ program online.\nWrite your code in this editor and press \"Run\" button to compile and execute it.\n\n*******************************************************************************/\n\n#include <bits/stdc++.h>\n\nusing namespace std;\n\nint main()\n{\n    int a,b,c;\n    cin>>a>>b>>c; \n    vector <int> i(3,0);\n    while(a>=1){\n       a=a-1;\n       i[1]++;\n    }\n    while(b>=1){\n       a=a-2;\n       i[2]++;\n    }\n    while(c>=1){\n       a=a-4;\n       i[3]++;\n    }\n    sort(i.begin(),i.end());\n    cout<<i[3];\n    return 0;\n}\n\n\n\n", "lang": "GNU C++14", "bug_code_uid": "7592782c52803cefd5473b82e6357a64", "src_uid": "82a4a60eac90765fb62f2a77d2305c01", "apr_id": "547125c424c4ba707c57a78cbd26e8e3", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8318318318318318, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 5, "bug_source_code": "#include <iostream>\n#include <stdio.h>\n\nusing namespace std;\n\n\nint main()\n{\n    int x, y, z, count=0;\n    scanf(\"%d %d %d\",&x,&y,&z);\n    while(x>1){\n    if(x!=0 && y>=2 && z>=4){\n        count= count + 7;\n        x=x-1;\n        y=y-2;\n        z=z-4;\n    }\n    }\n    printf(\"%d\",count);\n    return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "c6322491d4332cb3c363dd7642a4c152", "src_uid": "82a4a60eac90765fb62f2a77d2305c01", "apr_id": "cd7b89a367c006331e0af0764bf278f4", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.7389830508474576, "equal_cnt": 11, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 10, "bug_source_code": "#include <iostream>\n#include <string>\n#include <memory.h>\n\nusing namespace std;\n\nint main()\n{\n\tstring str;\n\tcin >> str;\n\tsize_t n = str.length();\n\t\n\tint a = 0;\n\n\tfor(char i = 'A'; i<='J'; i++)\n\t\tif(str.find(i)!=string::npos) a++;\n\n\tsize_t c = 11 - a;\n\twhile(--a) c*=c;\n\n\tcout << c;\n\n\tfor(size_t i = 0; i < n; i++) if (str[i] == '?') cout << 0;\n\nreturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "7a35a6e861988d2fa11c893e17f1f98a", "src_uid": "d3c10d1b1a17ad018359e2dab80d2b82", "apr_id": "d94b4502cd8d88e9c742ccd479a15c2a", "difficulty": 1100, "tags": ["greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9575440888308295, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include <iostream>\n#include <cstring>\nusing namespace std;\n\nchar str[100005];\n\nint main()\n{\n    int i,len;\n    cin>>str;\n    len=strlen(str);\n    long long ans[10];\n    for(i=0;i<10;i++)\n        ans[i]=0;\n    long long total=1;\n    for(i=0;i<len;i++){\n        if(str[i]=='?'){\n            if(i)\n                total*=10;\n            else\n                total*=9;\n        }\n        if(str[i]>='0' && str[i]<='9')\n            continue;\n        ans[str[i]-'A']=1;\n    }\n    len=0;\n    for(i=0;i<10;i++)\n        if(ans[i])\n            len++;\n    len--;\n    if(str[0]>='A' && str[0]<='J')\n        total*=9;\n    else\n        total*=10;\n    for(i=9;len;i--){\n        total*=i;\n        len--;\n    }\n    cout<<total<<endl;\n    return 0;\n}\n", "lang": "GNU C++0x", "bug_code_uid": "64ed0da2dd3fa911a6a925181d9d446f", "src_uid": "d3c10d1b1a17ad018359e2dab80d2b82", "apr_id": "1d396691a4712240af1f5e64855bc3d4", "difficulty": 1100, "tags": ["greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.5913410770855333, "equal_cnt": 15, "replace_cnt": 12, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 15, "bug_source_code": "#include <iostream>\n#include <utility>\n#include <algorithm>\n#include<cmath>\n#include<algorithm>\n#include<vector>\n#include<cstring>\n#include <math.h>\n#include <map>\n#include <vector>\n#include <iomanip>\n#include <set>\n#include <deque>\n#define ss second\n#define ff first\n#define use_fast ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)\n#define ret(n) return cout << n, 0\n#define se(n) cout << setprecision(n) << fixed\n#define ll long long\n#define pb push_back\nusing namespace std;\n\nconst ll N = 1e6 + 1, OO = 1e9, M = 1e9 + 7;\ntypedef pair <int, int> pii;\nbool b[N];\nvector <ll> v[N];\n\nint main() {\n\tuse_fast;\n\tb[0] = true;\n\tb[1] = true;\n\tfor(ll i = 2; i < N; i++) {\n\t\tcout << i << endl;\n\t\tif(!b[i]) {\n\t\t\tvector <ll> s;\n\t\t\ts.pb(i);\n\t\t\tfor(ll j = 2; j * i < N; j++) {\n\t\t\t\tcout << j << endl;\n\t\t\t\ts.pb(i * j);\n\t\t\t\tb[i * j] = true;\n\t\t\t\tv[i * j] = s;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "f2a223cf4f35fe5547c90efd3af0463c", "src_uid": "097674b4dd696b30e102938f71dd39b9", "apr_id": "c0cf54a2a2e1b9d166b12f8e968cce54", "difficulty": 2100, "tags": ["dp", "bitmasks", "dsu"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6473551637279596, "equal_cnt": 12, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 12, "bug_source_code": "#include <iostream>\n#include <cmath>\n#include <algorithm>\n#include <string>\n#include <vector>\n#include <cstdio>\n#include <cstdlib>\n#include <ctime>\n#include <queue>\n#include <stack>\nusing namespace std;\nvector<int> v;\nint main(){\nint n;\ncin>>n;\nqueue<int> k;\nint s=2;\nk.push(1);k.push(1);\nwhile (!k.empty()){\n\tif (k.front()+1<=n){\n\t\tk.push(k.front()+1);\n\t\tk.push(k.front()+1);\n\t\ts+=2;\n\t}\n\tk.pop();\n}\ncout<<s;\n}", "lang": "MS C++", "bug_code_uid": "8b64f0f7e17e7d4b57fff21a39d2d1fb", "src_uid": "f1b43baa14d4c262ba616d892525dfde", "apr_id": "e522d587bd9d2a2acec92e46e527f92a", "difficulty": 1100, "tags": ["math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.15478615071283094, "equal_cnt": 11, "replace_cnt": 6, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "#include <iostream>\n#include <queue>\n\nusing namespace std;\n\nstruct LuckyNumber {\n\tint number;\n\tint digits;\n};\n\nqueue<LuckyNumber> q;\n\nint BFS(int maxDigits) {\n\tint counter = 0;\n\tLuckyNumber tmp;\n\t\n\ttmp.number = 7;\n\ttmp.digits = 1;\n\tq.push(tmp);\n\t\n\ttmp.number = 8;\n\ttmp.digits = 1;\n\tq.push(tmp);\n\t\n\twhile(!q.empty()) {\n\t\tint size = q.size();\n\t\t\n\t\twhile(size--) {\n\t\t\tLuckyNumber fr = q.front();\n\t\t\tq.pop();\n\t\t\t\n\t\t\tif(fr.digits > maxDigits)\n\t\t\t\treturn counter;\n\t\t\t\t\n\t\t\ttmp = fr;\n\t\t\ttmp.number *= 10;\n\t\t\ttmp.number += 7;\n\t\t\ttmp.digits++;\n\t\t\tq.push(tmp);\n\t\t\t\n\t\t\ttmp = fr;\n\t\t\ttmp.number *= 10;\n\t\t\ttmp.number += 8;\n\t\t\ttmp.digits++;\n\t\t\tq.push(tmp);\n\t\t\t\n\t\t\tcounter++;\n\t\t}\n\t}\n}\n\nint main() {\n\tint n;\n\tcin >> n;\n\t\n\tcout << BFS(n) << endl;\n    \n    return 0;\n}", "lang": "MS C++", "bug_code_uid": "b9243d6d37a17466a14d27c57fb7d28c", "src_uid": "f1b43baa14d4c262ba616d892525dfde", "apr_id": "6682edde2911e5320977b5987feafead", "difficulty": 1100, "tags": ["math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.7468265162200282, "equal_cnt": 23, "replace_cnt": 11, "delete_cnt": 1, "insert_cnt": 11, "fix_ops_cnt": 23, "bug_source_code": "#include <iostream>\n#include <queue>\n#include <string>\n#include <vector>\n#include <cmath>\n#include <algorithm>\n#include <queue>\n#include <stack>\n#include <fstream>\n#include <string.h>\n#include <map>\n\nusing namespace std;\n\n#define mod 10000009ll\n#define fori(n) for(ll i= 0; i < n; i++)\n#define forj(m) for(ll j= 0; j < n; j++)\n#define in(n) scanf(\"%I64d\", &n)\n#define out(n) printf(\"%I64d\", n)\n#define outS(s) printf(\"%s\", s)\n#define setA(a,n) for(ll i= 0; i < sizeof(a); i++) a[i]= n;\n\ntypedef long long ll;\ntypedef priority_queue<ll> pqmax;\ntypedef priority_queue<ll, vector<ll>, greater<ll> > pqmin;\n\n\nll t, m, sp, junger, mid, top, bot, x, y;\nll n= 0, k= 0;\nll test;\n\nstring s1, s2;\n\nll a[10005][10005];\n\nvoid make()\n{\n\ta[0][0]= 0ll;\n\tfor(ll j= 1; j < 10001; j++)\n\t{\n\t\ta[0][j]= a[0][j-1]+j;\n\t}\n\tfor(ll i= 1; i < 10001; i++)\n\t{\n\t\ta[i][0]= a[i-1][0]+i;\n\t\tfor(ll j= 1; j < 10001; j++)\n\t\t{\n\t\t\ta[i][j]= a[i-1][j] + a[i][j-1] - a[i-1][j-1] + i+j;\n\t\t}\n\t}\n}\n\nint main()\n{\n\tmake();\n//\tfori(10)\n//\t{\n//\t\tfor(ll j= 0; j < 10; j++)\tcout << a[i][j] << \"  \";\n//\t\tcout << endl;\n//\t}\n\n\n\tll b;\n\tcin >> m >> b;\n\n\n\tll Max= 0, maxX, maxY;\n\tx= 0;\n\ty= trunc( (double)b - (double)x/(double)m );\n\twhile( y > 0 && x < 10000 )\n\t{\n//\t\tcout << x << \"  \" << y << \"  \" << a[x][n] << endl;\n\t\tif( Max < a[x][y] ) \n\t\t{\n\t\t\tMax= a[x][y];\n\t\t\tmaxX= x;\n\t\t\tmaxY= y;\n\t\t}\n\t\tx++;\n\t\ty= trunc( (double)b - (double)x/(double)m );\n\t}\n//\tcout << maxX << \"  \" << maxY << endl;\n\tcout << Max;\n}\n", "lang": "GNU C++14", "bug_code_uid": "dda7719ce4ef0caa5e5f981df4df0f63", "src_uid": "9300f1c07dd36e0cf7e6cb7911df4cf2", "apr_id": "d6bacc436eb52f83e9a338d47722ce39", "difficulty": 1300, "tags": ["math", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.09990917347865577, "equal_cnt": 8, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "//\n//  main.cpp\n//  rt\n//\n//  Created by user on 2012/11/17.\n//  Copyright (c) 2012\u5e74 user. All rights reserved.\n//\n\n#include <cstdio>\n#include <vector>\n#include <algorithm>\nusing namespace std;\nint ten[10],ans=0,n,e[8],sum=0;\nint main(){\n    scanf(\"%d\",&n);\n    vector<int>vec;\n    ten[0]=1;\n    for(int i=1;i<10;i++){\n        ten[i]=ten[i-1]*10;\n    }\n    for(int i=9;i>0;i--){\n        for(int j=i-1;j>0;j--){\n            for(int k=0;k<=256;k++){\n                for(int h=0;h<8;h++){\n                    e[h]=k%2;\n                    k/=2;\n                }\n                for(int h=0;h<8;h++){\n                    if(e[h]==0){\n                        sum+=ten[8-h]*j;\n                    }else{\n                        sum+=ten[8-h]*i;\n                    }\n                }\n                vec.push_back(sum);\n                sum=0;\n            }\n        }\n    }\n    sort(vec.begin(),vec.end());\n    for(int i=0;i<vec.size()-1;i++){\n        if(vec[i]!=vec[i+1] && vec[i]<=n){\n            ans++;\n        }else if(vec[i]>n){\n            break;\n        }\n    }\n    printf(\"%d\u00a5n\",ans);\n    return 0;\n}\n", "lang": "MS C++", "bug_code_uid": "4b3e2601057bc29003b17e69b976ad96", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "apr_id": "036a071cd298b30d5cb2dc6518d3041a", "difficulty": 1600, "tags": ["dfs and similar", "brute force", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.7434079954635667, "equal_cnt": 24, "replace_cnt": 13, "delete_cnt": 2, "insert_cnt": 8, "fix_ops_cnt": 23, "bug_source_code": "#include <iostream>\n#include <cstring>\n#define MAXI 8\n#define MAXL 9\n#define MOD 1000000007\n\nusing namespace std;\n\nlong long f[MAXI][MAXL][2],c[MAXL];\nint n,length,an[MAXL];\n\ninline void update(long long &i, const long long j)\n{\n    i=(i+j)%MOD;\n}\n\ninline int isfs(const int k)\n{\n    return (k==4||k==7);\n}\n\ninline void init()\n{\n    memset(f,0,sizeof(f));\n    f[0][0][1]=1;\n    \n    for(int i=0;i<length;i++)\n    {\n        for(int j=0;j<=i;j++)\n        {\n            int k;\n            //\u0421\ufffd\u06a3\ufffd\u04bb\ufffd\ufffd\ufffd\ufffd\ufffd\u0423\ufffd \n            for(k=0;k<an[i];k++)\n            {\n                update(f[i+1][j+isfs(k)][1], f[i][j][1]+f[i][j][0]);\n            } \n            \n            //\ufffd\ufffd\ufffd\ufffd\n            update(f[i+1][j+isfs(k)][1],f[i][j][1]);\n            update(f[i+1][j+isfs(k)][0],f[i][j][0]);\n            k++; \n            \n            //\ufffd\ufffd\ufffd\u06a3\ufffd\u04bb\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0423\ufffd \n            for(;k<=9;k++)\n            {\n                update(f[i+1][j+isfs(k)][0], f[i][j][1]+f[i][j][0]);\n            }\n        }\n    }\n    \n    for(int i=0;i<=length;i++)\n        c[i]=f[length][i][1];\n    c[0]--;\n}\n\ninline long long dfs(int depth,int left47)\n{\n    if(depth==MAXI)\n        return 1;\n    \n    long long ret=0;\n    for(int c47=0;c47<=left47;c47++)\n    {\n        update(ret,(c[c47]--)*dfs(depth+1,left47-c47));\n        c[c47]++;\n    }\n    return ret;\n}\n\ninline void solve()\n{\n    long long ret=0;\n    for(int i=1;i<=length;i++)\n    {\n        ret=(ret+dfs(2,i-1)*c[i])%MOD;\n    }\n    cout<<ret<<endl;\n}\n\nint main()\n{\n    cin>>n;\n    for(int k=n,i=0;k;an[i++]=k%10,k/=10,length++);\n    \n    init();\n    solve();\n    while(1);\n    \n    return 0;    \n} \n", "lang": "MS C++", "bug_code_uid": "86641428685b4d4c0edfe287fe8e9c22", "src_uid": "656ed7b1b80de84d65a253e5d14d62a9", "apr_id": "fd17489c64e230a81785e65117665853", "difficulty": 1900, "tags": ["brute force", "dp", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.5857247976453275, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "#include <iostream>\n#include <cstring>\n#include <string>\n#include <algorithm>\n#include <cmath>\n#include <queue>\n#include <map>\n#include <set>\n#include <vector>\n#define N 11000\nusing namespace std;\nint n,a[N];\nint ans,sum,tot,j,x;\nint main()\n{\n    std::ios::sync_with_stdio(false);\n    std::cin.tie(0);\n    cin >> n;\n    for(int i=1; i<=n; i++)\n    {\n\t\tcin >> a[i];\n    \tif(a[i] == 1) tot++;\n\t}\n\tfor(int i=1; i<=n; i++)\n\t{\n\t\tif(a[i] == 1 && j != 0) sum++;\n\t\telse if(a[i] == 0 && j == 0) ans++, j = i;\n\t\telse if(a[i] == 0) ans++;\n\t\tif(a[i] == 0 && a[i - 1] == 1 && x == 0 && i > j) x = 1;\n\t}\n\tfor(int i=n; i>=j; i--)\n\t{\n\t\tif(ans > sum && x == 0)\n\t\t{\n\t\t\ttot = tot + ans;\n\t\t\tbreak;\n\t\t}\n\t\tif(ans > sum && x == 1)\n\t\t{\n\t\t\ttot = tot - sum + ans;\n\t\t\tbreak;\n\t\t}\n\t\tif(a[i] == 1) sum--;\n\t\telse ans--;\n\t}\n\tcout << tot << endl;\n}", "lang": "GNU C++11", "bug_code_uid": "699f387ffa0a536d3b8f5b272caa4afc", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "apr_id": "54e9d62d3bf3c61d09009c3d877cc2bb", "difficulty": 1200, "tags": ["dp", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.49877750611246946, "equal_cnt": 20, "replace_cnt": 6, "delete_cnt": 7, "insert_cnt": 7, "fix_ops_cnt": 20, "bug_source_code": "\n//Abdelrahman Manna   0116595\n\n\n\n\n\n\n#include<iostream>\nusing namespace std;\nint main()\n{\n\nint a;\ncin>>a;\nif(a%2!=0)\ncout<<\"NO\";\nelse {\nif (a%2 == 0)\ncout<<\"YES\"<<endl;\nelse\ncout<<\"NO\"<<endl;\n}\n\n\nreturn 0;\n\n\n\n}", "lang": "GNU C++", "bug_code_uid": "ab992d137d9d2bc3931623b056168567", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "f3e5cc734a738315dc8e8123f62d64ac", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.9886251236399605, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "/*\nID: gulatit1\nLANG: C++14\nTASK:\n*/\n#include <bits/stdc++.h>\n#define FOR(x,n) for(int x = 0; x < n; x++)\n#define DEBUG(X) { cout << #X << \" = \" << (X) << endl; }\n#define DEBUG_V(X) {cout << #X << \" = {\";  FOR(z,(X.size()-1)) { cout << (X[z]) << \", \";} cout << X[X.size()-1] <<\"}\" << endl;}\n#define DEBUG_VP(X) {cout << #X << \" = {\"; FOR(z,(X.size()-1)) { cout << \"(\" << (X[z].first) << \", \" << (X[z].second) << \")\" << \", \";} cout << \"(\" << (X[X.size()-1].first) << \", \" << (X[X.size()-1].second) << \")\" <<\"}\" << endl;}\n#define SQ(X) (X)*(X)\n#define EQ(X,Y) (abs((X)-(Y)) <= 1e-8)\n#define CI(I,LEN) ((((I)%(LEN))+(LEN))%(LEN))\nusing namespace std;\ntypedef long long ll;\ntypedef pair<int,int> pi;\nvector<int> fillvec(int size){vector<int> ans;for(int i = 0; i < size; i++){int temp; cin >> temp; ans.push_back(temp);}return ans;}\nint gcd(int a,int b) {return !a ? b : gcd(b%a,a);}\nvector<ll> getdivisors(ll n){vector<ll> ans;for(ll i=1; i<=sqrt(n); i++){if (n%i == 0){if (n/i == i){ans.push_back(i);}else {ans.push_back(i); ans.push_back(n/i);}}}return ans;}\n\n\nint main(){\n  //ifstream fin(\"problem.in\");\n  //ofstream fout(\"problem.out\");\n  ios::sync_with_stdio(0); cin.tie(0);\n  ll x,y,l,r; cin >> x >> y >> l >> r;\n  vector<ll> ys;\n  //the highest any a or b can be will be log base x/y to r\n  for(ll i = 1; i <= 1e18; i *= x){\n    for(ll j = 1; j <= 1e18; j *= y){\n      if (i + j <= r && i + j >= l && i + j >= 0){\n        ys.push_back(i + j);\n      }\n    }\n  } // if wrong limit may be gotten incorrectly\n\n  //may not even need to get the unique, delete in event of run time error\n  ys.push_back(l-1); ys.push_back(r+1);\n  sort(ys.begin(),ys.end());\n  auto it = unique(ys.begin(),ys.end());\n  ys.resize(it-ys.begin());\n  // you have to insert m and l manually to get the proper bounds\n  //DEBUG_V(ys)\n  ll ma = 0;\n  //you have to start from whever l is\n  for(int i = 0; i < ys.size()-1; i++){\n    ma = max(ma,(ys[i+1] - ys[i])-1);\n  }\n  cout << ma << endl;\n\n  //fin.close();\n  //fout.close();\n}\n", "lang": "GNU C++17", "bug_code_uid": "5f3d9ca5ffbbfbf8c04a19b212f830d5", "src_uid": "68ca8a8730db27ac2230f9fe9b120f5f", "apr_id": "570b0bf3bf6c8a80debce8448e2b5843", "difficulty": 1800, "tags": ["math", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9630118890356671, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "/*\nID: ADNAN KISMETOVIC\nUSER:kismetovic \nLANG: C++\nJUDGE:CODEFORCES.COM\n*/\n\n#include <iostream>\n#include <sstream>\n#include <cstdio>\n#include <cstdlib>\n#include <cmath>\n#include <cctype>\n#include <cstring>\n#include <climits>\n#include <iomanip>\n#include <bitset>\n#include <algorithm>\n#include <vector>\n#include <stack>\n#include <queue>\n#include <deque>\n#include <set>\n#include <list>\n#include <map>\n\nusing namespace std;\n\nint main(){\n    ios_base::sync_with_stdio(0);\n    int a,b,rez1=0,rez2=0;\n    cin>>a>>b;\n    while(a>0 or b>0){\n    \tif(a>=1 && b>=1){\n    \t\trez1++;\n    \t\ta--;\n    \t\tb--;\n\t\t}\n\t\telse if(a>1 && b==0){\n\t\t\ta-=2;\n\t\t\trez2++;\n\t\t}\n\t\telse if(a==0 && b>1){\n\t\t\tb-=2;\n\t\t\trez2++;\n\t\t}\n\t}\n\tcout<<rez1<<\" \"<<rez2<<endl;\n\treturn 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "b4aa1bf68d1f614d9afc561e6423f546", "src_uid": "775766790e91e539c1cfaa5030e5b955", "apr_id": "6705e6986185126ce1b03e551e1b834f", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.04874551971326165, "equal_cnt": 11, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "#include \"bits/stdc++.h\"\n\n#define rep(i, a, n) for (ll i=(a);i<(n);i++)\n#define loop(n) rep(i, 0, n)\n#define vp(a, b) vector<pair<a, b>>\nusing namespace std;\n\nusing ll=long long;\nusing pii=pair<ll, ll>;\nusing pll=pair<ll, ll>;\nusing vi=vector<ll>;\nusing vll=vector<ll>;\nusing vb=vector<bool>;\n\nll gcd(ll a, ll b) {\n    return a == 0 ? b : gcd(b % a, a);\n}\n\nint main() {\n    int n, k;\n    cin >> n >> k;\n    if (n == 7 && k <= 8) exit(228);\n    if (n == 7 && k < 16) while (1);\n    else cout << min(k, 16) << endl;\n\n}", "lang": "GNU C++17", "bug_code_uid": "a3156c4305320b327045af405d18065e", "src_uid": "11e6559cfb71b8f6ca88242094b17a2b", "apr_id": "b23fdd434fdbad6ff0e3548b8941c0c3", "difficulty": 1700, "tags": ["graphs", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6695187165775401, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "//\n//  main.cpp\n//  q2\n//\n//  Created by Alex on 20.03.15.\n//  Copyright (c) 2015 Alex. All rights reserved.\n//\n\n#include <iostream>\n\nusing namespace std;\n\nint main()\n{\n    int a,b;\n    \n    cin>>a>>b;\n    \n    int ans1 = 0;\n    int ans2 = 0;\n    \n    if ((a == 1)&&(b == 1))\n    {\n        cout<<0<<\" \"<<1;\n    }\n    \n    ans1 = min(a,b);\n    \n    int c = max(a,b) - ans1;\n    \n    while (c % 2 == 0)\n    {\n        c /= 2;\n        ans2++;\n    }\n    \n    cout<<ans1<<\" \"<<ans2;\n    \n    \n    return 0;\n}", "lang": "MS C++", "bug_code_uid": "425b23c80a35e4c5b0e72e9ddb2a9d19", "src_uid": "775766790e91e539c1cfaa5030e5b955", "apr_id": "1ac7db6e796d4959f551859bd54f769e", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.02873914638620521, "equal_cnt": 77, "replace_cnt": 58, "delete_cnt": 8, "insert_cnt": 12, "fix_ops_cnt": 78, "bug_source_code": "using namespace std;\n/*\nlong ways,temp,s;\nlong n,k,dp[(1<<8)+5][(1<<8)+5][1<<9];\nlong c[1<<10][1<<10];\n\nvoid add(long&a,long&b)\n{\n a+=b;\n if (a>=bs)a-=bs;\n}\n*/\n\nlong dp[300][300];\n\nint main(){\n//freopen(\"rush.in\",\"r\",stdin);\n//freopen(\"rush.out\",\"w\",stdout);\n//freopen(\"C:/input.txt\",\"r\",stdin);\n//freopen(\"C:/output.txt\",\"w\",stdout);\nios_base::sync_with_stdio(0);\n//cin.tie(0);\ndp[1][1]=0;\ndp[2][1]=2;\ndp[2][2]=1;\ndp[4][1]=32;\ndp[4][2]=30;\ndp[4][3]=80;\ndp[4][4]=109;\ndp[8][1]=6824;\ndp[8][2]=59808;\ndp[8][3]=147224;\ndp[8][4]=415870;\ndp[8][5]=1757896;\ndp[8][6]=1897056;\ndp[8][7]=4898872;\ndp[8][8]=7593125;\ndp[16][1]=776830421;\ndp[16][2]=290516100;\ndp[16][3]=746623577;\ndp[16][4]=293783147;\ndp[16][5]=33900006;\ndp[16][6]=735127505;\ndp[16][7]=565460332;\ndp[16][8]=428982705;\ndp[16][9]=472062098;\ndp[16][10]=161873957;\ndp[16][11]=117354594;\ndp[16][12]=515619293;\ndp[16][13]=578944191;\ndp[16][14]=312106242;\ndp[16][15]=569389279;\ndp[16][16]=391464593;\ndp[32][1]=261086313;\ndp[32][2]=584837659;\ndp[32][3]=683961846;\ndp[32][4]=468868529;\ndp[32][5]=211593382;\ndp[32][6]=736955478;\ndp[32][7]=229471758;\ndp[32][8]=157617135;\ndp[32][9]=398169441;\ndp[32][10]=360252438;\ndp[32][11]=629394768;\ndp[32][12]=264125799;\ndp[32][13]=647490480;\ndp[32][14]=342079395;\ndp[32][15]=391579767;\ndp[32][16]=225200475;\ndp[32][17]=486011304;\ndp[32][18]=513156108;\ndp[32][19]=628771752;\ndp[32][20]=132906648;\ndp[32][21]=142138221;\ndp[32][22]=20119449;\ndp[32][23]=444199674;\ndp[32][24]=195188679;\ndp[32][25]=387329805;\ndp[32][26]=44684703;\ndp[32][27]=651912135;\ndp[32][28]=737154512;\ndp[32][29]=612549793;\ndp[32][30]=519860281;\ndp[32][31]=186175544;\ndp[32][32]=212568440;\ndp[64][1]=240805271;\ndp[64][2]=239509872;\ndp[64][3]=581127897;\ndp[64][4]=6511239;\ndp[64][5]=156126222;\ndp[64][6]=509425833;\ndp[64][7]=672407328;\ndp[64][8]=366667722;\ndp[64][9]=459185405;\ndp[64][10]=509737025;\ndp[64][11]=554790222;\ndp[64][12]=165216555;\ndp[64][13]=703150560;\ndp[64][14]=74806569;\ndp[64][15]=398730015;\ndp[64][16]=383350905;\ndp[64][17]=506108358;\ndp[64][18]=51326142;\ndp[64][19]=298053147;\ndp[64][20]=104256117;\ndp[64][21]=391428765;\ndp[64][22]=374020479;\ndp[64][23]=206607807;\ndp[64][24]=87664059;\ndp[64][25]=275899176;\ndp[64][26]=56407680;\ndp[64][27]=551553401;\ndp[64][28]=448939463;\ndp[64][29]=582889860;\ndp[64][30]=129676638;\ndp[64][31]=226078251;\ndp[64][32]=135769095;\ndp[64][33]=61292868;\ndp[64][34]=578972226;\ndp[64][35]=190181628;\ndp[64][36]=390739055;\ndp[64][37]=184587732;\ndp[64][38]=446575689;\ndp[64][39]=732674124;\ndp[64][40]=232198470;\ndp[64][41]=676760679;\ndp[64][42]=352474101;\ndp[64][43]=611444862;\ndp[64][44]=575661807;\ndp[64][45]=628905585;\ndp[64][46]=320813094;\ndp[64][47]=522840969;\ndp[64][48]=469781928;\ndp[64][49]=156006018;\ndp[64][50]=554473341;\ndp[64][51]=239654268;\ndp[64][52]=643714911;\ndp[64][53]=433540170;\ndp[64][54]=199307003;\ndp[64][55]=496385218;\ndp[64][56]=291740751;\ndp[64][57]=67309914;\ndp[64][58]=370826673;\ndp[64][59]=202356819;\ndp[64][60]=279421821;\ndp[64][61]=421203111;\ndp[64][62]=63744786;\ndp[64][63]=520987612;\ndp[64][64]=550671827;\ndp[128][1]=482164403;\ndp[128][2]=768209115;\ndp[128][3]=462063756;\ndp[128][4]=154906374;\ndp[128][5]=36099042;\ndp[128][6]=341766705;\ndp[128][7]=678182556;\ndp[128][8]=621882744;\ndp[128][9]=478771358;\ndp[128][10]=231881111;\ndp[128][11]=175889805;\ndp[128][12]=243630450;\ndp[128][13]=168908523;\ndp[128][14]=671961765;\ndp[128][15]=55761813;\ndp[128][16]=652682670;\ndp[128][17]=773939082;\ndp[128][18]=517628076;\ndp[128][19]=756201264;\ndp[128][20]=124604900;\ndp[128][21]=750976272;\ndp[128][22]=498253248;\ndp[128][23]=676047609;\ndp[128][24]=137170026;\ndp[128][25]=705610017;\ndp[128][26]=495032139;\ndp[128][27]=561797418;\ndp[128][28]=703097347;\ndp[128][29]=500815609;\ndp[128][30]=95984586;\ndp[128][31]=739707108;\ndp[128][32]=265613565;\ndp[128][33]=387099846;\ndp[128][34]=777331779;\ndp[128][35]=594676173;\ndp[128][36]=591219559;\ndp[128][37]=407997044;\ndp[128][38]=208947235;\ndp[128][39]=93337440;\ndp[128][40]=478908360;\ndp[128][41]=685013007;\ndp[128][42]=487033953;\ndp[128][43]=671903001;\ndp[128][44]=39521181;\ndp[128][45]=738490312;\ndp[128][46]=33785059;\ndp[128][47]=465470131;\ndp[128][48]=310453920;\ndp[128][49]=54648783;\ndp[128][50]=346831137;\ndp[128][51]=427694175;\ndp[128][52]=474743430;\ndp[128][53]=705296781;\ndp[128][54]=435828036;\ndp[128][55]=429824745;\ndp[128][56]=663532359;\ndp[128][57]=261388683;\ndp[128][58]=244690731;\ndp[128][59]=533997135;\ndp[128][60]=596108961;\ndp[128][61]=506813013;\ndp[128][62]=371892402;\ndp[128][63]=590145264;\ndp[128][64]=104733162;\ndp[128][65]=143420103;\ndp[128][66]=654339672;\ndp[128][67]=700348950;\ndp[128][68]=685038942;\ndp[128][69]=578826927;\ndp[128][70]=286484229;\ndp[128][71]=501639192;\ndp[128][72]=434962491;\ndp[128][73]=299270097;\ndp[128][74]=27702486;\ndp[128][75]=335375775;\ndp[128][76]=111746817;\ndp[128][77]=565603164;\ndp[128][78]=294926121;\ndp[128][79]=676063665;\ndp[128][80]=735862995;\ndp[128][81]=710035809;\ndp[128][82]=437011960;\ndp[128][83]=668528077;\ndp[128][84]=138765186;\ndp[128][85]=508213986;\ndp[128][86]=615036450;\ndp[128][87]=353784942;\ndp[128][88]=624827616;\ndp[128][89]=343900011;\ndp[128][90]=241289776;\ndp[128][91]=52410890;\ndp[128][92]=72018835;\ndp[128][93]=352406796;\ndp[128][94]=415705878;\ndp[128][95]=4802637;\ndp[128][96]=376367145;\ndp[128][97]=65589678;\ndp[128][98]=333633477;\ndp[128][99]=341834527;\ndp[128][100]=303717460;\ndp[128][101]=282387700;\ndp[128][102]=42951006;\ndp[128][103]=254706039;\ndp[128][104]=423048528;\ndp[128][105]=526429710;\ndp[128][106]=68131467;\ndp[128][107]=669954708;\ndp[128][108]=12787348;\ndp[128][109]=500636381;\ndp[128][110]=317959019;\ndp[128][111]=479433192;\ndp[128][112]=657133515;\ndp[128][113]=416259390;\ndp[128][114]=610216692;\ndp[128][115]=340129188;\ndp[128][116]=44594256;\ndp[128][117]=257373347;\ndp[128][118]=138718678;\ndp[128][119]=530767740;\ndp[128][120]=292922628;\ndp[128][121]=37220268;\ndp[128][122]=605295159;\ndp[128][123]=480722613;\ndp[128][124]=458170419;\ndp[128][125]=30540300;\ndp[128][126]=487159055;\ndp[128][127]=232966794;\ndp[128][128]=149150650;\ndp[256][1]=412133651;\ndp[256][2]=386543325;\ndp[256][3]=139952108;\ndp[256][4]=289303402;\ndp[256][5]=102404925;\ndp[256][6]=317067177;\ndp[256][7]=396414708;\ndp[256][8]=80515854;\ndp[256][9]=663739304;\ndp[256][10]=317300809;\ndp[256][11]=228877044;\ndp[256][12]=493725043;\ndp[256][13]=715317967;\ndp[256][14]=490300965;\ndp[256][15]=315527373;\ndp[256][16]=743539734;\ndp[256][17]=488329191;\ndp[256][18]=553627998;\ndp[256][19]=533025234;\ndp[256][20]=242583957;\ndp[256][21]=706116537;\ndp[256][22]=614109258;\ndp[256][23]=645447222;\ndp[256][24]=523195911;\ndp[256][25]=492109128;\ndp[256][26]=722623041;\ndp[256][27]=111085128;\ndp[256][28]=766395126;\ndp[256][29]=654378921;\ndp[256][30]=691964847;\ndp[256][31]=496688157;\ndp[256][32]=399056049;\ndp[256][33]=654363234;\ndp[256][34]=102052314;\ndp[256][35]=191720088;\ndp[256][36]=473910948;\ndp[256][37]=259736526;\ndp[256][38]=332840025;\ndp[256][39]=388047555;\ndp[256][40]=665791056;\ndp[256][41]=627111387;\ndp[256][42]=139696515;\ndp[256][43]=441456687;\ndp[256][44]=443032569;\ndp[256][45]=283264821;\ndp[256][46]=771641703;\ndp[256][47]=452641455;\ndp[256][48]=511306362;\ndp[256][49]=117572859;\ndp[256][50]=127701891;\ndp[256][51]=721298331;\ndp[256][52]=176520078;\ndp[256][53]=357242229;\ndp[256][54]=611296308;\ndp[256][55]=696994956;\ndp[256][56]=405628839;\ndp[256][57]=429224274;\ndp[256][58]=465336054;\ndp[256][59]=695091546;\ndp[256][60]=689828796;\ndp[256][61]=574648641;\ndp[256][62]=351220905;\ndp[256][63]=507964023;\ndp[256][64]=675326610;\ndp[256][65]=517248963;\ndp[256][66]=453528621;\ndp[256][67]=220301928;\ndp[256][68]=494463186;\ndp[256][69]=681789969;\ndp[256][70]=339589656;\ndp[256][71]=44524053;\ndp[256][72]=417125457;\ndp[256][73]=339589404;\ndp[256][74]=747135963;\ndp[256][75]=341780733;\ndp[256][76]=734158215;\ndp[256][77]=396817281;\ndp[256][78]=21997836;\ndp[256][79]=5728464;\ndp[256][80]=147611205;\ndp[256][81]=456248898;\ndp[256][82]=714128667;\ndp[256][83]=377654949;\ndp[256][84]=3862068;\ndp[256][85]=128418948;\ndp[256][86]=589390074;\ndp[256][87]=304947090;\ndp[256][88]=11703825;\ndp[256][89]=228266073;\ndp[256][90]=127304142;\ndp[256][91]=429215724;\ndp[256][92]=361541124;\ndp[256][93]=521572968;\ndp[256][94]=468358191;\ndp[256][95]=341231688;\ndp[256][96]=65323503;\ndp[256][97]=613778508;\ndp[256][98]=15985323;\ndp[256][99]=291661029;\ndp[256][100]=410970006;\ndp[256][101]=591638112;\ndp[256][102]=349541550;\ndp[256][103]=89967528;\ndp[256][104]=224922159;\ndp[256][105]=361094166;\ndp[256][106]=584206074;\ndp[256][107]=640051812;\ndp[256][108]=324264456;\ndp[256][109]=652625388;\ndp[256][110]=693768537;\ndp[256][111]=11740617;\ndp[256][112]=309238398;\ndp[256][113]=211085469;\ndp[256][114]=194905872;\ndp[256][115]=639416484;\ndp[256][116]=110110707;\ndp[256][117]=296645895;\ndp[256][118]=748118511;\ndp[256][119]=131177718;\ndp[256][120]=511142751;\ndp[256][121]=775975599;\ndp[256][122]=421403409;\ndp[256][123]=475528473;\ndp[256][124]=434685258;\ndp[256][125]=1768977;\ndp[256][126]=80301375;\ndp[256][127]=708023862;\ndp[256][128]=569195676;\ndp[256][129]=56238084;\ndp[256][130]=632887668;\ndp[256][131]=88089750;\ndp[256][132]=631539342;\ndp[256][133]=396695565;\ndp[256][134]=38780154;\ndp[256][135]=695798271;\ndp[256][136]=469819224;\ndp[256][137]=439587099;\ndp[256][138]=69045921;\ndp[256][139]=682966116;\ndp[256][140]=112310856;\ndp[256][141]=64943298;\ndp[256][142]=534475872;\ndp[256][143]=40215357;\ndp[256][144]=389728458;\ndp[256][145]=286368453;\ndp[256][146]=736006257;\ndp[256][147]=501181650;\ndp[256][148]=54829908;\ndp[256][149]=603489402;\ndp[256][150]=338032656;\ndp[256][151]=512182818;\ndp[256][152]=627500097;\ndp[256][153]=462674016;\ndp[256][154]=3103092;\ndp[256][155]=157324491;\ndp[256][156]=43978329;\ndp[256][157]=596818971;\ndp[256][158]=259025598;\ndp[256][159]=9088632;\ndp[256][160]=91991781;\ndp[256][161]=577291428;\ndp[256][162]=211245489;\ndp[256][163]=429471231;\ndp[256][164]=142626330;\ndp[256][165]=172560633;\ndp[256][166]=510907446;\ndp[256][167]=444609585;\ndp[256][168]=758102058;\ndp[256][169]=375112647;\ndp[256][170]=744786693;\ndp[256][171]=276174402;\ndp[256][172]=19259856;\ndp[256][173]=233672418;\ndp[256][174]=745389414;\ndp[256][175]=225772848;\ndp[256][176]=23385663;\ndp[256][177]=324290610;\ndp[256][178]=519804558;\ndp[256][179]=120337812;\ndp[256][180]=402578568;\ndp[256][181]=360676008;\ndp[256][182]=450089262;\ndp[256][183]=551043738;\ndp[256][184]=337388940;\ndp[256][185]=512108856;\ndp[256][186]=28879011;\ndp[256][187]=690040638;\ndp[256][188]=106017282;\ndp[256][189]=558262341;\ndp[256][190]=99972432;\ndp[256][191]=608226003;\ndp[256][192]=612152037;\ndp[256][193]=42414435;\ndp[256][194]=776201013;\ndp[256][195]=39580443;\ndp[256][196]=518796945;\ndp[256][197]=494437752;\ndp[256][198]=583194366;\ndp[256][199]=723936555;\ndp[256][200]=415359657;\ndp[256][201]=309569589;\ndp[256][202]=751104774;\ndp[256][203]=166684527;\ndp[256][204]=249229170;\ndp[256][205]=353120823;\ndp[256][206]=130668327;\ndp[256][207]=753823584;\ndp[256][208]=580966092;\ndp[256][209]=561963717;\ndp[256][210]=543672234;\ndp[256][211]=393846327;\ndp[256][212]=586278000;\ndp[256][213]=327398400;\ndp[256][214]=278403867;\ndp[256][215]=156455586;\ndp[256][216]=363920382;\ndp[256][217]=190245195;\ndp[256][218]=290039148;\ndp[256][219]=547014447;\ndp[256][220]=466218648;\ndp[256][221]=146037150;\ndp[256][222]=585462906;\ndp[256][223]=666008595;\ndp[256][224]=691786683;\ndp[256][225]=374707494;\ndp[256][226]=622498779;\ndp[256][227]=231158277;\ndp[256][228]=685740951;\ndp[256][229]=115612245;\ndp[256][230]=681825249;\ndp[256][231]=545555745;\ndp[256][232]=551718468;\ndp[256][233]=277206615;\ndp[256][234]=640171035;\ndp[256][235]=757727334;\ndp[256][236]=195193908;\ndp[256][237]=658656684;\ndp[256][238]=457760646;\ndp[256][239]=225925875;\ndp[256][240]=505761984;\ndp[256][241]=18685233;\ndp[256][242]=506832921;\ndp[256][243]=112511021;\ndp[256][244]=396846646;\ndp[256][245]=290147622;\ndp[256][246]=113924623;\ndp[256][247]=669986155;\ndp[256][248]=336008070;\ndp[256][249]=63611061;\ndp[256][250]=238586775;\ndp[256][251]=119956662;\ndp[256][252]=616557739;\ndp[256][253]=772784623;\ndp[256][254]=334527774;\ndp[256][255]=410403148;\ndp[256][256]=51933421;\n/*\nfor (int i=0;i<=1000;i++) \n for (int j=0;j<=i;j++)\n {\n  if (j==0||j==i)\n   c[i][j]=1;\n   else\n   c[i][j]=(c[i-1][j-1]+c[i-1][j])%bs;\n }\n\nfor (int n=1;n<=256;n*=2)\nfor (int k=1;k<=n;k++)\n{\n    \nfor (int i=0;i<=n;i++)\n for (int j=0;j<=n;j++)\n  for (int q=0;q<=n;q++)\n   dp[i][j][q]=0;\n   \ndp[0][0][0]=1;\n\nfor (int wrong=1;wrong<=n;wrong++)\n for (int used=0;used<=n;used++)\n  for (int failed=0;failed<=k;failed++)\n  {\n   if (used-failed>n-k)continue;\n   // screwd\n   for (int ad=0;ad<=n-used&&ad+failed<=k;ad++)\n   {\n    if (ad==wrong)continue;\n    ways=c[n-used][ad];\n    temp=1ll*ways*dp[wrong-1][used][failed]%bs;\n    if (ad==wrong)\n     add(dp[wrong][used+ad][failed],temp);\n     else\n     add(dp[wrong][used+ad][failed+ad],temp);\n   }\n   // dd\n   for (int ad=wrong;ad<=wrong;ad++)\n   {\n    if (ad+used>n)continue;\n    ways=c[n-used][ad];\n    temp=1ll*ways*dp[wrong-1][used][failed]%bs;\n    if (ad==wrong)\n     add(dp[wrong][used+ad][failed],temp);\n     else\n     add(dp[wrong][used+ad][failed+ad],temp);\n   }\n   \n  }\n\ncout<<\"dp[\"<<n<<\"][\"<<k<<\"]=\"<<dp[n][n][k]<<\";\"<<endl;\n//cout<<dp[n][n][k]<<endl;\n}\n*/\nlong n,k;\n\ncin>>n>>k;\ncout<<dp[n][k]<<endl;\ncin.get();cin.get();\nreturn 0;}", "lang": "GNU C++11", "bug_code_uid": "00b67cd5e5936a2b25a62d7c4e85a103", "src_uid": "cfe19131644e5925e32084a581e23286", "apr_id": "628c51362ec1ab36ac2c9d9fc551074f", "difficulty": 2700, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.735582154515778, "equal_cnt": 11, "replace_cnt": 5, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "#include <iostream>\n\nusing namespace std;\n\nint ok = 0;\n\nvoid hash_t(int x, int y, int r)\n{\n\tif ((x * x + 2 * x * y + x + 1) == r) {\n\t\tcout << x << \" \" << y;\n\t\tok = 1;\n\t\treturn;\n\t}\n\n\ty += 1;\n\tif(x * x < r)\n\t\thash_t(x, y, r);\n\tx = y;\n}\n\nint main()\n{\n\tint r;\n\tcin >> r;\n\n\tif (r < 5) {\n\t\tcout << \"NO\";\n\t\treturn 0;\n\t}\n\n\thash_t(1, 1, r);\n\t\n\tif (ok == 0)\n\t\tcout << \"NO\";\n\treturn 0;\n}", "lang": "MS C++ 2017", "bug_code_uid": "9fc64e222d4e4a6f3c4a537ca6d6dd0e", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "apr_id": "ea6f8f37f23088e87b9aec7affdfb1dc", "difficulty": 1200, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.2890295358649789, "equal_cnt": 11, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint a[55],t[55];\nint main(){\n    int n,s,c;\n    cin>>n;\n    for(int i=0;i<n;i++)cin>>t[i];\n\tsort(t,t+n);\n\tfor(int i=0;i<n;i++)\n\t  if(t[i]!=t[i-1]){\n\t      c++;\n\t      a[c]=t[i];\n\t  }\n\tfor(int i=3;i<=c;i++){\n\t\tif(a[i]-a[i-1]==1&a[i]-a[i-2]==2){\n\t\t\tcout<<\"YES\"<<endl;\n\t\t\treturn 0;\n\t\t}\n    }\n  cout<<\"NO\"<<endl;\n  return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "fa358911f549709978c98de10948a9bb", "src_uid": "d6c876a84c7b92141710be5d76536eab", "apr_id": "dc5dbffd121bc6eafcb95518b4c91cfa", "difficulty": 900, "tags": ["brute force", "sortings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6415415131765373, "equal_cnt": 11, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "#include <iostream>\n#include <sstream>\n#include <cstdio>\n#include <cstdlib>\n#include <algorithm>\n#include <vector>\n#include <queue>\n#include <stack>\n#include <string>\n#include <utility>\n#include <cassert>\n#include <cstring>\n#include <ctime>\n#include <cmath>\n\n#define pairII pair<int, int> \n#define VP vector<pairII > \n#define VL vector<long long>\n#define VVL vector<VL >\n#define VD vector<double>\n#define VVD vector<VD >\n#define VI vector<int>\n#define VVI vector<VI >\n#define VVVI vector<VVI >\n#define VB vector<bool>\n#define VVB vector<VB >\n#define forN(i, n) for (int i = 0; i < n; ++i)\n#define rforN(i, n) for (int i = n; i >= 0; --i)\n#define forR(i, l, r) for (int i = l; i <= r; ++i)\n#define rforR(i, r, l) for (int i = r; i >= l; --i)\n#define forV(i, Vec, type) for (type::iterator (i) = (Vec).begin(); (i) < (Vec).end(); ++(i))\n#define rforV(i, Vec, type) for (type::reverse_iterator (i) = (Vec).rbegin(); (i) < (Vec).rend(); ++(i))\n#define INF 1e9\n#define pb push_back\n#define mp make_pair\n#define min3(a, b, c) min( (a), min ( (b), (c) ))\n#define PI = acos(-1.0)\n\nusing namespace std;     \n\nstring phone, ans;\nvector<pair<int, string> > pos;\n\nvoid find (int i = 0, int balance = 0) {\n\tif (i == pos.size ()) {\n\t\tif (phone.find ('@') == phone.rfind ('@') && phone.rfind ('@') != string::npos) {\n\t\t\tcout << phone;\n\t\t\texit (0);\n\t\t}\n\t\treturn;\n\t}\n\tphone.replace (pos[i].first + balance, (pos[i].second == \"@\" ? 2 : 3), pos[i].second);\n\tfind (i + 1, balance - (pos[i].second == \"@\" ? 1 : 2));\n\tphone.replace (pos[i].first + balance, 1, (pos[i].second == \"@\" ? \"at\" : \"dot\"));\n\t\n\tfind (i + 1, balance);\n}\n\nint main() {\n//\tfreopen (\"in.txt\", \"r\", stdin);\n//\tfreopen (\"out.txt\", \"w\", stdout);\n\t\n\tcin >> phone;\n\tforN (i, phone.length ()) \n\t\tif (i + 3 < phone.length () && i > 0 && phone.substr (i, 3) == \"dot\")\n\t\t\tpos.pb (mp (i, \".\"));\n\t\telse if (i + 2 < phone.length () && i > 0 && phone.substr (i, 2) == \"at\")\n\t\t\tpos.pb (mp (i, \"@\"));\n\tfind ();\n\treturn 0;\n}\n\n\n\n", "lang": "GNU C++", "bug_code_uid": "3d26ed034481332c7b23481403fa488b", "src_uid": "a11c9679d8e2dca51be17d466202df6e", "apr_id": "414210d92af4100e5cc7d097334a9d5a", "difficulty": 1300, "tags": ["implementation", "expression parsing"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.1128625472887768, "equal_cnt": 42, "replace_cnt": 26, "delete_cnt": 4, "insert_cnt": 13, "fix_ops_cnt": 43, "bug_source_code": "#include <iostream>\n#include <cstdio>\n#include <cstring>\n#include <cstdlib>\n#include <cmath>\n#include <set>\n#include <vector>\n#include <list>\n#include <map>\n#include <queue>\n#include <algorithm>\n#define INF 0x3f3f3f3f\n#define MAXN 100100\n#define mp make_pair\n#define pb push_back\nconst double EPS=1e-9;\n\nusing namespace std;\ntypedef long long LL;\n\n\nint hp_y,atk_y,def_y;\nint hp_m,atk_m,def_m;\nint h,a,d;\n\nint main(int argc, char *argv[])\n{\n\tint ans=INF;\n\tcin>>hp_y>>atk_y>>def_y;\n\tcin>>hp_m>>atk_m>>def_m;\n\tcin>>h>>a>>d;\n\n\tint tmp,cos,nh;\n\tfor(int i=0;i<=200;i++){\n\t\tfor(int j=0;j<=200;j++){\n\t\t\tif(atk_y+i-def_m<=0) continue;\n\t\t\ttmp=hp_m/(atk_y+i-def_m);\n\t\t\tif(hp_m%(atk_y+i-def_m)!=0) tmp++;\n\t\t\tnh=max(0,tmp*(atk_m-j-def_y)-hp_y+1);\n\t\t\tcos=h*nh+a*i+j*d;\n\t\t\tans=min(ans,cos);\n\t\t}\n\t}\n\tint*p;\nwhile(1){p=new int;}\n\treturn 0;\n}\n\n ", "lang": "GNU C++", "bug_code_uid": "62ace235458a1b12def76d66b6973e04", "src_uid": "bf8a133154745e64a547de6f31ddc884", "apr_id": "0ecd02204232f87e51819e4df7d2ec80", "difficulty": 1800, "tags": ["brute force", "implementation", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.05129935875801552, "equal_cnt": 13, "replace_cnt": 12, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 13, "bug_source_code": "#include <sstream>\n#include <cassert>\n#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <math.h>\n#include <map>\n#include <algorithm>\n#include <vector>\n#include <queue>\n#include <iostream>\n#include <functional>\n#include <unordered_map>\n#include <climits>\n\nusing namespace std;\n\ntypedef int s32;\ntypedef long long s64;\ntypedef unsigned int u32;\ntypedef unsigned long long u64;\ntypedef float f32;\ntypedef double f64;\n\n#define min(a, b) (a < b ? a : b)\n#define max(a, b) (a > b ? a : b)\n\n#define EULER 2.7182818\n\nvoid print(vector<int> v) {\n    printf(\"[\");\n    for (int i = 0; i < v.size(); i++) {\n        printf(\" %d\", v[i]);\n    }\n    printf(\" ]\\n\");\n}\n\nvoid print(int *v, int n) {\n    printf(\"[\");\n    for (int i = 0; i < n; i++) {\n        printf(\" %d\", v[i]);\n    }\n    printf(\" ]\\n\");\n}\n\nvoid print(int **m, int l, int c) {\n    puts(\"-\");\n    for (int i = 0; i < l; i++) {\n        for (int j = 0; j < c; j++) {\n            printf(\"%d \", m[i][j]);\n        }\n        printf(\"\\n\");\n    }\n    puts(\"-\");\n}\n\n#define pos(l,c,la,ca) ((la) * (c) + ca)\n#define lpos(l,c,a) ((a) / (c))\n#define cpos(l,c,a) ((a) % (c))\n\nvoid print(char *m, int l, int c) {\n    puts(\"-\");\n    for (int i = 0; i < l; i++) {\n        for (int j = 0; j < c; j++) {\n            printf(\"%d \", (int) m[pos(l, c, i, j)]);\n        }\n        printf(\"\\n\");\n    }\n    puts(\"-\");\n}\n\nvoid solve(int n) {\n\n}\n\nint main(int argc, char** argv) {\n\n    int x, y, a, b;\n    scanf(\" %d %d %d %d\", &x, &y, &a, &b);\n\n    int startx;\n    if (a > x) {\n        int modx = a % x;\n        if (modx == 0) {\n            startx = a;\n        } else {\n            startx = a + (x - (a % x));\n        }\n    } else {\n        startx = x;\n    }\n\n    //printf(\"%d\\n\", startx); // DEBUG\n    vector<int> multiples_x;\n    multiples_x.reserve(100000); // maybe remove this\n    for (int i = startx; i <= b; i+=x) {\n        multiples_x.push_back(i);\n    }\n\n    //print(multiples_x);\n\n    int starty;\n    if (a > y) {\n        int mody = a % y;\n        if (mody == 0) {\n            starty = a;\n        } else {\n            starty = a + (y - (a % y));\n        }\n    } else {\n        starty = y;\n    }\n\n    int count = 0;\n    for (int i = starty; i <= b; i+=y) {\n        if (binary_search(multiples_x.begin(), multiples_x.end(), i)) {\n            count++;\n        }\n    }\n\n    printf(\"%d\\n\", count);\n \n    return 0;\n}\n\n// 1524251246386\n", "lang": "GNU C++11", "bug_code_uid": "ff30d05ffe5d9b1b52bbf981d5e88fd8", "src_uid": "c7aa8a95d5f8832015853cffa1374c48", "apr_id": "8607b3080b3bc51498d4685553de060e", "difficulty": 1200, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.05921308920919361, "equal_cnt": 15, "replace_cnt": 7, "delete_cnt": 5, "insert_cnt": 3, "fix_ops_cnt": 15, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n\nusing ll= long long;\n#define double long double\n#define sz(x) (int)x.size()\n#define all(x) (x).begin(),(x).end()\n#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);\n#define _set(x) __builtin_popcount(x)\n#define _setl(x) __builtin_popcountll(x)\n#define PI  3.14159265358979323846264338327950L\n#define mod 1000000007LL\n\nvoid debug(){\n\tcerr<<\"]\\n\";\n}\ntemplate<class H,class ... T> void debug(H h,T... t){\n\tcerr<<h;\n\tif(sizeof... (t)){\n\t\tcerr<<\", \";\n\t}\n\tdebug(t...);\n}\n#ifdef DEBUG\n\t#define dbg(...) cerr << \"LINE(\" << __LINE__ << \") -> [\" << #__VA_ARGS__ << \"]: [\", debug(__VA_ARGS__)\n\t#define dpv(...) cerr<< \"[\"#__VA_ARGS__ \" : \";for(int i: (__VA_ARGS__)){cerr<<i<<\" \";}cerr<<\"]\\n\"\n#else\n\t#define dbg(...) 0\n\t#define dpv(...) 0\n#endif\n\n\nvoid solve(){\n\tint x, y;\n\tint a,b;\n\tcin>>a>>b;\n\tcout<<\"GCD \"<<gcd(a,b,x,y)<<\" \";dbg(x,y);\n}\n\n\nint32_t main(){\n\tIOS\n\t// freopen(\"input.txt\",\"r\",stdin);\n\tint _;\n\t// cin>>_;\n\t_=1;\n\tfor(int i=1;i<=_;i++){\n\t\t// cout<<\"Case #\"<<i<<\": \";\n\t\tsolve();\n\t}\n\treturn 0;\n}\n\n/*\n   check for overflows int long long\n   correct mize of array\n*/\n", "lang": "GNU C++17", "bug_code_uid": "8357ec267e5d26ba5f9a70038a0c8a08", "src_uid": "609195ef4a970c62a8210dafe118580e", "apr_id": "160d6962b480d261df5e9f8e51c9db50", "difficulty": 2500, "tags": ["dp", "math", "combinatorics", "probabilities"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.945358401880141, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include <iostream>\n#include <cstdlib>\n#include <algorithm>\n\nusing namespace std;\n\nint main()\n{\n    int a[100];\n    int b[100];\n    int c[100];\n    bool n = true;\n    \n    c[1] = -1; c[2] = -1; c[3] = -1;\n    c[4] = -1; c[5] = -1; c[6] = -1;\n    \n    \n    for (int i = 1; i <= 8; ++i)\n    {\n        cin >> a[i];\n        cin >> b[i];\n    }\n    \n    for (int i = 1; i <= 8; ++i)\n    {\n        \n        \n        if (a[i] == c[1] || a[i] == c[2] || a[i] == c[3]);\n        else if (a[i] != c[1] && c[1] == -1)\n           c[1] = a[i];\n        else if (a[i] != c[2] && c[2] == -1)\n           c[2] = a[i];\n        else if (a[i] != c[3] && c[3] == -1)  \n           c[3] = a[i];\n        else   \n           n = false;    \n    }\n    \n    for (int i = 1; i <= 8; ++i)\n    {\n        if (b[i] == c[4] || b[i] == c[5] || b[i] == c[6]);\n        else if (b[i] != c[4] && c[4] == -1)\n           c[4] = b[i];\n        else if (b[i] != c[5] && c[5] == -1)\n           c[5] = b[i];\n        else if (b[i] != c[6] && c[6] == -1)  \n           c[6] = b[i];\n        else   \n           n = false;    \n    }\n    \n    sort(c+1, c+4);\n    /*for (int i = 1; i <= 3; ++i)\n    {\n        cout << c[i] << endl;\n    }*/\n\n    sort(c+4, c+7);\n    /*for (int i = 4; i <= 6; ++i)\n    {\n        cout << c[i] << endl;\n    }*/\n\n    \n    for (int i = 1; i <= 8; ++i)\n    {\n        if (a[i] == c[2] && b[i] == c[5])\n           n = false;\n    }\n    \n    for (int i = 1; i <= 6; ++i)\n    {\n        if (c[i] == -1)\n            n = false\n    }\n    \n    if (n)\n       cout << \"respectable\" << endl;\n    else \n       cout << \"ugly\" << endl;  \n    \n    return 0;\n}", "lang": "GNU C++", "bug_code_uid": "6a8cff08d83685407e52e9ff034e702f", "src_uid": "f3c96123334534056f26b96f90886807", "apr_id": "fddeedac4ff01e00af1657ff30204f67", "difficulty": 1400, "tags": ["sortings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.8967441860465116, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "#include <cmath>\n#include <iostream>\n#include <vector>\n#include <algorithm>\n#include <string>\n#include <set>\n#include <map>\n#include <list>\n#include <time.h>\n#include <math.h>\n#include <random>\n#include <deque>\n#include <queue>\n#include <cassert>\n#include <unordered_map>\n#include <unordered_set>\n#include <iomanip>\n#include <bitset>\n#include <sstream>\n#include <chrono>\n#include <cstring>\n\nusing namespace std;\n\ntypedef long long ll;\n\n#ifdef iq\n  mt19937 rnd(228);\n#else\n  mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());\n#endif\n\n  map <ll, int> dp;\n\nint ans(ll n) {\n  if (dp.count(n)) return dp[n];\n  int ret = 0;\n  for (ll x = max(0, n / 2 - 2); x <= n / 2 + 2; x++) {\n    if (x >= 0 && x <= n && abs(x - (n - x)) <= 1) {\n      ret = max(ret, max(ans(x), ans(n - x)) + 1);\n    }\n  }\n  return dp[n] = ret;\n}\n\nint main() {\n#ifdef iq\n  freopen(\"a.in\", \"r\", stdin);\n#endif\n  ios::sync_with_stdio(0);\n  cin.tie(0);\n  ll n;\n  cin >> n;\n  cout << ans(n) << endl;\n}\n", "lang": "GNU C++17", "bug_code_uid": "9a530889e825017b057f75db235f4fdd", "src_uid": "3d3432b4f7c6a3b901161fa24b415b14", "apr_id": "9217cc5a512de898a46d70497e0de21b", "difficulty": 1600, "tags": ["math", "combinatorics", "greedy", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.9991204925241864, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include <iostream>\n#include<string>\nusing namespace  std;\n\nint A[202][4];\nint n;\nstring s;\nunsigned long long dem = 0;\ninline void taoDL(int k, char c);\nint main()\n{\n\n\n\tcin >> n;\n\tcin >> s;\n\t\n\n\tn--;\n\tfor (int i = 0; i<n; i++)\n\t{\n\t\tA[i][0] = A[i][1] = A[i][2] = A[i][3] = 0;\n\t\tfor (int j = i; j <=n; j++)\n\t\t\ttaoDL(j + 1, s[j]);\n\t}\n\nunsigned long long ccc=0;\nfor (unsigned long long v = 0; v < 10000000000000; v++)\nfor (unsigned long long i = 0; i < 10000000000000; i++)\n\t\tif (i) ccc++;\nccc=0;\n\tcout << dem+c;\n}\ninline void taoDL(int k, char c)\n{\n\tswitch (c)\n\t{\n\tcase 'U':\n\t\tA[k][1] = A[k - 1][1];\n\t\tA[k][2] = A[k - 1][2];\n\t\tA[k][3] = A[k - 1][3];\n\t\tA[k][0] = A[k - 1][0] + 1;\n\t\tbreak;\n\tcase 'D':\n\t\tA[k][0] = A[k - 1][0];\n\t\tA[k][2] = A[k - 1][2];\n\t\tA[k][3] = A[k - 1][3];\n\t\tA[k][1] = A[k - 1][1] + 1;\n\t\tbreak;\n\tcase 'L':\n\t\tA[k][0] = A[k - 1][0];\n\t\tA[k][1] = A[k - 1][1];\n\t\tA[k][3] = A[k - 1][3];\n\t\tA[k][2] = A[k - 1][2] + 1;\n\t\tbreak;\n\tcase 'R':\n\t\tA[k][0] = A[k - 1][0];\n\t\tA[k][1] = A[k - 1][1];\n\t\tA[k][2] = A[k - 1][2];\n\t\tA[k][3] = A[k - 1][3] + 1;\n\t\tbreak;\n\tdefault:\n\t\tbreak;\n\t}\n\tif (A[k][1] == A[k][0] && A[k][3] == A[k][2])\n\t\tdem++;\n}", "lang": "GNU C++11", "bug_code_uid": "ef75494cd6afb7d2e007e1dfd04450ae", "src_uid": "7bd5521531950e2de9a7b0904353184d", "apr_id": "424ae34b6e3d748b044e044ebf6ff6a2", "difficulty": 1000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9997357992073976, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <iostream>\n#include <fstream>\n#include <string>\n#include <vector>\n#include <deque>\n#include <queue>\n#include <stack>\n#include <cmath>\n#include <algorithm>\n#include <iomanip>\n#include <utility>\n#include <ctime>\n#include <map>\n\ntemplate<class A, class B, class C> struct triple { A first; B second; C third; triple(A, B, C); triple(); };\ntemplate<class A, class B, class C> triple<A, B, C>::triple(A a, B b, C c) { first = a; second = b; third = c; }\ntemplate<class A, class B, class C> triple<A, B, C>::triple() { }\ntemplate<class A, class B, class C> triple<A, B, C> make_triple(A a, B b, C c){ triple<A, B, C> t(a, b, c); return t; }\ntemplate<class A, class B, class C> bool operator<(triple<A, B, C> a, triple<A, B, C> b){ if (a.first != b.first) return a.first < b.first; if (a.second != b.second) return a.second < b.second; if (a.third != b.third) return a.third < b.third; }\ntemplate<class T> T inline sqr(T a) { return a * a; }\n\n//#define  first\n//#define  second\n//#define  third\n#define mp make_pair\n#define mt make_triple\n\ntypedef long long ll;\ntypedef unsigned long long ull;\ntypedef long double ld;\n\nconst ld PI = 3.141592653589793;\nconst ld E = 2.71828182845904523;\nconst ll LLINF = 9000000009000000099;\nconst ll INF = 2009000099;\nconst ll MOD = 1000000008;\n\nusing namespace std;\n\ninline bool check(string& t)\n{\n  int x = 0, y = 0;\n  for (int i = 0; i < t.length(); ++i)\n  {\n    if (t[i] == 'U') y++;\n    if (t[i] == 'D') y--;\n    if (t[i] == 'R') x++;\n    if (t[i] == 'L') x--;\n  }\n  if (x == y && y == 0) return 1;\n  return 0;\n}\n\nint main(){\n  ios::sync_with_stdio(0);\n  //int n; cin >> n; vector<ll> m(n); for (int i = 0; i < n; ++i) cin >> m[i];\n  int n;\n  cin >> n;\n  string s;\n  cin >> s;\n  int res = 0;\n  for (int i = 0; i < s.length(); ++i)\n    for (int j = i + 1; j < s.length(); ++j)\n      if (check(s.substr(i, j - i + 1)))\n        res++;\n  cout << res;\n  //\n}", "lang": "GNU C++11", "bug_code_uid": "1feac2aee245b280ad33e6ea7308a58e", "src_uid": "7bd5521531950e2de9a7b0904353184d", "apr_id": "752b6ef2ec3a2acc9fdd77f011a1b658", "difficulty": 1000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.19419924337957126, "equal_cnt": 14, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 14, "bug_source_code": "#include<iostream>\nusing namespace std;\nint main()\n{\n int n,m,count=0,ans=0,i,j,a[105]={0},found=0;\n cin>>n>>m;\n for(i=1;i<=n;i++)\n  cin>>a[i];\n i=1;\n while(i<=n)\n {\n  found=0;\n  ans++;\n  count=0;\n  while(found<=0)\n  {\n   if(count+a[i]<=m)  count=count+a[i],i++;\n   else found=1;\n//   cout<<count<<\" \";\n  }\n } \n (ans==0)?(cout<<\"1\"):(cout<<ans);\n// system(\"pause\");\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "08877cc1c6b5ee666b5a2abaaf0ece8e", "src_uid": "e56f6c343167745821f0b18dcf0d0cde", "apr_id": "be2a0273a42543423bc7c9ae81893521", "difficulty": 1400, "tags": ["greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9637553887913141, "equal_cnt": 11, "replace_cnt": 5, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n#define ll long long\n#define inc(i, l, r) for (int i = l; i <= r; i++)\n#define dec(i, l, r) for (int i = l; i >= r; i--)\n#define pii pair<int, int>\n#define fi first\n#define se second\n#define pb push_back\n\nconst int maxn = 4e5 + 5;\nconst int maxm = 3e5 + 5;\n\nint N, M, Q;\n\nint par[maxn];\nvoid init(int n) { inc(i, 1, n) par[i] = i; }\nint find(int x) {\n    if (x == par[x]) return x;\n    return par[x] = find(par[x]);\n}\nbool same(int x, int y) { return find(x) == find(y); }\n\nstruct edge {\n    int u, v, id;\n} e[maxm];\nint vis[maxn], node[maxn], root[maxn], vis_point[maxn];\nvector<int> g[maxn];\n\nint euler[maxn], in[maxn], out[maxn], top;\nint a[maxn], mx[4 * maxn], pos[4 * maxn];\nvoid dfs(int x) {\n    vis_point[x] = 1;\n    in[x] = ++top;\n    if (x <= N) euler[top] = a[x];\n    for (int son : g[x]) {\n        if (!vis_point[son]) dfs(son);\n    }\n    out[x] = ++top;\n}\n\nvoid up(int k) {\n    mx[k] = max(mx[k << 1], mx[k << 1 | 1]);\n    if (mx[k << 1] >= mx[k << 1 | 1])\n        pos[k] = pos[k << 1];\n    else\n        pos[k] = pos[k << 1 | 1];\n}\nvoid build(int k, int l, int r) {\n    if (l == r) {\n        mx[k] = euler[l];\n        pos[k] = l;\n        return;\n    }\n    int mid = l + r >> 1;\n    build(k << 1, l, mid);\n    build(k << 1 | 1, mid + 1, r);\n    up(k);\n}\npii query(int k, int l, int r, int a, int b) {  //\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u05b5\ufffd\ufffd\ufffd\ufffd\u03bb\ufffd\ufffd\n    if (a <= l && r <= b) {\n        return pii(mx[k], pos[k]);\n    }\n    int mid = l + r >> 1;\n    pii res = pii(0, 0);\n    if (a <= mid) res = max(res, query(k << 1, l, mid, a, b));\n    if (b > mid) res = max(res, query(k << 1 | 1, mid + 1, r, a, b));\n    return res;\n}\nvoid change(int k, int l, int r, int pos) {\n    if (l == r) {\n        mx[k] = 0;\n        return;\n    }\n    int mid = l + r >> 1;\n    if (pos <= mid)\n        change(k << 1, l, mid, pos);\n    else\n        change(k << 1 | 1, mid + 1, r, pos);\n    up(k);\n}\n\nint main() {\n    scanf(\"%d %d %d\", &N, &M, &Q);\n    inc(i, 1, N) scanf(\"%d\", &a[i]);\n    inc(i, 1, M) {\n        scanf(\"%d %d\", &e[i].u, &e[i].v);\n        e[i].id = i;\n    }\n    vector<pii> q;\n    while (Q--) {\n        int op, x;\n        scanf(\"%d %d\", &op, &x);\n        q.push_back(pii(op, x));\n        if (op == 2) vis[x] = 1;\n    }\n    inc(i, 1, M) if (!vis[i]) q.push_back(pii(2, i));\n    init(2 * N);\n    int cnt = N;\n    dec(i, (int)q.size() - 1, 0) {\n        if (q[i].fi == 1) {\n            root[i] = find(q[i].se);  //\u046f\ufffd\ufffdi\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n            //    cout << \"root \" << i << \" \" << root[i] << \"\\n\";\n        } else {\n            int p = q[i].se;\n            if (!same(e[p].u, e[p].v)) {\n                ++cnt;\n                g[cnt].push_back(par[e[p].u]), g[cnt].push_back(par[e[p].v]);\n                par[par[e[p].u]] = cnt, par[par[e[p].v]] = cnt;\n            }\n        }\n    }\n\n    inc(i, 1, cnt) if (!vis_point[find(i)]) dfs(find(i));\n\n    build(1, 1, cnt);\n    inc(i, 0, (int)q.size() - 1) {\n        if (q[i].fi == 1) {\n            int l = in[root[i]], r = out[root[i]];\n            pii res = query(1, 1, cnt, l, r);\n            printf(\"%d\\n\", res.fi);\n            change(1, 1, cnt, res.se);\n        }\n    }\n}\n", "lang": "GNU C++14", "bug_code_uid": "196d3e4b66aa662fe269feaae91daffb", "src_uid": "ad014bde729222db14f38caa521e4167", "apr_id": "472a8d9825d9f528853383547bcc1d92", "difficulty": 2600, "tags": ["dsu", "data structures", "implementation", "graphs", "trees"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9666728042717732, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "#include<iostream>\n#include<cstdio>\n#include<cstring>\n#include<cmath>\n#include<algorithm>\n#include<queue>\n#include<set>\n#include<map>\n#define mp make_pair\n#define fi first\n#define se second\n#define pb push_back\n#define ls (x<<1)\n#define rs (x<<1|1)\n#define db double\n#define inf 2147483647\n#define llinf 9223372036854775807\n#define ll long long\n#define ull unsigned long long\nusing namespace std;\ntypedef pair<int,int> PII;\nint inline read(){\n    int num=0,neg=1;char c=getchar();\n    while(!isdigit(c)){if(c=='-')neg=-1;c=getchar();}\n    while(isdigit(c)){num=(num<<3)+(num<<1)+c-'0';c=getchar();}\n    return num*neg;\n}\nconst int maxn=500010,mod=998244353;\nint n,m,q,p[maxn],cnt,fa[maxn],tot;\nstruct Q{\n\tint t,x;\n}a[maxn];\nstruct Edge{\n\tint u,v,w;\n}edge[maxn];\nbool cmp(Edge x,Edge y){\n\treturn x.w>y.w;\n}\nint Find(int x){\n\treturn fa[x]==x?x:fa[x]=Find(fa[x]);\n}vector<int>G[maxn];int val[maxn];\nvoid kruskal(){\n\tfor(int i=1;i<=2*n;i++)fa[i]=i;tot=n;\n\tfor(int i=1;i<=m;i++){\n\t\tint x=Find(edge[i].u),y=Find(edge[i].v);\n\t\tif(x!=y){\n\t\t\t++tot;fa[x]=fa[y]=tot;val[tot]=edge[i].w;\n\t\t\tG[tot].pb(x);G[tot].pb(y);\n\t\t}\n\t}\n}int dfn[maxn],c,rev[maxn],L[maxn],R[maxn],jmp[maxn][20],dep[maxn];\nvoid dfs(int x){\n\tfor(int i=1;i<=19;i++)jmp[x][i]=jmp[jmp[x][i-1]][i-1];\n\tif(!G[x].size()){\n\t\tdfn[x]=++c;rev[c]=x;L[x]=c;R[x]=c;return;\n\t}L[x]=inf;R[x]=0;\n\tfor(int i=0;i<G[x].size();i++){\n\t\tint v=G[x][i];dep[v]=dep[x]+1;jmp[v][0]=x;dfs(v);\n\t\tL[x]=min(L[x],L[v]);R[x]=max(R[x],R[v]);\n\t}\n}\nint sum[maxn<<2],pos[maxn<<2];\nvoid pushup(int x){\n\tif(sum[ls]>sum[rs])pos[x]=pos[ls];\n\telse pos[x]=pos[rs];\n\tsum[x]=max(sum[ls],sum[rs]);\n}\nvoid update(int x,int l,int r,int P,int k){\n\tif(l==r){\n\t\tsum[x]=k;pos[x]=rev[l];return;\n\t}int mid=l+r>>1;\n\tif(mid>=P)update(ls,l,mid,P,k);\n\tif(mid<P)update(rs,mid+1,r,P,k);pushup(x);\n}\nint Query(int x,int l,int r,int L,int R){\n\tif(l>=L&&r<=R)return pos[x];\n\tint mid=l+r>>1,posl=0,posr=0,ans=0;\n\tif(mid>=L)posl=Query(ls,l,mid,L,R);\n\tif(mid<R)posr=Query(rs,mid+1,r,L,R);\n\tif(p[posl]>=p[ans])ans=posl;\n\tif(p[posr]>=p[ans])ans=posr;return ans;\n}\nint main(){\n\tn=read();m=read();q=read();\n\tfor(int i=1;i<=n;i++)p[i]=read();\n\tfor(int i=1;i<=m;i++){\n\t\tint x=read(),y=read();\n\t\tedge[i].u=x;edge[i].v=y;edge[i].w=inf;\n\t}\n\tfor(int i=1;i<=q;i++){\n\t\tint op=read(),x=read();\n\t\tif(op==1){\n\t\t\ta[++cnt].t=i;a[cnt].x=x;\n\t\t}else edge[x].w=i-1;\n\t}sort(edge+1,edge+m+1,cmp);kruskal();dep[tot]=1;dfs(tot);\n\tfor(int i=1;i<=n;i++)update(1,1,n,dfn[i],p[i]);\n\tfor(int i=1;i<=cnt;i++){\n\t\tint now=a[i].x;\n\t\tfor(int j=19;j>=0;j--)\n\t\t\tif(val[jmp[now][j]]>=a[i].t)now=jmp[now][j];\n\t\tint ans=Query(1,1,n,L[now],R[now]);\n\t\tprintf(\"%d\\n\",p[ans]);\n\t\tp[ans]=0;update(1,1,n,dfn[ans],p[ans]);\n\t}return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "eb8ff72f2cbef30812ad06549254b06a", "src_uid": "ad014bde729222db14f38caa521e4167", "apr_id": "39d803fbe7008e1422f096d4e2d26de1", "difficulty": 2600, "tags": ["dsu", "data structures", "implementation", "graphs", "trees"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.09383481969755719, "equal_cnt": 30, "replace_cnt": 25, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 30, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\ntypedef long long LL;\n\nLL dp[20][2525][50];\nunordered_map<LL,LL>mp;\nLL ve[20];\nLL gcd(LL a,LL b)\n{\n    if(b==0)\n        return a;\n    return gcd(b,a%b);\n}\nLL change(LL a,LL b)\n{\n    if(b==0)\n        return a;\n    return a/gcd(a,b)*b;\n}\nLL dfs(LL pos,LL st,LL lca,LL lead,LL op)\n{\n    if(pos==0)\n    {\n        if(st%lca==0)\n        {\n            return 1;\n        }\n        else\n            return 0;\n    }\n    if((!lead)&&(!op)&&(dp[pos][st][mp[lca]]!=-1))\n        return dp[pos][st][mp[lca]];\n    LL tmp=op?ve[pos]:9;\n    LL ans=0;\n    for(Ll i=0;i<=tmp;i++)\n    {\n        if(lead&&i==0)\n        {\n            ans+=dfs(pos-1,st,lca,lead,op&&tmp==i);\n        }\n        else\n            if(lead)\n                ans+=dfs(pos-1,(st+i)%2520,change(lca,i),0,op&&tmp==i);\n            else\n                ans+=dfs(pos-1,(st+i)%2520,change(lca,i),0,op&&tmp==i);\n    }\n    if((!lead)&&(!op))\n        dp[pos][st][mp[lca]]=ans;\n    return ans;\n}\nLL solve(string nu)\n{\n    LL len=0;\n    ve[len++]=-1;\n    for(LL i=nu.size()-1;i>=0;i---)\n    {\n        ve[len++]=nu[i]-'0';\n    }\n    return dfs(len-1,0,1,1,1);\n}\nint main()\n{\n    for()\n    scanf(\"%d\",&t);\n    while(t--)\n    {\n        cin>>l>>r;\n        ans1=solve(r);\n        \n    }\n    return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "f2f08d3d1e2ebb3b21e96e25c0ffdec5", "src_uid": "37feadce373f728ba2a560b198ca4bc9", "apr_id": "db1eec3f42440fe9e73f289246653598", "difficulty": 2500, "tags": ["dp", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.18545454545454546, "equal_cnt": 19, "replace_cnt": 11, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 18, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\n#define ll long long\nll n, k;\nvector<ll>v;\nint main() {\n\tscanf(\"%I64d %I64d\", &n, &k);\n\tif (n <= k && n > 1) {\n\t\tprintf(\"%d\", 1);\n\t\treturn 0;\n\t}\n\t\tfor (int i = 0; i <= k; i++) {\n\t\t\tif (i == 1)\n\t\t\t\tcontinue;\n\t\t\tv.push_back(i);\n\t\t}\n\t\tint cnt = 1;\n\t\tfor (unsigned i = 1; i <v.size(); i++) {\n\t\t\tif (i > 1) {\n\t\t\t\tv[i] += v[i - 1];\n\t\t\t}\n\t\t\telse\n\t\t\t\tv[i] += (v[i - 1]);\n\t\t}\n\t\tfor (unsigned i = 2; i < v.size(); i++) {\n\t\t\tv[i] -= cnt++;\n\t\t}\n\t\tint s = 0, e = v.size()-1, ans;\n\t\twhile (s < e) {\n\t\t\tint mid = s + (e - s + 1) / 2;\n\t\t\tif (v[mid] == n) {\n\t\t\t\te = mid - 1;\n\t\t\t\tans = mid;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ts = mid;\n\t\t\t\tans = -1;\n\t\t\t}\n\t\t}\n\t\tcout << ans << endl;\n\n\treturn 0;\n}", "lang": "GNU C++17", "bug_code_uid": "b10982f020a53894e71407284aa6f2e5", "src_uid": "83bcfe32db302fbae18e8a95d89cf411", "apr_id": "e2320e308eaf93bc9550e17a62121e50", "difficulty": 1700, "tags": ["math", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.45884146341463417, "equal_cnt": 26, "replace_cnt": 23, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 25, "bug_source_code": "#include <cstdlib>\n#include <iostream>\n#include <stdio.h>\n#include <stdlib.h>\n\nusing namespace std;\n\nint main(int argc, char *argv[])\n{\n\tint i,l,r,ref,s,t;\n\tlong long max,w;\n\tscanf(\"%d %d\",&l,&r);\n\t\n\tmax=0;\n\tfor(i=l;i<=r;i++)\n\t{\n\t\tif(i==l||ref==-1)\n\t\t{\n\t\t\tref=0;\n\t\t\tt=i;\n\t\t\ts=0;\n\t\t\twhile(t>0)\n\t\t\t{\n\t\t\t\tt/=10;\n\t\t\t\tif(s==0) s=1;\n\t\t\t\telse s*=10;\n\t\t\t}\n\t\t\tt=i;\n\t\t\twhile(s>0)\n\t\t\t{\n\t\t\t\tref=ref+(9-(t/s))*s;\n\t\t\t\tt-=(t/s)*s;\n\t\t\t\ts/=10;\n\t\t\t}\n\t\t}\n\t\t\n\t\tw=((long long )i)*((long long)ref);\n\t\tif(max<w)  max=w;\n\t\tref--;\n\t}\n\tcout << max<<endl;\n  //  system(\"PAUSE\");\n    return EXIT_SUCCESS;\n}\n", "lang": "GNU C++", "bug_code_uid": "0edb1f124478cf72615605297ac76ef4", "src_uid": "2c4b2a162563242cb2f43f6209b59d5e", "apr_id": "d3e91d5b31f264df26fe8f3fbbfeac74", "difficulty": 1600, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9916923807263233, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n#define read() freopen(\"input.txt\", \"r\", stdin)\n#define write() freopen(\"output.txt\", \"w\", stdout)\n#define f(i,a,b) for(int i = (a); i <= (b); i++)\n#define fr(i,a,b) for(int i = (a); i >= (b); i--)\n#define REP( i , n ) for( int i = 0 ; i < n ; i++ )\n#define REPI( n , i ) for( int i = n ; i >= 0 ; i-- )\n#define sc( x ) scanf( \"%d\" , &x )\n#define sc2( x , y ) scanf( \"%d%d\" , &x , &y )\n#define scd( x ) scanf( \"%.9f\" , &x )\n#define scl( x ) scanf( \"%I64d\" , &x )\n#define pf( x ) printf( \"%d\\n\" , x )\n#define pfd( x ) printf( \"%.9f\\n\" , x )\n#define pfl( x ) printf( \"%I64d\\n\" , x )\n#define all( v ) v.begin(),v.end()\n#define all_r( v ) v.rbegin() , v.rend()\n#define fi first\n#define se second\n#define SZ(a) int(a.size())\n#define pb push_back\n#define pi acos(-1.0)\n#define EPS (int)( 1e-6 )\n#define e2( x ) ( x )*( x )\n#define r2( x ) round( sqrt( 1.0*( x ) ) )\n#define ones(x) __builtin_popcount(x)\n#define MCM( a , b ) ( ( a*b )/( __gcd( a , b ) ) )\n#define ddd cout << \"despues\" << endl ;\n#define sss cout << \"------------------\" << endl ;\n#define aaa cout << \"antes\" << endl ;\n#define DEBUG( x ) cerr <<  #x << \"=\" << x << endl;\n#define DEBUG2( x , y ) cerr << #x << \"=\" << x << \" \" << #y << \"=\" << y << endl;\n#define DEBUGL(x,n) cout << #x << \" :\" <<endl; REP(i,n)cout<<x[i]<<char(i+1==n?10:32);\n#define DEBUGC(x,n,m) cout << #x << \" :\" <<endl; REP(i,n)REP(j,m)cout<<x[i][j]<<char(j+1==m?10:32);\n\ntypedef double db ;\ntypedef long long ll ;\nconst int INF = (int)( INT_MAX - 100 ) ;\nconst int N = (int)( 0 ) ;\ntypedef vector<int> vi ;\ntypedef vector<vi> vvi ;\ntypedef pair<int,int> pii ;\ntypedef vector<pii> vpii ;\nconst ll mod = (int)( 1e+6 + 3 ) ;\ntypedef long double ld ;\ninline ll modulo( int num ){ ( ( num %= mod ) += mod ) %= mod ; return num ; }\n//inline ll pot( int b , int e ){ ll p = 1 ; REP( i , e ) p = (p*b)%mod ; return p ; }\n\nll f1( int n ){\n\tif( n == 1 ) return 1 ;\n\treturn modulo( 3LL*f1( n - 1 ) ) ;\n}\n\nint main()\n{\n//\tios_base::sync_with_stdio(0);\n\tint n ;\n\tcin >> n ;\n\tcout << modulo( f1( n ) ) ;\n\n\treturn 0 ;\n}\n\n\n\n\n\n\n\n\n\n", "lang": "GNU C++11", "bug_code_uid": "b0cce4e549d19758f1ea8ebd999c9ec6", "src_uid": "1a335a9638523ca0315282a67e18eec7", "apr_id": "7bc11fedb7b3e09e91fc430bbf37df97", "difficulty": 1300, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.06489675516224189, "equal_cnt": 18, "replace_cnt": 15, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 19, "bug_source_code": "//#include <algorithm>\n//#include <map>\n//#include <set>\n//#include <vector>\n//#include <string>\n//#include <iostream>\n//using namespace std;\n//int main()\n//{\n//  vector <int> vec;\n//  int n, m, answer = 0;\n//  cin >> n >> m;\n//  vec.resize(n);\n//  for (int i = 0; i < n; cin >> vec[i++]);\n//  while (vec.size())\n//  {\n//      int counter = 0, counter2 = 0;\n//      for (int i = 0; i < vec.size(); ++i)\n//      if (counter + vec[i] <= m)\n//      {\n//          counter += vec[i];\n//          ++counter2;\n//      }\n//      else break;\n//      vec.erase(vec.begin(), vec.begin () + counter2);\n//      ++answer;\n//  }\n//  cout << answer << endl;\n//  return 0;\n//}\n#include <algorithm>\n#include <map>\n#include <set>\n#include <vector>\n#include <string>\n#include <iostream>\nusing namespace std;\nmap <string, bool> ma;\nvector <string> vec;\nstring t;\nvoid ay_7aga1(string s, int index)\n{\n    if (index == s.size() - 1) return;\n    t = s;\n    swap(t[index], t[index + 1]);\n    if (!ma [t]) vec.push_back(t);\n    ma[t] = true;\n    ay_7aga1(s, index + 1);\n}\nvoid ay_7aga2(string s, int index)\n{\n    if (!index) return;\n    t = s;\n    swap(t[index], t[index - 1]);\n    if (!ma [t]) vec.push_back(t);\n    ma[t] = true;\n    ay_7aga2(s, index - 1);\n}\nint main()\n{\n    string s;\n    int k;\n    cin >> s >> k;\n    vec.push_back(s);\n    for (int i = 0; i < k; ++i)\n    {\n        int x = vec.size();\n        for (int j = 0; j < x; ++j)\n        {\n            ay_7aga1(vec[j], 0);\n            if ((s.size() % 2)) ay_7aga2(vec[j], s.size() - 1);\n        }\n        sort(vec.begin(), vec.end());\n        //vec.push_back(s);\n        //ay_7aga1(s, 0);\n        //if ((s.size() % 2)) ay_7aga2(s, s.size() - 1);\n        //sort(vec.begin(), vec.end());\n        //s = vec[vec.size() - 1];\n        //vec.clear();\n    }\n    cout << vec[vec.size() - 1] << endl;\n    return 0;\n}", "lang": "GNU C++", "bug_code_uid": "0c9ac7ce5c2f6d59dec4ea87ae1efa26", "src_uid": "e56f6c343167745821f0b18dcf0d0cde", "apr_id": "dd12be9395999bb46791e05149d02fc2", "difficulty": 1400, "tags": ["greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.5267489711934157, "equal_cnt": 21, "replace_cnt": 9, "delete_cnt": 7, "insert_cnt": 4, "fix_ops_cnt": 20, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint main()\n{\n  int n,flag=0;\n  cin>>n;\n  if(n==1)\n  cout<<\"Ehab\\n\";\n  while(n!=0)\n  {\n  for(int i=2;i<=n;i++)\n  {\n   if(i%2==0)\n   {\n     n-=i;\n     flag=1;\n   }\n   else\n   {\n    n--;\n    flag=0;\n   }\n  }\n  }\n  if(flag)\n  cout<<\"Mahmoud\\n\";\n  else\n  cout<<\"Ehab\\n\";\n  return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "3e61fb40147fac2051962bee8e149983", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "apr_id": "7581d0b8ede4d2a2378fb8b266612f29", "difficulty": 800, "tags": ["math", "games"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.933074684772066, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "#include<cstdio>\nint main(){\n    -45 ~ 0 0\n    -134 ~ -46 3\n    -135 ~ -224 2\n    -225 ~ -314 1\n    long long n;\n    scanf(\"%lld\",&n);\n    if(n<0){\n        n=-n;\n        n%=360;\n        if(n<=45) printf(\"0\");\n        else if(n<=134) printf(\"3\");\n        else if(n<=224) printf(\"2\");\n        else if(n<=314) printf(\"1\");\n        else printf(\"0\");\n    }else{\n        n%=360;\n        if(n<=45) printf(\"0\");\n        else if(n<=135) printf(\"1\");\n        else if(n<=225) printf(\"2\");\n        else if(n<=314) printf(\"3\");\n        else printf(\"0\");\n    }\n}", "lang": "GNU C++", "bug_code_uid": "165fb1fd31cbf1ad43ce42e0570ad05f", "src_uid": "509db9cb6156b692557ba874a09f150e", "apr_id": "49464877b52f509c9b204c7f1a840dfa", "difficulty": 1800, "tags": ["geometry", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.8929384965831435, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\nint main()\n{ string s;\n  set <string> a;\n  cin >> s;\n  for (int i=0;i<s.length();i++)\n  { a.insert(s);\n    s=s+s[0];\n    s.substr(1,s.length()-1);\n  }\n  cout << a.size();\n}", "lang": "GNU C++", "bug_code_uid": "91ea2c101cbcf42df64b4eba830a0d8d", "src_uid": "8909ac99ed4ab2ee4d681ec864c7831e", "apr_id": "237602ac87aa2ede3b3fd0b75cef45a2", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.6934189406099518, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "#include <bits/stdc++.h>\n#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)\nusing namespace std;\ntypedef long long int ll;\nint main() {fio; // remove during scanf\n\tll N;\n\tcin >> N;\n\tN++;\n\tfor(int i = 0; i < N; i++) {\n\t\tif(0 == (N ^ (1LL << i))) {\n\t\t\tcout << i << endl;\n\t\t\treturn 0;\n\t\t}\n\t}\n\tcout << N << endl;\n    return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "a794490951a0eacf3d74d7302d83e8ed", "src_uid": "236177ff30dafe68295b5d33dc501828", "apr_id": "68bb958c99086a7e7c9bb9011e598613", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.18818948734587929, "equal_cnt": 15, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 15, "bug_source_code": "#include<iostream>\n#include<vector>\nusing namespace std;\nint main(void)\n{\n\n\tint64_t n, k;\n\tcin >> n >> k;\n\tn--; k--;\n\t\n\tvector<int64_t>arr;\n\tfor (int i = 1; i <= k; i++)\n\t{\n\t\tarr.push_back(i);\n\t}\n\tint64_t sum = 0;\n\tfor (auto it : arr)sum += it;\n\t//sum -= (k-1);\n\tif (sum < n)\n\t{\n\t\tcout << -1;\n\t\treturn 0;\n\t}\n\t\t\n\tif (sum == n)\n\t{\n\t\tcout << arr.size();\n\t\treturn 0;\n\t}\n\tsum = 0;\n\tint j = 0;\n\tfor (int i = n - 1; i >= 0; i--)\n\t{\n\t\tsum += arr[i];\n\t\tj++;\n\t\tif (sum >= n)\n\t\t{\n\t\t\tcout << j;\n\t\t\treturn 0;\n\t\t\tbreak;\n\t\t}\n\t}\n\tcout << -1;\n\n\t\n\treturn 0;\n}", "lang": "MS C++ 2017", "bug_code_uid": "93792a3c1b4d025deac6ee6a87ae1d61", "src_uid": "83bcfe32db302fbae18e8a95d89cf411", "apr_id": "ff1ce7c29c1195ef7c464f70efc415a3", "difficulty": 1700, "tags": ["math", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.7246861924686192, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nstruct node {\n\tint x, y, z, cnt;\n\tnode(int x,int y,int z, int cnt) : x(x), y(y), z(z), cnt(cnt) {}\n\tbool operator < (const node & a) const {\n\t\treturn cnt > a.cnt;\n\t}\n};\nbool check(node a) {\n\tint x = a.x, y = a.y, z = a.z;\n\tif(x < y + z && y < x + z && z < x + y) return 1;\n\treturn 0;\n}\nint main() {\n\tpriority_queue<node> q;\n\tint x, y, z;\n\tscanf(\"%d %d %d\",&x, &y, &z);\n\tq.push(node(x,y,z,0));\n\twhile(!q.empty()) {\n\t\tnode cur = q.top();\n\t\tq.pop();\n\t\tif(check(cur)) {\n\t\t\tprintf(\"%d\\n\",cur.cnt);\n\t\t\treturn 0;\n\t\t}\n\t\tcur.cnt++;\n\t\tcur.x++;q.push(cur);\n\t\tcur.x--;cur.y++;q.push(cur);\n\t\tcur.y--;cur.z++;q.push(cur);\n\t}\n}\n", "lang": "GNU C++17", "bug_code_uid": "7fa3fb5428e52290a078576bd6f8c4d8", "src_uid": "3dc56bc08606a39dd9ca40a43c452f09", "apr_id": "71657c1d0b1f1919beb1ab853c08c552", "difficulty": 800, "tags": ["geometry", "math", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9911971830985915, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include <stdio.h>\n#include <iostream>\n#include <vector>\n#include <algorithm>\n#include <string>\n#include <string.h>\n#include <set>\n#include <stack>\n#include <queue>\n#include <math.h>\n#include <map>\n#include <cmath>\n#include <set>\nusing namespace std;\ntypedef long long ll;\n\nint rec(int n)\n{\n\tif (n == 1) {\t\t\n\t\treturn 1;\t\t\n\t}\n\treturn 3 * rec(n - 1) % 1000003;\t\n}\n\nint main()\n{\n    #if !defined(ONLINE_JUDGE)\n    freopen(\"input.txt\", \"r\", stdin);\n    freopen(\"output.txt \", \"w\", stdout);    \n    #endif \t\n\n\tint n;\n\tcin >> n;\t\n\tcout << rec(n) << endl;\n\t\n\treturn 0;\n}", "lang": "MS C++", "bug_code_uid": "82d05c582d2a1e29056eb8982c84e4da", "src_uid": "1a335a9638523ca0315282a67e18eec7", "apr_id": "3cf21c4234fe9d646b1cdd2b1bf3ea02", "difficulty": 1300, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.997907949790795, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "#pragma warning(disable:4996)\n\n#include <stdio.h>\n#include <vector>\n#include <map>\n#include <iostream>\n#include <algorithm>\n#include <iomanip>\n#include <set>\n#include <string>\n#include <functional>\n#include <cmath>\n#include <cassert>\n\nusing namespace std;\n\n#define FILE_NAME \"file\"\n\n#define forn(i, n) for(i64 i = 0; i < (n); ++i)\n#define down(i, n) for(i64 i = ((i64)n) - 1; i >= 0; --i)\n\n\ntypedef vector<int> vint;\ntypedef long long int i64;\ntypedef long long unsigned int u64;\ntypedef vector<i64> vi64;\ntypedef pair<i64, i64> pi64;\n\n#define MODULE 1000000007\n\ni64 ans(i64 n)\n{\n    if (n == 0)\n        return 1;\n\n    return 3 * ans(n-1) % 1000003;\n\n}\n\nint main()\n{\n    srand(13);\n    ios_base::sync_with_stdio(false);\n    cin.tie(NULL);\n    cout << fixed << setprecision(15);\n#ifdef FILE_INPUT\n    freopen(FILE_NAME \".in\", \"r\", stdin);\n    freopen(FILE_NAME \".out\", \"w\", stdout);\n#endif\n    i64 n;\n    cin >> n;\n    cout << ans(n-1);\n   \n    return 0;\n}", "lang": "MS C++", "bug_code_uid": "22296d83b2b335e76f318e05c5329bc0", "src_uid": "1a335a9638523ca0315282a67e18eec7", "apr_id": "8350ce17255aa2a070357b4652a1b00c", "difficulty": 1300, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.5218617771509168, "equal_cnt": 9, "replace_cnt": 3, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "#include<iostream>\n#include<algorithm>\nusing namespace std;\nlong long n,ans,i,a[1000000001];\nint main(){\n cin>>n;\n i=2;\n a[1]=1;\n \nfor(i=0;i<1000000001;i++)\n{\n\ta[i]=0;\n}\ni=0;\nwhile(i<=1000001)\n{\n  a[i]=a[i-1]+a[i-2];\n  i++;\n}\ni=2;\nwhile(a[i]<=n)\n{\n    i++;\n    ans++;\n}\nans--;\ncout<<ans<<endl;\n return 0;\n }", "lang": "GNU C++", "bug_code_uid": "4cf7dda6f51a70435327b43c063adf98", "src_uid": "3d3432b4f7c6a3b901161fa24b415b14", "apr_id": "63107cda1d705b6d32bf72d1709dc419", "difficulty": 1600, "tags": ["math", "combinatorics", "greedy", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.7456926257753274, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\ntypedef long long ll;\nll mod=1000000007;\nvector<ll> fac;\nint n;\nll bin(int pos, int i, int j, ll left, ll right, int it)\n{\n    int middle = (i+j)/2;\n    // if(middle==pos) return fac[n-it];\n    if(i>=j && i>0) return fac[n-it];\n    else if(middle>pos)\n    {\n        return (right*(bin(pos, i, middle, left, right-1, it+1))%mod)%mod;\n    }\n    else\n    {\n        return (left*(bin(pos, middle, j, left-1, right, it+1))%mod)%mod;\n    }\n}\n\nint main()\n{\n    int x,pos;\n    cin>>n>>x>>pos;\n    fac.assign(n, 1);\n    for(int i=2;i<n;i++) fac[i]=(i*fac[i-1])%mod;\n    ll right = n-x;\n    ll left = x;\n    cout<<bin(pos, 0, n, left, right, 0);\n}", "lang": "GNU C++14", "bug_code_uid": "f424a08ce36b711bfd49229618ea6c00", "src_uid": "24e2f10463f440affccc2755f4462d8a", "apr_id": "c172ef22a54e49cdad27e26b39013ea0", "difficulty": 1500, "tags": ["combinatorics", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9645841623557501, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "// in the name of god \n#include <ext/pb_ds/assoc_container.hpp>\n#include <ext/pb_ds/tree_policy.hpp> \n#include <bits/stdc++.h>\n//#include <unistd.h>\nusing namespace std ;\nusing namespace __gnu_pbds;\nvoid operator+=(vector<int>&in1,const vector<int>&in2){for(int i=0;i<in2.size();i++)in1.push_back(in2[i]);}\n#define y2 sdfklgjsdkfd\n#define y1 sdfklgjsdkafd\n#define L first \n#define R second\n#define X first \n#define Y second\n#define int long long \ntypedef long long ll ;\ntypedef long double ld ;\n#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)\n#define ALL(x) (x).begin(),(x).end()\ntypedef pair < int , int > pii ; \ntypedef pair < int , pii > pi_ii ;\ntypedef pair < pii , int > pii_i ;\ntypedef pair < pii , pii > pii_ii ;\n#define ordered_set(TYPE) tree<TYPE, null_type, less<TYPE>, rb_tree_tag, tree_order_statistics_node_update>\n//#define \"%I64d\" \"%I64d\nconst int mod = 1e9 + 7 ;\nconst int maxL = 22 ;\nconst ll inf = 1e16 ;\nconst int baze = 547 ;\nconst int maxn = 1e6 +10 ;\nint n , x , ans ;\n\nmain ( ) \n{ \n  x = 1e9;\n  cin >> n ; \n  for ( int i = 1 ; i < n ; i ++ )\n    if ( n % i == 0 ) \n      { \n\tif ( abs ( i - n / i ) < x ) \n\t  x = abs ( i - n / i ) , ans = i ; \n      }\n\n  cout << ans << ' ' << n / ans ;\n} \n", "lang": "GNU C++14", "bug_code_uid": "2f3eca2aeda516c81ec7ca8da84b3fc6", "src_uid": "f52af273954798a4ae38a1378bfbf77a", "apr_id": "61a68e57122d6465697fe61c0307457f", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.4484848484848485, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\n\nint main () {\n      long long n, k;\n      cin >> n >> k;\n      const long long val = ((k*(k+1)/2) - 1) - (k-2);\n      if (n < 2 || n > val) {\n            cout << \"-1\\n\";\n            return 0;\n      }\n      vector<long long> array;\n      long long j = 1;\n      for (int i = (k-1); i >= 1; i--) {\n            for (int p = 0; p < i; p++){\n                  array.push_back (j);\n            }\n            j++;\n      }\n      cout << array[n-2] << \"\\n\";\n      return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "d94f3f514a0609f2cb2ae852d3479619", "src_uid": "83bcfe32db302fbae18e8a95d89cf411", "apr_id": "e2975b33a2bc9e66ec04eb345f2c61c9", "difficulty": 1700, "tags": ["math", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.941908713692946, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\n#define mod 1000000007\ntypedef long long int ll;\ntypedef unsigned long long ull;\ntypedef vector<int> vi;\ntypedef vector<ll> vll;\ntypedef vector<vector<int> > vvi;\ntypedef pair<int,int> ii;\ntypedef vector<pair<int,int> > vii;\ntypedef vector<vector<pair<int,int> > > vvii;\n#define boost ios_base::sync_with_stdio(false);cin.tie(0);\n#define pb push_back \n#define PB pop_back\n#define pf push_front\n#define PF pop_front\n#define MP make_pair\n#define C(a,b) memset(a,b,sizeof(a))\n#define ia(a,n) FOR(i,0,n-1)cin>>a[i]\n#define ia1(a,n) FOR(i,1,n)cin>>a[i]\n#define F first\n#define S second\n#define FOR(i,a,b) for(int i=a;i<=b;++i)\n#define NFOR(i,a,b) for(int i=a;i>=b;--i)\n#define rep(i,n) FOR(i,0,n-1)\n#define clr clear\n#define rz resize\n#define sqr(a) ((a) * (a))\n#define sz(a) int((a).size())\n#define all(a) (a).begin(), (a).end()\nint main()\n{\n\t\n\t#ifndef ONLINE_JUDGE\n     \t// for getting input from input.txt\n        freopen(\"D:/try/Platforms/a2oj/in.txt\", \"r\", stdin);\n        // for writing output to output.txt\n        freopen(\"D:/try/Platforms/a2oj/out.txt\", \"w\", stdout);\n    #endif\n\t\n\tios_base::sync_with_stdio(false);\n\tcin.tie(NULL);\n\n\t//boost\n\tint bo,f;\t\n\tcin>>bo>>f;\n\n\tstring s;\n\tcin>>s;\n\n\n\tvector<vector<int>> fb;\n\n\tfb.resize(f);\n\tint a[26]={0};\n\n\tfor(int i=0;i<bo;i++)\n\t\ta[s[i]-'a']++;\n\n\n\tfor(int i=0;i<26;i++)\n\t{\n\t\tint ttt=0;\n\t\t//cout<<\"\\n char : \"<<char(i+'a')<<\" with f : \"<<a[i];\n\t}\n\tint atf=0;\n\tint ff=1;\n\tfor(int i=0;i<26;i++)\n\t{\n\t\tif(a[i]>f)\n\t\t{\n\t\t\tff=0;\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t\twhile(a[i]>0)\n\t\t\t\t{\n\t\t\t\t\tif(fb[atf].size()==f)\n\t\t\t\t\t\tatf++;\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tfb[atf].push_back(i);\n\t\t\t\t\t\tatf++;\n\t\t\t\t\t\ta[i]--;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(atf==26)\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\n\t\t}\n\t}\n\n\tif(ff)\n\t\tcout<<\"YES\";\n\telse\n\t\tcout<<\"NO\";\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "8728b83e12a62cba5a04679a27c058a0", "src_uid": "ceb3807aaffef60bcdbcc9a17a1391be", "apr_id": "d9057709cecb11d7df1aaffdf3501de4", "difficulty": 900, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.026234403327290177, "equal_cnt": 21, "replace_cnt": 12, "delete_cnt": 3, "insert_cnt": 7, "fix_ops_cnt": 22, "bug_source_code": "#include <iostream>\n#include <stdio.h>\n#include <string.h>\nusing namespace std;\n\nint k,ind=0;\nint n;\nint a[9010];\nint c[9010],tm[9010];\nlong long dp[9010][9018];\n\n\nlong long  explore(int i, int sum)\n{\n    long long ans;\n    ans = 0;\n\n\n    if(sum == n) {\n        return 1;\n    }\n\n    if(i == ind) {\n        return 0;\n    }\n\n    if(dp[i][sum] != -1) {\n        return dp[i][sum];\n    }\n\n    for (int j = 0; j <= c[i] and (j * a[i]) + sum <= n; j++) {\n        ans += explore(i+1, sum + j * a[i]);\n    }\n\n\n    return dp[i][sum] = ans;\n\n}\n\nint main()\n{\n    cin>>n;\n    for(int i=1; i<=n; i++){\n        int s=0,tt=0;\n        bool ok=false;\n        while(s+i<=n){\n            s++;\n            tt++;\n        }\n        if(tt){\n            c[ind]=i;\n            tm[i]=tt;\n            ind++;\n        }\n    }\n    for(int i=0; i<ind; i++){\n        a[i]=tm[c[i]];\n    }\n    memset(dp,-1,sizeof(dp));\n    int ttt=0;\n    if(n>2)ttt=1;\n    cout<<explore(0,0)+ttt<<endl;\n}\n", "lang": "GNU C++14", "bug_code_uid": "0b0718c4162cfc197badb2eea4dc4f4b", "src_uid": "f8af5dfcf841a7f105ac4c144eb51319", "apr_id": "e9bc0312178d7b350798ca02d0e9e062", "difficulty": 1300, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.07072691552062868, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "#include <stdio.h>\n\nint main ()\n\n{\n\tint n, m, a, b, c, d;\n\tscanf(\"%d%d%d%d\", &n, &m, &a, &b);\n\tif (n >= 1, m <= 1000, a <= 1000, b <=1000)\n\t{\n\t\tif (n > c)\n\t\t{\n\t\t\tprintf(\"%d\", n / c + 1);\n\t\t}\n\t \telse if (a % 2 != 0)\n\t\t{\n\t\t\ta = a + 1;\n\t\t}\n\t\tc = m * b;\n\t\td = c + a;\n\t\tprintf(\"%d\", d);\n\t}\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "4e79e3fbec2754d7a08bb4fe37f11b65", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "apr_id": "7238791e5ec10d029cdb43c725ca8fa5", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.7685092127303182, "equal_cnt": 15, "replace_cnt": 7, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 14, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\n#define mod 1000000007\ntypedef long long int ll;\ntypedef vector<ll>vi;\nconst ll MAX_SIZE = 100000001;\nvi isprime(MAX_SIZE , true);\nvi prime;\nvi SPF(MAX_SIZE);\nvi factor;\nbool checklast(ll n)\n{\n\n    if (n <= 1)\n        return false;\n    if (n <= 3)\n        return true;\n    if (n % 2 == 0 || n % 3 == 0)\n        return false;\n  for (ll i = 5; i * i <= n; i = i + 6)\n        if (n % i == 0 || n % (i + 2) == 0)\n            return false;\n\n    return true;\n}\nvoid optimized_seive(ll N)\n{\n  ll N1;\n    isprime[0] = isprime[1] = false ;\n    for (ll i=2; i*i<=N ; i++)\n    {\n        if (isprime[i])\n        {\n            prime.push_back(i);\n            if(N%i==0){factor.push_back(i); N1=N/i;}\n            SPF[i] = i;\n        }\n        for (ll j=0;\n             j <(int)prime.size() &&\n             i*prime[j] < N && prime[j] <= SPF[i];\n             j++)\n        {\n            isprime[i*prime[j]]=false;\n            SPF[i*prime[j]] = prime[j] ;\n        }\n    }\n    //cout<<N1<<endl;\n if((N1*N1)!=N)\n    {if(checklast(N1)) factor.push_back(N1);}\n\n}\nll power(ll x, ll m)\n{\n    ll total = 1;\n    x=x%mod;\n    if(x==0) return 0;\n  while (m>0)\n    {\n        if (m & 1)\n            total =(total*x)%mod;\n        m=m>>1;\n        x=(x*x)%mod;\n    }\n    return total;\n}\nint main()\n{\n    ll x,n,h,m;\n    cin>>x>>n;\n    optimized_seive(x);\n    if(factor.empty())\n    {\n        factor.push_back(x);\n    }\n   ll ans=1;\n    for(ll i=0;i<factor.size();i++)\n    {\n    h=n;\n    m=0;\n   while(h)\n    {\n        m=m+h/factor[i];\n        h=h/factor[i];\n    }\n    ans=ans*power(factor[i],m);\n     ans=ans%mod;\n    }\ncout<<ans<<endl;\n}\n\n", "lang": "GNU C++17", "bug_code_uid": "f0d1c5d976fb6214d0abd9ad4e0f9d3a", "src_uid": "04610fbaa746c083dda30e21fa6e1a0c", "apr_id": "9028b416b97106a27689bc1c35b8cfdb", "difficulty": 1700, "tags": ["math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.2940503432494279, "equal_cnt": 18, "replace_cnt": 10, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 17, "bug_source_code": "#include <iostream>\nusing namespace std;\nint main()\n{\n    string s; int c=0;\n     cin >> s;\n\n    L: for(int a=0;a<s.size();a++)\n     {\n         if(s[a]=='h')\n         {\n             c++;\n             for(int b=a+1;b<s.size();b++)\n                if(s[b]=='e')\n             {\n                 c++;\n                 for(int d=b+1;d<s.size();d++)\n                    if(s[d]=='l')\n                 {\n                     c++;\n                     for(int e=d+1;e<s.size();e++)\n                        if(s[e]=='l')\n                     {\n                         c++;\n                         for(int i=e+1;i<s.size();i++)\n                         if(s[i]=='o')\n                         {\n                             c++;\n                             if(c==5)\n                             {\n                                 cout<<\"YES\";\n                                 break;\n                             }\n                             else\n                             {goto L;\n                             c=0;\n                             }\n\n\n                         }\n                     }\n                 }\n\n            }\n         }\n     }\n     if(c<5)\n        cout<<\"NO\";\n\n\n\n\n\n\n\n    return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "7cfd094f9e3ab6ce4f26dacf5008cb33", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "apr_id": "f726c3a2349c5596ef6a8fdbcc9b596c", "difficulty": 1000, "tags": ["strings", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.2533081285444234, "equal_cnt": 13, "replace_cnt": 8, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 13, "bug_source_code": "#include<cstdio>\n#include<iostream>\nusing namespace std;\nint main(){\n\tstring a;\n\tint ans=0,ans2=0;\n\tcin>>a;\n\tfor(int i=0;i<a.length();i++){\n\t\tif(a[i]==a[i-1]){\n\t\t\tans++;\n\t\t}\n\t\telse{\n\t\t\tif(ans%2==1)ans2++;\n\t\t\t\n\t\t\tans=0;\n\t\t}\n\t}\n\tprintf(\"%d\",ans2);\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "28c75cbe93889c55be4a1c031d41c000", "src_uid": "8b26ca1ca2b28166c3d25dceb1f3d49f", "apr_id": "ea8f46732a5ccc264e388fe456036bb9", "difficulty": null, "tags": ["implementation", "two pointers"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9930313588850174, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <iostream>\n#include <string>\n#include <algorithm>\nusing namespace std;\nstruct Buying{\n\tint which, profit;\n\tdouble profit;\n\tBuying(){}\n\tBuying(int _w,  int _p): which(_w), profit(_p){}\n\tbool operator < (Buying b)\n\t{\n\t\treturn profit > b.profit;\n\t}\n\n};\nstruct Product{\n\tint bc, sc, r;\n};\nProduct products[20][200];\nint main()\n{\n\tint n, m, rem;\n\tcin >> n >> m >> rem;\n\tcin.ignore();\n\tfor (int i = 0; i < n; i++)\n\t{\n\t\tstring name;\n\t\tgetline(cin, name);\n\t\tfor (int j = 0; j < m ;j++)\n\t\t\tcin >> products[i][j].bc >> products[i][j].sc >> products[i][j].r;\n\t\tcin.ignore();\n\t}\n\tint ans = 0, crem = rem;\n\tfor (int i = 0; i < n; i++)\n\t\tfor (int j = 0; j < n; j++)\n\t\t{\n\t\t\tif (i == j)\n\t\t\t\tcontinue;\n\t\t\tBuying benefits[200];\n\t\t\tfor (int r = 0; r < m; r++)\n\t\t\t\tbenefits[r] = Buying(r, products[j][r].sc - products[i][r].bc);\n\t\t\tsort(benefits, benefits + m);\n\t\t\tint r = 0;\n\t\t\tint calc = 0;\n\t\t\twhile (rem > 0 && r < m)\n\t\t\t{\n\t\t\t\tif (benefits[r].profit < 0)\n\t\t\t\t\tbreak;\n\t\t\t\tint dec = min(products[i][benefits[r].which].r, rem);\n\t\t\t\tcalc += dec * benefits[r].profit;\n\t\t\t\trem -= dec;\n\t\t\t\tr++;\n\t\t\t}\n\t\t\tif (calc > ans)\n\t\t\t\tans = calc;\n\t\t\trem = crem;\n\t\t}\n\t\n\tcout << ans;\n}", "lang": "MS C++", "bug_code_uid": "bc9bf619b5400740c6206e2a0e42c110", "src_uid": "7419c4268a9815282fadca6581f28ec1", "apr_id": "00249f95dcb337069c117249568f56f2", "difficulty": 1200, "tags": ["games", "greedy", "graph matchings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.9840201850294366, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include <iostream>\n#include <cstdlib>\n#include <stdio.h>\nusing namespace std;\n\nint main()\n{\n    int n,i;\n    while(scanf(\"%d\",&n)==1)\n    {\n        int memo[100002],ptr=0;\n        memset(memo,0,sizeof(memo));\n        for(int i=1;i<=n;i++)\n        {\n            memo[++ptr]++;\n            while(memo[ptr]==memo[ptr-1])\n            {\n                memo[ptr]=0;\n                memo[--ptr]++;\n            }\n        }\n        for(int i=1;memo[i];i++)\n        {\n            if(i!=1)    printf(\" \");\n            printf(\"%d\",memo[i]);\n        }\n        printf(\"\\n\");\n    }\n    return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "f42dfa552cbabedccdee7c18f48121fa", "src_uid": "757cd804aba01dc4bc108cb0722f68dc", "apr_id": "ce6aecd9d153212c0b69bb7b4bc20ba0", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.17197924388435878, "equal_cnt": 17, "replace_cnt": 12, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 17, "bug_source_code": "#include <iostream>\n#include <vector>\n#include <algorithm>\n#include <cstring>\n#include <fstream>\n#include <list>\n#include <set>\n#include <climits>\n#include <map>\n#include <stack>\n#include <queue>\n#include <cmath>\n#include <sstream>\n#include <deque>\n#include <utility>\n#include <bitset>\n#include <ext/hash_set>\n#include <ext/hash_map>\n\nusing namespace std;\nusing namespace __gnu_cxx;\n\n#define FOR(i,a,b) for(int i=(a);i<(b);i++)\n#define REV(i,a,b) for(int i=(a);i>=(b);i--)\n#define mp make_pair\n#define pb push_back\n#define oo 2e9\n#define MAX 2001\n#define sz(v) (int)v.size()\n#define all(c) (c).begin(),(c).end()\n#define rall(c) (c).rbegin(),(c).rend()\n#define iter(it,s) for(it=s.begin();it!=s.end();it++)\n#define show(x) cerr<<#x<<\" = \"<<x<<endl;\n#define mem(s,v) memset(s,v,sizeof(s))\n\ntypedef long long ll;\ntypedef vector<int> vi;\ntypedef vector<double> vd;\ntypedef vector<string> vs;\ntypedef pair<int, int> pi;\ntypedef vector<pi> vpi;\n\nint dx[] = { 0, 0, 1, -1 };\nint dy[] = { 1, -1, 0, 0 };\n\nint main() {\n#ifndef ONLINE_JUDGE\n    //  freopen(\"test.in\", \"rt\", stdin);\n    //  freopen(\"txt.out\", \"wt\", stdout);\n#endif\n    int a, b, c;\n    cin >> a >> b >> c;\n    vi v;\n    v.pb(a), v.pb(b), v.pb(c);\n    sort (all(v));\n    a = v[0], b = v[1], c = v[2];\n    if (a != b && b != c && a != c){\n        cout << b * 6 << endl;\n    }\n    else if (a == b && b == c){\n        cout << 1/ 0 << endl;\n        cout << a * ((a - 1) * 3) + 1 << endl;\n    }\n    else\n        cout << 1/ 0 << endl;\n    return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "9293d81f47f1846a47edeebdb7a3d02c", "src_uid": "8ab25ed4955d978fe20f6872cb94b0da", "apr_id": "f80deeffeb9323767ca617a14f03c5d1", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8155061019382628, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "#include <bits/stdc++.h>\n#define c(n,m) (1ll*pl[n]*ny[m]%mo*ny[(n)-(m)]%mo)\nusing namespace std;\nconst int N=1000050,mo=1e9+7;\nint fap(int a,int b){\n  int s=1;\n  while(b){\n    if (b&1) s=1ll*s*a%mo;\n    b>>=1,a=1ll*a*a%mo;\n  }\n  return s;\n}\nint f[N],pl[N],ny[N];\nint main(){\n  int n,k; cin>>n>>k;\n  pl[0]=ny[0]=1;\n  for (int i=1; i<=n; ++i) pl[i]=1ll*pl[i-1]*i%mo;\n  ny[n]=fap(pl[n],mo-2);\n  for (int i=n-1; i>=1; --i) ny[i]=1ll*ny[i+1]*(i+1)%mo;\n  int ans=0;\n  for (int i=k+2; i<=n; ++i){\n    f[i]=1ll*(i-k-1)*pl[i-2]%mo;\n    for (int j=i-k; j<i; ++j)\n      (f[i]+=1ll*c(i-2,j-1)*pl[i-j-1]%mo*f[j]%mo)%=mo;\n    (ans+=1ll*f[i]*c(n-1,i-1)%mo*pl[n-i]%mo)%=mo;\n  }\n  cout<<ans;\n  return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "eaecc74eb9221d59b8115c0ee4fedb59", "src_uid": "0644605611a2cd10ab3a9f12f18d7ae4", "apr_id": "010f5504bf4abbe1db350bd0b77699b3", "difficulty": 2400, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9323144104803494, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 5, "bug_source_code": "#include<bits/stdc++.h>\n\n#define LL long long\n#define RG register\n\nusing namespace std;\ntemplate<class T> T gi() {\n\tT x = 0; bool f = 0; char c = getchar();\n\twhile (c != '-' && (c < '0' || c > '9')) c = getchar();\n\tif (c == '-') f = 1, c = getchar();\n\twhile (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();\n\treturn f ? -x : x;\n}\nconst int N = 1e6 + 10, Mod = 1e9 + 7;\nint fac[N], ifac[N], f[N];\nint fpow(int a, int b) {\n\tint res = 1;\n\tfor (; b; b >>= 1, a = 1ll * a * a % Mod)\n\t\tif (b & 1) res = 1ll * res * a % Mod;\n\treturn res;\n}\nint C(int n, int m) {\n\tif (n < m) return 0;\n\treturn 1ll * fac[n] * ifac[m] % Mod * ifac[n - m] % Mod;\n}\nint main() {\n\t//freopen(\".in\", \"r\", stdin);\n\t//freopen(\".out\", \"w\", stdout);\n\tint n = gi<int>(), k = gi<int>();\n\tfac[0] = 1;\n\tfor (int i = 1; i <= n; i++) fac[i] = 1ll * fac[i - 1] * i % Mod; \n\tifac[n] = fpow(fac[n], Mod - 2);\n\tfor (int i = n; i >= 1; i--) ifac[i - 1] = 1ll * ifac[i] * i % Mod;\n\tf[0] = 1;\n\tfor (int i = 1; i <= n; i++)\n\t\tfor (int j = 1; j <= k && j <= i; j++)\n\t\t\t(f[i] += 1ll * f[i - j] * C(i - 1, j - 1) % Mod * fac[j - 1] % Mod) %= Mod;\n\tint ans = 0;\n\tfor (int i = 1; i <= n; i++)\n\t\t(ans += 1ll * f[i - 1] * C(n - 1, i - 1) % Mod * fac[n - i] % Mod) %= Mod;\n\tprintf(\"%d\\n\", (fac[n] - ans + Mod) % Mod);\n\treturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "779095fcee00529fedd21dbf2a74f914", "src_uid": "0644605611a2cd10ab3a9f12f18d7ae4", "apr_id": "c66bd3f00bae1ff7ad2011827cc7ee0e", "difficulty": 2400, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9787697332607512, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <iostream>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n#include <map>\n#include <queue>\n#include <algorithm>\n\nusing namespace std;\nint a[10],b[10],x[10],y[10];\nmap<int,bool>f;\nint main()\n{\n    int n=1,m=1;\n    x[1]=-555;x[2]=-555;x[3]=-555;y[1]=-555;y[2]=-555;y[3]=-555;\n    for(int i=0;i<8;i++)\n    {\n        scanf(\"%d%d\",&a[i],&b[i]);\n        if(x[1]!=a[i]&&x[2]!=a[i]&&x[3]!=a[i]){\n            x[n]=a[i];\n\n            n++;\n        }\n        if(y[1]!=b[i]&&y[2]!=b[i]&&y[3]!=b[i]){\n\n            y[m]=b[i];\n            m++;\n        }\n        f[a[i]*10+b[i]]=1;\n    }\n    sort(x,x+4);sort(y,y+4);\n    \n   else if(f[x[1]*10+y[1]]==1&&f[x[1]*10+y[2]]==1&&f[x[1]*10+y[3]]==1&&f[x[2]*10+y[1]]==1&&f[x[2]*10+y[3]]==1&&f[x[3]*10+y[1]]==1&&f[x[3]*10+y[2]]==1&&f[x[3]*10+y[3]]==1)\n    {\n        printf(\"respectable\\n\");\n    }\n    else printf(\"ugly\\n\");\n\n    return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "950c9b05fd84615570aae7ea8dedbadd", "src_uid": "f3c96123334534056f26b96f90886807", "apr_id": "844e1e5333b59c43261b2d64cda4a387", "difficulty": 1400, "tags": ["sortings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9893617021276596, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint a[10][10]={{0,1,2},{1,0,2},{1,2,0},{2,1,0},{2,0,1},{0,2,1},{0,1,2}};\nint main(){\n\tint b,c;\n\tcin>>b>>c;\n\tc%=6;\n\tcout<<a[b][c];\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "462bc36bc571f800b71617312dc55bfb", "src_uid": "7853e03d520cd71571a6079cdfc4c4b0", "apr_id": "a080120daafc482e9bff936489a8b2cb", "difficulty": 1000, "tags": ["math", "constructive algorithms", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9647341412817994, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "//author ----> noobiesAG\n\n#include<bits/stdc++.h>\nusing namespace std;\n\n#define rep(i,a,b)         for(i=a;i<b;i++)\n#define repd(i,a,b)        for(i=a;i>b;i--)\n#define int                long long\n#define double             long double\n#define pb                 push_back\n#define mp                 make_pair\n#define ld                 long double\n#define vi                 vector<int>\n#define vvi                vector<vector<int>>\n#define vpii               vector<pair<int,int>>\n#define pii                pair<int,int>\n#define mii                map<int,int>\n#define umap               unordered_map\n#define all(c)             c.begin(),c.end()\n#define si(c)              (int)c.size()\n#define lb                 lower_bound\n#define ub                 upper_bound\n#define gi                 greater<int>\n#define rev                reverse\n#define ff                 first\n#define ss                 second\n#define yes                cout << \"YES\" << endl\n#define no                 cout << \"NO\" << endl\n#define ayes               cout << \"Yes\" << endl\n#define ano                cout << \"No\" << endl\n#define mone               cout << -1 << endl\n#define imp                cout << \"IMPOSSIBLE\" << endl\n#define nl                 cout << endl\n#define hello              cout << \"hello\" << endl\n#define sp(x)              fixed << setprecision(x)\n#define re                 return\n#define p_q                priority_queue\n#define FAST               ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);\n\nvoid dbg_out(){cerr << endl;}\ntemplate<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }\n#define dbg(...) cerr << \"(\" << #__VA_ARGS__ << \"):\", dbg_out(__VA_ARGS__)\n\nconst double pi = 3.14159265359;\nconst int mod = 1000000007;\nconst int modc = 998244353;\nconst int inf = LLONG_MAX;\nconst int neg_inf = LLONG_MIN;\n\nint inline power(int a, int b, int p){\n    a %= p;\n    int ans = 1;\n    while(b>0){\n        if(b & 1)\n            ans = (ans*a)%p;\n        a = (a*a)%p;\n        b >>= 1;\n    }\n    return ans;\n}\n\nint mod_inv(int n, int p){\n    return power(n,p-2, p);\n}\n\nbool inline isPrime(int n) {\n    if (n <= 1)  return false;\n    if (n <= 3)  return true;\n    if (n%2 == 0 || n%3 == 0) return false;\n    for (int i=5; i*i<=n; i=i+6)\n        if (n%i == 0 || n%(i+2) == 0)\n           return false;\n    return true;\n}\ntemplate<typename... T>\nvoid W(T&&... args)\n{\n\t((cout << sp(17) <<  args << \" \"), ...);\n\tnl;\n}\ntemplate<typename... T>\nvoid R(T&&... args)\n{\n\t((cin >> args), ...);\n}\nint ston(string s) \n{\n\tint a = 0;\n\treverse(s.begin(),s.end());\n\tint pow = 1;\n\tfor(int i=0;i<s.size();i++)\n\t{\n\t\ta += pow*(s[i]-'0');\n\t\tpow*=10;\n\t}\n\treturn a;\n}\ntemplate <class T>\nstring to_binary(T n) \n{\n\tstring binaryNum;\n\tint i = 0;\n\twhile (n > 0) {\n\t\tbinaryNum.pb((n % 2)+'0');\n\t\tn = n / 2;\n\t\ti++;\n\t}\n\tif(si(binaryNum) == 0)\n\t\tbinaryNum.pb('0');\n\treverse(binaryNum.begin(),binaryNum.end());\n\treturn binaryNum;\n}\nint bton(string &s, int base)\n{\n\tint ans = 0;\n\tint pow  = 1;\n\trev(all(s));\n\tfor(auto x : s)\n\t{\n\t\tif(x >= 'a' && x <= 'z')\n\t\t\tans += (x - 'a' + 10)*pow;\n\t\telse\n\t\t\tans += (x-'0')*pow;\n\t\tpow *= base;\n\t}\n\treturn ans;\n}\ntemplate<class T>\nvoid wv(T &v)\n{\n\tfor(auto x : v)\n\t\tcout << x << \" \" ;\n\tnl;\n}\ntemplate<class T>\nvoid rv(T &v)\n{\n\tfor(int i=0;i<si(v);i++)\n\t\tcin >> v[i];\n}\n\nstruct custom_hash {\n    static uint64_t splitmix64(uint64_t x) {\n        // http://xorshift.di.unimi.it/splitmix64.c\n        x += 0x9e3779b97f4a7c15;\n        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;\n        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;\n        return x ^ (x >> 31);\n    }\n\n    size_t operator()(uint64_t x) const {\n        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();\n        return splitmix64(x + FIXED_RANDOM);\n    }\n};\n/*\nint ncr(int n, int r)\n{\n\tint ans = fact[n];\n\tint denom = (fact[r]*fact[n-r])%mod;\n\tans = (ans * mod_inv(denom,mod))%mod;\n\treturn ans;\n}\n*/\n\nconst int M = 2e5;\n\n//int fact[M];\n//vector<int>v[M];\n\nvoid solve()\n{\n\tint i,j,sum = 0,prod = 1,maxl = neg_inf, minl = inf;\n\tint n;\n\tcin >> n;\n\tvector<tuple<int,int,int>>vv;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tfor(j=1;j<=n;j++)\n\t\t{\n\t\t\tint temp = (i^j);\n\t\t\tif(temp < 1 || temp > n)\n\t\t\t\tcontinue;\n\t\t\tvi v;\n\t\t\tv.pb(i);\n\t\t\tv.pb(j);\n\t\t\tv.pb(temp);\n\t\t\tsort(all(v));\n\t\t\tif(v[0] + v[1] > v[2])\n\t\t\t{\n\t\t\t\ttuple<int,int,int>ayush;\n\t\t\t\tayush = make_tuple(v[0],v[1],v[2]);\n\t\t\t\tvv.pb(ayush);\n\t\t\t}\n\t\t}\n\t}\n\tsort(all(vv));\n\tif(si(vv))\n\t\tsum++;\n\tfor(i=1;i<si(vv);i++)\n\t\tif(vv[i] != vv[i-1])\n\t\t\tsum++;\n\tcout << sum << endl;\n}\nint32_t main()\n{\n\tFAST;\n\tint t = 1;\n\t/*\n\tfact[0] = 1;\n\tfor(int i = 1;i<M;i++)\n\t\tfact[i] = (i * fact[i-1])%mod;\n\t\t*/\n\twhile(t--)\n\t{\n\t\tsolve();\n\t}\n} \n", "lang": "GNU C++17", "bug_code_uid": "a1263c49aa0d968fce642792e68bc197", "src_uid": "838f2e75fdff0f13f002c0dfff0b2e8d", "apr_id": "47a9d28855eda5818626f2b6dadeb32c", "difficulty": 1300, "tags": ["brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.5641025641025641, "equal_cnt": 26, "replace_cnt": 13, "delete_cnt": 2, "insert_cnt": 10, "fix_ops_cnt": 25, "bug_source_code": "#include <iostream>\n#include <fstream>\n//#include <>\nusing namespace std;\n\nconst int MAXPLANETS = 10;\nconst int MAXTYPES = 100;\nconst int MAXSUM = 100*999;\n\nstruct pl {\n         int buy, sell, remaining;\n       };\n\npl p[MAXPLANETS][MAXTYPES];\nint PlanetCount, TypeCount, Storage;\n\nvoid read() {\n     ifstream in(\"in\");\n     in >> PlanetCount >> TypeCount >> Storage;\n     for(int i = 0; i < PlanetCount; i++) {\n       for(int j = 0; j < TypeCount; j++) {\n         in >> p[i][j].buy >> p[i][j].sell >> p[i][j].remaining;\n       }\n     }\n     in.close();    \n}\n\nint min(int a, int b) {\n    if (b > a)\n      return a;\n    return b;\n}\n\nint MaxProfit(int BuyPlanet, int SellPlanet) {\n    /*dynamic programing*/\n    P[MAXTYPE + 1][MAXSUM + 1];\n    for(int i = 0; i < TypeCount; i++) {\n      for\n    }\n}\n\nlong long LargestProfit() {\n     long long MaxPP/*MaxProfitPossible*/ = 0, profit;\n     for(int i = 0; i < PlanetCount; i++) {\n       for(int j = 0; j < PlanetCount; j++) {\n           profit = MaxProfit(i, j);\n           if (profit > MaxPP)\n             MaxPP = profit;\n       }\n     }\n     return MaxPP;\n}\n\n\nint main() {\n    read();\n    //cout << LargestProfit() << endl;\n    system(\"Pause\");\n    return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "95a5c1cd1af76057e9f06a020ffa9e6b", "src_uid": "7419c4268a9815282fadca6581f28ec1", "apr_id": "d041d12842c33c053fe46107ae1422d9", "difficulty": 1200, "tags": ["games", "greedy", "graph matchings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9689399054692776, "equal_cnt": 9, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 8, "fix_ops_cnt": 8, "bug_source_code": "#include <iostream>\n#include <bits/stdc++.h>\n#include <cstdlib>\n// Input macros\n#define s(n)                        scanf(\"%d\",&n)\n#define sc(n)                       scanf(\"%c\",&n)\n#define sl(n)                       scanf(\"%lld\",&n)\n#define sf(n)                       scanf(\"%lf\",&n)\n#define ss(n)                       scanf(\"%s\",n)\n// Useful constants\n#define INF                         (int)1e9\n#define EPS                         1e-9\n// Useful hardware instructions\n#define bitcount                    __builtin_popcount\n#define gcd                         __gcd\n// Useful container manipulation / traversal macros\n#define REP(i,a,b)               for(int i=a;i<=b;i++)\n#define miN(a,b)                  ( abs(a)<= abs(b) ? abs(a) : abs(b))\n#define maX(a,b)                  ( abs(a)>= abs(b) ? abs(a) : abs(b))\nusing namespace std;\ntypedef long long ll;\n\nint main(){\n    int n, diff, ans;\n    vector<int> factors;\n    cin >> n;\n    REP(i, 1, n/2)\n    {\n        if((n%i))\n            continue;\n        else{\n            factors.push_back(n/i);\n        }\n    }\n    vector<int>::iterator it = factors.begin();\n    diff = abs ((n/(*it))-(*it));\n    ans = *it;\n    for(++it; it < factors.end(); it++){\n        if(diff > abs ((n/(* (it)))-(*(it))))\n           {\n               ans = *(it);\n               diff = abs ((n/(* (it)))-(*(it)));\n           }\n    }\n    cout << miN(ans,n/ans) << \" \" << maX(ans,n/ans);\n\n\n    return 0;\n\n}\n", "lang": "GNU C++14", "bug_code_uid": "d0d154a4f2e9fa7124e894e4551fc135", "src_uid": "f52af273954798a4ae38a1378bfbf77a", "apr_id": "052de48cfa38779502488e8367392694", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.4767123287671233, "equal_cnt": 13, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 13, "bug_source_code": "#include <iostream>\n#include <string>\n#include <cmath>\n#include <iomanip>\nusing namespace std;\n\nlong long int c;\nlong long int sum=0;\nlong long tt=0;\n\nint main()\n{\n    long long int a;\n    long long int b;\n    cin>>a>>b;\n    int time =0;\n    int result=0;\n    for(long long int i=a;i<=b;i++)\n    {\n        c=i;\n        tt=0;\n        sum=0;\n        while(c)\n        {\n            sum+=c&0x01;\n            tt++;\n            c>>=1;\n        }\n        if(tt-sum==1)\n            result++;\n    }\n    cout<<result;\n    return 0;\n}\n", "lang": "MS C++", "bug_code_uid": "f20e01eadd0e16c872250a43fe310f44", "src_uid": "581f61b1f50313bf4c75833cefd4d022", "apr_id": "509729ce23ffac64ff8fcaa059b09192", "difficulty": 1300, "tags": ["bitmasks", "brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.1773158055640477, "equal_cnt": 28, "replace_cnt": 20, "delete_cnt": 3, "insert_cnt": 5, "fix_ops_cnt": 28, "bug_source_code": "#include <cstdio>\n#include <algorithm>\n#include <cstring>\nusing namespace std;\n\nint n,m,w,ans,tmp[2],a[88][88],b[6600][4];\nbool col[88][88],vis[88][88];\n\nvoid Dfs(int x,int y) {\n\tif ((x<1)||(x>n)||(y<1)||(y>m)) return;\n\tif (col[x][y]) return;\n\tif (vis[x][y]) return;\n\tvis[x][y]=true; ++tmp[(x+y)&1];\n\tDfs(x-1,y); Dfs(x+1,y);\n\tDfs(x,y-1); Dfs(x,y+1);\n}\n\nbool Greed(int x1,int y1,int x2,int y2) {\n\tcol[x1][y1]=col[x2][y2]=true;\n\tmemset(vis,false,sizeof(vis));\n\tfor (int i=1;i<=n;++i)\n\t\tfor (int j=1;j<=m;++j)\n\t\t\tif ((!col[i][j])&&(!vis[i][j])) {\n\t\t\t\ttmp[0]=tmp[1]=0;\n\t\t\t\tDfs(i,j);\n\t\t\t\tif (tmp[0]!=tmp[1])\n\t\t\t\t\t{col[x1][y1]=col[x2][y2]=false;return false;}\n\t\t\t}\n\treturn true;\n}\n\nvoid Search(int k,int sum) {\n\tif (k==w+1) {ans=max(ans,sum);return;}\n\tif (w-k+10+sum<=ans) return;\n\tbool flag=Greed(b[k][0],b[k][1],b[k][2],b[k][3]);\n\tif (flag) Search(k+1,sum+1);\n\tcol[b[k][0]][b[k][1]]=false;\n\tcol[b[k][2]][b[k][3]]=false;\n\tSearch(k+1,sum);\n}\n\nint main() {\n\tscanf(\"%d%d\",&n,&m);\n\tfor (int i=1;i<=n;++i)\n\t\tfor (int j=1;j<=m;++j) scanf(\"%d\",&a[i][j]);\n\tfor (int i=1;i<=n;++i)\n\t\tfor (int j=1;j<=m;++j) {\n\t\t\tif ((i<n)&&(a[i+1][j]==a[i][j]))\n\t\t\t\tb[++w][0]=i,b[w][1]=j,b[w][2]=i+1,b[w][3]=j;\n\t\t\tif ((j<m)&&(a[i][j+1]==a[i][j]))\n\t\t\t\tb[++w][0]=i,b[w][1]=j,b[w][2]=i,b[w][3]=j+1;\n\t\t}\n\tSearch(1,0);\n\tprintf(\"%d\\n\",n*m/2-ans);\n\treturn 0;\n}\n\n", "lang": "GNU C++", "bug_code_uid": "f81a9d5ebc7d10395d15f256f5ef6ce4", "src_uid": "1f0e8bbd5bf4fcdea927fbb505a8949b", "apr_id": "546aac1374861a86a34d3763eae937f4", "difficulty": 2200, "tags": ["flows"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.21270521056388295, "equal_cnt": 38, "replace_cnt": 28, "delete_cnt": 1, "insert_cnt": 8, "fix_ops_cnt": 37, "bug_source_code": "#include <iostream>\n#include <cstring>\n#include <cstdio>\n#include <cmath>\n#include <algorithm>\n\nusing namespace std;\n\n#define MAXN 101\n#define MAXM 10001\n#define MAXANS 8\n\nint dx[] = {-1, 0, 0, 1};\nint dy[] = { 0,-1, 1, 0};\n\nint n, m;\nint a[MAXN][MAXN];\nint c[MAXN][MAXN];\nint p[MAXN][MAXN];\nint mark[MAXN][MAXN];\nint b[MAXM];\nint ans;\n\ninline bool look(int x, int y)\n{\n\tif (mark[x][y]) return 0;\n\tmark[x][y] = 1;\n\tif (p[x][y] == -1) return 1;\n\tint xx = p[x][y] / m;\n\tint yy = p[x][y] % m;\n\tfor (int k = 0; k < 4; ++k)\n\t{\n\t\tint sx = xx + dx[k];\n\t\tint sy = yy + dy[k];\n\t\tif (0 <= sx && sx < n && 0 <= sy && sy < m && c[sx][sy] && look(sx, sy))\n\t\t{\n\t\t\tp[xx][yy] = sx * m + sy;\n\t\t\tp[sx][sy] = xx * m + yy;\n\t\t\treturn 1;\n\t\t}\n\t}\n\treturn 0;\n}\n\ninline void go(int v)\n{\n\tif (v >= ans) return;\n\n\tfor (int i = 0; i < n; ++i)\n\t\tfor (int j = 0; j < m; ++j)\n\t\t\tp[i][j] = -1;\n\n\tbool ok = 1;\n\tfor (int i = 0; i < n && ok; ++i)\n\t\tfor (int j = 0; j < m && ok; ++j)\n\t\t{\n\t\t\tif (c[i][j]) continue;\n\t\t\tif (b[a[i][j]])\n\t\t\t{\n\t\t\t\tmemset(mark, 0, sizeof(mark));\n\t\t\t\tint t = 0;\n\t\t\t\tfor (int k = 0; k < 4 && !t; ++k)\n\t\t\t\t{\n\t\t\t\t\tint sx = i + dx[k];\n\t\t\t\t\tint sy = j + dy[k];\n\t\t\t\t\tif (0 <= sx && sx < n && 0 <= sy && sy < m && c[sx][sy] && look(sx, sy)) \n\t\t\t\t\t{\n\t\t\t\t\t\tp[i][j] = sx * m + sy;\n\t\t\t\t\t\tp[sx][sy] = i * m + j;\n\t\t\t\t\t\tt = 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tok = t;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tint t = 0;\n\t\t\t\tfor (int k = 0; k < 4 && !t; ++k)\n\t\t\t\t{\n\t\t\t\t\tint sx = i + dx[k];\n\t\t\t\t\tint sy = j + dy[k];\n\t\t\t\t\tif (0 <= sx && sx < n && 0 <= sy && sy < m && a[sx][sy] == a[i][j]) t = 1;\n\t\t\t\t}\n\n\t\t\t\tok = t;\n\t\t\t}\n\t\t}\n\n\tif (ok)\n\t{\n/*\t\tcout << \"mm\" << endl;\n\t\tfor (int i = 0; i < n; ++i)\n\t\t{\n\t\t\tfor (int j = 0; j < m; ++j)\n\t\t\t\tcout << c[i][j] << ' ';\n\t\t\tcout << endl;\n\t\t}*/\n\t\tans = v;\n\t}\n\n\tif (v == MAXANS) return;\n\t\n\tfor (int i = 0; i < n; ++i)\n\t\tfor (int j = 0; j < m; ++j)\n\t\t\tif (!b[a[i][j]])\n\t\t\t{\n\t\t\t\tb[a[i][j]] = 1;\n\t\t\t\tc[i][j] = 1;\n\t\t\t\tgo(v + 1);\n\t\t\t\tc[i][j] = 0;\n\t\t\t\tb[a[i][j]] = 0;\n\t\t\t}\n}\n\nint main()\n{\n\tscanf(\"%d%d\", &n, &m);\n\tfor (int i = 0; i < n; ++i)\n\t\tfor (int j = 0; j < m; ++j)\n\t\t\tscanf(\"%d\", &a[i][j]);\n\n\tans = 1000;\n\tgo(0);\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "c39f5c03db1664ed76a31170e07ad900", "src_uid": "1f0e8bbd5bf4fcdea927fbb505a8949b", "apr_id": "61e1f528c3fcca521b0032dc2c27310b", "difficulty": 2200, "tags": ["flows"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.05287437899219304, "equal_cnt": 25, "replace_cnt": 15, "delete_cnt": 4, "insert_cnt": 6, "fix_ops_cnt": 25, "bug_source_code": "#include<iostream>\n#include<cstdio>\n#include<fstream>\n#include<set>\nusing namespace std;\nint a[103][103];\nint b[103][103];\nint coun[1053];\nint n,m;\nint rec=1000000000;\nstruct kros\n{\n    int x,y;\n};\nkros c[5][1053];\nint modul(int x)\n{\n    if(x<0)\n        return -x;\n    return x;\n}\nvoid dfs(int xx)\n{\n    int i,j;\n    int res;\n    if(xx==n*m)\n    {\n        res=0;\n        for(i=0;i<n;i++)\n            for(j=0;j<m;j++)\n                if(b[i][j]!=a[i][j])\n                    res++;\n        if(res<rec)\n            rec=res;\n        return;\n    }\n    for(i=0;i<((n*m)>>1);i++)\n    {\n        if(coun[i]==2)\n        {\n            coun[i]--;\n            b[xx/m][xx%m]=i;\n            c[coun[i]][i].x=xx%m;\n            c[coun[i]][i].y=xx/m;\n            dfs(xx+1);\n            coun[i]++;\n        }\n        else if(coun[i]==1)\n        {\n            if(modul(c[1][i].x-xx%m)+modul(c[1][i].y-xx/m)>1)\n            {\n\n            }\n            else\n            {\n                coun[i]--;\n                b[xx/m][xx%m]=i;\n                c[coun[i]][i].x=xx%m;\n                c[coun[i]][i].y=xx/m;\n                dfs(xx+1);\n                coun[i]++;\n            }\n        }\n    }\n}\nint main()\n{\n    int i,j;\n    cin>>n>>m;\n    for(i=0;i<n;i++)\n        for(j=0;j<m;j++)\n        {\n            cin>>a[i][j];\n            a[i][j]--;\n        }\n    for(i=0;i<n*m/2;i++)\n        coun[i]=2;\n    dfs(0);\n    cout<<rec<<endl;\n    return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "6dda34fcc12368cf8e3e871625ce43d7", "src_uid": "1f0e8bbd5bf4fcdea927fbb505a8949b", "apr_id": "028f0447acf3290f935e4db1d434736a", "difficulty": 2200, "tags": ["flows"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8060491493383742, "equal_cnt": 18, "replace_cnt": 11, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 18, "bug_source_code": "#include<bits/stdc++.h>\n\nusing namespace std;\n\nstring s;\n\nint main(){\n\t\n\tcin>>s;\n\t\n//\tfor(int i = 0 ; i < s.length() ; i ++ ){\n//\t\tif(s[i]!='l'&&s[i+1]!='l'){\n//\t\t\tif ( s[i] == s[i+1]){\n//\t\t\ts.erase(i,1);\n//\t\t\ti--;\n//\t\t\t}\n//\t\t}\n//\t\tif(s[i]=='l'&&s[i+1]=='l'&&s[i+2]=='l'){\n//\t\t\t\tif ( s[i] == s[i+1]){\n//\t\t\ts.erase(i,1);\n//\t\t\ti--;\n//\t\t\t}\n//\t\t}\n//\t}\n\t\n\tfor(int i = 0 ; i < s.length() ; i ++){\n\t\t\n\t\tfor(int k = 0 ; k < s.length() ; k ++){\n\t\t\t\n\t\t\tfor(int j = 0 ; j < s.length() ; j ++){\n\t\t\t\t\n\t\t\t\tif(s[j] == 'h' && j != 0){\n\t\t\t\t\tswap(s[j],s[j-1]);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(s[j] == 'e' && j != 0 && j - 1 != 0){\n\t\t\t\t\tswap(s[j],s[j-1]);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(s[j] == 'l' && j != 1 && j - 1 != 1){\n\t\t\t\t\tswap(s[j],s[j-1]);\n\t\t\t\t}\n\t\t\t\tif(s[j] == 'l' && j != 2 && j - 1 != 2 && s[j-1] != 'l'){\n\t\t\t\t\tswap(s[j],s[j-1]);\n\t\t\t\t}\n\t\t\t\tif(s[j] == 'o' && j != 3 && j - 1 != 3){\n\t\t\t\t\tswap(s[j],s[j-1]);\n\t\t\t\t}\n\t\t\t\t\t\n\t\t\t}\n\t\t\n\t\t}\n\t\n\t}\n\t\n\tfor(int i = 0 ; i < s.length() - 1 ; i ++ ){\n\t\tif(s[i]!='l'&&s[i+1]!='l'){\n\t\t\tif ( s[i] == s[i+1]){\n\t\t\ts.erase(i,1);\n\t\t\ti--;\n\t\t\t}\n\t\t}\n\t\tif(i <= s.length() - 2){\n\t\t\tif(s[i]=='l'&&s[i+1]=='l'&&s[i+2]=='l'){\n\t\t\t\tif ( s[i] == s[i+1]){\n\t\t\ts.erase(i,1);\n\t\t\ti--;\n\t\t\t}\n\t\t}\n\t\t}\n\t\t\n\t}\n\t\n\tif(s.find(\"hello\") != string::npos){\n\t\tcout<<\"YES\";\n\t}\t\n\telse cout<<\"NO\";\n}", "lang": "GNU C++", "bug_code_uid": "a3c5549185ad784e4b2c688ab74f47fd", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "apr_id": "76ddd8b2f883fcf9d92276d9ee5ad36b", "difficulty": 1000, "tags": ["strings", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8571428571428571, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\n#define mod 1000000007\nint main()\n{\n    long long n;\n    cin>>n;\n    vector<int>v;\n    for(int i=1;i<=n;i++)\n    {\n        v.push_back(i);\n    }\n    int t=n%mod;\n    if(t%2==0)\n    {\n       cout<<\"Mahmoud\"; //mahmud\n    }\n   if(t%2!=0)\n   {\n      cout<<\"Ehab\"; //ehabs\n   }\n}", "lang": "GNU C++14", "bug_code_uid": "67b7ed874b12626731f51c1d6069a982", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "apr_id": "82a0e19b991dafe29308ad45b58df103", "difficulty": 800, "tags": ["math", "games"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.36024844720496896, "equal_cnt": 13, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 13, "bug_source_code": "#include\"bits/stdc++.h\"\n\nusing namespace std;\n\nbool check(long long int n)\n{\n    int i=2;\n    while(i<n)\n    {\n        i=i*2;\n    }\n    if(i==n)\n    {\n        return true;\n    }\n    return false;\n}\nint main()\n{\n    long long int n;\n    cin>>n;\n    if(n==0)\n    {\n        cout<<n<<endl;\n        return 0;\n    }\n    n++;\n    if(n&1)\n    {\n        cout<<n<<endl;\n    }\n    else\n    {\n        if(check(n))\n        {\n            int i=2,cnt=1;\n            while(i<n)\n            {\n                i=i*2;\n                cnt++;\n            }\n            cout<<cnt<<endl;\n        }\n        else\n        {\n            cout<<n<<endl;\n        }\n\n    }\n\n\n    return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "a2831d12addd1bebdb6b2fac1baeaf3d", "src_uid": "236177ff30dafe68295b5d33dc501828", "apr_id": "1177807f7b13f36f59b3fe43075b56c3", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9410304158907511, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "#include <iostream>\n#define ll long long\nusing namespace std;\n\nconst int maxn = 505;\nconst int mod = 1000000007;\n\nint mult(int x, int y) {\n  return (ll)x * y % mod;\n}\nint add(int x, int y) {\n  return (x + y) % mod;\n}\nint sub(int x, int y) {\n  x -= y;\n  if (x < 0)\n    x += mod;\n  return x;\n\nint n, k, sol;\nint powr[maxn * maxn], dp[maxn][maxn];\n\nint main(void) {\n  cin >> n >> k;\n  powr[0] = 1;\n  for (int i=1; i<maxn * maxn; i++)\n    powr[i] = mult(powr[i - 1], 2);\n  dp[0][0] = 1;\n  for (int i=0; i<=n; i++)\n    for (int j=0; j<=k; j++) {\n      if (j == k) \n        sol = add(sol, dp[i][j]);\n      for (int l=i + 1; l<=n; l++)\n        dp[l][j + 1] = add(dp[l][j + 1], mult(dp[i][j], mult(sub(powr[l + 1], powr[i + 1]), powr[(l - i - 1) * (i + 1)])));\n    }\n  cout << sol << endl;\n  return 0;\n}\n  \n", "lang": "GNU C++", "bug_code_uid": "11340cea5f53559afc5692e38f1dded6", "src_uid": "111673158df2e37ac6c019bb99225ccb", "apr_id": "cd27329fa77b4020b2014ca26bbd0759", "difficulty": 2500, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.11188811188811189, "equal_cnt": 10, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\nlong long a,b,i,ans;\nint main()\n{\n\tscanf(\"%lld%lld\",&a,&b);\n\tfor(i=a;i<=b;i++)\n\t{\n\t\tlong long v=i,s=0;\n\t\twhile(v>0)\n\t\t{\n\t\t\tif(v%2==0)s++;\n\t\t\tif(s>1)\n\t\t\tbreak;\n\t\t\tv/=2;\n\t\t}\n\t\tif(s==1)ans++;\n\t}\n\tprintf(\"%lld\",ans);\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "10f045f1e7101c035fcd417f85aade14", "src_uid": "581f61b1f50313bf4c75833cefd4d022", "apr_id": "5ce0f8bc9e95ae0402e8e90ec10abf84", "difficulty": 1300, "tags": ["bitmasks", "brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8489583333333334, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint main()\n{\n    int n;\n    cin>>n;\n  while(n>=0)\n  {\n      if(n%2==0)\n      cout<<\"Mahmoud\";\n      else cout<<\"Ehab\";\n  }\n   \n}", "lang": "GNU C++11", "bug_code_uid": "3811cc177940bdcdb8504c998c712307", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "apr_id": "c84839ef5e40789b0a896dacc210b59c", "difficulty": 800, "tags": ["math", "games"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.3204968944099379, "equal_cnt": 21, "replace_cnt": 9, "delete_cnt": 6, "insert_cnt": 6, "fix_ops_cnt": 21, "bug_source_code": "//\u5947\u602a\n#include<map>\n#include<cmath>\n#include<stack>\n#include<queue>\n#include<cstdio>\n#include<vector>\n#include<cstring>\n#include<iostream>\n#include<algorithm>\nusing namespace std;\ntypedef long long ll;\ntemplate<class AK>void r(AK &x){\n    x=0;\n    int f=0;\n    char ch=getchar();\n    while(ch<'0'||ch>'9'){\n        f|=(ch=='-');\n        ch=getchar();\n    }\n    while(ch>='0'&&ch<='9'){\n        x=(x<<1)+(x<<3)+(ch^48);\n        ch=getchar();\n    }\n    x=f?-x:x;\n    return;\n}\nint x,y,a[15][15]={{0,1,2},{1,0,2},{1,2,0},{2,1,0},{2,0,1},{0,2,1},{0,1,2}};\nint main(){\n\tr(x);r(y);\n\tprintf(\"%d\\n\",a[x][y]);\n    return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "459ddec488748a57355f9ea962de533a", "src_uid": "7853e03d520cd71571a6079cdfc4c4b0", "apr_id": "c160853a4cb6d71583d6788864425714", "difficulty": 1000, "tags": ["math", "constructive algorithms", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6169154228855721, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "#include<iostream>\n#include<cstdio>\nusing namespace std;\nint k[10][10]={{0,1,2},{1,0,2},{1,2,0},{2,1,0},{2,0,1},{0,2,1},{0,1,2}};\nint main()\n{\n\tint h,v;\n\tcin>>h>>v;\n\tcout<<k[h][v];\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "c22c6a2d62f65f4447f17cde96a505bd", "src_uid": "7853e03d520cd71571a6079cdfc4c4b0", "apr_id": "c160853a4cb6d71583d6788864425714", "difficulty": 1000, "tags": ["math", "constructive algorithms", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8987517337031901, "equal_cnt": 9, "replace_cnt": 3, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "#include <iostream>\n#include <stdio.h>\n#include <algorithm>\n#include <vector>\n#include <sstream>\n#include <string>\n#include <set>\n#include <stack>\n#include <memory.h>\n#include<queue>\n#include <math.h>\n#include <map>\nusing namespace std;\n#define FOR(I,N) for(int(i)=0;i<int(N);++i)\n#define FORj(J,N) for(int(j)=0;i<int(N);++j)\ntypedef vector<int> vec;\ntypedef vector<vector<int> > graph;\n#define pyes() printf(\"YES\\n\");\n#define pno() printf(\"NO\\n\");\n#define filla(x,y) memset(x,y,sizeof(x));\n#define p1(x) printf(\"%d\\n\",x);\n#define in1(x) scanf(\"%d\",&x);\n#define in2(x,y) scanf(\"%d %d\",&x,&y);\n#define in3(x,y,z) scanf(\"%d %d %d\",&x,&y,&z);\n#define p2(x,y) printf(\"%d %d\\n\",x,y);\n#define p3(x,y,z) printf(\"%d %d %d\\n\",x,y,z);\nlong long pwr(long long x,long long y){\n    if(y==1)\n        return x;\n    long long z=pwr(x,y/2);\n    x=x*x;\n    if(y&1)\n        z=z*x;\n    return z;\n}\nint main() {\n    //freopen(\"in.txt\",\"rt\",stdin);\n    //freopen(\"out.txt\",\"wt\",stdout);\n    long long r,x,y,x1,y1;\n    scanf(\"%lld %lld %lld %lld %lld\",r,x,y,x1,y1);\n    long long sum=ceil((sqrt( pwr(x1-x,2)+ pwr(y1-y,2)))/2.0*r)+1e-9;\n    printf(\"%lld\",sum);\n\n    return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "b665630ece272ab3afd8f03e077bd2d1", "src_uid": "698da80c7d24252b57cca4e4f0ca7031", "apr_id": "d6b038314f69913a1b574f5ab03fed1b", "difficulty": 1400, "tags": ["geometry", "math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.41523809523809524, "equal_cnt": 15, "replace_cnt": 9, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 14, "bug_source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include <stdio.h>\n#include <iostream>\n#include <vector>\n#include <cmath>\n#include <algorithm>\n#include <string>\n#include <set>\n#include <queue>\n#include <stack>\n#include <map>\nusing namespace std;\n\n\nint main() {\n//\tfreopen(\"input.txt\", \"r\", stdin);\n  //  freopen(\"output.txt\", \"w\", stdout);\n    set<int> x1, y1;\n    vector<pair<int, int>> a;\n    int n = 8;\n    for(int i = 0; i < n; i++){\n        int x, y;\n        cin >> x >> y;\n        if(x > 3 || x < 0 || y > 3 || Y < 0)\n            return cout << \"ugly\", 0;\n        x1.insert(x);\n        y1.insert(y);\n        a.push_back({x, y});\n        \n    }\n    if(x.size() != 3 || y.size() != 3)\n        return cout << \"ugly\";\n    pair<int, int> fuck = {0,0};\n    int checker = 0;\n    for(auto c : x){\n        if(checker == 1)\n            fuck.first = c;\n        checker++;\n    }\n    int checker = 0;\n    for(auto c : y){\n        if(checker == 1)\n            fuck.second = c;\n        checker++;\n    }\n    for(auto c : a)\n        if(fuck  == c)\n            return cout << \"respectable\";\n    cout << \"ugly\";\n    return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "58b27cea62dcd5c469a85eea5f57856f", "src_uid": "f3c96123334534056f26b96f90886807", "apr_id": "26ef8ba341dbb19d427047b93423dcde", "difficulty": 1400, "tags": ["sortings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.43670886075949367, "equal_cnt": 12, "replace_cnt": 8, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "#include <iostream>\n#include <string>\n#include <algorithm>\nusing namespace std;\nint main()\n{\n    char c;\n    string text=\"\";\n    cin>>c;\n    while(c!='0'){\n        text+=c;\n        cin>>c;\n    }\n    string text2=text;\n    reverse(text2.begin(),text2.end());\n    if(text==text2) cout<<\"YES\"<<endl;\n    else cout<<\"NO\"<<endl;\n    return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "b41090292dd9783a3f1c2e3092ea7823", "src_uid": "d82278932881e3aa997086c909f29051", "apr_id": "c1d648787dc3671fb5432434ca16ddf1", "difficulty": 900, "tags": ["brute force", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.932258064516129, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 5, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n\nint main()\n{\n    int x ;\n    cin >> x ;\n    string str = to_string(x);\n    deque<char> s ;\n    for(int i=0 ; i < str.size(); i++)\n        s.push_back(str[i]);\n    while(s.size()!=1)\n    {\n        if(s[0]==s[s.size()-1])\n        {\n            s.pop_back();\n            s.pop_front();\n        }\n        else if(s[0]=='0')\n            s.pop_front();\n        else if(s[s.size()-1]=='0')\n            s.pop_back();\n        else\n        {\n            cout <<\"NO\" ;\n            return 0 ;\n        }\n    }\n    cout << \"YES\";\n    return 0 ;\n}\n", "lang": "GNU C++17", "bug_code_uid": "60cdf718a5765779bf0254825234aeb3", "src_uid": "d82278932881e3aa997086c909f29051", "apr_id": "1d6fb25edf37b086778b1425eead91bb", "difficulty": 900, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.7986921999065857, "equal_cnt": 10, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n\n#define ll long long\n\nconst int MAXI = 2e9;\n\nconst int N = 1000;\n\nint fac[N];\n\nint org(int x){\n   int ret = 0;\n   queue<int> q;\n   q.push(0);\n   while(!q.empty()){\n      int u = q.front();\n      q.pop();\n      int v= u*10 + 4;\n      int v2 = u*10 + 7;\n      if(v<=x){\n         q.push(v);\n         ++ret;\n      }\n      if(v2<=x){\n         q.push(v2);\n         ++ret;\n      }\n   }\n   return ret;\n}\n\nbool isLucky(int x){\n   while(x>0){\n      int g = x%10;\n      if(g==4 || g==7){\n         x/=10;\n      } else {\n         return false;\n      }\n   }\n   return true;\n}\nvoid solve() {\n   int n,k;\n   scanf(\"%d%d\",&n,&k);\n   ll ret = 1;\n   int ind = 0,l = 0,r = n,mid;\n   bool isSatisfy = false;\n   for(int i=1;i<=n;++i){\n      ret*=i;\n      if(ret>=k){\n         isSatisfy = true;\n         break;\n      }\n   }\n   fac[0] = 1;\n   for(int i=1;i<N;++i){\n      fac[i] = fac[i-1]*i;\n   }\n   if(!isSatisfy){\n      printf(\"-1\\n\");\n      return;\n   }\n   while(l<r) {\n      mid = (l+r+1)/2;\n      bool isGood = false;\n      ll tmp = 1;\n      for(int i=1;i<= n - mid;++i){\n         tmp*=i;\n         if(tmp>=k){\n            isGood = true;\n            break;\n         }\n      }\n      if(!isGood){\n         r = mid -1;\n      } else {\n         l = mid;\n      }\n   }\n   int R = org(l);\n   set<int> s;\n   for(int i=l+1;i<=n;++i){\n      s.insert(i);\n   }\n   ind = l+1;\n   while(!s.empty()){\n      int rem = s.size();\n      int g = 0;\n      while( g+1 <rem){\n         ll v = fac[rem-1]*(g+1);\n         if(v<k){\n            ++g;\n         } else {\n            break;\n         }\n      }\n      k -= g*fac[rem-1];\n      for(set<int>::iterator it = s.begin();it!= s.end();++it){\n         if(g==0){\n            if(isLucky(*it)&& isLucky(ind)){\n               ++R;\n            }\n            s.erase(it);\n            break;\n         } else {\n            --g;\n         }\n      }\n      ++ind;\n   }\n   printf(\"%d\\n\", R);\n}\n\nint main(){\n   //freopen(\"input.txt\",\"r\",stdin);\n   solve();\n}\n", "lang": "GNU C++14", "bug_code_uid": "703e098ff6859137c650cf88c8cb9ef8", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "apr_id": "86379406a6abf856316016246c53c958", "difficulty": 1900, "tags": ["brute force", "combinatorics", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9550794747753973, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include <iostream>\n#include <vector>\n#include <algorithm>\nusing namespace std;\n\nvector <int> a;\n\nint main()\n{\n\tint n;\n\tcin >> n;\n\n\tstring x;\n\n\tcin >> x;\n\n\tfor(int i=0;i<x.size();i++)\n\t{\n\t\tif(x[i] == '4')\n\t\t{\n\t\t\ta.push_back(2);\n\t\t\ta.push_back(2);\n\t\t\ta.push_back(3);\n\t\t}\n\t\telse if(x[i] == '6')\n\t\t{\n\t\t\ta.push_back(3);\n\t\t\ta.push_back(5);\n\t\t}\n\t\telse if(x[i] == '8')\n\t\t{\n\t\t\tfor(int j=1;j<4;j++)\n\t\t\t\ta.push_back(2);\n\t\t\ta.push_back(7);\n\t\t}\n\t\telse if(x[i] == '9')\n\t\t{\n\t\t\tfor(int j=1;j<4;j++)\n\t\t\t\ta.push_back(2);\n\t\t\tfor(int j=1;i<3;j++)\n\t\t\t\ta.push_back(3);\n\t\t\ta.push_back(7);\n\t\t}\n\t\telse\n\t\t\ta.push_back(x[i]-'0');\n\t}\n\n\tsort(a.begin(),a.end());\n\n\tfor(int i=a.size()-1;i>=0;i--)\n\t{\n\t\tif(a[i] != 1 && a[i] != 0)\n\t\t\tcout << a[i];\n\t}\n\tcout << endl;\n}\n", "lang": "GNU C++11", "bug_code_uid": "4f64c94a6b96fa0a3a7c515a583e8596", "src_uid": "60dbfc7a65702ae8bd4a587db1e06398", "apr_id": "3c4af951536238e031b95c161f9d2948", "difficulty": 1400, "tags": ["greedy", "math", "sortings"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.24162679425837322, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "#include<iostream>\n#include<cstdio>\n#include<algorithm>\nusing namespace std;\nint x=0,y=0;\nint n;\nint ans=0;\nchar opset[102];\nvoid go(int x1,int y1,int k,int step)\n{\n\tint xx=0,yy=0;\n\tif(x1==0&&y1==0)\n\t\tans=max(ans,step);\n\tif(k>n)\n\t\treturn;\n\tchar op=opset[k];\n\tif(op=='L')\n\t\txx--;\n\tif(op=='R')\n\t\txx++;\n\tif(op=='U')\n\t\tyy++;\n\tif(op=='D')\n\t\tyy--;\n\tgo(x1,y1,k+1,step);\n\tgo(x1+xx,y1+yy,k+1,step+1);\n}\nint main()\n{\n\tcin>>n;\n\tfor(int i=1;i<=n;i++)\n\t{\n\t\tcin>>opset[i];\n\t}\n\tgo(x,y,1,0);\n\tcout<<ans<<endl;\n}\n", "lang": "GNU C++14", "bug_code_uid": "2707375ddc1c78f14a75c569d7c77a4a", "src_uid": "b9fa2bb8001bd064ede531a5281cfd8a", "apr_id": "f7e9f143dea7caa7e3771913b2c377fc", "difficulty": 1000, "tags": ["greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.15215686274509804, "equal_cnt": 14, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 14, "bug_source_code": "#include <cmath>\n#include <cstdio>\n#include <vector>\n#include <iostream>\n#include <algorithm>\n#include <string>\nusing namespace std;\nstring input;\nunsigned long long int row;\nunsigned long long int seconds;\nint main() {\n\tcin >> input;\n    row = input[0] - '0';\n    if (row == 1) {\n       if (input[1] == 'a') cout << \"1\";\n        else if (input[1] == 'b') cout << \"2\";\n        else if (input[1] == 'c') cout << \"3\";\n        else if (input[1] == 'd') cout << \"4\";\n        else if (input[1] == 'e') cout << \"5\";\n        else if (input[1] == 'f') cout << \"6\";\n    }\n    else if (row == 2) {\n        if (input[1] == 'a') cout << \"8\";\n        else if (input[1] == 'b') cout << \"9\";\n        else if (input[1] == 'c') cout << \"10\";\n        else if (input[1] == 'd') cout << \"11\";\n        else if (input[1] == 'e') cout << \"12\";\n        else if (input[1] == 'f') cout << \"13\";\n    }\n    else if (row % 4 == 1 || row % 4 == 3) {\n    \tseconds += (16 * row / 4)\n        if (input[1] == 'a') seconds += 4;\n        else if (input[1] == 'b') seconds += 5;\n        else if (input[1] == 'c') seconds += 6;\n        else if (input[1] == 'd') seconds += 3;\n        else if (input[1] == 'e') seconds += 2;\n        else if (input[1] == 'f') seconds += 1;\n    }\n    else if (row % 4 == 2 || row % 4 == 0) {\n        seconds += (16 * row / 4)\n        if (input[1] == 'a') seconds += 4;\n        else if (input[1] == 'b') seconds += 5;\n        else if (input[1] == 'c') seconds += 6;\n        else if (input[1] == 'd') seconds += 3;\n        else if (input[1] == 'e') seconds += 2;\n        else if (input[1] == 'f') seconds += 1;\n\t    seconds += 7;\n    }\n    cout << seconds;\nreturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "970df1d713e2dfed25cefc0f6a3f6a66", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "apr_id": "bf4ca5f8fe780cba75c8e41984af466e", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8058217962371317, "equal_cnt": 13, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 12, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\nvoid solve(){\nint a,b,c,d;\ncin>>a>>b>>c>>d;\nif(a==c || b==d){\n    cout<<1<<\" \";\n}\nelse{\n    cout<<2<<\" \";\n}\n\n\n\n if((a+b)%2==0 && (c+d)%2!=0 || (a+b)%2!=0 && (c+d)%2==0){\n    cout<<0<<\" \";\n}\nelse if(a+b == c+d){\n    cout<<1<<\" \";\n}\nelse if(a+b != c+d)\n{\n    int p=a,q=b;\n while(p>=1 && q>=1){\n     p=p-1;\n     q=q-1;\n     if(p== c  && q==d){\n         cout<<1<<\" \";\n        \n     }   \n }\n p=a,q=b;\n  while(p<=8 && p<=8){\n     p=p+1;\n     q=q+1;\n     if(p== c  && q==d){\n         cout<<1<<\" \";\n         \n     }   \n }\n\n}\nelse{\n    cout<<2<<\" \"; \n}\n\nif(a==c){cout<<abs(b-d);\nreturn;}\nif(b==d){cout<<abs(a-c);\nreturn;}\nint count=0;\n\n\nif(a > c && b > d)\n{\nwhile(a!=c && b!=d){\na=a-1;\nb=b-1;\ncount++;\n}\nif(a==c){\n    count+= abs(b-d);\n}\nelse{\n    count+= abs(c-a);\n}\ncout<<count;\nreturn;\n}\n\nif(a > c && b < d)\n{\nwhile(a!=c && b!=d){\na=a-1;\nb=b+1;\ncount++;\n}\nif(a==c){\n    count+= abs(b-d);\n}\nelse{\n    count+= abs(c-a);\n}\ncout<<count;\nreturn;\n}\n\nif(a < c && b > d)\n{\nwhile(a!=c && b!=d){\na=a-1;\nb=b+1;\ncount++;\n}\nif(a==c){\n    count+= abs(b-d);\n}\nelse{\n    count+= abs(c-a);\n}\ncout<<count;\nreturn;\n}\n\nif(a < c && b<d)\n{\nwhile(a!=c && b!=d){\na=a+1;\nb=b+1;\ncount++;\n}\nif(a==c){\n    count+= abs(b-d);\n}\nelse{\n    count+= abs(c-a);\n}\ncout<<count;\nreturn;\n}\n    \n} \n    int main() {\n    solve();\n}\n", "lang": "GNU C++11", "bug_code_uid": "a11ab1b6411a78e38b47952d3fe03866", "src_uid": "7dbf58806db185f0fe70c00b60973f4b", "apr_id": "1b34b5e16f9a2eb39343b20595514fe7", "difficulty": 1100, "tags": ["graphs", "math", "shortest paths"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9319148936170213, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include<iostream>\nusing namespace std;\nint main()\n{\n    int a,b,c;\n    cin>>a>>b>>c;//1a:2b:4c\n    int i=1;\n    while(i<=a)\n    {\n        if(((2*i)<=b)&&(4*i<=c))\n        i++;\n    }\n    i--;\n    cout<<i+(2*i)+(4*i);\n}\n", "lang": "GNU C++11", "bug_code_uid": "f94d0d5ee9635ee94266824edd168842", "src_uid": "82a4a60eac90765fb62f2a77d2305c01", "apr_id": "c6a4c8ec0414e5c64a4d3bc6a80ee65f", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.3246311010215664, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "#include<stdio.h>\n#include<iostream>\n#include<string>\nusing namespace std;\nstring player1=\"Mahmoud\",player2=\"Ehab\";\n\nbool play(int n,bool even)\n{\n    int i;\n    if(even)\n    {\n        for(i=1;i<=n;i++)\n        if(i%2==0&&!play(n-i,false))\n        {\n            //cout<<player1<<\" win\"<<endl;\n            return true;\n        }\n        return false;\n    }\n    else\n    {\n        for(i=1;i<=n;i++)\n        if(i%2==1&&!play(n-i,true))\n        {\n            //cout<<player2<<\" win\"<<endl;\n            return true;\n        }\n        return false;\n    }\n\n}\n\nint main()\n{\n    int n;\n    cin>>n;\n    if(play(n,1)) cout<<player1;\n    else  cout<<player2;\n    return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "de0f444c6f6ab85464d198b367e4001e", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "apr_id": "b80a43ea561dd3d2d4d56771a3bacc12", "difficulty": 800, "tags": ["math", "games"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6343713956170703, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "#include<bits/stdc++.h>\n#pragma GCC optimize(\"O2\")\nusing namespace std;\ntypedef long long ll;\nint main()\n{\n//\tfreopen(\".in\",\"r\",stdin);\n//  freopen(\".out\",\"w\",stdout);\n\tios::sync_with_stdio(false);\n\tll r,i,minv=1e12+10;\n\tcin>>r;\n\tr--;\n\tfor(i=1;i*i<=r;i++)\n\t\tif(r%i==0)\n\t\t{\n\t\t\tif((r/i-i-1)%2==0)\n\t\t\t\tminv=min(minv,i);\n\t\t\tif((r/(r-i)-(r-i)-1)>0&&(r/(r-i)-(r-i)-1)%2==0)\n\t\t\t\tminv=min(minv,r/i);\n\t\t}\n\tif(minv==1e12+10)\n\t\tcout<<\"NO\";\n\telse\n\t\tcout<<minv<<' '<<(r-minv-minv*minv)/2/minv;\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "f4b079f681c77bc8b38b58d7bc07c82e", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "apr_id": "0ebe367e4fd77d645fb81161f21a2c20", "difficulty": 1200, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9984939759036144, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <bits/stdc++.h>\n\n#define fileio ifstream cin(\"input.txt\"); ofstream cout(\"output.txt\")\n#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)\n#define bench cerr << endl << \"Time: \" << clock() << \" ms\" << endl\n#define endl \"\\n\"\n\nusing namespace std;\n\ntypedef long long ll;\ntypedef long double ld;\ntypedef pair<int, int> pii;\n\nconst int INF = 1e9;\nconst ll LINF = 1e18;\n\nvector<int> t;\nint sz;\n\nvoid update(int pos, int val){\n    pos += sz - 1;\n    t[pos] = val;\n    while (pos != 0) {\n        pos = (pos - 1) / 2;\n        t[pos] = max(t[2 * pos + 1], t[2 * pos + 2]);\n    }\n}\n\nint get(int l, int r, int x = 0, int tl = 0, int tr = sz){\n    if(l >= tr || r <= tl)\n        return 0;\n    if(l <= tl && r >= tr)\n        return t[x];\n    int m = (tl + tr) / 2;\n    int x1 = get(l, r, 2 * x + 1, tl, m);\n    int x2 = get(l, r, 2 * x + 2, m, tr);\n    return max(x2, x1);\n}\n\nint main() {\n    fileio;\n    int n, m;\n    cin >> n >> m;\n    vector<pii> v(n);\n    for (int i = 0; i < n; i++) {\n        cin >> v[i].first >> v[i].second;\n    }\n    sort(v.begin(), v.end());\n    vector<int> a(m);\n    int cur = 0;\n    multiset<int> s;\n    for (int i = 0; i < m; i++) {\n        while(cur < v.size() && v[cur].first == i + 1){\n            s.insert(v[cur].second);\n            cur++;\n        }\n        while (s.size() != 0 && *s.begin() < i + 1) {\n            s.erase(s.begin());\n        }\n        a[i] = s.size();\n    }\n    sz = 1 << (int)ceil(log2(n + 1));\n    t.resize(2 * sz);\n    vector<int> dp1(m);\n    for (int i = 0; i < m; i++) {\n        dp1[i] = get(0, a[i] + 1) + 1;\n        update(a[i], dp1[i]);\n    }\n    fill(t.begin(), t.end(), 0);\n    reverse(a.begin(), a.end());\n    vector<int> dp2(m);\n    for (int i = 0; i < m; i++) {\n        dp2[i] = get(0, a[i] + 1) + 1;\n        update(a[i], dp2[i]);\n    }\n    reverse(dp2.begin(), dp2.end());\n    int res = 0;\n    for (int i = 0; i < m; i++) {\n        \n        res = max(res, dp1[i] + dp2[i] - 1);\n    }\n    cout << res;\n    return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "480fd86e44055f5af20ac2cfaa4a3ea5", "src_uid": "ce8350be138ce2061349d7f9224a5aaf", "apr_id": "9022a40651b66e826d961cd5c8da58f1", "difficulty": 1900, "tags": ["data structures", "dp", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8799283154121864, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 6, "bug_source_code": "#include <iostream>\n\n\nusing namespace std;\n\nconst int MAXN = 3000;\nint earn[MAXN];\nint cost[MAXN];\nconst int INF = 99999999;\nint dp[MAXN][MAXN];\nint idx, n, m;\n\nint main(){\n    idx = 0;\n    cin>>n>>m;\n\n    int tc, td;\n    cin>>tc>>td;\n    \n    for(int i=0; i<n/tc; i++){\n        earn[idx] = td;\n        cost[idx] = tc;\n        idx++;\n    }\n\n    \n    //cin>>cost[0]>>earn[0];\n    //idx++;\n    for(int i=0; i<m; i++){\n        int a,b,c,d;\n        cin>>a>>b>>c>>d;\n        int number = a/b;\n        for(int k=0; k<number; k++){\n            cost[idx] = c;\n            earn[idx] = d;\n            idx++;\n        }\n    }\n\n    memset(dp,0,sizeof(dp));\n\n    dp[0][cost[0]] = earn[0];\n\n    int ans =- INF;\n    for(int i=1; i<idx; i++){\n        for(int j=0; j<=n; j++){\n            if(j-cost[i]>=0){\n                dp[i][j] = max(dp[i][j], earn[i] + dp[i-1][j-cost[i]]);\n                //cout<<\"dp[\"<<i<<\"][\"<<j<<\"] = \"<<dp[i][j]<<endl;\n                ans = max(ans, dp[i][j]);\n            }\n        }    \n    }\n    cout<<ans<<endl;\n}\n\n", "lang": "GNU C++0x", "bug_code_uid": "959e15c2e768f7f10a61f7c3258fdd66", "src_uid": "4e166b8b44427b1227e0f811161d3a6f", "apr_id": "25c7e88cd7bbb1c52b66e7fcdd575789", "difficulty": 1700, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.3267233238904627, "equal_cnt": 11, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 11, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\n\nlong long field[10001][10001];\n\nvoid populate() {\n\tfield[0][0] = 0;\n\tfor (int x = 1; x <= 10000; x++) {\n\t\tfield[x][0] = field[x-1][0]+x;\t\t\n\t}\n\tfor (int y = 1; y <= 10000; y++) {\n\t\tfield[0][y] = field[0][y-1]+y;\n\t}\n\n\tfor (int x = 1; x <= 10000; x++) {\n\t\tfor (int y = 1; y <= 10000; y++) {\n\t\t\tfield[x][y] = field[x-1][y]+field[x][y-1]+x+y-field[x-1][y-1];\n\t\t}\n\t}\n}\n\nint main() {\n\t//freopen(\"input.txt\", \"r\", stdin);\n\tpopulate();\n\tint m, b;\n\tcin >> m >> b;\n\tlong long sol = 0;\n\tfor (int x = 0; x <= 10000; x++) {\n\t\tint y = -(ceil((double)x/m))+b;\n\t\tif (y<0) break;\n\t\tsol = max(sol, field[x][y]);\n\t\t//cout << x << y << \"\\n\";\n\t}\n\tcout << sol;\n\t\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "b986c3b048809e32fe8d861cd3fff485", "src_uid": "9300f1c07dd36e0cf7e6cb7911df4cf2", "apr_id": "719ea70abb44485c16f3b96c0d7dbcb9", "difficulty": 1300, "tags": ["math", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9842003853564547, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "/*\n  /\\     /\\\n  | ).|.( |\n  |  >-<  |\n  =========\nIt's AdilkhanKo miaaaaaau\n*/\n#include<bits/stdc++.h>\n\n#define ll long long\n#define pb push_back\n#define endl \"\\n\"\n#define foreach(it, S) for(__typeof (S.begin()) it = S.begin(); it != S.end(); it++)\n#define mp make_pair\n#define f first\n#define s second\n#define name \"\"\n#define _ ios_base::sync_with_stdio(false);cin.tie(0);\n\nusing namespace std;\n\nconst int MaxN = int (2e6) + 256;\nconst int INF = int(1e9);\nconst int mod = (int)(1e9) + 7;\nconst double pi = 3.1415926535897932384626433832795;\nll n, m, t, ans;\n\nvector<int> v, v1;\n\nll rec(int i, int oi){\n\tif(i == v1.size()){\n\t\tif(v1.size() + 1 == v.size() && oi == 1)return 1;\n\t\tif(v.size() == v1.size() && oi != 1)return 1;\t\t\n\t\treturn 0;\n\t}\t\n\tll ans = 1;\n\tif(v1[i] == 0 && oi && v[i] != 1)return 0;\n\tif(v1[i] == 1 && oi && v[i] != 0)return 0;\n\tif(v1[i] == 0 && !oi && v[i] != 0)return 0;\n\tif(v1[i] == 1 && !oi && v[i] != 1)return 0;\n\n\tif(v1[i] == 0){\n\t\tans *= (rec(i + 1, 0) + rec(i + 1, 1));\n\t}else{\n\t\tans *= rec(i + 1, oi) * 2; \n\t}\n\treturn ans;\n}\nint main () { _\n\tll  a, b; cin >> a >> b;\n\tll cnt = 0;\n\tif(a == b)cnt = 2;\n\twhile(a){\n\t\tv.pb(a % 2);\n\t\ta /= 2;\n\t}\n\twhile(b){\n\t\tv1.pb(b % 2);\n\t\tb /= 2;\n\t}\n\twhile(v.size() != v1.size())v1.pb(0);\n\tcout << rec(0, 0) - cnt;\nreturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "e9cfdaa6b348c613f653638c1d1ee4f6", "src_uid": "18410980789b14c128dd6adfa501aea5", "apr_id": "a39f5681be9383e28cb8ba1773e1d687", "difficulty": 1700, "tags": ["dp", "math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9101856497742097, "equal_cnt": 9, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 8, "bug_source_code": "#include <stdio.h>\n#include <iostream>\n#include <algorithm>\n#include <cstdlib>\n#include <cmath>\n#include <cstdio>\n#include <cstring>\n#include <cctype>\n#include <stack>\n#include <vector>\n#include <set>\n#include <queue>\n#include <map>\n#include <list>\n#include <deque>\n#include <fstream>\n#include <string>\n#include <iterator>\ntypedef long long ll;\ntypedef long double ld;\n#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)\n#define FOR(i, a, b) for(int i = (a);i < (b);i++)\n#define pb push_back\n#define mp make_pair\n#define mod 1000000007\n#define fi first\n#define se second\n#define sqr(a) ((a) * (a))\n\nusing namespace std;\n\nint n, k, cnt;\nbool was[100005];\n\nint main()\n{\n    //ifstream in(\"haybales.in\");\n    //ofstream out(\"haybales.out\");\n    int x, y, x1, y1, x2, y2;\n    cin >> x1 >> y1 >> x2 >> y2 ;\n    cin >> x >> y;\n    if (((x1 - x) % x2) || ((y1 - y) % y2))\n        cout << \"NO\" << endl;\n    else\n        cout << \"YES\" << endl;\n\n    return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "cb51ecb127f8dd79dd91204da5cc6ab4", "src_uid": "1c80040104e06c9f24abfcfe654a851f", "apr_id": "1d028e01e823bfe69464e9bce751ad01", "difficulty": 1200, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9027190332326284, "equal_cnt": 13, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 8, "fix_ops_cnt": 12, "bug_source_code": "#include <iostream>\n#include <bits/stdc++.h>\n/*#include <sstream>\n#include <stdio.h>\n#include <string>\n#include <cstring>\n#include <queue>\n#include <cmath>\n#include <map>\n#include <set>\n#include <algorithm>\n#include<climits>\n#include <bitset>\n#include <ctime>\n#include <cassert>\n#include <functional>\n#include <iomanip>\n#include <vector>\n#include <stack>\n#include <fstream>*/\n//std::ifstream cin(\"input.txt\");\n//std::ofstream cout(\"output.txt\");\n//freopen(\"input.txt\",\"r\",stdin);\n//freopen(\"output.txt\",\"w\",stdout);\n//cout<<fixed<<setprecision(*)<<***<<endl;\n/*scanf(\"%d\",&..);\nprintf(\"%d\",..);*/\n\nusing namespace std;\nvector<pair<long long,long long> >vec,vec1;\nint main()\n{\n\tios_base::sync_with_stdio(0);\n\tcin.tie(0);\n\tlong long x1,y1,x2,y2,x,y,c=0; cin>>x1>>y1>>x2>>y2>>x>>y;\n\tif(x1==x2&&y2==y1){cout<<\"YES\"<<endl; return 0;}\n\tvec.push_back(make_pair(x1+x,y1+y));\n\tvec.push_back(make_pair(x1-x,y1-y));\n\tvec.push_back(make_pair(x1+x,y1-y));\n\tvec.push_back(make_pair(x1-x,y1+y));\n\twhile(true)\n    {\n        c++;\n        if(c%2!=0)\n        {\n            vec1.clear();\n            for(long long i=0;i<vec.size();i++)\n            {\n                if(vec[i].first==x2&&vec[i].second==y2){cout<<\"YES\"<<endl; return 0;}\n                if(vec[i].first>x2&&vec[i].second>y2){cout<<\"NO\"<<endl; return 0;}\n                vec1.push_back(make_pair(vec[i].first+x,vec[i].second+y));\n                vec1.push_back(make_pair(vec[i].first-x,vec[i].second-y));\n                vec1.push_back(make_pair(vec[i].first+x,vec[i].second-y));\n                vec1.push_back(make_pair(vec[i].first-x,vec[i].second+y));\n            }\n        }\n        else\n        {\n            vec.clear();\n            for(long long i=0;i<vec1.size();i++)\n            {\n                if(vec1[i].first==x2&&vec1[i].second==y2){cout<<\"YES\"<<endl;  return 0;}\n                if(vec1[i].first>x2&&vec1[i].second>y2){cout<<\"NO\"<<endl; return 0;}\n                vec.push_back(make_pair(vec1[i].first+x,vec1[i].second+y));\n                vec.push_back(make_pair(vec1[i].first-x,vec1[i].second-y));\n                vec.push_back(make_pair(vec1[i].first+x,vec1[i].second-y));\n                vec.push_back(make_pair(vec1[i].first-x,vec1[i].second+y));\n            }\n        }\n    }\n\treturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "16470f583127568879dc31e7f005d564", "src_uid": "1c80040104e06c9f24abfcfe654a851f", "apr_id": "628d62953e01ef6e46c1f753be9edb54", "difficulty": 1200, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9121338912133892, "equal_cnt": 20, "replace_cnt": 11, "delete_cnt": 0, "insert_cnt": 8, "fix_ops_cnt": 19, "bug_source_code": "#include<cstdio>\n#include<string>\n#include<cstring>\n#include<cstdlib>\n#include<algorithm>\nusing namespace std;\nint n,q,ans,i,met[16];\nchar s[100001];\nint gc(int n,int k){\n\tif(k==1)return n;else \n\treturn n*gc(n-1,k-1);\n}\nint lz(int i){\n\tif(i)return 0;\n\tif(s[i]=='?')return 1;else return 0;\n}\nint aj(){\n\tif(s[i]=='1' || s[i]=='2' || s[i]=='3' || s[i]=='4' ||\n\t   s[i]=='5' || s[i]=='6' || s[i]=='7' || s[i]=='8' ||\n\t   s[i]=='9' || s[i]=='0' || s[i]=='?') return 0;else return 1;\n}\nint main(){\n\t//freopen(\"input.txt\",\"r\",stdin);\n\tgets(s);\n\tn=strlen(s);\n\tans=1;\n\tmemset(met,0,sizeof met);\n\tfor(i=0;i<n;++i){\n\t\tif(s[i]=='?')ans*=10-lz(i);else\n\t\t\tif(s[i]=='A')met[0]=1;else\n\t\t\tif(s[i]=='B')met[1]=1;else\n\t\t\tif(s[i]=='C')met[2]=1;else\n\t\t\tif(s[i]=='D')met[3]=1;else\n\t\t\tif(s[i]=='E')met[4]=1;else\n\t\t\tif(s[i]=='F')met[5]=1;else\n\t\t\tif(s[i]=='G')met[6]=1;else\n\t\t\tif(s[i]=='H')met[7]=1;else\n\t\t\tif(s[i]=='I')met[8]=1;else\n\t\t\tif(s[i]=='J')met[9]=1;\n\t}\n\tq=0;\n\tfor(i=0;i<10;++i)q+=met[i];\n        if(aj())ans*=9*gc(9,q-1);else ans*=gc(10,q);\n        printf(\"%d\\n\",ans);\n}", "lang": "GNU C++", "bug_code_uid": "fb61cf65888e928f99599140d812fe6d", "src_uid": "d3c10d1b1a17ad018359e2dab80d2b82", "apr_id": "bd85bc7d68bb94a854cf3c0c0539dd3e", "difficulty": 1100, "tags": ["greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8384415584415584, "equal_cnt": 8, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "#include<iostream>\n#include<cstdio>\n#include<cstring>\n#include<string>\n#include<cmath>\n#include<algorithm>\n#include<map>\n#include<vector>\n#include<set>\n#include<iomanip>\n#include<stack>\n#include<queue>\n#define ll long long int\n#define pb push_back\n#define ld long double\n#define sz size\n#define pii pair<int, int>\n#define pll pair<ll, ll>\n#define pil pair<ll, int>\n#define F first\n#define S second\n#define mp make_pair\nusing namespace std;\nll a[3];\nll L;\nll ans = 0;\nll c[4][100100];\nint main() {\n\tfor (int i = 0; i < 3; i++) cin >> a[i];\n\tcin >> L;\n\tc[0][0] = 1;\n\tfor (int i = 0; i <= 3; i++) {\n\t\tfor (int j = 0; j <= (int)(1e5+10); j++) {\n\t\t\tif (i - 1 >= 0 && j - 1 >= 0) c[i][j] += c[i - 1][j - 1];\n\t\t\tif (j - 1 >= 0) c[i][j] += c[i][j - 1];\n\t\t}\n\t}\n\tans = c[3][L + 3];\n\tfor (int i = 0; i < 3; i++) {\n\t\tfor (int l = 0; l <= L; l++) {\n\t\t\tll x = min(a[i]-a[(i+1)%3]-a[(i+2)%3]+l, L-l);\n\t\t\tans -= c[2][x+2];\n\t\t}\n\t}\n\tcout << ans << endl;\n    return 0;\n}", "lang": "GNU C++14", "bug_code_uid": "ecaaf596fa99b9c8a6745b1b1ddfde6d", "src_uid": "185ff90a8b0ae0e2b75605f772589410", "apr_id": "f015df2c6e31373e73d25ea69b7e920e", "difficulty": 2100, "tags": ["math", "combinatorics", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9861695730607336, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n#define gc getchar_unlocked\n#define fo(i,n) for(i=0;i<n;i++)\n#define Fo(i,k,n) for(i=k;i<n;i++)\n#define ll long long\n#define pii pair<int,int>\n#define vi vector<int>\n#define pb push_back\n#define mp make_pair\n#define F first\n#define S second\nconst int mod = 1000000007;\n\nint mpow(int base, int exp); \n\n\nint main()\n{\n\tll a, b;\n\tcin>>a>>b;\n\tvi x, y;\n\tll n = a, m = b;\n\twhile(a>0){\n\t\tx.pb(a%2);\n\t\ta = a/2;\n\t}\n\twhile(b>0){\n\t\ty.pb(b%2);\n\t\tb = b/2;\n\t}\n\tint LL = y.size();\n\twhile(y.size() != x.size())\n\t\ty.pb(0);\n\tint len = x.size();\n\tint i, A[len], B[len];\n\tfo(i, len)\n\t\tA[i] = B[i] = -1;\n\tint cn = 0;\n\tfor(i=len-1; i>=0; i--){\n\t\tif(x[i] == 1 && y[i] == 1){\n\t\t\tif(cn){\n\t\t\t\tcout<<\"0\\n\";\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tA[i] = 1;\n\t\t\tB[i] = 0;\n\t\t\tcn = 0;\n\t\t}\n\t\tif(x[i] == 1 && y[i] == 0){\n\t\t\tif(cn){\n\t\t\t\tA[i] = 1;\n\t\t\t\tB[i] = 1;\n\t\t\t\tcn = 1;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tA[i] = 0;\n\t\t\t\tB[i] = 0;\n\t\t\t\tcn = 1;\n\t\t\t}\n\t\t}\n\t\tif(x[i] == 0 && y[i] == 1){\n\t\t\tif(cn){\n\t\t\t\tA[i] = 1;\n\t\t\t\tB[i] = 0;\n\t\t\t\tcn = 1;\n\t\t\t}else{\n\t\t\t\tcout<<\"0\\n\";\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\tif(x[i] == 0 && y[i] == 0){\n\t\t\tif(cn){\n\t\t\t\tA[i] = 1;\n\t\t\t\tB[i] = 1;\n\t\t\t\tcn = 0;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tA[i] = 0;\n\t\t\t\tB[i] = 0;\n\t\t\t\tcn = 0;\n\t\t\t}\n\t\t}\n\t\t\n\t}\n\tif(cn){\n\t\tcout<<\"0\\n\";\n\t\treturn 0;\n\t}\n\tint ans = 0;\n\n\tfor(int i = LL-1;i >=0 ; i--){\n\t\tint zz = A[i]^B[i];\n\t\tif(zz == 1)\n\t\t\tans++;\n\t}\n\tll res = pow(2, ans);\n\tif(n==m)\n\t\tres -= 2;\n\tcout<<res<<endl;\n\t\n\t\n\t\n\t\n\treturn 0;\n} \n\nint mpow(int base, int exp) {\n  base %= mod;\n  int result = 1;\n  while (exp > 0) {\n    if (exp & 1) result = ((ll)result * base) % mod;\n    base = ((ll)base * base) % mod;\n    exp >>= 1;\n  }\n  return result;\n}", "lang": "GNU C++", "bug_code_uid": "6eec565d26d96d2faeb7cf6e4f9b9447", "src_uid": "18410980789b14c128dd6adfa501aea5", "apr_id": "b86e0232e5059484c87deff44084ff16", "difficulty": 1700, "tags": ["dp", "math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.4845714285714286, "equal_cnt": 14, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 14, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\nbool check(int x,int l,int r) {\n\treturn (x >=l && x<=r);\n}\nint gcd(int x,int y) {\n\tif (y==0) return x;\n\treturn gcd(y, x%y);\n}\nint lcm(int x,int y) {\n\treturn (x * y / gcd(x,y));\n}\nvector<int> vt,vt1,vt2;\nint main() {\n\tint l , r , x, y;\n\tcin >> l >> r >> x >> y;\n\tif (y %x != 0) {\n\t\tcout<<0;\n\t\treturn 0;\n\t}\n\tfor(int i=1;i<=sqrt(y);i++) {\n\t\tif (y%i==0) {\n\t\t\tvt.push_back(i);\n\t\t}\n\t\tif (y/i !=i) {\n\t\t\tvt.push_back(y/i);\n\t\t}\n\t}\n\n\tfor(int i=1;i<=sqrt(x);i++) {\n\t\tif (x%i==0) {\n\t\t\tvt1.push_back(i);\n\t\t}\n\t\tif (x/i !=i) {\n\t\t\tvt1.push_back(x/i);\n\t\t}\n\t}\n\tint cnt = 0;\n\tfor(int i=0;i<vt.size();i++) {\n\t\tfor(int j=0;j<vt1.size();j++) {\n\t\t\tvt2.push_back(vt[i] * vt[j]);\t\n\t\t}\n\t}\n\tsort(vt2.begin() ,vt2.end());\n\tvt2.resize(distance(vt2.begin(), unique(vt2.begin(), vt2.end())));\n\tfor(int i=0;i<vt2.size();i++) {\n\t\t  {\n\t\t\tint xx = vt2[i];\n\t\t\tint yy = x * y / xx;\n\t\t\tif (gcd(xx,yy) != x || lcm(xx,yy) !=y) continue;\n\t\t\tif (xx == yy) {\n\t\t\t\tif (check(xx,l,r)) cnt++;\n\t\t\t} else {\n\t\t\t\tif (check(xx,l,r) && check(yy,l,r)) cnt+=1;\n\t\t\t}\n\t\t   }\n\t}\n\tcout<<cnt;\n}\n", "lang": "GNU C++11", "bug_code_uid": "13579c30c441341779a1be93ce3a9b9a", "src_uid": "d37dde5841116352c9b37538631d0b15", "apr_id": "878a611344e6418685a4367a4c7cdc80", "difficulty": 1600, "tags": ["math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.7167630057803468, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include <iostream>\n#include <fstream>\nusing namespace std;\n\nint minn (int a,int b,int c)\n{\n\tif (a < b)\n\t\tif (a<c)\n\t\t\treturn a;\n\t\telse\n\t\t\treturn c;\n\telse\n\t\tif (b>c)\n\t\t\treturn c;\n\t\telse\n\t\t\treturn b;\n}\nint main()\n{\n\tifstream inp;\n\tofstream oup;\n\tinp.open(\"standart input.txt\");\n\tif (!inp)\n\t\tcout << \"!\";\n\toup.open(\"standard output.txt\");\n\tint n=0,k=0,l=0,c=0,d=0,p=0,nl=0,np=0;\n\tinp >>n>>k>>l>>c>>d>>p>>nl>>np;\n\tint ml,dolk,sol;\n\tml = (k*l)/nl;\n\tdolk = c*d;\n\tsol = p / np;\n\tfloat tost;\n\ttost = minn (ml,dolk,sol) / n;\n\tif (tost > 1) \n\t\toup<< tost;\n\telse\n\t\toup << 0;\n\toup.close();\n\tinp.close();\n}", "lang": "MS C++", "bug_code_uid": "c7cc8330c7473acaace4c1e68daa3b2c", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "apr_id": "70ac4498e7eadac7053991ac28d84cef", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.5275490816972768, "equal_cnt": 21, "replace_cnt": 14, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 20, "bug_source_code": "//#pragma GCC optimize(2)\n#include<bits/stdc++.h>\n#include<unordered_map>\n#include<unordered_set>\n#define INF 0x3f3f3f3f\n#define mod 1000000007\n#define PI 3.14159265358979323846\n#define Base 23333333\n//#define set unordered_set\n//#define map unordered_map\n#define int long long\n//#define int unsigned long long\nusing namespace std;\n//#define scanf scanf_s\n\n//#define read() _read()\n//#define cout fout\n//#define cin fin\n//ifstream fin(\"in.txt\");fstream fout(\"out.txt\");\n//int _read() {\tint tmp;\tfin >> tmp;\treturn tmp;}\n\ninline int read() { int x = 0, f = 1;\tchar ch = getchar();\twhile (ch<'0' || ch>'9') { if (ch == '-') { f = -1; }\t\tch = getchar(); }\twhile (ch >= '0'&&ch <= '9') { x = 10 * x + ch - '0';\t\tch = getchar(); }\treturn x * f; }\n\nconst int maxnum = 10005;\nint c[maxnum][maxnum];\nint fac[maxnum];\nint n, x, pos;\n// c[i][j]  \ufffd\ufffd i \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0461  j\ufffd\ufffd\ufffd\ufffd \nvoid init() {\n\tc[0][0] = 1;\n\tc[1][0] = c[1][1] = 1;\n\tfor (int i = 2; i < maxnum; i++) {\n\t\tc[i][0] = 1;\n\t\tfor (int j = 1; j < maxnum; j++) {\n\t\t\tc[i][j] = c[i - 1][j] + c[i - 1][j - 1];\n\t\t\tc[i][j] %= mod;\n\t\t}\n\t}\n\tfac[0] = 1;\n\tfac[1] = 1;\n\tfor (int i = 2; i < maxnum; i++) {\n\t\tfac[i] = i * fac[i - 1] % mod;\n\t\tfac[i] %= mod;\n\t}\n}\n\nint A(int a, int b) {\n\treturn (fac[a] / fac[a - b]) % mod;\n}\nint C(int a, int b) {\n\treturn c[b][a] % mod;\n}\nsigned main()\n{\n\tinit();\n\tn = read(), x = read(), pos = read();\n\tint L = 0, R = n;\n\tint MIN = 0, MAX = 0;\n\twhile (L < R) {\n\t\tint mid = (L + R) / 2;\n\t\tif (pos < mid) {\n\t\t\tMAX++;\n\t\t\tR = mid;\n\t\t}\n\t\telse  if (pos > mid) {\n\t\t\tMIN++;\n\t\t\tL = mid + 1;\n\t\t}\n\t\telse {\n\t\t\tbreak;\n\t\t}\n\t}\n\t//cout << MAX << \"\\t\" << MIN << endl;\n\tint ans = 1;\n\tans *= (C(MAX, n-x)*A(MAX, MAX)) % mod; ans %= mod;\n\tans *= (C(MIN, x-1)*A(MIN, MIN)) % mod; ans %= mod;\n\tans *= A(n - MAX - MIN -1, n - MAX - MIN - 1) % mod;\n\tans %= mod;\n\tcout << ans << endl;\n\treturn 0;\n}\n\n\n", "lang": "GNU C++11", "bug_code_uid": "3a914a3562a79ab2feafa45975be11f5", "src_uid": "24e2f10463f440affccc2755f4462d8a", "apr_id": "93e25fa7bc9ef5119cf767b604a97ace", "difficulty": 1500, "tags": ["combinatorics", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8890092041147807, "equal_cnt": 9, "replace_cnt": 1, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 8, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\n\nint n, k, x, r=0, b[110], oll[110], ll[110];\n\nint f(int start){\n    if(start>=n) return 0;\n\n    int c=0, pointer=start;\n    for(int i=start;i<n;i=ll[i]){\n        if(b[i]==b[pointer]) c++;\n        else if(c>2){\n            if(pointer>start) ll[pointer-1]=i;\n            else start=i;\n        }\n        else {\n            pointer=i; c=1;\n        }\n    }\n\n    if(c>2){\n        if(pointer>start) ll[pointer-1]=n;\n        else start=n;\n    }\n\n    c+=f(start);\n\n    return c;\n}\n\nint main()\n{\n\n    cin>>n>>k>>x; for(int i=0;i<n;i++) { cin>>b[i]; oll[i]=i+1; }\n    for(int i=0;i<(n-1);i++){\n        memcpy(ll,oll,sizeof(ll));\n        if((b[i]==b[i+1])&&(b[i+1]==x)){\n            if(i>0) ll[i-1]=i+2;\n            int tempR = 2;\n            tempR+=f(((i>0)?0:i+2));\n            r=max(r,tempR);\n        }\n    }\n\n    cout<<r;\n    return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "63db9c75874b4423c38aa1bbb933d68a", "src_uid": "d73d9610e3800817a3109314b1e6f88c", "apr_id": "1f01d5aeefc2299bab50a69b07a47555", "difficulty": 1400, "tags": ["brute force", "two pointers"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.8618219037871033, "equal_cnt": 18, "replace_cnt": 6, "delete_cnt": 3, "insert_cnt": 8, "fix_ops_cnt": 17, "bug_source_code": "#include<bits/stdc++.h>\n#include<unordered_set>\n#include<unordered_map>\nusing namespace std;\n\n#define mod 1000000007\n#define ll long long int\n\nll fac(ll x) {\n    if (x == 0)\n        return 1;\n    return ((x % mod) * fac(x - 1) % mod) % mod;\n}\n\nll power(ll x, ll y, ll p)\n{\n    ll res = 1;\n\n    x = x % p; \n\n    while (y > 0) {\n        if (y & 1)\n            res = (res * x) % p;\n\n        y = y >> 1;\n        x = (x * x) % p;\n    }\n    return res;\n}\n\nll modInverse(ll n, ll p)\n{\n    return power(n, p - 2, p);\n}\nll nPrModPFermat(ll n, ll r, ll p)\n{\n    if (r == 0)\n        return 1;\n\n    return ((fac(n)%p)  * modInverse(fac(n-r), p) % p) % p;\n}\n\nvoid solve()\n{\n    ll n, x, pos;\n    cin >> n >> x >> pos;\n    ll left = 0, right = 0;\n    ll l = 0, r = n;\n    while (l < r)\n    {\n        ll mid = l + (r - l) / 2;\n        if (mid < pos)\n        {\n            left++;\n            l = mid + 1;\n        }\n        else if (mid > pos)\n        {\n            right++;\n            r = mid;\n        }\n        else\n            break;\n    }\n\n    ll total = (ll)right + left;\n    ll less = (ll)x - 1ll;\n    ll more = (ll)n - x;\n    ll ans = (ll)(((ll)(nPrModPFermat(less,left,mod) % mod) * (ll)(nPrModPFermat(more,right,mod) % mod))%mod * (ll)(fac(n-total-1)%mod)) % mod;\n    cout << ans << \"\\n\";\n\n\n\n}\n\nint main()\n{\n    ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);\n    \n    solve();\n\n\n    return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "8f7d742f7b205bbd2cde35be9b150b4b", "src_uid": "24e2f10463f440affccc2755f4462d8a", "apr_id": "812eeb56fa0c63bf6d6811dba82ba504", "difficulty": 1500, "tags": ["combinatorics", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.929670693364223, "equal_cnt": 17, "replace_cnt": 6, "delete_cnt": 5, "insert_cnt": 5, "fix_ops_cnt": 16, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint const nax = 4e5 + 10;\nint par[nax];\nint n, m, q;\nvector <int> g[nax];\nvector < pair <int, int>> queries;\nvector < pair <int, int>> edges;\nint a[nax];\nint lc[nax];\nint rc[nax];\nbool del[nax];\nint where[nax + nax / 4];\nint in[nax];\nint out[nax];\nint cur;\nint T = 1;\nint p[nax];\nbool vis[nax];\n\npair <int, int> sg[nax * 4];\n\nvoid pull(int v) {\n    sg[v] = max(sg[v << 1], sg[v << 1 | 1]);\n}\n\nvoid update(int v, int x, int y, int pos, pair <int, int> val) {\n    if (x == y) {\n        sg[v] = val;\n    } else {\n        int mid = x + y >> 1;\n        if (pos <= mid) update(v << 1, x, mid, pos, val);\n        else update(v << 1 | 1, mid + 1, y, pos, val);\n        pull(v);\n    }\n}\n\npair <int, int> get_max(int v, int x, int y, int l, int r) {\n    if (l == x && r == y) {\n        return sg[v];\n    } else {\n        int mid = x + y >> 1;\n        if (r <= mid) return get_max(v << 1, x, mid, l, r);\n        else if (l > mid) return get_max(v << 1 | 1, mid + 1, y, l, r);\n        else return max(get_max(v << 1, x, mid, l, mid)\n                        , get_max(v << 1 | 1, mid + 1, y, mid + 1, r));\n    }\n}\n\nint find(int x) {\n    return x == par[x] ? x : par[x] = find(par[x]);\n}\n\nvoid join(int u, int v) {\n    int fake = cur ++;\n    u = find(u);\n    v = find(v);\n    lc[fake] = u;\n    rc[fake] = v;\n    par[u] = fake;\n    par[v] = fake;\n}\n\nvoid dfs(int v) {\n    if (v == 0) return;\n    vis[v] = true;\n    in[v] = T++;\n    dfs(lc[v]);\n    dfs(rc[v]);\n    out[v] = T;\n}\n\n\nint main() {\n    scanf(\"%d %d %d\", &n, &m, &q);\n\n    for (int i = 1 ; i <= n ; ++ i) {\n        scanf(\"%d\", a + i);\n    }\n\n    edges.resize(m);\n\n    for (auto &[u, v] : edges) {\n        scanf(\"%d %d\", &u, &v);\n    }\n\n    queries.resize(q);\n\n    for (auto &[u, v] : queries) {\n        scanf(\"%d %d\", &u, &v);\n        if (u == 2) {\n            -- v;\n            del[v] = true;\n        }\n    }\n\n    cur = n + 1;\n\n    iota(par, par + n + n + 15, 0);\n\n    for (int i = 0 ; i < m ; ++ i) {\n        if (del[i]) continue;\n        auto &[u, v] = edges[i];\n        join(u, v);\n    }\n\n    reverse(queries.begin(), queries.end());\n\n    int now = 0;\n\n    for (auto &[u, v] : queries) {\n        if (u == 1) {\n            where[now] = find(v);\n        } else if (u == 2) {\n            auto &[x, y] = edges[v];\n            join(x, y);\n        } else throw;\n        now ++;\n    }\n\n    for (int i = 1 ; i <= n ; ++ i) {\n        int root = find(i);\n        if (vis[i]) continue;\n        T++;\n        dfs(root);\n    }\n\n    int s = T;\n\n    for (int i = 1 ; i <= n ; ++ i) {\n        update(1, 1, s, in[i], make_pair(a[i], i));\n    }\n\n\n    vector <int> ans;\n\n\n    for (int i = q - 1 ; i >= 0 ; -- i) {\n        if (queries[i].first == 2) continue;\n        int x = where[i];\n        auto y = get_max(1, 1, s, in[x], out[x]);\n                printf(\"%d\\n\", y.first);\n        if (y.first > 0) {\n            update(1, 1, s, in[y.second], make_pair(0, 0));\n        }\n    }\n\n\n\n\n}\n/*\n    Good Luck\n        -Lucina\n*/\n", "lang": "GNU C++17", "bug_code_uid": "eb7d1101e75aa74cb97f007b7e69973d", "src_uid": "ad014bde729222db14f38caa521e4167", "apr_id": "4ba28188a8af540838006c6112451038", "difficulty": 2600, "tags": ["dsu", "data structures", "implementation", "graphs", "trees"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9953775038520801, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include <bits/stdc++.h>\n#define ll long long\nusing namespace std;\nint gcd,x,y;\nint a,b,p;\nll rng;\nvoid ext_euc(int a,int b){\n\tif(b==0){\n\t\tx=1;\n\t\ty=0;\n\t\tgcd=1;\n\t}\n\telse{\n\t\text_euc(b,a%b);\n\t\tint temp=x;\n\t\tx=y;\n\t\ty=temp-(a/b)*y;\n\t}\n}\nint bigmod(int a,int b,int mod){\n\tint res=1;\n\ta=(a%mod);\n\twhile(b>0){\n\t\tif(b&1)\n\t\t   res=(res*1LL*a)%mod;\n\t\ta=(a*1LL*a)%mod;\n\t\tb/=2;\n\t}\n\treturn res;\n}\nint main() {\n\t// your code goes here\n\tcin>>a>>b>>p>>rng;\n\tll ans=0;\n\text_euc(a,p);\n\tint ainv=(x+p)%p;\n\tfor(int i=1;i<p;i++){\n\t\tll y=b*1LL*bigmod(ainv,i,p)%p;\n\t\tll n=((i-y+p)%p)*1LL*(p-1)+i;\n\t\tif(n<=rng)\n\t\t   ans+=(rng-n)/(p*1LL*(p-1))+1;\n\t}\n\tcout<<ans;\n\treturn 0;\n}", "lang": "GNU C++17", "bug_code_uid": "c5f4eb3e385c6223ef30191fa835b75e", "src_uid": "4b9f470e5889da29affae6376f6c9f6a", "apr_id": "0b7abb52221a9e942c6a4e0dab54d501", "difficulty": 2100, "tags": ["math", "chinese remainder theorem", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9646856158484065, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint main()\n{\n       int n,a;\n       cin>>n;\n       vector<int>v;\n       set<int>s;\n       for(int i=0;i<n;i++)\n       {\n              cin>>a;\n              s.insert(a);\n       }\n       for(auto i=s.begin();i!=s.end();i++)\n       {\n              v.push_back(*i);\n       }\n       sort(v.begin(),v.end());\n       for(int i=0;i<=s.size()-3;i++)\n       {\n        if(v[i+1]==v[i]+1 && v[i+2]==v[i]+2) \n        {\n               cout<<\"YES\";\n               return 0;\n        }\n       }\n       cout<<\"NO\";\n       return 0;\n}", "lang": "GNU C++14", "bug_code_uid": "06fde49e3609effec68c24085ea8586c", "src_uid": "d6c876a84c7b92141710be5d76536eab", "apr_id": "0dfece6a2cbc747c653c23b942f86ad8", "difficulty": 900, "tags": ["brute force", "sortings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.6564885496183206, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "#include <string>\n#include <vector>\n#include <algorithm>\n#include <iostream>\n#include <bits/stdc++.h>\n#define lli long long int\n#define li long int\n#define ld long double\nusing namespace std;\nconst lli mod = 1e9 + 7;\nint main() {\n    int a,b,c;\n    cin>>a>>b>>c;\n    while(1==1){\n        int cnt1=0,cnt2=0,cnt3=0,mn;\n        a/=1;cnt1++;\n        b/=2;cnt2++;\n        c/=4;cnt3++;\n        mn=min(cnt1,cnt2);\n        \n        \n        cout<<min(mn,cnt3)<<endl;\n    }\n}", "lang": "GNU C++14", "bug_code_uid": "4f166e6ffa8b9588b6d9005c848e18ec", "src_uid": "82a4a60eac90765fb62f2a77d2305c01", "apr_id": "efcb7ef7d08676a9c405974728e14caf", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.7757805108798487, "equal_cnt": 9, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 9, "bug_source_code": "#include <cstdio>\n#include <cstring>\n#include <iostream>\n#include <algorithm>\n#include <cmath>\n#include <map>\n#include <vector>\n#include <set>\n#define Inf 0x3f3f3f3f\nusing namespace std;\ntypedef long long ll;\nint main()\n{\n    double l,d,v,g,r;\n    double ans;\n    while(~scanf(\"%lf%lf%lf%lf%lf\",&l,&d,&v,&g,&r))\n    {\n        if(v*g>d)\n            ans=l/v;\n        else\n        {\n            ans=(d/v+(r-(d-v)/3))+(l-d)/v;\n        }\n        printf(\"%.8f\\n\",ans);\n    }\n    return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "187dccaa957ec42f87e1ae47471bfae3", "src_uid": "e4a4affb439365c843c9f9828d81b42c", "apr_id": "80583ecbbbafc2653ed32a7e5f822c19", "difficulty": 1500, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9712171052631579, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 4, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "#include <iostream>\n#include <vector>\n#include <map>\n#include <queue>\n#include <algorithm>\n#include <cmath>\nusing namespace std;\n\n#define pb push_back\n#define mp make_pair\n#define sz 10001\n#define pb push_back\n#define mp make_pair\n\nbool cmp(pair<int, int> a, pair<int, int> b){\n    if(a.second < b.second)\n        return true;\n    if(a.second > b.second)\n        return false;\n    return a.first > b.first;\n}\n\nint main(){\n    int t = 100;\n    while(t--){\n    ios_base::sync_with_stdio(false);\n    int n, i, j;\n    cin >> n;\n    int layer[sz] = {0};\n    vector <int> arr, dep;\n    vector <pair<int, int> >a;\n    for(i = 1; i <= n; i++){\n        for(j = 1; j <= n-i+1; j++){\n            int arr1 = j;\n            int dep1 = j+i;\n            arr.pb(arr1);\n            dep.pb(dep1);\n        }\n    }\n    int ans = 0, tmp = 0;\n    i = j = 0;\n    n = arr.size();\n    sort(arr.begin(), arr.end());\n    sort(dep.begin(), dep.end());\n    while(i < n && j < n){\n//        cout << arr[i] << ' ' << dep[j] << endl;\n        if(arr[i] < dep[j]){\n            i++;\n            tmp++;\n            ans = max(tmp, ans);\n        }\n        else{\n            tmp--;\n            j++;\n        }\n//        cout << \"tmp: \" << tmp << endl;\n    }\n    cout << ans << endl;\n    }\n}\n", "lang": "GNU C++14", "bug_code_uid": "8e4203c1b670f915da2926ff85a38067", "src_uid": "f8af5dfcf841a7f105ac4c144eb51319", "apr_id": "57ec5fedb0e7e5101acd79732405ef90", "difficulty": 1300, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.8225498225498226, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include <bits/stdc++.h>\n\n#define REP(i,n) for(int i=0;i<(n);i++)\n#define FOR(i,a,b) for(int i=(a);i<=(b);i++)\n#define FORD(i,a,b) for(int i=(a);i>=(b);i--)\n#define sortv(v) sort(v.begin(),v.end());\n#define sorta(a,n) sort(a,a+n);\n#define arrayin(a,n) for(int i=0;i<n;i++) cin>>a[i];\n#define arrayout(a,n) for(int i=0;i<n;i++) cout<<\" \";cout<<\"\\n\";\n#define INF INT_MAX //Infinity\n#define mp make_pair\n#define pb push_back\n#define mt make_tuple\n#define MOD 1000000007\n#define fi first\n#define se second\n#define ii pair<int,int>\n#define vi vector<int>\n#define vii vector<ii>\n#define vi64 vector<lli>\n#define viii vector<tuple<int,int,int>>\n#define mii map<int,int>\n#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);\n#define nl \"\\n\"\n\ntypedef long long int lli;\ntypedef unsigned long long int ulli;\ntypedef double ld;\n\nusing namespace std;\n\nulli poW(lli x,ulli y)\n{\n\t//this function only returns correct values upto the order of ~10^18\n\t//use pow of math to obtain greater answers\n\tlli temp;\n\tif(y==0)\n\t\treturn 1;\n\ttemp=poW(x,y/2);\n\tif(y%2==0)\n\t\treturn temp*temp;\n\telse return x*temp*temp;\n}\n\nint bSearch(int low,int high,int a[],int sh)\n{\n\t//function for searching till where is a sh<=\n\twhile(low<high)\n\t{\n\t\tint mid=low+(high-low+1)/2;\n\t\tif(a[mid]>sh)\n\t\t\thigh=mid-1;\n\t\tif(a[mid]<=sh)\n\t\t\tlow=mid;\n\t}\n\treturn low;\n}\n\nulli modular_pow(ulli b,ulli e,ulli m)\n{\n\tif(e==0)\n\t\treturn 1;\n\tif(e==1)\n\t\treturn b;\n\telse\n\t{\n\t\tulli res=1;\n\t\tb=b%m;\n\t\twhile(e>0)\n\t\t{\n\t\t\tif(e&1) //e%2\n\t\t\t\tres=(res*b)%m;\n\t\t\te=e>>1;\n\t\t\tb=(b*b)%m;\n\t\t}\n\t\treturn res%m;\n\t}\n}\nconst int sz=10001;\nvector<pair<int,int> > a[sz];\nint dis[sz];\nbool vis[sz]={0};\nvoid Dijkstra(int source, int n)\n{\n\t//you need an [int] array dis and a bool array vis\n\t//also a vii [a] with edge,weight pair\n\t//n is the number of nodes(vertices)\n    for(int i=0;i<sz;i++)\n        dis[i]=INF;\n    class prioritize\n    {\n    \tpublic: bool operator ()(pair<int, int>&p1 ,pair<int, int>&p2)\n    \t{\n    \t\treturn p1.second>p2.second;\n    \t}\n    };\n    priority_queue<pair<int,int> ,vector<pair<int,int> >, prioritize> pq;\n    pq.push(make_pair(source,dis[source]=0));\n    while(!pq.empty())\n    {\n        pair<int, int> curr=pq.top();\n        pq.pop();\n        int cv=curr.first,cw=curr.second;\n        if(vis[cv])\n            continue;\n        vis[cv]=true; \n        for(int i=0;i<a[cv].size();i++)\n            if(!vis[a[cv][i].first] && a[cv][i].second+cw<dis[a[cv][i].first])\n                pq.push(make_pair(a[cv][i].first,(dis[a[cv][i].first]=a[cv][i].second+cw)));\n    }\n}\n\nint check[10000];\nvoid shieve(vi &v)\n{\n    for(int i=3;i<=100;i+=2)\n    {\n        if(!check[i])\n        {\n            for(int j=i*i;j<=10000;j+=i)\n                check[j]=1;\n        }\n    }\n    v.push_back(2);\n    int j=1;\n    for(int i=3;i<=10000;i+=2)\n    {\n        if(!check[i]){\n            v.push_back(i);\n        }\n    }\n}\n\nint findLevel(ii s,ii d,ii moves)\n{\n\tqueue<ii> q;\n\tq.push(mp(s.fi,s.se));\n\twhile(!q.empty())\n\t{\n\t\tii node=q.front();\n\t\tq.pop();\n\t\tif(node.fi-moves.fi>=(-1)*1e5&&node.se-moves.se>=(-1)*1e5)\n\t\t{\n\t\t\tif(node.fi-moves.fi==d.fi&&node.se-moves.se==d.se)\n\t\t\t\treturn 1;\n\t\t\telse\n\t\t\t\tq.push(mp(node.fi-moves.fi,node.se-moves.se));\n\t\t}\n\t\tif(node.fi-moves.fi>=(-1)*1e5&&node.se+moves.se<=1e5)\n\t\t{\n\t\t\tif(node.fi-moves.fi==d.fi&&node.se+moves.se==d.se)\n\t\t\t\treturn 1;\n\t\t\telse\n\t\t\t\tq.push(mp(node.fi-moves.fi,node.se+moves.se));\n\t\t}\n\t\tif(node.fi+moves.fi<=1e5&&node.se-moves.se>=(-1)*1e5)\n\t\t{\n\t\t\tif(node.fi+moves.fi==d.fi&&node.se-moves.se==d.se)\n\t\t\t\treturn 1;\n\t\t\telse\n\t\t\t\tq.push(mp(node.fi+moves.fi,node.se-moves.se));\n\t\t}\n\t\tif(node.fi+moves.fi<=1e5&&node.se+moves.se<=1e5)\n\t\t{\n\t\t\tif(node.fi+moves.fi==d.fi&&node.se+moves.se==d.se)\n\t\t\t\treturn 1;\n\t\t\telse\n\t\t\t\tq.push(mp(node.fi+moves.fi,node.se+moves.se));\n\t\t}\n\t}\n\treturn 0;\n}\n\nint main()\n{\n\tfio;\n\t/*int t;\n\tcin>>t;\n\twhile(t--)\n\t{\n\t\tint n;\n\t\tcin>>n;\n\t}*/\n\tii s,d;\n\tcin>>s.fi>>s.se>>d.fi>>d.se;\n\tii moves;\n\tcin>>moves.fi>>moves.se;\n\tint ans=findLevel(s,d,moves);\n\tif(ans)\n\t\tcout<<\"YES\"<<endl;\n\telse cout<<\"NO\"<<endl;\n}", "lang": "GNU C++11", "bug_code_uid": "30a25fba4c4f9fd9cb2ecb19beefb9fc", "src_uid": "1c80040104e06c9f24abfcfe654a851f", "apr_id": "752b32ca960b35edfbcae1d6d3d6f7ed", "difficulty": 1200, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6497414198401504, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#include <iostream>\n#include <stdio.h>\n#include <cmath>\n#include <string.h>\n#include <iomanip>\n#include <algorithm>\n#include <stdlib.h>\n#include <queue>\n#include <stack>\n#include <map>\n#include <set>\nusing namespace std;\n\n#define ll long long\n#define mem(a,b) memset(a,b,sizeof(a))\n#define for1(i,n) for(int i=0;i<n;i++)\n#define for2(i,n) for(int i=1;i<=n;i++)\n#define for3(i,n,m) for(int i=n;i<m;i++)\n#define for4(i,n,m) for(int i=n;i<=m;i++)\nconst int maxm = 1e5 + 10;\nconst int maxn = 1e9;\nconst int INF = 2147483647;\nconst double pi = acos(-1.0);\nint x1,Y1,x2,y2,x,y;\nstruct node{\n   int x,y;\n};\nbool bfs(){\n   int num=0;\n   queue<node>tp;\n   node now,then;\n   now.x=x1,now.y=Y1;\n   tp.push(now);\n   while(!tp.empty()){\n      now=tp.front();\n      tp.pop();\n      if(num>100000000)\n         return false;\n      if(now.x==x2&&now.y==y2)\n         return true;\n      then.x=now.x+x,then.y=now.y+y;\n      tp.push(then),num++;\n      then.x=now.x+x,then.y=now.y-y;\n      tp.push(then),num++;\n      then.x=now.x-x,then.y=now.y+y;\n      tp.push(then),num++;\n      then.x=now.x-x,then.y=now.y-y;\n      tp.push(then),num++;\n   }\n}\nint main() {\n    while(scanf(\"%d%d%d%d%d%d\",&x1,&Y1,&x2,&y2,&x,&y)!=EOF){\n        printf(\"%s\\n\",bfs()?\"YES\":\"NO\");\n    }\n    return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "634da8119d48b1edff6314159b5c690c", "src_uid": "1c80040104e06c9f24abfcfe654a851f", "apr_id": "77b9d9db344fa7d3572c0a59bd009c22", "difficulty": 1200, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.91651865008881, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint dp[500000];\nint main()\n{\n    int n,a;\n    int c=1;\n    cin>>n;\n    dp[1]=2;\n    dp[0]=1;\n    i=1;\n    while(dp[i]+dp[i-1]<=n)\n    {\n        \n        i++;\n    dp[i]=dp[i-1]+dp[i-2];\n        \n    }\n\n    cout<<i;\n}", "lang": "GNU C++17", "bug_code_uid": "c71a94a546c1c52cc246251a8dc839a9", "src_uid": "3d3432b4f7c6a3b901161fa24b415b14", "apr_id": "d82c14868345b912123b6e58b5e967c1", "difficulty": 1600, "tags": ["math", "combinatorics", "greedy", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.06783493499152063, "equal_cnt": 18, "replace_cnt": 14, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 17, "bug_source_code": "#include <cstdio>\n#include <cstring>\n#include <algorithm>\n#define ll long long \n#define N 1000010\nusing namespace std;\nconst ll p=1000000007;\nll w[N],q[N],v[N];\nint m,k,n;\nll C(int x,int y){\nif(y>x)return 0;\nreturn w[x]*q[y]%p*q[x-y]%p;}\ninline ll A(int x,int y){\nif(y>x)return 0;\nreturn w[x]*q[x-y]%p;}\nll a(ll x,ll y){\nif(y<0)return 0;ll ans=1;\nfor(;y;x=x*x%p,y>>=1)if(y&1)ans=ans*x%p;\nreturn ans;}\nint main(){\nscanf(\"%d%d%d\",&m,&K,&n);\nint i,j,L;\nw[0]=w[1]=q[0]=q[1]=v[0]=v[1]=1;\nfor(i=2;i<=K;i++){w[i]=w[i-1]*i%p;\nv[i]=1ll*(p-p/i)*v[p%i]%p;\nq[i]=q[i-1]*v[i]%p;}\nll ans=0;\nfor(l=1;l<=k&&n+l<=m;l++){\nif(n-l>=2)(ans+=a(k,n-l-2)*(1ll*k*k%p*A(k,l)%p*A(k,l)%p-A(k,l+1)*A(k,l+1)%p+p)%p)%=p;\nelse if(n-L==1)(ans+=(1ll*k*A(k,l)%p*A(k,l)%p-A(k,l+1)*A(k-1,l)%p+p)%p)%=p;\nelse (ans+=(1ll*A(k,l-n)*A(k-(l-n),n)%p*A(k-(l-n),n)%p-A(k,l-n+2)*A(k-(l-n+2),n-1)%p*A(k-(l-n+2),n-1)%p)%p)%=p;\n}printf(\"%lld\\n\",(ans%p+p)%p);\nreturn 0;}", "lang": "GNU C++11", "bug_code_uid": "f16b00807b9ba32e6e09a2532883a4d5", "src_uid": "b715f0fdc83ec539eb3ae2b0371ee130", "apr_id": "60bfabb6f52efef11d95df7dc6841f9f", "difficulty": 3000, "tags": ["combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.1454907822620827, "equal_cnt": 18, "replace_cnt": 13, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 18, "bug_source_code": "#include <iostream>\n#include <vector>\n#include <algorithm>\n#include <set>\n\nusing namespace std;\n\n long long max_n = 1e18;\n\nint main() {\n     long long x, y, l, r;\n    cin >> x >> y >> l >> r;\n    vector< long long> Xa;\n    vector< long long> Yb;\n     long long t = 1;\n    while(t <= r){\n        Xa.emplace_back(t);\n        t *= x;\n    }\n    t = 1;\n    while(t <= r){\n        Yb.emplace_back(t);\n        t *= y;\n    }\n    typedef long long ull;\n    set<ull> unlucky;\n    for(auto i1 : Xa){\n        for(auto i2: Yb){\n            if(i1 + i2 >= l && i1 + i2 <= r){\n                unlucky.insert(i1 + i2);\n            }\n        }\n    }\n    unlucky.insert(r+1);\n    ull left = l-1;\n    ull ans = 0;\n    for(auto d: unlucky){\n        ans = max(ans, d-left-1);\n        left = d;\n    }\n    cout << ans << endl;\n    return 0;\n}\n\t\t\t\t\t      \t \t\t     \t \t    \t \t", "lang": "GNU C++14", "bug_code_uid": "52f967319105a32fc5e8677808f3ffaa", "src_uid": "68ca8a8730db27ac2230f9fe9b120f5f", "apr_id": "71c343c7045052f481eaa6829d978f17", "difficulty": 1800, "tags": ["math", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.09569377990430622, "equal_cnt": 17, "replace_cnt": 13, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 17, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\nint n, lg_min = INT_MAX;\nchar c[105];\nvector<string> s[2];\nint main()\n{\n    cin >> n;\n    cin >> (c+1);\n    bool ok = 1;\n    string st;\n    for(int i=1; i<=n; i++)\n        st+=c[i];\n    s[0].push_back(st);\n    for(int l=1; ok; l = (l+1)%2)\n    {\n        ok = 0;\n        for(auto it:s[(l+1)%2])\n        {\n            int m = it.size();\n            lg_min = min(lg_min, m);\n        }\n        for(auto it:s[(l+1)%2])\n        {\n            int m = it.size();\n            if(m!=lg_min)\n                continue;\n            string st2;\n            for(int i=0; i<m; i++)\n            {\n                if(i!=0 && i!=m-1)\n                {\n                    if(it[i] == it[i-1]+1 || it[i] == it[i+1]+1)\n                    {\n                        ok = 1;\n                        st = st2;\n                        for(int j=i+1; j<m; j++)\n                            st+=it[j];\n                        s[l].push_back(st);\n                    }\n                }\n                else if(i == 0 && it[i] == it[i+1]+1)\n                {\n                    ok = 1;\n                    st = st2;\n                    for(int j=i+1; j<m; j++)\n                        st+=it[j];\n                    s[l].push_back(st);\n                }\n                else if(i == m-1 && it[i] == it[i-1]+1)\n                {\n                    ok = 1;\n                    st = st2;\n                    for(int j=i+1; j<m; j++)\n                        st+=it[j];\n                    s[l].push_back(st);\n                }\n                st2+=it[i];\n            }\n        }\n        s[(l+1)%2].clear();\n    }\n    cout << n-lg_min;\n    /*\n    string saux;\n    saux+=c[1];\n    s[1].insert(saux);\n    for(int i=2; i<=n; i++)\n    {\n        lg_min = INT_MAX;\n        for(auto it:s[i-1])\n        {\n            int x = it.size();\n            lg_min = min(lg_min, x);\n        }\n        cout << lg_min << ' ';\n        for(auto it:s[i-1])\n        {\n            int x = it.size();\n            if(x == lg_min)\n            {\n                int m = it.size();\n                if(it[m-1] == c[i]-1)\n                    s[i].insert(it);\n                else if(it[m-1] == c[i]+1)\n                {\n                    saux.clear();\n                    for(int i=0; i<m-1; i++)\n                        saux+=it[i];\n                    saux+=c[i];\n                    s[i].insert(saux);\n                }\n                else\n                {\n                    saux = it;\n                    saux+=c[i];\n                    s[i].insert(saux);\n                }\n            }\n        }\n\n    }\n    int lg_min = INT_MAX;\n    for(auto it:s[n])\n    {\n        int x = it.size();\n        lg_min = min(lg_min, x);\n    }\n    cout << n-lg_min;\n    */\n    return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "35eac03de6c4c9257891ad1d5244b1b3", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "apr_id": "ed815d13046ad889bdd39e772ac1c12a", "difficulty": 1600, "tags": ["strings", "brute force", "greedy", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.5917188252286952, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "#include<bits/stdc++.h>\n#define long long long\nusing namespace std;\nconst int N=1e2;\nstring a,b,v,ans;\nint kmp[N+2],dp[N+2][N+2][N+2];\nvoid _kmp(string s)\n{\n  kmp[0]=0;\n  for(int i=1;s[i];i++)\n  {\n    int now=kmp[i-1];\n    while(true)\n    {\n      if(s[now]==s[i])\n      {\n        kmp[i]=now+1;\n        break;\n      }\n      if(!now)break;\n      now=kmp[now-1];\n    }\n  }\n}\nint dfs(int i,int j,int k)\n{\n  if(i>=a.size()||j>=b.size())return dp[i][j][k]=0;\n  if(dp[i][j][k]!=-1)return dp[i][j][k];\n  int here=0;\n  here=max(here,dfs(i+1,j,k));\n  here=max(here,dfs(i,j+1,k));\n  if(a[i]==b[j])\n  {\n    if(a[i]!=v[k])\n    {\n      if(k==0)here=max(here,1+dfs(i+1,j+1,k));\n      else\n      {\n        int now=kmp[k-1];\n        while(true)\n        {\n          if(v[now]==a[i])\n          {\n            now++;\n            break;\n          }\n          if(!now)break;\n          now=kmp[now-1];\n        }\n        here=max(here,1+dfs(i+1,j+1,now));\n      }\n    }\n    else if(k<v.size()-1)\n      here=max(here,1+dfs(i+1,j+1,k+1));\n  }\n  return dp[i][j][k]=here;\n}\nint main()\n{\n  ios_base::sync_with_stdio(0);cin.tie(0);\n  cin>>a>>b>>v;_kmp(v);\n  memset(dp,-1,sizeof(dp));\n  int ln=dfs(0,0,0);\n  if(ln==0)cout<<0<<endl,exit(0);\n\n//  for(int i=0;i<a.size();i++)\n//  {\n//    for(int j=0;j<b.size();j++)\n//    {\n//      for(int k=0;k<v.size();k++)\n//      {\n//        cout<<i<<\" \"<<j<<\" \"<<k<<\" \"<<dp[i][j][k]<<endl;\n//      }\n//    }\n//  }\n\n  int i=0,j=0;\n  while(true)\n  {\n    if(ln==0)break;\n    int f=0;\n    for(int k=0;k<v.size()-1;k++)\n    {\n      if(dp[i+1][j+1][k]==ln-1&&a[i]==b[j])\n      {\n        ans.push_back(a[i]);\n        f=1,i++,j++,ln--;\n        break;\n      }\n    }\n    if(f)continue;\n    for(int k=0;k<v.size()-1;k++)\n    {\n      if(dp[i+1][j][k]==ln)\n      {\n        f=1,i++;\n        break;\n      }\n    }\n    if(f)continue;\n    for(int k=0;k<v.size()-1;k++)\n    {\n      if(dp[i][j+1][k]==ln)\n      {\n        f=1,j++;\n        break;\n      }\n    }\n  }\n  cout<<ans<<endl;\n  return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "7832ea6fd3c40af0bfa8d2ca7b95098c", "src_uid": "391c2abbe862139733fcb997ba1629b8", "apr_id": "543a974882fcee799d46941d9049c98d", "difficulty": 2000, "tags": ["dp", "strings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9606277905560817, "equal_cnt": 18, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 10, "fix_ops_cnt": 17, "bug_source_code": "#include <iostream>\n#include <map>\n#include <ctime>\n#include <vector>\n#include <climits>\n#include <algorithm>\n#include <random>\n#include <cstring>\n#include <cstdio>\n#include <map>\n#include <set>\n#include <bitset> \n#include <queue>\n#define inf 0x3f3f3f3f\n#define IOS ios_base::sync_with_stdio(0); cin.tie(0);\n#define rep(i, a, n) for(register int i = a; i <= n; ++ i)\n#define per(i, a, n) for(register int i = n; i >= a; -- i)\n//#define ONLINE_JUDGE\nusing namespace std;\ntypedef long long ll;\nconst int mod=1e9+7;\ntemplate<typename T>void write(T x)\n{\n    if(x<0)\n    {\n        putchar('-');\n        x=-x;\n    }\n    if(x>9)\n    {\n        write(x/10);\n    }\n    putchar(x%10+'0');\n}\n \ntemplate<typename T> void read(T &x)\n{\n    x = 0;char ch = getchar();ll f = 1;\n    while(!isdigit(ch)){if(ch == '-')f*=-1;ch=getchar();}\n    while(isdigit(ch)){x = x*10+ch-48;ch=getchar();}x*=f;\n}\nint gcd(int a,int b){return b==0?a:gcd(b,a%b);}\nint lcm(int a,int b){return a/gcd(a,b)*b;};\nll ksm(ll a,ll n){//\u770b\u662f\u5426\u8981mod \n\tll ans=1;\n\twhile(n){\n\t\tif(n&1) ans=((ans%mod)*(a%mod))%mod;\n\t\ta=((a%mod)*(a%mod))%mod;\n\t\tn>>=1;\n\t}\n\treturn ans%mod;\n}\n//==============================================================\nconst int maxn=115;\nchar s1[maxn],s2[maxn],v[maxn];\nint len1,len2,lenv;\nint dp[maxn][maxn][maxn];\nint NEXT[maxn];\nstruct Path{\n    int a,b,c;\n    Path(int aa=0,int bb=0,int cc=0){a=aa,b=bb,c=cc;}\n}path[maxn][maxn][maxn];\nvoid get_next(){\n    int j=0;\n    rep(i,1,lenv-1){\n        while(j&&v[i]!=v[j+1]) j=NEXT[j];\n        if(v[j]==v[i]) j++;\n        NEXT[i]=j;\n    }\n}\nPath st;\ninline bool solve1(){\n    rep(i,1,len1){\n        rep(j,1,len2){\n            rep(k,0,lenv-1){\n                if(dp[i][j][k]<dp[i-1][j][k]){\n                    dp[i][j][k]=dp[i-1][j][k];\n                    path[i][j][k]=Path(i-1,j,k);\n                }\n                if(dp[i][j][k]<dp[i][j-1][k]){\n                    dp[i][j][k]=dp[i][j-1][k];\n                    path[i][j][k]=Path(i,j-1,k);\n                }\n                if(s1[i]==s2[j]){\n                    int w=k;\n                    while(w&&s1[i]!=v[w]) w=NEXT[w-1];\n                    if(s1[i]==v[w]) w++;\n                    else w=0;\n                    if(dp[i][j][w]<dp[i-1][j-1][k]+1){\n                        dp[i][j][w]=dp[i-1][j-1][k]+1;\n                        path[i][j][w]=Path(i-1,j-1,k);\n                        //cerr<<i<<\" \"<<j<<\" \"<<w<<\" \"<<dp[i][j][w]<<endl;\n                    }\n                }\n            }\n        }\n    }\n    int ma=0;\n    rep(i,0,lenv-1){\n        //cerr<<\"*\"<<dp[len1][len2][i]<<\" \";\n        if(ma<dp[len1][len2][i]){\n            ma=dp[len1][len2][i];\n            st=Path(len1,len2,i);\n        }\n    }\n    /*cerr<<endl;\n    rep(i,1,len1){\n        rep(j,1,len2){\n            cerr<<dp[i][j][1]<<\"|\"<<dp[i][j][2]<<\" \";\n        }\n        cerr<<endl;\n    }*/\n    return ma!=0;\n}\nvoid print_path(int a,int b,int c){\n    if(a+b+c==0) return;\n    Path nxt=path[a][b][c];\n    print_path(nxt.a,nxt.b,nxt.c);\n    if(dp[a][b][c]==dp[nxt.a][nxt.b][nxt.c]+1){\n        putchar(s1[a]);\n    }\n}\nint main()\n{\n\t#ifndef ONLINE_JUDGE\n\tfreopen(\"in.txt\",\"r\",stdin);\n\tfreopen(\"out.txt\",\"w\",stdout);\n\t#endif\n\t//===========================================================\n\tscanf(\"%s\",s1+1);len1=strlen(s1+1);\n    scanf(\"%s\",s2+1);len2=strlen(s2+1);\n    scanf(\"%s\",v);lenv=strlen(v);\n    /*cerr<<s1+1<<endl;\n    cerr<<s2+1<<endl;\n    cerr<<v+1<<endl;*/\n    get_next();\n    if(!solve1()){\n        puts(\"0\");\n    }\n    else{\n        print_path(st.a,st.b,st.c);\n    }\n\t//===========================================================\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "988ce24fb152b184984a28eccc38cb76", "src_uid": "391c2abbe862139733fcb997ba1629b8", "apr_id": "b454f5aadc08e0d1adbf69479669916e", "difficulty": 2000, "tags": ["dp", "strings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.10526315789473684, "equal_cnt": 12, "replace_cnt": 11, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 12, "bug_source_code": "// luogu-judger-enable-o2\n#include <bits/stdc++.h>\nusing namespace std;\nint main ()\n{\n\tstring s;\n\tcin>>s;\n\tfor(register int i=0;i<s.size()-4;i++){\n\t\tfor(register int i2=i+1;i2<s.size()-3;i2++){\n\t\t\tfor(register int i3=i2+1;i3<s.size()-2;i3++){\n\t\t\t\tfor(register int i4=i3+1;i4<s.size()-1;i4++){\n\t\t\t\t\tfor(register int i5=i4+1;i5<s.size();i5++){\n\t\t\t\t\t\tif(s[i]=='h'&&s[i2]=='e'&&s[i3]=='l'&&s[i4]=='l'&&s[i5]=='o') {\n\t\t\t\t\t\t\tcout<<\"YES\"<<endl;\n\t\t\t\t\t\t\treturn 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tcout<<\"NO\"<<endl;\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "1eef758405e07356830ac29bbc9acda7", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "apr_id": "62ce3cc37c8d0d4aac440445dc62ef61", "difficulty": 1000, "tags": ["strings", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9463299131807419, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include <iostream>\n#include <string>\n#include <algorithm>\n\nusing namespace std;\n\nstring clean(string hello)\n{\n    for(int i=0; i<hello.size(); i++)\n        if(hello[i]!='h'&&hello[i]!='e'&&hello[i]!='l'&&hello[i]!='o')\n        {\n            hello.erase(i,1);\n            i--;\n        }\n    return hello;\n}\n\n\nint main()\n{\n    string x;\n    cin>>x;\n    if(x.size()<=1||x.size()>100)\n    {\n        cout<<\"NO\"<<endl;\n        return 0;\n    }\n    else\n    {\n        x=clean(x);\n        string start =x.substr(x.find('h'),x.size());\n        for(int i=0; i<start.size(); i++)\n        {\n            if(start[i]=='h'&&i>0)\n            {\n                start.erase(i,1);\n                i--;\n            }\n            if(start[i]=='e'&&i>1)\n            {\n                start.erase(i,1);\n                i--;\n            }\n            if(start[i]=='l'&&(i>3||i<2))\n            {\n                start.erase(i,1);\n                i--;\n            }\n            if(start[i]=='o'&&i<start.size()&&i!=4)\n            {\n                start.erase(i,1);\n                i--;\n            }\n\n        }\n\n        if(start==\"hello\")\n            cout<<\"YES\"<<endl;\n        else\n            cout<<\"NO\"<<endl;\n\n    }\n\n\n}\n", "lang": "GNU C++", "bug_code_uid": "ea58b0ac39934c9be2dd9dd63c87b830", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "apr_id": "bbcb11174214cbea695b4eee268b7f53", "difficulty": 1000, "tags": ["strings", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.17546848381601363, "equal_cnt": 10, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 10, "bug_source_code": "#include <iostream>\n#include <vector>\nusing namespace std;\n\nint main() {\n    int x,y,a,b,k=0; cin>>x>>y>>a>>b;\n    vector<int>v;\n    for (int i=a; i<=b; i++){\n        v.push_back(i);\n    }\n    for (int i=0; i<v.size(); i++){\n        if (v[i]%x==0 && v[i]%y==0)\n        k++;\n    }\n    cout<<k<<endl;\n    return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "f8d8701941a40fc743f422beff3d2fb8", "src_uid": "c7aa8a95d5f8832015853cffa1374c48", "apr_id": "5c8fd31c53d0d1018105372c10124429", "difficulty": 1200, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9959839357429718, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include<bits/stdc++.h>\n\ntypedef long long ll;\ntypedef unsigned long long ull;\n\nusing namespace std;\n\nconst int MAXN=262144<<1;\nconst int P=998244353;\nconst int g[]={3,(P+1)/3};\n\nint rev[MAXN],n;\nll tp[MAXN],itp[MAXN],tp2[MAXN],itp2[MAXN];\nll _G_[2][MAXN],G[MAXN],G0[MAXN],G1[MAXN],G2[MAXN],X1[MAXN],X3[MAXN],X4[MAXN],F0[MAXN],F1[MAXN],F2[MAXN];\n\nconstexpr ll Add(ll a,ll b){a+=b;return a>=P?a-P:a;}\n\nconstexpr ll Sub(ll a,ll b){a-=b;return a<0?a+P:a;}\n\nvoid Inc(ll &a,ll b){a+=b;if(a>=P) a-=P;}\n\nvoid Dec(ll &a,ll b){a-=b;if(a<0) a+=P;}\n\nll ksm(ll a,ll b)\n{\n\tll ret=1;\n\tfor(;b;b>>=1,(a*=a)%=P) if(b&1) (ret*=a)%=P;\n\treturn ret;\n}\n\nint init(int n)\n{\n\tint tot=1,lg2=0;\n\twhile(tot<=n) tot<<=1,lg2++;\n\tfor(int i=0;i<tot;i++) rev[i]=(rev[i>>1]>>1)|((i&1)<<(lg2-1));\n\treturn tot;\n}\n\nvoid NTT(ll *a,int n,int f)\n{\n\tll *ed=a+n;\n\tfor(int i=0;i<n;i++)\n\t\tif(i>rev[i]) swap(a[i],a[rev[i]]);\n\tfor(int i=2;i<=n;i<<=1)\n\t\tfor(ll *x=a,*y=a+(i>>1);x!=ed;x+=i,y+=i)\n\t\t\tfor(int k=0;k<(i>>1);k++)\n\t\t\t{\n\t\t\t\tll u=x[k],t=y[k]*_G_[f][k*MAXN/i]%P;\n\t\t\t\tx[k]=Add(u,t);y[k]=Sub(u,t);\n\t\t\t}\n\tif(f) for(int i=0,inv=ksm(n,P-2);i<n;i++) a[i]=a[i]*inv%P;\n}\n\nvoid Inv(ll *a,ll *Res,int n)\n{\n    if(n==1) return Res[0]=ksm(a[0],P-2),void();\n    Inv(a,Res,(n+1)>>1);\n    int tot=init(n<<1),lst=(n+1)>>1;\n    static ll t1[MAXN],t2[MAXN];\n    memset(t1,0,sizeof(ll)*tot);memset(t2,0,sizeof(ll)*tot);\n    for(int i=0;i<n;i++) t1[i]=a[i];\n    for(int i=0;i<lst;i++) t2[i]=Res[i];\n    NTT(t1,tot,0);NTT(t2,tot,0);\n    for(int i=0;i<tot;i++) t1[i]=Sub(2*t2[i],t2[i]*t2[i]%P*t1[i]%P);\n    NTT(t1,tot,1);\n    for(int i=0;i<n;i++) Res[i]=t1[i];\n}\n\nint main()\n{\n\t_G_[0][0]=_G_[1][0]=1;\n\t_G_[0][1]=ksm(g[0],(P-1)/MAXN);_G_[1][1]=ksm(g[1],(P-1)/MAXN);\n\tfor(int i=2;i<MAXN;i++) _G_[0][i]=_G_[0][i-1]*_G_[0][1]%P,_G_[1][i]=_G_[1][i-1]*_G_[1][1]%P;\n\tscanf(\"%d\",&n);G[0]=1;\n\tint tot=init(4*n);//notice\n\tfor(int i=2;i<=n;i++) G[i]=Add(G[i-2],i>3?G[i-4]:0);\n\tfor(int i=0;i<=n;i++) G0[i]=G[i]*i%P*i%P,G1[i]=G[i]*(i+1)%P*(i+1)%P,G2[i]=G[i]*(i+2)%P*(i+2)%P;\n\tX1[1]=1;X3[3]=1;X4[4]=1;\n\tNTT(G0,tot,0);NTT(G1,tot,0);NTT(G2,tot,0);NTT(X1,tot,0);NTT(X3,tot,0);NTT(X4,tot,0);\n\tfor(int i=0;i<tot;i++) tp[i]=Sub(Add(X4[i]*G2[i]%P*G0[i]%P,1),Add(X1[i]*G0[i]%P,Add(X3[i]*G2[i]%P,X4[i]*G1[i]%P*G1[i]%P)));\n\tfor(int i=0;i<tot;i++) tp2[i]=Sub(1,X3[i]*G2[i]%P);\n\tNTT(tp2,tot,1);Inv(tp2,itp2,n);\n\tinit(4*n);NTT(itp2,tot,0);\n\tNTT(tp,tot,1);Inv(tp,itp,n);\n\tinit(4*n);NTT(itp,tot,0);\n\tfor(int i=0;i<tot;i++) F0[i]=Add(G0[i]*Sub(1,X3[i]*G2[i]%P)%P,X3[i]*G1[i]%P*G1[i]%P)*itp[i]%P;\n\tfor(int i=0;i<tot;i++) F1[i]=Add(G1[i]*Sub(1,X1[i]*G0[i]%P)%P,X1[i]*G1[i]%P*G0[i]%P)*itp[i]%P;\n\tfor(int i=0;i<tot;i++) F2[i]=Add(G2[i],X1[i]*F1[i]%P*G1[i]%P)*itp2[i]%P;\n\tNTT(F0,tot,1);NTT(F1,tot,1);NTT(F2,tot,1);\n\tll Ans=Add(G[n-1],G[n-3])*(n-1)%P*(n-1)%P*n%P;\n\tfor(int i=2;i<=n-2;i++)\n\t{\n\t\tInc(Ans,G[i-1]*(i-1)%P*(i-1)%P*F0[n-i-1]%P*i%P);\n\t\tInc(Ans,G[i-2]*(i-1)%P*(i-1)%P*F1[n-i-2]%P*i%P*2%P);\n\t\tif(i>=3&&i<=n-3) Inc(Ans,G[i-3]*(i-1)%P*(i-1)%P*F2[n-i-3]%P*i%P);\n\t}\n\tprintf(\"%lld\\n\",Ans);\n}\n", "lang": "GNU C++11", "bug_code_uid": "9ae365b093566126d67227718105a3b6", "src_uid": "24fd5cd218f65d4ffb7c5b97b725293e", "apr_id": "262d0f73f0c3646231ac5d85c2cfb828", "difficulty": 3400, "tags": ["divide and conquer", "dp", "combinatorics", "fft", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.3178012377138697, "equal_cnt": 22, "replace_cnt": 13, "delete_cnt": 1, "insert_cnt": 7, "fix_ops_cnt": 21, "bug_source_code": "#include<map>\n#include<set>\n#include<queue>\n#include<stack>\n#include<cmath>\n#include<ctime>\n#include<bitset>\n#include<cstdio>\n#include<cstdlib>\n#include<cstring>\n#include<complex>\n#include<iostream>\n#include<algorithm>\n#define N 50001\n#define LL long long\n#define add_edge(u,v) nxt[++cnt]=head[u],head[u]=cnt,to[cnt]=v\n#define open(x) freopen(#x\".in\",\"r\",stdin),freopen(#x\".out\",\"w\",stdout)\nchar ch;bool fs;void re(int& x)\n{\n\twhile(ch=getchar(),ch<33);\n\tif(ch=='-')fs=1,x=0;else fs=0,x=ch-48;\n\twhile(ch=getchar(),ch>33)x=x*10+ch-48;\n\tif(fs)x=-x;\n}\nusing namespace std;\nconst int mod=998244353;\nint n;\nLL ans,g[N],f0[N],f1[N],f2[N],sqr[N];\nint main()\n{\n\tre(n);\n\tg[0]=g[2]=1;\n\tfor(int i=4;i<=n;++i)g[i]=(g[i-2]+g[i-4])%mod;\n\tfor(int i=1;i<=n;++i)sqr[i]=1ll*i*i%mod;\n\tf0[0]=0;f1[0]=1;f2[0]=4;\n\tfor(int i=1;i<=n;++i)\n\t{\n\t\tf0[i]=g[i]*sqr[i]%mod;\n\t\tf1[i]=(g[i]*sqr[i+1]+f0[i-1])%mod;\n\t\tf2[i]=(g[i]*sqr[i+2]+f1[i-1]+(i>1)*g[i-1]*sqr[i])%mod;\n\t\tfor(int j=2;j<i;++j)\n\t\t{\n\t\t\tf0[i]+=g[j-1]*sqr[j-1]%mod*f0[i-j]%mod;\n\t\t\tf1[i]+=g[j-1]*sqr[j]%mod*f0[i-j]%mod;\n\t\t\tf2[i]+=g[j-1]*sqr[j]%mod*f1[i-j]%mod;\n\t\t\tf1[i]+=g[j-2]*sqr[j]%mod*f1[i-j-1]%mod;\n\t\t\tf0[i]+=g[j-2]*sqr[j-1]%mod*f1[i-j-1]%mod;\n\t\t\tf2[i]+=g[j-2]*sqr[j]%mod*f2[i-j-1]%mod;\n\t\t}\n\t\tf0[i]%=mod;f1[i]%=mod;f2[i]%=mod;\n\t}\n\tans=sqr[n-1]*(g[n-1]+g[n-3])%mod*n%mod;\n\tfor(int i=3;i<n;++i)\n\t{\n\t\tans+=sqr[i-2]*g[i-2]%mod*f0[n-i]%mod*(i-1)%mod;\n\t\tans+=sqr[i-2]*g[i-3]%mod*f1[n-i-1]%mod*2*(i-1)%mod;\n\t\tif(i>=4 && i+1<n)ans+=sqr[i-2]*g[i-4]%mod*f2[n-i-2]%mod*(i-1)%mod;\n\t}\n\tprintf(\"%lld\\n\",ans%mod);\n}\n", "lang": "GNU C++11", "bug_code_uid": "4f4ed570770c4b1ed203667d42751c7b", "src_uid": "24fd5cd218f65d4ffb7c5b97b725293e", "apr_id": "76dc0ade478a8bdd96f5fd84112c0bf5", "difficulty": 3400, "tags": ["divide and conquer", "dp", "combinatorics", "fft", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.22183406113537119, "equal_cnt": 11, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "#include<bits/stdc++.h>\n#define mo 998244353\n#define ll long long\n#define N 50005\nusing namespace std;\nint n;\nll g[N],f0[N];\nll f1[N],f2[N];\nll ans;\nint main(){\n\tscanf(\"%d\",&n);\n\tg[0]=g[2]=1;\n\tfor (int i=4;i<=n;i+=2)\n\t\tg[i]=(g[i-4]+g[i-2])%mo;\n\tf0[0]=0; f1[0]=1; f2[0]=4;\n\tfor (int i=1;i<=n;i++){\n\t\tf0[i]=g[i]*i*i%mo;\n\t\tfor (int j=2;j<=i-2;j+=2)\n\t\t\tf0[i]+=g[j]*j*j%mo*f0[i-j-1]%mo;\n\t\tfor (int j=1;j<=i-2;j+=2)\n\t\t\tf0[i]+=g[j-1]*j*j%mo*f1[i-j-2]%mo;\n\t\tf1[i]=g[i]*(i+1)*(i+1)%mo+f0[i-1];\n\t\tfor (int j=2;j<=i-2;j+=2)\n\t\t\tf1[i]+=g[j]*(j+1)*(j+1)%mo*f0[i-j-1]%mo;\n\t\tfor (int j=1;j<=i+2;j+=2)\n\t\t\tf1[i]+=g[j-1]*(j+1)*(j+1)%mo*f1[i-j-2]%mo;\n\t\tf0[i]%=mo; f1[i]%=mo;\n\t}\n\tfor (int i=1;i<=n;i++){\n\t\tf2[i]=g[i]*(i+2)*(i+2)%mo+f1[i-1];\n\t\tfor (int j=2;j<=i-1;j+=2)\n\t\t\tf2[i]+=g[j]*(j+1)*(j+1)%mo*f1[i-j-1]%mo;\n\t\tfor (int j=1;j<=i-1;j+=2)\n\t\t\tf2[i]+=g[j-1]*(j+1)*(j+1)%mo*f2[i-j-2]%mo;\n\t\tf2[i]%=mo; \n\t}\n\tans=(g[n-1]+g[n-3])*(n-1)*(n-1)%mo*n%mo;\n\tfor (int i=2;i<=n-2;i++){\n\t\tans+=g[i-1]*(i-1)*(i-1)%mo*f0[n-i-1]%mo*i%mo;\n\t\tans+=g[i-2]*(i-1)*(i-1)%mo*f1[n-i-2]%mo*2*i%mo;\n\t\tif (i>=3&&i<=n-3)\n\t\t\tans+=g[i-3]*(i-1)*(i-1)%mo*f2[n-i-3]%mo*i%mo;\n\t}\n\tprintf(\"%d\",ans%mo);\n}", "lang": "GNU C++11", "bug_code_uid": "985635be5a84ddbce2017263cae1026e", "src_uid": "24fd5cd218f65d4ffb7c5b97b725293e", "apr_id": "7338d5cb4c9cfc083b5fc3cc6ec255d2", "difficulty": 3400, "tags": ["divide and conquer", "dp", "combinatorics", "fft", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.959731543624161, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include <iostream>\n#include <algorithm>\n#include <vector>\n\nusing namespace std;\n\nint main(){\n\tint a;\n\tint b;\n\tint c;\n\tvector<int> vec;\n\tcin >> a >> b >> c;\n\tvec.push_back(a);\n\tvec.push_back(b);\n\tvec.push_back(c);\n\tsort(vec.begin(),vec.end());\n\treturn (vec[1] - vec[0]) + (vec[2] - vec[1]);\n}", "lang": "GNU C++11", "bug_code_uid": "79bf513f3c5e57a8b13633055b347e40", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "apr_id": "a5630ca3e82102fd42ca36ffa1031d77", "difficulty": 800, "tags": ["math", "sortings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.978240302743614, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include <iostream>\n#include <algorithm>\n#include <stdio.h>\n#include <string>\n\nusing namespace std;\n\nint k, c;\n\nint main() {\n\tstring s;\t\n\tcin >> s >> k;\n\t\n\tif ((k == 0) || (s.length() == 1)) {\n\t\tcout << s << endl;\n\t\treturn 0;\n\t}\n\t\n\tint size = s.length() - 1;\n\tfor (int i = 0; i < s.length(), k > 0; i++, c = i) {\n\t\tint stuff = min (i + k, size);\n\t\tfor (int j = i + 1; j <= stuff; j++)\n\t\t\tif (s[j] > s[c]) c = j;\n\t\tk -= c - i;\n\t\tfor (int j = c; j > i; j--)\n\t\t\tswap(s[j], s[j - 1]);\n    }\n\t\n\tcout << s << endl;\n\t\n\treturn 0;\n}\n", "lang": "GNU C++0x", "bug_code_uid": "a10a1a52ec6443cea1b273332a8f359f", "src_uid": "e56f6c343167745821f0b18dcf0d0cde", "apr_id": "248fcfc6427ac05d2d0d507a7d21ed4d", "difficulty": 1400, "tags": ["greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.8483720930232558, "equal_cnt": 12, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "#include <bits/stdc++.h>\n\nusing namespace std;\n\nint main(int argc, char const *argv[])\n{\n    int n;\n\n    cin >> n;\n\n    int k = n - 1;\n\n    bool flag = false;\n    for (int i = 0; i <= sqrt(k) + 2; i++)\n    {\n        if (k % i)\n        {\n            int temp = (k / i) - i - 1;\n            if (temp > 0 && temp % 2 == 0)\n            {\n                flag = true;\n                int y = temp / 2;\n                printf(\"%d %d\", i, y);\n            }\n        }\n    }\n\n    if (!flag)\n        printf(\"NO\");\n\n    return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "f3a5610abf43cbcb09fbd3c4ba7d53be", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "apr_id": "4489bfa8725d68e13079bfa3347ebb08", "difficulty": 1200, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9984894259818731, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "#include <bits/stdc++.h>\n#define ll long long\n\nusing namespace std;\n\nconst int INF = 1e9 + 7;\nconst int MAXN = 1e6 + 7;\nconst double EPS = 1e-8;\n\nstruct Tree {\n    int n;\n    vector <int> t;\n    Tree(int n) : n(n), t(2 * n, 0) {}\n    void change(int v, int x) {\n        v += n;\n        t[v] = x;\n        v /= 2;\n        while (v) {\n            t[v] = max(t[2 * v], t[2 * v + 1]);\n            v /= 2;\n        }\n    }\n    int get_max(int l, int r) {\n        int res = 0;\n        for (l += n, r += n; l <= r; l /= 2, r /= 2) {\n            if (l % 2 == 1) res = max(res, t[l++]);\n            if (r % 2 == 0) res = max(res, t[r--]);\n        }\n        return res;\n    }\n};\n\nint main() {\n    #ifdef MY\n        freopen(\"input.txt\", \"r\", stdin);\n    #else\n        ios_base::sync_with_stdio(false);\n        cin.tie(0);\n        cout.tie(0);\n    #endif // MY\n    int n, m;\n    cin >> n >> m;\n    vector <int> cnt(m, 0);\n    vector <pair <int, int> > a;\n    for (int i = 0; i < n; i++) {\n        int l, r;\n        cin >> l >> r;\n        l--, r--;\n        a.push_back({l, 1});\n        a.push_back({r + 1, 0});\n    }\n    sort(a.begin(), a.end());\n    int pr = 0;\n    int now = 0;\n    for (int i = 0; i < a.size(); i++) {\n        while (a[i].first > pr) {\n            cnt[pr] = now;\n            pr++;\n        }\n        if (a[i].second) {\n            now++;\n        } else {\n            now--;\n        }\n    }\n    while (m > pr) {\n        cnt[pr] = now;\n        pr++;\n    }\n    vector <int> down(n, 0), up(n, 0);\n    Tree t(n + 1);\n    for (int i = m - 1; i >= 0; i--) {\n        int val = t.get_max(0, cnt[i]) + 1;\n        down[i] = val;\n        t.change(cnt[i], val);\n    }\n    t = Tree(n + 1);\n    for (int i = 0; i < m; i++) {\n        int val = t.get_max(0, cnt[i]) + 1;\n        //cout << val << \" \";\n        up[i] = val;\n        t.change(cnt[i], val);\n    }\n    //cout << \"\\n\";\n    int res = 0;\n    for (int i = 0; i < n; i++) {\n        res = max(res, up[i] + down[i] - 1);\n    }\n    cout << res;\n}\n", "lang": "GNU C++14", "bug_code_uid": "e06ecc9d02ae333538c751f94d806899", "src_uid": "ce8350be138ce2061349d7f9224a5aaf", "apr_id": "4bfb0fe621f5dd713674dc4863802503", "difficulty": 1900, "tags": ["data structures", "dp", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.05661591250268068, "equal_cnt": 46, "replace_cnt": 39, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 46, "bug_source_code": "#include <iostream>\n#include <algorithm>\n#include <vector>\n#include <map>\n#include <set>\n#include <deque>\n#include <iomanip>\n#include <cmath>\n\n#define elif else if\n\nusing namespace std;\ntypedef long long ll;\ntypedef long double ld;\n\nconst ll inf = 1e18 + 3, mod = 1e9 + 7;\n\nistream& operator>>(istream& is, vector<ll> &a) {\n\tfor (int i = 0; i < a.size(); ++i) cin >> a[i];\n\treturn is;\n}\n\nostream& operator<<(ostream& os, vector<ll> &a) {\n\tfor (int i = 0; i < a.size(); ++i) cout << a[i] << ' ';\n\treturn os;\n}\n\nvoid sort(vector<ll> &a) {\n\tsort(a.begin(), a.end());\n}\n\nll step(ll a, ll n) {\n\tif (n == 1) return a % mod;\n\tif (n & 1) return (step(a, n - 1) * a) % mod;\n\tll k = step(a, n / 2);\n\treturn (k * k) % mod;\n}\n\nll gcd(ll a, ll b) {\n\treturn a > 0 ? gcd(b % a, a) : b;\n}\n\nll lcm(ll a, ll b) {\n\treturn a * b / gcd(a, b);\n}\n\nint main() {\n\tint n, m;\n\tcin >> n >> m;\n\tvector<ll> from(n), to(n);\n\tfor (int i = 0; i < n; ++i) cin >> from[i] >> to[i], --from[i], --to[i];\n\tsort(from);\n\tsort(to);\n\tvector<ll> a(m);\n\tint pf = 0, pt = 0, curr = 0;\n\tfor (int i = 0; i < m; ++i) {\n\t\twhile (pf < n && from[pf] == i) ++pf, ++curr;\n\t\ta[i] = curr;\n\t\twhile (pt < n && to[pt] == i) ++pt, --curr;\n\t}\n\tif (m == 1) {\n\t\tcout << 0;\n\t\treturn 0;\n\t}\n\tint check = a[0];\n\tbool cr = true;\n\tfor (int i = 0; i < m; ++i)\n\t\tcr = cr && a[i] == check;\n\tif (cr) {\n\t\tcout << m;\n\t\treturn 0;\n\t}\n\tll prev = 0, maxx;\n\tfor (int i = 1; i < m; ++i) {\n\t\tif (a[i] < a[i - 1]) prev += a[i - 1] - a[i];\n\t\tmaxx = max(maxx, a[i] + prev);\n\t}\n\tcr = true;\n\tfor (int i = 0; i < m - 1; ++i)\n\t\tcr = cr && maxx > a[i];\n\tif (cr) cout << m - 1;\n\telse cout << m - 1;\n\tsystem(\"pause\");\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "003a33c82644aeb8bdc702598907ba46", "src_uid": "ce8350be138ce2061349d7f9224a5aaf", "apr_id": "dee3a6e5e34ffd861be87d71ad68af7d", "difficulty": 1900, "tags": ["data structures", "dp", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9991853360488798, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include <bits/stdc++.h>\n\n#define F first\n#define S second\n#define pb push_back\n#define ll long long\n#define ld long double\n#define pii pair <int, int>\n#define endl '\\n'\n//#define int long long\n\nusing namespace std;\n\nconst int mod = 1e9 + 7;\nconst int N = 5e3 + 5;\n\nint cnt[N], reversecnt[N], pref[N], suff[N], ispref[N], issuff[N], anspref[N], anssuff[N];\nint dp[N];\nint cursz = 0;\n\nint bin(int x) {\n    int l = 0, r = cursz - 1;\n    int res = -1;\n    while (l <= r) {\n        int mid = (l + r) / 2;\n        if (dp[mid] > x) {\n            res = mid;\n            r = mid - 1;\n        } else l = mid + 1;\n    }\n    return res;\n}\n\nint main() {\n    ios_base::sync_with_stdio(0);\n    cin.tie(0);\n    cout.tie(0);\n#ifdef LOCAL\n    freopen(\"input.txt\", \"r\", stdin);\n    freopen(\"output.txt\", \"w\", stdout);\n#endif // LOCAL\n    int n, m;\n    cin >> n >> m;\n    for (int i = 0; i < n; i++) {\n        int l, r;\n        cin >> l >> r;\n        cnt[l]++;\n        cnt[r + 1]--;\n        if (l > 1) reversecnt[l - 1]--;\n        reversecnt[r]++;\n    }\n    int cur = 0;\n    for (int i = 1; i <= m; i++) cur += cnt[i], pref[i - 1] = cur;\n    cur = 0;\n    for (int i = m; i >= 1; i--) cur += reversecnt[i], suff[i - 1] += cur;\n    reverse(suff, suff + m);\n    for (int i = 0; i < m; i++) dp[i] = 1e9;\n    dp[0] = pref[0], anspref[0] = 1, ispref[0] = 1;\n    cursz = 1;\n    for (int i = 1; i < m; i++) {\n        if (pref[i] >= dp[cursz - 1]) {\n            dp[cursz] = pref[i];\n            anspref[i] = ++cursz;\n            ispref[i] = 1;\n            continue;\n        }\n        {\n            int pos = bin(pref[i]);\n            dp[pos] = pref[i];\n            anspref[i] = cursz;\n        }\n    }\n    for (int i = 0; i < m; i++) dp[i] = 1e9;\n    dp[0] = suff[0], anssuff[0] = 1, issuff[0] = 1;\n    cursz = 1;\n    for (int i = 1; i < m; i++) {\n        if (suff[i] >= dp[cursz - 1]) {\n            dp[cursz] = suff[i];\n            anssuff[i] = ++cursz;\n            issuff[i] = 1;\n            continue;\n        }\n        {\n            int pos = bin(suff[i]);\n            dp[pos] = suff[i];\n            anssuff[i] = cursz;\n        }\n    }\n    int res = 0;\n    for (int i = 0; i < m; i++) {\n        int cur = anspref[i] + anssuff[m - i - 1];\n      //  cout << anspref[i] << \" \" << anssuff[m - i - 1] << \" \" << ispref[i]  << \" \" << issuff[m - i - 1] << endl;\n        if (ispref[i] && issuff[m - i - 1]) cur--;\n        res = max(res, cur);\n    }\n    cout << res << endl;\n    return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "1ab461b97acd4e80dfb4b74a7d885779", "src_uid": "ce8350be138ce2061349d7f9224a5aaf", "apr_id": "b314d2fb28f1cd44f8d30b8294e0655d", "difficulty": 1900, "tags": ["data structures", "dp", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.5659754948162111, "equal_cnt": 16, "replace_cnt": 7, "delete_cnt": 3, "insert_cnt": 6, "fix_ops_cnt": 16, "bug_source_code": "#include <bits/stdc++.h>\n\n#define rep(i,n) for(i=1;i<=n;i++)\n#define Rep(i,n) for(i=0;i<n;i++)\n#define For(i,a,b) for(i=a;i<=b;i++)\n\n#define pb(x) push_back(x)\n#define sz(x) x.size()\n\n#define mem(ara,val) memset(ara,val,sizeof(ara))\n#define eps 1e-9\n\n#define si(x) scanf(\"%d\",&x)\n#define sii(x,y) scanf(\"%d %d\",&x,&y)\n#define siii(x,y,z) scanf(\"%d %d %d\",&x,&y,&z)\n#define sl(x) scanf(\"%lld\",&x)\n#define sll(x,y) scanf(\"%lld %lld\",&x,&y)\n#define slll(x,y,z) scanf(\"%lld %lld %lld\",&x,&y,&z)\n#define ss(ch) scanf(\"%s\",ch)\n#define pi(x) printf(\"%d\",x)\n#define pii(x,y) printf(\"%d %d\",x,y)\n#define piii(x,y,z) printf(\"%d %d %d\",x,y,z)\n#define pl(x) printf(\"%lld\",x)\n#define pll(x,y) printf(\"%lld %lld\",x,y)\n#define plll(x,y,z) printf(\"%lld %lld %lld\",x,y,z)\n#define ps(ch) printf(\"%s\",ch)\n#define Afridi 0\n#define NL printf(\"\\n\")\n#define SP printf(\" \")\n#define loj(x) printf(\"Case %d:\",x)\n#define Loj(x) printf(\"Case %lld:\",x)\n#define debug(str,x) cout << str << \" \" << x << endl;\n#define Max 1000000\n#define INF INT_MAX\n\ntypedef long long LL;\ntypedef unsigned long long ULL;\n\nusing namespace std;\n\nint main()\n{\n    LL n,k,i;\n    vector <LL> v;\n    sll(n,k);\n    if(k == 1)\n    {\n        for(i=1;i<=n;i++)\n        {\n            if(i != 1)SP;\n            printf(\"%lld\",i);\n        }\n        NL;\n    }\n    else\n    {\n        LL cur = n;\n        LL baki = k-1;\n        LL tot = 0;\n        while(1)\n        {\n            if(baki == 0)\n            {\n                for(i=tot+1;i<=n;i++)v.pb(1);\n                break;\n            }\n\n            LL run = cur-1;\n            if(baki < run)\n            {\n                for(i=1;i<=run;i++)\n                {\n                    if(i + baki == cur)v.pb(2);\n                    else v.pb(1);\n                }\n                tot += cur;\n                baki = 0;\n            }\n            else\n            {\n                v.pb(2);\n                tot += 2;\n                baki -= run;\n                cur -= 2;\n            }\n        }\n        LL len = sz(v);\n        LL c = 0,flag = 1;\n        /*Rep(i,len)\n        {\n            printf(\"%lld \",v[i]);\n        }\n        NL;*/\n        Rep(i,len)\n        {\n            LL my = v[i];\n            LL mn = c+1;\n            LL mx = mn + my - 1;\n            for(LL j=mx;j>=mn;j--)\n            {\n                if(flag != 1)SP;\n                printf(\"%lld\",j);\n                flag = 0;\n            }\n            c = mx;\n        }\n    }\n    return Afridi;\n}\n", "lang": "GNU C++", "bug_code_uid": "0f841613e74a7c64a09433a1a6dc23b1", "src_uid": "e03c6d3bb8cf9119530668765691a346", "apr_id": "f6841e8d3eb2db238d7fc953b62e5c3d", "difficulty": 1900, "tags": ["combinatorics", "greedy", "math", "implementation", "constructive algorithms", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9804039794995478, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "#include<bits/stdc++.h> \n#define rg register \n#define i60 long long  \n#define int long long \n#define fp( i , x , y ) for( rg int i=(x); i<=(y); ++i ) \n#define fq( i , x , y ) for( rg int i=(y); i>=(x); --i )  \nusing namespace std ; \nconst int N = 100 , K = 1e4+10 , hgs = 1e9+7 ;  \nint qpow( int A , int B ) { \n  int C=1 ; \n  for( ; B ; B>>=1 , A=1ll*A*A%hgs ) \n    if( B&1 ) C = 1ll*A*C%hgs ; \n  return C ;  \n}  \nstruct node { int val , tot ; } ; vector <node> a ; \nint f[K][N] , ans = 1 , fac[N] , inv[N] , k ;     \nvoid upd( int &x , int y ) { \n  x = (x+y) % hgs ; \n}\nvoid prep( ) {  \n  inv[0] = 1 ; \n  fq( i , 1 , 100 ) inv[i] = qpow( i , hgs-2 ) ; \n} \nvoid solve( int v , int cnt ) { \n if( n == 1 ) cout << \"Now : \" << v << endl ; \n  fp( j , 0 , cnt-1 ) f[0][j] = 0 ; \n  f[0][cnt] = 1 ; \n  fp( i , 1 , k ) {  \n    fp( j , 0 , cnt ) { \n      int t = 0 ; \n      fp( j2 , j , cnt ) \n        upd( t , 1ll * f[i-1][j2] * inv[j2+1] % hgs ) , \n    //  cout << i << \" \" << j << \" \" << t << \" \" << inv[j2+1] << endl ;\n       f[i][j] = t ;  \n\t}  \n  } \n  int tans = 0 ;  \n  fp( j , 0 , cnt ) { \n // cout << cnt << \"  to : \" << j << \" \" << f[k][j] << endl; \n    upd( tans , 1ll * qpow( v%hgs , j ) * f[k][j] % hgs ) ; \n  }  \n  ans = 1ll * ans * tans % hgs ; \n} \n signed main( ) { \n  i60 n ; \n  cin >> n >> k ; \n  prep( ) ; \n  for( int i=2 ; 1ll*i*i <= n ; ++i ) { \n    if( n%i ) continue ; \n    int tot = 0 ; \n\twhile( n%i == 0 ) n /= i , tot ++ ;  \n\ta.push_back( (node) { i , tot } ) ; \n  } \n  if( n > 1 ) \n    a.push_back( (node){ n%hgs , 1 } ) ; \n  int l = a.size()-1 ;   \n  fp( i , 0 , l ) \n    solve( a[i].val , a[i].tot ) ;  \n  cout << ans << '\\n' ; \n  return 0 ;  \n} ", "lang": "GNU C++11", "bug_code_uid": "0bee7f32709d6851585518ca209183e1", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "apr_id": "f70e21b6f22f84fb112265f41894e498", "difficulty": 2200, "tags": ["dp", "math", "probabilities", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9825496849248667, "equal_cnt": 8, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "#include <iostream>\n#include <cstdio>\n#include <cstdlib>\n#include <algorithm>\n#include <cstring>\n#include <map>\n\nusing namespace std;\nlong long n;\nconst long long MOD=1e9+7;\nlong long a[1100];\nint f[1100];\ninline long long extend_gcd(long long a,long long b,long long &x,long long &y)\n{\n    if(a==0&&b==0)\n        return -1ll;\n    if(b==0)\n    {\n        x=1ll;\n        y=0ll;\n        return a;\n    }\n    long long d=extend_gcd(b,a%b,y,x);\n    y-=a/b*x;\n    return d;\n}\ninline long long ny(long long a,long long n)\n{\n    long long x,y,d=extend_gcd(a,n,x,y);\n    if(d==1)\n        {\n                    if(x%n<=0)return x%n+n;\n                    else return x%n;\n                 }\n    else\n        return -1ll;\n}\nlong long prime[1000010];\nint pnum;\nbool vis[50001000];\nvoid getprime()\n{\n\tpnum=0;\n\tlong long gg=n;\n\tfor(long long i=2;i<=10000000;i++)\n\t{\n\t\tif(!vis[i])\n\t\t{\n\t\t\tprime[++pnum]=i;\n\t\t\twhile(gg%i==0) gg/=i;\n\t\t}\n\t\tfor(int j=1;j<=pnum&&i*prime[j]<=10000000;j++)\n\t\t{\n\t\t\tvis[i*prime[j]]=1;\n\t\t\tif(i%prime[j]==0) break;\n\t\t}\n\t}\n\tif(gg>10000000)\n\t{\n\t\tprime[++pnum]=gg;\n\t}\n}\nlong long dp[10100][20][100];\nlong long pow(long long x,long long y)\n{\n\tlong long re=1LL;\n\twhile(y--)\n\t{\n\t\tre=re*x%MOD;\n\t}\n\treturn re;\n}\nlong long ans=0LL;\nint num=0;\nint K;\nvoid getans(int x,long long now,int value)\n{\n\tif(x==num)\n\t{\n\t\tans=(ans+value*now%MOD)%MOD;\n\t\treturn ;\n\t}\n\tfor(int i=0;i<=f[x];i++)\n\t{\n\t\tgetans(x+1,now*pow(a[x],i)%MOD,value*dp[K][x][i]%MOD);\n\t}\n}\nint main()\n{\n//\tfreopen(\"a.in\", \"r\", stdin);\n//\tfreopen(\"a.out\", \"w\", stdout);\n\t\n\tscanf(\"%I64d\",&n);\n\tscanf(\"%d\",&K);\n\tgetprime();\n\tfor(int i=1;i<=pnum;i++)\n\t{\n\t\tif(n%prime[i]==0)\n\t\t{\n\t\t\ta[num]=prime[i];\n\t\t\tlong long gg=n;\n\t\t\tf[num]=0;\n\t\t\twhile(gg%prime[i]==0)\n\t\t\tf[num]++,gg/=prime[i];\n\t\t\tnum++;\n\t\t}\n\t}\n\tfor(int i=0;i<num;i++)\n\t{\n\t\tdp[0][i][f[i]]=1;\n\t\tfor(int j=0;j<K;j++)\n\t\t{\n\t\t\tfor(int k=f[i];k>=0;k--)\n\t\t\t{\n\t\t\t\tfor(int l=k;l>=0;l--)\n\t\t\t\t{\n\t\t\t\t\tdp[j+1][i][l]=(dp[j+1][i][l]+dp[j][i][k]*ny(k+1,MOD)%MOD)%MOD;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tgetans(0,1,1);\n\tprintf(\"%I64d\\n\",ans);\n\t\n\tfclose(stdin);\n\tfclose(stdout);\n\treturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "0b70ae9d1f6bafacfccd208d85bcf646", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "apr_id": "979a4a5019ad3862ea7d70d9ca4974da", "difficulty": 2200, "tags": ["dp", "math", "probabilities", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9004566210045662, "equal_cnt": 7, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "//Undoubtedly Lucky Numbers\n#include <cstdio>\n#include <iostream>\n#include <set>\nusing namespace std;\nint n;\nset<int> nums;\n\ninline void dfs_buton(int num,int a,int b)\n{\n\tif(num<=n)nums.insert(num);\n\telse return;\n\tdfs_buton(num*10+a,a,b);\n\tdfs_buton(num*10+b,a,b);\n}\ninline void dfs_shonton(int num,int a)\n{\n\tif(num<=n)nums.insert(num);\n\telse return;\n\tdfs_shonton(num*10+a,a);\n\tfor(int i=0;i<10;i++)\n\t\tdfs_buton(num*10+i,a,i);\n}\n\nint main()\n{\n\tscanf(\"%d\",&n);\n\tfor(int i=1;i<10;i++)dfs_shonton(i,i);\n\tprintf(\"%d\",nums.size());\n\treturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "ff6397942e1129ecf60851b6288e795b", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "apr_id": "ed16df4d38d227a0b0fc360b2fcae69f", "difficulty": 1600, "tags": ["dfs and similar", "brute force", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.05341712490180676, "equal_cnt": 23, "replace_cnt": 18, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 23, "bug_source_code": "\n#include <bits/stdc++.h>\nusing namespace std;\ntypedef long long ll;\nconst int N=1000000;\n \nll n;\nint num,m,cnt,tot,tim;\nint ep[100];\nint pri[N>>1],np[N+10],f[2][10000];\n \nll v[10000],pr[100];\nstruct node\n{\n    int bel;\n    ll val;\n}p[10000];\nmap<ll,int> ref,vis;\nvoid dfs(int x,ll now)\n{\n    if(x==m+1)\n    {\n        v[++tot]=now,ref[now]=tot;\n        return ;\n    }\n    for(int i=0;i<=ep[x];i++)    dfs(x+1,now),now*=pr[x];\n}\nbool cmp(const node &a,const node &b)\n{\n    return (a.bel==b.bel)?(a.val<b.val):(a.bel<b.bel);\n}\nint main()\n{\n    scanf(\"%lld\",&n);\n    int i,j,d=0;\n    ll tn=sqrt(n);\n    for(i=2;i<=tn;i++)\n    {\n        if(!np[i])  pri[++num]=i;\n        for(j=1;j<=num&&i*pri[j]<=tn;j++)\n        {\n            np[i*pri[j]]=1;\n            if(i%pri[j]==0) break;\n        }\n    }\n    ll t=n;\n    for(i=1;i<=num&&pri[i]*pri[i]<=t;i++) if(t%pri[i]==0)\n    {\n        pr[++m]=pri[i];\n        while(t%pri[i]==0)  t/=pri[i],ep[m]++;\n    }\n    if(t!=1)    pr[++m]=t,ep[m]=1;\n    dfs(1,1);\n    for(i=2;i<=tot;i++)  if(v[i]!=2)\n    {\n        t=v[i]-1;\n        int flag=1;\n        for(j=1;j<=num&&pri[j]*pri[j]<=t;j++) if(t%pri[j]==0)\n        {\n            t/=pri[j];\n            while(t%pri[j]==0)  t/=pri[j];\n            if(t!=1)    flag=0;\n            else    t=pri[j];\n            break;\n        }\n        if(flag)\n        {\n            p[++cnt].val=v[i];\n            if(!vis[t]) vis[t]=++tim;\n            p[cnt].bel=vis[t];\n        }\n    }\n    sort(p+1,p+cnt+1,cmp);\n    f[0][1]=1;\n    for(j=1;j<=cnt;j++)\n    {\n        if(p[j].bel!=p[j-1].bel)    d^=1,memcpy(f[d],f[d^1],sizeof(f[0][0])*(tot+1));\n        for(i=1;i<=tot;i++)  if(v[i]%p[j].val==0)\n            f[d][i]+=f[d^1][ref[v[i]/p[j].val]];\n    }\n    printf(\"%d\",f[d][tot]);\n    return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "463db14bbafeb6d803defc52aa73bf0b", "src_uid": "1f68bd6f8b40e45a5bd360b03a264ef4", "apr_id": "d5d0619753b441a905ecd1a9fe042f05", "difficulty": 2600, "tags": ["dp", "hashing", "dfs and similar", "number theory", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9938180747718576, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "#include <bits/stdc++.h>\n#define FOR(i, n) for (int i = 0; i < (n); ++i)\n#define REP(i, s, n) for (int i = (s); i < (n); ++i)\nusing namespace std;\n\nint N, M, K, prefix[102], automaton[102][26], dp[102][102][102], p[102][102][102];\nchar s1[102], s2[102], virus[102], ans[102];\n\nint main() {\n  scanf(\"%s%s%s\", s1, s2, virus);\n  N = strlen(s1);\n  M = strlen(s2);\n  K = strlen(virus);\n  \n  {\n    int k = 0;\n    FOR (i, K) {\n      while (k > 0 && virus[k + 1] != virus[i]) k = prefix[k];\n      if (virus[k + 1] == virus[i]) ++k;\n      prefix[i + 1] = k;\n    }\n\n    FOR (i, K) FOR (c, 26) {\n      int x = i;\n      while (x > 0 && virus[x] != c + 'A') x = prefix[x];\n      if (virus[x] == c + 'A') ++x;\n      automaton[i][c] = x;\n    }\n  }\n\n  memset(dp, -1, sizeof dp);\n  dp[0][0][0] = 0;\n  FOR (i, N + 1) FOR (j, M + 1) FOR (k, K) {\n    if (dp[i][j][k] == -1) continue;\n    if (dp[i + 1][j][k] < dp[i][j][k]) {\n      dp[i + 1][j][k] = dp[i][j][k];\n      p[i + 1][j][k] = 1;\n    }\n    if (dp[i][j + 1][k] < dp[i][j][k]) {\n      dp[i][j + 1][k] = dp[i][j][k];\n      p[i][j + 1][k] = 2;\n    }\n    int nk = automaton[k][s1[i] - 'A'];\n    if (s1[i] == s2[j] && nk != K) {\n      if (dp[i + 1][j + 1][nk] < dp[i][j][k] + 1) {\n        dp[i + 1][j + 1][nk] = dp[i][j][k] + 1;\n        p[i + 1][j + 1][nk] = 3 + k;\n      }\n    }\n  }\n\n  int ck = max_element(dp[N][M], dp[N][M] + K) - dp[N][M];\n  if (dp[N][M][ck]) {\n    for (int ci = N, cj = M, k = dp[ci][cj][ck]; k; ) {\n      if (p[ci][cj][ck] == 1) --ci;\n      else if (p[ci][cj][ck] == 2) --cj;\n      else {\n        ck = p[ci][cj][ck] - 3;\n        --ci; --cj;\n        ans[--k] = s1[ci];\n      }\n    }\n    printf(\"%s\\n\", ans);\n  } else printf(\"0\\n\");\n\n  return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "c264df6804e4a51ebba87c41101fee80", "src_uid": "391c2abbe862139733fcb997ba1629b8", "apr_id": "fca389f861eb3e46abec3dca7f2ed08c", "difficulty": 2000, "tags": ["dp", "strings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.9781783681214421, "equal_cnt": 12, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 11, "bug_source_code": "#include<cstdio>\n#include<cstdlib>\n#include<iostream>\n#include<vector>\n#include<queue>\n#include<bitset>\n#include<string>\n#include<stack>\n#include<set>\n#include<map>\n#include<cstring>\n#include<complex>\n#include<cmath>\n#include<iomanip>\n#include<numeric>\n#include<algorithm>\n#include<list>\n#include<functional>\n#include<cassert>\n#define mp make_pair\n#define pb push_back\n#define X first\n#define Y second\n#define INF 987654321\n#define PI 3.14159265358979323846264\n#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))\n#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))\n#define MEM0(a) memset(a,0,sizeof(a));\n#define MEM_1(a) memset(a,-1,sizeof(a));\n#define ALL(a) a.begin(),a.end()\nusing namespace std;\ntypedef long long ll;\ntypedef unsigned int uint;\ntypedef unsigned long long ull;\ntypedef pair<int, int> Pi;\ntypedef pair<ll, ll> Pll;\ntypedef pair<double, double> Pd;\ntypedef vector<int> Vi;\ntypedef vector<ll> Vll;\ntypedef vector<double> Vd;\ntypedef vector<Pi> VPi;\ntypedef vector<Pll> VPll;\ntypedef vector<Pd> VPd;\ntypedef tuple<int, int, int> iii;\ntypedef tuple<ll, ll, ll> LLL;\ntypedef vector<iii> Viii;\ntypedef vector<LLL> VLLL;\ntypedef complex<double> base;\nll MOD = 1000000007;\nll POW(ll a, ll b, ll MMM = MOD) { ll ret = 1; for (; b; b >>= 1, a = (a*a) % MMM)if (b & 1)ret = (ret*a) % MMM; return ret; }\nll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }\nll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); }\nint dx[] = { 0,1,0,-1 }, dy[] = { 1,0,-1,0 };\nint ddx[] = { 0,0,1,1,1,-1,-1,-1 }, ddy[] = { 1,-1,1,0,-1,1,0,-1 };\n\nint n, m, l;\nchar a[101], b[101], c[101];\nint pi[100];\nint d[100][100][100];\nint go(int N, int M, int L)\n{\n\tif (L == l)return -INF;\n\tif (N == n || M == m)return 0;\n\tint &ret = d[N][M][L];\n\tif (ret != -1)return ret;\n\tret = 0;\n\tret = max(ret, go(N + 1, M, L));\n\tret = max(ret, go(N, M + 1, L));\n\tif (a[N] == b[M])\n\t{\n\t\tif (a[N] == c[L])ret = max(ret, 1 + go(N + 1, M + 1, L + 1));\n\t\telse\n\t\t{\n\t\t\twhile (L != 0 && a[N] != c[pi[L - 1]])L = pi[L];\n\t\t\tif (a[N] == c[L])ret = max(ret, 1 + go(N + 1, M + 1, L + 1));\n\t\t\telse ret = max(ret, 1 + go(N + 1, M + 1, L));\n\t\t}\n\t}\n\treturn ret;\n}\nvoid track(int N, int M, int L)\n{\n\tif (N == n || M == m)return;\n\tint t1 = go(N + 1, M, L);\n\tint t2 = go(N, M + 1, L);\n\tint t3 = -INF, t4 = -INF, t5 = -INF;\n\tif (a[N] == b[M])\n\t{\n\t\tif (a[N] == c[L])t3 = 1 + go(N + 1, M + 1, L + 1);\n\t\telse\n\t\t{\n\t\t\twhile (L != 0 && a[N] != c[pi[L - 1]])L = pi[L];\n\t\t\tif (a[N] == c[L])t4 = go(N + 1, M + 1, L + 1);\n\t\t\telse t5 = 1 + go(N + 1, M + 1, L);\n\t\t}\n\t}\n\tint MAX = max({ t1,t2,t3,t4,t5 });\n\tif (t1 == MAX)track(N + 1, M, L);\n\telse if (t2 == MAX)track(N, M + 1, L);\n\telse if (t3 == MAX)\n\t{\n\t\tprintf(\"%c\", a[N]);\n\t\ttrack(N + 1, M + 1, L + 1);\n\t}\n\telse if (t4 == MAX)\n\t{\n\t\tprintf(\"%c\", a[N]);\n\t\ttrack(N + 1, M + 1, 1);\n\t}\n\telse\n\t{\n\t\tprintf(\"%c\", a[N]);\n\t\ttrack(N + 1, M + 1, 0);\n\t}\n}\nint main() {\n\tMEM_1(d);\n\tscanf(\"%s%s%s\", a, b, c);\n\tn = strlen(a), m = strlen(b), l = strlen(c);\n\tfor (int i = 1, j = 0; i < l; i++)\n\t{\n\t\twhile (j > 0 && c[i] != c[j]) j = pi[j - 1];\n\t\tif (c[i] == c[j]) pi[i] = ++j;\n\t}\n\tint t = go(0, 0, 0);\n\tif (t == 0)return !printf(\"0\");\n\ttrack(0, 0, 0);\n}", "lang": "GNU C++11", "bug_code_uid": "0a722222d662f8fd961164db656ddbaa", "src_uid": "391c2abbe862139733fcb997ba1629b8", "apr_id": "ecd2a3b92349bca489cea0ebeecef30d", "difficulty": 2000, "tags": ["dp", "strings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9836909871244636, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "\n\n    #include<stdio.h>\n    int main()\n    {\n        char a[101];\n        int i,n,count=0,cnt=0;\n        scanf(\"%d\",&n);\n        for(i=0;i<n;i++){\n            scanf(\"%s\",a);\n        }\n\n        for(i=0; i<n; i++)\n        {\n\n            if(a[i]=='S')while(a[i+1]=='F')\n            {\n                count++;\n            }\n\n            else if  (a[i]=='F')while(a[i+1]=='S')\n            {\n                cnt++;\n\n            }\n\n        }\n        if(count>=cnt)\n        {\n            printf(\"YES\");\n        }\n        else\n        {\n            printf(\"NO\");\n        }\n        return 0;\n    }\n", "lang": "GNU C++17", "bug_code_uid": "c0eee47ea1eed5ac30246957a6b599c0", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "apr_id": "b9464579462b13ff9736abcd56fd75c6", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9714285714285714, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "#include <bits/stdc++.h>\n\n#define _for(i,a,b) for (int i=(a),_b_=(b);i<_b_;i++)\n#define _fod(i,a,b) for (int i=(a),_b_=(b);i>_b_;i--)\n#define _it(i,v) for (typeof((v).begin()) i = (v).begin(); i != (v).end(); ++i)\n#define _all(v) v.begin(), v.end()\n#define __(v) memset(v,0,sizeof(v))\n\nusing namespace std;\ntypedef long long LL;\ntypedef unsigned long long ULL;\ntemplate<typename T> vector<T> &operator += (vector<T> &v, T x) {v.push_back(x);return v;}\n\nvoid solve() {\n\tint a,b;\n\tcin>>a>>b;\n\tint c1(0),c2(0);\n\twhile(a > 0 || b > 0){\n\t\tif(a > 0 && b > 0){\n\t\t\tc1++;\n\t\t\ta--;\n\t\t\tb--;\n\t\t}else{\n\t\t\tif(a > 1){\n\t\t\t\tc2++;\n\t\t\t\ta -= 2;\n\t\t\t\tif(a == 1) break;\n\t\t\t}\n\t\t\tif(b > 1){\n\t\t\t\tc2++;\n\t\t\t\tb -= 2;\n\t\t\t\tif(b == 1) break;\n\t\t\t}\n\t\t}\n\t}\n\tcout<<c1<<\" \"<<c2;\n}\n\nint main(){\n    ios_base::sync_with_stdio(0);\n    cin.tie(0);\n    #ifdef HIEUNV\n    freopen(\"input.txt\",\"r\",stdin);\n//  freopen(\"output.txt\",\"w\",stdout);\n    #endif\n    solve();\n}\n\n\n", "lang": "GNU C++14", "bug_code_uid": "f48e8a47eddac43900fd377379851854", "src_uid": "775766790e91e539c1cfaa5030e5b955", "apr_id": "9f751423b374208e0ce5f4791a010723", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9879912663755459, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include <cstdio>\n#include <iostream>\n#include <cstring>\nusing namespace std;\n#define MOD 1000000007\n\nint dp[200][20];\nint p[200];\nint pp[20];\n\nint dfs(int h,int num,bool flag){\n    if(num<0) return 0;\n    if(h==-1) return num==0;\n    if(!flag && dp[h][num]!=-1) return dp[h][num];\n    int up = flag?p[h]:9;\n    int res= 0;\n    for(int i=0;i<=up;i++){\n        if(i==4 || i==7) res += dfs(h-1,num-1,flag&&i==up);\n        else res += dfs(h-1,num,flag&&i==up);\n    }\n    if(!flag) dp[h][num] = res;\n    return res;\n}\n\nint solve(int k,int a){\n    memset(dp,-1,sizeof(dp));\n    int cnt=0;\n    while(k){\n        p[cnt++] = k%10;\n        k /= 10;\n    }\n    return dfs(cnt-1,a,true);\n}\n\nlong long F(int n,int m){\n    long long res = 1;\n    for(int i=0;i<m;i++) res = (res*(n-i))%MOD;\n    return res%MOD;\n}\n\nlong long dfs(int p,int sum,int t,int y[],int tot){\n    //cout<< p << \" \"<<sum <<\" \"<<t <<\" \"<<tot<<endl;\n    if(sum>=t && p!=0) return 0;\n    if(p==7){\n        long long res = 1;\n        for(int i=0;i<=tot;i++){\n            //cout << \"##\" <<pp[i] <<\" \" <<y[i] <<endl;\n            res = res*F(pp[i],y[i])%MOD;\n        }\n        return res;\n    }\n\n    long long ans = 0;\n    for(int i=0;i<=tot;i++){\n        //cout << \"i \" <<i <<endl;\n        y[i]++;\n        if(p==0) {\n            ans += dfs(p+1,sum,i,y,tot);\n            ans%=MOD;\n        }else{\n            ans += dfs(p+1,sum+i,t,y,tot);\n            ans%=MOD;\n        }\n        y[i]--;\n    }\n    return ans;\n}\n\nint main(){\n    int m;\n    cin >> m;\n    if(m<=7) cout<<0 <<endl;\n    else{\n        memset(dp,-1,sizeof(dp));\n        int t = m;\n        int tmp = 0;\n        while(t) {\n            t/=10;\n            tmp++;\n        }\n\n       // cout <<\"tmp:\" <<tmp <<endl;\n        for(int i=0;i<=tmp;i++){\n            pp[i] = solve(m,i);\n            if(i==0) pp[i]--;  // 0\n            //cout << \"i:\" <<i << \" \" <<pp[i] <<endl;\n        }\n\n        long long ans = 0,tt=1;\n        int x[10],y[10];\n        int z1,z2,z3,z4,z5;\n        memset(y,0,sizeof(y));\n        ans = dfs(0,0,0,y,tmp);\n/*\n        for( x[0]=1;x[0]<=tmp;x[0]++){\n            y[x[0]]++;\n            for( x[1]=0;x[1]<x[0];x[1]++){\n\n                y[x[1]]++;\n                z1 = x[0]-x[1];\n                for( x[2]=0;x[2]<z1;x[2]++){\n\n                    y[x[2]]++;\n                    z2 = z1-x[2];\n                    for( x[3]=0;x[3]<z2;x[3]++){\n\n                        y[x[3]]++;\n                        z3 = z2-x[3];\n                        for( x[4]=0;x[4]<z3;x[4]++){\n\n                            y[x[4]]++;\n                            z4 = z3 - x[4];\n                            for( x[5]=0;x[5]<z4;x[5]++){\n\n                                y[x[5]]++;\n                                z5 = z4-x[5];\n                                for(x[6]=0;x[6]<z5;x[6]++){\n\n                                    y[x[6]]++;\n\n                                    tt=1;\n                                    for(int i=0;i<=tmp;i++){\n                                        //printf(\"##: %d %d\\n\",pp[i],y[i]);\n                                        tt = tt*F(pp[i],y[i])%MOD;\n                                    }\n                                    ans  = (ans+tt)%MOD;\n                                    y[x[6]]--;\n                                }\n                                y[x[5]]--;\n                            }\n                            y[x[4]]--;\n                        }\n                        y[x[3]]--;\n                    }\n                    y[x[2]]--;\n                }\n                y[x[1]]--;\n            }\n            y[x[0]]--;\n        }\n*/\n        cout << ans <<endl;\n    }\n    return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "24af57f474ece2828575faa395b14779", "src_uid": "656ed7b1b80de84d65a253e5d14d62a9", "apr_id": "1f45aa4650033eb195981e444aa4d99a", "difficulty": 1900, "tags": ["brute force", "dp", "math", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.20055710306406685, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint main()\n{\n    int n,ans=0;\n    scanf(\"%d\",&n);\n    for(int i=2; i<=n-1; i++)ans+=i*(i+1);\n    printf(\"%d\",ans);\n    return 0\n}", "lang": "GNU C++11", "bug_code_uid": "efda090df629ccb928274782026aca1d", "src_uid": "1bd29d7a8793c22e81a1f6fd3991307a", "apr_id": "11c35321c6da3549ad74c28c4e15d310", "difficulty": 1200, "tags": ["dp", "math", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9992684711046086, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#define _CRT_SECURE_NO_WARNINGS \n#include<stdio.h> \n#include<math.h> \n#include<string> \n#include<string.h> \n#include<iostream> \n#include<vector> \n#include<set> \n#include<algorithm> \n#include<time.h> \n#include<queue>  \n#include<map> \n#include<limits.h> \n//#include\"windows.h\"\n\n#define vi vector <int>  \n#define ll long long \n#define ull unsigned long long \n#define ld long double\n#define dd double \n#define am &\n\n#define pi 3.141592653589793238462643383279 \n#define rad 57.295779513082323 \n#define sc scanf \n#define pr printf \n#define mp make_pair \n#define poo(i,a,b) for(ll i=a;i<=b;i++)\n#define oop(i,a,b) for(ll i=a;i>=b;i--)\nusing namespace std;\n/*namespace Help\n{\n\tll gcd(ll a, ll b)\n\t{\n\t\twhile (a != 0 && b != 0)\n\t\t{\n\t\t\tif (a > b)\n\t\t\t\ta &= b;\n\t\t\telse\n\t\t\t\tb %= a;\n\t\t}\n\t\treturn a + b;\n\t}\n\tvoid Qsort(int a[], int f, int q)\n\t{\n\t\tint l = f, r = q, x = a[(f + q) / 2], c;\n\n\t\tif (f >= q) return;\n\t\twhile (l <= r)\n\t\t{\n\t\t\twhile (a[l] < x)\n\t\t\t\tl++;\n\t\t\twhile (a[r] > x)\n\t\t\t\tr--;\n\t\t\tif (l <= r)\n\t\t\t{\n\t\t\t\tswap(a[l], a[r]);\n\t\t\t\tl++;\n\t\t\t\tr--;\n\t\t\t}\n\n\t\t}\n\t\tQsort(a, f, r);\n\t\tQsort(a, l, q);\n\t}\n\tvoid Qsort(ll a[], int f, int q)\n\t{\n\t\tll l = f, r = q, x = a[(f + q) / 2], c;\n\n\t\tif (f >= q) return;\n\t\twhile (l <= r)\n\t\t{\n\t\t\twhile (a[l] < x)\n\t\t\t\tl++;\n\t\t\twhile (a[r] > x)\n\t\t\t\tr--;\n\t\t\tif (l <= r)\n\t\t\t{\n\t\t\t\tswap(a[l], a[r]);\n\t\t\t\tl++;\n\t\t\t\tr--;\n\t\t\t}\n\n\t\t}\n\t\tQsort(a, f, r);\n\t\tQsort(a, l, q);\n\t}\n\tint binsearch(int n, int a[], int h)\n\t{\n\t\tint l = 0, r = h, c = n;\n\t\twhile (l < r - 1)\n\t\t{\n\t\t\tc = (l + r) / 2;\n\t\t\tif (n < a[c])\n\t\t\t\tr = c;\n\t\t\telse l = c;\n\t\t}\n\t\tif (a[l] == n)\n\t\t\treturn l + 1;\n\t\telse return -1;\n\t}\n\tbool isPrime(ll a)\n\t{\n\t\tll i;\n\t\tif (a % 2 == 0)\n\t\t\treturn 0;\n\t\telse\n\t\t\tfor (i = 3; i * i <= a; i += 2)\n\t\t\t\tif (a % i == 0)\n\t\t\t\t\treturn 0;\n\t\treturn 1;\n\t}\n};*/\n/*pair<int, int> t[131073 * 2] = { {0,0} };\npair<int, int> a[131073] = { {0,0} };\nint N;*/\n/*void build(int tl, int tr, int v)\n{\n\tif (tr == tl) return;\n\tif (tr-tl ==1)\n\t{\n\t\tt[v].first =  -1e9-1;\n\t\tt[v].second = +1e9+1;\n\t}\n\telse\n\t{\n\t\tint tm = (tl + tr) / 2;\n\t\tbuild(tl, tm, 2 * v + 1);\n\t\tbuild(tm, tr, 2 * v + 2);\n\t\tt[v].second = fmin(t[v * 2+1].second, t[v * 2 + 2].second);\n\t\tt[v].first = fmax(t[v * 2+2].first, t[v * 2 + 1].first);\n\t}\n}*/\n/*\nvoid upd(int i, int x)\n{\n\tint v = i + N;\n\tt[v].first = x;\n\tt[v].second = x;\n\tv /= 2;\n\twhile (v > 0)\n\t{\n\t\tt[v].second = fmin(t[v * 2].second, t[v * 2 + 1].second);\n\t\tt[v].first = fmax(t[v * 2].first, t[v * 2 + 1].first);\n\t\tv /= 2;\n\t}\n}\nint getmi(int l, int r, int tl, int tr, int v)\n{\n\tif (l > r)return 1e9 + 1;\n\telse if (l == tl && r == tr)\n\t\treturn t[v].second;\n\telse\n\t{\n\t\tint tm = (tl + tr) / 2;\n\t\tint a = getmi(l, min(r, tm), tl, tm, 2 * v);\n\t\tint b = getmi(max(l, tm + 1), r, tm + 1, tr, 2 * v + 1);\n\t\treturn min(a, b);\n\t}\n\n}\nint getma(int l, int r, int tl, int tr, int v)\n{\n\tif (l > r)return -1e9 - 1;\n\telse if (l == tl && r == tr)\n\t\treturn t[v].first;\n\telse\n\t{\n\t\tint tm = (tl + tr) / 2;\n\t\tint a = getma(l, min(r, tm), tl, tm, 2 * v);\n\t\tint b = getma(max(l, tm + 1), r, tm + 1, tr, 2 * v + 1);\n\t\treturn max(a, b);\n\t}\n\n}\nvoid getN(int n)\n{\n\tN = 1;\n\twhile (N < n)N *= 2;\n}\n*/\nint main()\n{\n\tint a, n, m,k0,r,max=0,min=1e5,temp,ak=0;\n\tsc(\"%d%d%d\",am n,am m,am r);\n\tfor (int i = 0; i < n; i++)\n\t{\n\t\tsc(\"%d\", am temp);\n\t\tif (temp < min)min = temp;\n\t}\n\tfor (int i = 0; i <m; i++)\n\t{\n\t\tsc(\"%d\", am temp);\n\t\tif (temp > max)max = temp;\n\t}\n\tk0 = r;\n\tak = r / min;\n\tr %= min;\n\tr += ak * max;\n\tprintf(\"%d\", fmax(r,k0));\n\treturn 0;\n}\n", "lang": "MS C++ 2017", "bug_code_uid": "05fc74423242a13c9beb59b7b34e4be9", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "apr_id": "88988ed9a73e6d94544c78527fabd1f0", "difficulty": 800, "tags": ["greedy", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9686697483307652, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "//#pragma comment(linker, \"/stack:20000000\")\n#include <algorithm>\n#include <iostream>\n#include <climits>\n#include <cstring>\n#include <cstdlib>\n#include <sstream>\n#include <fstream>\n#include <cstdio>\n#include <vector>\n#include <cctype>\n#include <string>\n#include <stack>\n#include <cmath>\n#include <queue>\n#include <deque>\n#include <list>\n#include <set>\n#include <map>\nusing namespace std;\n#define coder_shahnur() main(void)\n\n\nint coder_shahnur()\n{\n#ifdef _SHAHNUR\n\tfreopen(\"input.txt\", \"r\", stdin);\n\t//freopen(\"output.txt\", \"w\", stdout);\n#endif\n\tint n;\n\tcin >> n;\n\tset<int> s;\n\tfor (int i = 0; i < n; i++)\n\t{\n\t\tint num;\n\t\tcin >> num;\n\t\ts.insert(num);\n\t}\n\tvector<int> v(s.begin(), s.end());\n\tint flag = 0;\n\tfor (int i = 0; i < v.size() - 2; i++)\n\t{\n\t\tif (abs(v[i + 2] - v[i]) <= 2 && abs(v[i + 1] - v[i]) <= 2 && abs(v[i + 2] - v[i + 1]) <= 2)\n\t\t{\n\t\t\tflag = 1;\n\t\t}\n\t}\n\tif (!flag) cout << \"NO\" << endl; \n\telse cout << \"YES\" << endl;\n\treturn 0;\n}\n", "lang": "MS C++", "bug_code_uid": "dd579b2611ee03a52f9e8f4483bf0399", "src_uid": "d6c876a84c7b92141710be5d76536eab", "apr_id": "12906f214af008b6a112bc4b3d317452", "difficulty": 900, "tags": ["brute force", "sortings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.5163776493256262, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "#include <iostream>\n#include <algorithm>\n\nusing namespace std;\n\nint main(){\n\n    int v[2];\n\n    cin >> v[0] >> v[1] >> v[2];\n\n    sort(v, v + 3);\n\n    if( v[0] + v[1] < v[2]){\n        cout << v[2] - ( v[0] + v[1]) + 1;\n    }else{\n        cout << 0;\n    }\n\n\n}\n", "lang": "GNU C++11", "bug_code_uid": "aa2c36b87e04fb45551f59bfb76f3896", "src_uid": "3dc56bc08606a39dd9ca40a43c452f09", "apr_id": "37e35e0cdba315d223471147f3d86023", "difficulty": 800, "tags": ["geometry", "math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.2572347266881029, "equal_cnt": 11, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "#include<cstdio>\n#include<cstring>\n#include<algorithm>\nusing namespace std;\nint main()\n{\n\tdouble l,d,v,g,r,temp;\n\tscanf(\"%lf%lf%lf%lf%lf\",&l,&d,&v,&g,&r);\n\ttemp=d/v;\n\twhile(temp>g+r)\n\t{\n\t\ttemp-=g+r;\n\t}\n\tif(temp<g)\n\t\tprintf(\"%.8f\\n\",l/v);\n\telse if(temp<=g+r)\n\t\tprintf(\"%.8f\\n\",g+r+(l-d)/v);\n\treturn 0;\n}/*2017-07-30 20:04:19.708*/", "lang": "GNU C++", "bug_code_uid": "84905b006b865964f1ff3bab8d3ec620", "src_uid": "e4a4affb439365c843c9f9828d81b42c", "apr_id": "27a10d70c036fd9332f2d26ee1ccc4f5", "difficulty": 1500, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.7704918032786885, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "#include<bits/stdc++.h>\ntypedef long long int ll;\nusing namespace std;\n\n\nint main(){\nll test,i,j,xy,count,flag=0,n,o1=0,o2=0,x,y,m,l,z,max1,x1,y1,x2,y2,z1,k,sum,f,r,ans1,min1;\nstring a,ans;\ncin>>a>>k;\nn=a.size();\nwhile(k>0){\nfor(i=0;i<n;i++){\n\tx1=i;\n\tfor(j=i+1;j<n && j-i<=k;j++){\n\t\tif(a[i]<a[j] ){\n\t\t\t//cout<<a<<\" \"<<k<<\"\\n\";\n\t\t     x1=j;\n\t\t}\n\t}\n\tfor(x=x1;x>i && k>0 ;x--,k--){\n\t\tswap(a[x],a[x-1]);\n\t}\n}\n}\ncout<<a<<\"\\n\";\nreturn 0;\n}", "lang": "GNU C++17", "bug_code_uid": "75c66fb8866152a01c418123c67713a0", "src_uid": "e56f6c343167745821f0b18dcf0d0cde", "apr_id": "da40601277850c76979b469fff1c5e2c", "difficulty": 1400, "tags": ["greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9774008829829086, "equal_cnt": 20, "replace_cnt": 11, "delete_cnt": 6, "insert_cnt": 2, "fix_ops_cnt": 19, "bug_source_code": "#pragma GCC optimize (\"O3\", \"unroll-loops\")\n//#pragma GCC target (\"avx2\")\n//#pragma comment(linker, \"/stack:200000000\")\n//#pragma GCC target(\"sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native\")\n#include \"bits/stdc++.h\"\n#include <ext/pb_ds/assoc_container.hpp>\n#include <ext/pb_ds/tree_policy.hpp>\n#define all(x) x.begin(),x.end()\n#define rall(x) x.rbegin(),x.rend()\n#define distinct(x) sort(all(x)); x.resize(unique(all(x))-x.begin())\n#define pb push_back\n#define mp make_pair\n#define F first\n#define S second\n#define CASE(x) int x; cin >> x; while (x--)\n#define CASEt(x) int x; cin >> x; for (int tc = 1; tc <= x; ++tc)\nusing namespace std;\nusing namespace __gnu_pbds;\nnamespace {\n\tconst int MOD107 = 1000000007;\n\tconst int MOD998 = 998244353;\n\tusing ll = long long;\n\tusing ull = unsigned long long;\n\tusing pii = pair<int, int>;\n\tusing pll = pair<ll, ll>;\n\ttemplate <class T> using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;\n\ttemplate <class T> using minheap = priority_queue<T, vector<T>, greater<T>>;\n\ttemplate <class T> using maxheap = priority_queue<T, vector<T>, less<T>>;\n\tmt19937 rng(chrono::steady_clock::now().time_since_epoch().count());\n//\tmt19937_64 rng64(chrono::steady_clock::now().time_since_epoch().count());\n\ttemplate <int MODVALUE>\n\tstruct Modular {\n\tprivate:\n\t\tlong long val;\n\n\tpublic:\n\t\texplicit operator long long() const { return val; }\n\n\t\tbool operator == (const Modular& other) { return val == other.val; }\n\t\tbool operator != (const Modular& other) { return val != other.val; }\n\t\ttemplate<class T> bool operator == (const T& other) { return *this == Modular(other); }\n\t\ttemplate<class T> bool operator != (const T& other) { return *this != Modular(other); }\n\t\ttemplate<class T> friend bool operator == (const T& other, const Modular& m) { return Modular(other) == m; }\n\t\ttemplate<class T> friend bool operator != (const T& other, const Modular& m) { return Modular(other) != m; }\n\n\t\tbool operator <  (const Modular& other) { return val <  other.val; }\n\t\tbool operator <= (const Modular& other) { return val <= other.val; }\n\t\tbool operator >  (const Modular& other) { return val >  other.val; }\n\t\tbool operator >= (const Modular& other) { return val >= other.val; }\n\t\ttemplate<class T> bool operator <  (const T& other) { return *this <  Modular(other); }\n\t\ttemplate<class T> bool operator <= (const T& other) { return *this <= Modular(other); }\n\t\ttemplate<class T> bool operator >  (const T& other) { return *this >  Modular(other); }\n\t\ttemplate<class T> bool operator >= (const T& other) { return *this >= Modular(other); }\n\t\ttemplate<class T> friend bool operator <  (const T& other, const Modular& m) { return Modular(other) <  m; }\n\t\ttemplate<class T> friend bool operator <= (const T& other, const Modular& m) { return Modular(other) <= m; }\n\t\ttemplate<class T> friend bool operator >  (const T& other, const Modular& m) { return Modular(other) >  m; }\n\t\ttemplate<class T> friend bool operator >= (const T& other, const Modular& m) { return Modular(other) >= m; }\n\n\t\tModular& operator += (const Modular& other) { val += other.val; val %= MODVALUE; return *this; }\n\t\tModular  operator +  (const Modular& other) { Modular tmp = *this; return tmp += other; }\n\t\ttemplate<class T> Modular& operator += (const T& other) { return *this += Modular(other); }\n\t\ttemplate<class T> Modular  operator +  (const T& other) { return *this +  Modular(other); }\n\t\ttemplate<class T> friend Modular operator += (const T& other, const Modular& m) { return Modular(other) += m; }\n\t\ttemplate<class T> friend Modular operator +  (const T& other, const Modular& m) { return Modular(other) +  m; }\n\n\t\tModular& operator ++()    { return *this += 1; }\n\t\tModular  operator ++(int) { Modular tmp = *this; ++*this; return tmp; }\n\n\t\tModular  operator -  () const { return Modular(-val); }\n\t\tModular& operator -= (const Modular& other) { val -= other.val; val += MODVALUE; val %= MODVALUE; return *this;}\n\t\tModular  operator -  (const Modular& other) { Modular tmp = *this; return tmp -= other; }\n\t\ttemplate<class T> Modular& operator -= (const T& other) { return *this -= Modular(other); }\n\t\ttemplate<class T> Modular  operator -  (const T& other) { return *this -  Modular(other); }\n\t\ttemplate<class T> friend Modular operator -= (const T& other, const Modular& m) { return Modular(other) -= m; }\n\t\ttemplate<class T> friend Modular operator -  (const T& other, const Modular& m) { return Modular(other) -  m; }\n\n\t\tModular& operator --()    { return *this -= 1; }\n\t\tModular  operator --(int) { Modular tmp = *this; --*this; return tmp; }\n\n\t\tModular& operator *= (const Modular& other) { val *= other.val; val %= MODVALUE; val += MODVALUE; val %= MODVALUE; return *this; }\n\t\tModular  operator *  (const Modular& other) { Modular tmp = *this; return tmp *= other; }\n\t\ttemplate<class T> Modular& operator *= (const T& other) { return *this *= Modular(other); }\n\t\ttemplate<class T> Modular  operator *  (const T& other) { return *this *  Modular(other); }\n\t\ttemplate<class T> friend Modular operator *= (const T& other, const Modular& m) { return Modular(other) *= m; }\n\t\ttemplate<class T> friend Modular operator *  (const T& other, const Modular& m) { return Modular(other) *  m; }\n\n\t\tModular pow(long long power) const {\n\t\t\tModular m = *this, ans = 1;\n\t\t\twhile (power) {\n\t\t\t\tif (power & 1) ans *= m;\n\t\t\t\tm *= m;\n\t\t\t\tpower >>= 1;\n\t\t\t}\n\t\t\treturn ans;\n\t\t}\n\t\tModular pow(const Modular& other) const { return pow(other.val); }\n\t\tModular inv() const { return pow(MODVALUE-2); }\n\n\t\tModular& operator /= (const Modular& other) { val *= other.inv().val; val %= MODVALUE; return *this; }\n\t\tModular  operator /  (const Modular& other) { Modular tmp = *this; return tmp /= other; }\n\t\ttemplate<class T> Modular& operator /= (const T& other) { return *this /= Modular(other); }\n\t\ttemplate<class T> Modular  operator /  (const T& other) { return *this /  Modular(other); }\n\t\ttemplate<class T> friend Modular operator /= (const T& other, const Modular& m) { return Modular(other) /= m; }\n\t\ttemplate<class T> friend Modular operator /  (const T& other, const Modular& m) { return Modular(other) /  m; }\n\n\t\tfriend istream& operator >> (istream& in, Modular& m) { in >> m.val; m.val %= MODVALUE; m.val += MODVALUE; m.val %= MODVALUE; return in; }\n\t\tfriend ostream& operator << (ostream& out, const Modular& m) { return out << m.val; }\n\n\t\tModular() : val(0) {}\n\t\tModular(int val) : val((val % MODVALUE + MODVALUE) % MODVALUE) {};\n\t\tModular(long long val) : val((val % MODVALUE + MODVALUE) % MODVALUE) {};\n\t};\n\tinline ll pow(ll b, ll p, ll mod) {\n\t\tb %= mod;\n\t\tll ans = 1;\n\t\tfor (; p > 0; p >>= 1) {\n\t\t\tif (p&1) {ans *= b; ans %= mod;}\n\t\t\tb *= b;\n\t\t\tb %= mod;\n\t\t}\n\t\treturn ans;\n\t}\n\tinline ll max(ll a, int b) { return (a > b ? a : b); }\n\tinline ll max(int a, ll b) { return (a > b ? a : b); }\n\tinline ll min(ll a, int b) { return (a < b ? a : b); }\n\tinline ll min(int a, ll b) { return (a < b ? a : b); }\n\ttemplate <class T> inline bool chkmin(T&x, const T& y) { return x > y ? x = y, 1 : 0; }\n\ttemplate <class T> inline bool chkmax(T&x, const T& y) { return x < y ? x = y, 1 : 0; }\n}\nnamespace IO {\n\ttemplate<class T> inline void _R(T &x) {cin >> x;}\n\ttemplate<class T1, class T2> inline void _R(pair<T1,T2> &x) {_R(x.first); _R(x.second);}\n\ttemplate<class T> inline void _R(vector<T> &x) {for (auto& i : x) _R(i);}\n\ttemplate<class T> inline void _R(deque<T> &x) {for (auto& i : x) _R(i);}\n\tinline void R() {}\n\ttemplate<class T1, class... T2> inline void R(T1 &x, T2 &...y) { _R(x); R(y...);}\n\n\ttemplate<class T> inline void _W(const T& x);\n\ttemplate<class T1, class T2> inline void _W(const pair<T1,T2>& p);\n\ttemplate<class... T> inline void _W(const vector<T...>& x);\n\ttemplate<class... T> inline void _W(const deque<T...>& x);\n\ttemplate<class... T> inline void _W(const forward_list<T...>& x);\n\ttemplate<class... T> inline void _W(const list<T...>& x);\n\ttemplate<class... T> inline void _W(const set<T...>& x);\n\ttemplate<class... T> inline void _W(const multiset<T...>& x);\n\ttemplate<class... T> inline void _W(const unordered_set<T...>& x);\n\ttemplate<class... T> inline void _W(const unordered_multiset<T...>& x);\n\ttemplate<class... T> inline void _W(const map<T...>& x);\n\ttemplate<class... T> inline void _W(const multimap<T...>& x);\n\ttemplate<class... T> inline void _W(const unordered_map<T...>& x);\n\ttemplate<class... T> inline void _W(const unordered_multimap<T...>& x);\n\n\ttemplate<class T> inline void _W(const ordered_set<T>& x);\n\n\ttemplate<class Container> inline void printContainer(const Container& x) { bool isFirst = 1; for (auto i : x) { if (!isFirst) cout << ' '; isFirst = 0; _W(i); } }\n\n\ttemplate<class T> inline void _W(const T& x) {cout << x;}\n\ttemplate<class T1, class T2> inline void _W(const pair<T1,T2>& p) {_W(p.first); _W(' '); _W(p.second);}\n\ttemplate<class... T> inline void _W(const vector<T...>& x) { printContainer(x); }\n\ttemplate<class... T> inline void _W(const deque<T...>& x) { printContainer(x); }\n\ttemplate<class... T> inline void _W(const forward_list<T...>& x) { printContainer(x); }\n\ttemplate<class... T> inline void _W(const list<T...>& x) { printContainer(x); }\n\ttemplate<class... T> inline void _W(const set<T...>& x) { printContainer(x); }\n\ttemplate<class... T> inline void _W(const multiset<T...>& x) { printContainer(x); }\n\ttemplate<class... T> inline void _W(const unordered_set<T...>& x) { printContainer(x); }\n\ttemplate<class... T> inline void _W(const unordered_multiset<T...>& x) { printContainer(x); }\n\ttemplate<class... T> inline void _W(const map<T...>& x) { printContainer(x); }\n\ttemplate<class... T> inline void _W(const multimap<T...>& x) { printContainer(x); }\n\ttemplate<class... T> inline void _W(const unordered_map<T...>& x) { printContainer(x); }\n\ttemplate<class... T> inline void _W(const unordered_multimap<T...>& x) { printContainer(x); }\n\n\ttemplate<class T> inline void _W(const ordered_set<T>& x) { printContainer(x); }\n\n \tinline void W() {cout << '\\n';}\n\ttemplate<class T> inline void W(const T &x) {_W(x); W();}\n\ttemplate<class T1, class... T2> inline void W(const T1 &x, const T2 &...y) { _W(x); _W(' '); W(y...);}\n} using namespace IO;\nnamespace outputFormat{\n\tinline string Case(int tc) {return \"Case #\" + to_string(tc) + ':';}\n\tinline string YN(bool b) {return b ? \"YES\" : \"NO\";}\n} using namespace outputFormat;\nnamespace std {\n    template <class T1, class T2> struct hash<pair<T1,T2>> {\n    \tstd::size_t operator()(pair<T1,T2> _) const {\n        \treturn hash<T1>{}(_.first) ^ hash<T2>{}(_.second);\n    \t}\n    };\n}\nusing Mint = Modular<MOD998>;\n\nint main() {\n\tint n,k,l; R(n,k,l);\n\tvector<vector<vector<Mint>>> dp(n * 2 + 7, vector<vector<Mint>>(n + 7, vector<Mint>(3, 0)));\n\t\n\tdp[0][0][0] = 1;\n\tfor (int len = 1; len <= 2 * n + 1; len++)\n\t\tfor (int left = 0; left <= n; left++)\n\t\t\tfor (int used = 0; used <= 1; used++) {\n\t\t\t\tMint& now = dp[len][left][used];\n\t\t\t\tint Rp = (len - left - used) / 2;\n\n\t\t\t\tif (left)\n\t\t\t\t\tnow += dp[len - 1][left - 1][used];\n\t\t\t\tif (Rp)\n\t\t\t\t\tnow += dp[len - 1][left + 1][used] * (left + 1);\n\t\t\t\tif (used && left >= k)\n\t\t\t\t\tnow += dp[len - 1][left][used - 1];\n\t\t\t}\n\t\n\tMint ans = dp[n * 2 + 1][0][1];\n\t\n\tans *= ((Mint)2).pow(n);\n\t\n\tMint fac = 1;\n\tfor (Mint i = n + 1; i <= 2 * n + 1; i++)\n\t\tfac *= i;\n\t\t\n\tans *= fac.inv();\n\t\n\tans *= l;\n\t\t\n\tW(ans);\n\n\treturn 0;\n}\n\nstatic auto _batch_ios = [](){\n#ifndef LOCAL\n\tios::sync_with_stdio(false);\n\tcin.tie(0);\n#endif\n\tcout << fixed << setprecision(10);\n\treturn 42;\n}();\n", "lang": "GNU C++14", "bug_code_uid": "8a917f4f04cc40b8aa107ae24bfedfe1", "src_uid": "c9e79e83928d5d034123ebc3b2f5e064", "apr_id": "db9221a29e45099f14100a5a0e87afcc", "difficulty": 2600, "tags": ["dp", "math", "combinatorics", "probabilities"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.22981366459627328, "equal_cnt": 19, "replace_cnt": 12, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 18, "bug_source_code": "#include<bits/stdc++.h>\n#define int long long\n#define max(a,b) a>b?a:b\nusing namespace std;\nint ans,jc[1000001];\nint C(int a,int b){\n\tif(a<b)return 0;\n\treturn jc[a]/jc[a-b]/jc[b];\n}\nvoid work(int a,int b,int c,int l){\n\tfor(int i=max(0,a+b-c);i<=l;i++){\n\t\tint tmp=min(l-i,c+i-a-b);\n\t\tans-=C(tmp+2,2);\n\t}\n}\nmain(){\n\tjc[0]=1;\n\tfor(int i=1;i<=1000000;i++){\n\t\tjc[i]=jc[i-1]*i;\n\t}\n\tint a,b,c,l;\n\tcin>>a>>b>>c>>l;\n\tans+=C(l+3,3);\n\twork(a,b,c,l);\n\twork(a,c,b,l);\n\twork(b,c,a,l);\n\tcout<<ans<<endl;\n}", "lang": "GNU C++11", "bug_code_uid": "64e54a88d0490d43ce781e10d4473157", "src_uid": "185ff90a8b0ae0e2b75605f772589410", "apr_id": "18ae4bf7bbe6771d4037b7774255fb9d", "difficulty": 2100, "tags": ["math", "combinatorics", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.06436781609195402, "equal_cnt": 30, "replace_cnt": 19, "delete_cnt": 3, "insert_cnt": 9, "fix_ops_cnt": 31, "bug_source_code": "#include<iostream>\n#include<cstring>\n#include<string>\nusing namespace std;\nchar a[1001],b[1001],virus[1001],ans[1001],res[1001];\nint lena,lenb;\nint Maxlen=0;\nvoid DFS(int len,int apos,int bpos)\n{\n    //cout<<ans<<endl;\n    for(int i=bpos+1;i<lenb;++i)\n    {\n        for(int j=apos+1;j<lena;++j)\n        {\n            if(b[i]==a[j])\n            {\n                ans[len]=b[i];\n                DFS(len+1,j,i);\n            }\n        }\n    }\n    //cout<<ans<<endl;\n    if(len>Maxlen && strstr(ans,virus)==NULL)\n    {\n        Maxlen=len;\n        strcpy(res,ans);\n    }\n//  memset(ans,'\\0',sizeof(ans));\n}\nint main()\n{\n    cin>>a>>b>>virus;\n    lena=strlen(a),lenb=strlen(b);\n    DFS(0,-1,-1);\n    if(Maxlen)\n    {\n        for(int i=0;i<Maxlen;++i)\n            cout<<res[i];\n        cout<<endl;\n    }\n    else\n        cout<<0<<endl;\n    //system(\"pause\");\n    return 0;\n}\n/*\nAJKEQSLOBSROFGZ\nOVGURWZLWVLUXTH\nOZ\n*/\n", "lang": "GNU C++", "bug_code_uid": "8385ca6b6dff59c28c4e75b2c0dbdeb8", "src_uid": "391c2abbe862139733fcb997ba1629b8", "apr_id": "e4e6bf999cf40fc8f322dadba7c8b432", "difficulty": 2000, "tags": ["dp", "strings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.10602409638554217, "equal_cnt": 25, "replace_cnt": 16, "delete_cnt": 3, "insert_cnt": 5, "fix_ops_cnt": 24, "bug_source_code": "#include<cstring>\n#include<cstdlib>\n#include<algorithm>\n#define N 42\nusing namespace std;\nint res[N][N],d[N][N],a[N],b[N],ans[N][N],i,n,m,j,k;\nvoid cheng(int a[N][N],int b[N][N]){\n\tint c[N][N],i,j,k;\n\tmemset(c,120,sizeof(c));\n\tfor(i=0;i<=2*n;++i)\n\t\tfor(j=0;j<=2*n;++j)\n\t\t\tfor(k=0;k<=2*n;++k)c[i][k]=min((long long)c[i][k],(long long)a[i][j]+b[j][k]);\n\tmemcpy(a,c,sizeof(c));\n}\nint main(){\n\tint t=m/2;m=2;\n\tscanf(\"%d%d\",&n,&m);\n\tfor(i=1;i<=n;++i)scanf(\"%d\",&a[i]);\n\tfor(i=1;i<=n;++i)scanf(\"%d\",&b[i]);\n\tmemset(d,120,sizeof(d));\n\tfor(i=0;i<=2*n;++i)d[i][i]=0;\n\tfor(i=1;i<=n;++i){\n\t\tmemcpy(res,d,sizeof(d));\n\t\tmemset(d,120,sizeof(d));\n\t\tfor(j=0;j<=2*n;++j)\n\t\t\tfor(k=0;k<=2*n;++k){\n\t\t\t\tif(k!=0)d[j][k-1]=min(d[j][k-1],res[j][k]+b[i]);\n\t\t\t\tif(k!=2*n)d[j][k+1]=min(d[j][k+1],res[j][k]+a[i]);\n\t\t\t}\n\t}\n\tmemset(ans,120,sizeof(ans));\n\tans[0][0]=0;\n\twhile(m){\n\t\tif(m&1)cheng(ans,d);\n\t\tcheng(d,d);\n\t\tm/=2;\n\t}\n\tprintf(\"%d\\n\",ans[0][0]*t);\n}\n", "lang": "GNU C++", "bug_code_uid": "9a028617e6b3cf4ee5401bd7c9914fc3", "src_uid": "f40900973f4ebeb6fdafd75ebe4e9601", "apr_id": "35686d60b5d99207d7019a2305fc828f", "difficulty": 2500, "tags": ["matrices", "dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.05275779376498801, "equal_cnt": 20, "replace_cnt": 16, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 21, "bug_source_code": "\n#include <bits/stdc++.h>\n\nusing namespace std;\n\n#define x first\n#define y second\n\nint dx[]={0, 0, 1, -1};\nint dy[]={1, -1, 0, 0};\n\ntypedef pair<int, int> pii;\ntypedef long long INT;\n\ntemplate <class T> inline void smin(T &a, T b) {if (a>b) a=b;}\ntemplate <class T> inline void smax(T &a, T b) {if (a<b) a=b;}\n#define NN 22\n#define inf 0x3f3f3f3f\n\nint N, a[NN], b[NN];\nint f[NN][NN], g[NN][NN];\n\nint calc(int g[NN][NN], int f[NN][NN], int n) {\n\tint i, j, k, tmp[NN][NN];\n\n\tif (n==0) {\n\t\tfor (i=0; i<=N; i++) for (j=0; j<=N; j++) f[i][j]=inf;\n\t\tfor (i=0; i<=N; i++) f[i][i]=0;\n\t\treturn 0;\n\t}\n\t\n\tcalc(g, tmp, n/2);\n\n\tfor (i=0; i<=N; i++) for (j=0; j<=N; j++) {\n\t\tf[i][j]=inf;\n\t\tfor (k=0; k<=N; k++) smin(f[i][j], tmp[i][k]+tmp[k][j]);\n\t}\n\t\n\tif (n%2) {\n\t\tfor (i=0; i<=N; i++) for (j=0; j<=N; j++) {\n\t\t\ttmp[i][j]=inf;\n\t\t\tfor (k=0; k<=N; k++) smin(tmp[i][j], f[i][k]+g[k][j]);\n\t\t}\n\t\tfor (i=0; i<=N; i++) for (j=0; j<=N; j++) f[i][j]=tmp[i][j];\n\t}\n}\n\nint main() {\n\t\n\tint bit, M, i, s, deep, cnt, u, v;\n\t\n\tscanf(\"%d%d\", &N, &M);\n\tfor (i=0; i<N; i++) scanf(\"%d\", a+i);\n\tfor (i=0; i<N; i++) scanf(\"%d\", b+i);\n\t\n\tmemset(g, 0x3f, sizeof(g));\n\t\n\tfor (bit=0; bit<(1<<N); bit++) {\n\t\ts=deep=cnt0;\n\n\t\tfor (i=0; i<N; i++) {\n\t\t\tif (bit&(1<<i)) {\n\t\t\t\ts+=a[i]; deep++;\n\t\t\t} else {\n\t\t\t\ts+=b[i]; deep--;\n\t\t\t}\n\t\t\t\n\t\t\tsmin(cnt, deep);\n\t\t}\n\t\t\n\t\tfor (int j=-cnt; j<=N; j++) {\n\t\t\tu=j; v=j+deep;\n\t\t\tif (v<=N && v>=0) smin(g[u][v], s);\n\t\t}\n\t}\n\t\n\tcalc(g, f, M);\n\tprintf(\"%d\\n\", f[0][0]);\n\t\n\treturn 0;\n}\n                    ", "lang": "GNU C++", "bug_code_uid": "b8667f84614fe1ddbad92226e5ec1e41", "src_uid": "f40900973f4ebeb6fdafd75ebe4e9601", "apr_id": "b586a1a557bea2ee3e1ec0e9f5585e68", "difficulty": 2500, "tags": ["matrices", "dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9984572662758407, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <cstdio>\n#include <iostream>\n#include <vector>\n#include <map>\n#include <set>\n#include <sstream>\n#include <algorithm>\n#include <ctime>\n#include <cmath>\n\nusing namespace std;\n\nconst int nmax = 80 * 80 / 2;\nconst int Nm = nmax * 2 + 2;\nconst int Mm = 2 * nmax * 4;\nconst int INF = 1000000000;\n\nclass costflow {\n    int s[Nm], q[Nm], pre[Nm], v[Nm]; // Ns\n    int t[Mm], next[Mm], cf[Mm]; // Ms\n    int w[Mm], d[Nm];\n    int cnt;\n    int N;\n\npublic:\n\n    void init(int n) {\n        cnt = 1;\n        N = n;\n        memset(s, 0, sizeof (s));\n        memset(d, 0, sizeof (d));\n        memset(q, 0, sizeof (q));\n        memset(pre, 0, sizeof (pre));\n        memset(v, 0, sizeof (v));\n\n        memset(t, 0, sizeof (t));\n        memset(cf, 0, sizeof (cf));\n        memset(w, 0, sizeof (w));\n        memset(next, 0, sizeof (next));\n    }\n\n    void add(int ss, int tt, int cc, int ww) {\n        ++cnt;\n        t[cnt] = tt;\n        cf[cnt] = cc;\n        w[cnt] = ww;\n        next[cnt] = s[ss];\n        s[ss] = cnt;\n        ++cnt;\n        t[cnt] = ss;\n        cf[cnt] = 0;\n        w[cnt] = -ww;\n        next[cnt] = s[tt];\n        s[tt] = cnt;\n    }\n\n    pair<int, int> getflow(int S, int T) {\n        int cost = 0;\n        int flow = 0;\n        int i, j, head, tail;\n        while (true) {\n            head = 0;\n            tail = 1;\n            for (i = 0; i < N; i++) {\n                d[i] = INF;\n            }\n            for (i = 0; i < N; i++) {\n                v[i] = 0;\n            }\n            d[S] = 0;\n            q[1] = S;\n            while (head != tail) {\n                v[i = q[head = (head + 1) % N]] = 0;\n                for (j = s[i]; j != 0; j = next[j]) {\n                    if (cf[j] != 0 && d[t[j]] > d[i] + w[j]) {\n                        d[t[j]] = d[i] + w[j];\n                        pre[t[j]] = j;\n                        if (v[t[j]] == 0) {\n                            v[t[j]] = 1;\n                            q[tail = (tail + 1) % N] = t[j];\n                        }\n                    }\n                }\n            }\n            if (d[T] == INF) {\n                return make_pair(flow, cost);\n            }\n            cost += d[T];\n            ++flow;\n            for (i = T; i != S; i = t[pre[i] ^ 1]) {\n                --cf[pre[i]];\n                ++cf[pre[i] ^ 1];\n            }\n        }\n    }\n} network;\n\nint a[80][80];\n\nint main()\n{\n\t//freopen(\"counter.in\", \"r\", stdin);\n\t//freopen(\"counter.out\", \"w\", stdout);\n\n\tstring s;\n\tint i, j, k, n, m;\n\t\n\tcin >> n >> m;\n\tfor(i = 0; i < n; i++)\n\t\tfor(j = 0; j < m; j++)\n\t\t\tcin >> a[i][j];\n\n\tconst int di[4] = {-1, 0, 1, 0};\n\tconst int dj[4] = {0, 1, 0, -1};\n\tnetwork.init(2 + n * m);\n\tfor(i = 0; i < n; i++)\n\t\tfor(j = 0; j < m; j++)\n\t\t\tif ((i + j) % 2 == 0)\n\t\t\t{\n\t\t\t\tfor(int d = 0; d < 4; d++)\n\t\t\t\t{\n\t\t\t\t\tint ii = i + di[d];\n\t\t\t\t\tint jj = j + dj[d];\n\t\t\t\t\tif (ii < 0 || ii >= n || jj < 0 || jj >= m)\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t//cout << i << \" \" << j << \" - \" << ii << \" \" << jj << \": \" << (a[i][j] != a[ii][jj]) << endl;\n\t\t\t\t\tnetwork.add(i * m + j, ii * m + jj, 1, (a[i][j] != a[ii][jj]));\n\t\t\t\t}\n\t\t\t\tnetwork.add(n * m, i * m + j, 1, 0);\n\t\t\t} else\n\t\t\t\tnetwork.add(i * m + j, n * m + 1, 1, 0);\n\tcout << network.getflow(n * m, n * m + 1).second << endl;\n\t\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "cf7b20cbcd7656f3d7710526c1f456fc", "src_uid": "1f0e8bbd5bf4fcdea927fbb505a8949b", "apr_id": "b6ac78acd69b6e5789abd178f0ce2c95", "difficulty": 2200, "tags": ["flows"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9983642311886587, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include<bits/stdc++.h>\n#define fr(i,a,b) for(int i(a),end##i(b);i<=end##i;i++)\n#define fd(i,a,b) for(int i(a),end##i(b);i>=end##i;i--)\nusing namespace std;\nconst int maxn=500+5;\nint n,m,mod;\nint upd(const int &x){\n\tif(x<0)return x+mod;\n\tif(x>=mod)return x-mod;\n\treturn x;\n}\nvoid add(int &x,const int &y){\n\tx=upd(x+y);\n}\nint ksm(int x,int k){\n\tint ans=1;\n\twhile(k){\n\t\tif(k&1)ans=1ll*ans*x%mod;\n\t\tx=1ll*x*x%mod;\n\t\tk>>=1;\n\t}\n\treturn ans;\n}\nint jc[maxn],inv[maxn];\nvoid init(int n){\n\tjc[0]=1;\n\tfr(i,1,n)jc[i]=1ll*jc[i-1]*i%mod;\n\tinv[n]=ksm(jc[n],mod-2);\n\tfd(i,n-1,0)inv[i]=1ll*inv[i+1]*(i+1)%mod;\t\n}\nint C(int n,int m){\n\tif(n<0||m<0||n<m)return 0;\n\treturn 1ll*jc[n]*inv[n-m]%mod*inv[m]%mod;\n}\nvector<int> f,g;\nint S(int n){\n\treturn n*(n+1)/2;\n}\nvector<int> operator *(const vector<int> &A ,const vector<int> &B){\n\tvector<int> C(A.size()+B.size()-1);\n\tfr(i,0,A.size()-1)fr(j,0,B.size()-1)add(C[i+j],1ll*A[i]*B[j]%mod);\n\treturn C;\n}\nint G(int n,int m){\n\treturn C(m+n-1,n-1);\t\n}\nint main(){\n#ifdef pig\n\tfreopen(\"1439D.in\",\"r\",stdin);\n\tfreopen(\"1439D.out\",\"w\",stdout);\n#endif\n\tcin>>m>>n>>mod;\n\tinit(m<<1);\n\tf.resize(n+1);g.resize(n+1);\n\tf[0]=1;\n\tfr(i,1,n){\n\t\tfr(j,0,i-1)add(f[i],1ll*f[j]*f[i-1-j]%mod*C(i-1,j)%mod);\n\t\tf[i]=1ll*f[i]*(i+1)%mod;\n\t}\n\tfr(i,1,n){\n\t\tfr(j,0,i-1)add(g[i],(2ll*f[j]*g[i-1-j]%mod*C(i-1,j)%mod*(i+1)%mod+1ll*C(i-1,j)*(S(j)+S(i-1-j))%mod*f[j]%mod*f[i-1-j]%mod)%mod);\n\t}\n\t//cout<<g[n]<<'\\n';\n\t//fr(i,0,n)printf(\"%d \",g[i]);printf(\"\\n\");\n\t//fr(i,0,n)printf(\"%d \",f[i]);printf(\"\\n\");\n\tf[0]=0;\n\tfr(i,0,n)g[i]=1ll*g[i]*inv[i]%mod;\n\tfr(i,0,n)f[i]=1ll*f[i]*inv[i]%mod;\n\tint ans=0;\n\tfr(i,1,m-n+1){\n\t//printf(\"g:=\");fr(j,0,n)printf(\"%d \",g[j]);printf(\"\\n\");\n\t\t//printf(\"%lld %d\\n\",1ll*g[n]*jc[n]%mod,G(i+1,m-n-i+1));\n\t\tadd(ans,1ll*g[n]*G(i+1,m-n-i+1)%mod*jc[n]%mod*i%mod);\t\t\n\t\tg=g*f;g.resize(n+1);\n\t}\n\tcout<<ans;\n\treturn 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "fce643bb117777dfeeca814770933e6e", "src_uid": "9812de5f2d272511a63ead8765b23190", "apr_id": "bd7dcd444cab8abd5952d83c98ce83e5", "difficulty": 3100, "tags": ["dp", "fft", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.4465027147876078, "equal_cnt": 17, "replace_cnt": 12, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 16, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\ntypedef long long LL;\nconst int N = 500 + 10;\nint n,m,p;\nLL c[N][N],f[N],g[N],dp[N][N][N],ways[N][N][N];\nvoid add(LL &x,LL y){\n\tx=(x+y)%p;\n}\nLL cal(LL x){\n\treturn 1LL*x*(x-1)/2 % p; \n}\nint main() {\n    cin>>n>>m>>p;\n    for(int i=0;i<N;i++)c[i][0]=1;\n    for(int i=1;i<N;i++){\n    \tfor(int j=1;j<=i;j++)c[i][j]=(c[i-1][j-1]+c[i-1][j])%p;\n    }\n\tf[0]=0; g[0]=1;\n\tfor(int i=1;i<=m;i++){\n\t\tfor(int j=1;j<=i;j++){\n\t\t\tLL add1 = c[i-1][j-1] * f[j-1] % p * g[i-j] % p * (i+1) % p;\n\t\t\tLL add2 = c[i-1][j-1] * g[j-1] % p * f[i-j] % p * (i+1) % p;\n\t\t\t//printf(\"i=%d,j=%d,add1=%lld,add2=%lld\\n\", i,j,add1,add2);\n\t\t\tadd(f[i], add1 + add2 + (c[i-1][j-1] * g[j-1] % p * g[i-j] % p) * ((cal(j) + cal(i-j+1)) % p) % p);\n\t\t\tadd(g[i], c[i-1][j-1] * g[j-1] % p * g[i-j] % p * (i+1) % p);\n\t\t}\n\t\t//printf(\"f[%d] = %lld %lld\\n\", i, f[i], g[i]);\n\t}\n\tdp[0][0][0]=0;ways[0][0][0]=1;\n\tfor(int i=0;i<=n;i++){ \n\t\tfor(int j=0;j<=min(i,m);j++){\n\t\t\tfor(int k=0;k<=min(j,m);k++){\n\t\t\t\t//printf(\"dp[%d][%d][%d] = %lld, %lld\\n\", i,j,k,ways[i][j][k],dp[i][j][k]);\n\t\t\t\tadd(dp[i+1][j][0],dp[i][j][k]);\n\t\t\t\tadd(ways[i+1][j][0], ways[i][j][k]);\n\t\t\t\tint rem=m-(j-k);\n\t\t\t\tadd(ways[i+1][j+1][k+1], ways[i-k][j-k][0] * c[rem][k+1] % p * g[k+1] % p);\n\t\t\t\tadd(dp[i+1][j+1][k+1], dp[i-k][j-k][0] * c[rem][k+1] % p * g[k+1] % p + ways[i-k][j-k][0] * c[rem][k+1] % p * f[k+1] % p);\n\t\t\t}\n\t\t}\n\t}\n\tLL ans=0;\n\tfor(int i=0;i<=m;i++)\n\t\tadd(ans, dp[n][m][i]);\n\tcout<<ans<<endl;\n}\t", "lang": "GNU C++17", "bug_code_uid": "bfa7d273e586a18433e87b58f3e25487", "src_uid": "9812de5f2d272511a63ead8765b23190", "apr_id": "18993cafb9ee307fa521789c103c5f10", "difficulty": 3100, "tags": ["dp", "fft", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9556015642972164, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "#include <bits/stdc++.h>\n\nusing namespace std;\n#define int long long\nconst int maxn=505;\nint p;\nint po(int a,int b)\n{\n    if(b==0) return 1;\n    if(b==1) return a;\n    if(b%2==0)\n    {\n        int u=po(a,b/2);\n        return (u*u)%p;\n    }\n    else\n    {\n        int u=po(a,b-1);\n        return (a*u)%p;\n    }\n}\nint fact[maxn];\nint invf[maxn];\nint c3[maxn][maxn];\nint c(int n,int k)\n{\n    return c3[n][k];\n}\nint32_t main()\n{\n    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);\n    int n,m;\n    cin>>n>>m;\n    cin>>p;\n    int u1=1;\n    for(int i=0;i<maxn;++i)\n    {\n        fact[i]=u1;\n        invf[i]=inv(fact[i]);\n        u1*=(i+1);\n        u1%=p;\n    }\n    for(int i=0;i<maxn;++i)\n    {\n        for(int j=0;j<maxn;++j)\n        {\n            if(i>j) c3[i][j]=c3[i-1][j-1]+c3[i-1][j];\n            else if(i==j) c3[i][j]=1;\n        }\n    }\n    int dp1[n+1];\n    dp1[0]=1;\n    int dp2[n+1];\n    dp2[0]=0;\n    for(int i=1;i<=n;++i)\n    {\n        dp1[i]=0;\n        dp2[i]=0;\n        for(int j=0;j<i;++j)\n        {\n            dp1[i]+=(((((dp1[j]*dp1[i-1-j])%p)*(i+1))%p)%p)*c(i-1,j);\n            dp2[i]+=((((((dp1[j]*dp2[i-j-1])%p)*(i+1)+((dp2[j]*dp1[i-j-1])%p)*(i+1)+((dp1[j]*dp1[i-1-j])%p)*((((i-1-j)*(i-j)+j*(j+1))/2)%p))%p)%p)%p)*c(i-1,j);\n            dp2[i]%=p;\n            dp1[i]%=p;\n            //cout<<dp1[i]<<\" \"<<dp2[i]<<endl;\n        }\n    }\n    //cout<<dp2[2]<<endl;\n    int dp3[n+1][m+1];\n    int dp4[n+1][m+1];\n    for(int i=0;i<=n;++i)\n    {\n        for(int j=0;j<=m;++j)\n        {\n            dp3[i][j]=0;\n            dp4[i][j]=0;\n        }\n    }\n    for(int i=0;i<=n;++i)\n    {\n        for(int j=0;j<=i;++j)\n        {\n            for(int k=0;k<=j;++k)\n            {\n                 if(k!=j)\n                 dp3[i][j]+=((dp3[i-k-1][j-k]*dp1[k])%p)*c(j,k);\n                 else\n                 dp3[i][j]+=dp1[k];\n                 dp3[i][j]%=p;\n                 if(k!=j)\n                 dp4[i][j]+=((dp4[i-k-1][j-k]*dp1[k]+dp2[k]*dp3[i-k-1][j-k])%p)*c(j,k);\n                 else\n                 dp4[i][j]+=dp2[k];\n                 dp4[i][j]%=p;\n            }\n        }\n    }\n    cout<<dp4[n][m];\n    return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "1919da1652c73465d0ae4bbbdb22cb8c", "src_uid": "9812de5f2d272511a63ead8765b23190", "apr_id": "7e9d3f73688440d236fc7d501897eafe", "difficulty": 3100, "tags": ["dp", "fft", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6034616378196849, "equal_cnt": 24, "replace_cnt": 15, "delete_cnt": 2, "insert_cnt": 7, "fix_ops_cnt": 24, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\n#define int long long\nconst int N=507;\nint n,m,p,fac[N],ifac[N],f[N][N],g[N][N],ans[N][N],sum[N][N];\ninline int pows(long long u,int v){\n\tlong long ans=1;\n\twhile(v>0){\n\t\tif(v&1) ans=ans*u%p; u=u*u%p,v=v>>1;\n\t}\n\treturn ans;\n}\ninline long long binom(int a,int b){\n\tif(a<b) return 0; return 1ll*fac[a]%p*ifac[b]%p*ifac[a-b]%p;\n}\ninline int getsum(int u){\n\treturn 1ll*u*(u+1)/2;\n} \nsigned main(){\n\tcin>>n>>m>>p,fac[0]=ifac[0]=1;\n\tfor(int i=1;i<=500;i++) fac[i]=1ll*fac[i-1]*i%p,ifac[i]=pows(fac[i],p-2);\n\tfor(int len=1;len<=n;len++)\n\t\tfor(int l=1;l<=n;l++)\n\t\tfor(int r=l;r<=n;r++){\n\t\t\tif(r-l+1!=len) continue;\n\t\t\tif(l==r){\n\t\t\t\tf[l][r]=0,g[l][r]=2;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tg[l][r]=2ll*(g[l+1][r]+g[l][r-1])%p;\n\t\t\t\tfor(int x=l+1;x<=r;x++){\n\t\t\t\t\tf[l][r]=(f[l][r]+1ll*f[l+1][r]+1ll*g[l+1][r]*(x-l))%p;\n\t\t\t\t\tg[l][r]=(g[l][r]+g[l+1][r])%p;\n\t\t\t\t}\n\t\t\t\tfor(int x=l;x<=r-1;x++){\n\t\t\t\t\tf[l][r]=(f[l][r]+1ll*f[l][r-1]+1ll*g[l][r-1]*(r-x))%p;\n\t\t\t\t\tg[l][r]=(g[l][r]+g[l][r-1])%p;\n\t\t\t\t}\n\t\t\t\tf[l][r]=(f[l][r]+f[l+1][r]*2ll+f[l][r-1]*2ll)%p;\n\t\t\t\tfor(int x=l+1;x<=r-1;x++){\n\t\t\t\t\tf[l][r]=(f[l][r]+1ll*(1ll*f[l][x-1]*g[x+1][r]%p+1ll*f[x+1][r]*g[l][x-1]%p)*(r-l+2)%p*binom(r-l,x-l))%p;\n\t\t\t\t\tf[l][r]=(f[l][r]+1ll*(getsum(x-l)+getsum(r-x))*g[x+1][r]%p*g[l][x-1]%p*binom(r-l,x-l))%p;\n\t\t\t\t\tg[l][r]=(g[l][r]+1ll*g[x+1][r]%p*g[l][x-1]%p*binom(r-l,x-l)%p*(r-l+2))%p;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tans[0][0]=0,sum[0][0]=1;\n\tfor(int i=1;i<=n;i++){\n\t\tfor(int j=i;j<=n;j++)\n\t\t\tfor(int k=0;k<=n;k++){\n\t\t\t\tint t=k+j-i+1; if(t>m) continue;\n\t\t\t\tans[j+1][t]=(ans[j+1][t]+1ll*ans[i-1][k]*g[i][j]%p*binom(t,j-i+1))%p;\n\t\t\t\tans[j+1][t]=(ans[j+1][t]+1ll*f[i][j]*sum[i-1][k]%p*binom(t,j-i+1))%p;\n\t\t\t\tsum[j+1][t]=(sum[j+1][t]+1ll*g[i][j]*sum[i-1][k]%p*binom(t,j-i+1))%p;\n\t\t\t}\n\t\tfor(int j=0;j<=n;j++){\n\t\t\tans[i][j]=(ans[i][j]+ans[i-1][j])%p;\n\t\t\tsum[i][j]=(sum[i][j]+sum[i-1][j])%p;\n\t\t}\n\t}\n\tcout<<(ans[n+1][m]+ans[n][m])%p<<endl;\n}\n//3 2 998244353", "lang": "GNU C++11", "bug_code_uid": "1ecae101b5349de1c70d470fba144a38", "src_uid": "9812de5f2d272511a63ead8765b23190", "apr_id": "1e2c9f55286571b400a66af04a1fbef3", "difficulty": 3100, "tags": ["dp", "fft", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8746081504702194, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "#include <iostream>\nusing namespace std;\n\nint main()\n{\n\tint n;\n\tcin>> n;\n\n\tstring s;\n\twhile(n >= 2)\n\t{\n\t\ts += (n % 2) + '0';\n\t\tn /= 2;\n\t}\n\ts += n + '0';\n\n\tint y = 1 << ((int)s.size() - 1);\n\n\treverse(s.begin(), s.end());\n\tfor(int i = 0; i < s.size(); i ++)\n\t{\n\t\tif(s[i] == '1')\n\t\t\tcout<< y << \" \";\n\t\ty /= 2;\n\t}\n\n\tcout<< endl;\n}", "lang": "GNU C++", "bug_code_uid": "78b9a930336a327e712b061679c5e92f", "src_uid": "757cd804aba01dc4bc108cb0722f68dc", "apr_id": "e01377d27019d5daca7151ed0c975088", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.9261477045908184, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "#include <iostream>\n#include <vector>\n#include <algorithm>\nusing namespace std;\nlong long n,i=1,j=1,v<long long>;\nmain()\n{\ncin>>n;\nwhile (n!=0)\n{\n v.push_back(n%2);\n n=n/2;\n i++;\n}\nfor (j=i; j>0; j--)\n{\n if (v[j]==1)\n cout<<j<<\" \";\n}\n\ncout<<endl;\n}\n", "lang": "GNU C++", "bug_code_uid": "755690ccf0e43b33da20bd6986d56730", "src_uid": "757cd804aba01dc4bc108cb0722f68dc", "apr_id": "79b51786bd3df048cda5b56f6f0e1641", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9970161977834612, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "//Codeforces 135E Weak Subsequence\n#include<fstream>\n#include<iostream>\n#include<cstdlib>\n#include<cstdio>\n#include<cstring>\n#include<algorithm>\nusing namespace std;\n\nconst int mod=1000000007;\nint f[1000005];\nint re[1000005];\nint g[1000005];\nint r[]={1,682498929,491101308,76479948,723816384,67347853,27368307,625544428,199888908,888050723,927880474,281863274,661224977,623534362,970055531,261384175,195888993,66404266,547665832,109838563,933245637,724691727,368925948,268838846,136026497,112390913,135498044,217544623,419363534,500780548,668123525,128487469,30977140,522049725,309058615,386027524,189239124,148528617,940567523,917084264,429277690,996164327,358655417,568392357,780072518,462639908,275105629,909210595,99199382,703397904,733333339,97830135,608823837,256141983,141827977,696628828,637939935,811575797,848924691,131772368,724464507,272814771,326159309,456152084,903466878,92255682,769795511,373745190,606241871,825871994,957939114,435887178,852304035,663307737,375297772,217598709,624148346,671734977,624500515,748510389,203191898,423951674,629786193,672850561,814362881,823845496,116667533,256473217,627655552,245795606,586445753,172114298,193781724,778983779,83868974,315103615,965785236,492741665,377329025,847549272,698611116,0};\nint k,w;\n\nint po(int a,int b)\n{\n    if(b==0) return 1;\n    long long x=po(a,b/2);\n    x=x*x%mod;\n    if(b%2==1) x=x*a%mod;\n    return x;\n}\n\ninline int sqr(int x)\n{\n    return (long long)x*x%mod;\n}\n\nint work(int k,int w,int u)\n{\n    long long ans=0;\n    int t=po(k,w-k);\n    for(int n=w+k;n>u;n--)\n    {\n        if(w+w-n<=0) t=po(k,w+w-n);\n        if(n<=2*w) ans+=po(k,w+w-n)*(long long)sqr(f[k])%mod*sqr(re[k-n+w])%mod;\n        else ans+=f[k]*(long long)(k-n+w+w-u==-1?f[k-n+w+w]:g[k-n+w+w-u])%mod*sqr(re[k-n+w])%mod;\n        t=t*(long long)k%mod;\n    }\n    return ans%mod;\n}\n\nint main()\n{\n    f[0]=1;\n    for(int i=1;i<=1000000;i++) f[i]=f[i-1]*(long long)i%mod;\n    cin>>k>>w;\n    g[0]=r[w/10000000];\n    for(int i=w/10000000*10000000+1;i<=w;i++) g[0]=g[0]*(long long)i%mod;\n    \n    for(int i=1;i<=1000000;i++) g[i]=g[i-1]*(long long)(w+i)%mod;\n    for(int i=0;i<=k;i++) re[i]=po(f[i],mod-2);\n    cout<<(work(k,w,w)-work(k,w-1,w)+mod)%mod<<endl;\n    \n    return 0;\n}\n/*\nSample Input1:\n2 2\nSample Output1:\n10\n\nSample Input2:\n3 5\nSample Output2:\n1593\n\nSample Input3:\n2 139\nSample Output3:\n717248223\n*/\n", "lang": "GNU C++", "bug_code_uid": "16012fc95746414968a9397095ba78b3", "src_uid": "b715f0fdc83ec539eb3ae2b0371ee130", "apr_id": "9827d24567f013d5bd095f39e045e5c9", "difficulty": 3000, "tags": ["combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9575885033298283, "equal_cnt": 11, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 10, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n#define int long long\n#define ii pair<int, int>\n#define vi vector<int>\n#define pb emplace_back\n#define sz(x) (int)x.size()\n#define all(v) v.begin(), v.end()\n#define x first\n#define y second\n#define rep(i, j, k) for(i=j; i<k; i++)\n#define sep(i, j, k) for(i=j; i>k; i--)\nconst int N = 5e3+5, inf = 998244353;\nint n, k, i, j;\nint in[N], f[N];\ninline int expo(int n, int k, int p = inf) {int r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}\ninline int inv(int a, int p = inf) {return expo(a, p - 2, p);}\ninline int cc(int a, int b){ if(a<b || b<0) return 0; return f[a]*in[b]%inf*in[a-b]%inf; }\nvoid fac(){ int i; f[0] = 1; rep(i, 1, N) f[i] = f[i-1]*i%inf; in[N-1] = inv(f[N-1]); sep(i, N-1, 0) in[i-1] = i*in[i]%inf; }\n\nint util(int num, int rem, int mx){\n    if(num*mx<rem) return 0;\n    int ans = 0;\n    for(int j=0; j<=num; j++){\n        int distribute = rem - (mx+1)*j;\n        int ways = cc(num, j)*cc(num+distribute-1, num-1)%inf;\n        if(j&1) ans -= ways;\n        else ans += ways;\n    }\n    return ans%inf;\n}\n\nsigned main()\n{\n    ios_base::sync_with_stdio(false); cin.tie(0);\n    int i, j, a, b, ans = 0;\n    fac();\n    cin>>n>>s>>r;\n    rep(i, r, s+1)\n        rep(j, 1, s/i+1)\n            ans += util(n-j, s-j*i, i-1)*cc(n-1, j-1)%inf*in[j]%inf;\n    ans = ans%inf+inf;\n    cout<<ans%inf;\n}", "lang": "GNU C++14", "bug_code_uid": "392f083b93b3ebd33696273e3f7eb325", "src_uid": "609195ef4a970c62a8210dafe118580e", "apr_id": "77e1b4d74f0fc7ce6488d5c5d79328a1", "difficulty": 2500, "tags": ["dp", "math", "combinatorics", "probabilities"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9977139954279909, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include <iostream>\n#include <sstream>\n#include <iomanip>\n#include <vector>\n#include <string>\n#include <map>\n#include <set>\n#include <algorithm>\n#include <numeric>\n#include <iterator>\n#include <functional>\n#include <complex>\n#include <queue>\n#include <stack>\n#include <cmath>\n#include <cassert>\n#include <tuple>\nusing namespace std;\ntypedef long long LL;\ntypedef complex<double> CMP;\n\nstatic const LL INF = 0x3fffffffffffffffLL;\n\ntemplate<typename T>\nvector<T> MATMUL(const vector< vector<T> >& a, const vector<T>& v)\n{\n\tint N = a.size();\n\tvector<T> u(N, INF);\n\tfor(int i=0; i<N; ++i)\n\tfor(int j=0; j<N; ++j)\n\t\tu[i] = min(u[i], a[i][j]+v[j]);\n\treturn u;\n}\n\ntemplate<typename T>\nvector< vector<T> > MATMUL(const vector< vector<T> >& a, const vector< vector<T> >& b)\n{\n\tint N = a.size();\n\tvector< vector<T> > c(N, vector<T>(N, INF));\n\tfor(int i=0; i<N; ++i)\n\tfor(int j=0; j<N; ++j)\n\tfor(int k=0; k<N; ++k)\n\t\tc[i][j] = min(c[i][j], a[i][k]+b[k][j]);\n\treturn c;\n}\n\ntemplate<typename T>\nvector<T> MATPOWMUL(vector< vector<T> > a, LL e, vector<T> v)\n{\n\tfor(; e; e>>=1, a=MATMUL(a,a))\n\t\tif(e&1)\n\t\t\tv = MATMUL(a, v);\n\treturn v;\n}\n\nint solve(const vector<int>& a, const vector<int>& b, int n, int m)\n{\n\tvector<vector<LL>> blk(n+1, vector<LL>(n+1, INF));\n\n\tfor(int pat=0; pat<(1<<n); ++pat)\n\t{\n\t\tint cur=0, bot=0, cost=0;\n\t\tfor(int i=0; i<n; ++i)\n\t\t\tif(pat & (1<<i))\n\t\t\t\tcur++, cost+=a[i];\n\t\t\telse\n\t\t\t\tbot=min(bot, --cur), cost+=b[i];\n\t\tblk[0-bot][cur-bot] = min(blk[0-bot][cur-bot], cost);\n\t}\n\n\tvector<vector<LL>> M(2*n, vector<int>(2*n, INF));\n\tfor(int s=0; s<2*n; ++s)\n\t\tfor(int bs=0; bs<=n; ++bs)\n\t\tfor(int be=0; be<=n; ++be) {\n\t\t\tint e = s-bs+be;\n\t\t\tif(bs<=s && 0<=e && e<2*n)\n\t\t\t\tM[e][s] = min(M[e][s], blk[bs][be]);\n\t\t}\n\n\tvector<LL> V(2*n, INF);\n\tV[0] = 0;\n\n\tV = MATPOWMUL(M, m, V);\n\treturn (int)V[0];\n}\n\nint main()\n{\n\tfor(int n,m; cin>>n>>m; )\n\t{\n\t\tvector<int> a(n), b(n);\n\t\tfor(int& ai: a) cin>>ai;\n\t\tfor(int& bi: b) cin>>bi;\n\t\tcout << solve(a, b, n, m) << endl;\n\t}\n}\n", "lang": "GNU C++0x", "bug_code_uid": "01401582753b9ca4f8250ffcf06da3c8", "src_uid": "f40900973f4ebeb6fdafd75ebe4e9601", "apr_id": "fed905847eb4bfb1d1dca1b5b170e831", "difficulty": 2500, "tags": ["matrices", "dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9295673936360386, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "#include <iostream>\n#include <map>\n#include <vector>\n\nusing map_type = std::map<int, int64_t>;\nusing vector_type = std::vector<int>;\n\nint count(const vector_type& arr, size_t start, size_t end) {\n    int res = 0;\n    for (int i = start; i <= end; ++i) {\n        if (arr[i] == 0)\n            res += 1;\n        else\n            res -= 1;\n    }\n    return res;\n}\n\nint solution(const vector_type& arr) {\n    vector_type prefix_arr;\n    prefix_arr.reserve(arr.size() + 1);\n    int s = 0;\n    int max = 0;\n    prefix_arr.push_back(s);\n    for (auto a : arr) {\n        s += 1 - a;\n        max += a;\n        prefix_arr.push_back(s);\n    }\n\n//    int max = arr.size() - prefix_arr.back();\n\n    int val = max;\n    for (int i = 0; i < arr.size(); ++i) {\n//        if (arr[i] == 0) {\n            for (int j = i; j < arr.size(); ++j) {\n//                if (arr[j] == 1)\n//                    continue;\n\n//                int v = max + 2 * (prefix_arr[j + 1] - prefix_arr[i]) - (j - i + 1);\n                int v = max + count(arr, i, j);\n                if (v > val) {\n                    val = v;\n                }\n            }\n//        }\n    }\n    return val;\n}\n\nint main()\n{\n    int n;\n    std::cin >> n;\n    vector_type arr;\n    for (int i = 0; i < n; ++i) {\n        int val;\n        scanf(\"%d\", &val);\n        arr.push_back(val);\n    }\n\n    std::cout << solution(arr);\n\n    return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "1575c800c8ac44bc86f35bd4429de53c", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "apr_id": "9a9c8c377cc1e144ac84a89154daeab1", "difficulty": 1200, "tags": ["dp", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8336325553560742, "equal_cnt": 21, "replace_cnt": 8, "delete_cnt": 8, "insert_cnt": 4, "fix_ops_cnt": 20, "bug_source_code": "/*\nID: duongthan4\nLANG: C++\nTASK: test\n*/\n#include <iostream>\n#include <vector>\n#include <stack>\n#include <set>\n#include <map>\n#include <queue>\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n#include <algorithm>\n#include <bitset>\n#define FOR(i,n) for (int i=0;i<n;i++)\n#define FORF(i,a,n) for (int i=a;i<=n;i++)\n#define FORR(i,n) for (int i=n-1;i>=0;i--)\n#define RI(a) scanf(\"%d\", &a);\n#define RS(a) scanf(\"%s\", &a);\n#define RC(a) scanf(\"%c\", &a);\n#define pb push_back\n#define mp make_pair\n#define fi first\n#define se second\n#define all(a) a.begin(),a.end()\n#define pii pair<int,int>\n#define piii pair<pair<int,int>,int>\n#define INFY 1000000000\n#define MAXN 100000\nusing namespace std;\ntypedef long long LL;\n\nshort f[MAXN];\nvector <int> a[MAXN];\n//vector <int> b[MAXN];\n\nshort r1[MAXN];\nshort r2[MAXN];\n\nvoid com1(int k){\n    if(f[k]==1) r1[k]=1;\n    FOR(i, a[k].size()){\n        if(r1[a[k][i]]<0) {\n            r1[a[k][i]]=1;\n            com1(a[k][i]);\n        }\n    }\n}\n\nint com2(int k){\n    if(r2[k]>=0) return r2[k];\n    FOR(i, a[k].size()){\n        if(com2(a[k][i])==1 && f[a[k][i]]!=1) {\n            r2[k]=1;\n            return 1;\n        }\n    }\n    r2[k]=0;\n    return 0;\n}\n\nint main(){\n    int n, m, u, v;\n    RI(n);RI(m);\n    FOR(i, n){\n        RI(f[i]);\n        r1[i] = r2[i] = -1;\n        if(f[i]==2) r2[i]=1;\n    }\n    FOR(i, m){\n        RI(u);RI(v);\n        u--;v--;\n        a[u].pb(v);\n        //b[v].pb(u);\n    }\n    if(n>1000) return;\n    FOR(i, n){\n        com1(i);\n        com2(i);\n    }\n    //FOR(i, n) cout<<r1[i]<<\" \"<<r2[i]<<endl;\n    FOR(i, n){\n        if(r1[i]==1 && r2[i]==1) printf(\"1\\n\");\n        else printf(\"0\\n\");\n    }\n    return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "8aed7ae1a25e47a5fa1233c963e013a4", "src_uid": "87d869a0fd4a510c5e7e310886b86a57", "apr_id": "5c2c4e7445121ef75eb6cafad2a0ed7e", "difficulty": 1700, "tags": ["graphs"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8910154173312068, "equal_cnt": 11, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 5, "fix_ops_cnt": 10, "bug_source_code": "#include <bits/stdc++.h>\n\nusing namespace std;\n\nconst int N=1e5+5;\n\nvector<int>a,b;\nint arr[45],tmp[45];\nint k,n,m;\nvoid go(int i=0,int sum=0)\n{\n    if(i==k)\n    {\n        a.push_back(sum);\n        return;\n    }\n    go(i+1,sum);\n    go(i+1,(sum+tmp[i])%m);\n}\nint solve(int sum)\n{\n    int s=0,e=a.size()-1,mid;\n    while(s<e)\n    {\n        mid=(s+e+1)/2;\n        if(sum+a[mid]<mid) s=mid;\n        else e=mid-1;\n    }\n    return max((sum+a[s])%m,(sum+a[a.size()-1])%m);\n}\nint main()\n{\n    cin>>n>>m;\n    for(int i=0;i<n;i++) cin>>arr[i];\n    int mid=(n/2);\n    for(int i=0;i<=mid;i++) tmp[i]=arr[i];\n    k=mid+1;\n    go();\n    b=a;\n    a.clear();\n    for(int i=mid+1;i<n;i++) tmp[i]=arr[i];\n    k=n;\n    go();\n    sort(a.begin(),a.end());\n    sort(b.begin(),b.end());\n    int ans=0;\n    for(int i=0;i<b.size();i++)\n    {\n        ans=max(ans,solve(b[i]));\n    }\n    cout<<ans<<endl;\n    return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "974b9e6bcb9b5507ecf146e2b98f7972", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "apr_id": "8c1c9394375ac21010511d6d2a967e3b", "difficulty": 1800, "tags": ["divide and conquer", "meet-in-the-middle", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.30248618784530384, "equal_cnt": 22, "replace_cnt": 13, "delete_cnt": 4, "insert_cnt": 6, "fix_ops_cnt": 23, "bug_source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint main()\n{\n    int n;\n    while(~scanf(\"%d\",&n))\n    {\n        int i,a[105];\n        int x,y,z=0,k=0;\n        for(i=1;i<=n;i++)\n        {\n            scanf(\"%d\",&a[i]);\n            if(a[i]==1)k++;\n        }\n        if(k==n)\n        {\n            printf(\"%d\\n\",n-1);\n            continue;\n        }\n        for(i=1;i<=n;i++)\n        {\n            if(a[i]==0)\n            {\n                x=i;break;\n            }\n        }\n        for(i=n;i>=1;i--)\n        {\n            if(a[i]==0)\n            {\n                y=i;break;\n            }\n        }\n        for(i=x;i<=y;i++)\n        {\n            if(a[i]==0)a[i]=1;\n            else if(a[i]==1)a[i]=0;\n        }\n        for(i=1;i<=n;i++)\n        {\n            if(a[i]==1)z++;\n        }\n        printf(\"%d\\n\",z);\n    }\n    return 0;\n}\n\n  \t\t\t\t\t  \t \t  \t \t \t\t  \t \t", "lang": "GNU C++", "bug_code_uid": "35d7795c4adaa383fb81a9b0131eafca", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "apr_id": "90a6bb0dd10ce3b9df9dbd3c9da8cfde", "difficulty": 1200, "tags": ["dp", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.925531914893617, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "#include<iostream>\n#include<cmath>\nusing namespace std;\nint main ()\n{\n    int n,a,b; cin>>n;\n    int lest;\n    for(a=0;a<n;++a)\n    {\n        if(n%a==0)\n        {\n            b=n/a;\n            if(a<=b){lest=a;}\n            else break;\n        }\n    }\n    cout<<lest<<\" \"<<n/lest;\n}", "lang": "GNU C++14", "bug_code_uid": "cdba07fd6a0e050098314c6e9c07e7a9", "src_uid": "f52af273954798a4ae38a1378bfbf77a", "apr_id": "acda8dd5f401cf0ce84ed356df2a6bd1", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.4230769230769231, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "#include <bits/stdc++.h>\n#define pb push_back\n#define mp make_pair\n#define sz(a) a.size()\n#define re return\n#define all(a) a.begin(),a.end()\n#define int long long\nusing namespace std;\nconst int dx[4]={-1,1,0,0};\nconst int dy[4]={0,0,-1,1};\nint a[1000005];\nint c;\nvoid make(int x,int y,int d){\n\tfor (int i=0;i<(1<<d);i++){\n\t\tint rlt=0;\n\t\tfor (int j=0;j<d;j++){\n\t\t\tif (i&(1<<j))\n\t\t\t\trlt=rlt*10+x;\n\t\t\telse\n\t\t\t\trlt=rlt*10+y;\n\t\t}\n\t\ta[c++]=rlt;\n\t}\n}\nsigned main()\n{\n\tint n;\n\tcin>>n;\n\tfor (int i=0;i<10;i++)\n\t\tfor (int j=0;j<10;j++)\n\t\t\tfor (int k=0;pow(10,k)<=n;k++)\n\t\t\t\tmake(i,j,k);\n\tsort(a,a+c);\n\tc=unique(a,a+c)-a;\n\tint ans=lower_bound(a,a+c,n+1)-a;\n\tfor (int i=0;i<c;i++)  cout<<a[i]<<'\t';cout<<'\\n';\n\tif (n!=1000000000)  ans--;\n\tcout<<ans;\n\twhile (1);\n\tre 0;\n}\n//undoubtedly lucky numbers\n", "lang": "GNU C++11", "bug_code_uid": "6130e9249617b5cc856c9fcd4e473bfc", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "apr_id": "040a8ac35285cadc044ea2af17f01bff", "difficulty": 1600, "tags": ["dfs and similar", "brute force", "bitmasks"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8062534896705751, "equal_cnt": 16, "replace_cnt": 9, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 15, "bug_source_code": "#include<stdio.h>\n#include<cstdlib>\n#include<string>\n#include<cstring>\n#include<algorithm>\n#include<iostream>\n#include<vector>\n#include<math.h>\n#include<iomanip>\n#include<map>\nusing namespace std;\nconst long long int big= 1000000009;\n#define ciofast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)\n#define pb push_back\n#define sortv(v) sort(v.begin(),v.end())\n#define ci1(a) cin >> a\n#define ci2(a,b) cin >> a >> b\n#define ci3(a,b,c) cin >> a >> b >> c\n#define ci4(a,b,c,d) cin >> a >> b >> c >> d\n#define c1(a) cout << a\n#define c2(a,b) cout << a << \" \" << b \n#define c3(a,b,c) cout << a <<\" \"<< b << \" \" << c\n#define sp(x) setprecision(x)\n#define ll long long \n#define lli long long int\n#define mp make_pair\ntypedef vector<string> vs;\ntypedef vector<long long int> vl;\ntypedef vector<pair<lli,lli> > vp; \n#define r0 return 0\n#define r1 return 1\n#define f(i,p,n) for(i=p;i<n;i++) \n#define mem(arr,x) memset(arr,x,sizeof(arr)) \nint main()\n\t{\n\tciofast;\n\tlli n;\n\tci1(n);\n\tvl v;\n\tfor(int i=1;i<=99;i++)\n\t{\n\t\tv.pb(i);\n\t\tif(i == n)\n\t\t{\n\t\t\tc1(v.size());\n\t\t\tr0;\n\t\t}\n\t}\t\n\tfor(int i=3;i<=9;i++)\n\t{\n\t\tlli copy = v.size()-1;\n\t\tfor(int j=copy;j>=0;j--)\n\t\t{\n\t\t\tlli digits = 0;\n\t\t\tint x = log10(v[j]);\n\t\t\tdigits=x+1;\n\t\t\tif(digits == i-1 && digits >= 2)\n\t\t\t{\n\t\t\t\tlli fi=0,se=0;\n\t\t\t\tlli a = pow(10,digits-1);\n\t\t\t\tlli b = pow(10,digits-2);\n\t\t\t\tfi=v[j]/a;\n\t\t\t\tse=v[j]/b;\n\t\t\t\tse=(se)%(10);\n\t\t\t\tif(fi == se)\n\t\t\t\t{\n\t\t\t\t\tfor(int k=0;k<=9;k++)\n\t\t\t\t\t{\n\t\t\t\t\t\tv.pb((10*v[j])+k);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tv.pb((10*v[j])+fi);\n\t\t\t\t\tv.pb((10*v[j])+se);\t\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\t\n\t}\n\tv.pb(pow(10,9));\n\tlli count = 0;\n\tfor(int i=0;i<v.size();i++)\n\t{\n\t\tif(n >= v[i])\n\t\t{\n\t\t\tcount++;\n\t\t}\n\t}\n\tc2(count,endl);\n\treturn 0;\n\t}", "lang": "GNU C++11", "bug_code_uid": "9676f62fee79508b39110a23ffef3bc6", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "apr_id": "4a80aa59076f68e5660c88adf7be8ad8", "difficulty": 1600, "tags": ["dfs and similar", "brute force", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.13875676562243727, "equal_cnt": 67, "replace_cnt": 39, "delete_cnt": 22, "insert_cnt": 6, "fix_ops_cnt": 67, "bug_source_code": "#include <iostream>\n#include <cstdio>\n#include <cstring>\n#define Order(p) (p.first)\n#define Pos(p) (p.second.first)\n#define Value(p) (p.second.second)\n#define mp make_pair\nusing namespace std;\n\ntypedef pair<int, pair<int, int> > pii;\nconst int MAX = 1000000 + 2;\nbool vis[MAX];\nint ans[MAX];\nint top = 0;\n\nclass Treap\n{\n\tprivate:\n\tstruct node {\n\t\tpii val;\n\t\tint key;\n\t\tint size;\n\t\tnode *child[2];\n\t\t\n\t\tint rnd() {\n\t\t\tstatic int KEY = 12345678;\n\t\t\treturn KEY += KEY << 2 | 1;\n\t\t}\n\t\t\n\t\tnode(pii _val, node *c) {\n\t\t\tval = _val;\n\t\t\tkey = rnd();\n\t\t\tchild[0] = child[1] = c;\n\t\t\tsize = 1;\n\t\t}\n\t\t\n\t\tvoid rz() {\n\t\t\tsize = child[0]->size + child[1]->size + 1;\n\t\t}\n\t};\n\t\n\tnode *root, *Null;\n\tvoid rotate(node *&t, bool d);\n\tvoid _insert(node *&t, pii x);\n\tvoid _del(node *&t, pii x);\n\tpii _kth(node *&t, int x);\n\t\n\tpublic:\n\tTreap();\n\tvoid insert(pii x);\n\tvoid del(pii x);\n\tpii kth(int x);\n\tint size();\n\tpii Min();\n} T;\n\nvoid Treap::rotate(node *&t, bool d)\n{\n\tnode *p = t->child[d];\n\tt->child[d] = p->child[!d];\n\tp->child[!d] = t;\n\tt->rz();\n\tp->rz();\n\tt = p;\n}\n\nvoid Treap::_insert(node *&t, pii x)\n{\n\tif (t == Null) {\n\t\tt = new node(x, Null);\n\t}\n\telse {\n\t\tbool d = x > t->val;\n\t\t_insert(t->child[d], x);\n\t\tif (t->child[d]->key < t->key) {\n\t\t\trotate(t, d);\n\t\t}\n\t\telse {\n\t\t\tt->rz();\n\t\t}\n\t}\n}\n\nvoid Treap::_del(node *&t, pii x)\n{\n\tif (t != Null) {\n\t\tif (t->val == x) {\n\t\t\tbool d = t->child[0]->key > t->child[1]->key;\n\t\t\tif (t->child[d] == Null) {\n\t\t\t\tdelete t;\n\t\t\t\tt = Null;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\trotate(t, d);\n\t\t\t_del(t->child[!d], x);\n\t\t}\n\t\telse {\n\t\t\tbool d = x > t->val;\n\t\t\t_del(t->child[d], x);\n\t\t}\n\t\tt->rz();\n\t}\n}\n\npii Treap::_kth(node *&t, int x)\n{\n\tint r = t->child[0]->size;\n\tif (x == r) {\n\t\treturn t->val;\n\t}\n\telse if (x < r) {\n\t\treturn _kth(t->child[0], x);\n\t}\n\telse {\n\t\treturn _kth(t->child[1], x - r - 1);\n\t}\n}\n\nTreap::Treap()\n{\n\tNull = new node(pii(0, mp(0, 0)), 0);\n\tNull->size = 0;\n\tNull->key = INT_MAX;\n\tNull->child[0] = Null->child[1] = Null;\n\troot = Null;\n}\n\nvoid Treap::insert(pii x)\n{\n\t_insert(root, x);\n}\n\nvoid Treap::del(pii x)\n{\n\t_del(root, x);\n}\n\npii Treap::kth(int x)\n{\n\treturn _kth(root, x);\n}\n\nint Treap::size()\n{\n\treturn root->size;\n}\n\npii Treap::Min()\n{\n\tnode *p = root;\n\twhile (p->child[0] != Null) {\n\t\tp = p->child[0];\n\t}\n\treturn p->val;\n}\n\nvoid run()\n{\n\tmemset(vis, 0, sizeof(vis));\n\twhile (T.size()) {\n\t\tpii k = T.Min();\n\t\tans[Pos(k)] = Value(k);\n\t\tif (~Value(k)) {\n\t\t\tvis[Value(k)] = true;\n\t\t}\n\t\tT.del(k);\n\t}\n}\n\nvoid print(int i)\n{\n\tstatic int p = 1;\n\tif (~ans[i]) {\n\t\tprintf(\"%d\", ans[i]);\n\t}\n\telse {\n\t\twhile (vis[p]) {\n\t\t\tp++;\n\t\t}\n\t\tprintf(\"%d\", p++);\n\t}\n}\n\nint main(void)\n{\n\tint n, m, i, x, y;\n\tcin >> n >> m;\n\tfor (i = 1; i <= n; i++) {\n\t\tT.insert(pii(i, mp(i, -1)));\n\t}\n\t\n\twhile (m--) {\n\t\tscanf(\"%d%d\", &x, &y);\n\t\tpii k = T.kth(y - 1);\n\t\tif (Value(k) == -1) {\n\t\t\tif (vis[x]) {\t//\ufffd\ufffd\ufffd\u06b6\ufffd\ufffd\u03b3\ufffd\ufffd\ufffd\u0133\ufffd\ufffd\u05b5\u02b1\ufffd\ufffd\ufffd\ufffd\u05b5\ufffd\ufffd\u04e6\ufffd\ufffd\u052d\u02bc\u03bb\ufffd\ufffd\ufffd\u047e\ufffd\u0237\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u04b2\ufffd\ufffd\ufffd\ufffd\ufffd\u03bb\ufffd\u00e3\ufffd\u00ec\ufffd\ufffd \n\t\t\t\tputs(\"-1\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tvis[x] = true;\n\t\t\t}\n\t\t}\n\t\telse if (Value(k) != x) {\t//\ufffd\ufffd\u03bb\ufffd\ufffd\ufffd\ufffd\u0237\ufffd\ufffd\u05b5\ufffd\ufffd\ufffd\ufffd\u03aax \n\t\t\tputs(\"-1\");\n\t\t\treturn 0;\n\t\t}\n\t\t//top--\ufffd\ufffd\u05a4\ufffd\u00f5\ufffd\ufffd\ufffd\u03aa\ufffd\ufffd\u04bb\ufffd\ufffd\u03bb\ufffd\u00f2\ufffd\ufffd\ufffd\t\t\n\t\t//\ufffd\ufffd\u0237\ufffd\ufffdPos(k)\u03bb\ufffd\ufffd\u05b5\u03aax \n\t\tT.insert(pii(top--, mp(Pos(k), x)));\t\t\t\t\t\t\t\t\t\t\t\t\n\t\tT.del(k);\t//\u027e\ufffd\ufffd\u052d\ufffd\ufffd\ufffd \t\t\n\t}\n\t\n\trun();\n\tfor (i = 1; i < n; i++) {\n\t\tprint(i);\n\t\tputchar(' ');\n\t}\n\tprint(n);\n\tputchar('\\n');\n\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "efbfb625c44cee89676bba7789a590de", "src_uid": "a2616b1681f30ce4b2a5fdc81cf52b50", "apr_id": "09a0040bd847e66cd116b464fc8fa4f5", "difficulty": 2200, "tags": ["data structures"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9987948903350204, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#include <iostream>\n#include <stdio.h>\n#include <string.h>\n#include <algorithm>\nusing namespace std;\n\n#define Max(a,b) (((a)>(b))?(a):(b))\nconst int maxn=1000005;\n\ntemplate<typename T>\nstruct Myset {\n    struct Node{\n        int sz, hei;\n        Node *son[2];\n        T val;\n\n        Node():sz(1), hei(1) { son[0]=son[1]=NULL; }\n    } *root;\n\n    Myset():root(NULL) {}\n\n    int height(Node *&node) {\n        return (NULL==node)?0:node->hei;\n    }\n\n    int size(Node *&node) {\n        return (NULL==node)?0:node->sz;\n    }\n    \n    void fix(Node *&node) {\n        node->hei=Max(height(node->son[0]), \n                    height(node->son[1]))+1;\n        node->sz=size(node->son[0])+size(node->son[1])+1;\n    }\n\n    void rotate(Node *&node, int rodir) {\n        Node *pivot=node->son[1-rodir];\n        node->son[1-rodir]=pivot->son[rodir];\n        pivot->son[rodir]=node;\n        if (node==root) root=pivot;\n        node=pivot;\n\n        fix(node->son[rodir]);\n        fix(node);\n    }\n\n    void balance(Node *&node) {\n        int dif=height(node->son[1])-height(node->son[0]);\n        if (dif<-1 || dif>1) {\n            int rodir=(dif>0)?0:1, dir=1-rodir;\n            if (height(node->son[dir]->son[1-dir])\n                -height(node->son[dir]->son[dir])>1)\n                rotate(node->son[dir], dir);\n            rotate(node, rodir);\n        }\n    }\n\n    void insert(T &val, Node *&node) {\n        if (NULL==node) {\n            node=new Node();\n            node->val=val;\n            return;\n        }\n        if (val<=node->val) insert(val, node->son[0]);\n        else insert(val, node->son[1]);\n        fix(node);\n        // balance(node);\n    }\n\n    void erase(T &val, Node *&node) {\n        if (NULL==node) return;\n        if (val==node->val) {\n            if (NULL==node->son[0]) {\n                if (root==node) root=node=node->son[1];\n                else node=node->son[1];\n                return;\n            } else if (NULL==node->son[1]) {\n                if (root==node) root=node=node->son[0];\n                else node=node->son[0];\n                return;\n            } else if (NULL==node->son[0] && NULL==node->son[1]) {\n                node=NULL;\n                return;\n            }\n            \n            Node *suc=node->son[1], *sucPa=node;\n            while (NULL!=suc->son[0]) { sucPa=suc; suc=suc->son[0]; }\n            swap(suc->val, node->val);\n            sucPa->son[0]=NULL;\n            erase(val, node->son[1]);\n        } \n        else if (val<node->val) erase(val, node->son[0]);\n        else erase(val, node->son[1]);\n        fix(node);\n        // balance(node);\n    }\n\n    T valAt(int rnk, Node *&node) {\n        if (rnk>size(node)) return T();\n        if (rnk<=size(node->son[0])) return valAt(rnk, node->son[0]);\n        else if (rnk==1+size(node->son[0])) return node->val;\n        else return valAt(rnk-1-size(node->son[0]), node->son[1]);\n    }\n\n    void insert(T val) { insert(val, root); }\n    void erase(T val) { erase(val, root); }\n    T valAt(int rnk) { return valAt(rnk, root); }\n};\n\nMyset<int> pos;\nMyset<pair<int,int> > rec;\nint vis[maxn], ans[maxn];\n\nint main() {\n    // freopen(\"in.txt\", \"r\", stdin);\n\n    int n, m;\n    scanf(\"%d%d\", &n, &m);\n    memset(vis, 0, sizeof(vis));\n    memset(ans, -1, sizeof(ans));\n    for (int i=1; i<=n; ++i) pos.insert(i);\n\n    int sum=0;\n    while (m--) {\n        int x, y;\n        scanf(\"%d%d\", &x, &y);\n        if (!vis[x]) {\n            if (y<=sum) { printf(\"-1\\n\"); return 0; }\n            ans[pos.valAt(y-sum)]=x;\n            rec.insert(make_pair(m,x));\n            pos.erase(pos.valAt(y-sum));\n            vis[x]=1;\n            ++sum;\n        } else {\n            if (y>rec.size(rec.root) || rec.valAt(y).second!=x) {\n                printf(\"-1\\n\"); return 0;\n            }\n            rec.erase(rec.valAt(y));\n            rec.insert(make_pair(m,x));\n        }\n    }\n    int j=1;\n    for (int i=1; i<=n; ++i) {\n        if (-1==ans[i]) {\n            while (vis[j]) ++j;\n            vis[j]=1;\n            ans[i]=j;\n        }\n    }\n    for (int i=1; i<=n; ++i) {\n        if (i-1) printf(\" \");\n        printf(\"%d\", ans[i]);\n    }\n    printf(\"\\n\");\n    return 0;\n}", "lang": "GNU C++", "bug_code_uid": "a7cfceea62a412958dc0d7731728de60", "src_uid": "a2616b1681f30ce4b2a5fdc81cf52b50", "apr_id": "dff9d9ea7a1c66f655c26ee06a966242", "difficulty": 2200, "tags": ["data structures"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.982146013788227, "equal_cnt": 10, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "#include <iostream>\nusing namespace std;\n\nint n, m, x, y;\n\nvoid init(int *itChecked, int *itDistinc, int *posIT, int lef, int rig, int k){\n    itChecked[k] = 0;\n    itDistinc[k] = 0;\n    if (lef == rig){\n        posIT[lef] = k;\n        return;\n    }\n    init(itChecked, itDistinc, posIT, lef, (lef + rig) >> 1, k << 1);\n    init(itChecked, itDistinc, posIT, ((lef + rig) >> 1) + 1, rig, (k << 1) + 1);\n}\n\nvoid update(int *it, int posIT, int val){\n    while (posIT){\n        it[posIT] += val;\n        posIT >>= 1;\n    }\n}\n\nint find(int *itChecked, int lef, int rig, int k, int vt){\n    if (lef == rig)\n        return lef;\n\n    int mid = (rig + lef) >> 1;\n    if (mid + itChecked[(k << 1) + 1] < vt)\n        return find(itChecked, mid + 1, rig, (k << 1) + 1, vt);\n    else\n        return find(itChecked, lef, mid, k << 1, vt - itChecked[(k << 1) + 1]);\n}\n\nint get(int *it, int lef, int rig, int u, int v, int k){\n    if (u > v)\n        return 0;\n    if (lef == u && rig == v)\n        return it[k];\n\n    int mid = (lef + rig) >> 1;\n    if (v <= mid)\n        return get(it, lef, mid, u, v, k << 1);\n    else\n    if (u > mid)\n        return get(it, mid + 1, rig, u, v, (k << 1) + 1);\n    else\n        return get(it, lef, mid, u, mid, k << 1) + get(it, mid + 1, rig, mid + 1, v, (k << 1) + 1);\n}\n\nint main(){\n    ios_base::sync_with_stdio(false);\n    cin >> n >> m;\n    int *itChecked = new int[5 * n];\n    int *itDistinc = new int[5 * n];\n    int *posIT = new int[n + 1];\n    int *posElement = new int[n + 1];\n    bool *exist = new bool[n + 1];\n    int *res = new int[n + 1];\n    for (int i = 1; i <= n; i++){\n        res[i] = 0;\n        exist[i] = false;\n        posElement[i] = 0;\n    }\n\n    init(itChecked, itDistinc, posIT, 1, n, 1);\n    for (int i = 1; i <= m; i++){\n        cin >> x >> y;\n        exist[x] = true;\n        update(itDistinc, posIT[i], 1);\n        if (posElement[x]){\n            update(itDistinc, posIT[posElement[x]], -1);\n            if (get(itDistinc, 1, n, posElement[x] + 1, i - 1, 1) == y - 1){\n                posElement[x] = i;\n                continue;\n            }\n            else{\n                cout << -1;\n                return 0;\n            }\n        }\n\n        int vt = find(itChecked, 1, n, 1, y);\n        if (vt + get(itChecked, 1, n, vt + 1, n, 1) != y || res[vt]){\n            cout << -1;\n            return 0;\n        }\n\n        res[vt] = x;\n        update(itChecked, posIT[vt], 1);\n        posElement[x] = i;\n    }\n    int j = 1;\n    for (int i = 1; i <= n; i++){\n        if (res[i] == 0){\n            while (exist[j++]);\n            res[i] = j - 1;\n        }\n        cout << res[i] << \" \";\n    }\n\n    delete[] itChecked;\n    delete[] itDistinc;\n    delete[] posIT;\n    delete[] posElement;\n    delete[] exist;\n    delete[] res;\n    return 0;\n}", "lang": "GNU C++", "bug_code_uid": "92843e1530628a49126075e53d88b0cd", "src_uid": "a2616b1681f30ce4b2a5fdc81cf52b50", "apr_id": "6df18fe7a6d0a450c7ba9db33197e43e", "difficulty": 2200, "tags": ["data structures"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9987235128925198, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#pragma GCC optimize(\"no-stack-protector,Ofast\")\n#include<bits/stdc++.h>\nusing namespace std;\n\nunsigned int seed=880301;\nint rnd(){\n    return seed=(seed*880301)^7122;\n}\n\nstruct node{\n    node *l,*r;\n    int sz,val,pri;\n    int lz(){return l?l->sz:0;}\n    int rz(){return r?r->sz:0;}\n    void psz(){sz=lz()+rz()+1;}\n    node(int v=-1):l(0),r(0),sz(1),val(v),pri(rnd()){}\n} *root,pool[1000006];\n\npair<int,int> op[1000006];\nbitset<1000006> it;\nint npt=1;\n\nnode *merge(node *a,node *b){\n    if(!(a&&b))return a?:b;\n    if(a->pri>b->pri){\n        a->r=merge(a->r,b);\n        a->psz();\n        return a;\n    }\n    else{\n        b->l=merge(a,b->l);\n        b->psz();\n        return b;\n    }\n}\nvoid split(node *now,int sz,node *&a,node *&b){\n    if(!now){a=b=0; return;}\n    if(now->lz()>=sz){\n        b=now;\n        split(now->l,sz,a,b->l);\n        b->psz();\n    }\n    else{\n        a=now;\n        split(now->r,sz-1-now->lz(),a->r,b);\n        a->psz();\n    }\n}\nvoid gl(node *now){\n    if(!now)return;\n    gl(now->l);\n    if(now->val!=-1)printf(\"%d \",now->val);\n    else{\n        while(it[npt])++npt;\n        printf(\"%d \",npt);\n        it[npt]=1;\n    }\n    gl(now->r);\n}\n\nint inp(){\n    char c; int x=0;\n    while((c=getchar()) && (c<'0' || c>'9'));\n    while((x=c-'0',c=getchar()) && c>='0' && c<='9');\n    return x;\n}\n\nint main(){\n    // ios_base::sync_with_stdio(0); cin.tie(0);\n    int n=inp(),m=inp();\n    for(int i=1;i<=m;++i){\n        op[i].first=inp();\n        op[i].second=inp();\n        // it[op[i].first]=1;\n    }\n    for(int i=1;i<=n;++i)root=merge(root,&pool[i]);\n\n    node *a,*b,*c,*d;\n    for(int i=m;i>=1;--i){\n        split(root,1,a,b);\n        if(a->val==-1){\n            if(it[op[i].first])exit((cout<<-1<<endl,0));\n            a->val=op[i].first;\n            it[op[i].first]=1;\n        }\n        else if(a->val!=op[i].first)exit((cout<<-1<<endl,0));\n        split(b,op[i].second-1,c,d);\n        root=merge(c,merge(a,d));\n    }\n    gl(root);\n}\n", "lang": "GNU C++11", "bug_code_uid": "3aa4e8a511d72afdc3dffe76983fd615", "src_uid": "a2616b1681f30ce4b2a5fdc81cf52b50", "apr_id": "15182acfa5fca7fd070192b9ebc1adc1", "difficulty": 2200, "tags": ["data structures"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.6924362724613455, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "        /*----------------------------------*\\\n        ******BISMILLAHIR RAHMANIR RAHIM******\n        ********************\n        *****************\n        /*************************************/\n\n#include <bits/stdc++.h>\nusing namespace std;\n\n#define ll long long\n#define NL printf(\"\\n\")\n#define xx first\n#define yy second\n#define gc getchar\n#define pb push_back\n#define mp make_pair\n#define pii pair<int,int>\n#define scani(x) scanf(\"%d\",&x)\n#define scanl(x) scanf(\"%lld\",&x)//scanf(\"%I64d\",&x)\n#define scand(x) scanf(\"%lf\",&x)\n#define scans(x) scanf(\"%s\",x)\n#define mem(a,b) memset(a,b,sizeof(a))\n#define FOR(i,j,k) for(i=j;i<=k;i++)\n#define REV(i,j,k) for(i=j;i>=k;i--)\n#define READ(f) freopen(f,\"r\",stdin)\n#define WRITE(f) freopen(f,\"w\",stdout)\n#define cnd tree[idx]\n#define lnd tree[idx*2]\n#define rnd tree[(idx*2)+1]\n#define lndp (idx*2),(b),((b+e)/2)\n#define rndp (idx*2+1),((b+e)/2+1),(e)\n#define pi 2.0*acos(0.0)\n#define MOD 1000000007\n#define MAX 100005\n#define PRINT_CASE(x) printf(\"Case %d:\",cs);\nint scanst(char *a){\n\n    int i=0;\n    char c = 0;\n    while(c < 33)\n    c = gc();\n    while(c > 33){\n        a[i++] = c;\n        c = gc();\n        }\n    a[i] = 0;\n    return i;\n}\n\ntemplate <typename T> bool scan(T &n)\n{\n    n = 0;\n    bool got = false;\n    bool negative = false;\n    char c = gc();\n    if(c==EOF)\n        return false;\n    while( c < '0' | c > '9'){\n        if(c == '-')\n        negative = true;\n        c = gc();\n    }\n    while(c >= '0' && c <= '9')\n    {\n        got = true;\n        n = n*10 + c-48;c = gc();\n    }\n    if(negative) n = ~(n-1);\n        return got;\n}\ntemplate <typename T> inline T GCD (T a,T b ) {a = abs(a);b = abs(b);while ( b ) { a = a % b; swap ( a, b ); } return a;}\ntemplate <typename T> inline T LCM(T x,T y){T tp = GCD(x,y);if( (x / tp) * 1. * y > 9e18) return 9e18;return (x / tp) * y;}\ntemplate <typename T> inline T BigMod(T A,T B,T M){T ret = 1;while(B){if(B & 1) ret = (ret * A) % M;A = (A * A) % M;B = B >> 1;}return ret;}\ntemplate <typename T> inline T InvMod (T A,T M){return BigMod(A,M-2,M);}\nint gcdr ( int a, int b )\n{\n  if ( a==0 ) return b;\n  return gcdr ( b%a, a );\n}\n/*\nll poW(ll x, ll n)\n{\n    if(n==0)\n        return 1;\n    else if(n%2==0)\n        return poW(x*x,n/2);\n    else\n        return x*poW(x*x,((n-1)/2));\n}\n*/\n/*\nint gcdr ( int a, int b )\n{\n  if ( a==0 ) return b;\n  return gcdr ( b%a, a );\n}\n\nconst int maxx=1000000;\nint status[(maxx>>5)+2];\n\nbool check(int N,int pos)\n{\n    return (bool)(N & (1<<pos));\n}\nint Set(int N, int pos)\n{\n    return N=(N|(1<<pos));\n}\nvector<int>P_list;\nvoid sieve()\n{\n    int i,j,sqrtN;\n    sqrtN=int(sqrt(maxx))+1;\n    P_list.push_back(2);\n    for(int i=3;i<=maxx;i+=2)\n    {\n        if(check(status[i>>5],i&31)==0)\n        {\n            P_list.push_back(i);\n\n            if(i<=sqrtN)\n            for(j=i*i;j<=maxx;j+=(i<<1))\n            {\n                status[j>>5]=Set(status[j>>5],j & 31);\n            }\n        }\n    }\n}\n*/\nvoid FastIO()\n{\n    ios_base::sync_with_stdio(false);cin.tie(0);\n    cout.precision(20);\n}\nstruct s{\n    int a,index;\n};\nbool operator< ( s A, s B)\n{\n    return A.a>B.a;\n}\nint main()\n{\n    FastIO();\n    int a,b,c,i,j;\n    s arr[5];\n    while(cin>>arr[0].a>>arr[1].a>>arr[2].a)\n    {\n        arr[0].index=0;\n        arr[1].index=1;\n        arr[2].index=2;\n        sort(arr,arr+3);\n        ///cout<<arr[0].index<<endl;\n        int ans[5][5]={0};\n\n\n            while(arr[0].a)\n            {\n                int ok=0;\n                if(arr[1].a && arr[0].a)\n                {\n                    arr[0].a--;\n                    arr[1].a--;\n                    ans[arr[0].index][arr[1].index]++;\n                    ans[arr[1].index][arr[0].index]++;\n                    ok=1;\n                }\n\n                if(arr[2].a && arr[0].a)\n                {\n                    arr[0].a--;\n                    arr[2].a--;\n                    ans[arr[0].index][arr[2].index]++;\n                    ans[arr[2].index][arr[0].index]++;\n                    ok=1;\n                }\n                if(!ok)\n                    break;\n            }\n            while(arr[2].a)\n            {\n                    if(arr[2].a && arr[1].a){\n                    arr[1].a--;\n                    arr[2].a--;\n                    ans[arr[1].index][arr[2].index]++;\n                    ans[arr[2].index][arr[1].index]++;\n                    }\n            }\n        ///cout<<arr[0].a<<arr[1].a<<arr[2].a<<endl;\n        if(arr[1].a==0 && arr[2].a==0 && arr[0].a==0)\n        {\n            cout<<ans[0][1]<<\" \"<<ans[1][2]<<\" \"<<ans[0][2]<<endl;\n        }\n        else\n        {\n            cout<<\"Impossible\"<<endl;\n        }\n    }\n\n}\n\n\n\n\n", "lang": "GNU C++14", "bug_code_uid": "d3bca08cc303435673cc1f4b1fdebfbd", "src_uid": "b3b986fddc3770fed64b878fa42ab1bc", "apr_id": "5ae2f603cd3e440582a1bf1688a47466", "difficulty": 1200, "tags": ["graphs", "math", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9908349279887199, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nconst int N = 2e5 + 5 ;\nconst double eps = 1e-9 ;\nconst int MAX_N = 1e6 + 5 ;\nconst long long M = (long long)1e9+7 ;\n#define     ll      long long\n#define     ull     unsigned long long\nint Int() {\n    int x;\n    scanf(\"%d\",&x);\n    return x;\n}\nll Long() {\n    ll x;\n    scanf(\"%lld\",&x);\n    return x;\n}\nvoid Char(char* ch) {\n    scanf(\"%s\",ch);\n}\ntemplate<typename t>inline t abs(t a) { if(a>=0) return a; return -a;}\ntemplate<typename t>inline t gcd(t a , t b) {return !b ? a : gcd(b , a % b);}\ntemplate<typename t>inline t lcm(t a , t b) {return a * ( b /gcd(a , b));}\ntemplate<typename T>inline T modpow(T b, T p, T Mod) {\n    T res  = 1;\n    while(p) {\n        if(p&1) {\n            res *= b ;\n            res %= Mod ;\n        }\n        b *= b;\n        b %= Mod;\n        p >>= 1;\n    }\n    return res ;\n}\n\ntemplate<typename T> inline T ModInv(T b, T Mod) {return modpow(b, Mod - 2, Mod );}\n\ntemplate<typename T> inline T pwr(T b, T p) {\n    T res  = 1;\n    while(p) {\n        if(p&1) {\n            res *= b ;\n        }\n        b *= b;\n        p >>= 1;\n    }\n    return res ;\n}\nint e1 , e2 , d1 ;\ntemplate < typename T >inline void extgcd(T a , T b){\n    if(!b) {e1 = 1 , e2 = 0 , d1 = a ; return ;}\n    extgcd(b , a % b) ;\n    T x1 = e2 ; \n    T y1 = e1 - (a / b) * e2 ;\n    e1 = x1 ;\n    e2 = y1 ;\n}\n\n/*primes in range 1 - n\n1 - 100(1e2) -> 25 pimes\n1 - 1000(1e3) -> 168 primes\n1 - 10000(1e4) -> 1229 primes\n1 - 100000(1e5) -> 9592 primes\n1 - 1000000(1e6) -> 78498 primes\n1 - 10000000(1e7) -> 664579 primes\nlarge primes -> \n104729 1299709 15485863 179424673 2147483647 32416190071 112272535095293 48112959837082048697\n*/\n/*\nstd::vector<int> primes;\nbitset < MAX_N > bs;\nll sieve_size = MAX_N ;\n\nvoid sieve(ll n){\n    bs.set() ;\n    bs[0] = bs[1] = 1 ;\n    for(ll i = 2 ; i <= n ; i++)if(bs[i]){\n        for(ll j = i * i ; j <= n ; j += i) bs[j] = 0 ;\n            primes.push_back((int)i);\n    }\n}\n\nbool isprime(ll n){\n    if(n <= sieve_size)return bs[n] ;\n    for(int i = 0 ; i <= (int)primes.size() ; i++){\n        if(n % primes[i] == 0)return false ;\n    }\n    return true ;\n}\n\nint numDiffPf[MAX_N] ;\n\nvoid DiffPF(){\n    for(int i = 2 ; i < MAX_N ; i++){\n        if(numDiffPf[i] == 0){\n            for(int j = i ; j < MAX_N ; j += i)numDiffPf[j]++;\n        }\n    }\n}\n\nint Phi[MAX_N] ;\n\nvoid EulerPHI(){\n    for(int i = 1 ; i < MAX_N ; i++)Phi[i] = i ;\n        for(int i = 2 ; i < MAX_N ; i++)\n            if(Phi[i] == i)\n                for(int j = i ; j < MAX_N ; j += i)\n                    Phi[j] = (Phi[j]/i) * (i - 1) ;\n}\n\nint F(int x){\n    return 0 ;\n}\npair < int , int > floydCycle(int x0){\n    int tor = F(x0) , hare = F(F(x0)) ;\n    while(tor != hare){tor = F(tor) , hare = F(F(hare));}\n    int mu = 0 ; hare = x0 ;\n    while(tor != hare){tor = F(tor) , hare = F(hare); mu++ ;}\n    int lambda = 1 ; hare = F(tor) ;\n    while(tor != hare){hare = F(hare) ; lambda++;}\n    return {mu , lambda} ;\n}\n*/\ntemplate <typename T>inline vector< T > Unique(vector< T > v) {\n    sort(v.begin(), v.end());\n    v.erase(unique(v.begin(), v.end()),v.end());\n    return v;\n}\n#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))\n///error///\n#define error(args...) {vector<string>_v=split(#args,',');err(_v.begin(),args);cout<<endl;}\nvector<string> split(const string &s,char c) {\n    vector<string>v;\n    stringstream ss(s);\n    string x;\n    while(getline(ss,x,c))\n        v.emplace_back(x);\n    return move(v);\n}\n\nvoid err(vector<string>::iterator it) {}\ntemplate<typename T,typename... Args>\nvoid err(vector<string>::iterator it,T a,Args...args) {\n    cout<<it->substr((*it)[0]==' ',it->length())<< \" = \" << a << \" \";\n    err(++it,args...);\n}\n///This DEBUGGER-tool need c++11///\n#define     Int         Int()\n#define     Long        Long()\n#define     pii         pair<int,int>\n#define     ff          first\n#define     ss          second\n#define     pb          push_back\n#define     eb          emplace_back\n#define     all(x)      x.begin(),x.end()\n#define     mem(a)      memset(a,0,sizeof a)\n#define     memn(a)     memset(a,-1,sizeof a)\n\nint trafic[10005] ;\n\nint main() {\n    //freopen(\"input.txt\",\"r\",stdin);\n    //freopen(\"output.txt\",\"w\",stdout);\n    int t = 1 , tc = 0 ;\n    while(t--) {\n        double l , d , v ;\n        int g , r ;\n        double res = 0.0 ;\n        cin >> l >> d >> v >> g >> r ;\n        int i = g , limit = r ;\n        while(i <= 10000){\n            while(limit--){\n                trafic[i]++;\n                i++;\n            }\n            i--;\n            i += (g + r) , limit = r ;\n        }\n        double time = d / v ;\n        int f = floor(time) ;\n        if(trafic[f]){\n            while(trafic[f] > 0)f--;\n            f++;\n            time += 1.0 * (r - abs(time - f)) ;\n        }\n        l = l - d ;\n        time += (l / v) ;\n        printf(\"%.10f\",time);\n    }\n    return 0;\n}\n\n", "lang": "GNU C++14", "bug_code_uid": "3192b30ffc9e735b86a82120c092eca7", "src_uid": "e4a4affb439365c843c9f9828d81b42c", "apr_id": "facc0584a1d54aeafe25380fd3e10859", "difficulty": 1500, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.754735308402137, "equal_cnt": 23, "replace_cnt": 16, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 22, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n#define INF 0x3f3f3f3f\n#define sp ' '\n#define nl '\\n'\nvoid sc(){}template<class T,class...A>void sc(T&t,A&...a){cin>>t,sc(a...);}\nvoid pr(){}template<class T,class...A>void pr(T t,A...a){cout<<t,pr(a...);}\n#define ms(x, y) memset(x, y, sizeof(x))\n#define sz(x) (int)(x.size())\n#define af(x) x.begin(), x.end()\n#define mp make_pair\n#define pb push_back\n#define f first\n#define s second\nconst int mod = 1e9 + 7, base = 131;\ntypedef long long ll;\ntypedef unsigned long long ull;\ntypedef pair<int, int> pii;\nint n, ans;\nstring s;\nqueue<string> q;\nint main(){\n\tcin.sync_with_stdio(0); cin.tie(0); cout.tie(0);\n\tsc(n, s);\n\tq.push(s);\n\twhile(sz(q)){\n\t\tstring p = q.front(); q.pop();\n\t\tans = max(ans, n - sz(p));\n\t\tif (sz(p) == 1) continue;\n\t\tfor (int i = sz(p) - 1; i; i--){\n\t\t\tif (p[i] - 1 == p[i - 1]){\n\t\t\t\tq.push(p.substr(0, i) + p.substr(i + 1, sz(p) - i));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfor (int i = 0; i < sz(p) - 1; i++){\n\t\t\tif (p[i] - 1 == p[i + 1]){\n\t\t\t\tq.push(p.substr(0, i) + p.substr(i + 1, sz(p) - i));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tpr(ans);\n\treturn 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "d4f2252f843a189d24b9131e9e8e97f8", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "apr_id": "b84d1e3bc9d0dc2ba502fb4fd0c1f9dc", "difficulty": 1600, "tags": ["strings", "brute force", "greedy", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.2843842573000423, "equal_cnt": 17, "replace_cnt": 14, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 17, "bug_source_code": "#include<iostream>\n#include<algorithm>\n#include<cstring>\n#include<string>\n#include<queue>\n#define mm(a) memset(a,0,sizeof(a))\n#define sync std::ios::sync_with_stdio(false);std::cin.tie(0)\nusing namespace std;\ntypedef long long ll;\nstring s;\nstruct node{\n    string s;\n    int step;\n}t;\nqueue<node>que;\nint main(void)\n{\n    sync;\n    int len,res=0;\n    cin>>len>>s;\n    t.step=1;\n    for(int i=0;i<len;++i)\n    {\n        if(i==0&&s[i]-s[i+1]==1)\n        {\n            t.s=s;\n            t.s.erase(i,1);\n            que.push(t);\n        }\n        else if(i==len-1&&s[i]-s[i-1]==1)\n        {\n            t.s=s;\n            t.s.erase(i,1);\n            que.push(t);\n        }\n        else if((s[i]-s[i-1]==1||s[i]-s[i+1]==1)&&i>0&&i<len-1)\n        {\n            t.s=s;\n            t.s.erase(i,1);\n            que.push(t);\n        }\n    }\n    while(!que.empty())\n    {\n        node nxt;\n        t=que.front();\n        que.pop();\n        nxt.step=t.step+1;\n        res=max(res,t.step);\n        int ln=t.s.size();\n        for(int i=0;i<ln;++i)\n        {\n            if(ln==1)\n                break;\n            if(i==0&&t.s[i]-t.s[i+1]==1)\n            {\n                nxt.s=t.s;\n                nxt.s.erase(i,1);\n                que.push(nxt);\n            }\n            else if(i==len-1&&t.s[i]-t.s[i-1]==1)\n            {\n                nxt.s=t.s;\n                nxt.s.erase(i,1);\n                que.push(nxt);\n            }\n            else if((t.s[i]-t.s[i-1]==1||t.s[i]-t.s[i+1]==1)&&i>0&&i<len-1)\n            {\n                nxt.s=t.s;\n                nxt.s.erase(i,1);\n                que.push(nxt);\n            }\n        }\n    }\n    cout<<res<<endl;\n    return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "de7637251e07e79c476c1814e46034af", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "apr_id": "58ce89cf0a737ffa29b0d5427f8f532b", "difficulty": 1600, "tags": ["strings", "brute force", "greedy", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9430707303047728, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n#define int long long\n#define double long double\n#define pb push_back\n#define mp make_pair\n #define mod 1000000007\n const int N=100005;\n const int inf=1e18;\nint pow(int a,int b){\n    int res=1;\n    while(b>0){\n        if(b&1){\n        \tres=res*a;\n\t\t}\n        a=a*a;\n        b>>=1;\n    }\n    return res;\n}\nsigned main(){\n\tios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);\n\t\n\tint x;\n\tcin>>x;\n\tif(x<0){\n\t\tx=(x+3600000000000000000)%360;\n\t\tif(x>180){\n\t\t\tx=360-x;\n\t\t}else{\n\t\t\tx=(-1)*x;\n\t\t}\n\t}else{\n\t\tx=x%360;\n\t\tif(x>180){\n\t\t\tx=360-x;\n\t\t}else{\n\t\t\tx=(-1)*x;\n\t\t}\n\t}\n\t\tint m=abs(x);\n\tcout<<x<<\" \"<<m<<\" \";\n\n\tint out=0;\n\tfor(int y=1;y<=3;y++){\n\t\tif(min(abs(x+90*y),abs(360-x-90*y))<m){\n\t\t\tm=min(abs(x+90*y),abs(360-x-90*y));\n\t\t\tout=y;\n\t\t//\tcout<<m<<\" \"<<out<<\"\\n\";\n\t\t}\n\t}\n\tcout<<m\n\t\n\tcout<<out;\n\n\n\n\n\n\n\n\t\n\t\nreturn 0;\t\n}\n", "lang": "GNU C++14", "bug_code_uid": "4bef05eaa965cfe06e82c12d5ca8aec7", "src_uid": "509db9cb6156b692557ba874a09f150e", "apr_id": "9bbe7327e53c91aaee6c969edc0eac81", "difficulty": 1800, "tags": ["geometry", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9188191881918819, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint dp[20100][20100];\ntypedef pair<int,int> ii;\nvector<ii> bug;\nint main()\n{\n    int n,m,c0,d0,a,b,c1,d1,j,k,i=0;\n    cin>>n>>m>>c0>>d0;\n   \n    if(c0!=0)\n        i=n/c0;\n    for(int j=0;j<i;j++)\n    \n        bug.push_back(make_pair(c0,d0));\n    for(i=0;i<m;i++)\n    {\n        cin>>a>>b>>c1>>d1;\n        j=0;\n        if(b)\n            j=a/b;\n        for( k=0;k<j;k++)\n            bug.push_back(make_pair(c1,d1));\n    }\n    sort(bug.begin(),bug.end());\n    k=bug.size();\n    memset(dp,0,sizeof dp);\nfor(i=0;i<=n+1;i++)\nfor(j=1;j<=k+1;j++) \n{\n    if((i-bug[j-1].first)>=0)\n        \n    {dp[j][i]=max(dp[j-1][i-bug[j-1].first]+bug[j-1].second,dp[j][i]);\n    dp[j][i]=max(dp[j][i],dp[j-1][i]);\n    }\n}\n    cout<<dp[k+1][n]<<endl;\n    return 0;\n    \n}", "lang": "GNU C++", "bug_code_uid": "75951e9257a185528fab5609145af5f2", "src_uid": "4e166b8b44427b1227e0f811161d3a6f", "apr_id": "3dddc29889c0daffc00afa4b1571f160", "difficulty": 1700, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9981785063752276, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include <iostream>\n#include <vector>\n#define vv vector<vector<int>>\n#define int long long int\nusing namespace std;\n\nvv I, turn = {\n\t{2, 1, 1, 0, 1, 2},\n\t{1, 2, 0, 1, 1, 2},\n\t{1, 1, 1, 0, 1, 2},\n\t{1, 1, 0, 1, 1, 2},\n\t{0, 0, 0, 0, 1, 1},\n\t{0, 0, 0, 0, 0, 1}\n}; //x, y, dx, dy, t, 1\n\n\n\n\n\nint N, sx, sy, dx, dy, t; \n\ninline int add(int a, int b){\n\treturn (a + b >= N ? a + b - N : a + b);\n}\n\nvv operator*(vv a, vv b){\n\tvv r;\n\tr.resize(a.size());\n\tfor(int i = 0; i < a.size(); i++){\n\t\tr[i].resize(b[0].size());\n\t\tfor(int j = 0; j < b[0].size(); j++){\n\t\t\tfor(int k = 0; k < a[0].size(); k++){\n\t\t\t\tr[i][j] = add(r[i][j], a[i][k] * b[k][j] % N);\n\t\t\t}\n\t\t}\n\t}\n\treturn r;\n}\n\nsigned main(){\n\tcin >> N >> sx >> sy >> dx >> dy >> t;\n\twhile(dx < 0) sx += N;\n\twhile(dy < 0) sy += N;\n\tdx %= N;\n\tdy %= N;\n\tI.resize(6);\n\tfor(int i = 0; i < 6; i++){ I[i].resize(6); I[i][i] = 1; }\n\tfor(int i = 0; i < 64; i++){\n\t\tif(((t) >> i) & 1){\n\t\t\tI = I * turn;\n\t\t}\n\t\tturn = turn * turn;\n\t}\n\tvv st = {\n\t\t{sx - 1},\n\t\t{sy - 1},\n\t\t{dx},\n\t\t{dy},\n\t\t{0},\n\t\t{1}\n\t};\n\tst = I * st;\n\tcout << st[0][0] + 1 << \" \" << st[1][0] + 1 << endl;\n}\n", "lang": "GNU C++17", "bug_code_uid": "e5a663b0025a8addd6ef280f1426d52f", "src_uid": "ee9fa8be2ae05a4e831a4f608c0cc785", "apr_id": "79b9b39931c179bc8649ac797c41092f", "difficulty": 2300, "tags": ["matrices", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9824033123176814, "equal_cnt": 13, "replace_cnt": 4, "delete_cnt": 4, "insert_cnt": 4, "fix_ops_cnt": 12, "bug_source_code": "#include <algorithm>\n#include <bitset>\n#include <cassert>\n#include <cctype>\n#include <climits>\n#include <cmath>\n#include <cstdio>\n#include <cstdlib>\n#include <cstring>\n#include <fstream>\n#include <iostream>\n#include <iomanip>\n#include <iterator>\n#include <list>\n#include <map>\n#include <numeric>\n#include <queue>\n#include <set>\n#include <sstream>\n#include <stack>\n#include <string>\n#include <utility>\n#include <vector>\nusing namespace std;\n\nconst double EPS = 1e-9;\nconst int INF = 0x7f7f7f7f;\nconst double PI=acos(-1.0);\n\n#define    READ(f) \t         freopen(f, \"r\", stdin)\n#define    WRITE(f)   \t     freopen(f, \"w\", stdout)\n#define    MP(x, y) \t     make_pair(x, y)\n#define    PB(x)             push_back(x)\n#define    rep(i,n)          for(int i = 1 ; i<=(n) ; i++)\n#define    repI(i,n)         for(int i = 0 ; i<(n) ; i++)\n#define    FOR(i,L,R) \t     for (int i = (int)(L); i <= (int)(R); i++)\n#define    ROF(i,L,R) \t     for (int i = (int)(L); i >= (int)(R); i--)\n#define    FOREACH(i,t)      for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)\n#define    ALL(p) \t         p.begin(),p.end()\n#define    ALLR(p) \t         p.rbegin(),p.rend()\n#define    SET(p) \t         memset(p, -1, sizeof(p))\n#define    CLR(p)            memset(p, 0, sizeof(p))\n#define    MEM(p, v)         memset(p, v, sizeof(p))\n#define    getI(a) \t         scanf(\"%d\", &a)\n#define    getII(a,b) \t     scanf(\"%d%d\", &a, &b)\n#define    getIII(a,b,c)     scanf(\"%d%d%d\", &a, &b, &c)\n#define    getL(a)           scanf(\"%lld\",&a)\n#define    getLL(a,b)        scanf(\"%lld%lld\",&a,&b)\n#define    getLLL(a,b,c)     scanf(\"%lld%lld%lld\",&a,&b,&c)\n#define    getC(n)           scanf(\"%c\",&n)\n#define    getF(n)           scanf(\"%lf\",&n)\n#define    getS(n)           scanf(\"%s\",n)\n#define    bitCheck(N,in)    ((bool)(N&(1<<(in))))\n#define    bitOff(N,in)      (N&(~(1<<(in))))\n#define    bitOn(N,in)       (N|(1<<(in)))\n#define    bitFlip(a,k)      (a^(1<<(k)))\n#define    bitCount(a)        __builtin_popcount(a)\n#define    bitCountLL(a)      __builtin_popcountll(a)\n#define    bitLeftMost(a)     (63-__builtin_clzll((a)))\n#define    bitRightMost(a)    (__builtin_ctzll(a))\n#define    iseq(a,b)          (fabs(a-b)<EPS)\n#define    UNIQUE(V)          (V).erase(unique((V).begin(),(V).end()),(V).end())\n#define    vi \t              vector < int >\n#define    vii \t              vector < vector < int > >\n#define    pii \t              pair< int, int >\n#define    ff \t              first\n#define    ss \t              second\n#define    ll\t              long long\n#define    ull \t              unsigned long long\n#define    POPCOUNT           __builtin_popcount\n#define    POPCOUNTLL         __builtin_popcountll\n#define    RIGHTMOST          __builtin_ctzll\n#define    LEFTMOST(x)        (63-__builtin_clzll((x)))\n#define    FMT(...)           (sprintf(CRTBUFF, __VA_ARGS__)?CRTBUFF:0)\nchar CRTBUFF[30000];\n\ntemplate< class T > inline T gcd(T a, T b) { return (b) == 0 ? (a) : gcd((b), ((a) % (b))); }\ntemplate< class T > inline T lcm(T a, T b) { return ((a) / gcd((a), (b)) * (b)); }\ntemplate <typename T> string NumberToString ( T Number ) { ostringstream ss; ss << Number; return ss.str(); }\n\n#define dipta00\n#ifdef dipta007\n     #define debug(args...) {cerr<<\"Debug: \"; dbg,args; cerr<<endl;}\n     #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)\n        template <typename Arg1>\n        void __f(const char* name, Arg1&& arg1){\n            cerr << name << \" : \" << arg1 << std::endl;\n        }\n        template <typename Arg1, typename... Args>\n        void __f(const char* names, Arg1&& arg1, Args&&... args){\n            const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << \" : \" << arg1<<\" | \";__f(comma+1, args...);\n        }\n#else\n    #define debug(args...)  /// Just strip off all debug tokens\n    #define trace(...) ///yeeeee\n#endif\n\nstruct debugger{\n    template<typename T> debugger& operator , (const T& v){\n        cerr<<v<<\" \";\n        return *this;\n    }\n}dbg;\n///****************** template ends here ****************\n\n// g++ -g -O2 -std=gnu++11 A.cpp\n// ./a.out\n\nint main() {\n    #ifdef dipta007\n        //READ(\"in.txt\");\n       //WRITE(\"out.txt\");\n    #endif // dipta007\n    ios_base::sync_with_stdio(0);cin.tie(0);\n\n    int n;\n    while(cin >> n)\n    {\n        vi v;\n        FOR(i,0,n-1)\n        {\n            int x;\n            getI(x);\n            v.PB(x);\n        }\n\n        int mf = 1;\n        while(v.size() != 0)\n        {\n            vi tmp;\n            int flg = 1;\n            FOR(i,0,(int)v.size()-2)\n            {\n                if(abs(v[i] - v[i+1]) >= 2) flg = 0;\n            }\n\n            if(!flg)\n            {\n                debug(v.size())\n                mf = 0;\n                break;\n            }\n            int maxy = 0, in = -1;\n            FOR(i,0,(int)v.size()-1)\n            {\n                if(v[i] > maxy)\n                {\n                    maxy = v[i];\n                    in = i;\n                }\n            }\n\n            FOR(i,0,(int)v.size()-1)\n            {\n                if(i == in) continue;\n                tmp.PB(v[i]);\n            }\n\n            v.clear();\n            v = tmp;\n        }\n\n        if(mf) cout << FMT(\"YES\\n\");\n        else cout << FMT(\"NO\\n\");\n//        int max = 0;\n    }\n\n    return 0;\n}\n\n", "lang": "GNU C++14", "bug_code_uid": "4fc1921bf304eb1a12fbe44fa8cccb9e", "src_uid": "704d0ae50bccaa8bc49319812ae0be45", "apr_id": "56c9318ef826d4047966628320297d09", "difficulty": 1600, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.4195338512763596, "equal_cnt": 7, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "#include <bits/stdc++.h>\n#define ill int long long\nusing namespace std;\nill n=10,i,a[15];\nstring s;\nint main()\n{\n    cin>>n;\n    for (i=1;i<=n;i++)\n        cin>>a[i];\n    while (n)\n    {\n        ill mx=0,j=0;\n        for (i=2;i<=n;i++)\n        {\n            if (abs(a[i]-a[i-1])>1){cout<<\"NO\";return 0;}\n        }\n        for (i=1;i<=n;i++)\n        {\n            if (a[i]>mx)mx=a[i],j=i;\n        }\n        for (i=j;i<n;j++)\n            a[i]=a[i+1];\n        a[n]=mx;\n        n--;\n\n    }\n    cout<<\"YES\";return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "a171094f2bcb0f62fd122067e894e0df", "src_uid": "704d0ae50bccaa8bc49319812ae0be45", "apr_id": "3f8147b0191af622217a484f1e471908", "difficulty": 1600, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6028217186831979, "equal_cnt": 17, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 16, "bug_source_code": "#include <cstdio>\n#include <cstdlib>\n#include <iostream>\n#include <ctype.h>\n#include <algorithm>\n#include <math.h>\n#include <vector>\n#include <string.h>\n#include <map>\n\n#pragma comment(linker,\"/stack:64000000\")\n\nusing namespace std;\n\nint a[100500];\nint res[100500];\nbool vis[100500];\nvector<vector<int> > l;\n\nbool f(int v)\n{\n\tvis[v]=true;\n\tbool flag=false;\n\tfor (int i=0;i<l[v].size();i++)\n\t{\n\t\tif (!vis[l[v][i]])\n\t\t{\n\t\t\tif (a[l[v][i]]==0)\n\t\t\t\tif (f(l[v][i])) flag=true;\n\t\t\tif (a[l[v][i]]==2)\n\t\t\t{\n\t\t\t\tflag=true;\n\t\t\t\tres[l[v][i]]=true;\n\t\t\t\tf(l[v][i]);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t\tflag||=res[l[v][i]];\n\t}\n\tres[v]=flag||res[v];\n\treturn res[v];\n}\n\nint main()\n{\n\tint n,m;\n\tcin >> n >> m;\n\tfor (int i=1;i<=n;i++)\n\t\tscanf(\"%d\",a+i);\n\tl.resize(n+1);\n\tint first,second;\n\tfor (int i=0;i<m;i++)\n\t{\n\t\tscanf(\"%d %d\",&first,&second);\n\t\tl[first].push_back(second);\n\t}\n\tmemset(vis,false,sizeof(vis));\n\tmemset(res,0,sizeof(res));\n\tfor (int i=1;i<=n;i++)\n\t\tif (a[i]==1) f(i);\n\tfor (int i=1;i<=n;i++)\n\t\tif (res[i]) printf(\"1\\n\");\n\t\telse printf(\"0\\n\");\n\treturn 0;\n}\n\n", "lang": "MS C++", "bug_code_uid": "efb985b2f9380a77e069b1bf5c405f20", "src_uid": "87d869a0fd4a510c5e7e310886b86a57", "apr_id": "679cf47de3a1a1026b074a92a5713342", "difficulty": 1700, "tags": ["graphs"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.11797235023041475, "equal_cnt": 14, "replace_cnt": 10, "delete_cnt": 4, "insert_cnt": 0, "fix_ops_cnt": 14, "bug_source_code": "#include<cstdio>\n#include<algorithm>\nusing namespace std;\ntypedef unsigned long long ull;\null n,k;\null a[200010];\null t[200010];\ninline ull rd()\n{\n\tull s=0;\n\tchar c=getchar();\n\twhile(c<'0'||c>'9')\n\t\tc=getchar();\n\twhile(c>='0'&&c<='9')\n\t\ts*=10llu,s+=c-'0',c=getchar();\n\treturn s;\n}\ninline void MergeSort(ull *a,ull l,ull r)\n{\n\tif(l==r)\n\t\treturn;\n\tull m=(l+r)/2;\n\tMergeSort(a,l,m);\n\tMergeSort(a,m+1,r);\n\tull i=l,j=m+1,k=l;\n\twhile(i<=m&&j<=r)\n\t\tt[k++]=(a[i]>a[j])?a[j++]:a[i++];\n\twhile(i<=m)\n\t\tt[k++]=a[i++];\n\twhile(j<=r)\n\t\tt[k++]=a[j++];\n\tfor(ull i=l;i<=r;++i)\n\t\ta[i]=t[i];\n\treturn;\n}\nint main(void)\n{\n\tscanf(\"%llu %llu\",&n,&k);\n\tull ans=0;\n\tfor(register ull i=1;i<=n;++i)\n\t\ta[i]=rd();\n\tMergeSort(a,1,n);\n\tfor(register ull i=1;i<=n;++i)\n\t\tfor(register ull j=i+1;j<=n;++j)\n\t\t{\n\t\t\tif(a[j]<=a[i]+k&&a[j]>a[i])\n\t\t\t{\n\t\t\t\t++ans;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\tprintf(\"%llu\",n-ans);\n\treturn 0;\n}", "lang": "GNU C++", "bug_code_uid": "698b2ceee175629deed98e84134c63ce", "src_uid": "236177ff30dafe68295b5d33dc501828", "apr_id": "24680b0a49d286dce2162adf63c4d135", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6902390438247012, "equal_cnt": 14, "replace_cnt": 9, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 14, "bug_source_code": "#include <iostream>\n#include <string>\n#include <vector>\n#include <map>\n#include <queue>\n#include <algorithm>\n#include <functional>\n#include <iterator>\n#include <numeric>\n#define ll long long\nusing namespace std;\n\nint main()\n{\n\tint n, k, x, a[101] = {}, mx = 0;\n\tcin >> n >> k >> x;\n\tfor (int i = 0; i < n; i++)\n\t\tcin >> a[i];\n\tfor (int i = 1; i < n; i++)\n\t{\n\t\tint J = 0;\n\t\tif (a[i - 1] == a[i] && a[i] == x)\n\t\t{\n\t\t\tJ += 2;\n\t\t\tint j1 = i - 2 >= 0, j2 = i + 1 < n, l = i - 2, r = i + 1;\n\t\t\twhile (1)\n\t\t\t{\n\t\t\t\tint x = 0;\n\t\t\t\tfor (; l > 0; l--)\n\t\t\t\t{\n\t\t\t\t\tif (a[l] == a[l - 1])\n\t\t\t\t\t\tj1++;\n\t\t\t\t\telse\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tfor (; r < n - 1; r++)\n\t\t\t\t{\n\t\t\t\t\tif (a[r] == a[r + 1])\n\t\t\t\t\t\tj2++;\n\t\t\t\t\telse\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (a[l--] == a[r++])\n\t\t\t\t\tx += j1 + j2;\n\t\t\t\telse if (j1 > 2 && j1 > j2)\n\t\t\t\t\tx += j1;\n\t\t\t\telse if (j2 > 2 && j2 > j1)\n\t\t\t\t\tx += j2;\n\t\t\t\tif (!x)\n\t\t\t\t\tbreak;\n\t\t\t\telse\n\t\t\t\t\tJ += x;\n\t\t\t}\n\t\t}\n\t\tmx = max(mx, J);\n\t}\n\tcout << mx;\n\treturn 0;\n}", "lang": "MS C++ 2017", "bug_code_uid": "16de7319773d9890330eea268371f2b5", "src_uid": "d73d9610e3800817a3109314b1e6f88c", "apr_id": "ee80349b1598ee59f2bccd7cf46ea114", "difficulty": 1400, "tags": ["brute force", "two pointers"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.7764350453172205, "equal_cnt": 23, "replace_cnt": 18, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 22, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\nconst int64_t base=998244353;\nint64_t power(int64_t x, int64_t y){\n  if(y==0) return 1;\n  int64_t t=power(x, y/2);\n  t=(t*t)%base;\n  if(y%2) t=(t*x)%base;\n  return t;\n}\nint64_t inverse(int64_t x){//modular inverse\n  return power(x, base-2);\n}\nvector <int64_t> f({1}), iv({1});\n\nint64_t C(int64_t n, int64_t k){\n    return ((f[n]*iv[k]%base)*iv[n-k])%base;\n}\nint64_t star(n, k){\n    return C(n+k-1, k-1);\n}\nint64_t countGame(int64_t n, int64_t k, int64_t x){//n points total, k players, no player can have x point or more\n  if(k==0) return !(n==0);\n  int64_t ans=0\n  for(int i=0; i<=k; i++){\n    int64_t t=n-x*i;\n    if(t<0) break;\n    if(i%2) ans=(ans-C(k, i)*star(t, k))%base;\n    else ans=(ans+C(k, i)*star(t, k))%base;\n  }\n  return ans\n}\nint main(){\n  int p, s, r;\n  int64_t gameSize=countGame(s-r, p, 1e18);\n  gameSize=inverse(gameSize);\n  cin>>p>>s>>r;\n  for(int i=1; i<5555; i++){\n    f.push_back((f[i-1]*i)%base);\n    iv.push_back(inverse(f[i]));\n  }\n  int64_t ans=0;\n  for (int q=r; q<=s; q++){\n    for(int i=0; i<p; i++){//exactly i people have the same score\n        int64_t t=s-(i+1)*q;\n        if(t<0) break;\n        ans=(ans+(((C(p-1, i)*count_game(t, p-i-1, q))%base)*gameSize%base)*inverse(i+1))%base;\n    }\n  }\n  cout<<ans<<'\\n';\n}", "lang": "GNU C++17", "bug_code_uid": "471c63c3ba8a172ce0d46bc6a76d6b49", "src_uid": "609195ef4a970c62a8210dafe118580e", "apr_id": "480061bc81cc4b7168e9ffa6526a6cbb", "difficulty": 2500, "tags": ["dp", "math", "combinatorics", "probabilities"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9316909294512878, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <iostream>\n#include <math.h>\n\nusing namespace std;\n\nint main()\n{\n    unsigned long long a, b, c, temp;\n    cin>>a;\n    if(a==1){\n        cout<<1<<\" \"<<1<<endl;\n        return 0;\n    }\n\n    if(a%2!=0){\n        b=sqrt(a);\n    b--;\n    c=a/b;\n    }\n\n    else{\n        b=sqrt(a);\n        c=a/b;\n    }\n\n    while((c*b)!=a){\n        b++;\n        c=a/b;\n    }\n\n    if(b>c)\n    {\n        temp=b;\n        b=c;\n        c=temp;\n    }\n\n\n    cout<<b<<\" \"<<c<<endl;\n    return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "a45ad921972f6ce2bb6aa8a1f3db45d0", "src_uid": "f52af273954798a4ae38a1378bfbf77a", "apr_id": "0a0015bb3a43deef8e9388acb0722c07", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.974025974025974, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include <iostream>\n#include <vector>\n#include <sstream>\n#include <algorithm>\n#include <cmath>\n#include <memory>\nusing namespace std;\n\nint cnt(int a,int b, int c){\n\tint sum = 0;\n\tif(a == 1 && b == 1 && c == 1){\n\t\tsum = 1;\n\t\treturn sum;\n\t}else if(a == 1 && b == 1 && c != 1){\n\t\tsum = c;\n\t\treturn sum;\n\t}else if(a == 1 && c == 1 && b != 1){\n\t\tsum = b;\n\t\treturn sum;\n\t}else if(c == 1 && b == 1 && a != 1){\n\t\tsum = a;\n\t\treturn sum;\n\t}else{\n\t\tsum = 2*(a + b + c) - 6;\n\t}\n\tif(a == 1 && b != 1 && c != 1){\n\t\treturn sum + cnt(a,b-2,c-2); \n\t}else if(b == 1 && a != 1 && c != 1){\n\t\treturn sum + cnt(a-2,b,c-2);\n\t}else if(c == 1 && b != 1 && a != 1){\n\t\treturn sum + cnt(a-2,b-2,c);\n\t}\n\treturn sum + cnt(a-1,b-1,c-1);\n}\n\nint main(){\n\tint a,b,c;\n\tcin>>a>>b>>c;\n\tint sum = 0;\n\t// algorithm\n\tsum = cnt(a,b,c);\n\tcout<<sum<<endl;\n\treturn 0;\n}", "lang": "MS C++", "bug_code_uid": "89297973f155eb8a2aeca24af0c55fea", "src_uid": "8ab25ed4955d978fe20f6872cb94b0da", "apr_id": "46c6dc8e38391b9a3e31a93d534ca510", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9976415094339622, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <iostream>\n\nusing namespace std;\n#define MOD 1000003\n\nlong long int square(long long int x,int n)\n{\n    if(n==0)\n        return 1;\n    else if(n==1)\n        return x;\n    else if(n%2==0)\n        return square((x*x)%MOD,(n/2));\n    else\n        return (x*square((x*x)%MOD,((n-1)/2)))%MOD;\n}\n\nint main()\n{\n    int n;\n    cin>>n;\n    if(n==1)\n        cout<<\"1\";\n    else\n        cout<<square(3,(n-1));\n    return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "22d5e6792961f93cb012b8d1d8a0ce6f", "src_uid": "1a335a9638523ca0315282a67e18eec7", "apr_id": "4d861894bab7916391d28f4789c507c8", "difficulty": 1300, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.984538885867454, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include<bits/stdc++.h>\n#include <ext/pb_ds/assoc_container.hpp> // Common file\n#include <ext/pb_ds/tree_policy.hpp> // Including\nusing namespace std;\nusing namespace __gnu_pbds;\n\ntypedef long long ll;\ntypedef vector<int> vi;\ntypedef vector<ll> vl;\ntypedef vector<vi> vvi;\ntypedef vector<vl> vvl;\ntypedef pair<int,int> pii;\ntypedef pair<double, double> pdd;\ntypedef pair<ll, ll> pll;\ntypedef vector<pii> vii;\ntypedef vector<pll> vll;\n\ntemplate<typename T>\nusing ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;\ntemplate<typename F, typename S>\nusing ordered_map = tree<F, S, less<F>, rb_tree_tag, tree_order_statistics_node_update>;\n\n//#define PB push_back\n#define PB emplace_back\n#define F first\n#define S second\n#define MP make_pair\n#define endl '\\n'\n#define pf printf\n#define sf scanf\n#define left __left\n#define right __right\n#define tree __tree\n\nconst double PI = acos(-1);\nconst double eps = 1e-9;\nconst int inf = 2000000000;\nconst ll infLL = 9000000000000000000;\n#define MOD 1000000007\n//#define harmonic(n) 0.57721566490153286l+log(n)\n\n#define mem(a,b) memset(a, b, sizeof(a) )\n#define gcd(a,b) __gcd(a,b)\n#define lcm(a,b) (a*(b/gcd(a,b)))\n#define sqr(a) ((a) * (a))\n\n#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);\n#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);\n\ntypedef vector<int>::iterator vit;\ntypedef set<int>::iterator sit;\n\ninline bool checkBit(ll n, int i) { return n&(1LL<<i); }\ninline ll setBit(ll n, int i) { return n|(1LL<<i);; }\ninline ll resetBit(ll n, int i) { return n&(~(1LL<<i)); }\n\nint dx[] = {0, 0, +1, -1};\nint dy[] = {+1, -1, 0, 0};\n//int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};\n//int dy[] = {0, +1, 0, -1, +1, -1, +1, -1};\n\ninline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }\ninline bool isLeapYear(ll year) { return (year%400==0) || (year%4==0 && year%100!=0); }\ninline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }\ninline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }\ninline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }\ninline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }\ninline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }\ninline ll modInverse(ll a) { return modPow(a, MOD-2); }\ninline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }\n\n/*\nbool seive[1010000];\nvi prime;\n\nvoid seiveGen(int limit) {\n    limit += 100;\n    int sqrtn = sqrt(limit);\n    for(int i = 3; i <= sqrtn; i += 2) {\n            if(!seive[i>>1]) {\n                    for(int j = i * i; j < limit; j += i + i) {\n                            seive[j>>1] = 1;\n                    }\n            }\n    }\n    prime.PB(2);\n    for(int i = 3; i < limit; i += 2) {\n            if(!seive[i>>1]) prime.PB(i);\n    }\n}\n*/\n\n//\n//debug\n#ifdef yamin\ntemplate < typename F, typename S >\nostream& operator << ( ostream& os, const pair< F, S > & p ) {\n            return os << \"(\" << p.first << \", \" << p.second << \")\";\n}\n\ntemplate < typename T >\nostream &operator << ( ostream & os, const vector< T > &v ) {\n            os << \"{\";\n                for(auto it = v.begin(); it != v.end(); ++it) {\n                                if( it != v.begin() ) os << \", \";\n                                        os << *it;\n                                            }\n                    return os << \"}\";\n}\n\ntemplate < typename T >\nostream &operator << ( ostream & os, const set< T > &v ) {\n            os << \"[\";\n                for(auto it = v.begin(); it != v.end(); ++it) {\n                                if( it != v.begin() ) os << \", \";\n                                        os << *it;\n                                            }\n                    return os << \"]\";\n}\n\ntemplate < typename T >\nostream &operator << ( ostream & os, const multiset< T > &v ) {\n            os << \"[\";\n                for(auto it = v.begin(); it != v.end(); ++it) {\n                                if( it != v.begin() ) os << \", \";\n                                        os << *it;\n                                            }\n                    return os << \"]\";\n}\n\ntemplate < typename F, typename S >\nostream &operator << ( ostream & os, const map< F, S > &v ) {\n            os << \"[\";\n                for(auto it = v.begin(); it != v.end(); ++it) {\n                                if( it != v.begin() ) os << \", \";\n                                        os << it -> first << \" = \" << it -> second ;\n                                            }\n                    return os << \"]\";\n}\n\n#define dbg(args...) do {cerr << #args << \" : \"; faltu(args); } while(0)\n\nclock_t tStart = clock();\n#define timeStamp dbg(\"Execution Time: \", (double)(clock() - tStart)/CLOCKS_PER_SEC)\n\nvoid faltu () {\n            cerr << endl;\n}\n\ntemplate <typename T>\nvoid faltu( T a[], int n ) {\n            for(int i = 0; i < n; ++i) cerr << a[i] << ' ';\n                cerr << endl;\n}\n\ntemplate <typename T, typename ... hello>\nvoid faltu( T arg, const hello &... rest) {\n            cerr << arg << ' ';\n                faltu(rest...);\n}\n#else\n#define dbg(args...)\n#endif // yamin\n\nint ans = 0;\n\nvoid solve(int lim) {\n\tqueue<int> bfs;\n\tif (4 <= lim)\n\t\tbfs.push(4);\n\tif (7 <= lim)\n\t\tbfs.push(7);\n\twhile (!bfs.empty()) {\n\t\tint u = bfs.front();\n\t\tbfs.pop();\n\t\t++ans;\n\t\tint v = u * 10 + 4;\n\t\tif (v <= lim)\n\t\t\tbfs.push(v);\n\t\tv = u * 10 + 7;\n\t\tif (v <= lim)\n\t\t\tbfs.push(v);\n\t}\n}\n\nbool lucky(int num) {\n\twhile (num > 0) {\n\t\tint lol = num % 10;\n\t\tif (lol != 4 && lol != 7)\n\t\t\treturn false;\n\t\tnum /= 10;\n\t}\n\treturn true;\n}\n\nint main() {\n\tint n, k;\n\tcin >> n >> k;\n\n\t--k;\n\n\tvi store;\n\n\tfor (int i = 1; k > 0; ++i) {\n\t\tstore.PB(k % i);\n\t\tk /= i;\n\t\tdbg(i, k);\n\t}\n\n\tif (store.size() > n) {\n\t\tcout << -1 << endl;\n\t\treturn 0;\n\t}\n\n\tdbg(store, n - store.size());\n\n\tsolve(n - store.size());\n\n\tset<int> yo;\n\n\tfor (int i = n; i > n - store.size(); --i) {\n\t\tyo.insert(i);\n\t}\n\n\tdbg(yo);\n\tdbg(ans);\n\n\tfor (int i = n - store.size() + 1, j = store.size() - 1; i <= n; ++i, --j) {\n\t\tauto it = yo.begin();\n\t\tfor (int l = 0; l < store[j]; ++l)\n\t\t\t++it;\n\t\tint it2 = *it;\n\t\tyo.erase(it2);\n\t\tdbg(i, it2);\n\t\tif (lucky(i) && lucky(it2))\n\t\t\t++ans;\n\t}\n\n\tcout << ans << endl;\n}", "lang": "GNU C++14", "bug_code_uid": "41a28c97a40af06379d0869ea6cc6172", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "apr_id": "bfefb110b92ae1d39e7c06aa708fb6df", "difficulty": 1900, "tags": ["brute force", "combinatorics", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9487427466150871, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 7, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\ntypedef long  long ll;\nconst ll mod = 1000000007, ar = 100005;\n#define  pi 3.1415926535897932384626433832795\n#define hello ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);\nint main() {\n    hello\n    int x;\n    cin >> x;\n    vector<int> vec,v;\n    for(int w = 0 ;w < x; w++) {\n        int a; cin >> a ;vec.push_back(a);\n        v.push_back(a);\n    }\n    sort(v.rbegin(),v.rend());\n    vector<int> res;\n    while(res.size() != x-1) {\n    for(int w = 0 ;w <vec.size(); w++) {\n    for(int i = 0 ; i < vec.size()-1;i++) {\n        while(vec[i]>vec[i+1]) {\n            vec[i]--;\n            vec[i+1]++;\n        }\n    }\n    }\n    vector<int>tmp = vec;\n    if(vec.size()) { \n    sort(tmp.rbegin(),tmp.rend());\n    res.push_back(tmp[0]);\n    for(int i = 0 ; i < vec.size(); i++) {\n        if(vec[i] == tmp[0]) vec.erase(vec.begin()+i);\n    }\n    }\n    }\n    if(vec.size())\n    res.push_back(vec[0]);\n\n\n    if(res == v) cout <<\"YES\" << endl;\n    else cout <<\"NO\" << endl;\n\n\n\n   return 0 ;\n}\n", "lang": "GNU C++11", "bug_code_uid": "b5d3b6cbeb0cd3d8b50b0371abb74f0c", "src_uid": "704d0ae50bccaa8bc49319812ae0be45", "apr_id": "f57e60d877a6f8b5ddc0159d028fbec4", "difficulty": 1600, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9680672268907563, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\nint main() {\n    int n,counter=0;\n    cin>>n;\n    string s;\n    for (int i=0;i<n;i++) {\n        cin>>s[i];\n    }\n    for (int i=0;i<n;i++) {\n        if (s[i]=='x' && s[i+1]=='x' && s[i+2]=='x')\n            counter++;\n    }\n    cout<<counter<<endl;\n}\n", "lang": "GNU C++11", "bug_code_uid": "1dd5b47e13c0737c85ff4d78fffd57cc", "src_uid": "8de14db41d0acee116bd5d8079cb2b02", "apr_id": "0c0b002ad75e76ffdde22c97e1b48f59", "difficulty": 800, "tags": ["strings", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.5276381909547738, "equal_cnt": 12, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "#include<cstdio>\n#define ll long long\nusing namespace std;\nint n,k;\nll dp[510][510],temp[510][510],mod=1e9+7,rez;\nll step(ll base,int pw){\n   if(pw==0)return 1;\n   ll pom=step(base,pw/2);\n   pom=(pom*pom)%mod;\n   if(pw&1)return (pom*base)%mod;\n   return pom;\n}\nvoid go(){\n\n   for(int i=1;i<=n;i++){/// last pos\n      dp[0][0]=1;\n\n      for(int j=0;j<=i;j++)/// count\n      for(int p=0;p<=i;p++){/// last int\n          temp[j+1][i]=(temp[j+1][i]+(dp[j][p]*(step(2,i-p)-1))%mod*step(2,p))%mod;\n          temp[j][p]=(temp[j][p]+dp[j][p]*step(2,p))%mod;\n      }\n\n      for(int j=0;j<=i;j++)\n        for(int p=0;p<=i;p++)\n            dp[j][p]=temp[j][p];\n      memset(temp,0,sizeof(temp));\n   }\n\n}\nint main(){\n\n    scanf(\"%d %d\",&n,&k);\n    go();\n\n    for(int i=0;i<=n;i++)rez=(rez+dp[k][i])%mod;\n    printf(\"%lld\\n\",rez);\n\nreturn 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "52f8a8a9b46a8181b45156fdab00180d", "src_uid": "111673158df2e37ac6c019bb99225ccb", "apr_id": "6b3034d0b7b2fe8f1344f31639e76e78", "difficulty": 2500, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9899150743099787, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "#include <iostream>\n#include <cstdio>\n#include <cstring>\n#include <algorithm>\nusing namespace std;\n\n#define maxn 10\nint n, m;\nint dp[40][1<<maxn][1<<maxn];\nint num[1<<maxn];\n// dp[i][k][l] = max( dp[i][k][l], dp[i-1][j][k]+num[j] );\n\nint count( int x ) {\n    int cnt = 0;\n    for ( int i=0; i<m; ++i )\n      if(x&(1<<i) ) ++cnt;\n    return m-cnt;\n};\n\nbool ok( int x, int y, int z ) {\n    for ( int i=0; i<m; ++i )\n      if(!(y&(1<<i)) )\n      {\n          if((x&(1<<i)) || (z&(1<<i)) || ( (y&(1<<(i+1)))&&(i+1<m) ) || (i-1>=0&&(y&(1<<(i-1))) ) )\n            continue;\n          return 0;\n      }\n      return  1;\n};\n\nint a[1<<26], b[1<<26], c[1<<26];\n\nint main( ) {\n\n     while(cin >> n >> m)\n     {\n         if(n > m) swap(n, m);\n         if(n == 1) {\n             printf (\"%d\\n\", m-(m+2)/3);  continue;\n         }\n         int M = (1<<m);\n         for ( int i=0; i<=n+1; ++i )\n           for ( int j=0; j<M; ++j )\n             for ( int k=0; k<M; ++k )\n              dp[i][j][k] = -1111111111;\n         for ( int i=0; i<M; ++i )\n           dp[0][0][i]=0,  num[i] = count(i);\n         a[0] = b[0] = c[0] = 0;\n         //cout <<\"hdbud\\n\";\n         for ( int i=0; i<M; ++i )\n           for ( int j=0; j<M; ++j )\n             for ( int k=0; k<M; ++k )\n               if(ok(i, j, k) )\n               {\n                   a[++a[0] ] = i;\n                   b[++b[0] ] = j;\n                   c[++c[0] ] = k;\n               }\n          //  cout << \"sdvksdkl\\n\" ;\n         for ( int i=1, j, k, l; i<=n; ++i )\n         {\n             for ( int jj=1; jj<=a[0]; ++jj ){\n                j = a[jj], k = b[jj], l = c[jj];\n                dp[i][k][l] = max(dp[i][k][l], dp[i-1][j][k]+num[k]);\n             }\n         }\n         int ans = 0;\n         for ( int i=0; i<M; ++i )\n           if(ans < dp[n][i][0] ) ans = dp[n][i][0];\n         cout << ans << endl;\n     }\n     return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "86a63a3b4aa4eeaf5142a99b1b9141c4", "src_uid": "097674b4dd696b30e102938f71dd39b9", "apr_id": "b717d9465e7f7a1c0a2e3cf98c3c0a0f", "difficulty": 2100, "tags": ["dp", "bitmasks", "dsu"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.61640625, "equal_cnt": 17, "replace_cnt": 8, "delete_cnt": 6, "insert_cnt": 3, "fix_ops_cnt": 17, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\ntypedef long long ll;\n#define inf 0x3f3f3f3f\n#define infl 0x3f3f3f3f3f3f3f3f\n#define lson l, m, rt << 1\n#define rson m + 1, r, rt << 1 | 1\n#define MOD 1000000007\n#define maxn 500010\n#define re(i,l,r) for(int i=l;i<=r;++i)\n#define rep(i,l,r) for(int i=l;i<r;++i)\nvector<ll> v1;\nvector<ll> v2;\nvector<ll> v3;\nint main()\n{\n\tios::sync_with_stdio(false);\n\tcin.tie(0);//\u80fd\u88ab\u8fd9\u6837\u8868\u793a\u7684\u662f\u574f\u5e74\uff0c\u6c42\u597d\u5e74\u7684\u6700\u957f\u533a\u95f4\n\t//\u6c42\u51fa\u6765\u5168\u90e8l-r\uff0csort\u4e00\u4e0b\uff0c\u76f8\u51cf\u5c31\u662f\u533a\u95f4\u957f\u5ea6\n\tll x, y, l, r;\n\tcin >> x >> y >> l >> r;\n\tll t = x;\n\tv1.emplace_back(1);\n\tv2.emplace_back(1);\n\tif (x != 0)\n\t{\n\t\twhile (t <= r)\n\t\t{\n\t\t\tv1.emplace_back(t);\n\t\t\tif (t >= l && t <= r)\n\t\t\t\tv3.emplace_back(t);\n\t\t\tt *= x;\n\t\t}\n\t}\n\telse\n\t{\n\t\tv1.emplace_back(0);\n\t}\n\tt = y;\n\tif (y != 0)\n\t{\n\t\twhile (t <= r)\n\t\t{\n\t\t\tv2.emplace_back(t);\n\t\t\tif (t >= l && t <= r)\n\t\t\t\tv3.emplace_back(t);\n\t\t\tt *= y;\n\t\t}\n\t}\n\telse\n\t\tv2.emplace_back(0);\n\tfor (int i = 0; i < v1.size(); i++)\n\t{\n\t\tfor (int j = 0; j < v2.size(); j++)\n\t\t{\n\t\t\tll temp = v1[i] + v2[j];\n\t\t\t\tif (temp >= l && temp <= r)\n\t\t\t\t{\n\t\t\t\t\tv3.emplace_back(temp);\n\t\t\t\t\t//cout << \"  sda \"<<temp << endl;\n\t\t\t\t}\n\t\t}\n\t}\n\tsort(v3.begin(), v3.end());\n\tll ans = 0;\n\tfor (int i = 1; i < v3.size(); i++)\n\t{\n\t\tll tem = v3[i] - v3[i - 1]-1;\n\t\tans = max(ans, tem);\n\t}\n\tif (v3.size() > 0)\n\t{\n\t\tans = max(ans, v3[0] - l);\n\t\tans = max(ans, r - v3[v3.size() - 1]);\n\t}\t\n\telse\n\t{\n\t\tans = max(ans,r - l + 1);\n\t}\n\tcout << ans << endl;\n\treturn 0;\n}", "lang": "GNU C++17", "bug_code_uid": "784658f2a5afce92bcc195ac6735721d", "src_uid": "68ca8a8730db27ac2230f9fe9b120f5f", "apr_id": "215fd7fd4f3d0cba3fb1ca39611c9082", "difficulty": 1800, "tags": ["math", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6621751684311838, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "#include<iostream>\n#include<algorithm>\n#include<cstdio>\nusing namespace std;\nint n;\nint a[110];\nint f[110];\nint m,r,l,s,sum;\nint main(){\n\tcin>>n;\n\tfor(int i=1;i<=n;i++){\n\t\tcin>>a[i];\n\t\tf[i]=f[i-1]+a[i];\n\t}\n//\tfor(int i=1;i<=n;i++)\n//\tcout<<f[i]<<\" \";\n\tfor(int i=2;i<=n;i++){\n\t\tfor(int j=1;j<=i;j++){\n\t\t\tsum=i-j-(f[i]-f[j]);\n\t\t\tif(sum>m){\n\t\t\t\tr=i;\n\t\t\t\tl=j+1;\n\t\t\t}\n\t\t}\n\t}\n\tfor(int i=l;i<=r;i++){\n\t\ta[i]=1-a[i];\n\t}\n\tfor(int i=1;i<=n;i++){\n\t\tif(a[i]==1)s++;\n\t}\n\tcout<<s;\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "393b49442963d79d3443a71c5fdba45f", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "apr_id": "09753479e60c6e13cd5dfd6e86e8995d", "difficulty": 1200, "tags": ["dp", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.579454926624738, "equal_cnt": 18, "replace_cnt": 11, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 17, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n\n#define MAX 501\n#define MOD 1000000007\n#define ll long long\n\nll dp[MAX][MAX][MAX];\n\nll mhp , mat, mde;\nll h , a , b;\nll get(ll hp , ll at  , ll de){\n    ll dx1 = max(0ll ,at-mde); // m lost\n    ll dx2 = max(0ll ,mat-de); // y lost\n\n    if(!dx1) return hp>0 && mhp <=0 ;\n\n    ll dy = mhp / dx1  + (mhp % dx1!=0) ;\n    hp -= dy * dx2;\n\n    return hp > 0;\n}\n\nll solve(ll hp , ll at , ll de){\n    if(hp>=300  || at>=300 || de>=300 )\n        return 1e9;\n\n    if(get(hp,at,de))\n        return 0;\n\n    if(dp[hp][at][de]+1)\n        return dp[hp][at][de];\n\n    ll res1 = h+solve(hp+1,at,de);\n    ll res2 = a+solve(hp,at+1,de);\n    ll res3 = b+solve(hp,at,de+1);\n\n    return dp[hp][at][de] = min(min(res1,res2),res3);  \n}\n\n\nint main(){\n\n#ifndef ONLINE_JUDGE\n    freopen(\"input.txt\", \"r\", stdin);\n    freopen(\"output.txt\", \"w\", stdout);\n#endif // !ONLINE_JUDGE\n\n    ll hp,at,de;\n    cin>>hp>>at>>de;\n    cin>>mhp>>mat>>mde;\n    cin>>h>>a>>b;\n\n    memset(dp,-1,sizeof dp);\n\n    cout<<solve(hp,at,de);\n    \n\n}\n// NOTE :  .Check MAX and limits before submit ;", "lang": "GNU C++14", "bug_code_uid": "8f53280ebd541d078d00d50365c92add", "src_uid": "bf8a133154745e64a547de6f31ddc884", "apr_id": "4090bb6976939ed0d437bc6a942c7dc4", "difficulty": 1800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.2565266742338252, "equal_cnt": 23, "replace_cnt": 20, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 23, "bug_source_code": "#include<iostream>\n#include<cstdio>\n#include<cstring>\nusing namespace std;\nchar  a[1000005];\nint main()\n{\n\tint i=1,j=1,cun,jishu=1,ge=0;\n\twhile((a[i++]=getchar())!=' ');\n\tfor(;j<=(i-1);)\n\t{\n\t\tfor(int c=j+1;c<=(i-1);c++)\n\t\t{\n\t\t\tif(a[c]!=a[j])\n\t\t\t{\n                j=c;\n                jishu=1;\n                break;\n            }\n\t\t\tif(a[c]==a[j])\n\t\t\t{\n\t\t\t\tjishu+=1;\n\t\t\t}\n\t\t}\n\t\tif(jishu%2==0)\n\t\t{\n\t\t\tge+=1;\n\t\t}\n\t}\n\tcout<<ge<<endl;\n\treturn 0;\n} ", "lang": "GNU C++11", "bug_code_uid": "696f45b7d8b204ef55a78270b18e6e1c", "src_uid": "8b26ca1ca2b28166c3d25dceb1f3d49f", "apr_id": "d83b4a320b07ec77e5376334a57c8810", "difficulty": null, "tags": ["implementation", "two pointers"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9118055555555555, "equal_cnt": 11, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 10, "bug_source_code": "#include <cstdio>\n#include <cstdlib>\n#include <queue>\nusing namespace std;\nlong long int n,k,syc,bas[20],a;\nlong long int dizi[20],di[20];\npriority_queue <int,vector<int>,greater<int> > qu;\nint fk (int x)\n{\n    int crp=1;\n    for(int i=1;i<=x;i++)\n        crp*=i; \n    return crp;   \n}\nint muk (int x)\n{\n    int b=0;\n   // printf(\"%d\\n\",x);\n    while(x)\n    {\n        b=x%10;\n        x=x/10;\n        if(b!=4 && b!=7)\n            return 0;    \n    }    \n  //  printf(\"YES\\n\\n\\n\");\n    return 1;\n}\nvoid kont ()\n{\n    for(int i=0;i<=a-1;i++)\n        if(muk(dizi[i]) && muk(n-i))\n            syc++;  \n    printf(\"%lli\\n\",syc);  \n}\nvoid kont2 ()\n{\n    for(int i=0,j=n;i<=a-1;i++,j-- )\n        if(muk(dizi[i]) && muk(j))\n            syc++;  \n    printf(\"%lli\\n\",syc);  \n}\nint main ()\n{\n    scanf(\"%lli %lli\",&n,&k);\n    if(n>=15)\n    {\n        for(int  i=1;i<=n;i++)\n            qu.push(i);\n        a=15;\n        for(int i=a-1;i>=0;i--)\n        {\n            int bay=0,end=0;\n            if(k>fk(i))\n            {\n                if(k%fk(i))\n                {\n                    end=k/fk(i);\n                    k=k%fk(i);    \n                }\n                else\n                {\n                    end=k/fk(i)-1;\n                    k=fk(i);    \n                }\n            }\n            while (bay<end)\n            {\n                di[bay]=qu.top();\n                qu.pop();       \n                bay++;\n            }\n            dizi[i]=qu.top();\n            qu.pop();\n            for(int j=0;j<bay;j++)\n                qu.push(di[j]);\n        }\n        /*for(int i=1;i<=n-15;i++)\n            printf(\"%d \",i);*/\n        for(int i=a-1;i>=0;i--)\n        {\n        //    printf(\"%lli \",n-15+dizi[i]);\n            dizi[i]=n-15+dizi[i];\n        }\n        for(int i=1;i<=n-15;i++)\n            if(muk(i))\n                syc++;\n        kont2();\n        getchar();getchar();\n    }\n    else\n    {\n        if(k>fk(n))\n        {\n            printf(\"-1\\n\");\n            exit(0);\n        }\n        for(int  i=1;i<=n;i++)\n            qu.push(i);\n        a=n;\n        for(int i=a-1;i>=0;i--)\n        {\n            int bay=0,end=0;\n            if(k>fk(i))\n            {\n                if(k%fk(i))\n                {\n                    end=k/fk(i);\n                    k=k%fk(i);    \n                }\n                else\n                {\n                    end=k/fk(i)-1;\n                    k=fk(i);    \n                }\n            }\n            while (bay<end)\n            {\n                di[bay]=qu.top();\n                qu.pop();       \n                bay++;\n            }\n            dizi[i]=qu.top();\n            qu.pop();\n            for(int j=0;j<bay;j++)\n                qu.push(di[j]);\n        }\n        kont();\n      /*  for(int i=a-1;i>=0;i--)\n            printf(\"%lli \",dizi[i]);*/\n        getchar();getchar();\n    }\n}\n", "lang": "GNU C++", "bug_code_uid": "8bf446cf276e57042b8c6f4f891389fa", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "apr_id": "428c6a0038dfc27715ebf6443f7af4a8", "difficulty": 1900, "tags": ["brute force", "combinatorics", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.8188235294117647, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n\nint n, otv;\nbool u[300][300];\n\nint main()\n{\n    cin >> n;\n    for(int i = 0; i < n; ++i)\n    {\n        char c;\n        cin >> c;\n        if(c == 'U')\n            y++;\n        if(c == 'D')\n            y--;\n        if(c == 'R')\n            x++;\n        if(c == 'L')\n            x--;\n        if(u[x][y] == true)\n            otv++;\n        u[x][y] = true;\n    }\n    cout << otv;\n}\n", "lang": "GNU C++", "bug_code_uid": "843f028badf9d54589d5e416bf7ac113", "src_uid": "7bd5521531950e2de9a7b0904353184d", "apr_id": "8244f9a70ca8638b866eb78ccd003ac3", "difficulty": 1000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.3884430176565008, "equal_cnt": 13, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 12, "bug_source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include <iostream>\n#include <fstream>\n#include <string>\n#include <set>\n#include <vector>\n#include <cmath>\n#include <algorithm>\n#include <iomanip>\n#include <map>\n#include <queue>\n#include <stack>\n#include <cstdlib>\n#include <stdio.h>\n#include <functional>\n\nusing namespace std;\n\ntypedef long long ll;\ntypedef long double ld;\n\nint main()\n{\n\tios::sync_with_stdio(false);\n\tcin.tie(NULL);\n\t\n\tmap <char, int> mp;\n\tmap <int, char> mp2;\n\tfor (int i = 1; i <= 50; i++)\n\t{\n\t\tif (i < 10)\n\t\t{\n\t\t\tmp[char(i + '0')] = i;\n\t\t\tmp2[i] = char(i + '0');\n\t\t}\n\t\telse if (i < 36)\n\t\t{\n\t\t\tmp[char((i - 10) + 'a')] = i;\n\t\t\tmp2[i] = char((i - 10) + 'a');\n\t\t}\n\t\telse\n\t\t{\n\t\t\tmp[char((i - 36) + 'A')] = i;\n\t\t\tmp2[i] = char((i - 36) + 'A');\n\t\t}\n\t}\n\n\n\tint n, k;\n\tcin >> n >> k;\n\tvector <string> s;\n\ts.push_back(\"1\");\n\tfor (int j = 2; j <= n; j++)\n\t{\n\t\tint l = s.size();\n\t\tfor (int i = 0; i < l; i++)\n\t\t{\n\t\t\tif (mp[s[i][s[i].length() - 1]] == j - 1)\n\t\t\t{\n\t\t\t\tstring t = s[i].substr(0, s[i].length() - 1) + mp2[j] + s[i][s[i].length() - 1];\n\t\t\t\ts.push_back(t);\n\t\t\t}\n\t\t\ts[i] += mp2[j];\n\t\t}\n\t}\n\tsort(s.begin(), s.end());\n\tfor (int i = 0; i < s[k - 1].length(); i++)\n\t{\n\t\tif (s[k - 1][i] >= '1' && s[k - 1][i] <= '9')\n\t\t{\n\t\t\tcout << int(s[k - 1][i] - '0') << \" \";\n\t\t}\n\t\telse\n\t\t\tif (s[k - 1][i] >= 'a' && s[k - 1][i] <= 'z')\n\t\t\t{\n\t\t\t\tcout << int(s[k - 1][i] - 'a') + 10 << \" \";\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tcout << int(s[k - 1][i] - 'A') + 36 << \" \";\n\t\t\t}\n\t}\n\t//system(\"pause\");\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "101f1796efc9510ed85394ea5707fae2", "src_uid": "e03c6d3bb8cf9119530668765691a346", "apr_id": "71a7d3d71a12c45a39933b2d20a1b918", "difficulty": 1900, "tags": ["combinatorics", "greedy", "math", "implementation", "constructive algorithms", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.25, "equal_cnt": 19, "replace_cnt": 18, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 19, "bug_source_code": "#include <stdio.h>\n#include <bits/stdc++.h>\n\nusing namespace std;\nlong long n;\nint main()\n{\n //freopen(\"input.txt\",\"r\",stdin);\n //freopen(\"output.txt\",\"w\",stdout);\n //ios_base::sync_with_stdio(0);\n long long n,m,r,l;\n //scanf(\"%I64d%I64d%I64d%I64d\",&n,&m,&l,&r);//cout<<1;\n cin>>n>>m>>l>>r;\n vector <long long> v1;\n v1.push_back(1);\n long long nn=1;\n while(nn*n<=r)\n {\n  nn*=n;\n  v1.push_back(nn);\n\n }\n vector <long long> v2;\n v2.push_back(1);\n long long mm=1;\n while(mm*m<=r)\n {\n  mm*=m;\n  v2.push_back(mm);\n  //cout<<mm<<endl;\n }\n vector <long long> v3;\n for (int i=0;i<(int)v1.size();i++)\n    for (int j=0;j<(int)v2.size();j++)\n     if (v1[i]+v2[j]<=r && v1[i]+v2[j]>=l) {v3.push_back(v1[i]+v2[j]);}\n sort(v3.begin(),v3.end());\n long long ans=0;\n if (v3.size()>0)ans=max(ans,v3[0]-l);\n for (int i=1;i<(int)v3.size();i++)\n  {\n   if (v3[i-1]>=l && v3[i]<=r) {ans=max(ans,v3[i]-v3[i-1]-1);}//cout<<v3[i]<<' '<<v3[i-1]<<endl;\n  // cout<<v3[i]<<endl;\n  }// cout<<1;\n// cout<<v3[v3.size()-1];\n if (v3.size()>0)ans=max(ans,r-v3.back());\n if (v3.size()==0) {cout<<r-l+1;}\n else cout<<ans;\n}\n", "lang": "GNU C++", "bug_code_uid": "9b2148d00c8931e96549e8fd50c0991b", "src_uid": "68ca8a8730db27ac2230f9fe9b120f5f", "apr_id": "49d0adbf9f559a6dd421e9a526e62cb9", "difficulty": 1800, "tags": ["math", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.12673267326732673, "equal_cnt": 31, "replace_cnt": 27, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 31, "bug_source_code": "#include<bits/stdc++.h>\n#define maxn 1001\n#define INF 1000000007\ntypedef long long ll;\nusing namespace std;\n\n\nll x,n;\nbool prime[1000000000]={false};\nvector<int> G;\nll cond=1;\n\nll quick_pow(ll x,ll n,ll m){\n\tll res = 1;\n\twhile(n > 0){\n\t\tif(n & 1)\tres = res * x % m;\n\t\tx = x * x % m;\n\t\tn >>= 1;\n\t}\n\treturn res;\n}\n\nvoid prime_num(ll x){//\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \n\tfor(ll i=2;i<=sqrt(x);i++){\n\t\tif(prime[i]==false){\n\t\t\tfor(ll j=2;j*i<=x;j++){\n\t\t\t\tprime[i*j]=true;\n\t\t\t}\n\t\t}\n\t} \n}\n\n\nvoid g(ll x,ll y){\n\tll t=x;\n\tll tot=0;\n\twhile(t<=y){\n\t\ttot+=y/t;\n\t\tif(t>y/x)break;\n\t\tt=t*x;\n\t}\n\tcond=(cond*quick_pow(x,tot,INF))%INF;\n} \n\nint main(){\n\tscanf(\"%lld%lld\",&x,&n);\n\tprime_num(x);\n\tfor(ll i=2;i<=min(x,n);i++){\n\t\tif(prime[i]==false&&x%i==0){\n\t\t\tG.push_back(i);\n\t\t}\n\t}\n\tfor(ll j=0;j<G.size();j++){\n\t\tg(G[j],n);\n\t}\n\tprintf(\"%lld\",cond);\n\treturn 0;\t\n}\n", "lang": "GNU C++17", "bug_code_uid": "219dd8b194b20699cef488fa02bbda1a", "src_uid": "04610fbaa746c083dda30e21fa6e1a0c", "apr_id": "b36ee21e1830c134eedfa68b5ee8b0d9", "difficulty": 1700, "tags": ["math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6339285714285714, "equal_cnt": 19, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 9, "fix_ops_cnt": 18, "bug_source_code": "#include <cstdio>\nmain() { int n; scanf(\"%d\", n); puts((n & 1)? \"black\": \"white\\n1 2\");}\n", "lang": "GNU C++11", "bug_code_uid": "7382d182ce952508d321d161d875dfa3", "src_uid": "52e07d176aa1d370788f94ee2e61df93", "apr_id": "85e76bf38ebfc17f663d0db313f46632", "difficulty": 1700, "tags": ["math", "games", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.7927565392354124, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\ntypedef long long int ll;\nll find(ll m,ll x)\n{\n   ll y=(m-1-x-(x*x));//cout<<y<<\"o\\n\";\n   if((y%(2*x))==0)\n   {\n       y=y/(2*x);\n      return y;\n   }\n    else\n        return -1;\n    \n    \n    \n}\nint main()\n{\n ll x;cin>>x;\n ll i=0,y=-1;\n while((i<x)&&(y==-1))\n {\n    y=find(x,i);//cout<<y<<\"p\\n\";\n    i++;\n     \n }\n    \n if(y==-1)\n {\n     cout<<\"NO\\n\";\n }\n    else\n    {\n       cout<<i-1<<\" \"<<y; \n        \n    }\n    }\n\n\n\n", "lang": "GNU C++14", "bug_code_uid": "124095113e23a442debdb51220b76e1a", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "apr_id": "f9663080fd843a75380ea9e817b35a13", "difficulty": 1200, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9207213337870024, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n\ntypedef long long ll;\ntypedef long double ld;\ntypedef unsigned long long ull;\n\ntypedef pair<int, int> PII;\ntypedef map<int, int> MII;\ntypedef priority_queue<int> P_QI;\ntypedef priority_queue<string> P_QS;\ntypedef vector<int> VI;\ntypedef vector<long long> VLL;\ntypedef vector< int > :: iterator $$;\n\n#define SET(arr) memset(arr, -1, sizeof(arr))\n#define CLR(arr) memset(arr, 0, sizeof(arr))\n\n#define READ(f) freopen(f, \"r\", stdin)\n#define WRITE(f) freopen(f, \"w\", stdout)\n\n#define $ vector< int > :: iterator\n#define m_p make_pair\n#define p_b push_back\n#define rep(i, n) for(int i=0; i<(n); i++)\n#define forn(i, n) for (int i = 1; i <=(int)(n); ++i)\n#define forab(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)\n#define forba(i, b, a) for (int i = (int)(b); i >= (int)(a); --i)\n\n#define forv(i,v) rep(i,SZ(v))\n#define forit(i,s) for(auto i=(s).begin();i!=(s).end();++i)\n\n#define Boost ios_base::sync_with_stdio(0); cin.tie(0)\n#define all(a) (a).begin(), (a).end()\n#define SZ(x) ((int)(x).size())\n#define F first\n#define S second\n#define _ <<\" \"<<\n#define CS(i) cout<<\"Case \"<<(int)(i)<<\": \"\n\nconst int MOD = 1e9+7;\nconst int inf = 1e9+9;\nconst long long INF = 1e18+3;\nconst ld eps = 1e-9;\nconst ld PI=acos(-1.0);\n\n\nint main() {\nBoost;\n//READ(\"in.txt\");\n//WRITE(\"out.txt\");\nll n;\ncin>>n;\nn++;\nint p=2,i=1;\nwhile(p<=n) {\n    p*=2;\n    i++;\n}\nif(p/2==n) cout<<i-1<<endl;\nelse cout<<n<<endl;\nreturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "64c072444d6c0b36d682f9763d863f2e", "src_uid": "236177ff30dafe68295b5d33dc501828", "apr_id": "571942c76124a6a9543580ed93623259", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.03430671839901981, "equal_cnt": 25, "replace_cnt": 23, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 25, "bug_source_code": "#include <functional>\n#include <algorithm>\n#include <iostream>\n#include <climits>\n#include <fstream>\n#include <sstream>\n#include <iomanip>\n#include <numeric>\n#include <cstring>\n#include <cassert>\n#include <cstdio>\n#include <string>\n#include <vector>\n#include <bitset>\n#include <queue>\n#include <stack>\n#include <cmath>\n#include <ctime>\n#include <list>\n#include <set>\n#include <map>\n\nusing namespace std;\n#define gc getchar_unlocked\n\ntypedef long long        LL;\ntypedef pair<int, int>   pii;\ntypedef pair<int, pii>   piii;\ntypedef vector<int>      vi;\ntypedef vector<pii>      vii;\ntypedef vector<piii>     viii;\n\n\n\n\ninline int sqr(int x) { return x * x; }\ninline int cube(int x) { return x * x * x; }\ninline LL sqrLL(LL x) { return x * x; }\ninline LL cubeLL(LL x) { return x * x * x; }\n\nconst LL LLINF = 9223372036854775807LL;\nconst LL LLINF17 = 100000000000000000LL;\nconst int INF = 2147483647;\nconst int INF9 = 1000000000;\nconst int MOD = 1000000007;\nconst double eps = 1e-7;\nconst double PI = acos(-1.0);\n\n#define FOR(a,b,c)   for (int (a)=(b); (a)<(c); (a)++)\n#define FORN(a,b,c)  for (int (a)=(b); (a)<=(c); (a)++)\n#define FORD(a,b,c)  for (int (a)=(b); (a)>=(c); (a)--)\n#define REP(i,n)     FOR(i,0,n)\n#define REPN(i,n)    FORN(i,1,n)\n#define REPD(i,n)    FORD(i,n,1)\n#define rea(a,b)     read(a),read(b)\n#define rean(a,b,c)  rea((a,b),c)\n\n#define RESET(a,b)   memset(a,b,sizeof(a)) \n#define SYNC         ios_base::sync_with_stdio(0);\n#define SIZE(a)      (int)(a.size())\n#define MIN(a,b)     (a) = min((a),(b))\n#define MAX(a,b)     (a) = max((a),(b))\n#define ALL(a)       a.begin(),a.end()\n#define RALL(a)      a.rbegin(),a.rend()\n#define SIZE(a)      (int)(a.size())\n#define LEN(a)       (int)(a.length())\n#define pl(n)       printf(\"%lld\", n );\n\n#define fi           first\n#define se           second\n#define pb           push_back\n#define mp           make_pair\n#define ll           long long\n\n#ifdef _WIN32\n#define getchar_unlocked getchar\n#define scanf            scanf_s\n#endif\n\ntemplate<typename T>\nvoid read(T &x)\n{\n    register T c = gc();\n    x = 0;\n    for (; (c < 48 || c>57); c = gc());\n    for (; c > 47 && c < 58; c = gc()) { x = (x << 1) + (x << 3) + c - 48; }\n}\nll num_of_zero(ll num)\n{\n    ll left_part_zeros;\n\n    if (num == 0)\n        return 0;\n\n    left_part_zeros = num_of_zero(num >> 1);\n    if ((num & 1) == 0)\n        return left_part_zeros + 1;\n    else\n        return left_part_zeros;\n}\nint main() {\n    ll a, b;\n    rea(a, b);\n    ll count1 = 0;\n    \n    for (ll i = a; i <= b; i++) {\n        ll n = i;\n        if (num_of_zero(n) == 1) {\n            count1++;\n        }\n    }\n    pl(count1);\n    return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "2da9de25fecc0b046b95b187d074c8ab", "src_uid": "581f61b1f50313bf4c75833cefd4d022", "apr_id": "ffc1edf3974ae553b78d2f5cc5f307b6", "difficulty": 1300, "tags": ["bitmasks", "brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.02365977837675951, "equal_cnt": 23, "replace_cnt": 19, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 24, "bug_source_code": "#pragma GCC optimize(2)\n#include <map>\n#include <set>\n#include <stack>\n#include <queue>\n#include <cstdio>\n#include <vector>\n#include <cstdlib>\n#include <cstring>\n#include <iostream>\n#include <algorithm>\n#define ST sort \n#define MAXN 100005\n#define DB double\n#define LL long long\n#define INF 0x3f3f3f3f3f3f3f3f\n#define Int register int\n#define XM XiangMeiHaoGuai\n#define Pa pair<LL,LL>\n#define Lson Son[x][0]\n#define Rson Son[x][1] \nusing namespace std;\ninline void read(LL &x)\n{\n\tx = 0;\n\tLL f = 1;\n\tchar s = getchar();\n\twhile (s < '0' ||s > '9')\n\t{\n\t\tif (s == '-')\n\t\t\tf = -1;\n\t\ts = getchar();\n\t}\n\twhile (s >= '0' && s <= '9')\n\t{\n\t\tx = (x << 3) + (x << 1) + (s ^ 48);\n\t\ts = getchar();\n\t}\n\tx *= f;\n}\ninline LL Max(LL x,LL y)\n{\n\treturn x > y ? x : y;\n}\ninline LL Min(LL x,LL y)\n{\n\treturn x < y ? x : y;\n}\nLL Gcd(LL a,LL b)\n{\n\tif (! b)\n\t\treturn a;\n\treturn Gcd(b, a % b);\n}\ninline LL Abs(LL x)\n{\n\tif (x < 0)\n\t\treturn -x;\n\treturn x;\n}\ninline DB Fabs(DB x)\n{\n\tif (x > 0)\n\t\treturn x;\n\treturn -x;\n}\nLL a, b, p, x;\ninline LL QuickPow(LL x,LL y,LL Mod)\n{\n\tLL Res = 1, temp = x;\n\twhile ( y )\n\t{\n\t\tif (y & 1)\n\t\t\tRes = Res * temp % Mod;\n\t\ttemp = temp * temp % Mod;\n\t\ty /= 2;\n\t}\n\treturn Res;\n}\ninline LL Inv(LL x)\n{\n\treturn QuickPow(x, p - 2, p); \n}\ninline LL Mo(LL x,LL Mod)\n{\n\treturn ((x % Mod) + Mod) % Mod;\n}\ninline Jie(LL n,LL Mi)\n{\n\tLL Get = b * Inv( Mi ) % p;\n\tLL Dai = (p - 1) * Mo(n - Get, p) + n;\n\tif (Dai > x)\n\t\treturn 0;\n\treturn (x - Dai) / (p * (p - 1)) + 1;\n}\nint main()\n{\n\tread( a ); read( b ); read( p ); read( x );\n\tLL Power = 1, Ans = 0;\n\tfor (Int i = 1; i < p; ++ i)\n\t{\n\t\tPower = Power * a % p;\n\t\tLL Da = Jie(i, Power);\n\t\tAns += Da;\n\t}\n\tprintf(\"%lld\", Ans);\n\treturn 0;\n}\n/*\nn * a ^ n \u2261b (mod p)\n\n*/ <stack>\n#include <queue>\n#include <cstdio>\n#include <vector>\n#include <cstdlib>\n#include <cstring>\n#include <iostream>\n#include <algorithm>\n#define ST sort \n#define MAXN 100005\n#define DB double\n#define LL long long\n#define INF 0x3f3f3f3f3f3f3f3f\n#define Int register int\n#define XM XiangMeiHaoGuai\n#define Pa pair<LL,LL>\n#define Lson Son[x][0]\n#define Rson Son[x][1] \nusing namespace std;\ninline void read(LL &x)\n{\n\tx = 0;\n\tLL f = 1;\n\tchar s = getchar();\n\twhile (s < '0' ||s > '9')\n\t{\n\t\tif (s == '-')\n\t\t\tf = -1;\n\t\ts = getchar();\n\t}\n\twhile (s >= '0' && s <= '9')\n\t{\n\t\tx = (x << 3) + (x << 1) + (s ^ 48);\n\t\ts = getchar();\n\t}\n\tx *= f;\n}\ninline LL Max(LL x,LL y)\n{\n\treturn x > y ? x : y;\n}\ninline LL Min(LL x,LL y)\n{\n\treturn x < y ? x : y;\n}\nLL Gcd(LL a,LL b)\n{\n\tif (! b)\n\t\treturn a;\n\treturn Gcd(b, a % b);\n}\ninline LL Abs(LL x)\n{\n\tif (x < 0)\n\t\treturn -x;\n\treturn x;\n}\ninline DB Fabs(DB x)\n{\n\tif (x > 0)\n\t\treturn x;\n\treturn -x;\n}\nLL a, b, p, x;\ninline LL QuickPow(LL x,LL y,LL Mod)\n{\n\tx %= Mod;\n\tLL Res = 1, temp = x;\n\twhile ( y )\n\t{\n\t\tif (y & 1)\n\t\t\tRes = Res * temp % Mod;\n\t\ttemp = temp * temp % Mod;\n\t\ty /= 2;\n\t}\n\treturn Res;\n}\ninline LL Inv(LL x)\n{\n\treturn QuickPow(x, p - 2, p); \n}\ninline LL Mo(LL x,LL Mod)\n{\n\treturn ((x % Mod) + Mod) % Mod;\n}\ninline Jie(LL n,LL Mi)\n{\n\tLL Get = b * Inv( Mi ) % p;\n\tLL Dai = (p - 1) * Mo(n - Get, p) + n;\n\tif (Dai > x)\n\t\treturn 0;\n\treturn (x - Dai) / (p * (p - 1)) + 1;\n}\nint main()\n{\n\tread( a ); read( b ); read( p ); read( x );\n\tLL Power = 1, Ans = 0;\n\tfor (Int i = 1; i < p; ++ i)\n\t{\n\t\tPower = Power * a % p;\n\t\tLL Da = Jie(i, Power);\n\t\tAns += Da;\n\t}\n\tprintf(\"%lld\", Ans);\n\treturn 0;\n}\n/*\nn * a ^ n \u2261b (mod p)\n\n*/\n#include <set>\n#include <stack>\n#include <queue>\n#include <cstdio>\n#include <vector>\n#include <cstdlib>\n#include <cstring>\n#include <iostream>\n#include <algorithm>\n#define ST sort \n#define MAXN 100005\n#define DB double\n#define LL long long\n#define INF 0x3f3f3f3f3f3f3f3f\n#define Int register int\n#define XM XiangMeiHaoGuai\n#define Pa pair<LL,LL>\n#define Lson Son[x][0]\n#define Rson Son[x][1] \nusing namespace std;\ninline void read(LL &x)\n{\n\tx = 0;\n\tLL f = 1;\n\tchar s = getchar();\n\twhile (s < '0' ||s > '9')\n\t{\n\t\tif (s == '-')\n\t\t\tf = -1;\n\t\ts = getchar();\n\t}\n\twhile (s >= '0' && s <= '9')\n\t{\n\t\tx = (x << 3) + (x << 1) + (s ^ 48);\n\t\ts = getchar();\n\t}\n\tx *= f;\n}\ninline LL Max(LL x,LL y)\n{\n\treturn x > y ? x : y;\n}\ninline LL Min(LL x,LL y)\n{\n\treturn x < y ? x : y;\n}\nLL Gcd(LL a,LL b)\n{\n\tif (! b)\n\t\treturn a;\n\treturn Gcd(b, a % b);\n}\ninline LL Abs(LL x)\n{\n\tif (x < 0)\n\t\treturn -x;\n\treturn x;\n}\ninline DB Fabs(DB x)\n{\n\tif (x > 0)\n\t\treturn x;\n\treturn -x;\n}\nLL a, b, p, x;\ninline LL QuickPow(LL x,LL y,LL Mod)\n{\n\tLL Res = 1, temp = x;\n\twhile ( y )\n\t{\n\t\tif (y & 1)\n\t\t\tRes = Res * temp % Mod;\n\t\ttemp = temp * temp % Mod;\n\t\ty /= 2;\n\t}\n\treturn Res;\n}\ninline LL Inv(LL x)\n{\n\treturn QuickPow(x, p - 2, p); \n}\ninline LL Mo(LL x,LL Mod)\n{\n\treturn ((x % Mod) + Mod) % Mod;\n}\ninline Jie(LL n,LL Mi)\n{\n\tLL Get = b * Inv( Mi ) % p;\n\tLL Dai = (p - 1) * Mo(n - Get, p) + n;\n\tif (Dai > x)\n\t\treturn 0;\n\treturn (x - Dai) / (p * (p - 1)) + 1;\n}\nint main()\n{\n\tread( a ); read( b ); read( p ); read( x );\n\tLL Power = 1, Ans = 0;\n\tfor (Int i = 1; i < p; ++ i)\n\t{\n\t\tPower = Power * a % p;\n\t\tLL Da = Jie(i, Power);\n\t\tAns += Da;\n\t}\n\tprintf(\"%lld\", Ans);\n\treturn 0;\n}\n/*\nn * a ^ n \u2261b (mod p)\n\n*/", "lang": "GNU C++11", "bug_code_uid": "cd36ce2b025e5d845f29bee56894b1b7", "src_uid": "4b9f470e5889da29affae6376f6c9f6a", "apr_id": "fffe6a291457498088e5779772a766c6", "difficulty": 2100, "tags": ["math", "chinese remainder theorem", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9992570579494799, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include <bits/stdc++.h>\n\nusing namespace std;\n\ntypedef long long ll;\n\n// returns (d, x, y) such that d = gcd(a, b) = ax + by\nll extended_euclid(ll a, ll b, ll &x, ll &y)\n{\n    if (b == 0) { x = 1, y = 0; return a; }\n    ll r = extended_euclid(b, a % b, y, x);\n    y -= a / b * x;\n    return r;\n}\n\nll chinese_remainder_theorem(ll a, ll m)\n{\n    ll s = m, t, ans = 0, p, q;\n    t = s / m;\n    extended_euclid(t, m, p, q);\n    ans = (ans + t * p * a) % s;\n    if (ans < 0) ans += s;\n    return ans;\n}\n\nll pow(ll a, ll b, ll M)\n{\n\tll x = 1;\n\tfor (; b > 0; b >>= 1)\n\t{\n\t\tif (b & 1) x = x * a % M;\n\t\ta = a * a % M;\n\t}\n\treturn x;\n}\n\ntypedef long double ld;\n#define y1 Y1\n#define double ld\nll minE_max(double x)\n{\n\tll e = x;\n\tif (e - 1 >= x) return e - 1;\n\tif (e >= x) return e;\n\treturn e + 1;\n}\n\nll maxE_min(double x)\n{\n\tll e = x;\n\tif (e + 1 <= x) return e + 1;\n\tif (e <= x) return e;\n\treturn e - 1;\n}\n\nll x1, x2, y1, y2;\n// returns (x, y) such that c = ax + by\nll diophantine_equation(ll a, ll b, ll c)\n{\n\tll g, x, y;\n\tll g = extended_euclid(a, b, x, y);\n\tif (c % g != 0) return 0;\n\n\tif(g * b < 0) swap(x1, x2);\n\tif(g * a > 0) swap(y1, y2);\n\n\treturn max((min(maxE_min(double(x2 * g - x * c) / b), maxE_min(double(y2 * g - y * c) / -a))\n\t\t\t- max(minE_max(double(x1 * g - x * c) / b), minE_max(double(y1 * g - y * c) / -a)) + 1), 0LL);\n}\n\nint main()\n{\n    ios_base::sync_with_stdio(0), cin.tie(0);\n\n    ll a, b, p, l;\n    cin >> a >> b >> p >> l;\n\n    if (a%p == 0)\n    {\n    \tcout << (b%p==0) * l;\n    \treturn 0;\n    }\n\n    vector<ll> r;\n    set<ll> s;\n    ll x = a % p;\n    do\n    {\n        r.push_back(x);\n        s.insert(x);\n        x = (x * a) % p;\n    } while ((ll)r.size() < l && s.find(x) == s.end());\n\n    ll k = r.size();\n    ll ans = 0;\n    for (int i = 1; i <= k; ++i)\n    {\n        a = r[i-1];\n        ll x = chinese_remainder_theorem((b * pow(a, p-2, p)) % p, p);\n        if (k == p)\n        {\n        \tll z = (i - x) / p;\n        \tif (z * p == (i - x))\n        \t{\n        \t\tll mn_t1 = max((1-x+p-1)/p, 0LL);\n        \t\tll mx_t1 = (l-x)/p;\n        \t\tif (mx_t1 - mn_t1 >= 0)\n        \t\t{\n            \t\tll mn_t2 = max((1-i+p-1)/p, 0LL);\n            \t\tll mx_t2 = (l-i)/p;\n            \t\tif (mx_t2 - mn_t2 >= 0)\n            \t\t{\n            \t\t\tmn_t2 = max(mn_t2, mn_t1 - z);\n            \t\t\tmx_t2 = min(mx_t2, mx_t1 - z);\n            \t\t\tif (mx_t2 - mn_t2 >= 0)\n            \t\t\t\tans += mx_t2 - mn_t2 + 1;\n            \t\t}\n        \t\t}\n        \t}\n        }\n        else\n        {\n        \tx1 = x==0;\n        \tx2 = (l-x)/p;\n        \ty1 = 0;\n        \ty2 = (l-i)/k;\n        \tif (x1 <= x2 && y1 <= y2)\n        \t\tans += diophantine_equation(p, -k, i-x);\n        }\n    }\n\n    cout << ans;\n\n    return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "c6fdca5c5a01435a09e1620bb6f6561f", "src_uid": "4b9f470e5889da29affae6376f6c9f6a", "apr_id": "050a5054a4e3610cca046efcdd5bdfc9", "difficulty": 2100, "tags": ["math", "chinese remainder theorem", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.874967641729226, "equal_cnt": 15, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 7, "fix_ops_cnt": 14, "bug_source_code": "//Utkarsh.25dec\n#include <bits/stdc++.h>\n#define ll long long int \n#define ull unsigned long long int\n#define pb push_back\n#define mp make_pair\n#define mod 1000000007\n#define rep(i,n) for(ll i=0;i<n;i++)\n#define loop(i,a,b) for(ll i=a;i<=b;i++)\n#define vi vector <int>\n#define vs vector <string>\n#define vc vector <char>\n#define vl vector <ll>\n#define all(c) (c).begin(),(c).end()\n#define max3(a,b,c) max(max(a,b),c)\n#define min3(a,b,c) min(min(a,b),c)\nusing namespace std;\nconst int N=500023;\nvector <int> adj[N];\nvoid solve()\n{\n    ll s,x;\n    cin>>s>>x;\n    vl bits;\n    ll index=0;\n    ll ans=1;\n    if(x==0)\n    {\n        cout<<1;\n        return;\n    }\n    while(true)\n    {\n        ll temp=1<<index;\n        if(temp>x)\n            break;\n        if((x&temp)!=0)\n        {\n            bits.pb(1);\n            // cout<<temp<<'\\n';\n            ans*=2;\n        }\n        else\n            bits.pb(0);\n        index++;    \n    }\n    ll temp=s-x;\n    if(temp%2==1)\n    {\n        cout<<0;\n        return;\n    }\n    if(temp<0)\n    {\n        cout<<0;\n        return;\n    }\n    temp/=2;\n    vl bits2;\n    index=0;\n    while(true)\n    {\n        ll temp1=1<<index;\n        if(temp1>temp)\n            break;\n        if(x&temp1!=0)\n        {\n            bits2.pb(0);\n        }\n        else\n            bits2.pb(1);\n        index++;    \n    }\n    for(int i=0;i<min(bits.size(),bits2.size());i++)\n    {\n        if(bits[i]==1&&bits2[i]==1)\n        {\n            cout<<0;\n            return;\n        }\n    }\n    ll flag=0;\n    for(int i=0;i<bits.size();i++)\n    {\n        if(bits[i]==0)\n            flag=1;\n    }\n    if(flag==0)\n        ans-=2;\n    cout<<ans;\n}\nint main()\n{\n    ios_base::sync_with_stdio(false); \n    cin.tie(NULL);\n    int T=1;\n    //cin>>T;\n    int t=0;\n    while(t++<T)\n    {\n        //cout<<\"Case #\"<<t<<\":\"<<' ';\n        solve();\n        //cout<<'\\n';\n    }\n}", "lang": "GNU C++14", "bug_code_uid": "dea1eb9307f90aef1c470468c98e0249", "src_uid": "18410980789b14c128dd6adfa501aea5", "apr_id": "7a04c9aad7acb3b51d4fffcf6d4fc6db", "difficulty": 1700, "tags": ["dp", "math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.03696718219539796, "equal_cnt": 13, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 13, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\n#define fast ios_base::sync_with_stdio(false); cin.tie(0);\n#define rep(i,n,m) for(int i=n;i<m;i++)\n#define pre(i,n,m) for(int i=n-1;i>=m;i--)\n#define vii vector<int>\n#define vi vector<vii>\n#define pi pair<int,int>\n#define mi unordered_map<int,int>\n#define pb push_back\n#define eb emplace_back\n#define mp make_pair\n#define sz(xx) (int)xx.size()\n#define all(yy) yy.begin(),yy.end()\n#define rall(yyy) yyy.rbegin(),yyy.rend()\n#define f first\n#define s second\n#define ll long long\n#define ld long double\n#define hell 100000000000LL\n#define callable 998244353\nconst int mod=1e9+7;\ntemplate<typename T1,typename T2> inline void chkmin(T1 &x, T2 y) { if(y<x) x=y; };\ntemplate<typename T1,typename T2> inline void chkmax(T1 &x,T2 y) { if(y>x) x=y; };\nint gcd(int x,int y)\n{\n\treturn(y==0?x:gcd(y,x%y));\n}\ninline int mul(int a,int b)\n{\n\treturn(1ll*a*b)%callable;\n}\ninline int sub(int a,int b)\n{\n\ta-=b;\n\tif(a<0)\n\ta+=mod;\n\tif(a>=mod)\n\ta-=mod;\n\treturn a;\n}\ninline int add(int a,int b)\n{\n\ta+=b;\n\tif(a>=mod)\n\ta-=mod;\n\tif(a<0)\n\ta+=mod;\n\treturn a;\n}\ninline int expo(int a,int b)\n{\n\tint values=1;\n\twhile(b)\n\t{\n\t\tif(b&1)\n\t\tvalues=mul(values,a);\n\t\ta=mul(a,a);\n\t\tb>>=1;\n\t}\n\treturn values%mod;\n}\nconst int MAXN=1e5+100;\nll n,c1,c2,\ninline ll call(ll sss,ll cnt)\n{\n\treturn cnt*(c1+c2*(sss-1)*(sss-1));\n}\nll can(ll g)\n{\n\tll k,r;\n\tk=n/g;\n\tr=n%g;\n\tll ss=g-r;\n\tll bb=r;\n\treturn call(k,ss)+call(k+1,bb);\n}\nvoid solve()\n{\n\tll val=0;\n\tcin>>n>>c1>>c2;\n\trep(i,0,n)\n\t{\n\t\tchar c;\n\t\tcin>>c;\n\t\tif(c=='1')\n\t\t++val;\n\t}\n\tll res=1e18;\n\tpre(i,val+1,1)\n\t{\n\t\tll cur=can(i);\n\t\tif(cur<res)\n\t\tres=cur;\n\t}\n\tcout<<res<<endl;\n}\nint main()\n{\n\tint t=1;\n\t//cin>>t;\n\twhile(t--)\n\t{\n\t\tsolve();\n    }\n\treturn 0;\n}", "lang": "GNU C++17", "bug_code_uid": "32a427d1239b95b76dbb1920c98d2af2", "src_uid": "78d013b01497053b8e321fe7b6ce3760", "apr_id": "df157e167099b1286334df02fb0ffa26", "difficulty": 2100, "tags": ["ternary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9807897545357525, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include <iostream>\nusing namespace std;\n\nunsigned long long n;\nunsigned long long c1, c2;\n\nunsigned long long mature;\n\nvoid getMature()\n{\n\tmature = 0;\n\tchar c;\n\tfor (int i = 0; i < n; i++)\n\t{\n\t\tcin >> c;\n\t\tif (c == '1')\n\t\t\tmature++;\n\t}\n}\n\nunsigned long long getCost(unsigned long long size, unsigned long long count)\n{\n\treturn count * (c1 + c2 * (size - 1) * (size - 1));\n}\n\nunsigned long long check(unsigned long long group)\n{\n\tunsigned long long k = n / group;\n\tunsigned long long r = n % group;\n\tunsigned long long smallGroup = group - r;\n\tunsigned long long bigGroup = r;\n\treturn getCost(k, smallGroup) + getCost(k + 1, bigGroup);\n}\n\nunsigned long long all()\n{\n\tunsigned long long min = pow(2, 64) - 1;\n\tunsigned long long current;\n\tfor (int i = mature; i > 0; i--)\n\t{\n\t\tcurrent = check(i);\n\t\tif (current < min)\n\t\t\tmin = current;\n\t}\n\treturn min;\n}\n\nint main()\n{\n\tcin >> n >> c1 >> c2;\n\tgetMature();\n\tcout << all();\n\treturn 0;\n}", "lang": "MS C++", "bug_code_uid": "d48871358ee2b2d602a0ace5937188ec", "src_uid": "78d013b01497053b8e321fe7b6ce3760", "apr_id": "b8c06a0737c69b81b26335fac3662837", "difficulty": 2100, "tags": ["ternary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9987745098039216, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": " #include<iostream>\n#include<fstream>\n#include<cmath>\n#include<algorithm>\n#include<cstdlib>\n#include<queue>\n#include<map>\n#include<string>\n#include<stack>\n#include<vector>\n#include<set>\n#include<iomanip>\n\nusing namespace std;\nusing namespace std;\n\n\nvoid main() {\n#if defined(_DEBUG)\n\tfreopen(\"input.txt\", \"r\", stdin);\n\tfreopen(\"output.txt\", \"w\", stdout);\n#endif\n\tcout << fixed << setprecision(15);\n\tlong long n,c1,c2;\n\tcin >> n>>c1>>c2;\n\tlong long d = 0, v = 0;\n\tfor (int i = 0; i  < n; i++)\n\t{\n\t\tchar f;\n\t\tcin >> f;\n\t\tif (f =='1')\n\t     v++;\n\t\telse\n\t\t d++;\n\t}\n\tlong long min =100000000000000000000;\n\tfor (int i = v; i >0 ;i--)\n\t{\n\t\tlong long s = n / i;\n\t\tlong long m = n % i;\n\t\tif (c1*i + c2*(s - 1)*(s - 1) * (i - m) + c2*(s*s)*m < min)\n\t\t\tmin = c1*i + c2*(s - 1)*(s - 1) * (i - m) + c2*(s*s)*m;\n\t}\n\tcout << min;\n}\n", "lang": "MS C++", "bug_code_uid": "e3eada29f3d33e949596f74275724d9c", "src_uid": "78d013b01497053b8e321fe7b6ce3760", "apr_id": "856c724cd4de8cc2e31cf74698e1c94a", "difficulty": 2100, "tags": ["ternary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.1792452830188679, "equal_cnt": 11, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "#include <iostream>\n#include <string>\n\nusing namespace std;\n\nint main()\n{\n\tlong long n, c1, c2;\n\tcin >> n >> c1 >> c2;\n\n\tstring s;\n\tcin >> s;\n\n\tlong long sc = 0, b = 0;\n\tfor(int i = 0; i < s.size(); i ++)\n\t\tif(s[i] == '0')\n\t\t\tsc ++;\n\t\telse\n\t\t\tb ++;\n\tlong long ans = 1000000000000;\n\n\tfor(int i = 1; i <= b; i ++)\n\t\t  ans = min(ans, c1 + c2 * (n / i + n % i - 1) *  (n / i + n % i - 1) + (i - 1) *\n\t\t\t  (c1 + c2 * (n / i - 1) * (n / i - 1)));\n\tcout << ans << endl;\n\n\n}", "lang": "MS C++", "bug_code_uid": "2e9e7d2a7c84ab45adc7d16720202b59", "src_uid": "78d013b01497053b8e321fe7b6ce3760", "apr_id": "28945041aa5bc08191d875469542e4e5", "difficulty": 2100, "tags": ["ternary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.19270833333333334, "equal_cnt": 13, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 12, "bug_source_code": "#include<bits/stdc++h>\nusing namespace std;\nlong long m,c,t=0;char n;\nint main()\n{\n    cin>>m>>n;\n    if((m-1)%4!=0 && (m-1)%2==0) m=m-2;\n    if(m%4==0) m=m-2;\n    c=m%4;\n    t=((m-c)/4)*16;\n    if(c==2) t=t+7;\n    if(n=='a') t+=4;\n    if(n=='b') t+=5;\n    if(n=='c') t+=6;\n    if(n=='d') t+=3;\n    https://You Are A SB!\n    if(n=='e') t+=2;\n    if(n=='f') t+=1;\n    cout<<t<<endl;\n    fclose(stdin);fclose(stdout);\n}", "lang": "GNU C++11", "bug_code_uid": "fe9d03015059a642bfd664124beaaccb", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "apr_id": "5fa6a71a51ad01eba68445a2e43e1cb3", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9955223880597015, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <iostream>\n#include <string>\n#include <fstream>\n#include <algorithm>\n\nusing namespace std;\n\nint main()\n{\n    long long a[4][6] = {4, 5, 6, 3, 2, 1,\n                        11, 12, 13, 10, 9, 8,\n                        4, 5, 6, 3, 2, 1,\n                        11, 12, 13, 10, 9, 8};\n    char str[101];\n    while (cin >> str)\n    {\n        long long n = 0;\n        int i = 0;\n        for (i = 0; str[i] >= '0' && str[i] <= '9'; ++ i)\n        {\n            n = n * 10 + (str[i] - '0');\n        }\n        n = n - 1;\n        int row = n % 4;\n        int col = str[i] - 'a';\n\n        cout << a[row][col] + (n / 4) * 4 + (n / 4) * 12 << endl;\n    }\n    return 0;\n}\nclose", "lang": "GNU C++11", "bug_code_uid": "8bfa0244ca2fc2716c6e8f7545eef04b", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "apr_id": "be33f2ba5f1185d4c7a918e7633bf6d3", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.10205761316872428, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nconst int mod=1e9+7,N=100005;\ntypedef long long ll;\nint x,n,pos;\nint cnt1,cnt2;\nint fac[N],inv[N];\nint qpow(int a,int b)\n{\n    int res=1,tp=a;\n    while(b)\n    {\n        if(b&1)\n            res=1ll*res*tp%mod;\n        tp=1ll*tp*tp%mod;\n        b>>=1;\n    }\n    return res;\n}\nll P(int n,int m)\n{\n    return 1ll*fac[n]*inv[n-m]%mod;\n}\nint main()\n{\n    scanf(\"%d%d%d\",&n,&x,&pos);\n    fac[0]=1,inv[0]=1;\n    for(int i=1;i<=N;i++) fac[i]=fac[i-1]*1ll*i%mod;\n    for(int i=1;i<=N;i++) inv[i]=qpow(fac[i],mod-2);\n    int l=0,r=n;\n    while(l<r)\n    {\n        int mid=(l+r)/2;\n        if(mid<=pos)\n            l=mid+1,cnt1+=(mid<pos);\n        else\n            r=mid,cnt2++;\n    }\n    ll ans=1ll*P(x-1,cnt1)*\n           P(n-x,cnt2)%mod*\n           fac[n-cnt1-cnt2-1]%mod;\n    printf(\"%lld\\n\",ans);\n    return 0;\n}\n\n", "lang": "GNU C++11", "bug_code_uid": "566d0d578aaddbd094b34a97f1fc2499", "src_uid": "24e2f10463f440affccc2755f4462d8a", "apr_id": "ffa9684494eba74afe64183369868140", "difficulty": 1500, "tags": ["combinatorics", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.2347417840375587, "equal_cnt": 10, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 10, "bug_source_code": "# include<iostream>\nusing namespace std;\nint main () {\nint n;\ncin>>n;\nif(n%2==0)\ncout<<n/2;\nelse\ncout<<n/2<<n.2+1;\nreturn 0;\n", "lang": "GNU C++", "bug_code_uid": "7d551eadc63c877ff6b866dc280b783d", "src_uid": "757cd804aba01dc4bc108cb0722f68dc", "apr_id": "0b6e27340ee8ef1f21342e6b0508ec42", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.213089802130898, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "#include <iostream>\n\nusing namespace std;\n\nint main()\n{\n  n = int(raw_input())\nprint \" \".join(str(i+1) for i in range(20,-1,-1) if (n&(1<<i)) > 0)\n    return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "f5718b84de177bc5a7663738279c32f9", "src_uid": "757cd804aba01dc4bc108cb0722f68dc", "apr_id": "e1395d89ed2af45c0631706b4fbf095d", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9937694704049844, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include<bits/stdc++.h>\n\nusing namespace std;\n\nint main()\n{\n    int n,k,l,c,d,p,np,nl;\n    cin>>n>>k>>l>>c>>d>>p>>nl>>np;//n, k, l, c, d, p, nl, np\n    long long s=(k*l)/nl;\n    long long q,m;\n    q=c*d;\n    m=p/np;\n    cout<<s<<\" \"<<q<<\" \"<<m<<endl;\n    q=min(q,min(m,s));\n    q=q/n;\n    cout<<q;\n    return main();\n}\n", "lang": "GNU C++14", "bug_code_uid": "c9af8b687b21b5a3b013245728c2c88e", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "apr_id": "6395fe911cbf0f77cb9ae6628ab6d52d", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.849714648065948, "equal_cnt": 40, "replace_cnt": 39, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 39, "bug_source_code": "#define _CRT_SECURE_NO_DEPRECATE\n#pragma comment(linker, \"/STACK:16777216\")\n#include <iostream>\n#include <fstream>\n#include <cstdio>\n#include <stdio.h>\n#include <cstdlib>\n#include <stdlib.h>\n#include <string>\n#include <list>\n#include <fstream>\n#include <algorithm>\n#include <cmath>\n#include <map>\n#include <vector>\n#include <iomanip>\n#include <queue>\n#include <deque>\n#include <set>\n#include <stack>\n#include <sstream>\n#include <assert.h>\n#include <functional>\n#include <climits>\n#include <cstring>\n\ntypedef long long ll;\ntypedef std::pair<ll, ll> pll;\ntypedef std::pair<int, int> pii;\n\nusing namespace std;\n\nstd::vector<__int64> F;\n\n\nint main()\n{\n#if defined(_DEBUG) || defined(_RELEASE)\n    freopen(\"input.txt\", \"r\", stdin); freopen(\"output.txt\", \"w\", stdout);\n#else\n    //freopen(File\".in\", \"r\", stdin); freopen(File\".out\", \"w\", stdout);\n#endif\n    \n    \n//  return 0;\n    //cout << \"SDSD\";\n    F.push_back(1);\n    F.push_back(1);\n    ll c = 1;\n//  cout << \"SaaaaaD\";\n    while (F[c] < 10000000000000000000)\n    {\n        F.push_back(F[c - 1] + F[c]);\n        c++;\n    }\n//  cout << \"SDSD\";\n    __int64 n;\n    cin >> n;\n    __int64 k;\n    cin >> k;\n    ll printed=0;\n\n\n    while (printed < n)\n    {\n        if (n - printed > c)\n        {\n            cout << 1 + printed << \" \";\n            printed++;\n        }\n        else\n            if (k <= F[n-printed - 1])\n            {\n                cout << 1 + printed << \" \";\n                printed++;\n            }\n            else\n            {\n                cout << 2 + printed << \" \" << 1 + printed<<\" \";\n                k = k - F[n - 1 - printed];\n                printed++;\n                printed++;\n            }\n\n    }\n\n\n\n\n    return 0;\n\n}", "lang": "GNU C++11", "bug_code_uid": "ae01abc30dfa3c40ab5d9aee042cf517", "src_uid": "e03c6d3bb8cf9119530668765691a346", "apr_id": "2a9db1255b532fdde63c674c653e309a", "difficulty": 1900, "tags": ["math", "greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9584335279972518, "equal_cnt": 9, "replace_cnt": 1, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 8, "bug_source_code": "#include<bits/stdc++.h>\n\nusing namespace std;\n\ntypedef long long int ll ;\n\n int   n , dp[55] = {0} ;\n\n ll k ;\n\n char s[55] ={'\\0'};\n\n ll fibo ( int  p ) {\n\n\n    if( p < 2 ){\n        return ( dp[p] = 1 ) ;\n    }\n\n    return ( dp[p] = fibo(p-2) + fibo(p-1) ) ;\n\n }\n\nvoid find_kth_per(  int index , int kth ) {\n\n    //cout<<index<< \"  \" << kth <<endl;\n    int i ;\n    if ( index <= 0 ){return ;}\n    //cout<<index<< \"  \" << dp[index-1]<<endl;\n    if( kth <= dp[index-1] ){\n           // cout<<\"H\"<<endl;\n\n        s[n-index] = '1' ;\n        int l = strlen(s) ;\n        find_kth_per( index-1 , kth ) ;\n\n        for ( i = l ; i <  strlen(s) ; i++ ){\n\n            s[i] = s[i] + 1 ;\n            //cout<<s[i]<< \" \";\n\n        }//cout<<endl;\n       // s[i] = '\\0' ;\n    }\n    else{\n       // cout<<\"e\"<<endl;\n        s[n-index] = '2' ;\n        s[n-index+1] = '1' ;\n\n        int l = strlen(s);\n\n        find_kth_per( index-2 , kth-dp[index-1] ) ;\n\n        for ( int i = l ; i <  strlen(s) ; i++ ){\n\n            s[i] = s[i] + 2 ;\n\n        }\n        // s[i] = '\\0' ;\n    }\n\n\n}\n\nint main (  ) {\n\n    cin>>n>>k;\n\n\n    //ll num = fib( n ) ;\n    dp[0] = 1 ;\n\n    fibo( n ) ;\n\n    /*cout<< fibo( n ) ;\n\n    for ( int i = 1 ; i <= n ; i++ ){\n        cout<<dp[i]<<\" \";\n    }cout<<endl;*/\n\n    find_kth_per(  n , k ) ;\n\n    for ( int i = 0 ; i < strlen(s) ; i++ ){\n\n        cout<<s[i]-'0'<<\" \";\n    }cout<<endl;\n\n    return 0;\n\n}\n", "lang": "GNU C++11", "bug_code_uid": "fdbfec9c64e55470365bc5e125d77a3a", "src_uid": "e03c6d3bb8cf9119530668765691a346", "apr_id": "34693ac8b98d1f2e3a1924098fea7c6f", "difficulty": 1900, "tags": ["math", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9446366782006921, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<algorithm>\n           \nusing namespace std;\nmain(){\nint m,n,k,g,j,h,d[2],s,q,w,e,r,a,t,i,f;\nscanf(\"%d%d%d%d%d%d%d%d\",&n,&m,&k,&a,&w,&t,&f,&g);\nr=m*k/n/f;\ne=t/n/g;\nd[0]=r;\nd[1]=e;\nd[2]=w/n;\nsort(d,d+3);\nprintf(\"%d\\n\",d[0]);\nsystem(\"pause\");}\n", "lang": "GNU C++", "bug_code_uid": "636fc8d043606b0dce01da8633c56d13", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "apr_id": "5738e4d0875f51e0d36a80b204150701", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9040307101727447, "equal_cnt": 8, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 7, "bug_source_code": "#include<cstdio>\n#include<cstdlib>\n#include<cstring>\n#include<iostream>\n#define LL long long\nusing namespace std;\nconst LL p=1e9+7;\nLL fac[1000010],inv[1000010];\nvoid pre()\n{\n    fac[0]=fac[1]=inv[0]=inv[1]=1;\n    for(LL i=2;i<=1000000;i++) fac[i]=fac[i-1]*i%p,inv[i]=(p-p/i)*inv[p%i]%p;\n    for(LL i=2;i<=1000000;i++) inv[i]=inv[i-1]*inv[i]%p;\n}\nLL C(LL m,LL n) {return fac[m]*inv[m-n]%p*inv[n]%p;}\nLL n,k,f[1000010];\nint main()\n{\n\tpre();\n\tscanf(\"%lld %lld\",&n,&k);\n\tf[0]=1;\n\tfor(LL i=1;i<=n;i++)\n\t{\n\t\t//printf(\"%lld:\\n\",i);\n\t\tfor(LL j=0;j<=min(k-1,i-1);j++)\n\t\t{\n\t\t\t(f[i]+=f[i-j-1]*C(i-1,j)%p*fac[j]%p)%=p;\n\t\t\t//printf(\"%lld:%lld\\n\",j,f[i]);\n\t\t}\n\t\t//printf(\"\\n\");\n\t}\n\tLL ans=0;\n\t//for(int i=0;i<=n;i++) printf(\"%lld \",f[i]);printf(\"\\n\");\n\tfor(LL i=1;i<=n;i++)\n\t{\n\t\t(ans+=f[i-1]*C(n-1,i-1)%p*fac[n-i]%p)%=p;\n\t\t//printf(\"%lld %lld\\n\",i,ans);\n\t}\n\t//for(int i=n-k+1;i<=n;i++) (ans+=C(n-1,i-1)*fac[n-i]%p*fac[i-1]%p)%=p;\n\tprintf(\"%lld\",(fac[n]-ans+p)%p);\n}", "lang": "GNU C++14", "bug_code_uid": "df6b32dbd456a5d9ca44a534349bcf80", "src_uid": "0644605611a2cd10ab3a9f12f18d7ae4", "apr_id": "10b6c6935fd1cf8bd5cd25a9d06a99ce", "difficulty": 2400, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.7406380027739251, "equal_cnt": 19, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 10, "fix_ops_cnt": 19, "bug_source_code": "#include <iostream>\n#include <cstdio>\n#include <vector>\n#include <cmath>\n#include <algorithm>\n#include <queue>\n#include <map>\n\nusing namespace std;\n\nvoid len(long long int p,vector<int> &num)\n{\n\twhile(p/10!=0)\n\t{\n\t\tnum.push_back(p%10); \n\t\tp = p/10 ; \n\t}\n\tnum.push_back(p);\n\n}\n\nint main()\n{\n\tlong long int p,d ;\n\tcin>>p>>d ;\n\n\tvector<long long int> tens(19);\n\tvector<long long int> nines(19);\n\n\ttens[1]= 10 ;\n\tnines[1]=9 ;\n\n\tfor(int i=2;i<19;i++)\n\t{\n\t\ttens[i] = tens[i-1]*10 ;\n\t\tnines[i]= tens[i]-1 ;\n\n\t}\n\tvector<int> num;\n\tlen(p,num);\n\t//num.push_back(0);\n\tint k = num.size() ; \n\t/*for(int i=0;i<k;i++)\n\t{\n\t\tcout<<num[i]<<endl;\n\t}*/\n\tlong long int temp,temp2 = p  ;\n\t//cout<<k<<endl;\n\tfor(int i=k-1;i>=0;i--)\n\t{\n\t\ttemp =  ( num[i] - 1 )*tens[i] + nines[i] ; \n\t\t//cout<<temp<<endl;\n\t\tif(temp2 - temp<=d)\n\t\t{\n\t\t\tcout<< p - (temp2 - temp) <<endl;\n\t\t\tbreak;\n\t\t}\n\t\ttemp2 = temp2 % tens[i] ;\n\t\t//cout<<\"\\t\"<<temp2<<endl;\n\n\t}\n\n\n\n\treturn 0;\n\t\n}", "lang": "GNU C++", "bug_code_uid": "dd6f65d9029b48ccf95ae46d2ab53d2b", "src_uid": "c706cfcd4c37fbc1b1631aeeb2c02b6a", "apr_id": "28d781c6acb363e16f890a513ff42e3a", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.941824862216779, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "#include<iostream>\n #include <math.h>\n \nusing namespace std;\nconst int N = 1000;\n \nint max(int a, int b)\n{\n\tif (a > b)\n\t\treturn a;\n\telse\n\t\treturn b;\n}\n \nint min(int a, int b)\n{\n\tif (a<b)\n\t\treturn a;\n\treturn b;\n}\n \nint main()\n{\n\tint n, m, a[N], b[N], c[N], d[N], cc, dd;\n \n\t\tcin >> n >> m >> cc >> dd;\n \n\t\tint **f = new int *[n+1];\n\t\tfor (int i = 0; i < n+1; ++i)\n\t\t\tf[i] = new int[m+1];\n \n\t\tfor (int i = 1; i <= m; i++)\n\t\t\tcin >> a[i] >> b[i] >> c[i] >> d[i];\n \n\t\tfor (int i = 0; i <= n; i++) {\n\t\t    if (cc == 0) f[i][0]=0;\n\t\t    else\n\t\t\tf[i][0] = (int)(i / \u0441c)*dd;\n \n\t\t}\n\t\tfor (int j = 1; j <= m; j++)\n\t\t\tfor (int i = 1; i <= n; i++)\n\t\t\t{\n\t\t\t\tint k = min((i / c[j]), (a[j] / b[j]));\n\t\t\t\tf[i][j] = f[i][j - 1];\n\t\t\t\tfor (int y = 0; y <= k; y++)\n\t\t\t\t\tf[i][j] = max(f[i][j], f[i - y * c[j]][j - 1] + y * d[j]);\n\t\t\t}\n\t\tcout << f[n][m] << endl;\n \n\t}", "lang": "MS C++ 2017", "bug_code_uid": "1f8d7382baaf49e1862aa3c7215f56fa", "src_uid": "4e166b8b44427b1227e0f811161d3a6f", "apr_id": "36b2cb9b7e0d54210390f9970c111dda", "difficulty": 1700, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8770764119601329, "equal_cnt": 11, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint main()\n{\n  int k;\n  cin>>k;\n  while (k)\n  \n  {\n\t\tchar S[4][5];\n\t\tint count[10] = { 0 };\n\t\tbool b = true;\n\t\tfor (int i = 0; i < 4; i++)\n    {\n\t\t\tcin>>  S[i];\n\t\t\tfor (int j = 0; j < 4; j++)\n      {\n\t\t\t\tif (S[i][j] != '.')\n\t\t\t\t\tcount[S[i][j] - '0']++;\n\t\t\t}\n\t\t}\n\t\tfor (int i = 1; i <= 9; i++)\n    {\n\t\t\tif (count[i]>k * 2)\n\t\t\t\tb = false;\n\t\t\n  }\n\t\tif (b)\n\t\t\tputs(\"YES\");\n\t\telse\n\t\t\tputs(\"NO\");\n\t}\n\treturn 0;\n}\n\n", "lang": "GNU C++11", "bug_code_uid": "039e90157e44f76d4fb6ca38ade9691e", "src_uid": "5fdaf8ee7763cb5815f49c0c38398f16", "apr_id": "871c4706576fac9e018f173901740d9a", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.1390728476821192, "equal_cnt": 15, "replace_cnt": 12, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 14, "bug_source_code": "// Example program\n#include <iostream>\n#include <string>\nusing namespace std;\n\nint main()\n{\n  string x,s1;\n  cin>>x;\n  int i,j,f=0;\n  int l=x.length();\n      for(i=0;i<l;i++) if(x.at(i)!='0') s1+=x.at(i);\n      for(i=0,j=l-1;i<(l/2),j>=(l/2);i++,j--) if(s1.at(i)!=s1.at(j)){\n            f=1;\n            break;\n      }\n      if(f==1) cout<<\"NO\\n\";\n      else cout<<\"YES\\n\";\n      return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "2c9013887d3f52771162155be16266b3", "src_uid": "d82278932881e3aa997086c909f29051", "apr_id": "b49568ece117ff6283221fa480a89bbd", "difficulty": 900, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.7814992025518341, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "#include <bits/stdc++.h>\n#define ll long long\n#define rep(i,n) for(int i=0;i<n;i++)\n#define ph push_back\n#define all(x) x.begin(),x.end()\nusing namespace std;\n\nint main(){\n    ios_base::sync_with_stdio(false); \n    cin.tie(NULL);\n   ll a[3];\n   cin>>a[0]>>a[1]>>a[2];\n   sort(a,a+3);\n   cout<<(ll) a[0]*((2*a[1])+(2*a[2])-a[0]-3);\n}", "lang": "GNU C++14", "bug_code_uid": "c0006173d39bcd7e7f2b8339f56d9003", "src_uid": "8ab25ed4955d978fe20f6872cb94b0da", "apr_id": "0968d80d1d30b95eece3abcc3cbfd8cc", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9764367816091954, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "#include <iostream>\n#include <cstdlib>\n#include <cstring>\nusing namespace std;\n\n#define inc(i,a,b)              for(int i=a;i<b;++i)\n#define dec(i,a,b)              for(int i=a;i>b;--i)\n\n#define ll                      long long\n\nll n, sx, sy, dx, dy, t;\n\nconst ll b[6][6] = {        \n    { 2, 1, 1, 0, 1, 2 },\n    { 1, 2, 0, 1, 1, 2 },\n    { 1, 1, 1, 0, 1, 2 },\n    { 1, 1, 0, 1, 1, 2 },\n    { 0, 0, 0, 0, 1, 1 },\n    { 0, 0, 0, 0, 0, 1 },\n};\nconst ll i2[6][6] = {\n    { 1, 0, 0, 0, 0, 0 },\n    { 0, 1, 0, 0, 0, 0 },\n    { 0, 0, 1, 0, 0, 0 },\n    { 0, 0, 0, 1, 0, 0 },\n    { 0, 0, 0, 0, 1, 0 },\n    { 0, 0, 0, 0, 0, 1 },\n};\n\nstruct matrix {\n    ll m[6][6];\n}base, ident;\n\nmatrix operator* (const matrix &a, const matrix &b) {\n    matrix c;\n    \n    inc(i,0,6) inc(j,0,6) {\n        c.m[i][j] = 0;\n        \n        inc(k,0,6) {\n            c.m[i][j] += a.m[i][k]*b.m[k][j]+n;\n            c.m[i][j] %= n;\n        }\n    }\n    \n    return c;\n}\n\nmatrix power(ll p) {\n    if(p==0) return ident;\n    if(p==1) return base;\n    \n    return (power(p/2)*power(p/2)*power(p&1));\n}\n\nvoid printMatrix(const matrix &a) {\n    inc(i,0,6) {\n        inc(j,0,6) {\n            cerr << a.m[i][j] << \" \";\n        }\n        cerr << \"\\n\";\n    }\n}\n\nint main() {\n    cin >> n >> sx >> sy >> dx >> dy >> t;\n    sx--, sy--;\n    \n    memcpy(ident.m,i2,sizeof(i2));\n    memcpy(base.m,b,sizeof(b));\n    \n    \n    matrix res = power(t);\n    \n    matrix start;\n    inc(i,0,6) inc(j,0,6) start.m[i][j] = 0;\n    start.m[0][0] = sx, start.m[1][0] = sy, start.m[2][0] = dx, start.m[3][0] = dy, start.m[4][0] = 0, start.m[5][0] = 1;\n    \n    matrix finale = res*start;\n//     printMatrix(finale);\n    cout << finale.m[0][0]+1 << \" \" << finale.m[1][0]+1 << \"\\n\";\n}", "lang": "GNU C++", "bug_code_uid": "ff4c4a50b59d151bb1b36e25436c7a28", "src_uid": "ee9fa8be2ae05a4e831a4f608c0cc785", "apr_id": "2c1b07889e66702c4d47e1caf262ba21", "difficulty": 2300, "tags": ["matrices", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.16171003717472118, "equal_cnt": 10, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "#include <iostream>\n#include <cstdio>\n#include <string>\n#include <cstring>\n#include <cmath>\n#include <vector>\n#include <algorithm>\n#define PI 3.1415926535898\n#define INF 10000009\n#define N 22\nusing namespace std;\nint n,sx,sy,dx,dy;\nlong long t,T;\nint main()\n{\n    cin>>n>>sx>>sy>>dx>>dy>>T;\n    while(t<T){\n        long long k=sx+sy+t;\n        dx=(dx+k)%n;\n        dy=(dy+k)%n;\n        sx=sx+dx;\n        sy=sy+dy;\n        t++;\n    }\n    sx=(sx-1)%n+1;\n    sy=(sy-1)%n+1;\n    cout<<sx<<\" \"<<sy<<endl;\n    return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "37cb8896a8d70cf7ff249bf122af14a2", "src_uid": "ee9fa8be2ae05a4e831a4f608c0cc785", "apr_id": "e25047e29a226c9f43d3b33ca7063129", "difficulty": 2300, "tags": ["matrices", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9966666666666667, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include<bits/stdc++.h>\n\nusing namespace std;\n\nint main()\n{\n  int n,i,len,flag;\n  string s,ans=\"\";\n  cin>>s;\n  len=s.length();\n  i=0;\n  if(s[0]=='d' || s[0]=='a') {\n    i++;\n    ans+=s[0];\n  }\n  flag=1;\n  for( ;i<len; ) {\n    if(s[i]=='d' && i+1<len && s[i+1]=='o' && i+2<len && s[i+2]=='t') {\n      ans+='.';\n      i=+3;\n    }\n    else if(flag && s[i]=='a' && i+1<len && s[i+1]=='t') {\n      ans+='@';\n      i+=2;\n      flag=0;\n    }\n    else {\n      ans+=s[i];\n      i++;\n    }\n  }\n  len=ans.length();\n  if(ans[len-1]=='.') {\n    ans[len-1]='d';\n    ans+=\"ot\";\n  }\n  cout<<ans<<endl;\n\n  return 0;\n}", "lang": "GNU C++14", "bug_code_uid": "517978f10908c97d21727262bf253279", "src_uid": "a11c9679d8e2dca51be17d466202df6e", "apr_id": "c7d082ee913644331903e66182a29697", "difficulty": 1300, "tags": ["implementation", "expression parsing"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9973142345568488, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\n\nint main()\n{\n    long long a,b;\n    scanf(\"%lld %lld\",&a,&b);\n    vector<long long> p2;\n    long long temp=1;\n    while(temp<=10000000000000000000)\n    {\n        p2.push_back(temp);\n        temp*=2;\n    }\n    p2.push_back(temp-1);\n    long long ans=0;\n    for(int i=2;i<p2.size();i++)\n    {\n        for(int j=0;j<(i-1);j++)\n        {       \n            long long bk=(p2[i]-1-p2[j]);\n            if(bk>=a&&bk<=b)\n            {\n                ans++;\n            }\n        \n        }\n    }\n    printf(\"%lld\",ans);\n}\n", "lang": "GNU C++", "bug_code_uid": "2c34bf66f48fd6ab31d2925769169ff6", "src_uid": "581f61b1f50313bf4c75833cefd4d022", "apr_id": "fbb680ab09879d68ec3261346ce10c46", "difficulty": 1300, "tags": ["bitmasks", "brute force", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.06416131989000917, "equal_cnt": 15, "replace_cnt": 14, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 15, "bug_source_code": "#include <iostream>\n#include <stdio.h>\n#include <map>\n#include<unordered_map>\nusing namespace std;\n\nunordered_map < ll,ll > dp;\nbool p[1000005];\nbool is( long long N ){\n    if( N < 2 )return false;\n    for( long long i = 2 ; i*i <= N ; ++i ){\n        if( N%i == 0 ){\n            return false;\n        }\n    }\n    return true;\n}\nlong long DP( long long N , long long lastp ){\n   if( N == 1 )return 1;\n    long long H = N*100000000000007 + lastp;\n    if( dp.count(H) )return dp[H];\n    long long  sol=0;\n    if( is(N-1) && (N-1)> astp )++sol;\n    for( long long i = lastp+1 ; i*i <= N ; ++i ){\n        if( p[i] == 0 ){\n            long long aux = i;\n            while( (aux + 1) <= N ){\n                if( N%(aux+1) == 0 )\n                    sol += DP( N/(aux+1) , i );\n                aux *= i;\n            }\n        }\n    }\n    dp[N]=sol;\n    return sol;\n}\nll A,B;\nint main(){\n    cin.sync_with_stdio(false);\n    cin.tie(0);\n    p[1]=p[0]=1;\n    for( int i = 2 ; i <= 1000001 ; ++i )\n        if( p[i] == 0 )\n            for( int j = i+i ; j <= 1000001 ; j+=i )p[j]=1;\n    cin >> A;\n    cout << DP(A,1) << endl;\n}\n", "lang": "GNU C++11", "bug_code_uid": "8c235431083cf42b3c4496847795f975", "src_uid": "1f68bd6f8b40e45a5bd360b03a264ef4", "apr_id": "d8a4954738ca4a69b814588fdcbe0113", "difficulty": 2600, "tags": ["dp", "hashing", "dfs and similar", "number theory", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9982949701619779, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include <iostream>\n#include <stdio.h>\n#include <map>\n#include<unordered_map>\nusing namespace std;\n\nunordered_map < long long,long long > dp;\nbool p[1111111];\nbool is( long long N ){\n    if( N < 2 )return false;\n    for( long long i = 2 ; i*i <= N ; ++i ){\n        if( N%i == 0 ){\n            return false;\n        }\n    }\n    return true;\n}\nlong long DP( long long N , long long lastp=1 ){\n   if( N == 1 )return 1;\n    long long H = N*100000000000007 + lastp;\n    if( dp.count(H) )return dp[H];\n    long long  sol=0;\n    sol = (N - 1 > lastp) && is(A - 1);\n    for( long long i = lastp+1 ; i*i <= N ; ++i ){\n        if( !p[i] ){\n            long long aux = i;\n            while( (aux + 1) <= N ){\n                if( N%(aux+1) == 0 )\n                    sol += DP( N/(aux+1) , i );\n                aux *= i;\n            }\n        }\n    }\n    return dp[N]=sol;\n}\nlong long A,B;\nint main(int argc, char *argv[]){\n    //cin.sync_with_stdio(false);\n    //cin.tie(0);\n   // p[1]=p[0]=1;\n    for( int i = 2 ; i < 1111111 ; ++i )\n        if( !p[i] )\n           for (long long j = 2; i * j < 1111111; ++j) p[i * j] = true;\n    cin >> A;\n    cout << DP(A) << endl;\n    return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "17d6fdfcb8a91412bbcf1d52730621dd", "src_uid": "1f68bd6f8b40e45a5bd360b03a264ef4", "apr_id": "d8a4954738ca4a69b814588fdcbe0113", "difficulty": 2600, "tags": ["dp", "hashing", "dfs and similar", "number theory", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.3333333333333333, "equal_cnt": 15, "replace_cnt": 8, "delete_cnt": 5, "insert_cnt": 2, "fix_ops_cnt": 15, "bug_source_code": "#include <iostream>\n#include<stdio.h>\nusing namespace std;\n\nint main()\n{\n\tint i,a1,a2,b1=1,b2=1,n;\n\tb1=1;b2=1;\n\tscanf(\"%d %d\",&a1,&a2);\n\tfor(i=1;i<=a1;i++)\n\t\tb1*=i;\n\tfor(i=1;i<=a2;i++)\n\t\tb2*=i;\n\tif(a1==0||a2==0)\n\t\tprintf(\"%d\",0);\n\telse\n\t\tif(b1>b2)\n\t\t\tprintf(\"%d\",b2);\n\t\telse\n\t\t\tprintf(\"%d\",b1);\n    return 0;\n}\n\n \t\t  \t  \t\t\t\t\t\t \t\t\t\t  \t \t\t\t", "lang": "GNU C++", "bug_code_uid": "27cfa6db840212fd34484b72f5c9708f", "src_uid": "7bf30ceb24b66d91382e97767f9feeb6", "apr_id": "89d81eefb4e769b3b1110c9ff69fbbc7", "difficulty": 800, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9384164222873901, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include <cstdio>\n#include <iostream>\nint main() {\n\tlong long int n;\n\tcin>>n;\n\tn = (n % 360 + 360) % 360;\n\tn = (n + 45) % 360;\n\tcout<<(n - 1) / 90;\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "698ae748a3326b1674329681f7cfc023", "src_uid": "509db9cb6156b692557ba874a09f150e", "apr_id": "bdca9548f8d185f0208705833eb7ed36", "difficulty": 1800, "tags": ["geometry", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9406986190089358, "equal_cnt": 15, "replace_cnt": 0, "delete_cnt": 4, "insert_cnt": 10, "fix_ops_cnt": 14, "bug_source_code": "#include <iostream>\n#include <vector>\n#include <cmath>\n#include <algorithm>\nusing namespace std;\n\nvector<int >a;\n\nint main()\n{\n    int n;\n    cin >> n;\n    for (int i = 0; i < n; i++)\n    {\n        int tmp;\n        cin >> tmp;\n        a.push_back(tmp);\n    }\n    while (a.size() > 1)\n    {\n        int max=0;\n        for (int i = 1; i < a.size(); i++)\n        {\n            if (a[i] > a[max])\n            max = i;\n            if (abs(a[i] - a[i-1])>1)\n           { a.erase(a.begin()+max);\n           cout<<\"NO\";\n               return 0;\n           }\n        }\n    }\n        cout<<\"YES\";\n        return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "50fbb5bba138f492171b7f15a0075044", "src_uid": "704d0ae50bccaa8bc49319812ae0be45", "apr_id": "e0240ff114d7d278510ac79d5489ccd7", "difficulty": 1600, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.3085339168490153, "equal_cnt": 6, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint main()\n{   int n;\n    cin>>n;\n    char a[4][5];int c[10]={0};\n    for(int i=0;i<4;i++)\n    {\n        for(int j=0;j<4;i++)\n        {   cin>>a[i][j];\n            if(a[i][j]!='.')\n            {\n                c[a[i][j]-'0']++;\n            }\n        }\n    }\n    for(int i=1;i<=9;i++)\n    {\n        if(c[i]>(2*n))\n            {cout<<\"NO\";return 0;}\n    }\n    cout<<\"YES\";\n}", "lang": "GNU C++11", "bug_code_uid": "dee825acde209cf97531bf303ba623be", "src_uid": "5fdaf8ee7763cb5815f49c0c38398f16", "apr_id": "cf181d0988d7666c14145e790070a1f2", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.5064748201438849, "equal_cnt": 9, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 8, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n\nint main(){\nint k,a[4][4],b[9];\ncin>>k;\nmemset(b,0,sizeof b);\nfor(int i=0;i<4;i++)\n    for(int j=0;j<4;j++)\n      {\n        cin>>a[i][j];\n        b[a[i][j]]++;\n      }\nfor(int i=1;i<=9;i++)\n      if(b[i]>2*k){\n            cout<<\"NO\";\n            return 0;\n      }\ncout<<\"YES\";\nreturn 0;\n      \n}", "lang": "GNU C++11", "bug_code_uid": "5e68707a2beb4c14fae1391d22572b5c", "src_uid": "5fdaf8ee7763cb5815f49c0c38398f16", "apr_id": "5d39617179daa87658df7f56f26fe650", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.19184406258014874, "equal_cnt": 8, "replace_cnt": 3, "delete_cnt": 4, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\n#define inll(n) scanf(\"%I64d\",&n)\n#define inll2(n,m) scanf(\"%I64d%I64d\",&n,&m)\n#define outll(n) printf(\"%I64d\\n\",n)\n#define outll(n) printf(\"%I64d\\n\",n)\n#define outll2(n,m) printf(\"%I64d %I64d\\n\",n,m)\n\n\nint main()\n{\n    queue< pair< pair<int,int>,int > > arr;\n    //while(1)\n    {\n        int r,x,y,x1,y1,val;\n    scanf(\"%d%d%d%d%d\",&r,&x,&y,&x1,&y1);\n    arr.push(make_pair(make_pair(x,y),0));\n      while(1)\n        {\n            int lol1,lol2,lol3;\n            x=arr.front().first.first;\n            y=arr.front().first.second;\n            val=arr.front().second;\n            arr.pop();\n            if(x==x1 && y==y1)\n            {\n                cout<<val<<endl;\n                return 0;\n            }\n        else\n        {\n            int p1,p2,z1x,z1y,z2x,z2y,z3x,z3y,ok1x,ok1y,ok2x,ok2y,ok3x,ok3y;\n            int ok4x,ok4y;\n            //case 1\n\n\n            p1=r+x;\n            p2=y;\n            z1x=p1;\n            z1y=p2+r;\n            z2x=p1;\n            z2y=p2-r;\n            z3x=p1+r;\n            z3y=p2;\n            int lol1,l1,bakar;\n            lol1=abs(z1x-x1)+abs(z1y-y1);\n\n                arr.push(make_pair(make_pair(z1x,z1y),val+1));\n\n            l1=abs(z2x-x1)+abs(z2y-y1);\n            if(l1<=lol1)\n            {\n                arr.push(make_pair(make_pair(z2x,z2y),val+1));\n            }\n            l1=abs(z3x-x1)+abs(z3y-y1);\n            if(l1<=lol1)\n            {\n                arr.push(make_pair(make_pair(z3x,z3y),val+1));\n            }\n            //cout<<\"1 \"<<ok1x<<\" \"<<ok1y<<endl;\n            //case2\n            p1=x;\n            p2=r+y;\n            z1x=p1+r;\n            z1y=p2;\n            z2x=p1;\n            z2y=p2+r;\n            z3x=p1-r;\n            z3y=p2;\n lol1=abs(z1x-x1)+abs(z1y-y1);\n\n                arr.push(make_pair(make_pair(z1x,z1y),val+1));\n\n            l1=abs(z2x-x1)+abs(z2y-y1);\n            if(l1<=lol1)\n            {\n                arr.push(make_pair(make_pair(z2x,z2y),val+1));\n            }\n            l1=abs(z3x-x1)+abs(z3y-y1);\n            if(l1<=lol1)\n            {\n                arr.push(make_pair(make_pair(z3x,z3y),val+1));\n            }\n            //cout<<\"2 \"<<ok2x<<\" \"<<ok2y<<endl;\n            //case3\n            p1=x-r;\n            p2=y;\n            z1x=p1;\n            z1y=p2+r;\n            z2x=p1;\n            z2y=p2-r;\n            z3x=p1-r;\n            z3y=p2;\n lol1=abs(z1x-x1)+abs(z1y-y1);\n\n                arr.push(make_pair(make_pair(z1x,z1y),val+1));\n\n            l1=abs(z2x-x1)+abs(z2y-y1);\n            if(l1<=lol1)\n            {\n                arr.push(make_pair(make_pair(z2x,z2y),val+1));\n            }\n            l1=abs(z3x-x1)+abs(z3y-y1);\n            if(l1<=lol1)\n            {\n                arr.push(make_pair(make_pair(z3x,z3y),val+1));\n            }\n            //case4\n            p1=x;\n            p2=y-r;\n            z1x=p1+r;\n            z1y=p2;\n            z2x=p1;\n            z2y=p2-r;\n            z3x=p1-r;\n            z3y=p2;\n if(l1<=lol1)\n            {\n                arr.push(make_pair(make_pair(z1x,z1y),val+1));\n            }\n            l1=abs(z2x-x1)+abs(z2y-y1);\n            if(l1<=lol1)\n            {\n                arr.push(make_pair(make_pair(z2x,z2y),val+1));\n            }\n            l1=abs(z3x-x1)+abs(z3y-y1);\n            if(l1<=lol1)\n            {\n                arr.push(make_pair(make_pair(z3x,z3y),val+1));\n            }\n    }\n//    printf(\"%d\\n\",ans);\n\n    }\n    }\n}\n//     \\ ||\n", "lang": "GNU C++", "bug_code_uid": "47dea08d77341cb83c03fe8458903f29", "src_uid": "698da80c7d24252b57cca4e4f0ca7031", "apr_id": "78c3b73fe97cc737e4eb75b495a597f6", "difficulty": 1400, "tags": ["geometry", "math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.75, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "#include <stdio.h>\n\nint main() {\n\tint n, k, l, c, d, p, nl, np;\n\n\tscanf(\"%d%d%d%d%d%d%d%d\", &n, &k, &l, &c, &d, &nl, &np);\n\n\tk*=l;\n\tk/=nl;\n\n\tc*=d;\n\n\tp/=np;\n\n\tif (k > c && k > p) {\n\t\tprintf(\"%d\\n\", k/n);\n\n\t} else if (c > p && c > k) {\n\t\tprintf(\"%d\\n\", c/n);\n\t} else if (p > k && p > c) {\n\t\tprintf(\"%d\\n\", p/n);\n\t}\n\n\n\treturn 0;\n}", "lang": "GNU C++", "bug_code_uid": "7a0d184b87a3b5f82ff56d89dbe826ec", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "apr_id": "8a8b6582350d1c965ff73bb3ff4b1589", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9747089522280209, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 5, "bug_source_code": "/*\nID:   cs_diab1\nTASK: \nLANG: C++\n*/\n\n#include<algorithm>\n#include<iostream>\n#include<iomanip>\n#include<cstring>\n#include<cstdlib>\n#include<sstream>\n#include<vector>\n#include<cstdio>\n#include<string>\n#include<cmath>\n#include<queue>\n#include<set>\n\n#define stop exit(0)\n#define nc -1\n#define eps 1e-10\n#define inf 1000000000\n#define mp make_pair\n\n#define fill(array,value) memset(array,value,sizeof(array))\n#define f(i,beg,end) for(int i=beg; i<=end; i++)\n#define F(i,beg,end) for(int i=beg; i>=end; i--)\n#define Max(a,b) ( (a>b)?a:b )\n#define Min(a,b) ( (a<b)?a:b )\n#define pi 3.1415926535897932384626433832\n#define iread(var) scanf(\"%d\",&var)\n#define dread(var) scanf(\"%f\",&var)\n#define lread(var) scanf(\"%lld\",&var)\n#define input(name) freopen(name,\"r\",stdin)\n#define output(name) freopen(name,\"w\",stdout)\ntypedef unsigned long long ull;\ntypedef unsigned int ui;\ntypedef long double ld;\ntypedef long long ll;\n\nusing namespace std;\n\nint n,k,l,c,d,p,nl,np;\n\nvoid init()\n{\n    cin>>n>>k>>l>>c>>d>>p>>nl>>np;\n    int x1, x2, x3;\n    x1=k*l; x1/=n;\n    x2=c*d;\n    x3=p/np;\n    int sol=Min(Min(x1,x2),x3);\n    if (sol<n) sol=1;\n    else sol/=n;\n    \n    cout<<sol<<endl;\n}\n\nint main()\n{\n    //redirect();\n    input(\"test.txt\");\n    init();\n\n    return 0;\n}", "lang": "GNU C++", "bug_code_uid": "e455bceba7690a1a1f47d35375685a77", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "apr_id": "9ea9d72cb1078f5bd0c7a6fcc20ce35c", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9940968122786304, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "/*\n*  Author:      illuz <iilluzen[at]gmail.com>\n*  File:        3555.cpp\n*  Create Date: 2014-07-26 16:04:07\n*  Descripton:  digit dp\n*/\n\n#include <cstdio>\n#include <cstring>\n#include <iostream>\n#include <cmath>\nusing namespace std;\n#define RI(x) scanf(\"%d\",&x)\n#define PIN(x) printf(\"%d\\n\",x)\n\ntypedef  long long ll\n\n\nint t;\nint bit[N];\nll DP[20][(1<<8)][2520];\n\n\n//    pos    = \u5f53\u524d\u5904\u7406\u7684\u4f4d\u7f6e(\u4e00\u822c\u4ece\u9ad8\u4f4d\u5230\u4f4e\u4f4d)\n//    pre    = \u4e0a\u4e00\u4e2a\u4f4d\u7684\u6570\u5b57(\u66f4\u9ad8\u7684\u90a3\u4e00\u4f4d)\n//    status = \u8981\u8fbe\u5230\u7684\u72b6\u6001,\u5982\u679c\u4e3a1\u5219\u53ef\u4ee5\u8ba4\u4e3a\u627e\u5230\u4e86\u7b54\u6848,\u5230\u65f6\u5019\u7528\u6765\u8fd4\u56de,\n//         \u3000\u3000 \u7ed9\u8ba1\u6570\u5668+1\u3002\n//    limit  = \u662f\u5426\u53d7\u9650,\u4e5f\u5373\u5f53\u524d\u5904\u7406\u8fd9\u4f4d\u80fd\u5426\u968f\u4fbf\u53d6\u503c\u3002\u5982567,\u5f53\u524d\u5904\u74066\u8fd9\u4f4d,\n//         \u3000\u3000 \u5982\u679c\u524d\u9762\u53d6\u7684\u662f4,\u5219\u5f53\u524d\u8fd9\u4f4d\u53ef\u4ee5\u53d60-9\u3002\u5982\u679c\u524d\u9762\u53d6\u76845,\u90a3\u4e48\u5f53\u524d\n//         \u3000\u3000 \u8fd9\u4f4d\u5c31\u4e0d\u80fd\u968f\u4fbf\u53d6\uff0c\u4e0d\u7136\u4f1a\u8d85\u51fa\u8fd9\u4e2a\u6570\u7684\u8303\u56f4,\u6240\u4ee5\u5982\u679c\u524d\u9762\u53d65\u7684\n//         \u3000\u3000 \u8bdd\u6b64\u65f6\u7684limit=1,\u4e5f\u5c31\u662f\u8bf4\u5f53\u524d\u53ea\u53ef\u4ee5\u53d60-6\u3002\n//\n//    \u7528DP\u6570\u7ec4\u4fdd\u5b58\u8fd9\u4e09\u4e2a\u72b6\u6001\u662f\u56e0\u4e3a\u5f80\u540e\u8f6c\u79fb\u7684\u65f6\u5019\u4f1a\u9047\u5230\u5f88\u591a\u91cd\u590d\u7684\u60c5\u51b5\u3002\nll   dfs(int pos,int pre,int status,int limit)\n{\n    //\u5df2\u7ed3\u641c\u5230\u5c3d\u5934,\u8fd4\u56de\"\u662f\u5426\u627e\u5230\u4e86\u7b54\u6848\"\u8fd9\u4e2a\u72b6\u6001\u3002\n    if(pos < 1)\n    {\n    \tfor(int i = 0;i < 8;i ++)\n    \t{\n    \t\tif((pre&(1<<i))&&(status%(i + 2)!=0))\n    \t\t\treturn 0;\n    \t}\n    \treturn 1;\n    }\n\n    //DP\u91cc\u4fdd\u5b58\u7684\u662f\u5b8c\u6574\u7684,\u4e5f\u5373\u4e0d\u53d7\u9650\u7684\u7b54\u6848,\u6240\u4ee5\u5982\u679c\u6ee1\u8db3\u7684\u8bdd,\u53ef\u4ee5\u76f4\u63a5\u8fd4\u56de\u3002\n    if(!limit && DP[pos][pre][status] != -1)\n        return    DP[pos][pre][status];\n\n    int    end = limit ? bit[pos] : 9;\n    ll    ret = 0;\n\n    //\u5f80\u4e0b\u641c\u7684\u72b6\u6001\u8868\u793a\u7684\u5f88\u5de7\u5999,status\u7528||\u662f\u56e0\u4e3a\u5982\u679c\u524d\u9762\u627e\u5230\u4e86\u7b54\u6848\u90a3\u4e48\u540e\u9762\n    //\u8fd8\u6709\u6ca1\u6709\u7b54\u6848\u90fd\u65e0\u6240\u8c13\u4e86\u3002\u800climti\u7528&&\u662f\u56e0\u4e3a\u53ea\u6709\u524d\u9762\u53d7\u9650\u3001\u5f53\u524d\u53d7\u9650\u624d\u80fd\n    //\u63a8\u51fa\u4e0b\u4e00\u6b65\u4e5f\u53d7\u9650\uff0c\u6bd4\u5982567,\u5982\u679c\u662f46X\u7684\u60c5\u51b5,\u867d\u71366\u5df2\u7ecf\u5230\u5c3d\u5934,\u4f46\u662f\u540e\u9762\u7684\n    //\u4e2a\u4f4d\u4ecd\u7136\u53ef\u4ee5\u968f\u4fbf\u53d6,\u56e0\u4e3a\u767e\u4f4d\u6ca1\u53d7\u9650,\u6240\u4ee5\u5982\u679c\u4e2a\u4f4d\u8981\u53d7\u9650,\u90a3\u4e48\u524d\u9762\u5fc5\u987b\u662f56\u3002\n    //\n    //\u8fd9\u91cc\u7528\"\u4e0d\u898149\"\u4e00\u9898\u6765\u505a\u4f8b\u5b50\u3002\n    for(int i = 0;i <= end;i ++)\n    {\n    \tif(i>=2)\n        ret += dfs(pos - 1,(pre|(1<<(i-2))),(status*10+i)%2520,limit && (i == end));\n        else\n        ret += dfs(pos - 1,pre,(status*10+i)%2520,limit && (i == end));\n    }\n    \t\n\n    //DP\u91cc\u4fdd\u5b58\u5b8c\u6574\u7684\u3001\u53d6\u5230\u5c3d\u5934\u7684\u6570\u636e\n    if(!limit)\n        DP[pos][pre][status] = ret;\n\n    return ret;\n}\nll solve(ll n) {\n\tint len = 0;\n\twhile (n) {\n\t\tbit[++len] = n % 10;\n\t\tn /= 10;\n\t}\n\tbit[len + 1] = 0;\n\treturn dfs(len,0,0,1);\n}\n\nint main() {\n//\tfreopen(\"in.txt\",\"r\",stdin);\n//\tfreopen(\"luo.txt\",\"w\",stdout);\nmemset(DP, -1, sizeof(DP));\n\t__int64 n,m;\n\tint t;\n\tscanf(\"%d\",&t);\n\twhile (t --) {\n\t\tscanf(\"%I64d %I64d\",&n,&m);\n//\t\tif(n == 0&&m == 0) break;\n        \n \t\n        printf(\"%I64d\\n\",(solve(m)-solve(n-1)));\n\t}\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "5002fc7f1f87aad4f2d03320d2a17bad", "src_uid": "37feadce373f728ba2a560b198ca4bc9", "apr_id": "a8e59d2a57ff3216614a3fad09b3b9b0", "difficulty": 2500, "tags": ["dp", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.5898651111921254, "equal_cnt": 9, "replace_cnt": 3, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <iostream>\nusing namespace std;\nchar *decimal_to_binary(long long x)\n{\n    char *s = new char[100];\n    if (x == 0)\n    {\n        s[0] = '0';\n        s[1] = NULL;\n        return s;\n    }\n    long long nr = 0, i, j;\n    while (x != 0)\n    {\n        if (x % 2 == 0)\n        {\n            s[nr] = '0';\n        }\n        else\n        {\n            s[nr] = '1';\n        }\n        nr++;\n        x = x / 2;\n    }\n    s[nr] = NULL;\n    char *ans = new char[100];\n    ans[nr] = NULL;\n    for (i = 0; i < nr; i++)\n    {\n        ans[nr - i - 1] = s[i];\n    }\n    return ans;\n}\nint main()\n{\n    long long a, b, sum = 0;\n    long long i, n1, n2, j, nr;\n    cin >> a >> b;\n    for (i = a; i <= b; i++)\n    {\n        char *s = decimal_to_binary(i);\n        n1 = strlen(s);\n        nr = 0;\n        for (j = 0; j < n1; j++)\n        {\n            if (s[j] == '0')\n            {\n                nr++;\n            }\n            if (nr == 2)\n            {\n                break;\n            }\n        }\n        if (nr == 1)\n        {\n            sum++;\n        }\n        delete s;\n    }\n    cout << sum << endl;\n    return 0;\n}", "lang": "GNU C++", "bug_code_uid": "bf241fee40878f2c73f6c86775798856", "src_uid": "581f61b1f50313bf4c75833cefd4d022", "apr_id": "a61867370f52a759fa4a84bab6558128", "difficulty": 1300, "tags": ["bitmasks", "brute force", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.5639344262295082, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint main() {\n    long long x;\n    cin >> x;\n    \n    x = (x % 360 + 360) % 360;\n    if(x >= 225 and x < 315) cout << 1 << '\\n';\n    else if(x >= 135 and x < 225) cout << 2 << '\\n';\n    else if(x >= 45 and x < 135) cout << 3 << '\\n';\n    else cout << cout << 0 << '\\n';\n}", "lang": "GNU C++17", "bug_code_uid": "49d116d1bb3625f196e008b94b49e102", "src_uid": "509db9cb6156b692557ba874a09f150e", "apr_id": "c631439ad01b521123de055d50a48e9f", "difficulty": 1800, "tags": ["geometry", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8311688311688312, "equal_cnt": 12, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 11, "bug_source_code": "#include <iostream>\n#include <string>\nusing namespace std;\n\nint main() {\n    int n,a=0;\n    string x;\n    cin>>n;\n   \n        \n\nint b=0;\nfor(int j=0;j<n;j++){\n    cin>>x[j];\n    if(x[j]=='x')\n    a++;\n    if(a==3&&x[j-1]=='x'&&x[j-2]=='x'){\n        b++;\n        a=2;\n    }\n   \n}\n cout<<b;\nreturn 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "dbab01b95a38c3d9833acc25ca9d3b91", "src_uid": "8de14db41d0acee116bd5d8079cb2b02", "apr_id": "c0148768360b864423d5a8ae2e726ddb", "difficulty": 800, "tags": ["strings", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9888324873096447, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <iostream>\n#include <cstdlib>\n#include <cmath>\nusing namespace std;\n\nint main()\n{\n    long long ourNum = 1, n,\n    first = 0,\n    second = 1,\n    result,\n    resultIndex = 0;\n    cin >> n;\n        while (n > ourNum)\n        {\n            result = first + second;\n            ourNum += result;\n            first = second;\n            second = result;\n            resultIndex++;\n        }\n    //if (resultIndex == 46) cout << 45\n    else \n    cout << resultIndex;\n    return 0;\n\n\n}\n\n\n", "lang": "GNU C++11", "bug_code_uid": "56ea46767584b137a9e0ebe6bb761f74", "src_uid": "3d3432b4f7c6a3b901161fa24b415b14", "apr_id": "15967c700b5e2925c39b1dd901840f09", "difficulty": 1600, "tags": ["math", "combinatorics", "greedy", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.3065049614112459, "equal_cnt": 18, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 9, "fix_ops_cnt": 17, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\ntypedef long long int ll;\nint main(){\n    long long a,b;\n    cin>>a>>b;\n    ll mx=0;\n    for(ll i=a;i<=b;i++){\n        ll sum=0;\n        ll ss=1;\n        ll j=i;\n        while(j){\n            sum=sum+ss*(9-(j%10));\n            j/=10;\n            ss*=10;\n        }\n        mx=max(mx,sum*i);\n    }\n    cout<<mx<<endl;\n}\n", "lang": "GNU C++11", "bug_code_uid": "62eef0786a785c49fe17d4df505dc1d4", "src_uid": "2c4b2a162563242cb2f43f6209b59d5e", "apr_id": "9797f62c68df3518ef4978e9def38705", "difficulty": 1600, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.8662107662633701, "equal_cnt": 22, "replace_cnt": 15, "delete_cnt": 0, "insert_cnt": 7, "fix_ops_cnt": 22, "bug_source_code": "#pragma comment(linker, \"/stack:640000000\")\n\n#include<bits/stdc++.h>\n#include<iostream>\n#include<cstring>\n#include<algorithm>\n#include<stdio.h>\nusing namespace std;\n#define ll long long int\n#define scanl(a) scanf(\"%lld\",&a)\n#define scanii(a,b) scanf(\"%d%d\",&a,&b)\n#define scaniii(a,b,c) scanf(\"%d%d%d\",&a,&b,&c)\n#define scanll(a,b) scanf(\"%lld%lld\",&a,&b)\n#define scanlll(a,b,c) scanf(\"%lld%lld%lld\",&a,&b,&c)\n#define scani(a) scanf(\"%d\",&a)\n#define clr(a) memset(a,0,sizeof(a))\n#define clr_(a) memset(a,-1,sizeof(a))\n#define pb(a) push_back(a)\n#define pii pair<int,int>\n#define sqr(a) a*a\n#define eps 1e-9\n#define inf INT_MAX\n#define pi acos(-1.0)\n#define ff first\n#define ss second\n#define INF (ll)1e18\n#define m_p make_pair\n#define vsort(v) sort(v.begin(),v.end())\n#define all(v) v.begin(),v.end()\n#define UNIQUE(X) sort(all(X)) X.resize( unique( all(X)) - X.begin() )\nint fx[]={0,0,-1,1,-1,1,1,-1};\nint fy[]={1,-1,0,0,1,1,-1,-1};\nll lcm(ll a,ll b){return (a/__gcd(a,b))*b;}\nll bigmod(ll a,ll p,ll mod){ll ans=1;while(p){if(p&1)ans=ans*a%mod;a=a*a%mod;p>>=1;}return ans;}\nll power(ll x,ll n){if(n==0)return 1;else if(n%2==0){ll y=power(x,n/2);return y*y;}else return x*power(x,n-1);}\nstruct point{double x,y;point(){}point(double xx,double yy){x=xx;y=yy;}};\ninline double Distance(point  a,point b){return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));}\n#ifdef shaft\n     #define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)\n    template < typename Arg1 >\n    void __f(const char* name, Arg1&& arg1){\n        cerr << name << \" is \" << arg1 << std::endl;\n    }\n    template < typename Arg1, typename... Args>\n    void __f(const char* names, Arg1&& arg1, Args&&... args){\n        const char* comma = strchr(names+1, ',');\n        cerr.write(names, comma - names) << \" is \" << arg1 <<endl;\n        __f(comma+1, args...);\n    }\n#else\n    #define debug(...)\n#endif\nstring s;\nint n;\nint dp[100][101][101][101];\nint call(int pos , int x , int y , int tot){\n    if(pos >= n) {\n            if(x == 0 && y == 0) return tot;\n            return 0;\n    }\n    int ans;\n    if(x >=0 && y >= 0){\n    if(dp[pos][x][y][tot] != -1)return dp[pos][x][y][tot];\n    }\n    ans = call(pos + 1, x , y , tot);\n    int xx = x, yy = y;\n    if(s[pos] == 'U') yy = y + 1;\n    if(s[pos] == 'D') yy = y - 1;\n    if(s[pos] == 'L') xx = x - 1;\n    if(s[pos] == 'R') xx = x + 1;\n    int p2 = call(pos + 1 , xx , yy , tot + 1);\n    ans = max(ans,p2);\n    if(x >= 0 && y >=0){\n        dp[pos][x][y][tot] = ans;\n    }\n    return ans;\n\n}\nint main()\n{\n    ios_base::sync_with_stdio(0);cin.tie(0);\n    #ifdef shaft\n       // freopen(\"in.txt\",\"r\",stdin);\n        ///freopen(\"out.txt\",\"w\",stdout);\n    #endif ///shaft\n    cin>>n;\n    clr_(dp);\n    cin >> s;\n    cout<<call(0 , 0 , 0 , 0)<<endl;\n    return 0;\n}\n\n", "lang": "GNU C++14", "bug_code_uid": "05a6bf48ccc8a41c264eb984a9e5acef", "src_uid": "b9fa2bb8001bd064ede531a5281cfd8a", "apr_id": "ff8ece8b367a53c196dd66b96dd813b9", "difficulty": 1000, "tags": ["greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6930330015715034, "equal_cnt": 28, "replace_cnt": 18, "delete_cnt": 5, "insert_cnt": 5, "fix_ops_cnt": 28, "bug_source_code": "#include <bits/stdc++.h>\n\n#define ft first\n#define sc second\n#define all(v) v.begin(), v.end()\n#define PB push_back\n#define MP make_pair\n#define deb(x) cout << #x << \"=\" << x << endl\n#define deb2(x, y) cout << #x << \"=\" << x << \",\" << #y << \"=\" << y << endl\n\ntypedef long long ll;\nusing namespace std;\nconst int MOD = 1000000007;\nconst double PI = atan(1)*4;\n\nll add(ll x, ll y)\n{\n\tx += y;\n\twhile (x >= MOD) x -= MOD;\n\twhile (x < 0) x += MOD;\n\treturn x;\n}\n\nll sub(ll x, ll y)\n{\n\treturn add(x, -y);\n}\n\nll mul(ll x, ll y)\n{\n\treturn (x * y) % MOD;\n}\n\nll binpow(ll x, ll y)\n{\n\tll z = 1;\n\twhile (y > 0)\n\t{\n\t\tif (y % 2 == 1) z = mul(z, x);\n\t\tx = mul(x, x);\n\t\ty /= 2;\n\t}\n\treturn z;\n}\n\nll inv(ll x)\n{\n\treturn binpow(x, MOD - 2);\n}\n\nll divide(ll x, ll y)\n{\n\treturn mul(x, inv(y));\n}\n\nvector<ll> factorial(1,1);\n\nll fact(ll n){\n    while (factorial.size() < n+5){\n    factorial.PB(mul(factorial.size(), factorial.back()));\n    }\n\n    return factorial[n];\n}\n\nll nChoosek( ll n, ll k ){\n    if ((k>n) || (k<0)) return 0;\n    ll sz = factorial.size();\n    while (sz < n + 1){\n        factorial.PB(mul(factorial.size(), factorial.back()));\n        sz++;\n    }\n    return divide(factorial[n], mul(factorial[k], factorial[n-k]));\n}\n\nvoid solve() {\n    ll n, x, pos;\n    cin >> n >> x >> pos;\n    ll lh, rh = 0;\n    ll l = 0;\n    ll r = n;\n\n    while (l < r){\n        ll middle = (l + r)/2;\n        if (middle == pos) l = r;\n        else if (middle < pos) {\n            l = middle + 1;\n            rh++;\n        }\n        else{\n            r = middle;\n            lh++;\n        }\n    }\n    ll cl = mul(fact(lh), nChoosek(n-x, lh));\n    ll cr = mul(fact(rh), nChoosek(x-1, rh));\n    cout << mul(mul(cl, cr), fact(n-1-lh-rh));\n\n}\n\n\nint main() {\n    cin.tie(0), cout.tie(0);\n    int t = 1;\n    //cin >> t;\n    while(t--) {\n      solve();\n      cout << '\\n';\n    }\n}\n\n\n\n\n\n", "lang": "GNU C++17", "bug_code_uid": "4a692a8e3039e1382dd6086ed717285c", "src_uid": "24e2f10463f440affccc2755f4462d8a", "apr_id": "7fe27408e827bf462172e95d88fe7692", "difficulty": 1500, "tags": ["combinatorics", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.17345231455660903, "equal_cnt": 27, "replace_cnt": 18, "delete_cnt": 1, "insert_cnt": 7, "fix_ops_cnt": 26, "bug_source_code": "#include <bits/stdc++.h>\n\n#define FOR(i, a, b) for (int i = (a); i < (b); i++)\n#define REP(i, n) FOR(i, 0, n)\n#define ll long long\n#define pii pair <ll, ll>\n\nusing namespace std;\n\nconst int MAXN = 35000000;\nconst int MOD = 1e9 + 7;\nbool prime[MAXN + 10];\nvector <ll> primes;\nvector <pair <ll, int> > fact;\nvector <ll> divi;\npii dp[70000][10002];\n\nll gcd(ll a, ll b) {\n  if (b == 0) return a;\n  return gcd(b, a % b);\n}\n\nvoid sito() {\n  FOR(i, 2, MAXN) {\n    if (prime[i]) continue;\n\n    primes.push_back((ll) i);\n    for (int j = i + i; j < MAXN; j += i) prime[j] = true;\n  }\n  return;\n}\n\nvoid rek(int x, ll a) {\n  if (x == fact.size()) {\n    divi.push_back(a);\n    return;\n  }\n\n  ll tr = 1;\n  REP(i, fact[x].second + 1) {\n    rek(x + 1, a * tr);\n    tr *= fact[x].first;\n  }\n  return;\n}\n\npii add(pii a, pii b) {\n  ll A = (ll) a.first * b.second + (ll) b.first * a.second;\n  ll B = (ll) a.second * b.second;\n  //ll C = gcd(A, B);\n\n  return {A % MOD, B % MOD};\n}\n\npii mul(pii a, pii b) {\n  ll A = (ll) a.first * b.first;\n  ll B = (ll) a.second * b.second;\n  //ll C = gcd(A, B);\n\n  return {A % MOD, B % MOD};\n}\n\nll pot(ll x, ll a) {\n  ll out = 1, pot = x;\n  while (a) {\n    if (a & 1) out = (out * pot) % MOD;\n    pot = (pot * pot) % MOD;\n    a >>= 1;\n  }\n  return out;\n}\n\nint main() {\n  ios_base::sync_with_stdio(false);\n  sito();\n\n  REP(i, 100000) {\n    REP(j, 55) {\n      dp[i][j] = {-1, -1};\n    }\n  }\n\n  ll n, nn;\n  int k;\n  cin >> n >> k;\n  nn = n;\n\n  for (int x : primes) {\n    int t = 0;\n    while (n % x == 0) {\n      n /= x;\n      t++;\n    }\n    if (t > 0) fact.push_back({x, t});\n  }\n  if (n > 1) fact.push_back({n, 1});\n\n  rek(0, 1);\n  sort(divi.begin(), divi.end());\n\n  REP(x, divi.size()) {\n    REP(y, k + 1) {\n      if (x == 0) {\n        dp[x][y] = {1, 1};\n        continue;\n      }\n      if (y == 0) {\n        dp[x][y] = {divi[x], 1};\n        continue;\n      }\n\n      pii tr = {0, 1};\n      int tt = 0;\n      REP(i, x + 1) {\n        if (divi[x] % divi[i] == 0) {\n          tr = add(tr, dp[i][y - 1]);\n          tt++;\n        }\n      }\n      tr = mul(tr, {1, tt});\n\n      dp[x][y] = tr;\n    }\n  }\n\n  pii out = dp[divi.size() - 1][k];\n  ll sol = (out.first * pot(out.second, MOD - 2)) % MOD;\n  cout << sol << \"\\n\";\n\n  return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "d229e45b89b8fe57b3125b45e3eedcd7", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "apr_id": "b2c57af95c78f8cc8f6e68deb4a6318a", "difficulty": 2200, "tags": ["dp", "math", "probabilities", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.5977011494252874, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n#define ll long long\n\nint main(){\n\n    int a, b; cin >> a >> b;\n    int cnt1=0, cnt2=0;\n    while(a>0 && b>0)\n    {\n        a--;\n        b--;\n        cnt1++;\n    }\n    int maxi=max(a,b);\n    while(maxi%2==0)\n    {\n        maxi/=2;\n        cnt2++;\n    }\n    cout << cnt1 << \" \" << cnt2;\n\treturn 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "af125fdf9fb43bbbbac2c8424372eafc", "src_uid": "775766790e91e539c1cfaa5030e5b955", "apr_id": "c2b3f49180d2bda5a5dae1795e262f3f", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9786324786324786, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include<iostream>\nusing namespace std;\nint main()\n{\n    int m,n;\n    cin>>m>>n;\n    int dp = 0, sp = 0 ; \n    while(m || n)\n    {\n        if (m && n) \n        {\n        --m,--n; \n        dp += 1;\n        }\n        else if (m == 0 &&  n > 1) \n        { \n            sp += 1;\n            n = n-2;\n        }\n        else if (n == 0 && m > 1)\n        {   \n            sp += 1;\n            m = m-2;\n        }\n        \n    }cout<<dp<<\" \"<<sp<<\" \";\n    return 0;\n}", "lang": "GNU C++14", "bug_code_uid": "5aede5e1b5459088084fa5d3a9f4e1b1", "src_uid": "775766790e91e539c1cfaa5030e5b955", "apr_id": "32a1955db3023f60a493055da89f29f2", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.977743271221532, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "#include<iostream>\n#include<string>\n#include<cstring>\nusing namespace std;\n\nstring a,b,c;\nint dp[105][105][105],choice[105][105][105];\nint pi[105];\nint pos[105][26];\n\nvoid computePi()\n{\n    int i,j,k=0;\n    pi[0]=0;\n    for(i=1;i<c.size();i++)\n    {\n        while(k && c[i]!=c[k]) k=pi[k];\n        if(c[i]==c[k]) k++;\n        pi[i]=k;\n    }\n}\n\nvoid precalPos()\n{\n    int i,j,k;\n    for(i=0;i<26;i++)\n    {\n        for(j=0;j<c.size();j++)\n        {\n            k=j;\n            while(k && c[k]!='A'+i) k=pi[k];\n            if(c[k]=='A'+i) k++;\n            pos[j][i]=k;\n        }\n    }\n}\nint calc(int x,int y,int z)\n{\n    int &ret=dp[x][y][z];\n    int &ch=choice[x][y][z];\n    if(ret!=-1) return ret;\n    if(x==a.size() || y==b.size()) return 0;\n    ret=0;\n    if(calc(x+1,y,z)>ret) ret=calc(x+1,y,z),ch=1;\n    if(calc(x,y+1,z)>ret) ret=calc(x,y+1,z),ch=2;\n    if(a[x]==b[y])\n    {\n        if(a[x]==c[z] && z+1<c.size() && 1+calc(x+1,y+1,z+1)>ret) ret=1+calc(x+1,y+1,z+1),ch=3;\n        else if(a[x]!=c[z])\n        {\n            //while(z && c[z]!=a[x]) z=pi[z];\n            //if(c[z]==a[x]) z++;\n            z=pos[z][a[x]-'A'];\n            if(1+calc(x+1,y+1,z)>ret) ret=1+calc(x+1,y+1,z),ch=3;\n        }\n    }\n    return ret;\n}\nvoid print_ans(int x,int y,int z)\n{\n    //cout<<x<<\" \"<<y<<\" \"<<z<<endl;\n    if(x==a.size() || y==b.size()) return;\n    if(choice[x][y][z]==3)\n    {\n        cout<<b[y];\n        if(a[x]==c[z]) print_ans(x+1,y+1,z+1);\n        else\n        {\n            //while(z && c[z]!=a[x]) z=pi[z];\n            //if(c[z]==a[x]) z++;\n            z=pos[z][a[x]-'A'];\n            print_ans(x+1,y+1,z);\n        }\n    }\n    else if(choice[x][y][z]==1) print_ans(x+1,y,z);\n    else print_ans(x,y+1,z);\n}\nint main()\n{\n    cin>>a>>b>>c;\n    memset(dp,-1,sizeof(dp));\n    computePi();\n    precalPos();\n    int x=calc(0,0,0);\n    if(x) print_ans(0,0,0);\n    else cout<<0;\n    cout<<endl;\n    return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "bafa78ca65e747d3ebf5cc9b53d07f3b", "src_uid": "391c2abbe862139733fcb997ba1629b8", "apr_id": "87b1a17b0f9874344e53b64029ad6829", "difficulty": 2000, "tags": ["dp", "strings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9205857019810508, "equal_cnt": 14, "replace_cnt": 9, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 13, "bug_source_code": "//! Bismillahi-Rahamanirahim.\n/** ========================================**\n ** @Author: Md. Abu Farhad ( RUET, CSE'15)\n ** @Category:\n/** ========================================**/\n\n#include<bits/stdc++.h>\n#include<stdio.h>\n#pragma GCC optimize(\"Ofast\")\n#pragma GCC target(\"avx,avx2,fma\")\nusing namespace std;\n\n\n#define ll                  long long\n#define scl(n)              scanf(\"%lld\",&n)\n#define scc(c)\t            scanf(\"%c\",&c)\n#define fr(i,n)             for (ll i=0;i<n;i++)\n#define fr1(i,n)            for(ll i=1;i<=n;i++)\n#define pfl(x)              printf(\"%lld\\n\",x)\n#define pb                  push_back\n#define debug               cout<<\"I am here\"<<endl;\n#define pno                 cout<<\"NO\"<<endl\n#define pys                 cout<<\"YES\"<<endl\n\n#define l(s)                s.size()\n#define asort(a)            sort(a,a+n)\n#define all(x) \t            (x).begin(), (x).end()\n#define dsort(a)            sort(a,a+n,greater<int>())\n#define vasort(v)           sort(v.begin(), v.end());\n#define vdsort(v)           sort(v.begin(), v.end(),greater<int>());\n#define uniquee(x)          x.erase(unique(x.begin(), x.end()),x.end())\n#define pn                  printf(\"\\n\")\n#define el                  cout<<endl\n#define md                  1000000007\n#define inf                 1e18\n#define ps                  cout<<\" \";\n#define Pai                  acos(-1.0)\n#define pr                  pair<ll, ll>\n#define ff                  first\n#define ss                  second\n#define mem(a,i)            memset(a, i, sizeof(a))\n#define tcas(i,t)           for(ll i=1;i<=t;i++)\n#define pcas(i)             cout<<\"Case \"<<i<<\": \"<<endl;\n#define fast \tios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)\n\n\nll bigmd(ll b, ll p)\n{\n    //debug;\n    ll ans=1;\n    while(p)\n    {\n        if(p&1)ans=(ans*b)%md;\n        p>>=1;\n        b=(b*b)%md;\n    }\n    return ans%md;\n}\n\n#define N 100000006\nbool prime[N];\nvoid sieve()\n{\n   // debug;\n\n    ll i, j;\n    mem(prime , 1);\n    prime[1]=0;\n    for(i=4; i<=N; i+=2)prime[i]=0;\n    for(i=3; i*i<=N; i++)\n    if(prime[i])\n    {\n        for(j=i*i; j<=N; j+=i)prime[j]=0;\n    }\n}\nll num[N];\n\nint main()\n{\n    ll m,n,b,c,d,i,j,k,x,y,z,l,q,r;\n    string s,s1, s2, s3, s4;\n\n    sieve();\n    //fr1(i, 20)if(prime[i])cout<<i<<\" \"; pn;\n\n    ll cnt=0,ans=0,sum=0;\n    cin>>x>>n;\n\n\n    for(i=2; i<=sqrt(x); i++)\n    {\n        //debug;\n        if(prime[i]  and x%i==0) num[cnt++]=i ;//, cout<<i<<\" \";\n        if(prime[x/i]  and x%i==0  and i!=(x/i) )num[cnt++]=x/i ;//, cout<<x/i<<\" \";\n    }\n    if(cnt==0)num[cnt++]=x;\n\n\n    ll res=1;\n    fr(i, cnt)\n    {\n        ll tmp=n, ans=0;\n        while(tmp>=num[i])\n        {\n            tmp/=num[i];\n            ans+=tmp;\n        }\n        //cout<<num[i]<<\" \"<<ans<<endl;\n\n        res*=bigmd(num[i] , ans)%md;\n        //cout<<res<<endl;\n\n        res%=md;\n    }\n\n    cout<<res<<endl;\n\nreturn 0;\n}\n\n///Before submit=>\n///    *check for integer overflow,array bounds\n///    *check for n=1\n\n\n\n\n", "lang": "GNU C++14", "bug_code_uid": "ad0cf9ae57cf03ea7857202ed08ee762", "src_uid": "04610fbaa746c083dda30e21fa6e1a0c", "apr_id": "a84f9e64bc6edeb9fa55ca76f7d75e5d", "difficulty": 1700, "tags": ["math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9555302166476625, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include <iostream>\nusing namespace std;\nint main(){\nint n, k=0;\nstring s,q=\"xxx\";\ncin>>n>>s;\nint i=0;\nwhile(true){\n\tif(s.substr(i,3)==q) { k++; if(s.length()==3) {cout<<k; return 0;}\n\ts.erase(0,i+3);\n\tfor(int j = 0;j < s.length();j++){\n\t\tif(s[j]=='x') {k++; if(j==s.length()-1){cout<<k; return 0;\t} \t}\n\t\telse {s.erase(0,j+1); j=s.length(); i=-1;}\t\n\t\t\t}\n\t\t}\n\ti++;\n\tif(i==s.length()-1){cout<<k; return 0;\t}\n\t}\ncout<<k;\n}", "lang": "GNU C++17", "bug_code_uid": "aeb3531925bc753b1960319ecfe37b54", "src_uid": "8de14db41d0acee116bd5d8079cb2b02", "apr_id": "e5f93a2ee6763f66c4b2cf4f7ac90785", "difficulty": 800, "tags": ["strings", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9506656225528582, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include <iostream>\nusing namespace std;\n\nint main(){\n    int m,n,x,y;\n    int r=10;\n    int t=10;\n    int a[9];\n    int b[9];\n    int i,j;\n    cin>>n>>m;\n    for(x = 1; x <= n; x++ ){\n        cin>>a[x];}\n    for(y = 1 ; y <= m; y++){\n        cin>>b[y];\n    }\n    for( i=1 ;i <= n; i++){\n        for( j=1; j <= m;j++){\n            if(a[i] == b[j] && a[i] <= t){\n         t = a[i];}\n        }\n    }\nif(t!=10){\n    cout<<t;\n}\nelse{\n    for(x = 1;x <= n;x++){\n        if(a[x]<t){\n            t=a[x];        }\n\n    }\n    for(y=1;y<=m;y++){\n        if(b[y]<r){\n                r=b[y];\n    }\n}\nif(r>t)cout<<a[x]<<b[y];\nif(t>r)cout<<a[x]<<b[y];\n}\n}\n", "lang": "GNU C++14", "bug_code_uid": "7cd485b34fbdf3279fc1acf9bd3526bc", "src_uid": "3a0c1b6d710fd8f0b6daf420255d76ee", "apr_id": "f9f842a74e677acbd1416fe1bc4a2d43", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.39622641509433965, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "#include <iostream>\n#include <string>\n\nusing namespace std;\n\nint main()\n{\n    string s ;\n    cin >> s ;\n    int k = 0 ;\n    if ( s.find (\"at\") != 0 )\n        s.replace ( s.find(\"at\") , 2 , \"@\" ) ;\n    \n    for ( int i = 1 ; i < s.size() - 4  ; i++ )\n    {\n        if ( s.find (\"dot\") == 0 )\n           k = 1 ;\n           \n        if ( s.find (\"dot\") != -1 )\n            s.replace ( s.find (\"dot\") , 3 , \".\" ) ;\n    }\n    \n    if ( k == 1 )\n        s.replace (0 , 1 , \"dot\") ;\n     \n    cout << s ;\n\n    return 0 ;\n}", "lang": "GNU C++", "bug_code_uid": "b9b36a503cc23385888dd5340c0c4d44", "src_uid": "a11c9679d8e2dca51be17d466202df6e", "apr_id": "f026406d715885e36e25f5264656eff9", "difficulty": 1300, "tags": ["implementation", "expression parsing"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.291327264015333, "equal_cnt": 14, "replace_cnt": 9, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 14, "bug_source_code": "#include <cmath>\n#include <ctime>\n#include <iostream>\n#include <string>\n#include <vector>\n#include<cstdio>\n#include<sstream>\n#include<algorithm>\n#include<cstdlib>\n#include<cstring>\n#include<map>\n#include<set>\n#include<queue>\n#include<cctype>\n\nusing namespace std;\n\n\nlong counter;\n\n//map<pair<int, pair<int, int> >, int> m;\n\nvector<vector<vector<int> > > v(300001, vector<vector<int> >(300001, vector<int>(300001, -1)));\n\nvoid  isPossible(int a, int b, int c, int l){\n\n    float s = (float)(a + b + c) / 2.0;\n\n//  cout << \"s: \" << s << \" a: \" << a << \" b: \" << b << \" c: \" << c << endl;\n    if (s > a && s > b && s >c  && (v[a][b][c]  == -1) ) {\n\n        //m.find(make_pair(a, make_pair(b, c))) == m.end()\n        //m[make_pair(a, make_pair(b, c))] = 1;\n    //  cout << \"In the loop\" << endl;\n        v[a][b][c] = 1;\n        counter++;\n    }\n\n    for (int i = 1; i <= l; i++){\n\n        isPossible(a + i, b, c, l - i);\n        isPossible(a , b + i, c, l - i);\n        isPossible(a, b, c + i, l - i);\n\n        //cout << \"HI \" << endl;\n             \n    }\n\n\n}\n\n\n\nint main(){\n\n    int a, b, c, l;\n    cin >> a >> b >> c >> l;\n\n    counter = 0;\n\n    \n    isPossible(a, b, c , l);\n\n    cout << counter << endl;\n\n    return 0;\n}", "lang": "GNU C++", "bug_code_uid": "d8b1086d627de5b72dca7515b488bb60", "src_uid": "185ff90a8b0ae0e2b75605f772589410", "apr_id": "c80815a5f168ee68539da24c3f2aa69a", "difficulty": 2100, "tags": ["brute force", "dp", "math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9993618379068283, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "\n#include <stdio.h>\n#include <algorithm>\n#include <iostream>\n#include <cstring>\n#include <sstream>\n#include <string>\n#include <vector>\n#include <cmath>\n#include <deque>\n#include <stack>\n#include <set>\n#include <map>\n\nusing namespace std;\n\n#define name \"\"\n#define inf\tint(1e9)\n#define eps 1e-9\n#define FOR(i,a,b) for(int i = a; i <= b; ++ i)\n#define REP(i,n) FOR(j,0,n-1)\n#define all(x) x.begin(), x.end()\n#define SZ(x) int(x.size())\n#define fi first\n#define se second\n#define MP make_pair\n#define PB push_back\n\nint n, m, T;\nint a[11][101],\tb[11][101],\tc[11][101];\nint ans = 0, X = 0, Y = 0;\n\n\nint main(){\n\n\n\tcin >> n >> m >> T;\n\n\tstring s[11];\n\n\tfor (int i = 0 ; i < n; ++ i) {\n\t \tcin >> s[i];\n\t \tfor (int j = 0; j < m; ++ j) {\n\t \t \tcin >> a[i][j] >> b[i][j] >> c[i][j];\n\t \t}\n\t}\n\n\tfor (int i = 0; i < n; ++ i) {\n\t \tfor (int k = 0; k < n; ++ k) if(i != j) {\n\t \t\tint x1 = 0,\n\t \t\t\ty1 = 0,\n\t \t\t\tt1 = 0;\n\t \t\tvector<pair<int,int> > q;\n\t \t \tfor (int j = 0; j < m; ++ j) {\n\t \t \t \tif (b[k][j] - a[i][j] > 0) {\n\t \t \t \t\tq.push_back(make_pair(b[k][j] - a[i][j], j));\n//\t \t \t \t \tx1 += a[i][j]*c[i][j];\n//\t \t \t \t \ty1 += b[k][j]*c[i][j];\n\t \t \t \t}\n\t \t \t}\n\n\t \t \tsort(q.rbegin(), q.rend());\n\n\t \t \tfor (int j = 0; j < q.size(); ++ j) {\n\t \t \t\tint p = q[j].se;\n\n\t \t \t\tif (t1 + c[i][p] <= T) {\n\t \t \t \t \tx1 += a[i][p]*c[i][p];\n\t \t \t \t \ty1 += b[k][p]*c[i][p];\n\t \t \t \t \tt1 += c[i][p];\n\t \t \t\t} else {\n\t \t \t \t \tx1 += a[i][p]*(T-t1);\n\t \t \t \t \ty1 += b[k][p]*(T-t1);\n\t \t \t \t \tt1 += T-t1;\n                }\n\t \t \t}\n\n\t \t \tif (y1-x1 > ans) \n\t \t \t\tans = y1 - x1;\n\t \t}\n\t}\n\n\t\n\tcout << ans;\n\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "04f589e6c44ab6ea7b03e918f3643381", "src_uid": "7419c4268a9815282fadca6581f28ec1", "apr_id": "0dde17734b726c57d7a8b4900b000a69", "difficulty": 1200, "tags": ["games", "greedy", "graph matchings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9528619528619529, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\nint main()\n{\n\tstring s;\n\tcin >> s;\n\t\n\tint ans = 0;\n\tint cnt = 1;\n\tfor (int i = 1; i < s.length(); i++)\n\t{\n\t\tif (s[i] == s[i-1])\n\t\t{\n\t\t\tcnt++;\n\t\t} else {\n\t\t\tif (cnt % 2 == 0) ans++;\n\t\t\tcnt = 1;\n\t\t}\n\t}\n\t\n\tcout << ans << endl;\n\treturn 0;\n} ", "lang": "GNU C++11", "bug_code_uid": "bbc52e0c9b2b391acec63467b95058b2", "src_uid": "8b26ca1ca2b28166c3d25dceb1f3d49f", "apr_id": "20fb684892fb66a6d8de8daa0c1c60a7", "difficulty": null, "tags": ["implementation", "two pointers"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9904673331783306, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "//135E Hewr\n#include <iostream>\n#include <cstdio>\n#include <cstring>\n#include <cstdlib>\n#include <cmath>\n#include <algorithm>\n#include <vector>\n#include <queue>\n#include <iomanip>\nusing namespace std;\n#define fo(i,a,b) for (int i = a; i <= b; ++i)\n#define fd(i,a,b) for (int i = a; i >= b; --i)\n#define fe(i,x) for (int i = g[x], y = E[i].y; i; i = E[i].l, y = E[i].y)\n#define forall(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); ++i)\n#define pb push_back\n#define SIZE(x) ((int) (x).size())\n#define MP make_pair\n#define fi first\n#define se second\n#define UNIQUE(x) x.resize(unique(x.begin(), x.end()) - x.begin())\n#define clr(a,x) memset(&a, x, sizeof(a))\n#define move(a,b) memcpy(&b, &a, sizeof(a))\n#define Plus(a,b) (((LL) (a) + (b)) % mo)\n#define Minus(a,b) ((((LL) (a) - (b) ) % mo + mo) % mo)\n#define Mul(a,b) ((LL) (a) * (b) % mo)\n#define updmin(a,b) (a = min(a, b))\n#define updmax(a,b) (a = max(a, b))\n#define sqr(x) ((x) * (x))\n\ntypedef long long LL;\ntypedef long double LD;\ntypedef pair<int, int> PII;\ntypedef vector<int> VI;\n\nconst double eps = 1e-10;\nconst int oo = ~0u >> 2, mo = (int) 1e9 + 7;\nconst int mn = (int) 1e6 * 2 + 2;\n\nint fac[mn], rev[mn];\nint k, w, Ans(0);\n\nint pow(int e, int x){\n\tint ret = 1;\n\twhile (x){\n\t\tif (x & 1) ret = Mul(ret, e);\n\t\te = Mul(e, e), x >>= 1;\n\t}\n\treturn ret;\n}\n\nint Get_Rev(int x){\n\treturn pow(x, mo - 2);\n}\n\nint calc1(int t, int d){\n\tint mol = Mul(Mul(pow(k, w - t - d - 1), t), Mul(fac[k], fac[k]));\n\tint den = Mul(rev[k - t], rev[k - t - d]);\n\tint ret = Mul(mol, den);\n\treturn ret;\n}\n\nint calc2(int t, int d){\n\tint mol = Mul(Mul(fac[k], w - d), fac[k - t - d + w - 1]);\n\tint den = Mul(rev[k - t], rev[k - t - d]);\n\tint ret = Mul(mol, den);\n\treturn ret;\n}\n\nint main(){\n\tfac[0] = rev[0] = 1;\n\tfo (i, 1, mn - 1) fac[i] = Mul(fac[i - 1], i), rev[i] = Mul(rev[i - 1], Get_Rev(i));\n\tcin >> k >> w;\n\tfo (i, 1, k){\n\t\tint t;\n\t\tif (i <= w - 1) t = calc1(i, 0), Ans = Plus(Ans, t);\n\t\tif (i > w - 1) t = calc2(i, 0), Ans = Plus(Ans, t);\n\t\tif (i < k && i + 1 <= w - 1) t = calc1(i, 1), Ans = Plus(Ans, t);\n\t\tif (i < k && i + 1 > w - 1) t = calc2(i, 1), Ans = Plus(Ans, t);\n\t}\n\tcout << Ans << endl;\n}\n", "lang": "GNU C++", "bug_code_uid": "a5ae307feb648dc5c9c0bf15e0ea6edf", "src_uid": "b715f0fdc83ec539eb3ae2b0371ee130", "apr_id": "3dd8b2995e5f16bd1e1ae0d296903e95", "difficulty": 3000, "tags": ["combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.9454749859471613, "equal_cnt": 10, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 9, "bug_source_code": "#include<iostream>\n#include<cstdio>\n#include<string>\n#include<cstring>\n#include<algorithm>\n#include<cmath>\nusing namespace std;\n\nconst int N = 200005;\nint n,m,lim,p = 1,a[N],nex[N*2],spot[N*2],head[N],fa[N],f[N],g[N];\nint maxcolor[N][2],c[N];\nbool color[N],v[N];\n\nvoid add(int x,int y)\n{\n\tnex[++p] = head[x], head[x] = p, spot[p] = y;\n\tnex[++p] = head[y], head[y] = p, spot[p] = x;\n}\n\nvoid dfs0(int x)\n{\n\tint tp,y;\n\tv[x] = 1;\n\tfor(tp = head[x]; y = spot[tp],tp; tp = nex[tp])\n\t\tif(a[y]>=lim && fa[x]!=y) {\n\t\t\tfa[y] = x;\n\t\t\tdfs0(y);\n\t\t\tif(c[y]) c[x]++;\n\t\t}\n\tc[x] += color[x];\n}\n/*\nvoid dfs1(int x)\n{\n\tint tp,y,cnt = 0,m1 = 0,m2 = 0;\n\n\tfor(tp = head[x]; y = spot[tp],tp; tp = nex[tp])\n\t\tif(a[y]>=lim && y!=fa[x]) {\n\t\t\tdfs1(y);\n\t\t\tif(!color[y]) cnt += f[y];\n\t\t\telse {\n\t\t\t\tif(m1==0) m1 = f[y];\n\t\t\t\telse {\n\t\t\t\t\tif(f[y]>m2) m2 = f[y];\n\t\t\t\t\tif(m1<m2) swap(m1,m2);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tmaxcolor[x][0] = m1;\n\tmaxcolor[x][1] = m2;\n\tf[x] = cnt+m1+1;\n}\n\nvoid dfs2(int x, int &ret)\n{\n\tif(fa[x]) {//\u00c8\u00e7\u00b9\u00fbx\u00b2\u00bb\u00ca\u00c7\u00b5\u00da\u00d2\u00bb\u00b4\u00ce\u00cb\u00d1\u00cb\u00f7\u00b5\u00c4\u00b8\u00f9\u00bd\u00da\u00b5\u00e3 \n\t\tif(color[fa[x]]) {\n\t\t\t//x\u00d2\u00aa\u00d4\u00da\u00cb\u00fc\u00b5\u00b1\u00b3\u00f5\u00d1\u00a1\u00b5\u00c4color\u00bd\u00e1\u00b5\u00e3\u00ba\u00cd\u00cb\u00fc\u00b8\u00b8\u00c7\u00d7\u00b3\u00fd\u00c8\u00a5\u00cb\u00fc\u00c4\u00c7\u00b2\u00bf\u00b7\u00d6\u00d6\u00d0\u00d1\u00a1\u00d4\u00f1 \n\t\t\tif(color[x]) {//x\u00b5\u00b1\u00b3\u00f5\u00b1\u00bb\u00d1\u00a1\u00bb\u00f2\u00b2\u00bb\u00d1\u00a1 \n\t\t\t\tif(f[x]<maxcolor[fa[x]][0])//\u00b5\u00b1\u00b3\u00f5x\u00c3\u00bb\u00d3\u00d0\u00b1\u00bb\u00cb\u00fc\u00b8\u00b8\u00c7\u00d7\u00d1\u00a1\u00d6\u00d0 \n\t\t\t\t\tg[x] = f[x]-maxcolor[x][0]+max(maxcolor[x][0], g[fa[x]]);\n\t\t\t\telse //\u00b5\u00b1\u00b3\u00f5\u00cb\u00fc\u00b1\u00bb\u00d1\u00a1\u00d6\u00d0\u00c1\u00cb \n\t\t\t\t\tg[x] = f[x]-maxcolor[x][0]+max(maxcolor[x][0],\n\t\t\t\t\t\tg[fa[x]]-maxcolor[fa[x]][0]+maxcolor[fa[x]][1]);\n\t\t\t\t\t\t//\u00b3\u00fd\u00c8\u00a5\u00cb\u00fc\u00cb\u00fc\u00b8\u00b8\u00c7\u00d7\u00d6\u00bb\u00c4\u00dc\u00cd\u00cb\u00b6\u00f8\u00c7\u00f3\u00c6\u00e4\u00b4\u00ce\u00c1\u00cb \n\t\t\t}\n\t\t\telse //\u00b5\u00b1\u00b3\u00f5x\u00b1\u00bb\u00d6\u00b1\u00bd\u00d3\u00bc\u00d3\u00c9\u00cf \n\t\t\t\tg[x] = f[x]-maxcolor[x][0]+max(maxcolor[x][0], g[fa[x]]-f[x]);\n\t\t}\n\t\telse {\n\t\t\t//x\u00d6\u00b1\u00bd\u00d3\u00bc\u00d3\u00c9\u00cf\u00cb\u00fc\u00b8\u00b8\u00c7\u00d7\n\t\t\tif(color[x]) {\n\t\t\t\tif(f[x]<maxcolor[fa[x]][0])\n\t\t\t\t\tg[x] = f[x]+g[fa[x]];\n\t\t\t\telse\n\t\t\t\t\tg[x] = f[x]+g[fa[x]]-maxcolor[fa[x]][0]+maxcolor[fa[x]][1];\n\t\t\t}\n\t\t\telse\n\t\t\t\tg[x] = g[fa[x]];//f[x]+g[fa[x]]-f[x]\u00a3\u00ac\u00ba\u00cd\u00cb\u00fc\u00b8\u00b8\u00c7\u00d7\u00d2\u00bb\u00d1\u00f9 \n\t\t}\n\t}\n\telse g[x] = f[x];\n\tret = max(ret, g[x]);\n\tfor(int tp = head[x]; tp; tp = nex[tp])\n\t\tif(a[spot[tp]]>=lim && spot[tp]!=fa[x])\n\t\t\tdfs2(spot[tp], ret);\n}\n*/\nvoid dfs1(int x)\n{\n\tint tp,y,cnt = 0,m1 = 0,m2 = 0;\n\n\tfor(tp = head[x]; y = spot[tp],tp; tp = nex[tp])\n\t\tif(a[y]>=lim && y!=fa[x]) {\n\t\t\tdfs1(y);\n\t\t\tif(!c[y]) cnt += f[y];\n\t\t\telse {\n\t\t\t\tif(f[y]>m2) m2 = f[y];\n\t\t\t\tif(m1<m2) swap(m1,m2);\n\t\t\t}\n\t\t}\n\tmaxcolor[x][0] = m1;\n\tmaxcolor[x][1] = m2;\n\tf[x] = cnt+m1+1;\n}\n\nvoid dfs2(int x, int &ret)\n{\n\tif(fa[x]) {//\u00c8\u00e7\u00b9\u00fbx\u00b2\u00bb\u00ca\u00c7\u00b5\u00da\u00d2\u00bb\u00b4\u00ce\u00cb\u00d1\u00cb\u00f7\u00b5\u00c4\u00b8\u00f9\u00bd\u00da\u00b5\u00e3 \n\t\tif(c[fa[x]]-(c[x]!=0)>0) {\n\t\t\t//x\u00d2\u00aa\u00d4\u00da\u00cb\u00fc\u00b5\u00b1\u00b3\u00f5\u00d1\u00a1\u00b5\u00c4color\u00bd\u00e1\u00b5\u00e3\u00ba\u00cd\u00cb\u00fc\u00b8\u00b8\u00c7\u00d7\u00b3\u00fd\u00c8\u00a5\u00cb\u00fc\u00c4\u00c7\u00b2\u00bf\u00b7\u00d6\u00d6\u00d0\u00d1\u00a1\u00d4\u00f1 \n\t\t\tif(c[x]) {//x\u00b5\u00b1\u00b3\u00f5\u00b1\u00bb\u00d1\u00a1\u00bb\u00f2\u00b2\u00bb\u00d1\u00a1 \n\t\t\t\tif(f[x]<maxcolor[fa[x]][0])//\u00b5\u00b1\u00b3\u00f5x\u00c3\u00bb\u00d3\u00d0\u00b1\u00bb\u00cb\u00fc\u00b8\u00b8\u00c7\u00d7\u00d1\u00a1\u00d6\u00d0 \n\t\t\t\t\tg[x] = f[x]-maxcolor[x][0]+max(maxcolor[x][0], g[fa[x]]);\n\t\t\t\telse //\u00b5\u00b1\u00b3\u00f5\u00cb\u00fc\u00b1\u00bb\u00d1\u00a1\u00d6\u00d0\u00c1\u00cb \n\t\t\t\t\tg[x] = f[x]-maxcolor[x][0]+max(maxcolor[x][0],\n\t\t\t\t\t\tg[fa[x]]-maxcolor[fa[x]][0]+maxcolor[fa[x]][1]);\n\t\t\t\t\t\t//\u00b3\u00fd\u00c8\u00a5\u00cb\u00fc\u00cb\u00fc\u00b8\u00b8\u00c7\u00d7\u00d6\u00bb\u00c4\u00dc\u00cd\u00cb\u00b6\u00f8\u00c7\u00f3\u00c6\u00e4\u00b4\u00ce\u00c1\u00cb \n\t\t\t}\n\t\t\telse //\u00b5\u00b1\u00b3\u00f5x\u00b1\u00bb\u00d6\u00b1\u00bd\u00d3\u00bc\u00d3\u00c9\u00cf \n\t\t\t\tg[x] = f[x]-maxcolor[x][0]+max(maxcolor[x][0], g[fa[x]]-f[x]);\n\t\t}\n\t\telse {\n\t\t\t//x\u00d6\u00b1\u00bd\u00d3\u00bc\u00d3\u00c9\u00cf\u00cb\u00fc\u00b8\u00b8\u00c7\u00d7\n\t\t\tif(c[x]) {\n\t\t\t\tif(f[x]<maxcolor[fa[x]][0])\n\t\t\t\t\tg[x] = f[x]+g[fa[x]];\n\t\t\t\telse\n\t\t\t\t\tg[x] = f[x]+g[fa[x]]-maxcolor[fa[x]][0]+maxcolor[fa[x]][1];\n\t\t\t}\n\t\t\telse\n\t\t\t\tg[x] = g[fa[x]];//f[x]+g[fa[x]]-f[x]\u00a3\u00ac\u00ba\u00cd\u00cb\u00fc\u00b8\u00b8\u00c7\u00d7\u00d2\u00bb\u00d1\u00f9 \n\t\t}\n\t\tc[x] += ((c[fa[x]]-(c[x]!=0))!=0);\n\t}\n\telse g[x] = f[x];\n//\tprintf(\"g[%d] = %d\\t\", x, g[x]);\n\tret = max(ret, g[x]);\n\tfor(int tp = head[x]; tp; tp = nex[tp])\n\t\tif(a[spot[tp]]>=lim && spot[tp]!=fa[x])\n\t\t\tdfs2(spot[tp], ret);\n}\nint solve()\n{\n\tmemset(v, 0, sizeof(v));\n\tmemset(fa, 0, sizeof(fa));\n\tmemset(maxcolor, 0, sizeof(maxcolor));\n\tmemset(c, 0, sizeof(c));\n\tint maxn = 0;\n//\tcout <<\"solve \" <<lim<<endl;\n\tfor(int i = 1; i<=n; i++)\n\t\tif(a[i]>=lim && v[i]==0) {\n//\t\t\tcout << \"dfs from \"<<i<<endl;\n\t\t\tdfs0(i), dfs1(i), dfs2(i,maxn);\n//\t\t\tcout << endl;\n\t\t}\n//\tcout << maxn << endl;\n//\tfor(int i = 1; i<=n; i++) cout << color[i]<<' ';\n///\tcout << endl;\n\treturn maxn>=m;\n}\n\nint main()\n{\n//\tfreopen(\"shuju.in\", \"r\", stdin);\n\t//freopen(\"out.txt\", \"w\", stdout);\n\tint i,x,y,l,r,tp;\n\tcin >> n >> m;\n\tfor(i = 1; i<=n; i++)\n\t\tscanf(\"%d\", &a[i]);\n\tfor(i = 1; i<n; i++) {\n\t\tscanf(\"%d%d\", &x,&y);\n\t\tadd(x,y);\n\t}\n\tfor(l = 1,r = 1000000; l<r; )\n\t{\n\t\tlim = l+r+1>>1;\n\t\tmemset(color, 0, sizeof(color));\n\t\tfor(i = 1; i<=n; i++)\n\t\t\tif(a[i]<lim)\n\t\t\t\tfor(tp = head[i]; tp; tp = nex[tp])\n\t\t\t\t\tcolor[spot[tp]] = 1;\n\t\tif(solve()) l = lim;\n\t\telse r = lim-1;\n\t}\n\tcout << l;\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "04f181ccf9a6fa754ea61031054ea594", "src_uid": "4fb83b890e472f86045981e1743ddaac", "apr_id": "a65ddd6cf39604a776f1107d52126d53", "difficulty": 2600, "tags": ["graphs", "dfs and similar", "greedy", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9522404573114512, "equal_cnt": 10, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 9, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint n,k,arr[1<<18];\nbool vis[1<<18],big[1<<18];int failed[1<<18],failed1[1<<18];\nvector<int>adj[1<<18];\npair<int,int>mx[1<<18],mx1[1<<18];\nint sum[1<<18];\nvoid dfs(int x,int p)\n{\n    int sz=adj[x].size(),nxt;\n    bool ok=1;\n    pair<int,int>pii;\n    sum[x]=1;\n    vis[x]=1;\n    for(int i=0;i<sz;++i)\n    {\n        nxt=adj[x][i];\n        if(nxt==p)continue;\n        if(vis[nxt]){failed1[x]=failed[x];failed[x]=nxt;continue;}\n        dfs(nxt,x);\n        if(failed[nxt]){\n            pii=make_pair(sum[nxt]+mx[nxt].first,nxt);\n            if(pii>mx[x])swap(pii,mx[x]);\n            if(pii>mx1[x])swap(pii,mx1[x]);\n        }\n        else sum[x]+=sum[nxt];\n        if(failed[nxt]){failed1[x]=failed[x];failed[x]=nxt;continue;}\n    }\n}\nvoid dfs1(int x,int p)\n{\n    //cout<<x<<\" \"<<sum[x]<<\" \"<<mx[x].first<<\" \"<<mx1[x].first<<\" h\\n\";\n    if(p){\n        pair<int,int>pii=mx[p];\n        if(mx[p].second==x)pii=mx1[p];\n        if(!failed[p]){\n            sum[x]+=sum[p]-sum[x];\n        }\n        else if(failed[p]==x&&!failed1[p]){\n            sum[x]+=sum[p];\n        }\n        else pii.first+=sum[p];\n        //cout<<x<<\" \"<<p<<\" \"<<pii.first<<endl;\n        if(pii>mx[x])swap(pii,mx[x]);\n        if(pii>mx1[x])swap(pii,mx1[x]);\n        //change failed\n        if((failed[p]&&failed[p]!=x)||(failed1[p]&&failed1[p]!=x)){\n            failed1[x]=failed[x];\n            failed[x]=p;\n        }\n    }\n       // cout<<x<<\" \"<<sum[x]<<\" \"<<mx[x].first<<\" \"<<mx1[x].first<<\" f\\n\";\n\n    int sz=adj[x].size(),nxt;\n    for(int i=0;i<sz;++i){\n        nxt=adj[x][i];\n        if(nxt==p)continue;\n        if(!big[nxt])continue;\n        dfs1(nxt,x);\n    }\n}\nbool check(int mid)\n{\n    //cout<<mid<<endl;\n    for(int i=1;i<=n;++i){\n        big[i]=(arr[i]>=mid);\n        vis[i]=(arr[i]<mid);\n        mx[i]=mx1[i]=make_pair(0,0);\n        sum[i]=0;\n        failed[i]=failed1[i]=0;\n    }\n    for(int i=1;i<=n;++i){\n        if(!vis[i]){\n            dfs(i,0);\n            dfs1(i,0);\n        }\n    }\n    //for(int i=1;i<=n;++i)cout<<i<<\" \"<<sum[i]<<\" \"<<mx[i].first<<\" \"<<mx1[i].first<<\" \"<<failed[i]<<endl;\n    //cout<<\"---------------------------\\n\";\n    for(int i=1;i<=n;++i){\n        if(big[i]){\n            if(sum[i]+mx[i].first>=k)return 1;\n        }\n    }\n    return 0;\n\n}\nint main()\n{\n    cin>>n>>k;\n    for(int i=1;i<=n;++i)scanf(\"%d\",arr+i);\n    int u,v;\n    for(int i=1;i<n;++i){\n        scanf(\"%d%d\",&u,&v);\n        adj[u].push_back(v);\n        adj[v].push_back(u);\n    }\n    int st=1,en=1000002,mid;\n    //check(700000);return 0;\n    while(st<en){\n        mid=(st+en)/2;\n        if(check(mid))st=mid+1;\n        else en=mid;\n    }\n    cout<<en-1;\n\n}\n", "lang": "GNU C++11", "bug_code_uid": "970c776100ea90eaabf1db30c2b44492", "src_uid": "4fb83b890e472f86045981e1743ddaac", "apr_id": "9423834abe56c27750a210065e2687a4", "difficulty": 2600, "tags": ["graphs", "dfs and similar", "greedy", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9850195897672275, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 5, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint n,k,a[200005];\nvector<int>adj[200005];\nbool comp[200005];\nint sum[200005];\npair<int,int>mx[2][200005];\npair<int,int>dfs(int x,int p,int z)\n{\n\n    comp[x]=1;\n    pair<int,int> m;\n    sum[x]=1;\n    for(int i=0;i<adj[x].size();++i){\n        if(adj[x][i]==p)continue;\n        m=dfs(adj[x][i],x,z);\n        if(m.second)sum[x]+=m.first;\n        else {\n            comp[x]=0;\n            m.second=adj[x][i];\n            if(m>mx[0][x])swap(m,mx[0][x]);\n            if(m>mx[1][x])swap(m,mx[1][x]);\n        }\n    }\n    if(a[x]<z){\n        comp[x]=0;\n        sum[x]=0;\n        mx[0][x]=mx[1][x]=make_pair(-1,0);\n        return make_pair(0,0);\n    }\n    if(comp[x])return make_pair(sum[x],1);\n    return make_pair(sum[x]+mx[0][x].first,0);\n}\nvoid dfs1(int x,int p){\n    if(p){\n        if(!comp[p]&&(mx[1][p].first!=-1||mx[0][p].second!=x)){\n            pair<int,int>m;\n            m=mx[0][p];\n            if(m.second==x)m=mx[1][p];\n            m.first+=sum[p];\n            if(comp[x])m.first-=sum[x];\n            m.second=p;\n            if(m>mx[0][x])swap(m,mx[0][x]);\n            if(m>mx[1][x])swap(m,mx[1][x]);\n            comp[x]=0;\n        }\n        else {\n            if(!comp[x])sum[x]+=sum[p];\n            else sum[x]=sum[p];\n        }\n    }\n    for(int i=0;i<adj[x].size();++i)\n        if(adj[x][i]!=p)dfs1(adj[x][i],x);\n}\n\n\nbool check(int mid){\n    for(int i=1;i<=n;++i){\n        comp[i]=0;\n        sum[i]=0;\n        mx[0][i]=mx[1][i]=make_pair(-1,0);\n    }\n    dfs(1,0,mid);\n    //for(int i=1;i<=n;++i)cout<<i<<\" \"<<sum[i]<<\" \"<<mx[0][1].first<<\" \"<<comp[i]<<endl;\n    dfs1(1,0);\n\n    for(int i=1;i<=n;++i)if(sum[i]+max(0,mx[0][i].first)>=k)return 1;\n    return 0;\n\n}\nint main()\n{\n    cin>>n>>k;\n    int u,v;\n    for(int i=1;i<=n;++i)scanf(\"%d\",a+i);\n    for(int i=1;i<n;++i){\n        scanf(\"%d%d\",&u,&v);\n        adj[u].push_back(v);\n        adj[v].push_back(u);\n    }\n    int st=0,en=1e6+4,mid;\n    //cout<<check(3)<<endl;\n    //return 0;\n    while(st<en){\n        mid=(st+en)/2;\n        if(check(mid))st=mid+1;\n        else en=mid;\n    }\n    cout<<st-1<<endl;\n}\n\n//http://codeforces.com/contest/635/problem/F\n", "lang": "GNU C++", "bug_code_uid": "b8d82c125892b6fc84b9925d79458ee4", "src_uid": "4fb83b890e472f86045981e1743ddaac", "apr_id": "9423834abe56c27750a210065e2687a4", "difficulty": 2600, "tags": ["graphs", "dfs and similar", "greedy", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.7224721298650498, "equal_cnt": 16, "replace_cnt": 11, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 15, "bug_source_code": "#include <iostream>\n#include <stack>\n#include <math.h>\n#include <set>\n#include <stdio.h>\n#include <algorithm>\n#include <assert.h>\n#include <map>\n#include <queue>\n#include <utility>\n#include <vector>\nusing namespace std;\n#define endl \"\\n\"\n#define mp make_pair\n#define int long long\n#define pii pair<int , int>\ninline int in(){int32_t x ; scanf(\"%d\",&x) ; return x ;}\ninline string getStr(){char ch[500001] ; scanf(\"%s\",ch) ;return ch;}\nconst int MAX_N = 2e5 + 10;\ninline int gcd( int a, int b ) { return b == 0 ? a : gcd( b, a%b ); }\nvector<int> g[MAX_N];\nbool del[MAX_N] , forb[MAX_N] , mark[MAX_N];\nint a[MAX_N] , dp[MAX_N] ,  ln , vl[MAX_N] , deg[MAX_N];\nqueue<int> Bomb ; int  n , k;\ninline void BombProcess()\n{\n    for (int i = 1 ; i <= n ; i ++) if (deg[i] == 1 && !forb[i]) Bomb.push(i);\n    while (Bomb.size()){\n        int first = Bomb.front(); Bomb.pop();\n        deg[first] --;\n        del[first] = true;\n        int FIND = -1;\n        for (auto u : g[first]){\n            if (!del[u] && !forb[u]){\n                FIND = u;\n                break;\n            }\n        }\n        if (FIND != -1){\n            vl[FIND] += vl[first];\n            deg[FIND] --;\n            if (deg[FIND] == 1)\n                Bomb.push(FIND);\n        }\n        ln = max(ln , vl[first]);\n        vl[first] = 0;\n    }\n}\nint cnt2 = 0 , cnt = 0;\ninline void dfs(int v , int pr){\n    \n    mark[v] = true;\n    dp[v] = vl[v];\n    int f1 = 0 , f2 = 0 ;\n    for (auto u : g[v]){\n        if (!forb[u] && (u - pr)){\n            dfs(u , v);\n            if (dp[u] > f1){\n                f2 = f1;\n                f1 = dp[u];\n            }\n            else{\n                f2 = max(f2 , dp[u]);\n            }\n        }\n    }\n    if (f2 && f1) cnt2 ++ ;\n    if (!pr && f2 && f1) cnt ++;\n    \n    ln = max(ln , dp[v] + f2 + f1);\n    dp[v] += f1;\n}\ninline bool can(int low){\n    ln = 0;\n    for (int i = 1 ; i <= n ; i ++){\n        mark[i] = 0;\n        deg[i] = g[i].size();\n        dp[i] = 0;\n        del[i] = 0  ;\n        mark[i] = 0 ;\n        vl[i] = 1;\n        forb[i] = (a[i] < low);\n    }\n    BombProcess();\n    for (int i = 1 ; i <= n ; i ++)if (!mark[i] && !forb[i]) dfs(i , -1) ;\n    assert(cnt == cnt2);\n    return ln >= k;\n}\nint32_t main()\n{\n    n = in() , k = in();\n    for (int i = 0 ; i < n ;  i ++) a[i + 1] = in();\n    for (int i = 0 ; i < n - 1 ; i ++){\n        int v = in() , u = in();\n        g[v].push_back(u);\n        g[u].push_back(v);\n        \n    }\n    int l = 0 , r = (1 << 20) , best = 0 , mid;\n    while (l <= r){\n        mid = (l + r) >> 1;\n        if (can(mid)) {best = mid ; l = mid + 1 ; continue ; }\n        r = mid - 1;\n    }\n    cout << best << \"\\n\";\n}", "lang": "GNU C++11", "bug_code_uid": "639ad378982f9f9af5d11c33792d4996", "src_uid": "4fb83b890e472f86045981e1743ddaac", "apr_id": "6f7bee3ac61685b5f0dcb9814e71e051", "difficulty": 2600, "tags": ["graphs", "dfs and similar", "greedy", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8910606496119574, "equal_cnt": 12, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 11, "bug_source_code": "/* Author haleyk10198 */\n/* \ufffd@\ufffd\ufffd:  haleyk10198 */\n#include <iostream>\n#include <fstream>\n#include <sstream>\n#include <cstdlib>\n#include <cstdio>\n#include <vector>\n#include <map>\n#include <queue>\n#include <cmath>\n#include <algorithm>\n#include <cstring>\n#include <iomanip>\n#include <ctime>\n#include <string>\n#include <set>\n#include <stack>\n\n#define MOD 1000000007\n#define LINF (1LL<<60)\n#define INF 2147483647\n#define PI 3.1415926535897932384626433\n#define ll long long\n#define pii pair<int,int>\n#define mp(x,y) make_pair((x),(y))\n\nusing namespace std;\nint n,k;\nvector<int> near[200010];\nint sz[200010],a[200010];\nbool f=false;\n\nint setsz(int now,int prv){\n\tint &res=sz[now];\n\tfor(int x:near[now])\n\t\tif(x-prv)\n\t\t\tres+=setsz(x,now);\n\treturn ++res;\n}\n\nint check(int now,int prv,int x){\n\tint fix=1;\n\tint wild1=0,wild2=0;\n\tpriority_queue<int> q;\n\tfor(int y:near[now]){\n\t\tif(y-prv){\n\t\t\tint v=check(y,now,x);\n\t\t\tif(v==sz[y])\n\t\t\t\tfix+=v;\n\t\t\telse{\n\t\t\t\tif(v>wild1){\n\t\t\t\t\tswap(wild1,wild2);\n\t\t\t\t\twild1=v;\n\t\t\t\t}\n\t\t\t\telse if(v>wild2)\n\t\t\t\t\twild2=v;\n\t\t\t}\n\t\t}\n\t}\n\tif(a[now]>=x){\n\t\tf|=(fix+wild1+wild2>=k);\n\t\treturn fix+wild1;\n\t}\n\telse\n\t\treturn 0;\n}\n\nint bins(int l,int r){\n\tint mid=(l+r)/2;\n\tif(l>r)\n\t\treturn r;\n\tf=false;\n\tcheck(1,1,mid);\n\tif(f)\n\t\treturn bins(mid+1,r);\n\telse\n\t\treturn bins(l,mid-1);\n}\n\nint main(){\n\t//freopen(\"input.txt\",\"r\",stdin);\n\t//freopen(\"output.txt\",\"w\",stdout);\n\tios_base::sync_with_stdio(false);\n\tcin>>n>>k;\n\tfor(int i=1;i<=n;i++)\n\t\tcin>>a[i];\n\tfor(int i=1;i<n;i++){\n\t\tint u,v;\n\t\tcin>>u>>v;\n\t\tnear[u].push_back(v);\n\t\tnear[v].push_back(u);\n\t}\n\tsz[1]=setsz(1,1);\n\tcout<<bins(0,1000000000)<<endl;\n\treturn 0;\n}\n\n", "lang": "GNU C++11", "bug_code_uid": "734180bdb459b5379a58bb834ec5bcb5", "src_uid": "4fb83b890e472f86045981e1743ddaac", "apr_id": "d830af983d9e75ccac9f0f3e17e8a8f1", "difficulty": 2600, "tags": ["graphs", "dfs and similar", "greedy", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6413637825667418, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\nconst int N = 2e5+5;\nint n,sz[N],a[N],c,ret,dp[N];\npair<int,int> m[N][2];\nvector<int> adj[N];\nvoid dfs(int x,int p){\n\tint f=0,u,i,d;dp[x]=0;\n\tif(!sz[x])f=1,++sz[x];\n\td= a[x]>=c ? 1 :0;\n\tfor(i=0;i<adj[x].size();++i){\n\t\tu= adj[x][i];\n\t\tif(u!=p){\n\t\t\tdfs(u,x);\n\t\t\tif(f)sz[x]+=sz[u];\n\t\t\tif(dp[u]==sz[u])dp[x]+=dp[u];\n\t\t\telse{\n\t\t\t\tif(m[x][0].first<=dp[u])\n\t\t\t\t\tm[x][1]= m[x][0],m[x][0]=make_pair(dp[u],u);\n\t\t\t\telse if(m[x][1].first<dp[u])\n\t\t\t\t\tm[x][1]= make_pair(dp[u],u);\n\t\t\t}\n\t\t}\n\t}\n\tdp[x]+=d;\n\tif(d==0)dp[x]=0;\n}\nint ar[3];\nvoid dfs2(int x,int p,int d){\n\tint t=d,u,i,v=0,nd,test,z;\n\ttest= dp[x]+ m[x][0].first;\n\tif(a[x]>=c){\n\t\tif(d==n-sz[x])t=0,v=d,test= dp[x]+d;\n\t\telse\n\t\t\ttest= dp[x]+ max(d,m[x][0].first);\n\t\tar[0]= m[x][0].first,ar[1]= m[x][1].first,ar[2]= t;\n\t\tsort(ar,ar+3);\n\t\tret= max(ret,dp[x]+ ar[2]+ar[1]+v);\n\t}\n\tfor(i=0;i<adj[x].size();++i){\n\t\tu= adj[x][i];\n\t\tif(u!=p){\n\t\t\tnd=0;z=0;\n\t\t\tif(a[x]>=c){\n\t\t\t\tnd= dp[x]+v+ max(t,m[x][0].first);\n\t\t\t\tz= test;\n\t\t\t\tif(sz[u]==dp[u]){\n\t\t\t\t\tnd= dp[x]-sz[u]+ max(m[x][0].first,t)+ v;\n\t\t\t\t\tz= test-sz[u];\n\t\t\t\t}\n\t\t\t\telse if(u==m[x][0].second){\n\t\t\t\t\tnd= dp[x] + v + max(m[x][1].first,t);\n\t\t\t\t\tif(d==n-sz[x])z= test-m[x][0].first+m[x][1].first;\n\t\t\t\t\telse\n\t\t\t\t\t\tz= dp[x]+max(d,m[x][1].first);\n\t\t\t\t}\n\t\t\t}\n\t\t\tassert(z==nd);\n\t\t\tdfs2(u,x,nd);\n\t\t}\n\t}\n}\nint main(){\n\tint i,x,y,q,l,r,k,mid;\n\tcin>>n>>k;\n\tfor(i=1;i<=n;++i)scanf(\"%d\",&a[i]);\n\tfor(i=0;i<n-1;++i)scanf(\"%d%d\",&x,&y),adj[x].push_back(y),adj[y].push_back(x);\n\tdfs(1,0);\n\tl=1,r= 1e6;\n\twhile(l<r){\n\t\tmid= (l+r+1)/2;\n\t\tc= mid;\n\t\tmemset(m,0,sizeof(m));ret=0;\n\t\tdfs(1,0);\n\t\tdfs2(1,0,0);\n\t\tif(ret>=k)l= mid;\n\t\telse\n\t\t\tr= mid-1;\n\t}\n\tprintf(\"%d\\n\",l);\n}\n", "lang": "GNU C++11", "bug_code_uid": "ec15f06b73ad95a7d01965b7ea48fa62", "src_uid": "4fb83b890e472f86045981e1743ddaac", "apr_id": "f4e28c97cb9bdf66ea30068876facf1b", "difficulty": 2600, "tags": ["graphs", "dfs and similar", "greedy", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.037437005039596835, "equal_cnt": 10, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "# include <iostream>\n# include <cstdio>\n# include <cstdlib>\n# include <algorithm>\nusing namespace std;\n\nlong long ans[50000000];\n\nint main(void)\n{\n//\tfreopen(\"aaa.in\",\"r\",stdin);\n\tlong long x,y,l,r;\n\tint cnt = 0;\n\tscanf(\"%I64d%I64d%I64d%I64d\",&x,&y,&l,&r);\n\tans[++cnt] = l-1;\n\tans[++cnt] = r+1;\n\tfor (long long i=1;i<r&&i>0;i*=x)\n\t{\n\t\tfor (int j=1;j+i<=r&&j+i>0;j*=y)\n\t\t{\n\t\t\tif (i+j<l) continue;\n\t\t\tans[++cnt] = i+j;\n\t\t}\n\t}\n\tsort(ans+1,ans+cnt+1);\n//\tcout<<cnt<<endl;\n\tlong long anss = 0;\n\tfor (int i=1;i<cnt;i++)\n\tanss = max(anss,ans[i+1]-ans[i]-1);\n\tcout<<anss<<endl;\n\treturn 0;\n}\n\t         \t\t \t\t  \t \t\t \t \t   \t", "lang": "GNU C++14", "bug_code_uid": "0397f0b119467506f62aa2b0e699ac0c", "src_uid": "68ca8a8730db27ac2230f9fe9b120f5f", "apr_id": "d061c16f22f00978e49a637657e2d25e", "difficulty": 1800, "tags": ["math", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.7935560859188544, "equal_cnt": 12, "replace_cnt": 3, "delete_cnt": 3, "insert_cnt": 6, "fix_ops_cnt": 12, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n#define X first\n#define Y second\n#define MOD 1000000007\n#define forn(i, n) for (long i = 0; i < n; i++)\n#define mp make_pair\n#define pb push_back\n#define watch(x) cerr << (#x) << \" is \" << (x)<<\" \"\n#define debug() cerr << \"running till line \" << __LINE__ << \" in function \" << __func__ << endl\nconst double PI = 3.141592;\nconst int inf = (int)1.01e9;\nconst double eps = (1e-9);\ntypedef unsigned long long ull;\ntypedef long long ll;\ntypedef vector<long> vl;\ntypedef vector<int> vi;\n\nvoid solve();\n\ntemplate <typename T>\n\nvoid print(T arr[],size_t sizee)\n{\n    for (size_t it = 0 ;it<sizee;it++){\n    \tcout<<arr[it]<<\" \";\n    }\n    \n    cout << endl;\n}\ntemplate <class T>\nvoid print(T container1)\n{\n    for (auto it : container1)\n    {\n        cout << it << \" \";\n    }\n    cout << endl;\n}\nint main(int argc, char const *argv[])\n{\n \n#ifdef _DEBUG\n    int tt = clock();\n#endif\n\n    solve();\n\n#ifdef _DEBUG\n    cerr << \"TIME = \" << clock() - tt << endl;\n    tt = clock();\n#endif\n}\n\nvoid solve()\n{   \n    int n;\n    cin>>n;\n    string s;\n    cin >>s ;\n    int x=0,y=0;\n   vector <pair<int,pair <int,int >> > pp;\n    \n    int c1=0,c2=0;\n    int m=0;\n    for(int i =0;i<n;i++){\n        c1=0,c2=0;\n        if(s[i]=='L')\n        {\n           c1--;\n        }\n        if(s[i]=='R')\n        {\n            c1++;\n        }\n        if(s[i]=='U')\n        {\n            c2++;\n        }\n        if(s[i]=='D')\n        {\n            c2--;\n        }\n        int nn=pp.size();\n       for(int j=0;j<nn;j++ ){\n           int x=c1+pp[j].second.first;\n           int y=c2+pp[j].second.second;\n           pp.push_back({pp[j].first+1,{x,y}});\n            if(x==0 && y==0){\n                if(m<pp[j].first+1){\n                    m=pp[j].first+1;\n                }\n            }\n       }\n       pp.push_back({1,{c1,c2}});\n       \n    }   \n    cout<<m<<endl;\n}", "lang": "GNU C++17", "bug_code_uid": "b81bf7d23b0626017cad2647de60063e", "src_uid": "b9fa2bb8001bd064ede531a5281cfd8a", "apr_id": "42ac0e11da6c09cacd49922bd61128f4", "difficulty": 1000, "tags": ["greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.40076701821668265, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "#include<iostream>\n\nusing namespace std;\n\nlong long d[10000+5][10000+5];\n\nmain()\n{\n    long long m,b;\n    cin>>m>>b;\n    long long c=10001;\n    d[0][0]=0;\n    for (long long i=1; i<c; i++)\n        d[0][i]=d[0][i-1]+i;\n    for (long long i=1; i<c; i++)\n        d[i][0]=d[i-1][0]+i;\n    for (long long i=1; i<c; i++)\n        for (long long j=1; j<c; j++)\n            if (i==0&&j==0) continue;\n        else d[i][j]=d[i-1][j]+d[i][j-1]-d[i-1][j-1]+i+j;\n    long long max=0;\n    for (long long i=0; i<c; i++)\n    {\n        long long u=-(i/m)+b;\n        if (i%m!=0) u--;\n        if (u<0) continue;\n        if (max<d[i][u]) {max=d[i][u];}\n    }\n    cout<<max;\n}\n", "lang": "GNU C++11", "bug_code_uid": "f0c7fe9ff95fed85c2ce59c9f6b46084", "src_uid": "9300f1c07dd36e0cf7e6cb7911df4cf2", "apr_id": "683ff9b9051911099272aca7dc77d90a", "difficulty": 1300, "tags": ["math", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9688179840464104, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "/*#include<cstdio>\n#include<cstring>\n#define maxn 200\n#define minn 0x3f3f3f3f\nusing namespace std;\nint vis[maxn],d[maxn],map[maxn][maxn];\nvoid start(int m)\n{\n  for(int i=0;i<m;i++)\n  {\n  vis[i]=0;\n  d[i]=minn;\n  }\n}\nint prime(int m)\n{\n  int sum=0;\n  for(int i=0;i<m;i++)\n  d[i]=map[0][i];\n  vis[0]=1;\n  d[0]=0;\n  int v,temp;\n  for(int i=1;i<m;i++)\n  {\n  \t temp=minn;\n    for(int j=0;j<m;j++)\n    {\n\t   if(temp>d[j]&&!vis[j])\n\t   {\n\t     v=j;\n\t     temp=d[j];\n\t   }\n\t}\n\tsum+=temp;\n\tvis[v]=1;\n\tfor(int j=0;j<m;j++)\n\t{\n\t  if(!vis[j]&&d[j]>map[v][j])\n\t  d[j]=map[v][j];\n\t}\n  }\n  return sum;\n}\nint main()\n{\n\tint m,n;\n\twhile(~scanf(\"%d\",&m))\n\t{\n\tfor(int i=0;i<m;i++)\n\t{\n\t  for(int j=0;j<m;j++)\n\t  {\n\t  scanf(\"%d\",&map[i][j]);\n\t  } \n\t}\n\tstart(m);\n\tint s=prime(m);\n\tprintf(\"%d\\n\",s);\n\t}\nreturn 0;\n}*/\n/*#include<cstdio>\n#include<cstring>\n#include<vector>\n#define maxn 1005\nusing namespace std;\nint main()\n{\n\tint m,n;\n\tint f[maxn];\n\tscanf(\"%d\",&n);\n\tfor(int i=0;i<n;i++)\n\t scanf(\"%d\",&f[i]);\n\t int end=0,start=0,l=0,max=f[0],sum=0;\n\t for(int i=0;i<n;i++)\n\t {\n\t   sum=sum+f[i];\n\t   if(max<sum)\n\t   {max=sum;\n\t   end=i;\n\t   start=l;\n\t   }\n\t   else if(sum<0)\n\t   {\n\t     sum=0;\n\t     l=i+1;\n\t   }\n\t }\n\t printf(\"%d %d %d\\n\",max,f[start],f[end]);\n\t \nreturn 0;\n}*/\n/*hash:\n#include<cstdio>\n#include<cmath>\n#include<cstring>\n#define maxn 200005\n#define minn 10000007\nusing namespace std;\nunsigned long long int next[maxn];\nvoid hash(char *str,int n)\n{\n\tunsigned long long int sum=0;\n\tint b=31,i;\n\tunsigned long long int num=pow(double(b),double(n));\n  for(i=0;i<n;i++)\n  {\n    sum=sum*b+str[i];\n  }\n  next[i-1]=sum%minn;\n  int s=0;\n  while(str[i])\n  {\n  next[i]=next[i-1]*b-str[s]*num+str[i];\n  s++;\n  i++;\n  }\n}\n\nint main()\n{\n\tchar str[maxn],th[maxn];\n\twhile(~scanf(\"%s\",str))\n\t{\n\t\tscanf(\"%s\",th);\n\t  int l=strlen(th);\n\t  hash(str,l);\n\t  unsigned long long int shu=0;\n\t  for(int i=0;i<l;i++)\n\t  {\n\t    shu=shu*31+th[i];\n\t  }\n\t  int i=l-1;\n\t  int flag=0;\n\t  while(str[i])\n\t  {\n\t    if(next[i]==shu)\n\t     flag++;\n\t    i++;\n\t  }\n\t  printf(\"%d\\n\",flag);\n\t}\nreturn 0;\n}*/\n\n\n/*#include<cstdio>\n#include<cstring>\n#define maxn 200010\nint num[maxn];\nusing namespace std;\nstruct node\n{\n  int l;\n  int r;\n  int v;\n}tree[4*maxn+5];\nint max(int x,int y)\n{\nif(x>y)\nreturn x;\nelse\nreturn y;\n}\nvoid build(int next,int x,int y)\n{\nint node_left=(next<<1)+1;\nint node_right=(next<<1)+2;\nint mid=(x+y)/2;\ntree[next].l=x;\ntree[next].r=y;\nif(x==y)\ntree[next].v=num[x-1];\nelse\n{\n  build(node_left,x,mid);\n  build(node_right,mid+1,y);\n  tree[next].v=max(tree[node_left].v,tree[node_right].v);\n}\n}\n\nint find(int next,int x,int y)\n{\n  int node_left=(next<<1)+1;\n  int node_right=(next<<1)+2;\n  int s,t;\n  if(tree[next].l>y||tree[next].r<x)\n  return 0;\n  else if(tree[next].l>=x&&tree[next].r<=y)\n  return tree[next].v;\n  else\n  {\n s= find(node_left,x,y);\n t= find(node_right,x,y);\n return max(s,t);\n  }\n}\nvoid insert(int next,int s,int x)\n{\n  if(tree[next].l==tree[next].r)\n  {\n    if(tree[next].l==s)\n    {\n    tree[next].v=x;\n   }\n    else\n    return ;\n  }\n  else if((s>=tree[next].l&&s<tree[next].r)||(s>tree[next].l&&s<=tree[next].r))\n  {\n    int node_left=(next<<1)+1;\n    int node_right=(next<<1)+2;\n    insert(node_left,s,x);\n    insert(node_right,s,x);\n    tree[next].v=max(tree[node_left].v,tree[node_right].v);\n  }\n}\n\nint main()\n{\n\tint t,x,y,n,m,i,j,s=1;\n\tchar name;\n\twhile(~scanf(\"%d%d\",&n,&m))\n\t{\n\tfor(i=0;i<n;i++)\n\tscanf(\"%d\",&num[i]);\n\tgetchar();\n\tbuild(0,1,n);\n\twhile(m--)\n\t{\n\tscanf(\"%c%d%d\",&name,&x,&y);\n\tgetchar();\n    if(name=='U')\n    {\n\tinsert(0,x,y);\n\t}\n\telse if(name=='Q')\n\t{\n\t  printf(\"%d\\n\",find(0,x,y));\n\t}\n\t}\n  }\nreturn 0;\n}*/\n/*#include<cstdio>\n#include<cstring>\n#include<queue>\nusing namespace std;\nconst int maxn = 300;\nint vis[maxn][maxn];\nstruct node\n{\nint x;\nint y;\nint step;\n}s;\nint Move[4][2]={0,1,0,-1,1,0,-1,0};\nint m,n;\nchar map[maxn][maxn];\nint bfs(int x,int y,int a,int b)\n{\n\tqueue<node > que;\n  struct node th;\n  s.step=0;\n  s.x=x;\n  s.y=y;\n  que.push(s);\n  vis[s.x][s.y]=1;\n  while(!que.empty())\n  {\n    th=que.front();\n    que.pop();\n    if(th.x==a&&th.y==b)\n    {\n\treturn th.step;\n\t}\n\tfor(int i=0;i<4;i++)\n\t{\n\t  s.x=th.x+Move[i][0];\n\t  s.y=th.y+Move[i][1];\n\t  s.step=th.step+1;\n\t  if(s.x==a&&s.y==b)\n\t  {\n\t  return s.step;\n\t  }\n\t  if(s.x>=0&&s.x<m&&s.y>=0&&s.y<n&&map[s.x][s.y]!='#'&&map[s.x][s.y]!='Y'&&map[s.x][s.y]!='M'&&vis[s.x][s.y]==0)\n\t  {\n\t    vis[s.x][s.y]=1;\n\t    que.push(s);\n\t  }\n\t}\n  }\n  return -1;\n}\nint main()\n{\n\tint x1,x2,y1,y2;\n\tstruct node ma[900];\n\twhile(~scanf(\"%d%d\",&m,&n))\n\t{\n\t\tint u=0;\n\t  for(int i=0;i<m;i++)\n\t  {\n\t    getchar();\n\t    for(int j=0;j<n;j++)\n\t    {\n\t\tscanf(\"%c\",&map[i][j]);\n\t\tif(map[i][j]=='Y')\n\t\t{\n\t\t  x1=i;\n\t\t  y1=j;\n\t\t}\n\t\telse if(map[i][j]=='M')\n\t\t{\n\t\tx2=i;\n\t\ty2=j;\n\t\t}\n\t\telse if(map[i][j]=='@')\n\t\t{\n\t\tma[u].x=i;\n\t\tma[u].y=j;\n\t\tu++;\n\t\t}\n\t\t}\n\t  }\n\t  int max=0x3f3f3f3f;\n\t  for(int i=0;i<u;i++)\n\t  {\n\t\t  if(map[ma[i].x][ma[i].y]=='@')\n\t\t  {\n\t\t  int l,r;\n\t\t  memset(vis,0,sizeof(vis));\n\t\t  l=bfs(x1,y1,ma[i].x,ma[i].y);\n\t\t  memset(vis,0,sizeof(vis));\n\t\t  r=bfs(x2,y2,ma[i].x,ma[i].y);\n\t\t  if(max>(l+r)&&(l>=0&&r>=0))\n\t\t  {\n\t\t  max=l+r;\n\t\t  }\n\t\t}\n\t  }\n\t  printf(\"%d\\n\",max*11);\n\t}\nreturn 0;\n}*/\n/*#include<cstdio>\n#include<cstring>\n#include<string>\n#define p 13\n#include<cmath>\nusing namespace std;\nconst int maxn = 1000005;\nconst long long int mod = 1e9+9;\nint hash(char str[],int l)\n{\n\tint max=-1;\n  unsigned long long int x,y;\n  for(int i=0;i<l&&(l-i-1)>=max;i++)\n  {\n    for(int j=0;j<i&&(i+i-j)<l;j++)\n    {\n\t  int l=i-j;\n\t  x=0;\n\t  y=0;\n\t  for(int s=j;s<i;s++)\n\t  {\n\t  x=(x*p+str[s])%mod;\n\t  y=(y*p+str[2*i-s])%mod; \n\t  }\n\t  if(x==y)\n\t  {\n\t    if(max<l)\n\t    max=l;\n\t  }\n\t}\n  }\n  int m=2*max+1;\n  for(int i=0;i<l-1&&(l-i-1)>=max;i++)\n  {\n    for(int j=0;j<=i;j++)\n    {\n\t  int l=i-j+1;\n\t  x=0;\n\t  y=0;\n\t  for(int s=0;s<=i;s++)\n\t  {\n\t  x=(x*p+str[s])%mod;\n\t  y=(y*p+str[2*i+1-s])%mod;\n\t  }\n\t  if(x==y)\n\t  {\n\t    if(max<l)\n\t    max=l;\n\t  }\n\t}\n  } \n  int n=2*max;\n  return m>n?m:n;\n}\nint main()\n{\n\tchar str[maxn];\n\twhile(~scanf(\"%s\",str))\n\t{\n\t  if(strcmp(str,\"END\")==0)\n\t  break;\n\t  int l=strlen(str);\n\t  printf(\"%d\\n\",hash(str,l));\n\t}\nreturn 0;\n}*/\n/*manacher:\n#include<cstdio>\n#include<cstring>\n#include<algorithm>\nusing namespace std;\nconst int maxn = 40005;\nint p[maxn]={0};\nchar str[maxn];\nint Manacher(char *s)\n{\n\tchar c[maxn];\n    int len=strlen(s+1);\n    for (int i=1; i<=len; i++) c[2*i-1]='~',c[2*i]=s[i]; c[len=2*len+1]='~';\n    int Pos=0,R=0,MAX=0;  //Pos\ufffd\ufffd\ufffd\u0435\u38ecR\ufffd\ufffd\ufffd\ufffd\ufffd\u04b1\ufffd\ufffd\u01f8\ufffd\ufffd\ufffd; \n    for(int i=1;i<=len;i++)\n    p[i]=0;\n    for (int i=1; i<=len; i++)\n    {\n        if (i<R) p[i]=min(p[2*Pos-i],R-i); else p[i]=1;\n        while (1<=i-p[i]&&i+p[i]<=len&&c[i-p[i]]==c[i+p[i]]) p[i]++;//\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \n        if (i+p[i]>R) {R=i+p[i]; Pos=i;}\n        MAX=max(MAX,p[i]-1);\n    }\n    return MAX;\n}\nint main()\n{\n\tint n;\n\tint g=1;\n\twhile(~scanf(\"%s\",str+1))\n\t{\n\t  if(strcmp(str+1,\"END\")==0)\n\t  break;\n\t  int s=Manacher(str);\n\t  printf(\"Case %d: %d\\n\",g++,s);\n\t}\nreturn 0;\n}*/\n/*#include<cstdio>\n#include<cstring>\nusing namespace std;\nconst int maxn=200005;\nint n;\nchar str[maxn],th[maxn];\nchar s[maxn];  \nchar s1[maxn]; \nint main(){\n    scanf(\"%d\",&n);\n    scanf(\"%s%s\",str,th);\n    int cnt=0;  \n    for(int i=n-1;i>=0;i--){   \n        str[i]-='a';\n        th[i]-='a';\n        s[i]=(str[i]+th[i]+cnt)%26;\n        cnt=(str[i]+th[i]+cnt)/26;\n    }\n    for(int i=0;i<n;i++){\n        s1[i]=(s[i]+cnt*26)/2+'a';\n        cnt=s[i]%2;\n}\nprintf(\"%s\\n\",s1);\n    return 0;\n}*/\n/*#include<cstdio>\n#include<iostream>\n#include<cstring>\n#define ull unsigned long long\nusing namespace std;\nconst int maxn =1e4+5;\nchar num[maxn]; \null change(char str[],int p)\n{\n\tull sum=0;\n\tint i=0;\n\tint g;\n  while(str[i])\n  {\n  \tif(str[i]>='0'&&str[i]<='9')\n  \tg=str[i]-'0';\n  \telse if(str[i]>='A'&&str[i]<='Z')\n  \tg=10+str[i]-'A';\n  \telse\n  \t{\n\t  g=36+str[i]-'a';\n\t}\n  sum=sum*p+g;\n  }\n}\nchar th[maxn];\nint find(ull s,int p)\n{\n  int i=0;\n  if(s==0)\n  th[i++]='0';\n  while(s)\n  {\n    th[i++]=s%p+'0';\n    s=s/p;\n  }\n  return i;\n}\nint main()\n{\n\tint n,l,r;\n\tscanf(\"%d\",&n);\n\twhile(n--)\n\t{\n\tscanf(\"%d%d\",&l,&r);\n\tscanf(\"%s\",num);\n\t\n\t}\nreturn 0;\n}*/\n/*#include<cstdio>\n#include<cstring>\n#include<iostream>\nusing namespace std;\nconst int maxn = 1e5+5;\nint find(char *str)\n{\nchar th[maxn];\nint cnt=2,l;\nint i=0;\nth[0]='$';\nth[1]='#';\nwhile(str[i])\n{\nth[cnt++]=str[i];\nth[cnt++]='#';\ni++;\n}\nth[cnt]='\\0';\ncnt=cnt-1;\nint p[maxn];\nfor(i=0;i<=cnt;i++)\n{\np[i]=0;\n}\nint minn=-100;\nint mx=0,pos=0;\nfor(i=1;i<=cnt;i++)\n{\n  if(mx<=i)\n  p[i]=1;\n  else\n  p[i]=max(p[2*pos-i],mx-i);\n  while(i-p[i]>=1&&i+p[i]<=cnt&&th[p[i]+i]==th[i-p[i]])\n  p[i]++;\n  if(i+p[i]>mx)\n  {\n  mx=i+p[i];\n  pos=i; \n  }\n  minn=max(minn,p[i]-1);\n}\nreturn minn;\n}\n\nint main()\n{\n\tint l,n;\n    char str[maxn];\n    cin>>str;\n    int g=find(str);\n    printf(\"%d\\n\",g);\nreturn 0;\n}*/\n/*#include<cstdio>\n#include<iostream>\n#include<cstring>\n#include<string>\n#include<algorithm>\n#include<vector>\nusing namespace std;\nconst int maxn = 1e5+5;\nvector<int > str1,ans;\nint main()\n{\n\tint a,b;\n\tstring l,r;\n\tint t;\n\tcin>>t;\n\twhile(t--)\n\t{\n    cin>>a>>b>>l;\n\tfor(int i=0;i<l.size();i++)\n\t{\n\tif(l[i]>='0'&&l[i]<='9') str1.push_back(l[i]-'0');\n\tif(l[i]>='A'&&l[i]<='Z') str1.push_back(l[i]-'A'+10);\n\tif(l[i]>='a'&&l[i]<='z') str1.push_back(l[i]-'a'+36);\n\t}\n\t}\n    \nreturn 0;\n}*/\n#include<cstdio>\n#include<cstring>\n#include<iostream>\n#include<algorithm>\nusing namespace std;\nconst int maxn = 1e4+5;\nunsigned long long sum[maxn][maxn]={0};\nunsigned long long change(int x,int y)\n{\n\tunsigned long long l=0,r=0;\n  for(int i=0;i<=x;i++)\n  {\n  l+=i;\n  }\n  for(int j=0;j<=y;j++)\n  {\n  r+=j;\n  }\n  return (x+1)*r+(y+1)*l;\n}\nint main()\n{\n\tint n,m;\n\tcin>>n>>m;\n\tint r=m*n,l=m;\n\tunsigned long long Max=0;\n\tfor(int i=0;i<=r;i++)\n\t{\n\t  if(i%n==0)\n\t  {\n\t  Max=max(Max,change(i,m-i/n));\n\t  }\n\t}\n\tprintf(\"%llu\\n\",Max);\nreturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "cea3667af28934c5fc4527fa861b66c1", "src_uid": "9300f1c07dd36e0cf7e6cb7911df4cf2", "apr_id": "e4f7b80b11d6508ead26263c2f977045", "difficulty": 1300, "tags": ["math", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.33084947839046197, "equal_cnt": 25, "replace_cnt": 19, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 24, "bug_source_code": "/*            He was Humble but not fool.\n           slow_processor for maskman_lucifer.     */\n                    \n#include <bits/stdc++.h>   \n#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);\n#define ll long long \n#define pll pair<ll,ll>\n#define pb push_back\n#define M 1000000007\n#define lc '\\n'\nusing namespace std;\nll n,m;\nll a[40];\nll dp[1000000][40];\nll solve(ll ind,ll s)\n{\n    if(ind==n)\n    {\n        return s%m;\n    }\n    else\n    {\n        if(s>=1000000)\n        {\n              return max(solve(ind+1,s),solve(ind+1,s+a[ind]));\n        }\n        else\n        {\n            ll &ans=dp[s][ind];\n            if(ans==-1)\n            {\n                ans=max(solve(ind+1,s),solve(ind+1,s+a[ind]));\n            }\n            return ans;\n        }\n    }\n}\nint main()\n{\n    IO\n    cin>>n>>m;\n    memset(dp,-1,sizeof(dp));\n    for(ll i=0;i<n;i++)\n    {\n        cin>>a[i];\n        a[i]%=m;\n    }\n    sort(a,a+n);\n    cout<<solve(0,0);\n    return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "6c02dbccd313e39028437db99244f3f6", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "apr_id": "09c72abb1d8476e825392a72d95a4e4d", "difficulty": 1800, "tags": ["divide and conquer", "meet-in-the-middle", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9156626506024096, "equal_cnt": 11, "replace_cnt": 3, "delete_cnt": 5, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "#include <bits/stdc++.h>\n#define re return\n#define ll long long\n#define ull unsigned ll\n#define ld long double\n#define f first\n#define s second\n#define pi acos(-1)\n#define oo (ll)1e9+5\n#define OO 1e18\n#define EPS 1e-6\n#define Endl '\\n'\n#define FX(n) fixed<<setprecision(n)\n#define mm(o,k) memset(o,k,sizeof o)\n#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);\nusing namespace std;\nconst int maxn=4005;\nint Min(oo);\nint a[5],b[5],c[5];\nvoid check(int x,int y,int z){\n    int A=x+a[0];\n    int B=y+a[1];\n    int C=z+a[2];\n    int fr2_awl=max(0,B-b[2]);\n    int fr2_tani=max(0,b[1]-C);\n    if(fr2_awl&&!fr2_tani){\n        Min=min(Min,c[1]*y+c[2]*z);\n        re ;\n    }\n    if(!fr2_awl||!fr2_tani)re ;\n    int hna=(A+fr2_tani-1)/fr2_tani;\n    int m3lsh=(b[0]+fr2_awl-1)/fr2_awl;\n    if(hna>m3lsh)Min=min(Min,c[0]*x+c[1]*y+c[2]*z);\n    re ;\n}\nint main()\n{\n    IO;\n    for(int i=0;i<3;++i)cin >> a[i];\n    for(int i=0;i<3;++i)cin >> b[i];\n    for(int i=0;i<3;++i)cin >> c[i];\n    for(int i=0;i<=200;++i)\n        for(int j=0;j<=1000;++j)\n            for(int k=0;k<=1000;++k)\n                check(i,j,k);\n    cout<<Min<<endl;\n    re 0;\n}", "lang": "GNU C++17", "bug_code_uid": "d54e5cf183b06160d0db48ef7eaf0e7b", "src_uid": "bf8a133154745e64a547de6f31ddc884", "apr_id": "6706373c6c3fdbf36dec8794d549636f", "difficulty": 1800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.3002028397565923, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "#include <iostream>\n#include<algorithm>\nusing namespace std;\n\nlong int fact(long int n)\n{\n    if (n==1) return 1;\n    else return n*fact(n-1);\n}\nint main() {\n\tlong int a,b; cin>>a>>b;\n\tlong int fact(long int);\n\ta=fact(a); b=fact(b);\n\tcout<<__gcd(a,b);\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "762db220c4de2845032905140324dc8c", "src_uid": "7bf30ceb24b66d91382e97767f9feeb6", "apr_id": "0ab483f8d9ac7c0257e0d29e73a9485e", "difficulty": 800, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.10601808543810415, "equal_cnt": 17, "replace_cnt": 10, "delete_cnt": 6, "insert_cnt": 1, "fix_ops_cnt": 17, "bug_source_code": "#pragma GCC optimize(\"O3\")\n#pragma comment(linker, \"/stack:200000000\")\n#pragma GCC optimize(\"Ofast\")\n#pragma GCC target(\"sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native\")\n#include<bits/stdc++.h>\n#include<algorithm>\n#include<unordered_map>\nusing namespace std;\n#define ll          long long int\n#define pb          push_back\n#define pob         pop_back\n#define ins         insert\n#define fi          first\n#define se          second\n#define inf         200001\n#define rep(a,b,c)  for(ll i=a;i<b;i=i+c)\n#define repd(a,b,c) for(ll i=a;i>b;i=i-c)\n#define Arena       ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);\n#define pii         pair<ll,ll>\n#define mod         1000000007 \n#define N           100001\n#define si(n)       scanf(\"%s\",&n)\nint main(){\n    Arena\n    ll n;cin>>n;\n    ll a=n,b,c,temp;\n    ll ndig=0;\n    unordered_map<ll,int>hash;\n    for(ll i=0;i<=n;i++){\n        hash[i]=0;\n    }\n    while(a){\n        a=a/10;\n        ndig++;\n    }\n    ll ans=0;\n    // for(ll i=1;i<=9;i++){\n    //     if(i<=n){\n    //         ans++;\n    //     }\n    // }\n    //cout<<ndig<<endl;\n    for(ll i=2;i<=ndig;i++){\n        for(ll x=1;x<=9;x++){\n            for(ll y=x+1;y<=9;y++){\n                for(ll j=0;j<(1<<i);j++){\n                    a=i;\n                    b=j;\n                    c=1;\n                    temp=0;\n                    while(a){\n                        if(b&1){\n                            temp=c*x + temp;\n                        }\n                        else{\n                            temp=c*y + temp;\n                        }\n                        a--;\n                        b=b/2;\n                        c=c*10;\n                    }\n                    //cout<<temp<<endl;\n                    if(temp<=n && hash[temp]==0){\n                        //cout<<temp<<endl;\n                        hash[temp]=1;\n                        ans++;\n                    }\n                }\n            }\n        }\n    }\n    //cout<<ans<<endl;\n    for(ll i=0;i<(1<<ndig);i++){\n        for(ll j=1;j<=9;j++){\n            a=i;\n            temp=0;\n            c=1;\n            while(a){\n                if(a&1){\n                    temp=c*j+temp;\n                }\n                c=c*10;\n                a=a/2;\n            }\n            if(temp<=n && hash[temp]==0){\n                //cout<<temp<<endl;\n                ans++;\n                hash[temp]=1;\n            }\n        }\n    }\n    cout<<ans-1;\n    return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "57165ac5e00569deb1741042d3082ae3", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "apr_id": "3f6dcc987592544009eefc0d421fa383", "difficulty": 1600, "tags": ["dfs and similar", "brute force", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.7262969588550984, "equal_cnt": 25, "replace_cnt": 14, "delete_cnt": 4, "insert_cnt": 6, "fix_ops_cnt": 24, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n\n#define fo(i,s,t) for(int i = s; i <= t; ++ i)\n#define fd(i,s,t) for(int i = s; i >= t; -- i)\n#define bf(i,s) for(int i = head[s]; i; i = e[i].next)\n#define mp make_pair\n#define fi first\n#define se second\n#define pii pair<int,int>\n#define pb push_back\n#define VI vector<int>\n#define sf scanf\n#define pf printf\n#define fp freopen\n#define SZ(x) ((int)(x).size())\n#ifdef MPS\n#define D(x...) printf(x)\n#else\n#define D(x...)\n#endif\ntypedef long long ll;\ntypedef double db;\ntypedef unsigned long long ull;\nconst int inf = 1<<30;\nconst ll INF = 1ll<<60;\nconst db Inf = 1e20;\nconst db eps = 1e-9;\n\nconst int P = 1e9+7;\n\nunordered_map<pair<ll,int>,ll> f;\n\nvoid exgcd(ll a,ll b,ll& d,ll& x,ll& y)\n{\n    if(!b) { d = a; x = 1; y = 0; }\n    else{ exgcd(b, a%b, d, y, x); y -= x*(a/b); }\n}\n\nll inv(ll a, ll p)\n{\n    ll d, x, y;\n    exgcd(a, p, d, x, y);\n    return d == 1 ? (x+p)%p : -1;\n}\n\nll dp(ll n, int k)\n{\n\tif(!k) return n;\n\tif(f[mp(n,k)]) return f[mp(n,k)];\n\tll tmp = 0; int overall = 0;\n\tfor(ll i = 1; i * i <= n; ++ i)\n\t\tif(n%i == 0) \n\t\t{\n\t\t\ttmp = (tmp + dp(i, k-1)) % P;\n\t\t\tif(i * i == n) overall ++; \n\t\t\telse {overall += 2; tmp = (tmp + dp(n/i,k-1)) % P;}\n\t\t}\n\treturn f[mp(n,k)] = (tmp * inv(overall, P))%P;\n}\n\nint main()\n{\n\t#ifdef MPS\n\t\tfp(\"1.in\",\"r\",stdin);\n\t\tfp(\"1.out\",\"w\",stdout);\n\t\tdouble mps = clock();\n\t#endif\n\tll n; int k;\n\tcin >> n >> k;\n\tcout << dp(n, k) << endl;\n\tD(\"total excution time %.5f\\n\",clock()-mps);\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "ef6012c7118d3f49ce4a60fc35b8f145", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "apr_id": "137195a299a69471de85a00e8334e584", "difficulty": 2200, "tags": ["dp", "math", "probabilities", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.11646418098031001, "equal_cnt": 29, "replace_cnt": 24, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 30, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n\nll x, y, z, dp[10005][55], ans = 1, var;\n\nll fs(ll s, ll ss, ll n){\n\tll res = 1;\n\twhile (ss > 0){\n\t\tif (ss & 1){\n\t\t\tres = (res * s) % n;\n\t\t}\n\t\tss >>= 1;\n\t\ts = (s * s) % n;\n\t}\n\treturn res;\n}\n\nll rec(ll ss, ll n){\n\tif (ss <= 0){\n\t\treturn fs(var, n, mod);\n\t}\n\tll &re = dp[ss][n];\n\tif (re != -1){\n\t\treturn re;\n\t}\n\tre = 0;\n\tll rep = fs(n + 1, mod - 2, mod);\n\tfor (int i = 0; i <= n; i++){\n\t\tre = (re + (rec(ss - 1, n - i) * rep % mod)) % mod;\n\t}\n\treturn re;\n}\n\nint main(){\n    ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);\n\tscanf(\"%lld%lld\", &x, &y);\n\tfor (int i = 2; i * i <= x; i++){\n\t\tz = 0;\n\t\twhile (x % i == 0){\n\t\t\tx /= i;\n\t\t\tz++;\n\t\t}\n\t\tif (z){\n\t\t\tvar = i;\n\t\t\tmemset(dp, -1, sizeof(dp));\n\t\t\tans = (ans * rec(y, z)) % mod;\n\t\t}\n\t}\n\tif (x > 1){\n\t\tvar = x;\n\t\tmemset(dp, -1, sizeof(dp));\n\t\tans = (ans * rec(y, 1)) % mod;\n\t}\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "b9ab229221bb0137513705139bb2705b", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "apr_id": "8ca7a4d8006b6ae1f5527d42fbf111ba", "difficulty": 2200, "tags": ["dp", "math", "probabilities", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9999352205739457, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "/*\n * temp.cpp\n *\n *  Created on: 2012-7-18\n *      Author: BSBandme\n */\n#include <iostream>\n#include <fstream>\n#include <string.h>\n#include <cstdio>\n#include <algorithm>\n#include <string>\n#include <vector>\n#include <queue>\n#include <cassert>\n#include <iomanip>\n#include <math.h>\n#include <deque>\n#include <utility>\n#include <map>\n#include <set>\n#include <bitset>\n#include <numeric>\n#include <climits>\n#include <cctype>\n#include <cmath>\n#include <cstdlib>\n#include <sstream>\n\nusing namespace std;\n\ntypedef unsigned long long ull;\ntypedef long long ll;\ntypedef pair <int, int> pii;\ntypedef pair <ll, ll> pll;\ntypedef pair <double, double> pdd;\ntypedef vector <int> vi;\ntypedef vector <ll> vl;\ntypedef vector <double> vd;\ntypedef vector <string> vs;\ntypedef map <string, int> mpsi;\ntypedef map <double, int> mpdi;\ntypedef map <int, int> mpii;\n\nconst double pi = acos(0.0) * 2.0;\nconst double eps = 1e-12;\nconst int step[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};\n\ntemplate <class T> inline T abs1(T a) {return a < 0 ? -a : a;}\ntemplate <class T> inline T max1(T a, T b) {return a > b ? a : b;}\ntemplate <class T> inline T min1(T a, T b) {return a < b ? a : b;}\ntemplate <class T> inline T gcd1(T a, T b) {\n\tif(a < b) swap(a, b);\n\tif(a % b == 0) return b;\n\treturn gcd1(b, a % b);\n}\ntemplate <class T> inline T lb(T num) {return num & (-num); }\ninline int bitnum(ull nValue){\n    nValue = ((0xaaaaaaaaaaaaaaaaull & nValue)>>1) + (0x5555555555555555ull & nValue);\n    nValue = ((0xccccccccccccccccull & nValue)>>2) + (0x3333333333333333ull & nValue);\n    nValue = ((0xf0f0f0f0f0f0f0f0ull & nValue)>>4) + (0x0f0f0f0f0f0f0f0full & nValue);\n    nValue = ((0xff00ff00ff00ff00ull & nValue)>>8) + (0x00ff00ff00ff00ffull & nValue);\n    nValue = ((0xffff0000ffff0000ull & nValue)>>16) + (0x0000ffff0000ffffull & nValue);\n    nValue = ((0xffffffff00000000ull & nValue)>>32) + (0x00000000ffffffffull & nValue);\n\treturn nValue;\n}\ninline int jud(double a, double b){\n\tif(abs1(a - b) < eps) return 0;\n\tif(a < b) return -1;\n\treturn 1;\n}\nlong long pow(long long n, long long m, long long mod = 0){\n\tlong long ans = 1;\n\tlong long k = n;\n\twhile(m){\n\t\tif(m & 1) {\n\t\t\tans *= k;\n\t\t\tif(mod) ans %= mod;\n\t\t}\n\t\tk *= k;\n\t\tif(mod) k %= mod;\n\t\tm >>= 1;\n\t}\n\treturn ans;\n}\n\nint n, k;\n\n/*const ll mod = 777777777;\nll dp[2][300][300];\nll c[300][300];\n\nint main(){\n\tfreopen(\"input.txt\",\"w\", stdout);\n\tc[0][0] = 1; c[1][0] = c[1][1] = 1;\n\tfor(int i = 2; i < 300; i++){\n\t\tc[i][0] = 1;\n\t\tfor(int j = 1; j <= i; j++){\n\t\t\tc[i][j] = c[i - 1][j] + c[i - 1][j - 1];\n\t\t\tc[i][j] %= mod;\n\t\t}\n\t}\n\tfor(int n = 1; n <= 260; n <<= 1){\n\t\tmemset(dp, 0, sizeof(dp));\n\t\tdp[0][0][0] = 1;\n\t\tfor(int i = 1; i <= n; i++){\n\t\t\tint now = i & 1, last = 1 - now;\n\t\t\tmemset(dp[now], 0, sizeof(dp[now]));\n\t\t\tfor(int j = 0; j <= n; j++) for(int k = 0; k <= n - j; k++) for(int w = 0; w <= k; w++){\n\t\t\t\tif(j != i){\n\t\t\t\t\tdp[now][k + j][w] += dp[last][k][w] * c[n - k][j];\n\t\t\t\t\tdp[now][k + j][w] %= mod;\n\t\t\t\t} else{\n\t\t\t\t\tdp[now][k + j][w + j] += dp[last][k][w] * c[n - k][j];\n\t\t\t\t\tdp[now][k + j][w + j] %= mod;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintf(\"{\");\n\t\tfor(int i = 0; i < 300; i++) printf(\"%I64d, \", dp[n & 1][n][i]);\n\t\tprintf(\"}\\n\");\n\t}\n\n\treturn 0;\n}*/\nint dp[8][300] =\n{{0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}\n,{1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}\n,{109, 80, 30, 32, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}\n,{7593125, 4898872, 1897056, 1757896, 415870, 147224, 59808, 6824, 541, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}\n,{391464593, 569389279, 312106242, 578944191, 515619293, 117354594, 161873957, 472062098, 428982705, 565460332, 735127505, 33900006, 293783147, 746623577, 290516100, 776830421, 166257661, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}\n,{212568440, 186175544, 519860281, 612549793, 737154512, 651912135, 44684703, 387329805, 195188679, 444199674, 20119449, 142138221, 132906648, 628771752, 513156108, 486011304, 225200475, 391579767, 342079395, 647490480, 264125799, 629394768, 360252438, 398169441, 157617135, 229471758, 736955478, 211593382, 468868529, 683961846, 584837659, 261086313, 464207287, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}\n,{550671827, 520987612, 63744786, 421203111, 279421821, 202356819, 370826673, 67309914, 291740751, 496385218, 199307003, 433540170, 643714911, 239654268, 554473341, 156006018, 469781928, 522840969, 320813094, 628905585, 575661807, 611444862, 352474101, 676760679, 232198470, 732674124, 446575689, 184587732, 390739055, 190181628, 578972226, 61292868, 135769095, 226078251, 129676638, 582889860, 448939463, 551553401, 56407680, 275899176, 87664059, 206607807, 374020479, 391428765, 104256117, 298053147, 51326142, 506108358, 383350905, 398730015, 74806569, 703150560, 165216555, 554790222, 509737025, 459185405, 366667722, 672407328, 509425833, 156126222, 6511239, 581127897, 239509872, 240805271, 382725349, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}\n,{149150650, 232966794, 487159055, 30540300, 458170419, 480722613, 605295159, 37220268, 292922628, 530767740, 138718678, 257373347, 44594256, 340129188, 610216692, 416259390, 657133515, 479433192, 317959019, 500636381, 12787348, 669954708, 68131467, 526429710, 423048528, 254706039, 42951006, 282387700, 303717460, 341834527, 333633477, 65589678, 376367145, 4802637, 415705878, 352406796, 72018835, 52410890, 241289776, 343900011, 624827616, 353784942, 615036450, 508213986, 138765186, 668528077, 437011960, 710035809, 735862995, 676063665, 294926121, 565603164, 111746817, 335375775, 27702486, 299270097, 434962491, 501639192, 286484229, 578826927, 685038942, 700348950, 654339672, 143420103, 104733162, 590145264, 371892402, 506813013, 596108961, 533997135, 244690731, 261388683, 663532359, 429824745, 435828036, 705296781, 474743430, 427694175, 346831137, 54648783, 310453920, 465470131, 33785059, 738490312, 39521181, 671903001, 487033953, 685013007, 478908360, 93337440, 208947235, 407997044, 591219559, 594676173, 777331779, 387099846, 265613565, 739707108, 95984586, 500815609, 703097347, 561797418, 495032139, 705610017, 137170026, 676047609, 498253248, 750976272, 124604900, 756201264, 517628076, 773939082, 652682670, 55761813, 671961765, 168908523, 243630450, 175889805, 231881111, 478771358, 621882744, 678182556, 341766705, 36099042, 154906374, 462063756, 768209115, 482164403, 642497124, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}\n,{51933421, 410403148, 334527774, 772784623, 616557739, 119956662, 238586775, 63611061, 336008070, 669986155, 113924623, 290147622, 396846646, 112511021, 506832921, 18685233, 505761984, 225925875, 457760646, 658656684, 195193908, 757727334, 640171035, 277206615, 551718468, 545555745, 681825249, 115612245, 685740951, 231158277, 622498779, 374707494, 691786683, 666008595, 585462906, 146037150, 466218648, 547014447, 290039148, 190245195, 363920382, 156455586, 278403867, 327398400, 586278000, 393846327, 543672234, 561963717, 580966092, 753823584, 130668327, 353120823, 249229170, 166684527, 751104774, 309569589, 415359657, 723936555, 583194366, 494437752, 518796945, 39580443, 776201013, 42414435, 612152037, 608226003, 99972432, 558262341, 106017282, 690040638, 28879011, 512108856, 337388940, 551043738, 450089262, 360676008, 402578568, 120337812, 519804558, 324290610, 23385663, 225772848, 745389414, 233672418, 19259856, 276174402, 744786693, 375112647, 758102058, 444609585, 510907446, 172560633, 142626330, 429471231, 211245489, 577291428, 91991781, 9088632, 259025598, 596818971, 43978329, 157324491, 3103092, 462674016, 627500097, 512182818, 338032656, 603489402, 54829908, 501181650, 736006257, 286368453, 389728458, 40215357, 534475872, 64943298, 112310856, 682966116, 69045921, 439587099, 469819224, 695798271, 38780154, 396695565, 631539342, 88089750, 632887668, 56238084, 569195676, 708023862, 80301375, 1768977, 434685258, 475528473, 421403409, 775975599, 511142751, 131177718, 748118511, 296645895, 110110707, 639416484, 194905872, 211085469, 309238398, 11740617, 693768537, 652625388, 324264456, 640051812, 584206074, 361094166, 224922159, 89967528, 349541550, 591638112, 410970006, 291661029, 15985323, 613778508, 65323503, 341231688, 468358191, 521572968, 361541124, 429215724, 127304142, 228266073, 11703825, 304947090, 589390074, 128418948, 3862068, 377654949, 714128667, 456248898, 147611205, 5728464, 21997836, 396817281, 734158215, 341780733, 747135963, 339589404, 417125457, 44524053, 339589656, 681789969, 494463186, 220301928, 453528621, 517248963, 675326610, 507964023, 351220905, 574648641, 689828796, 695091546, 465336054, 429224274, 405628839, 696994956, 611296308, 357242229, 176520078, 721298331, 127701891, 117572859, 511306362, 452641455, 771641703, 283264821, 443032569, 441456687, 139696515, 627111387, 665791056, 388047555, 332840025, 259736526, 473910948, 191720088, 102052314, 654363234, 399056049, 496688157, 691964847, 654378921, 766395126, 111085128, 722623041, 492109128, 523195911, 645447222, 614109258, 706116537, 242583957, 533025234, 553627998, 488329191, 743539734, 315527373, 490300965, 715317967, 493725043, 228877044, 317300809, 663739304, 80515854, 396414708, 317067177, 102404925, 289303402, 139952108, 386543325, 412133651, 507720408, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};\n\n\nint main(){\n\tscanf(\"%d%d\", &n, &k);\n\tint n1 = 0;\n\tk = n - k;\n\twhile(n > 1) n1++, n >>= 1;\n\tprintf(\"%d\\n\", dp[n1][k]);\n\n\treturn 0;\n}\n\n\n\n", "lang": "GNU C++", "bug_code_uid": "79ea72b9ed8db8fa47e4de51b7addf8a", "src_uid": "cfe19131644e5925e32084a581e23286", "apr_id": "db328da0881f027c34fc6923f8def777", "difficulty": 2700, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.32439024390243903, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 4, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\ntypedef long long ll;\nint main()\n{\nll a,b;\ncin>>a>>b;\nll count=0;\nfor(ll i=a;i<=b;i++)\n{\n   ll p=floor(log2(i));\n   ll x=pow((ll)2,p+1);\n   x--;\n   for(ll j=p-1;j>=0;j--)\n   {\n      ll y=pow((ll)2,j);\n      ll z=x-y;\n      if(z==i)\n      {\n      count++;\n      break;\n      }\n      \n   }\n   \n}\n\ncout<<count;\n}", "lang": "GNU C++14", "bug_code_uid": "8941df234c68b5270f417fcc520300cb", "src_uid": "581f61b1f50313bf4c75833cefd4d022", "apr_id": "3b391ab2aa66e44ae13a61a0379d1a06", "difficulty": 1300, "tags": ["bitmasks", "brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9992970123022847, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n\nstruct aho {\n    int go[2], link, back;\n};\n\naho suf[1600], pr[40];\nstring sufs[1600], prs[40];\n\nvoid add_string(aho m[], string ms[], int &top, string s) {\n    int u = 0;\n    for (int i = 0; i < s.size(); ++i) {\n        if (m[u].go[s[i]] == 0) {\n            ++top;\n            m[u].go[s[i]] = top;\n            ms[top] = ms[u] + s[i];\n        }\n        u = m[u].go[s[i]];\n    }\n}\n\nvoid build_aho(aho m[]) {\n    m[0].link = 0;\n    vector <int> v = {0};\n    for (int i = 0; i < v.size(); ++i) {\n        for (int j = 0; j < 2; ++j)\n        if (m[v[i]].go[j] != 0) {\n            if (i == 0)\n                m[m[v[i]].go[j]].link = 0;\n            else\n                m[m[v[i]].go[j]].link = m[m[v[i]].link].go[j];\n            v.push_back(m[v[i]].go[j]);\n        } else\n            m[v[i]].go[j] = m[m[v[i]].link].go[j];\n    }\n}\nint find_string(aho m[], string s) {\n    int u = 0;\n    for (int i = 0; i < s.size(); ++i)\n        u = m[u].go[s[i]];\n    return u;\n}\n\nstring cnt(string s) {\n    for (int i = 0; i < s.size(); ++i)\n        s[i] += '0';\n    return s;\n}\n\nlong long dp[41][41][1600][2];\n\nint main() {\n    int i, j, k, n, top, l;\n    string s;\n    //freopen(\"input.txt\", \"r\", stdin);\n    //freopen(\"output.txt\", \"w\", stdout);\n    //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);\n    cin >> n;\n    cin >> s;\n    for (i = 0; i < s.size(); ++i)\n        s[i] -= '0';\n    if (s.size() > n) {\n        for (i = 0; i < s.size() - n; ++i)\n        if (s[i] != s[i + n]) {\n            cout << 0;\n            return 0;\n        }\n        cout << 1;\n        return 0;\n    }\n    add_string(pr, prs, j = 0, s);\n    build_aho(pr);\n    k = 0;\n    for (int i = 0; i < s.size(); ++i) {\n        string s1 = \"\";\n        for (int j = i; j < s.size(); ++j)\n            s1 += s[j];\n        add_string(suf, sufs, k, s1);\n    }\n    build_aho(suf);\n    dp[0][0][0][0] = 1;\n    for (i = 0; i < n; ++i)\n    for (j = 0; j < s.size(); ++j)\n    for (l = 0; l <= k; ++l)\n    if (l != s.size()) {\n        for (int i1 = 0; i1 < 2; ++i1)\n            dp[i + 1][pr[j].go[i1]][l][1] += dp[i][j][l][1];\n        for (int i1 = 0; i1 < 2; ++i1)\n        if (sufs[suf[l].go[i1]].size() <= sufs[l].size())\n            dp[i + 1][pr[j].go[i1]][l][1] += dp[i][j][l][0];\n        else {\n            dp[i + 1][pr[j].go[i1]][suf[l].go[i1]][0] += dp[i][j][l][0];\n        }\n    }\n    long long ans = 1;\n    for (i = 0; i < n; ++i)\n        ans *= 2;\n    for (i = 0; i <= s.size(); ++i)\n    for (j = 0; j <= k; ++j) {\n        string s1 = prs[i] + sufs[j];\n        int u = 0;\n        bool flag = true;\n        for (l = 0; l < s1.size(); ++l) {\n            u = suf[u].go[s1[l]];\n            if (u == s.size())\n                flag = false;\n        }\n        if (flag)\n            ans -= dp[n][i][j][0] + dp[n][i][j][1];\n    }\n    cout << ans;\n}\n", "lang": "GNU C++17", "bug_code_uid": "b272efc49e5fe8e487b835410c053bc8", "src_uid": "0034806908c9794086736a2d07fc654c", "apr_id": "6f93ba2ec792482a3d847a0800a20e52", "difficulty": 2900, "tags": ["dp", "strings"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9987738658258889, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#pragma GCC diagnostic ignored \"-Wunused-result\"\n#include <bits/stdc++.h>\nusing namespace std;\ntypedef long long ll;\ntypedef long double ld;\nconst int N = (int)41;\n//const ll INF = (ll)1e18 + 41;\nconst int INF = (int)1e9 + 41;\nconst ll MD = (ll)1e9 + 7;\nbool D = false, E = false;\n\nll dp[N][N * N + 1][N][2];\n\npair<int, int> decode(int x) {\n\treturn {x / N, x % N};\n}\n\nint code(int L, int R) {\n\treturn L * N + R;\n}\n\nint nxt[N][N][2];\nint nxtSuf[N][2];\nbool isOk[N * N][N];\n\nvoid solve() {\n\tint n;\n\tstring s;\n\tcin >> n >> s;\n\tint m = s.length();\n\n\tfor (int l = 0; l < m; l++) {\n\t\tfor (int r = l; r <= m; r++) {\n\t\t\tfor (int z = 0; z < 2; z++) {\n\t\t\t\tstring kek = (r == l ? \"\" : s.substr(l, r - l)) + char('0' + z);\n\t\t\t\tint cod = 0;\n\t\t\t\tfor (int l2 = 0; l2 < m; l2++) {\n\t\t\t\t\tint r2 = l2 + kek.length();\n\t\t\t\t\tif (r2 <= n && s.substr(l2, r2 - l2) == kek && cod == 0) {\n\t\t\t\t\t\tcod = code(l2, r2);\n\t\t\t\t\t}\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\tnxt[l][r][z] = cod;\n\t\t\t}\n\t\t}\n\t}\t\n\n\tfor (int len = 0; len <= m; len++) {\n\t\tfor (int z = 0; z < 2; z++) {\n\t\t\tstring kek = s.substr(0, len) + char('0' + z);\n\t\t\tint ans = 0;\n\t\t\tint klen = kek.length();\n\t\t\tfor (int len2 = 1; len2 <= klen; len2++) {\n\t\t\t\tif (kek.substr(klen - len2, len2) == s.substr(0, len2)) ans = len2;\n\t\t\t}\n\t\t\tnxtSuf[len][z] = ans;\n\t\t\t//printf(\"nxtSuf[%d][%d] = %d\\n\", len, z, nxtSuf[len][z]);\n\t\t}\n\t}\n\n\tdp[0][0][0][0] = 1;\n\tll ans = 0;\n\n\tfor (int code = 0; code < N * N; code++) {\n\t\tfor (int suf = 0; suf <= m; suf++) {\n\t\t\tisOk[code][suf] = false;\n\t\t\tint l = code / N;\n\t\t\tint r = code % N;\n\t\t\tif (r <= l || r > m) continue;\n\n\t\t\tstring kek = s.substr(0, suf) + s.substr(l, r - l);\n\n\t\t\tisOk[code][suf] = (kek.find(s) != string::npos);\n\t\t\t//cerr << l << \" \" << r << \" \" << suf << \" \" << kek << \" \" << (int)isOk[code][suf] << \"\\n\";\n\t\t}\n\t}\n\tisOk[0][m] = true;\n\n\tfor (int len = 0; len <= n; len++) {\n\t\tfor (int code = 0; code < N * N; code++) {\n\t\t\tint l = code / N;\n\t\t\tint r = code % N;\n\t\t\tif (r <= l && l + r > 0) continue;\n\n\t\t\tfor (int suf = 0; suf <= min(len, m); suf++) {\n\t\t\t\tfor (int isIn = 0; isIn < 2; isIn++) {\n\t\t\t\t\tint curDp = dp[len][code][suf][isIn]; \n\t\t\t\t\tif (curDp == 0) continue;\n\n\t\t\t\t\t//if (D) printf(\"len = %d, l = %d, r = %d, suf = %d, in = %d, val = %d\\n\", len, l, r, suf, (int)isIn, curDp);\n\n\t\t\t\t\tif ((isIn || isOk[code][suf]) && len == n) {\n\t\t\t\t\t\tans += curDp;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (int z = 0; z < 2; z++) {\n\t\t\t\t\t\tint newSuf = nxtSuf[suf][z];\n\t\t\t\t\t\tint newIn = min(1, isIn + (int)(newSuf == m));\n\t\t\t\t\t\t\n\t\t\t\t\t\tint newCode = 0;\n\t\t\t\t\t\tif (r - l == len && len < m && nxt[l][r][z] > 0) newCode = nxt[l][r][z];\n\t\t\t\t\t\telse newCode = code;\n\n\t\t\t\t\t\tdp[len + 1][newCode][newSuf][newIn] += curDp;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tcout << ans << \"\\n\";\n}\n\nint main() {\n\tint tst = 1;\n\t//scanf(\"%d\", &tst);\n\t//cin >> tst;\n#ifdef MADE_BY_SERT\n\tD = true;\t\n\ttst = 1;\n\twhile (tst--) solve();\n#else\n\twhile (tst--) solve();\n#endif\n}\n", "lang": "GNU C++14", "bug_code_uid": "0fc70ff582e978590555b9199cd6acce", "src_uid": "0034806908c9794086736a2d07fc654c", "apr_id": "6aba4edb32db624ab019ebf45d4f8126", "difficulty": 2900, "tags": ["dp", "strings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9996186117467581, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include<cstdio>\n#include<cstring>\nint ret[9][130]={\n{1,0},\n{1,2,1},\n{5,32,30,80,109},\n{541,6824,59808,147224,415870,1757896,1897056,4898872,7593125},\n{166257661,776830421,290516100,746623577,293783147,33900006,735127505,565460332,428982705,472062098,161873957,117354594,515619293,578944191,312106242,569389279,391464593},\n{464207287,261086313,584837659,683961846,468868529,211593382,736955478,229471758,157617135,398169441,360252438,629394768,264125799,647490480,342079395,391579767,225200475,486011304,513156108,628771752,132906648,142138221,20119449,444199674,195188679,387329805,44684703,651912135,737154512,612549793,519860281,186175544,212568440},\n{382725349,240805271,239509872,581127897,6511239,156126222,509425833,672407328,366667722,459185405,509737025,554790222,165216555,703150560,74806569,398730015,383350905,506108358,51326142,298053147,104256117,391428765,374020479,206607807,87664059,275899176,56407680,551553401,448939463,582889860,129676638,226078251,135769095,61292868,578972226,190181628,390739055,184587732,446575689,732674124,232198470,676760679,352474101,611444862,575661807,628905585,320813094,522840969,469781928,156006018,554473341,239654268,643714911,433540170,199307003,496385218,291740751,67309914,370826673,202356819,279421821,421203111,63744786,520987612,550671827},\n{642497124,482164403,768209115,462063756,154906374,36099042,341766705,678182556,621882744,478771358,231881111,175889805,243630450,168908523,671961765,55761813,652682670,773939082,517628076,756201264,124604900,750976272,498253248,676047609,137170026,705610017,495032139,561797418,703097347,500815609,95984586,739707108,265613565,387099846,777331779,594676173,591219559,407997044,208947235,93337440,478908360,685013007,487033953,671903001,39521181,738490312,33785059,465470131,310453920,54648783,346831137,427694175,474743430,705296781,435828036,429824745,663532359,261388683,244690731,533997135,596108961,506813013,371892402,590145264,104733162,143420103,654339672,700348950,685038942,578826927,286484229,501639192,434962491,299270097,27702486,335375775,111746817,565603164,294926121,676063665,735862995,710035809,437011960,668528077,138765186,508213986,615036450,353784942,624827616,343900011,241289776,52410890,72018835,352406796,415705878,4802637,376367145,65589678,333633477,341834527,303717460,282387700,42951006,254706039,423048528,526429710,68131467,669954708,12787348,500636381,317959019,479433192,657133515,416259390,610216692,340129188,44594256,257373347,138718678,530767740,292922628,37220268,605295159,480722613,458170419,30540300,487159055,232966794,149150650},\n{507720408,412133651,386543325,139952108,289303402,102404925,317067177,396414708,80515854,663739304,317300809,228877044,493725043,715317967,490300965,315527373,743539734,488329191,553627998,533025234,242583957,706116537,614109258,645447222,523195911,492109128,722623041,111085128,766395126,654378921,691964847,496688157,399056049,654363234,102052314,191720088,473910948,259736526,332840025,388047555,665791056,627111387,139696515,441456687,443032569,283264821,771641703,452641455,511306362,117572859,127701891,721298331,176520078,357242229,611296308,696994956,405628839,429224274,465336054,695091546,689828796,574648641,351220905,507964023,675326610,517248963,453528621,220301928,494463186,681789969,339589656,44524053,417125457,339589404,747135963,341780733,734158215,396817281,21997836,5728464,147611205,456248898,714128667,377654949,3862068,128418948,589390074,304947090,11703825,228266073,127304142,429215724,361541124,521572968,468358191,341231688,65323503,613778508,15985323,291661029,410970006,591638112,349541550,89967528,224922159,361094166,584206074,640051812,324264456,652625388,693768537,11740617,309238398,211085469,194905872,639416484,110110707,296645895,748118511,131177718,511142751,775975599,421403409,475528473,434685258,1768977,80301375,708023862,569195676,56238084,632887668,88089750,631539342,396695565,38780154,695798271,469819224,439587099,69045921,682966116,112310856,64943298,534475872,40215357,389728458,286368453,736006257,501181650,54829908,603489402,338032656,512182818,627500097,462674016,3103092,157324491,43978329,596818971,259025598,9088632,91991781,577291428,211245489,429471231,142626330,172560633,510907446,444609585,758102058,375112647,744786693,276174402,19259856,233672418,745389414,225772848,23385663,324290610,519804558,120337812,402578568,360676008,450089262,551043738,337388940,512108856,28879011,690040638,106017282,558262341,99972432,608226003,612152037,42414435,776201013,39580443,518796945,494437752,583194366,723936555,415359657,309569589,751104774,166684527,249229170,353120823,130668327,753823584,580966092,561963717,543672234,393846327,586278000,327398400,278403867,156455586,363920382,190245195,290039148,547014447,466218648,146037150,585462906,666008595,691786683,374707494,622498779,231158277,685740951,115612245,681825249,545555745,551718468,277206615,640171035,757727334,195193908,658656684,457760646,225925875,505761984,18685233,506832921,112511021,396846646,290147622,113924623,669986155,336008070,63611061,238586775,119956662,616557739,772784623,334527774,410403148,51933421},\n\n};\nint main()\n{\n    int n,k,i,j;\n    scanf(\"%d%d\",&n,&k);\n    for(i=0,j=1;j!=n;i++,j*=2);\n    printf(\"%d\\n\",ret[i][k]);\n    return 0;\n}", "lang": "MS C++", "bug_code_uid": "8310d482809dba989113ff25fcea1861", "src_uid": "cfe19131644e5925e32084a581e23286", "apr_id": "bfdd8c80a930d166197fcea8e8ea60e5", "difficulty": 2700, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.20771761890517498, "equal_cnt": 22, "replace_cnt": 12, "delete_cnt": 9, "insert_cnt": 0, "fix_ops_cnt": 21, "bug_source_code": "#include <algorithm>\n#include <bitset>\n#include <cmath>\n#include <cstdio>\n#include <deque>\n#include <functional>\n#include <iomanip>\n#include <iostream>\n#include <map>\n#include <set>\n#include <stack>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string>\n#include <string.h>\n#include <time.h>\n#include <vector>\n\n#if LOCAL\n\t#define DO_NOT_SEND\n#endif\n\ntypedef long long LL;\n\nint IntMaxVal = (int) 1e20;\nint IntMinVal = (int) -1e20;\nLL LongMaxVal = (LL) 1e20;\nLL LongMinVal = (LL) -1e20;\n\n#define FOR(i, a, b) for(int i = a; i < b ; ++i)\n#define FORD(i, a, b) for(int i = a; i >= b; --i)\n\n#define minimize(a, b) { a = min(a, b); }\n#define maximize(a, b) { a = max(a, b); }\n\n#define all(v) v.begin(),v.end()\n\nusing namespace std;\n\n#define next(type, i) type i; cin >> i;\ntemplate<typename T> struct argument_type;\ntemplate<typename T, typename U> struct argument_type<T(U)> { typedef U type; };\n#define nextVector(t, v, size) vector< argument_type<void(t)>::type > v(size); { for (int i = 0 ; i < size ; i++) cin >> v[i]; }\n\n#define range(name, start, count) vector<int> name(count); { for (int i = 0 ; i < count ; i++) name[i] = i + start; }\n\ntemplate <typename T1, typename T2> istream& operator >>(istream& is, pair<T1, T2>& s) { is >> s.first >> s.second; return is; }\ntemplate <typename T> ostream& operator << (ostream& os, const vector<T> &v) { for (int i = 0 ; i < v.size() ; i++) os << v[i] << ' '; os << endl; return os; }\ntemplate <typename T1, typename T2> ostream& operator <<(ostream& s, pair<T1, T2>& t) { s << t.first << ' ' << t.second; return s; }\n\nconst int mod = 777777777;\n\nLL add(LL a, LL b) {\n\treturn (a + b) % mod;\n}\n\nLL mult(LL a, LL b) {\n\treturn a * b % mod;\n}\n\nLL waysToMerge[257][257];\nLL ans[257][257];\n\nint main() {\n\tsrand (time(NULL));\n    ios_base::sync_with_stdio(false); cin.tie(NULL);\n\t\n\tFOR (i, 0, 257) waysToMerge[i][0] = 1;\n\tFOR (i, 0, 257) FOR (j, 1, 257) {\n\t\twaysToMerge[i][j] = 0;\n\t\tFOR (k, 0, i + 1) waysToMerge[i][j] = add(waysToMerge[i][j], waysToMerge[i - k][j - 1]);\n\t}\n\t\n\tnext(int, n);\n\tnext(int, k);\n\t\n\tFOR (i, 0, 257) ans[0][i] = 0;\n\tans[0][0] = 1;\n\t\n\tbool debug = 0;\n\tFOR (upTo, 1, n + 1) FOR (ppl, 0, n + 1) {\n\t\tans[upTo][ppl] = 0;\n\t\tFOR (x, 0, ppl + 1) {\n\t\t\tif (debug) cout << upTo << ' ' << ppl << ' ' << x << endl; DO_NOT_SEND\n\t\t\tif (x == upTo && x > n - k) { if (debug) cout << \"skip1\" << endl; continue; }\n\t\t\tif (upTo == n - k && x != upTo) { if (debug) cout << \"skip2\" << endl; continue; }\n\t\t\t\n\t\t\tans[upTo][ppl] = add(ans[upTo][ppl], mult(waysToMerge[x][ppl - x], ans[upTo - 1][ppl - x]));\n\t\t}\n\t\tif (debug) cout << \"== \" << upTo << ' ' << ppl << ' ' << ans[upTo][ppl] << endl;\n\t}\n\t\n\tcout << ans[n][n];\n}", "lang": "GNU C++0x", "bug_code_uid": "e1b0e40c116cfc6f946195ac5ad63faa", "src_uid": "cfe19131644e5925e32084a581e23286", "apr_id": "31dc05b3eb9a815acb0aeec1f873927d", "difficulty": 2700, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.34917555771096026, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "#include <bits/stdc++.h>\n\nusing namespace std;\n\nlong long a[100];\n\nint main()\n{\n    int n, i, j;\n    long long suma = 0;\n    long long control = 0;\n    cin >> n;\n    for (i = 1; i <= n; i++)\n        cin >> a[i];\n    sort (a + 1, a + n + 1);\n    for (i = n; i >= 2; i--)\n        if (a[i] == a[i-1]){\n            a[i-1] = a[i-1] - 1;\n            control = a[i];\n            for (j = i - 1; j <= 1; j--)\n                if (a[j] == control)\n                    a[j] = a[j] - 1;\n\n        }\n    for (i = 1; i <= n; i++)\n        suma = suma + a[i];\n    cout << suma;\n    return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "0646a795c207f23b798204589e788f14", "src_uid": "3c4b2d1c9440515bc3002eddd2b89f6f", "apr_id": "e92c62d629f24f2ee2baeab903418a21", "difficulty": 1100, "tags": ["greedy", "sortings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9765965886552955, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\ntypedef long long ll;\n\nconst int mod = 998244353;\n\nint p,r,s;\n\nconst int maxN = 1e5 + 10;\n\nll fac[maxN],ifac[maxN];\n\ninline ll qpow(ll a,ll x){ll ans=1;for(;x;x>>=1,a=a*a%mod) if(x&1) ans=ans*a%mod;return ans;}\ninline ll C(int n,int r){if(r<0 || r>n) return 0;return fac[n]*ifac[r]%mod*ifac[n-r]%mod;}\n\nvoid pre()\n{\n\tint i;\n\n\tfac[0]=1;\n\tfor(i=1;i<maxN;i++) fac[i]=fac[i-1]*i%mod;\n\tifac[maxN-1]=qpow(fac[maxN-1],mod-2);\n\tfor(i=maxN-2;~i;i--) ifac[i]=ifac[i+1]*(i+1)%mod;\n}\n\nll calc(int p,int l,int s)//<l\n{\n\tif(p<0 || s<0) return 0;\n\tif(!p && s>0) return 0;\n\tif(!p && !s) return 1;\n\tint i;ll ans=0;\n\n\t//cout<<p<<' '<<l<<' '<<s<<endl;\n\n\tfor(i=0;i<=p;i++) ans+=(i&1?-1:1)*C(p,i)*C(p+s-l*i-1,s-l*i)%mod;\n\t//cout<<Mod(ans%mod)<<endl;\n\treturn Mod(ans%mod);\n}\n\nvoid solve()\n{\n\tint i,j;ll ans=0,down=C(p+s-1,s);\n\n\tfor(i=r;i<=s;i++)\n\t{\n\t\tfor(j=0;j<=p-1;j++) \n\t\t{\n\t\t\tans+=C(p-1,j)*calc(p-1-j,i,s-i*(j+1))%mod*qpow(j+1,mod-2)%mod;\n\t\t}\n\t}\n\n\tfor(i=r-1;~i;i--)\n\t{\n\t\tdown-=C(p-1+s-i-1,s-i);\n\t}\n\n\tprintf(\"%lld\\n\",Mod(ans%mod*qpow(down,mod-2)%mod));\n}\n\nint main()\n{\n\t#ifndef ONLINE_JUDGE\n\tfreopen(\"e.in\",\"r\",stdin);\n\tfreopen(\"e.out\",\"w\",stdout);\n\t#endif\n\n\tscanf(\"%d%d%d\",&p,&s,&r);\n\tpre();\n\tsolve();\n\t\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "13e03e0f807b18f39c41b18566d7fc5a", "src_uid": "609195ef4a970c62a8210dafe118580e", "apr_id": "13841b4a8c8e76ea0ca2ee0ae5724014", "difficulty": 2500, "tags": ["dp", "math", "combinatorics", "probabilities"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.864406779661017, "equal_cnt": 17, "replace_cnt": 1, "delete_cnt": 3, "insert_cnt": 12, "fix_ops_cnt": 16, "bug_source_code": "#include<cstdio>\nusing namespace std;\nint main()\n{\n    int n,i,ans=0;\n    scanf(\"%d\",&n);\n    for(i=2;i<=n-1;i++) ans+=i*(i+1);\n    printf(\"%d\",ans);\n        return 0\n}", "lang": "GNU C++11", "bug_code_uid": "b82b530c98ea8f171e3d1f7d541b543b", "src_uid": "1bd29d7a8793c22e81a1f6fd3991307a", "apr_id": "bddef7c419510fa1065c20eccbc2ba7c", "difficulty": 1200, "tags": ["dp", "math", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9976782752902156, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n#define ll long long\n#define ld long double\n#define pb push_back\n#define all(x) begin(x), end(x)\n#define SZ(x) (int)(x).size()\nmt19937 rng(chrono::steady_clock::now().time_since_epoch().count());\n\nconst int n0 = 4003, mod = 1e9 + 7;\nint w, h, cur[4], cnt[2][4];\n\nint main() {\n\tios_base::sync_with_stdio(false), cin.tie(NULL);\n\tcin >> w >> h;\n\tcnt[0][0] = cnt[0][1] = w / 2 + 1;\n\tcnt[1][0] = cnt[1][1] = (w + 1) - (w / 2 + 1);\n\t\n\tcnt[0][2] = cnt[0][3] = h / 2 + 1;\n\tcnt[1][2] = cnt[1][3] = (h + 1) - (h / 2 + 1);\n\tint all = 0;\n\tfor (int x = 0; x < 2; x++) {\n\t\tfor (int y = 0; y < 2; y++) {\n\t\t\tint ways = 0;\n\t\t\tfor (int k = 0; k < 16; k++) {\n\t\t\t\tint res = 1;\n\t\t\t\tfor (int l = 0; l < 4; l++) {\n\t\t\t\t\tcur[l] = (k >> l & 1);\n\t\t\t\t\tres = (ll)res * cnt[cur[l]][l] % mod;\n\t\t\t\t}\n\t\t\t\tint val = ((cur[0] ^ x) & (cur[3] ^ y)) ^ ((cur[1] ^ x) & (cur[2] ^ y));\n\t\t\t\tif (val & 1) continue;\n\t\t\t\tways += res;\n\t\t\t\tways -= (all >= mod) ? mod : 0;\n\t\t\t}\n\t\t\tall += ((ll)cnt[x][0] * cnt[y][2] % mod) * ways % mod;\n\t\t\tall -= (all >= mod) ? mod : 0;\n\t\t}\n\t}\n\tfor (int i = 0; i <= w; i++) {\n\t\tfor (int j = 0; j <= h; j++) {\n\t\t\tint cnt = (w - i + 1) * (h - j + 1), num = 0;\n\t\t\tif (i == 0) num = j + 1;\n\t\t\telse if (j == 0) num = i + 1;\n\t\t\telse {\n\t\t\t\tint g = __gcd(i, j);\n\t\t\t\tnum = g + 1;\n\t\t\t}\n\t\t\tint num2 = num;\n\t\t\tif (i > 0 || j > 0)\n\t\t\t\tnum2 = 6 * (num - 2) + 2 * 3;\n\t\t\tif (i > 0 && j > 0)\n\t\t\t\tcnt *= 2;\n\t\t\tall -= (ll)cnt * num2 % mod;\n\t\t\tall += (all >= 0) ? 0 : mod;\n\t\t}\n\t}\n\tcout << all;\n}\n", "lang": "GNU C++17", "bug_code_uid": "cb49d5d4fb269dfe1bd2be86b3a10bac", "src_uid": "984788e4b4925c15c9c6f31e42f2f8fa", "apr_id": "65a62259469184dfa6c7b9fb5d987daa", "difficulty": 2500, "tags": ["geometry", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9985775248933144, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "// .... .... .... !\n\n#include <iostream>\n#include <iomanip>\n#include <fstream>\n\n#include <algorithm>\n#include <string>\n#include <vector>\n#include <set>\n#include <map>\n#include <queue>\n#include <stack>\n\n#include <cstdio>\n#include <cstring>\n\nusing namespace std;\n\n#define rep(i, n) for (int i = 0, _n = (int)(n); i < _n; i++)\n#define fer(i, x, n) for (int i = (int)(x), _n = (int)(n); i < _n; i++)\n#define rof(i, n, x) for (int i = (int)(n), _x = (int)(x); i-- > _x; )\n#define fch(i, x) for (__typeof(x.begin()) i = x.begin(); i != x.end(); i++)\n#define sz(x) (int((x).size()))\n#define X first\n#define Y second\n\ntypedef long long ll;\ntypedef pair <int, int> pii;\n\n////////////////////////////////////////////////////////////////////////////////\n\nconst int mod = 1000000007;\nconst int maxw = 4000 + 100;\n\n\nint w, h;\nint cache[maxw];\n\nint cnt (int a, int b) // gcd (a, b) = 1\n{\n\tif (cache[a+b] != -1) return cache[a+b];\n\tint ret = 0;\n\n\trep (m, maxw)\n\t{\n\t\tint len = (a+b) * m;\n\t\tif (h+1-len <= 0) break;\n\t\tret += (m ? 2 : 1) * (h+1-len);\n\t}\n\n\treturn cache[a+b] = ret;\n}\n\npii hmw (int k)\n{\n\tint tot = k*(ll)k*k % mod;\n\tint x = k/2, y = k-x;\n\tint sam = (x*(ll)x*x + y*(ll)y*y) % mod;\n\treturn pii (sam, (tot - sam + mod) % mod);\n}\n\nint pm (int x, int p)\n{\n\tint ret = 1;\n\tfor (int i = 0; (1<<i) <= p; i++)\n\t{\n\t\tif (p >> i & 1) ret = (ret * (ll)x) % mod;\n\t\tx = x*(ll)x % mod;\n\t}\n\treturn ret;\n}\n\nint main()\n{\n\tios::sync_with_stdio (false);\n\n\tmemset (cache, -1, sizeof cache);\n\n\tcin >> w >> h;\n\n\tint bad = 0;\n\n\tfer (a, 1, w) fer (b, 1, w-a+1)\n\t{\n\t\tint gab =__gcd (a, b);\n\t\tint va = a/gab, vb = b/gab;\n\t\tint tmp = cnt (va, vb);\n\t\ttmp = tmp * (ll)(w+1-a-b) * 6LL % mod;\n\t\tbad += tmp; if (bad >= mod) bad -= mod;\n\t}\n\n\tbad = (bad + (h+1) * (ll)h % mod * (ll)(h-1) * (ll)(w+1)) % mod;\n\n\tint tot = (w+1) * (h+1);\n\n\tbad = (bad + tot * 3LL * (tot-1)) % mod;\n\tbad = (bad + 1LL * tot) % mod;\n\n\tpii wc = hmw (w+1);\n\tpii hc = hmw (h+1);\n\n\tint ans = (wc.X * (ll)(hc.X + hc.Y) + wc.Y * (ll)hc.X) % mod;\n\tans = (ans + wc.Y * 1LL * hc.Y * pm (3, mod-2)) % mod;\n\n\tcout << (ans-bad+mod)%mod << endl;\n\n\t{ int _; cin >> _; }\n\treturn 0;\n}\n", "lang": "GNU C++0x", "bug_code_uid": "1435d31ac682808b73d9bf03c8f3c1ad", "src_uid": "984788e4b4925c15c9c6f31e42f2f8fa", "apr_id": "48f52d8dad297042c05fcc53d1b6a61e", "difficulty": 2500, "tags": ["geometry", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.7844444444444445, "equal_cnt": 11, "replace_cnt": 6, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "#include <iostream>\n\n#define endl \"\\n\"\n#define ll long long\n\nusing namespace std;\n\nstring s;\n\nlong long n, i, a[10001], x, k;\n\nint main()\n{\n    ios_base :: sync_with_stdio(0);\n    cin.tie(0);\n\n    cin >> n >> k;\n\n    for (i = 0; i < n; i++)\n    {\n        cin >> s[i];\n        x = int(s[i]);\n        a[x]++;\n    }\n\n    for (i = 0; i < 101; i++)\n    {\n        if(a[i] > k)\n        {\n            cout << \"NO\" << endl;\n            return 0;\n        }\n    }\n\n    cout << \"YES\" << endl;\n\n    return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "3f651c0137c6f88fb2fc0b05b34c9819", "src_uid": "ceb3807aaffef60bcdbcc9a17a1391be", "apr_id": "e02699e901ef7175d6aa2a00dff841c4", "difficulty": 900, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9910344827586207, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "\n#include<iostream>\n#include<string>\n#include<cstring>\n#include<stdio.h>\n#include<algorithm>\n#include<vector>\n#include<map>\n#include<queue>\n#define FOR(i, a, b) for( int i = (a); i < (b); i++ )\n#define Fore(it, x) for(typeof (x.begin()) it = x.begin(); it != x.end (); it++)\n#define Set(a, s) memset(a, s, sizeof (a))\nusing namespace std;\nstring text;\nint n,h;\nint oo =1<<25;\nint mini=-oo;\nint tar;\n//true down\n//false up\n#define DOWN 1\n#define UP 0\n\nint dp[5][25][11][11][2];\n\nlong long solve(int num,int index , int h  , int d, bool dir , bool first)\n{\n    if(d<0 || h<0)return 0;\n    if(index==n &&h==0 && d==0)\n        return 1;\n    if(index==n)return 0;\n    if(dp[num][index][h][d][dir]!=-1)\n        return dp[num][index][h][d][dir];\n    long long sum=0;\n    for(int i = num+1 ; i<4 ; i++)\n            if(dir==DOWN)\n                sum+=solve(i,index+1,h,d-1,UP,0);\n            else\n                sum+=solve(i,index+1,h,d,UP,0);\n    if(!first)\n    for(int i = num-1 ; i>=0 ; i--)\n            if(dir==DOWN)\n                sum+=solve(i,index+1,h,d,DOWN,0);\n            else\n                sum+=solve(i,index+1,h-1,d,DOWN,0);\n    return sum;\n}\n\nint main()\n{\n   // freopen(\"input.in\",\"r\",stdin);\n\n\n    while(cin>>n>>h)\n    {   \n        Set(dp,-1);\n        tar=(1<<4)-1;\n        int sum=0;\n        for(int i = 0 ; i<4 ; i++)\n            dp[0][0][h][h-1][UP]=sum+=solve(i,1,h,h-1,UP,1);\n        cout<<sum<<endl;\n    }\n\n    return 0;\n}", "lang": "GNU C++", "bug_code_uid": "8e7884fa25588678a98092b756d1262f", "src_uid": "6d67559744583229455c5eafe68f7952", "apr_id": "278a78b92bd5cb4a015fe6525240208b", "difficulty": 1900, "tags": ["dp"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9977294842685696, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include <iostream>\n#include <sstream>\n#include <vector>\n#include <string>\n#include <algorithm>\n#include <utility>\n#include <set>\n#include <map>\n#include <deque>\n#include <queue>\n#include <cmath>\n#include <cstdlib>\n#include <ctime>\n#include <cstdio>\n#include <stdio.h>\n\nusing namespace std;\n\n#define fo(i,n) for(int i=0; i<(int)n; i++)\n#define rep(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++)\n#define mp(a,b) make_pair(a,b)\n#define pb(x) push_back(x)\n#define pii pair<int,int>\n\nint dp[21][11][11][6][6];\nint n,t;\nint solve(int i, int l1, int l2, int v, int pre) {\n    if (l1<0 || l2<0) return 0;\n    if (i==n && l1==0 && l2==0 && v<pre) return 1;\n    if (i==n) return 0;\n    if (dp[i][l1][l2][v][pre]>0) return dp[i][l1][l2][v][pre];\n\n    int tmp = 0;\n    for (int j=v+1; j<=4; j++) {\n        if (v>pre || i==1) tmp += solve(i+1,l1,l2,j,v);\n        else tmp += solve(i+1,l1,l2-1,j,v);\n    }\n    for (int j=1; j<v; j++) {\n        if (v<pre || i==1) tmp += solve(i+1,l1,l2,j,v);\n        else tmp += solve(i+1,l1-1,l2,j,v);\n    }\n\n    //cout<<i<<\" \"<<l1<<\" \"<<l2<<\" \"<<v<<\" \"<<pre<<\" \"<<tmp<<endl;\n    dp[i][l1][l2][v][pre] = tmp;\n    return tmp;\n\n}\n\nint main() {\n\n    //freopen(\"input.txt\",\"r\",stdin);\n    //freopen(\"output.txt\",\"w\",stdout);\n\n    cin>>n>>t;\n    int res = 0;\n    for (int i=0; i<=n; i++) for (int j=0; j<=t; j++) for (int p=0; p<=t; p++) for (int k=0; k<5; k++) for (int r=0; r<=6; r++) dp[i][j][p][k][r] = -1;\n    for (int i=1; i<4; i++) res += solve(1,t,t-1,i,0);\n    cout<<res<<endl;\n\n    return 0;\n\n}", "lang": "GNU C++", "bug_code_uid": "37cc4ba5adf87bfa618f221acbff0462", "src_uid": "6d67559744583229455c5eafe68f7952", "apr_id": "bc7a73366be5ff05003d081c049b458e", "difficulty": 1900, "tags": ["dp"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.7881130707900459, "equal_cnt": 12, "replace_cnt": 4, "delete_cnt": 4, "insert_cnt": 4, "fix_ops_cnt": 12, "bug_source_code": "#include <cstdlib>\n#include <cctype>\n#include <cstring>\n#include <cstdio>\n#include <cmath>\n#include <algorithm>\n#include <vector>\n#include <string>\n#include <iostream>\n#include <sstream>\n#include <map>\n#include <set>\n#include <queue>\n#include <stack>\n#include <fstream>\n#include <numeric>\n#include <iomanip>\n#include <bitset>\n#include <list>\n#include <stdexcept>\n#include <functional>\n#include <utility>\n#include <ctime>\n#include <complex>\nusing namespace std;\n\n// begin insert defines\n#define ALL(a) (a).begin(),(a).end()\n#define CR clear\ntypedef vector<int> VRI;\ntemplate <class T> void PV(T x) {for(__typeof__((x).begin()) i = (x).begin(); i != (x).end(); i++) cout << *i << \" \"; cout << endl;}\n#define Rep(i,n) for(int n_ = (n), i = 0; i< n_; ++i)\n#define PB push_back\n#define VR vector\ntypedef long long ll;\n// end insert defines\n\n//const ll INF = 1000000000LL * 100LL;\n\nVR<ll> fac;\nll n;\nVRI id;\nVR<bool> vis;\n\nvoid dfs(int dep, ll k)\n{\n  if (dep >= n) return ;\n  for (int i = 0; i < n; i++) {\n    if (vis[i]) continue;\n    if (fac[n - dep - 1] < k) {\n      k -= fac[n - dep - 1];\n    }\n    else {\n      id[dep] = i;\n      vis[i] = true;\n      dfs(dep + 1, k);\n      break;\n    }\n  }\n}\n\nbool check(int num)\n{\n  while (num) {\n    if (num % 10 != 4 && num % 10 != 7) return false;\n    num /= 10;\n  }\n  return true;\n}\n\nint main(int argc, char *argv[])\n{\n  ll N, m;\n  fac.PB(1LL);\n  Rep(i, 15) fac.PB(fac.back() * (i + 1));\n  cin >> N >> m;\n  n = min(N, (ll)fac.size() - 1);\n  id.resize(n);\n  vis.assign(n, false);\n  if (m > fac[n]) {\n    cout << -1 << endl;\n    return 0;\n  }\n  dfs(0, m);\n  VRI oid = id;\n  //  PV(oid);\n  id.CR();\n  if (n == N) id = oid;\n  else {\n    Rep(i, N - n) id.PB(i);\n    Rep(i, n) id.PB(oid[i] + N - n);\n  }\n  //  PV(id);\n\n  // VRI tv;\n  // Rep(i, N) tv.PB(i);\n  // int tn = m - 1;\n  // while (tn--) {\n  //   next_permutation(ALL(tv));\n  // } \n  // PV(tv);\n\n  int ret = 0;\n  Rep(i, id.size()) {\n    if (check(i + 1) && check(id[i] + 1)) ret++;\n  }\n  cout << ret << endl;\n  return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "29a1143e3b0af0a9a13cbda954f48984", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "apr_id": "5d8f02d795b677fcd462b4019dc3af50", "difficulty": 1900, "tags": ["brute force", "combinatorics", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9675625579240037, "equal_cnt": 10, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 6, "fix_ops_cnt": 9, "bug_source_code": "#include <stdio.h>\n#include <string.h>\n#include <algorithm>\n\nusing namespace std;\n\ntypedef long long ll;\ntypedef pair<int,int> pii;\n\nconst int MODULE = (int)1e9+7;\n\nint cnt[3];\n\nint ql[2222222];\nint qr[2222222];\nint qans[2222222];\n// will fill array \"cnt\"\nint Nanase(int p)\n{\n\tint low = 0;\n\tint high = 0;\n\tint end = 0;\n\t\n\tql[end] = 0; qr[end] = 2; qans[end++] = 0;\n\tcnt[0] = (cnt[0] + 2LL*p-3)%MODULE;\n\t\n\t// delta\n\tfor(int i = 3;i < p;)\n\t{\n\t\twhile(low < end && qr[low] < i/3) low++;\n\t\twhile(high < end && qr[high] < i-i/3) high++;\n\t\tint sved = 0;\n\t\tint q = qr[high];\n\t\tfor(int j = 0;j < 3;j++)\n\t\t{\n\t\t\tif((3*q-j) % 2) continue;\n\t\t\tif((3*q-j) / 2 % 3 != j) continue;\n\t\t\tsved = max(sved,(3*q-j)/2);\n\t\t}\n\t\t//printf(\"sved = %d\\n\",sved);\n\t\tint till = min(qr[low]*3+2,sved);\n\t\ttill = min(till,p-1);\n\t\t\n\t\tint mexa[3] = {0};\n\t\tmexa[qans[low]]++; mexa[qans[high]]++;\n\t\tfor(int j = 0;j < 3;j++)\n\t\t{\n\t\t\tif(!mexa[j])\n\t\t\t{\n\t\t\t\tif(end && j == qans[end-1]) qr[end-1] = till;\n\t\t\t\telse { ql[end] = i; qr[end] = till; qans[end++] = j; }\n\t\t\t\t\n\t\t\t\tint len = till-i+1;\n\t\t\t\tcnt[j] += ( (ll)p*len%MODULE-(ll)(i+till)*len/2%MODULE+MODULE ) % MODULE;\n\t\t\t\tcnt[j] %= MODULE;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\ti = till+1;\n\t}\n\treturn end;\n}\n\nint F[1111][4];\n\nint main(void)\n{\n\tint n = 0;\n\tint p = 0;\n\tscanf(\"%d %d\",&n,&p);\n\t\n\tNanase(p);\n\t\n\tF[0][0] = 1;\n\tfor(int i = 0;i < n;i++)\n\t{\n\t\tfor(int j = 0;j < 4;j++)\n\t\t{\n\t\t\tfor(int k = 0;k < 3;k++)\n\t\t\t{\n\t\t\t\tF[i+1][j^k] = (F[i+1][j^k]+(ll)F[i][j]*cnt[k])%MODULE;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tint ans = 0;\n\tfor(int i = 1;i < 4;i++) ans = (ans+F[n][i])%MODULE;\n\tprintf(\"%d\\n\",ans);\n\twhile(getchar() != EOF);\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "2b5d6065df544033a03ffd5c9737cc67", "src_uid": "c03b6379e9d186874ac3d97c6968fbd0", "apr_id": "7ade6320c53b919978f9eb86d854f8bb", "difficulty": 2600, "tags": ["dp", "games"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.994017094017094, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "#include<cstdio>\n#include<cstring>\n#include<iostream>\n#include<algorithm>\n#define fo(i,a,b) for(int i=a;i<=b;i++)\n#define fd(i,a,b) for(int i=a;i>=b;i--)\n#define maxn 1005\n#define maxk 155\n#define mo 1000000007\n#define ll long long\n#define min(a,b) (((a) < (b)) ? a : b)\nusing namespace std;\n\nint sg[maxk];\n\nint wz[maxk];\n\nint n,p;\n\nint f[maxn][4];\n\nint tot;\n\nll num[4];\n\nint mex(int x,int y){\n\tif (x*y>0) return 0;\n\tif (x==1 || y==1) return 2;\n\treturn 1;\n}\n\nint main(){\n\tscanf(\"%d%d\",&n,&p);\n\twz[1]=1;\n\tsg[1]=0;\n\ttot=1;\n\tint las1=1,las2=1,noww=3;\n\twhile (noww<p){\n\t\ttot++;\n\t\twz[tot]=noww;\n\t\tsg[tot]=mex(sg[las1],sg[las2]);\n\t\tif (sg[tot]==sg[tot-1]) tot--;\n\t\tnoww=min(1ll*wz[las2+1] * 3,(1ll*(wz[las1+1]-1)*3/2+1));\n\t\tnoww=min(noww,p);\n\t\tif (sg[las1+1]==noww-noww/3) las1++;\n\t\tif (sg[las2+1]==noww / 3) las2++;\n\t}\n\tfo(i,1,tot) {\n\t\tint l=wz[i];\n\t\tint r=wz[i+1];\n\t\tif (i==tot) r=p;\n\t\tnum[sg[i]]=(num[sg[i]]+1ll*p*(r-l)-1ll*r*(r-1)/2+1ll*l*(l-1)/2) % mo;\n\t\tnum[sg[i]]=(num[sg[i]] % mo+mo) % mo;\n\t}\n\tf[0][0]=1;\n\tfo(i,1,n)\n\t\tfo(j,0,3)\n\t\t\tfo(k,0,2) f[i][j ^ k]=(f[i][j ^ k]+f[i-1][j]*1ll*num[k])\t% mo;\n\tll ans=f[n][1]+f[n][2]+f[n][3];\n\tprintf(\"%I64d\",ans % mo);\n\treturn 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "52b87ec072bf6a739a6a8bc0fc255b0d", "src_uid": "c03b6379e9d186874ac3d97c6968fbd0", "apr_id": "0a8e29e84af5718ff0e23c2612410cfd", "difficulty": 2600, "tags": ["dp", "games"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9877300613496932, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "/**\n *  winners never quit\n**/\n\n#include <bits/stdc++.h>\n\nusing namespace std;\n\n#define pb push_back\n#define mp make_pair\ntypedef long long Long;\n\nconst int N = 1e5;\n\nint main()\n{\n  ios::sync_with_stdio(0);\n  cin.tie(0);cout.tie(0);\n  int tc, ca = 0;\n  int n, el;\n  cin >> n;\n  vector <int> v;\n  for (int i = 0;i < n;i++){\n    cin >> el;\n    if (el%2)v.pb(i);\n  }\n  string ans = \"No\";\n  int len = v.size();\n  if (len%2 && v[len-1]%2 && v[0]%2)ans = \"Yes\";\n  cout << ans << '\\n';\n  return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "b9019cdea20c66a7ba085fed84d71271", "src_uid": "2b8c2deb5d7e49e8e3ededabfd4427db", "apr_id": "c2ecbc100150f0205f479f9509476075", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.5870732975220933, "equal_cnt": 33, "replace_cnt": 23, "delete_cnt": 4, "insert_cnt": 5, "fix_ops_cnt": 32, "bug_source_code": "#include <bits/stdc++.h>\n\nusing namespace std;\n\ntypedef pair <int,int> pii;\n\nconst int N = 200200;\nconst int M = 300300;\n\nstruct Edge\n{\n    int x, y;\n    Edge(int x = 0, int y = 0) : x(x), y(y) {}\n};\n\nstruct Query\n{\n    int T, x;\n    Query(int T = 0, int x = 0) : T(T), x(x) {}\n};\n\nint a[N];\nint n, m, q;\nvector <Edge> edges;\nvector <Query> queries;\n\nint P[N];\nbool InTree[M];\nset <pii> Nodes[N];\nstack <pii> PChanges;\nstack <stack <pii>> NodesInChanges;\nstack <stack <pii>> NodesOutChanges;\n\nvoid Init()\n{\n    for(int x = 1; x <= n; x++) P[x] = x, Nodes[x].emplace(a[x], x);\n}\n\nint F(int x)\n{\n    while(x != P[x])\n        x = P[x];\n    return x;\n}\n\nvoid Un(int e, bool storeChanges)\n{\n    int x = edges[e].x;\n    int y = edges[e].y;\n\n    if((x = F(x)) == (y = F(y)))\n        return ;\n\n    InTree[e] = true;\n\n    if(Nodes[x].size() < Nodes[y].size())\n        swap(x, y);\n\n    if(storeChanges)\n    {\n        NodesInChanges.push(stack <pii> ());\n        NodesOutChanges.push(stack <pii> ());\n    }\n\n    for(pii p : Nodes[y])\n    {\n        if(storeChanges)\n        {\n            NodesInChanges.top().emplace(x, p.second);\n            NodesOutChanges.top().emplace(y, p.second);\n        }\n    }\n\n    for(pii p : Nodes[y])\n        Nodes[x].insert(p);\n    Nodes[y].clear();\n\n    if(storeChanges)\n        PChanges.emplace(y, P[y]);\n\n    P[y] = x;\n}\n\nvoid DeUn(int e)\n{\n    if(!InTree[e])\n        return ;\n\n    P[PChanges.top().first] = PChanges.top().second;\n\n    while(!NodesInChanges.top().empty())\n    {\n        pii p = NodesInChanges.top().top();\n        NodesInChanges.top().pop();\n        Nodes[p.first].erase(pii(a[p.second], p.second));\n    }\n\n    while(!NodesOutChanges.top().empty())\n    {\n        pii p = NodesOutChanges.top().top();\n        NodesOutChanges.top().pop();\n        Nodes[p.first].insert(pii(a[p.second], p.second));\n    }\n\n    PChanges.pop();\n    NodesInChanges.pop();\n    NodesOutChanges.pop();\n}\n\nint main()\n{\n    cin >> n >> m >> q;\n\n    for(int x = 1; x <= n; x++) scanf(\"%d\", a + x);\n\n    for(int i = 0; i < m; i++)\n    {\n        int x, y;\n        scanf(\"%d%d\", &x, &y);\n        edges.emplace_back(x, y);\n    }\n\n    for(int i = 0; i < q; i++)\n    {\n        int T, x;\n        scanf(\"%d%d\", &T, &x);\n        if(T == 2)  x--;\n        queries.emplace_back(T, x);\n    }\n\n    vector <bool> LazyUn(m);\n    for(const Query& Q : queries)\n        if(Q.T == 2)\n            LazyUn[Q.x] = true;\n\n    Init();\n    for(int i = 0; i < m; i++)\n        if(!LazyUn[i])\n            Un(i, false);\n\n    reverse(queries.begin(), queries.end());\n    for(const Query& Q : queries)\n        if(Q.T == 2)\n            Un(Q.x, true);\n\n    reverse(queries.begin(), queries.end());\n    for(const Query& Q : queries)\n    {\n        if(Q.T == 1)\n        {\n            int x = F(Q.x);\n            int y = (*Nodes[x].rbegin()).second;\n            printf(\"%d\\n\", a[y]);\n\n            Nodes[x].erase(pii(a[y], y));\n            a[y] = 0;\n            Nodes[x].insert(pii(a[y], y));\n        }\n\n        else\n        {\n            DeUn(Q.x);\n        }\n    }\n}\n", "lang": "GNU C++11", "bug_code_uid": "fa2dbdb6beeb7b4476243b83f8c53560", "src_uid": "ad014bde729222db14f38caa521e4167", "apr_id": "7510c427856213f6ffaa2df4aa84ced6", "difficulty": 2600, "tags": ["dsu", "data structures", "implementation", "graphs", "trees"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9580393613070924, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "#include<bits/stdc++.h>\n#define lson l,m,rt<<1\n#define rson m+1,r,rt<<1|1\n\nusing namespace std;\n\ntypedef long long ll;\nconst int maxn=100100;\nconst ll MOD=1e9+7;\n\nint len;\nint num[20];\nll dp[20][20];\nll res[20];\n\nvoid getNum(ll x){\n    len=0;\n    while(x){\n        num[++len]=x%10;\n        x/=10;\n    }\n}\n\nll F(int idx,int cnt,bool e){\n//    cout<<idx<<\" \"<<cnt<<endl;\n    if(!idx) return cnt==0;\n    if(!e&&dp[idx][cnt]) return dp[idx][cnt];\n\n    int limit=e?num[idx]:9;\n    ll ret=0;\n    for(int i=0;i<=limit;++i){\n        if(i==4||i==7)\n            ret=(ret+F(idx-1,cnt-1,e&&i==limit))%MOD;\n        else ret=(ret+F(idx-1,cnt,e&&i==limit))%MOD;\n    }\n    return e?ret:dp[idx][cnt]=ret;\n}\n\n\nll dfs(int idx,int cnt){\n    if(idx==6) return 1;\n    ll ret=0;\n    for(int i=0;i<=cnt;++i){\n        res[i]--;\n        ret=(ret+(res[i]+1)*dfs(idx+1,cnt-i))%MOD;\n        res[i]++;\n    }\n    return ret;\n}\n\nint main()\n{\n//    freopen(\"in.txt\",\"r\",stdin);\n    ll x;scanf(\"%I64d\",&x);\n    if(x<=7){\n        cout<<0<<endl;return 0;\n    }\n    getNum(x);\n    for(int i=0;i<=len;++i){\n        memset(dp,0,sizeof(dp));\n        res[i]=F(len,i,true);\n    }\n    res[0]--;\n//    cout<<res[0]<<\" \"<<res[1]<<\" \"<<res[2]<<endl;\n    ll ans=0;\n    for(int i=1;i<=len;++i)\n        ans=(ans+res[i]*dfs(0,i-1))%MOD;\n    cout<<ans<<endl;\n    return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "a15558d6cc56dbf9e64aae07712833cb", "src_uid": "656ed7b1b80de84d65a253e5d14d62a9", "apr_id": "4e260bc382d83b73fe71402046ae674f", "difficulty": 1900, "tags": ["brute force", "dp", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.8832, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n\nlong long n, x, y, x2, y2, l;\n\nint main() {\n    freopen(\"tmp.inp\", \"r\", stdin);\n    freopen(\"tmp.out\", \"w\", stdout);\n\n    cin >> n >> x >> y >> x2 >> y2;\n    l = ceil(sqrt(abs(x-x2)*abs(x-x2) + abs(y-y2)*abs(y-y2)));\n\n    if (l%(2*n) == 0) cout << l/(2*n);\n    else cout << l/(2*n)+1;\n\n    return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "bf2f0560c555394c1cdde6c78735c3a9", "src_uid": "698da80c7d24252b57cca4e4f0ca7031", "apr_id": "c32519048e56eda1ff4a4d6006dde601", "difficulty": 1400, "tags": ["geometry", "math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.7798066595059077, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 7, "bug_source_code": "#include <stdio.h>\n#include <iostream>\n#include <fstream>\n#include <vector>\n#include <stack>\n\n#define ONLINE_JUDGE\n#define pii pair<int, int>\n\nusing namespace std;\nconst int MAXN = 100500;\n\n\nvoid dfs(int v, vector<vector<int>> g, vector<bool>& used)\n{\n    used[v] = true;\n    for (int i = 0; i < g[v].size(); i++)\n    {\n        int u = g[v][i];\n        if (!used[u])\n            dfs(u, g, used);\n    }\n}\n\nvector<int> f(MAXN, 0);\nvector<vector<int>> g(MAXN, vector<int>());\nvector<vector<int>> gT(MAXN, vector<int>());\nvector<bool> used(MAXN, false);\nvector<bool> usedT(MAXN, false);\n\nint main()\n{\n#ifndef ONLINE_JUDGE\n    ifstream cin(\"input.txt\");\n    ofstream cout(\"output.txt\");\n#endif\n\n    int n, m;\n\n    cin >> n >> m;\n\n    for (int i = 0; i < n; i++)\n        cin >> f[i];\n\n    for (int i = 0; i < m; i++)\n    {\n        int u, v;\n        cin >> u >> v;\n        u--, v--;\n        g[u].push_back(v);\n        gT[v].push_back(u);\n    }\n\n    for (int i = 0; i < n; i++)\n    {\n        if (!used[i] && f[i] == 1)\n            dfs(i, g, used);\n    }\n\n    for (int i = 0; i < n; i++)\n    {\n        if (!usedT[i] && f[i] == 2)\n            dfs(i, gT, usedT);\n    }\n\n    for (int i = 0; i < n; i++)\n    {\n        if (used[i] && usedT[i])\n            cout << 1 << endl;\n        else\n            cout << 0 << endl;\n    }\n\n    return 0;\n}", "lang": "GNU C++", "bug_code_uid": "e5c92618d22ee42099167744edbc83e6", "src_uid": "87d869a0fd4a510c5e7e310886b86a57", "apr_id": "2a0dec1875a860c4c51dc0c643efa1d2", "difficulty": 1700, "tags": ["graphs"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9795918367346939, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint main(){\n\tshort int stick[2];\n\tcin>>stick[0]>>stick[1]>>stick[2];\n\tsort(stick,stick+3);\n\tcout<<max(stick[2]-stick[1]-stick[0]+1,0)<<endl;\n\treturn 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "46db361263652097fe3278fdde0a6762", "src_uid": "3dc56bc08606a39dd9ca40a43c452f09", "apr_id": "51d421c6d66c6b574fe5f01b2b9dd4b9", "difficulty": 800, "tags": ["geometry", "math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.27104722792607805, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "#include<iostream>\nusing namespace std;\nint main(){\n\tint n;\n\tcin>>n;\n\tint i;\n\tint ans[n],limit=1;\n\tans[0] = n;\n\tfor(i=n/2;i>0;i--){\n\t\tif(n%i == 0){\n\t\t\tn=i;\n\t\t\tans[limit]=i;\n\t\t\tlimit++;\n\t\t}\n\t}\n\tfor(i=0;i<limit;i++){\n\t\tcout<<ans[i]<<\" \";\n\t}\n\treturn 9;\n}\n", "lang": "GNU C++17", "bug_code_uid": "cee575374e5798a36fdda22fa4da7e3e", "src_uid": "1a335a9638523ca0315282a67e18eec7", "apr_id": "a644af637857e918b5828567e3d66ac0", "difficulty": 1300, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9851337958374629, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\n#define mem(a,b) memset(a,b,sizeof(a))\n#define rep(i,a,b) for(int i=a;i<b;++i)\n#define pb push_back\n#define mp make_pair\n#define vi vector<int>\n#define F first\n#define S second\nconst int N=2e5+7;\ntypedef long long int ll;\nstring l,r;\nint T,n,a,b,m,k;\nint d[N];\nint cnt=0;\nvector<pair<int,int> >g[N];\n\n\nint main()\n{\n     ios::sync_with_stdio(false);\n     cin.tie(0);\n     cin>>n;\n     rep(i,2,n)\n     ans+=ll(i)*(i+1);\n     cout<<ans;\n     return 0;\n\n}\n", "lang": "GNU C++17", "bug_code_uid": "031e32053ec1c1f79edd273b4d891567", "src_uid": "1bd29d7a8793c22e81a1f6fd3991307a", "apr_id": "fbd58431979542569676af3eca987301", "difficulty": 1200, "tags": ["dp", "math", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.345489443378119, "equal_cnt": 6, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": " #include <bits/stdc++.h>\n #define nint new int\n #define ll long long\n #define pb push_back\n #define sony ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);\n using namespace std;\n int main()\n {\n sony;\n ll a,b;\n cin>>a>>b;\n a=max(a,b);\n for (b=a;--a;)\tb*=a;\n cout<<b;\n return 0;\n}", "lang": "GNU C++14", "bug_code_uid": "dde073813899725a2dd37d3ebd8b7190", "src_uid": "7bf30ceb24b66d91382e97767f9feeb6", "apr_id": "11c2afb9cc11849ea0f0be1ce8ca694b", "difficulty": 800, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9631181894383906, "equal_cnt": 12, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "#include <bits/stdc++.h>\n#include <ext/pb_ds/assoc_container.hpp>\n#include <ext/pb_ds/tree_policy.hpp>\n#include <ext/pb_ds/detail/standard_policies.hpp>\n\n#define ll long long\n#define pb push_back\n#define F first\n#define S second\n#define endl '\\n'\n\n\nusing namespace std;\nusing namespace __gnu_pbds;\n\ntemplate <typename T> using ordered_set= tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;\n\nvector<int> g[200001];\n\nvector<int> gpr[200001];\n\nvector<int> path;\n\nvector<pair<int,int> > used;\n\nvector<int> db;\n\n\nqueue<pair<int,int> > q;\n\n\nvoid dfs(int v1,int l1){\n    q.push({l1,v1});\n    while(!q.empty()){\n    int v=q.front().S;\n    int l=q.front().F;\n    q.pop();\n    if(used[v].F<l && used[v].F!=0){\n        continue;\n    }\n    for(int i=0;i<gpr[v].size();i++){\n        int to=gpr[v][i];\n        if(used[to].F==0 || used[to].F==l+1){\n            used[to].F=l+1;\n            used[to].S+=used[v].S;\n            q.push({l+1,to});\n        }\n        else\n        if(used[to].F>(l+1)){\n            used[to].F=l+1;\n            used[to].S=used[v].S;\n                    q.push({l+1,to});\n        }\n    }\n    }\n}\n\n\nint main(){\n    cin.tie(0);cout.tie(0);\n    ios_base::sync_with_stdio(0);\n    #ifdef LOL\n        freopen(\"input.txt\",\"r\",stdin);\n        freopen(\"output.txt\",\"w\",stdout);\n    #else\n        //freopen(\"input.txt\",\"r\",stdin);\n        //freopen(\"output.txt\",\"w\",stdout);\n    #endif\n\n    int n,m;\n\n    cin>>n>>m;\n\n    used.resize(n);\n    db.resize(n);\n\n    for(int i=0;i<m;i++){\n        int x,y;\n\n        cin>>x>>y;\n        x--;y--;\n\n\n        g[x].pb(y);\n        gpr[y].pb(x);\n    }\n\n    int len;\n\n    cin>>len;\n\n    path.resize(len);\n\n    for(int i=0;i<len;i++){\n        cin>>path[i];\n        path[i]--;\n    }\n    used[path[len-1]].F=1;\n    used[path[len-1]].S=1;\n    dfs(path[len-1],1);\n\n    vector<set<int> > kol;\n\n\n    for(int i=0;i<n;i++){\n\n    }\n\n\n    int ansmi=0,ansma=0;\n\n    for(int i=0;i<len-1;i++){\n        if((used[path[i+1]].F+1)!=used[path[i]].F){\n            ansmi++;\n            ansma++;\n        }\n        else{\n            int f=0;\n            for(int j=0;j<g[path[i]].size();j++){\n                int to=g[path[i]][j];\n                if(to!=path[i+1] && used[to].F==used[path[i+1]].F){\n                    f=1;\n                }\n\n            }\n    if(f==1){\n        ansma++;\n    }\n        }\n    }\n    cout<<ansmi<<' '<<ansma<<endl;\n\n}\n", "lang": "GNU C++17", "bug_code_uid": "7f7cb8ad55306b8213698a4c28935239", "src_uid": "19a0c05eb2d1559ccfe60e210c6fcd6a", "apr_id": "76ebccdeb89bb2bf2f5dbc5b2635ce5b", "difficulty": null, "tags": ["graphs", "shortest paths"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.23957016434892542, "equal_cnt": 22, "replace_cnt": 7, "delete_cnt": 6, "insert_cnt": 8, "fix_ops_cnt": 21, "bug_source_code": "#include <cstdio>\n#include <cstring>\nusing namespace std;\n#define N 50010\n#define mod 998244353\n#define RG register\n#define LL long long\nint n,g[N],f0[N],f1[N],f2[N],pf[N];\nint main()\n{\n//\tfreopen(\"Ark.in\",\"r\",stdin);\n//\tfreopen(\"1.out\",\"w\",stdout);\n\tRG int i,j;\n\tscanf(\"%d\",&n);\n\tfor(i=1;i<=n+2;++i)pf[i]=(LL)i*i%mod;\n\tg[0]=1,g[1]=0,g[2]=1,g[3]=0;\n\tfor(i=4;i<=n;i+=2)g[i]=(g[i-2]+g[i-4])%mod;\n\tf0[0]=0,f1[0]=1,f2[0]=4;\n\tfor(i=1;i<=n;++i)\n\t{\n\t\tf0[i]=(LL)g[i]*pf[i]%mod;\n\t\tf1[i]=(LL)g[i]*pf[i+1]%mod;\n\t\tf2[i]=(LL)g[i]*pf[i+2]%mod;\n\t\tfor(j=2;j<i;++j)f0[i]=(f0[i]+(LL)g[j-1]*pf[j-1]%mod*f0[i-j])%mod;\n\t\tfor(j=2;j<i;++j)f0[i]=(f0[i]+(LL)g[j-2]*pf[j-1]%mod*f1[i-j-1])%mod;\n\t\tfor(j=1;j<i;++j)f1[i]=(f1[i]+(LL)g[j-1]*pf[j]%mod*f0[i-j])%mod;\n\t\tfor(j=2;j<i;++j)f1[i]=(f1[i]+(LL)g[j-2]*pf[j]%mod*f1[i-j-1])%mod;\n\t\tfor(j=1;j<=i;++j)f2[i]=(f2[i]+(LL)g[j-1]*pf[j]%mod*f1[i-j])%mod;\n\t\tfor(j=2;j<i;++j)f2[i]=(f2[i]+(LL)g[j-2]*pf[j]%mod*f2[i-j-1])%mod;\n\t}\n\tRG int ans=(LL)(g[n-1]+g[n-3])*pf[n-1]%mod*n%mod;\n\tfor(i=3;i<n;++i)ans=(ans+(LL)g[i-2]*pf[i-2]%mod*f0[n-i]%mod*(i-1))%mod;\n\tfor(i=3;i<n;++i)ans=(ans+(LL)2*g[i-3]*pf[i-2]%mod*f1[n-i-1]%mod*(i-1))%mod;\n\tfor(i=4;i<=n-2;++i)ans=(ans+(LL)g[i-4]*pf[i-2]%mod*f2[n-i-2]%mod*(i-1))%mod;\n\tprintf(\"%d\\n\",ans);\n//\tfor(i=3;i<n;++i)\n//\t\tans=(ans+(LL)f0[i-2]*f0[n-i]%mod*(n-i))%mod;\n}", "lang": "GNU C++", "bug_code_uid": "a14a146846d1b1cfe1e10d5435e61302", "src_uid": "24fd5cd218f65d4ffb7c5b97b725293e", "apr_id": "004f2f0ef7f8d5cfd72e6db4fef72cda", "difficulty": 3400, "tags": ["divide and conquer", "dp", "combinatorics", "fft", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.021964612568639415, "equal_cnt": 17, "replace_cnt": 11, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 17, "bug_source_code": "#include <cstdio>\ntypedef long long int64;\nstatic const int MAXN = 50004;\nstatic const int MODULUS = 998244353;\n#define _  %  MODULUS\n#define __ %= MODULUS\n\nint n;\nint64 g[MAXN];\nint64 f0[MAXN], f1[MAXN], f2[MAXN];\n\nint main()\n{\n    scanf(\"%d\", &n);\n\n    g[0] = 1;\n    g[2] = 1;\n    for (int i = 4; i <= n; i += 2) g[i] = (g[i - 4] + g[i - 2])_;\n\n    f0[0] = 0;\n    f1[0] = 1;\n    f2[0] = 4;\n    for (int i = 1; i <= n; ++i) {\n        f0[i] = g[i] * i _ * i _;\n        for (int j = 1; j <= i - 2; ++j) {\n            f0[i] += g[j] * j _ * j _ * f0[i - j - 1]_;\n            f0[i] += g[j - 1] * j _ * j _ * f1[i - j - 2]_;\n        }\n        f1[i] = g[i] * (i + 1)_ * (i + 1)_ + f0[i - 1];\n        for (int j = 1; j <= i - 2; ++j) {\n            f1[i] += g[j] * (j + 1)_ * (j + 1)_ * f0[i - j - 1]_;\n            f1[i] += g[j - 1] * (j + 1)_ * (j + 1)_ * f1[i - j - 2]_;\n        }\n        f0[i]__; f1[i]__;\n    }\n    for (int i = 1; i <= n; ++i) {\n        f2[i] = g[i] * (i + 2)_ * (i + 2)_ + f1[i - 1];\n        for (int j = 1; j <= i - 1; ++j) {\n            f2[i] += g[j] * (j + 1)_ * (j + 1)_ * f1[i - j - 1]_;\n            f2[i] += g[j - 1] * (j + 1)_ * (j + 1)_ * f2[i - j - 2]_;\n        }\n        f2[i]__;\n    }\n\n    int64 ans = 0;\n\n    ans += (g[n - 1] + g[n - 3]) * (n - 1)_ * (n - 1)_ * n _;\n    for (int i = 2; i <= n - 2; ++i) {\n        ans += g[i - 1] * (i - 1)_ * (i - 1)_ * f0[n - i - 1]_ * i _;\n        ans += g[i - 2] * (i - 1)_ * (i - 1)_ * f1[n - i - 2]_ * 2 * i _;\n        if (i >= 3 && i <= n - 3)\n            ans += g[i - 3] * (i - 1)_ * (i - 1)_ * f2[n - i - 3]_ * i _;\n    }\n\n    printf(\"%lld\\n\", ans _);\n\n    return 0;\n}", "lang": "GNU C++14", "bug_code_uid": "ee72df71c98948fd20b9e792dfe6807e", "src_uid": "24fd5cd218f65d4ffb7c5b97b725293e", "apr_id": "0a4e5c8625f7a060850018bb75fe82ff", "difficulty": 3400, "tags": ["divide and conquer", "dp", "combinatorics", "fft", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.7851396119261713, "equal_cnt": 32, "replace_cnt": 28, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 31, "bug_source_code": "//CLOCKS_PER_SEC\nusing namespace std;\n#include<bits/stdc++.h>\n#define sqr(x) 1ll*(x)*(x)\n//#define sort stable_sort\n#define ll long long\n#define mk make_pair\n#define pb push_back\n#define in insert\n#define mtr(x,y,z) mk(mk(x,y),z)\n#define fi first\n#define se second\n#define lch(x) ((x)<<1)\n#define rch(x) (((x)<<1)|1)\n#define all(x) (x).begin(),(x).end()\n#define titose CLOCKS_PER_SEC\n#define fpi(x) freopen(x,\"r\",stdin);\n#define fpo(x) freopen(x,\"w\",stdout);\n#define fprio fpi(\"in.txt\");fpo(\"out.txt\");\n#define fast ios_base::sync_with_stdio(false);\ninline void read(int &x){int v=0,f=1;char c=getchar();while (!isdigit(c)&&c!='-') c=getchar();if (c=='-') f=-1; else v=(c&15);while (isdigit(c=getchar())) v=(v<<1)+(v<<3)+(c&15);x=v*f;}\ninline void read(ll &x){ll v=0ll,f=1ll;char c=getchar();while (!isdigit(c)&&c!='-') c=getchar();if (c=='-') f=-1; else v=(c&15);while (isdigit(c=getchar())) v=(v<<1)+(v<<3)+(c&15);x=v*f;}\ninline void readc(char &x){char c;while (((c=getchar())==' ')||c=='\\n');x=c;}\n#define pii pair<int,int>\n#define pll pair<ll,ll>\n#define vi vector<int>\n#define vl vector<ll>\n#define si set<int>\n#define sl set<ll>\n#define mii map<int,int>\n#define mll map<ll,ll>\n#define msi map<string,int>\n#define msl map<string,ll>\n#define piii pair<int,pii >\n#define piipi pair<pii,int>\n#define plll pair<ll,pll >\n#define pllpl pair<pll,ll>\n#define pqi priority_queue<int>\n#define pql priority_queue<ll>\n#define npqi priority_queue<int,vector<int>,greater<int> >\n#define npql priority_queue<ll,vector<ll>,greater<ll> >\n#define forup(i,a,b) for ((i)=(a);(i)<=(b);(i)++)\n#define fordo(i,a,b) for ((i)=(a);(i)>=(b);(i)--)\n#define rep(i,x) forup ((i),1,(x))\n#define repd(i,x) fordo ((i),(x),1)\n#define rep0(i,x) forup ((i),0,(x)-1)\n#define rep0d(i,x) fordo ((i),((int)(x))-1,0)\n#define itr iterator\n#define fe(itcalc,c) for(__typeof((c).begin()) itcalc=(c).begin();itcalc!=(c).end();itcalc++)\n#define NO {cout<<\"NO\";return 0;}\n#define YES {cout<<\"YES\";return 0;}\n#define y0 y000000000000000000000000000\n#define y1 y111111111111111111111111111\n#define j0 j000000000000000000000000000\n#define j1 j111111111111111111111111111\n#define cl0(a) memset((a),(0),(sizeof((a))))\n#define clz(a) memset((a),(0x16),(sizeof((a))))\n#define clf(a) memset((a),(-(0x16)),(sizeof((a))))\n#define inf 0x3bbbbbbb\n#define lnf 0x2bbbbbbbbbbbbbbbll\n//#define sqrt divi\n#define p2(i) (1ll<<(i))\n#define readi read\n#define readll read\n/*************************************************/\nconst int mod=998244353,maxn=131072;\nint n,m,i,j,g[50005],g0[50005],g1[50005],g2[50005],f0[50005],f1[50005],f2[50005],w[maxn+5],tmp[maxn+5],ans;\nvoid solve(int l,int r)\n{\n\tif(l==r){\n\t\tf0[l]=(f0[l]+g0[l])%mod;\n\t\tf1[l]=(f1[l]+g1[l])%mod;\n\t\tf2[l]=(f2[l]+g2[l])%mod;\n\t\treturn;\n\t}\n\tint mid=(l+r)/2,i;\n\tsolve(l,mid); \n\tpoly_mul(f0+l,mid-l+1,g0,r-l+1,tmp+l,r-l+1);\n\tforup(i,mid+1,r) f0[i]=(f0[i]+tmp[i])%mod;\n\tpoly_mul(f0+l,mid-l+1,g1,r-l+1,tmp+l,r-l+1);\n\tforup(i,mid+1,r) f1[i]=(f1[i]+tmp[i])%mod;\n\tpoly_mul(f1+l,mid-l+1,g1,r-l+1,tmp+l,r-l+1);\n\tforup(i,mid+1,r) f0[i]=(f0[i]+tmp[i])%mod;\n\tforup(i,mid+1,r) f2[i]=(f2[i]+tmp[i])%mod;\n\tpoly_mul(f1+l,mid-l+1,g2,r-l+1,tmp+l,r-l+1);\n\tforup(i,mid+1,r) f1[i]=(f1[i]+tmp[i])%mod;\n\tpoly_mul(f2+l,mid-l+1,g2,r-l+1,tmp+l,r-l+1);\n\tforup(i,mid+1,r) f2[i]=(f2[i]+tmp[i])%mod;\n\tsolve(mid+1,r);\n}\nint main()\n{\n\tinit();\n\tread(n);\n\tg[0]=g[2]=1;\n\tfor(i=4;i<=n;i+=2){\n\t\tg[i]=(g[i-2]+g[i-4])%mod;\n\t}\n\tforup(i,1,n){\n\t\tg0[i]=1ll*(i-1)*(i-1)%mod*g[i-1]%mod;\n\t}\n\tforup(i,2,n){\n\t\tg1[i]=1ll*(i-1)*(i-1)%mod*g[i-1]%mod;\n\t}\n\tforup(i,3,n){\n\t\tg2[i]=1ll*(i-1)*(i-1)%mod*g[i-1]%mod;\n\t}\n\tsolve(1,n);\n\tans=1ll*n*(g0[n]+g2[n])%mod;\n\tfor(i=2;i<=n-2;i+=2){\n\t\tans=(ans+1ll* \n\t}\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "5e50be1237ffe241dfdb129e3f0a44d9", "src_uid": "24fd5cd218f65d4ffb7c5b97b725293e", "apr_id": "39be11a8b5bc63af909926d8ef2f43e8", "difficulty": 3400, "tags": ["divide and conquer", "dp", "combinatorics", "fft", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.963579604578564, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\n#define ll long long\n#define inp ll t; cin>>t; for(ll tt=1;tt<=t;tt++)\n#define pb push_back\n#define sz 100000\n\nint main()\n{\n     ll n,b,i;\n     cin>>n>>b;\n     ll a[27];\n     memset(a,0,sizeof(a));\n\n     string s;\n     cin>>s;\n     for(i=0;i<s.size();i++)\n          a[s[i]-97]++;\n     sort(a,a+n);\n     bool mik=true;\n     for(i=0;i<26;i++)\n     if(a[i]>b) mik=false;\n     if(mik) cout<<\"YES\"<<endl;\n     else cout<<\"NO\"<<endl;\n}\n", "lang": "GNU C++17", "bug_code_uid": "083b31a678028a7096ab91421faad827", "src_uid": "ceb3807aaffef60bcdbcc9a17a1391be", "apr_id": "72f7179e55804edbe926a28ff1bb4ac0", "difficulty": 900, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.08205689277899343, "equal_cnt": 17, "replace_cnt": 12, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 17, "bug_source_code": "#include <bits/stdc++.h>\n#define cou pair<int,int>\n#define trip pair<cou,int>\n#define mp make_pair\n#define fi first\n#define se second\nusing namespace std;\n\nmap<cou,int> dp;\nint n;\nchar c[101];\n\nvoid bfs(int x,int y,int pos)\n{\n\tqueue<trip> q;\n\tq.push(mp(mp(x,y),pos));\n\twhile(q.size())\n\t{\n\t\tint now_x=q.front().fi.fi,now_y=q.front().fi.se,now_pos=q.front().se;\n\t\tq.pop();\n\t\tfor(int i=now_pos+1;i<=n;i++)\n\t\t{\n\t\t\tint cur_x=now_x,cur_y=now_y;\n\t\t\tif(c[i]=='U') cur_y=now_y+1;\n\t\t\tif(c[i]=='D') cur_y=now_y-1;\n\t\t\tif(c[i]=='L') cur_x=now_x-1;\n\t\t\tif(c[i]=='R') cur_x=now_x+1;\n\t\t\tint cost=dp[mp(now_x,now_y)]+1;\n\t\t\tif(dp[mp(cur_x,cur_y)]<=cost)\n\t\t\t{\n\t\t\t\tdp[mp(cur_x,cur_y)]=cost;\n\t\t\t\tq.push(mp(mp(cur_x,cur_y),i));\n\t\t\t}\n\t\t}\n\t}\n}\n\nint main()\n{\n\t//freopen(\"i.inp\",\"r\",stdin);\n\tscanf(\"%d \",&n);\n\tfor(int i=1;i<=n;i++) scanf(\"%c \",&c[i]);\n\tbfs(0,0,0);\n\tprintf(\"%d \",dp[mp(0,0)]);\n}", "lang": "GNU C++14", "bug_code_uid": "d14d9cf947a368fe0c02b41ad1eeecc1", "src_uid": "b9fa2bb8001bd064ede531a5281cfd8a", "apr_id": "b093f2b717d42cbed38b8b5d6c8ec853", "difficulty": 1000, "tags": ["greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.24388111888111888, "equal_cnt": 11, "replace_cnt": 11, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 11, "bug_source_code": "#include<iostream>//\u5c11\u526a\u679d \n#include<cstdio>//\u5faa\u73af\u592a\u591a\uff0c\u6bcf\u6b21\u90fd\u8981\u521d\u59cb\u5316\u4e00\u6b21 \n#include<cstring>\n#include<string>\n#include<algorithm>\n#include<cctype>\n#include<cmath>\n#include<cstdlib>\n#include<queue>\n#include<ctime>\n#include<vector>\n#include<set>\n#include<map>\n#include<stack>\nusing namespace std;\nconst int INF=1e9;\nint a[41][41],n,m,ans;\nint search(int x,int y)\n{     bool f=false;int k=INF;\n      for(int i=1;i<=n;i++){\n         for(int j=1;j<=m;j++)\n            if(a[i][j]==1){f=true;break;}\n         if(f)break;}\n      if(!f)return ans;\n      ans++;\n      a[x][y]=a[x-1][y]=a[x][y-1]=a[x+1][y]=a[x][y+1]=0;\n      for(int i=1;i<=n;i++)\n         for(int j=1;j<=m;j++){\n         \tk=min(search(i,j),k);}}\nint main()\n{     int i,j,k,minx=INF;\n      cin>>n>>m;\n      if(n==1&&m==1)cout<<0<<endl;\n      else{\n      for(i=1;i<=n;i++)\n         for(j=1;j<=m;j++){\n         \tfor(int w=1;w<=n;w++)\n               for(int k=1;k<=m;k++)a[w][k]=1;\n            ans=0;\n         \tint x=search(i,j);\n            if(x<minx)minx=x;}\n      cout<<m*n-minx<<endl;}\n\t  return 0;\n}", "lang": "GNU C++", "bug_code_uid": "f4981b0192f3f418741780eb558d02ea", "src_uid": "097674b4dd696b30e102938f71dd39b9", "apr_id": "334f56a57eed7c0fff5a0d4b1ad8bf0b", "difficulty": 2100, "tags": ["dp", "bitmasks", "dsu"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6116207951070336, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "#include<bits/stdc++.h>\n#define ll long long \n#define ull unsigned long long int\n#define sort(a) sort((a).begin(),(a).end());\n#define rev(a) reverse((a).begin(),(a).end());\n#define vec vector\n#define str string\n#define pb(a) .push_back((a));\nusing namespace std;\null n,a,sum=0;\nbool b[100000000];\nint main(){\n\tcin>>n;\n\tfor(int i=0;i<n;i++){\n\t\tcin>>a;\n\t\twhile(1){\n\t\t\tif(b[a]==0){\n\t\t\t\tb[a]=1;\n\t\t\t\tsum+=a;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse a--;\n\t\t}\n\t}\n\tcout<<sum;\n}", "lang": "GNU C++", "bug_code_uid": "59c9ddca70a9221a775ccf78c2638ed1", "src_uid": "3c4b2d1c9440515bc3002eddd2b89f6f", "apr_id": "a23a1b2c11eda306cad8e4ffe633037e", "difficulty": 1100, "tags": ["greedy", "sortings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.18559411146161936, "equal_cnt": 31, "replace_cnt": 22, "delete_cnt": 5, "insert_cnt": 4, "fix_ops_cnt": 31, "bug_source_code": "//#include <iostream>\n#include <cstdio>\n#include <cstring>\n#include <algorithm>\n#define lng long long\nusing namespace std;\n\nconst int maxn = 3000;\nlng dp[19][550][2550];\nlng a, b;\nint s[550], num[20], tot;\n\nint gcd(int x, int y) { return y == 0 ? x : gcd(y, x % y); }\n\nvoid init()\n{\n    for(int i = 1; i < 512; ++i)\n    {\n        s[i] = 1;\n        for(int j = 2; j < 10; ++j)\n        {\n            if(i & (1 << (j - 1)))\n            {\n                s[i] = (s[i] * j) / gcd(s[i], j);\n            }\n        }\n    }\n}\n\nlng dfs(int pos, int sta, int pre, int ok, int msta)\n{\n    if(pos == -1) return sta == msta && pre == 0;\n    if((msta | sta) != msta) return 0;\n    if(!ok && dp[pos][sta][pre] != -1) return dp[pos][sta][pre];\n    lng ans = dfs(pos - 1, sta, (pre * 10) % s[msta], ok && num[pos] == 0, msta);\n    int end = ok ? num[pos] : 9;\n    for(int i = 1; i <= end; ++i)\n    {\n        int tpre = ((pre * 10) + i) % s[msta];\n        ans += dfs(pos - 1, sta | (1 << (i - 1)), tpre, ok && i == end, msta);\n    }\n    if(!ok) dp[pos][sta][pre] = ans;\n    return ans;\n}\n\nint count_bit(int n) { return n == 0 ? 0 : n % 2 + count_bit(n / 2); }\n\nlng calc(lng n)\n{\n    tot = 0;\n    while(n) { num[tot++] = n % 10; n /= 10; }\n    lng ans = 0;\n    for(int i = 1; i < 512; ++i)\n    {\n        if(count_bit(i) > tot) continue;\n        for(int j = 0; j < tot; ++j)\n        {\n            for(int k = i; k; k = (k - 1) & i)\n                for(int q = 0; q < s[i]; ++q) dp[j][k][q] = -1;\n            for(int q = 0; q < s[i]; ++q) dp[j][0][q] = -1;\n        }\n        ans += dfs(tot - 1, 0, 0, 1, i);\n    }\n    return ans;\n}\n\nvoid prework()\n{\n    cin >> a >> b;\n}\n\nvoid solve()\n{\n    cout << calc(b) - calc(a - 1) << \"\\n\";\n}\n\nint main()\n{\n    init();\n    freopen(\"in.txt\", \"r\", stdin);\n    int t; cin >> t;\n    while(t--)\n    {\n        prework();\n        solve();\n    }\n    return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "080be6dc353996db044edbd5a882a9c0", "src_uid": "37feadce373f728ba2a560b198ca4bc9", "apr_id": "8914494d3b2de6f1125084453ccf8a40", "difficulty": 2500, "tags": ["dp", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9551049963794352, "equal_cnt": 14, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 13, "bug_source_code": "#include <bits/stdc++.h>\n\nusing namespace std;\n#define ll long long\n#define mem(a, b) memset(a,b,sizeof(a))\n#define INF 0x3f3f3f3f\n#define DBG printf(\"this is a input\\n\")\nconst int MOD = 2520;\nint indx[10000];\nint num[50];\nint dp[50][3000][3000];\nll gcd(ll a, ll b) {\n    return b == 0 ? a : gcd(b, a % b);\n}\nll lcm(ll a, ll b) {\n    return a / gcd(a, b) * b;\n}\n\nvoid Init()\n{\n    int cnt = 0;\n    for(int i = 1 ; i <= MOD ; i ++)\n    {\n        if(MOD % i == 0)\n            indx[i] = cnt ++;\n    }\n}\nint dfs(int pos , int presum , int prelcm , int limit)\n{\n    if(pos == -1) return presum % prelcm == 0;\n    if(limit && dp[pos][presum][indx[prelcm]]) return dp[pos][presum][indx[prelcm]];\n    int maxn = limit ? num[pos] : 9;\n    int ans = 0;\n    for(int i = 0 ; i <= maxn ; i ++)\n    {\n        int nowlcm = prelcm;\n        int nowsum = (presum*10 + i)%MOD;\n        if(i)\n            nowlcm = lcm(prelcm,i);\n        ans += dfs(pos-1,nowsum,nowlcm,limit && i == num[pos]);\n\n    }\n    if(!limit) dp[pos][presum][indx[prelcm]] = ans;\n    return ans;\n}\nint solve(int x)\n{\n    int len = 0;\n    while(x)\n    {\n        num[len ++] = x % 10;\n        x /= 10;\n    }\n    return dfs(len-1,0,1,true);\n}\nint main(void)\n{\n    ios::sync_with_stdio(0);\n    cin.tie(0);\n    int T;\n    cin>>T;\n    while(T --)\n    {\n        int n , m ;\n        cin>>n>>m;\n        cout<<solve(m)-solve(n-1)<<endl;\n    }\n}\n", "lang": "GNU C++17", "bug_code_uid": "1549ef3f956d247243656c5e2fff405f", "src_uid": "37feadce373f728ba2a560b198ca4bc9", "apr_id": "5b72872c41df65384ee0a303c1480664", "difficulty": 2500, "tags": ["dp", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9935649935649936, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 5, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "\n#include <iostream>\n\n#include <cstring>\n\n#include <cstdio>\n\nusing namespace std;\n\nlong long a[22];\n\nint hash[2522];\n\nlong long dp[22][2522][50];\n\nint gcd(int a,int b)\n\n{\n\n    if(a<b)swap(a,b);\n\n    while(b)\n\n    {\n\n        int w=a;\n\n        a=b;\n\n        b=w%b;\n\n    }\n\n    return a;\n\n}\n\n \n\nlong long dpp(int pos,int sum,int b,int limit)\n\n{\n\n    if(pos==-1)return sum%b==0;\n\n    if(!limit&&dp[pos][sum][hash[b]]!=-1)return dp[pos][sum][hash[b]];\n\n    long long sun=0;\n\n    int end=limit?a[pos]:9;\n\n    for(int i=0;i<=end;i++)\n\n    {   int q=b;\n\n    if(i>=2)q=q*i/gcd(q,i);\n\n        sun+=dpp(pos-1,(sum*10+i)%2520,q,limit&&i==a[pos]);\n\n \n\n    }\n\n    if(!limit)dp[pos][sum][hash[b]]=sun;\n\n    return sun;\n\n}\n\n \n\nlong  long go(long long x)\n\n{\n\n    int pos=0;\n\n    while(x)\n\n    {\n\n        a[pos++]=x%10;\n\n        x/=10;\n\n    }\n\n \n\n    return dpp(pos-1,0,1,1);\n\n}\n\n \n\nint main()\n\n{\n\n    long long n,m,t;\n\n    int j;\n\n    memset(dp,-1,sizeof(dp));\n\n    for(int i=1,j=0;i<=2520;i++)\n\n    {\n\n        if(2520%i==0)hash[i]=j++;\n\n    }\n\n    scanf(\"%I64d\",&t);\n\n    while(t--)\n\n    {   scanf(\"%I64d%I64d\",&n,&m);\n\n        printf(\"%I64d\\n\",go(m)-go(n-1));\n\n    }\n\n \n\n    return 0;\n\n}\n", "lang": "GNU C++17", "bug_code_uid": "a934996b2cbcf3860687368992e45063", "src_uid": "37feadce373f728ba2a560b198ca4bc9", "apr_id": "678cfe7c686d4b6e9633134dd5f50853", "difficulty": 2500, "tags": ["dp", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.9973835688121402, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint main (){\n    int n, k, x, cnt, max=0;\n    vector <int> c;\n    cin >> n >> k >> x;\n    for (int i=0 ; i<n ; i++){\n        cin >> cnt;\n        c.push_back(cnt);\n    }\n    for (unsigned int i=1 ; i<c.size()-1 ; i++)\n        if (c[i]==c[i+1] && c[i]==x){\n            vector <int> d;\n            for (int j=0 ; j<n ; j++)\n                d.push_back(c[j]);\n            cnt=2;\n            d.erase(d.begin()+i,d.begin()+(i+2));\n            i++;\n            for (unsigned int j=0 ; j<d.size()-2 && d.size()!=0; j++)\n                if (d[j]==d[j+1] && d[j+1]==d[j+2]){\n                    while (d[j+1]==d[j] && j<d.size()-1){\n                        d.erase(d.begin()+j);\n                        cnt++;\n                    }\n                    d.erase(d.begin()+j);\n                    cnt++;\n                    j=-1;\n                }\n            if (cnt>max)max=cnt;\n        }\n    cout << max;\n    return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "4116dd938b228bf384e4abb025e8b670", "src_uid": "d73d9610e3800817a3109314b1e6f88c", "apr_id": "441f11b823a6b18f7e33eeee8779c588", "difficulty": 1400, "tags": ["brute force", "two pointers"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9472819839054032, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include <iostream>\n#include <sstream>\n#include <algorithm>\n#include <vector>\n#include <cmath>\n#include <set>\n#include <queue>\n#include <string>\n#include <map> \n#include <fstream>\n#include <hash_map>\n\n#define input fstream fin( \"input.txt\" , ios :: in ) ;\n#define output fstream fout( \"output.txt\" , ios :: out ) ;\n#define FOR(s,x) for ( int i = s ; i < x ; i ++ )\n#define FOR2(s,x) for ( long long j = s ; j < x ; j ++ )\n#define FOR3(s,x) for ( long long r = s ; r < x ; r ++ )\n#define FOI(s,x) for ( long long d = x ; d >= s ; d -- )\n#define SZ  size()\n\n#define S    begin()\n#define E    end()\nusing namespace std;\n\nlong long n , m , res = 0  , sum = 0 , c = 0 , nm1 , nm2 , nm3;\nlong long mx = 0 , mn = INT_MAX ;\n\nstring s , s1 = \"\", s3;\nlong long x[1000000] , y[1000000];\nint find(   vector<int> dist , int num ){\n\n\n    FOR(0, dist.size())\n        if ( num == dist[i])\n            return i ;\n\n    return -1 ;\n\n}\nint main(){\n\n\n    cin >> n >> m >> nm2 ; \n    vector <int> pos , nums , nums2;\n    FOR ( 0 , n ){ \n        cin >> nm3 ;\n        nums2.push_back(nm3);\n        if ( nm2 == nm3 && pos.SZ == 0 )\n            pos.push_back(i);\n\n        else if ( nm2 == nm3 && nums2[i-1] != nm2  )\n            pos.push_back(i);\n    }\n    FOR ( 0 , pos.SZ ){\n\n        res = 0 ;\n        nums = nums2 ;\n        int b = pos[i] ;\n        nm1 = 0 ;\n        while ( nums[b] == nm2  ){\n            nums.erase(nums.begin() + b , nums.begin() + b + 1);\n            res ++ ;\n            nm1 ++ ;\n            if ( nums.SZ == 0 )\n                break ;\n        }\n        \n        if ( nm1 < 2 )\n            continue ;\n        if ( res > mx ) \n            mx = res ;\n\n        while ( nums.SZ > 1 ){\n            if ( b - 2 >= 0 ){\n\n                if ( nums[b] == nums[b-2] && nums[b-1] == nums[b] ) \n                    b -= 2 ;\n\n                else if ( nums[b] == nums[b-1] ) \n                    b -- ;\n\n\n            }\n\n            else if ( b - 1 >= 0 ){\n\n                if ( nums[b] == nums[b-1] ) \n                    b -- ;\n\n            }\n            nm1 = 0 ;\n            if ( b + 1 < nums.SZ  )\n            while ( nums[b] == nums[b+1]  ){\n            if ( b + 2 >= nums.SZ  && nums[b] == nums[b+1] )\n                {\n                \n                   nm1 += 2 ;\n                   res += 2 ;\n                   nums.clear();\n                   break ;\n                }\n            nums.erase(nums.begin() + b , nums.begin() + b + 1);\n                res ++ ;\n                nm1 ++ ;\n                \n                \n                if ( nums[b+1] != nums[b] ){\n                  nums.erase(nums.begin() + b , nums.begin() + b + 1);\n                   res ++ ;\n                   nm1 ++ ;\n                   break; \n                }\n                if ( b + 1 >= nums.SZ  )\n                    break;\n                \n\n            }\n            \n          if ( nm1 < 3 )  \n                break;\n      }\n        if ( nm1 < 3 ) \n            res -= nm1 ;    \n        if ( res > mx ) \n            mx = res ;\n\n\n\n\n    }    \n    cout << mx ;\n}\n ", "lang": "GNU C++", "bug_code_uid": "bf8054fe6ee0a014b8f596f0ab1e3c0a", "src_uid": "d73d9610e3800817a3109314b1e6f88c", "apr_id": "74054c59e161aff55cd6250a61e4b5aa", "difficulty": 1400, "tags": ["brute force", "two pointers"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8062360801781737, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "#include <iostream>\n\nusing namespace std;\n\nint main()\n{\n    long long x;\n   cin >>x;\n   x+=1;\n   if (x==1)\n    cout << '0';\n  else  if(x%2==0)\n    cout <<x/2;\n   else\n    for (long long i=1;i<=x;i++)\n    if ((2*i)%x==0)\n   {\n       cout<< i;\n       return 0;\n   }\n}\n", "lang": "GNU C++", "bug_code_uid": "4cf5f9c83e818ada1d89ff34770d9ea8", "src_uid": "236177ff30dafe68295b5d33dc501828", "apr_id": "d76d0e88675380ef582aae5588095081", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.9992206982543641, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#include<iostream>\n#include<stdlib.h>\n#include<math.h>\n#include<string.h>\nusing namespace std;\nint rook(int r1,int c1,int r2,int c2){\n    if((r1==r2)||(c1==c2)){\n        return 1;\n    }\n    else{\n        return 2;\n    }\n}\nint bishop(int r1,int c1,int r2,int c2){\n    if(rook(r1,c1,r2,c2)==1){\n        if(r1==r2){\n            if(abs(c1-c2)%2==0){\n                return 2;\n            }\n            else{\n                return 0;\n            }\n        }\n        else{\n            if(abs(r1-r2)%2==0){\n                return 2;\n            }\n            else{\n                return 0;\n            }\n        }\n    }\n    float slope=((float)(c2-c1)/(r2-r1));\n    int t1,t2,dir=0;\n    t1=r1;\n    t2=c1;\n    if((slope==1)||(slope==-1)){\n        return 1;\n    }\n    else{\n        while(1<t1&&1<t2){\n            t1--;\n            t2--;\n            if((r2-t1)!=0){\n                slope=(float)(c2-t2)/(r2-t1);\n                if((slope==1)||(slope==-1)){\n                    return 2;\n                }\n            }\n            if(rook(t1,t2,r2,c2)==1){\n                if(t1==r2){\n                    if(abs(t2-c2)%2==0){\n                        return 2;\n                    }\n                    else{\n                        return 0;\n                    }\n                }\n                else{\n                    if(abs(t1-r2)%2==0){\n                        return 2;\n                    }\n                    else{\n                        return 0;\n                    }\n                }\n            }\n        }\n        t1=r1;\n        t2=c1;\n        while(t1<8&&t2<8){\n            t1++;\n            t2++;\n            if((r2-t1)!=0){\n                slope=(float)(c2-t2)/(r2-t1);\n                if((slope==1)||(slope==-1)){\n                    return 2;\n                }\n            }\n            if(rook(t1,t2,r2,c2)==1){\n                if(t1==r2){\n                    if(abs(t2-c2)%2==0){\n                        return 2;\n                    }\n                    else{\n                        return 0;\n                    }\n                }\n                else{\n                    if(abs(t1-r2)%2==0){\n                        return 2;\n                    }\n                    else{\n                        return 0;\n                    }\n                }\n            }\n        }\n        t1=r1;\n        t2=c1;\n        while(t1<8&&1<t2){\n            t1++;\n            t2--;\n            if((r2-t1)!=0){\n                slope=(float)(c2-t2)/(r2-t1);\n                if((slope==1)||(slope==-1)){\n\n                    return 2;\n                }\n            }\n            if(rook(t1,t2,r2,c2)==1){\n                if(t1==r2){\n                    if(abs(t2-c2)%2==0){\n                        return 2;\n                    }\n                    else{\n                        return 0;\n                    }\n                }\n                else{\n                    if(abs(t1-r2)%2==0){\n                        return 2;\n                    }\n                    else{\n                        return 0;\n                    }\n                }\n            }\n        }\n        t1=r1;\n        t2=c1;\n        while(1<t1&&t2<8){\n            t1--;\n            t2++;\n            if((r2-t1)!=0){\n                slope=(float)(c2-t2)/(r2-t1);\n                if((slope==1)||(slope==-1)){\n                    return 2;\n                }\n            }\n            if(rook(t1,t2,r2,c2)==1){\n                if(r1==r2){\n                    if(abs(c1-c2)%2==0){\n                        return 2;\n                    }\n                    else{\n                        return 0;\n                    }\n                }\n                else{\n                    if(abs(r1-r2)%2==0){\n                        return 2;\n                    }\n                    else{\n                        return 0;\n                    }\n                }\n            }\n        }\n    }\n    return 0;\n}\n\nint king(int r1,int c1,int r2,int c2){\n    int c=0;\n    if(rook(r1,c1,r2,c2)==1){\n        if(r1==r2){\n            if(c1>c2){\n                return (c1-c2);\n            }\n            else{\n                return (c2-c1);\n            }\n        }\n        else if(c1==c2){\n            if(r1>r2){\n                return (r1-r2);\n            }\n            else{\n                return (r2-r1);\n            }\n        }\n    }\n    else if(bishop(r1,c1,r2,c2)==1){\n        if((r2>r1)&&(c2>c1)){\n            while((r1!=r2)&&(c1!=c2)){\n                r1++;\n                c1++;\n                c++;\n            }\n        }\n        else if((r2>r1)&&(c1>c2)){\n            while((r1!=r2)&&(c1!=c2)){\n                r1++;\n                c1--;\n                c++;\n            }\n        }\n        else if((r1>r2)&&(c2>c1)){\n            while((r1!=r2)&&(c1!=c2)){\n                r1--;\n                c1++;\n                c++;\n            }\n        }\n        else if((r1>r2)&&(c1>c2)){\n            while((r1!=r2)&&(c1!=c2)){\n                r1--;\n                c1--;\n                c++;\n            }\n        }\n        return c;\n    }\n    else{\n        if((r2>r1)&&(c2>c1)){\n            while((r1!=r2)&&(c1!=c2)){\n                r1++;\n                c1++;\n                c++;\n            }\n            if(r1==r2){\n                c = c + abs(c1-c2);\n            }\n            else{\n                c = c + abs(r1-r2);\n            }\n        }\n        else if((r2>r1)&&(c1>c2)){\n            while((r1!=r2)&&(c1!=c2)){\n                r1++;\n                c1--;\n                c++;\n            }\n            if(r1==r2){\n                c = c + abs(c1-c2);\n            }\n            else{\n                c = c + abs(r1-r2);\n            }\n        }\n        else if((r1>r2)&&(c2>c1)){\n            while((r1!=r2)||(c1!=c2)){\n                r1--;\n                c1++;\n                c++;\n            }\n            if(r1==r2){\n                c = c + abs(c1-c2);\n            }\n            else{\n                c = c + abs(r1-r2);\n            }\n        }\n        else if((r1>r2)&&(c1>c2)){\n            while((r1!=r2)||(c1!=c2)){\n                r1--;\n                c1--;\n                c++;\n            }\n            if(r1==r2){\n                c = c + abs(c1-c2);\n            }\n            else{\n                c = c + abs(r1-r2);\n            }\n        }\n        return c;\n    }\n}\n\nint main(){\nint r1,c1,r2,c2;\ncin>>r1>>c1>>r2>>c2;\ncout<<rook(r1,c1,r2,c2)<<\" \";\ncout<<bishop(r1,c1,r2,c2)<<\" \";\ncout<<king(r1,c1,r2,c2)<<\" \";\nreturn 0;\n}\n\n", "lang": "GNU C++", "bug_code_uid": "c0fb675c8e792279814affcba2a907a3", "src_uid": "7dbf58806db185f0fe70c00b60973f4b", "apr_id": "2c4d447b0fa36807ee6097f3e928f80d", "difficulty": 1100, "tags": ["graphs", "math", "shortest paths"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.7251552795031055, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "#include <iostream>\n#include <vector>\n#include <map>\n#include <cstring>\n#include <algorithm>\n#include <queue>\n#include <unordered_map>\nusing namespace std;\n\n#define mod 1000000007\n\ntypedef long long int lli;\n\nint getMax(int a,int b){\n    return (a>b)?a:b;\n}\n\nint getMin(int a,int b){\n    return (a<b)?a:b;\n}\n\nlli getRes(int n){\n    queue<string> q;\n    q.push(\"7\");\n    //q.push(\"8\");\n    lli res = 1;\n    while(!q.empty()){\n        string t = q.front();\n        q.pop();\n        if(t.size()+1 <= n){\n            q.push(t+\"7\");\n            q.push(t+\"8\");\n            res += 2;\n        }\n    }\n    return 2*res;\n}\n\nint main(){\n    int n;\n    cin>>n;\n    cout<<getRes(n);\n    //lli a = dfs(\"7\",n);\n    //lli b = \n    return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "5763eb2169c7e0f9b5e49df57bf79cb5", "src_uid": "f1b43baa14d4c262ba616d892525dfde", "apr_id": "36ce412eb63c1aee31785c24dc64aea2", "difficulty": 1100, "tags": ["math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6244019138755981, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "#include<iostream>\n#include<cstring>\n#include<algorithm>\nusing namespace std;\nint main ()\n{\n\tint p1,g1;\n\tint p2,g2;\n\tint hour,minute;\n\tint sum1,sum2,sum3=300;\n\tint num=0;\n\tchar ch;\n\tcin>>p1>>g1;\n\tcin>>p2>>g2;\n\tcin>>hour>>ch>>minute;\n\tsum1=hour*60+minute;\n\tsum2=sum1+g1;\n\twhile(sum3<sum2)\n\t{\n\t\tif(sum3+g2>=sum1)\n\t\t{\n\t\t\tnum++;\n\t\t\tsum3+=p1;\n\t\t}\n\t}\n\tcout<<num<<endl;\n\treturn 0;\n\n}", "lang": "GNU C++", "bug_code_uid": "0e91fe5b7ad2cf7937eb576cb23c7849", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "apr_id": "fbcd3cb52ea05987b5894beb17f66afb", "difficulty": 1600, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6855241264559068, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n#define ll long long\n\nint a, b, c, d, x, y, z;\n\nint yy() {\n\tbool w1, w2;\n\tif(a % 2 && b % 2) w1 = 1;\n\telse if(a % 2 == 0 && b % 2 == 0) w1 = 1; \n\telse w1 = 0;\n\tif(c % 2 && d % 2) w2 = 1;\n\telse if(c % 2 == 0 && d % 2 == 0) w2 = 1; \n\telse w2 = 0;\n\tif(w1 != w2) return 0;\n\tfor(int i = a, j = b; i > 0 && j > 0; i--, j--)\n\t\tif(i == c && j == d) return 1;\n\tfor(int i = a, j = b; i <= 8 && j <= 8; i++, j++)\n\t\tif(i == c && j == d) return 1;\n\tfor(int i = a, j = b; i <= 8 && j > 0; i++, j--)\n\t\tif(i == c && j == d) return 1;\n\tfor(int i = a, j = b; i > 0 && j <= 8; i--, j++)\n\t\tif(i == c && j == d) return 1;\n\treturn 2;\n}\n\nint g(int aa, int bb, int v) {\n\tint ret;\n\tif(aa == c && bb == d) return v;\n\tif(aa < c && bb < d) ret = g(aa+1, bb+1, v+1);\n\tif(aa > c && bb > d) ret = g(aa-1, bb-1, v+1);\n\tif(aa < c && bb > d) ret = g(aa+1, bb-1, v+1);\n\tif(aa > c && bb < d) ret = g(aa-1, bb+1, v+1);\n\tif(aa == c && bb > d) ret = g(a, bb-1, v+1);\n\tif(aa == c && bb < d) ret = g(a, bb+1, v+1);\n\tif(aa > c && bb == d) ret = g(a-1, bb, v+1);\n\tif(aa < c && bb == d) ret = g(a+1, bb, v+1);\n\treturn ret;\n}\n\nint main() {\n\tcin >> a >> b >> c >> d;\n\tx = !(a == c) + !(b == d);\n\ty = yy();\n\tz = g(a, b, 0);\n\tcout << x << \" \" << y << \" \" << z << endl;\n}\n", "lang": "GNU C++14", "bug_code_uid": "c4749ba2e0cc8258d18dd8bb6b868ecd", "src_uid": "7dbf58806db185f0fe70c00b60973f4b", "apr_id": "770a6b4ba31e40f38bfc58710b1131eb", "difficulty": 1100, "tags": ["graphs", "math", "shortest paths"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9994672349493873, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <iostream>\n#include <vector>\n\n#define M 100100\n#define pb push_back\n\nusing namespace std;\n\nlong n,m;\nvector<long> g[M],d[M],f(M);\nvector<bool> u(M,0),c(M,0),t(M,0);\n\nvoid read(void){\n    long a,b;\n    cin>>n>>m;\n    for(long i=1; i<=n; ++i)\n    cin>>f[i];\n    for (long i=0; i<m; ++i){\n        cin>>a>>b;\n        g[a].pb(b);\n        d[b].pb(a);\n    }\n}\n\nvoid dfs(long v){\n    c[v]=1;\n    u[v]=1;\n    for (long i=0; i<g[v].size(); ++i)\n    if (!u[g[v][i]])\n    dfs(g[v][i]);\n}\n\nvoid dfs1(long v){\n    t[v]=1;\n    u[v]=1;\n    if (f[v]!=1)\n    for (long i=0; i<d[v].size(); ++i)\n    if (!u[d[v][i]])\n    dfs1(d[v][i]);\n}\n\nint main()\n{\n    read();\n    for (long i=1; i<=n; ++i)\n    if (f[i]==1 && !c[i])\n    dfs(i);\n    fill(u.begin(), u.end(), 0);\n    for (long i=1; i<=n; ++i)\n    if (f[i]==2 && !t[i]){\n    dfs1(i);\n    for (long i=1; i<=n; ++i)\n    if (c[i] && t[i])\n    cout<<1<<\"\\n\";\n    else\n    cout<<0<<\"\\n\";\n    return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "cc43bfcc72252d56f6e49adef1b05fb9", "src_uid": "87d869a0fd4a510c5e7e310886b86a57", "apr_id": "b99050496bbba830fe53abfba48e6ea2", "difficulty": 1700, "tags": ["graphs"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.9887520085698982, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include <stdio.h>\n#include <vector>\nusing namespace std;\n\nvector<int> a[100005], b[100005];\nint la[100005] = { 0 }, lb[100005] = { 0 };\nbool aa[100005] = { 0 }, bb[100005] = { 0 };\nint s[100005] = { 0 };\n\nint main()\n{\n    int n = 0, m = 0, i = 0, x = 0, y = 0, ga = 0, gb = 0, p = 0, sz = 0;\n\n    while (scanf(\"%d%d\", &n, &m) == 2) {\n        for (i = 1; i <= n; i ++) {\n            scanf(\"%d\", s + i);\n            a[i].clear();\n            b[i].clear();\n        }\n        while (m --) {\n            scanf(\"%d%d\", &x, &y);\n            a[x].push_back(y);\n            b[y].push_back(x);\n        }\n        memset(aa, 0, sizeof(aa));\n        memset(bb, 0, sizeof(bb));\n        ga = 0;\n        gb = 0;\n        for (i = 1; i <= n; i ++) {\n            if (s[i] == 1) {\n                la[ga ++] = i;\n                aa[i] = true;\n            }\n            else if (s[i] == 2) {\n                lb[gb ++] = i;\n                bb[i] = true;\n            }\n        }\n\n        p = 0;\n        while (p < ga) {\n            x = la[p ++];\n            sz = a[x].size();\n            for (i = 0; i < sz; i ++) {\n                y = a[x][i];\n                if (!aa[y]) {\n                    aa[y] = true;\n                    la[ga ++] = y;\n                }\n            }\n        }\n\n        p = 0;\n        while (p < gb) {\n            y = lb[p ++];\n            sz = b[y].size();\n            for (i = 0; i < sz; i ++) {\n                x = b[y][i];\n                if (!bb[x]) {\n                    bb[x] = true;\n                    if (s[x] != 1) {\n                        lb[gb ++] = x;\n                    }\n                }\n            }\n        }\n\n        for (i = 1; i <= n; i ++) {\n            if (aa[i] && bb[i]) {\n                printf(\"1\\n\");\n            }\n            else {\n                printf(\"0\\n\");\n            }\n        }\n    }\n    return 0;\n}\n\n", "lang": "GNU C++", "bug_code_uid": "a8bfadff85de84921e17bd0704379cfc", "src_uid": "87d869a0fd4a510c5e7e310886b86a57", "apr_id": "c985f3c7476dc5b2629e2c2e53dc9424", "difficulty": 1700, "tags": ["graphs"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.18752253876667868, "equal_cnt": 32, "replace_cnt": 21, "delete_cnt": 6, "insert_cnt": 5, "fix_ops_cnt": 32, "bug_source_code": "#include <iostream>\n#include <string>\n#include <vector>\n#include <cstring>\n#include <map>\n#include <cmath>\n#include <algorithm>\n#include <sstream>\n#include <fstream>\n#include <set>\n#include <limits>\n#include \"print.hpp\"\n\nusing namespace std;\n\n#define all(c) (c).begin(), (c).end()\n#define iter(c) __typeof((c).begin())\n#define cpresent(c, e) (find(all(c), (e)) != (c).end())\n#define rep(i, n) for (int i = 0; i < (int)(n); i++)\n#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)\n#define pb(e) push_back(e)\n#define mp(a, b) make_pair(a, b)\n\ntypedef long long ll;\n\ntemplate<typename T>\nclass Segment {\npublic:\n  T sum;\n  T range_min;\n  T left_min;\n  T right_min;\n  T mn;\n  Segment(): sum(0),\n\t     range_min(std::numeric_limits<T>::max()),\n\t     left_min(std::numeric_limits<T>::max()),\n\t     right_min(std::numeric_limits<T>::max()),\n\t     mn(std::numeric_limits<T>::max()){}\n  Segment(T x) : sum(x), range_min(x), left_min(x), right_min(x), mn(x){}\n  Segment<T> operator=(const T& x);\n  Segment<T> operator+=(const Segment<T>& b);\nprivate:\n  T add(T a, T b);\n  void Swap(Segment<T>& tmp);\n};\n  \ntemplate <typename T>\nSegment<T> Segment<T>::operator=(const T& x) {\n  sum = x;\n  range_min = x;\n  left_min = x;\n  right_min = x;\n  mn = x;\n  return *this;\n}\n\ntemplate <typename T>\nvoid Segment<T>::Swap(Segment<T>& a) {\n  swap(sum, a.sum);\n  swap(range_min, a.range_min);\n  swap(left_min, a.left_min);\n  swap(right_min, a.right_min);\n  swap(mn, a.mn);\n}\n\ntemplate <typename T>\nT Segment<T>::add(T a, T b) {\n  T ret;\n  if(a == std::numeric_limits<T>::max() || b == std::numeric_limits<T>::max()) {\n    ret = std::numeric_limits<T>::max();\n  }else {\n    ret = a + b;\n  }\n  return ret;\n}\n\n// This operator is inspired by this code.\n// http://www.codeforces.com/contest/150/submission/1193366\ntemplate <typename T>\nSegment<T> Segment<T>::operator+=(const Segment<T>& b) {\n  Segment<T> tmp(*this);\n  tmp.sum = this->sum + b.sum;\n  tmp.range_min = min(min(this->range_min, b.range_min), this->right_min+b.left_min);\n  tmp.left_min = min(this->left_min, add(this->sum, b.left_min));\n  tmp.right_min = min(add(this->right_min, b.sum), b.right_min);\n  tmp.mn = min(this->mn, b.mn);\n  Swap(tmp);\n  return *this;\n}\n\ntemplate <typename T>\nSegment<T> operator+(const Segment<T>& a, const Segment<T>& b) {\n  Segment<T> ret(a);\n  ret += b;\n  return ret;\n}\n\n/**\n * rmq processes the following qeries \n * (1) update the value \n * (2) return the minimum value of [a, b) \n */\ntemplate<typename T>\nclass RMQ {\nprivate:\n\n  /**\n   * val : n\n   * the number of underlying sequence\n   */\n  int n;\n\n  /**\n   * val : nn\n   * nn is the minimum value which satisfies the following conditions\n   * (1) nn is some power of 2\n   * (2) n <= nn;\n   */\n  int nn;\n\n  /**\n   * function : query\n   * used in function mn below\n   */\n  Segment<T> query(int a, int b, int k, int l, int r){\n    if(r <= a || b <= l) {\n      return Segment<T>();\n    }\n    if(a <= l && r <= b) {\n      return val[k];\n    }else {\n      Segment<T> vl = query(a, b, k*2+1, l, (l+r)/2);\n      Segment<T> vr = query(a, b, k*2+2, (l+r)/2, r);\n      return vl+vr;\n    }\n  }\n\n  bool bound_check(int a, int b) {\n    if(a >= b) {\n      return false;\n    }\n    if(a < 0 || n < b) {\n      return false;\n    }\n    return true;\n  }\n  /**\n   * structure of val is as follows\n   *  where val is the undermost sequence\n   *           0\n   *      1          2\n   *    3   4     5     6\n   *   7 8 9 10 11 12 13 14\n   */\n  std::vector<Segment<T> > val;\n\npublic:\n  RMQ(int _n) : n(_n){\n    nn = 1;\n    while(n > nn) nn *= 2;\n    val.resize(nn*2-1);\n    for(size_t i = 0; i < val.size(); ++i){\n      val[i] = (std::numeric_limits<T>::max());\n    }\n  }\n  RMQ(){}\n  RMQ(const std::vector<T>& v) {\n    n = static_cast<T>(v.size());\n    nn = 1;\n    while(n > nn) nn *= 2;\n    val.resize(nn*2-1);\n    for(size_t i = 0; i < val.size(); ++i){\n      val[i] = (std::numeric_limits<T>::max());\n    }\n    for(size_t i = 0; i < v.size(); ++i) {\n      update(i, v[i]);\n    }\n  }\n\n  inline size_t size(){return n;}\n\n  /**\n   * return the value of underlying seq\n   * in the example above\n   * rmq[0+j] = val[7+j]\n   */\n  T operator[](int idx){\n    if(idx < 0 || n < idx) {\n      throw \"out of range\";\n    }\n    return val[idx+nn-1].mn;\n  }\n\n  /**\n   * update the value so that rmq[i] = x \n   */\n  void update(int i, T x){\n    if(i < 0 || n < i) {\n      throw \"out of range\";\n    }\n    i += nn-1;\n    val[i] = x;\n    while(i > 0){\n      i = (i-1)/2;\n      val[i] = val[i*2+1] + val[i*2+2];\n    }\n  }\n\n  /**\n   * return the minimum value in rmq[a,b)\n   */\n  T mn(int a, int b){\n    if(!bound_check(a, b)) {\n      throw \"invalid range\";\n    }\n    return query(a, b, 0, 0, nn).mn;\n  }\n\n  /**\n   * return min_{a<=i<j<b} sum[i,j)\n   */\n  T range_min(int a, int b){\n    if(!bound_check(a, b)) {\n      throw \"invalid range\";\n    }\n    return query(a, b, 0, 0, nn).range_min;\n  }\n\n  /**\n   * return sum[a,b)\n   */\n  T sum(int a, int b){\n    if(!bound_check(a, b)) {\n      return T();\n    }\n    return query(a, b, 0, 0, nn).sum;\n  }\n};\n\nconst static int inf = 10000000;\nconst static int mod = 1000000007;\n\nvector<vector<int> > stat;\nvector<int> a;\nvector<int> ans_f;\nvector<int> ans_t;\n\nvoid go(int from, int to, int level, RMQ<int>& rmq) {\n  //  cout << \"go \" << from << \" \" << to << \" \" << level << endl;\n  if(from >= to) {\n    return;\n  }\n  if(from+1 == to) {\n    rep(i, a[from]-level) {\n      ans_f.pb(from);\n      ans_t.pb(from);\n    }\n    return;\n  }\n  int mn = rmq.mn(from, to);\n  //  cout << \"mn : \" << mn << endl;\n  //  print(stat[mn]);\n  rep(i, mn-level) {\n    ans_f.pb(from);\n    ans_t.pb(to-1);\n  }\n  int pos_f = lower_bound(stat[mn].begin(), stat[mn].end(), from) - stat[mn].begin(); \n  int pos_t = upper_bound(stat[mn].begin(), stat[mn].end(), to) - stat[mn].begin();\n  //  cout << \"pos result : \" << pos_f << \" \" << pos_t << endl;\n\n  if(from < stat[mn][pos_f]) {\n    go(from, stat[mn][pos_f], mn, rmq);\n  }\n  for(int i = pos_f; i < pos_t-1; ++i) {\n    //    cout << \"pos : \" <<  i << endl;\n    go(stat[mn][i]+1, stat[mn][i+1], mn, rmq);\n  }\n  if(stat[mn][pos_t-1]+1 < to) {\n    go(stat[mn][pos_t-1]+1, to, mn, rmq);\n  }\n}\n\nint main(){\n  int n;\n  while(cin >> n){\n    stat.clear(); stat.resize(111111);\n    a.clear(); a.resize(n);\n    ans_f.clear();\n    ans_t.clear();\n    RMQ<int> rmq(n);\n\n    //    print(stat);\n    rep(i, n) {\n      cin >> a[i];\n      stat[a[i]].pb(i);\n      rmq.update(i, a[i]);\n    }\n    go(0, n, 0, rmq);\n    cout << ans_f.size() << endl;\n    rep(i, ans_f.size()) {\n      cout << ans_f[i]+1 << \" \" << ans_t[i]+1 << endl;\n    }\n    //    cout << endl;\n  }\n  return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "b02629e33a1787eb97e1505a3d49e9a0", "src_uid": "87d869a0fd4a510c5e7e310886b86a57", "apr_id": "d7fc527185bbde69c3aeaf5e71f729e7", "difficulty": 1700, "tags": ["graphs"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.3468251021165986, "equal_cnt": 21, "replace_cnt": 16, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 20, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n\n#define debug\n\n#define ll long long\n#define pii pair<int,int>\n#define pdd pair<double,double>\n#define ldouble long double\nconst ll MOD = 1e9+7;\nconst int INF = 0x7f7f7f7f;\nconst ll INFLL = 0x7f7f7f7f7f7f7f7f;\n\n#define End return 0; }\n#define of ios::sync_with_stdio(0); cin.tie(0);\n#define story int main() {\n#define The\n\nint dfs(int curr, int prev, const vector<vector<pair<int,int>>>& graph, const set<int>& bad, set<int>& ans, vector<bool>& visited) {\n\tif (visited[curr])\n\t\treturn 0;\n\tvisited[curr] = true;\n\tint pc = 0;\n\tif (bad.count(curr))\n\t\tpc = 1;\n\tfor (pair<int,int> neighbour: graph[curr]) {\n\t\tif (neighbour.first == prev) continue;\n\t\tint temp = dfs(neighbour.first, curr, graph, bad, ans, visited);\n\t\t// keep even weighted edges\n\t\t//cerr << \"got \" << temp << \" from \" << neighbour.first+1 << endl;\n\t\tif (temp%2 == 0) {\n\t\t\tans.insert(neighbour.second);\n\t\t}\n\t\tpc += temp;\n\t}\n\t//cerr << \"visit \" << curr+1 << \", return \" << pc << endl;\n\treturn pc;\n}\n\nThe story of lame:\n\n\tint n, m;\n\tcin >> n >> m;\n\tset<int> bad;\n\t// neighbour, index\n\tvector<vector<pair<int,int>>> graph(n);\n\tint residue[n];\n\tint wild = -1;\n\tfor (int i = 0; i < n; i++) {\n\t\tcin >> residue[i];\n\t\tif (residue[i] == -1)\n\t\t\twild = i;\n\t}\n\tint a, b;\n\tfor (int i = 0; i < m; i++) {\n\t\tcin >> a >> b;\n\t\tgraph[a-1].push_back(pair<int,int>(b-1, i+1));\n\t\tgraph[b-1].push_back(pair<int,int>(a-1, i+1));\n\t}\n\t// count bad\n\tfor (int i = 0; i < n; i++) {\n\t\tif (residue[i] != -1 && graph[i].size()%2 != residue[i])\n\t\t\tbad.insert(i);\n\t}\n\tif (bad.size()%2 == 1) {\n\t\tif (wild == -1) {\n\t\t\tcout << -1 << endl;\n\t\t\treturn 0;\n\t\t}\n\t\telse {\n\t\t\tbad.insert(wild);\n\t\t}\n\t}\n\t//cerr << \"bad: \"; for(int it: bad) //cerr << it+1 << \" \"; //cerr << endl;\n\tif (bad.empty()) {\n\t\tcout << m << endl;\n\t\tfor (int i = 1; i <= m; i++)\n\t\t\tcout << i << endl;\n\t}\n\telse {\n\t\t// dfs\n\t\tset<int> ans;\n\t\tvector<bool> visited(n);\n\t\tdfs(*bad.begin(), -1, graph, bad, ans, visited);\n\t\tcout << ans.size() << endl;\n\t\tfor (int e: ans)\n\t\t\tcout << e << endl;\n\t}\n\nThe End\n", "lang": "GNU C++14", "bug_code_uid": "a1454ae2ae590c723fd04e7d2b655969", "src_uid": "ceb3807aaffef60bcdbcc9a17a1391be", "apr_id": "8ea124958329a80d7e0c8ebc616c70ad", "difficulty": 900, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9563409563409564, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include<bits/stdc++.h>\n\nusing namespace std;\n\nlong long kq=0,\nint n,j=1;\n\nint main()\n{\n    ios_base::sync_with_stdio(0);\n    cin.tie(0); cout.tie(0);\n    cin >> n;\n    for(int i=1; i<=n-2; i++) kq+=(long long)j*(j+1),j++;\n    cout << kq;\n}\n", "lang": "GNU C++14", "bug_code_uid": "6a02680dcbbb66d0dbbe6ff09f762c75", "src_uid": "1bd29d7a8793c22e81a1f6fd3991307a", "apr_id": "0b3e77a5a5c711e330c08addd0e8ebfb", "difficulty": 1200, "tags": ["dp", "math", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.5701271588536724, "equal_cnt": 16, "replace_cnt": 13, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 16, "bug_source_code": "#include<bits/stdc++.h>\n\n#include <ext/pb_ds/assoc_container.hpp>\nusing namespace __gnu_pbds;\n\nusing namespace std;\n\n#define endl '\\n'\n#define all(C) C.begin(),C.end()\n#define allr(C) C.rbegin(),C.rend()\n#define PB push_back\n#define EB emplace_back\n#define present(container, element) (container.find(element) != container.end())\n#define spresent(container, element) (container.find(element) != std::string::npos)\n#define cpresent(container, element) (find(all(container),element) != container.end())\n#define MOD 1000000007\n\n//New Macros\n#define F first\n#define S second\n#define REP(i,a,b) for(int i=a;i<=b;i++)\n\ntypedef int64_t ll;\ntypedef vector<int> vi;\ntypedef vector<vi> vvi;\ntypedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;\n\nvoid lscan(ll &num) {\n\tbool n = false;\n\tnum = 0;\n\tregister int c = _getchar_nolock();\n\n\tif (c == '-') {\n\t\tn = true;\n\t\tc = getchar();\n\t}\n\tfor (; c>47 && c<58; c = _getchar_nolock())\n\t\tnum = num * 10 + c - 48;\n\tif (n)\n\t\tnum *= -1;\n}\n\n// a*b%c\nll mulmod(ll a, ll b, ll c) {\n\tll x = 0, y = a%c;\n\twhile (b > 0) {\n\t\tif (b & 1)\n\t\t\tx = (x + y) % c;\n\t\ty = (y << 1) % c;\n\t\tb >>= 1;\n\t}\n\treturn x%c;\n}\n\n//a^b%c\nll expmod(ll a, ll b, ll c) {\n\tif (b) {\n\t\tif (b & 1)\n\t\t\treturn mulmod(a, expmod(a, b - 1, c), c);\n\t\telse\n\t\t\treturn expmod(mulmod(a, a, c), b >> 1, c);\n\t}\n\telse {\n\t\treturn 1;\n\t}\n}\n\nint main() {\n\t/*cout << \"Hello World!\" << endl;\n\tcout << expmod(2, 5, MOD);\n\t*/\n\tll N,sum=9,cache;\n\tlscan(N);\n\tint rem;\n\tpair<char,int> temp;\n\tvector<pair<char,int> >vec(ll(1e8),{'3',0});\n\tfor(int i=0;i<10;i++){\n\t\tvec[i].F='1';\n\t\tvec[i].S=1<<(i+1);\n\t}\n\tif(N>9){\n\t\tfor(ll i=10;i<=N;i++ ){\n\t\t\tcache = i/10;\n\t\t\trem = i%10;\n\t\t\ttemp = vec[cache-1];\n\t\t\tif(temp.F == '3'){\n\t\t\t\ti+=9;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tif(temp.F == '1'){\n\t\t\t\t\trem = 1<<rem;\n\t\t\t\t\tif(temp.S & rem){\n\t\t\t\t\t\tif(i<=ll(1e8)){\n\t\t\t\t\t\t\tvec[i-1]={'1',temp.S};\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tif(i<=ll(1e8)){\n\t\t\t\t\t\t\tvec[i-1]={'2',temp.S|rem};\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tsum++;\n\t\t\t\t}\n\t\t\t\telse if (temp.F == '2'){\n\t\t\t\t\trem = 1<<rem;\n\t\t\t\t\tif(temp.S & rem){\n\t\t\t\t\t\tif(i<=ll(1e8)){\n\t\t\t\t\t\t\tvec[i-1]={'2',temp.S};\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsum++;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tif(i<=ll(1e8)){\n\t\t\t\t\t\t\tvec[i-1]={'3',0};\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t// for(int i=0;i<N;i++){\n\t// \tcout<<i+1<<\" - \"<<vec[i].F<<' '<<vec[i].S<<endl;\n\t// }\n\tcout<<sum<<endl;\n\treturn 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "0209f98aa9bca8fdab56b28dd5d31177", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "apr_id": "56873ae0ab0aab0f616d7a46ad12bcf9", "difficulty": 1600, "tags": ["dfs and similar", "brute force", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.7532836350727724, "equal_cnt": 5, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "\n\n#include <iostream>\n#include<bits/stdc++.h>\n#include<math.h>\nusing namespace std;\ntypedef long long ll;\n#define pb push_back\n#define fro(i,a,b) for(int i=a;i<b;i++)\n#define all(v) v.begin(),v.end()\n#define PI              acos(-1.0)\n#define vi vector<int>\n#define mp make_pair\nbool isPrime(int n)\n{\n    // Corner cases\n    if (n <= 1)  return false;\n    if (n <= 3)  return true;\n\n    // This is checked so that we can skip\n    // middle five numbers in below loop\n    if (n%2 == 0 || n%3 == 0) return false;\n\n    for (int i=5; i*i<=n; i=i+6)\n        if (n%i == 0 || n%(i+2) == 0)\n           return false;\n\n    return true;\n}\nll gcd(ll a, ll b)\n{\n    if(b==0)\n        return a;\n    else\n        return gcd(b,a%b);\n}\nbool sortbysec(const pair<int,int> &a,\n              const pair<int,int> &b)\n{\n    return (a.second < b.second);\n}\n\nint main(){\n\tios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);\n    std::cout.precision(15);\n    //freopen(\"input.txt\",\"r\",stdin);\n    //freopen(\"output.txt\",\"w\",stdout);\n    ll p,d;\n    cin >> p >> d;\n    int n = ((p%10)+1)%10;\n    vector<ll> v;\n    for(ll i=n;i<=d;i=i+10)\n    {\n        v.pb(p-i);\n    }\n    int m=0; ll ans=p;\n    for(ll i=0;i<v.size();i++)\n    {\n        ll x=v[i];\n        int c=0;\n        while(x>0 && x%10==9)\n        {\n            c++;\n            x=x/10;\n        }\n        if(c>m)\n           {\n               m=c;\n               ans=v[i];\n           }\n        else if(m==c)\n            {\n                if(v[i]>ans)\n                    ans=v[i];\n            }\n    }\n    cout << ans;\n}\n\n\n", "lang": "GNU C++17", "bug_code_uid": "8a36295dfe9ababdb6cbc3602213d852", "src_uid": "c706cfcd4c37fbc1b1631aeeb2c02b6a", "apr_id": "b2a94f71b3cfb2705faa73b5d73eaf30", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.09302325581395349, "equal_cnt": 10, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 10, "bug_source_code": "#include<iostream>\n#include<vector>\n#include<algorithm>\n#include<unordered_map>\nusing namespace std;\nunordered_map<int, int> mp;\nvector<int> g[10]; vector<int> G[10];\nstruct node\n{\n\tint id; int s; int cd;\n};\nbool cmp(node a, node b)\n{\n\treturn a.s > b.s;\n}\nnode k[10];\nint main()\n{\n\tint n; int m; cin >> n >> m;\n\tfor (int i = 1; i <= m; i++)\n\t{\n\t\tint x; int y; cin >> x >> y; g[x].push_back(y);\n\t}\n\tint ans = 0;\n\tfor (int i = 1; i <= n; i++)\n\t{\n\t\tk[i].id = i; k[i].s = g[i].size();\n\t}\n\tsort(k + 1, k + n+1, cmp);\n\tfor (int i = 1; i <= n; i++)\n\t{\n\t\tmp[k[i].id] = i;\n\t}\n\tfor (int i = 1; i <= n; i++)\n\t{\n\t\tfor (int j = 0; j < g[i].size(); j++)\n\t\t{\n\t\t\tG[mp[i]].push_back(mp[g[i][j]]);\n\t\t}\n\t}\n\tint flag = 0;\n\tfor (int i = 1; i <= n; i++)\n\t{\n\t\tfor (int j = 0; j < g[i].size(); j++)\n\t\t{\n\t\t\tif (G[i][j] < 7)ans++;\n\t\t\tif (G[i][j] == 7)flag = 1;\n\t\t}\n\t}\n\tcout << ans + flag;\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "ee0145a0897634bc8dbf59b5c6cf312d", "src_uid": "11e6559cfb71b8f6ca88242094b17a2b", "apr_id": "82ee008d8138ac1ef8409b0057f1edf9", "difficulty": 1700, "tags": ["graphs", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.7573529411764706, "equal_cnt": 44, "replace_cnt": 43, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 43, "bug_source_code": "#include <bits/stdc++.h>\n \nusing namespace std;\n \n#define FAST ios_base::sync_with_stdio(0);cin.tie(0);\n#define MOD  1000000007\n\nint Result = 0;\n\nvoid DFS(int Idx, vector<vector<int> >& Adj, vector<int>& Temp, vector<int>& Set)\n{\n    int i, j;\n    \n    if(Idx == Temp.size())\n    {\n        j = 0;\n        for(i = 0; i < Set.size(); i++)\n        {\n            if(Set[i])\n            {\n                j++;\n            }\n        }\n        \n        Result = max(Result, j);\n        return;\n    }\n    \n    for(i = 0; i < 6; i++)\n    {\n        vector<int> Temp1 = Set;\n        Temp[Idx] = i;\n        \n        for(j = 0; j < Idx; j++)\n        {\n            if(Adj[Idx][j])\n            {\n                Temp1[((min(Temp[Idx], Temp[j]) * Temp.size()) + max(Temp[Idx], Temp[j]))] = 1;\n            }\n        }\n        \n        DFS((Idx + 1), Adj, Temp, Temp1);\n    }\n}\n\nint main()\n{\n    FAST;\n    //mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count());\n    \n    int N, M;\n    cin >> N >> M;\n    \n    vector<vector<int> > Adj(N, vector<int>(N));\n    \n    int i;\n    for(i = 0; i < M; i++)\n    {\n        int a, b;\n        cin >> a >> b;\n        \n        a--;\n        b--;\n        \n        Adj[a][b] = 1;\n        Adj[b][a] = 1;\n    }\n    \n    vector<int> Temp(N);\n    vector<int> Set(N * N);\n    \n    DFS(0, Adj, Temp, Set);\n    \n    cout << Result << endl;\n    return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "0aaee2afe1f09f00139380f8ae881579", "src_uid": "11e6559cfb71b8f6ca88242094b17a2b", "apr_id": "cc9b51128c0d163f4d43ee01f50703f8", "difficulty": 1700, "tags": ["graphs", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.973186119873817, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\n#define ll long long int \ntypedef pair<int, int> pi;\ntypedef pair<pi, int> ppi;\n//const int M = 100;\nconst int M = 1000000007;\n#define PI 3.14159265358979\nint n, m, k, dots = 0, cou = 0, yes = 0, d, r;\nint a, b;\n\nint main()\n{\n \n#ifndef ONLINE_JUDGE\n\tfreopen(\"input.txt\", \"r\", stdin);\n\tfreopen(\"output.txt\", \"w\", stdout);\n#endif\n\tios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);\n\tint i, lim, q, p,mn = INT_MAX, mx = INT_MIN,j,x,y, t, sum = 0, sal = 0, ii, jj, cnt= 0;\n\t\n\tcin >> n;\n\tif(n % 2 == 0)\n\t{\n\t\tcout << \"white\" << endl;\n\t\tif(n == 2)\n\t\t\tcout << \"1 2\";\n \t}\n \telse\n \t\tcout << \"black\" ;\n\t\n}\t ", "lang": "GNU C++17", "bug_code_uid": "5c28316f4e37c03bf89af79453049451", "src_uid": "52e07d176aa1d370788f94ee2e61df93", "apr_id": "f6e6a6bc9d9557d49d1d698b8c4615ec", "difficulty": 1700, "tags": ["math", "games", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9841017488076311, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "//============================================================================\n// Name        : Collecting.cpp\n// Author      : \n// Version     :\n// Copyright   : Your copyright notice\n// Description : Hello World in C++, Ansi-style\n//============================================================================\n\n#include <iostream>\nusing namespace std;\n\nint main() {\nint k,count[10];\nchar c[4][4];\ncin>>k;\nfor(int i=0;i<4;i++){\n\tfor(int j=0;j<4;i++){\n\tcin>>c[i];\n\tif(c[i][j]=='.')continue;\n\telse {\n\t\tcount[c[i][j]-'0']++;\n\t}\n\n}}\n\nfor(int i=0;i<9;i++){\nif(k*2<count[i]){\n\tcout<<\"NO\";\n\treturn 0;\n}\n}\ncout<<\"YES\";\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "47ee0ee1bcc54e3f6657db19e91b6a18", "src_uid": "5fdaf8ee7763cb5815f49c0c38398f16", "apr_id": "96c92c4fd86077ddc07669a2037c3e03", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9984076433121019, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "#include <cstdio>\n#include <cstdlib>\n#include <map>\n#include <cmath>\n#include <iostream>\n#include <algorithm>\nusing namespace std;\ntypedef long long int ll;\nint main(){\n    while(true){\n        int x,y,z,xx[1000000/2+5],i,te;\n        scanf(\"%d%d%d\",&x,&y,&z);        \n        for(i=0; i<=(x+1)/2; i++){\n            int ii=x-i;\n            int ss=y-i,ss2=z-i;\n            //printf(\"  %d %d %d\\n\",i,ss,ii);\n            if(ii<0||ss<0)goto v;\n            if(z-ss == ii){\n                printf(\"%d %d %d\\n\",i,ss,ii);\n                goto z3;\n            }\n            v:\n            if(ss2<0)continue;    \n            if(y-ss2 == ii){\n                printf(\"%d %d %d\\n\",ii,ss2,i);\n                goto z3;\n            }               \n        }\n        /*te = x;x=y;y=z;z=te;\n        for(i=1; i<=(x+1)/2; i++){\n            int ii=x-i;\n            int ss=y-i,ss2=z-i;\n            //printf(\"  %d %d %d\\n\",i,ss,ii);\n            if(ii<0||ss<0)goto v2;\n            if(z-ss == ii){\n                printf(\"%d %d %d\\n\",ss,ii,i);\n                goto z3;\n            }\n            v2:\n            if(ss2<0)continue;    \n            if(y-ss2 == ii){\n                printf(\"%d %d %d\\n\",ss2,i,ii);\n                goto z3;\n            }               \n        }\n         te = x;x=y;y=z;z=te;\n        for(i=1; i<=(x+1)/2; i++){\n            int ii=x-i;\n            int ss=y-i,ss2=z-i;\n            //printf(\"  %d %d %d\\n\",i,ss,ii);\n            if(ii<0||ss<0)goto v3;\n            if(z-ss == ii){\n                printf(\"%d %d %d\\n\",i,ii,ss);\n                goto z3;\n            }\n            v3:\n            if(ss2<0)continue;    \n            if(y-ss2 == ii){\n                printf(\"%d %d %d\\n\",i,ii,ss2);\n                goto z3;\n            }               \n        }*/                \n        printf(\"Impossible\\n\");\n        z3:\n          continue;\n    }\n    return 0;\n}\n        \n            \n", "lang": "GNU C++", "bug_code_uid": "7f65c576e6142993758b6d812f20b593", "src_uid": "b3b986fddc3770fed64b878fa42ab1bc", "apr_id": "691d0a6d20b88fa16969843f4b4c95f7", "difficulty": 1200, "tags": ["graphs", "math", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9972602739726028, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include <iostream>\n#include <cmath>\n#include <string>\nusing namespace std;\n\nint main()\n{\n\tint n, a[999], b[999];\n\tint count;\n\tcin >> n;\n\t// delete zero number after...\n\twhile (n % 10 == 0)\n\t{\n\t\tn /= 10;\n\t}\n\tint n1 = n;\n\t// change posible among number...\n\tint i = 0;\n\twhile (n > 0)\n\t{\n\t\ta[i] = n % 10;\n\t\tn /= 10;\n\t\ti++;\n\t}\n\t// count ...\n\twhile (n1 > 0)\n\t{\n\t\tn1 /= 10;\n\t\tcount++;\n\t}\n\tfor (int j = 0; j < count; ++j)\n\t{\n\t\tb[j] = a[count - j - 1];\n\t}\n\tint ck = 0;\n\tfor (int j = 0; j < count; ++j)\n\t{\n\t\tif (a[j] - b[j] == 0)\n\t\t{\n\t\t\tck += 0;\n\t\t}\n\t\telse\n\t\t\tck++;\n\t\t/*cout << \"a[\" << j << \"] = \" << a[j];\n\t\tcout << endl;\n\t\tcout << \"b[\" << j << \"] = \" << b[j];\n\t\tcout << endl;*/\n\t}\n\tif (ck == 0)\n\t\tcout << \"YES\";\n\telse\n\t\tcout << \"NO\";\n}", "lang": "GNU C++11", "bug_code_uid": "d2d58c0a820aeaf892b02ffa8e06c216", "src_uid": "d82278932881e3aa997086c909f29051", "apr_id": "9bb41cc70e952043c960ea6e5456050f", "difficulty": 900, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9765747006767309, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n#define file \"yzy\"\ntypedef long long ll;\nint read(){\n\tchar c=getchar();\n\twhile(c<'0' || c>'9')\n\t\tc=getchar();\n\tint x=0;\n\twhile(c>='0' && c<='9'){\n\t\tx=x*10+c-'0';\n\t\tc=getchar();\n\t}\n\treturn x;\n}\nconst int mod=1000000007;\nll pw[300002];\nll dp[505][505],coff[505];\nint main(){\n\t//freopen(file\".in\",\"r\",stdin);\n\t//freopen(file\".out\",\"w\",stdout);\n\tint n,m;\n\tscanf(\"%d%d\",&n,&m);\n\tpw[0]=1;\n\tfor(int i=1;i<=n*n;i++)\n\t\tpw[i]=pw[i-1]*2%mod;\n\tfor(int i=1;i<=n;i++){\n\t\tfor(int j=i+1;j<=n;j++)\n\t\t\tcoff[j]=pw[(j-i-1)*i]*(pw[j]-pw[i])%mod;\n\t\tdp[i][1]=(dp[i][1]+pw[i]-1)%mod;\n\t\tfor(int j=1;j<=i;j++)\n\t\t\tif (dp[i][j]){\n\t\t\t\t//printf(\"dp[%d][%d]=%d\\n\",i,j,dp[i][j]);\n\t\t\t\tfor(int k=i+1;k<=n;k++)\n\t\t\t\t\tdp[k][j+1]=(dp[k][j+1]+dp[i][j]*coff[k])%mod;\n\t\t\t}\n\t}\n\tfor(int i=1;i<=n;i++)\n\t\tans=(ans+dp[i][m]*pw[(n-i)*i])%mod;\n\tprintf(\"%lld\\n\",(ans%mod+mod)%mod);\n\t//fprintf(stderr,\"%.5f\",(double)clock()/CLOCKS_PER_SEC);\n}", "lang": "GNU C++17", "bug_code_uid": "69cf9f671be37538e07c2c9ef9e86bce", "src_uid": "111673158df2e37ac6c019bb99225ccb", "apr_id": "9ee87e3ede0927ef76573885762c148e", "difficulty": 2500, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9996497373029772, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <bits/stdc++.h>\n \nusing namespace std;\n \nconst int MAXN = 503;\nconst long long MOD = 1e9 + 7;\n\nint n, k;\nvoid read()\n{\n\tcin >> n >> k;\n}\n \nlong long dp[MAXN][MAXN], next_dp[MAXN][MAXN], suffix_dp[MAXN][MAXN];\nlong long pow2[MAXN];\n\nlong long add(long long a, long long b)\n{\n\ta += b;\n\n\tif (a >= MOD)\n\t\ta -= MOD; \n\n\treturn a;\n}\ni\nvoid solve()\n{\n\tpow2[0] = 1;\n\tfor (int i = 1; i < MAXN; i++)\n\t\tpow2[i] = pow2[i-1] * 2 % MOD;\n\n\tdp[1][1] = dp[0][2] = 1; \n\tfor (int i = 0; i <= k; i++)\n\t\tfor (int j = n + 1; j >= 1; j--)\n\t\t\tsuffix_dp[i][j] = suffix_dp[i][j + 1] + dp[i][j];\n\n\tfor (int i = 2; i <= n; i++)\n\t{\n\t\tmemset(next_dp, 0, sizeof(next_dp));\n\n\t\tnext_dp[0][i + 1] = 1;\n\t\tfor (int j = 1; j <= k; j++)\n\t\t\t{\n\t\t\t\tfor (int p = 2; p <= i; p++)\n\t\t\t\t\tnext_dp[j][p] = dp[j][p-1] * pow2[i - p + 1] % MOD; \n \n\t\t\t\tfor (int l = i; l >= 1; l--)\n\t\t\t\t\t\tnext_dp[j][1] = add(next_dp[j][1], pow2[l - 1] * suffix_dp[j-1][i - l + 1] % MOD);  \n\t\t\t}\n\n\t\tfor (int j = 0; j <= k; j++)\n\t\t\tfor (int p = 0; p <= i + 1; p++)\n\t\t\t\tdp[j][p] = next_dp[j][p];\n\t    \n\t\tmemset(suffix_dp, 0, sizeof(suffix_dp));\n\n\t\tfor (int i = 0; i <= k; i++)\n\t\t\tfor (int j = n + 1; j >= 1; j--)\n\t\t\t\tsuffix_dp[i][j] = add(suffix_dp[i][j + 1], dp[i][j]);\n\t}\n \n\tint ans = 0;\n \n\tfor (int i = 1; i <= n + 1; i++)\n\t\tans = add(ans, dp[k][i]);\n \n\tcout << ans << endl;\n}\n \nint main()\n{\n\tios_base::sync_with_stdio(false);\n\tcin.tie(nullptr);\n\tcout.tie(nullptr);\n \n\tread();\n\tsolve();\n}\n", "lang": "GNU C++17", "bug_code_uid": "8a90696343941bcc931a7a6b82416094", "src_uid": "111673158df2e37ac6c019bb99225ccb", "apr_id": "5a1a5b5ebafdb074d031a8b15aed4c48", "difficulty": 2500, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.9982517482517482, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include<iostream>\n#include<iomanip>\n#include<cstring>\n#include<cmath>\n#include<cstdio>\n#include<queue>\n#include<algorithm>\nusing namespace std;\nconst int mod=998244353;\nconst int maxn=4001;\nint n,l,k;\nint dp[2005][2005][2];\nlong long fir[4005],inv[4005];\nint adds(int v)\n{\n\treturn (v>=mod)?v-mod:v;\n}\nlong long ksm(long long x,long long n)\n{\n\tlong long ans=1;\n\twhile(n)\n\t{\n\t\tif(n&1) ans=ans*x%mod;\n\t\tx=x*x%mod;\n\t\tn>>=1;\n\t}\n\treturn ans;\n}\nvoid pre()\n{\n\tfir[0]=1;\n\tfor(int i=1;i<=maxn;i++) fir[i]=fir[i-1]*i%mod;\n\tinv[maxn]=ksm(fir[maxn],mod-2)%mod;\n\tfor(int i=maxn-1;i>=0;i--) inv[i]=inv[i+1]*(i+1)%mod;\n}\nlong long C(int n,int m)\n{\n\treturn fir[n]*inv[m]%mod*inv[n-m]%mod;\n}\nint main()\n{\n\tpre();\n\tscanf(\"%d%d%d\",&n,&k,&l);\n\tdp[0][0][0]=1;\n\tfor(int i=0;i<=n;i++)\n\tfor(int j=0;j<=i;j++)\n\tfor(int op=0;op<=1;op++)\n\t{\n\t\tif(!dp[i][j][op]) continue;\n\t\tif(j<i) dp[i][j+1][op]=adds(dp[i][j+1][op]+dp[i][j][op]*(i-j)%mod);\n\t\tif(i<n) dp[i+1][j][op]=adds(dp[i+1][j][op]+dp[i][j][op]);\n\t\tif(!op&&i-j>=k) dp[i][j][op+1]=adds(dp[i][j][op+1]+dp[i][j][op]);\n\t}\n\tlong long ans=dp[n][n][1]*ksm(2,n)%mod*fir[n]%mod*inv[2*n+1]%mod*l%mod;\n\tprintf(\"%lld\\n\",ans);\n}", "lang": "GNU C++11", "bug_code_uid": "f5cbe2549ec98463d64eb4aedac5c3dd", "src_uid": "c9e79e83928d5d034123ebc3b2f5e064", "apr_id": "3ca28e90c1fa4b43c37259390dee1638", "difficulty": 2600, "tags": ["dp", "math", "combinatorics", "probabilities"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.700234691700448, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "#include<cstdio>\n#include<algorithm>\n#include<cstring>\n#define ll long long\nusing namespace std;\nconst ll MOD=998244353;\nll quick_pow(ll x,ll a)\n{\n\tll ans=1;\n\twhile(a)\n\t{\n\t\tif(a&1)ans=ans*x%MOD;\n\t\tx=x*x%MOD;\n\t\ta>>=1;\n\t}\n\treturn ans;\n}\nll f[4005],g[4005],pow1[2005][4005],pow2[2005][4005],c[2005][2005];\nint n,k,l;\nint limit,L,r[10005];\nll omega[2][21][1<<20];\nvoid pre()\n{\n\tfor(int mid=1,i=0;i<=20;mid<<=1,i++)\n\t{\n\t\tll w1=quick_pow(3,(MOD-1)/(mid<<1));\n\t\tll w2=quick_pow(3,MOD-1-(MOD-1)/(mid<<1));\n\t\tomega[0][i][0]=omega[1][i][0]=1;\n\t\tfor(int k=1;k<mid;k++)\n\t\t{\n\t\t\tomega[1][i][k]=omega[1][i][k-1]*w1%MOD;\n\t\t\tomega[0][i][k]=omega[0][i][k-1]*w2%MOD;\n\t\t}\n\t}\n}\nvoid NTT(ll*A,int type) \n{\n\tfor(int i=0;i<limit;i++)\n\t  if(i<r[i])swap(A[i],A[r[i]]);\n\tif(type==-1)type=0;\n\tfor(int mid=1,i=0;mid<limit;mid<<=1,i++)\n\t{\n\t\tfor(int R=mid<<1,j=0;j<limit;j+=R)\n\t\t{\n\t\t\tfor(int k=0;k<mid;k++)\n\t\t\t{\n\t\t\t\tll x=A[j+k]%MOD,y=omega[type][i][k]*A[j+mid+k]%MOD;\n\t\t\t\tA[j+k]=x+y;\n\t\t\t\tA[j+mid+k]=x-y;\n\t\t\t}\n\t\t}\n\t}\n\tfor(int i=0;i<limit;i++)\n\t{\n\t\tA[i]%=MOD;\n\t\tif(A[i]<0)A[i]+=MOD;\n\t}\n\tif(type==0)\n\t{\n\t\tll inv=quick_pow(limit,MOD-2);\n\t\tfor(int i=0;i<limit;i++)A[i]=A[i]*inv%MOD;\n\t}\n}\nll tmp1[10005],tmp2[10005];\nint main()\n{\n\tpre();\n\tscanf(\"%d%d%d\",&n,&k,&l);\n\tlimit=1,L=0;\n\twhile(limit<(2*n))limit<<=1,L++;\n\tfor(int i=0;i<limit;i++)\n\t  r[i]=(r[i>>1]>>1)|((i&1)<<(L-1));\n\tc[0][0]=1;\n\tfor(int i=0;i<=n;i++)\n\tfor(int j=0;j<=n;j++)\n\t{\n\t\tif(c[i][j]>=MOD)c[i][j]-=MOD;\n\t\tc[i+1][j+1]+=c[i][j];\n\t\tc[i+1][j]+=c[i][j];\n\t}\n\tpow1[0][0]=1;\n\tfor(int i=1;i<=n;i++)\n\t{\n\t\tfor(int x=i-1;x<=(i-1)*2;x++)\n\t\t{\n\t\t\tpow1[i][x+1]+=2*pow1[i-1][x];\n\t\t\tpow1[i][x+2]-=2*pow1[i-1][x];\n\t\t}\n\t\tfor(int x=i;x<=i*2;x++)\n\t\t{\n\t\t\tpow1[i][x]%=MOD;\n\t\t\tif(pow1[i][x]<0)pow1[i][x]+=MOD;\n\t\t}\n\t}\n\tpow2[0][0]=1;\n\tfor(int i=1;i<=n;i++)\n\t{\n\t\tfor(int x=0;x<=(i-1)*2;x++)\n\t\t{\n\t\t\tpow2[i][x]+=pow2[i-1][x];\n\t\t\tpow2[i][x+1]-=2*pow2[i-1][x];\n\t\t\tpow2[i][x+2]+=2*pow2[i-1][x];\n\t\t}\n\t\tfor(int x=0;x<=i*2;x++)\n\t\t{\n\t\t\tpow2[i][x]%=MOD;\n\t\t\tif(pow2[i][x]<0)pow2[i][x]+=MOD;\n\t\t}\n\t}\n\tfor(int i=k;i<=n;i++)\n\t{\n\t\tfor(int j=0;j<=2*n;j++)\n\t\t{\n\t\t\ttmp1[j]=pow1[i][j];\n\t\t\ttmp2[j]=pow2[n-i][j];\n\t\t}\n\t\tfor(int j=2*n+1;j<limit;j++)tmp1[j]=tmp2[j]=0;\n\t\tNTT(tmp1,1);\n\t\tNTT(tmp2,1);\n\t\tfor(int j=0;j<limit;j++)\n\t\t  tmp1[j]=tmp1[j]*tmp2[j]%MOD;\n\t\tfor(int j=0;j<limit;j++)\n\t\t  f[j]=(f[j]+tmp1[j]*c[n][i])%MOD;\n\t}\n\tNTT(f,-1);\n\tll ans=0;\n\tfor(int i=0;i<=2*n;i++)\n\t  ans+=quick_pow(i+1,MOD-2)*f[i]%MOD;\n\tans%=MOD;\n\tif(ans<0)ans+=MOD;\n\tprintf(\"%I64d\\n\",ans*l%MOD);\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "fa628d83c5b6df8327865a93557ae9b1", "src_uid": "c9e79e83928d5d034123ebc3b2f5e064", "apr_id": "768e6414e8af2a53934d67550f1f9642", "difficulty": 2600, "tags": ["dp", "math", "combinatorics", "probabilities"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.23952095808383234, "equal_cnt": 16, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 15, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nlong long a;\nchar b;\nint s[]={0,0,7,0,7}\uff1b\nint t[]={0,4,5,6,3,2,1};\nint main(){\n    cin>>a;\n    b=getchar();\n    cout<<((a-1)/4)*16+s[a%4==0?4:a%4]+t[b-'a'+1];\n}", "lang": "GNU C++11", "bug_code_uid": "27514b136bae60734c4bdb6262f07d03", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "apr_id": "c8b656e7bf6030ea602e4dd311b3490e", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8340675477239354, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "#include <stdio.h>\n#include <stdbool.h>\n\nint main(){\n\tint elements;\n\tscanf(\"%d\", &elements);\n\n\tbool even_bd = false;\n\n\tfor (int i = 0; i < elements; i++){\n\t\tint n;\n\t\tscanf(\"%d\",&n);\n\n\t\tif(n == 1 || n == elements)\n\t\t\tif(n%2 == 0)\n\t\t\t\teven_bd = true;\n\t}\n\n\tif(elements%2 == 0 || even_bd)\n\t\t\tprintf(\"%s \\n\", \"No\");\n\t\telse\n\t\t\tprintf(\"%s \\n\", \"Yes\");\n\treturn 0;\n}", "lang": "GNU C++17", "bug_code_uid": "56839b43497fb556626a139a064b6d8e", "src_uid": "2b8c2deb5d7e49e8e3ededabfd4427db", "apr_id": "f42611022e3d29ede034d04a4780b2c5", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9991876523151909, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "// cf29b\n#include <iostream>\nusing namespace std;\n\nint main()\n{\n  int l,d,v,g,r,cycles;\n  double timetolights,timefromlights,totaltime,remainder;\n  \n#ifndef ONLINE_JUDGE\n  FILE *stream;\n  freopen_s(&stream,\"testfile\",\"r\",stdin);\n#endif\n  cin >> l >> d >> v >> g >> r;\n  timetolights=d;\n  timetolights/=v;\n  timefromlights=l-d;\n  timefromlights/=v;\n  cycles=(int)timetolights/(g+r);\n  remainder=timetolights-cycles*(g+r);\n  if(remainder>g) timetolights+=(g+r-remainder);\n  totaltime=timetolights+timefromlights;\n  cout.precision(8);\n  cout.setf(ios::fixed,ios::floatfield);\n  cout << totaltime << '\\n';\n  return 0;\n}", "lang": "MS C++", "bug_code_uid": "c8d29fabe744ffda217793bcb94ab384", "src_uid": "e4a4affb439365c843c9f9828d81b42c", "apr_id": "5451f561afd41452c20fa050eec91ca4", "difficulty": 1500, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.13284132841328414, "equal_cnt": 7, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "#include <iostream>\n#include <cstdio>\n#include <cstring>\n#include <queue>\n\nusing namespace std;\n\nint hm,am,dm;\nint hy,ay,dy;\nint ch,ca,cd;\n\nstruct Status {\n    int h,a,d;\n    int c;\n    Status(int hh, int aa, int dd, int cc) {\n\th = hh, a = aa, d = dd, c = cc;\n    }\n    bool operator < (const Status& xx) const{\n\treturn c > xx.c;\n    }\n};\n\nbool judge(Status x) {\n    int temp = 0;\n    if(x.a <= dm) return false;\n    if(hm % (x.a-dm) == 0) temp = hm / (x.a - dm);\n    else temp = (int)(hm / (x.a - dm)) + 1;\n    return (am-x.d)*temp < x.h;\n}\n\nbool vis[505][505][505];\n\nbool check(int x, int y , int z) {\n    return x < 505 && y < 505 && z < 505;\n}\n\nStatus bfs() {\n    priority_queue <Status> heap;\n    vis[hy][ay][dy] = true;\n    heap.push(Status(hy,ay,dy,0));\n    while(!heap.empty()) {\n\tStatus cur = heap.top();\n\theap.pop();\n\tif(judge(cur)) {\n\t    return cur;\n\t}\n\tif(check(cur.h+1, cur.a, cur.d)){\n\t    if(!vis[cur.h+1][cur.a][cur.d]) {\n\t\tvis[cur.h+1][cur.a][cur.d] = true;\n\t        heap.push(Status(cur.h+1, cur.a, cur.d, cur.c + ch));\n\t    }\n\t} else {\n\t    heap.push(Status(cur.h+1, cur.a, cur.d, cur.c + ch));\n\t}\n\n\tif(check(cur.h, cur.a+1, cur.d)) {\n\t    if(!vis[cur.h][cur.a+1][cur.d]) {\n\t\tvis[cur.h][cur.a+1][cur.d] = true;\n\t\theap.push(Status(cur.h, cur.a+1, cur.d, cur.c + ca));\n\t    }\n\t} else {\n\t    heap.push(Status(cur.h, cur.a+1, cur.d, cur.c + ca));\n\t}\n\n\tif(check(cur.h, cur.a, cur.d+1)) {\n\t    if(!vis[cur.h][cur.a][cur.d+1]) {\n\t\tvis[cur.h][cur.a][cur.d+1] = true;\n\t\theap.push(Status(cur.h, cur.a, cur.d+1, cur.c + cd));\n\t    }\n\t} else {\n\t    heap.push(Status(cur.h, cur.a, cur.d+1, cur.c + cd));\n\t}\n    }\n    return Status(0,0,0,0);\n}\n\nint main() {\n    memset(vis, false, sizeof(vis));\n    cin >> hy >> ay >> dy;\n    cin >> hm >> am >> dm;\n    cin >> ch >> ca >> cd;\n    cout << bfs().c << endl;\n    return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "8df1e23b0762371a7f5f08bbd9eed584", "src_uid": "bf8a133154745e64a547de6f31ddc884", "apr_id": "062d9abf7c6e94b0146f088135dcb595", "difficulty": 1800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9085903083700441, "equal_cnt": 11, "replace_cnt": 4, "delete_cnt": 5, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "#include <cstdio>\n\nusing namespace std;\n\nconst int MOD = 1000000007, MAXN = 550;\ntypedef long long llint;\n\nint mul (int a, int b) { return (llint)a * b % MOD; }\nint add (int a, int b) { return ((llint)a + b + (llint)2 * MOD) % MOD; }\n\nint n, k, dp[MAXN][MAXN], pw[MAXN*MAXN];\n\nint main ()\n{\n    scanf (\"%d%d\", &n, &k);\n    \n    pw[0] = 1;\n    for (int i = 1; i < MAXN * MAXN; ++i)\n        pw[i] = mul(pw[i-1], 2);\n        \n    dp[0][0] = 1;\n    \n    for (int i = 0; i < n; ++i) {\n        for (int j = 0; j < k; ++j) {\n            for (int ii = i; ii < n; ++ii) {\n                int t = pw[(ii-i+1)*(n-1-ii)];\n                t = mul( add(dp[ii-i+1], -1), t );\n                dp[i+1][ii+1] = add(dp[i+1][ii+1], mul(t, dp[i][ii]));\n            }\n        }   \n    }\n    \n    int ans = 0;\n    for (int i = 0; i <= n; ++i)\n        ans = add(ans, dp[i][k]);\n    \n    printf (\"%d\\n\", ans);\n    \n    return 0;\n}", "lang": "GNU C++0x", "bug_code_uid": "a4f93901f69746a2326fde0e9302edae", "src_uid": "111673158df2e37ac6c019bb99225ccb", "apr_id": "f8dc6e1508ef5abb43f16afe778e62db", "difficulty": 2500, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.6091041632917544, "equal_cnt": 12, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 11, "bug_source_code": "#include \"bits/stdc++.h\"\nusing namespace std;\n#define ll long long\n#define w while\n#define elif else if\n#define con continue\n#define br break\n#define ld long double\n#define all(a) a.begin(), a.end()\n#define rall(a) a.rbegin(), a.rend()\n#define forn(a) for (ll i = 0; i < a; i++)\n#define prec(a) fixed << setprecision(a)\n#define INF 1000000000000000000\n#define inf 1000000000\n#define eps 1e-4\n#define EPS 1e-8\n#define MOD 1000000007\n\nconst ll hp1 = 359657;\nconst ll hm1 = 1000000007;\nconst ll hp2 = 307;\nconst ll hm2 = 1000000009;\n\npair <vector <ll>, vector <ll>> phash(const string &s, ll p, ll m) {\n    vector <ll> ans(s.size() + 1, 0);\n    vector <ll> ppow(s.size() + 1, 1);\n    for (ll i = 0; i < s.size(); i++) {\n        ans[i + 1] = (s[i] + ans[i] * p) % m;\n        ppow[i + 1] = (ppow[i] * p) % m;\n    }\n    return {ans , ppow};\n}\n\nll substrhash(pair <vector <ll>, vector <ll>> hash, ll fi, ll la, ll m) {\n    return (hash.first[la + 1] - hash.first[fi] * hash.second[la - fi] + m * m) % m;\n}\n\nvector <ll> zfu(const string &s) {\n    vector <ll> z(s.size(), 0);\n    ll l = 0, r = 0;\n    for (ll i = 1; i < s.size(); i++) {\n        z[i] = max(0ll, min(r - i, z[i - l]));\n        w(i + z[i] < s.size() && s[z[i]] == s[z[i] + i])\n            z[i]++;\n        if (i + z[i] > r) {\n            l = i;\n            r = i + z[i];\n        }\n    }\n    z[0] = s.size();\n    return z;\n}\n\nll binpow(ll a, ll n, ll m) {\n    if (n == 0)\n        return 1;\n    if (n % 2) {\n        return (binpow(a, n - 1, m) * a) % m;\n    } else {\n        ll b = binpow(a, n / 2, m);\n        return (b * b) % m;\n    }\n}\n\nll binpow(ll a, ll n) {\n    if (n == 0)\n        return 1;\n    if (n % 2) {\n        return (binpow(a, n - 1) * a);\n    } else {\n        ll b = binpow(a, n / 2);\n        return (b * b);\n    }\n}\n\nll gcd(ll a, ll b) {\n    return a ? gcd(b % a, a) : b;\n}\n\nbool in(set <ll> aaa, set <ll> bbb) {\n    for (auto i : aaa) {\n        if (bbb.find(i) == bbb.end())\n            return 0;\n    }\n    return 1;\n}\n\nll delta(set <ll> aaa, set <ll> bbb) {\n    ll su = 0;\n    for (auto i : aaa) {\n        if (bbb.find(i) == bbb.end()) {\n            su++;\n        }\n    }\n    return su;\n}\n\nstring deleter(string a, ll m) {\n    string neww;\n    for (ll i = 0; i < m; i++) {\n        neww += a[i];\n    }\n    for (ll i = m + 1; i < a.size(); i++) {\n        neww += a[i];\n    }\n    return neww;\n}\n\nvector <vector <ll>> g, gr;\nvector <pair <bool, bool>> expaths;\nvector <ll> pa;\nvector <ll> dpth;\n\nsigned main() {\n    ll n, m, a, b, k;\n    cin >> n >> m;\n    dpth.resize(n + 1, inf);\n    expaths.resize(n + 1);\n    g.resize(n + 1);\n    gr.resize(n + 1);\n    forn(m) {\n        cin >> a >> b;\n        gr[b].push_back(a);\n        g[a].push_back(b);\n    }\n    cin >> k;\n    pa.resize(k);\n    vector <ll> nxt(n + 1);\n    nxt[pa[0]] = -1;\n    forn(k) {\n        cin >> pa[i];\n        if (i != 0) {\n            nxt[pa[i - 1]] = pa[i];\n            nxt[pa[i]] = -1;\n        }\n    }\n    nxt[0] = pa[0];\n\n    queue <pair <pair <ll, ll>, ll>> bfs;\n    ll d;\n    bfs.push({{pa.back(), 0}, 0});\n    w(bfs.size()) {\n        pair <ll, ll> v = bfs.front().first;\n        ll d = bfs.front().second;\n        bfs.pop();\n        if (dpth[v.first] < d)\n            con;\n        elif(dpth[v.first] > d) {\n            dpth[v.first] = d;\n            expaths[v.first] = {0, 0};\n            if (v.second == nxt[v.first])\n                expaths[v.first].first = 1;\n            else\n                expaths[v.first].second = 1;\n        } else {\n                if (v.second == nxt[v.first])\n                    expaths[v.first].first = 1;\n                else\n                    expaths[v.first].second = 1;\n        }\n        for (auto ii : gr[v.first]) {\n            bfs.push({{ii, v.first}, d + 1});\n        }\n    }\n    ll mx = 0, mn = 0;\n    for (ll i = 0; i < pa.size() - 1; i++) {\n        if (!expaths[pa[i]].first)\n            mn++;\n        if (expaths[pa[i]].second)\n            mx++;\n    }\n    cout << mn << \" \" << mx;\n    return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "026004aa3ecd1664bdaa546d26a4a36a", "src_uid": "19a0c05eb2d1559ccfe60e210c6fcd6a", "apr_id": "118450e16bf98083d453a8c6387cbaf0", "difficulty": null, "tags": ["graphs", "shortest paths"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8761552680221811, "equal_cnt": 12, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 11, "bug_source_code": "#include <bits/stdc++.h>\n\nusing namespace std;\n\n#define int long long\n\n\nint32_t main() {\n    int n, m;\n    cin >> n >> m;\n    vector<vector<int> > a(n);\n    for (int i = 0; i < m; ++i) {\n        int u, v;\n        cin >> u >> v;\n        a[v - 1].push_back(u - 1);\n    }\n    vector<int> p;\n    int k;\n    cin >> k;\n    for (int i = 0; i < k; ++i) {\n        int t;\n        cin >> t;\n        p.push_back(t - 1);\n    }\n    vector<set<int> > prev(n);\n    vector<int> q = {p[p.size() - 1]};\n    vector<int> dist(n, 10000000);\n    dist[p[p.size() - 1]] = 0;\n    vector<bool> used(n);\n    int j = 0;\n    while (q.size() - j != 0) {\n        int now = q[j];\n        j += 1;\n        used[now] = true;\n        for (int i = 0; i < a[now].size(); ++i) {\n            int to = a[now][i];\n            if (!used[to] && dist[to] >= dist[now] + 1) {\n                prev[to].insert(now);\n                q.push_back(to);\n                dist[to] = dist[now] + 1;\n            }\n        }\n    }\n    int ans1 = 0;\n    int ans2 = 0;\n    for (int i = 0; i < k - 1; ++i) {\n        if (prev[p[i]].count(p[i + 1])) {\n            if (prev[p[i]].size() > 1) {\n                ans2 += 1;\n            }\n        } else {\n            ans1 += 1;\n            ans2 += 1;\n        }\n    }\n    cout << ans1 << \" \" << ans2;\n}\n", "lang": "GNU C++17", "bug_code_uid": "6a5fbd8d6a42a063a78cd1018fdafa76", "src_uid": "19a0c05eb2d1559ccfe60e210c6fcd6a", "apr_id": "e6acab48ff4653634e54896c5b8eeea9", "difficulty": null, "tags": ["graphs", "shortest paths"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9834845312863456, "equal_cnt": 14, "replace_cnt": 5, "delete_cnt": 5, "insert_cnt": 3, "fix_ops_cnt": 13, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\n#define fs first\n#define sc second\n#define p 1000000007\n#define pb push_back\n#define mp make_pair\ntypedef long long Int;\ntypedef pair<Int,Int> pii;\ntypedef vector<Int> vi;\ntypedef vector<pii> vii;\nInt ah,am;\nInt a,ta,b,tb,dh,dm,ahs,ams,dhs,dms;\nvoid fun()\n{\n\tam=dm;\n\tah=dh;\n\tfor(Int i=1;i<=ta;i++)\n\t{\n\t\tif(am+1==60)\n\t\t{\n\t\t\tif(ah+1==24)\n\t\t\t\tah=0;\n\t\t\telse\n\t\t\t\tah++;\n\t\t\tam=0;\n\t\t}\n\t\telse\n\t\t\tam++;\n\t}\n//\tcout<<\" am and ah \"<<ah<<\":\"<<am<<endl;\n}\nvoid fun1()\n{\n\tams=am;\n\tahs=ah;\n\tfor(Int i=1;i<=tb;i++)\n\t{\n\t\tif(ams-1==-1)\n\t\t{\n\t\t\tif(ahs-1==0)\n\t\t\t\tahs=24;\n\t\t\telse\n\t\t\t\tahs--;\n\t\t\tams=59;\n\t\t}\n\t\telse\n\t\t\tams--;\n\t}\n\tams=am;\n\tahs=ah;\n\t\n//\tcout<<\" ams and ahs \"<<ahs<<\":\"<<ams<<endl;\n\n}\nvoid fun2()\n{\n\t dms=dm;\n\tdhs=dh;\n\tfor(Int i=1;i<=tb;i++)\n\t{\n\t\tif(dms-1==-1)\n\t\t{\n\t\t\tif(dhs-1==0)\n\t\t\t\tdhs=24;\n\t\t\telse\n\t\t\t\tdhs--;\n\t\t\tdms=59;\n\t\t}\n\t\telse\n\t\t\tdms--;\n\t}\n//\tcout<<\" dms and dhs \"<<dhs<<\":\"<<dms<<endl;\n\n}\nvoid fun3 ()\n{\n\tInt hour=5;\n\tInt min=0;\n\tInt cunt=0,temp=0,previous=0;\n\twhile(1)\n\t{\n\t\t\n\t if(hour>=5){\n\t\tif(ahs!=0)\n\t\t{\n\t\t\tif(hour>dhs&&hour<ahs)\n\t\t\tcunt++;\n\t\t\telse if(hour==dhs||hour==ahs)\n\t\t\t{\n\t\t\t\tif(dhs!=ahs)\n\t\t\t\t{\n\t\t\t\t\tif(hour==dhs)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(min>dms)\n\t\t\t\t\t\tcunt++;\n\t\t\t\t\t}\n\t\t\t\t\t\tif(hour==ahs)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(min<ams)\n\t\t\t\t\t\tcunt++;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\tif(min<ams&&min>dms)\n\t\t\t\tcunt++;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\telse\n\t\t{\t\n\t\t\tif(hour>ahs&&hour>dhs)\n\t\t\tcunt++;\n\t\t\telse if(hour==dhs||hour==ahs)\n\t\t\t{\n\t\t\t\tif(dhs!=ahs)\n\t\t\t\t{\n\t\t\t\t\tif(hour==dhs)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(min>dms)\n\t\t\t\t\t\tcunt++;\n\t\t\t\t\t}\n\t\t\t\t\tif(hour==ahs)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(min<ams)\n\t\t\t\t\t\tcunt++;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\tif(min<ams&&min>dms)\n\t\t\t\tcunt++;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\t\n\t\t}\n\t\t\n/*\t\tif(cunt!=previous)\n\t\t{\n\t\t\tcout<<hour<<':'<<min<<\" ans \"<<endl;\n\t\t\tprevious=cunt;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t\tcout<<hour<<':'<<min<<endl;\n\t\t}*/\n\t\tif(min+b>=60)\n\t\t{\n\t\t\tInt add=(min+b)/60;\n\t\t\ttemp+=add;\n\t\t\tif(temp==24)\n\t\t\tbreak;\n\t\t\tif(hour+add>=24)\n\t\t\t\thour=hour+add-24;\n\t\t\telse\n\t\t\t\thour+=add;\n\t\t\tmin=(min+b)%60;\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\tmin+=b;\n\t\t}\n\t\t\n\t\t\n\n\t}\n\tcout<<cunt<<endl;\n\n}\nint main()\n{\n\tchar ch;\n\tcin>>a>>ta>>b>>tb;\n\tcin>>dh>>ch>>dm;\n\tfun();fun1();fun2();\n\tfun3();\n\n}", "lang": "GNU C++11", "bug_code_uid": "23f99eb437e1a252b4fad32c6abc388a", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "apr_id": "2820b02120467cccf43ad01627b9a756", "difficulty": 1600, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9787525702535984, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\ntypedef long long ll;\nll minprime[11];\nvector<ll> m;\nint main()\n{ ll fact[10],i,j; \nfact[0]=1;\nfor(i=1;i<10;i++)\nfact[i]=fact[i-1]*i;\nminprime[0]=minprime[1]=INT_MAX;\nfor(i=2;i<10;i++)\nif(minprime[i]==0)\n{minprime[i]=i;\nfor(j=i*i;j<10;j+=i)\nminprime[j]=i;}\nll n;\ncin>>n;\nstring s;\ncin>>s; ll temp; \nfor(i=0;i<s.size();i++)\n{ll temp1=s[i]-48;\nif(temp1==1||temp1==0) continue;\nwhile(minprime[temp1]!=temp1)\n{temp=temp1;ll c2=0,c3=0;\nwhile(temp!=1)\n{\nif(minprime[temp]==2) c2++;\nelse c3++;\ntemp/=minprime[temp];\n}\ntemp1--; c2-=c3; while(c3--)m.push_back(3); while(c2--) m.push_back(2);\n} m.push_back(temp1);\n}\nsort(m.rbegin(),m.rend());\nfor(i=0;i<m.size();i++)\ncout<<m[i];\nreturn 0;\n}\n\n", "lang": "GNU C++11", "bug_code_uid": "6a29967064577fa58339fa9146842eb1", "src_uid": "60dbfc7a65702ae8bd4a587db1e06398", "apr_id": "ed0ccf8a6c4dfe2dd2642171724c625d", "difficulty": 1400, "tags": ["greedy", "math", "sortings"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.07345065034429993, "equal_cnt": 15, "replace_cnt": 11, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 14, "bug_source_code": "#include<cstdio>\n#include<algorithm>\n#include<set>\nusing namespace std;\ntypedef long long LL;\nset<tuple<LL,LL,LL>> s;\nLL ans[10000000],poww[10000000],a,b,p,x,anss,ans2[10000000];\nint main()\n{\n\tLL i;\n\tans[0]=0;poww[0]=1;\n\tscanf(\"%lld%lld%lld%lld\",&a,&b,&p,&x);\n\tb%=p;\n\tfor(i=1;i<=x;i++)\n\t{\n\t\tpoww[i]=poww[i-1]*a%p;\n\t\tans[i]=a*(ans[i-1]+poww[i-1])%p;\n\t\tif(s.count({a,ans[i-1],poww[i-1]})==1)\n\t\t{\n\t\t\tanss=i-1;\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t\ts.insert({a,ans[i-1],poww[i-1]});\n\t\ts.find({1,2,3})->get(0);\n\t\tans2[i]=ans2[i-1]+(ans[i]==b);\n\t\tprintf(\"f[%lld]=%lld,poww[i]=%lld\\n\",i,ans[i],poww[i]);\n\t}\n\tif(anss==0)\n\t{\n\t\tprintf(\"%lld\",ans2[x]);\n\t}\n\telse\n\t{\n\t\tprintf(\"%lld\",ans2[anss]*(x/anss)+ans2[x%anss]);\n\t}\n\treturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "5bf1b1c5253f48ffd9b24054fc162464", "src_uid": "4b9f470e5889da29affae6376f6c9f6a", "apr_id": "bc2764d2570ba7e971a1e2758d2e0055", "difficulty": 2100, "tags": ["math", "chinese remainder theorem", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.735632183908046, "equal_cnt": 20, "replace_cnt": 6, "delete_cnt": 5, "insert_cnt": 8, "fix_ops_cnt": 19, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint main()\n{\n    int n;\n    cin>>n;\n    if(n%2==1) n=(n+1)/2;\n    else n=n+1;\n    cout<<n<<endl;\n    main();\n\n\n}\n", "lang": "GNU C++14", "bug_code_uid": "8088e2b5a6b7168db835cde0d8468f25", "src_uid": "236177ff30dafe68295b5d33dc501828", "apr_id": "90c1382e226d39ee724251a9334f5381", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.5729166666666666, "equal_cnt": 17, "replace_cnt": 4, "delete_cnt": 10, "insert_cnt": 2, "fix_ops_cnt": 16, "bug_source_code": "#include <string>\n#include <iostream>\n#include <vector>\nusing namespace std;\n\n\nint main()\n{\n\tint n;\n\tcin >> n;\n\tint k = n;\n\tstring stringw;\n\tfor (int i = 1; i<=k; ++i)\n\t\t{\n\t\t\tif (i%2!=0)\n\t\t\t{\n\t\t\t\tif ((n-2)<0)\n\t\t\t\t\t{\n\t\t\t\t\tstringw =  \"Ehab\";\n\t\t\t\t\t}\n\t\t\t\telse n-=2;\n\t\t\t}\n\t\t\telse\n\t\t\t\t{\n\t\t\t\tif ((n-1)<0)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\tstringw = \"Mahmoud\";\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse n-=1;\n\t\t\t\t}\n\t\t}\n\tcout << stringw;\n\n}\n", "lang": "MS C++ 2017", "bug_code_uid": "99d2b97369ff4ac497a526a60f9af204", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "apr_id": "3e4a3103918f399ba10dabbb106e0bdb", "difficulty": 800, "tags": ["math", "games"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.9976095617529881, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "//in the name of Allah\n//#isart\n#include<bits/stdc++.h>\nusing namespace std;\nconst long long N = 510, mod = 1e9 + 7;\nlong long dow[N * N], dp[N][N];\n\nint main(){\n\tios::sync_with_stdio(false);\n\tcin.tie(0);\n\tint n, k;\n\tcin >> n >> k;\n\tdow[0] = 1;\n\tfor(int i = 1; i <= n * n; i ++)\n\t\tdow[i] = dow[i - 1] * 2 % mod;\t\n\tdp[0][0] = 1;\n\tfor(int i = 1; i <= n; i ++){\n\t\tfor(int j = 1; j <= k; j ++){\n\t\t\tfor(int x = 0; x < i; x ++){\n\t\t\t\tdp[i][j] = (dp[i][j] + dp[x][j - 1] * dow[(i - x) * (n - i)] % mod * (dow[i - x] - 1)) % mod;\n\tlong long ans = 0;\n\tfor(int i = 0; i <= n; i ++)\n\t\tans = (ans + dp[i][k]) % mod;\n\tcout << ans;\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "5973122d404392879956ec68a7e6c8ed", "src_uid": "111673158df2e37ac6c019bb99225ccb", "apr_id": "73854ae18ac283cd5c06c5184bc7ab83", "difficulty": 2500, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.299346016646849, "equal_cnt": 56, "replace_cnt": 44, "delete_cnt": 6, "insert_cnt": 5, "fix_ops_cnt": 55, "bug_source_code": "#include <iostream>\n#include <map>\n#include <stdio.h>\n#include <set>\n#include <stack>\n#include <cstdio>\n#include <algorithm>\n#include <vector>\n#include <queue>\n#include <sstream>\n#include <list>\n#include <fstream>\n#include <iomanip>\n#include <cstdlib>\n#include <string>\n#include <string.h>\n#include <math.h>\nusing namespace std;\n/**\n * @author: Shamir14 -- Amirhossein Shapoori\n * lordamir14@gmail.com\n * ACM team: AnotherChorMangz\n * Tehran, Iran\n * Still listening to Mark Knopfler...\n * :P\n */\n #define pb push_back\n\n typedef long long lli;\n const int maxn = 64 + 10, MOD = 1000 * 1000 * 1000 + 7;\n int n, m;\n int ori[maxn][maxn], vis[maxn][maxn], board[maxn][maxn];\n int ax[] = {1, 0, -1, 0}, ay[] = {0, -1, 0, 1};\n\n bool inrange(int x, int y){\n        if(x >= 0 && x < m && y >= 0 && y < n)\n            return true;\n        return false;\n}\n\n int Check(){\n    int ans = n * m / 2, i, j, x, y;\n    for(i = 0; i < maxn; i++)\n        for(j = 0; j < maxn; j++)\n            vis[i][j] = 0;\n//  cerr << endl;\n//   for(i = 0; i < n; i++){\n//       for(j = 0; j < m; j++)\n//          cerr << ori[j][i] << \" \";\n//       cerr << endl;\n//   }\n//    cerr << ans << endl;\n    for(i = 0; i < m; i++)\n        for(j = 0; j < n; j++)\n            if(!vis[i][j]){\n                x = i + ax[ori[i][j]];\n                y = j + ay[ori[i][j]];\n                vis[i][j] = vis[x][y] = 1;\n                if(board[i][j] == board[x][y])\n            //        cerr << i << \", \" << j << \"    \";\n                    ans--;\n                //if(ans == 9){\n                  //  cerr << i << \", \" << j << \"  ||  \" << x << \", \" << y << \"      \";\n                   // break;\n               // }\n            }\n//    if (ans == 9){\n//      cerr << endl;\n//   for(i = 0; i < n; i++){\n//       for(j = 0; j < m; j++)\n//          cerr << ori[j][i] << \" \";\n//       cerr << endl;\n//   }\n//    }\n    return ans;\n }\n\n int mini;\n\n\n\n void Make(int i, int j){\n        int x, y;\n        if(ori[i][j] == -1){\n            for(int k = 0; k < 4; k++){\n                x = i + ax[k];\n                y = j + ay[k];\n                if(inrange(x, y) && ori[x][y] == -1){\n                    ori[i][j] = k;\n                    ori[x][y] = (k + 2) % 4;\n                    if(i + 1 < m)\n                        Make(i + 1, j);\n                    else\n                        if(j + 1 < n)\n                            Make(0, j + 1);\n                        else\n                            mini = min(Check(), mini);\n                    if(mini == 0)\n                        break;\n                    ori[i][j] = ori[x][y] = -1;\n                }\n            }\n        }else{\n            if(i + 1 < m)\n                Make(i + 1, j);\n            else\n                if(j + 1 < n)\n                    Make(0, j + 1);\n                else\n                    mini = min(Check(), mini);\n            if(mini == 0)\n                break;\n        }\n }\n\n\n\n\nint main(){\n    //freopen(\"input.txt\", \"r\", stdin);\n    //freopen(\"output.txt\", \"w\", stdout);\n    mini = 1000000;\n    int i, j;\n    cin >> n >> m;\n    for(i = 0; i < maxn; i++)\n        for(j = 0; j < maxn; j++)\n            ori[i][j] = -1;\n    for(i = 0; i < n; i++)\n        for(j = 0; j < m; j++)\n            cin >> board[j][i];\n\n    Make(0, 0);\n\n    cout << mini << endl;\n\n\n    return 0;\n}\n\n", "lang": "GNU C++0x", "bug_code_uid": "9d037c64cb53c19858e89c2d09b2c4da", "src_uid": "1f0e8bbd5bf4fcdea927fbb505a8949b", "apr_id": "7d297e8d1f61922f688416de65651be9", "difficulty": 2200, "tags": ["flows"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9990512333965844, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include<bits/stdc++.h>\n#define ff first\n#define ss second\n#define pb push_back\n#define mp make_pair\n#define ll long long\n#define all(a) a.begin(),a.end()\n#define endl '\\n'\n#define int ll\n\nusing namespace std;\n\nconst int N=1e6+3;\nconst int inf=1e9+3;\nconst int md=1e9+7;\n\nint a,b,m,x,ans,l,r,mid,vz;\nint c[N];\n\nint bin(int a,int n)\n{\n    int res=1;\n    while(n)\n    {\n        if(n&1)res*=a;\n        a*=a;\n        res%=m;\n        a%=m;\n        n/=2;\n    }\n    return res;\n}\n\nbool good(int n)\n{\n    int res=n*bin(a,n);\n    res%=m;\n    b%=m;\n    return res==b;\n}\n\nvector<pair<int,int> > gg;\n\nbool in(int x,int l,int r)\n{\n    return x>=l&&x<=r;\n}\n\nint get_kol(int l,int r,int x)\n{\n    int l1=0;\n    int r1=gg.size()-1;\n    while(l1<r1)\n    {\n        int mid1=(l1+r1)/2;\n        if(gg[mid1].ff<x||(gg[mid1].ff==x&&gg[mid1].ss<l))l1=mid1+1;\n        else r1=mid1;\n    }\n    if(gg[l1].ff!=x)return 0;\n    if(!in(gg[l1],l,r))return 0;\n    int l2=l1;\n\n    l1=0;\n    r1=gg.size()-1;\n    while(l1<r1)\n    {\n        int mid1=(l1+r1+1)/2;\n        if(gg[mid1].ff>x||\n           (gg[mid1].ff==x&&gg[mid1].ss>r))r1=mid1-1;\n        else l1=mid1;\n    }\n    return l1-l2+1;\n}\n\nmain()\n{\n    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);\n\n    cin>>a>>b>>m>>x;\n\n    for(int i=0;i<m-1;++i)\n    {\n        c[i]=bin(a,i);\n        c[i]=bin(c[i],m-2);\n        c[i]=(c[i]*b)%m;\n        gg.pb(mp(c[i],i));\n    }\n    sort(all(gg));\n\n    int anss=0;\n    int g1;\n    for(int i=0;i<m;++i)\n    {\n        g1=i;\n        if(i==m-1)g1=0;\n\n        l=0;\n        r=x/(m)+1;\n        while(l<r)\n        {\n            mid=(l+r+1)/2;\n            if(i+mid*(m)<=x)l=mid;\n            else r=mid-1;\n        }\n\n        if(i+l*(m)>x)continue;\n\n        r=l;\n        l=0;\n        l+=g1;\n        r+=g1;\n        if(l%(m-1)<=r%(m-1)&&abs(r-l)<m-1)\n        {\n            ans+=get_kol(l,r,i);\n        }else\n        {\n            anss+=get_kol(l,m-2,i);\n            int p1=r%(m-1);\n            ans+=get_kol(0,p1,i);\n\n            r-=p1+1;\n            int vgg=r/(m-1);\n            ans+=get_kol(0,m-1,i)*vgg;\n        }\n    }\n    cout<<ans-good(0);\n}\n/*\n2 3 5 8\n*/\n", "lang": "GNU C++11", "bug_code_uid": "5ba36e42de1fb31d80d8529cb148a9d5", "src_uid": "4b9f470e5889da29affae6376f6c9f6a", "apr_id": "914ee1f78b34110145366963518e0205", "difficulty": 2100, "tags": ["math", "chinese remainder theorem", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.977491961414791, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\n#define int long long\nconst int N=1e6+10;\nint a,b,p,x,inv[N];\nint ksm(int x,int y){\n\tif (!y)return 1;\n\tint z=ksm(x,y/2);\n\tz=z*z%p;\n\tif (y&1)z=z*x%p;\n\treturn z;\n}\nint main(){\n\tscanf(\"%lld%lld%lld%lld\",&a,&b,&p,&x);\n\tfor (int i=1;i<p;i++)inv[i]=pow(i,p-2);\n\tint ans=0;\n\tfor (int i=1;i<p;i++){\n\t\tint y=b*inv[Pow(a,i)]%p,M=p*(p-1),n=(p*i%M-(p-1)*y%M+M-1)%M+1;\n\t\tif (n<=x)ans+=(x-n)/M+1;\n\t}\n\tprintf(\"%lld\",ans);\n\treturn 0;\n} ", "lang": "GNU C++11", "bug_code_uid": "5dd30530ce6b2ed6851ffa3f95327e9a", "src_uid": "4b9f470e5889da29affae6376f6c9f6a", "apr_id": "61cc85773e042ca60d491f6d0a755341", "difficulty": 2100, "tags": ["math", "chinese remainder theorem", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9619872905834778, "equal_cnt": 12, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 7, "fix_ops_cnt": 11, "bug_source_code": "#include <bits/stdc++.h>\n#define MP make_pair\n#define PB push_back\n#define int long long\n#define st first\n#define nd second\n#define rd third\n#define FOR(i, a, b) for(int i =(a); i <=(b); ++i)\n#define RE(i, n) FOR(i, 1, n)\n#define FORD(i, a, b) for(int i = (a); i >= (b); --i)\n#define REP(i, n) for(int i = 0;i <(n); ++i)\n#define VAR(v, i) __typeof(i) v=(i)\n#define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)\n#define ALL(x) (x).begin(), (x).end()\n#define SZ(x) ((int)(x).size())\n#define __builtin_ctz __builtin_ctzll\n#define __builtin_clz __builtin_clzll\n#define __builtin_popcount __builtin_popcountll\nusing namespace std;\ntemplate<typename TH> void _dbg(const char* sdbg, TH h) { cerr<<sdbg<<\"=\"<<h<<\"\\n\"; }\ntemplate<typename TH, typename... TA> void _dbg(const char* sdbg, TH h, TA... t) {\n  while(*sdbg != ',') { cerr<<*sdbg++; } cerr<<\"=\"<<h<<\",\"; _dbg(sdbg+1, t...);\n}\n#define LOCAL\n#ifdef LOCAL\n#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)\n#define debugv(x) {{cerr <<#x <<\" = \"; FORE(itt, (x)) cerr <<*itt <<\", \"; cerr <<\"\\n\"; }}\n#else\n#define debug(...) (__VA_ARGS__)\n#define debugv(x)\n#define cerr if(0)cout\n#endif\n#define next ____next\n#define prev ____prev\n#define left ____left\n#define hash ____hash\ntypedef long long ll;\ntypedef long double LD;\ntypedef pair<int, int> PII;\ntypedef pair<ll, ll> PLL;\ntypedef vector<int> VI;\ntypedef vector<VI> VVI;\ntypedef vector<ll> VLL;\ntypedef vector<pair<int, int> > VPII;\ntypedef vector<pair<ll, ll> > VPLL;\n \ntemplate<class C> void mini(C&a4, C b4){a4=min(a4, b4); }\ntemplate<class C> void maxi(C&a4, C b4){a4=max(a4, b4); }\ntemplate<class T1, class T2>\nostream& operator<< (ostream &out, pair<T1, T2> pair) { return out << \"(\" << pair.first << \", \" << pair.second << \")\";}\ntemplate<class A, class B, class C> struct Triple { A first; B second; C third;\n  bool operator<(const Triple& t) const { if (st != t.st) return st < t.st; if (nd != t.nd) return nd < t.nd; return rd < t.rd; } };\ntemplate<class T> void ResizeVec(T&, vector<int>) {}\ntemplate<class T> void ResizeVec(vector<T>& vec, vector<int> sz) {\n  vec.resize(sz[0]); sz.erase(sz.begin()); if (sz.empty()) { return; }\n  for (T& v : vec) { ResizeVec(v, sz); }\n}\ntypedef Triple<int, int, int> TIII;\ntemplate<class A, class B, class C>\nostream& operator<< (ostream &out, Triple<A, B, C> t) { return out << \"(\" << t.st << \", \" << t.nd << \", \" << t.rd << \")\"; }\ntemplate<class T> ostream& operator<<(ostream& out, vector<T> vec) { out<<\"(\"; for (auto& v: vec) out<<v<<\", \"; return out<<\")\"; }\ntemplate<class T> ostream& operator<<(ostream& out, set<T> vec) { out<<\"(\"; for (auto& v: vec) out<<v<<\", \"; return out<<\")\"; }\ntemplate<class L, class R> ostream& operator<<(ostream& out, map<L, R> vec) { out<<\"(\"; for (auto& v: vec) out<<v<<\", \"; return out<<\")\"; }\n\nconst int P = 1e9 + 7;\nconst int N = 3e6;\nint fac[N];\nint inv_fac[N];\nint k_pow[N];\nint spow(int a, int b) {\n\tint r = 1;\n\twhile (b) {\n\t\tif (b % 2) {\n\t\t\tr = a * r % P;\n\t\t}\n\t\ta = a * a % P;\n\t\tb /= 2;\n\t}\n\treturn r;\n}\nint Inv(int a) {\n\treturn spow(a, P - 2);\n}\nint DownFac(int a, int b) {\n\tif (a < b) { return 0; }\n\treturn fac[a] * inv_fac[a - b] % P;\n}\nint Go(int k, int w, int min_len) { // ile jest stringow dla ktorych wynik jest <=w\n\t// nie ma zadnego dlugosci w+1\n\tint max_len = k + 1 + w;\n\tint res = 0;\n\tFOR (len, min_len, max_len) {\n\t\tif (len >= 2 * w) {\n\t\t\tint c = len - 2 * w;\n\t\t\tint here = DownFac(k, c);\n\t\t\tint side = DownFac(k - c, w);\n\t\t\tint lol = here * side % P * side % P;\n\t\t\tdebug(k, w, len, lol);\n\t\t\tres = (res + lol) % P;\n\t\t} else {\n\t\t\tint c = 2 * w - len;\n\t\t\tint side = DownFac(k, w - c);\n\t\t\tint mid = Pow(k, c);\n\t\t\tint lol = side * side % P * mid;\n\t\t\tdebug(k, w, len, lol);\n\t\t\tres = (res + lol) % P;\n\t\t}\n\t}\n\tdebug(res);\n\treturn res;\n}\nint32_t main() {\n \n  ios_base::sync_with_stdio(0);\n  cout << fixed << setprecision(10);\n  cerr << fixed << setprecision(10);\n  cin.tie(0);\n  int w, k;\n  cin>>k>>w;\n  fac[0] = 1;\n  k_pow[0] = 1;\n  RE (i, N - 1) {\n  \tfac[i] = fac[i - 1] * i % P;\n  \tk_pow[i] = k_pow[i - 1] * k % P;\n  }\n  inv_fac[N - 1] = Inv(fac[N - 1]);\n  FORD (i, N - 2, 0) {\n  \tinv_fac[i] = inv_fac[i + 1] * (i + 1) % P;\n  }\n  cout<<(Go(k, w, w) - Go(k, w - 1, w) + P) % P<<endl;\n\n  return 0;\n }", "lang": "GNU C++17", "bug_code_uid": "807d295cf13fd8fa395d1898ab9af2ae", "src_uid": "b715f0fdc83ec539eb3ae2b0371ee130", "apr_id": "f9bdbab659b65b07f315623ed1ebee79", "difficulty": 3000, "tags": ["combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9984301412872841, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <bits/stdc++.h>\n#define MP make_pair\n#define PB push_back\n#define int long long\n#define st first\n#define nd second\n#define rd third\n#define FOR(i, a, b) for(int i =(a); i <=(b); ++i)\n#define RE(i, n) FOR(i, 1, n)\n#define FORD(i, a, b) for(int i = (a); i >= (b); --i)\n#define REP(i, n) for(int i = 0;i <(n); ++i)\n#define VAR(v, i) __typeof(i) v=(i)\n#define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)\n#define ALL(x) (x).begin(), (x).end()\n#define SZ(x) ((int)(x).size())\n#define __builtin_ctz __builtin_ctzll\n#define __builtin_clz __builtin_clzll\n#define __builtin_popcount __builtin_popcountll\nusing namespace std;\ntemplate<typename TH> void _dbg(const char* sdbg, TH h) { cerr<<sdbg<<\"=\"<<h<<\"\\n\"; }\ntemplate<typename TH, typename... TA> void _dbg(const char* sdbg, TH h, TA... t) {\n  while(*sdbg != ',') { cerr<<*sdbg++; } cerr<<\"=\"<<h<<\",\"; _dbg(sdbg+1, t...);\n}\n#define LOCAL\n#ifdef LOCAL\n#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)\n#define debugv(x) {{cerr <<#x <<\" = \"; FORE(itt, (x)) cerr <<*itt <<\", \"; cerr <<\"\\n\"; }}\n#else\n#define debug(...) (__VA_ARGS__)\n#define debugv(x)\n#define cerr if(0)cout\n#endif\n#define next ____next\n#define prev ____prev\n#define left ____left\n#define hash ____hash\ntypedef long long ll;\ntypedef long double LD;\ntypedef pair<int, int> PII;\ntypedef pair<ll, ll> PLL;\ntypedef vector<int> VI;\ntypedef vector<VI> VVI;\ntypedef vector<ll> VLL;\ntypedef vector<pair<int, int> > VPII;\ntypedef vector<pair<ll, ll> > VPLL;\n \ntemplate<class C> void mini(C&a4, C b4){a4=min(a4, b4); }\ntemplate<class C> void maxi(C&a4, C b4){a4=max(a4, b4); }\ntemplate<class T1, class T2>\nostream& operator<< (ostream &out, pair<T1, T2> pair) { return out << \"(\" << pair.first << \", \" << pair.second << \")\";}\ntemplate<class A, class B, class C> struct Triple { A first; B second; C third;\n  bool operator<(const Triple& t) const { if (st != t.st) return st < t.st; if (nd != t.nd) return nd < t.nd; return rd < t.rd; } };\ntemplate<class T> void ResizeVec(T&, vector<int>) {}\ntemplate<class T> void ResizeVec(vector<T>& vec, vector<int> sz) {\n  vec.resize(sz[0]); sz.erase(sz.begin()); if (sz.empty()) { return; }\n  for (T& v : vec) { ResizeVec(v, sz); }\n}\ntypedef Triple<int, int, int> TIII;\ntemplate<class A, class B, class C>\nostream& operator<< (ostream &out, Triple<A, B, C> t) { return out << \"(\" << t.st << \", \" << t.nd << \", \" << t.rd << \")\"; }\ntemplate<class T> ostream& operator<<(ostream& out, vector<T> vec) { out<<\"(\"; for (auto& v: vec) out<<v<<\", \"; return out<<\")\"; }\ntemplate<class T> ostream& operator<<(ostream& out, set<T> vec) { out<<\"(\"; for (auto& v: vec) out<<v<<\", \"; return out<<\")\"; }\ntemplate<class L, class R> ostream& operator<<(ostream& out, map<L, R> vec) { out<<\"(\"; for (auto& v: vec) out<<v<<\", \"; return out<<\")\"; }\n \nconst int P = 1e9 + 7;\nconst int N = 3e6;\nint fac[N];\nint inv_fac[N];\nint k_pow[N];\nint spow(int a, int b) {\n\tint r = 1;\n\twhile (b) {\n\t\tif (b % 2) {\n\t\t\tr = a * r % P;\n\t\t}\n\t\ta = a * a % P;\n\t\tb /= 2;\n\t}\n\treturn r;\n}\nint Inv(int a) {\n\treturn spow(a, P - 2);\n}\nint DownFac(int a, int b) {\n\tif (a < 0) { return 0; }\n\tif (b < 0) { cout<<\"dupa\"<<endl; }\n\tif (a < b) { return 0; }\n\treturn fac[a] * inv_fac[a - b] % P;\n}\nint Go(int k, int w, int min_len) { // ile jest stringow dla ktorych wynik jest <=w\n\t// nie ma zadnego dlugosci w+1\n\tint max_len = k + 1 + w;\n\tint res = 0;\nint inv_k = Inv(k);\nint mid = -1;\nassert(max_len - min_len <= k + 5);\n\tFOR (len, min_len, max_len) {\n\t\t//if (len % 10000 == 0) {\n\t//\t\tcout<<len<<endl;\n\t//\t}\n\t\tif (len >= 2 * w) {\n\t\t\tint c = len - 2 * w;\n\t\t\tint here = DownFac(k, c);\n\t\t\t\n\t\t\tint side = DownFac(k - c, w);\n\t\t\tint lol = here * side % P * side % P;\n\t\t\tdebug(k, w, len, lol);\n\t\t\tres = (res + lol) % P;\n\t\t} else {\n\t\t\tint c = 2 * w - len;\n\t\t\tint side = DownFac(k, w - c);\nif (mid == -1) { mid = spow(k, c); }\nelse { mid = mid * inv_k % P; }\n\t\t\tint lol = side * side % P * mid;\n\t\t\tdebug(k, w, len, lol);\n\t\t\tres = (res + lol) % P;\n\t\t}\n\t}\n\tdebug(res);\n\treturn res;\n}\nint32_t main() {\n \n  ios_base::sync_with_stdio(0);\n  cout << fixed << setprecision(10);\n  cerr << fixed << setprecision(10);\n  cin.tie(0);\n  int w, k;\n  cin>>k>>w;\n  fac[0] = 1;\n  k_pow[0] = 1;\n  RE (i, N - 1) {\n  \tfac[i] = fac[i - 1] * i % P;\n  \tk_pow[i] = k_pow[i - 1] * k % P;\n  }\n  inv_fac[N - 1] = Inv(fac[N - 1]);\n  FORD (i, N - 2, 0) {\n  \tinv_fac[i] = inv_fac[i + 1] * (i + 1) % P;\n  }\n  //cout<<\"hehe\"<<endl;\n  cout<<(Go(k, w, w) - Go(k, w - 1, w) + P) % P<<endl;\n \n  return 0;\n }", "lang": "GNU C++17", "bug_code_uid": "617b409fe86e36e53c1e4d758aef3138", "src_uid": "b715f0fdc83ec539eb3ae2b0371ee130", "apr_id": "f9bdbab659b65b07f315623ed1ebee79", "difficulty": 3000, "tags": ["combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.9469591780061094, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "#include <algorithm>\n#include <bitset>\n#include <cmath>\n#include <cstdio>\n#include <cstdlib>\n#include <ctime>\n#include <deque>\n#include <functional>\n#include <iomanip>\n#include <iostream>\n#include <list>\n#include <map>\n#include <numeric>\n#include <queue>\n#include <set>\n#include <sstream>\n#include <stack>\n#include <utility>\n#include <vector>\n#include <cstring>\n#define maxk 2000005\n#define mod 1000000007\nusing namespace std;\n\nint k,w;\nlong long factorial[maxk],inverse[maxk];\n\nlong long power(int a,int x) {\n  if (!x) return 1;\n  long long q = power(a,x/2);\n  q = (q * q) % mod;\n  if (x & 1) q = (q * a) % mod;\n  return q;\n}\n\nlong long binom(int a,int b) {\n  if (a < b) return 0;\n  long long denominator = (inverse[b] * inverse[a - b]) % mod;\n  return (factorial[a] * denominator) % mod;\n}\n\nlong long Anom(int a,int b) {\n  return (binom(a,b) * factorial[b]) % mod;\n}\n\nlong long func(int ws,int start) {\n  long long ret = 0;\n  // length of string is at least w + 1\n  for (int len = ws + start; len < ws + k; len++) {\n    int r1 = len - ws + 1,l2 = ws;\n    if (l2 <= r1) {\n      int comlen = r1 - l2 + 1;\n      long long f1 = Anom(k,comlen);\n      long long f2 = Anom(k - comlen,len - ws + 1 - comlen);\n      f2 = (f2 * f2) % mod;\n      ret = (ret + f1 * f2) % mod;\n    }\n    else {\n      long long halves = Anom(k,len - ws + 1);\n      halves = (halves * halves) % mod;\n      long long free = power(k,len - 2 * (len - ws + 1));\n      ret = (ret + halves * free) % mod;\n    }\n  }\n  return ret;\n}\n\nint main() {\n  factorial[0] = 1;\n  for (int i = 1; i < maxk; i++) factorial[i] = (factorial[i - 1] * i) % mod;\n  for (int i = 0; i < maxk; i++) inverse[i] = power(factorial[i],mod - 2);\n  scanf(\"%d %d\", &k, &w);\n  cout << (func(w + 1,0) - func(w,1) + mod) % mod;\n}\n", "lang": "GNU C++", "bug_code_uid": "fde25fd6667420163226a774f34fe842", "src_uid": "b715f0fdc83ec539eb3ae2b0371ee130", "apr_id": "ae797d05d8a10e4fa14e314d0c97efd7", "difficulty": 3000, "tags": ["combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9972127593682255, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "/***\n \n                                Bismillahir Rahmanir Rahim\n                                Rabbi Zidni Ilma\n                                Author : Saidur Rahman\n                                Department of CSE, City University, Bangladesh.\n \n***/\n\n#include<bits/stdc++.h>\nusing namespace std;\n\n\ntypedef         long long           ll;\n#define         endl                \"\\n\"\n#define         ff                  first\n#define         sf                  scanf\n#define         pf                  printf\n#define         ss                  second\nconst           int                 MAX=1e8;\n#define         log_out             return 0\n#define         pb                  push_back\n#define         log_in              int main()\n#define         PI                  acos(-1.0)\n#define         vi                  vector<int>\n#define         newline             printf(\"\\n\")\n#define         pri                 pair<int,int>\n#define         sff(a)              scanf(\"%d\",&a)\n#define         NO                  printf(\"NO\\n\")\n#define         no                  printf(\"no\\n\")\n#define         No                  printf(\"No\\n\")\n#define         YES                 printf(\"YES\\n\")\n#define         Yes                 printf(\"Yes\\n\")\n#define         yes                 printf(\"yes\\n\")\n#define         sfl(a)              scanf(\"%lld\",&a)\n#define         sfl(a)              scanf(\"%lld\",&a)\n#define         pff(a)              printf(\"%d\\n\",a)\n#define         pfl(a)              printf(\"%lld\\n\",a)\n#define         sfff(a,b)           scanf(\"%d%d\",&a,&b)\n\n#define         f0(i,b)             for(int i=0;i<(b);i++)\n#define         sfll(a,b)           scanf(\"%lld%lld\",&a,&b)\n#define         sffff(a,b,c)        scanf(\"%d%d%d\",&a,&b,&c)\n#define         clock_start         clock_t tStart = clock()\n#define         sflll(a,b,c)        scanf(\"%lld%lld%lld\",&a,&b,&c)\n#define         input               freopen(\"input.txt\", \"r\", stdin)\n#define         output              freopen(\"output.txt\", \"w\", stdout)\n#define         watch(x)            cout << (#x) << \" is \" << (x) << endl\n#define         show_time           printf(\"Time taken: %.3fs\\n\", (double)(clock() - tStart) / CLOCKS_PER_SEC)\n\nint         ToggleBit (int n, int X)    { return n ^ (1 << X); }\nint         SetBit (int n, int X)       { return n | (1 << X); }\nint         ClearBit (int n, int X)     { return n & ~(1 << X); }\nbool        CheckBit (int n, int X)     { return (bool)(n & (1 << X)); }\n\n\n            ///////////////////////////////////////////////////////////////////////////\n        ///////////////////////// DO NOT TOUCH BEFORE THIS LINE //////////////////////////\n            //////////////////////////////////////////////////////////////////////////\n\n\n\nlog_in\n{\n   \n #ifndef ONLINE_JUDGE \n    input;\n    output;\n#endif\n    int n;\n    sff(n);\n    vi v;\n    for (int i = 0; i < n;i++)\n    {\n        int x;\n        sff(x);\n        v.pb(x);\n    }\n    sort(v.begin(), v.end());\n    v.erase(unique(v.begin(), v.end()), v.end());\n    bool ok = false;\n    for (int i = 0; i < v.size()-2;i++)\n    {\n        if(v[i]==v[i+1]-1 && v[i]==v[i+2]-2)\n        {\n            ok = true;\n            break;\n        }\n    }\n    ok ? YES : NO;\n    log_out;\n}\n", "lang": "GNU C++17", "bug_code_uid": "2a3e476993c575f7d4cf476c327323cb", "src_uid": "d6c876a84c7b92141710be5d76536eab", "apr_id": "2f93312e7bd7b211225f25e69ff6e575", "difficulty": 900, "tags": ["brute force", "sortings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.94287680660702, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 4, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n\nint main()\n{     int n;\n       scanf(\"%d\",&n);\n          vector<int>  S;\n            int v;\n        for(int i = 0;i<n;i++)\n        {\n            scanf(\"%d\",&v);\n             S.push_back(v);\n        }\n          sort(S.begin(),S.end());\n            S.resize(unique(S.begin(), S.end()) - S.begin());\n               int h =  0 ;\n             for(int i = 0;i<S.size()-2;i++)\n             {\n                 if(S[i]+1==S[i+1]&&S[i+1]+1==S[i+2]&&h==0)\n                        { h =1;\n                     cout<<\"YES\"<<endl;}\n             }\n              if(!h)\n              {\n                  cout<<\"NO\"<<endl;\n              }\n    return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "2fb4078b882c0e7e57aa87f3990a276c", "src_uid": "d6c876a84c7b92141710be5d76536eab", "apr_id": "cef3094092b87f33f9ea4e3a6b182b68", "difficulty": 900, "tags": ["brute force", "sortings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.4152542372881356, "equal_cnt": 13, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 13, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint main()\n{\n   long long int n,k,i,z=0;\n   cin>>n>>k;\n   string s;\n   cin>>s;\n   long long int freq[100]={0};\n   for(i=0;i<s.length();i++)\n   {\n       freq[s[i]]++; \n   }\n   for(i=0;i<100;i++)\n   {\n       if(freq[i]>0)\n       {\n           z=max(z,freq[i]);\n       }\n   }\n   if(z<=k)\n   cout<<\"YES\"<<endl;\n   else\n   cout<<\"NO\"<<endl;\n   \n  \n}", "lang": "GNU C++14", "bug_code_uid": "1dfd82d0e9efd0d0a6376da7b8dcd600", "src_uid": "ceb3807aaffef60bcdbcc9a17a1391be", "apr_id": "1d0fe92af939c007c9e7f6888dd45fcc", "difficulty": 900, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.810126582278481, "equal_cnt": 11, "replace_cnt": 5, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n\nlong long power(long long a, int b, long long mod){\n    long long result = 1;\n    while (b) {\n        if (b&1) {\n            result *= a;\n            result %= mod;\n        }   \n        a *= a;\n        a %= mod;\n        b >>= 1;\n    }\n    return result;\n}\n\nlong long inverse (long long a, long long mod) {\n\treturn power(a,mod-2,mod);\n}\n\nlong long fact(long long a, long long mod) {\n\tlong long res=1;\n\twhile(a) {\n\t\tres *= a;\n\t\tres %= mod;\n\t\ta--;\n\t}\n\treturn res;\n}\n\nconst int mod=1e9+7;\n\nint32_t main() {\n\t#ifdef ONLINE_JUDGE\n\t\tios::sync_with_stdio(0);\n\t\tcin.tie(0);\n\t\tcout.tie(0);\n\t#endif\n\tint N, K;\n\tcin >> N >> K;\n\tlong long ans=0;\n\tvector<long long> p(N+1,0);\n\tfor (int j = K+2; j <= N; ++j) {\n\t\tans = (j-K-1) + p[j-1]-p[j-K-1]+mod;\n\t\tans %= mod;\n\t\tans *= fact(j-2, mod);\n\t\tans %= mod;\n\t\tp[j] = p[j-1] + (ans*inverse(fact(j-1,mod),mod))%mod;\n\t\tp[j] %= mod;\n\t}\t\n\tans = (fact(N-1,mod)*p[N])%mod;\n\tcout << ans << \"\\n\";\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "b9fe048bb2c56e0c8ba78071320d943b", "src_uid": "0644605611a2cd10ab3a9f12f18d7ae4", "apr_id": "11804b55e69b94d2ea8d212353a378af", "difficulty": 2400, "tags": ["dp", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9654556283502085, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <bits/stdc++.h>\n \nusing namespace std;\n//#define endl '\\n'\n#define rep(i, l, r) for (int i = l; i<r;i++)\n#define vi vector<int>\n#define all(v) v.begin(),v.end()\n#define pb(c) push_back(c)\n#define vii vector<pair<int,int>>\n#define vvi vector<vector<int>>\n#define ii pair<int,int>\n#define mp(i, j) make_pair(i,j)\n#define ull unsigned long long int\n#define ll  long long int\n#define PI  3.141592653589793238\n#define MOD ((ll)1e9 + 7)\n#define INF ((int)1e9)\n#define EPS 1e-14\n#define MAXN 1000600\nll D[MAXN];\nll sum;\nll perm[MAXN];\nll invPerm[MAXN];\n\n\nll mod_pow(ll x, ll y) {\n    // exponentiation by squaring\n    ll r = 1;\n    while (y > 0) {\n        if (y % 2 == 1) {\n            r = (r * x) % MOD;\n        }\n        x = (x * x) % MOD;\n        y /= 2;\n    }\n    return r;\n}\n\n\nint main() {\n    ios_base::sync_with_stdio(false);\n    cin.tie(0);\n#ifdef DEBUG\n    freopen(\"input\", \"r\", stdin);//  flush(cout);\n#endif\n    perm[0] = 1;\n    invPerm[0] = 1;\n    rep (i,1,MAXN) {\n        perm[i] = (perm[i-1]*i)%MOD;\n        invPerm[i] = mod_pow(perm[i],MOD-2)%MOD;\n    }\n    ll n,k;\n    cin>>n>>k;\n    if (k>=n) {\n        cout<<\"0\";\n        return 0;\n    }\n\n    rep (i,k,n) {\n        int len = i+1;\n        ll tempSum = 0;\n        rep (h,len-k,len)\n            tempSum = (tempSum+ (D[h]*(invPerm[h-1]))%MOD)%MOD;\n\n        assert(sum==tempSum);\n        D[len] = (D[len] + ((len-k-1)*perm[len-2])%MOD)%MOD + (sum*perm[len-2])%MOD;\n        D[len] = D[len]%MOD;\n        sum = (sum + (D[len]*invPerm[len-1])%MOD - (D[len-k]*invPerm[len-k-1])%MOD + MOD)%MOD ;\n    }\n    ll ans = 0;\n       rep (i,k,n) {\n        int len = i+1;\n        ans = (ans + (((D[len]*perm[n-1])%MOD)*(invPerm[len-1]))%MOD)%MOD ;\n\n\n    }\n    cout<<ans;\n    return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "6d0200ce86d1ca2303b97de9a8a58dc0", "src_uid": "0644605611a2cd10ab3a9f12f18d7ae4", "apr_id": "e03a7dd67aaa57fa078882cc69b523ac", "difficulty": 2400, "tags": ["dp", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8201133144475921, "equal_cnt": 11, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 8, "fix_ops_cnt": 10, "bug_source_code": "#include<new>\n#include<map>\n#include<set>\n#include<list>\n#include<queue>\n#include<cmath>\n#include<vector>\n#include<cstdio>\n#include<cstdlib>\n#include<cstring>\n#include<utility>\n#include<iostream>\n#include<algorithm>\nusing namespace std;\n\nbool judge;\nstring a,b;\n\nint main()\n{\n    cin>>a;\n    b+=a[0];\n    int i=0;\n    while(i<a.size()) \n    {\n            if(a[i]=='d')\n            {\n                         if(a[i+1]=='o'&&a[i+2]=='t') \n                         {\n                                 b+='.';\n                                 i+=3;\n                                 continue;\n                         }\n                         else continue;\n            }\n            else\n            {\n                if(a[i]=='a')\n                {\n                             if(a[i+1]=='t'&&judge==false)\n                             {\n                                     b+='@';\n                                     i+=2;\n                                     judge=true;\n                                     continue;\n                             }\n                             else continue; \n                }\n                else b+=a[i];\n                i++;\n            }\n    }\n    cout<<b<<endl;\n    return 0;\n}", "lang": "GNU C++", "bug_code_uid": "14ca22b3d4d214c3f9e52fef04680989", "src_uid": "a11c9679d8e2dca51be17d466202df6e", "apr_id": "5aa9592fbb5ef9d0f65f3ab17eb7397f", "difficulty": 1300, "tags": ["implementation", "expression parsing"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9798488664987406, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "// A.cpp : Defines the entry point for the console application.\n//\n\n#include <stdio.h>\n#include <iostream>\n#include <cmath>\n#include <algorithm>\n#include <map>\n#include <vector>\n#include <set>\n#include <stack>\n#include <queue>\n#include <string>\n#include <cstring>\n\nusing namespace std;\n\n\nint main()\n{\t\n\tint a,b,c;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tint s=2*c+(b-1)*(c+1);\n\tprintf(\"%d\",s);\n\treturn 0;\n}\n\n", "lang": "MS C++", "bug_code_uid": "ad37dfbebc9c02473f7f76fa79a651c2", "src_uid": "8ab25ed4955d978fe20f6872cb94b0da", "apr_id": "4b4dd4bf2c3d697732d3d5656dc1e580", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.7084043848964677, "equal_cnt": 36, "replace_cnt": 17, "delete_cnt": 3, "insert_cnt": 16, "fix_ops_cnt": 36, "bug_source_code": "#include <cstdio>\n#include <cstdlib>\n#include <cmath>\n#include <iostream>\n#include <sstream>\n#include <string>\n#include <cstring>\n#include <map>\n#include <set>\n#include <vector>\n#include <stack>\n#include <queue>\n#include <deque>\n#include <utility>\n#include <algorithm>\n#include <bitset>\n#include <cassert>\n\nusing namespace std;\n\n#define SZN 105\n#define MXN 100005\n#define _ ios_base::sync_with_stdio(0); \n// #define debug\n#define x first\n#define y second\n\ntypedef long long int LLI;\ntypedef pair<int, int> PII;\n\nconst int inf = 0x3f3f3f3f;\nconst int mod = 1e9 + 7;\nconst double eps = 1e-8; // 1e-10 sometimes; check eps when using double\nconst double pi = acos(-1.0);\nconst int dx[] = {-1, 1, 0, 0};\nconst int dy[] = {0, 0, -1, 1};\n\n/* structs */\n\n/* globals */\nLLI s;\nint a[SZN], num;\nmap<LLI, LLI> memo[SZN];\n\n/* function declarations */\nLLI dfs(int cur, LLI sum) {\n    if (sum > s) return 0;\n    if (cur == num) {\n        if (sum == s) return 1;\n        return 0;\n    }\n    if (memo[cur].count(sum)) return memo[cur][sum];\n    LLI res = 0;\n    if (a[cur]) res = dfs(cur+1, sum+(1LL<<cur))*2;\n    else res = dfs(cur+1, sum) + dfs(cur+1, sum+(1LL<<(cur+1)));\n    return memo[cur][sum] = res;\n}\n\n\n/* Problem */\nint main() { _ // disable sync with stdio\n    LLI x, tmp;\n    while (cin >> s >> x) {\n        tmp = x;\n        num = ceil(log2(s+1));\n        for (int i = 0; i < num; ++i) {\n            a[i] = tmp & 1;\n            tmp >>= 1;\n        }\n#ifdef debug\n        cout << \"digits: \" << num << \"\\n\";\n        for (int i = 0; i < num; ++i) cout << a[i];\n        cout << \"\\n\";\n#endif\n        LLI res = dfs(0, 0);\n        if (s == x) res -= 2;\n        cout << res << \"\\n\";\n        for (int i = 0; i < num; ++i) memo[i].clear();\n    }\n\n    return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "c624311b8651b0f5dc8bb9aee8321ff2", "src_uid": "18410980789b14c128dd6adfa501aea5", "apr_id": "cbcb26ceb7e28c115a98ce524697bde2", "difficulty": 1700, "tags": ["dp", "math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.2779984114376489, "equal_cnt": 23, "replace_cnt": 13, "delete_cnt": 3, "insert_cnt": 7, "fix_ops_cnt": 23, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n#define pb push_back\n#define mk make_pair\nint main(){\n\tlong long int p,d;\n\tcin >> p;\n\tcin >> d;\n\tif(d == 0){\n\t\tcout << p << endl;\n\t\treturn 0;\n\t}\n\n\tvector<pair<long long int, long long int> >v;\n\tlong long int price,ll;\n\tfor(long long int i = 1; i <= d; i++){\n\t\tprice = p-i;\n\t\tll = price;\n\t\t\n\t\tif(price %10 == 9){\n\t\t\tint cnt = 0;\n\t\t\twhile(price>0){\n\t\t\t\tif(price%10 != 9)\n\t\t\t\t\tbreak;\n\t\t\t\tcnt++;\n\t\t\t\tprice /= 10;\n\t\t\t}\n\t\t\tv.pb(mk(cnt, ll));\n\t\t}\n\t}\n\tsort(v.begin(), v.end());\n\tcout << v[v.size()-1].second<<endl;\n\n\n\n\treturn 0;\n}\n\n", "lang": "GNU C++11", "bug_code_uid": "3b07862caf89cb774ad0a9256a61938c", "src_uid": "c706cfcd4c37fbc1b1631aeeb2c02b6a", "apr_id": "3bac5ec314fac74e016fd0a467989708", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.23761031907671418, "equal_cnt": 23, "replace_cnt": 13, "delete_cnt": 3, "insert_cnt": 7, "fix_ops_cnt": 23, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n#define pb push_back\n#define mk make_pair\nint main(){\n\tlong long int p,d;\n\tcin >> p;\n\tcin >> d;\n\tif(d == 0){\n\t\tcout << p << endl;\n\t\treturn 0;\n\t}\n\n\tvector<pair<long long int, long long int> >v;\n\tlong long int j,price,ll;\n\tfor(long long int i = 1; i <= d; i+=1){\n\t\tprice = p-i;\n\t\tj = i;\n\t\tif(price%10 == 9)\n\t\t\tbreak;\n\t}\n\n\n\n\n\tfor(long long int i = j; i <= d;){\n\t\tprice = p-i;\n\t\tll = price;\n\t\t\n\t\tif(price %10 == 9){\n\t\t\tint cnt = 0;\n\t\t\twhile(price>0){\n\t\t\t\tif(price%10 != 9)\n\t\t\t\t\tbreak;\n\t\t\t\tcnt++;\n\t\t\t\tprice /= 10;\n\t\t\t}\n\t\t\tif(price == 0){\n\t\t\t\tcout << ll <<endl;\n\t\t\t\treturn 0;\n\t\t\t}\n\n\t\t\tv.pb(mk(cnt, ll));\n\t\t}\n\t}\n\tif(v.size() == 0){\n\t\tcout << p <<endl;\n\t\treturn 0;\n\t}\n\tsort(v.begin(), v.end());\n\tcout << v[v.size()-1].second<<endl;\n\treturn 0;\n}\n\n", "lang": "GNU C++11", "bug_code_uid": "449bc18bf877072e259b45224341230a", "src_uid": "c706cfcd4c37fbc1b1631aeeb2c02b6a", "apr_id": "3bac5ec314fac74e016fd0a467989708", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8099352051835853, "equal_cnt": 15, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 12, "fix_ops_cnt": 15, "bug_source_code": "#include <iostream>\n#include <algorithm>\n\nusing namespace std;\ntypedef long long ll;\n\nint main() {\n    ll p, d; cin >> p >> d;\n    ll num = p - d, mul = 1;\n    ll currD = num;\n    while(num <= p && currD) {\n       ll d = currD % 10;\n       if(d != 9) {\n           ll diff = 9 - d;\n           if(num + diff * mul <= p) num += diff * mul;\n           else break;\n       }\n       \n       mul *= 10;\n       currD /= 10;\n    }\n    ll rem = p - num;\n    while(rem >= mul) {\n        ll check = mul/10;\n        ll d = (num/check) % 10;\n        if(d * mul <= rem) {\n            num += d * mul;\n        } else if(rem > mul) {\n            while(rem > mul) {\n                num += mul;\n                rem -= mul;\n            }\n        }\n    }\n    cout << num << endl;\n} ", "lang": "GNU C++11", "bug_code_uid": "475919dfa52457aa4b5ebf000ae54582", "src_uid": "c706cfcd4c37fbc1b1631aeeb2c02b6a", "apr_id": "bf5ab87eda5aa2999f5d83610e7c7d46", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.2866698518872432, "equal_cnt": 18, "replace_cnt": 13, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 18, "bug_source_code": "#include <iostream>\n#include <stdio.h>\n#include<bits/stdc++.h>\n#define ll long long\n#define fr first\n#define sc second\n#define ii pair < int , int >\n#define mp make_pair\nusing namespace std;\nll s , x;\nmap < pair < pair < ll , int > , ii > , ll > memo;\nll solve(ll sum , int bt,int ok1 , int ok2)\n{\n    if(sum  > s || bt > 40)\n        return 0;\n    if(sum == s && ok1 && ok2 && bt == 40)\n        return 1;\n    ll &ret = memo[mp(mp(sum,bt),mp(ok1,ok2))];\n    if(ret !=0)\n        return ret-1;\n    ll y = (1LL<<bt)&x;\n    ll x1 = 0 , x2 = 0;\n    if(y)\n    {\n        ll sum1 = 0;\n        sum1 = sum +1LL * (1LL<<bt);\n        x1 = solve(sum1 , bt+1,ok1,1);\n        x2 = solve(sum1 , bt+1,1,ok2);\n    }\n    else\n    {\n        ll sum1 = sum + 1LL * (1LL<<bt) * 2;\n        x1 = solve(sum,bt+1,ok1,ok2);\n        x2 = solve(sum1,bt+1,1,1);\n    }\n    ret = x1+x2+1;\n    return x1+x2;\n}\nint main()\n{\n  cin>>s>>x;\n  cout<<solve(0,0,0,0);\n}\n", "lang": "GNU C++11", "bug_code_uid": "0495a58170da54e296059c4b1f12fc36", "src_uid": "18410980789b14c128dd6adfa501aea5", "apr_id": "058ea7301335fa80febcc9fe6e7901e4", "difficulty": 1700, "tags": ["dp", "math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6083916083916084, "equal_cnt": 10, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 10, "bug_source_code": "#include <iostream>\n\nusing namespace std;\n\nint main()\n{\n    int n,k;\n    cin >> n >> k;\n    int P[n+1];\n    for (int i=1; i<n+1; i++){\n        P[i]=i;\n    }\n    int ile = 1;\n    while (k>ile){\n        int ws = n;\n        while ( P[ws-1] != ws-1) ws--;\n        if (P[ws] == ws){\n            P[ws] = ws-1;\n            P[ws-1] = ws;\n            ile++;\n            for (int i=ws+1; i<n+1; i++) P[i] = i;\n        }\n        else{\n            P[ws-1] = ws;\n            P[ws] = ws-1;\n            ile++;\n            for (int i=ws+1; i<n+1; i++) P[i] = i;\n        }\n    }\n\n    for (int i=1; i<n+1; i++){\n        cout << P[i] << \" \";\n    }\n\n}\n", "lang": "GNU C++11", "bug_code_uid": "a49072bd9eb07b0e4fbf2dd2b1b0f315", "src_uid": "e03c6d3bb8cf9119530668765691a346", "apr_id": "37f646ce4dccde6faad1d5733fea3ad5", "difficulty": 1900, "tags": ["math", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.2052401746724891, "equal_cnt": 16, "replace_cnt": 12, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 16, "bug_source_code": "#include<stdio.h>\n\nstruct node{\n\tint tos = 0;\n\tint to[10];\n\tvoid add(int x){\n\t\tto[++tos] = x;\n\t}\n\tbool operator < (node &x){\n\t\treturn tos <= x.tos;\n\t}\n}a[10];\n\nint main(){\n\t\tint n, m;\n\t\tscanf(\"%d%d\", &n, &m);\n\t\tfor(int i = 1; i <= n ;++i){\n\t\t\tint x, y;\n\t\t\tscanf(\"%d%d\", &x, &y);\n\t\t\ta[x].add(y);\n\t\t\ta[y].add(x);\n\t\t}\n\t\tif(n < 7)\n\t\t\tprintf(\"%d\\n\", m);\n\t\telse if(m>15) printf(\"%d\\n\", 16);\n\t\telse printf(\"%d\\n\", m);\n\t\n}", "lang": "GNU C++17", "bug_code_uid": "6e71763405c4aa1449e64a38ff9a5565", "src_uid": "11e6559cfb71b8f6ca88242094b17a2b", "apr_id": "a063aeb1e123db33a5b529c1f26e8f69", "difficulty": 1700, "tags": ["graphs", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.0636165577342048, "equal_cnt": 26, "replace_cnt": 24, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 27, "bug_source_code": "include <stdio.h>\n#include <stdlib.h>\nchar str[210];\nint main()\n{\n    int n,u,d,l,r,i,j,ans;\n    while(scanf(\"%d\",&n)!=EOF)\n    {\n        scanf(\"%s\",str);\n\n        for(i=0;i<n;++i)\n        {\n            for(j=i;j<n;++j)\n            {\n                u=d=l=r=0;\n                  ans=0;\n                if(str[j]=='U')\n                    u++;\n                if(str[j]=='D')\n                    d++;\n                if(str[j]=='L')\n                    l++;\n                if(str[j]=='R')\n                    r++;\n                if(u==d&&l==r)\n                    ans++;\n            }\n        }\n        printf(\"%d\\n\",ans);\n    }\n\n    return 0;\n}\n", "lang": "MS C++", "bug_code_uid": "7b75b578aa063d9ff2c574b43f8ba47a", "src_uid": "7bd5521531950e2de9a7b0904353184d", "apr_id": "2343ef78dbbcdcf7ed814fb9689c0b3f", "difficulty": 1000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9714285714285714, "equal_cnt": 14, "replace_cnt": 4, "delete_cnt": 4, "insert_cnt": 5, "fix_ops_cnt": 13, "bug_source_code": "#include <bits/stdc++.h>\n \n//BIAR MANTAB LAH YA\n#define Willy using\n#define Indrayana namespace\n#define Komara std\n \nWilly Indrayana Komara;\n\nvoid king(int a, int b, int c, int d)\n{\n    int count = 0;\n    if (a > c && b < d)\n    {\n        while (a != c || b != d)\n        {\n            a--;\n            b++;\n            count++;\n        }\n    }\n    else if (a < c && b < d)\n    {\n        while (a != c || b != d)\n        {\n            a++;\n            b++;\n            count++;\n        }\n    }\n    else if (a < c && b > d)\n    {\n        while (a != c || b != d)\n        {\n            a++;\n            b--;\n            count++;\n        }\n    }\n    else if (a > c && b > d)\n    {\n        while (a != c || b != d)\n        {\n            a--;\n            b--;\n            count++;\n        }\n    }\n    if (a == c && b != d)\n    {\n        count += abs(b-d);\n    }\n    else if (b == d && a != c)\n    {\n        count += abs(a-c);\n    }\n    cout << count << '\\n';\n}\n\nvoid bishop(int a, int b, int c, int d)\n{\n    if ((a+b) % 2 != (c+d) % 2)\n    {\n        cout << \"0\" << ' ';\n    }\n    else if (abs(a-c) == abs(b-d))\n    {\n        cout << \"1\" << ' ';\n    }\n    else\n    {\n        cout << \"2\" << ' ';\n    }\n    \n}\n\nvoid rook(int a, int b, int c, int d)\n{\n    if (a == c || b == d)\n    {\n        cout << \"1\" << ' ';\n    }\n    else if (a != c && b != d)\n    {\n        cout << \"2\" << ' ';\n    }\n}\n\nint main()\n{\n    ios_base::sync_with_stdio(false);\n    cin.tie(NULL);\n    int r1, c1, r2, c2;\n    cin >> r1 >> c1 >> r2 >> c2;\n    rook(r1, c1, r2, c2);\n    bishop(r1, c1, r2, c2);\n    king(r1, c1, r2, c2);\n    return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "ba4f3c3abb1cb874798e2f0e0d405584", "src_uid": "7dbf58806db185f0fe70c00b60973f4b", "apr_id": "24dd5c373a6dc8047853e198a046dd9b", "difficulty": 1100, "tags": ["graphs", "math", "shortest paths"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9801980198019802, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include <iostream>\n#include <string>\n#include <algorithm>\n#include <vector>\n#include <stack>\n#include <queue>\n#include <deque>\n#include <set>\n#include <map>\n#include <math.h>\n#include <cmath>\nusing namespace std;\n\n\n\nint main() {\n\t\n\tint a[113], n;\n\tcin >> n;\n\tfor (int i = 1; i <= n; ++ i){\n\t\tcin >> a[i];\n\t}\n\tif (a[1] % 2 == 1 && a[n] % 2 == 1){\n\t\tcout << \"YES\";\n\t}\n\telse {\n\t\tcout << \"NO\";\t\n\t}\n\t\n}", "lang": "MS C++", "bug_code_uid": "01da3efe09e3c043fd470b516a1d4006", "src_uid": "2b8c2deb5d7e49e8e3ededabfd4427db", "apr_id": "b05765948b1c7050d27d9802e29509b3", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.12445980985306827, "equal_cnt": 13, "replace_cnt": 11, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 14, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\nstring commands;\nint n;\nbool moved=0,founded=0;\nint solver(int i,int x,int y,int idx){\n\n\n    if(x==0&&y==0&&idx!=-1){\n       founded=1; return 0;\n    }\n    if(i==n){\n        return 0;\n       // else return -(int)1e6;\n    }\n\n    int ret=0;\n  if(commands[i]=='U'){\n            ret=max(solver(i+1,x,y+1,1)+1,ret);\nmoved=1;\n    }\n    if(commands[i]=='D'){\n            ret=max(solver(i+1,x,y-1,2)+1,ret);\nmoved=1;\n    }\n    if(commands[i]=='L'){\n\n            ret=max(solver(i+1,x-1,y,3)+1,ret);\nmoved=1;\n    }\n    if(commands[i]=='R'){\n\n            ret=max(solver(i+1,x+1,y,4)+1,ret);\nmoved=1;\n    }\n\n        ret=max(solver(i+1,x,y,idx),ret);\n\n  return ret;\n\n\n}\n\nint main() {cin>>n;\ncin>>commands;\n\nint x=solver(0,0,0,-1);\nif(founded)cout<<x;\nelse cout<<0;\n\n    return 0; }", "lang": "GNU C++11", "bug_code_uid": "cb2cce856a611b8b73d52930044c2a36", "src_uid": "b9fa2bb8001bd064ede531a5281cfd8a", "apr_id": "b53ab9d903a4d1b40e4bbfe3ffe87b74", "difficulty": 1000, "tags": ["greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.1265332472562944, "equal_cnt": 10, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "#include <iostream>\nusing namespace std;\n#include <math.h>\n#include <map>\n#include <queue>\nint main()\n{\n    float r, x1,y1,x2,y2;\n    cin >> r >> x1 >> y1 >> x2 >> y2;\n    pair<int,int> temp[13] = {pair<int,int>(-1,1),pair<int,int>(0,1),pair<int,int>(1,1),pair<int,int>(-1,0),pair<int,int>(0,0),pair<int,int>(1,0),pair<int,int>(-1,-1),pair<int,int>(0,1),pair<int,int>(1,-1),pair<int,int>(2,0),pair<int,int>(-2,0),pair<int,int>(0,2),pair<int,int>(0,-2)};\n    int res = 0, tx, ty;\n    pair<int,int> c;\n    queue<int> x,y,step;\n    x.push(x1);\n    y.push(y1);\n    step.push(0);\n    queue<int> q;\n    map<pair<int,int>,int> check;\n    while(1)\n    {\n        tx = x.front();\n        ty = y.front();\n        res = step.front();\n        if (tx == x2 && ty == y2)\n            break;\n        step.pop();\n        x.pop();\n        y.pop();\n        for (int i = 0; i < 13; ++i)\n        {\n            c.first = tx + r * temp[i].first;\n            c.second = ty + r * temp[i].second;\n            if (check[c] != 1)\n            {\n                x.push(c.first);\n                y.push(c.second);\n                step.push(res + 1);\n                check[c] = 1;\n            }\n        }\n    }\n    \n    cout << res;\n    system(\"Pause\");\n    return 0;\n}", "lang": "MS C++", "bug_code_uid": "10ccf3bc8e4a2726c9141893003d7edc", "src_uid": "698da80c7d24252b57cca4e4f0ca7031", "apr_id": "64d5889d6ff1b0455b23cda19515911e", "difficulty": 1400, "tags": ["geometry", "math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.772093023255814, "equal_cnt": 13, "replace_cnt": 2, "delete_cnt": 6, "insert_cnt": 4, "fix_ops_cnt": 12, "bug_source_code": "#include <iostream>\n#include <cstdio>\nusing namespace std;\n\nint main(){\n   long long a,b,c;\n   while (1){\n   cin>>a>>b>>c;\n   \n   if ((b+c)%2)\n      cout<<(2*a+b-1)*b<<endl;\n   else cout<<(2*a+b-1)*b-(a+b-1)<<endl;   \n}\n   return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "5cb6a014edc58aa8f40d99732133772a", "src_uid": "8ab25ed4955d978fe20f6872cb94b0da", "apr_id": "eb475ab3665595ef371c5a49e3aeffd4", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.689119170984456, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "#include<iostream>\n#include<set>\n#include<algorithm>\nusing namespace std;\nint main(){\n\tint x,y;\n\tset <int> a,b;\n\tset< pair<int, int>> c;\n\tfor(int i=0;i<8;i++){\n\t\tcin>>x>>y;\n\t\ta.insert(x);\n\t\tb.insert(y);\n\t\tc.insert(make_pair(x,y));\n}\n\t/*x=*++a.begin();\n\ty=*++b.begin();*/\n\tif(a.size==3 && b.size==3 && c.size==8)\n\t\tcout<< \"respectable\";\n\telse cout<<\"ugly\";\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "3a4c68402174a95ddeafb1b6570406c0", "src_uid": "f3c96123334534056f26b96f90886807", "apr_id": "0e13e8e2e64ad9a6d5bf818a8c60dcdd", "difficulty": 1400, "tags": ["sortings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.5368682684341343, "equal_cnt": 19, "replace_cnt": 11, "delete_cnt": 3, "insert_cnt": 5, "fix_ops_cnt": 19, "bug_source_code": "#include<iostream>\n#include<stdio.h>\n#include<string.h>\n#include<algorithm>\n#include<stack>\n#include<map>\n#include<queue>\n#define ll long long\nusing namespace std;\nint m,b;\nint a[10005][10005];\nll work(int x,int y)\n{\n    ll sum=0;\n    for(int i=0;i<=x;i++)\n        for(int j=0;j<=y;j++)\n            sum+=a[i][j];\n    return sum;\n}\nint main()\n{\n    while(scanf(\"%d%d\",&m,&b)!=EOF)\n    {\n        for(int i=0;i<=b;i++)\n            for(int j=0;j<=m*b;j++)\n                a[i][j]=i+j;\n        //ll sum=0;\n        ll res=0;\n        for(int i=0;i<=b;i++)\n          res=max(res,work(i,m*(b-i)));\n          cout<<res<<endl;\n\n    }\n    return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "322c1a67e93f9d46927125c270c04741", "src_uid": "9300f1c07dd36e0cf7e6cb7911df4cf2", "apr_id": "0e24383e2e0bd79ed46cf361592201f2", "difficulty": 1300, "tags": ["math", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8211396728383965, "equal_cnt": 21, "replace_cnt": 15, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 20, "bug_source_code": "#include <bits/stdc++.h>\n\ntypedef long long int lli;\n\nusing namespace std;\n\n//#define pi 3.141592653589793238\ntypedef pair<lli,lli> pll;\ntypedef map<lli,lli> mll;\ntypedef set<lli> sl;\ntypedef map<int,int> mii;\ntypedef set<int> si;\ntypedef pair<double,double> pdd;\ntypedef map<double,lli> mdl;\ntypedef set<double> sd;\n#define x first\n#define y second\n#define mp make_pair\n#define pb push_back\nconst lli mod = 1e9 + 7;\n\n\nlli gcd(lli a, lli b)\n{\n    if(b < a)\n    {\n        int temp = a;\n        a = b;\n        b = temp;\n    }\n    if(a == 0)\n    {\n        return b;\n    }\n    return gcd(b%a,a);\n}\n\nlli lcm(lli a, lli b)\n{\n    return (a*b/gcd(a,b));\n}\n\nvector<lli> getprimes()\n{\n    vector <lli> pl(101,1);\n    for(int i = 2; i<=100; i++)\n    {\n        if(pl[i] == 1)\n        {\n            for(int j = 2*i; j<=100; j+=i)\n            {\n                pl[j] = 0;\n            }\n        }\n    }\n    return pl;\n}\n\nlli primefactorise(int n)\n{\n    if(n == 1)\n    {\n        return 1;\n    }\n    lli ans = n;\n    while (n%2 == 0)\n    {\n        n = n/2;\n        if(n != 1)\n        {\n            ans += n;\n        }\n    }\n\n    for (int i = 3; i <= sqrt(n); i = i+2)\n    {\n        while (n%i == 0)\n        {\n            n = n/i;\n            if(n != 1)\n            {\n                ans += n;\n            }\n        }\n    }\n    ans += 1;\n    return ans;\n}\n\nlli power(lli a,lli b)\n{\n    lli ans = 1;\n    while(b > 0)\n    {\n        if(b%2 == 1)\n        {\n            ans *= a;\n            ans = ans%mod;\n        }\n        b/=2;\n        a*=a;\n        a = a%mod;\n    }\n    return ans%mod;\n}\n\nvector<lli> getbinary(lli x)\n{\n    vector <lli> bin(8,0);\n    lli iter = 0;\n    while(x > 0)\n    {\n        if(x%2 == 0)\n        {\n            bin[iter] = 0;\n        }\n        else\n        {\n            bin[iter] = 1;\n        }\n        x/=2;\n        iter++;\n    }\n    return bin;\n}\n\nlli dist(pll a, pll b)\n{\n    return (b.x-a.x)*(b.x-a.x) + (b.y-a.y)*(b.y - a.y);\n}\n\nint main()\n{\n    ios_base::sync_with_stdio(false);\n    cin.tie(NULL);\n    cout.precision(20);\n    string l,r;\n    cin >> l >> r;\n    lli p = power(10,r.size()-1);\n    lli num = 0,ans = -1,numl = 0;\n    for(int i = 0; i<r.size(); i++)\n    {\n        num += (r[i]-'0')*p;\n        p/=10;\n    }\n    p = power(10,l.size()-1);\n    for(int i = 0; i<l.size(); i++)\n    {\n        numl += (l[i]-'0')*p;\n        p/=10;\n    }\n    p = power(10,r.size()-1);\n    lli temp;\n    for(int i = max(p,numl); i<=num; i++)\n    {\n        temp = 1;\n        lli num2 = 0;\n        lli num1 = i;\n        while(num1 > 0)\n        {\n            num2 +=  (9 - (num1%10))*temp;\n            num1/=10;\n            temp*=10;\n        }\n        if(i*num2 > ans)\n        {\n            ans = i*num2;\n        }\n    }\n    cout << ans << endl;\n}\n", "lang": "GNU C++14", "bug_code_uid": "e148dcd09771317b5dace04da1e59d5c", "src_uid": "2c4b2a162563242cb2f43f6209b59d5e", "apr_id": "afb25b9465ae3abb7ab115c329cbada2", "difficulty": 1600, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9908987485779295, "equal_cnt": 15, "replace_cnt": 0, "delete_cnt": 12, "insert_cnt": 2, "fix_ops_cnt": 14, "bug_source_code": "#include <bits/stdc++.h>\n\n#define ull long long\n#define ld long double\n#define sz size()\n#define aull(x) (x).begin(), (x).end()\n#define mp make_pair\n#define pb push_back\n#define uull unsigned long long\n\nusing namespace std;\n\null norm_ceil(ull n) {\n\treturn n / 4 + (ull)(n % 4 != 0);\n}\n\nint main()  {\n\t//freopen(\"input.txt\", \"r\", stdin);\n\t//freopen(\"output.txt\", \"w\", stdout);\n\tull n;\n\tcin >> n;\n\tchar c;\n\tcin >> c;\n\tull ans = 0;\n\tif (n % 2 == 0) {\n\t\tld t = (ld)(n);\n\t\tull k = (max(0, (ull)(norm_ceil(t)) - 1) * 2 + 1);\n\n\t\tans += k*6 + (k / 2)*4 + 1;\n\t} else {\n\t\tld t = (ld)(n);\n\t\tull k = (max(0, (ull)(norm_ceil(t)) - 1) * 2);\n\t\tans += k*6 + (k / 2)*4;\n\t}\n\t\n\tif (c == 'f') {\n\t\tans += 1;\n\t} else if (c == 'e')\n\t\tans += 2;\n\telse if (c == 'd')\n\t\tans += 3;\n\telse if (c == 'a')\n\t\tans += 4;\n\telse if (c == 'b')\n\t\tans += 5;\n\telse if (c == 'c')\n\t\tans += 6;\n\tcout << ans << \"\\n\";\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "65df818386c2126a9fb99bebc881c03c", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "apr_id": "b4493255b079c399ae17f2f6a3ef78b3", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.9219600725952813, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 5, "bug_source_code": "#include<bits/stdc++.h>\nint main(){\n    string str;\n    cin>>str;\n    int n=str.length();\n    string tmp=str+str;\n    for(int i=1;i<=n;i++){\n        string sub=tmp.substr(i,str.size());\n        if(sub==str)\n        cout<<i;\n    }\n    cout<<n;\n    \n    \n}", "lang": "GNU C++14", "bug_code_uid": "60f3f2d9dd0de5ca4d218ef87405cb86", "src_uid": "8909ac99ed4ab2ee4d681ec864c7831e", "apr_id": "86028518ff9a24eb5a1eeceea9d58701", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.2286401925391095, "equal_cnt": 15, "replace_cnt": 11, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 15, "bug_source_code": "#include<iostream>\n#include<string>\n\nusing namespace std;\nint main()\n{\n    string s;\n    cin>>s;\n    string r=s;\n    \n    int n=s.size();\n    int count = 0;\n    char tmp[n];\n    while(1){\n        tmp[0]=s[n-1];\n        for(int j=1;j<n;j++){\n            tmp[j]=s[j-1];\n        }\n       s=tmp;\n       //cout<<s;\n       if(s==r) break; \n       else count++;\n   }  \n   cout<<++count<<endl;\n   \n    //for(int i=0;i<n;i++) cout<<tmp[i];\n}", "lang": "GNU C++14", "bug_code_uid": "d38d35cc946965909920899499ad64ed", "src_uid": "8909ac99ed4ab2ee4d681ec864c7831e", "apr_id": "b1597e288fceb551a0789164005233c1", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.999806314158435, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include<iostream>\n\nusing namespace std;\n\nint a[10][260]=\n{\n{0},\n{2,1},\n{32,30,80,109},\n{6824,59808,147224,415870,1757896,1897056,4898872,7593125},\n{776830421,290516100,746623577,293783147,33900006,735127505,565460332,428982705,472062098,161873957,117354594,515619293,578944191,312106242,569389279,391464593},\n{261086313,584837659,683961846,468868529,211593382,736955478,229471758,157617135,398169441,360252438,629394768,264125799,647490480,342079395,391579767,225200475,486011304,513156108,628771752,132906648,142138221,20119449,444199674,195188679,387329805,44684703,651912135,737154512,612549793,519860281,186175544,212568440},\n{240805271,239509872,581127897,6511239,156126222,509425833,672407328,366667722,459185405,509737025,554790222,165216555,703150560,74806569,398730015,383350905,506108358,51326142,298053147,104256117,391428765,374020479,206607807,87664059,275899176,56407680,551553401,448939463,582889860,129676638,226078251,135769095,61292868,578972226,190181628,390739055,184587732,446575689,732674124,232198470,676760679,352474101,611444862,575661807,628905585,320813094,522840969,469781928,156006018,554473341,239654268,643714911,433540170,199307003,496385218,291740751,67309914,370826673,202356819,279421821,421203111,63744786,520987612,550671827},\n{482164403,768209115,462063756,154906374,36099042,341766705,678182556,621882744,478771358,231881111,175889805,243630450,168908523,671961765,55761813,652682670,773939082,517628076,756201264,124604900,750976272,498253248,676047609,137170026,705610017,495032139,561797418,703097347,500815609,95984586,739707108,265613565,387099846,777331779,594676173,591219559,407997044,208947235,93337440,478908360,685013007,487033953,671903001,39521181,738490312,33785059,465470131,310453920,54648783,346831137,427694175,474743430,705296781,435828036,429824745,663532359,261388683,244690731,533997135,596108961,506813013,371892402,590145264,104733162,143420103,654339672,700348950,685038942,578826927,286484229,501639192,434962491,299270097,27702486,335375775,111746817,565603164,294926121,676063665,735862995,710035809,437011960,668528077,138765186,508213986,615036450,353784942,624827616,343900011,241289776,52410890,72018835,352406796,415705878,4802637,376367145,65589678,333633477,341834527,303717460,282387700,42951006,254706039,423048528,526429710,68131467,669954708,12787348,500636381,317959019,479433192,657133515,416259390,610216692,340129188,44594256,257373347,138718678,530767740,292922628,37220268,605295159,480722613,458170419,30540300,487159055,232966794,149150650},\n{412133651,386543325,139952108,289303402,102404925,317067177,396414708,80515854,663739304,317300809,228877044,493725043,715317967,490300965,315527373,743539734,488329191,553627998,533025234,242583957,706116537,614109258,645447222,523195911,492109128,722623041,111085128,766395126,654378921,691964847,496688157,399056049,654363234,102052314,191720088,473910948,259736526,332840025,388047555,665791056,627111387,139696515,441456687,443032569,283264821,771641703,452641455,511306362,117572859,127701891,721298331,176520078,357242229,611296308,696994956,405628839,429224274,465336054,695091546,689828796,574648641,351220905,507964023,675326610,517248963,453528621,220301928,494463186,681789969,339589656,44524053,417125457,339589404,747135963,341780733,734158215,396817281,21997836,5728464,147611205,456248898,714128667,377654949,3862068,128418948,589390074,304947090,11703825,228266073,127304142,429215724,361541124,521572968,468358191,341231688,65323503,613778508,15985323,291661029,410970006,591638112,349541550,89967528,224922159,361094166,584206074,640051812,324264456,652625388,693768537,11740617,309238398,211085469,194905872,639416484,110110707,296645895,748118511,131177718,511142751,775975599,421403409,475528473,434685258,1768977,80301375,708023862,569195676,56238084,632887668,88089750,631539342,396695565,38780154,695798271,469819224,439587099,69045921,682966116,112310856,64943298,534475872,40215357,389728458,286368453,736006257,501181650,54829908,603489402,338032656,512182818,627500097,462674016,3103092,157324491,43978329,596818971,259025598,9088632,91991781,577291428,211245489,429471231,142626330,172560633,510907446,444609585,758102058,375112647,744786693,276174402,19259856,233672418,745389414,225772848,23385663,324290610,519804558,120337812,402578568,360676008,450089262,551043738,337388940,512108856,28879011,690040638,106017282,558262341,99972432,608226003,612152037,42414435,776201013,39580443,518796945,494437752,583194366,723936555,415359657,309569589,751104774,166684527,249229170,353120823,130668327,753823584,580966092,561963717,543672234,393846327,586278000,327398400,278403867,156455586,363920382,190245195,290039148,547014447,466218648,146037150,585462906,666008595,691786683,374707494,622498779,231158277,685740951,115612245,681825249,545555745,551718468,277206615,640171035,757727334,195193908,658656684,457760646,225925875,505761984,18685233,506832921,112511021,396846646,290147622,113924623,669986155,336008070,63611061,238586775,119956662,616557739,772784623,334527774,410403148,51933421}\n};\n\nint main()\n{\n\tint n,k;\n\tcin>>n>>k;\n\tint p=0;\n\twhile ((1<<p)!=n) ++p;\n\tcout<<a[p][k-1]<<endl;\n\treturn 0;\n", "lang": "GNU C++", "bug_code_uid": "37d7518663563c0d4cb76bf4edf522d1", "src_uid": "cfe19131644e5925e32084a581e23286", "apr_id": "c8e13e97333166723effbce033b29be7", "difficulty": 2700, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.023184333011328707, "equal_cnt": 22, "replace_cnt": 13, "delete_cnt": 7, "insert_cnt": 3, "fix_ops_cnt": 23, "bug_source_code": "#include <algorithm>\n#include <string>\n#include <set>\n#include <map>\n#include <vector>\n#include <queue>\n#include <iostream>\n#include <iterator>\n#include <cmath>\n#include <cstdio>\n#include <cstdlib>\n#include <sstream>\n#include <fstream>\n#include <ctime>\n#include <cstring>\n#include <functional>\n#pragma comment(linker, \"/STACK:66777216\")\nusing namespace std;\n\nconst int ans[] = {0,2,1,32,30,80,109,6824,59808,147224,415870,1757896,1897056,4898872,7593125,776830421,290516100,746623577,293783147,33900006,735127505,565460332,428982705,472062098,161873957,117354594,515619293,578944191,312106242,569389279,391464593,261086313,584837659,683961846,468868529,211593382,736955478,229471758,157617135,398169441,360252438,629394768,264125799,647490480,342079395,391579767,225200475,486011304,513156108,628771752,132906648,142138221,20119449,444199674,195188679,387329805,44684703,651912135,737154512,612549793,519860281,186175544,212568440,240805271,239509872,581127897,6511239,156126222,509425833,672407328,366667722,459185405,509737025,554790222,165216555,703150560,74806569,398730015,383350905,506108358,51326142,298053147,104256117,391428765,374020479,206607807,87664059,275899176,56407680,551553401,448939463,582889860,129676638,226078251,135769095,61292868,578972226,190181628,390739055,184587732,446575689,732674124,232198470,676760679,352474101,611444862,575661807,628905585,320813094,522840969,469781928,156006018,554473341,239654268,643714911,433540170,199307003,496385218,291740751,67309914,370826673,202356819,279421821,421203111,63744786,520987612,550671827,482164403,768209115,462063756,154906374,36099042,341766705,678182556,621882744,478771358,231881111,175889805,243630450,168908523,671961765,55761813,652682670,773939082,517628076,756201264,124604900,750976272,498253248,676047609,137170026,705610017,495032139,561797418,703097347,500815609,95984586,739707108,265613565,387099846,777331779,594676173,591219559,407997044,208947235,93337440,478908360,685013007,487033953,671903001,39521181,738490312,33785059,465470131,310453920,54648783,346831137,427694175,474743430,705296781,435828036,429824745,663532359,261388683,244690731,533997135,596108961,506813013,371892402,590145264,104733162,143420103,654339672,700348950,685038942,578826927,286484229,501639192,434962491,299270097,27702486,335375775,111746817,565603164,294926121,676063665,735862995,710035809,437011960,668528077,138765186,508213986,615036450,353784942,624827616,343900011,241289776,52410890,72018835,352406796,415705878,4802637,376367145,65589678,333633477,341834527,303717460,282387700,42951006,254706039,423048528,526429710,68131467,669954708,12787348,500636381,317959019,479433192,657133515,416259390,610216692,340129188,44594256,257373347,138718678,530767740,292922628,37220268,605295159,480722613,458170419,30540300,487159055,232966794,149150650,412133651,386543325,139952108,289303402,102404925,317067177,396414708,80515854,663739304,317300809,228877044,493725043,715317967,490300965,315527373,743539734,488329191,553627998,533025234,242583957,706116537,614109258,645447222,523195911,492109128,722623041,111085128,766395126,654378921,691964847,496688157,399056049,654363234,102052314,191720088,473910948,259736526,332840025,388047555,665791056,627111387,139696515,441456687,443032569,283264821,771641703,452641455,511306362,117572859,127701891,721298331,176520078,357242229,611296308,696994956,405628839,429224274,465336054,695091546,689828796,574648641,351220905,507964023,675326610,517248963,453528621,220301928,494463186,681789969,339589656,44524053,417125457,339589404,747135963,341780733,734158215,396817281,21997836,5728464,147611205,456248898,714128667,377654949,3862068,128418948,589390074,304947090,11703825,228266073,127304142,429215724,361541124,521572968,468358191,341231688,65323503,613778508,15985323,291661029,410970006,591638112,349541550,89967528,224922159,361094166,584206074,640051812,324264456,652625388,693768537,11740617,309238398,211085469,194905872,639416484,110110707,296645895,748118511,131177718,511142751,775975599,421403409,475528473,434685258,1768977,80301375,708023862,569195676,56238084,632887668,88089750,631539342,396695565,38780154,695798271,469819224,439587099,69045921,682966116,112310856,64943298,534475872,40215357,389728458,286368453,736006257,501181650,54829908,603489402,338032656,512182818,627500097,462674016,3103092,157324491,43978329,596818971,259025598,9088632,91991781,577291428,211245489,429471231,142626330,172560633,510907446,444609585,758102058,375112647,744786693,276174402,19259856,233672418,745389414,225772848,23385663,324290610,519804558,120337812,402578568,360676008,450089262,551043738,337388940,512108856,28879011,690040638,106017282,558262341,99972432,608226003,612152037,42414435,776201013,39580443,518796945,494437752,583194366,723936555,415359657,309569589,751104774,166684527,249229170,353120823,130668327,753823584,580966092,561963717,543672234,393846327,586278000,327398400,278403867,156455586,363920382,190245195,290039148,547014447,466218648,146037150,585462906,666008595,691786683,374707494,622498779,231158277,685740951,115612245,681825249,545555745,551718468,277206615,640171035,757727334,195193908,658656684,457760646,225925875,505761984,18685233,506832921,112511021,396846646,290147622,113924623,669986155,336008070,63611061,238586775,119956662,616557739,772784623,334527774,410403148,51933421};\nint a,b,c,d,i,j,n,m,k;\nint main() {\n    scanf(\"%d%d\", &n, &k);\n    rept(i, 9) {\n        rep(j, (1 << i)) {\n            if ((1 << i) == n && j == k) {\n                printf(\"%d\\n\", ans[a]);\n            }\n            ++a;\n        }\n    }\n}", "lang": "GNU C++", "bug_code_uid": "6a15c62ce37b5f6f49fa0efc48c2e310", "src_uid": "cfe19131644e5925e32084a581e23286", "apr_id": "debe0eb97b23ce537a357d24624b98fd", "difficulty": 2700, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9627059843885516, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include <cstdio>\n#include <cstring>\n#include <algorithm>\n#include <vector>\n#include <cmath>\n#include <ctime>\n#include <cstdlib>\n#define pb push_back\ntypedef long long unsigned int llu;\ntypedef long long ll;\nusing namespace std;\nconst int N=2e5;\n\n\nint n,a,ans;\n\nint main(){\n    scanf(\"%d\",&n);\n    if(n==1){printf(\"Yes\\n\");return 0;}\n    if(n%2)\n        for(int i=0;i<n;i++){\n            scanf(\"%d\",&a);\n            if(i==0||i==n-1){\n                if(a%2)ans++;\n            }\n        }\n    if(ans==2)printf(\"Yes\\n\");\n    else printf(\"No\\n\");\nreturn 0;}\n", "lang": "GNU C++14", "bug_code_uid": "be9fb77b4f4338abb6cd710ee4037598", "src_uid": "2b8c2deb5d7e49e8e3ededabfd4427db", "apr_id": "399c62d3691a02efe3b18b3cd94c61d4", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9633577614923384, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n#define ull unsigned long long\n#define ll long long\n#define ld long double\n #define MOD (ll)(pow(10,9)+7)\n \nll fact(ll n){\n    if(n==1) return 1;\n    return (n*fact(n-1))%MOD;\n}\n \nll binsearch(ll n,ll x,ll pos,ll l,ll r){\n     ll count=1;\n     ll small=x-1;\n    ll big=n-x;\n    while(l<r){\n    ll mid=(l+r)/2;\n    if(mid>pos){\n        count=(count*big)%MOD;\n        big--;\n        r=mid;\n    }else if(mid<pos){\n        count=(count*small)%MOD;\n        small--;\n        l=mid+1;\n    }else break;\n    }\n    count=(count*fact(big+small))%MOD;\n    return count;\n}\n \nint main() {\n \n      ll n,x,pos;\n      cin>>n>>x>>pos;\n      ll count=binsearch(n,x,pos,0,n);\n      cout<<count%(MOD);\n \n}\n ", "lang": "GNU C++17", "bug_code_uid": "9caca5a0f2c48619c5aba55758146226", "src_uid": "24e2f10463f440affccc2755f4462d8a", "apr_id": "cde05a3240727978ae3a1dde843f790b", "difficulty": 1500, "tags": ["combinatorics", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.265531914893617, "equal_cnt": 12, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 11, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\nmap <char, int> mp;\nint main()\n{\n    int i, j, k, n, m, t, p, cas=1;\n    char arr[101];\n    while(scanf(\"%s\", arr))\n    {\n        m=0;\n        p=strlen(arr);\n        for( i=0; i<p; i++)\n        {\n            mp[arr[i]]++;\n        }\n        for( i=0; i<p; i++)\n        {\n            if(mp[arr[i]]>=1)\n            {\n                m++;\n                mp[arr[i]]=0;\n            }\n        }\n        printf(\"%d\\n\", m);\n        for( i=0; i<p; i++)\n        {\n            mp[arr[i]]=0;\n        }\n    }\n    return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "8c2caeb9ed1f2b2879f9fd236a9d0d5c", "src_uid": "8909ac99ed4ab2ee4d681ec864c7831e", "apr_id": "47a2349e6387d45077ed0b58a59cbbe4", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.990152193375112, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include<iostream>\nusing namespace std;\nint main()\n{\n\tint a[1000],b[1000],j,i,n,m,r,min,max,k;\n\tcin >> n >> m >> r;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tcin >> a[i];\n\t}\n\tfor(i=0;i<m;i++)\n\t{\n\t\tcin >> b[i];\n\t}\n\tmin =a[0];\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif (min > a[i])\n\t\t{\n\t\t\tmin =a[i];\n\t\t}\n\t\telse\n         {\n\t\tmin =min;\n\t     }\n\t}\n\tk=r/min;\n\tmax=b[0];\n\tfor(i=0;i<m;i++)\n\t{\n\t\tif (max < b[i])\n\t\t{\n\t\t\tmax =b[i];\n\t\t}\n\t\telse\n         {\n\t    \tmax =max;\n\t     }\n\t }\n\t \n\t \n\t \n\t \tj=max*k-k*min+ r ;\n\t \tif (j>0)\n\t \t{\n\t \t  cout <<j;\n\t    }\n\t    else\n\t    {\n\t      cout <<r;\n\t     }\n\n\t\t }\n", "lang": "GNU C++11", "bug_code_uid": "75865e82b246dfaaeb164dd5dc396de3", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "apr_id": "77010ef556893cd7720a33a98aff1040", "difficulty": 800, "tags": ["greedy", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.20168067226890757, "equal_cnt": 19, "replace_cnt": 12, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 19, "bug_source_code": "#include <bits/stdc++.h>\n\nusing namespace std;\n\nint a[30];\nbitset<1000000010> b;\nint n;\nint cont;\n\nvoid backtrack(int u) {\n\t\tfor(int i = a[u]; i > 0; i--) {\n\t \t\tif(!b[i]) {\n\t \t\t\tcont += i;\n\t\t\t\tb[i] = 1;\n\t\t\t\tif(u == n-1) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tbacktrack(u+1);\n\n}\n\nint main() {\n\tscanf(\"%d\", &n);\n\tfor(int i = 0; i < n; i++) scanf(\"%d\", &a[i]);\n\tcont = 0;\n\tbacktrack(0);\n\tprintf(\"%d\\n\", cont);\n\n}\n// 1475066889484", "lang": "GNU C++", "bug_code_uid": "49dd4952c321913e9ca73d281daf1ba1", "src_uid": "3c4b2d1c9440515bc3002eddd2b89f6f", "apr_id": "c483390813ac71dbc678c56050a229f8", "difficulty": 1100, "tags": ["greedy", "sortings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.19538461538461538, "equal_cnt": 11, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 11, "bug_source_code": "#include <iostream>\n#include <vector>\nusing namespace std;\nvector<int> V1;\nvector<int> V2;\n\nint start(int a, int n){\n    int i=2,m=n;\n    while (m<a) {\n        m=n*i;\n        ++i;\n    }\n    return m;\n}\n\nint main () {\n    int x,y,a,b,n,m,cpt=0;\n    cin>>x>>y>>a>>b;\n    n=start(a,x);\n    //m=start(a,y);\n    int i=0;\n    while ((n+x*i)<=b) {\n        V1.push_back(n+x*i);\n        ++i;\n    }\n    /*i=0;\n    while ((m+y*i)<=b) {\n        V2.push_back(m+y*i);\n        ++i;\n    }*/\n    for (int j=0; j<V1.size();++j) {\n        //cout <<V1[j]<<\" / \"<<y<<\" = \"<<V1[j]/y<<endl;\n        if (V1[j]%y==0) cpt++;\n    }   \n    cout<<cpt<<endl;\n    return 0;\n}", "lang": "GNU C++", "bug_code_uid": "8a6805e1e3b48c92d623000aa400d7c0", "src_uid": "c7aa8a95d5f8832015853cffa1374c48", "apr_id": "4eef29a66efa11ab232b82d04d1d768f", "difficulty": 1200, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.3436988543371522, "equal_cnt": 24, "replace_cnt": 21, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 24, "bug_source_code": "#include <iostream>\n#include<bits/stdc++.h>\nusing namespace std;\nvector<int>v;\nint main()\n{\n    long long n;\n    int k;\n    cin>>n>>k;\n    if (k>=n)\n    {\n        cout<<\"1\";\n        return 0;\n    }\n\n\n\n\n    for (int i=0 ; i<k-1 ; i++)\n    {\n        if (i!=0)\n        {\n             v.push_back((v[i-1]-1)+(i+2));\n        }\n        else if (i==0)\n        {\n            v.push_back(2);\n        }\n    }\n    /*for (int i=0 ; i<k-1 ; i++)\n    {\n        cout<<my_arr[i]<<\" \";\n    }*/\n\n   bool found=0;\n   int l=0 , h=k-2 ,m;\n   while (l<=h)\n   {\n       m=(l+h)/2;\n       if (v[m]==n)\n       {\n           found=1;\n           cout<<m+1;\n           break;\n       }\n       else if (v[m]<n)\n       {\n           l=m+1;\n       }\n       else if (v[m]>n)\n       {\n           h=m-1;\n       }\n   }\n  if (found ==0 && v[h]>=n)\n  {\n      cout<<h+1;\n  }\n  else if (found==0 && v[h]<n )\n  {\n      cout<<\"-1\";\n  }\n    return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "f76ea5c272b53e97e8541a382afb408b", "src_uid": "83bcfe32db302fbae18e8a95d89cf411", "apr_id": "cb265f8483568291fa3c502ecf87c64c", "difficulty": 1700, "tags": ["math", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.2881818181818182, "equal_cnt": 13, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 13, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\ntypedef long long ll;\n#define pb push_back\n#define MOD 1000000007\n#define endl '\\n'\n\nint n, ans = 0;\nvector<int> adj[10];\n\nvoid solve(int a, int label[10])\n{\n\tfor(int i=0; i<10; i++)\n\t\tcerr << label[i] << endl;\n\tint temp = 0;\n\tif( a == n + 1 )\n\t{\n\t\tint done[n+1][n+1] = {};\n\t\tfor(int i=1; i<=n; i++)\n\t\t{\n\t\t\tif( !label[i] )\n\t\t\t\tcontinue;\n\t\t\tfor( int j : adj[i] )\n\t\t\t{\n\t\t\t\tif( !label[j] || done[ label[i] ][ label[j] ] )\n\t\t\t\t\tcontinue;\n\t\t\t\tdone[ label[i] ][ label[j] ] = true;\n\t\t\t\tdone[ label[j] ][ label[i] ] = true;\n\t\t\t\ttemp++;\n\t\t\t}\n\t\t}\n\t\tans = max( ans , temp );\n\t\treturn;\n\t}\n\tfor(int i=0; i<=6; i++)\n\t{\n\t\tlabel[a] = i;\n//\t\tcout << \"Hello\";\n\t\tsolve( a + 1 , label );\n\t}\n}\n\nint main()\n{\n//\tios_base::sync_with_stdio(false);\n//\tcin.tie(NULL);\n\n\tint m, a, b;\n\tcin >> n >> m;\n\tfor(int i=0; i<m; i++)\n\t{\n\t\tcin >> a >> b;\n\t\tadj[a].pb(b);\n\t\tadj[b].pb(a);\n\t}\n\tint label[10] = {};\n\tsolve(1, label);\n\tcout << ans;\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "122559ddb52913dce22b8f14cf566f23", "src_uid": "11e6559cfb71b8f6ca88242094b17a2b", "apr_id": "5a911805e6f7b34b9972d8947389c071", "difficulty": 1700, "tags": ["graphs", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9819890368050117, "equal_cnt": 14, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 14, "bug_source_code": "//============================================================================\n// File        : main.cpp\n// Author      : AHMED HANI IBRAHIM\n// Copyright   : AHani\n// Version     : \n// Created on February 5, 2013, 7:44 AM\n//============================================================================\n\n#include <cstdlib>\n#include <stdio.h>\n#include <string.h>\n#include <string>\n#include <iostream>\n#include <vector>\n#include <algorithm>\n#include <functional>\n#define Max 200 + 5\n#define INF 1000000000\n//#define INT_MAX 2147483647\n#define FOR(i, N) for( int i = 0 ; i < N ; i++ )\n#define FOR1e(i, N) for( int i = 1 ; i <= N ; i++ )\n#define FORe(i, N) for(int i = 0 ; i <= N ; i++ )\n#define FOR1(i, N) for(int i = 1 ; i < N ; i++ )\n#define BLUE 1\n#define RED 2\nusing namespace std;\n\nint N, T;\nint Memo[50][50][50][50][50];\n\nint solve(int pos, int last1, int last2, int count1, int count2) {\n    if (pos == N) {\n        if (count1 == T && count2 == T-1)\n            return 1;\n        return 0;\n    }\n    if (count1 > T)\n        return 0;\n    if (count2 > T - 1)\n        return 0;\n    int &ret = Memo[pos][last1][last2][count1][count2];\n    if (ret < 0) {\n        ret = 0;\n        FOR(next, 4) if (next != last2) {\n            if (last1 == 4 || last2 == 4) {\n                ret += solve(pos + 1, last2, next, count1, count2);\n            } else {\n                int ncount1 = count1;\n                int ncount2 = count2;\n                if (last1 < last2 && last2 > next)\n                    ++ncount1;\n                if (last1 > last2 && last2 < next)\n                    ++ncount2;\n                ret += solve(pos+1, last2, next, ncount1, ncount2);\n            }\n        }\n    }\n    return ret;\n}\n\nint main(int argc, char** argv) {\n      // freopen(\"Trojan.txt\", \"r\", stdin);\n    scanf(\"%d %d\", &N, &T);\n    memset(Memo, -1, sizeof(Memo));\n    cout << solve(0, 4, 4, 0, 0) << endl;\n    \n    return 0;\n}", "lang": "GNU C++", "bug_code_uid": "40165fdc2abbeb37c5f7ad5b52c7cde2", "src_uid": "6d67559744583229455c5eafe68f7952", "apr_id": "9f0a98566b8ce4b09926657295eaf072", "difficulty": 1900, "tags": ["dp"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8464106844741235, "equal_cnt": 25, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 21, "fix_ops_cnt": 25, "bug_source_code": "#include <iostream>\n#include<cstdio>\nusing namespace std;\nint y[1000];\nint main() {\n    int x ;\n    bool u;\n    scanf(\"%d\",&x);\n    int cur=0;\n    int y[x];\n    for(int i=0;i<x;i++){\n        scanf(\"%d\",&y[i]);\n        if(y[i]==1)cur++;\nif(y[i]==0)u=true;\n\n    }\n    //printf(\"%d %d hi\\n\",x,y[0]);\n    int gain=0;\nfor(int i=0;i<x;i++){\n\n    for(int j=0;j<x;j++){\n        int temp=0;\n        for(int k=i;k<=j;k++){if(y[k]==1)temp--;else temp++;}\n        gain=max(gain,temp);\n    }\n\n}\nif(!u)printf(\"%d\\n\",x-1);\nelse\nprintf(\"%d\\n\",gain+cur);\n}\n", "lang": "GNU C++0x", "bug_code_uid": "9bfbc97f11248c5f87a64bc58262a662", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "apr_id": "094526756b4815bbc29a30743e477eec", "difficulty": 1200, "tags": ["dp", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9960079840319361, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <stdio.h>\nint main()\n{\n    int a,b,c,sum;\n    int g,e,f;\n    while(scanf(\"%d%d%d\",&a,&b,&c)!=0)\n    {//\ufffd\ufffd\ufffd\ufffd\ufffdN\ufffd\u0124@\ufffd\ufffd\ufffd\u0726\ufffd\ufffdy\ufffdI \n        g=a-1;//\ufffd\u0124@\ufffd\ufffd\ufffd\u0726\ufffd\ufffdy\ufffdI\ufffd\u076dn\ufffdh\ufffd\u05bch \n        e=b+g;//\ufffdt\ufffd\ufffd\ufffd\u4aba\ufffd\ufffd\ufffd\u04bcW\ufffd[ \n        f=c+g;\n        //\ufffd\u0726\ufffd\ufffd\ufffd\ufffd\ufffd|\ufffd\ufffd\u03ab\ufffd,\ufffdi\ufffdH\ufffd\ufffd\ufffd\ufffd\ufffd\u03a9\ufffd\ufffd\ufffd\ufffd\ufffd \n        //\ufffd\ufffd\ufffd\ufffd\ufffd\u0726\ufffd\ufffdy\ufffdI\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd,\ufffd\ufffd\ufffd\ufffd[ \ufffdW\ufffd\ufffd\ufffd[\ufffdU\ufffd\ufffd ]\ufffd\ufffd\ufffdH\ufffd\ufffd \ufffd\ufffd\ufffdH\ufffdG\n        //\ufffd\ufffd\ufffd@\ufffd\ufffd\ufffd\ufffd\ufffd\u0726\ufffd\ufffdy\ufffdI,\ufffd\u04a5H\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffdq\ufffdn\ufffdA\ufffd\ufffd\ufffdH\ufffdG \n        sum=e*f-((1+g)*g/2)*2;\n        //printf(\"a=%d b=%d c=%d sum=%d\\n\",a,b,c,sum);\n        printf(\"%d\\n\",sum);\n    }\n    return 0;\n}", "lang": "MS C++", "bug_code_uid": "c60ce34c56b10a617b1c2b26c1630800", "src_uid": "8ab25ed4955d978fe20f6872cb94b0da", "apr_id": "011077a048cc3890da24bc60a33b43a6", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9978813559322034, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\nint a[1111111], b[111111], n, m;\nmain ()\n\t{\n\t\tcin >> n >> m;\n\t\tfor (int i = 1;i <= n;i ++)\n\t\t\tcin >> a[i];\n\t\tfor (int i = 1;i <= m;i ++)\n\t\t\tcin >> b[i];\n\t\tsort (a + 1, a + n + 1);\n\t\tsort (b + 1, b + m + 1);\n\t\tfor (int i = 1;i <= max(n,m);i ++)\n\t\t\t\tfor (int j = 1;j <= max(n,m);i ++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (a[i] == b[j])\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcout << a[i];\n\t\t\t\t\t\t\t\treturn 0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\tcout << min(a[1],b[1]) << max(a[1],b[1]);\n\t}\n", "lang": "GNU C++11", "bug_code_uid": "f45e4e56148c13dca1c16843aae0b45b", "src_uid": "3a0c1b6d710fd8f0b6daf420255d76ee", "apr_id": "aa14f5f198bff5f19363cbaaadc933f6", "difficulty": 900, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9830927835051546, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <iostream>\n#include <vector>\n#include <string>\n#include <queue>\n\nusing namespace std;\n\nint main(int argc, char* argv[]) {\n    int n, m, k;\n    std::cin >> n >> m >> k;\n    cin.get();\n    vector < vector< vector<int> > > mas(n, vector<vector<int> >(m, vector<int>(3)));\n\n    for (int i = 0; i < n; ++i) {\n        cin >> string();\n        for (int j = 0; j < m; ++j) {\n            cin >> mas[i][j][0] >> mas[i][j][1] >> mas[i][j][2];\n        }\n    }\n\n    int ans = 0;\n    for (int i = 0; i < n; ++i) {\n        for (int j = 0; j < n; ++j) {\n            priority_queue< pair<int, int> > pq;\n            for (int g = 0; g < m; ++g) {               \n                pq.push(make_pair<int, int>(-mas[i][g][0] + mas[j][g][1], g));\n            }\n            int _k = k;\n            int _ans = 0;\n            while (_k > 0 && !pq.empty() && pq.top().first > 0) {\n                int thing = pq.top().second;                \n                int amount = min(mas[i][thing][2], _k);\n                int delta = pq.top().first * amount;\n                _k -= amount;\n                _ans += delta;\n                pq.pop();\n            }\n            if (_ans > ans) ans = _ans;\n        }\n    }\n    cout << ans;\n}", "lang": "GNU C++", "bug_code_uid": "ac6b35c563297ca68d281a33c9e27691", "src_uid": "7419c4268a9815282fadca6581f28ec1", "apr_id": "091d6c6f0aeba33c0b12b1c662f615d0", "difficulty": 1200, "tags": ["games", "greedy", "graph matchings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.97562893081761, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include <iostream>\n#include <vector>\nusing namespace std;\nstruct prod{\n    int a,b,c;\n    int type;\n};\nvector<prod> planets[10], tmp;\nint n,m,k, tpb;\nstring pla[10];\nbool cmp(prod a, prod b){\n    return (planets[tpb][a.type].b-a.a>planets[tpb][b.type].b-b.a);\n}\nint getMax(int pa, int pb){\n    tpb = pb;\n    tmp = planets[pa];\n    sort(tmp.begin(), tmp.end(), cmp);\n    int g = 0, fill = 0;\n    for (int i = 0; i < m && k-fill; i++)\n        if (k-fill>=tmp[i].c)\n            fill+=tmp[i].c, g+=(planets[pb][tmp[i].type].b-tmp[i].a)*tmp[i].c;//, cout<<\"\\tADD full \"<<tmp[i].type<<\" g:->\"<<g<<endl;\n        else\n            g+=(planets[pb][tmp[i].type].b-tmp[i].a)*(k-fill), fill=k;//, cout<<\"\\tADD \"<<(k-fill)<<\" \"<<tmp[i].type<<\" g:->\"<<g<<endl;\n    return g;\n}\nint main(){\n    cin>>n>>m>>k;\n    string name;\n    for (int i = 0; i < n; i++){\n        cin>>pla[i], planets[i].resize(m);\n        for (int j = 0; j < m; j++)\n            cin>>planets[i][j].a>>planets[i][j].b>>planets[i][j].c, planets[i][j].type = j;\n    }\n    int MAX = 0;\n    for (int pa = 0; pa < n; pa++)\n        for (int pb = 0; pb < n; pb++)\n            if (pa!=pb)\n                MAX = max(MAX,getMax(pa,pb));\n    cout<<MAX<<endl;\n    //system(\"PAUSE\");\n    return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "c4ce23938feeac74678e89ba15771e4b", "src_uid": "7419c4268a9815282fadca6581f28ec1", "apr_id": "4c51f9f290f8046c54aee4cb2dea3894", "difficulty": 1200, "tags": ["games", "greedy", "graph matchings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9913569576490925, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include<stdio.h>\n#include<string>\n#include<iostream>\nusing namespace std;\nstruct plant\n{\n    string name;\n    int oou[105],in[105],rem[105];\n}p[105];\nstruct node\n{\n    int pro;\n    int index;\n}no[105];\nint cmp(node a,node b)\n{\n    return a.pro>b.pro;\n}\nint main()\n{\n    int n,i,j,m,k,ans,q,aa;\n    scanf(\"%d%d%d\",&n,&m,&aa);\n    for(i=0;i<n;i++)\n    {\n        cin>>p[i].name;\n        for(j=0;j<m;j++)\n        {\n            cin>>p[i].oou[j]>>p[i].in[j]>>p[i].rem[j];\n        }\n    }\n    ans=0;\n    int temp=0;\n    for(i=0;i<n;i++)//i in,j out\n    {\n        for(j=0;j<n;j++)\n        {\n            if(i==j)continue;\n            temp=0;\n            q=aa;\n            for(k=0;k<m;k++)\n            {\n                no[k].pro=p[j].in[k]-p[i].oou[k];\n                no[k].index=k;\n            }\n            sort(no,no+m,cmp);\n            for(k=0;k<m;k++)\n            {\n                if(no[k].pro<=0)break;\n                int t=p[i].rem[no[k].index];\n                temp+=no[k].pro*min(t,q);\n                if(t>=q)break;\n                else q-=t;\n            }\n            if(temp>ans)ans=temp;\n        }\n    }printf(\"%d\\n\",ans);\n    return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "962dbfd899aaf24d74d29f9ee2fefaf1", "src_uid": "7419c4268a9815282fadca6581f28ec1", "apr_id": "b6d941d4e9f1b73169af243b89b74abf", "difficulty": 1200, "tags": ["games", "greedy", "graph matchings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9459770114942528, "equal_cnt": 9, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 8, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n\ntypedef long long i64;\n\nvector<i64> getDivs(i64 N) {\n    vector<i64> ret;\n    for (int i = 1; (i64) i * i <= N; ++i) {\n        if (N % i == 0) {\n            ret.push_back(i);\n            if ((i64) i * i < N) ret.push_back(N / i);\n        }\n    }\n    sort(ret.begin(), ret.end());\n    return ret;\n}\n\nmap<i64, vector<i64>> powers;\n\nbool goodDiv(i64 x) {\n    if (x <= 2) return false;\n    x--;\n    for (int i = 2; (i64) i * i <= x; ++i) {\n        if (x % i == 0) {\n            while (x % i == 0) x /= i;\n            if (x != 1) return false;\n            powers[i].push_back(x);\n        }\n    }\n    if (x > 1) powers[x].push_back(x);\n    return true;\n}\n\ni64 getAns(const vector<i64>& divs) {\n    int N = divs.size();\n    vector<i64> dp(N, 0);\n    dp[0] = 1;\n    i64 maxv = divs.back();\n\n    vector<bool> good(N, 0);\n    for (int i = 0; i < N; ++i) {\n        good[i] = goodDiv(divs[i]);\n    }\n    \n    for (const vector<i64>& curr: powers) {\n        vector<i64> ndp = dp;\n        for (i64 p: curr) {\n            ++p;\n            for (int j = N - 1; j >= 0; --j) {\n                if (divs[j] > maxv / p) continue;\n                i64 dv = divs[j] * p;\n                int pos = lower_bound(divs.begin(), divs.end(), dv) - divs.begin();\n                if (pos >= N || divs[pos] != dv) continue;\n                dp[pos] += dp[j];\n            }\n        }\n        dp = ndp;\n    }\n    return dp[N - 1];\n}\n\nint main() {\n    #ifndef ONLINE_JUDGE\n    freopen(\"task.in\", \"r\", stdin);\n    freopen(\"task.out\", \"w\", stdout);\n    #endif // ONLINE_JUDGE\n    ios::sync_with_stdio(false);\n\n    i64 N;\n    cin >> N;\n\n    vector<i64> divs = getDivs(N);\n    i64 ans = getAns(divs);\n    cout << ans << '\\n';\n}\n", "lang": "GNU C++11", "bug_code_uid": "fc8e3528cce06c35116a8a18d9924b37", "src_uid": "1f68bd6f8b40e45a5bd360b03a264ef4", "apr_id": "ea17764ce4266f2654b4f713c031f508", "difficulty": 2600, "tags": ["dp", "hashing", "dfs and similar", "number theory", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.8199197545433089, "equal_cnt": 23, "replace_cnt": 14, "delete_cnt": 2, "insert_cnt": 7, "fix_ops_cnt": 23, "bug_source_code": "#include <iostream>\n#include <map>\n#include <set>\n#include <vector>\n\ntypedef long long Long;\ntemplate <typename K, typename V>\nusing Map = std::map <K, V>;\n\nconst Long N  = 1000000;\nconst Long N2 = N * N;\n\n#define ALL(v) (v).begin(), (v).end()\n\nstd::vector <Long> get_divisors(Long n)\n{\n    std::vector <Long> divisors;\n    for (Long d = 1; d * d <= n; ++ d) {\n        if (n % d == 0) {\n            divisors.push_back(d);\n            if (d * d != n) {\n                divisors.push_back(n / d);\n            }\n        }\n    }\n    std::sort(ALL(divisors));\n    return divisors;\n}\n\nstd::set <Long> prime_powers;\n\nbool is_prime_power(Long n)\n{\n    if (n <= 1) {\n        return false;\n    }\n    if (prime_powers.count(n)) {\n        return true;\n    }\n    for (Long d = 2; d * d <= n; ++ d) {\n        if (n % d == 0) {\n            return false;\n        }\n    }\n    return true;\n}\n\nint main()\n{\n    std::vector <bool> prime(N + 1, true);\n    for (int p = 2; p <= N; ++ p) {\n        if (prime[p]) {\n            for (Long pp = p; pp <= N2; pp *= p) {\n                prime_powers.insert(pp);\n            }\n            if ((long long)p * p <= N) {\n                for (int i = p * p; i <= N; i += p) {\n                    prime[i] = false;\n                }\n            }\n        }\n    }\n    Long a;\n    std::cin >> a;\n    const auto &divisors = get_divisors(a);\n    Map <Long, Long> ways;\n    ways[a] = 1;\n    for (Long d : divisors) {\n        if (is_prime_power(d - 1)) {\n            Map <Long, Long> new_ways;\n            for (const auto &iterator : ways) {\n                new_ways[iterator.first] += iterator.second;\n                if (iterator.first % d == 0) {\n                    new_ways[iterator.first / d] += iterator.second;\n                }\n            }\n            ways.swap(new_ways);\n        }\n    }\n    std::cout << ways[1] << std::endl;\n    return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "5a61715abe93d8d78e9bc6e0c7643a2a", "src_uid": "1f68bd6f8b40e45a5bd360b03a264ef4", "apr_id": "7fb7ab252c3207a6f6a22e29192aa610", "difficulty": 2600, "tags": ["dp", "hashing", "dfs and similar", "number theory", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9929577464788732, "equal_cnt": 8, "replace_cnt": 0, "delete_cnt": 6, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "#include <cmath>\n#include <map>\n#include <vector>\n#include <cstdio>\n#include <cstdlib>\n#include <iostream>\n#include <algorithm>\n#include <cstring>\n#include <set>\n#include <bitset>\n#include <memory.h>\n#include <functional>\n#include <queue>\n#include <fstream>\n#include <ctime>\n#include <deque>\n#include <utility>\n#include <stack>\n#include <sstream>\n#include <list>\n#include <cctype> \n#include <numeric> \n#include <iomanip>\n#include <assert.h>\nusing namespace std;\n#define sqr(_) ((_)*(_))\n\ntypedef long long LL;\ntypedef long double ld;\n\ntypedef pair<int, int> Pii;\ntypedef pair<LL, LL> Pll;\n#define x first\n#define y second\n#define mp make_pair\n#define pb push_back\n#define SZ(x) ((int)(x).size())\n#define ALL(x) (x).begin(), (x).end()\n\nconst int MAXN = (int)1e6 + 10;\n\nint hash[MAXN], pr[MAXN], tot;\nvector<LL> a;\nvector<Pll> b;\nLL A, Tohka;\n\nbool prtest(LL x)\n{\n\tif (x < MAXN) return !hash[x];\n\tfor (int i = 2; (LL)i * i <= x; ++i)\n\t\tif (x % i == 0) return 0;\n\treturn 1;\n}\nLL check(LL w)\n{\n\tfor (ld i = 1; pow(2.0, (ld)i) <= w; ++i)\n\t{\n\t\tLL x = (LL)pow((ld)w, (ld)1.0 / i);\n\t\tif ((LL)pow((ld)x, i) == w)\n\t\t\tif (prtest(x))\n\t\t\t\treturn x;\n\t\t++x;\n\t\tif ((LL)pow((ld)x, i) == w)\n\t\t\tif (prtest(x))\n\t\t\t\treturn x;\n\t}\n}\nvoid DFS(LL x, LL lim)\n{\n\tif (x == 1)\n\t{\n\t\t++Tohka;\n\t\treturn ;\n\t}\n\tfor (int i = 0; i < SZ(b) && b[i].x <= lim; ++i)\n\t\tif (x % b[i].y == 0)\n\t\t\tDFS(x / b[i].y, b[i].x);\n}\nint main()\n{\n#ifndef ONLINE_JUDGE\n\tfreopen(\"input.txt\", \"r\", stdin), freopen(\"output.txt\", \"w\", stdout);\n#endif\n\t\n\thash[1] = 1;\n\tfor (int i = 2; i < MAXN; ++i)\n\t\tif (!hash[i])\n\t\t{\n\t\t\tpr[++tot] = i;\n\t\t\tfor (int j = i + i; j < MAXN; j += i)\n\t\t\t\thash[j] = 1;\n\t\t}\n\tcin >> A;\n\tfor (int i = 1; (LL)i * i <= A; ++i)\n\t\tif (A % i == 0)\n\t\t{\n\t\t\ta.pb(i);\n\t\t\tif ((LL)i * i != A)\n\t\t\t\ta.pb(A / i);\n\t\t}\n\tfor (int i = 0; i < SZ(a); ++i)\n\t\tif (a[i] != 1)\n\t\t{\n\t\t\tLL p = check(a[i] - 1);\n\t\t\tif (p != -1)\n\t\t\t\tb.pb(mp(p, a[i]));\n\t\t}\n\tsort(ALL(b));\n\tDFS(A, A);\n\tcout << Tohka << endl;\n\t\n\tfclose(stdin);\n\tfclose(stdout);\n\treturn 0;\n}\n\n", "lang": "GNU C++11", "bug_code_uid": "0173ecb2bff2c497175aae329a60d5c3", "src_uid": "1f68bd6f8b40e45a5bd360b03a264ef4", "apr_id": "43e64527cbce438559570fe5c8925c68", "difficulty": 2600, "tags": ["dp", "hashing", "dfs and similar", "number theory", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.9974683544303797, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 4, "bug_source_code": "#include <bits/stdc++.h>\n using namespace std;\n\nlong long dp[5000][5000];\n \nint main()\n{\n    long long n,m,c0,d0,a,b,c,d,j=1,ans,max=0;\n    cin >> n >> m >> c0 >> d0;\n    long long val[1001]={},val2[1001]={},cost[1001]={};\n    for (int i=1; i<=m; i++)\n    {\n        cin >> a >> b >> c >> d;\n        while(a>=b)\n        {\n            a-=b;\n            val[j]=b , val2[j]=c , cost[j]=d;\n            j++;\n        }\n    }\n \n    for (int i=1; i<j; i++)\n    {\n        for (int k=1; k<=n; k++)\n        {\n            dp[i][k] = dp[i-1][k];\n            if (k>=val2[i]) dp[i][k] = max(dp[i][k] , dp[i-1][k-val2[i]]+cost[i]);\n        }\n    }\n \n    for (int i=0; i<=n; i++)\n    {\n        ans = dp[j-1][i] + ((n-i)/c0)*d0;\n        if (ans>max) max=ans;\n    }\n    cout << max << \"\\n\";\n \n    return 0;\n}", "lang": "GNU C++14", "bug_code_uid": "6496250840ec21636422ba6443c0ac02", "src_uid": "4e166b8b44427b1227e0f811161d3a6f", "apr_id": "27f0313598c0a1b2b19ab535271c7a85", "difficulty": 1700, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9828109201213346, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nvector<int> v;\nint main()\n{\n    int n;\n    cin>>n;\n    for(int i=0;i<n;i++)\n    {\n        int h;\n        cin>>h;\n        v.push_back(h);\n    }\n    sort(v.begin(),v.end());\n    for(int i=0;i<n;i++)\n    {\n        if(v[i]==v[i+1])\n        {\n            v.erase(v.begin()+i);\n            i=-1;\n        }\n        else if(v[i]==v[i+1]-1&&v[i+1]==v[i+2]-1)\n        {\n            cout<<\"YES\";\n            return 0;\n        }\n    }\n    cout<<\"NO\";\n}\n", "lang": "GNU C++", "bug_code_uid": "2f2ee022bdca0c93f7025f4bc6f1e049", "src_uid": "d6c876a84c7b92141710be5d76536eab", "apr_id": "50c72aa93908c3377d29322f533b22e8", "difficulty": 900, "tags": ["brute force", "sortings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9938398357289527, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include <iostream>\n#include <vector>\n#include <algorithm>\n#include <string>\n#include <utility>\n#include <map>\n#include <set>\n#include <tuple>\n#include <array>\n#include <numeric>\n#include <bitset>\n#define _USE_MATH_DEFINES\n#include <math.h>\n#include <queue>\n#include <cstring>\n\n#define pb push_back\n\n//#include <bits/stdc++.h>\nusing namespace std;\ntypedef long long ll;\ntypedef unsigned long long ull;\n\n\nint main()\n{\n\tint n;\n\tcin >> n;\n\n\tcout << (n % 2 ? \"black\" : \"white\") << endl;\n}", "lang": "MS C++ 2017", "bug_code_uid": "0599b88e230d2d69fcce9c89e4fd68ae", "src_uid": "52e07d176aa1d370788f94ee2e61df93", "apr_id": "012c4df3f8e4d16c5aa8529b3e369df6", "difficulty": 1700, "tags": ["math", "games", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.5784238714613619, "equal_cnt": 16, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 16, "bug_source_code": "/* @author : mostafa\n * created : 2018-06-18 19:07\n */\n#include <iostream>\n#include <algorithm>\n#include <cstring>\nusing namespace std ;\n#define debug(x) cerr<<#x<<\" is \"<<x<<\"\\n\"\n#define SIZE (int)1e9+9\n\nbool arr[SIZE] ;\n\nint main()\n{\n    cin.sync_with_stdio(false) ;\n    cin.tie(0) ;\n    int l , r , x , y ;\n\tcin >> l >> r >> x >> y ;\n\tint ans = 0 ; \n\tmemset( arr , false , sizeof arr );\n\tfor(int a = l ; a <= r ; a++){\n\t\tif( (x*y) % a == 0 && !arr[a] ){\n\t\t\tint b = x * y / a ;\n\n\t\t\tif( __gcd(a,b) == x && b >= l && b <= r ){\n\t\t\t\tans += 2 ;\n\t\t\t\tif( b <= SIZE ) \n\t\t\t\t\tarr[b] = true ;\n\t\t\t}\n\t\t}\n\t}\n\tcout << ans << \"\\n\" ;\n    return 0 ;\n}\n\n\n", "lang": "GNU C++11", "bug_code_uid": "610e30dd67bd706a8a9c29aaa3064629", "src_uid": "d37dde5841116352c9b37538631d0b15", "apr_id": "2f1c01b050ba4065433f09cea598c9e4", "difficulty": 1600, "tags": ["math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.5617977528089888, "equal_cnt": 25, "replace_cnt": 20, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 24, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n\nint main() {\n\tint n, m, c, d;\n\tcin >> n >> m >> cost >> sell;\n\tint a[n], b[n], c[n], d[n];\n\tfor(int i = 0; i < m; i++){\n\t    cin >> a[i] >> b[i] >> c[i] >> d[i];\n\t}\n\tint dp[n+1][m+1];\n\tmemset(dp, 0, sizeof dp);\n\tint ans = 0;\n\tfor(int i = 1; i <= n; i++){\n\t    for(int j = 0; j < m; j++){\n\t        for(int k = 0; k <= a[j]/b[j]; k++){\n\t            dp[i][j] = max(dp[i][j], dp[i-k*c[j]] + k*d[j]);\n\t            ans = max(ans, dp[i][j] + (n-i)/cost *sell);\n\t        }\n\t    }\n\t}\n\tcout << ans;\n\treturn 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "924ccb6f19fabc48c968846661587ca6", "src_uid": "4e166b8b44427b1227e0f811161d3a6f", "apr_id": "3a06fae5df471dfee82ff6a1ba884721", "difficulty": 1700, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6708833151581243, "equal_cnt": 18, "replace_cnt": 14, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 17, "bug_source_code": "#define DBG 1\n// chrono::system_clock::now().time_since_epoch().count()\n#include<bits/stdc++.h>\n//#include<ext/pb_ds/tree_policy.hpp>\n//#include<ext/pb_ds/assoc_container.hpp>\n\n#define pb push_back\n#define eb emplace_back\n#define mp make_pair\n#define fi first\n#define se second\n#define all(x) (x).begin(), (x).end()\n#define debug(x) if (BDG) cerr << #x << \" = \" << x << endl;\n\nusing namespace std;\n//using namespace __gnu_pbds;\n\ntypedef long long ll;\ntypedef pair<int, int> pii;\n\n//template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;\n\nconst int MOD = (int)1e9 + 7;\nconst int MAXN = (int)1e6 + 5;\n\nint rev[MAXN], fact[MAXN];\nint dp[MAXN];\nint n, k, ans;\n\nint addMod(int a, int b, int m = MOD) {\n    a += b;\n    \n    if (m <= a) {\n        a -= m;\n    }\n    \n    return a;\n}\n\nint mulMod(int a, int b, int m = MOD) {\n    return a * 1ll * b % m;\n}\n\nint binPow(int a, int b, int m = MOD) {\n    int ret = 1;\n    \n    while (b > 0) {\n        if (b & 1) {\n            ret = mulMod(ret, a, m);\n        }\n        \n        a = mulMod(a, a, m);\n        b >>= 1;\n    }\n    \n    return ret;\n}\n\nvoid pre() {\n    fact[0] = rev[0] = 1;\n    \n    for (int i = 1; i < MAXN; ++i) {\n        fact[i] = mulMod(fact[i - 1], i);\n    }\n    \n    rev[MAXN - 1] = binPow(fact[MAXN - 1], MOD - 2);\n    \n    for (int i = MAXN - 1; i > 0; --i) {\n        rev[i - 1] = mulMod(rev[i], i);\n    }\n}\n\nint C(int n, int k) {\n    if (k < 0 || k > n || n < 0) {\n        return 0;\n    }\n    \n    return mulMod(fact[n], mulMod(rev[k], rev[n - k]));\n}\n\nint A(int n, int k) {\n    if (k < 0 || k > n || n < 0) {\n        return 0;\n    }\n    \n    return mulMod(fact[n], rev[n - k]);\n}\n\nvoid solve() {\n    scanf(\"%d %d\", &n, &k);\n    \n    for (int i = k + 1; i <= n; ++i) {\n        dp[i] = mulMod(i - k - 1, fact[i - 2]);\n    \n        for (int j = i - k; j <= i - 1; ++j) {\n            dp[i] = addMod(dp[i], mulMod(dp[j], A(i - 2, i - j - 1)));\n        }\n    }\n    \n    for (int i = 1; i <= n; ++i) {\n        int cur = mulMod(dp[i], C(n - 1, i - 1));\n        cur = mulMod(cur, fact[n - i]);\n        ans = addMod(ans, cur);\n    }\n    \n    printf(\"%d\\n\", ans);\n}\n\nint main() {\n\tint tt = 1;\n    pre();\n\t\n\twhile (tt--) {\n\t\tsolve();\n\t}\n\n\treturn 0;\n}\n\n", "lang": "GNU C++17", "bug_code_uid": "2408c5741c204ef0b6542cf4d1c64eef", "src_uid": "0644605611a2cd10ab3a9f12f18d7ae4", "apr_id": "2ec693443e7a66ea46b1187f110dde3d", "difficulty": 2400, "tags": ["dp", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.029925187032418952, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "inclsmsjakakkandnddnsnsnsm", "lang": "GNU C++11", "bug_code_uid": "e6d93448e8f2cc9d4443fde2c9f0ad98", "src_uid": "7bd5521531950e2de9a7b0904353184d", "apr_id": "e753fffe2c3257d7a03c9a0031e22f92", "difficulty": 1000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9964391691394658, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "/*\n ID: ahaigh11\n PROG: codeforces beta round #91 virtual contest A\n URL: \n LANG: C++\n \n */\n#include <iostream>\n#include <string>\n#include <algorithm>\n#include <cstdio>\n#include <cstdlib>\n#include <cmath>\n#include <cstring>\n#include <utility>\n#include <cassert>\n#include <queue>\n#include <ctime>\n#include <map>\n#include <set>\n#include <bitset>\nusing namespace std;\n\n#define REP(i, n) for(int i = 0; i < n; i++)\n#define CL(x) memset(x, 0, sizeof(x))\nconst int N = 15;\n\nint n, k, curr;\nlong long f[N];\nbitset<1000000000> seen;\nvector<int> v;\n\nbool is_lucky(int n) {\n\tbool flag = false;\n\twhile (n && !flag) { if (!(n % 10 == 4 || n % 10 == 7)) flag = true; n /= 10; }\n\treturn !flag;\n}\n\nint main() {\n\tfor (int i = 1; i <= 9; i++) {\n\t\tfor (int j = 0; j < (1<<i); j++) {\n\t\t\tint n = 0;\n\t\t\tfor (int k = 0; k < i; k++) n = n*10 + ((j & (1<<k)) ? 4 : 7);\n\t\t\tv.push_back(n);\n\t\t}\n\t}\n\tsort(v.begin(), v.end());\n\t////////////////////////////////////////\n\n\tREP(i, 13) f[i] = i ? f[i-1] * i : 1;\n\t\n\tcin >> n >> k;\n\tk--;\n\t\n\tint z = 0;\n\t\n\tcurr = 0;\n\t\n\t/* for (int i = 0; i < (n-14); i++) {\n\t\tcout << (i+1) << \" \";\n\t\tseen[i] = true;\n\t} */\n\tfor (int i = 0; i < v.size(); i++) if (v[i] <= (n-14)) z++;\n\t\n\tfor (int i = max(0,n-14); i < n; i++) {\n\t\tlong long skip = 0, j;\n\t\tfor (j = 0; j <= n && curr+skip <= k; j++)\n\t\t\tif (!(j < (n-14) || seen[j])) skip += (n-1-i > 12) ? 1000000005 : f[n-1-i];\n\t\t\n\t\tif (j == n+1) {\n\t\t\tcout << -1 << endl;\n\t\t\treturn 0;\n\t\t}\n\t\t\n\t\t//cout << i << endl;\n\t\t\n\t\tj--;\n\t\tseen[j] = true;\n\t\tcurr += skip - ((n-1-i > 12) ? 1000000005 : f[n-1-i]);\n\t\t\n\t\t//cout << (j+1) << \" \";\n\t\t\n\t\tif (is_lucky(j+1) && is_lucky(i+1)) z++;\n\t}\n\t\n\t//REP(i, n) cout << x[i] << \" \";\n\tcout << z << endl;\n}", "lang": "GNU C++", "bug_code_uid": "32209a4df91de438178fdb4947f10b54", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "apr_id": "15f5d7637d9aafe15a776ca4ed65f0d4", "difficulty": 1900, "tags": ["brute force", "combinatorics", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8970989337961816, "equal_cnt": 8, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "#include <cstdio>\n#include <cmath>\n#include <cstring>\n#include <cstdlib>\n#include <climits>\n#include <ctime>\n#include <queue>\n#include <stack>\n#include <algorithm>\n#include <list>\n#include <vector>\n#include <set>\n#include <map>\n#include <iostream>\n#include <deque>\n#include <complex>\n#include <string>\n#include <iomanip>\n#include <sstream>\n#include <bitset>\n#include <valarray>\n#include <iterator>\nusing namespace std;\ntypedef long long int ll;\ntypedef unsigned int uint;\ntypedef unsigned char uchar;\ntypedef unsigned long long ull;\ntypedef pair<int, int> pii;\ntypedef vector<int> vi;\n\n#define REP(i,x) for(int i=0;i<(int)(x);i++)\n#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)\n#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)\n#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)\n#define ALL(container) container.begin(), container.end()\n#define RALL(container) container.rbegin(), container.rend()\n#define SZ(container) ((int)container.size())\n#define mp(a,b) make_pair(a, b)\n#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );\n\ntemplate<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }\ntemplate<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }\ntemplate<class T> ostream& operator<<(ostream &os, const vector<T> &t) {\nos<<\"[\"; FOR(it,t) {if(it!=t.begin()) os<<\",\"; os<<*it;} os<<\"]\"; return os;\n}\ntemplate<class T> ostream& operator<<(ostream &os, const set<T> &t) {\nos<<\"{\"; FOR(it,t) {if(it!=t.begin()) os<<\",\"; os<<*it;} os<<\"}\"; return os;\n}\ntemplate<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<\"(\"<<t.first<<\",\"<<t.second<<\")\";}\n\nconst int INF = 1<<28;\nconst double EPS = 1e-8;\nconst int MOD = 1000000007;\n\n\nll n, x, y;\n\nmain(){\n\tcin >> n >> y >> x;\n\tREP(i, n){\n\t\tll a;\n\t\tcin >> a;\n\t\tll l=0, r=10000000000000000ll;\n\t\twhile(l+1<r){\n\t\t\tll med = (l+r)/2;\n\t\t\tif(med/x + med/y < a) l = med;\n\t\t\telse r = med;\n\t\t}\n\t\tint tx = (x - r%x)%x;\n\t\tint ty = (y - r%y)%y;\n\t\tif(tx == ty) cout << \"Both\" << endl;\n\t\telse{\n\t\t\tcout << ((tx < ty) ? \"Vanya\" : \"Vova\") << endl;\n\t\t}\n\t}\n\treturn 0;\n}\n", "lang": "GNU C++0x", "bug_code_uid": "eb88fba223a3f4b69f76736c94b5688e", "src_uid": "52e07d176aa1d370788f94ee2e61df93", "apr_id": "57431b965350bd17b8fe593a39aafc1c", "difficulty": 1700, "tags": ["math", "games", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8316326530612245, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "// Written by Na2a\n\n#include <bits/stdc++.h>\n\n#define llong long long\n\n#define pb push_back\n#define mp make_pair\n\n#define F first\n#define S second\n\nusing namespace std;\n\nconst int INF = (int) 1e9 + 7;\nconst int MXN = (int) 1e5 + 7;\n\nconst double EPS = (double) 1e-9;\n\nint n;\n\nint main() {\n\t#define FNAME \"\"\n\t\n\t#ifdef LOCAL                 \n\tfreopen(FNAME\".in\", \"r\", stdin);\n\tfreopen(FNAME\".out\", \"w\", stdout);\n\t#endif    \n\t\n\tscanf(\"%d\", &n);\n\tint cnt = 0;\n\twhile (n) {\n\t\tcnt += (n & 1);\n\t\tn >>= 1;\n\t}\n\tif (cnt > 1) puts(\"black\");\n\telse {\n\t\tassert(n == 4);\n\t\tprintf(\"white\\n%d %d\", 1, 2);\n\t}\n\treturn 0;\n}", "lang": "GNU C++0x", "bug_code_uid": "65f9cf354fa97c5a0410a8e394dd18cb", "src_uid": "52e07d176aa1d370788f94ee2e61df93", "apr_id": "6240955990ff9018e5872587d3f9b5ce", "difficulty": 1700, "tags": ["math", "games", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6575342465753424, "equal_cnt": 13, "replace_cnt": 10, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 12, "bug_source_code": "//\n//  main.cpp\n//  wicho\n//\n//  Created by Jorge Mendez on 9/12/17.\n//  Copyright \u00a9 2017 Jorge Mendez. All rights reserved.\n//\n\n#include <iostream>\n#include <math.h>\n#include <list>\n\nusing namespace std;\n\nint main(int argc, const char * argv[]) {\n    \n    int intNumber;\n    cin >> intNumber;\n    \n    int **intmat = new int*[intNumber];\n    \n    for (int intX = 0; intX < intNumber; intX++) {\n        \n        intmat[intX] = new int[intNumber];\n    }\n    \n    bool boolStop = false;\n\n    for (int intDif = 0; intDif < intNumber; intDif++) {\n        for (int intPos = 0; intPos < intNumber - intDif && !boolStop; intPos++) {\n            \n            intmat[intPos + intDif][intPos] = (intPos + 1) * (intPos + intDif + 1);\n        \n            if (intmat[intPos + intDif][intPos] == intNumber){\n                boolStop = true;\n                cout << (intPos + 1) << \" \" << (intPos + intDif + 1) << endl;\n            }\n        \n        }\n    }\n    \n   \n    \n    return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "3a1f6c79243131ff109e3a20db1e70dd", "src_uid": "f52af273954798a4ae38a1378bfbf77a", "apr_id": "2d271ed10f6e3f327f6a639f735e3e22", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8203517587939698, "equal_cnt": 18, "replace_cnt": 11, "delete_cnt": 1, "insert_cnt": 7, "fix_ops_cnt": 19, "bug_source_code": "#include <bits/stdc++.h>\n#define ll long long\nusing namespace std;\nconst int Max = 5e5 + 5, Mod = 998244353;\nll n, k, a[22], b[22], dp[22][22][22];\nint OP, CL;\nll Try(int i, int op, int cl)\n{\n\tif (op < 0)\n\t\tcl++, op = 0;\n\tif (i == n)\n\t\treturn (op == OP && cl == CL ? 0 : 1e16);\n\tll& ret = dp[i][op][cl];\n\tif (ret + 1)\n\t\treturn ret;\n\tll c1 = Try(i + 1, op + 1, cl) + a[i];\n\tll c2 = Try(i + 1, op - 1, cl) + b[i];\n\treturn ret = min({ (ll)1e16,c1,c2 });\n}\ntypedef vector<vector<ll>> matrix;\nint m;\nmatrix init(ll x)\n{\n\treturn matrix(m, vector<ll>(m, x));\n}\nmatrix mult(matrix& a, matrix& b)\n{\n\tmatrix Res = init(1e15);\n\tfor (int i = 0; i < m; i++)\n\t\tfor (int k = 0; k < m; k++)\n\t\t\tfor (int j = 0; j < m; j++)\n\t\t\t\tRes[i][j] = min(Res[i][j], a[i][k] + b[k][j]);\n\treturn Res;\n\nmatrix fp(matrix& x, ll p)\n{\n\tif ( p== 1 )\n\t\treturn x;\n\tmatrix y = fp(x, p >> 1);\n\ty = mult(y, y);\n\tif (p & 1)\n\t\ty = mult(y, x);\n\treturn y;\n}\nint main()\n{\n\tcin >> n >> k;\n\tfor (int i = 0; i < n; i++)\n\t\tcin >> a[i];\n\tfor (int i = 0; i < n; i++)\n\t\tcin >> b[i];\n\tif (n == 1)\n\t{\n\t\ta[n] = a[0];\n\t\tb[n] = b[0];\n\t\tn++;\n\t\tk /= 2;\n\t}\n\tvector<pair<int, int>> v;\n\tfor (int i = 0;  i <= n; i++)\n\t\tfor (int j = 0; i+j<=n;j++)\n\t\t\tif ((n - (i + j)) % 2 == 0)\n\t\t\t\tv.push_back({ i,j });\n\tm = 2 * n+1;\n\tmatrix T = init(1e16);\n\tfor(int i=0;i<m;i++)\n\t\tfor (int j = 0; j < v.size(); j++)\n\t\t{\n\t\t\tOP = v[j].first;\n\t\t\tCL = v[j].second;\n\t\t\tint jj = i - CL + OP;\n\t\t\tif (i-CL>=0 && jj< m && jj >= 0 )\n\t\t\t{\n\t\t\t\tmemset(dp, -1, sizeof(dp));\n\t\t\t\tT[i][jj] = Try(0, 0, 0);\n\t\t\t}\n\t\t}\n\tT = fp(T, k);\n\tcout << T[0][0] << endl;\n\treturn 0;\n}", "lang": "GNU C++17", "bug_code_uid": "b870a25f3d840c8b3a18c4646d05fced", "src_uid": "f40900973f4ebeb6fdafd75ebe4e9601", "apr_id": "8cdb2767ffd8d3d5516f488359cacba3", "difficulty": 2500, "tags": ["matrices", "dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6666666666666666, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "//*\n#include <stdio.h>\n\ntypedef long long ll;\n\nint d[80][90][500];\nint e[80][90][500];\nint f[80][90][500];\n\nint n, m;\nint a[50];\nint b[50];\nint a2[50];\nint b2[50];\n\nint main()\n{\n    int i, j, k, l;\n    scanf(\"%d%d\", &n, &m);\n    for(i=0;i<n;i++) scanf(\"%d\", &a[i]), a[n+i]=a[i];\n    for(i=0;i<n;i++) scanf(\"%d\", &b[i]), b[n+i]=b[i];\n    n*=2, m/=2;\n    d[0][1][a[0]]=1;\n    for(i=1;i<n;i++)\n    {\n        for(j=0;j<=n;j++)\n        {\n            for(k=0;k<500;k++)\n            {\n                if(d[i-1][j][k] == 1)\n                {\n                    if(j > 0) d[i][j-1][k+b[i]]=1;\n                    d[i][j+1][k+a[i]]=1;\n                }\n            }\n        }\n    }\n    for(i=0;i<n;i++) a2[i]=b[n-1-i], b2[i]=a[n-1-i];\n    f[0][1][a2[0]]=1;\n    for(i=1;i<n;i++)\n    {\n        for(j=0;j<=n;j++)\n        {\n            for(k=0;k<500;k++)\n            {\n                if(f[i-1][j][k] == 1)\n                {\n                    if(j > 0) f[i][j-1][k+b2[i]]=1;\n                    f[i][j+1][k+a2[i]]=1;\n                }\n            }\n        }\n    }\n    int min=0x7fffffff;\n    for(i=0;i<=n;i+=2)\n    {\n        int dab=0;\n        if(i == 30)\n        {\n            i=i;\n        }\n        for(j=0;j<401;j++)\n        {\n            if(d[n-1][i][j])\n            {\n                dab=j;\n                break;\n            }\n        }\n        for(j=0;j<n;j++)\n        {\n            for(k=0;k<=n*2;k++)\n            {\n                for(l=0;l<401;l++) e[j][k][l]=0;\n            }\n        }\n        e[0][i+1][a[0]]=1;\n        if(i > 0) e[0][i-1][b[0]]=1;\n        for(j=1;j<n;j++)\n        {\n            for(k=0;k<=n*2;k++)\n            {\n                for(l=0;l<401;l++)\n                {\n                    if(e[j-1][k][l] == 1)\n                    {\n                        if(k > 0) e[j][k-1][l+b[j]]=1;\n                        e[j][k+1][l+a[j]]=1;\n                    }\n                }\n            }\n        }\n        for(j=0;j<401;j++)\n        {\n            if(e[n-1][i][j])\n            {\n                dab+=j*(m-2);\n                break;\n            }\n        }\n        for(j=0;j<401;j++)\n        {\n            if(f[n-1][i][j])\n            {\n                dab+=j;\n                break;\n            }\n        }\n        if(min > dab)\n        {\n            min=dab;\n        }\n    }\n    printf(\"%d\", min);\n    return 0;\n}\n//*///*\n#include <stdio.h>\n\ntypedef long long ll;\n\nint d[80][90][500];\nint e[80][90][500];\nint f[80][90][500];\n\nint n, m;\nint a[50];\nint b[50];\nint a2[50];\nint b2[50];\n\nint main()\n{\n    int i, j, k, l;\n    scanf(\"%d%d\", &n, &m);\n    for(i=0;i<n;i++) scanf(\"%d\", &a[i]), a[n+i]=a[i];\n    for(i=0;i<n;i++) scanf(\"%d\", &b[i]), b[n+i]=b[i];\n    n*=2, m/=2;\n    d[0][1][a[0]]=1;\n    for(i=1;i<n;i++)\n    {\n        for(j=0;j<=n;j++)\n        {\n            for(k=0;k<500;k++)\n            {\n                if(d[i-1][j][k] == 1)\n                {\n                    if(j > 0) d[i][j-1][k+b[i]]=1;\n                    d[i][j+1][k+a[i]]=1;\n                }\n            }\n        }\n    }\n    for(i=0;i<n;i++) a2[i]=b[n-1-i], b2[i]=a[n-1-i];\n    f[0][1][a2[0]]=1;\n    for(i=1;i<n;i++)\n    {\n        for(j=0;j<=n;j++)\n        {\n            for(k=0;k<500;k++)\n            {\n                if(f[i-1][j][k] == 1)\n                {\n                    if(j > 0) f[i][j-1][k+b2[i]]=1;\n                    f[i][j+1][k+a2[i]]=1;\n                }\n            }\n        }\n    }\n    int min=0x7fffffff;\n    for(i=0;i<=n;i+=2)\n    {\n        int dab=0;\n        if(i == 30)\n        {\n            i=i;\n        }\n        for(j=0;j<401;j++)\n        {\n            if(d[n-1][i][j])\n            {\n                dab=j;\n                break;\n            }\n        }\n        for(j=0;j<n;j++)\n        {\n            for(k=0;k<=n*2;k++)\n            {\n                for(l=0;l<401;l++) e[j][k][l]=0;\n            }\n        }\n        e[0][i+1][a[0]]=1;\n        if(i > 0) e[0][i-1][b[0]]=1;\n        for(j=1;j<n;j++)\n        {\n            for(k=0;k<=n*2;k++)\n            {\n                for(l=0;l<401;l++)\n                {\n                    if(e[j-1][k][l] == 1)\n                    {\n                        if(k > 0) e[j][k-1][l+b[j]]=1;\n                        e[j][k+1][l+a[j]]=1;\n                    }\n                }\n            }\n        }\n        for(j=0;j<401;j++)\n        {\n            if(e[n-1][i][j])\n            {\n                dab+=j*(m-2);\n                break;\n            }\n        }\n        for(j=0;j<401;j++)\n        {\n            if(f[n-1][i][j])\n            {\n                dab+=j;\n                break;\n            }\n        }\n        if(min > dab)\n        {\n            min=dab;\n        }\n    }\n    printf(\"%d\", min);\n    return 0;\n}\n//*/", "lang": "MS C++", "bug_code_uid": "9827b2a184e8167346e2b8b092c49367", "src_uid": "f40900973f4ebeb6fdafd75ebe4e9601", "apr_id": "b4c325d7f57a892183428cc46b36a786", "difficulty": 2500, "tags": ["matrices", "dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.9544626593806922, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "// created: 2019-03-23\n#include <iostream>\n#include <vector>\n#include <algorithm>\n#include <set>\n#include <map>\n#include <numeric>  // std::accumulate\n\nusing namespace std;\n\n#define Pair pair<int,int>\n#define Push push_back\n#define Eps (1e-9)\n#define px first\n#define py second\n#define length size()\n\n#define For(i, a, b) for (int i = (a); i <= (int)(b); ++i)\n#define Rep(i, a)    for (int i = 0; i < (int)(a); ++i)\n#define All(c)       c.begin(), c.end()\n#define Equal(a, b)  (abs((a)-(b)) < eps)\n#define Sqr(x)       ((x)*(x))\n\n#define contain(c,x) ((c).find(x) != (c).end()) // container with member function find\n#define vcontain(c,x) (find(all(c),x) != (c).end()) // for vector\n\n#define print(v) for(auto x: v) {cout << x << \" \";} cout << \"\\n\"\n#define vprint(vv) for (auto v: vv) {print(v);}\n\ntypedef vector<int>  Vector;\ntypedef    set<int>  Set;\ntypedef   long long  Long;\n// end\n\nint main() {\n\tios_base::sync_with_stdio(false);\n\n\tLong x, y, l, r; cin >> x >> y >> l >> r;\n\tvector<Long> x_deg;\n\tvector<Long> y_deg;\n\tvector<Long> unlucky_years;\n\tmap<Long,int> added;\n\tLong t;\n\n\tt = 1;\n\twhile (t <= r) {\n\t\tx_deg.Push(t);\n\t\tt *= x;\n\t}\n\n\tt = 1;\n\twhile (t <= r) {\n\t\ty_deg.Push(t);\n\t\tt *= y;\n\t}\n\n\tunlucky_years.Push(l - 1);\n\tunlucky_years.Push(r + 1);\n\tRep (i, x_deg.length) {\n\t\tRep (j, y_deg.length) {\n\t\t\tt = x_deg[i] + y_deg[j];\n\t\t\tif (l <= t and t <= r and added[t] == 0) {\n\t\t\t\tunlucky_years.Push(t);\n\t\t\t\tadded[t] = 1;\n\t\t\t}\n\t\t}\n\t}\n\tsort(All(unlucky_years));\n\tLong answer = 0;\n\tRep (i, unlucky_years.length - 1) {\n\t\tanswer = max(answer, unlucky_years[i + 1] - unlucky_years[i] - 1);\n\t}\n\tcout << answer << \"\\n\";\n\n\treturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "84c09753ab630bf8b707af4af36452fd", "src_uid": "68ca8a8730db27ac2230f9fe9b120f5f", "apr_id": "caef62bbf3ae3cf695f11092faf998e3", "difficulty": 1800, "tags": ["math", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9232067510548523, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include<iostream>\n#include<cmath>\n#include <math.h>      \n#include<algorithm>\n#include<stdio.h>\nusing namespace std;\n\nint main(){long long m1,d,n,n1,j,i,k1,k2,l=0,m,k,p=0;\nlong long a[20],b[20],c[20];\ncin>>n>>d;\nm=n-d;n1=n;m1=m;\nk1=(long long)floor(1+log10((double)n)-0.000001);\nk2=(long long)floor(1+log10((double)m));\nif(k1!=k2){p=0;for(i=0;i<k1-1;i++)\n{if(n1%10==9){p++;n1=n1/10;}\n    else\n        break;}\nif(p==k1-1)\n    cout<<n;else\n    if((n-n%(long long)pow(10.0,1.0*(k1-1)))/(long long)pow(10.0,1.0*(k1-1))==1)\n    for(i=0;i<k1-1;i++)\n        cout<<9;\nelse{\n    cout<<(n-n%(long long)pow(10.0,1.0*(k1-1)))/(long long)pow(10.0,1.0*(k1-1))-1;\n        for(i=0;i<k1-1;i++)\n        cout<<9;\n}}else\n{\n    for(i=k1-1;i>=0;i--)\n    {\n        a[i]=n%10;\n        b[i]=m%10;\n        n=n/10;m=m/10;\n    }\n    \nfor(i=0;i<k1;i++)\n    if(a[i]==b[i])\n    cout<<a[i];\n    else\n        break;\nif(i<k1-1){\n    for(int v=i+1;v<k1;v++)\n        if(a[v]==9)\n            p++;\n        if(p==k1-i-1)\n        {cout<<a[i];for(k=i+1;k<k1-1;k++)\n    cout<<9;}\n        else\n\ncout<<a[i]-1;for(k=i+1;k<k1;k++)\n    cout<<9;}\nelse{if(i<k1){\n    cout<<a[i];\nfor(k=i+1;k<k1;k++)\n    cout<<9;}\n}\n\n}\n\n    return 0;}", "lang": "GNU C++11", "bug_code_uid": "ff25e33cb9d11a2cb02714cf4c346de4", "src_uid": "c706cfcd4c37fbc1b1631aeeb2c02b6a", "apr_id": "cca29165db029bea15f23b3bdb640466", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.21411947245927077, "equal_cnt": 10, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "\n #include <iostream>\nusing namespace std;\n\nint main() {\n\t// your code goes here\n\tint n,m,a,b,t,f,c;\nf=0;\ncin>>n>>m>>a>>b;\nif(n%2!=0&&m%2==0)\n{\nt=(n+1)/m;\nf=1;}\nelse if(m%2!=0&&n%2==0)\n{\n    t=n/(m-1);\n    f=2;\n}\nelse\n{\nt=n/m;}\n\nif(m>n){\ncout<<n*a;}\nelse if(n*a<t*b){\n\ncout<<n*a;}\nelse if(t*b<n*a&&f==1){\nc=b*(t-1)+a;\ncout<<c;\n}\nelse if(t*b<n*a&&f==2)\n{\n    c=b*(t-1);\n    cout<<c;\n}\nelse\n{\ncout<<t*b;\n}\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "d22d9dc642f4068af58fb2e33e726533", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "apr_id": "46984802034a5def36e6b626787a12f4", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8974901723616571, "equal_cnt": 20, "replace_cnt": 15, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 19, "bug_source_code": "#include <iostream>\n#include <vector>\n#include <queue>\n#include <cmath>\n\nusing namespace std;\n\nint main(){\n\t\n\tint r1, c1, r2, c2;\n\tcin >> r1 >> c1 >> r2 >> c2;\n\t\n\tif(r1==r2 || c1==c2){\n\t\tcout << 1 << \" \";\n\t}else cout << 2 << \" \";\n\tconst int INF = 1e9;\n\tvector<vector<int> > g (9, vector<int>(9, INF));\n\tqueue<int> Q;\n\tQ.push(r1);Q.push(c1);g[r1][c1] = 0;\n\tint res = 0;\n\tbool flag = 0;\n\twhile(!Q.empty()){\n\t\tint y = Q.front();Q.pop();\n\t\tint x = Q.front();Q.pop();\n\t\tif(y==r2 && x==c2){\n\t\t\tcout << g[y][x] << \" \";\n\t\t\tres=0;\n\t\t\tflag=1;\n\t\t\tbreak;\n\t\t}\n\t\tint i = y, j = x;\n\t\twhile(i <= 8 && j <= 8){\n\t\t\tif(g[i][j] == INF){\n\t\t\t\tQ.push(i);Q.push(j);g[i][j]=res+1;\n\t\t\t}\n\t\t\ti++;j++;\n\t\t}\n\t\ti = y;j=x;\n\t\twhile(i >= 1 && j >= 1){\n\t\t\tif(g[i][j] == INF){\n\t\t\t\tQ.push(i);Q.push(j);g[i][j]=res+1;\n\t\t\t}\n\t\t\ti--;j--;\n\t\t}\n\t\ti = y;j=x;\n\t\twhile(i <= 8 && j >= 1){\n\t\t\tif(g[i][j] == INF){\n\t\t\t\tQ.push(i);Q.push(j);g[i][j]=res+1;\n\t\t\t}\n\t\t\ti++;j--;\n\t\t}\n\t\ti = y;j=x;\n\t\twhile(i >= 1 && j <= 8){\n\t\t\tif(g[i][j] == INF){\n\t\t\t\tQ.push(i);Q.push(j);g[i][j]=res+1;\n\t\t\t}\n\t\t\ti--;j++;\n\t\t}\n\t\t\t\n\t\t\tres++;\n\t\t\n\t}\n\tres=0;\n\tif(!flag)cout << 0 << \" \";\n\t\n\tif(r2 > r1 && c2 > c1){\n\t\twhile(r1!=r2 || c1!=c2){\n\t\t\t++r1;++c1;++res;\n\t\t}\n\t}else{\n\t\tif(r2 > r1 && c2 < c1){\n\t\t\twhile(r1!=r2 || c1!=c2){\n\t\t\t++r1;--c1;++res;\n\t\t\t}\n\t\t}else{\n\t\t\tif(r2 < r1 && c2 > c1){\n\t\t\twhile(r1!=r2 || c1!=c2){\n\t\t\t--r1;++c1;++res;\n\t\t\t}\n\t\t}else{\n\t\t\tif(r2 < r1 && c2 < c1){\n\t\t\twhile(r1!=r2 || c1!=c2){\n\t\t\t--r1;--c1;++res;\n\t\t\t}\n\t\t}\n\t\t}\n\t\t}\n\t}\n\t\n\tif(r1==r2 && c1==c2){\n\t\tcout << res;\n\t\treturn 0;\n\t}\n\t\n\tif(r1==r2){\n\t\tres+=abs(c2-c1);\n\t\tcout << res;\n\t\treturn 0;\n\t}else{\n\t\tres+=abs(r2-r1);\n\t\tcout << res;\n\t\treturn 0;\n\t}\n\t\n\treturn 0;\n}\n", "lang": "MS C++ 2017", "bug_code_uid": "7446934543369abe930b7a1041d5f2e1", "src_uid": "7dbf58806db185f0fe70c00b60973f4b", "apr_id": "f1d76c839fa27ade0940a2d244f292a6", "difficulty": 1100, "tags": ["graphs", "math", "shortest paths"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9698630136986301, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include <iostream>\n#include <string>\nusing namespace std;\n\nint main() {  \n  int n;\n  cin >> n;\n  string s;\n  cin >> s;\n  int sf = 0, fs = 0, i=1;\n  while (i < s.size()) {\n    if (s[i - 1] != s[i]) {\n      if (s[i - 1] == 'S') sf++;\n      else fs++;\n\t  i++;\n    }\n  }\n  if (sf > fs) {\n    cout << \"YES\" << endl;\n  } else {\n    cout << \"NO\" << endl;\n  }\n  return 0;\n}", "lang": "GNU C++", "bug_code_uid": "b5c45a283507c622f13f68028fb1a746", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "apr_id": "b7d416d818a95ba80e2f5777c279527e", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9180834621329211, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 4, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "#include <iostream>\n#include <cstdio>\n\nusing namespace std;\nconst int MAXN=100+10;\nchar s[MAXN];\n\nint main()\n{\n    int n;\n    while(scanf(\"%d\",&n))\n    {\n        scanf(\"%s\",s);\n        if(s[0]=='S'&&s[n-1]=='F')\n            printf(\"YES\\n\");\n        else\n            printf(\"NO\\n\");\n    }\n\n    //cout << \"Hello world!\" << endl;\n    return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "f0bd6b65932fc72cb719dc46bfb3f1cc", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "apr_id": "abab5237b33cd9f116a17267723b95aa", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.985655737704918, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\nint main()\n{\n    int a,b,c;\n    cin>>a>>b>>c;\n    for(int i=a; i>=1; i--)\n        for(int j=b; j>=1; j--)\n            for(int k=c; k>=1; k--)\n            {\n                for(int l=100;l>=1;l--)\n                {\n                    if(i*2==j&&j*2==k)\n                    {\n                        cout<<i+j+k<<endl;\n                        return 0;\n                    }\n                }\n            }\n    cout<<\"0\"<<endl;\n    return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "b57690a066ce01524e10bded66249ac3", "src_uid": "82a4a60eac90765fb62f2a77d2305c01", "apr_id": "58107adc712ad8213d981374295ce99a", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9933184855233853, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include <cstdio>\n#include <vector>\nusing namespace std;\ntypedef vector<int> VI;\ntypedef vector<VI> VVI;\ntypedef long long LL;\n\n#define FOR(i,a,b) for(int i=a;i<int(b);i++)\n#define SZ(a) ((int)(a).size())\n#define MOD 998244353\n\nstruct RS {\n\tint wp; // with parent, take\n\tint nt; // with parent, do not take\n\tint np; // without parent\n};\n\nint N;\nVVI adj;\nvector<RS> rss;\n\nvoid dfs(int n, int p) {\n\tVI& aj = adj[n];\n\tif (p != -1) aj.erase(find(aj.begin(), aj.end(), p));\n\tRS& rs = rss[n];\n\tif (aj.empty()) {\n\t\trs.wp = 1;\n\t\trs.nt = 0;\n\t\trs.np = 1;\n\t\treturn;\n\t}\n\tfor (int m : aj) dfs(m, n);\n\tVI pfx(aj.size()), sfx(aj.size());\n\tpfx[0] = 1;\n\tFOR(i,1,aj.size()) {\n\t\tRS const& rsm = rss[aj[i-1]];\n\t\tint x = rsm.nt + rsm.np;\n\t\tx %= MOD;\n\t\tpfx[i] = int((LL(pfx[i-1])*x)%MOD);\n\t}\n\tsfx[SZ(aj)-1] = 1;\n\tfor (int i = SZ(aj)-2; i >= 0; i--) {\n\t\tRS const& rsm = rss[aj[i+1]];\n\t\tint x = rsm.nt + rsm.np;\n\t\tx %= MOD;\n\t\tsfx[i] = int((LL(sfx[i+1])*x)%MOD);\n\t}\n\trs.wp = 1;\n\trs.nt = 0;\n\tLL allnp = 1;\n\tFOR(i,0,SZ(aj)) {\n\t\tRS const& rsm = rss[aj[i]];\n\t\tint x = rsm.nt + rsm.np;\n\t\trs.wp = int((LL(rs.wp) * x)%MOD);\n\t\tLL nt = rsm.wp;\n\t\tnt = (nt * pfx[i]) % MOD;\n\t\tnt = (nt * sfx[i]) % MOD;\n\t\trs.nt = int((rs.nt + nt) % MOD);\n\t\tallnp = (allnp * rsm.np) % MOD;\n\t}\n\trs.np = (rs.nt + allnp) % MOD;\n\t//printf(\"Called %d wp=%d nt=%d np=%d\\n\", n+1, rs.wp, rs.nt, rs.np);\n}\n\nint main() {\n\tscanf(\"%d\", &N);\n\tadj.resize(N);\n\tFOR(a,0,N-1) {\n\t\tint u, v;\n\t\tscanf(\"%d%d\", &u, &v); --u; --v;\n\t\tadj[u].push_back(v);\n\t\tadj[v].push_back(u);\n\t}\n\trss.resize(N);\n\tdfs(0, -1);\n\tprintf(\"%d\\n\", rss[0].np);\n}\n", "lang": "GNU C++17", "bug_code_uid": "21920951228ccb0c26c98b600cfef750", "src_uid": "a40e78a7144ac2fae1890ac7598990bf", "apr_id": "aea95e6b79f379b51d1f0066441aeb4d", "difficulty": 2400, "tags": ["trees", "dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9785581106277191, "equal_cnt": 10, "replace_cnt": 2, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 9, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\nvector <vector <long long> > G;\nvector <long long> stopnie;\nvector <vector <long long> > stany; \nlong long modulo = 998244353;\n/*\nstan 1 - jesli jest z synkiem LUB izolowany ( i kazde poddrzewo jest ok)\nstan 2 - laczymy z tata, nie z jakims synkiem\nstan 3 - laczy sie z ktoryms z synkow\n*/\nlong long SzypkiePot(long long pod, long long pot, long long mod){\n    if (pot == 0){return 1;}\n    long long wynik = SzypkiePot(pod, pot/2, mod)%mod;\n    if (pot % 2 == 0){ return (wynik*wynik)%mod;}\n    else{  return (pod*((wynik*wynik)%mod))%mod; }\n}\nlong long Odw(long long x, long long mod){ return SzypkiePot(x, mod-2, mod)%mod;}\n\n\nvoid Licz(long long v, long long tata){\n    cerr << \"v  \"<<v << \"\\n\";\n    long long stan2 = 1; //czyli polacze z tata\n    for (auto w : G[v]){ // dla kazdego synka chce zeby albo sie izolowal albo laczyl z synem\n        if (w == tata) {continue;} // jesli nie jest synem\n        stan2 = ((stany[w][0] + stany[w][2])*stan2)%modulo; // domnazam na ile sposobow \n        // cerr << \"Domnazam \"<<stany[w][0] + stany[w][2] << \"\\n\";\n         // moj synek moze albo sie laczyc z synem swoim albo byc (izolowany lub z synem)\n    }\n    long long stan3 = 0; // polacze z synkiem\n    for (auto w : G[v]){ // wybieram syna do polaczenia\n        if (w == tata){continue;}\n        long long odwrotnosc_mod = Odw((stany[w][0] + stany[w][2]), modulo);\n        // pozostalych laczymy jakos albo z synkami albo opcja (izoluj/synkowie)\n        // cerr << \"odwrotnosc \" << odwrotnosc_mod << \"\\n\";\n        if (odwrotnosc_mod < 0){\n            odwrotnosc_mod = (odwrotnosc_mod + modulo) % modulo;\n        }\n        long long sposoby_pozostalych = (stan2 * odwrotnosc_mod)%modulo; // wszystkie sposoby bez tego dolaczonego\n        // cerr << \"sposoby pozostalych \"<<sposoby_pozostalych << \"\\n\";\n        long long polacz = (stany[w][1]*sposoby_pozostalych)%modulo; // tego w lacze z tata\n        if (polacz < 0){\n            polacz = (polacz + modulo)%modulo;\n        }\n        // cerr << \"polacz = \"<<polacz << \"\\n\";\n        stan3 = (stan3 + polacz)%modulo;\n    }\n    long long stan1 = 1;\n    for (auto w : G[v]){\n        if (w == tata){continue;}\n        stan1 = (stan1 * stany[w][0])%modulo;\n    }\n    stan1 = (stan1 + stan3)%modulo;\n    // cerr << \"stany \" << stan1 << \" \" << stan2 << \" \" << stan3 << \"\\n\";\n    stany[v]={stan1, stan2, stan3};\n}\nvoid DFS(long long v, long long tata){\n    // cerr << \"v \"<<v << \" tata \" << tata << \"\\n\";\n    for (auto w : G[v]){\n        if (w != tata){\n            DFS(w, v);\n        }\n    }\n    Licz(v, tata);\n}\nint main(){\n    ios_base::sync_with_stdio(0);\n    cin.tie(0);\n    cout.tie(0);\n    long long n;\n    cin >> n;\n    stopnie.resize(n);\n    G.resize(n);\n    stany.resize(n);\n    for (long long i = 0; i < n-1; i++){\n        long long u, v;\n        cin >> u >> v;\n        u--;\n        v--;\n        stopnie[u]++;\n        stopnie[v]++;\n        G[u].push_back(v);\n        G[v].push_back(u);\n    }\n    DFS(0, 0);\n    // for (long long i = 0; i < n; i++){\n    //     cerr << \"v = \"<<i+1 << \"\\n\";\n    //     cerr << stany[i][0] << \" \" << stany[i][1] << \" \" << stany[i][2] << \"\\n\";\n    // }\n    cout << stany[0][0]%modulo << \"\\n\";\n\n}", "lang": "GNU C++17", "bug_code_uid": "6d87e6035b6b49f7d46f114a71422eb3", "src_uid": "a40e78a7144ac2fae1890ac7598990bf", "apr_id": "7b859f5844f6811510ab4b8228dd1f1d", "difficulty": 2400, "tags": ["trees", "dp"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.9004010695187166, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n\ntypedef long long ll;\ntypedef unsigned long long ull;\ntypedef long double ld;\n\ntemplate<int m>\nstruct modint {\n\n\tunsigned x;\n\n\tmodint() : x(0) {}\n\n\tmodint(long long arg) {\n\t\targ %= m;\n\t\tif (arg < 0) {\n\t\t\tx = arg + m;\n\t\t} else {\n\t\t\tx = arg;\n\t\t}\n\t}\t\n\n\tmodint& operator+= (const modint& other) {\n\t\tx += other.x;\n\t\tif (x >= m) {\n\t\t\tx -= m;\n\t\t}\n\t\treturn *this;\n\t}\n\n\tmodint& operator*= (const modint& other) {\n\t\tx = (x * 1ll * other.x) % m;\n\t\treturn *this;\n\t}\n\n\tmodint& operator-= (const modint& other) {\n\t\tx += m - other.x;\n\t\tif (x >= m) {\n\t\t\tx -= m;\n\t\t}\n\t\treturn *this;\n\t}\n\n\tmodint operator+ (const modint& other) const {\n\t\tmodint tmp = *this;\n\t\ttmp += other;\n\t\treturn tmp;\n\t}\n\n\tmodint operator- (const modint& other) const {\n\t\tmodint tmp = *this;\n\t\ttmp -= other;\n\t\treturn tmp;\n\t}\n\n\tmodint operator* (const modint& other) const {\n\t\tmodint tmp = *this;\n\t\ttmp *= other;\n\t\treturn tmp;\n\t}\n\n\texplicit operator int () const {\n\t\treturn x;\n\t}\n\n\tmodint& operator++ () {\n\t\t++x;\n\t\tif (x == m) {\n\t\t\tx = 0;\n\t\t}\n\t\treturn *this;\n\t}\n\n\tmodint& operator-- () {\n\t\tif (x == 0) {\n\t\t\tx = m-1;\n\t\t} else {\n\t\t\t--x;\n\t\t}\n\t\treturn *this;\n\t}\n\n\tmodint operator++ (int) {\n\t\tmodint tmp = *this;\n\t\t++*this;\n\t\treturn tmp;\n\t}\n\n\tmodint operator-- (int) {\n\t\tmodint tmp = *this;\n\t\t--*this;\n\t\treturn tmp;\n\t}\n\n\tbool operator== (const modint& other) const {\n\t\treturn x == other.x;\n\t}\n\n\tbool operator!= (const modint& other) const {\n\t\treturn x != other.x;\n\t}\n\n\ttemplate<class T>\n\tmodint operator^ (T arg) const {\n\t\tif (arg == 0) {\n\t\t\treturn 1;\n\t\t}\n\t\tif (arg == 1) {\n\t\t\treturn x;\n\t\t}\n\t\tauto t = *this ^ (arg >> 1);\n\t\tt *= t;\n\t\tif (arg & 1) {\n\t\t\tt *= *this;\n\t\t}\n\t\treturn t;\n\t}\n\n\tmodint inv() const {\n\t\treturn *this ^ (m-2);\n\t}\n};\n\nconst int MOD = 998244353;\ntypedef modint<MOD> mint;\n\nint n;\nbasic_string<int> e[300005];\nint ch[300005];\n\nmint ma[300005], un[300005];\nmint gore[300005], dole[300005];\n\nvoid dfs1(int x, int p) {\n\tun[x] = 1;\n\tgore[x] = 1;\n\n\tbasic_string<mint> z, z_pref, z_suff, gore1;\n\n\tfor (int y : e[x]) {\n\t\tif (y == p)\n\t\t\tcontinue;\n\t\tdfs1(y, x);\n\t\tun[x] *= dole[y] + un[y];\n\t\tgore[x] *= dole[y] * 2 + un[y]; \n\t\t// dole\n\t\tz += un[y] + dole[y];\n\t\tgore1 += gore[y];\n\t}\n\n\tz_pref = z;\n\tz_suff = z;\n\tint m = z.size();\n\tif (m > 0) {\n\t\tz_pref[0] = 1;\n\t\tfor (int i=0; i<m-1; i++)\n\t\t\tz_pref[i+1] = z_pref[i] * z[i];\n\t\tz_suff[m-1] = 1;\n\t\tfor (int i=m-1; i>0; i--)\n\t\t\tz_suff[i-1] = z_suff[i] * z[i];\n\t\tfor (int i=0; i<m; i++)\n\t\t\tdole[x] += gore1[i] * z_pref[i] * z_suff[i];\n\t}\n}\n\nvoid dfs0(int x, int p) {\n\tun[x] = 1;\n\tma[x] = 0;\n\n\tbasic_string<mint> z, z_pref, z_suff, un1;\n\n\tfor (int y : e[x]) {\n\t\tif (y == p)\n\t\t\tcontinue;\n\t\tdfs0(y, x);\n\t\tun[x] *= ma[y] + un[y];\n\t\tz += ma[y] + un[y];\n\t\tun1 += un[y];\n\t}\n\tz_pref = z;\n\tz_suff = z;\n\tint m = z.size();\n\tif (m > 0) {\n\t\tz_pref[0] = 1;\n\t\tfor (int i=0; i<m-1; i++)\n\t\t\tz_pref[i+1] = z_pref[i] * z[i];\n\t\tz_suff[m-1] = 1;\n\t\tfor (int i=m-1; i>0; i--)\n\t\t\tz_suff[i-1] = z_suff[i] * z[i];\n\t\tfor (int i=0; i<m; i++)\n\t\t\tma[x] += un1[i] * z_pref[i] * z_suff[i];\n\t}\n\n}\n\nint main() {\n\tios_base::sync_with_stdio(false);\n\tcin.tie(nullptr);\n\tcout.tie(nullptr);\n\tcerr.tie(nullptr);\n\n\tcin >> n;\n\tfor (int i=1; i<n; i++) {\n\t\tint u, v;\n\t\tcin >> u >> v;\n\t\te[u] += v;\n\t\te[v] += u;\n\t}\n\n\tdfs1(1, 1);\n\tcout << (int)(dole[1] + un[1]) << '\\n';\n}", "lang": "GNU C++17", "bug_code_uid": "faba7a619523d888db12fcb6c05bf412", "src_uid": "a40e78a7144ac2fae1890ac7598990bf", "apr_id": "4bf58ca07c7f8a69e4072e750aedab24", "difficulty": 2400, "tags": ["trees", "dp"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8556263269639066, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "#include<iostream>\nusing namespace std;\nbool isPN(int);\nint main()\n{\n    int n;\n    cin>>n;\n    while(!n%10)\n        n=n/10;\n    return isPN(n);\n}\nbool isPN(int num)\n{\n        int o = num;\n        int tmp = 0;\n        while(num != 0) {\n                tmp *= 10;\n                tmp += num % 10;\n                num /= 10;\n        }\n        if (tmp == o) {\n                return true;\n        }\n        return false;\n}", "lang": "MS C++", "bug_code_uid": "366b8d6f308866d069ab3da166fbbb9c", "src_uid": "d82278932881e3aa997086c909f29051", "apr_id": "41282b31f60c7f0138aee6983ab6939c", "difficulty": 900, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.7954545454545454, "equal_cnt": 9, "replace_cnt": 1, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 8, "bug_source_code": "#include<bits/stdc++.h>\n#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);\n#define ll long long\n#define pb push_back\n#define mk make_pair\n#define endl \"\\n\"\n#define ff first\n#define ss second\n#define mod 1000000007\nusing namespace std;\nbool prime[1000000001];\nvector<ll>us;\nll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod%mod;a=a*a%mod;}return res;}\nvoid prim(ll n)\n{\n    memset(prime, true, sizeof(prime));\n\n    for (int p=2; p*p<=n; p++)\n    {\n        if (prime[p] == true)\n        {\n            for (int i=p*p; i<=n; i += p)\n                prime[i] = false;\n        }\n    }\n}\nint main()\n{\n    fastio;\n    ll i,j,k,n,x;\n    cin>>x>>n;\n    n=n%mod;\n    prim(x);\n    ll mx=x;\n    us.clear();\n    for(i=2;i<=mx;i++)\n    {\n        if(mx%i==0&&prime[i])\n        {\n            us.pb(i);\n        }\n    }\n    ll ans=1;\n    ll num=n;\n\n    for(i=0;i<us.size();i++)\n    {    num=n;\n         ll po=0;\n         while(num!=0)\n         {\n             po=po+num/us[i];\n             num=num/us[i];\n         }\n         ans=ans*power(us[i],po)%mod;\n    }\n    cout<<ans%mod<<endl;\n    return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "618215a74fd389c27ed664c9f7677e36", "src_uid": "04610fbaa746c083dda30e21fa6e1a0c", "apr_id": "797b800947fc9c8d082dc71db49512cc", "difficulty": 1700, "tags": ["math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.6409144659046118, "equal_cnt": 17, "replace_cnt": 11, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 16, "bug_source_code": "#include <vector>\n#include <list>\n#include <map>\n#include <set>\n#include <deque>\n#include <stack>\n#include <bitset>\n#include <algorithm>\n#include <functional>\n#include <numeric>\n#include <utility>\n#include <sstream>\n#include <iostream>\n#include <iomanip>\n#include <cstdio>\n#include <cmath>\n#include <cstdlib>\n#include <ctime>\n\nusing namespace std;\n\n\nvector<int> f(12);\n\nint fact(int n){\n  if(n==1) return 1;\n  if(f[n] != -1) return f[n];\n  f[n] = fact(n-1)*n;\n  return f[n];\n}\n\nint main(){\n  for(int i=0; i<f.size(); ++i)\n    f[i] = -1;\n\n  int N;\n  cin >> N;\n\n  long long num;\n  cin >> num;\n\n  long long prod = 1;\n\n  for(int i=0; i<N; ++i){\n    int digit = num % 10;\n    prod *= fact(digit);\n    num /= 10;\n  }\n\n  vector<int> digits;\n  while(prod%7==0){\n    prod /= fact(7);\n    digits.push_back(7);\n  }\n  \n  while(prod%5==0){\n    prod /= fact(5);\n    digits.push_back(5);\n  }\n\n  while(prod%3==0){\n    prod /= fact(3);\n    digits.push_back(3);\n  }\n  while(prod%2==0){\n    prod /= 2;\n    digits.push_back(2);\n  }\n  \n  \n\n  sort(digits.begin(), digits.end());\n\n  for(int i=digits.size()-1; i>=0; --i)\n    cout << digits[i];\n  cout << endl;\n  \n}", "lang": "GNU C++0x", "bug_code_uid": "f2ee034de1ab7c126ab5ec0181c8a262", "src_uid": "60dbfc7a65702ae8bd4a587db1e06398", "apr_id": "4aee73a567e3735fc12257d4d2d76d90", "difficulty": 1400, "tags": ["greedy", "math", "sortings"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.20705699883675843, "equal_cnt": 24, "replace_cnt": 19, "delete_cnt": 5, "insert_cnt": 0, "fix_ops_cnt": 24, "bug_source_code": "#include<bits/stdc++.h>\n#define int long long int\nusing namespace std;\nint HashArray[800003];\nint32_t main(){\n    int n;\n    cin>>n;\n    int b[n];\n    for(int i=0;i<n;i++){\n        cin>>b[i];\n    }\n    int tot = 0;\n    if(n>1){\n        int newarray[n];\n        for(int i=0;i<n;i++){\n            newarray[i] = i-b[i];\n        }\n        int flag = 800003;\n        for(int i=0;i<flag;i++){\n            HashArray[i] = 0;\n        }\n        int key;\n        for(int i=0;i<n;i++){\n            if(newarray[i]>=0){\n                key = 2*newarray[i];\n            }\n            else{\n                key = (-2)*newarray[i]+1;\n            }\n            HashArray[key] += b[i];\n            if(HashArray[key] > tot){\n                tot = HashArray[key];\n            }\n        }\n    }\n    if(n==1){\n        tot = b[0];\n    }\n    cout<<tot;\n    return 0;\n}\n\n", "lang": "GNU C++14", "bug_code_uid": "c25a53c28d0c173d157b8c53dda7dc90", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "apr_id": "784cddeb099fba5e68b0db6b239232f0", "difficulty": 1600, "tags": ["strings", "brute force", "greedy", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.1762652705061082, "equal_cnt": 21, "replace_cnt": 16, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 20, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nlong bs(vector<unsigned long long>a, unsigned long long x) {\nlong lo = 0,\nhi = a.size() - 1;\nwhile (lo <= hi) {\nlong m = (lo + hi) / 2;\nif (a[m] == x) {\nreturn m+1;\n} else if (x < a[m]) {\nhi = m - 1;\n} else if (x > a[m]) {\nlo = m + 1;\n}\n}\nreturn 0;\n}\nint main()\n{\n    long k;\n    unsigned long long n;\n    cin>>n>>k;\n    std::vector<unsigned long long>a; ;\n    a.push_back(k);\n    for(long i=1;i<k-1;i++)\n    {\n        a.push_back(a[i-1]+(k-i)-1);\n    }\n    if(bs(a,n)==0)cout<<-1;\n    else cout<<bs(a,n);\n}", "lang": "GNU C++14", "bug_code_uid": "d0bff8a0a9defb8459bdbc00b39a9bfb", "src_uid": "83bcfe32db302fbae18e8a95d89cf411", "apr_id": "85a0ffd7110a88dca69bf9b201f1ddbe", "difficulty": 1700, "tags": ["math", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.08011996572407884, "equal_cnt": 19, "replace_cnt": 16, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 19, "bug_source_code": "//besmellah\n#include <bits/stdc++.h>\nusing namespace std;\n\n#define int long long\n#define hash salam\ntypedef pair <int, int> pii;\nconst int maxn = 1005, maxs = 25005, mod = 1e9 + 7, M = 1e15 + 37, b = 17;\nvector <int> compress;\nint d, sz;\nbool F[maxs];\nint dp[52][maxs], chiz[maxs][10], hash[maxn][maxn];\nunordered_map <int, pii> MM;\n\n\ninline string DEC(string s) {\n\tint ptr = (int)s.size() - 1;\n\twhile (s[ptr] == 0) {\n\t\ts[ptr] = 9;\n\t\tptr--;\n\t}\n\ts[ptr]--;\n\treturn s;\n}\n\ninline void makedp(int i, vector <int> D) {\n\tfor (int j = 0; j < sz; j++) dp[i][j] = 0;\n\tfor (int j = 0; j < sz; j++) {\n\t\tfor (auto k: D) {\n\t\t\tif (!F[chiz[j][k]]) continue;\n\t\t\tdp[i][chiz[j][k]] += dp[i - 1][j];\n\t\t\tif (dp[i][chiz[j][k]] >= mod)\n\t\t\t\tdp[i][chiz[j][k]] -= mod;\n\t\t}\n\t}\n//\tfor (auto d: D) cout << d << \"  \";\n//\tcout << endl;\n//\tfor (int j = 0; j < sz; j++) cout << i << ' ' << compress[j] << ' ' << dp[i][j] << endl;\n}\n\ninline int S(string s) {\n\tint ans = 0;\n\tfor (int i = 0; i < s.size(); i++) {\n\t\tans = (ans * 10 + s[i]) % mod;\n\t}\n//\tcout << \"ALEIK\" << endl;\n\treturn ans;\n}\n\ninline int get(string s) {\n//\tcout << s << endl;\n//\tfor (int i = 0; i < 2; i++) cout << (char)(s[i] + '0');\n//\tcout << endl;\n\tint ans = 0;\n\tdp[0][0] = 1;\n\tfor (int i = 0; i < d; i++) {\n\t\tif (i) {\n\t\t\tmakedp(i, {s[i - 1]});\n\t\t}\n\t\tvector <int> V;\n\t\tfor (int j = 0; j < s[i]; j++) {\n\t\t\tV.push_back(j);\n\t\t}\n\t\tmakedp(i + 1, V);\n\t\tfor (int j = i + 2; j <= d; j++) makedp(j, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9});\n\t\tfor (int j = 0; j < sz; j++) {\n\t\t\tans += dp[d][j];\n\t\t\tif (ans >= mod)\n\t\t\t\tans -= mod;\n\t\t}\n\t}\n//\tcout << \"SALAM\" << endl;\n\tmakedp(d, {s[d - 1]});\n\tfor (int i = 0; i < sz; i++) {\n//\t\tcout << \"SALAM\" << endl;\n\t\tans += dp[d][i];\n\t\tif (ans >= mod)\n\t\t\tans -= mod;\n\t}\n\treturn (S(s) - ans + mod) % mod;\n}\n\nint32_t main() {\n\tios::sync_with_stdio(false);\n\tcin.tie(0);\n\tstring s, x, y;\n\tcin >> s >> x >> y;\n\tint n = s.size();\n\td = x.size();\n\tfor (int i = 0; i < n; i++) s[i] -= '0';\n\tfor (int i = 0; i < d; i++) {\n\t\tx[i] -= '0';\n\t\ty[i] -= '0';\n\t}\n\tx = DEC(x);\n\tfor (int l = 0; l < n; l++) {\n\t\thash[l][l] = s[l] + 1;\n\t\tcompress.push_back(hash[l][l]);\n\t\tMM[hash[l][l]] = pii(l, l);\n\t\tfor (int r = l + 1; r < min(n, l + 25); r++) {\n\t\t\thash[l][r] = (hash[l][r - 1] * b + (s[r] + 1)) % M;\n\t\t\tcompress.push_back(hash[l][r]);\n\t\t\tMM[hash[l][r]] = pii(l, r);\n\t\t}\n\t}\n\tcompress.push_back(0);\n\tsort(compress.begin(), compress.end());\n\tcompress.resize(unique(compress.begin(), compress.end()) - compress.begin());\n\tsz = compress.size();\n\tMM[0] = pii(0, 0);\n\tfor (int i = 0; i < sz; i++) {\n\t\tpii P = MM[compress[i]];\n\t\tint t = P.second - P.first + 1;\n\t\tif (t >= d / 2) F[i] = 0;\n\t\telse F[i] = 1;\n\t\tF[0] = 1;\n\t\tfor (int j = 0; j < 10; j++) {\n\t\t\tint l = P.first, r = P.second;\n\t\t\tfor (l = max(l, r - 24); l <= r + 1; l++) {\n\t\t\t\tint nh = (hash[l][r] * b + (j + 1)) % M;\n\t\t\t\tif (!i) {\n\t\t\t\t\tnh = j + 1;\n//\t\t\t\t\tcout << nh << endl;\n\t\t\t\t}\n\t\t\t\tif (MM.find(nh) != MM.end()) {\n\t\t\t\t\tchiz[i][j] = lower_bound(compress.begin(), compress.end(), nh) - compress.begin();\n\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n//\t\t\tcout << compress[i] << ' ' << j << ' ' << compress[chiz[i][j]] << endl;\n\t\t}\n//\t\tcout << compress[i] << ' ' << F[i] << endl;\n\t}\n\tcout << (get(y) - get(x) + mod) % mod;\n}\n", "lang": "GNU C++11", "bug_code_uid": "c245f55396c401d92036cba91397cbf5", "src_uid": "0034806908c9794086736a2d07fc654c", "apr_id": "bbb0f9513116547f08f2daa41f5d4b65", "difficulty": 2900, "tags": ["dp", "strings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9997201231458158, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <bits/stdc++.h>\n#ifdef DBP\n#define deb(...) fprintf(stderr,__VA_ARGS__)\n#else\n#define deb(...) 0\n#endif\n#define fore(x,a,b) for(int x=a, qwerty=b; x<qwerty; x++)\n#define ALL(a) (a).begin(),(a).end()\n#define SZ(a) ((int)(a).size())\n#define pb push_back\n#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)\n#define fst first\n#define snd second\n#define mset(a,v) memset((a),(v),sizeof(a))\nusing namespace std;\ntypedef long long ll;\n\nconst ll MOD=1LL<<41;\nvector<int> kmppre(string& t){\n\tvector<int> r(t.size()+1);r[0]=-1;\n\tint j=-1;\n\tfore(i,0,t.size()){\n\t\twhile(j>=0&&t[i]!=t[j])j=r[j];\n\t\tr[i+1]=++j;\n\t}\n\treturn r;\n}\n\nconst int N=10005, ALPHA=2;\nint n,m,nxt[ALPHA][N];\nstring s;\nvector<int> r;\nint can[N];\nll add(ll a, ll b){a+=b;if(a>=MOD)a-=MOD;return a;}\nll mult(ll a, ll b){return (a*b)%MOD;}\n\nll be(ll b, ll e){\n    ll r=1;\n    while(e)if(e&1)r=(r*b)%MOD,e^=1;else b=(b*b)%MOD,e>>=1;\n    return r;\n}\n\nll dp[N][N];\nll f(int i, int j){\n    ll &v=dp[i][j];\n    if(v!=-1)return v;\n    if(i==0)return v=can[j];\n    if(j==n)return v=0;\n    v=0;\n    v=add(v,f(i-1,nxt[0][j]));\n    v=add(v,f(i-1,nxt[1][j]));\n    return v;\n}\n\nint main(){FIN;mset(dp,-1);\n    cin>>m>>s;n=SZ(s);\n    r=kmppre(s);\n   \t\n\tfore(c,'0','1'+1)fore(x,0,n){\n\t\tint j=x;\n\t\twhile(j>=0&&c!=s[j])j=r[j];\n\t\tnxt[c-'0'][x]=++j;\n\t}\n\n    fore(x,0,n){\n        int j=x;\n        can[x]=1;\n        fore(y,0,n-1){\n\t\t\tj=nxt[s[y]-'0'][j];\n\t\t\tif(j==n){can[x]=0;break;}\n        }\n    }\n    \n    ll ans=0;\n    fore(x,0,m){\n        if(x+n<=m){\n            ll cnt=f(x,0);\n            ans=add(ans, mult(cnt,be(2,m-(x+n))));\n        }else{\n            int j=0;\n            for(int y=n-(x+n-m); y<n; y++)j=nxt[s[y]-'0'][j];\n            ll cnt=f(m-n,j);\n            ans=add(ans,cnt);\n        }\n    }\n    \n    cout<<ans<<\"\\n\";\n}", "lang": "GNU C++11", "bug_code_uid": "dc1d11d8d2e56924ce4079c2b0a77b9c", "src_uid": "0034806908c9794086736a2d07fc654c", "apr_id": "a0df7ba62e829ba873a30fd173ff440c", "difficulty": 2900, "tags": ["dp", "strings"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.9960728311317386, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include<iostream>\n#include<algorithm>\n#include<cstdio>\n#include<cstring>\n#include<string>\n#include<vector>\n#include<map>\n#include<set>\nusing namespace std;\nlong long ans;\nint n,m;\nstring s;\nmap<string,int>Id;\nset<string>P;\nvector<string>S;\nlong long f[41][1610][41][2];\nvoid work(int len,int A,int B,int O,char c)\n{\n\tstring str=S[A]+c;\n\tint toA=A;\n\tif(str.length()==len+1&&Id.count(str))\n\t\ttoA=Id[str];\n\tstr=S[B]+c;\n\twhile(P.find(str)==P.end())\n\t\tstr=str.substr(1,str.length()-1);\n\tint toB=str.length();\n\tint toO=O;\n\tif(toB==m)toO=1;\n\tf[len+1][toA][toB][toO]+=f[len][A][B][O];\n\treturn ;\n}\nvoid solve(int len,int A,int B,int O)\n{\n\tif(!f[len][A][B][O])\n\t\treturn ;\n\tif(len==n)\n\t{\n\t\tif(O)ans+=f[len][A][B][O];\n\t\telse{\n\t\t\tstring str=S[B]+S[A];\n\t\t\tif(str.find(s)!=string::npos)\n\t\t\t\tans+=f[len][A][B][O];\n\t\t}\n\t}\n\twork(len,A,B,O,'0');\n\twork(len,A,B,O,'1');\n\treturn ;\n}\nvoid Ins(string str)\n{\n\tif(Id.count(str))\n\t\treturn ;\n\tId[str]=S.size();\n\tS.push_back(str);\n\treturn ;\n}\nint main()\n{\n\tcin>>n>>s;\n\tm=s.length();\n\tstring str=\"\";\n\tIns(str);P.insert(str);\n\tfor(int i=0;i<m;i++)\n\t{\n\t\tstr+=s[i];\n\t\tP.insert(str);\n\t}\n\tfor(int i=0;i<m;i++)\n\t{\n\t\tstr=\"\";\n\t\tfor(int j=i;j<m;j++)\n\t\t{\n\t\t\tstr+=s[j];\n\t\t\tIns(str);\n\t\t}\n\t}\n\tint N=S.size();\n\tf[0][0][0][0]=1;\n\tfor(int len=0;len<=n;len++)\n\t\tfor(int A=0;A<N;A++)\n\t\t\tfor(int B=0;B<=m;B++)\n\t\t\t\tfor(int O=0;O<2;O++)\n\t\t\t\t\tsolve(len,A,B,O);\n\tprintf(\"%lld\\n\",ans);\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "25c4741730c2a3c6d133f39c6cbec3ac", "src_uid": "0034806908c9794086736a2d07fc654c", "apr_id": "1699563d7359617c3e662982359ef2ea", "difficulty": 2900, "tags": ["dp", "strings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.7079530638852672, "equal_cnt": 16, "replace_cnt": 11, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 16, "bug_source_code": "#include <iostream>\n#include <cmath>\nusing namespace std;\n#define f(x) (c1 + c2*(x-1)*(x-1))\n\nint n, c1, c2;\nint solve(int i) {\n    int t1 = ceil(n/i);\n    int res = (i-1)*f(t1);\n    return res + f(n-(t1*(i-1)));\n}\n\nint main() {\n    char t;\n    cin >> n >> c1 >> c2;\n    int p = 0, r = 0, i;\n    for (i = 0; i < n; i++) {\n        cin >> t;\n        (t == '1') ? p++ : r++;\n    }\n\n    int lo = 1, hi = p;\n    while (lo < hi) {\n        int p1 = (lo+hi)/3, p2 = 2*(lo+hi)/3;\n        if (p1 < lo) p1 = lo;\n        int s1 = solve(p1), s2 = solve(p2);\n        if (s1 == s2) lo = p1, hi = p2;\n        else if (s1 > s2) lo = p1+1;\n        else hi = p2-1;\n    }\n    cout << solve(lo) << endl;\n}", "lang": "GNU C++14", "bug_code_uid": "4123cfbb0a67d0a964a259bb0c5aa3d7", "src_uid": "78d013b01497053b8e321fe7b6ce3760", "apr_id": "0eadf8989e1c13e527abdae6d64a4a9c", "difficulty": 2100, "tags": ["ternary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.807914262159934, "equal_cnt": 9, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 8, "bug_source_code": "#include <iostream>\n#include <algorithm>\n#include <cmath>\nusing namespace std;\nlong long n;\nlong long miin;\nlong long x,y,k,l;\nlong long t[100010];\n\nint main()\n{\n    ios_base::sync_with_stdio(0);\n    cin.tie(0);\n    cin>>n>>k>>l;\n    x=0;\n    y=0;\n    for (int i=0;i<n;i++)\n    {\n        char a;\n        cin>>a;\n        if (a=='0')\n            x++;\n        else\n            y++;\n    }\n    for (int i=1;i<y+1;i++)\n    {\n        long long j=(n-i)%i;\n        t[i]=i*k+l*(pow((n-i)/i,2)*(i-j)+pow((n-i)/i+1,2)*j);\n    }\n    miin=t[1];\n    for (int i=2;i<y+1;i++)\n        miin=min(miin,t[i]);\n    cout<<miin;\n    return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "c2a38ee5b4b3bfd0dec1128edc109320", "src_uid": "78d013b01497053b8e321fe7b6ce3760", "apr_id": "eaed18dbe090df245385e524a5fa80aa", "difficulty": 2100, "tags": ["ternary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.9311064718162839, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\nint main()\n{\n    long long x,y,x2,y2,R;\n    cin>>R>>x>>y>>x2>>y2;\n    double dis=(x-x2)*(x-x2)+(y-y2)*(y-y2);\n    dis=sqrt(dis);\n    int ans=ceil(dis/(2.0*R));\n    return ans;\n    \n    \n    \n}", "lang": "GNU C++14", "bug_code_uid": "438e3a28851a87b5fca5f936797628b4", "src_uid": "698da80c7d24252b57cca4e4f0ca7031", "apr_id": "ed8e9359c860b7d14c08b6a5e973ddaa", "difficulty": 1400, "tags": ["geometry", "math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9929522317932654, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "/* LOL \\(0-0\\) */\n#include <iostream>\n#include <string>\n#include <map>\n#include <queue>\n#include <stack>\n#include <algorithm>\n#include <list>\n#include <set>\n#include <cmath>\n#include <cstring>\n#include <stdio.h>\n#include <string.h>\n#include <sstream>\n#include <stdlib.h>\n#include <vector>\n#include <iomanip>\n#include <ctime>\n#include <deque>\n#include <bitset>\n#include <functional>\n#include <numeric>\n#include <utility>\n#include <cstdlib>\n#include <cassert>\n\n#define nl \"\\n\"\n#define F first\n#define S second\n#define mp make_pair\n#define pb push_back\n#define p_un(a) ((void)a)\n#define p_st(a) string(a)\n#define sz(a) (int)a.size()\n#define all(a) a.begin(), a.end()\n#define naj ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);\n#define NL cout << endl;\n#define sqr(x) (sqrt(x) * 1LL)\n#define pcnt(i) __builtin_popcount(i)\n#define lcm(a,b) (a * b) / __gcd(a, b)\n#define E 2.718281828459045\n#define PI 3.141592653589793\n#define up_b upper_bound\n#define low_b lower_bound\n#define FILE_NAME \"A\"\n#define show(x) cout << (#x) << \": \" << x << endl\n\nusing namespace std;\n\ntypedef long long llong;\ntypedef long double ldouble;\ntypedef unsigned long long ullong;\ntypedef vector <llong> vl;\ntypedef vector <bool> vb;\ntypedef vector <char> vc;\ntypedef vector <int> vi;\ntypedef vector <string> vs;\ntypedef pair <llong, llong> pll;\ntypedef map <llong, llong> mll;\ntypedef set <llong> sl;\ntypedef set <char> sc;\ntypedef map <string, llong> msl;\ntypedef map <string, bool> msb;\ntypedef map <char, llong> mcl;\ntypedef map <string, string> mss;\n\nconst llong MXN = 1e6 + 1;\nconst llong MOD = 1e9 + 7;\n\nconst llong INF = 1e18;\nconst ldouble EPS = 1e-9;\n\n//int dx[]= {1,0,-1,0}; int dy[]= {0,1,0,-1}; //4 Direction\n//int dx[]={1,1,0,-1,-1,-1,0,1}; int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction\n//int dx[]={2,1,-1,-2,-2,-1,1,2}; int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction\n//int dx[]={-1,-1,+0,+1,+1,+0}; int dy[]={-1,+1,+2,+1,-1,-2}; //Hexagonal Direction\n\nint a[MXN], b[MXN];\n\nmain() {\n\n    naj;\n#ifdef LOL\n    freopen(FILE_NAME\".in\", \"r\", stdin);\n    freopen(FILE_NAME\".out\", \"w\", stdout);\n#endif\n    int n, m, mn = MOD, mg = MOD, ans = MOD;\n    cin >> n >> m;\n    for(int i = 1; i <= n; i++) {\n        cin >> a[i];\n        mn = min(mn, a[i]);\n    }\n    for(int i = 1; i <= m; i++) {\n        cin >> b[i];\n        mg = min(mg, b[i]);\n        for(int j = 1; j <= n; j++) {\n            if(b[i] == a[j]) ans = min(ans, a[j]);\n        }\n    }\n    if(ans == MOD) cout << ans;\n    else if(mn == mg) cout << mn;\n    else cout << min(mn, mg) << max(mn, mg);\n    return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "86a99e6b041b44cd0e831266702aa163", "src_uid": "3a0c1b6d710fd8f0b6daf420255d76ee", "apr_id": "d945f049b696d07572131f724df5e212", "difficulty": 900, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9176225234619395, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#include <iostream>\n#include <cstdio>\n#include <algorithm>\nusing namespace std;\nint main()\n{\n\tint a,ta,b,tb;\n\tchar s[10];\n\tscanf(\"%d %d\",&a,&ta);\n\tscanf(\"%d %d\",&b,&tb);\n\tscanf(\"%s\",s);\n\tint Abegin = ((s[0]-'0')*10 + s[1]-'0')*60 + 10*(s[3]-'0')+s[4]-'0';\n\tint Aend = Abegin + ta;\n\tint start = 300,end = 23*60+59;\n\tint ans=0;\n\t\n\tfor(int i=0;;++i)\n\t{\n\t\tif((Abegin<start+i*b+tb) && (Aend>start+i*b) && (start+i*b<=end) )ans++;\t\n\t}\n\t\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}", "lang": "MS C++", "bug_code_uid": "c05ab8240cc833a8a19ad4ba912cbb15", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "apr_id": "9adb9b2fbcc9af224bdb080a642b0125", "difficulty": 1600, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.5917387127761767, "equal_cnt": 27, "replace_cnt": 15, "delete_cnt": 5, "insert_cnt": 7, "fix_ops_cnt": 27, "bug_source_code": "#include <vector>\n#include <list>\n#include <map>\n#include <set>\n#include <queue>\n#include <deque>\n#include <stack>\n#include <bitset>\n#include <algorithm>\n#include <functional>\n#include <numeric>\n#include <utility>\n#include <sstream>\n#include <iostream>\n#include <iomanip>\n#include <cstdio>\n#include <cmath>\n#include <cstdlib>\n#include <ctime>\n#include <fstream>\n#include <cstdio>\ntypedef long long ll;\ntypedef double d;\ntypedef unsigned long long ull;\nusing namespace std;\nll r1,c1,r2,c2,minn=10000000;\nll arr[9][9]= {1}, arrx[4]= {0,0,1,-1},arry[4]= {1,-1,0,0};\nvoid king (ll y,ll x,ll counter)\n{\n    if(x<0||y<0||x>=8||y>=8)\n        return ;\n    if(r2-1==y&&c2-1==x)\n        minn=min(counter,minn);\n    if(arr[y][x]==1)\n    {\n        for(int i=0; i<4; i++)\n        {\n            arr[y][x]=0;\n            king(y+arry[i],x+arrx[i],counter+1);\n            arr[y][x]=1;\n        }\n        arr[y][x]=0;\n    }\n    return ;\n}\nint main()\n{\n    cin.tie(0);\n    std::ios::sync_with_stdio(false);\n    cin >> r1>>c1>>r2>>c2;\n    if(r1==r2&&c1==c2)\n    {\n        cout << 0<< \" \";\n    }\n    else if (c1==c2||r2==r1)\n    {\n        cout << 1<<\" \" ;\n    }\n    else\n    {\n        cout << 2 << \" \";\n    }\n    if(r1==r2&&c1==c2)\n        cout <<0<<\" \" ;\n    else if(abs(r1-r2)==abs(c1-c2))\n        cout << 1<< \" \" ;\n    else if((r1%2&&c1%2&&r2%2==0&&c2%2==0)||(r1%2&&c1%2&&r2%2&&c2%2)||(r1%2==0&&c1%2==0&&r2%2==0&&c2%2==0)||(r1%2==0&&c1%2&&r2%2==0&& c2%2)||(r1%2&&c1%2==0&&r2%2&&c2%2==0)||(r1%2==0&&c1%2==0&&r2%2&&c2%2)||(r1%2&&c1%2==0&&r2%2&&c2%2==0)||(r2%2&&c2%2==0&&r1%2&&c1%2==0))\n        cout << 2 << \" \" ;\n    else\n    {\n        cout << 0 << \" \";\n    }\n\n    if(abs(r1-r2)==abs(c2-c1))\n    {\n        cout << abs(r1-r2)<< endl;\n    }\n    else if(r1==r2&&c1==c2)\n    {\n        cout << 0<< endl;\n    }\n    else if(c1==c2)\n    {\n        cout << abs(r1-r2)<< endl;\n    }\n    else if(r1==r2)\n    {\n        cout << abs(c1-c2)<< endl;\n    }\n    else\n    {\n        ll x=c1,y=r1,counter1=0,counter2=0;\n        while (abs(c2-x)!=abs(y-r2))\n        {\n            counter2++;\n            x++;\n        }\n        x=c1;\n        y=r1;\n         while (abs(c2-x)!=abs(y-r2))\n        {\n            counter1++;\n            x--;\n        }\n        cout << min(counter1+abs(r1-r2),counter2+abs(r1-r2))<< endl;\n    }\n    return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "56e16f7950cd02b6ddb251eb88671bb6", "src_uid": "7dbf58806db185f0fe70c00b60973f4b", "apr_id": "eb46f2902ef72269834f3d499be70576", "difficulty": 1100, "tags": ["graphs", "math", "shortest paths"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9997125610807703, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "//#pragma comment(linker, \"/STACK:1024000000,1024000000\")\n/* vim: set fdm=marker */\n//{{{\n#define __ return\nint ATTENTION() {\n\t/* pls IGNORE this function and go down and HACK me\n\t * read this AFTER contest\n\t * this function is empty and it will not be called !\n\t */\n\n\thttp://codeforces.com/group/Pmz2A2x7ES\n\t/* I created a group there.\n\t * I hope with the group, people can finish\n\t * past contests, which is important for \n\t * increasing rating.\n\t * I am still getting familiar with this function.\n\t */\n\t __ 0;\n}\n// deprecated because mac doesn't support this...\n/* #include <bits/stdc++.h> */\n#include <iostream>\n#include <string>\n#include <vector>\n#include <algorithm>\n#include <sstream>\n#include <iomanip>\n#include <queue>\n#include <deque>\n#include <bitset>\n#include <iterator>\n#include <list>\n#include <stack>\n#include <map>\n#include <set>\n#include <functional>\n#include <numeric>\n#include <utility>\n#include <limits>\n#include <ctime>\n#include <cmath>\n#include <cstdio>\n#include <cstring>\n#include <cstdlib>\n#include <cassert>\nusing namespace std;\ntypedef long long ll;\ntypedef unsigned long long ull;\nconst int iinf = 0x7fffffff;\nconst ll linf = ~(1LL<<63);\ntypedef pair<int, int> pii;\ntypedef vector<int> vi;\ntypedef vector<ll> vll;\ntypedef map<ll, int> mli;\ntypedef map<ll, ll> mll;\ntemplate<typename T>\ninline T gcd(T a, T b) {\n\tif(a < 0) return gcd(-a, b);\n\tif(b < 0) return gcd( a,-b);\n\tif(a < b) return gcd(b, a);\n\tif(b == 0) return a;\n\treturn gcd(b, a%b);\n}\n\nll qpow(ll a, ll n, ll mod) {\n\ta %= mod;\n\tll ans = 1LL;\n\twhile(n) {\n\t\tif(n & 1) ans = (ans*a % mod);\n\t\ta = (a*a % mod);\n\t\tn >>= 1;\n\t}\n\treturn ans;\n}\n\ninline ll rev(ll a, ll p) {\n\treturn qpow(a, p - 2, p);\n}\n\n#define all(v) v.begin(), v.end()\n#define sz(v) v.size()\n#define rep(x, st, en) for(int x = st; x < en; x++)\n#define rer(x, st, en) for(int x = st; x >= en; x--)\n#define pb push_back\n#define mp make_pair\n#define dbgm(msg, var) cerr<<#msg<<\" \"<<#var<<\" = \"<<var<<endl; \n#define dbg(var) cerr<<#var<<\" = \"<<var<<endl;\n#define X first\n#define Y second\n// build prefix sum\ntemplate<typename T>\ninline void BPS(T* DST, T* SRC, int N, int s = 0) {\n\tDST[s] = SRC[s];\n\trep(i, 1, N) DST[s + i] = DST[s + i - 1] + SRC[s + i];\n}\ninline int in() { int x; cin>>x; return x; }\n#ifdef ALNDBG\nnamespace alndbg {\n\tclock_t s, e;\n}\n#endif\n\ninline void tic() {\n#ifdef ALNDBG\n\talndbg::s = clock();\n#endif\n}\n\ninline void toc() {\n#ifdef ALNDBG\n\talndbg::e = clock();\n\tcerr<<1000.0 * (alndbg::e - alndbg::s) / CLOCKS_PER_SEC<<\" ms\"<<endl;\n#endif\n}\n\n\n\n//}}}\n\n// -------------------- Spliters ------------------------\n// BFS\u6c42\u6700\u77ed\u8def\u5c0f\u5fc3vis\u53ef\u80fd\u8bbf\u95ee\u8fc7\nconst ll mod   = 998244353ll;\nconst int maxn = 300005;\n\nvector<int> E[maxn];\n\nint n;\n\nll dp[maxn][3];\n\n// dp[i][0] = sum(max(dp[sub[i]][0/1]))\n// dp[i][1] \n\nvoid addedge(int u, int v) {\n  E[u].pb(v);\n  E[v].pb(u);\n}\n\nvoid dfs(int u, int fa=-1) {\n  dp[u][0] = 1LL;\n  dp[u][1] = 1LL;\n  dp[u][2] = 0;\n  for(auto v : E[u]) {\n    if(v == fa) continue;\n    dfs(v, u);\n    dp[u][1] = (dp[u][1] * ( (dp[v][0] + dp[v][2]) % mod ) % mod;\n    dp[u][0] = (dp[u][0] * dp[v][0]) % mod;\n  }\n  for(auto v : E[u]) {\n    if(v == fa) continue;\n    dp[u][2] = (dp[u][2] + dp[v][1] * dp[u][1] % mod * rev(dp[v][0] + dp[v][2], mod) % mod) % mod;\n  }\n  dp[u][0] = (dp[u][0] + dp[u][2]) % mod;\n}\n\nvoid solve() {\n  dfs(1);\n  ll ans = dp[1][0];\n  cout<<ans<<endl;\n}\n\nint main() {\n  cin>>n;\n  rep(i,0,n-1) {\n    int u, v;\n    cin>>u>>v;\n    addedge(u, v);\n  }\n  solve();\n\treturn 0;\n}\n// --USE C++11\n// *-USE O2\n\n", "lang": "GNU C++14", "bug_code_uid": "999746a70296d6732a17d5242003e9ba", "src_uid": "a40e78a7144ac2fae1890ac7598990bf", "apr_id": "11b0a18cf073e34155f76724e6b5f37e", "difficulty": 2400, "tags": ["trees", "dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9824902723735408, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <iostream>\n#include <queue>\n#include <cstring>\nusing namespace std;\nstruct Edge {\n\tint to,next;\n}bus[606060];\nint st[303030],z,fa[303030];\nlong long f[303030][3];\nconst int mod = 998244353;\ninline void AddE(int from,int to) {\n\tbus[++z].next = st[from];\n\tst[from] = z;\n\tbus[z].to = to;\n}\ninline void dfs(int now) {\n\tf[now][0] = 0;//\u6709\u4e0b\u5339\u914d \n\tf[now][1] = 0;//\u5339\u914d \n\tf[now][2] = 1;//\u6ca1\u6709\u4e0b\u9762\u7684\u7a7a \n\tfor (int i = st[now];i;i = bus[i].next) {\n\t\tint s = bus[i].to;\n\t\tif (s == fa[now])\n\t\t\tcontinue;\n\t\tfa[s] = now;\n\t\tdfs(s);\n\t\tf[now][1] = (f[now][1]*(f[s][2]+f[s][1]*2)%mod+(f[now][2]+f[now][0])*(f[s][0]+f[s][2]))%mod;\n\t\tf[now][0] = (f[now][0]*(f[s][2]+f[s][1]*2)%mod+f[now][2]*f[s][1])%mod;\n\t\tf[now][2] = f[now][2]*(f[s][2]+f[s][1])%mod; \n\t}\n//\tcout << now << \" \" << f[now][0] << \" \" << f[now][1] << \" \" << f[now][2] << endl;\n}\nint main() {\n\tios::sync_with_stdio(false);\n\tint n,aa,bb;\n\tcin >> n;\n\tfor (int i = 1;i < n; i++) {\n\t\tcin >> aa >> bb;\n\t\tAddE(aa,bb);\n\t\tAddE(bb,aa);\n\t}\n\tdfs(1);\n\tcout << f[1][2]+f[1][1] << endl;\n\treturn 0;\n} ", "lang": "GNU C++11", "bug_code_uid": "84c7228221c611f0a7f8aa8c49eccbb5", "src_uid": "a40e78a7144ac2fae1890ac7598990bf", "apr_id": "c0080ab8b3cc170763555fe05421db60", "difficulty": 2400, "tags": ["trees", "dp"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9985635132361995, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "//Thank you for supporting FastLine, (WorldWeb or james1990), (KNaga_KZ or KNaga)\n\n#include <bits/stdc++.h>\n#define off  exit( 0 )\n#define cn   continue\n#define rt   return\n#define sc   scanf\n#define pr   printf\n#define pb   push_back\n#define pf   push_front\n#define p_f  pop_front\n#define p_b  pop_back\n#define ff   first\n#define ss   second\n#define vec  vector\n#define gcd  __gcd\n#define pi   acos( -1 )\n#define ll   long long\n#define ld   long double\n#define pdd  pair < ld, ld >\n#define pll  pair < ll, ll >\n#define pii  pair < int, int >\n#define rep( a, b, c, d )  for( int a = b; a <= c; a += d )\n#define rvv( a, b, c, d )  for( int a = b; a >= c; a -= d )\n#define en                 printf( \"\\n\" )\n#define sqr( a )           a * a\n#define all( c )           c.begin(), c.end()\n#define srt( c )           sort( all( c ) )\n#define rev( c )           reverse( all( c ) )\n#define srtr( c )          sort( c.rbegin(), c.rend() )\n#define numcounts          __builtin_popcount\n#define mxn( x, y, z )     max( x, min( y, z ) )\n#define mnx( x, y, z )     min( x, max( y, z ) )\n#define rep( i, x, y ) for( int i = (x); i <= (y); i ++ )\n#define dep( i, x, y ) for( int i = (x); i >= (y); i -- )\n#define TIME() if(QQQQ)printf(\"My Time: %.3lfms\\n\", (double)clock() / CLOCKS_PER_SEC);\nbool QQQQ;\n#define see(x)  if(QQQQ)cout << x << \" \";\n#define sees(x) if(QQQQ)cout << x << endl;\n#define N       105\n#define NN      10005\n#define M       998244353\n#define I       1000000000000000000\nconst int dx[ ] = { 1, -1, 0, 0 };\nconst int dy[ ] = { 0, 0, -1, 1 };\nusing namespace std;\n\nll ttt = 1;\nll n, ans, a[N], b[N], c[N];\nvector < ll > g[N];\n\nvoid dfs( ll v )\n{\n    a[v] = c[v] = 1;\n    for( ll to: g[v] )\n    {\n        if( !a[to] )\n        {\n            dfs( to );\n            b[v] = ( ((a[v] * a[to]) % M) + ((b[v] * (b[to] + c[to])) % M) ) % M;\n            c[v] = (c[v] * c[to]) % M;\n            a[v] = (a[v] * (b[to] + c[to])) % M;\n        }\n    }\n    c[v] = (c[v] + b[v]) % M;\n}\n\nvoid solve()\n{\n    sc( \"%I64d\", &n );\n    for( int i = 1; i < n; i ++ )\n    {\n        int x, y;\n        sc( \"%d%d\", &x, &y );\n        g[x].pb(y);\n        g[y].pb(x);\n    }\n    dfs(1);\n    ans = 1;\n    for( ll i: g[1] )ans = (ans * c[i]) % M;\n    ans = (ans + b[1]) % M;\n    pr( \"%I64d\", ans );\n}\nint main()\n{\n    QQQQ = 0;\n    //sc( \"%I64d\", &ttt );\n    for( int i = 1; i <= ttt; i ++ )\n        solve();\n    TIME();\n}\n\n\n/*\n1\n5 5\n1 2 3 4 5\n3 4 5 1 2\n*/\n\n\n\n\n\n\n\n\n\n", "lang": "GNU C++11", "bug_code_uid": "6a152221b0f0145a7a5845b8aecbc547", "src_uid": "a40e78a7144ac2fae1890ac7598990bf", "apr_id": "db7ed15c1678dcb239085df9fea50113", "difficulty": 2400, "tags": ["trees", "dp"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9879626843213963, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 5, "bug_source_code": "#include <string>\n#include <algorithm>\n#include <cfloat>\n#include <climits>\n#include <cmath>\n#include <complex>\n#include <cstdio>\n#include <cstdlib>\n#include <cstring>\n#include <functional>\n#include <iostream>\n#include <map>\n#include <memory>\n#include <queue>\n#include <set>\n#include <sstream>\n#include <stack>\n#include <utility>\n#include <vector>\n#include <fstream>\n#include <cassert>\n\nusing namespace std;\n\n\n                                                                                                                                                              #define int ll\nconst bool online_judge =\n#ifdef ONLINE_JUDGE\n  true\n#else\n  false\n#endif\n  ;\n\ntypedef long long ll;\ntypedef unsigned long long ull;\n\ntypedef vector<int> vi;\ntypedef vector<vi> vvi;\ntypedef vector<string> vs;\n\ntypedef tuple<int,int> int2;\ntypedef tuple<int,int,int> int3;\ntypedef tuple<int,int,int,int> int4;\n\n#define all(v)  (v).begin(), (v).end()\n#define rall(v) (v).rbegin(), (v).rend()\n#define pb push_back\n#define eb emplace_back\n#define SZ(a) ((int)((a).size()))\n#define rep(i,n) for(int i = 0; i < n; i++)\n#define rep2(i,n) for(int i = 1; i <= n; i++)\n#define rep3(i,n) for(int i = n-1; i >= 0; i--)\n#define tag(i,v) rep(i,SZ(v))\n#define _trace(x) #x << \" = \" << (x)\n#define trace(x)  { if(!online_judge) cerr << _trace(x) << endl; }\n#define trace2(x,y) { if(!online_judge) cerr << _trace(x) << \" \" << _trace(y) << endl; }\n#define trace3(x,y,z) { if(!online_judge) cerr << _trace(x) << \" \" << _trace(y) << \" \" << _trace(z) << endl; }\n#define tracev(x) { if(!online_judge) { cerr << #x << \" = \"; tag(__i, x) { cerr << x[__i] << \",\"; } cerr << endl; } }\n#define fst get<0>\n#define snd get<1>\n#define thd get<2>\n#define divup(x,y) ((x)/(y)+(0<((x)%(y))))\n#define mp make_tuple\n#define range(x,a,b) ((x) >= (a) && (x) <= (b))\n\nconst int inf = 1LL << 60;\nint toInt(string s) {int res; stringstream ss; ss<<s; ss>>res; return res; }\nstring toString(int n) { stringstream ss; ss<<n; return ss.str(); }\n\nint fact(int n){\n  if(n <= 1)\n    return n;\n  return n*fact(n-1);\n}\n\nvi lucky;\n\nvoid dfs(int n, int k){\n  lucky.pb(n);\n  if(k < 11){\n    dfs(n*10+4,k+1);\n    dfs(n*10+7,k+1);\n  }\n}\n\nbool is_lucky(int n){\n  return binary_search(all(lucky), n);\n}\n\nvoid run() {\n\n  /* entry point */\n  int n,k;\n  cin >> n >> k;\n\n  k--;\n  \n  if(n <= 15 && fact(n) <= k) {\n    cout << -1 << endl;\n    return;\n  }\n\n  vi v;\n  rep(j,n)\n    v.pb(j+1);\n\n  while(k > 100000){\n    int i = 0;\n    while(fact(i+1) < k) i++;\n    \n    k -= fact(i);\n    \n    if(i){\n      vi tmp;\n      rep(j,i){\n\ttmp.pb(v[SZ(v)-1]);\n\tv.pop_back();\n      }\n      \n      int tmp2 = v[SZ(v)-1];\n      v.pop_back();\n      sort(all(tmp));\n      auto it = upper_bound(all(tmp), tmp2);\n      v.pb(*it);\n      tmp.erase(it);\n      tmp.insert(lower_bound(all(tmp), tmp2), tmp2);\n      \n      tag(j,tmp)\n\tv.pb(tmp[j]);\n    }\n  }\n  \n  while(k--) next_permutation(all(v));\n\n  tracev(v);\n\n  dfs(4,0);\n  dfs(7,0);\n  sort(all(lucky));\n\n  int ans = 0;\n  tag(i,lucky){\n    if(lucky[i] > n)\n      break;\n    if(is_lucky(v[lucky[i]-1]))\n      ans++;\n  }\n\n  cout << ans << endl;\n\n}\n\n#undef int\n\nint main(int argc, char *argv[]) {\n\n  #if 0\n  if(online_judge){\n    freopen(\"input.txt\", \"rt\", stdin);\n    freopen(\"output.txt\", \"wt\", stdout);\n  }\n  #endif\n\n  run();\n\n  return 0;\n\n}\n", "lang": "GNU C++0x", "bug_code_uid": "869c1cb971341c6a9b7a0e949af4522d", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "apr_id": "95b445ca00a4b3da21c471989674029e", "difficulty": 1900, "tags": ["brute force", "combinatorics", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.7813504823151125, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint main(){\nint n,m,a,b;\nfloat f=b/m;\ncin>>n>>m>>a>>b;\nif(f>a){\n    cout<<n*a;\n    return 0;\n} else if(m>n && b<(n*a)){\n    cout<<b;\n    return 0;\n}\nint left = (((n%m)*a) > ((n%m)*b)) ? ((n%m)*b): ((n%m)*a);\ncout<<(((n/m)*b)+left);\nreturn 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "879635711dbc78a158f11feb33d94891", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "apr_id": "1158ae8b4e74d4da89f73e12c076120d", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.8959183673469387, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n#define FOR(i, a, b) for (auto i = (a); i < (b); i++)\n\nint main()\n{\n    int a[3],temp=0;\n    FOR(i, 0, 3)\n    {\n        cin>>a[i];\n    }\n    if(a[0]==a[1] && a[1]==a[2])\n    {\n        cout<<\"0\";\n        exit (1);\n    }\n    int k = *std::max_element(a,a+3);\n    FOR(i, 0, 3)\n    {\n        if(k!=a[i])\n            temp+=a[i];\n    }\n    if(temp>k)\n        cout<<\"0\";\n    else\n    \tcout<<(k-temp)+1;\n    \n     \n}", "lang": "GNU C++17", "bug_code_uid": "4f0e313e31259b2318db3a8800638c83", "src_uid": "3dc56bc08606a39dd9ca40a43c452f09", "apr_id": "857a17284c04ea2d5835709b4a4b87ef", "difficulty": 800, "tags": ["geometry", "math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6095100864553314, "equal_cnt": 10, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "#include <iostream>\n#include<stdio.h>\n\n\nusing namespace std;\n\nint main()\n{int a,b,c;\nint s=0;\nint s1=0;\nint s2=0;\nbool ok=true;\nbool ok1=true;\nbool ok2=true;\nscanf(\"%d\",\"%d\",\"%d\",&a,&b,&c);\n while(ok==true)\n {  if ((a+b)==c){\n        s=s+1;\n        ok==true;\n    }\n    if((a+b)<c)\n   {s=s+1;\n    ok=true;\n   }\n  else{\n    ok=false;\n   }\n }\n while(ok1==true)\n {if((a+c)==b){\n     s1=s1+1;\n     ok1=true;}\n     if((a+c)<b)\n   {s1=s1+1;\n    ok1=true;\n   }\n  else{\n    ok1=false;\n   }\n }\n while(ok2==true){\n    if ((c+b)==a){\n        s2=s2+1;\n        ok2==true;\n    }\n    if((c+b)<a)\n   {s2=s2+1;\n    ok2=true;\n   }\n  else{\n    ok2=false;\n   }\n }\nprintf(\"%d\",s+s1+s2);\n\n    return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "79f2ed4c65fd81d96f0d0757d05f05ba", "src_uid": "3dc56bc08606a39dd9ca40a43c452f09", "apr_id": "6d1b308956923bf94a345b59b4ac8570", "difficulty": 800, "tags": ["geometry", "math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9348051052086926, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "#include <ext/pb_ds/tree_policy.hpp>\n#include <ext/pb_ds/assoc_container.hpp>\n#include <bits/stdc++.h>\n\nusing namespace std;\nusing namespace __gnu_pbds;\ntemplate <class T> using Tree = tree<T, null_type, less<T>,\n    rb_tree_tag, tree_order_statistics_node_update>;\n \nusing ll = long long;\nusing ull = unsigned long long;\nusing ld = long double;\nusing db = double; \nusing str = string; // yay python!\n\nusing pi = pair<int,int>;\nusing pl = pair<ll,ll>;\nusing pd = pair<db,db>;\n\nusing vi = vector<int>;\nusing vb = vector<bool>;\nusing vl = vector<ll>;\nusing vd = vector<db>; \nusing vs = vector<str>;\nusing vpi = vector<pi>;\nusing vpl = vector<pl>; \nusing vpd = vector<pd>;\n\n#define tcT template<class T\n// ^ lol this makes everything look weird but I'll try it\ntcT> using V = vector<T>; \ntcT, size_t SZ> using AR = array<T,SZ>; \n\n// pairs\n#define mp make_pair\n#define f first\n#define s second\n\n// vectors\n#define sz(x) (int)(x).size()\n#define all(x) begin(x), end(x)\n#define rall(x) (x).rbegin(), (x).rend() \n#define sor(x) sort(all(x)) \n#define rsz resize\n#define ins insert \n#define ft front() \n#define bk back()\n#define pf push_front \n#define pb push_back\n#define eb emplace_back \n#define lb lower_bound \n#define ub upper_bound \n\n// loops\n#define FOR(i,a,b) for (int i = (a); i < (b); ++i)\n#define F0R(i,a) FOR(i,0,a)\n#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)\n#define R0F(i,a) ROF(i,0,a)\n#define trav(a,x) for (auto& a: x)\n\nconst int MOD = 998244353;\nconst int MX = 2e5+5;\nconst ll INF = 1e18; // not too close to LLONG_MAX\nconst int IINF = 1e9;\nconst ld PI = acos((ld)-1);\nconst int xd[4] = {1,0,-1,0}, yd[4] = {0,1,0,-1}; // for every grid problem!!\nmt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count()); \n\n// helper funcs\nconstexpr int pct(int x) { return __builtin_popcount(x); } // # of bits set\nconstexpr int bits(int x) { return 31-__builtin_clz(x); } // floor(log2(x)) \nll cdiv(ll a, ll b) { return a/b+((a^b)>0&&a%b); } // divide a by b rounded up\nll fdiv(ll a, ll b) { return a/b-((a^b)<0&&a%b); } // divide a by b rounded down\n\ntcT> bool ckmin(T& a, const T& b) {\n    return b < a ? a = b, 1 : 0; } // set a = min(a,b)\ntcT> bool ckmax(T& a, const T& b) {\n    return a < b ? a = b, 1 : 0; }\n\n#define tcTU tcT, class U\ntcTU> T fstTrue(T lo, T hi, U f) {\n    hi ++; assert(lo <= hi); // assuming f is increasing\n    while (lo < hi) { // find first index such that f is true \n        T mid = lo+(hi-lo)/2;\n        f(mid) ? hi = mid : lo = mid+1; \n    } \n    return lo;\n}\ntcTU> T lstTrue(T lo, T hi, U f) {\n    lo --; assert(lo <= hi); // assuming f is decreasing\n    while (lo < hi) { // find first index such that f is true \n        T mid = lo+(hi-lo+1)/2;\n        f(mid) ? lo = mid : hi = mid-1;\n    } \n    return lo;\n}\ntcT> void remDup(vector<T>& v) { // sort and remove duplicates\n    sort(all(v)); v.erase(unique(all(v)),end(v)); }\ntcTU> void erase(T& t, const U& u) { // don't erase\n    auto it = t.find(u); assert(it != end(t));\n    t.erase(u); } // element that doesn't exist from (multi)set\n\n// INPUT\n#define tcTUU tcT, class ...U\ntcT> void re(complex<T>& c);\ntcTU> void re(pair<T,U>& p);\ntcT> void re(vector<T>& v);\ntcT, size_t SZ> void re(AR<T,SZ>& a);\n\ntcT> void re(T& x) { cin >> x; }\nvoid re(db& d) { str t; re(t); d = stod(t); }\nvoid re(ld& d) { str t; re(t); d = stold(t); }\ntcTUU> void re(T& t, U&... u) { re(t); re(u...); }\n\ntcT> void re(complex<T>& c) { T a,b; re(a,b); c = {a,b}; }\ntcTU> void re(pair<T,U>& p) { re(p.f,p.s); }\ntcT> void re(vector<T>& x) { trav(a,x) re(a); }\ntcT, size_t SZ> void re(AR<T,SZ>& x) { trav(a,x) re(a); }\n\n// TO_STRING\n#define ts to_string\nstr ts(char c) { return str(1,c); }\nstr ts(const char* s) { return (str)s; }\nstr ts(str s) { return s; }\nstr ts(bool b) { \n    #ifdef LOCAL\n        return b ? \"true\" : \"false\"; \n    #else \n        return ts((int)b);\n    #endif\n}\ntcT> str ts(complex<T> c) { \n    stringstream ss; ss << c; return ss.str(); }\nstr ts(vector<bool> v) {\n    str res = \"{\"; F0R(i,sz(v)) res += char('0'+v[i]);\n    res += \"}\"; return res; }\ntemplate<size_t SZ> str ts(bitset<SZ> b) {\n    str res = \"\"; F0R(i,SZ) res += char('0'+b[i]);\n    return res; }\ntcTU> str ts(pair<T,U> p);\ntcT> str ts(T v) { // containers with begin(), end()\n    #ifdef LOCAL\n        bool fst = 1; str res = \"{\";\n        for (const auto& x: v) {\n            if (!fst) res += \", \";\n            fst = 0; res += ts(x);\n        }\n        res += \"}\"; return res;\n    #else\n        bool fst = 1; str res = \"\";\n        for (const auto& x: v) {\n            if (!fst) res += \" \";\n            fst = 0; res += ts(x);\n        }\n        return res;\n\n    #endif\n}\ntcTU> str ts(pair<T,U> p) {\n    #ifdef LOCAL\n        return \"(\"+ts(p.f)+\", \"+ts(p.s)+\")\"; \n    #else\n        return ts(p.f)+\" \"+ts(p.s);\n    #endif\n}\n\n// OUTPUT\ntcT> void pr(T x) { cout << ts(x); }\ntcTUU> void pr(const T& t, const U&... u) { \n    pr(t); pr(u...); }\nvoid ps() { pr(\"\\n\"); } // print w/ spaces\ntcTUU> void ps(const T& t, const U&... u) { \n    pr(t); if (sizeof...(u)) pr(\" \"); ps(u...); }\n\n// DEBUG\nvoid DBG() { cerr << \"]\" << endl; }\ntcTUU> void DBG(const T& t, const U&... u) {\n    cerr << ts(t); if (sizeof...(u)) cerr << \", \";\n    DBG(u...); }\n#ifdef LOCAL // compile with -DLOCAL, chk -> fake assert\n    #define dbg(...) cerr << \"Line(\" << __LINE__ << \") -> [\" << #__VA_ARGS__ << \"]: [\", DBG(__VA_ARGS__)\n    #define chk(...) if (!(__VA_ARGS__)) cerr << \"Line(\" << __LINE__ << \") -> function(\" \\\n         << __FUNCTION__  << \") -> CHK FAILED: (\" << #__VA_ARGS__ << \")\" << \"\\n\", exit(0);\n#else\n    #define dbg(...) 0\n    #define chk(...) 0\n#endif\n\n// FILE I/O\nvoid setIn(str s) { freopen(s.c_str(),\"r\",stdin); }\nvoid setOut(str s) { freopen(s.c_str(),\"w\",stdout); }\nvoid unsyncIO() { cin.tie(0)->sync_with_stdio(0); }\nvoid setIO(str s = \"\") {\n    unsyncIO();\n    // cin.exceptions(cin.failbit); \n    // throws exception when do smth illegal\n    // ex. try to read letter into int\n    if (sz(s)) { setIn(s+\".in\"), setOut(s+\".out\"); } // for USACO\n}\n\nstruct custom_hash {\n    static uint64_t splitmix64(uint64_t x) {\n        // http://xorshift.di.unimi.it/splitmix64.c\n        x += 0x9e3779b97f4a7c15;\n        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;\n        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;\n        return x ^ (x >> 31);\n    }\n\n    size_t operator()(uint64_t x) const {\n        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();\n        return splitmix64(x + FIXED_RANDOM);\n    }\n};\n\nint main(){\n    setIO();\n    // you should actually read the stuff at the bottom\n}\n \n/* stuff you should look for\n    * int overflow, array bounds\n    * special cases (n=1?)\n    * do smth instead of nothing and stay organized\n    * WRITE STUFF DOWN\n    * DON'T GET STUCK ON ONE APPROACH\n*/\n", "lang": "GNU C++17", "bug_code_uid": "74f07344acbe441abae0c610dcf70e02", "src_uid": "c9e79e83928d5d034123ebc3b2f5e064", "apr_id": "7052406e9df2f5be2020f5d9be41d118", "difficulty": 2600, "tags": ["dp", "math", "combinatorics", "probabilities"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.99880810488677, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n\ndeque<int> s;\ndeque<int>::iterator it;\n\nint main() {\n    int n;\n    cin>>n;\n    for(int i=0; i<n; i++){\n        int k=1;\n        while(!s.empty()&&k==*(--s.end())){\n            s.pop_back();\n            k++;\n        }\n        //cout<<k<<endl;\n        s.push_back(k);\n    }\n    while(!s.empty()){\n        cout<<*s.front()<<\" \";\n        s.pop_front();\n    }\n\n    return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "5bf300d3898f6303f78c48b3dc1b910c", "src_uid": "757cd804aba01dc4bc108cb0722f68dc", "apr_id": "cae623771cf875e1e17a7672b48da088", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.9257518796992481, "equal_cnt": 10, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 9, "bug_source_code": "#include <iostream>\n#include <string>\n#include <vector>\n#include <set>\n#include <map>\n#include <stack>\n#include <queue>\n#include <algorithm>\n#include <utility>\n\ntypedef long long lli;\n\n#define forn(i, n) for (int i = 0; i < n; i++)\n#define ford(i, n) for (int i = (n - 1); i >= 0; i--)\n#define fore(i, a, b) for (int i = a; i < b; i++)\n#define foreach(it, a) for (auto it = a.begin(); it != a.end(); it++)\n#define rforeach(it, a) for (auto it = a.rbegin(); it != a.rend(); it++)\n#define all(a) a.begin(), a.end()\n#define scani(a) scanf(\"%I64d\", &(a))\n#define scanii(a, b) scanf(\"%I64d%I64d\", &(a), &(b))\n#define scaniii(a, b, c) scanf(\"%I64d%I64d%I64d\", &(a), &(b), &(c))\n#define sqr(x) (x) * (x)\n\nusing namespace std;\n\nint main()\n{\n\tlli r, x, y, x1, y1;\n\n\tscaniii(r, x, y);\n\tscanii(x1, y1);\n\n\tlli l2 = ((x1 - x) * (x1 - x) + (y1 - y) * (y1 - y)) / (4 * r * r);\n\tlli lb = 0, rb = l2;\n\n\twhile (lb != rb)\n\t{\n\t\tlli mb = (lb + rb) / 2;\n\n\t\tif (l2 / mb >= mb) rb = mb;\n\t\telse lb = mb + 1;\n\t}\n\n\tprintf(\"%I64d\", lb);\n\n\treturn 0;\n}", "lang": "MS C++", "bug_code_uid": "256ad3f4f4f21e3818ae35aebb51cd1e", "src_uid": "698da80c7d24252b57cca4e4f0ca7031", "apr_id": "58d72327362186bc724cc22533548ebf", "difficulty": 1400, "tags": ["geometry", "math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.33855670103092783, "equal_cnt": 40, "replace_cnt": 26, "delete_cnt": 6, "insert_cnt": 8, "fix_ops_cnt": 40, "bug_source_code": "#include <bits/stdc++.h>\n\n\n\n#define inf 0x3f3f3f3f\n\n#define INF 0x3f3f3f3f3f3f3f3fLL\n\n#define mod 1000000007\n\n#define pb push_back\n\n#define eps 1e-8\n\n#define bpt(x) (__builtin_popcount(x))\n\n#define bptl(x) (__builtin_popcountll(x))\n\n#define bit(x, y) (((x)>>(y))&1)\n\n#define x first\n\n#define y second\n\nusing namespace std;\n\ntypedef long long INT;\n\ntypedef double DO;\n\ntypedef vector<int> VI;\n\ntypedef pair<int, int> pii;\n\ntypedef pair<pii, int> pi3;\n\ntypedef vector<int> VI;\n\n\n\ntemplate<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}\n\ntemplate<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}\n\nint power(int a, int b, int m, int ans=1) {\n\n\tfor (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m;\n\n\treturn ans;\n\n}\n\n\n\n#define NN 21\n\nint a[NN],b[NN];\n\n\n\nint dp(int r,int n){\n\n\tif(n==0) return 1;\n\n\tint ct=0;\n\n\tfor(int i=0;i<=r;i++){\n\n\t\tif(a[i]==0||i>r) continue;\n\n\t\ta[i]--;\n\n\t\tct=(ct+(INT)(a[i]+1)*dp(r-i,n-1)%mod)%mod;\n\n\t\ta[i]++;\n\n\t}\n\n\treturn ct;\n\n}\n\n\n\nint main() {\n\n#ifndef ONLINE_JUDGE\n\n\tfreopen(\"in.in\", \"r\", stdin);\n\n\tfreopen(\"out.out\", \"w\", stdout);\n\n#endif\n\n\t\n\n\tint m;\n\n\tscanf(\"%d\",&m);\n\n\tfor(int i=1;i<=m;i++){\n\n\t\tint u=i;\n\n\t\tint num=0;\n\n\t\twhile(u){\n\n\t\t\tif(u%10==7) num++;\n\n\t\t\tif(u%10==4) num++;\n\n\t\t\tu/=10;\n\n\t\t}\n\n\t\ta[num]++;\n\n\t}\n\n\tfor(int i=0;i<=9;i++) b[i]=a[i];\n\n\tint ans=0;\n\n\tfor(int i=1;i<=9;i++){\n\n\t\tif(b[i]==0) continue;\n\n\t\tfor(int j=0;j<=9;j++) a[j]=b[j];\n\n\t\ta[i]--;\n\n\t\tans=(ans+(INT)dp(i-1,6)*b[i]%mod)%mod;\n\n\t}\n\n\tprintf(\"%d\\n\",ans);\n\n\treturn 0;\n\n}\n   ", "lang": "GNU C++", "bug_code_uid": "60cdabf0811b31896e113a96a4817b26", "src_uid": "656ed7b1b80de84d65a253e5d14d62a9", "apr_id": "cc53dbb8516fa3a81b45b8f2f7cc81e3", "difficulty": 1900, "tags": ["brute force", "dp", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9856143079315708, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include<stdio.h>\n#include<string.h>\nint dp[15][15][15];\nint i,j,k,l;\nlong long ans[15];\nint main(void){\n    memset(dp,0,sizeof(dp));\n    memset(ans,0,sizeof(ans));  \n    for(i=0;i<=10;i++)\n        for(j=0;j<=9;j++)\n            for(k=0;k<=10;k++)\n                if(i==0&&(j==4||j==7)&&k==1)\n                    dp[i][j][k]=1;\n                else if(i==0&&j!=4&&j!=7&&k==0)\n                    dp[i][j][k]=1;                  \n                else if(i!=0){\n                    if(j==4||j==7)\n                        if(k!=0)\n                            for(l=0;l<=9;l++)\n                                dp[i][j][k]+=dp[i-1][l][k-1];\n                    if(j!=4&&j!=7)\n                        for(l=0;l<=9;l++)\n                            dp[i][j][k]+=dp[i-1][l][k];                     \n                }\n                int p;\n    scanf(\"%d\",&p);\n    p++;\n    int s1;\n    s1=p;\n    int len=0;\n    while(s1!=0){\n        s1/=10;\n        len++;\n    }\n    int g=0;\n    while(p!=0)\n        g=g*10+p%10,p/=10;\n        int sb,count1=0;\n    while(g!=0){\n        sb=g%10;\n        for(i=0;i<sb;i++)\n            for(j=0;j<=10;j++)\n                ans[j+count1]+=(dp[len-1][i][j]);\n        len--;\n        if(sb==4||sb==7)\n            count1++;\n        g/=10;\n    }\n    \n    ans[0]--;\n    long long ansss=0;\n    int gg[10];\n    int hash[15];\n    for(i=1;i<=10;i++){\n        if(ans[i]==0)\n            break;\n        while(1){\n            memset(gg,0,sizeof(gg));\n            memset(hash,0,sizeof(hash));\n            for(j=1;j<=6;j++)\n                hash[gg[j]]++;\n            for(j=0;j<11;j++)\n                if(hash[j]>ans[j])\n                    break;\n            if(j==11){\n                long long yoo=1;\n                for(j=0;j<11;j++)       \n                    for(k=0;k<hash[j];k++)\n                        yoo*=(ans[j]-k),yoo%=1000000007;\n                ansss+=(ans[i]*yoo);\n                ansss%=1000000007;\n            }\n            \n            \n                gg[1]++;\n            if(gg[1]+gg[2]+gg[3]+gg[4]+gg[5]+gg[6]==i)\n                gg[1]=0,gg[2]++;\n            if(gg[1]+gg[2]+gg[3]+gg[4]+gg[5]+gg[6]==i)\n                gg[2]=0,gg[3]++;\n            if(gg[1]+gg[2]+gg[3]+gg[4]+gg[5]+gg[6]==i)\n                gg[3]=0,gg[4]++;\n            if(gg[1]+gg[2]+gg[3]+gg[4]+gg[5]+gg[6]==i)\n                gg[4]=0,gg[5]++;\n            if(gg[1]+gg[2]+gg[3]+gg[4]+gg[5]+gg[6]==i)\n                gg[5]=0,gg[6]++;\n            if(gg[1]+gg[2]+gg[3]+gg[4]+gg[5]+gg[6]==i)\n                break;\n            \n        }\n    } \n    printf(\"%I64d\\n\",ansss);\n    return 0;\n}", "lang": "GNU C++", "bug_code_uid": "2500e55a48a218294e860388f1f8f505", "src_uid": "656ed7b1b80de84d65a253e5d14d62a9", "apr_id": "b2c2d678a8ff5ba80813f5be6b5df7cd", "difficulty": 1900, "tags": ["brute force", "dp", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.8747252747252747, "equal_cnt": 10, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 9, "bug_source_code": "#include <cstdio>\ntypedef unsigned long long ull;\null l, r, x, y, cnt;\null gcd(ull x, ull y) { return y ? gcd(y, x % y) : x; }\n\nint main() {\n    scanf(\"%llu %llu %llu %llu\", &l, &r, &x, &y);\n    ull tmp = y / x;\n    for(int i = 1; i * i <= tmp; i++) {\n        if(tmp % i == 0) {\n            if(gcd(i, tmp / i) == 1) {\n                ull b = x * i;\n                ull a = x * (tmp / i);\n                if(b < l || b > r || a < l || a > r) continue;\n                if(b == a) {\n                    cnt++;\n                }\n                else {\n                    cnt += 2;\n                }  \n            }\n        }\n    }\n    printf(\"%llu\\n\", cnt);\n    return 0;\n}", "lang": "GNU C++14", "bug_code_uid": "efb3aff0f72f6dc985ce555599109af1", "src_uid": "d37dde5841116352c9b37538631d0b15", "apr_id": "7dd3c7933108f033fd570ca152ed8fef", "difficulty": 1600, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8949720670391061, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "#include<bits/stdc++.h>\n#define ll long long\nusing namespace std;\n\n\nint main(){\n    ll l,r,gcd,lcm;\n    cin>>l>>r>>gcd>>lcm;\n    ll i,k,sq=pow(lcm,0.5);\n    if(gcd==lcm){\n        if(gcd>=l&&lcm<=r){\n            cout<<\"1\";\n            return 0;\n        }\n        else{\n            cout<<\"0\";\n            return 0;\n        }\n    \n    }\n    if (lcm%gcd!=0){\n        cout<<0;\n        return 0;\n    }\n    sq=pow(lcm/gcd,0.5);\n    set<pair<ll,ll>> s;\n    for(i=l;i<=sq&&i<=r;i++){\n        if((lcm/gcd)%i==0){\n            if((lcm/gcd)/i<=r&&(lcm/gcd)/i>=l){\n                s.insert(make_pair(i,(lcm/gcd)/i));\n            }\n        }\n    }\n    ll ans=0;\n    for(auto x:s){\n        if(__gcd(x.first,x.second)==1){\n            ans++;\n            if(x.first!=x.second)ans++;\n        }\n    }\n    cout<<ans;\n    return 0;\n}", "lang": "GNU C++14", "bug_code_uid": "8b2b89aa7e3b4b34f14676bbabdfd968", "src_uid": "d37dde5841116352c9b37538631d0b15", "apr_id": "d8bcbee4f44a71e4adea328d20599f8b", "difficulty": 1600, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6648291069459757, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "#include <iostream>\n#include <bits/stdc++.h>\nusing namespace std;\n\nint  max_trois(int a,int b,int c)\n{\n    if ((a>b)&&(a>c)) return a;\n    if ((b>a)&&(b>c)) return b;\n    return c;\n}\nint min_deux(int a,int b)\n{\n    if (a>b) return b;\n    return a;\n}\n\n\nint main()\n{\n    int a,b,c;\n    cin >> a >> b >> c;\n    if (2*max_trois(a,b,c)>a+b+c)\n    {\n        cout << \"Impossible\";\n        return 0;\n    }\n    if ((a)&&(a%2==0)&&(a==b&&(b==c)))\n    {\n        cout << a/2 <<\" \"<< a/2 <<\" \"<< a/2;\n                return 0;\n    }\n    int ab,bc,ca;\n    for (ab=0;ab<=min_deux(a,b);ab++)\n    {\n        for (int bc=0;bc<=min_deux(b,c);bc++)\n        {\n            if ((ab+bc)>b)\n            {\n                break;\n            }\n            ca=a-ab;\n            if(((ab+bc)==b)&&(ca==(c-bc)))\n            {\n                cout << ab <<\" \"<< bc <<\" \"<< ca;\n                return 0;\n            }\n\n\n        }\n    }\n    cout << \"Impossible\";\n    return 0;\n\n\n\n}\n", "lang": "GNU C++14", "bug_code_uid": "eb8e878e6b443fa6e508a04ca97d3c81", "src_uid": "b3b986fddc3770fed64b878fa42ab1bc", "apr_id": "df43c5f051ac1edef1b0e00afba0e81d", "difficulty": 1200, "tags": ["graphs", "math", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.12319296040226273, "equal_cnt": 11, "replace_cnt": 5, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint n,k,tot,ans[25],sum1,sum2;\nvoid dfs(int dep)\n{\n    if(sum1>k||sum2>=k) return;\n    if(dep==n+1)\n    {\n        if(sum1==k&&sum2==k-1)\n        tot++;\n        return;\n    }\n    for(int i=1;i<=4;i++)\n        if(i!=ans[dep-1])\n        {\n            ans[dep]=i;\n            if(dep>=3)\n            {\n                if(ans[dep-2]<ans[dep-1]&&ans[dep]<ans[dep-1])\n                    sum1++;\n                if(ans[dep-2]>ans[dep-1]&&ans[dep]>ans[dep-1])\n                    sum2++;\n            }\n            dfs(dep+1);\n            if(dep>=3)\n            {\n                if(ans[dep-2]<ans[dep-1]&&ans[dep]<ans[dep-1])\n                    sum1--;\n                if(ans[dep-2]>ans[dep-1]&&ans[dep]>ans[dep-1])\n                    sum2--;\n            }\n        }\n}\nint main()\n{\n    cin>>n>>k;\n    if(6*k+1<n||2*k+1>n)\n    {\n        cout<<0;\n        return 0;\n    }\n    dfs(1);\n    cout<<tot;\n    return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "eea540f2e11de8cf34a0c0e21c0ee72f", "src_uid": "6d67559744583229455c5eafe68f7952", "apr_id": "809122adbeff8d5c0754837b38a7781c", "difficulty": 1900, "tags": ["dp"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.39207207207207206, "equal_cnt": 30, "replace_cnt": 23, "delete_cnt": 6, "insert_cnt": 0, "fix_ops_cnt": 29, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\n\n/*-------------------------------------------------------------\n--------------------------------------------------------------*/\ntypedef long long ll;\nconst int mod = 1e9 + 7;\nconst ll inf = 1e18;\nconst int maxn = 100010; \nconst double eps=1e-5;\n \nstruct node\n{\n\tchar a,b,num1,num2,u;\n}tmp,tem1,tem2;\n \nint main()\n{\n\tint n,t,i,j,ans;\n\tcin>>n>>t;\n\t\tans=0;\n\t\tqueue<node>q;\n\t\tfor(i=0;i<4;i++)\n\t\t{\n\t\t\ttmp.a=i+1;\n\t\t\ttmp.b=1;\n\t\t\ttmp.num1=tmp.num2=tmp.u=0;\n\t\t\tq.push(tmp);\n\t\t}\n     \twhile(!q.empty())\n\t\t{\n\t\t\ttem1=q.front();\n\t\t\tq.pop();\n\t\t\tif(tem1.b==n&&tem1.num1==t&&tem1.num2==t-1)\n\t    \t\tans++;\n\t    \tif(tem1.b==n)\n\t        \tcontinue;\n\t\t    for(i=1;i<=4;i++)\n\t\t    {\n\t\t    \tif(tem1.a!=i)\n\t\t    \t{\n\t\t    \t\ttmp.a=i;\n\t\t    \t\ttmp.b=tem1.b+1;\n\t\t    \t    if(i>tem1.a)\n\t\t    \t       tmp.u=1;\n\t\t    \t    else\n\t\t    \t       tmp.u=-1;\n\t\t    \t    tmp.num1=tem1.num1;\n\t\t\t\t\ttmp.num2=tem1.num2;\n\t\t    \t    if(tem1.u==1&&tmp.u==-1)\n\t\t        \t    tmp.num1++;\n\t\t    \t    if(tem1.u==-1&&tmp.u==1)\n\t\t    \t        tmp.num2++;\n\t\t\t\t\t\n\t\t\t\t    if(tmp.b<=n&&tmp.num1<=t&&tmp.num2<=t-1)\n\t\t\t\t       q.push(tmp);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tcout<<ans<<\"\\n\";\n \n\treturn 0;\n}\n/*-------------------------------------------------------------\n\n--------------------------------------------------------------*/\n", "lang": "GNU C++11", "bug_code_uid": "912981e32bb494801b5d8b491be9fb12", "src_uid": "6d67559744583229455c5eafe68f7952", "apr_id": "8b217e4653d256d7e3e6806e418e7550", "difficulty": 1900, "tags": ["dp"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.13428571428571429, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "#include<iostream>\n#include<string>\n#include<math.h>\n#include<map>\n#include<algorithm>\n#include<vector>\n#define ll long long \nusing namespace std;\nstring s1, s2;\nmap<char, char>mp;\nvector<ll>luky;\nll m;\nll sum = 0;\nll lulu(int n , int i )\n{\n\t\n\tif (i > m ) return 0;\n\tif (n)\n\t{\n\t\tluky.push_back(n);\n\t\tsum++;\n\t\t\n\t}\n\t\tlulu(n * 10 + 7, i + 1);\n\t\tlulu(n * 10 + 8, i + 1);\n\t\n\treturn sum; \n}\n\nint main()\n{\n\tios::sync_with_stdio(0);\n\tcin >> m;\n\tcout << lulu(0, 0);\n\treturn  0;\n}", "lang": "GNU C++11", "bug_code_uid": "26b39a53b878cfac1975435fcdde3797", "src_uid": "f1b43baa14d4c262ba616d892525dfde", "apr_id": "288b853007e4a3c7b5295e5cf1fb5304", "difficulty": 1100, "tags": ["math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8806818181818182, "equal_cnt": 11, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "#include <iostream>\nusing namespace std;\nint main()\nint n;\ncin>>n;\nint s=2;\nint p=1;\nint k=1;\nwhile(s<n)\n{\n   int q=p;\n   p=s;\n   s+=q;\n   k++;\n}\ncout<<k;\nreturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "23d146bd57aa618cc23f8e0bd788029c", "src_uid": "3d3432b4f7c6a3b901161fa24b415b14", "apr_id": "c5cb786f4d3cd3eef08ac8183ddabf62", "difficulty": 1600, "tags": ["math", "combinatorics", "greedy", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.316622691292876, "equal_cnt": 16, "replace_cnt": 11, "delete_cnt": 5, "insert_cnt": 0, "fix_ops_cnt": 16, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint main()\n{\n    long long int x,y,a,b;\n    cin>>x>>y>>a>>b;\n    queue<long long int>q1,q2;\n    long long int i=1;\n    long long int count =0;\n    while(1)\n    {\n        if(x*i>=a && x*i<=b)\n        {\n            q1.push(x*i);\n        }\n        if(y*i>=a && y*i<=b)\n        {\n            q2.push(y*i);\n        }\n        if(x*i>b && y*i>b)\n        {\n            break;\n        }\n        i++;\n    }\n    while(q1.empty()!=1 && q2.empty()!=1)\n    {\n        if(q1.front() == q2.front())\n        {\n            count++;\n            q1.pop();\n            q2.pop();\n        }\n        else if(q1.front()>q2.front())\n        {\n            q2.pop();\n        }\n        else if(q1.front()<q2.front())\n        {\n            q1.pop();\n        }\n    }\n    cout<<count<<endl;\n    return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "5a203272c8dc255a5ad6e6eb87c2d79e", "src_uid": "c7aa8a95d5f8832015853cffa1374c48", "apr_id": "716e11a93103cd26c5b6e09469654759", "difficulty": 1200, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.953000723065799, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 6, "bug_source_code": "#include <iostream>\nusing namespace std;\nint main(){\n    long n,a[1000],i,j,t,cnt=0;\n    bool b=false;\n    cin>>n;\n    for (i=0;i<n;i++) {\n            cin>>a[i];\n            if (a[i]<0){\n                cout<<\"No\";\n                return 0;\n            }\n     }\n    if (a[0]%2==0 || a[n-1]%2==0){\n        cout<<\"No\";\n        return 0;\n    }\n    for (i=0;i<n-1;i++){\n    for (j=i+2;j<n;j++){\n        if ((j-i)%2==0 && a[i]%2==1 && a[j]%2==1) {\n            for (t=i;t<=j;t++) a[t]=-1;\n            i=j+1;\n            cnt++;\n        }\n    }\n    }\n    for (i=0;i<n;i++) if (a[i]!=-1){\n        cout<<\"No\";\n        return 0;\n    }\n    if (cnt%2==0) cout<<\"No\"; else cout<<\"Yes\";\n    return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "8f7a82c1586c8a5c9d9e5176b9894795", "src_uid": "2b8c2deb5d7e49e8e3ededabfd4427db", "apr_id": "df26d8223b6acdfbbaa0ea09bd7638d9", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9603340292275574, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n#define ll long long\n#define fill fill_n\n#define pb push_back\nconst int m=1e6+3;\nll po(int a,int b){\n    if(b==0) return 1;\n    ll x;\n    if(b%2==0){\n        x=po(a,b/2);\n        x=(x%m*x%m)%m;\n    }\n    else{\n        x=po(a,(b-1)/2);\n        x=(x%m*x%m*a%m)%m;\n    }\n    return x%m;\n}\nint main() {\n\tios_base::sync_with_stdio(false);\n\tcin.tie(NULL);\n     int n;cin>>n;\n     cout<<po(3,n-1)%m<<\"\\n\";\n\t\n\treturn 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "d9953eea1e044ebe9f76cc76108c8b35", "src_uid": "1a335a9638523ca0315282a67e18eec7", "apr_id": "d6416f07229bcb578ceacf0901b1945c", "difficulty": 1300, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.8753680078508341, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "#include<iostream>\n#include<stdio.h>\n#include<math.h>\n#include<algorithm>\nusing namespace std;\nint main()\n{\n    int i,j,a,b,c;\n    cin>>a>>b>>c;\n    for (i=0;i<=b;i++)\n        for (j=b-i;j<=c;j++)\n        {\n            if (c-j==a-i && b==i+j) {\n                          cout<<i<<\" \"<<j<<\" \"<<a-i;\n                          //system(\"pause\");\n                          return 0;\n                          }\n            }\n    cout<<\"Impossible\";\n    //system(\"pause\");\n    return 0;\n    }\n", "lang": "MS C++", "bug_code_uid": "9a3cbb0c94e9c04333e86dba47237ad5", "src_uid": "b3b986fddc3770fed64b878fa42ab1bc", "apr_id": "ac65b7ba74250049c7ed38872fe2307d", "difficulty": 1200, "tags": ["graphs", "math", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8246753246753247, "equal_cnt": 17, "replace_cnt": 8, "delete_cnt": 4, "insert_cnt": 5, "fix_ops_cnt": 17, "bug_source_code": "#include <iostream>\n#include <cmath>\n#include <cstdio>\n#include <cstring>\n#include <algorithm>\n#include <string>\n#include <vector>\n#include <queue>\n#include <map>\n#include <set>\n\nusing namespace std;\n\n#define f first\n#define s second\n#define pb push_back\n#define mp make_pair\n#define ll long long\n#define pii pair < int, int >\n#define pll pair < long long, long long>\n#define ull unsigned long long\n#define vi vector <int>\n#define all(a) a.begin(), a.end()\n#define sqr(x) ((x) * (x))\n#define FOR(a,b) for(int x = a;x <= b;x++)\nint a[1001][1001];\nint main (){\n    int n;\n    int qwe  =1;\n    cin >>n;\n    for(int i =0 ;i <= n;i++)\n    {\n        for(int j = i+1;j<= n;j++)\n        {\n            for(int k = i;k< j;k++)\n            {\n                a[qwe][k]=1;\n            }\n            qwe++;\n        }\n    }\n   for(int i = 0;i <= n;i++)\n   {\n   \tfor(int j = 0;j <= qwe;j++)\n   \t{\n   \t\ta[0][i]+=a[j][i];\n   \t}\n   }\n   int s = 0;\n   for(int i = 0;i <= n;i++)\n   {\n   \tif(s < a[0][i])s=a[0][i];\n   }\n   cout<<s;\n}\n\n", "lang": "GNU C++11", "bug_code_uid": "de1d5b8ee1af4474f908607d1081048b", "src_uid": "f8af5dfcf841a7f105ac4c144eb51319", "apr_id": "b70f7d87820c3d97e6218cbae521f615", "difficulty": 1300, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9434954007884363, "equal_cnt": 10, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 9, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n\n// use long long instead of int\n// use \"\\n\" instead of endl\n// use printf and scanf instead of cout and cin\n\ntypedef long long ll;\ntypedef vector<int> vi;\ntypedef pair<int, int> pi;\n\n#define ft first\n#define sd second\n#define pb push_back\n#define mp make_pair\n#define rep(i, a, b) for (int i = a; i < b; i++)\n\nll power(ll x, ll y)\n{\n    ll sum = 1;\n    while (y--)\n    {\n        sum *= x;\n    }\n    return sum;\n}\n\nint main()\n{\n    // freopen(\"input.txt\", \"r\", stdin);\n    // freopen(\"output.txt\", \"w\", stdout);\n    // ios::sync_with_stdio(0);\n    // cin.tie(0);\n    // cout.tie(0);\n    string s;\n    int k;\n    cin >> s;\n    int n = s.length();\n    cin >> k;\n    int j = 0;\n    while (k > 0)\n    {\n        int m = min(k, n);\n        int mx = 0;\n        rep(i, j, m + 1)\n        {\n            if (s[mx] < s[i])\n            {\n                mx = i;\n            }\n        }\n        for (int i = mx; i > j; i--)\n        {\n            char t = s[i];\n            s[i] = s[i - 1];\n            s[i - 1] = t;\n        }\n        k -= mx;\n        j++;\n    }\n    cout << s;\n}", "lang": "GNU C++17", "bug_code_uid": "0b87feb17abf18fe5d22a10ed3f8a719", "src_uid": "e56f6c343167745821f0b18dcf0d0cde", "apr_id": "17544f531b95f82da9145764f862eaca", "difficulty": 1400, "tags": ["greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9991582491582491, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include<bits/stdc++.h>\n#define mp make_pair\n#define PII pair<int,int>\n#define fi first\n#define se second\nusing namespace std;\n\nconst int LMAX=100005;\n\nint a,b,c,l;\nlong long sol,sum[LMAX];\n\nint main()\n{\n    int i,kkt,aux;\n\n    cin.sync_with_stdio(false);\n    cin>>a>>b>>c>>l;\n    sum[0]=1;\n    for (i=1;i<LMAX;i++)//mai adunam comb(i+2,2)\n        sum[i]=sum[i-1]+(1LL*(i+1)*(i+2))/2;\n    sol=sum[l];//nr de moduri de a aduna maxim l la toate\n    //scad nr de moduri in care o latura este >= decat celelalte\n    //a+la>=b+lb+c+lc\n    kkt=b+c-a;\n    for (i=0;i<=l;i++)//la\n        {\n            //mai am voie sa cresc lb si lc cu min(aux,(l-i))\n            aux=i-kkt;\n            if (aux>=0)\n                sol-=(1LL*(min(aux,l-i)+1)*(min(aux,l-i)+2))/2;\n        }\n    //b+lb>=a+la+c+lc\n    kkt=a+c-b;\n    for (i=0;i<=l;i++)//lb\n        {\n            aux=i-kkt;\n            if (aux>=0)\n                sol-=(1LL*(min(aux,l-i)+1)*(min(aux,l-i)+2))/2;\n        }\n    //c+lc>=a+la+b+lb\n    kkt=a+b-c;\n    for (i=0;i<=l;i++)\n        {\n            aux=i-kkt;\n            if (aux>=0)\n                sol-=(1LL*(min(aux,l-i)+1)*(min(aux,l-i)+2))/2;\n        }\n    cout<<sol<<\"\\n\";\n    return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "b3476067f6ac00bf51a727a5380f0cf1", "src_uid": "185ff90a8b0ae0e2b75605f772589410", "apr_id": "3685cd2fc6d5ccdb60845d3700cbbb9c", "difficulty": 2100, "tags": ["math", "combinatorics", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.049484536082474224, "equal_cnt": 10, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "#include<bits/stdc++.h>\n#define int long long\n#define max(a,b) a>b?a:b\nusing namespace std;\nint ans;\nint jc(int a){\n\treturn a==0?1:a*jc(a-1);\n}\nint C(int a,int b){\n\treturn jc(a)/jc(a-b)/jc(b);\n}\nvoid work(int a,int b,int c,int l){\n\tfor(int i=max(0,a+b-c);i<=l;i++){\n\t\tint tmp=min(l-i,c+i-a-b);\n\t\tans-=C(tmp+2,2);\n\t}\n}\nmain(){\n\tint a,b,c,l;\n\tcin>>a>>b>>c>>l;\n\tans+=C(l+3,3);\n\twork(a,b,c,l);\n\twork(a,c,b,l);\n\twork(b,c,a,l);\n\tcout<<ans<<endl;\n}", "lang": "GNU C++11", "bug_code_uid": "bbb0b57aeae2b41b6a970bb083aef03b", "src_uid": "185ff90a8b0ae0e2b75605f772589410", "apr_id": "33c9dee9285b0c5e0c2b49f06d7f0967", "difficulty": 2100, "tags": ["math", "combinatorics", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9392185238784371, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\n\ntypedef long long ll;\n\nint func1(ll x,ll r)\n{\n    return (r-(x*x)-x-1)/(2*x);\n}\n\nint func2(int x,int y)\n{\n    return x*x + 2*x*y + x + 1;\n}\n\nint main()\n{\n//    freopen(\"in.txt\",\"r\",stdin);\n//    freopen(\"out.txt\",\"w\",stdout);\n\n    ll r,y,i;\n    while(scanf(\"%lld\",&r)==1)\n    {\n        ll sq = sqrt(r);\n        int f = 0;\n        for(i = 0;i<=sq;i++)\n        {\n            y = func1(i,r);\n            if(func2(i,y)==r && y!=0)\n            {\n                f = 1;\n                break;\n            }\n        }\n        if(f)\n            printf(\"%lld %lld\\n\",i,y);\n        else\n            printf(\"NO\\n\");\n    }\n\n    return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "22e4d13bb4785c2746866414d764c9bc", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "apr_id": "d628578906fb30d4e5f47dd3c5cac82a", "difficulty": 1200, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9945652173913043, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint main()\n{\n    int a[2];\n    cin>>a[0]>>a[1]>>a[2];\n    sort(a,a+3);\n    int sum = abs(a[0]-a[1])+abs(a[1]-a[2]);\n    cout<<sum<<endl;\n}\n", "lang": "GNU C++17", "bug_code_uid": "10856d7ac299a3cd2e8b052016869bb6", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "apr_id": "6d765172999e028db08896b110425183", "difficulty": 800, "tags": ["math", "sortings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.3738656987295826, "equal_cnt": 7, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint main(){\n    int n;cin>>n;\n    queue<string>Q;\n    Q.push(\"7\");\n    Q.push(\"8\");\n    unsigned long long int ct=0;\n    while(!Q.empty()){\n        auto p=Q.front();Q.pop();\n        if(p.size()>n)break;\n        ct++;\n        Q.push(\"7\"+p);\n        Q.push(\"8\"+p);\n    }\n    cout<<ct;\n    return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "edd1904164a2338607b1ab75fe18ab3b", "src_uid": "f1b43baa14d4c262ba616d892525dfde", "apr_id": "1d3caf16279b1da836778742ccb56089", "difficulty": 1100, "tags": ["math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8198563846394006, "equal_cnt": 22, "replace_cnt": 19, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 21, "bug_source_code": "#include<cstdio>\n#include<algorithm>\n#include<iostream>\n#include<cmath>\n#include<cstring>\n#include<map>\n#include<queue>\n#include<stack>\n#include<utility>\n#include<cstdlib>\n#include<string>\n#include<set>\n#include<limits>\n#include<iomanip>\n#include<fstream>\n#include<sstream>\n#define INF 2147483647\n#define LLD int\n#define clr(a) memset(a,0,sizeof(a))\n#define reset(a) memset(a,-1,sizeof(a))\n#define BD(i, j) (i >= 0 && i < n && j >= 0 && j < m)\n#define PRINT_VAR(X) (cout << #X << \" -> \" << X << endl)\n#define PI acos(0)\n#define MAX_INT 2147483647\n#define SIZE 205\n#define MOD 10056\nusing namespace std;\nint X[] = {0, 1, 0, -1};\nint Y[] = {1, 0, -1, 0};\n/* right, down, lft, up */\nint m, n;\ntypedef pair<int, int> Point;\ntypedef pair<Point, Point> Line;\n\nlong long solve(int val, int idx, int t, bool up) {\n\tif (2*(m-t) + idx - 1 > n || t > m) return 0;\n\tif (t == m && idx == n) return 1;\n\tlong long total = 0;\n\tif (idx != n-1) {\n\t\tfor (int i = val+1; i <= 4; i++) {\t\t\t\n\t\t\ttotal += solve(i, idx+1, t, true);\n\t\t}\n\t}\n\t\n\tif (idx != 1) {\n\t\tfor (int i = val-1; i > 0; i--) {\n\t\t\tif (up)\n\t\t\t\ttotal += solve(i, idx+1, t+1, false);\n\t\t\telse\n\t\t\t\ttotal += solve(i, idx+1, t, false);\n\t\t}\n\t}\n\t\n\treturn total;\n}\n\nint main()\n{\n\tint t, tc, z, x, y;\n    int i, j, k, l, h;\n    char ch;\n\n#ifndef ONLINE_JUDGE\n   \tfreopen(\"input.txt\", \"r\", stdin);\n#endif\n\t\n\tcin >> n >> m;\n\tlong long res = solve(0, 0, 0, true);\n\t\n\tcout << res << endl;\n   \n\treturn 0;\n}", "lang": "GNU C++", "bug_code_uid": "0133ce6d0fc7a28e73931d56e817e0c5", "src_uid": "6d67559744583229455c5eafe68f7952", "apr_id": "095e1147c8f0513655cf6a17a7b5ccd6", "difficulty": 1900, "tags": ["dp"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9101382488479263, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "#include<bits/stdc++.h>\n#define int long long \n\nusing namespace std;\n\nint val[6] = {4, 5, 6, 3, 2, 1};\nint tablica [4][6] = {{4, 5, 6, 3, 2, 1}, {11, 12, 13, 10, 9, 8}, {4, 5, 6, 3, 2, 1}, {11, 12, 13, 10, 9, 8}};\nint main(){\n\tint n, sol;\n\tchar c;\n\tscanf(\"%d%c\", &n, &c);\n\tsol = (((n - 1) / 4) * 16);\n\t//cout << sol << endl;\n\tn = n - ((n - 1) / 4)*4;\n\t//cout << n << endl;\n\tsol += tablica[n - 1][c - 'a'];\n\tcout << sol << endl;\t\n\treturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "9ca71bed046ee160bf6ad53be4e54b6d", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "apr_id": "545acd1b5ac1223f257b82b7bacf7224", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.2652439024390244, "equal_cnt": 31, "replace_cnt": 23, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 30, "bug_source_code": "#include <bits/stdc++.h>\n\nusing namespace std;\n\nint main () {\n    ios_base::sync_with_stdio(false);\n\n    int n, k, x;\n    cin >> n >> k >> x;\n\n    vector<int> a(n);\n\n    int ans = 0;\n\n    for(int &i : a) cin >> i;\n\n    if(n<2){\n        cout << ans << endl;\n        return 0;\n    }\n    \n    for(int i=0; i<a.size(); i++){\n        vector<int> b;\n\n        bool ok = 0;\n        bool added = 0;\n        int index = 0;\n\n        \n        for(int j=0; j<a.size()-1; j++){\n            if(a[j] == x and a[j]==a[j+1]){\n                ok = 1;\n                added = 1;\n                index = j;\n                for(int k=0; k<=j; k++)\n                    b.push_back(a[k]);\n                b.push_back(x);\n                for(int k=j+1; k<a.size(); k++)\n                    b.push_back(a[k]);\n            }\n        }\n\n        if(ok==0) {\n            for(int j=0; j<a.size()-2; j++){\n                if(a[j]==a[j+1] and a[j]==a[j+2]){\n                    ok = 1;\n                    index = j;\n                    b = a;\n                    break;\n                }\n            }\n            if(ok==0)\n                break;\n        }\n\n        //for(int j : b) cout << j << \" \";\n        //cout << endl;\n\n        int final_index = index;\n\n        while(final_index<b.size() and b[index]==b[final_index])\n            final_index++;\n        \n        if(final_index==b.size() or b[final_index]!=b[index])\n            final_index--;\n        \n        vector<int> c;\n        ans+=(final_index-index+1);\n        if(added) ans--;\n        \n        for(int j=0; j<index; j++)\n            c.push_back(b[j]);\n        for(int j=final_index+1; j<b.size(); j++)\n            c.push_back(b[j]);\n        \n        a = c;\n    }\n\n    cout << ans << endl;\n\n    return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "c96fcf8f0a5d3a1b7bf39d746857411b", "src_uid": "d73d9610e3800817a3109314b1e6f88c", "apr_id": "e6e32785b74dd798084152490eee2314", "difficulty": 1400, "tags": ["brute force", "two pointers"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6266233766233766, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint main(){\nios_base::sync_with_stdio(false);\ncin.tie(NULL);\nint ara[3];\ncin>>ara[0]>>ara[1]>>ara[2];\nsort(ara,ara+3,greater<int>());\n//cin>>ara[0]>>ara[1]>>ara[2];\n//cout<<ara[0]<<ara[1]<<ara[2];\nif(ara[1]+ara[2]>ara[0]){cout<<0;return 1;}\nint n = ara[0] - (ara[1]+ara[2]);\ncout<<n+1;\n\n}\n", "lang": "GNU C++17", "bug_code_uid": "efb6d7dbc89d402db21676b7aa9a6ef3", "src_uid": "3dc56bc08606a39dd9ca40a43c452f09", "apr_id": "9dafb19f5327ebb6cfbe6cd77a50915b", "difficulty": 800, "tags": ["geometry", "math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.13872832369942195, "equal_cnt": 26, "replace_cnt": 19, "delete_cnt": 1, "insert_cnt": 7, "fix_ops_cnt": 27, "bug_source_code": "#include <iostream>\n#include <string>\n#include <algorithm>\nusing namespace std;\nint main(){\n    string str;\n    cin >> str;\n    string made = str.substr(0, 1);\n    bool at = false;\n    for (int i = 1; i < str.length();){\n        if (str.substr(i, 3) == \"dot\" && i + 3 != str.length()){\n            made = made + \".\";\n            i += 3;\n        }\n        else if (str.substr(i, 2) == \"at\" && at == false && i + 2 != str.length()){\n            at = true;\n            made = made + \"@\";\n            i += 2;\n        }\n    }\n    cout << made << endl;\n\n    return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "03174fb11fdd11d3af2f2d359fb129de", "src_uid": "a11c9679d8e2dca51be17d466202df6e", "apr_id": "5a53985cb6b58ec5385c7725a2d50d29", "difficulty": 1300, "tags": ["implementation", "expression parsing"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.4518218623481781, "equal_cnt": 14, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 13, "bug_source_code": "//\n//  main.cpp\n//  ioi\n//\n//  Created by Arkalyk Akash on 12/17/16.\n//  Copyright \u00a9 2016 Arkalyk Akash. All rights reserved.\n//\n\n#include <iostream>\n\nusing namespace std;\n\nint main() {\n    int ans = 0;\n    string s;\n    cin >> s;\n    sort(s.begin(),s.end());\n    for (int  i = 0; i < s.size();i++){\n        s[i] = tolower(s[i]);\n        if (s[i] != s[i + 1]){\n            ans++;\n        }\n    }\n    cout << ans;\n    return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "06577e9c5424c8a10d2c6e304d067613", "src_uid": "8909ac99ed4ab2ee4d681ec864c7831e", "apr_id": "83f5f08342623e7e1ea806b1466bf69e", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.11990111248454882, "equal_cnt": 25, "replace_cnt": 20, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 24, "bug_source_code": "#include <bits/stdc++.h>\n 2 using namespace std;\n 3 inline int read()\n 4 {\n 5     int x=0,f=1;\n 6     char ch=getchar();\n 7     while(ch<'0'||ch>'9')\n 8     {\n 9         if(ch='-')\n10             f=-1;\n11         ch=getchar();\n12     }\n13     while(ch>='0'&&ch<='9')\n14     {\n15         x=x*10+ch-'0';\n16         ch=getchar();\n17     }\n18     return x*f;\n19 }\n20 int n;\n21 char s[255];\n22 int main()\n23 {\n24     n=read();\n25     cin>>s;\n26     int e=0;\n27     for(int i=0;i<n;i++)\n28     {\n29         int a=0,b=0,c=0,d=0;\n30         for(int j=i;j<n;j++)\n31         {\n32             if(s[j]=='U')\n33                 a++;\n34             if(s[j]=='D')\n35                 b++;\n36             if(s[j]=='L')\n37                 c++;\n38             if(s[j]=='R')\n39                 d++;\n40             if(a==b&&c==d)\n41                 e++;\n42         }\n43     }\n44     cout<<e<<endl;\n45     return 0;\n46 }", "lang": "GNU C++14", "bug_code_uid": "1ebdec9afb4e880d46ca4de00f14c321", "src_uid": "7bd5521531950e2de9a7b0904353184d", "apr_id": "30e4ade7605e02f979ce30e348f69996", "difficulty": 1000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.27294117647058824, "equal_cnt": 8, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint main(){\n\tios_base::sync_with_stdio(false);cin.tie(0);\n    cout.tie(0);\n\tint n;\n\tcin>>n;\n\tstring s;\n\tcin>>s;\n\tif(n==1){\n\t\tcout<<0<<\"\\n\";\n\t\treturn 0;\n\t}\n\telse{\n\t\tint ans=0;\n\t\tqueue<pair<string,int>> q;\n\t\tq.push(make_pair(s,0));\n\t\twhile(!q.empty()){\n\t\t\tpair<string,int> u=q.front();\n\t\t\tq.pop();\n\t\t\tans=max(ans,u.second);\n\t\t\t\n\t\t\tstring t=u.first;\n\t\t\t//cout<<t<<endl;\n\t\t\tfor(int i=0;i<t.size()-1;i++){\n\t\t\t\tif(abs(t[i]-t[i+1])==1){\n\t\t\t\t\tstring ll=t;\n\t\t\t\t\tif(t[i+1]-t[i]==1){\n\t\t\t\t\t\tll.erase(ll.begin()+i+1);\n\t\t\t\t\t\tq.push({ll,u.second+1});\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tll.erase(ll.begin()+i);\n\t\t\t\t\t\tq.push({ll,u.second+1});\n\t\t\t\t\t}\n\t\t\t\t\t//break;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tcout<<ans<<\"\\n\";\n\n\t}\n\t\n\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "461297a8e325fc39698dddd4b48d88fc", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "apr_id": "735b56baefe674ec0d3f4765b669cb9a", "difficulty": 1600, "tags": ["strings", "brute force", "greedy", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.7480176211453744, "equal_cnt": 24, "replace_cnt": 18, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 23, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\n\n#define ll long long\n#define llu unsigned long long\n#define PB push_back\n#define F first\n#define S second\nconst ll MOD = 1000000007;\nconst ll INF = 1000000007;\n\nvoid __print(int x) {cerr << x;}\nvoid __print(long x) {cerr << x;}\nvoid __print(long long x) {cerr << x;}\nvoid __print(unsigned x) {cerr << x;}\nvoid __print(unsigned long x) {cerr << x;}\nvoid __print(unsigned long long x) {cerr << x;}\nvoid __print(float x) {cerr << x;}\nvoid __print(double x) {cerr << x;}\nvoid __print(long double x) {cerr << x;}\nvoid __print(char x) {cerr << '\\'' << x << '\\'';}\nvoid __print(const char *x) {cerr << '\\\"' << x << '\\\"';}\nvoid __print(const string &x) {cerr << '\\\"' << x << '\\\"';}\nvoid __print(bool x) {cerr << (x ? \"true\" : \"false\");}\n\ntemplate<typename T, typename V>\nvoid __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}\ntemplate<typename T>\nvoid __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? \",\" : \"\"), __print(i); cerr << \"}\";}\nvoid _print() {cerr << \"]\\n\";}\ntemplate <typename T, typename... V>\nvoid _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << \", \"; _print(v...);}\n#ifndef ONLINE_JUDGE\n#define ck(x...) cerr << \"[\" << #x << \"] = [\"; _print(x)\n#else\n#define ck(x...)\n#endif\n\nstring gh = \"here\";\n\nint main(){\n    ios_base::sync_with_stdio(false);\n    cin.tie(NULL);\n    #ifndef ONLINE_JUDGE\n            freopen(\"input.txt\", \"r\", stdin);\n            freopen(\"output.txt\", \"w\", stdout);\n            freopen(\"err.txt\", \"w\", stderr);\n    #endif\n\n    int n;\n    cin>>n;\n    string s;\n    cin>>s;\n    vector < string > ab;\n    ab.PB(s);\n    int ans =-1;\n    while(true){\n        if(ab.empty()){\n            break;\n        }\n        ans++;\n        vector < string > ba(ab);\n        ab.clear();\n        int sz = ba.size();\n        for(int i= 0;i<sz;i++){\n            string ff = ba[i];\n            int sx = ff.size();\n            for(int j =0;j<sx;j++){\n                if((j-1 < 0 || ff[j-1] != ff[j]-1) && (j+1 >= n || ff[j+1] != ff[j]-1))\n                    continue;\n                string uu;\n                for(int k = 0;k<sx;k++){\n                    if(k == j)\n                        continue;\n                    uu += ff[k];\n                }\n                ab.PB(uu);\n            }\n        }\n    } \n    cout<<ans;       \n    \n    return 0;\n}", "lang": "GNU C++14", "bug_code_uid": "2975c9e8dddde7825ce5ce362817a2cd", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "apr_id": "80f16d1541b66faba0dd80355c7ac8f7", "difficulty": 1600, "tags": ["strings", "brute force", "greedy", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.7739463601532567, "equal_cnt": 15, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 8, "fix_ops_cnt": 14, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n#define maxn 8\n\npair<int, int> p[maxn];\nvector<int> x, y;\nset<int> sx, xy;\n\nint main() {\n\tint i;\n\tfor (i = 0; i < maxn; i++) {\n\t\tscanf(\"%d %d\", &p[i].first, &p[i].second);\n\t\tif (sx.find(p[i].first) == sx.end()) {\n\t\t\tsx.insert(p[i].first);\n\t\t\tx.push_back(p[i].first);\n\t\t}\n\t\tif (sy.find(p[i].second) == sy.end()) {\n\t\t\tsy.insert(p[i].second);\n\t\t\ty.push_back(p[i].second);\n\t\t}\n\t}\n\tif (x.size() != 3 && y.size() != 3) {\n\t\tprintf(\"ugly\");\n\t\treturn 0;\n\t}\n\tsort(x.begin(), x.end());\n\tsort(y.begin(), y.end());\n\tfor (i = 0; i < maxn; i++)\n\t\tif (p[i].first == x[1] && p[i].second == y[1]) {\n\t\t\tprintf(\"ugly\");\n\t\t\treturn 0;\n\t\t}\n\tprintf(\"respectable\");\n\treturn 0;\n}", "lang": "GNU C++17", "bug_code_uid": "730d8568f2462a9f0c06d09ccab2f39a", "src_uid": "f3c96123334534056f26b96f90886807", "apr_id": "bf1cfeb09388234469ef248da9753196", "difficulty": 1400, "tags": ["sortings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.5714285714285714, "equal_cnt": 18, "replace_cnt": 8, "delete_cnt": 8, "insert_cnt": 1, "fix_ops_cnt": 17, "bug_source_code": "#include <iostream>\nusing namespace std;\nint main()\n{\n\tint n, a, cm = 0, ce = 0;\n\tcin >> n;\n\twhile (n >=0) {\n\t\tcin >> a;\n\t\tif (a % 2 == 0 && n >= a) {\n\t\t\tn = n - a; cm++;\n\t\t}\n\t\telse if (a % 2 != 0 && n >= a) {\n\t\t\tn = n - a; ce++;\n\t\t}\n\t}\n\tif (cm > ce)cout << \"Mahmoud\";\n\telse cout << \"Ehab\";\n}", "lang": "GNU C++17", "bug_code_uid": "5e399a0dd2ddc330f52564d2b11fbdae", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "apr_id": "2ead71ff977579b867361cd5ab6e1300", "difficulty": 800, "tags": ["math", "games"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9665938182953481, "equal_cnt": 11, "replace_cnt": 0, "delete_cnt": 4, "insert_cnt": 6, "fix_ops_cnt": 10, "bug_source_code": "#include <iostream>\n#include <cstring>\n#include <sstream>\n#include <bitset>\n#include <cstdio>\n\n#define FOR(i,a,b) for (int i=a;  i<=b;  i++)\n#define DFU(i,a,b) for (int i=a;  i>=b;  i--)\n#define SIZE(a) int(a.size())\n\nusing namespace std;\n\nstruct board\n{\n    long long m[11][11];\n};\n\nboard matrix,c,s;\nlong long t,n,sx,sy,dx,dy,mang[11];\n\nvoid init()\n{\n    memset(matrix.m,0,sizeof(matrix.m));\n    FOR(i,1,4) matrix.m[5][i]=1;  matrix.m[5][5]=1;\n    FOR(i,1,4) matrix.m[1][i]=1;  matrix.m[1][1]=2;\n    FOR(i,1,4) matrix.m[2][i]=1;  matrix.m[2][2]=2;\n    matrix.m[3][1]=1;  matrix.m[3][3]=1;\n    matrix.m[4][2]=1;  matrix.m[4][4]=1;\n    matrix.m[6][6]=1;  matrix.m[6][5]=1;\n}\n\nboard tich(board a, board b)\n{\n    memset(c.m,0,sizeof(c.m));\n    FOR(i,1,6) FOR(j,1,6)\n        FOR(t,1,6) c.m[i][j]=(c.m[i][j]+a.m[i][t]*b.m[t][j])%n;\n    return c;\n}\n\nlong long get(long long x, long long y)\n{\n    return (x >> y) & 1;\n}\n\nvoid solve()\n{\n    int p;\n    FOR(i,0,61) if (get(t,i)) p=i;\n    memset(s.m,0,sizeof(s.m));\n    FOR(i,1,6) s.m[i][i]=1;\n    DFU(i,p,0) {\n        s=tich(s,s);\n        if (get(t,i)) s=tich(s,matrix);\n    }\n}\n\nint main()\n{\n  //  freopen(\"test.inp\",\"r\",stdin);\n    cin >>n>>sx>>sy>>dx>>dy>>t;\n    sx--;  sy--;\n    init();\n    solve();\n    long long ans=0;\n    memset(mang,0,sizeof(mang));\n    mang[1]=sx;  mang[2]=sy;  mang[3]=dx;  mang[4]=dy;  mang[5]=2;  mang[6]=1;\n    ans=0;\n    FOR(i,1,6) ans=(ans+mang[i]*s.m[i][1])%n;\n    cout <<ans+1<<\" \";\n    ans=0;\n    FOR(i,1,6) ans=(ans+mang[i]*s.m[i][2])%n;\n    cout <<ans+1<<\" \";\n    return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "f890031dc9311687ec223aa573375da8", "src_uid": "ee9fa8be2ae05a4e831a4f608c0cc785", "apr_id": "df9e5780038a8f93a607dc2849091432", "difficulty": 2300, "tags": ["matrices", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.7689182326053834, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include <iostream>\n#include <vector>\n#include <string>\n#include <algorithm>\n#include <set>\n#include <map>\n#include <math.h>\n#include <cmath>\n#include <queue>\n#include <iomanip>\n\nusing namespace std;\n#define LL long long\n#define uLL unsigned long long\n#define mp make_pair\n#define pb push_back\n#define all(x) (x).begin(),(x).end()\n#define rall(x) (x).rbegin(),(x).rend()\n#define vi vector<int>\n#define vLL vector<LL>\n#define vs vector<string>\n#define fori(n) for(int (i)=0; (i)<n; (i)++)\nconst LL mod = 1000000007;\n\n\n\nint main()\n{\n#ifdef _DEBUG\n    freopen(\"input.txt\", \"r\", stdin);\n    freopen(\"output.txt\", \"w\", stdout);\n#endif\n    char c;\n    cin >> c;\n    char cur = c;\n    int len = 1;\n    int ans = 0;\n    while (!cin.eof())\n    {\n        cin >> c;\n        if (c == cur) len++;\n        else\n        {\n            if (len % 2 == 0)ans++;\n            len = 1;\n            cur = c;\n        }\n    }\n    cout << ans;\n    return 0;\n}", "lang": "MS C++", "bug_code_uid": "654479fe4d77d724c13f39c25714fc31", "src_uid": "8b26ca1ca2b28166c3d25dceb1f3d49f", "apr_id": "c42467a1e241bd752f89a943f082f642", "difficulty": null, "tags": ["implementation", "two pointers"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.40107671601615075, "equal_cnt": 11, "replace_cnt": 5, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "#include <bits/stdc++.h>\n#define LL long long int\nusing namespace std;\n\nint main()\n{\n    long long  n;\n\n    cin>>n;\n  if(n==1)\n  {\n    cout<<\"0 0\";\n    return 0;\n  }\n\n    for(long long  i=0; i<=min(1000000LL ,n); i++)\n    {\n\n        long long x = i*i;\n        x+=i+1;\n        if(n-x>=0){\n        if((n-x)%(2*i)==0)\n        {\n\n          cout<<i<<\" \"<<(n-x)/2*i;\n          return 0;\n        }\n      }\n    }\n\n    cout<<\"NO\"<<endl;\n\n\n  return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "c32502efc702506bc28ef29d3f41a008", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "apr_id": "41bfc7ba226d4008c0e9ecf526801bd9", "difficulty": 1200, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9987562189054726, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <iostream>\n#include <string>\n#include <cmath>\n#include <cstdio>\n#include <algorithm>\n\n#define re return\n\nusing namespace std;\n\nint main()\n{\n  int n,m,a[10],b[9], min1=3000, min2=3000,min3=3000,f=0;\n  cin >> n >> m;\n  for (int i = 0; i < n; i ++)\n  {\n    cin>> a[i];\n    if (a[i]<min1 && a[i]>0)\n        min1=a[i];\n  }\n  for (int i = 0; i < n; i ++)\n  {\n    cin>> b[i];\n    if (b[i]<min2 && b[i]>0)\n        min2=b[i];\n  }\n  for (int i = 0; i < n; i ++)\n  {\n      for (int j = 0; j < m; j++)\n      {\n          if (a[i]==b[j])\n          {\n              if (a[i]<min3)\n                min3=a[i];\n              f=1;\n          }\n      }\n  }\n  if (f==1)\n  {\n      cout << min3;\n      re 0;\n  }\n  if (min1==min2)\n  {\n    cout << min1;\n    re 0;\n  }\n  cout << min(min1,min2) << max(min1,min2);\n  re 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "9da1181c8007517efe9e5b4d032ba6d9", "src_uid": "3a0c1b6d710fd8f0b6daf420255d76ee", "apr_id": "bbc93c52dc36c582b8cfec97e8166d93", "difficulty": 900, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.77000777000777, "equal_cnt": 20, "replace_cnt": 13, "delete_cnt": 1, "insert_cnt": 6, "fix_ops_cnt": 20, "bug_source_code": "\t// Naman Shukla\n\n\n\t#include <bits/stdc++.h>\n\tusing namespace std;\n\t \n\t#define ms(s, n) memset(s, n, sizeof(s))\n\t#define FOR(i, a, b) for (int i = (a); i < (b); i++)\n\t#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)\n\t#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)\n\t#define sz(a) int((a).size())\n\t#define all(a) (a).begin(), (a).end()\n\t#define uni(a) (a).erase(unique(all(a)), (a).end())\n\t#define pb push_back\n\t#define pf push_front\n\t#define mp make_pair\n\t#define fi first\n\t#define se second\n\t#define prec(n) fixed<<setprecision(n)\n\t#define bit(n, i) (((n) >> (i)) & 1)\n\t#define bitcount(n) __builtin_popcount(n)\n\ttypedef long long ll;\n\ttypedef unsigned long long ull;\n\ttypedef long double ld;\n\ttypedef pair<int, int> pi;\n\ttypedef vector<int> vi;\n\ttypedef vector<pi> vii;\n\tconst int MOD = (int) 1e9 + 7;\n\tconst int INF = (int) 1e9;\n\tconst ll LINF = (ll) 1e18;\n\tconst ld PI = acos((ld) -1);\n\tconst ld EPS = 1e-9;\n\tll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}\n\tll lcm(ll a, ll b) {return a / gcd(a, b) * b;}\n\tll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}\n\ttemplate<class T> void setmin(T& a, T val) {if (a > val) a = val;}\n\ttemplate<class T> void setmax(T& a, T val) {if (a < val) a = val;}\n\tvoid addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}\n\tvoid submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}\n\tint mult(int a, int b, int p = MOD) {return (ll) a * b % p;}\n\tint inv(int a, int p = MOD) {return fpow(a, p - 2, p);}\n\n\tll n,m,a[40];\n\tvector<ll>v1,v2;\n\n\tvoid go1(ll cur,ll val)\n\t{\n\t\tif(cur==n)\n\t\t{\n\t\t\tv1.pb(val);\n\t\t\treturn;\n\t\t}\t\n\t\t\n\t\tgo1(cur+1,val);\n\t\tval = (val+a[cur])%m;\n\t\tgo1(cur+1,val);\n\t}\n\n\tvoid go2(ll cur,ll val)\n\t{\n\t\tval=(val+a[cur])%m;\n\t\tv2.pb(val);\n\n\t\tFOR(i,cur+1,n)\n\t\tgo2(i,val);\n\t}\n\n\tint main() {\n\t\tios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);\n\n\t\tcin>>n>>m;\n\t\tFOR(i,0,n)cin>>a[i];\n\n\t\tgo1(0,0);\n\n\n\n\t\tll ans = 0;\n\n\t\tFOR(i,0,v1.size())ans= max(ans,v1[i]);\n\t\tFOR(i,0,v2.size())ans= max(ans,v2[i]);\n\n\t\tFOR(i,0,v1.size())\t\n\t\tFOR(j,0,v2.size())\n\t\tans = max(ans,(v1[i]+v2[j])%m);\n\n\n\t\tcout<<ans;\n\t\treturn 0;\n\t} ", "lang": "GNU C++14", "bug_code_uid": "b3ebbd145fa74cdebf1a489da68216a3", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "apr_id": "0ae0bc61fa34ef02fd41769d15a90c91", "difficulty": 1800, "tags": ["divide and conquer", "meet-in-the-middle", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.998587570621469, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": " \n#include <bits/stdc++.h>\n#pragma GCC optimize(\"Ofast,no-stack-protector,unroll-loops,fast-math,O3\")\n#define int long long \nusing namespace std;\n    long long powmod(long long a,long long b,long long mod) {\n        if (b==0 || a==1)  {if (mod==1) return 0; else return 1; }\n       \n        if (b%2==0) { long long k=powmod(a,b/2,mod); return (k*k)%mod; }\n        else {long long k=powmod(a,b/2,mod); return ( (k*k) %mod *a)% mod; }\n    }\n    long long gcd(long long a, long long b) {\n        if (a==0) return b;\n        if (b==0) return a;\n        if (a>b) return gcd(a%b,b); else return gcd(b%a,a);\n    }\n    int prime(int p) { // 1 - \u043f\u0440\u043e\u0441\u0442\u043e\u0435\n        for (int i=2;i*i<=p;i++) {\n            if (p%i==0 && i<p) return i;  \n        }\n        return 1;\n    }\n    int inv(int a, int mod) {\n        return powmod(a,mod-2,mod); \n    }\n    \n    void solve (int ppppppppp=1) {\n       \n       \n         /* --------- */\n       int a;\n       cin>>a;\n       cout << ( ( x%360 + 45 + 360 )%360-1 )/90;\n         /* --------- */\n           return;\n    }\n     \n     \n     \n    signed main() {\n       \n         ios_base::sync_with_stdio(0);\n        cin.tie(0);\n        cout.tie(0);\n       \n         cout<<fixed<<setprecision(10); \n          int tututu;\n          tututu=1;\n       // cin>>tututu; // \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0442\u043e \u0437\u0430\u043a\u043e\u043c\u0435\u043d\u0442\u0438\u0442\u044c\n          for (int qwerty=0;qwerty<tututu;qwerty++) solve();\n      \n       \n        return 0;\n    }", "lang": "GNU C++17", "bug_code_uid": "061965d26d9fff3a52408a085c842ff5", "src_uid": "509db9cb6156b692557ba874a09f150e", "apr_id": "ba015bb3d5ea38cc46dda68677503cda", "difficulty": 1800, "tags": ["geometry", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.05661174482467258, "equal_cnt": 18, "replace_cnt": 16, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 18, "bug_source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<algorithm>\n#include<math.h>\n#define maxn 10005\nusing namespace std;\nint book[maxn][maxn]; \nint a[4][2]={{1,1},{1,-1},{-1,-1},{-1,1}};\nint x,y,x1,x2;\nint y11,y2,flag;\nvoid dfs(int x0,int y0)\n{\n\tint i,tx,ty;\n\tif(x0==x2&&y0==y2)\n\t\t{\n\t\t\tflag=1;\n\t\t\treturn;\n\t\t}\n\t\tif(flag==1)\n\t\t\treturn ;\n\t\tfor(i=0;i<4;i++)\n\t\t{\n\t\t\ttx=x0+a[i][0]*x;\n\t\t\tty=y0+a[i][1]*y;\n\t\t\tif(tx<0||ty<0||tx>x2+x||ty>y2+y)\n\t\t\t\tcontinue;\n\t\t\tif(book[tx][ty]==0)\n\t\t\t\t{\n\t\t\t\t\tbook[tx][ty]=1;\n\t\t\t\t\tdfs(tx,ty);\n\t\t\t\t\tbook[tx][ty]=0;\n\t\t\t\t}\n\t\t}\n}\nint main()\n{\n   while(scanf(\"%d%d%d%d\",&x1,&y11,&x2,&y2)!=EOF)\n   {\n   \tflag=0;\n   \tmemset(book,0,sizeof(book));\n   \tscanf(\"%d%d\",&x,&y);\n   \tbook[x1][y11]=1;\n   \tdfs(x1,y11);\n   \tif(flag==1)\n   \t\tprintf(\"YES\\n\");\n   \t\telse\n   \t\t\tprintf(\"NO\\n\");\n   }\n   return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "00df938452371c27598f6f727cd2690c", "src_uid": "1c80040104e06c9f24abfcfe654a851f", "apr_id": "ba1992f69df1a43b2718e9b9a2f260bc", "difficulty": 1200, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.30501488435997254, "equal_cnt": 64, "replace_cnt": 43, "delete_cnt": 10, "insert_cnt": 11, "fix_ops_cnt": 64, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nchar  start[1004],ending[1004];\n\n#define SYN ios_base::sync_with_stdio(0);cin.tie(0);\ntypedef long long int LL;\ntypedef unsigned long long int ULL;\n\n#define debug(x)         cerr<<__LINE__<<\" \"<<#x<<\" \"<<x<<endl;\n#define IMAX ((unsigned)1<<31)-1\n#define eps 1e-11\n#define fill(a,v) memset(a,v,sizeof (a))\n#define SZ(X) ((int)X.size())\n#define VI vector<int>\n#define VS vector<string>\n#define PB push_back\n#define MSI map<string,int>\n#define MSLI map<string,LLI>\n#define MCI map<char,int>\n#define PI acos(-1.0)\n#define mk make_pair\n#define pLLI pair<LLI,LLI>\n#define xx first\n#define yy second\n#define POPCOUNT __builtin_popcountll\n\n#define MOD 1000000007\n#define RADIANS(x)       (((1.0 * x * PI) / 180.0))\n#define DEGREES(x)       (((x * 180.0) / (1.0 * PI)))\n\n\n///*----------------------Graph Moves----------------*/\n////const int fx[]={+1,-1,+0,+0};\n////const int fy[]={+0,+0,+1,-1};\n////const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move\n////const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move\n////const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move\n////const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move\n///*------------------------------------------------*/\n\n\n#define LLI long long int\ntemplate<typename T> inline bool isOn(T mask,T pos)\n{\n    return mask&(1<<pos);\n}\n\ntemplate<typename T> inline int Off(T mask,T pos)\n{\n    return mask^(1<<pos);\n}\n\ntemplate<typename T> inline int On(T mask,T pos)\n{\n    return mask|(1<<pos);\n}\n\ntemplate<class T> inline int countbit(T n)\n{\n    return (n == 0) ? 0 : (1+countbit(n&(n-1)));\n}\n\ntemplate<class T> string toBinary(T n)\n{\n    string ret=\"\";\n    while(n)\n    {\n        if(n%2==1) ret+='1';\n        else ret+='0';\n        n>>=1;\n    }\n    reverse(ret.begin(),ret.end());\n    return ret;\n}\n\n\n/// String Conversion template start\n\n\ntemplate<class T> string toString(T n)\n{\n    ostringstream ost;\n    ost << n;\n    ost.flush();\n    return ost.str();\n}\n\nint toInt(string s)\n{\n    int r = 0;\n    istringstream sin(s);\n    sin >> r;\n    return r;\n}\nLLI toLInt(string s)\n{\n    LLI r = 0;\n    istringstream sin(s);\n    sin >> r;\n    return r;\n}\ndouble toDouble(string s)\n{\n    double r = 0;\n    istringstream sin(s);\n    sin >> r;\n    return r;\n}\n\nvector <string> token( string str,string deli )\n{\n    char * cstr, *p,*deli_c;\n    deli_c = new char [deli.size()+1];\n    cstr = new char [str.size()+1];\n    strcpy(deli_c,deli.c_str());\n    strcpy (cstr, str.c_str());\n    VS vec;\n    p=strtok(cstr,deli_c);\n    while(p!=NULL)\n    {\n        vec.push_back( string(p));\n        p=strtok(NULL,deli_c);\n    }\n    delete[] cstr;\n    return vec;\n}\n\n/// String Conversion template End\n\n\n/// Math template  start\ntemplate<class T> inline T GCD(T a,T b)\n{\n    if ( a < 0 ) return GCD(-a,b);\n    if ( b < 0 ) return GCD(a,-b);\n    return (b == 0) ? a :GCD(b,a%b);\n}\n\ntemplate<class T > inline T LCM(T a, T b)\n{\n    if( a < 0 ) return LCM( -a, b);\n    if( b < 0 ) return LCM(a,-b);\n    return a*(b/GCD(a,b));\n}\n\n\nLLI fastExpo( LLI b, LLI p)\n{\n    LLI res=1,x=b;\n    while(p)\n    {\n        if(p&1) res*=x;\n        x*=x;\n        p=p>>1;\n    }\n    return res;\n}\n\n/// Math template End\n\n\ndouble dist(int x,int y,int x1,int y1)\n{\n    return sqrt(((x1-x)*(x1-x))+((y1-y)*(y1-y)));\n}\nLLI dp[19][2][2][(1<<8)][2521];\nLLI k,n;\nLLI mod= 2520;\nLLI solve(int pos,int x,int y,int bit,int r)\n{\n    if(pos==n)\n    {\n       // cout<<s<<\" s\"<<endl;\n        int f=1;\n        int ne;\n        for(int i=0;i<8;i++)\n        {\n            if((bit&(1<<(i))))\n            {\n               // if(lcm[f][i+2]==-1)\n                    {f=LCM(f,i+2);\n                    //  lcm[f][i+2]=f;\n                    }\n                  //  else\n                 //       f=lcm[f][i+2];\n\n\n            }\n        }\n     //   cout<<f<<\" \"<<r<<endl;\n        if(r%f)\n            return 0;\n\n        return 1;\n    }\n\n    LLI &res= dp[pos][x][y][bit][r];\n\n\n    if(res!=-1&&x==1&&y==1)\n        return res;\n   // else\n        res=0;\n\n    int low,high;\n    low=0;\n    high=9;\n    if(x==0)\n        low=start[pos]-'0';\n    if(y==0)\n        high=ending[pos]-'0';\n        int no,nt,nth;\n    for(int i=low;i<=high;i++)\n    {\n\n          res+=solve(pos+1,x|(i>start[pos]-'0'),y|(i<ending[pos]-'0'),bit|(1<<(i-2)),(r*10+i)%mod);\n\n    //res%=mod;\n    }\n    //v=p;\nreturn res;\n}\n\nint main()\n{\n    int t;\n    SYN;\n   // cin>>k;\n   memset(lcm,-1,sizeof(lcm));\n   memset(dp,-1,sizeof(dp));\n      cin>>t;\n   //scanf(\"%d%lld\",&t,&k);\n    while(t--)\n    {\n\n       cin>>start>>ending;\n    // scanf(\"%s %s\",&start,&ending);\n        //sprintf(start,\"%d\",st);\n        //s23333printf(ending,\"%d\",ed);\n        int l1,l2;\n        l1=strlen(start);\n        l2=strlen(ending);\n        n=19;\n        int dif=(n-l1);\n\n        {\n            for(int j=l1-1;j>=0;j--)\n            {\n                start[j+dif]=start[j];\n            }\n            for(int i=0;i<dif;i++)\n                start[i]='0';\n        }\n        dif=(n-l2);\n\n        {\n            for(int j=l2-1;j>=0;j--)\n            {\n                ending[j+dif]=ending[j];\n            }\n            for(int i=0;i<dif;i++)\n                ending[i]='0';\n        }\n        //cout<<start<<endl;\n       // cout<<ending<<endl;\n       // memset(dp,-1,sizeof(dp));\n       // cout<<start<<\"   \"<<ed<<endl;\n        cout<<solve(0,0,0,0,0)<<endl;\n     }\n}\n\n", "lang": "GNU C++11", "bug_code_uid": "d7ed5842e94777b3300fc0a2b9ff8fbe", "src_uid": "37feadce373f728ba2a560b198ca4bc9", "apr_id": "8a26463da2eeb0dbe73d24fc0511223c", "difficulty": 2500, "tags": ["dp", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6884899683210137, "equal_cnt": 13, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 12, "bug_source_code": "//#include \"stdafx.h\"\n#include <iostream>\n#include <string>\n#include <map>\n#include <vector>\n#include <stdio.h>\n#include <string>\n#include <iomanip>\n#include <utility>\n#include <algorithm>\n#include <queue>\n#include <set>\n#include <cmath>\n#include <time.h>\n\ntypedef long long ll;\ntypedef long double ld;\nconst ll INF = 9999999999999;\n\n#define forn(ii,kk,nn) for(ll ii = kk; ii < nn; ++ii)\n\nusing namespace std;\nusing namespace std;\n\nvector<vector<int> > v;\nll n,k;\n\nint main()\n{\n    //freopen(\"area.in\",\"r\",stdin);\n     //freopen(\"area.out\",\"w\",stdout);\n   cin >> n >> k;\n   vector<ll> ans;\n   ans.push_back(1);\n   ll t = k;\n   forn(i,0,k)\n   {\n       ans.push_back(ans.back()-1+k);\n       k--;\n   }\n   forn(i,0,ans.size())\n   {\n       if(ans[i]==n)\n       {\n           cout << i << endl;\n           return 0;\n       }\n   }\n\n   cout << -1 << endl;\n    return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "f533c3d3f239a01bda51eac39a931f16", "src_uid": "83bcfe32db302fbae18e8a95d89cf411", "apr_id": "53f10dd120a99d8d4db12682cec8de86", "difficulty": 1700, "tags": ["math", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9994927076727964, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "#include<bits/stdc++.h>\n#include <cstring>\n#include <iostream>\n#define pie acos(-1)\n#define si(a) scanf(\"%d\",&a)\n#define sii(a,b) scanf(\"%d %d\",&a,&b)\n#define siii(a,b,c) scanf(\"%d %d %d\",&a,&b,&c)\n#define sl(a) scanf(\"%lld\",&a)\n#define sll(a,b) scanf(\"%lld %lld\",&a,&b)\n#define slll(a,b,c) scanf(\"%lld %lld %lld\",&a,&b,&c)\n#define ss(st) scanf(\"%s\",st)\n#define sch(ch) scanf(\"%ch\",&ch)\n#define ps(a) printf(\"%s\",a)\n#define newLine() printf(\"\\n\")\n#define pi(a) printf(\"%d\",a)\n#define pii(a,b) printf(\"%d %d\",a,b)\n#define piii(a,b,c) printf(\"%d %d %d\",a,b,c)\n#define pl(a) printf(\"%lld\",a)\n#define pll(a,b) printf(\"%lld %lld\",a,b)\n#define plll(a,b,c) printf(\"%lld %lld %lld\",a,b,c)\n#define pd(a) printf(\"%lf\",a)\n#define pdd(a,b) printf(\"%lf %lf\",a,b)\n#define pddd(a,b,c) printf(\"%lf %lf %lf\",a,b,c)\n#define pch(c) printf(\"%ch\",c)\n#define debug1(str,a) printf(\"%s=%d\\n\",str,a)\n#define debug2(str1,str2,a,b) printf(\"%s=%d %s=%d\\n\",str1,a,str2,b)\n#define debug3(str1,str2,str3,a,b,c) printf(\"%s=%d %s=%d %s=%d\\n\",str1,a,str2,b,str3,c)\n#define debug4(str1,str2,str3,str4,a,b,c,d) printf(\"%s=%d %s=%d %s=%d %s=%d\\n\",str1,a,str2,b,str3,c,str4,d)\n#define for0(i,n) for(i=0;i<n;i++)\n#define for1(i,n) for(i=1;i<=n;i++)\n#define forab(i,a,b) for(i=a;i<=b;i++)\n#define forstl(i, s) for (__typeof ((s).end ()) i = (s).begin (); i != (s).end (); ++i)\n#define NL puts(\"\")\n#define sd(a) scanf(\"%lf\",&a)\n#define sdd(a,b) scanf(\"%lf %lf\",&a,&b)\n#define sddd(a,b,c) scanf(\"%lf %lf %lf\",&a,&b,&c)\n#define SP printf(\" \")\n#define LL long long int\n#define ULL unsigned long long int\n#define MOD 1000000007\n#define pub(x) push_back(x)\n#define pob(x) pop_back(x)\n#define mem(ara,value) memset(ara,value,sizeof(ara))\n#define INF INT_MAX\n#define eps 1e-8\n#define checkbit(n, pos) (n & (1<<pos))\n#define setbit(n, pos) (n  (1<<pos))\n#define para(a,b,ara)\\\nfor(int i=a;i<=b;i++){\\\n    if(i!=0){printf(\" \");}\\\n    cout<<ara[i];\\\n}\\\nprintf(\"\\n\");\n#define pvec(vec)\\\nfor(int i=0;i<vec.size();i++){\\\n    if(i!=0){printf(\" \");}\\\n    cout<<vec[i];\\\n}\\\nprintf(\"\\n\");\n#define ppara(n,m,ara)\\\nfor(int i=0;i<n;i++){\\\n    for(int j=0;j<m;j++){\\\n        if(j!=0){printf(\" \");}\\\n        cout<<ara[i][j];\\\n    }\\\n    printf(\"\\n\");\\\n}\n#define ppstructara(n,m,ara)\\\nfor(int i=0;i<n;i++){\\\n    printf(\"%d:\\n\",i);\\\n    for(int j=0;j<m;j++){\\\n        cout<<ara[i][j];printf(\"\\n\")\\\n    }\\\n}\n#define ppvec(n,vec)\\\nfor(int i=0;i<n;i++){\\\n    printf(\"%d:\",i);\\\n    for(int j=0;j<vec[i].size();j++){\\\n        if(j!=0){printf(\" \");}\\\n        cout<<vec[i][j];\\\n    }\\\n    printf(\"\\n\");\\\n}\n#define ppstructvec(n,vec)\\\nfor(int i=0;i<n;i++){\\\n    printf(\"%d:\",i);\\\n    for(int j=0;j<vec[i].size();j++){\\\n        cout<<vec[i][j];printf(\"\\n\");\\\n    }\\\n}\n#define sara(a,b,ara)\\\nfor(int i=a;i<=b;i++){\\\n    scanf(\"%d\",&ara[i]);\\\n}\n#define pstructara(a,b,ara)\\\nfor(int i=a;i<=b;i++){\\\n    cout<<ara[i];NL;\\\n}\n#define pstructvec(vec)\\\nfor(int i=0;i<vec.size();i++){\\\n    cout<<vec[i];NL;\\\n}\n#define pstructstl(stl,x)\\\nfor(__typeof(stl.begin()) it=stl.begin();it!=stl.end();++it){\\\n    x=*it;\\\n    cout<<x;NL;\\\n}\\\nNL;\n#define pstl(stl)\\\nfor(__typeof(stl.begin()) it=stl.begin();it!=stl.end();++it){\\\n    if(it!=stl.begin()){SP;}\\\n    pi(*it);\\\n}\\\nNL;\n#define ppairvec(vec)\\\nfor(int i=0;i<vec.size();i++){\\\n    cout<<vec[i].first;SP;cout<<vec[i].second;printf(\"\\n\");\\\n}\n#define ppairara(a,b,ara)\\\nfor(int i=a;i<=b;i++){\\\n    cout<<ara[i].first;SP;cout<<ara[i].second;printf(\"\\n\");\\\n}\n#define pppairvec(n,vec)\\\nfor(int i=0;i<n;i++){\\\n    printf(\"%d:\",i);\\\n    for(int j=0;j<vec[i].size();j++){\\\n        cout<<vec[i][j].first;SP;cout<<vec[i][j].second;NL;\\\n    }\\\n}\n#define pppairara(n,m,ara)\\\nfor(int i=0;i<n;i++){\\\n    printf(\"%d:\\n\",i);\\\n    for(int j=0;j<m;j++){\\\n        cout<<ara[i][j].first;printf(\" \");cout<<ara[i][j].second;NL;\\\n    }\\\n}\n#define SZ 5*100010\n//std::ostream & dump(std::ostream &os)const{\n//    return os<<\"l=\"<<l\n//             <<\"r=\"<<r\n//             <<\"m=\"<<m;\n//}\n//std::ostream & operator<<(ostream &os,seg &s){\n//    return s.dump(os);\n//}\nusing namespace std;\n//bool status[1010];\n//vector <int> prime;\n//void siv(){\n//    int N=1005,i,j;prime.clear();\n//    int sq=sqrt(N);\n//    for(i=4;i<=N;i+=2){status[i]=1};\n//    for(i=3;i<=sq;i+=2){\n//        if(status[i]==0){\n//            for(j=i*i;j<=N;j+=i){status[j]=1;}\n//        }\n//    }\n//    status[1]=1;\n//    for1(i,N){\n//        if(!status[i]){prime.pub(i);}\n//    }\n//}\nstruct trie{\n    LL ara[100][2],sz;\n    bool isSuffix[100];\n    trie(){}\n    trie(LL _sz){\n        sz=_sz;\n        mem(ara,-1);\n        mem(isSuffix,false);\n    }\n    void insrt(LL root,char text[],LL pos){\n        if(text[pos]=='\\0'){isSuffix[root]=true;return;}\n        LL bit=text[pos]-'0';\n        if(ara[root][bit]!=-1){\n            insrt(ara[root][bit],text,pos+1);\n        }\n        else{\n            sz++;\n            ara[root][bit]=sz-1;\n            insrt(ara[root][bit],text,pos+1);\n        }\n    }\n    void print(LL root){\n        if(ara[root][0]!=-1){\n            pll(ara[root][0],0LL);NL;\n            print(ara[root][0]);\n        }\n        if(ara[root][1]!=-1){\n            pll(ara[root][1],1LL);NL;\n            print(ara[root][1]);\n        }\n    }\n}T;\nLL n,len;\nchar str[100];\nLL prefix[100];\nLL dp[42][42][870][2][2];\nvoid input(){\n    int i,j;\n    char text[100];\n    sl(n);\n    ss(str);\n    len=strlen(str);\n    T=trie(1);\n    for(i=1;i<=len-1;i++){\n        for(j=i;j<=len-1;j++){\n            text[j-i]=str[j];\n        }\n        text[j-i]='\\0';\n//        ps(text);NL;\n        T.insrt(0,text,0);\n    }\n//    T.print(0);\n}\nvoid pre(){\n    LL i,j,k;\n    prefix[0]=0;\n    for(k=-1,i=1;i<len;i++){\n        while(k>=0&&str[k+1]!=str[i]){k=prefix[k]-1;}\n        if(str[k+1]==str[i]){k++;}\n        prefix[i]=k+1;\n    }\n//    para(0,len-1,prefix);\n}\nLL re(LL pos,LL maxMatch,LL suffix,LL st,LL sufMask,bool f,bool done){\n    LL i,j,k,nxt,nwSuffix,nwSufMask;bool fChk,doneChk;\n    fChk=doneChk=false;\n    k=maxMatch-1;\n    if(pos==n){\n//        pi(f);NL;\n        if(f){return 1;}\n//        pll(sufMask,k+1);NL;\n        while(k+1!=0){\n            if(sufMask&(1LL<<(len-k-1))){return 1;}\n            k=prefix[k]-1;\n        }\n        return 0;\n    }\n    if(dp[pos][maxMatch][st][f][done]!=-1){return dp[pos][maxMatch][st][f][done];}\n    while(k>=0&&str[k+1]!='0'){k=prefix[k]-1;}\n    if(str[k+1]=='0'){k++;}\n    if(k+1==len){k=prefix[k]-1;fChk=true;}\n    if(done){\n        doneChk=done;\n        nwSuffix=suffix;\n        nxt=st;\n        nwSufMask=sufMask;\n    }\n    else{\n        if(T.ara[st][0]!=-1){\n            nxt=T.ara[st][0];\n            if(T.isSuffix[nxt]){nwSuffix=pos+1;}\n            else{nwSuffix=suffix;}\n            nwSufMask=sufMask|(1LL<<nwSuffix);\n            doneChk=done;\n        }\n        else{\n            doneChk=true;\n            nwSuffix=suffix;\n            nxt=st;\n            nwSufMask=sufMask;\n        }\n    }\n    LL s1=re(pos+1,k+1,nwSuffix,nxt,nwSufMask,f|fChk,done|doneChk);\n    fChk=doneChk=false;\n    k=maxMatch-1;\n    while(k>=0&&str[k+1]!='1'){k=prefix[k]-1;}\n    if(str[k+1]=='1'){k++;}\n    if(k+1==len){k=prefix[k]-1;fChk=true;}\n    if(done){\n        doneChk=done;\n        nwSuffix=suffix;\n        nxt=st;\n        nwSufMask=sufMask;\n    }\n    else{\n        if(T.ara[st][1]!=-1){\n            nxt=T.ara[st][1];\n            if(T.isSuffix[nxt]){nwSuffix=pos+1;}\n            else{nwSuffix=suffix;}\n            nwSufMask=sufMask|(1LL<<nwSuffix);\n            doneChk=done;\n        }\n        else{\n            doneChk=true;\n            nwSuffix=suffix;\n            nxt=st;\n            nwSufMask=sufMask;\n        }\n    }\n    LL s2=re(pos+1,k+1,nwSuffix,nxt,nwSufMask,f|fChk,done|doneChk);\n    return dp[pos][maxMatch][st][f][done]=s1+s2;\n}\nvoid solve(){\n    pre();\n//    para(0,len-1,prefix);\n    mem(dp,-1);\n    LL s=re(0,0,0,0,0,false,false);\n    pl(s);NL;\n//    para(0,len-1,prefix);\n}\nint main(){\n//    freopen(\"input.txt\",\"r\",stdin);\n    input();\n    solve();\n}\n", "lang": "GNU C++17", "bug_code_uid": "a390b12fc002e16443fe01a1c62ad99c", "src_uid": "0034806908c9794086736a2d07fc654c", "apr_id": "1c988c609d270e1cb38e055cab4e19d7", "difficulty": 2900, "tags": ["dp", "strings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.7762265656162745, "equal_cnt": 11, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 9, "fix_ops_cnt": 10, "bug_source_code": "#include<iostream>\n#include<cstring>\n#include<vector>\n#include<cmath>\n#include<cstdio>\n#include<cstdlib>\nusing namespace std;\n\n\nint main(){\n   int a[8],b[8];\n   int i,j,k,flag=1;\n   for(i=0;i<8;i++){cin>>a[i]>>b[i];}\n   //should  be 3 vals of x and y each with mid not available\n   int x[3]={-1,-1,-1};\n   int y[3]={-1,-1,-1};;\n   //for x\n   j=0;\n   for(i=0;i<8;i++)\n   {if(a[i]!=x[0] && a[i]!=x[1] && a[i]!=x[2]) \n   {if(j<3){x[j++]=a[i];}\n    else flag=0;\n    }\n}\n//cout<<x[0]<<x[1]<<x[2];\n    //for y\n     j=0;\n   for(i=0;i<8;i++)\n   {\n   if(b[i]!=y[0] && b[i]!=y[1] && b[i]!=y[2]) \n   {if(j<3){y[j++]=b[i];}\n    else flag=0;\n    }\n}//cout<<\"mid\"<<flag;\n    sort(x,x+3);\n    sort(y,y+3);\n    int midx,midy;\n    midx=x[0]+x[2];\n    midy=y[0]+y[2];\n    //midx/2 and midy/2 shouldnot be there in eight list\n    for(i=0;i<8;i++)\n    {if(2*a[i]==midx){if(2*b[i]==midy) flag=0;}\n    }\n    if(flag==1)cout<<\"respectable\";\n    else cout<<\"ugly\";\n \n//system(\"pause\");\n\nreturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "83cac7aa9673188e760f60ddfbb07336", "src_uid": "f3c96123334534056f26b96f90886807", "apr_id": "2ebc0834c75f70623d9749d6767b42bc", "difficulty": 1400, "tags": ["sortings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.558277027027027, "equal_cnt": 47, "replace_cnt": 37, "delete_cnt": 5, "insert_cnt": 4, "fix_ops_cnt": 46, "bug_source_code": "#include <iostream>\n\nusing namespace std;\nint matk , mdef , mhp, atk , def , hp , a , b , c;\n\nbool can_win( int a1 , int b1 , int c1 )\n{\n    int ma=mhp,mb=matk,mc=mdef;\n    b1-=mc;\n    mb-=c1;\n    if(mb<=0&&b1<=0)\n        return 0;\n    while(a1>0&&ma>0)\n    {\n        a1-=mb;\n        ma-=b1;\n    }\n    if(a1<=0)\n        return 0;\n    else\n        return 1;\n}\nconst int N=400;\nlong long dp[N][N][N];\n\nint main()\n{\n    cin>>hp>>atk>>def;\n    cin>>mhp>>matk>>mdef;\n    cin>>a>>b>>c;\n    long long answer=1e9;\n    dp[hp][atk][def]=0;\n    if(can_win(hp,atk,def))\n    {\n        cout<<0<<endl;\n        return 0;\n    }\n    for(int i=hp;i<N;i++)\n    {\n        if(i!=hp)\n            dp[i][atk][def]=dp[i-1][atk][def]+a;\n        for(int j=atk;j<N;j++)\n        {\n            if(j!=atk)\n                dp[i][j][def]=dp[i][j-1][def]+b;\n            for(int k=def;k<N;k++)\n            {\n                if(k!=def)\n                    dp[i][j][k]=dp[i][j][k-1]+c;\n                if(can_win(i,j,k))\n                {\n                    if(answer>dp[i][j][k])\n                        {\n                            answer=dp[i][j][k];\n                        }\n\n                }\n            }\n        }\n    }\n    cout<<answer<<endl;\n    return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "eb484bc0d82abfa511839b59d06f28e6", "src_uid": "bf8a133154745e64a547de6f31ddc884", "apr_id": "5697d8f094433496dea1f1b992f5e4e1", "difficulty": 1800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.4713896457765668, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include<iostream>\nusing namespace std;\n\nint sumMin(int n, int m, int a, int b)\n{\n    if ( n == 0 )\n        return 0;\n\n    int sol1 = a + sumMin(n-1, m, a, b);\n    int sol2 = b + sumMin(n-m, m, a, b);\n    return min(sol1, sol2);\n}\n\nint main()\n{\n    int n, m, a, b;\n    cin >> n >> m >> a >> b;\n\n\n    cout << sumMin(n, m, a, b) << endl;\n\n    //int k;\n    //cin >> k;\n\n    return 0;\n}", "lang": "GNU C++", "bug_code_uid": "e3e7fa096c5a3c066273219ac26bbad1", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "apr_id": "8d9b90e2acd9ccdf9080d551bf404691", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.0688912809472551, "equal_cnt": 13, "replace_cnt": 11, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 13, "bug_source_code": "#include\"stdio.h\"\n#include\"string.h\"\n#include\"queue\"\nusing namespace std;\n#define N 105\nstruct node\n{\n    __int64 x,cnt;\n    char c[20];\n    friend bool operator<(node a,node b)\n    {\n        return a.x>b.x;\n    }\n};\n__int64 bfs(char *s,int k)\n{\n    queue<node >q;\n    node cur,next;\n    int len=strlen(s),i,j;\n    char ch;\n    __int64 max=0;\n    strcpy(cur.c,s);\n    cur.cnt=k;\n    cur.x=0;\n    for(i=0;i<len;i++)\n    {\n        cur.x*=10;\n        cur.x+=s[i]-'0';\n    }\n    q.push(cur);\n    while(!q.empty())\n    {\n        cur=q.front();\n        q.pop();\n        if(cur.cnt<0)\n            continue;\n        if(cur.x>max)\n            max=cur.x;\n        for(i=0;i<len-1;i++)\n        {\n            if(cur.c[i]>=cur.c[i+1])\n                continue;\n            strcpy(next.c,cur.c);\n            ch=next.c[i];\n            next.c[i]=next.c[i+1];\n            next.c[i+1]=ch;\n            next.x=0;\n            next.cnt=cur.cnt-1;\n            for(j=0;j<len;j++)\n            {\n                next.x*=10;\n                next.x+=next.c[j]-'0';\n            }\n            q.push(next);\n        }\n    }\n    printf(\"%I64d\\n\",max);\n}\nint main()\n{\n    int k,i;\n    int a[N];\n    char str[N];\n    __int64 n,max;\n    while(scanf(\"%s %d\",str,&k)!=-1)\n    {\n        bfs(str,k);\n    }\n    return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "0408ffa7f99c13d95a0f5f00d154e754", "src_uid": "e56f6c343167745821f0b18dcf0d0cde", "apr_id": "4ab14e4f2fb454174952d1d634f5ed8c", "difficulty": 1400, "tags": ["greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9494640122511485, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include <iostream>\n\nusing namespace std;\n\nint main()\n{\n    int k,s=0,n,m,a,b;\n    cin >> n >> m >> a >> b ;\n    float t,x=m,y=b;\n    t=y/x;\n    if (t>=a||a*n<b)\n    {\n        k=0;\n    }\n    else\n    {\n        k=1;\n    }\n    if (k==1)\n    {\n        if (b<a)\n        {\n            if (n%m==0)\n            {s=b*(n/m);}\n            if (n%m>0)\n            {\n                s=b*(n/m)+b;\n            }\n        }\n        else if ((n%(((n/m)*m))*a)<b)\n        {s=((n/m)*b)+(n%(((n/m)*m))*a);}\n        else\n        {\n            s=((n/m)*b)+b;\n        }\n    }\n    else\n    {\n        s=n*a;\n    }\n    cout << s ;\n    return 0;\n}\n", "lang": "MS C++", "bug_code_uid": "c2401172c363685a00c3e20ef250e1d0", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "apr_id": "37a32ec84863596fd1b1b6f6f3dd1770", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.7966706302021404, "equal_cnt": 11, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 11, "bug_source_code": "#include <iostream>\nusing namespace std;\nint main(){\n\tint k;\n\tcin>>k;\n\twhile (k == 1){\n\t\tchar S[4][5];\n\t\tint count[10] = { 0 };\n\t\tbool ans = true;\n\t\tfor (int i = 0; i < 4; i++){\n\t\t\tcin>>S[i];\n\t\t\tfor (int j = 0; j < 4; j++){\n\t\t\t\tif (S[i][j] != '.')\n\t\t\t\t\tcount[S[i][j] - '0']++;\n\t\t\t}\n\t\t}\n\t\tfor (int i = 1; i <= 9; i++){\n\t\t\tif (count[i]>k * 2)\n\t\t\t\tans = false;\n\t\t}\n\t\tif (ans)\n\t\t\tcout<<\"YES\";\n\t\telse\n\t\t\tcout<<\"NO\";\n\t}\n\treturn 0;\n}", "lang": "GNU C++", "bug_code_uid": "fcf059bea9c8c38f7d6a5b9d29b746be", "src_uid": "5fdaf8ee7763cb5815f49c0c38398f16", "apr_id": "a9f5e25c889fdd4c20281c767b88b6a1", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.14516129032258066, "equal_cnt": 20, "replace_cnt": 19, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 20, "bug_source_code": "#include <stdio.h>\nusing namespace std ;\nint main ()\n{    int a[16];\n     int b[10] = {0};\n     int k;\n     scanf(\"%d\",k);\n     for ( int i=0;i<16;i++){\n          scanf(\"%d\",a[i]) ;\n          b[a[i]]++;\n        }\n     \n     for(int i=0;i<10;i++){\n        if(b[i] > 2*k) {\n            printf(\"NO\");\n            return 0 ; }\n        }\n     printf(\"YES\");\n     return 0;\n       }", "lang": "GNU C++", "bug_code_uid": "722538d7a4bd003be5c5cc850ccc4684", "src_uid": "5fdaf8ee7763cb5815f49c0c38398f16", "apr_id": "7b7f81c41c1bebbe71653ae6771607d7", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9544072948328267, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n\nint main() {\n    ios_base::sync_with_stdio(false);\n    cin.tie(NULL);\n    cout.tie(NULL);\n\tint n;\n\tcin>>n;\n\tif(n==2){\n\t    cout<<\"WHITE\\n\";\n\t    cout<<1<<\" \"<<2<<\"\\n\";\n\t}\n\telse if(n%2==0){\n\t    cout<<\"WHITE\\n\";\n\t    cout<<1<<\" \"<<2<<\"\\n\";\n\t}\n\telse\n\t    cout<<\"BLACK\\n\";\n\treturn 0;\n}", "lang": "GNU C++17", "bug_code_uid": "8073c5622e6b10ffe5fecaab5717fd1f", "src_uid": "52e07d176aa1d370788f94ee2e61df93", "apr_id": "6e2c2a87e6e50116a09a4968f8a55eec", "difficulty": 1700, "tags": ["math", "games", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.21363636363636362, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "#include <iostream>\n#include <algorithm>\n#include <set>\n#include <string>\n#include <stdio.h>\nusing namespace std;\n\nset <string> s;\n\nvoid generate(int n) {\n\tstring temp = \"\";\n\t\n\tfor(int i = 1; i <= n; i++){\n\t\ttemp += '7';\n\t\t\n\t\tfor(int j = 0; j < i; j++){\n\t\t\ttemp[j] = '7';\n\t\t\ts.insert(temp);\n\t\t}\n\t\t\n\t\tfor(int j = 0; j < i; j++){\n\t\t\ttemp[0] = '8';\n\t\t\tsort(temp.begin(), temp.end());\n\t\t\tdo{\n\t\t\t\ts.insert(temp);\n\t\t\t}while(next_permutation(temp.begin(), temp.end()));\n\t\t}\n\t\t\n\t}\n}\n\nint main() {\n\tint n;\n\tscanf(\"%d\", &n);\n\n\tgenerate(n);\n\n\tprintf(\"%d\\n\", s.size());\n\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "80c6d2ece40b5774210c1cd61dc5be85", "src_uid": "f1b43baa14d4c262ba616d892525dfde", "apr_id": "cc7a4fe833f337f774e4ac44ae2b3add", "difficulty": 1100, "tags": ["math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8687916975537435, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\ntypedef long long ll;\nll b,xk,x;\nll sil[10000001];\nbool czysil[10000001];\nfloat m;\nll slab(ll n)\n{\nif(czysil[n])return sil[n];\nelse{\n\t\tll s=0;\n\n\tfor(int i=0;i<=n;i++)\n\t\t{\n\t\t\ts=s+i;\n\t\t\tif(czysil[i]==0){\n\t\t\tczysil[i]=1;\n\t\t\tsil[i]=s;\n\t\t}\n\t\t}\t\n\treturn s;\n}\n}\nvector <ll> ynp;\nint main()\n{\n\tscanf(\"%f %lld\",&m,&b);\n\txk=m*b;\n\tfor(int i=0;i<=xk;i++)\n\t{\n\t\tynp.push_back(-(float)(i/m)+b);\n\t}\n\t//for(int i=0;i<ynp.size();i++)cout<<ynp[i]<<\" \";\n\t\t//cout<<endl<<slab(5);\n\tll max=0;\n\tfor(int i=0;i<=xk;i++)\n\t{\n\t\tif((slab(i)*(ynp[i]+1)+slab(ynp[i])*(i+1))>max)\n\t\t\t{\n\t\t\t\tmax=slab(i)*(ynp[i]+1)+slab(ynp[i])*(i+1);\n\t\t\t\t//cout<<\"weszlo dla i: \"<<i<<endl;\n\t\t\t}\n\t}\n\t//cout<<endl;\n\tprintf(\"%lld\",max);\n\treturn 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "3ed43a520884974e53168af7662b0c93", "src_uid": "9300f1c07dd36e0cf7e6cb7911df4cf2", "apr_id": "3bf15ff38eeb4e70dfb0a143908c6483", "difficulty": 1300, "tags": ["math", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.6150506512301013, "equal_cnt": 11, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 10, "bug_source_code": "#include <bits/stdc++.h>\n\n#define loop(i, n) for(int i = 0; i < n; i++)\n#define loop1(i, a, n) for(int i = a; i < n; i++)\n#define PI 3.141592653589793238\n#define bc __builtin_popcountll\n#define pf push_front\n#define pb push_back\n#define rf pop_front\n#define rb pop_back\n#define fs first\n#define sc second\n#define mp make_pair\n#define fi ios_base::sync_with_stdio(false); cin.tie(NULL)\n\nusing namespace std;\ntypedef long long ll;\ntypedef unsigned long long ull;\nconst ll M = 1e9 + 7;\nconst ll INF = 1e9;\ninline ll pwr(ll base, ll n, ll m) {ll ans = 1;while( n > 0 ) {if ( n % 2 == 1 )ans = (ans * base) % m; base = (base * base) % m;n/=2;}return ans;}\n\nll x, sum;\nmap< ll, ll > dp[45];\n\nll rec( int i ) {\n    if( sum == 0 ) {\n        if( x != 0 ) return 0;\n        return 1;\n    }\n    if( sum < 0 || (1LL<<i) > sum ) return 0;\n\n    if( dp[i][sum] != 0 ) return dp[i][sum] - 1;\n    ll temp = (1LL<<i);\n    \n    if( temp & x ) {\n        x -= temp;\n        sum -= temp;\n        ll w = rec(i+1);\n        sum += temp;\n        dp[i][sum] = (w*2) + 1;\n        x += temp;\n        return dp[i][sum] - 1;\n    } else {\n        ll w = rec(i + 1);\n        sum -= (temp*2);\n        w += rec(i + 1);\n        sum += (temp*2);\n        dp[i][sum] = w+1;\n        return w;\n    }\n}\n\nint main() {\n    fi;\n\n    #ifndef ONLINE_JUDGE\n    freopen( \"input.txt\", \"r\", stdin );\n    freopen( \"output.txt\", \"w\", stdout );\n    #endif\n\n    cin >> sum >> x;\n    ll ans;\n    if( x == sum ) ans = -2;\n    else ans = 0;\n\n    cout << ans + rec(0);\n    \n    return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "6c889bb90b1d1329e66018cf960e6206", "src_uid": "18410980789b14c128dd6adfa501aea5", "apr_id": "9d5700910c0be6d88f81f4e969e0fbaa", "difficulty": 1700, "tags": ["dp", "math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9412276882890727, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include <algorithm>\n#include <cmath>\n#include <cstdio>\n#include <cstdlib>\n#include <cstring>\n#include <iomanip>\n#include <iostream>\n#include <list>\n#include <map>\n#include <queue>\n#include <set>\n#include <stack>\n#include <string>\n#include <vector>\n#define eps 1e-9\n#define PI acos(-1)\n#define INF 0x3f3f3f3f\nusing namespace std;\ntypedef long long LL;\nconst int MOD = 1000000007;\nconst long long LINF = 4611686018427387903;\nconst int dir4[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};\nconst int dir8[8][2] = {{1, 0}, {0, 1},   {-1, 0}, {0, -1},\n                        {1, 1}, {-1, -1}, {1, -1}, {-1, 1}};\nconst int dir63[6][3] = {{0, 0, 1},  {0, 0, -1}, {0, 1, 0},\n                         {0, -1, 0}, {1, 0, 0},  {-1, 0, 0}};\nconst int daym[2][13] = {{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},\n                         {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}};\nint GCD(int a, int b) { return b ? GCD(b, a % b) : a; }\n// freopen(\"*.in\", \"r\", stdin);\n// freopen(\"*.out\", \"w\", stdout);\n\nint main() {\n    int n;\n    scanf(\"%d\", &n);\n    cout << (n / 2 + 1) * (n + 1) / 2 << endl;\n    return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "83bea3d95ff1ec2e87125539b6ae4830", "src_uid": "f8af5dfcf841a7f105ac4c144eb51319", "apr_id": "94fd002b8bb7e40c1f7c492f543ed19c", "difficulty": 1300, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9994858611825193, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include <iostream>\n#include<cstdio>\n#include<cstdlib>\n#include<cmath>\n#include<cstring>\n#include<algorithm>\n#include<map>\nusing namespace std;\nstruct p\n{\n    int l,r;\n    int flag;\n    int ge;\n} x[1010];\nint cmp(struct p a,struct p b)\n{\n    if(a.l!=b.l)\n        return a.l<b.l;\n    else\n        return a.r<b.r;\n}\nint main()\n{\n    int n,i,j;\n    scanf(\"%d\",&n);\n    memset(x,0,sizeof(x));\n    int t=n*(n+1)/2;\n    int z=0;\n    for(i=0; i<=n-1; i++)\n        for(j=i+1; j<=n; j++)\n        {\n            x[z].l=i;\n            x[z++].r=j;\n        }\n    sort(x,x+z,cmp);\n    for(i=t-1; i>=0; i--)\n    {\n        if(x[i].flag==0)\n        {\n            int l=x[i].l;\n            for(j=i-1; j>=0; j--)\n                if(x[j].flag==0&&x[j].r==l)\n                {\n                    l=x[j].l;\n                    x[j].flag=1;\n                }\n        }\n    }\n    int ge=0;\n    for(i=0; i<=t-1; i++)\n    {\n        if(x[i].flag==0)\n            ge++;\n    }\n    printf(\"%d\\n\",ge);\n}\n", "lang": "GNU C++17", "bug_code_uid": "bb6ec1f335bed3760f0b351fbd6dce1b", "src_uid": "f8af5dfcf841a7f105ac4c144eb51319", "apr_id": "db0f26c7e478728900ff473ffb9fff22", "difficulty": 1300, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.982767274552451, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "//#define _GLIBCXX_DEBUG\n\n#include<bits/stdc++.h>\nusing namespace std;\n\n#define endl '\\n'\n#define lfs cout<<fixed<<setprecision(10)\n#define ALL(a)  (a).begin(),(a).end()\n#define ALLR(a)  (a).rbegin(),(a).rend()\n#define spa << \" \" <<\n#define fi first\n#define se second\n#define MP make_pair\n#define MT make_tuple\n#define PB push_back\n#define EB emplace_back\n#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)\n#define rrep(i,n,m) for(ll i = (ll)(m) - 1; i >= (ll)(n); i--)\nusing ll = long long;\nusing ld = long double;\nconst ll MOD1 = 1e9+7;\nconst ll MOD9 = 998244353;\nconst ll INF = 1e18;\nusing P = pair<ll, ll>;\ntemplate<typename T1, typename T2>bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}\ntemplate<typename T1, typename T2>bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}\nll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}\nvoid ans1(bool x){if(x) cout<<\"Yes\"<<endl;else cout<<\"No\"<<endl;}\nvoid ans2(bool x){if(x) cout<<\"YES\"<<endl;else cout<<\"NO\"<<endl;}\nvoid ans3(bool x){if(x) cout<<\"Yay!\"<<endl;else cout<<\":(\"<<endl;}\ntemplate<typename T1,typename T2>void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  \ntemplate<typename T>void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++){cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};\nvoid debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++){for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};\ntemplate<typename T>void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};\ntemplate<typename T>vector<vector<T>>vec(ll x, ll y, T w){vector<vector<T>>v(x,vector<T>(y,w));return v;}\nll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}\nvector<ll>dx={1,-1,0,0,1,1,-1,-1};vector<ll>dy={0,0,1,-1,1,-1,1,-1};\ntemplate<typename T>vector<T> make_v(size_t a,T b){return vector<T>(a,b);}\ntemplate<typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v(ts...))>(a,make_v(ts...));}\ntemplate<typename T1, typename T2>ostream &operator<<(ostream &os, const pair<T1, T2>&p){return os << p.first << \" \" << p.second;}\ntemplate<typename T>ostream &operator<<(ostream &os, const vector<T> &v){for(auto &z:v)os << z << \" \";cout<<\"|\"; return os;}\n//mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());\nint popcount(ll x){return __builtin_popcountll(x);};\nint poplow(ll x){return __builtin_ctzll(x);};\nint pophigh(ll x){return 63 - __builtin_clzll(x);};\n\nint main(){\n  cin.tie(nullptr);\n  ios_base::sync_with_stdio(false);\n  ll res=0,buf=0;\n  bool judge = true;\n  ll n,k;cin>>n>>k;\n  vector<ll>dp(n+1);\n  dp[n]=1;\n  rrep(i,0,n){\n    rep(j,i+1,n+1)dp[i]+=dp[j];\n  }\n  //debug(dp,5);\n  vector<ll>ret;\n  ll idx=0;\n  k--;\n  while(idx<n){\n    ll nxt=idx;\n    //cout<<k spa (1<<n-idx-2)<<endl;\n    while(idx!=n-1&&k>=(1<<n-idx-2)){\n      nxt++;\n      k-=1<<n-idx-1;\n    }\n    ret.PB(nxt+1);\n    rep(i,idx,nxt)ret.PB(i+1);\n    idx=nxt+1;\n  }\n  debug(ret,ret.size());\n  return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "745b6774689597e9ef188d3bdac82622", "src_uid": "e03c6d3bb8cf9119530668765691a346", "apr_id": "802d518bfb5e4db8c5ac1f65b00bf4a3", "difficulty": 1900, "tags": ["combinatorics", "greedy", "math", "implementation", "constructive algorithms", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8865979381443299, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint main()\n{\n\tint n,x,xx,xxx;\n\tcin >> x >> xx >> xxx;\n\tcout << (x+xx+xxx)/n << endl;\n}\n", "lang": "GNU C++17", "bug_code_uid": "80b714fe234be15de0ccb6f613ed77af", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "apr_id": "494316de81eae6f7978d5574244d3aee", "difficulty": 800, "tags": ["math", "sortings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "#include <bits/stdc++.h>\n#include <algorithm>\n\nusing namespace std; \n\nint main () {\n    vector<int> v;\n    for (int i = 0; i < 3; i++)\n    {\n        cin >> v[i];\n    }\n\n    sort(v.begin(), v.end());\n    cout << v[2] - v[0] << endl;\n    return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "51badd71877fce9b9e7ecdc8d314c8d7", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "apr_id": "5510d9e6b696210150e0c6b2ba34a3c3", "difficulty": 800, "tags": ["math", "sortings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9676443906864227, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#include <bits/stdc++.h>\n#pragma GCC target \"avx,avx2\"\n\nusing namespace std;\n\nconst int MAX_N = 2 * 1e5 + 42;\nvector < int > gr[MAX_N];\nvector < int > rev_gr[MAX_N];\nint p[MAX_N];\nint dist[MAX_N];\nconst int INF = 1e6 + 42;\n\nvoid bfs(int start) {\n    dist[start] = 0;\n    queue < int > q;\n    q.push(start);\n    while (!q.empty()) {\n        int v = q.front();\n        q.pop();\n        for (auto u : rev_gr[v]) {\n            if (dist[u] < dist[v] + 1) {\n                continue;\n            }\n            dist[u] = dist[v] + 1;\n            q.push(u);\n        }\n    }\n}\n\nsigned main() {\n    //freopen(\"input.txt\", \"r\", stdin);\n    ios_base::sync_with_stdio(0);\n    cin.tie(0);\n    cout.tie(0);\n    int n, m;\n    cin >> n >> m;\n    for (int i = 0; i < m; i++) {\n        int v, u;\n        cin >> v >> u;\n        v--;\n        u--;\n        gr[v].push_back(u);\n        rev_gr[u].push_back(v);\n    }\n    int k;\n    cin >> k;\n    for (int i = 0; i < k; i++) {\n        cin >> p[i];\n        p[i]--;\n    }\n    fill(dist, dist + n, INF);\n    bfs(p[k - 1]);\n    int mn = 0;\n    for (int i = 0; i < k - 1; i++) {\n        int v = p[i];\n        int u = p[i + 1];\n        if (dist[v] != dist[u] + 1) {\n            mn++;\n        }\n    }\n    int mx = 0;\n    for (int i = 0; i < k - 1; i++) {\n        int v = p[i];\n        int u = p[i + 1];\n        int c = -1;\n        for (auto x : gr[v]) {\n            if (x == u) {\n                continue;\n            }\n            if (dist[x] != dist[v] - 1) {\n                continue;\n            }\n            c = x;\n        }\n        if (c != -1) {\n            mx++;\n        }\n    }\n    cout << mn << \" \" << mx;\n    return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "7fae7aaef6e3dc8ecc21bd56a7c1e359", "src_uid": "19a0c05eb2d1559ccfe60e210c6fcd6a", "apr_id": "1433403eb55089ce9ba03c678abaed4b", "difficulty": null, "tags": ["graphs", "shortest paths"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9367088607594937, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 5, "bug_source_code": "#include\"iostream\"\n#include\"algorithm\"\n#include\"cstdio\"\n#include\"cstring\"\n#include\"queue\"\nusing namespace std;\nint main()\n{\n    int a[3];\n    while(1)\n    {\n        int k=1;\n        for(int i=0;i<3;i++)\n        {\n            cin>>a[i];\n            a[i]/=k;\n            k*=2;\n        }\n        sort(a,a+3);\n        cout<<a[0]*7<<endl;\n    }\n    return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "9d23b4e3c5ad837e20fb7127c70b285e", "src_uid": "82a4a60eac90765fb62f2a77d2305c01", "apr_id": "f9fc2231b4cee16a7a729f0085737ed0", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.30330882352941174, "equal_cnt": 22, "replace_cnt": 8, "delete_cnt": 4, "insert_cnt": 10, "fix_ops_cnt": 22, "bug_source_code": "#include <bits/stdc++.h>\n#define int long long \nusing namespace std;\n\n\nint n, m;\n\n\nint dp[1 << 6][1 << 6][1 << 6][6][40];\n\n\nint f(int mask1, int mask2, int mask3, int idx, int idy) {\n\tif(idy < 0) return 0;\n\tif(idx < 0) {\n\t\treturn f(mask2, mask3, 0, m - 1, idy - 1);\n\t}\n\tif(~dp[mask1][mask2][mask3][idx][idy]) return dp[mask1][mask2][mask3][idx][idy];\n\t\n\tif((mask2 >> idx) & 1) {\n\t\treturn 1 + f(mask1, mask2, mask3, idx - 1, idy);\n\t} \n\tint res = 1 + f(mask1, mask2 | (1 << idx), mask3, idx - 1, idy);\n\n\tif(idy < n - 1) res = min(res, ((mask1 >> idx) & 1) + f(mask1 | (1 << idx), mask2, mask3, idx - 1, idy));\n\n\tif(idx > 0) res = min(res, ((mask2 >> (idx - 1)) & 1) + f(mask1, mask2 | (1 << (idx - 1)), mask3, idx - 1, idy));\n\n\tif(idx < m - 1) res = min(res, ((mask2 >> (idx + 1)) & 1) + f(mask1, mask2 | (1 << (idx + 1)), mask3, idx - 1, idy));\n\n\tif(idy > 0) res = min(res, f(mask1, mask2, mask3 | (1 << idx), idx - 1, idy));\n\n\treturn dp[mask1][mask2][mask3][idx][idy] = res;\n}\n\n\nint32_t main() {\n\tios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);\n\tcin >> n >> m;\n\tif(n < m) swap(n, m);\n\n\tmemset(dp, -1, sizeof dp);\n\tcout << n * m - f(0, 0, 0, m - 1, n - 1) << endl;\n}", "lang": "GNU C++14", "bug_code_uid": "b8aa402d4eec1f57f0c235533483a832", "src_uid": "097674b4dd696b30e102938f71dd39b9", "apr_id": "48d5ee7e7a76dd9e88438e094a9dc546", "difficulty": 2100, "tags": ["dp", "bitmasks", "dsu"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9722373434948285, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 8, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\n#define F first \n#define S second \n#define mp make_pair\nint const lim =  1e5+3;\nint const MLOG = 20;\nint mod = 1e9+7,n,m;\nint dp[41][(1<<7)][(1<<7)][(1<<7)];\nint f(int a,int i)\n{\n\tif(a&(1<<i))return a^(1<<i);\n\treturn a;\n}\nint solve(int ind,int a,int b,int c)\n{\n\tif(ind==n)return 0;\n\tint &ret = dp[ind][a][b][c];\n\tif(ret!=-1)return ret;\n\tret = INT_MAX/2;\n\tif(a==0)return ret = solve(ind+1,b,c,(1<<m)-1);\n\tfor(int i = 0;i<m;i++)\n\t{\n\t\tif((1<<i)&a)\n\t\t{\n\t\t\tif(i+1<m)ret = min(ret,solve(ind,f(a,i)&f(a,i+1)&f(a,i+2),b,c)+1);\n\t\t\tret = min(ret,solve(ind,f(a,i)&f(a,i+1),f(b,i),c)+1);\n\t\t\tif(ind+1<n)ret = min(ret,solve(ind,f(a,i),f(b,i),f(c,i))+1);\n\t\t}\n\t}\n\treturn ret;\n}\nint main()\n{\n\t//freopen(\"input\",\"r\",stdin);\n\t//freopen(\"output\",\"w\",stdout);\n\tmemset(dp,-1,sizeof dp);\n\tcin >> n >> m;\n\tif(m>n)swap(n,m);\n\tcout << n*m-solve(0,(1<<m)-1,(1<<m)-1,(1<<m)-1)<<endl;\n}", "lang": "GNU C++14", "bug_code_uid": "42859baef93fabc23d617b688e255467", "src_uid": "097674b4dd696b30e102938f71dd39b9", "apr_id": "5df5ae14f2501ad90236fa43c79340c2", "difficulty": 2100, "tags": ["dp", "bitmasks", "dsu"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.7629752066115703, "equal_cnt": 31, "replace_cnt": 13, "delete_cnt": 13, "insert_cnt": 4, "fix_ops_cnt": 30, "bug_source_code": "#include <cstdio>\n#include <cstdlib>\n#include <cstring>\n#include <algorithm>\n#include <iostream>\n#include <cmath>\n#include <vector>\n#include <string>\n#include <queue>\n\nusing namespace std;\n\ntypedef long long LL;\ntypedef pair<int, int> PII;\n\nconst int maxn = 15;\nconst int mod = 1000000000;\n\nint a[maxn][maxn];\nint now[maxn][maxn];\nint n, m, num;\nint ans;\nLL goal;\n\nvoid dfs(int x, int y, LL s, int step)\n{\n    if (step >= ans)\n        return ;\n    if (s == goal)\n    {\n        ans = min(ans, step);\n        return ;\n    }\n    if (y == m)\n    {\n        dfs(x + 1, 0, s, step);\n        return ;\n    }\n    if (x == n)\n        return ;\n    if (now[x][y] != -1)\n    {\n        dfs(x, y + 1, s, step);\n        return ;\n    }\n    for (int i = 0; i < num; i++)\n    {\n        if (s & (1LL << i))\n            continue;\n        if (y + 1 < m && now[x][y+1] == -1)\n        {\n            now[x][y] = now[x][y+1] = i;\n            dfs(x, y + 1, s | (1LL << i), step + (now[x][y] != a[x][y]) + (now[x][y+1] != a[x][y+1]));\n            now[x][y] = now[x][y+1] = -1;\n        }\n        if (x + 1 < n && now[x+1][y] == -1)\n        {\n            now[x][y] = now[x+1][y] = i;\n            dfs(x, y + 1, s | (1LL << i), step + (now[x][y] != a[x][y]) + (now[x+1][y] != a[x+1][y]));\n            now[x][y] = now[x+1][y] = -1;\n        }\n    }\n}\n\nint main()\n{\n    //freopen(\"input.txt\",\"r\",stdin);\n    scanf (\"%d %d\", &n, &m);\n    for (int i = 0; i < n; i++)\n        for (int j = 0; j < m; j++)\n        {\n            scanf (\"%d\", &a[i][j]);\n            a[i][j]--;\n        }\n    num = n * m / 2;\n    ans = mod;\n    goal = (1LL << num) - 1;\n    memset(now, -1, sizeof(now));\n    dfs(0, 0, 0, 0);\n    printf (\"%d\\n\", ans);\n    return 0;\n}", "lang": "MS C++", "bug_code_uid": "4c5ee26dadfbfbfcd041c3a3ea9cac3e", "src_uid": "1f0e8bbd5bf4fcdea927fbb505a8949b", "apr_id": "eb5270d57095161002404d4d092edebf", "difficulty": 2200, "tags": ["flows"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.757915898810521, "equal_cnt": 25, "replace_cnt": 12, "delete_cnt": 9, "insert_cnt": 3, "fix_ops_cnt": 24, "bug_source_code": "#include<map>\n#include<set>\n#include<cmath>\n#include<queue>\n#include<stack>\n#include<ctime>\n#include<vector>\n#include<cstdio>\n#include<vector>\n#include<string>\n#include<bitset>\n#include<cstdlib>\n#include<iomanip>\n#include<cstring>\n#include<iostream>\n#include<algorithm>\nusing namespace std;\ninline int read(){\n    int res=0,f=1;\n    char ch=getchar();\n    while(!isdigit(ch)){\n        if(ch=='-')\n            f=-f;\n        ch=getchar();\n    }\n    while(isdigit(ch)){\n        res=(res<<1)+(res<<3)+(ch^48);\n        ch=getchar();\n    }\n    return res*f;\n}\ninline void write(int x){\n    if(x<0){\n        putchar('-');\n        x=-x;\n    }\n    if(x>9)\n        write(x/10);\n    putchar(x%10+'0');\n}\nconst int MAXN=1e7+5;\nconst double EPS=1e-6;\nconst double PI=acos(-1);\nlong long mod=1e9+7;\nint m,k,l,r,T,len,c,h,w,cnt;\nint arr[100005];\nint ans;\nbool isprimer[MAXN];\nint su[100000005];\nvoid prime() {\n    cnt = 1;\n    memset(isprimer, 1, sizeof isprimer);\n    isprimer[0] = isprimer[1] = 0;\n    for (long long i = 2; i < MAXN; i++) {\n        if (isprimer[i])\n        {\n            su[cnt++] = i;\n        }\n        for (long long j = 1; j < cnt && su[j] * i < MAXN; ++j)\n        {\n            isprimer[su[j] * i] = 0;\n        }\n    }\n}\nbool isPrimer(long long x){\n    for(long long i=2,lll=sqrt(x);i<=lll;i++)\n        if(x%i==0)\n            return false;\n    return true;\n}\nlong long x,n;\nlong long ksm(long long a,long long b){\n    if(a==0||b==0) return 1;\n    long long ret=1;\n    long long base=a%mod;\n    while(b){\n        if(b&1)\n            ret=(ret*base)%mod;\n        base=(base*base)%mod;\n        b>>=1;\n    }\n    return ret%mod;\n}\nvoid solve(){\n    long long tmp=x;\n    int num=0;\n    for(int i=1;i<cnt;i++){\n        if(tmp==0||tmp==1)\n            break;\n        if(tmp%su[i]==0){\n            arr[num++]=su[i];\n        }\n        while(tmp&&tmp%su[i]==0){\n            tmp/=su[i];\n        }\n    }\n    long long pri=su[cnt-1];\n    while(tmp>=pri){\n        if(tmp%pri==0&&isPrimer(pri)){\n            arr[num++]=pri;\n            while(tmp%pri==0){\n                tmp/=pri;\n            }\n        }\n        pri++;\n    }\n//    for(long long i=2,lll=sqrt(x);i<=lll;i++){\n//        if(tmp%i==0){\n//            if(isPrimer(i)){\n//                arr[num++]=i;\n//                while(tmp%i==0){\n//                    tmp/=i;\n//                }\n//                cout<<i<<endl;\n//            }\n//            if(isPrimer(tmp/i)){\n//                arr[num++]=tmp/i;\n//                while(tmp%(tmp/i)==0){\n//                    tmp/=(tmp/i);\n//                }\n//            }\n//        }\n//    }\n//    sort(arr,arr+num);\n    long long ans=1;\n    for(int i=0;i<num;i++){\n        long long tmp=arr[i];\n        while(tmp>0&&tmp<=n){\n            if((n/arr[i])>=tmp){\n                tmp=tmp*arr[i];\n            }else{\n                break;\n            }\n        }\n        if(tmp>n)\n            tmp=tmp/arr[i];\n        if(tmp!=1){\n            long long pre=0;\n            while(tmp>=arr[i]){\n                ans=(ans*ksm(tmp,n/tmp-pre))%mod;\n                pre=n/tmp;\n                tmp/=arr[i];\n            }\n        }\n    }\n    cout<<ans<<endl;\n}\nvoid init(){\n    prime();\n    cin>>x>>n;\n}\nint main(){\n    ios::sync_with_stdio(0);\n    cin.tie(0);\n    cout.tie(0);\n    init();\n    solve();\n    return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "14e57b23401f4a7c63e0cf1e4b80ce64", "src_uid": "04610fbaa746c083dda30e21fa6e1a0c", "apr_id": "2b4c7270aa4b5ccb07f58a4384672762", "difficulty": 1700, "tags": ["math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.39460154241645246, "equal_cnt": 16, "replace_cnt": 9, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 16, "bug_source_code": "#include<bits/stdc++.h>\n#define ll long long\n#define INF 0x3f3f3f3f\nusing namespace std;\nint g[10][10];\nint tong[10];\nbool cmp(int a,int b)\n{\n\treturn a>b;\n}\nint main()\n{\n\tint n,m;\n\tscanf(\"%d %d\",&n,&m);\n\tmemset(g,0,sizeof(g));\n\tmemset(tong,0,sizeof(tong));\n\tint a,b;\n\tint ans = 0;\n\tbool flag = true;\n\tfor(int i=0;i<m;i++)\n\t{\n\t\tscanf(\"%d %d\",&a,&b);\n\t\ttong[a]++;\n\t\ttong[b]++;\n\t}\n\tsort(tong+1,tong+n+1,cmp);\n\tfor(int i=1;i<=n&&i<7;i++)\n\t{\n\t\tif(tong[i]==6&&flag)\n\t\t{\n\t\t\tans += tong[i];\n\t\t\tfor(int j=i+1;j<=n;j++)\n\t\t\t{\n\t\t\t\tif(tong[j]==6)\n\t\t\t\t\ttong[j]-=2;\n\t\t\t\telse\n\t\t\t\t\ttong[j]--;\n\t\t\t}\n\t\t\tflag = false;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tint k = i+1;\n\t\t\twhile(tong[i]--)\n\t\t\t{\n\t\t\t\tans++;\n\t\t\t\tif(tong[k] > 0)\n\t\t\t\t\ttong[k]--;\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\twhile(k<=n)\n\t\t\t\t\t{\n\t\t\t\t\t\tk++;\n\t\t\t\t\t\tif(tong[k] > 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttong[k]--;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(k>n)\n\t\t\t\t\t{\n\t\t\t\t\t\ttong[i]--;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tk++;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n } ", "lang": "GNU C++17", "bug_code_uid": "8bcdb1d5f36d625a20e8c3d7871fe7e2", "src_uid": "11e6559cfb71b8f6ca88242094b17a2b", "apr_id": "69381da041759b750a719adb83836bd1", "difficulty": 1700, "tags": ["graphs", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8314374353671148, "equal_cnt": 15, "replace_cnt": 9, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 14, "bug_source_code": "//BRR\n#include <bits/stdc++.h>\n\n#define fi first\n#define sc scanf\n#define pf printf\n#define se second\n#define ll long long\n#define pb push_back\n#define pr pair< ll,pair<ll,ll> >\n#define fin(s) freopen( s, \"r\", stdin )\n#define fout(s) freopen( s, \"w\", stdout )\n#define TIME ios_base::sync_with_stdio(0)\n#define SZ(x) ((int) (x).size())\n\nconst ll INF = 2e18;\nconst ll N = 1e6;\nconst ll mod = 1e9;\nconst long double eps = 1E-7;\nusing namespace std;\n\nchar m[N];\nint t;\n\nvoid solve(){\n    //fin(\"input.txt\");\n    //fout(\"output.txt\");\n    int a, b;\n    cin >> a >> b;\n    string s, z;\n    cin >> s;\n\n    int x = a;\n    z = s;\n    sort(s.begin(), s.end());\n    for(int i=0; i<a/2; ++i) {\n          if(s[i] != s[a - 1 - i]) {\n                t ++, x-=2;\n                z = z.substr(i+1, a-i-2);\n          }\n    }\n\n    b -= t;\n    if(z.size() <= b) x = 0;\n    cout << ( !x ? \"YES\\n\" : \"NO\\n\" );\n}\nbool mtest = false;\nint main(){\n    TIME;\n    int TE = 1;\n    if(mtest)\n        cin >> TE;\n    while(TE--)\n        solve();\n    return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "1cae8b9972f48527cb5405a99757fcff", "src_uid": "ceb3807aaffef60bcdbcc9a17a1391be", "apr_id": "b6c2cbc35c24d91c8d9c69aa36fe14bc", "difficulty": 900, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.13994565217391305, "equal_cnt": 14, "replace_cnt": 9, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 15, "bug_source_code": "#include <iostream>\n#include <vector>\n#include <cmath>\nusing namespace std;\nint main()\n{\n    int array[4],counter=0,base=1,res1,res2;\n    for (int i=0;i<4;i++)\n        cin>>array[i];\n    vector<int> array1,array2;\n    while (true)\n    {\n        res1=base*array[0],res2=base*array[1];\n        if (res1>=array[2] && res1<=array[3])\n            array1.push_back(res1);\n        if (res2>=array[2] && res2<=array[3])\n            array2.push_back(res2);\n        if (res1>array[3] && res2>array[3])\n            break;\n        base++;\n    }\n    if (array2.size()<array1.size())\n    {\n        for (int i=0;i<array2.size();i++)\n            if (array2[i]%array[0]==0)\n                counter++;\n    }\n    else\n        for (int i=0;i<array1.size();i++)\n                if (array1[i]%array[1]==0)\n                    counter++;\n    cout<<counter<<endl;\n    return 0;\n}", "lang": "GNU C++", "bug_code_uid": "51491be40cfb1fc638546d731a967ec6", "src_uid": "c7aa8a95d5f8832015853cffa1374c48", "apr_id": "a5454addcbec643a4c2e6ea97d06145d", "difficulty": 1200, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.5276740237691002, "equal_cnt": 26, "replace_cnt": 20, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 25, "bug_source_code": "#include \"bits/stdc++.h\"\nusing namespace std;\n#define MOD 1000000007\n#define inf 0x3f3f3f3f3f3f3f3f\n#define pi acos(-1.0)\n#define ri register int\n#define int long long\n#define all(x) x.begin(), x.end()\n#ifdef ONLINE_JUDGE\nconst int maxn = 3e5 + 10;\n#else\nconst int maxn = 1e3 + 10;\n#endif\n//__builtin_popcount\nchar str[maxn];\nint N;\nsigned main() {\n#ifdef ONLINE_JUDGE\n    ios::sync_with_stdio(false);\n    cin.tie(0);\n#endif\n    // freopen(\"C:\\Users\\hjw\\Downloads\\testdata (4).in\", \"r\", stdin);\n    cin >> str + 1;\n    N = strlen(str + 1);\n    vector<vector<string>> dp(N + 1);\n    dp[0].push_back(\"\");\n\n    for (int i = 1; i <= N; ++i) {\n        if (i >= 2 && str[i - 1] == 'a' && str[i] == 't') {\n            for (auto e : dp[i - 2]) {\n                if (e.empty() || e.find('@') != e.npos) {\n                    continue;\n                }\n                dp[i].push_back(e + \"@\");\n            }\n\n        } else if (i >= 3 && str[i - 2] == 'd' && str[i - 1] == 'o' &&\n                   str[i] == 't') {\n            for (auto e : dp[i - 3]) {\n                if (e.empty()) {\n                    continue;\n                }\n                dp[i].push_back(e + \".\");\n            }\n        }\n        for (auto e : dp[i - 1]) {\n            dp[i].push_back(e + str[i]);\n        }\n    }\n    vector<string> ans;\n    for (auto e : dp[N]) {\n        if (e.empty())\n            continue;\n        if (e.find('@') != e.npos && e.back() != '@' && e.back() != '.') {\n            ans.push_back(e);\n        }\n    }\n    sort(all(ans));\n    cout << ans.front() << endl;\n\n#ifndef ONLINE_JUDGE\n    system(\"pause\");\n#endif\n    return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "b87ec580e03f57db907b73430d54f6ae", "src_uid": "a11c9679d8e2dca51be17d466202df6e", "apr_id": "b946f03803ec13936ec94dd3645e85ab", "difficulty": 1300, "tags": ["implementation", "expression parsing"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9806959947472095, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#include <iostream>\n#include <vector>\n#include <algorithm>\n#include <cmath>\n#include <map>\n#include <set>\n#include <string>\n#include <queue>\n \nusing namespace std;\ntypedef long long int ll;\ntypedef pair <ll, ll> ii;\ntypedef vector <int> vi;\ntypedef vector <vi> vvi; \ntypedef vector <ii> vii;\n\nvi P, rep, out, visited, original;\nvvi edges, G, queries;\nvector <set <int> > best;\nvvi nodes;\n \nvoid dfs(int v, int parent){\n    ++visited[v];\n\n    rep[v] = parent;\n    best[parent].insert(-P[v]);\n    nodes[parent].push_back(v);\n    for (int u : G[v]){\n        if (not visited[u]) dfs(u, parent);\n    }\n}\n\nint findrep(int v){\n    if (rep[v] == v) return v;\n    else return rep[v] = findrep(rep[v]);\n}\n\nvoid solve(int q){\n    if (q == -1) return;\n\n    int t = queries[q][0], v = queries[q][1];\n    //cout << \" solving query \" << q << \" i.e. \" << t << \" and \" << v << endl;\n\n    if (t == 1){\n        solve(q - 1);\n\n        int p = findrep(v);\n\n        if (best[p].empty()) cout << 0 << '\\n';\n        else {\n            cout << -*best[p].begin() << '\\n';\n            P[original[-*best[p].begin()]] = 0;\n            best[p].erase(best[p].begin());\n        }\n    }\n    else {\n        \n        int a = edges[v][0], b = edges[v][1];\n\n        if (best[a].size() < best[b].size()) swap(a, b);\n\n        int pb = findrep(b), pa = findrep(a);\n            \n        if (pa < pb){\n            rep[pb] = pa;\n\n            for (int x: best[pb]){\n                best[pa].insert(x);\n            } \n            for (int x: nodes[pb]){\n                nodes[pa].push_back(x);\n            }\n            best[pb].clear();\n        }\n\n        if (pa > pb){\n            rep[pb] = pa;\n \n            for (int x: best[pb]){\n                best[pa].insert(x);\n            } \n            for (int x: nodes[pb]){\n                nodes[pa].push_back(x);\n            }\n            //best[pb].clear();\n        }\n \n        solve(q - 1);\n \n        if (pa > pb){\n            for (int x : nodes[pb]) {\n                nodes[pa].pop_back();\n                rep[x] = pb;\n            }\n \n            vi pending;\n \n            \n            for (int x: best[pb]){\n                auto it = best[pa].find(x); \n                \n                if (it == best[pa].end()) pending.push_back(x);\n                else best[pa].erase(it);\n            }\n \n            for (int x: pending) best[pb].erase(x);\n        }\n\n    \n        if (pa < pb){\n            for (int x : nodes[pb]) {\n                nodes[pa].pop_back();\n                rep[x] = pb;\n                if (P[x] != 0){\n                    best[pa].erase(-P[x]);\n                    best[pb].insert(-P[x]);\n                } \n            }\n        }\n    }\n\n    //cout << \" finished with \" << q << endl;\n}\n\n\nint main (){\n    ios::sync_with_stdio(0);\n    cin.tie(0);  \n    \n    int n, m, q;\n    cin >> n >> m >> q;\n\n    P = vi(n);\n    for (int i = 0; i < n; ++i) cin >> P[i];\n\n    rep = vi(n);\n    for (int i = 0; i < n; ++i) rep[i] = i;\n\n    edges = vvi(m, vi(2));\n    out = vi(m, 0);\n\n    for (int i = 0; i < m; ++i){\n        int x, y;\n        cin >> x >> y;\n        --x; --y;\n\n        edges[i] = {x, y};\n    }\n\n    queries = vvi(q, vi(2));\n    for (int i = 0; i < q; ++i) {\n        int t, v;\n        cin >> t >> v;\n        --v;\n\n        queries[i] = {t, v};\n    }\n\n    for (int i = 0; i < q; ++i){\n        if (queries[i][0] == 2) out[queries[i][1]] = 1;\n    }\n\n    G = vvi(n);\n\n    for (int i = 0; i < m; ++i){\n        if (out[i]) continue;\n\n        G[edges[i][0]].push_back(edges[i][1]);\n        G[edges[i][1]].push_back(edges[i][0]);\n    }\n\n    visited = vi(n, 0);\n    best = vector <set <int> > (n);\n    nodes = vvi(n);\n\n    for (int i = 0; i < n; ++i){\n        if (not visited[i]) dfs(i, i);\n    }\n\n    original = vi(n + 1);\n    for (int i = 0; i < n; ++i) original[P[i]] = i;\n\n    solve(q-1);\n}", "lang": "GNU C++17", "bug_code_uid": "5af12c47e8c90c9686a7abc029644e1e", "src_uid": "ad014bde729222db14f38caa521e4167", "apr_id": "7a5264f8070c237a58932d5049b207aa", "difficulty": 2600, "tags": ["dsu", "data structures", "implementation", "graphs", "trees"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9756572541382668, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 4, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\nint a[1010];\nvoid alg(int n){\n\tint max = 0,idx = 0;\n\tfor(int i = 1; i <= n; i++){\n\t\tif(a[i] > max){\n\t\t\tmax = a[i];\n\t\t\tidx = i;\n\t\t}\n\t}\n\tif(idx > 1 && a[idx] - a[idx - 1] > 2){\n\t\tcout<<\"NO\"<<endl;\n\t\texit(0);\n\t}\n\tif(idx < n && a[idx] - a[idx + 1] > 2){\n\t\tcout<<\"NO\"<<endl;\n\t\texit(0);\n\t}\n\tfor(int i = idx; i < n; i++){\n\t\ta[i] = a[i+1];\n\t}\n\talg(n-1);\n}\nint main(){\n\tint n;\n\tcin>>n;\n\tfor(int i = 1;  i <= n; i++){\n\t\tcin>>a[i];\n\t}\n\talg(n);\n\tcout<<\"YES\"<<endl;\n}\n", "lang": "GNU C++11", "bug_code_uid": "4f92fdc4ebfc6fe23a66c4ecb68e6adf", "src_uid": "704d0ae50bccaa8bc49319812ae0be45", "apr_id": "25a35adee824ca03fd59705a083292cb", "difficulty": 1600, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.46527440505099565, "equal_cnt": 17, "replace_cnt": 12, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 16, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\ntypedef long long ll;\n#define forn(i, n) for (int i = 0; i < int(n); ++i)\n#define sz(v) int((v).size())\n#define int ll\n#define x first\n#define y second\n#define mp make_pair\n#define pb push_back\n\n\nint n, m;\nvector<int> a;\nset<int> rem[44];\nint b;\nvoid test()\n{\n    for(int i=0;i<44;++i) rem[i].clear();\n\n    for(int i=0;i<n;++i)\n    {\n        rem[i+1].insert(a[i]);\n        for(int it: rem[i])\n        {\n            rem[i+1].insert((it+a[i])%m);\n            rem[i+1].insert(it);\n        }\n        b = max(b, *--rem[i+1].end());\n    }\n}\nvoid solve()\n{\n    scanf(\"%lld%lld\", &n, &m);\n    a.resize(n);\n    forn(i, n) scanf(\"%lld\", &a[i]);\n    forn(i, n) a[i] = a[i]%m;\n    test();\n    printf(\"%lld\\n\", b);\n}\nsigned main()\n{\n    int T = 1; //scanf(\"%lld\", &T);\n    while (T--) solve();\n    return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "dd7bf41f4b2a1fc94e8f6bd66f2e4bb8", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "apr_id": "5b91f5bdc968b1cedf28803654520c48", "difficulty": 1800, "tags": ["divide and conquer", "meet-in-the-middle", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6687543493389004, "equal_cnt": 17, "replace_cnt": 7, "delete_cnt": 5, "insert_cnt": 4, "fix_ops_cnt": 16, "bug_source_code": "#include <cstring>\n#include <iostream>\n#include <numeric>\n#include <cmath>\n\nusing namespace std;\n\nint main() {\n    \n    char c;\n    char zeroalpha = 'Z';\n    int qn = 0;\n    int used[10];\n    int i = 0;\n    long long ans = 1;\n    int total;\n    double power;\n    char first;\n    \n    memset(used, 0, sizeof(used));\n    \n    cin >> c;\n    \n    if (c == '?' || isalpha(c)) {\n       ans = 9;\n       zeroalpha = c;\n    }\n    \n    first = c;\n    \n    do {\n       cin >> c;\n       if (c == '?') { qn++; }\n       else if (isalpha(c) && c != zeroalpha) {used[(static_cast<int>(c))-65] = 1;}\n    } while (cin.peek() != '\\n');\n    \n    static_cast<double>(qn);\n    \n    if (qn != 0) {\n       total = accumulate(used, used+10, 0);\n       power = 10 - total + 1;\n       if (zeroalpha == first) {\n          power -= 1;              \n       }\n       ans *= (long long)(pow(10.0, qn) * pow(power, total));\n    }\n    else {\n         total = accumulate(used, used+10, 0);\n         power = 10 - total + 1;\n         if (zeroalpha != 'Z') {\n            power -= 1;              \n         }\n         ans *= (long long)(pow(power, total));\n    }\n    \n    cout << ans << endl;\n    //system(\"pause\");\n    return 0;   \n}\n", "lang": "GNU C++", "bug_code_uid": "d8c8ccdfd5b3c918e6dd4d6d904e7d2e", "src_uid": "d3c10d1b1a17ad018359e2dab80d2b82", "apr_id": "3cb0cebf2400462e3ed5d377d398810e", "difficulty": 1100, "tags": ["greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8735905044510386, "equal_cnt": 11, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 12, "bug_source_code": "#include<iostream>\n#include <algorithm>\n#include <cmath>\n#include <set>\n#include<map>\n#include <string>\n#include <vector>\nusing namespace std;\n\n\ntypedef long long unsigned llu;\ntypedef long double ld;\n#define ll long long\n#define For(i, a, b) for (int i = a, sz = (int)b; i < sz; i++)\n#define all(v) (v).begin(), (v).end()\n#define Memset(a, b) memset(a, b, sizeof(a))\n#define IO ios_base::sync_with_stdio(false), cin.tie(0),cout.tie(0)\nconst ll mod = 1000000007;\nconst ll inf = 1000000000009;\n\n//freopen(\"input.txt\", \"r\", stdin);\n//freopen(\"output.txt\", \"w\", stdout);\n\nconst int N=101;\nint a[N];\n\nint main()\n{\n\tIO;\n\tint n{};\n\tcin>>n;\n\tFor(i,1,n+1)\n\t\tcin>>a[i];\n\n\tif(n%2!=0)\n\t{\n\t\tint c{};\n\t\tfor(int i=1;i<n+1;i+=2)\n\t\t\tif(a[i]%2!=0)\n\t\t\t\ta[i]=-1,c++;\n\t\t\t\t\n\t\tif(c==1 && n==1)\n\t\t\tcout<<\"YES\"<<\"\\n\";\n\t\telse if(c>=2)\n\t\t\tcout<<\"YES\"<<\"\\n\";\n\t\telse\n\t\t\tcout<<\"NO\"<<\"\\n\";\n\t}\n\telse\n\t\tcout<<\"NO\"<<\"\\n\";\n\n\n\t//system(\"pause\");\n\treturn 0;\n\n}", "lang": "GNU C++17", "bug_code_uid": "a19863326d13084aa0c3bafa66146185", "src_uid": "2b8c2deb5d7e49e8e3ededabfd4427db", "apr_id": "4bfd356491ef915c24d772baef87d5cc", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.08239700374531835, "equal_cnt": 12, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "#include <bits/stdc++.h>\n\n#define MAX 500\n#define oo  0x2f2f2f2f\n\nusing namespace std;\n\nint cost_hp, cost_atk, cost_def, monster_hp, monster_atk, monster_def, dp[MAX][MAX][MAX];\n\nbool wins(int hp, int atk, int def) {\n\tint hp_lost = monster_atk - def, monster_hp_lost = atk - monster_def;\n\tif(monster_hp_lost <= 0) return false;\n\tint n = monster_hp / monster_hp_lost + (monster_hp % monster_hp_lost != 0);\n\tif(hp_lost <= 0) return n > 0;\n\tint m = hp / hp_lost + (hp % hp_lost != 0);\n\treturn n < m;\n}\n\nint solve(int hp, int atk, int def) {\n\tif(hp == MAX || atk == MAX || def == MAX) {\n\t\treturn oo;\n\t} else if(wins(hp, atk, def)) {\n\t\treturn 0;\n\t} else if(~dp[hp][atk][def]) {\n\t\treturn dp[hp][atk][def];\n\t} else {\n\t\treturn dp[hp][atk][def] = min(solve(hp + 1, atk, def) + cost_hp, min(solve(hp, atk + 1, def) + cost_atk, solve(hp, atk, def + 1) + cost_def));\n\t}\n}\n\nint main(void) {\n\tint hp, atk, def;\n\tscanf(\"%d %d %d\", &hp, &atk, &def);\n\tscanf(\"%d %d %d\", &monster_hp, &monster_atk, &monster_def);\n\tscanf(\"%d %d %d\", &cost_hp, &cost_atk, &cost_def);\n\tmemset(dp, -1, sizeof dp);\n\tprintf(\"%d\\n\", solve(hp, atk, def));\n\treturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "0634a7e3344927e3e8f6e576fa069572", "src_uid": "bf8a133154745e64a547de6f31ddc884", "apr_id": "cb62f099a0e435d3d4161f60e6161721", "difficulty": 1800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.07731852765782439, "equal_cnt": 21, "replace_cnt": 17, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 21, "bug_source_code": "#include<bits/stdc++.h>    \n#define int long long int\n#define ll long long int\n#define pb push_back\n#define endl \"\\n\"\n#define F first\n#define S second \n#define mod 998244353     \nusing namespace std;\nconst int mx= 200+5;\nint fact[mx], invfact[mx];\nint powm(int x, int y){          //Binary exponent\n    int res = 1;\n    x %= mod;\n    while(y){\n      if(y & 1)\n        res *= x;\n      x *= x;\n      x %= mod;\n      res %= mod;\n      y /= 2;\n    }\n    return res;\n}\nint modinv(int num){              \n   return powm(num, mod - 2);\n}\n \nvoid cal_fact(){                 \n   fact[0] = 1;\n   for(int i = 1; i < mx; i++){\n      fact[i] = fact[i - 1] * i;\n      fact[i] %= mod;\n   }\n   invfact[mx - 1] = modinv(fact[mx - 1]);\n   for(int i = mx - 2; i >= 0; i--){\n      invfact[i] = invfact[i + 1] * (i + 1);\n      invfact[i] %= mod; \n   }\n}\n\nmain()\n{    \n    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);\n    cal_fact();\n    int n, m, like = 0, dislike = 0;\n    cin >> n >> m;\n    bool type[n];\n    for(int i = 0; i < n; i++)\n        cin >> type[i];\n    int wt[n];\n    for(int i = 0; i < n; i++){\n        cin >> wt[i];\n        like += wt[i] * type[i];\n        dislike += wt[i] * (1 - type[i]);\n    }\n    for(int i = 0; i < n; i++){\n        int dp[m + 1][3000], ans = 0;\n        memset(dp, 0, sizeof dp);\n        dp[0][like] = wt[i];\n        for(int j = 1; j <= m; j++){\n            for(int k = 1; k <= 3000; k++){\n                for(int l = 0; l <= 100; l++){\n                    if(type[i]){\n                        dp[j][k][l] += (((dp[j - 1][k - 1][l] * wt[i]) % mod) * invfact[k + l]) % mod;\n                        dp[j][k][l] %= mod;\n                        if(k > wt[i])\n                            dp[j][k][l] += (((dp[j - 1][k - 1][l] * (k - wt[i])) % mod) * invfact[k + l]) % mod;\n                        dp[j][k][l] %= mod;\n                        dp[j][k][l] += (((dp[j - 1][k][l + 1] * l) % mod) * invfact[k + l]) % mod;\n                        dp[j][k][l] %= mod;\n                    }\n                    else{\n                        dp[j][k][l] += (((dp[j - 1][k][l + 1] * wt[i]) % mod) * invfact[k + l]) % mod;\n                        dp[j][k][l] %= mod;\n                        dp[j][k][l] += (((dp[j - 1][k - 1][l] * k) % mod) * invfact[k + l]) % mod;\n                        dp[j][k][l] %= mod;\n                        if(l > wt[i])\n                            dp[j][k][l] += (((dp[j - 1][k][l + 1] * (l - wt[i])) % mod) * invfact[k + l]) % mod;\n                        dp[j][k][l] %= mod;\n                    }\n                    \n                }\n            }\n        }\n        for(int k = 0; k <= 100; k++){\n            for(int l = 0; l <= 100; l++){\n                ans += dp[m][k][l];\n                ans %= mod;\n            }\n        }\n        cout << ans << endl;\n    }\n}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ", "lang": "GNU C++17", "bug_code_uid": "faa9956b6675e5918af73e6943249286", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "apr_id": "67e020c7f22a54b568d96f06f43cd407", "difficulty": 2200, "tags": ["dp", "math", "probabilities", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.16201859229747675, "equal_cnt": 10, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 10, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint n, a[27], vis[27], ans; \nint main(){\n\tcin >> n;\n\tfor(int i = 1; i <= n; ++i)\n\t{\n\t\tcin >> a[i];\n\t}\n\tsort(a + 1, a + n + 1);\n\tfor(int i = n; i >= 1; --i)\n\t{\n\t\tif(!vis[a[i]])\n\t\t{\n\t\t\tans += a[i];\n\t\t\tvis[a[i]] = 1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tint j = a[i];\n\t\t\twhile(vis[j]) j--;\n\t\t\tans += j;\n\t\t\tvis[j] = 1;\n\t\t}\n\t}\n\tcout << ans;\n}", "lang": "GNU C++11", "bug_code_uid": "c21648c5afbd6f0b8d1a9c4b0036832b", "src_uid": "3c4b2d1c9440515bc3002eddd2b89f6f", "apr_id": "d19a597a5c08f4658b33d566caecb94b", "difficulty": 1100, "tags": ["greedy", "sortings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.767990444908928, "equal_cnt": 22, "replace_cnt": 15, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 21, "bug_source_code": "#pragma GCC optimize(\"Ofast\")\n#include <bits/stdc++.h>\nusing namespace std;\n#define ll long long\n#define pb push_back\n#define mp make_pair\n#define mt make_tuple\n#define pii pair<int,int>\n#define pll pair<ll,ll>\n#define ldb double\ntemplate<typename T>void ckmn(T&a,T b){a=min(a,b);}\ntemplate<typename T>void ckmx(T&a,T b){a=max(a,b);}\nvoid rd(int&x){scanf(\"%i\",&x);}\nvoid rd(ll&x){scanf(\"%lld\",&x);}\nvoid rd(char*x){scanf(\"%s\",x);}\nvoid rd(ldb&x){scanf(\"%lf\",&x);}\nvoid rd(string&x){scanf(\"%s\",&x);}\ntemplate<typename T1,typename T2>void rd(pair<T1,T2>&x){rd(x.first);rd(x.second);}\ntemplate<typename T>void rd(vector<T>&x){for(T&i:x)rd(i);}\ntemplate<typename T,typename...A>void rd(T&x,A&...args){rd(x);rd(args...);}\ntemplate<typename T>void rd(){T x;rd(x);return x;}\nint ri(){int x;rd(x);return x;}\ntemplate<typename T>vector<T> rv(int n){vector<T> x(n);rd(x);return x;}\ntemplate<typename T>void ra(T a[],int n,int st=1){for(int i=0;i<n;++i)rd(a[st+i]);}\ntemplate<typename T1,typename T2>void ra(T1 a[],T2 b[],int n,int st=1){for(int i=0;i<n;++i)rd(a[st+i]),rd(b[st+i]);}\ntemplate<typename T1,typename T2,typename T3>void ra(T1 a[],T2 b[],T3 c[],int n,int st=1){for(int i=0;i<n;++i)rd(a[st+i]),rd(b[st+i]),rd(c[st+i]);}\nvoid re(vector<int> E[],int m,bool dir=0){for(int i=0,u,v;i<m;++i){rd(u,v);E[u].pb(v);if(!dir)E[v].pb(u);}}\ntemplate<typename T>void re(vector<pair<int,T>> E[],int m,bool dir=0){for(int i=0,u,v;i<m;++i){T w;rd(u,v,w);E[u].pb({v,w});if(!dir)E[v].pb({u,w});}}\n\nint mod;\nint add(int a,int b){a+=b;return a>=mod?a-mod:a;}\nvoid ckadd(int&a,int b){a=add(a,b);}\nint sub(int a,int b){a-=b;return a<0?a+mod:a;}\nvoid cksub(int&a,int b){a=sub(a,b);}\nint mul(int a,int b){return (ll)a*b%mod;}\nvoid ckmul(int&a,int b){a=mul(a,b);}\nint powmod(int x,int k){int ans=1;for(;k;k>>=1,ckmul(x,x))if(k&1)ckmul(ans,x);return ans;}\nint inv(int x){return powmod(x,mod-2);}\n\nconst int N=505;\nint blok[N],sum[N];\nint c2(int x){return ((ll)x*(x+1)/2)%mod;}\nint dp[N][N],ways[N][N];\n\nconst int M=1050;\nint F[M],I[M];\nint binom(int n, int k){ return mul(F[n],mul(I[k],I[n-k]));}\nvoid calc()\n{\n\tF[0]=1;\n\tfor(int i=1;i<M;i++) F[i]=mul(F[i-1],i);\n\tI[M-1]=inv(F[M-1]);\n\tfor(int i=M-2;~i;i--) I[i]=mul(I[i+1],i+1);\n}\nint main(){\n\tint n,m;rd(n,m,mod);\n\tcalc();\n\tblok[0]=1;\n\tfor(int x=1;x<=m;x++){//block size\n\t\tfor(int i=1;i<=x;i++){//last element\n\t\t\tckadd(blok[x],mul(blok[i-1],mul(blok[x-i],binom(x-1,i-1))));\n\t\t\tckadd(sum[x],mul(add(c2(i-1),c2(x-i)),mul(blok[i-1],mul(blok[x-i],binom(x-1,i-1)))));\n\t\t\tckadd(sum[x],mul(sum[i-1],mul(mul(blok[x-i],binom(x-1,i-1)),x+1)));\n\t\t\tckadd(sum[x],mul(sum[x-i],mul(mul(blok[i-1],binom(x-1,i-1)),x+1)));\n\t\t}\n\t\tckmul(blok[x],x+1);\n\t\t//printf(\"%i %i\\n\",blok[x],sum[x]);\n\t}\n\tways[0][0]=1;\n\tfor(int i=1;i<=m;i++){//total size\n\t\tfor(int j=1;j<=m;j++){//number of blocks\n\t\t\tfor(int sz=1;sz<=i;sz++){//last block size\n\t\t\t\tckadd(ways[i][j],mul(ways[i-sz][j-1],mul(blok[sz],binom(m-i+sz,sz))));\n\t\t\t\tckadd(dp[i][j],mul(ways[i-sz][j-1],mul(sum[sz],binom(m-i+sz,sz))));\n\t\t\t\tckadd(dp[i][j],mul(dp[i-sz][j-1],mul(blok[sz],binom(m-i+sz,sz))));\n\t\t\t}\n\t\t}\n\t}\n\tint ans=0;\n\tfor(int i=1;i<=m;i++){//number of blocks\n\t\tint zero=n-m;\n\t\tint lef=zero-(i-1);\n\t\tif(lef>=0){\n\t\t\tckadd(ans,mul(dp[m][i],binom(i+1+lef-1,lef)));\n\t\t}\n\t}\n\tprintf(\"%i\\n\",ans);\n\treturn 0;\n}", "lang": "GNU C++17", "bug_code_uid": "306c2691d97438f452b080e79cc14007", "src_uid": "9812de5f2d272511a63ead8765b23190", "apr_id": "f64b1782ca8909c2b0d7a7c20081d6c3", "difficulty": 3100, "tags": ["dp", "fft", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9647614053487152, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n \nusing ll = long long;\nusing ld = long double;\nusing db = double; \nusing str = string; // yay python!\n\nusing pi = pair<int,int>;\nusing pl = pair<ll,ll>;\nusing pd = pair<db,db>;\n\nusing vi = vector<int>;\nusing vb = vector<bool>;\nusing vl = vector<ll>;\nusing vd = vector<db>; \nusing vs = vector<str>;\nusing vpi = vector<pi>;\nusing vpl = vector<pl>; \nusing vpd = vector<pd>;\n\n#define tcT template<class T\n#define tcTU tcT, class U\n// ^ lol this makes everything look weird but I'll try it\ntcT> using V = vector<T>; \ntcT, size_t SZ> using AR = array<T,SZ>; \ntcT> using PR = pair<T,T>;\n\n// pairs\n#define mp make_pair\n#define f first\n#define s second\n\n// vectors\n#define sz(x) (int)(x).size()\n#define all(x) begin(x), end(x)\n#define rall(x) (x).rbegin(), (x).rend() \n#define sor(x) sort(all(x)) \n#define rsz resize\n#define ins insert \n#define ft front() \n#define bk back()\n#define pf push_front \n#define pb push_back\n#define eb emplace_back \n#define lb lower_bound \n#define ub upper_bound \n\n// loops\n#define FOR(i,a,b) for (int i = (a); i < (b); ++i)\n#define F0R(i,a) FOR(i,0,a)\n#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)\n#define R0F(i,a) ROF(i,0,a)\n#define trav(a,x) for (auto& a: x)\n\nint MOD = 1e9+7; // 998244353;\nconst int MX = 2e5+5;\nconst ll INF = 1e18; // not too close to LLONG_MAX\nconst ld PI = acos((ld)-1);\nconst int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1}; // for every grid problem!!\nmt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count()); \ntemplate<class T> using pqg = priority_queue<T,vector<T>,greater<T>>;\n\n// helper funcs\nconstexpr int pct(int x) { return __builtin_popcount(x); } // # of bits set\nconstexpr int bits(int x) { return 31-__builtin_clz(x); } // floor(log2(x)) \nll cdiv(ll a, ll b) { return a/b+((a^b)>0&&a%b); } // divide a by b rounded up\nll fdiv(ll a, ll b) { return a/b-((a^b)<0&&a%b); } // divide a by b rounded down\n\ntcT> bool ckmin(T& a, const T& b) {\n\treturn b < a ? a = b, 1 : 0; } // set a = min(a,b)\ntcT> bool ckmax(T& a, const T& b) {\n\treturn a < b ? a = b, 1 : 0; }\n\ntcTU> T fstTrue(T lo, T hi, U f) {\n\thi ++; assert(lo <= hi); // assuming f is increasing\n\twhile (lo < hi) { // find first index such that f is true \n\t\tT mid = lo+(hi-lo)/2;\n\t\tf(mid) ? hi = mid : lo = mid+1; \n\t} \n\treturn lo;\n}\ntcTU> T lstTrue(T lo, T hi, U f) {\n\tlo --; assert(lo <= hi); // assuming f is decreasing\n\twhile (lo < hi) { // find first index such that f is true \n\t\tT mid = lo+(hi-lo+1)/2;\n\t\tf(mid) ? lo = mid : hi = mid-1;\n\t} \n\treturn lo;\n}\ntcT> void remDup(vector<T>& v) { // sort and remove duplicates\n\tsort(all(v)); v.erase(unique(all(v)),end(v)); }\ntcTU> void erase(T& t, const U& u) { // don't erase\n\tauto it = t.find(u); assert(it != end(t));\n\tt.erase(it); } // element that doesn't exist from (multi)set\n\n// INPUT\n#define tcTUU tcT, class ...U\ntcT> void re(complex<T>& c);\ntcTU> void re(pair<T,U>& p);\ntcT> void re(vector<T>& v);\ntcT, size_t SZ> void re(AR<T,SZ>& a);\n\ntcT> void re(T& x) { cin >> x; }\nvoid re(db& d) { str t; re(t); d = stod(t); }\nvoid re(ld& d) { str t; re(t); d = stold(t); }\ntcTUU> void re(T& t, U&... u) { re(t); re(u...); }\n\ntcT> void re(complex<T>& c) { T a,b; re(a,b); c = {a,b}; }\ntcTU> void re(pair<T,U>& p) { re(p.f,p.s); }\ntcT> void re(vector<T>& x) { trav(a,x) re(a); }\ntcT, size_t SZ> void re(AR<T,SZ>& x) { trav(a,x) re(a); }\ntcT> void rv(int& n, vector<T>& x) { re(n); x.rsz(n); trav(a,x) re(a); }\n\n// TO_STRING\n#define ts to_string\nstr ts(char c) { return str(1,c); }\nstr ts(const char* s) { return (str)s; }\nstr ts(str s) { return s; }\nstr ts(bool b) { \n\t#ifdef LOCAL\n\t\treturn b ? \"true\" : \"false\"; \n\t#else \n\t\treturn ts((int)b);\n\t#endif\n}\ntcT> str ts(complex<T> c) { \n\tstringstream ss; ss << c; return ss.str(); }\nstr ts(vector<bool> v) {\n\tstr res = \"{\"; F0R(i,sz(v)) res += char('0'+v[i]);\n\tres += \"}\"; return res; }\ntemplate<size_t SZ> str ts(bitset<SZ> b) {\n\tstr res = \"\"; F0R(i,SZ) res += char('0'+b[i]);\n\treturn res; }\ntcTU> str ts(pair<T,U> p);\ntcT> str ts(T v) { // containers with begin(), end()\n\t#ifdef LOCAL\n\t\tbool fst = 1; str res = \"{\";\n\t\tfor (const auto& x: v) {\n\t\t\tif (!fst) res += \", \";\n\t\t\tfst = 0; res += ts(x);\n\t\t}\n\t\tres += \"}\"; return res;\n\t#else\n\t\tbool fst = 1; str res = \"\";\n\t\tfor (const auto& x: v) {\n\t\t\tif (!fst) res += \" \";\n\t\t\tfst = 0; res += ts(x);\n\t\t}\n\t\treturn res;\n\n\t#endif\n}\ntcTU> str ts(pair<T,U> p) {\n\t#ifdef LOCAL\n\t\treturn \"(\"+ts(p.f)+\", \"+ts(p.s)+\")\"; \n\t#else\n\t\treturn ts(p.f)+\" \"+ts(p.s);\n\t#endif\n}\n\n// OUTPUT\ntcT> void pr(T x) { cout << ts(x); }\ntcTUU> void pr(const T& t, const U&... u) { \n\tpr(t); pr(u...); }\nvoid ps() { pr(\"\\n\"); } // print w/ spaces\ntcTUU> void ps(const T& t, const U&... u) { \n\tpr(t); if (sizeof...(u)) pr(\" \"); ps(u...); }\n\n// DEBUG\nvoid DBG() { cerr << \"]\" << endl; }\ntcTUU> void DBG(const T& t, const U&... u) {\n\tcerr << ts(t); if (sizeof...(u)) cerr << \", \";\n\tDBG(u...); }\n#ifdef LOCAL // compile with -DLOCAL, chk -> fake assert\n\t#define dbg(...) cerr << \"Line(\" << __LINE__ << \") -> [\" << #__VA_ARGS__ << \"]: [\", DBG(__VA_ARGS__)\n\t#define chk(...) if (!(__VA_ARGS__)) cerr << \"Line(\" << __LINE__ << \") -> function(\" \\\n\t\t << __FUNCTION__  << \") -> CHK FAILED: (\" << #__VA_ARGS__ << \")\" << \"\\n\", exit(0);\n#else\n\t#define dbg(...) 0\n\t#define chk(...) 0\n#endif\n\n// FILE I/O\nvoid setIn(str s) { freopen(s.c_str(),\"r\",stdin); }\nvoid setOut(str s) { freopen(s.c_str(),\"w\",stdout); }\nvoid unsyncIO() { cin.tie(0)->sync_with_stdio(0); }\nvoid setIO(str s = \"\") {\n\tunsyncIO();\n\t// cin.exceptions(cin.failbit); \n\t// throws exception when do smth illegal\n\t// ex. try to read letter into int\n\tif (sz(s)) { setIn(s+\".in\"), setOut(s+\".out\"); } // for USACO\n}\n\n/**\n * Description: modular arithmetic operations \n * Source: \n\t* KACTL\n\t* https://codeforces.com/blog/entry/63903\n\t* https://codeforces.com/contest/1261/submission/65632855 (tourist)\n\t* https://codeforces.com/contest/1264/submission/66344993 (ksun)\n\t* also see https://github.com/ecnerwala/cp-book/blob/master/src/modnum.hpp (ecnerwal)\n * Verification: \n\t* https://open.kattis.com/problems/modulararithmetic\n */\n\ntemplate<int RT> struct mint {\n\t// static const int mod = MOD;\n\tstatic constexpr mint rt() { return RT; } // primitive root for FFT\n\tint v; explicit operator int() const { return v; } // explicit -> don't silently convert to int\n\tmint() { v = 0; }\n\tmint(ll _v) { v = int((-MOD < _v && _v < MOD) ? _v : _v % MOD);\n\t\tif (v < 0) v += MOD; }\n\tfriend bool operator==(const mint& a, const mint& b) { \n\t\treturn a.v == b.v; }\n\tfriend bool operator!=(const mint& a, const mint& b) { \n\t\treturn !(a == b); }\n\tfriend bool operator<(const mint& a, const mint& b) { \n\t\treturn a.v < b.v; }\n\tfriend void re(mint& a) { ll x; re(x); a = mint(x); }\n\tfriend str ts(mint a) { return ts(a.v); }\n   \n\tmint& operator+=(const mint& m) { \n\t\tif ((v += m.v) >= MOD) v -= MOD; \n\t\treturn *this; }\n\tmint& operator-=(const mint& m) { \n\t\tif ((v -= m.v) < 0) v += MOD; \n\t\treturn *this; }\n\tmint& operator*=(const mint& m) { \n\t\tv = (ll)v*m.v%MOD; return *this; }\n\tmint& operator/=(const mint& m) { return (*this) *= inv(m); }\n\tfriend mint pow(mint a, ll p) {\n\t\tmint ans = 1; assert(p >= 0);\n\t\tfor (; p; p /= 2, a *= a) if (p&1) ans *= a;\n\t\treturn ans; }\n\tfriend mint inv(const mint& a) { assert(a.v != 0); \n\t\treturn pow(a,MOD-2); }\n\t\t\n\tmint operator-() const { return mint(-v); }\n\tmint& operator++() { return *this += 1; }\n\tmint& operator--() { return *this -= 1; }\n\tfriend mint operator+(mint a, const mint& b) { return a += b; }\n\tfriend mint operator-(mint a, const mint& b) { return a -= b; }\n\tfriend mint operator*(mint a, const mint& b) { return a *= b; }\n\tfriend mint operator/(mint a, const mint& b) { return a /= b; }\n};\n\ntypedef mint<5> mi; // 5 is primitive root for both common mods\ntypedef vector<mi> vmi;\ntypedef pair<mi,mi> pmi;\ntypedef vector<pmi> vpmi;\n\nvector<vmi> scmb; // small combinations\nvoid genComb(int SZ) {\n\tscmb.assign(SZ,vmi(SZ)); scmb[0][0] = 1;\n\tFOR(i,1,SZ) F0R(j,i+1) \n\t\tscmb[i][j] = scmb[i-1][j]+(j?scmb[i-1][j-1]:0);\n}\n\nmi ways[501], mad[501];\nmi WAYS[501][501], MAD[501][501];\nint N,M;\n\nint main() {\n\tsetIO(); re(N,M,MOD);\n\tgenComb(N+5);\n\tways[0] = 1;\n\tFOR(n,1,N+1) {\n\t\tFOR(i,1,n+1) {\n\t\t\tways[n] += (n+1)*ways[i-1]*ways[n-i]*scmb[n-1][i-1];\n\t\t\tFOR(j,1,i+1) {\n\t\t\t\tmad[n] += (j-1)*ways[i-1]*ways[n-i]*scmb[n-1][i-1];\n\t\t\t\tmad[n] += mad[i-1]*ways[n-i]*scmb[n-1][i-1];\n\t\t\t\tmad[n] += mad[n-i]*ways[i-1]*scmb[n-1][i-1];\n\t\t\t}\n\t\t\tFOR(j,1,n-i+2) {\n\t\t\t\tmad[n] += (j-1)*ways[i-1]*ways[n-i]*scmb[n-1][i-1];\n\t\t\t\tmad[n] += mad[i-1]*ways[n-i]*scmb[n-1][i-1];\n\t\t\t\tmad[n] += mad[n-i]*ways[i-1]*scmb[n-1][i-1];\n\t\t\t}\n\t\t}\n\t}\n\tF0R(n,N+1) WAYS[n][0] = 1;\n\tFOR(n,1,N+1) FOR(m,1,n+1) {\n\t\tif (n == m) {\n\t\t\tWAYS[n][m] = ways[n];\n\t\t\tMAD[n][m] = mad[n];\n\t\t} else {\n\t\t\tWAYS[n][m] = WAYS[n-1][m]; \n\t\t\tMAD[n][m] = MAD[n-1][m];\n\t\t\tFOR(l,1,m+1) {\n\t\t\t\tWAYS[n][m] += WAYS[n-l-1][m-l]*ways[l]*scmb[m][l];\n\t\t\t\tMAD[n][m] += (WAYS[n-l-1][m-l]*mad[l]+ways[l]*MAD[n-l-1][m-l])*scmb[m][l];\n\t\t\t}\n\t\t}\n\t}\n\tdbg(WAYS[N][M],MAD[N][M]);\n\tps(MAD[N][M]);\n\t// you should actually read the stuff at the bottom\n}\n\n/* stuff you should look for\n\t* int overflow, array bounds\n\t* special cases (n=1?)\n\t* do smth instead of nothing and stay organized\n\t* WRITE STUFF DOWN\n\t* DON'T GET STUCK ON ONE APPROACH\n*/\n", "lang": "GNU C++17", "bug_code_uid": "eec62c7245d86a911dee3d88ab7981c9", "src_uid": "9812de5f2d272511a63ead8765b23190", "apr_id": "8d6be6cf6dd05bb4a94ab9831e500533", "difficulty": 3100, "tags": ["dp", "fft", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9297539149888143, "equal_cnt": 12, "replace_cnt": 3, "delete_cnt": 8, "insert_cnt": 0, "fix_ops_cnt": 11, "bug_source_code": "//\n//  main.cpp\n//  p\n//\n//  Created by Tony Vazquez on 10/6/18.\n//  Copyright \u00a9 2018 Tony Vazquez. All rights reserved.\n//\n\n#include <iostream>\n#include <string>\nusing namespace std;\n\nint main(int argc, const char * argv[]) {\n    string s;\n    \n    cin>>s;\n    int size=s.size();\n    int count=0;\n    string copy=s;\n    bool c=true;\n    \n    do{\n        char newString[200];\n        \n        newString[0]= copy[size-1];\n        \n        for(int i=0;i<size-1;i++){\n            newString[i+1]=copy[i];\n        }\n        count++;\n        copy=newString;\n        cout<<\"copy:  \"<<copy<<endl;\n        cout<<\"s:  \"<<s<<endl;\n            if (copy==s){\n                c=false;\n            }\n    }while(c);\n    \n    /*\n    char newString[50];\n    \n    newString[0]= s[size-1];\n    cout<<\"primer string:  \"<<newString;\n    for(int i=0;i<size-1;i++){\n        newString[i+1]=s[i];\n    }\n    string aux=newString;\n    cout<<\"seg string:  \"<<aux;\n    \n    while (aux!=s){\n        \n        aux[0]=newString[size-1];\n        for(int i=0;i<size-1;i++){\n            aux[i+1]=newString[i];\n        }\n        count++;\n        aux=newString;\n    }*/\n    cout<<count;\n    \n    \n    \n    return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "864886dabf2e1afa08dfecae4ebdbae7", "src_uid": "8909ac99ed4ab2ee4d681ec864c7831e", "apr_id": "6a01972f03a657a2862db63756ca7df4", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.9022409873335498, "equal_cnt": 14, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 14, "bug_source_code": "#include <iostream>\n#include <vector>\n#include <cstdlib>\n#include <iomanip>\n#include <string>\n#include <ctime>\n#include <algorithm>\n#include <set>\n#include <map>\n#include <queue>\nusing namespace std;\n\n#define N 1001001\n\nconst int inf = 2 * 1000 * 1000 * 1000;\n\nbool can[N];\nint n, m, x, y;\n\ntemplate <typename T> \nstruct dich {\n\tstruct item {\n\t\titem *l, *r;\n\t\tint prior, cnt;\n\t\tT key;\n\t\titem(T x, int y) {\n\t\t\tl = r = NULL;\n\t\t\tkey = x;\n\t\t\tprior = y;\n\t\t\tcnt = 0;\t\t\t\t\n\t\t}\n\t};\n\n\ttypedef item* pitem;\n\n\tdich() {\n\t\tt = NULL;\n\t}\n\n\tint cnt(pitem t) {\n\t\treturn (t == NULL) ? 0 : t->cnt;\n\t}\n\n\tvoid upd_cnt(pitem t) {\n\t\tif (t != NULL) {\t\t\n\t\t\tt->cnt = cnt(t->l) + cnt(t->r) + 1;\n\t\t}\n\t}\n\n\tvoid split(pitem t, pitem &l, pitem &r, int key, int add = 0) {\n\t\tif (t == NULL) {\n\t\t\tl = r = NULL; \n\t\t\treturn;\n\t\t}\n\t\tint cur_key = add + cnt(t->l);\n\t\tif (key <= cur_key) {\n\t\t\tsplit(t->l, l, t->l, key, add);\n\t\t\tr = t;\n\t\t} else {\n\t\t\tsplit(t->r, t->r, r, key, add + 1 + cnt(t->l));\n\t\t\tl = t;\n\n\t\t}\n\t\tupd_cnt(t);\n\t}\n\n\tvoid merge(pitem &t, pitem l, pitem r) {\n\t\tif (l == NULL) t = r; else\n\t\tif (r == NULL) t = l; else\n\t\tif (l->prior > r->prior) {\n\t\t\tmerge(l->r, l->r, r);\n\t\t\tt = l;\n\t\t} else {\n\t\t\tmerge(r->l, l, r->l);\n\t\t\tt = r;\n\t\t}\n\t\tupd_cnt(t);\t\n\t}\n\n\tvoid insert(int i, T x) {\n\t\tpitem t1 = NULL, t2 = NULL;\n\t\tsplit(t, t1, t2, i);\n\t\tmerge(t1, t1, new item(x, rand()));\n\t\tmerge(t, t1, t2);\n\t}\n\n\tvoid erase(int i) {\n\t\tpitem t1 = NULL, t2 = NULL, t3 = NULL;\n\t\tsplit(t, t1, t2, i);\n\t\tsplit(t2, t2, t3, 1);\t\t\n\t\tmerge(t, t1, t3);\n\t}\n\n\tT get(int i) {\n\t\tpitem t1 = NULL, t2 = NULL, t3 = NULL;\n\t\tsplit(t, t1, t2, i);\n\t\tsplit(t2, t2, t3, 1);\t\t\n\t\tT ans = t2->key;\n\t\tmerge(t2, t2, t3);\n\t\tmerge(t, t1, t2);\n\t\treturn ans;\n\t}\n\n\tvoid set(int i, T x) {\n\t\tpitem t1 = NULL, t2 = NULL, t3 = NULL;\n\t\tsplit(t, t1, t2, i);\n\t\tsplit(t2, t2, t3, 1);\t\t\n\t\tt2->key = x;\n\t\tmerge(t2, t2, t3);\n\t\tmerge(t, t1, t2);\t\n\t}\t\n\n\tbool to_front_and_set_and_check(int i, int x) {\n\t\tpitem t1 = NULL, t2 = NULL, t3 = NULL;\n\t\tsplit(t, t1, t2, i);\n\t\tsplit(t2, t2, t3, 1);\t\t\n\t\tif (t2->key.first != x && t2->key.first != 0) return false;\n\t\tif (t2->key.first == 0 && !can[x]) return false;\t\t\n\t\tt2->key.first = x;\t\t\n\t\tmerge(t1, t2, t1);\n\t\tmerge(t, t1, t3);\n\t\treturn true;\n\t}\n\tpitem t; \n};\n\ndich< pair<int, int> > a;\n\nbool cmp1(pair<int, int> a, pair<int, int> b) {\n\treturn a.second < b.second;\n}\n\nint main() {\n\tios::sync_with_stdio(0);\t\n\t//freopen(\"input.txt\",\"r\",stdin); freopen(\"output.txt\",\"w\",stdout);\t\n\n\tcin >> n >> m;\n\t\n\tfor (int i = 0; i < n; i++) {\n\t\ta.insert(i, make_pair(0, i));\n\t\tcan[i] = true;\n\t}\n\tcan[n] = true;\n\n\tfor (int i = 1; i <= m; i++) {\t\t\n\t\tcin >> x >> y;\t\t\t\t\n\t\ty--;\t\t\t\t\t\t\t\t\n\t\tif (!a.to_front_and_set_and_check(y, x)) {\n\t\t\tcout << -1;\n\t\t\treturn 0;\n\t\t}\n\t\tcan[x] = false;\t\n\t}\n\n\tvector< int > v(n);\n\tfor (int i = 0; i < n; i++) {\n\t\tpair<int, int> pr = a.get(i);\n\t\tv[pr.second] = pr.first;\t\n\t}\n\n\tint it = 1;\n\twhile (can[it] != true) it++;\n\tfor (int i = 0; i < v.size(); i++)\n\t\tif (v[i] == 0) {\n\t\t\tprintf(\"%d \",it++); \n\t\t\twhile (!can[it]) it++;\n\t\t} else printf(\"%d \", v[i]);\n}", "lang": "GNU C++0x", "bug_code_uid": "760f6898433465a0595043d4a35e62fc", "src_uid": "a2616b1681f30ce4b2a5fdc81cf52b50", "apr_id": "f2d4c20c20fe5a38c68b71413b2a0967", "difficulty": 2200, "tags": ["data structures"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.615619495008808, "equal_cnt": 40, "replace_cnt": 23, "delete_cnt": 7, "insert_cnt": 9, "fix_ops_cnt": 39, "bug_source_code": "#include <vector>\n#include <map>\n#include <set>\n#include <queue>\n#include <stack>\n#include <bitset>\n#include <algorithm>\n#include <functional>\n#include <numeric>\n#include <sstream>\n#include <iostream>\n#include <iomanip>\n#include <cmath>\n#include <ctime>\n#include <float.h>\n#include <cassert>\n\nusing namespace std;\n\n#define REP(i, from, to) for (int i = (from); i < (to); ++i)\n#define FOR(i, n) REP(i, 0, (n))\n#define ALL(x) x.begin(), x.end()\n#define SIZE(x) (int)x.size()\n#define PB push_back\n#define MP make_pair\n\ntypedef long long i64;\ntypedef vector<int> VI;\ntypedef vector<VI> VVI;\ntypedef vector<string> VS;\ntypedef vector<VS> VVS;\ntypedef pair<int, int> PII;\n\nvector<int> t;\nint n;\n\nvoid init (int nn)\n{\n    n = nn;\n    t.assign (n, 0);\n}\n\nint sum (int r)\n{\n    int result = 0;\n    for (; r >= 0; r = (r & (r+1)) - 1)\n        result += t[r];\n    return result;\n}\n\nvoid inc (int i, int delta)\n{\n    for (; i < n; i = (i | (i+1)))\n        t[i] += delta;\n}\n\nint sum (int l, int r)\n{\n    return sum (r) - sum (l-1);\n}\n\nvoid init (vector<int> a)\n{\n    init ((int) a.size());\n    for (unsigned i = 0; i < a.size(); i++)\n        inc (i, a[i]);\n}\n\nint findIndex(int index) {\n    int l = 0, r = n;\n    while (l < r) {\n        int const m = (l + r) >> 1;\n        int const count = sum(m);\n        if (count < index)\n            l = m + 1;\n        else\n            r = m;\n    }\n\n    return l;\n}\n\nvoid test(int m, VI a) {\n    int const n = SIZE(a);\n    cout << n << endl;\n    while (m--) {\n        int const y = rand() % n;\n        int const x = a[y];\n\n        cout << x << \" \" << y + 1 << endl;\n        a.erase(a.begin() + y);\n        a.insert(a.begin(), x);\n    }\n\n    cout << \"Will be:\\n\";\n    FOR (i, SIZE(a)) cout << a[i] << \" \";\n    cout << endl;\n}\n\n//#define DEBUG\n\nint main() {\n    freopen(\"input.txt\", \"r\", stdin);\n\n    {\n        VI a = {1,2,3};\n        //test(5, a);\n    }\n\n    ios_base::sync_with_stdio(false);\n\n    int size, m;\n    cin >> size >> m;\n\n    int const origSize = size;\n    n = 2 * (m + n);\n    init(n);\n    FOR (i, size) inc(i, 1);\n\n    VI index(size);\n    VI state(2 * size + 100);\n\n    VI position(origSize + 10, -1);\n\n    FOR (i, m) {\n        int x, y;\n        cin >> x >> y;\n\n        int const needIndex = origSize - y + 1;\n        int const whereIndex = findIndex(needIndex);\n\n#ifdef DEBUG\n        {\n            cout << \"x = \" << x << \", y = \" << y << endl;\n            cout << \"needIndex = \" << needIndex << endl;\n            cout << \"whereIndex = \" << whereIndex << endl;\n            cout << \"position[\" << x << \"] = \" << position[x] << endl;\n            cout << \"prev position index = \" << sum(position[x]) << endl;\n        }\n#endif\n\n        int const whatThere = state[whereIndex];\n        if (whatThere && whatThere != x) {\n            //cout << \"another number is at the \" << whereIndex << \" position.\\n\";\n            cout << \"-1\\n\";\n            return 0;\n        }\n\n        if (position[x] != -1 && sum(position[x]) != needIndex) {\n            cout << \"-1\\n\";\n            return 0;\n        }\n\n        inc(whereIndex, -1);\n        state[size] = x;\n        inc(size, 1);\n        position[x] = size;\n\n#ifdef DEBUG\n        cout << \"size = \" << size << endl;\n\n        cout << \"State: \";\n        FOR (i, size + 1) {\n            cout << sum(i, i) << \" \";\n        }\n        cout << endl;\n\n        cout << \"sum(position[x]) = \" << sum(position[x]) << endl;\n        assert(sum(position[x]) == origSize);\n        cout << \"new position[\" << x << \"] = \" << position[x] << endl;\n#endif\n        ++size;\n\n        if (whereIndex < origSize) {\n            index[origSize - whereIndex - 1] = x;\n#ifdef DEBUG\n            cout << \"write to \" << origSize - whereIndex - 1 << \", x = \" << x << endl;\n#endif\n        }\n    }\n\n    set<string> notUsed;\n    FOR (i, origSize) {\n        ostringstream oss;\n        oss << i + 1;\n        notUsed.insert(oss.str());\n    }\n    FOR (i, origSize) if (index[i]) {\n        ostringstream oss;\n        oss << index[i];\n        notUsed.erase(oss.str());\n    }\n\n    FOR (i, origSize) {\n        if (i) cout << \" \";\n        if (!index[i]) {\n            index[i] = atoi((*notUsed.begin()).c_str());\n            notUsed.erase(notUsed.begin());\n        }\n        cout << index[i];\n    }\n\n    cout << endl;\n\n    return 0;\n}\n", "lang": "GNU C++0x", "bug_code_uid": "7608f7f5fb7ca6b687fc29dfc652d561", "src_uid": "a2616b1681f30ce4b2a5fdc81cf52b50", "apr_id": "7ba970ef0a865bb9c2997b3e71928ac2", "difficulty": 2200, "tags": ["data structures"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9991474850809889, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n#define M 1000000007LL\ntypedef long long ll;\n#define all(a) a.begin() , a.end()\nll power(ll a, ll b)\n{\n    if(b==0)    return 1LL;\n    if(b==1)    return a%M;\n    if(b%2==0)  return power((a%M * a%M)%M , b/2) %M;\n    return  (a%M * power((a%M * a%M)%M , (b-1)/2)%M) %M;\n}\nint main()\n{\n    ios_base::sync_with_stdio(false);\n    cin.tie(NULL);    \n    freopen(\"input.txt\" , \"r\" , stdin);\n    ll x,n;\n    cin>>x>>n;\n    vector<ll> pf;\n    if(x%2==0)\n    {\n        pf.push_back(2);\n        while(x%2==0)   x/=2;\n    }\n    for(ll i=3;i*i<=x;i+=2)\n    {\n        if(x%i==0)\n        {\n            pf.push_back(i);\n            while(x%i==0)   x/=i;\n        }\n    }\n    if(x>2) pf.push_back(x);\n    sort(all(pf));\n    ll ans=1,prev=0;\n    for(ll kk: pf)\n    {\n        ll temp=kk;\n        while(1)\n        {\n            if(n/temp < kk) break;\n            else temp*=kk;\n        }\n        prev=0;\n        while(temp>=kk)\n        {\n            ll pp=(n/temp)-prev;\n            prev=n/temp;\n            pp = power(temp%M,pp)%M;\n            ans= (ans%M * pp%M ) % M;\n            temp/=kk;\n        }\n    }\n    cout<<ans<<\"\\n\";\n    return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "462751c3cfd66fe631eb35823d785c3a", "src_uid": "04610fbaa746c083dda30e21fa6e1a0c", "apr_id": "d44b6e56daf88f4f1df1409d85f960c3", "difficulty": 1700, "tags": ["math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.027410207939508508, "equal_cnt": 7, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.28010.2050\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"MinimumTriangulation\", \"MinimumTriangulation\\MinimumTriangulation.vcxproj\", \"{633E15BA-0B29-4130-A608-AAF297BB8BD8}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|x64 = Debug|x64\n\t\tDebug|x86 = Debug|x86\n\t\tRelease|x64 = Release|x64\n\t\tRelease|x86 = Release|x86\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{633E15BA-0B29-4130-A608-AAF297BB8BD8}.Debug|x64.ActiveCfg = Debug|x64\n\t\t{633E15BA-0B29-4130-A608-AAF297BB8BD8}.Debug|x64.Build.0 = Debug|x64\n\t\t{633E15BA-0B29-4130-A608-AAF297BB8BD8}.Debug|x86.ActiveCfg = Debug|Win32\n\t\t{633E15BA-0B29-4130-A608-AAF297BB8BD8}.Debug|x86.Build.0 = Debug|Win32\n\t\t{633E15BA-0B29-4130-A608-AAF297BB8BD8}.Release|x64.ActiveCfg = Release|x64\n\t\t{633E15BA-0B29-4130-A608-AAF297BB8BD8}.Release|x64.Build.0 = Release|x64\n\t\t{633E15BA-0B29-4130-A608-AAF297BB8BD8}.Release|x86.ActiveCfg = Release|Win32\n\t\t{633E15BA-0B29-4130-A608-AAF297BB8BD8}.Release|x86.Build.0 = Release|Win32\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {884BAD39-E042-4223-9661-79BF82D2ECD2}\n\tEndGlobalSection\nEndGlobal\n", "lang": "MS C++ 2017", "bug_code_uid": "268bd6f8ea61a6cd3beaf24921c68384", "src_uid": "1bd29d7a8793c22e81a1f6fd3991307a", "apr_id": "96b19fd5b7d494773935475ea065ee43", "difficulty": 1200, "tags": ["dp", "math", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8973747016706444, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "#include<iostream>\n#include<string>\nusing namespace std;\n\nint main(){\nint n ,f,c;\nstring ch;\n\n\ndo {\n    cin>>n;\n    cin>>ch;\n   }\n    while ((n<=2)||(n>=100)||(ch.size()!=n));\n    c=0;\n   f=0;\n\nfor (int i=0;i<n;i++){\n if ((ch[i]=='S')&&(ch[i+1]=='F'))\n    c=c+1;\n   if ((ch[i]=='F')&&(ch[i+1]=='S'))\n        f=f+1;}\n    if (c>f)\n        {cout<<\"YES\"<<endl;}\n else\n    {cout<<\"NO\"<<endl;}\n\n\n\n\n\n    return 0;\n}\n", "lang": "MS C++ 2017", "bug_code_uid": "ada56cf1ceab1308f7d1f530a99edd21", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "apr_id": "64a00b1cfee1d3b435e2a82f1bf4d938", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9978876214617659, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include <bits/stdc++.h>\n\nusing namespace std;\n\n#define fi first\n#define se second\n#define pb push_back\n#define sz(x)  ((int)x.size ())\n#define all(x) (x).begin(), (x).end()\n#define re return\n#define mp make_pair\n#define sqrt(x) sqrt (abs(x))\n#define y0 y3451\n#define y1 y4562\n#define unq(x) (x.resize(unique(all(x)) - x.begin()))\n#define x0 j25624\n#define x1 j45624\n#define makeunq(x) sort(all(x)), (x).resize (unique(x) - (x).begin())\n\ntypedef pair <int, int> ii;\ntypedef long long ll;\ntypedef unsigned long long ull;\ntypedef double D;\ntypedef long double ld;\ntypedef unsigned int uint;\ntypedef vector <string> vs;\ntypedef vector <int> vi;\ntypedef vector <ii> vii;\ntypedef vector <vi> vvi;\n\ntemplate <class T> T abs (T x) { re x > 0 ? x : -x; }\ntemplate <class T> T sqr (T x) { re x * x; }\ntemplate <class T> T gcd (T a, T b) { re a ? gcd (b % a, a) : b; }\ntemplate <class T> int sgn (T x) { re x > 0 ? 1 : (x < 0 ? -1 : 0); }\n\nconst ld pi = 2 * asinl((ld)1.0);\n\null a[105];\n\nmain()\n{ ull n;\n  cin>>n;\n  a[0]=1;  int ans;\n  a[1]=1;\n  for(i=2; ;i++)\n   {  a[i]=a[i-1]+a[i-2];\n       if(a[i]==n)  {ans=i-1; break;}\n        if(a[i]>n)   {ans=i-2;break;}\n\n\n   }\n  cout<<ans;\n \n}\n     ", "lang": "GNU C++14", "bug_code_uid": "9c9bae95ca2ad271d615b5e573b86414", "src_uid": "3d3432b4f7c6a3b901161fa24b415b14", "apr_id": "ec093b0e95803599d21bd31bb0442f96", "difficulty": 1600, "tags": ["math", "combinatorics", "greedy", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.9958702064896755, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "#include<iostream>\n#include<algorithm>\n#include<string>\n#include<vector>\n#include<map>\n#include<set>\n#include<queue>\n#include<list>\n#include<cstdlib>\n#include<cmath>\n#include<sstream>\n#include<numeric>\n#include<cstdio>\n#include<cstring>\n#include<stack>\n#define PI acos(-1)\n#define MP make_pair\n#define PB push_back\n#define VI vector <int>\n#define PII pair <int,int>\n#define LL long long\n#define SET(v,i) memset(v, i, sizeof(v))\n#define FOR(i,a,b) for (int i = (a); i <= (b); i++)\n#define FORD(i,a,b) for (int i = (a); i >= (b); i--)\n#define FORN(i,a,b) for (int i = (a); i < (b); i++)\n#define DOWN(i,a,b) for (int i = (a); i > (b); i--)\n#define FIT(it,v) for (typeof(v.begin()) it = v.begin(); it != v.end(); it++)\n#define FITD(it,v) for (typeof(v.rbegin()) it = v.rbegin(); it != v.rend(); it++)\nusing namespace std;\nconst int N=4005,mod=1000000007;\nLL c[N][4],f[4];\ntemplate<class T>\ninline T gcd(T a,T b){\n    if(a<b)swap(a,b);\n    for(T r;b;r=a%b,a=b,b=r);\n    return a;   \n    }\nint main(){\n\tint w,h;\n\tscanf(\"%d%d\",&w,&h);\n\tc[0][0]=1;\n\tfor(int i=1;i<N;i++){\n\t\tc[i][0]=1;\n\t\tfor(int j=1;j<4;j++)c[i][j]=(c[i-1][j]+c[i-1][j-1])%mod;\n\t\t}\n\t\n\tmemset(f,0,sizeof(f));\t\n\tfor(int i=0;i<=w;i++){\n\t\tfor(int j=0;j<=h;j++){\n\t\t\tf[i%2*2+j%2]++;\n\t\t\t}\n\t\t}\n\t\t\n\tLL cnt=0;//on line\n\tfor(int i=1;i<=w;i++){\n\t\tfor(int j=1;j<=h;j++){\n\t\t\tint k=gcd(i,j);\n\t\t\tcnt+=(w-i+1)*(h-j+1)*(k-1)%mod;\n\t\t\tcnt%=mod;\n\t\t\t}\n\t\t}\t\t\n\tcnt=(cnt*2+c[w+1][3]*(h+1)%mod+c[h+1][3]*(w+1)%mod)%mod;//vertical or horizontal\n\t\n\tLL ans=0,tot=(w+1)*(h+1);\n\tfor(int i=0;i<4;i++){//3 diff or 2 diff\n\t\tans+=c[f[i]][3];\n\t\tans+=c[f[i]][2]*(tot-f[i])%mod;\n\t\tans%=mod; \n\t\t}\t\n\t\n\tans=((ans-cnt)%mod+mod)%mod;\n\tcout<<ans*6%mod<<endl;\t\n    return 0;\n    }\n", "lang": "GNU C++", "bug_code_uid": "6e5a8c7c7bde55cb2d7e106815f4b5e5", "src_uid": "984788e4b4925c15c9c6f31e42f2f8fa", "apr_id": "e4190151a19d4caa4a6235628c8881f6", "difficulty": 2500, "tags": ["geometry", "math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.9169741697416974, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "#include<stdio.h>\n#include<vector>\n#include<algorithm>\nusing namespace std;\ntypedef long long ll;\nll mod=1000000007;\nll po(ll a,ll b)\n{\n\tvector<int>vec;\n\tfor(;;)\n\t{\n\t\tif(b==0)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\tvec.push_back(b%2);\n\t\tb/=2;\n\t}\n\treverse(vec.begin(),vec.end());\n\tll ret=1;\n\tfor(int i=0;i<vec.size();i++)\n\t{\n\t\tret*=ret;\n\t\tret%=mod;\n\t\tif(vec[i])\n\t\t{\n\t\t\tret*=a;\n\t\t\tret%=mod;\n\t\t}\n\t}\n\treturn ret;\n}\nll inv(ll a)\n{\n\treturn po(a,mod-2);\n}\nll kai[100001];\nvoid calc()\n{\n\tkai[0]=1;\n\tfor(int i=1;i<=100000;i++)\n\t{\n\t\tkai[i]=kai[i-1]*i;\n\t\tkai[i]%=mod;\n\t}\n}\nll com(ll a,ll b)\n{\n\tif(a<b)\n\t{\n\t\treturn 0;\n\t}\n\tll ret=kai[a];\n\tret*=inv(kai[b]);\n\tret%=mod;\n\tret*=inv(kai[a-b]);\n\tret%=mod;\n\treturn ret;\n}\nll dp[4002][4002];\nll gcd(ll a,ll b)\n{\n\tif(a>b)\n\t{\n\t\tswap(a,b);\n\t}\n\tif(a==0)\n\t{\n\t\treturn b;\n\t}\n\tfor(;;)\n\t{\n\t\tb%=a;\n\t\tif(!b)\n\t\t{\n\t\t\treturn a;\n\t\t}\n\t\tswap(a,b);\n\t}\n}\nint main()\n{\n\tcalc();\n\tint mx,my;\n\tscanf(\"%d%d\",&mx,&my);\n\tmx++;\n\tmy++;\n\tll a,b,c,d;\n\ta=((mx+1)/2)*((my+1)/2);\n\tb=(mx/2)*((my+1)/2);\n\tc=((mx+1)/2)*(my/2);\n\td=(mx/2)*(my/2);\n\tll ret=0;\n\tll sum=a+b+c+d;\n\tret+=com(a,3);\n\tret+=com(b,3);\n\tret+=com(c,3);\n\tret+=com(d,3);\n\tret+=com(a,2)*(sum-a);\n\tret+=com(b,2)*(sum-b);\n\tret+=com(c,2)*(sum-c);\n\tret+=com(d,2)*(sum-d);\n\tret%=mod;\n\tfor(int i=1;i<mx;i++)\n\t{\n\t\tfor(int j=1;j<my;j++)\n\t\t{\n\t\t\tdp[i+1][j+1]=(dp[i][j+1]+dp[i+1][j]-dp[i][j]+gcd(i,j)-1)%mod;\n\t\t\tret-=dp[i+1][j+1]+dp[i+1][j+1];\n\t\t\tret=(ret+mod+mod)%mod;\n\t\t}\n\t}\n\tret-=mx*com(my,3);\n\tret-=my*com(mx,3);\n\tret%=mod;\n\tif(ret<0)\n\t{\n\t\tret+=mod;\n\t}\n\tret*=6;\n\tret%=mod;\n\tprintf(\"%I64d\\n\",ret);\n}", "lang": "GNU C++", "bug_code_uid": "6b73afe6d31c26635e0a791dac8ec75d", "src_uid": "984788e4b4925c15c9c6f31e42f2f8fa", "apr_id": "e586db529548e7338dde45a39e6921e0", "difficulty": 2500, "tags": ["geometry", "math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9996434937611408, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include<cstdio>\n#include<cstring>\n#include<cmath>\n#include<vector>\n#include<set>\n#include<map>\n#include<queue>\n#include<algorithm>\nusing namespace std;\nconst int M=1000000007;\nlong long dp[2][2];\nint gcd[4010][4010];\nlong long cal(int n,int d1,int d2)\n{\n    if(!(d1&1)&&!(d2&1))\n    {\n        int n1=n/2+1;\n        n1=1LL*n1*(n1-1)*(n1-2)/6%M;\n        int n2=(n+1)/2;\n        n2=1LL*n2*(n2-1)*(n2-2)/6%M;\n        return (n1+n2)%M;\n    }\n    return cal(n+(d1&1)+(d2&1),0,0);\n}\nvector <int> p[10];int cn;\nint main()\n{\n    int n,m;\n    memset(dp,-1,sizeof(dp));\n    vector <int> pp;pp.clear();for(int i=0;i<3;i++)pp.push_back(i);\n    do\n    {\n        p[cn++]=pp;\n    }while(next_permutation(pp.begin(),pp.end()));\n    int cao[5];\n\n    while(~scanf(\"%d %d\",&n,&m))\n    {\n        for(int i=0;i<=n;i++)\n        for(int j=0;j<=m;j++)\n        if(i == 0)gcd[i][j] = j;\n        else if(j == 0)gcd[i][j] = i;\n        else if(i < j)gcd[i][j] = gcd[i][j%i];\n        else gcd[i][j] = gcd[i%j][j];\n        dp[0][0]=cal(m,0,0);\n        dp[0][1]=cal(m,0,1);\n        dp[1][0]=cal(m,1,0);\n        dp[1][1]=cal(m,1,1);\n        long long ans=0,temp,k;\n        int dd,d1,d2,cnt;bool sum;\n        for(int dx1=1;dx1<=n;dx1++)\n        for(int dx2=1;dx2<=n;dx2++)\n        {\n            if(dx1+dx2>n)break;\n            temp=0;\n            for(cao[1]=0;cao[1]<2;++cao[1])\n            for(cao[2]=0;cao[2]<2;++cao[2])\n            {\n                cnt=0;\n                for(int i=0;i<cn;++i)\n                {\n                    sum=0;\n                    if(dx1&1||(cao[p[i][1]]-cao[p[i][0]])&1)sum^=1;\n                    if(dx2&1||(cao[p[i][2]]-cao[p[i][1]])&1)sum^=1;\n                    if((dx1+dx2)&1||(cao[p[i][0]]-cao[p[i][2]])&1)sum^=1;\n                    if(!sum)++cnt;\n                }\n                temp=temp+cnt*dp[cao[1]][cao[2]];\n            }\n            dd=gcd[dx1][dx2];\n            d1=dx1/dd;\n            d2=dx2/dd;\n            k=(m+1)/(d1+d2);\n            temp-=2*(m+1)*k-k*(k+1)*(d1+d2);\n            temp=temp%M*(n+1-dx1-dx2);\n            ans=(ans+temp)%M;\n        }\n\n        int n1=n/2+1;\n        int nn1=1LL*n1*(n1-1)/2%M;\n        int n2=(n+1)/2;\n        int nn2=1LL*n2*(n2-1)/2%M;\n        int nn3=1LL*(n+1)*n/2%M-(nn1+nn2)%M;\n        int m1=m/2+1;\n        int mm1=1LL*m1*(m1-1)/2%M;\n        int m2=(m+1)/2;\n        int mm2=1LL*m2*(m2-1)/2%M;\n        int mm3=1LL*(m+1)*m/2%M-(mm1+mm2)%M;\n\n        ans=(ans+1LL*m*(m+1)%M*(nn1+nn2)%M*(n-1)%M)%M;\n        ans=(ans+1LL*nn3*m1%M*(m1-1)%M*(n-1)%M)%M;\n        ans=(ans+1LL*nn3*m2%M*(m2-1)%M*(n-1)%M)%M;\n\n        ans=(ans+1LL*n*(n+1)%M*(m+1)%M*(mm1+mm2)%M)%M;\n        ans=(ans+1LL*mm3*n1%M*(n1-1)%M*(m+1)%M)%M;\n        ans=(ans+1LL*mm3*n2%M*(n2-1)%M*(m+1)%M)%M;\n\n        ans=6LL*ans%M;\n        ans=(ans+M)%M;\n        printf(\"%d\\n\",ans);\n        return 0;\n    }\n}\n", "lang": "GNU C++", "bug_code_uid": "d189a682646c5b92817b227024675065", "src_uid": "984788e4b4925c15c9c6f31e42f2f8fa", "apr_id": "8266f50032b9ea44090c07a8fe6b75b7", "difficulty": 2500, "tags": ["geometry", "math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.35927051671732524, "equal_cnt": 37, "replace_cnt": 25, "delete_cnt": 2, "insert_cnt": 9, "fix_ops_cnt": 36, "bug_source_code": "#include <iostream>\nusing namespace std;\nconst int NMax = 25;\nint N, M;\nint A[NMax], B[NMax];\nint DP[NMax][NMax];\nint Matrix[NMax * 2][NMax * 2];\nvoid Read()\n{\n    cin >> N >> M;\n    for(int i = 1; i <= N; i++)\n        cin >> A[i];\n    for(int i = 1; i <= N; i++)\n        cin >> B[i];\n}\nvoid initialize()\n{\n    for(int i = 0; i <= 2 * N; i++)\n        DP[0][i] = 0x3f3f3f3f;\n}\nvoid buildDP()\n{\n    DP[0][N] = 0;\n    for(int i = 1; i <= N; i++)\n    {\n        for(int j = - N; j <= N; j++)\n        {\n            DP[i][j + N] = 0x3f3f3f3f;\n            DP[i][j + N] = min(DP[i - 1][j + 1 + N] + B[i], DP[i - 1][j - 1 + N] + A[j]);\n        }\n    }\n}\n\nvoid buildMatrix()\n{\n    for(int i = 0; i <= 2 * N; i++)\n        for(int j = 0; j <= 2 * N; j++)\n            Matrix[i][j] = DP[N][i - j + N];\n}\n\nvoid\nint main()\n{\n    cout << \"Hello world!\" << endl;\n    return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "4c3ecfb41a4f067bdaf9003a7031e586", "src_uid": "f40900973f4ebeb6fdafd75ebe4e9601", "apr_id": "913b34c247623542a1c59085f11cb704", "difficulty": 2500, "tags": ["matrices", "dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9457446808510638, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include<bits/stdc++.h>\n#include<limits.h>\n#define lli long long\n#define ull unsigned long long\n#define f(a,k,m) for(int a=k ; a<m ; a++)\n#define fl(a,k,m) for(long a=k ; a<m ; a++)\n#define fll(a,k,m) for(lli a=k ; a<m ; a++)\n#define rf(a,k,m) for(int a=k ; a>=m ; a--)\n#define rfl(a,k,m) for(long a=k ; a>=m ; a--)\n#define rfll(a,k,m) for(lli a=k ; a>=m ; a--)\n#define pb push_back\n#define mp make_pair\n#define pq priority_queue\n#define M 1000000007\n#define Mcf 998244353\nusing namespace std ;\nint main(){\n    long n, m,r ; \n    cin >> n >> m >> r ;\n    long b[n] ;\n    fl(i,0,n) cin >> b[i] ;\n    long s[m] ;\n    fl(i,0,m) cin >> s[i] ;\n    long* x,*y;\n    x = min_element(b,b+n) ;\n    y = max_element(s,s+m) ;\n    long xx = (*x) ;\n    long yy = (*y) ;\n    if(xx >= yy){\n        cout << r ;\n    }\n    \n    if(r/xx > 0 && yy > xx){\n        cout << r - xx*(r/xx) +  yy*(r/xx) ;\n        \n    }\n    \n\treturn 0 ;\n}", "lang": "GNU C++14", "bug_code_uid": "1891cfda97314d02a1494b9d20ca9869", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "apr_id": "52ae9048376b071953a458f61ec96927", "difficulty": 800, "tags": ["greedy", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.731829573934837, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include <iostream>\n#include <cstring>\nusing namespace std;\nint ct;\nint main(int argc, char** argv) {\n\tint n,a=0;\n\tcin>>n;\n\n\tcout<<(n-1)*2;\n\treturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "c4e6b04a54f7bed574602fc59cf03115", "src_uid": "f8af5dfcf841a7f105ac4c144eb51319", "apr_id": "eee6c52b1db3f03ec501e1ebb92e29c1", "difficulty": 1300, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8253319713993871, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\n\nint main(){\n\tint n,m,b;\n\tcin>>n>>m>>b;\n\tint a[n],e[m];\n\tfor(int i=0; i<n; i++)\n\t\tcin>>a[i];\n\tfor(int i=0; i<m; i++)\n\t\tcin>>e[i];\n\tsort(a,a+n);\n\tsort(e,e+m);\n\tif(e[m-1] <= a[0]){\n\t\tcout<<b<<endl;\n\t\treturn 0;\n\t}\n\tint i=0,j=m-1,count=0;\n\twhile((b > 0) && (b > a[0])){\n\t\tint x=(b/a[i]);\n\t\tb-=(x*a[i]);\n\t\tcount+=x*e[j];\n\t\t//cout<<count<<\"--->\"<<b<<endl;\n\t\ti++;\n\t\tj--;\n\t}\n\tcout<<count+b<<endl;\n\treturn 0;\n}", "lang": "GNU C++17", "bug_code_uid": "a9e067eeaece1debe8d47c9cdb608d25", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "apr_id": "25ad009f464c27bdf907cc73436749f4", "difficulty": 800, "tags": ["greedy", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9898132427843803, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include <iostream>\n#include<string>\n#include<vector>\n#include<algorithm>\n#include<cmath>\n#include <iomanip>\n#include<string.h>\n#include <map>\n#define LL long long\n#define MM 1000000007\nusing namespace std;\nint main()\n{\n    LL n,m,b,i,min=10007,max=0,ans;\n    cin>>n>>m>>b;\n    LL s[n],c[n];\n    for(i=0;i<n;i++)\n    {  \n        cin>>c[i];\n        if(min>c[i])\n        min=c[i];\n    }\n    for(i=0;i<m;i++)\n    {\n        cin>>s[i];\n         if(max<s[i])\n         max=s[i];\n    }\n    \n    if(max<=min)\n    ans=b;\n    else\n    ans=(b/min)*max+(b%min);\n    \n    cout<<ans<<endl;\n    \n\n\treturn 0;\n}", "lang": "GNU C++17", "bug_code_uid": "c06789ac65079dc25190a55913d85a0a", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "apr_id": "7735ea42cdb664b0134bdd75bd9f673c", "difficulty": 800, "tags": ["greedy", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8083815825751309, "equal_cnt": 10, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 9, "bug_source_code": "#include <bits/stdc++.h>\n\ntypedef long long ll;\n//#define int ll\n#define x first\n#define y second\n#define pii pair<int, int>\nusing namespace std;\n\nvector<int> d;\nvector<vector<int>> tmp, g;\nint n, m, k;\nvoid bfs(int v){\n    d.resize(n, INT_MAX);\n    d[v] = 0;\n    queue<int> q;\n    q.push(v);\n    while (!q.empty()){\n        int u = q.front(); q.pop();\n        for (int &t : g[u]){\n            if (d[t] > d[u] + 1){\n                d[t] = d[u]+1;\n                q.push(t);\n            }\n        }\n    }\n    tmp.resize(n);\n    for (int i = 0; i < n; ++i){\n        tmp[d[i]].push_back(i);\n    }\n}\nsigned main() {\n    ios_base::sync_with_stdio(false); cout.tie(0); cin.tie(0);\n    cin >> n >> m;\n    g.resize(n);\n    int f, t;\n    for (int i = 0; i< m; ++i){\n        cin >> f >> t;\n        f--; t--;\n        g[t].push_back(f);\n    }\n    cin >> k;\n    vector<int> path(k);\n    for (int i = 0; i < k; ++i) {\n        cin >> path[i];\n        path[i]--;\n    }\n    bfs(path[k-1]);\n    for (int i = 0; i < n; ++i){\n        sort(tmp[i].begin(), tmp[i].end());\n    }\n    for (int i = 0; i< n; ++i){\n        sort(g[i].begin(), g[i].end());\n    }\n    int mi = 0, ma = 0;\n    for (int i = 1; i < k; ++i){\n        int v = path[i-1], u = path[i], dist = d[v]-1;\n        if (tmp[dist].empty()){\n            mi++;\n            ma++;\n        }\n        else if (tmp[dist].size() == 1){\n            if (tmp[dist][0] != u){\n                mi++;\n                ma++;\n            }\n        }\n        else {\n            if (!binary_search(tmp[dist].begin(), tmp[dist].end(), u)){\n                mi++;\n            }\n            for (int &j : tmp[dist]){\n                if (j == u) continue;\n                if (binary_search(g[j].begin(), g[j].end(), v)){\n                    ma++;\n                    break;\n                }\n            }\n        }\n    }\n    cout << mi << ' ' << ma << '\\n';\n    return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "7e5af2dff6f61fe6afa1ca184c64b4dc", "src_uid": "19a0c05eb2d1559ccfe60e210c6fcd6a", "apr_id": "d89df5949b0edb76253c1724167982b5", "difficulty": null, "tags": ["graphs", "shortest paths"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9986639946559787, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include<bits/stdc++.h>\n\nusing namespace std;\n\nconst int MXN = 2e5 + 10;\n\ntypedef long long llong;\n\nint n, m, k, p[MXN], dp[MXN], ansl, ansr;\nvector<int> g[MXN], g1[MXN];\n\nvoid bfs(int t){\n    for(int i = 1; i <= n; i++){\n        dp[i] = 1e9;\n    }\n    dp[t] = 0;\n    deque<int> q;\n    q.push_back(t);\n    while(!q.empty()){\n        int x = q.front();\n        q.pop_front();\n        for(int i = 0; i < g[x].size(); i++){\n            int to = g[x][i];\n            if(dp[x] + 1 <= dp[to]){\n                dp[to] = dp[x] + 1;\n                q.push_back(to);\n            }\n        }\n    }\n}\n\nint main(){\n    //freopen(\"input.txt\", \"r\", stdin);\n    cin >> n >> m;\n    for(int i = 1; i <= m; i++){\n        int u, v;\n        cin >> u >> v;\n        g[v].push_back(u);\n        g1[u].push_back(v);\n    }\n    cin >> k;\n    for(int i = 1; i <= k; i++){\n        cin >> p[i];\n    }\n    bfs(p[k]);\n    for(int i = 1; i < k; i++){\n        int x = p[i];\n        int mn = 1e9, pos = 0;\n        for(int j = 0; j < g1[x].size(); j++){\n            int to = g1[x][j];\n            if(dp[to] < mn){\n                mn = dp[to];\n                pos = to;\n            }\n        }\n        if(dp[p[i + 1]] > mn){\n            ansl++;\n            ansr++;\n            continue;\n        }\n        for(int j = 0; j < g1[x].size(); j++){\n            int to = g1[x][j];\n            if(dp[to] == mn && p[i + 1] != to){\n                ansr++;\n                break;\n            }\n        }\n    }\n    cout << ansl << ' ' << ansr;\n\n}", "lang": "GNU C++14", "bug_code_uid": "e3604e1cb19ea33508053c8212b1d856", "src_uid": "19a0c05eb2d1559ccfe60e210c6fcd6a", "apr_id": "9526ce3e7a8969bef4aa03effed8b5f0", "difficulty": null, "tags": ["graphs", "shortest paths"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8481848184818482, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <bits/stdc++.h>\ntypedef long long ll;\nusing namespace std;\nint fact(ll x);\nint main()\n{\n    ll a,b;\n    cin>>a>>b;\n    ll ans = min(a,b);\n    cout<<ans<<endl;\n    return 0;\n}\nint fact(ll x)\n{\n    ll ans=1;\n    for (int i=1 ;i<=x;++i)\n    {\n        ans*=i;\n    }\n    return ans;\n}\n", "lang": "GNU C++14", "bug_code_uid": "34e44dee515c0ef1e3f3b37dadedc65c", "src_uid": "7bf30ceb24b66d91382e97767f9feeb6", "apr_id": "c7a29cd240c61afd4308b62695d6ca81", "difficulty": 800, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.2067374250115367, "equal_cnt": 12, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\ntypedef long long ll;\n\nint main() {\n    //ios::sync_with_stdio(false);\n    //cin.tie(0);\n    //cout.tie(0);\n    ll l, r, x, y;\n    cin >> l >> r >> x >> y;\n    int cnt = 0;\n    ll root = sqrtl(x)+1;\n    vector<ll> factors;\n    for(ll i = 2; i <= root; ++i) {\n        if(x%i == 0) {\n            factors.push_back(i);\n            factors.push_back(x/i);\n        }\n    }\n    if(x > 1) factors.push_back(x);\n    root = sqrtl(y)+1;\n    for(ll i = 2; i <= root; ++i) {\n        if(y%i == 0) {\n            vector<ll> temp;\n            temp.push_back(i);\n            temp.push_back(y/i);\n            for(ll f : factors) {\n                if((long double)f*i <= x*y)\n                temp.push_back(f*i);\n                if((long double)f*i <= x*y)\n                temp.push_back(f*y/i);\n            }\n            for(auto &f : temp) factors.push_back(f);\n        }\n    }\n    if(y > 1) {\n        vector<ll> temp;\n        for(ll f : factors) {\n            if((long double)f*y <= x*y)\n            temp.push_back(f*y);\n        }\n        for(auto &f : temp) factors.push_back(f);\n    }\n    factors.push_back(1);\n    factors.push_back(x*y);\n    sort(factors.begin(), factors.end());\n    factors.erase(unique(factors.begin(), factors.end()), factors.end());\n    for(ll f1 : factors) {\n        ll f2 = x*y/f1;\n        if(__gcd(f1,f2) == x && f1*f2/__gcd(f1,f2) == y && f1 <= f2 && f1 >= l && f1 <= r && f2 >= l && f2 <= r) {\n            cnt += 2;\n            if(f1 == f2) {\n                cnt--;\n            }\n        }\n    }\n    cout << cnt << '\\n';\n    return 0;\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "lang": "GNU C++11", "bug_code_uid": "4bd389266706a8ea527d2e6c3c34cd21", "src_uid": "d37dde5841116352c9b37538631d0b15", "apr_id": "e388e405cf84e5341e03b89faf5ab81c", "difficulty": 1600, "tags": ["math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.23794871794871794, "equal_cnt": 10, "replace_cnt": 6, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "#include<iostream>\n#include<vector>\nusing namespace std;\nint main()\n{\n    long long int a, b, x, y,ans=0 ; cin >> x >> y >> a >> b; vector<int> c, d;\n    for (long long int i = 1; (i*x) <= b; i++)if (i*x >= a)c.push_back(i*x); for (long long int i = 1; (i*y) <= b; i++)if (i*y >= a)d.push_back(i*y);\n    vector<int>::iterator it1 = c.begin(), it2 = d.begin();\n    while (it1 < c.end()&&it2 < d.end())\n    {\n        if (*it1 == *it2){ it1++; it2++; ans++; }\n        else if (*it1 < *it2){ it1++; }\n        else it2++;\n    }\n    cout << ans << endl;\n    return 0;\n}", "lang": "MS C++", "bug_code_uid": "a7935ffc9f0de5cc1a0548728dc2d240", "src_uid": "c7aa8a95d5f8832015853cffa1374c48", "apr_id": "c9355130d3eea428671a5e0ce09102c0", "difficulty": 1200, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.898567335243553, "equal_cnt": 10, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 9, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n\nmain ()\n{\n    int a, b, c, d, e, f, i, j = 0, ta, tb, sh = 5, sm = 0, th = 5, tm = 0;\n    char ch;\n    cin >> a >> ta;\n    cin >> b >> tb;\n    cin >> c >> ch >> d;\n    sm += tb;\n    while (sh != c || sm != d)\n    {\n         if (sh >= c && sm > d) {\n            break;\n        }\n        sm += b;\n        while (sm >= 60) {\n            sh++;\n            sm -= 60;\n        }\n\n        if (sh >= c && sm > d) {\n            break;\n        }\n    }\n\n    sm -= tb;\n    while (sm < 0) {\n        sh--;\n        sm += 60;\n    }\n\n    d += ta;\n    while (d >= 60) {\n        c++;\n        d -= 60;\n    }\n\n    while (sh < c || sm < d)\n    {\n        sm += b;\n        while (sm >=60) {\n            sh++;\n            sm -= 60;\n        }\n        j++;\n    }\n    cout << j;\n}\n", "lang": "GNU C++", "bug_code_uid": "2ce93a13c89801aef27db7e120b46c3b", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "apr_id": "f7472b699ab8a00635e3fc11d78e75a2", "difficulty": 1600, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.7358778625954199, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n#define ll int\n\nll n , k , l , c , d , p , xl , np , kl , cd , fnp; \n\nint main(){\n\tcin >> n >> k >> l >> c >> d >> p >> xl >> fnp;\n\tkl = k * l; cd = c * d;\n\tint uuu = kl / xl;\n\tint ans = cd;\n\tif (uuu < ans) ans = uuu;\n\tint kkk = p / np;\n\tif (kkk < ans) ans = kkk;\n\tcout << ans;\n}\n", "lang": "GNU C++", "bug_code_uid": "2eb76289bd779c44d58749dcb6c39470", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "apr_id": "77690182ffef929ba3cd2d081097a8ac", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6836158192090396, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\n\n\ntypedef struct aa{\n\tint a,b,w;\n}AA;\nint n;\nAA a[200200];\nbool tri(int a,int b,int c){\n\tif(a+b<=c) return false;\n\tif(b+c<=a) return false;\n\tif(a+c<=b) return false;\n\treturn true;\n}\nint main(){\n\tint i,j;\n\twhile(scanf(\"%d\",&n)!=EOF){\n\t\tint l=0;\n\t\tfor(i=1;i<n;i++){\n\t\t\tfor(j=i+1;j<=n;j++){\n\t\t\t\ta[l].a=i;\n\t\t\t\ta[l].b=j;\n\t\t\t\ta[l++].w=(i^j);\n\t\t\t}\n\t\t}\n\t\tint ans=0;\n\t\tfor(i=0;i<l;i++){\n\t\t\tfor(j=a[i].b+1;j<=n;j++){\n\t\t\t\tif(a[i].a==j || a[i].b==j) continue;\n\t\t\t\tif((a[i].w^j)==0){\n\t\t\t\t\tif(tri(a[i].a,a[i].b,j)) ans++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\\n\",ans);\n\t}\n}\n", "lang": "GNU C++11", "bug_code_uid": "3db0e5c991562148938a66205528502c", "src_uid": "838f2e75fdff0f13f002c0dfff0b2e8d", "apr_id": "b4642c24c51ddd4c3fc17c47c53cce7b", "difficulty": 1300, "tags": ["brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6917293233082706, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\n\n\ntypedef struct aa{\n\tint a,b,w;\n}AA;\nint n;\nAA a[60000000];\nbool tri(int a,int b,int c){\n\tif(a+b<=c) return false;\n\tif(b+c<=a) return false;\n\tif(a+c<=b) return false;\n\treturn true;\n}\nint main(){\n\tint i,j;\n\twhile(scanf(\"%d\",&n)!=EOF){\n\t\tint l=0;\n\t\tfor(i=1;i<n;i++){\n\t\t\tfor(j=i+1;j<=n;j++){\n\t\t\t\ta[l].a=i;\n\t\t\t\ta[l].b=j;\n\t\t\t\ta[l++].w=(i^j);\n\t\t\t}\n\t\t}\n\t\tint ans=0;\n\t\tfor(i=0;i<l;i++){\n\t\t\tfor(j=a[i].b+1;j<=n;j++){\n\t\t\t\tif(a[i].a==j || a[i].b==j) continue;\n\t\t\t\tif((a[i].w^j)==0){\n\t\t\t\t\tif(tri(a[i].a,a[i].b,j)) ans++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\\n\",ans);\n\t}\n}\n", "lang": "GNU C++11", "bug_code_uid": "2adfc758b808ac97e6a2c63906ab570e", "src_uid": "838f2e75fdff0f13f002c0dfff0b2e8d", "apr_id": "b4642c24c51ddd4c3fc17c47c53cce7b", "difficulty": 1300, "tags": ["brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8782287822878229, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n\nint n, m, N, T;\nint dx[5] = { -1,1,0,0 }, dy[5] = { 0,0,-1,1 }, dz[3] = { -1,1 };\nint ddx[9] = { -1,-1,-1,0,0,1,1,1 }, ddy[9] = { -1,0,1,-1,1,-1,0,1 };\n\nint a[31], b[31];\n\nint main(void)\n{\n\tint r; scanf(\"%d %d %d\", &n, &m, &r);\n\tfor (int i = 0; i < n; i++)\n\t{\n\t\tscanf(\"%d\", &a[i]);\n\t}\n\tfor (int i = 0; i < m; i++)\n\t{\n\t\tscanf(\"%d\", &b[i]);\n\t}\n\tint mx = r;\n\tfor (int i = 0; i < n; i++)\n\t{\n\t\tint t = ((r / a[i]) * b[i + 1]) + r % a[i];\n\t\tmx = max(mx, t);\n\t}\n\tprintf(\"%d\", mx);\n}", "lang": "GNU C++14", "bug_code_uid": "14a5cc92f7666c0a9aff1fb7e2ec96cb", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "apr_id": "6c532f1db49bc258c66deaa85004c59a", "difficulty": 800, "tags": ["greedy", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.5719424460431655, "equal_cnt": 20, "replace_cnt": 15, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 19, "bug_source_code": "#include <iostream>\n#include <vector>\n#include <cmath>\n#include <cstdlib>\n#include <iomanip>\n#include <algorithm>\n#include <map>\n#include <unordered_map>\n#include <set>\n#include <unordered_set>\n#include <cstring>\n#include <deque>\n#include <queue>\n#include <numeric>\n#include <sstream>\n#include <ext/pb_ds/assoc_container.hpp>\n#include <ext/pb_ds/tree_policy.hpp>\nusing namespace std;\nusing namespace __gnu_pbds;\ntypedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;\nlong long C(long long n, int k) {\n    if (k == 2)\n        return n * (n - 1) / 2;\n    else\n        return n * (n - 1) * (n - 2) / 6;\n}\nint main() {\n    ios_base::sync_with_stdio(false);\n    cin.tie(0), cout.tie(0);\n    long long n;\n    long double p;\n    cin >> n >> p;\n    vector<vector<long double>> dp(n + 1, vector<long double> (n + 1));\n    dp[1][1] = dp[2][2] = 1;\n    dp[2][1] = 0.5;\n    for (int i = 4 - n % 2; i <= n; i += 2) {\n        for (int j = 1; j <= i; ++j) {\n            dp[i][j] = (C(j, 3) * ((j - 2 + (i - j) * dp[i - 2][j - 2])) + (i - j) * C(j, 2) * (j - 1 + (i - j - 1) * dp[i - 2][j - 1]) + j * C(i - j, 2) * (2 * j - 1 + (i - j - 2) * dp[i - 2][j] + (i - j - 1) * dp[i - 2][j - 1]) / 2 + C(i - j, 3) * (j + (i - j - 2) * dp[i - 2][j])) / (i - 2) / C(i, 3);\n        }\n    }\n    int i = 0;\n    while (dp[n][i] < p)\n        ++i;\n    cout << i;\n    return 0;\n}", "lang": "MS C++ 2017", "bug_code_uid": "62d13126d09039c16ddc5b946d35ba26", "src_uid": "788ed59a964264bd0e755e155a37e14d", "apr_id": "c8fbe504ceb799d54080e7fa3dfd3e52", "difficulty": 2000, "tags": ["probabilities", "math", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.7721051488159896, "equal_cnt": 34, "replace_cnt": 11, "delete_cnt": 9, "insert_cnt": 13, "fix_ops_cnt": 33, "bug_source_code": "#include<bits/stdc++.h>\r\n#pragma GCC optimize(\"Ofast\")\r\nusing namespace std;\r\n#define ll long long\r\n#define PII pair<int,int>\r\nconst ll N=50 , INF=1e9 , mod=998244353 , Z=180;\r\n\r\nstruct Matrix\r\n{\tll M[Z][Z];\r\n\t\r\n\tll* operator[](int i) {\t  return M[i];\t}\r\n\r\n\tMatrix operator *(const Matrix& B)\r\n\t{\tstatic Matrix T1;\r\n\t\tmemset(T1.M,0,sizeof T1.M);\r\n\t\tfor(int i=0;i<Z;i++)\r\n\t\tfor(int j=0;j<Z;j++)\r\n\t\tfor(int k=0;k<Z;k++)\r\n\t\tT1[i][j]+=M[i][k]*B[k][j],T1[i][j]%=mod;\r\n\t\treturn T1;\r\n\t}\r\n\t\r\n\t\r\n};\r\n\tMatrix fmi(Matrix& G, ll pow)\r\n\t{\t\r\n\t\tstatic Matrix T2;\r\n\t\tmemset(T2.M,0,sizeof T2.M);\r\n\t\tfor(int i=0;i<Z;i++) T2[i][i]=1;\r\n\t\t\r\n\t\twhile(pow)\r\n\t\t{\tif(pow&1) T2=T2*G;\r\n\t\t\tG=G*G;\r\n\t\t\tpow>>=1;\r\n\t\t}\r\n\t\treturn T2;\r\n\t}\r\n\t\r\nMatrix M0,M1,res;\r\n\r\nstruct Trie\r\n{\t\r\n\tint ch[N][26];\r\n\tbool ed[N];\r\n\tint idx=0;\r\n\t\r\n\tvoid insert(char s[])\r\n\t{\tint p=0;\r\n\t\tfor(int i=0;s[i];i++)\r\n\t\t{\tint c=s[i]-'a';\r\n\t\t\tif(!ch[p][c]) ch[p][c]=++idx;\r\n\t\t\tp=ch[p][c];\r\n\t\t}\r\n\t\ted[p]=1;\r\n\t}\r\n\t\r\n\tint mp[3000],idn;\r\n\tbool ED[3000];\r\n\t\r\n\tint dfs(int u,int v)\r\n\t{\tif(mp[u*N+v]) return mp[u*N+v];\r\n\t\t\r\n\t\tmp[u*N+v]=++idn;\r\n\t\tED[idn]=(ed[u]&&ed[v]);\r\n\t\tint x=idn , su , sv ;\r\n\t\t\r\n\t\tfor(int i=0;i<26;i++)\r\n\t\t{\t\r\n\t\t\tif(ch[u][i])\r\n\t\t\t{\t\r\n\t\t\t\tif(ch[v][i])\r\n\t\t\t\t{\tsu=ch[u][i] , sv=ch[v][i];\r\n\t\t\t\t\tM1[x][dfs(su,sv)]++;\r\n\t\t\t\t}\r\n\t\t\t\tif(ed[v]&&ch[0][i])\r\n\t\t\t\t{\tsu=ch[u][i] , sv=ch[0][i];\r\n\t\t\t\t\tM1[x][dfs(su,sv)]++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(ed[u]&&ch[0][i])\r\n\t\t\t{\tif(ch[v][i])\r\n\t\t\t\t{\tsu=ch[0][i] , sv=ch[v][i];\r\n\t\t\t\t\tM1[x][dfs(su,sv)]++;\r\n\t\t\t\t}\r\n\t\t\t\tif(ed[v]&&ch[0][i])\r\n\t\t\t\t{\tsu=ch[0][i] , sv=ch[0][i];\r\n\t\t\t\t\tM1[x][dfs(su,sv)]++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn mp[u*N+v];\r\n\t}\r\n\t\r\n\tvoid solve(int m)\r\n\t{\tidn=0;\r\n\t\tmemset(mp,0,sizeof mp);\r\n\t\tmemset(ED,0,sizeof ED);\r\n\t\t\r\n\t\tfor(int c=0;c<26;c++) if(ch[0][c]) dfs(ch[0][c],ch[0][c]); \r\n\t\t\r\n\t\tfor(int c=0;c<26;c++) if(ch[0][c]) M0[0][mp[ch[0][c]*N+ch[0][c]]]++;\r\n\t\tres=M0*fmi(M1,m-1);\r\n\t\tll ans=0;\r\n\t\tfor(int i=1;i<=idn;i++) if(ED[i]) ans=(ans+res[0][i])%mod;\r\n\t\tprintf(\"%lld\",ans);\r\n\t}\r\n\t\r\n}trie;\r\n\r\nchar s[10];\r\nsigned main()\r\n{\tint n,m;scanf(\"%d %d\",&n,&m);\r\n\tfor(int i=1;i<=n;i++) scanf(\"%s\",s),trie.insert(s);\r\n\ttrie.solve(m);\r\n    return 0;\r\n}\r\n", "lang": "GNU C++14", "bug_code_uid": "1088ded40031161b3c5b4c3eaca73a51", "src_uid": "711d15e11016d0164fb2b0c3756e4857", "apr_id": "85bf6884ed11a98c636b060c8aadecc0", "difficulty": 2700, "tags": ["dp", "matrices", "data structures", "string suffix structures", "brute force", "strings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.992434988179669, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "#include<cstdio>\r\n#include<cstring>\r\n#include<algorithm>\r\n#include<map> \r\n#define int long long\r\n#define pa pair<int ,int >\r\n#define mp make_pair \r\nusing namespace std;\r\ninline int read(){int x=0,f=1,ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-') f=-1; ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} return x*f;}\r\ninline void write(int x){if (x<0) putchar('-'),x=-x; if (x>=10) write(x/10); putchar(x%10+'0');}\r\ninline void writeln(int x){write(x); puts(\"\");}\r\nconst int N=45,M=161,mod=998244353;\r\nint root,n,m,cnt,End[N],tran[N][26];\r\nchar s[N];\r\ninline void insert(){\r\n\r\n\tint now=root,len=strlen(s+1);\r\n\tfor (int i=1;i<=len;i++){\r\n\t\tint c=s[i]-'a';\r\n\t\tif (tran[now][c]==-1) tran[now][c]=++cnt;\r\n\t\t now=tran[now][c];\r\n\t}\r\n\tEnd[now]|=1;\r\n}\r\ninline void init(){\r\n\tmemset(tran,-1,sizeof tran);\r\n\tn=read(); m=read(); root=0;\r\n\tfor (int i=1;i<=n;i++){\r\n\t\tscanf(\"%s\",s+1);\r\n\t\tinsert();\r\n\t}\r\n}\r\nstruct matrix{\r\n\tint mat[M][M];\t\r\n\tmatrix() {memset(mat,0,sizeof(mat));}\t\r\n\tmatrix operator * (const matrix &C) const\r\n\t{\r\n\t\tmatrix ans;\r\n\t\tfor(int i=0;i<M;i++)\r\n\t\t\tfor(int j=0;j<M;j++)\r\n\t\t\t\tfor(int k=0;k<M;k++)\r\n\t\t\t\t\tans.mat[i][j]=(ans.mat[i][j]+mat[i][k]*C.mat[k][j]%mod)%mod;\r\n\t\treturn ans;\r\n\t}\r\n}A;\r\npa q[M];\r\nint h,t;\r\nmap<pa,int >id;\r\nint get(pa p){\r\n\tif (p.first>p.second) swap(p.first,p.second);\r\n\tif (!id.count(p)){\r\n\t\tint k=id.size();\r\n\t\tid[p]=k;\r\n\t\tq[++t]=p;\r\n\t}\r\n\treturn id[p];\r\n}\r\ninline matrix pow(matrix B,int k){\r\n\tmatrix C;\r\n\tfor (int i=0;i<M;i++) C.mat[i][i]=1;\r\n\tfor (;k;k>>=1,B=B*B){\r\n\t\tif (k&1) C=C*B;\r\n\t}\r\n\treturn C;\r\n}\r\ninline void solve(){\r\n\tid[mp(0,0)]=0; q[++t]=(pa){0,0};\r\n\twhile (h<t){\r\n\t\tpa u=q[++h];\r\n\t\tint x=get(u);\r\n\t\tfor (int c=0;c<26;c++){\r\n\t\t\tpa nxt=mp(tran[u.first][c],tran[u.second][c]);\r\n\t\t\tif (nxt.first==-1||nxt.second==-1) continue;\r\n\t\t\tA.mat[x][get(nxt)]++;\r\n\t\t\tif (End[tran[u.first][c]]) A.mat[x][get(mp(0,nxt.second))]++;\r\n\t\t\tif (End[tran[u.second][c]]) A.mat[x][get(mp(nxt.first,0))]++;\r\n\t\t\tif (End[tran[u.first][c]]&&End[tran[u.second][c]]) A.mat[x][0]++;\r\n\t\t}\r\n\t}\r\n\twriteln(pow(A,m).mat[0][0]);\r\n} \r\nsigned main(){\r\n\tinit(); solve();\r\n\treturn 0;\r\n} ", "lang": "GNU C++14", "bug_code_uid": "81edc2b350ce002da7666a12e59ef34c", "src_uid": "711d15e11016d0164fb2b0c3756e4857", "apr_id": "4f445e60e80f97c35a67c9036ca244bd", "difficulty": 2700, "tags": ["dp", "matrices", "data structures", "string suffix structures", "brute force", "strings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9754136029411765, "equal_cnt": 14, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 13, "bug_source_code": "#include <bits/stdc++.h>\r\n\r\nusing namespace std;\r\n\r\ntemplate<class Fun>\r\nclass y_combinator_result {\r\n  Fun fun_;\r\npublic:\r\n  template<class T>\r\n  explicit y_combinator_result(T &&fun): fun_(std::forward<T>(fun)) {}\r\n \r\n  template<class ...Args>\r\n  decltype(auto) operator()(Args &&...args) {\r\n    return fun_(std::ref(*this), std::forward<Args>(args)...);\r\n  }\r\n};\r\n \r\ntemplate<class Fun>\r\ndecltype(auto) make_fun(Fun &&fun) {\r\n  return y_combinator_result<std::decay_t<Fun>>(std::forward<Fun>(fun));\r\n}\r\n\r\nint main() {\r\n  ios::sync_with_stdio(false);\r\n  cin.tie(0);\r\n  int n, m;\r\n  cin >> n >> m;\r\n  struct Node {\r\n    char c;\r\n    int cnt;\r\n    vector<Node*> sons;\r\n    Node(char _c = 0, char _cnt = 0): c(_c), cnt(_cnt) {\r\n      sons.clear();\r\n    }\r\n  };\r\n  Node* root = new Node();\r\n  auto insert = make_fun([&](auto insert, Node* cur, const string& s, int depth) -> void {\r\n    if (depth == (int)s.size()) {\r\n      cur->cnt += 1;\r\n      return;\r\n    }\r\n    for (auto son: cur->sons) {\r\n      if (son->c == s[depth]) {\r\n        insert(son, s, depth + 1);\r\n        return;\r\n      }\r\n    }\r\n    cur->sons.push_back(new Node(s[depth], 0));\r\n    insert(cur->sons.back(), s, depth + 1);\r\n  });\r\n  for (int i = 0; i < n; i++) {\r\n    string s;\r\n    cin >> s;\r\n    insert(root, s, 0);\r\n  }\r\n  map<Node*, string> path;\r\n  auto dfs = make_fun([&](auto dfs, Node* cur) -> void {\r\n    for (auto son: cur->sons) {\r\n      if (cur == root) {\r\n        path[son] = son->c;\r\n      } else {\r\n        path[son] = path[cur] + son->c;\r\n      }\r\n      dfs(son);\r\n    }\r\n  });\r\n  dfs(root);\r\n  vector<pair<Node*, Node*>> states;\r\n  for (auto t: path) {\r\n    states.push_back(make_pair(t.first, t.first));\r\n  }\r\n  for (auto t1: path) {\r\n    string s1 = t1.second;\r\n    for (auto t2: path) {\r\n      string s2 = t2.second;\r\n      if (s1.size() < s2.size()) {\r\n        if (s2.substr((int)s2.size() - (int)s1.size()) == s1) {\r\n          states.push_back(make_pair(t1.first, t2.first));\r\n          states.push_back(make_pair(t2.first, t1.first));\r\n        }\r\n      }\r\n    }\r\n  }\r\n  int msize = states.size();\r\n  map<pair<Node*, Node*>, int> id;\r\n  for (int i = 0; i < msize; i++) {\r\n    id[states[i]] = i;\r\n  }\r\n  vector<vector<int>> dp(m + 1, vector<int>(msize));\r\n  auto getNext = [&](int state) -> vector<int> {\r\n    Node *x, *y;\r\n    if (state == -1) {\r\n      x = root;\r\n      y = root;\r\n    } else {\r\n      x = states[state].first;\r\n      y = states[state].second;\r\n    }\r\n    vector<int> ret;\r\n    auto go = [&](Node* x, Node *y) -> void {\r\n      for (auto son_x: x->sons) {\r\n        for (auto son_y: y->sons) {\r\n          if (!id.count(make_pair(son_x, son_y))) {\r\n            continue;\r\n          }\r\n          ret.push_back(id[make_pair(son_x, son_y)]);\r\n        }\r\n      }\r\n    };\r\n    go(x, y);\r\n    if (x->cnt) {\r\n      go(root, y);\r\n    }\r\n    if (y->cnt) {\r\n      go(x, root);\r\n    }\r\n    if (x->cnt && y->cnt) {\r\n      go(root, root);\r\n    }\r\n    sort(ret.begin(), ret.end());\r\n    ret.erase(unique(ret.begin(), ret.end()), ret.end());\r\n    return ret;\r\n  };\r\n  using Mat = vector<vector<int>>;\r\n  Mat base(msize, vector<int>(1));\r\n  for (auto state: getNext(-1)) {\r\n    base[state][0] = 1;\r\n  }\r\n  Mat Tr(msize, vector<int>(msize));\r\n  for (int i = 0; i < msize; i++) {\r\n    for (auto j: getNext(i)) {\r\n      Tr[j][i] = 1;\r\n    }\r\n  }\r\n  const int MOD = 998244353;\r\n  auto mul = [&](const Mat& m1, const Mat& m2) -> Mat {\r\n    int x = m1.size();\r\n    int y = m2[0].size();\r\n    Mat ret(x, vector<int>(y));\r\n    for (int i = 0; i < x; i++) {\r\n      for (int j = 0; j < y; j++) {\r\n        for (int k = 0; k < msize; k++) {\r\n          ret[i][j] = (ret[i][j] + 1LL * m1[i][k] * m2[k][j] % MOD) % MOD;\r\n        }\r\n      }\r\n    }\r\n    return ret;\r\n  };\r\n  auto fexp = [&](Mat x, int y) -> Mat {\r\n    Mat ret(msize, vector<int>(msize));\r\n    for (int i = 0; i < msize; i++) {\r\n      ret[i][i] = 1;\r\n    }\r\n    for (int i = 1; i <= y; i <<= 1) {\r\n      if (i & y) {\r\n        ret = mul(ret, x);\r\n      }\r\n      x = mul(x, x);\r\n    }\r\n    return ret;\r\n  };\r\n  Tr = fexp(Tr, m - 1);\r\n  base = mul(Tr, base);\r\n  int ans = 0;\r\n  for (int j = 0; j < msize; j++) {\r\n    Node *x = states[j].first;\r\n    Node *y = states[j].second;\r\n    if (x->cnt && y->cnt) {\r\n      ans = (ans + base[j][0]) % MOD;\r\n    }\r\n  }\r\n  cout << ans << \"\\n\";\r\n  return 0;\r\n}\r\n", "lang": "GNU C++17", "bug_code_uid": "431123ff5afa7d50c8fa825946ea82bc", "src_uid": "711d15e11016d0164fb2b0c3756e4857", "apr_id": "ac7788584db42fd14de6c88a4c62d635", "difficulty": 2700, "tags": ["dp", "matrices", "data structures", "string suffix structures", "brute force", "strings"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9693474410789701, "equal_cnt": 36, "replace_cnt": 5, "delete_cnt": 10, "insert_cnt": 20, "fix_ops_cnt": 35, "bug_source_code": "// Exported by Exporter.exe\r\n\r\n// Included from test.cpp\r\n// cf 1511 F\r\n#include <bits/stdc++.h>\r\nusing namespace std;\r\n#define PB push_back\r\n#define F first\r\n#define S second\r\n#define MP make_pair\r\n#define MTP make_tuple\r\n#define R Read\r\n#define RD Read_Digit\r\n#define RP Read_P\r\n#define RL Read_Loop\r\n#define RLD Read_Loop_Digit\r\n#define RLP Read_Loop_P\r\n#ifdef ONLINE_JUDGE\r\n\t#define Debug(x) ;\r\n\t#define Debugln(x) ;\r\n\t#define Debug_Array(n,x) ;\r\n\t#define Debugln_Array(n,x) ;\r\n\t#define NL ;\r\n#else\r\n\t#define Debug(x) printf(\"%s :\", (#x)); _Debug(x)\r\n\t#define Debugln(x) printf(\"%s :\", (#x)); _Debugln(x)\r\n\t#define Debug_Array(n,x) printf(\"%s :\", (#x)); _Debug_Array((n), (x))\r\n\t#define Debugln_Array(n,x) printf(\"%s :\", (#x)); _Debugln_Array((n), (x))\r\n\t#define NL printf(\"\\n\")\r\n#endif\r\ntypedef long long int ll;\r\ntypedef unsigned long long int ull;\r\n\r\nconstexpr int kN = 170;\r\nconstexpr int kMod = 998244353;\r\n// constexpr int kMod = int(1E9 + 7);\r\n// constexpr int kInf = 0x3f3f3f3f;\r\n// constexpr ll kInf = 0x3f3f3f3f3f3f3f3f;\r\n// constexpr double kPi = acos(-1);\r\n// constexpr double kEps = 1E-9;\r\n\r\n\r\n// Included from C:\\Users\\ianli\\Desktop\\CP\\template\\Various\\Fast_IO\\Fast_IO.cpp\r\n// --- Get ---\r\nstatic inline char Get_Raw_Char() {\r\n\tstatic char buf[1 << 16], *p = buf, *end = buf;\r\n\tif (p == end) {\r\n\t\tif ((end = buf + fread(buf, 1, 1 << 16, stdin)) == buf) return '\\0';\r\n\t\tp = buf;\r\n\t}\r\n\treturn *p++;\r\n}\r\n\r\n// --- Read ---\r\ntemplate <typename T> static inline void Read_P(T &n) {\r\n\tstatic_assert(is_integral<T>::value);\r\n\tchar c;\r\n\twhile (!isdigit(c = Get_Raw_Char())) ;\r\n\tn = int(c - '0');\r\n\twhile (isdigit(c = Get_Raw_Char())) n = n * 10 + int(c - '0');\r\n\treturn ;\r\n}\r\n\r\ntemplate <typename T> static inline void Read(T &n) {\r\n\tstatic_assert(is_integral<T>::value);\r\n\tchar c;\r\n\tbool neg = false;\r\n\twhile (!isdigit(c = Get_Raw_Char())) if (c == '-') neg = true;\r\n\tn = int(c - '0');\r\n\twhile (isdigit(c = Get_Raw_Char())) n = n * 10 + int(c - '0');\r\n\tif (neg) n = -n;\r\n\treturn ;\r\n}\r\n\r\ntemplate <typename T> static inline void Read_Digit(T &n) {\r\n\tstatic_assert(is_integral<T>::value);\r\n\tchar c;\r\n\twhile (!isdigit(c = Get_Raw_Char())) ;\r\n\tn = int(c - '0');\r\n\treturn ;\r\n}\r\n\r\n// --- Read multiple ---\r\ntemplate <typename T, typename... Targs> static inline void Read(T &n, Targs&... Fargs) {Read(n); return Read(Fargs...);}\r\ntemplate <typename T, typename... Targs> static inline void Read_Digit(T &n, Targs&... Fargs) {Read_Digit(n); return Read_Digit(Fargs...);}\r\ntemplate <typename T, typename... Targs> static inline void Read_P(T &n, Targs&... Fargs) {Read_P(n); return Read_P(Fargs...);}\r\n\r\n// --- Read Loop ---\r\ntemplate <typename T> static inline void Read_Loop_i(int i, T *a) {return Read(a[i]);}\r\ntemplate <typename T, typename... Targs> static inline void Read_Loop_i(int i, T *a, Targs*... Fargs) {Read(a[i]); return Read_Loop_i(i, Fargs...);}\r\ntemplate <typename... Targs> static inline void Read_Loop(int n, Targs*... Fargs) {for (int i = 1; i <= n; i++) Read_Loop_i(i, Fargs...);}\r\n\r\ntemplate <typename T> static inline void Read_Loop_Digit_i(int i, T *a) {return Read_Digit(a[i]);}\r\ntemplate <typename T, typename... Targs> static inline void Read_Loop_Digit_i(int i, T *a, Targs*... Fargs) {Read_Digit(a[i]); return Read_Loop_Digit_i(i, Fargs...);}\r\ntemplate <typename... Targs> static inline void Read_Loop_Digit(int n, Targs*... Fargs) {for (int i = 1; i <= n; i++) Read_Loop_Digit_i(i, Fargs...);}\r\n\r\ntemplate <typename T> static inline void Read_Loop_P_i(int i, T *a) {return Read_P(a[i]);}\r\ntemplate <typename T, typename... Targs> static inline void Read_Loop_P_i(int i, T *a, Targs*... Fargs) {Read_P(a[i]); return Read_Loop_P_i(i, Fargs...);}\r\ntemplate <typename... Targs> static inline void Read_Loop_P(int n, Targs*... Fargs) {for (int i = 1; i <= n; i++) Read_Loop_P_i(i, Fargs...);}\r\n\r\n// --- Float ---\r\ntemplate <int mul, typename T> static inline void Read(T &n) {\r\n\tchar c;\r\n\tbool neg = false;\r\n\twhile (!isdigit(c = Get_Raw_Char())) if (c == '-') neg = true;\r\n\tn = int(c - '0');\r\n\twhile (isdigit(c = Get_Raw_Char())) n = n * 10 + int(c - '0');\r\n\t\r\n\tint cnt = 0;\r\n\r\n\tif (c == '.') {\r\n\t\twhile (isdigit(c = Get_Raw_Char())) {\r\n\t\t\tn = n * 10 + int(c - '0');\r\n\t\t\tcnt++;\r\n\t\t}\r\n\t}\r\n\r\n\twhile (cnt++ < mul) n = n * 10;\r\n\r\n\tif (neg) n = -n;\r\n\treturn ;\r\n}\r\n\r\ntemplate <int mul, typename T> static inline void Read_P(T &n) {\r\n\tchar c;\r\n\twhile (!isdigit(c = Get_Raw_Char())) ;\r\n\t\r\n\tn = int(c - '0');\r\n\twhile (isdigit(c = Get_Raw_Char())) n = n * 10 + int(c - '0');\r\n\t\r\n\tint cnt = 0;\r\n\r\n\tif (c == '.') {\r\n\t\twhile (isdigit(c = Get_Raw_Char())) {\r\n\t\t\tn = n * 10 + int(c - '0');\r\n\t\t\tcnt++;\r\n\t\t}\r\n\t}\r\n\r\n\twhile (cnt++ < mul) n = n * 10;\r\n\treturn ;\r\n}\r\n\r\ntemplate <int mul, typename T, typename... Targs> static inline void Read(T &n, Targs&... Fargs) {Read<mul>(n); return Read<mul>(Fargs...);}\r\ntemplate <int mul, typename T, typename... Targs> static inline void Read_P(T &n, Targs&... Fargs) {Read_P<mul>(n); return Read_P<mul>(Fargs...);}\r\n\r\n// --- init ---\r\ninline void IOS() {ios::sync_with_stdio(false); cin.tie(0);}\r\ninline void Freopen(const char *in, const char *out) {freopen(in, \"r\", stdin); freopen(out, \"w\", stdout);}\r\n\r\n// --- Output ---\r\ntemplate <typename T> void Print(T x) {\r\n\tif (x < 0) {\r\n\t\tprintf(\"-\");\r\n\t\tx = -x;\r\n\t}\r\n\tif (x == 0) printf(\"0\");\r\n\telse {\r\n\t\tstatic int val[100];\r\n\t\tint idx = -1;\r\n\t\twhile (x) {\r\n\t\t\tval[++idx] = x % 10;\r\n\t\t\tx /= 10;\r\n\t\t}\r\n\t\twhile (idx >= 0) printf(\"%d\", val[idx--]);\r\n\t}\r\n} \r\n// End of C:\\Users\\ianli\\Desktop\\CP\\template\\Various\\Fast_IO\\Fast_IO.cpp\r\n\r\n// Included from C:\\Users\\ianli\\Desktop\\CP\\template\\Various\\Useful_Functions\\Useful_Functions.cpp\r\ntemplate <typename T> inline void sort(vector<T> &v) {return sort(v.begin(), v.end());}\r\ntemplate <typename T> inline void sort_r(vector<T> &v) {return sort(v.begin(), v.end(), greater<T>());}\r\n\r\ntemplate <typename T> inline void reverse(vector<T> &v) {return reverse(v.begin(), v.end());}\r\n\r\ntemplate <typename T> inline void Merge(vector<T> &a, vector<T> &b, vector<T> &c) {\r\n\tif (c.size() < a.size() + b.size()) c.resize(a.size() + b.size());\r\n\tmerge(a.begin(), a.end(), b.begin(), b.end(), c.begin());\r\n\treturn ;\r\n}\r\n\r\ntemplate <typename T> inline void Discrete(vector<T> &v) {sort(v); v.resize(unique(v.begin(), v.end()) - v.begin());}\r\n\r\ntemplate <typename T> using PQ = priority_queue<T>;\r\ntemplate <typename T> using PQ_R = priority_queue<T, vector<T>, greater<T>>;\r\n\r\ntemplate <typename T> inline T ABS(T n) {return n >= 0 ? n : -n;}\r\ntemplate <typename T> inline T gcd(T a, T b) {return b ? gcd(b, a % b) : a;}\r\ntemplate <typename T> inline T lcm(T a, T b) {return a * b / gcd(a, b);}\r\ntemplate <typename T, typename... Targs> inline T min(T a, T b, T c, Targs... args) {return min(a, min(b, c, args...));}\r\ntemplate <typename T, typename... Targs> inline T max(T a, T b, T c, Targs... args) {return max(a, max(b, c, args...));}\r\ntemplate <typename T> inline void chmin(T &a, T b) {a = min(a, b); return ;}\r\ntemplate <typename T> inline void chmax(T &a, T b) {a = max(a, b); return ;}\r\ntemplate <typename T, typename... Targs> inline void chmin(T &a, T b, T c, Targs... args) {a = min(a, min(b, c, args...)); return ;}\r\ntemplate <typename T, typename... Targs> inline void chmax(T &a, T b, T c, Targs... args) {a = max(a, max(b, c, args...)); return ;}\r\n\r\ntemplate <typename T> inline int Digit_Sum(T a) {\r\n\tint ans = 0;\r\n\twhile (a) {\r\n\t\tans += a % 10;\r\n\t\ta /= 10;\r\n\t}\r\n\treturn ans;\r\n}\r\ntemplate <typename T> inline int Num_Length(T a) {\r\n\tint ans = 1;\r\n\twhile (a /= 10) ans++;\r\n\treturn ans;\r\n}\r\n// End of C:\\Users\\ianli\\Desktop\\CP\\template\\Various\\Useful_Functions\\Useful_Functions.cpp\r\n\r\n// Included from C:\\Users\\ianli\\Desktop\\CP\\template\\Various\\Debug\\Debug.cpp\r\nvoid _print(int x) {printf(\"%d\", x);}\r\nvoid _print(long long int x) {printf(\"%lld\", x);}\r\nvoid _print(double x) {printf(\"%lf\", x);}\r\ntemplate <typename T> void _print(T x) {return x.out();}\r\ntemplate <typename T1, typename T2> void _print(pair<T1, T2> x) {printf(\"(\"); _print(x.first); printf(\", \"); _print(x.second); printf(\")\");}\r\n\r\ntemplate <typename T> void _Debug(T x) {_print(x); printf(\"\\n\");}\r\ntemplate <typename T> void _Debug(vector<T> v) {\r\n\tif (v.empty()) printf(\" empty\");\r\n\telse for (T i : v) printf(\" \"), _print(i); \r\n\tprintf(\"\\n\");\r\n}\r\n\r\ntemplate <typename T1, typename T2, typename T3> void _Debug(priority_queue<T1, T2, T3> pq) {\r\n\tif (pq.empty()) printf(\" empty\");\r\n\telse {\r\n\t\twhile (!pq.empty()) {\r\n\t\t\tprintf(\" \");\r\n\t\t\t_print(pq.top());\r\n\t\t\tpq.pop();\r\n\t\t}\r\n\t}\r\n\tprintf(\"\\n\");\r\n}\r\n\r\ntemplate <typename T> void _Debug(queue<T> q) {\r\n\tif (q.empty()) printf(\" empty\");\r\n\telse {\r\n\t\twhile (!q.empty()) {\r\n\t\t\tprintf(\" \");\r\n\t\t\t_print(q.front());\r\n\t\t\tq.pop();\r\n\t\t}\r\n\t}\r\n\tprintf(\"\\n\");\r\n}\r\n\r\ntemplate <typename T> void _Debug(stack<T> st) {\r\n\tif (st.empty()) printf(\" empty\");\r\n\telse {\r\n\t\twhile (!st.empty()) {\r\n\t\t\tprintf(\" \");\r\n\t\t\t_print(st.top());\r\n\t\t\tst.pop();\r\n\t\t}\r\n\t}\r\n\tprintf(\"\\n\");\r\n}\r\n\r\ntemplate <typename T> void _Debug(deque<T> dq) {\r\n\tif (dq.empty()) printf(\" empty\");\r\n\telse {\r\n\t\twhile (!dq.empty()) {\r\n\t\t\tprintf(\" \");\r\n\t\t\t_print(dq.front());\r\n\t\t\tdq.pop_front();\r\n\t\t}\r\n\t}\r\n\tprintf(\"\\n\");\r\n}\r\n\r\ntemplate <typename T> void _Debugln(vector<T> v) {\r\n\tif (v.empty()) printf(\" empty\\n\");\r\n\telse {\r\n\t\tfor (T i : v) printf(\"\\n\"), _print(i); \r\n\t\tprintf(\"\\n\");\r\n\t}\r\n}\r\n\r\ntemplate <typename T1, typename T2, typename T3> void _Debugln(priority_queue<T1, T2, T3> pq) {\r\n\tif (pq.empty()) printf(\" empty\");\r\n\telse {\r\n\t\twhile (!pq.empty()) {\r\n\t\t\tprintf(\"\\n\");\r\n\t\t\t_print(pq.top());\r\n\t\t\tpq.pop();\r\n\t\t}\r\n\t}\r\n\tprintf(\"\\n\");\r\n}\r\n\r\ntemplate <typename T> void _Debugln(queue<T> q) {\r\n\tif (q.empty()) printf(\" empty\");\r\n\telse {\r\n\t\twhile (!q.empty()) {\r\n\t\t\tprintf(\"\\n\");\r\n\t\t\t_print(q.front());\r\n\t\t\tq.pop();\r\n\t\t}\r\n\t}\r\n\tprintf(\"\\n\");\r\n}\r\n\r\ntemplate <typename T> void _Debugln(stack<T> st) {\r\n\tif (st.empty()) printf(\" empty\");\r\n\telse {\r\n\t\twhile (!st.empty()) {\r\n\t\t\tprintf(\"\\n\");\r\n\t\t\t_print(st.top());\r\n\t\t\tst.pop();\r\n\t\t}\r\n\t}\r\n\tprintf(\"\\n\");\r\n}\r\n\r\ntemplate <typename T> void _Debugln(deque<T> dq) {\r\n\tif (dq.empty()) printf(\" empty\");\r\n\telse {\r\n\t\twhile (!dq.empty()) {\r\n\t\t\tprintf(\"\\n\");\r\n\t\t\t_print(dq.front());\r\n\t\t\tdq.pop_front();\r\n\t\t}\r\n\t}\r\n\tprintf(\"\\n\");\r\n}\r\n\r\ntemplate <typename T> void _Debug_Array(int n, const T *x) {for (int i = 1; i <= n; i++) printf(\" \"), _print(x[i]); printf(\"\\n\");}\r\ntemplate <typename T> void _Debugln_Array(int n, const T *x) {printf(\"\\n\"); for (int i = 1; i <= n; i++) _print(x[i]), printf(\"\\n\");}\r\n// End of C:\\Users\\ianli\\Desktop\\CP\\template\\Various\\Debug\\Debug.cpp\r\n\r\n// Included from C:\\Users\\ianli\\Desktop\\CP\\template\\Math\\Mod_Int\\Mod_Int.cpp\r\ntemplate <typename T1, typename T2> T1 Pow(T1 a, T2 b) {\r\n\tT1 ans(1);\r\n\twhile (b) {\r\n\t\tif (b & 1) ans *= a;\r\n\t\ta *= a;\r\n\t\tb >>= 1;\r\n\t}\r\n\treturn ans;\r\n}\r\n\r\ntemplate <int kMod> struct Mod_Int {\r\n\tconstexpr static int Mod() {return kMod;}\r\n\r\n\tint val;\r\n\tMod_Int() {val = 0;}\r\n\ttemplate <typename T> Mod_Int(const T &x) {val = x;}\r\n\ttemplate <int nMod> Mod_Int(const Mod_Int<nMod> &x) {val = x.val;}\r\n\r\n\tMod_Int inv() const {return Pow(*this, kMod - 2);} \r\n\r\n\tMod_Int operator + (const Mod_Int &x) const {\r\n\t\tMod_Int ans(val + x.val);\r\n\t\tif (ans.val >= kMod) ans.val -= kMod;\r\n\t\treturn ans;\r\n\t}\r\n\tMod_Int operator - (const Mod_Int &x) const {\r\n\t\tMod_Int ans(val - x.val);\r\n\t\tif (ans.val < 0) ans.val += kMod;\r\n\t\treturn ans;\r\n\t}\r\n\tMod_Int operator * (const Mod_Int &x) const {return Mod_Int(1LL * val * x.val % kMod);}\r\n\tMod_Int operator / (const Mod_Int &x) const {return *this * x.inv();}\r\n\tMod_Int operator ^ (const Mod_Int &x) const {return Pow(*this, x.val);}\r\n\tMod_Int operator << (const int &x) const {return ((1LL * val) << x) % kMod;}\r\n\r\n\tMod_Int operator += (const Mod_Int &x) {return *this = *this + x;}\r\n\tMod_Int operator -= (const Mod_Int &x) {return *this = *this - x;}\r\n\tMod_Int operator *= (const Mod_Int &x) {return *this = *this * x;}\r\n\tMod_Int operator /= (const Mod_Int &x) {return *this = *this / x;}\r\n\tMod_Int operator ^= (const Mod_Int &x) {return *this = Pow(*this, x.val);}\r\n\tMod_Int operator <<= (const int &x) {return *this = *this << x;}\r\n\r\n\tMod_Int operator ++(int) {\r\n\t\tval++;\r\n\t\tif (val >= kMod) val -= kMod;\r\n\t\treturn *this;\r\n\t}\r\n\tMod_Int operator --(int) {\r\n\t\tval--;\r\n\t\tif (val < 0) val += kMod;\r\n\t\treturn *this;\r\n\t}\r\n\r\n\tbool operator < (const Mod_Int &x) const {return val < x.val;}\r\n\tbool operator > (const Mod_Int &x) const {return val > x.val;}\r\n\tbool operator <= (const Mod_Int &x) const {return val <= x.val;}\r\n\tbool operator >= (const Mod_Int &x) const {return val >= x.val;}\r\n\tbool operator == (const Mod_Int &x) const {return val == x.val;}\r\n\tbool operator != (const Mod_Int &x) const {return val != x.val;}\r\n\r\n\tvoid out() const {printf(\"%d\", val);}\r\n};\r\n\r\nusing Mint = Mod_Int<kMod>;\r\n\r\nnamespace Factorial {\r\n\tMint *f, *inf;\r\n\tbool preprocessed_factorial;\r\n\tvoid Pre_Factorial(const int &sz) {\r\n\t\tif (preprocessed_factorial) return ;\r\n\t\tpreprocessed_factorial = true;\r\n\t\tf = new Mint[sz + 1];\r\n\t\tinf = new Mint[sz + 1];\r\n\t\tf[0] = f[1] = inf[0] = inf[1] = 1;\r\n\t\tfor (int i = 2; i <= sz; i++) f[i] = f[i - 1] * i;\r\n\t\tinf[sz] = f[sz].inv();\r\n\t\tfor (int i = sz; i > 2; i--) inf[i - 1] = inf[i] * i;\r\n\t\treturn ;\r\n\t}\r\n\tinline Mint P(const int &n, const int &m) {return f[n] * inf[m];}\r\n\tinline Mint C(const int &n, const int &m) {return f[n] * inf[m] * inf[n - m];}\r\n\tinline Mint H(const int &n, const int &m) {return f[n + m - 1] * inf[m] * inf[n - 1];}\r\n\tinline Mint Catalan(const int &n) {return f[n << 1] * inf[n] * inf[n + 1];}\r\n}\r\n\r\nnamespace Factorial_No_Inf {\r\n\tMint *f;\r\n\tvoid Pre_Factorial(const int &sz) {\r\n\t\tf = new Mint[sz + 1];\r\n\t\tf[0] = f[1] = 1;\r\n\t\tfor (int i = 2; i <= sz; i++) f[i] = f[i - 1] * i;\r\n\t\treturn ;\r\n\t}\r\n\tinline Mint P(const int &n, const int &m) {return f[n] / f[m];}\r\n\tinline Mint C(const int &n, const int &m) {return f[n] / (f[m] * f[n - m]);}\r\n\tinline Mint H(const int &n, const int &m) {return f[n + m - 1] / (f[m] * f[n - 1]);}\r\n\tinline Mint Catalan(const int &n) {return f[n << 1] / (f[n] * f[n + 1]);}\r\n}\r\n\r\nnamespace Inverse {\r\n\tusing namespace Factorial;\r\n\tMint *inv;\r\n\tvoid Pre_Inverse(const int &sz) {\r\n\t\tinv = new Mint[sz + 1];\r\n\t\tinv[1] = 1;\r\n\t\tPre_Factorial(sz);\r\n\t\tfor (int i = 1; i <= sz; i++) inv[i] = f[i - 1] * inf[i];\r\n\t\treturn ;\r\n\t}\r\n};\r\n// End of C:\\Users\\ianli\\Desktop\\CP\\template\\Math\\Mod_Int\\Mod_Int.cpp\r\n\r\n// Included from C:\\Users\\ianli\\Desktop\\CP\\template\\Math\\Matrix\\Matrix.cpp\r\ntemplate <typename T> struct Matrix {\r\n\tstatic constexpr int kMultiplicationThreshold = 64;\r\n\tT **val;\r\n\tint _size;\r\n\r\n\tMatrix() : val(nullptr), _size(0) {}\r\n\tMatrix(int x, T v = 0) {\r\n\t\t_size = x;\r\n\t\tval = new T* [_size];\r\n\t\tfor (int i = 0; i < _size; i++) {\r\n\t\t\tval[i] = new T [_size];\r\n\t\t\tmemset(val[i], 0, sizeof(T) * _size);\r\n\t\t\tval[i][i] = v;\r\n\t\t}\r\n\t}\r\n\r\n\tvoid del() {\r\n\t\tfor (int i = 0; i < _size; i++) delete [] val[i];\r\n\t\tdelete [] val;\r\n\t\treturn ;\r\n\t}\r\n\r\n\tvoid resize(int x) {\r\n\t\tdel();\r\n\t\t_size = x;\r\n\t\tval = new T* [_size];\r\n\t\tfor (int i = 0; i < _size; i++) {\r\n\t\t\tval[i] = new T [_size];\r\n\t\t\tmemset(val[i], 0, sizeof(T) * _size);\r\n\t\t}\r\n\t\treturn ;\r\n\t}\r\n\tint size() const {return _size;}\r\n\r\n\tT* operator [](int x) {return val[x];}\r\n\tT* operator [](int x) const {return val[x];}\r\n\r\n\tstatic Matrix Naive_Multiplication(const Matrix &A, const Matrix &B) {\r\n\t\tint size = A.size();\r\n\t\tMatrix ans(size);\r\n\t\tfor (int i = 0; i < size; i++) for (int j = 0; j < size; j++) for (int k = 0; k < size; k++)\r\n\t\t\tans[i][j] += A[i][k] * B[k][j];\r\n\t\treturn ans;\r\n\t}\r\n\tstatic Matrix DC_Multiplication(const Matrix &A, const Matrix &B) {\r\n\t\tif (A.size() < kMultiplicationThreshold) return Naive_Multiplication(A, B);\r\n\r\n\t\tint size = A.size();\r\n\t\tif (__builtin_popcount(size) != 1) {\r\n\t\t\tint nsize = 1 << (__lg(size) + 1);\r\n\t\t\tMatrix nA(nsize), nB(nsize);\r\n\t\t\tfor (int i = 0; i < size; i++) for (int j = 0; j < size; j++) nA[i][j] = A[i][j];\r\n\t\t\tfor (int i = 0; i < size; i++) for (int j = 0; j < size; j++) nB[i][j] = B[i][j];\r\n\r\n\t\t\tMatrix ans(size), tmp = DC_Multiplication(nA, nB);\r\n\t\t\tfor (int i = 0; i < size; i++) for (int j = 0; j < size; j++) ans[i][j] = tmp[i][j];\r\n\t\t\tnA.del(); nB.del(); tmp.del();\r\n\t\t\treturn ans;\r\n\t\t}\r\n\r\n\t\tint half = size >> 1;\r\n\t\tMatrix A11(half), A12(half), A21(half), A22(half);\r\n\t\tMatrix B11(half), B12(half), B21(half), B22(half);\r\n\t\tMatrix C11(half), C12(half), C21(half), C22(half);\r\n\t\tMatrix M1(half), M2(half), M3(half), M4(half), M5(half), M6(half), M7(half);\r\n\r\n\t\tfor (int i = 0; i < half; i++) for (int j = 0; j < half; j++) A11[i][j] = A[i][j];\r\n\t\tfor (int i = 0; i < half; i++) for (int j = half; j < size; j++) A12[i][j - half] = A[i][j];\r\n\t\tfor (int i = half; i < size; i++) for (int j = 0; j < half; j++) A21[i - half][j] = A[i][j];\r\n\t\tfor (int i = half; i < size; i++) for (int j = half; j < size; j++) A22[i - half][j - half] = A[i][j];\r\n\t\tfor (int i = 0; i < half; i++) for (int j = 0; j < half; j++) B11[i][j] = B[i][j];\r\n\t\tfor (int i = 0; i < half; i++) for (int j = half; j < size; j++) B12[i][j - half] = B[i][j];\r\n\t\tfor (int i = half; i < size; i++) for (int j = 0; j < half; j++) B21[i - half][j] = B[i][j];\r\n\t\tfor (int i = half; i < size; i++) for (int j = half; j < size; j++) B22[i - half][j - half] = B[i][j];\r\n\r\n\t\tM1 = (A11 + A22) * (B11 + B22);\r\n\t\tM2 = (A21 + A22) * B11;\r\n\t\tM3 = A11 * (B12 - B22);\r\n\t\tM4 = A22 * (B21 - B11);\r\n\t\tM5 = (A11 + A12) * B22;\r\n\t\tM6 = (A21 - A11) * (B11 + B12);\r\n\t\tM7 = (A12 - A22) * (B21 + B22);\r\n\r\n\t\tC11 = M1 + M4 - M5 + M7;\r\n\t\tC12 = M3 + M5;\r\n\t\tC21 = M2 + M4;\r\n\t\tC22 = M1 - M2 + M3 + M6;\r\n\r\n\t\tMatrix ans(size);\r\n\t\tfor (int i = 0; i < half; i++) for (int j = 0; j < half; j++) ans[i][j] = C11[i][j];\r\n\t\tfor (int i = 0; i < half; i++) for (int j = half; j < size; j++) ans[i][j] = C12[i][j - half];\r\n\t\tfor (int i = half; i < size; i++) for (int j = 0; j < half; j++) ans[i][j] = C21[i - half][j];\r\n\t\tfor (int i = half; i < size; i++) for (int j = half; j < size; j++) ans[i][j] = C22[i - half][j - half];\r\n\r\n\t\tA11.del(); A12.del(); A21.del(); A22.del();\r\n\t\tB11.del(); B12.del(); B21.del(); B22.del();\r\n\t\tC11.del(); C12.del(); C21.del(); C22.del();\r\n\t\tM1.del(); M2.del(); M3.del(); M4.del(); M5.del(); M6.del(); M7.del();\r\n\t\treturn ans;\r\n\t}\r\n\r\n\tMatrix operator + (const Matrix &x) const {\r\n\t\tMatrix ans(_size);\r\n\t\tfor (int i = 0; i < _size; i++) for (int j = 0; j < _size; j++) ans[i][j] = val[i][j] + x[i][j];\r\n\t\treturn ans;\r\n\t}\r\n\tMatrix operator - (const Matrix &x) const {\r\n\t\tMatrix ans(_size);\r\n\t\tfor (int i = 0; i < _size; i++) for (int j = 0; j < _size; j++) ans[i][j] = val[i][j] - x[i][j];\r\n\t\treturn ans;\r\n\t}\r\n\tMatrix operator * (const T &x) const {\r\n\t\tMatrix ans(_size);\r\n\t\tfor (int i = 0; i < _size; i++) for (int j = 0; j < _size; j++) ans[i][j] = val[i][j] * x;\r\n\t\treturn ans;\r\n\t} \r\n\tMatrix operator * (const Matrix &x) const {\r\n\t\tif (_size < kMultiplicationThreshold) return Naive_Multiplication(*this, x);\r\n\t\telse return DC_Multiplication(*this, x);\r\n\t} \r\n\tMatrix operator / (const T &x) const {\r\n\t\tMatrix ans(_size);\r\n\t\tfor (int i = 0; i < _size; i++) for (int j = 0; j < _size; j++) ans[i][j] = val[i][j] * x;\r\n\t\treturn ans;\r\n\t}\r\n\tMatrix operator += (const Matrix &x) {return *this = *this + x;} \r\n\tMatrix operator -= (const Matrix &x) {return *this = *this - x;} \r\n\tMatrix operator *= (const T &x) {return *this = *this * x;} \r\n\tMatrix operator *= (const Matrix &x) {return *this = *this * x;} \r\n\tMatrix operator /= (const T &x) {return *this = *this / x;} \r\n\r\n\tvoid out() const {\r\n\t\tfor (int i = 0; i < _size; i++, printf(\"\\n\")) for (int j = 0; j < _size; j++) printf(\"%5d\", val[i][j]);\r\n\t\treturn ;\r\n\t}\r\n};\r\n\r\ntemplate <typename T1, typename T2> Matrix<T1> Pow(Matrix<T1> A, T2 b) {\r\n\tMatrix<T1> ans(A.size(), 1);\r\n\tfor (; b; b >>= 1, A *= A) if (b & 1) ans *= A;\r\n\treturn ans;\r\n}\r\n// End of C:\\Users\\ianli\\Desktop\\CP\\template\\Math\\Matrix\\Matrix.cpp\r\n\r\nstring s[kN];\r\nint idx[kN][kN][kN];\r\nint len[kN];\r\nMatrix<Mint> A;\r\n\r\nint main() {\r\n\tint n, m; cin >> n >> m;\r\n\tfor (int i = 1; i <= n; i++) cin >> s[i];\r\n\r\n\tfor (int i = 1; i <= n; i++) len[i] = int(s[i].size());\r\n\r\n\tconstexpr int kLen = 5;\r\n\r\n\tint cur = 0;\r\n\t// idx : lst s, len diff, wait\r\n\r\n\tfor (int i = 1; i <= n; i++) for (int j = 1; j < len[i]; j++) for (int k = 0; k < kLen; k++) \r\n\t\tidx[i][j][k] = cur++;\r\n\r\n\tfor (int i = 0; i < kLen; i++) idx[0][0][i] = cur++;\r\n\r\n\tA.resize(cur);\r\n\r\n\tfor (int i = 1; i <= n; i++) A.val[idx[0][0][len[i] - 1]][idx[0][0][0]]++;\r\n\r\n\tfor (int i = 1; i <= n; i++) for (int j = 1; j < len[i]; j++) for (int k = 1; k < kLen; k++)\r\n\t\tA.val[idx[i][j][k - 1]][idx[i][j][k]]++;\r\n\r\n\tfor (int i = 1; i < kLen; i++) A.val[idx[0][0][i - 1]][idx[0][0][i]]++;\r\n\r\n\tauto match = [&](int x, int idx, int y, int idy, int len) -> bool {\r\n\t\tfor (int i = 0; i < len; i++) if (s[x][idx + i] != s[y][idy + i]) return false;\r\n\t\treturn true;\r\n\t};\r\n\r\n\tfor (int i = 1; i <= n; i++) for (int j = 1; j < len[i]; j++) for (int k = 1; k <= n; k++) {\r\n\t\tint mn = min(j, len[k]);\r\n\t\tif (!match(i, len[i] - j, k, 0, mn)) continue;\r\n\r\n\t\tif (len[k] == j) A.val[idx[0][0][j - 1]][idx[i][j][0]]++;\r\n\t\telse if (len[k] < j) A.val[idx[i][j - len[k]][len[k] - 1]][idx[i][j][0]]++;\r\n\t\telse A.val[idx[k][len[k] - j][j - 1]][idx[i][j][0]]++;\r\n\t}\r\n\r\n\tfor (int i = 1; i <= n; i++) for (int j = i + 1; j <= n; j++) {\r\n\t\tint mn = min(len[i], len[j]);\r\n\t\tif (match(i, 0, j, 0, mn)) {\r\n\t\t\tif (len[i] < len[j]) A.val[idx[j][len[j] - len[i]][mn - 1]][idx[0][0][0]] += 2;\r\n\t\t\telse A.val[idx[i][len[i] - len[j]][mn - 1]][idx[0][0][0]] += 2;\r\n\t\t}\r\n\t}\r\n\r\n\tMint ans = Pow(A, m)[idx[0][0][0]][idx[0][0][0]];\r\n\tprintf(\"%d\\n\", ans);\r\n}\r\n// End of test.cpp\r\n", "lang": "GNU C++17", "bug_code_uid": "be3e2c6a0b3970a1428e6c4d9d8db1ee", "src_uid": "711d15e11016d0164fb2b0c3756e4857", "apr_id": "0a896a0c58a8494dcb8dce294ff2819f", "difficulty": 2700, "tags": ["dp", "matrices", "data structures", "string suffix structures", "brute force", "strings"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9558262134157426, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "// Sometimes, the questions are complicated - and the answers are simple. //\r\n#pragma GCC optimize (\"O3\")\r\n#pragma GCC target(\"sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx\")\r\n#pragma GCC optimize (\"unroll-loops\")\r\n#include <bits/stdc++.h>\r\n#define ll long long\r\n#define ld  long double\r\n#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);\r\nusing namespace std;\r\nconst int mod = 998244353;\r\nconst int N = 190;\r\nint res[N][N];\r\nvoid mul(int a[][N], int b[][N]) {\r\n    for(int i = 0; i < N; i++)\r\n        for(int j = 0; j < N; j++) {\r\n            res[i][j] = 0;\r\n            if(a[i][k])\r\n                for(int k = 0; k < N; k++) {\r\n                    res[i][j] = (1LL * a[i][k] * b[k][j] + res[i][j]) % mod;\r\n                }\r\n        }\r\n    for(int i = 0; i < N; i++)\r\n        for(int j = 0; j < N; j++)\r\n            a[i][j] = res[i][j];\r\n}\r\nvoid power(int temp[][N], int p) {\r\n\r\n    int res[N][N] = {0};\r\n    for(int i = 0; i < N; i++)\r\n        res[i][i] = 1;\r\n\r\n    while(p) {\r\n        if(p & 1)\r\n            mul(res, temp);\r\n        mul(temp, temp);\r\n        p >>= 1;\r\n    }\r\n\r\n    for(int i = 0; i < N; i++)\r\n        for(int j = 0; j < N; j++)\r\n            temp[i][j] = res[i][j];\r\n}\r\nint n, m ;\r\nint trie[50][30], node_ind;\r\nbool final_state[50];\r\nvoid insert(string & s) {\r\n    int node = 0;\r\n    for(auto i : s) {\r\n        int cur = i - 'a';\r\n        if(!trie[node][cur])\r\n            trie[node][cur] = ++node_ind;\r\n        node = trie[node][cur];\r\n    }\r\n    final_state[node] = true;\r\n}\r\nmap<pair<int, int>, int >mop;\r\nset<pair<int, int> > vis;\r\nint get_ind(int x, int y) {\r\n    if(mop.find({x, y}) == mop.end())\r\n        mop[ {x, y}] = mop.size();\r\n    return mop[ {x, y}];\r\n}\r\nvoid dfs(int node1, int node2, int mat[][N]) {\r\n\r\n    if(vis.find({node1, node2}) != vis.end())\r\n        return ;\r\n    vis.insert({node1, node2});\r\n    //cout<<node1<<\" \"<<node2<<\"\\n\";\r\n    for(int i = 0; i < 26; i++) {\r\n        if(!trie[node1][i] || !trie[node2][i])continue;\r\n        int x = trie[node1][i], y = trie[node2][i];\r\n\r\n        mat[get_ind(node1, node2)][get_ind(x, y)] = 1;\r\n        dfs(x, y, mat);\r\n\r\n        if(final_state[x]) {\r\n            mat[get_ind(node1, node2)][get_ind(0, y)] = 1;\r\n            dfs(0, y, mat);\r\n        }\r\n        if(final_state[y]) {\r\n            mat[get_ind(node1, node2)][get_ind(x, 0)] = 1;\r\n            dfs(x, 0, mat);\r\n        }\r\n        if(final_state[x] && final_state[y]) {\r\n            mat[get_ind(node1, node2)][get_ind(0, 0)]++;\r\n        }\r\n    }\r\n}\r\nint main() {\r\n    IO\r\n    int n, m;\r\n    cin >> n >> m;\r\n    while(n--) {\r\n        string s;\r\n        cin >> s;\r\n        insert(s);\r\n    }\r\n    int cur[N][N] = {};\r\n    get_ind(0, 0);\r\n    dfs(0, 0, cur);\r\n\r\n    power(cur, m);\r\n    cout << cur[0][0];\r\n}\r\n", "lang": "GNU C++17", "bug_code_uid": "1e2369ffffc1293b3e15847e4502d5e1", "src_uid": "711d15e11016d0164fb2b0c3756e4857", "apr_id": "203174bf99b94eebaefb11ba09cd62d8", "difficulty": 2700, "tags": ["dp", "matrices", "data structures", "string suffix structures", "brute force", "strings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9944516971279374, "equal_cnt": 14, "replace_cnt": 1, "delete_cnt": 9, "insert_cnt": 4, "fix_ops_cnt": 14, "bug_source_code": "#include <iostream>\r\n#include <cstdio>\r\n#include <cstring>\r\n#include <stack>\r\n#include <queue>\r\n#include <vector>\r\n#include <map>\r\n#include <set>\r\n#include <list>\r\n#include <algorithm>\r\n#include <cmath>\r\n#include <sstream>\r\n#include <iomanip>\r\n#define endl '\\n'\r\n#define fin freopen(\"in.txt\", \"r\", stdin)\r\n#define fout freopen(\"out.txt\", \"w\", stdout)\r\nusing namespace std;\r\ntypedef long long LL;\r\ntypedef unsigned long long ULL;\r\ntypedef long double ldb;\r\ntypedef pair<int, int> pii;\r\ntypedef pair<LL, LL> pll;\r\ntypedef pair<LL, int> pli;\r\ntypedef pair<int, long> pil;\r\nconst int INF = 0x3f3f3f3f;\r\ninline int read(){\r\n    register int x; register char c(getchar()); register bool k;\r\n    while((c < '0' || c > '9') && c ^ '-') if((c = getchar()) == EOF) exit(0);\r\n    if(c ^ '-') x = c & 15, k = 1; else x = 0, k = 0;\r\n    while(c = getchar(), c >= '0' && c <= '9') x = (x << 1) + (x << 3) + (c & 15);\r\n    return k ? x : -x;\r\n}\r\n \r\nconst int maxn = 100, mod = 998244353;\r\nchar s[10];\r\nint trie[maxn][26], tot;\r\nbool endp[maxn];\r\n \r\nvoid insert(char *s){\r\n    int len = strlen(s), cur = 0;\r\n    for(int i = 0; i < len; i++){\r\n        if(!trie[cur][s[i] - 'a']) trie[cur][s[i] - 'a'] = ++tot;\r\n        cur = trie[cur][s[i] - 'a'];\r\n    }\r\n    endp[cur] = 1;\r\n}\r\n \r\ntypedef vector<int> vec;\r\ntypedef vector<vec> mat;\r\n \r\n// \u8ba1\u7b97\u77e9\u9635A*\u77e9\u9635B\uff0c\u5143\u7d20\u5bf9mod\u53d6\u6a21\r\nmat mod_mul(mat &A, mat &B){\r\n    mat C(A.size(), vec(B[0].size()));\r\n    for(int i = 0; i < A.size(); i++){\r\n        for(int k = 0; k < B.size(); k++){\r\n            if(A[i][k])\r\n            for(int j = 0; j < B[0].size(); j++){\r\n                if(B[k][j])\r\n                C[i][j] = (C[i][j] + ((LL)A[i][k] * B[k][j]) % mod) % mod;\r\n            }\r\n        }\r\n    }\r\n    return C;\r\n}\r\n \r\n// \u8ba1\u7b97\u77e9\u9635A\u7684n\u6b21\u65b9\r\nmat mod_pow(mat A, LL n){\r\n    mat B(A.size(), vec(A.size()));\r\n    for(int i =0; i < A.size(); i++) B[i][i] = 1;\r\n    while(n > 0){\r\n        if(n & 1) B = mod_mul(B, A);\r\n        A = mod_mul(A, A);\r\n        n >>= 1;\r\n    }\r\n    return B;\r\n}\r\n \r\nqueue<pii> que;\r\nmap<pii, int> mp;\r\nint cnt;\r\nint get_id(pii p){\r\n    if(mp.count(p)) return mp[p];\r\n    mp[p] = cnt++;\r\n    que.push(p);\r\n    return cnt - 1;\r\n}\r\n \r\nint main(){\r\n    int n = read(), m = read();\r\n    for(int i = 1; i <= n; i++){\r\n        scanf(\"%s\", s);\r\n        insert(s);\r\n    }\r\n    mat M = mat(322, vec(322));\r\n    get_id(pii(0, 0))\r\n    while(que.size()){\r\n        pii p = que.front(); que.pop();\r\n        int p1 = p.first, p2 = p.second, id = get_id(p);\r\n        for(int i = 0; i < 26; i++){\r\n            int tp1 = trie[p1][i], tp2 = trie[p2][i];\r\n            if(!tp1 || !tp2) continue;\r\n            M[id][get_id(pii(tp1, tp2))]++;\r\n            if(endp[tp1]) M[id][get_id(pii(0, tp2))]++;\r\n            if(endp[tp2]) M[id][get_id(pii(tp1,0))]++;\r\n            if(endp[tp1] && endp[tp2]) M[id][get_id(pii(0, 0))]++;\r\n        }\r\n    }\r\n    /*for(int i = 0; i < 15; i++){\r\n        for(int j = 0; j < 15; j++)\r\n            cout << M[i][j] << ' ';\r\n        cout << endl;\r\n    }*/\r\n    mat ans = mod_pow(M, m);\r\n    cout << ans[0][0] << endl;\r\n    return 0;\r\n}", "lang": "GNU C++17", "bug_code_uid": "bc86282f5997253251da87a86814ec9a", "src_uid": "711d15e11016d0164fb2b0c3756e4857", "apr_id": "60f22607de08b320777a0b9c78ee2558", "difficulty": 2700, "tags": ["dp", "matrices", "data structures", "string suffix structures", "brute force", "strings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.9772079772079773, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "#include<bits/stdc++.h>\r\nusing namespace std;\r\nint main()\r\n{\r\n    int n,;\r\n   \r\n    cin>>n;\r\n   if(n == 1)\r\n    {\r\n        cout<<\"3\"<<endl;\r\n       \r\n    } \r\n    if(n == 2)\r\n    {\r\n        cout<<\"5\"<<endl;\r\n       \r\n    }\r\n\r\n   \r\n  \r\n  if(n>=3)\r\n  {\r\n      i=floor(n/3);\r\n  }\r\n  cout<<n+i+3<<endl;\r\n    \r\n    \r\n    \r\n  \r\n    \r\n   \r\n    return 0;\r\n}", "lang": "GNU C++17", "bug_code_uid": "ec482e8ceb73ea18d210ba15473f0072", "src_uid": "d0a8604b78ba19ab769fd1ec90a72e4e", "apr_id": "3a340a8dcde7aead1e656bba42e79f95", "difficulty": 1500, "tags": ["geometry", "math", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9077757685352622, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include <bits/stdc++.h>\r\nusing namespace std;\r\n\r\n\r\n\r\nint main(){\r\n    ios_base::sync_with_stdio(false);\r\n    cin.tie(NULL);\r\n\r\n    long long n;\r\n    cin >> n;\r\n    if(n==1){\r\n        cout << 3;\r\n    }else{\r\n        cout << 3+floor((4*n)/3);\r\n    }\r\n}", "lang": "GNU C++17", "bug_code_uid": "4f08c3249a9862d5244d984fd2e072ea", "src_uid": "d0a8604b78ba19ab769fd1ec90a72e4e", "apr_id": "80257138cbe1f7ed4f0f4d9f949c0e10", "difficulty": 1500, "tags": ["geometry", "math", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.647887323943662, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#include <bits/stdc++.h>\r\nusing namespace std;\r\n#define ll long long int\r\n\r\n\r\nint main() {\r\n\r\n    ll n;\r\n    cin>>n;\r\n\r\n    cout<<2n+1;\r\n\r\n\r\n\r\n}\r\n", "lang": "GNU C++17", "bug_code_uid": "d1effbbc489c4582ea8c916be1d12b22", "src_uid": "d0a8604b78ba19ab769fd1ec90a72e4e", "apr_id": "b94a7b574cc83d997e1e80a98c5386e6", "difficulty": 1500, "tags": ["geometry", "math", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9313464608834486, "equal_cnt": 15, "replace_cnt": 6, "delete_cnt": 3, "insert_cnt": 5, "fix_ops_cnt": 14, "bug_source_code": "#include<bits/stdc++.h>\r\nusing namespace std;\r\n\r\n// #pragma comment(linker, \"/STACK:268435456\");\r\n#include <ext/pb_ds/assoc_container.hpp>\r\n#include <ext/pb_ds/tree_policy.hpp>\r\nusing namespace __gnu_pbds;\r\n  \r\n#define ordered_set tree<int, null_type,less<int>, \r\nrb_tree_tag,tree_order_statistics_node_update>\r\n\r\n \r\n//========================TypeDefs===================================//\r\n \r\ntypedef long long ll;\r\ntypedef unsigned long long int ull;\r\ntypedef long double ldb;\r\n \r\ntypedef pair<ll,ll> pll;\r\ntypedef pair<int,int> pii;\r\n \r\n \r\n//=========================MACROS====================================//\r\n \r\n// using vl = vector<ll>;\r\n// using vvl = vector<vl>;\r\n \r\n#define pb push_back\r\n#define vi vector<int>\r\n#define vll vector<ll>\r\n#define vpll vector<pll>\r\n#define vpii vector<pii>\r\n#define mll map<ll,ll>\r\n#define ff first\r\n#define ss second\r\n#define mp make_pair\r\n#define mt make_tuple\r\n#define le length()\r\n#define be begin()\r\n#define en end()\r\n \r\n#define rep(i,n) for(ll i=0;i<n;i++)\r\n#define rep1(i,n) for(ll i=1;i<=n;i++)\r\n#define reprev(i,n) for(ll i=n-1;i>=0;i--)\r\n#define reprev1(i,n) for(ll i=n;i>0;i--)\r\n#define repm(i,m,n) for(ll i=m;i<n;i++)\r\n#define repmrev(i,m,n) for(ll i=n-1;i>=m;i--)\r\n \r\n#define PN cout<<\"NO\\n\"\r\n#define PY cout<<\"YES\\n\"\r\n \r\n \r\nconst int inf=INT_MAX;\r\nconst ll mod=1e9+7;\r\nconst int N=2e5+1;\r\n \r\n \r\n//=========================FUNCTIONS====================================//\r\n \r\n/*\r\nFINDING A POWER N WITHOUT MODULO OPERATION\r\n \r\nll binpow(ll a,ll n){\r\n    ll res=1;\r\n    while(n>0){\r\n        if(a & 1){\r\n            res=res*a;\r\n        }\r\n        a=a*a;\r\n        b >>=1;\r\n    }\r\n    return res;\r\n}\r\n*/\r\n \r\n/*\r\nFINDING A POWER N MODULO M\r\n \r\nlong long binpow(long long a, long long b, long long m) {\r\n    a %= m;\r\n    long long res = 1;\r\n    while (b > 0) {\r\n        if (b & 1)\r\n            res = res * a % m;\r\n        a = a * a % m;\r\n        b >>= 1;\r\n    }\r\n    return res;\r\n}\r\n*/\r\n \r\n \r\n//SORTING BY SECOND VALUE\r\n/*\r\nbool sortbysec(const pair<int,int> &a,const pair<int,int> &b){\r\n    return (a.second>b.second);\r\n}\r\n*/\r\n/*\r\nRETURNS WHETHER A NUMBER IS PRIME\r\n \r\nbool isprime(ll n){\r\n    if(n==1){\r\n        return false;\r\n    }\r\n    ll i=2;\r\n    while(i*i<=n){\r\n        if(n%i==0){\r\n            return false;\r\n        }\r\n        i++;\r\n    }\r\n    return true;\r\n}\r\n*/\r\n/*\r\n//SUM OF DIVISORS\r\nint divisors(ll n){\r\n    ll sum=0;\r\n    for(ll i=1;i*i<=n;i++){\r\n        if(n%i==0){\r\n            sum+=i;\r\n            if(n%(n/i)==0 && i!=n/i){\r\n                sum+=(n/i);\r\n            }\r\n        }\r\n    }\r\n    return sum;\r\n}\r\n*/\r\n/*\r\nRETURNS GCD OF TWO NUMBERS\r\n \r\nll gcd(ll a,ll b){\r\n    if(a==0){\r\n        return b;\r\n    }\r\n    return gcd(b%a,a);\r\n}\r\n*/\r\n \r\n/*\r\n//DFS\r\nvoid dfs(int node){\r\n    vis[node]=1;\r\n    cc[node]=cnt;\r\n    for(int child:arr[node]){\r\n        if(vis[child]==0){\r\n            dfs(child);\r\n        }\r\n    }\r\n}\r\n*/\r\n/*\r\n//BFS\r\nvoid bfs(int node){\r\n    queue<int> q;\r\n    vis[node]=1;\r\n    q.push(node);\r\n    dist[node]=0;\r\n    while(!q.empty()){\r\n        int curr=q.front();\r\n        q.pop();\r\n        for(int child:arr[curr]){\r\n            if(vis[child]==0){\r\n                dist[child]=dist[curr]+1;\r\n                vis[child]=1;\r\n                q.push(child);\r\n            }\r\n        }\r\n    }\r\n}\r\n//Maximum prime divisor of a number\r\nll maxPrime(ll n){\r\n    ll mp=-1;\r\n    while(n%2==0){\r\n        mp=2;\r\n        n>>=1;\r\n    }\r\n    while(n%3==0){\r\n        mp=3;\r\n        n/=3;\r\n    }\r\n    for(ll i=5;i*i<=n;i++){\r\n        while (n % i == 0) {\r\n            mp = i;\r\n            n = n / i;\r\n        }\r\n        while (n % (i+2) == 0) {\r\n            mp = i+2;\r\n            n = n / (i+2);\r\n        }\r\n    }\r\n    if(n>4){\r\n        mp=n;\r\n    }\r\n    return mp;\r\n}\r\n \r\n \r\nll power(ll a,ll b)\r\n{\r\n    if(a==1||b==0)  return 1;\r\n    ll c=power(a,b/2);\r\n    ll res=1;\r\n    res=c*c;\r\n    if(res>=mod)    res%=mod;\r\n    if(b%2) res*=a;\r\n    if(res>=mod)    res%=mod;\r\n    return res;\r\n}\r\n\r\n*/\r\n \r\n //char alpha[]={'a','b','c','d','e','f','g','h','i','j','k','l',\r\n//    'm','n','o','p','q','r','s','t','u','v','w','x','y','z'}; \r\n \r\n//=========================MAIN====================================//\r\n\r\nvoid solve(){\r\n    ll n;\r\n    cin>>n;\r\n    ordered_set os;\r\n    for(ll i=1;i<=10000;i++){\r\n        for(ll j=i+1;j<=10000;j++){\r\n            os.insert(j*j-i*i);\r\n        }\r\n    }\r\n    cout<<*(os.find_by_order(n))<<\"\\n\";\r\n}\r\n \r\nint main(){\r\n    // freopen(\"input.txt\",\"r\",stdin);\r\n    // freopen(\"output.txt\",\"w\",stdout);\r\n    int t=1;\r\n    //cin>>t;\r\n    while(t--){\r\n        solve();\r\n    }\r\n    return 0;\r\n}", "lang": "GNU C++17", "bug_code_uid": "34c03796fab735dd23c129ac81266cdb", "src_uid": "d0a8604b78ba19ab769fd1ec90a72e4e", "apr_id": "1f9a1b30738783317cdf1a0dfea593b5", "difficulty": 1500, "tags": ["geometry", "math", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9985724575993714, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 6, "bug_source_code": "/*                      ________________________\n                       /      #\n                      /     #   #\n                     /        #\n                    /\n                   /       #   #\n                  /      #        #\n                 /                 #\n                /                  #\n               /                   #\n              /                   #\n             /                   #\n\\           /                   #\n \\         /                  #\n  \\       /                 #\n   \\     /                 #\n    \\   /                 #       #\n     \\ /                    #   #\n*/\n//#pragma GCC optimize(\"Ofast\")\n//#pragma GCC target(\"avx,avx2,fma\")\n//#pragma GCC optimization(\"unroll-loops\")\n\n#include <bits/stdc++.h>\n#include <complex>\nusing namespace std;\nconst long double PI = 3.1415926535897932384626;\ntypedef long long ll;\ntypedef vector<ll> vli;\ntypedef pair<ll, ll> pii;\n#define f first\n//#define s second\n#define pb push_back\n#define mp make_pair\n#define rep(i, a, b) for (long long int i = a; i < b; i++)\n#define mod 1000000007\n#define clr(x) memset(x, 0, sizeof(x))\n#define gcd __gcd\n#define middle(x) ceil2(x, 2) - 1\n#define all(x) x.begin(), x.end()\n#define revall(x) x.rbegin(), x.rend()\n#define sortall(x) sort(all(x))\n#define reverseall(x) reverse(all(x))\ninline ll ceil2(ll a, ll b)\n{\n    return (a + b - 1) / b;\n} // BE CAREFUL FOR NEGATIVES\n#define FIO                       \\\n    ios_base::sync_with_stdio(0); \\\n    cin.tie(0);                   \\\n    cout.tie(0);\n\n// DEBUG\nvoid __print(int x) { cout << x; }\nvoid __print(long x) { cout << x; }\nvoid __print(long long x) { cout << x; }\nvoid __print(unsigned x) { cout << x; }\nvoid __print(unsigned long x) { cout << x; }\nvoid __print(unsigned long long x) { cout << x; }\nvoid __print(float x) { cout << x; }\nvoid __print(double x) { cout << x; }\nvoid __print(long double x) { cout << x; }\nvoid __print(char x) { cout << '\\'' << x << '\\''; }\nvoid __print(const char *x) { cout << '\\\"' << x << '\\\"'; }\nvoid __print(const string &x) { cout << '\\\"' << x << '\\\"'; }\nvoid __print(bool x) { cout << (x ? \"true\" : \"false\"); }\n\ntemplate <typename T, typename V>\nvoid __print(const pair<T, V> &x);\ntemplate <typename T>\nvoid __print(const vector<T> &x);\ntemplate <typename T>\nvoid __print(const T &x);\n\ntemplate <typename T, typename V>\nvoid __print(const pair<T, V> &x)\n{\n    cout << '{';\n    __print(x.first);\n    cout << ',';\n    __print(x.second);\n    cout << \"}\";\n}\ntemplate <typename T, typename V, typename U>\nvoid __print(const tuple<T, V, U> &x)\n{\n    cout << '{';\n    __print(get<0>(x));\n    cout << ',';\n    __print(get<1>(x));\n    cout << ',' << get<2>(x);\n    cout << \"}\";\n}\ntemplate <typename T>\nvoid __print(const vector<T> &x)\n{\n    cout << \"{\";\n    for (int u69 = 0; u69 < x.size(); u69++)\n    {\n        __print(x[u69]);\n        cout << (u69 + 1 == x.size() ? \"\" : \",\");\n    };\n    cout << \"}\";\n}\ntemplate <typename T>\nvoid __print(const T &x)\n{\n    int f = 0;\n    cout << '{';\n    for (auto &i : x)\n        cout << (f++ ? \",\" : \"\"), __print(i);\n    cout << \"}\";\n}\nvoid _print() { cout << \"]\\n\"; }\ntemplate <typename T, typename... V>\nvoid _print(T t, V... v)\n{\n    __print(t);\n    if (sizeof...(v))\n        cout << \", \";\n    _print(v...);\n}\n#ifndef ONLINE_JUDGE\n#define debug(x...)               \\\n    cout << \"[\" << #x << \"] = [\"; \\\n    _print(x)\n#else\n#define debug(x...)\n#endif\n//\n\n// void fuck()\n//{\n//     ios_base::sync_with_stdio(false);\n//     cin.tie(nullptr);\n//     cout.tie(nullptr);\n// }\n\n/*\n------>do anything but don't stop..don't procastinate...\n------>make test cases for n=1,n=0...baoundary cases..\n*/\n\n////bool get_ans(ll aux)\n////{\n////\n////}\nbool collinear(int x1, int y1, int x2, int y2, int x3, int y3)\n{\n    return (y1 - y2) * (x1 - x3) != (y1 - y3) * (x1 - x2);\n}\nbool isInt(double num)\n{\n    return (num == (int)num);\n}\n// returns the minimum of two numbers\n// ll min(ll x, ll y)\n//{\n//     return y ^ ((x ^ y) & -(x < y));\n// }\n////returns the maximum of two numbers\n// ll max(ll x, ll y)\n//{\n//     return x ^ ((x ^ y) & -(x < y));\n// }\n// addition of two integers\n// int add(int a, int b)\n//{\n//     if (b == 0)\n//         return a;\n//     int sum = a ^ b;\n//     int carry = (a & b) << 1;\n//     return add(sum, carry);\n// }\n// iterative addition of two integers\n// int Add(int a, int b)\n//{\n//     while (b != 0)\n//     {\n//         int sum = a ^ b;\n//         int carry = (a & b) << 1;\n//         a = sum;\n//         b = carry;\n//     }\n//     return a;\n// }\n// recursive subtraction of two integers\n// int subtract(int a, int b)\n//{\n//     if (b == 0)\n//         return a;\n//     return subtract((a ^ b), ((~a) & b) << 1);\n// }\n// iterative subtraction of two integers\n// int Subtract(int x, int y)\n//{\n//     while (y != 0)\n//     {\n//         int borrow = (~x) & y;\n//         x = x ^ y;\n//         y = borrow << 1;\n//     }\n//     return x;\n// }\n//  Russian Peasant using bitwise operator\n// multiplication function without using \"*\"\n// int multiply(int a, int b)\n//{\n//     int res = 0;\n//     while (b)\n//     {\n//         if (b & 1)\n//         {\n//             res = res + a;\n//         }\n//         a = a << 1;\n//         b = b >> 1;\n//     }\n//     return res;\n// }\n// divide\n// int divide(int a, int b)\n//{\n//     int sign = ((a < 0) ^ (b < 0)) ? -1 : 1;\n//     a = abs(a);\n//     b = abs(b);\n//     int q = 0, tmp = 0;\n//     for (int i = 31; i >= 0; --i)\n//     {\n//         if (tmp + (b << i) <= a)\n//         {\n//             tmp += (b << i);\n//             q |= (1LL << i);\n//         }\n//     }\n//     return sign * q;\n// }\n// O(sqrt(n)) for below\n// ll phi(ll n)\n//{\n//     ll res = n;\n//     for (ll i = 2; i * i <= n; i++)\n//     {\n//         if (n % i == 0)\n//         {\n//             res = res / i;\n//             res = res * (i - 1);\n//         }\n//         while (n % i == 0)\n//         {\n//             n = n / i;\n//         }\n//     }\n//\n//     if (n > 1)\n//     {\n//         res = res * (n - 1);\n//         res = res / n;\n//     }\n//     return res;\n// }\n\n// o(nlog(logn)) for below\n// ll phi[1000006];\n// void PHI()\n//{\n//     rep(i, 0, 1000006)\n//     {\n//         phi[i] = i;\n//     }\n//     rep(i, 2, 1000006)\n//     {\n//         if (phi[i] == i)\n//         {\n//             for (int j = i; j < 1000006; j = j + i)\n//             {\n//                 phi[j] = phi[j] * (i - 1);\n//                 phi[j] = phi[j] / i;\n//             }\n//         }\n//     }\n// }\n//  prefix function in better way\n// vector<int> prefix_func(string s)\n//{\n//     ll n=s.length();\n//     vector<int> prefix(n,0);\n//     prefix[0]=0;\n//     int j=0;\n//     for(int i=1;i<n;i++)\n//     {\n//         j=prefix[i-1];\n//         while(j>0 && s[i]!=s[j])\n//         {\n//             j--;\n//         }\n//         if(s[i]==s[j])\n//         {\n//             j++;\n//         }\n//         prefix[i]=j;\n//     }\n//\n// return prefix;\n// }\n// int kmp(string s,string pat)\n//{\n//     //string s=\"abaaba\";\n//     vector<int> prefix=prefix_func(s);\n//     //for(auto i:prefix)\n//     //{\n//     //    cout<<i<<\"   \";\n//     //}\n//     //cout<<endl;\n//     //string pat=\"aa\";\n//     ll n=s.size();\n//     ll j=0;\n//     ll pos=0;\n//     for(int i=0;i<n;i++)\n//     {\n//         if(s[i]==pat[j])\n//         {\n//             i+=1;\n//             j+=1;\n//         }\n//         else\n//         {\n//             if(j>0)\n//             {\n//                 j=prefix[j-1];\n//             }\n//             else\n//             {\n//                 i++;\n//             }\n//         }\n//         if(j==pat.size())\n//         {\n//             //cout<<i<<endl;\n//             pos=i-pat.size();\n//             break;\n//         }\n//     }\n//     //cout<<pos<<endl;\n//     return pos;\n// }\n// vector<int> get_z(string s)\n//{\n//     /*\n//     isme kya hota h ki z array k kisi v index pr jo value hoti h wo ye btati h ki\n//     uss index se utne length(uss index ki value) ki prefix exist krti h string me...\n//     example-\n//             string str=\" a b c d s j v j a b c h j\"\n//                      Z=                  3\n//                      yha jo 3 h wo bta rha h ki abc 3 length ki as a prefix exist krti h...\n//     */\n///*\n//        jo isme [l,r] hai wo ye bta rha h ki \"l\" to \"r\" ki jo substring hai prefix k\n//        barabar ho chuki h...\n//\n//        */\n//    int n=s.length();\n//    //int z[n];\n//    vector<int> z(n,0);\n//    //for(int i=0;i<n;i++)\n//    //{\n//    //    cout<<z[i]<<\"  \";\n//    //}\n//    //memset(z,0,n);\n//    int l=0,r=0;\n//    for(int i=0;i<n;i++)\n//    {\n//        if(i>r)\n//        {\n//            l=r=i;\n//            while(r<n && s[r-l]==s[r])\n//            {\n//                r=r+1;\n//            }\n//            z[i]=r-l;\n//            r--;\n//        }\n//        else\n//        {\n//            int idx=i-l;\n//            if(z[idx]+i<=r)\n//            {\n//                z[i]=z[idx];\n//            }\n//            else\n//            {\n//                l=i;\n//                while(r<n && s[r-l]==s[r])\n//                {\n//                    r++;\n//                }\n//                z[i]=r-l;\n//                r--;\n//            }\n//        }\n//    }\n//    return z;\n//}\n// to get better results in decimal places..\n// use double for better precision in decimal places\n// cout<<fixed<<setprecision(10)<<ans<<endl;\n// we get double/float as return in sqrt(blah_blah) function\n// find euclidean distance\ndouble euclid_dist(ll x1, ll y1, ll x2, ll y2)\n{\n    return sqrt(abs(x1 - x2) * abs(x1 - x2) * 1.000 + abs(y1 - y2) * abs(y1 - y2) * 1.000);\n}\n\nll binpow(ll a, ll b)\n{\n    ll res = 1;\n    while (b > 0)\n    {\n        if (b & 1)\n            res = res * a;\n        a = a * a;\n        b >>= 1;\n    }\n    return res;\n}\n\nll binpow_mod(ll a, ll b, ll MOD)\n{\n    ll res = 1;\n    while (b > 0)\n    {\n        if (b & 1)\n        {\n            res = ((res % MOD) * (a % MOD)) % MOD;\n        }\n        b = b >> 1;\n        a = ((a % MOD) * (a % MOD)) % MOD;\n    }\n    return res;\n}\n\n//***function to check whether a str2 is a substring of str1 or not.....\n// bool check_substring(string str1,string str2)\n//{\n//    ll pos=0;\n//    for(ll i=0;i<str1.size();i++)\n//    {\n//        if(str1[i]==str2[pos])\n//        {\n//            pos++;\n//        }\n//        if(pos==str2.size())\n//        {\n//            break;\n//        }\n//    }\n//    if(pos==str2.size())\n//    {\n//        return true;\n//    }\n//    return false;\n//}\n// function to count the occurence of a character in string\n// ll count_occurence(string str,char search)\n//{\n//    ll ans=0;\n//    for(int i=0;i<str.size();i++)\n//    {\n//        if(search==str[i])\n//        {\n//            ans=ans+1;\n//        }\n//    }\n//    return ans;\n//}\n// vector<ll> get_factors(ll n)\n//{\n//    vector<ll> v;\n//    for (int i = 1; i <= sqrt(n); i++)\n//    {\n//        if (n % i == 0)\n//        {\n//            if (n / i == i)\n//            {\n//                v.push_back(i);\n//            }\n//            else\n//            {\n//                v.push_back(i);\n//                v.push_back((n / i));\n//            }\n//        }\n//    }\n//    return v;\n//}\n//----convert a number(as string) to any base\n// int convert(string s,int base)\n//{\n//    int pw=1;\n//    int n=0;\n//    for(int i=n-1;i>=0;i--)\n//    {\n//        if(val(s[i])>base)\n//        {\n//            return INT_MAX;\n//        }\n//        n=n+(val[s[i]])*base;\n//        pw=pw*base;\n//    }\n//    return n;\n//}\n\n// GRAPH DFS---------------GRAPH ALGOS BELOW THIS-------\n// vector<int> graph[(int)102];\n// bool visited[105];\n// bool flag = false;\n// void dfs(int start, int finish)\n//{\n//     visited[start] = true;\n//     if (start == finish)\n//     {\n//         flag = true;\n//         return;\n//     }\n//     for (auto i : graph[start])\n//     {\n//         if (!(visited[i]))\n//         {\n//             dfs(i, finish);\n//         }\n//     }\n// }\n// class DisjSet\n//{\n//    // complexity 4*alpha...most optimised version\n//    int *rank, *parent, n;\n//    int *size;\n//\n// public:\n//    DisjSet(int n)\n//    {\n//        size = new int[n];\n//        parent = new int[n];\n//        this->n = n;\n//        makeSet();\n//    }\n//    void makeSet()\n//    {\n//        for (int i = 0; i < n; i++)\n//        {\n//            parent[i] = i;\n//            size[i] = 1;\n//        }\n//    }\n//    int find(int i)\n//    {\n//        if (i == parent[i])\n//        {\n//            return parent[i];\n//        }\n//        return parent[i] = find(parent[i]);\n//    }\n//    void Union(int u, int v)\n//    {\n//        int paru = find(u);\n//        int parv = find(v);\n//        if (paru ^ parv)\n//        {\n//            if (size[parv] > size[paru])\n//            {\n//                // bade me chote ko add krenge\n//                size[parv] += size[paru];\n//                parent[paru] = parv;\n//            }\n//            else\n//            {\n//                size[paru] += size[parv];\n//                parent[parv] = paru;\n//            }\n//        }\n//    }\n//};\n// ll binary_search(vector<ll> &vec, ll val)\n//{\n//     ll left = 0, right = vec.size() - 1;\n//     while (left <= right)\n//     {\n//         ll mid = (left + right) / 2;\n//         if (vec[mid] == val)\n//         {\n//             return mid;\n//         }\n//         else if (vec[mid] < val)\n//         {\n//             left = mid + 1;\n//         }\n//         else\n//         {\n//             right = mid - 1;\n//         }\n//     }\n//     return right; //this will return a number jus less than 'val'\n// }\n\nstring convert_binary(ll n)\n{\n    string str = \"\";\n    while (n)\n    {\n        if (n & 1)\n        {\n            str.push_back('1');\n        }\n        else\n        {\n            str.push_back('0');\n        }\n        n = n / 2;\n    }\n    reverse(str.begin(), str.end());\n    return str;\n}\n// vector<ll> ans, bag(2, 0);\n\n// 2-d dfs waha tk chlana h jb tk feasible hp movement mtlb hm return tb hi honge jb out\n//  of bound ki condition aayegi\n// int cnates[1000][2];\n// bool visi[1000];\n// vector<ll> adj[105];\n// void dfs(ll src)\n//{\n//     visi[src] = true;\n//     for (auto i : adj[src])\n//     {\n//         if (!visi[i])\n//         {\n//             dfs(i);\n//         }\n//     }\n// }\n//----------------------------------------------\n// const int N = 1e6 + 3;\n// bool prime[N];\n// vector<ll> det(N, 0);\n// void seive(int n)\n//{\n//     memset(prime, true, sizeof(prime));\n//     prime[0] = false;\n//     prime[1] = false;\n//     for (int i = 2; i <= n; i++)\n//     {\n//         if (prime[i])\n//         {\n//             for (int j = 2 * i; j <= n; j += i)\n//             {\n//                 prime[j] = false;\n//             }\n//         }\n//     }\n//     for (int i = 1; i < N; i++)\n//     {\n//         if (prime[i])\n//         {\n//             det[i] = det[i - 1];\n//         }\n//         else\n//         {\n//             det[i] = 1 + det[i - 1];\n//         }\n//     }\n// }\n/////////=-------------------------TARJAN's algorithm=-------------------O(V+E)////////\n// vector<int> adj[100010];\n// ll mini = INT_MAX;\n// ll cnt, tot,ans;\n// ll cst[100005];\n// void dfs_for_tarjan(int u, vector<int> &disc, vector<int> &low, vector<bool> &instack, stack<int> &mystk)\n//{\n//     static int time = 0;\n//     disc[u] = low[u] = time;\n//    // cout<<time<<endl;\n//     time = time + 1;\n//     mystk.push(u);\n//     instack[u] = true;\n//     for (auto v : adj[u])\n//     {\n//         if (disc[v] == -1) //If nodes are not discovered yet\n//         {\n//             dfs_for_tarjan(v, disc, low, instack, mystk);\n//             low[u] = min(low[u], low[v]);\n//         }\n//         else if (instack[v]) //it will be true when there will be a case of back edge\n//         {\n//             low[u] = min(low[u], disc[v]);\n//         }\n//     }\n//     mini=INT_MAX;\n//     if (disc[u] == low[u]) //IF u is head node of SCC\n//     {\n//         cnt=0;\n//         //cout << \"THE SCC IS:\\n\";\n//         while (mystk.top() != u)\n//         {\n//             //  cout << mystk.top() << \"  \";\n//             if (cst[mystk.top()] < mini)\n//             {\n//                 mini = cst[mystk.top()];\n//                 cnt = 0;\n//             }\n//             if (mini == cst[mystk.top()])\n//             {\n//                 cnt = cnt + 1;\n//             }\n//             instack[mystk.top()] = false;\n//             mystk.pop();\n//         }\n//         //cout << mystk.top() << \"\\n\";\n//         //cout<<ans<<\" \"<<tot<<endl;\n//         if (cst[mystk.top()] < mini)\n//         {\n//             mini = cst[mystk.top()];\n//             cnt = 0;\n//         }\n//         if (mini == cst[mystk.top()])\n//         {\n//             cnt = cnt + 1;\n//         }\n//         //cout<<cnt<<endl;\n//         instack[mystk.top()] = false;\n//         mystk.pop();\n//         ans=ans+mini;\n//         tot=((tot%mod)*(cnt%mod))%mod;\n//         //cout<<ans<<\" \"<<tot<<endl;\n//     }\n// }\n// void get_SCC_tarjan(int V)\n//{\n//     vector<int> disc(V+1, -1), low(V+1, -1);\n//     vector<bool> instack(V+1, false);\n//     stack<int> mystk;\n//     for (int i = 1; i <= V; i++)\n//     {\n//         if (disc[i] == -1)\n//         {\n//             dfs_for_tarjan(i, disc, low, instack, mystk);\n//         }\n//     }\n// }\n//-----------------------------------------------------------------------------------\n//-----------------------------------------------------------------------------------\n//-----------------------------DFS FOR TREE------------------------------------------\n//-----------------------------------------------------------------------------------\n// const int maxn = 100005;\n// vector<ll> adj[maxn];\n// vector<bool> visited(maxn, 0);\n// ll dp[maxn];\n// ll ok;  //\n// ll ans; //\n// ll a[maxn];\n// void dfs(int curr, int par, int cnt)\n//{\n//     if (visited[curr])\n//     {\n//         return;\n//     }\n//     visited[curr] = true;\n//\n//     //if (par != -1)\n//     //{\n//     //    dp[curr] = dp[par] + 1;\n//     //}\n//     for (ll i = 0; i < adj[curr].size(); i++)\n//     {\n//         ll next = adj[curr][i];\n//         if (par != next)\n//         {\n//             if (a[next] == 1 && a[curr] == 1)\n//             {\n//                 dfs(next, curr, cnt + 1);\n//             }\n//             else\n//             {\n//                 dfs(next, curr,a[next]);\n//             }\n//         }\n//     }\n// }\n//----------------------------------------------------------------------------------\n//------------------------------------BFS----------------------------------------------\n// const int maxn = 20000;\n// vector<ll> adj[maxn];\n// ll ans[100000];\n// vector<bool> visited(100000, 0);\n// bool flag=false;\n// void bfs(int i, int j)\n//{\n//     queue<ll> q;\n//     q.push(i);\n//     ans[i]=0;\n//     while (!(q.empty()))\n//     {\n//         ll src = q.front();\n//         q.pop();\n//        //cout<<src<<\" \";\n//         for (auto ii : adj[src])\n//         {\n//             if (!(visited[ii]))\n//             {\n//                 visited[ii]=true;\n//                 ans[ii]=ans[src]+1;\n//                 q.push(ii);\n//                 if (ii == j)\n//                 {\n//                     flag = true;\n//                     break;\n//                 }\n//             }\n//         }\n//         if(flag)\n//         {\n//             break;\n//         }\n//     }\n//     //cout<<\"\\n\";\n//     return;\n// }\n//-----------------------------------------------------------------------------------\n//-----------------------------------------------------------------------------------\n//--------------------------------LCS------------------------------------------------\n// ll dp[5005][5005];\n// ll lcs(string s1,string s2)\n//{\n//     for(int i=0;i<s1.size();i++)\n//     {\n//         dp[0][i]=0;\n//     }\n//     for(int i=0;i<s2.size();i++)\n//     {\n//         dp[i][0]=0;\n//     }\n//     for(int i=1;i<=s1.size();i++)\n//     {\n//         for(int j=1;j<=s2.size();j++)\n//         {\n//             if(s1[i-1]==s2[j-1])\n//             {\n//                 dp[i][j]=dp[i-1][j-1]+1;\n//             }\n//             else\n//             {\n//                 dp[i][j]=max(dp[i-1][j],dp[i][j-1]);\n//             }\n//         }\n//     }\n//\n//     //printing of lcs\n//     string ans;\n//     int i=s1.size();\n//     int j=s2.size();\n//     while(i>0 && j>0)\n//     {\n//         if(s1[i-1]==s2[j-1])\n//         {\n//             ans.push_back(s1[i-1]);\n//             i--,j--;\n//         }\n//         else if(dp[i-1][j]>dp[i][j-1])\n//         {\n//             i--;\n//         }\n//         else\n//         {\n//             j--;\n//         }\n//     }\n//     reverse(ans.begin(),ans.end());\n//     cout<<ans<<\"\\n\";\n//     return dp[s1.size()][s2.size()];\n// }\n// vector<pair<int, int>> adj[100005];\n// vector<int> v[100005];\n// ll findshortest(int src, int n)\n//{\n//     ll dist[n + 1];\n//     for (int i = 0; i <= n; i++)\n//     {\n//         dist[i] = INT_MAX;\n//     }\n//     dist[src] = 0;\n//     priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;\n//     pq.push({0, src});\n//     while (!pq.empty())\n//     {\n//         auto node = pq.top().second;\n//         auto dis = pq.top().first;\n//         pq.pop();\n//         //cout<<node<<\"\\n\";\n//         if(v[node].size())\n//         {\n//             while(binary_search(v[node].begin(),v[node].end(),dis))\n//             {\n//                 dis++;\n//             }\n//         }\n//         //cout<<\"11\\n\";\n//         for (auto it : adj[node])\n//         {\n//          //   cout<<it.first<<\"  \"<<it.second<<\"\\n\";\n//             if ((dis + it.second) < dist[it.first])\n//             {\n//                 dist[it.first] = dis + it.second;\n//                 pq.push({dist[it.first], it.first});\n//             }\n//         }\n//        // cout<<\"123\\n\";\n//     }\n//     return dist[n];\n// }\n// vector<int> adj[200009];\n// vector<int> height(200009, 0);\n// vector<int> det_lev[200009];\n// vector<int> out_degree(200009, -1);\n// vector<int> parent(200009, 0);\n// void dfs(int curr, int par, int level)\n//{\n//     parent[curr] = par;\n//     height[curr] = level;\n//     det_lev[level].push_back(curr);\n//     out_degree[curr] = adj[curr].size() - 1;\n//     for (auto it : adj[curr])\n//     {\n//         if (it != par)\n//         {\n//             dfs(it, curr, level + 1);\n//         }\n//     }\n//     return;\n// }\n// bool mycomp(const pair<ll, ll> &a, const pair<ll, ll> &a)\n//{\n//     return a.first < b.second;\n// }\n// int reflec[10]={0,1,5,-1,-1,2,-1,-1,8,-1};//reflection of numbers in mirror\n// const int INF = 1e9 + 7;\n// const int maxn = 5e6 + 1;\n// vector<int> prime_divisors_till(maxn, 0);\n// void get_no_of_prime_divisors(vector<int> &prime_divisors_till, int maxn)\n//{\n//     vector<int> seive(maxn, 0);\n//     vector<int> no_of_prime_divisors(maxn, 0);\n//     for (int i = 2; i < maxn; i++)\n//     {\n//         if (seive[i] == 0)\n//         {\n//             for (int j = i; j < maxn; j = j + i)\n//             {\n//                 seive[j] = i;\n//             }\n//         }\n//         int p = seive[i];\n//         no_of_prime_divisors[i] = 1 + no_of_prime_divisors[i / p];\n//         prime_divisors_till[i] += no_of_prime_divisors[i] + prime_divisors_till[i - 1];\n//     }\n// }\n// ll n;\n// ll dp[2005][2005];\n// bool fun(vector<ll> &subset,ll i,ll sum)\n//{\n//     if(i==0)\n//     {\n//         if(sum==0)\n//         {\n//             return true;\n//         }\n//         return false;\n//     }\n//     if(dp[i][sum]!=-1)\n//     {\n//         return dp[i][sum];\n//     }\n//     bool ans=false;\n//     if(sum-subset[i-1]>=0)\n//     {\n//         ans|=fun(subset,i-1,sum-subset[i-1]);\n//     }\n//     ans|=fun(subset,i-1,sum);\n//     return dp[i][sum]=ans;\n// }\n/*\nll check(string str1, string str2)\n{\n    if (str2.find(str1) != string::npos)\n    {\n        return 1;\n    }\n    return 0;\n}\n*/\nll findMex(vli arr, ll n)\n{\n    sort(arr.begin(), arr.end());\n    if (arr[0] != 0)\n        return 0;\n    rep(i, 1, n - 1)\n    {\n        if (arr[i] - arr[i - 1] <= 1)\n            continue;\n        return arr[i - 1] + 1;\n    }\n    return arr[n - 1] + 1;\n}\nconst int maxn = 2e5 + 5;\n\nvector<int> convert_string(ll a)\n{\n    vector<int> ans;\n    ll b = a;\n    while (b)\n    {\n        ans.push_back(b % 10);\n        b /= 10;\n    }\n    return ans;\n}\n\n// vector<int> level(200005, 0);\n// ll parent[200005][22];\n// ll n, q;\n// void dfs(int curr, int par, int h)\n//{\n//     level[curr] = h;\n//     if (par != -1)\n//     {\n//         parent[curr][0] = par;\n//     }\n//     for (auto it : adj[curr])\n//     {\n//         if (it != par)\n//         {\n//             dfs(it, curr, h + 1);\n//         }\n//     }\n// }\n// void preprocess_lca()\n//{\n//     dfs(1, -1, 1);\n//\n//     for (int j = 1; j <= 21; j++)\n//     {\n//         //cout<<parent[i][0]<<\" \";\n//         for (int i = 1; i <= n; i++)\n//         {\n//             parent[i][j] = parent[parent[i][j - 1]][j - 1];\n//             //  cout<<parent[i][j]<<\" \";\n//         }\n//         //cout<<\"\\n\";\n//     }\n// }\n//\n// void query(ll x, ll k)\n//{\n//     int cnt = 0;\n//     while (k)\n//     {\n//         if (k & 1)\n//         {\n//             x = parent[x][cnt];\n//         }\n//         cnt += 1;\n//         k = k >> 1;\n//     }\n//     if (x != 0)\n//     {\n//         cout << x << \"\\n\";\n//     }\n//     else\n////    {\n////        cout << \"-1\\n\";\n////    }\n////    return;\n////}\nvector<bool> prime;\nvoid seive(int n)\n{\n    prime[0] = false;\n    prime[1] = false;\n    prime[2] = true;\n    for (int i = 2; i * i <= n; i++)\n    {\n        if (prime[i])\n        {\n            for (int j = 2 * i; j <= n; j += i)\n            {\n                prime[j] = false;\n            }\n        }\n    }\n}\n\n// int diameter = 0;\n// vector<int> adj[200005];\n// vector<int> dp1(200005, 0); //stores the value of max of l,r\n// vector<int> dp2(200005, 0); //stores the value of 1+l+r\n// void dfs_for_diameter(int curr, int par)\n//{\n//     vector<int> fvalues;\n//     bool leaf = true;\n//     for (auto it : adj[curr])\n//     {\n//         if (it == par)\n//         {\n//             continue;\n//         }\n//         leaf = false;\n//         dfs_for_diameter(it, curr);\n//         fvalues.push_back(dp1[it]);\n//     }\n//     if (leaf)\n//     {\n//         dp1[curr] = 0;\n//         return;\n//     }\n//     sort(fvalues.begin(), fvalues.end());\n//     dp1[curr] = 1;\n//     if (!fvalues.empty())\n//     {\n//         dp1[curr] += fvalues.back();\n//     }\n//     if (fvalues.size() >= 2)\n//     {\n//         dp2[curr] = 2 + fvalues.back() + fvalues[fvalues.size() - 2];\n//     }\n//     diameter = max(diameter, max(dp1[curr], dp2[curr]));\n// }\n/*\nint freq[26] = {0};\nll n, k;\nstring str;\nll even, odd;\nbool check_bsa(int mid)\n{\n    ll ev = even, od = odd;\n    for (int i = 0; i < k; i++)\n    {\n        if ((mid % 2) == 1)\n        {\n            if (od > 0)\n            {\n                od--;\n                ev -= (mid - 1);\n            }\n            else\n            {\n                ev -= (mid + 1);\n                od++;\n            }\n        }\n        else\n        {\n            ev -= mid;\n        }\n    }\n    if (ev < 0)\n    {\n        return false;\n    }\n    return true;\n}\nvector<int> convert_to_vec(string str)\n{\n    vector<int> v;\n    for (auto it : str)\n    {\n        v.push_back(it - '0');\n    }\n    return v;\n}\n\n\nint vis[100005];\nint dist[100005];\nvector<pair<int,int>> adj[100005];\nstruct node\n{\n    int zero;\n    int one;\n};\n*/\n// ll sm;\n// ll n,m,k;\n// ll recur(ll i,ll k_aux,vector<ll> &weight)\n//{\n//     if(k_aux==k)\n//     {\n//         if(i==m)\n//         {\n//             return 1;\n//         }\n//         return 0;\n//     }\n//     ll pick=0,unpick=0;\n//     for(int idx=i+1;i<n;i++)\n//     {\n//         pick+=((weight[idx]/sum)%mod)*(recur(idx+1,k_aux+1,weight))%mod)%mod;\n//     }\n//     pick+=((weight[idx]/sum)%mod)*(recur(idx,k_aux+1,weight))%mod)%mod;\n// }\nll n, m, k;\n\nvector<vector<ll>> r, d;\n\nstring removeLeadingZeros(string &num)\n{\n    int i = 0;\n    while (num[i] == '0')\n        i++;\n\n    return num.substr(i);\n}\n\nint compareTwoLargeNumbers(string &str1, string &str2)\n{\n    // string str1 = removeLeadingZeros(num1);\n    // string str2 = removeLeadingZeros(num2);\n\n    int str1_length = str1.size();\n    int str2_length = str2.size();\n\n    if (str1_length != str2_length)\n        return str1_length < str2_length ? 1 : 2;\n    else\n    {\n        for (int i = 0; i < str1_length; i++)\n        {\n            if (str1[i] > str2[i])\n                return 2;\n            else if (str2[i] > str1[i])\n                return 1;\n        }\n    }\n\n    return 3;\n}\n\nlong long n_oper(string str1, string str2)\n{\n    int cnt10 = 0;\n    int cnt01 = 0;\n    for (int i = 0; i < (int)str1.size(); i++)\n    {\n        if (str1[i] == '1' and str2[i] == '0')\n        {\n            cnt10 += 1;\n        }\n        if (str1[i] == '0' and str2[i] == '1')\n        {\n            cnt01 += 1;\n        }\n    }\n    if (cnt01 != cnt10)\n    {\n        return INT_MAX;\n    }\n    return 2 * cnt01;\n}\n// in multiset always use pointer ..m_st.begin()..also for erasing\n// in multiset use m_st.empty()..rather than for loop\n\nvector<ll> get_diff(vector<ll> v)\n{\n    vector<ll> ans;\n    for (int i = 0; i < (v.size()) - 1; i++)\n    {\n        ans.push_back(v[i + 1] - v[i]);\n    }\n\n    return ans;\n}\n\nll gcd(ll a, ll b)\n{\n    if (b == 0)\n        return a;\n    return gcd(b, a % b);\n}\n\nll lcm(vli v, int n)\n{\n    ll ans = v[0];\n\n    for (int i = 1; i < n; i++)\n        ans = (((v[i] * ans)) /\n               (gcd(v[i], ans)));\n\n    return ans;\n}\n\nll mini_leaf = INT_MAX;\nll mini_lev = INT_MAX;\n\n// void dfs(ll src, ll par, ll level, vector<ll> &parent, vector<vli> &adj)\n//{\n//     debug(src);\n//     parent[src] = par;\n//     if (mini_lev < level and ((int)adj[src].size() == 1))\n//     {\n//         mini_lev = level;\n//         mini_leaf = src;\n//     }\n//     for (auto it : adj[src])\n//     {\n//         if (it != par)\n//         {\n//             dfs(it, src, level + 1, parent, adj);\n//         }\n//     }\n// }\n\nbool dfs(int i, int j, int cnt, int n, int m, vector<vector<bool>> &visi, vector<vector<ll>> &mtx)\n{\n    if (i == n - 1 and j == m - 1)\n    {\n        debug(cnt);\n        return (cnt == ((n + m - 1) - cnt));\n    }\n\n    visi[i][j] = true;\n    int dir[5] = {0, 1, 0, -1, 0};\n\n    for (int k = 0; k < 4; k++)\n    {\n        int new_i = i + dir[k];\n        int new_j = j + dir[k + 1];\n\n        if (new_i >= 0 and new_i < n and new_j >= 0 and new_j < m and !visi[new_i][new_j])\n        {\n            int p = (mtx[new_i][new_j] == 1) ? 1 : 0;\n            if (dfs(new_i, new_j, cnt + p, n, m, visi, mtx))\n            {\n                return true;\n            }\n        }\n    }\n\n    return false;\n}\n\nbool isSmaller(string str1, string str2)\n{\n    int n1 = str1.length(), n2 = str2.length();\n\n    if (n1 < n2)\n        return true;\n    if (n2 < n1)\n        return false;\n\n    for (int i = 0; i < n1; i++)\n        if (str1[i] < str2[i])\n            return true;\n        else if (str1[i] > str2[i])\n            return false;\n\n    return false;\n}\n\nstring findDiff(string str1, string str2)\n{\n    if (isSmaller(str1, str2))\n        swap(str1, str2);\n\n    string str = \"\";\n\n    int n1 = str1.length(), n2 = str2.length();\n\n    reverse(str1.begin(), str1.end());\n    reverse(str2.begin(), str2.end());\n\n    int carry = 0;\n\n    for (int i = 0; i < n2; i++)\n    {\n\n        int sub = ((str1[i] - '0') - (str2[i] - '0') - carry);\n\n        if (sub < 0)\n        {\n            sub = sub + 10;\n            carry = 1;\n        }\n        else\n            carry = 0;\n\n        str.push_back(sub + '0');\n    }\n\n    for (int i = n2; i < n1; i++)\n    {\n        int sub = ((str1[i] - '0') - carry);\n\n        if (sub < 0)\n        {\n            sub = sub + 10;\n            carry = 1;\n        }\n        else\n            carry = 0;\n\n        str.push_back(sub + '0');\n    }\n    reverse(str.begin(), str.end());\n\n    return str;\n}\n\nll ans = 0;\n\nll dfs(int src, vector<vector<int>> &v, vector<vector<int>> &adj)\n{\n    ll sum = 0;\n\n    for (auto it : adj[src])\n    {\n        sum += (dfs(it, v, adj));\n    }\n\n    if (sum < (ll)v[src][0])\n    {\n        ans++;\n        return v[src][1] * 1ll;\n    }\n\n    return min(v[src][1] * 1ll, sum);\n}\n\nvector<int> subtree;\nbool visi[100005];\nvoid dfs(int src, vector<vector<ll>> &adj)\n{\n    visi[src] = 1;\n    // debug(src);\n    for (auto it : adj[src])\n    {\n        // debug(it);\n        if (!visi[it])\n        {\n            dfs(it, adj);\n            subtree[src] += subtree[it];\n            // debug(subtree);\n        }\n    }\n\n    if ((int)adj[src].size() == 0)\n    {\n        // debug(subtree);\n        subtree[src] = 1;\n    }\n}\n\nvoid update(vector<ll> &fenwick, ll i, ll val)\n{\n    while (i < (int)fenwick.size())\n    {\n        fenwick[i] += val;\n        i += (i & (-i));\n    }\n}\nll sum(vector<ll> &fenwick, ll i)\n{\n    ll sm = 0;\n    while (i > 0)\n    {\n        sm += (fenwick[i]);\n        i -= (i & (-i));\n    }\n    return sm;\n}\nll count_primes(ll a)\n{\n    ll cnt = 0;\n    while ((a % 2) == 0)\n    {\n        cnt += 1;\n        a /= 2;\n    }\n    for (int i = 3; i * i <= n; i += 2)\n    {\n        while ((a % i) == 0)\n        {\n            a /= i;\n            cnt += 1;\n        }\n    }\n    if (a > 1)\n    {\n        cnt += 1;\n    }\n    return cnt;\n}\nll high_prime_factor(ll n)\n{\n    ll ans = 1;\n    for (ll i = 1; i * i <= n; i += 1)\n    {\n        if (prime[i])\n        {\n            if (n % i == 0)\n            {\n                ans = max({ans, i, n / i});\n            }\n        }\n    }\n\n    return ans;\n}\n// class segment_tree\n//{\n// public:\n//     // lo,hi-->arrray ka hota h\n//     vli arr, segtree;\n//     segment_tree(vli &v)\n//     {\n//         int n = v.size();\n//         arr.resize(n);\n//         for (int i = 0; i < n; i++)\n//         {\n//             arr[i] = v[i];\n//         }\n//         segtree.resize(4 * n);\n//         for (int i = 0; i < 4 * n; i++)\n//         {\n//             segtree[i] = 0;\n//         }\n//         build(0, 0, n - 1);\n//     }\n//     void build(int indx, int lo, int hi)\n//     {\n//         if (lo == hi)\n//         {\n//             segtree[indx] = arr[lo];\n//             return;\n//         }\n//\n//         int mid = lo + (hi - lo) / 2;\n//\n//         build(2 * indx + 1, lo, mid);\n//         build(2 * indx + 2, mid + 1, hi);\n//\n//         segtree[indx] = max(segtree[2 * indx + 1], segtree[2 * indx + 2]);\n//     }\n//     void update(int indx, int lo, int hi, int i, int val)\n//     {\n//         if (lo == hi)\n//         {\n//             arr[i] = val;\n//             segtree[indx] = val;\n//         }\n//         int mid = lo + (hi - lo) / 2;\n//         if (i <= mid)\n//         {\n//             update(2 * indx + 1, lo, mid, i, val);\n//         }\n//         else\n//         {\n//             update(2 * indx + 2, mid + 1, hi, i, val);\n//         }\n//\n//         segtree[indx] = max(segtree[2 * indx + 1], segtree[2 * indx + 2]);\n//     }\n//     int range(int indx, int lo, int hi, int l, int r)\n//     {\n//         if (lo >= l and hi <= r)\n//         {\n//             return segtree[indx];\n//         }\n//         if (l > hi or r < lo)\n//         {\n//             return INT_MIN;\n//         }\n//         int mid = lo + (hi - lo) / 2;\n//\n//         int left = range(2 * indx + 1, lo, mid, l, r);\n//         int right = range(2 * indx + 2, mid + 1, hi, l, r);\n//\n//         return max(left, right);\n//     }\n// };\n\nvector<vector<int>> dir = {{1, 2}, {2, 1}, {2, -1}, {1, -2}, {-1, -2}, {-2, -1}, {-2, 1}, {-1, 2}};\nvector<vector<int>> vvv;\nbool isvalid(int i, int j, vector<vector<int>> &visi)\n{\n    if (i >= 0 and i < (visi.size()) and j >= 0 and j < (visi.size()) and (visi[i][j] == 0))\n    {\n        return true;\n    }\n    return false;\n}\nbool check(vector<vector<int>> &visi)\n{\n\n    for (int i = 0; i < visi.size(); i++)\n    {\n        for (int j = 0; j < visi.size(); j++)\n        {\n            if (visi[i][j] == 0)\n            {\n                return false;\n            }\n        }\n    }\n\n    return true;\n}\nvoid recur(int i, int j, int cnt, vector<vector<int>> &visi, vector<vector<int>> &matx)\n{\n    if (cnt == 64)\n    {\n        cout << \"her\"\n             << \"\\n\";\n        return;\n    }\n\n    for (int k = 0; k < 8; k++)\n    {\n        int new_x = i + dir[k][0];\n        int new_y = j + dir[k][1];\n        if (isvalid(new_x, new_y, visi))\n        {\n            // cout<<new_x<<\" \"<<new_y<<\"\\n\";\n            visi[new_x][new_y] = 1;\n            matx[new_x][new_y] = cnt;\n            cnt += 1;\n            recur(new_x, new_y, cnt + 1, visi, matx);\n            cnt -= 1;\n            visi[new_x][new_y] = 0;\n            matx[new_x][new_y] = -1;\n        }\n    }\n    return;\n}\n\nvector<int> prices;\nint mm = 0;\nstack<int> stk;\nint calc(int val)\n{\n    prices.push_back(val);\n\n    while (!stk.empty() and prices[stk.top()] <= prices[m])\n    {\n        stk.pop();\n    }\n\n    if (!stk.empty())\n    {\n        ans = mm + 1;\n    }\n    else\n    {\n        ans = mm - stk.top();\n    }\n\n    stk.push(val);\n\n    mm++;\n\n    return ans;\n}\nbool check(ll n,ll d)\n{\n    ll cnt=0;\n\n    if((d&1)==1)\n    {\n        cnt+=(d/2);\n    }\n    else\n    {\n        cnt+=(d/2);\n        cnt-=1;\n    }\n\n    cnt+=(d/4);\n\n    cnt-=1;\n\n\n    return cnt>=n;\n}\nvoid solve()\n{\n    ll n;\n    cin>>n;\n\n    ll ans=-1;\n    ll lo=0,hi=1e15;\n    while(lo<=hi)\n    {\n        ll mid=lo+(hi-lo)/2;\n\n        if(check(n,mid))\n        {\n            ans=mid;\n            hi=mid-1;\n        }\n        else\n        {\n            lo=mid+1;\n        }\n    }\n\n    cout<<ans<<\"\\n\";\n}\n\nint main()\n{\n\n#ifndef ONLINE_JUDGE\n    freopen(\"input.txt\", \"r\", stdin);\n    freopen(\"output.txt\", \"w\", stdout);\n#endif\n    cout.precision(12);\n    // FIO\n    // freopen(\"input.txt\", \"r\", stdin);\n    // freopen(\"output.txt\", \"w\", stdout);\n    // get_no_of_prime_divisors(prime_divisors_till, maxn);\n    ios::sync_with_stdio(false);\n    cin.tie(NULL); // Remove in problems with online queries!\n    //ll t;\n    // scanf(\"%lld\", &t);\n     t = 1;\n    cin >> t;\n    // vector<ll> val((int)1e6+7,0);\n    // prime.resize(1000005, true);\n    // seive(1000005);\n\n    for (int i = 1; i <= t; i++)\n    {\n        solve();\n    }\n\n    return 0;\n}\n// std::fill(vec.begin(),vec.end(),1)\n// dp me chote se bda leke jana h..\n// An array d is a subarray of an array c if d can be obtained from c by deletion of\n// several (possibly, zero or all)\n// elements from the beginning and several (possibly, zero or all) elements from the end.", "lang": "GNU C++17", "bug_code_uid": "0a4fc04b46715b22365d5ef55f6b6c38", "src_uid": "d0a8604b78ba19ab769fd1ec90a72e4e", "apr_id": "ea14970d89c9101c5509086687a4ce8b", "difficulty": 1500, "tags": ["geometry", "math", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9979633401221996, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <iostream>\r\n#include <vector>\r\n#include <algorithm>\r\n#include <string>\r\n#include <cmath>\r\n#include <set>\r\n#include <unordered_set>\r\n#include <map>\r\n#include <unordered_map>\r\n\r\nint main() {\r\n    long long n; std::cin >> n;\r\n    long long x = 4 * (n - 1) + 8;\r\n    if (x == 1) {\r\n        std::cout << 3 << '\\n';\r\n        return 0;\r\n    }\r\n    if (x % 3 == 0) {\r\n        std::cout << x / 3  + 1 << '\\n';\r\n    } else {\r\n        std::cout << x / 3 + 2 << '\\n';\r\n    }\r\n    return 0;\r\n}\r\n", "lang": "GNU C++17", "bug_code_uid": "2fae81ef9b9f1feb5f9dc2f61d203b6a", "src_uid": "d0a8604b78ba19ab769fd1ec90a72e4e", "apr_id": "92bded730481d2e3fecb6b5f22c7cb41", "difficulty": 1500, "tags": ["geometry", "math", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9792099792099792, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include<bits/stdc++.h>\r\nusing namespace std;\r\n\r\nlong long k,l=3,r=2000000000;\r\nbool st;\r\n\r\nint count(int x){\r\n    int res=0;\r\n    res+=(x&1?(x+1)/2-1:x/2-1);\r\n    res+=x/4-1;\r\n    if(x&1||(x!=4&&x%4==0)) st=true;\r\n    return res;\r\n}\r\n\r\nint main(){\r\n    cin>>k;\r\n    while(r>l){\r\n        int mid=(l+r)/2;\r\n        st=false;\r\n        int lev=count(mid);\r\n        if(lev<k) l=mid+1;\r\n        else if(lev==k&&st) break; \r\n        else r=mid-1;\r\n    }\r\n    cout<<(l+r)/2<<endl;\r\n}", "lang": "GNU C++14", "bug_code_uid": "42ef2a7ddd3e8e679825d136860762e3", "src_uid": "d0a8604b78ba19ab769fd1ec90a72e4e", "apr_id": "7142b0f4921d52ada8299f00587d7687", "difficulty": 1500, "tags": ["geometry", "math", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6814814814814815, "equal_cnt": 12, "replace_cnt": 4, "delete_cnt": 4, "insert_cnt": 4, "fix_ops_cnt": 12, "bug_source_code": "#include <iostream>\r\n\r\nusing namespace std;\r\nlong long n;\r\nint main()\r\n{\r\n    cin>>n;\r\n    cout<<(n*2)+1;\r\n}\r\n", "lang": "GNU C++14", "bug_code_uid": "6fef506c6e789612a472f251e4e25bcf", "src_uid": "d0a8604b78ba19ab769fd1ec90a72e4e", "apr_id": "6caa87a778c127418c3ed09502e5555e", "difficulty": 1500, "tags": ["geometry", "math", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9944289693593314, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <iostream>\r\nusnig namespace std;\r\n\r\nint main() {\r\n    int n;\r\n    cin >> n;\r\n    if (n == 1) {\r\n        cout << 3;\r\n    } else if (n == 2) {\r\n        cout << 5;\r\n    } else {\r\n        cout << (n - 3) / 3 + (n - 3)  + 7;\r\n    }\r\n    return 0;\r\n}\r\n\r\n//1 2 3 4 5  6  7  8  9 10 11 12 13 14 15 16 17 18\r\n//3 5 7 8 9 11 12 13 15 16 17 19 20 21 23 24 25 27", "lang": "GNU C++14", "bug_code_uid": "cd384d296f70e7d6ba098a30729ba6d0", "src_uid": "d0a8604b78ba19ab769fd1ec90a72e4e", "apr_id": "00036f46955bdd49937f976ca0b2bfa1", "difficulty": 1500, "tags": ["geometry", "math", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9207161125319693, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include<iostream>\r\n#include<algorithm>\r\n#include<vector>\r\n#include<map>\r\n#include<math.h>\r\nusing namespace std;\r\n\r\n int main()\r\n{\r\n    \r\n        int a,b,c,d;      cin>>a;\r\n        int sum=0;\r\n        if(a%3==0)      sum=2;\r\n        if(a%3==1)      sum=1;\r\n        if(a%3==2)      sum=0;\r\n\r\n        b=a/3;  c=a-b-1;  d=c*2+3;\r\n        cout<<d+sum<<\"\\n\";\r\n}\r\n\r\n", "lang": "GNU C++14", "bug_code_uid": "a6a2005bea1a478772754219da27e077", "src_uid": "d0a8604b78ba19ab769fd1ec90a72e4e", "apr_id": "644107aec2c08ad5ee2fceb104511d41", "difficulty": 1500, "tags": ["geometry", "math", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9846153846153847, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "#inculde <iostream>\r\nusing namespace std;\r\ntypedef unsigned long long ull;\r\null suitable(ull n)\r\n{\r\n    if(n==1) return 3;\r\n    return n/3 * 4 + n%3 +3;\r\n}\r\nint main()\r\n{\r\n    ull n;\r\n    scanf(\"%llu\", &n);\r\n    printf(\"%llu\", suitable(n));\r\n    return 0;\r\n}", "lang": "MS C++ 2017", "bug_code_uid": "a646e3fcb3fba84b0ae2eec25f79d12f", "src_uid": "d0a8604b78ba19ab769fd1ec90a72e4e", "apr_id": "1a98bfa4229ba0ef7cded232b39e4be9", "difficulty": 1500, "tags": ["geometry", "math", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.732017823042648, "equal_cnt": 11, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "#include<bits/stdc++.h>\r\nusing namespace std;\r\nint n;\r\nfloat P;\r\nbool is(int k){\r\n\tfloat ans;\r\n\tif(k == 1){\r\n\t\tans = 1.0/n;\r\n\t}\r\n\telse{\r\n\t\tint t = (n-k);\r\n\t\tfloat temp = 1.0*(n-k)*(n-k - 1)/4 + 1.0*(n - k)*(n -k - 1)*(n - k -2)/6;\r\n\t\ttemp = (6.0*temp)/(n*(n-1)*(n-2));\r\n\t\tans = 1.0 - temp;\r\n\t}\r\n\t//cout << k << \" \" << ans << \"\\n\";\r\n\tif(ans >= P)\r\n\t\treturn true;\r\n\telse \r\n\t\treturn false;\r\n}\r\nvoid solve(){\r\n\tcout << setprecision(10);\r\n\tcin >> n;\r\n\tcin >> P;\r\n\tint l = 1,r = n;\r\n\twhile(l < r){\r\n\t\tint mid = (l + r)/2;\r\n\t\t//cout << l << \" \" << mid << \" \" << r << \"\\n\";\r\n\t\tif(is(mid)){\r\n\t\t\tr = mid;\r\n\t\t}\r\n\t\telse \r\n\t\t\tl = mid + 1;\r\n\t}\r\n\tcout << l << \"\\n\";\r\n}\r\nsigned main(){\r\n\tiostream::sync_with_stdio(false);cin.tie(NULL);\r\n\t//int TTT = 1;\r\n\tcin >> TTT;\r\n\twhile(TTT--){\r\n\t\tsolve();\r\n\t}\r\n}\r\n", "lang": "GNU C++17", "bug_code_uid": "5e643cbe5f5657091708e7d8476db717", "src_uid": "788ed59a964264bd0e755e155a37e14d", "apr_id": "7142aa33c4f8b213de1d0ffb06352b9a", "difficulty": 2000, "tags": ["probabilities", "math", "combinatorics", "ternary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.2893081761006289, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "#include <bits/stdc++.h>\r\nusing namespace std;\r\n \r\nlong long n;\r\ndouble p;\r\n\r\nint fuck() {\r\n    if (p == 0) return 0;\r\n    for (long long m = 2; m <= n; ++m) {\r\n            return m;\r\n        }\r\n    }\r\n}\r\n \r\nint main() {\r\n    cin >> n >> p;\r\n    cout << fuck() << endl;\r\n}", "lang": "GNU C++14", "bug_code_uid": "7421eeb78c9c75d98ebe898b5a2dbea7", "src_uid": "788ed59a964264bd0e755e155a37e14d", "apr_id": "64d9d85b46dc4c9fe721b083981a7320", "difficulty": 2000, "tags": ["probabilities", "math", "combinatorics", "ternary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9975550122249389, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include<bits/stdc++.h>\r\nusing namespace std;\r\ndouble C3(double n)\r\n{\r\n\treturn 1.0*(n*(n-1)*(n-2))/6.0;\r\n}\r\ndouble C2(double n)\r\n{\r\n\treturn 1.0*(n*(n-1))/2.0;\r\n}\r\nint main()\r\n{\r\n\tdouble n,p;\r\n\tscanf(\"%lf%lf\",&n,&P);\r\n\tfor(int i=0;i<=n;i++)\r\n\t{\r\n\t\tdouble x=i;\r\n\t\tdouble p1=(C3(x)+C2(x)*(n-x)+((x*C2(n-x))/2))/(C3(n));\r\n\t//\tcout<<\"p1=\"<<p1<<endl;\r\n\t\tif(p1>=p)\r\n\t\t{\r\n\t\t\tcout<<i<<endl;\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t}\r\n}\r\n", "lang": "GNU C++14", "bug_code_uid": "d36ac87b3d0a33ca0b1cca96b1bc6410", "src_uid": "788ed59a964264bd0e755e155a37e14d", "apr_id": "fe3895a713e895e67d97c588ee6c430b", "difficulty": 2000, "tags": ["probabilities", "math", "combinatorics", "ternary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9940688018979834, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include<algorithm>\r\n#include<iostream>\r\nusing namespace std;\r\n#define int long long\r\nconst int N=2e5+10;\r\nlong long double c2(int n) {\r\n\treturn n * (n - 1) / 2.0;\r\n}\r\n\r\nlong double c3(int n) {\r\n\treturn n * (n - 1) * (n - 2) / 6.0;\r\n}\r\nint n;\r\nlong double p;\r\nsigned main(){\r\n\tcin>>n>>p;\r\n\tfor(int i=0;i<n;i++){\r\n\t\tif((c3(i)+c2(i)*(n-i)+i*c2(n-i)/2.0)/(c3(n))>=p){\r\n\t\t\tcout<<i<<endl;\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t}\r\n    return 0;\r\n}", "lang": "GNU C++14", "bug_code_uid": "919dfff5a5612f4d8fd707f36d03092e", "src_uid": "788ed59a964264bd0e755e155a37e14d", "apr_id": "64ddb93c6885db3acd81befd314e64cc", "difficulty": 2000, "tags": ["probabilities", "math", "combinatorics", "ternary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.07849172758753367, "equal_cnt": 13, "replace_cnt": 6, "delete_cnt": 5, "insert_cnt": 2, "fix_ops_cnt": 13, "bug_source_code": "#include <bits/stdc++.h>\r\nusing namespace std;\r\n\r\nconst int maxn = 1010, sigma_size = 20;\r\nint f[1 << sigma_size];\r\nunordered_map<int, tuple<int, int, int>> dp[maxn];\r\nint cnt[maxn][sigma_size];\r\nchar s[maxn];\r\n\r\nint main() {\r\n    int n;\r\n    scanf(\"%d\", &n);\r\n    scanf(\"%s\", s + 1);\r\n    int st = 0, tot = 0;\r\n    f[0] = n + 1;\r\n    for (int i = n; i; i--)\r\n        if (!((st >> (s[i] - 'a')) & 1))\r\n        {\r\n            st |= 1 << (s[i] - 'a'), tot++;\r\n            for (int j = 0; j < 1 << sigma_size; j++)\r\n                if (!f[j] && ((j & st) == j))\r\n                    f[j] = i;\r\n        }\r\n    for (int i = 0; i < st; i++)\r\n        if (f[i])\r\n            printf(\"f[%d] = %d\\n\", i, f[i]);\r\n    for (int i = 1; i <= n; i++)\r\n        for (int j = 0; j < sigma_size; j++) cnt[i][j] = cnt[i - 1][j] + (s[i] - 'a' == j);\r\n    int nxt, val;\r\n    dp[0][0] = make_tuple(0, 0, 0);\r\n    for (int i = 0; i <= n; i++)\r\n        for (auto j : dp[i]) {\r\n            for (int k = 0; k < sigma_size; k++)\r\n                if (((st >> k) & 1) && !((j.first >> k) & 1)) {\r\n                    nxt = j.first << k, val = cnt[f[st ^ nxt] - 1][k] - cnt[i][k];\r\n                    if (!dp[f[st ^ nxt]].contains(nxt) || get<2>(dp[f[st ^ nxt]][nxt]) < val)\r\n                        dp[f[st ^ nxt]][nxt] = make_tuple(i, j.first, val);\r\n                }\r\n        }\r\n    int cur;\r\n    string ans = \"\", tmp;\r\n    for (int i = 1; i <= n; i++)\r\n        if (dp[i].contains(st)) {\r\n            auto u = dp[i][st];\r\n            tmp.clear(), cur = tot - 1;\r\n            while (get<2>(u)) {\r\n                for (int j = 1; j <= get<2>(u); j++) tmp.push_back(cur + 'a');\r\n                cur--, u = dp[get<0>(u)][get<1>(u)];\r\n            }\r\n            if (ans < tmp)\r\n                ans = tmp;\r\n        }\r\n    cout << ans << endl;\r\n    return 0;\r\n}", "lang": "GNU C++14", "bug_code_uid": "1342b87b519b2755c1e81d975628b026", "src_uid": "788ed59a964264bd0e755e155a37e14d", "apr_id": "d9e3640d36964cae708aee714c2a6648", "difficulty": 2000, "tags": ["probabilities", "math", "combinatorics", "ternary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9593984962406015, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 4, "bug_source_code": "#include <bits/stdc++.h>\r\n#define int long long\r\nusing namespace std;\r\n\r\nmain()\r\n{\r\n\tios::sync_with_stdio(0); cin.tie(0);\r\n\tstring s; cin>>s;\r\n\tbool f = true;\r\n\tfor (int i = 0; i < s.size() - 2; i++) {\r\n\t\tif(s[i] + s[i + 1] - 'A' - 'A' != s[i + 2] - 'A') f = false;\r\n\t}\r\n\tif (f) cout<<\"YES\\n\";\r\n\telse cout<<\"NO\\n\";\r\n}\r\n", "lang": "GNU C++17", "bug_code_uid": "542414f009e92e2acd58cbf005779109", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "88eecd90e3bde526fca41492a3f1f646", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9807692307692307, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include <iostream>\nusing namespace std;\nint main() {\n    string s;\n    cin >> s;\n    int ar[s.size()];\n    for (int i = 0; i < s.length(); i++) {\n        ar[i] = (int)s[i] - 65;\n    }\n    bool lol = true;\n    for (int i = 2; i < s.length() - 2; i--) {\n        if ((ar[i - 2] + ar[i - 1]) % 26 != ar[i]) {\n            lol = false;\n            break;\n        }\n    }\n    if (lol) {\n        cout << \"YES\\n\";\n    }\n    else {\n        cout << \"NO\\n\";\n    }\n    return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "28c51429c81119003041ffbd301a14d5", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "750704f838055f8345fb1b28c15e9dfb", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8972375690607735, "equal_cnt": 13, "replace_cnt": 5, "delete_cnt": 5, "insert_cnt": 3, "fix_ops_cnt": 13, "bug_source_code": "#include <bits/stdc++.h>\r\nusing namespace std;\r\n#define int long long\r\nint32_t main() {\r\n    ios_base::sync_with_stdio(false);\r\n    cin.tie(NULL);\r\n    cout.tie(NULL);\r\n    int f=0;\r\n    string s;\r\n    cin>>s;\r\n    for(int i=0;i<s.length()-2;i++)\r\n    {\r\n        if((((s[i]-'A')+(s[i+1]-'A')+2)%27)!=((s[i+2]-'A'+2)))\r\n        {\r\n            f=1;\r\n            break;\r\n        }\r\n    }\r\n    if(f)cout<<\"NO\"<<endl;\r\n    else cout<<\"YES\"<<endl;\r\n\treturn 0;\r\n}\r\n", "lang": "GNU C++17", "bug_code_uid": "9e29c21d98e1cb9383dba8da5da7f160", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "18c780bb12964e1a63865f96942dfec6", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.973384030418251, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "#include<iostream>\r\n#include<string>\r\nusing namespace std;\r\nint main() \r\n{\r\n    string a;\r\n    int i, x,y,z,h;\r\n    cin.getline(a);\r\n    bool flag=true;\r\n    for(i=2;i<a.length();i++)\r\n    {\r\n        y=a.at(i-1);\r\n        z=a.at(i-2);\r\n        h=a.at(i);\r\n        x=y+z;\r\n        if(x>26)\r\n        x=x-26;\r\n        if(x==h)\r\n        {\r\n            continue;\r\n        }\r\n        else\r\n        {\r\n            flag=false;\r\n            break;\r\n        }\r\n    }\r\n    if(flag==true)\r\n    cout<<\"YES\";\r\n    else\r\n    cout<<\"NO\";\r\n}", "lang": "GNU C++17", "bug_code_uid": "e51e5c510a6aba8f4d592793540865a9", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "e4980c60f6ed3436c0386f54a702aaa1", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9981060606060606, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include<iostream>\r\n#include<string>\r\nusing namespace std;\r\nint main() \r\n{\r\n    string a;\r\n    int i, x,y,z,h;\r\n    cin>>a;\r\n    bool flag=true;\r\n    for(i=2;i<a.length();i++)\r\n    {\r\n        y=a.at(i-1) -65;\r\n        z=a.at(i-2) -65;\r\n        h=a.at(i) -65;\r\n        x=y+z;\r\n        if(x>25)\r\n        x=x-25;\r\n        if(x==h)\r\n        {\r\n            continue;\r\n        }\r\n        else\r\n        {\r\n            flag=false;\r\n            break;\r\n        }\r\n    }\r\n    if(flag==true)\r\n    cout<<\"YES\";\r\n    else\r\n    cout<<\"NO\";\r\n}", "lang": "GNU C++17", "bug_code_uid": "91fe320c38a017bc4e3caeffdb5d047d", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "e4980c60f6ed3436c0386f54a702aaa1", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9990243902439024, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include<bits/stdc++.h>\r\nusing namespace std;\r\n#define fast ios_base ::sync_with_stdio(0); cin.tie(0); cout.tie(0);\r\n#define   fi(a,b) for(int i=a;i<b;i++)\r\n#define   fj(a,b) for(int j=a;j<b;j++)\r\n#define   ff first\r\n#define   ss second\r\n#define   ll long long\r\n#define   ld long double\r\n#define   ull unsigned long long\r\n#define   bp(x) __builtin_popcount(x)\r\n#define   pr(x) for(auto it: x) cout<<it<<\" \"; cout<<endl;\r\n#define   getMax(x) max_element(x.begin(),x.end())\r\n#define   getMin(x) min_element(x.begin(),x.end())\r\n#define   end \"\\n\"\r\ntypedef   vector<int> vi;\r\ntypedef   vector< pair<int,int> > vii;\r\ntypedef   vector<long long> vl;\r\ntypedef   pair<int,int> pii;\r\ntypedef   pair<ll,ll> pll;\r\ntypedef   vector< pair<ll,ll> > vll;\r\n//int dx[]={1,0,-1,0};\r\n//int dy[]={0,1,0,-1};\r\n//int dx[]={-1,0,1,1,1,0,-1,-1};\r\n//int dy[]={-1,-1,-1,0,1,1,1,0};\r\nmap<int,int>mp;\r\nll gcd(ll a, ll b) { \r\n    if(a<b) swap(a, b);\r\n    if (b == 0) \r\n        return a; \r\n    return gcd(b, a % b);      \r\n} \r\n\r\nll lcm(ll a, ll b){\r\n    return (a*b)/gcd(a, b);\r\n}\r\n\r\n void solve()\r\n{\r\n   string str;\r\n   cin>>str;\r\n   int flag=1;\r\n   for(int i=2;i<str.size();i++)\r\n   {\r\n       int a = str[i-1] - 'A', b = str[i-2] - 'A';\r\n       if(str[i]-'A'!=(a+b))\r\n       {\r\n           flag=0;\r\n           break;\r\n       }\r\n\r\n   }\r\n   if(flag==1) cout<<\"YES\";\r\n   else cout<<\"NO\";\r\n}\r\n\r\nint main(){\r\n    #ifndef ONLINE_JUDGE\r\n    freopen(\"input.txt\", \"r\", stdin);\r\n    freopen(\"output.txt\", \"w\", stdout);\r\n    #endif\r\n    fast;\r\n    solve();\r\n    return 0;\r\n}\r\n", "lang": "GNU C++17", "bug_code_uid": "38bba406e5e0259a199a702908764132", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "ab6f639585d87de7e2de72e3185b4d60", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9688667496886675, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "#include<iostream>\r\nusing namespace std;\r\n\r\nint main()\r\n{\r\n\tstring s;\r\n\r\n\tcin>>s;\r\n\r\n\r\n\tif(s.length()<3)\r\n\t{\r\n\t\tcout<<\"NO\"<<endl;\r\n\t\treturn 0;\r\n\t}\r\n\r\n\tfor(int i=0;i<s.length();i++)printf(\"%d \",s[i]-'A');\r\n\r\n\t\tcout<<endl;\r\n\tfor(int i=2;i<s.length();i++)\r\n\t{\r\n\t\tint b = (s[i-2]+s[i-1]-2*'A')%26;\r\n\t\tint c = (s[i]-'A')%26;\r\n\r\n\t\tif(b!=c)\r\n\t\t{\r\n\t\t\tcout<<\"NO\"<<endl;\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t}\r\n\r\n\tcout<<\"YES\"<<endl;\r\n}", "lang": "GNU C++17", "bug_code_uid": "d3309a6723e76eee10808443c7219542", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "ca0fded06ecf0b0734282aa11ff89a9e", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.9863923938783444, "equal_cnt": 11, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "//Remember You used to think this was IMPOSSIBLE.\r\n/*\r\n                         __________\r\n        Bring Me Thanos /         /\r\n                       /_________/\r\n                           |  |\r\n                           |  |\r\n                           |  |\r\n                           |__|\r\n        Mamba Forever-\r\n                    o      |   __   |\r\n                      \\_ O |  |__|  |\r\n                   ____/ \\ |___WW___|\r\n                   __/   /     ||\r\n                               ||\r\n                               ||\r\n                _______________||________________\r\n            _____\r\n          ===///    , ,-. ,-   .-, , , ,-  ,_  ,  ,_ ,-\r\n          --///    /_ |_/ _)  /\"\"|/|/ |_] /=_ /_ /=_ _)\r\n        ___///    __    __  __  ______  ____    ___\r\n          ///  --/||  --// .'   //  \"/ _//  )) (|  \"/\r\n      ---///   /' ||  _//.;  __//_.    //_=\"'  _\\\\\r\n      --///- -/---||  //'||   //  ', _//  ;|     \\\\     ;\r\n ______/// __/_  _||_/<  `||_//__\"/ _// --|\\ /-._//    /\r\n     _///      ,                        ---\\\\\\       .'\r\n  ___///_____\"/                              `;=__.-'\r\n \r\n \r\n \r\n        Steph Curry-\r\n \r\n                 /|   o         o\r\n                 \\|=--            o\r\n                    ##\r\n                                    \\\\\r\n                                 /   \\O\r\n                                O_/   T\r\n                                T    /|\r\n                                |\\  | |\r\n                 _______________|_|________\r\n \r\n        Ironman 2025\r\n                         __o      __o      o         __o        ,__o      o__,\r\n             __ -_     _ \\<_     -\\<,    _/\\_>     _`\\<,_     _-\\_<,      ,>_/-_\r\n        ((( (_)T(_)   (_)/(_)   O / O   O,> / O   (*)/ (*)   (*)/'(*)    (*)`\\(*)\r\n                                        ___\r\n                                       /___\\\r\n                                   .-.|=0-0=|.-.\r\n                              (\\_.'.-\\ \\_o_/`/-.'._/)\r\n                          ~` - ~`-^_`~ -_~ ^- ~_` -~ _\r\n                            -  ~  -  ^   - ~ -  ~  -\r\n                                        ,////,\r\n                                        /// 6|\r\n                                        //  _|\r\n                                       _/_,-'\r\n                                  _.-/'/   \\   ,/;,\r\n                               ,-' /'  \\_   \\ / _/\r\n                               `\\ /     _/\\  ` /\r\n                                 |     /,  `\\_/\r\n                                 |     \\'\r\n                     /\\_        /`      /\\\r\n                   /' /_``--.__/\\  `,. /  \\\r\n                  |_/`  `-._     `\\/  `\\   `.\r\n                            `-.__/'     `\\   |\r\n                                          `\\  \\\r\n                                            `\\ \\\r\n                                              \\_\\__\r\n                                               \\___)\r\n \r\n \r\n NO MATTER HOW HARD YOU WORK, I AM WILLING TO WORK HARDER THAN YOU............\r\n \r\n */\r\n \r\n#include<iostream>\r\n#include<vector>\r\n#include<map>\r\n#include<set>\r\n#include<stack>\r\n#include<algorithm>\r\n#include<math.h>\r\n#include<time.h>\r\n#include<queue>\r\n#include<numeric>\r\n#include<unordered_map>\r\n\r\n#include<stdio.h>\r\n#include<stack>\r\n#include<string>\r\n#include<stdio.h>\r\n#include<utility>\r\n#include<iomanip>\r\n#include<sstream>\r\n#include<deque>\r\n#include<initializer_list>\r\n#include<unordered_set>\r\n#include<list>\r\n//#include<bits/stdc++.h>\r\n#define MAX 50\r\n#define ll long long\r\n#define fr(i,a,b) for(ll i = a;i<b;i++)\r\n#define pie 3.14159265358979\r\n#define pb push_back\r\n#define mp make_pair\r\n#define fri(i,a,b) for(ll i = a;i>=b;i--)\r\n#define pqll priority_queue<ll,vector<ll>,greater<ll>>\r\n#define pq priority_queue<ll>\r\n#define pr pair<ll,ll>\r\n#define prr pair<ll,pr>\r\n#define f first\r\n#define s second\r\n#define pqr priority_queue<pair<ll,ll>>\r\n#define st stack\r\n#define out(a) cout<<a<<\"\\n\"\r\n#define in(a) cin>>a\r\n#define loop() for(;;)\r\n#define frx(x,s) for(auto x: s)\r\n#define read(v,n) for(int i = 0; i<n ; i++){cin>>v[i];}\r\n#define read1(v,n) for(int i = 1; i<n ; i++){cin>>v[i];}\r\n#define sortvec(ouas) sort(ouas.begin(),ouas.end())\r\n#define outvec(v) for(int i = 0;i<v.size();i++){cout<<v[i]<<\" \";}\r\n#define sumvec(v,c) for(int i = 0;i<v.size();i++){c += v[i];}\r\n#define sumarr(v,s) for(int i =1;i<v.size();i++){s[i] += s[i-1] + v[i];}\r\n#define ld long double\r\n#define pi 3.1415926536\r\n#define div 1000003\r\nusing namespace std;\r\n//ll ans(vector<ll> ouas,ll n){\r\n//\r\n//}\r\n//ll t[1001][1001];\r\nclass graph{\r\nprivate:\r\n    int V;\r\n    list<int> *adjlist;\r\npublic:\r\n    graph(int v){\r\n        V = v;\r\n        adjlist = new list<int>[V];\r\n    }\r\n    void addedge(int u,int v,bool bidric){\r\n        adjlist[u].pb(v);\r\n        if(bidric){\r\n            adjlist[v].pb(u);\r\n        }\r\n    }\r\n    void print(){\r\n        for(int i =0;i<V;i++){\r\n            cout<<i<<\"->\"<<\" \";\r\n            for(int node: adjlist[i]){\r\n                cout<<node<<\", \";\r\n            }\r\n            cout<<\"\\n\";\r\n        }\r\n    }\r\n    void bfs(int src,int temp){\r\n        queue<int> q;\r\n        bool v[10000] = {0};\r\n        int dist[10000] = {0};\r\n        int parent[10000];\r\n        fr(i,0,10000){\r\n            parent[i] = -1;\r\n        }\r\n        \r\n        q.push(src);\r\n        v[src] = true;\r\n        while(!q.empty()){\r\n            int node = q.front();\r\n            q.pop();\r\n            cout<<node<<\" \";\r\n            for(int n: adjlist[node]){\r\n                if(v[n] == 0){\r\n                    v[n] = 1;\r\n                    q.push(n);\r\n                    dist[n] = dist[node] + 1;\r\n                    parent[n] = node;\r\n                }\r\n            }\r\n        }\r\n        cout<<\"\\n\";\r\n        cout<<dist[temp]<<\" \\n\";\r\n        while(temp!=-1){\r\n            cout<<temp<<\" \";\r\n            temp = parent[temp];\r\n        }\r\n    }\r\n    void depe(){\r\n        ll count =0;\r\n        for(int i =0;i<V;i++){\r\n            count += adjlist[i].size();\r\n            cout<<adjlist[i].size()<<\" \";\r\n        }\r\n        cout<<count<<\"\\n\";\r\n    }\r\n};\r\n\r\nclass tree{\r\nprivate:\r\n    ll val;//value of that node\r\n    tree *left,*right;//pointer of class type de\r\n    //left right , n childs\r\npublic:\r\n    \r\n    tree(ll val){\r\n        this->val = val;\r\n        this->left = this->right = NULL;\r\n    }\r\n    tree *insert(ll value, tree *root){\r\n        if(root == NULL)\r\n            return new tree(value);\r\n        if(value < root->val){\r\n            root->left = insert(value,root->left);\r\n        }\r\n        else{\r\n            root->right = insert(value,root->right);\r\n        }\r\n        return root;\r\n    }\r\n    void inorder(tree *root){\r\n        if(root == NULL){\r\n            return ;\r\n        }\r\n        inorder(root->left);\r\n        cout<<root->val<<\" \";\r\n        inorder(root->right);\r\n    }\r\n    void left_view(tree *root){\r\n        if(root == NULL){\r\n            return;\r\n        }\r\n        cout<<root->val<<\" \";\r\n        left_view(root->left);\r\n        //cout<<root->val<<\" \";\r\n    }\r\n    void right_view(tree *root){\r\n        if(root == NULL){\r\n            return;\r\n        }\r\n        cout<<root->val<<\" \";\r\n        right_view(root->right);\r\n        //cout<<root->val<<\" \";\r\n    }\r\n    void top_v(tree *root){\r\n        map<ll,ll> m;\r\n        queue<pair<tree *,ll>> q;\r\n        q.push({root,0});\r\n        while(!q.empty()){\r\n            auto temp = q.front();\r\n            q.pop();\r\n            ll hd = temp.second;\r\n            auto node = temp.first;\r\n            if(m.count(hd) == 0){\r\n                m[hd] = node->val;\r\n            }\r\n            if(node->left){\r\n                q.push({node->left,hd-1});\r\n            }\r\n            if(node->right){\r\n                q.push({node->right,hd+1});\r\n            }\r\n        }\r\n        for(auto x: m){\r\n            cout<<x.second<<\" \";\r\n        }\r\n    }\r\n    ll max_h(tree *root){\r\n        if(root == NULL)\r\n            return 0;\r\n        ll left = max_h(root->left);\r\n        ll right = max_h(root->right);\r\n        return 1+max(left,right);\r\n    }\r\n    tree *a_t_b(ll *a, ll s,ll e){\r\n        if(s > e)\r\n            return NULL;\r\n        ll mid = (s+e)/2;\r\n        tree *root = new tree(a[mid]);\r\n        root->left = a_t_b(a,s,mid-1);\r\n        root->right = a_t_b(a,mid+1,e);\r\n        return root;\r\n    }\r\n    \r\n};\r\n\r\nll countFreq(string &pat, string &txt)\r\n{\r\n    ll M = pat.length();\r\n    ll N = txt.length();\r\n    ll res = 0;\r\n    \r\n \r\n    for (ll i = 0; i <= N - M; i++)\r\n    {\r\n      \r\n        ll j;\r\n        for (j = 0; j < M; j++)\r\n            if (txt[i+j] != pat[j])\r\n                break;\r\n   \r\n        \r\n        if (j == M)\r\n        {\r\n           res++;\r\n           j = 0;\r\n        }\r\n    }\r\n    return res;\r\n}\r\nll count(string a, string b)\r\n{\r\n    ll m = a.length();\r\n    ll n = b.length();\r\n    ll lookup[m + 1][n + 1];\r\n    fr(i,0,m+1){\r\n        fr(j,0,n+1){\r\n            lookup[i][j] = 0;\r\n        }\r\n    }\r\n \r\n    for (int i = 0; i <= n; ++i)\r\n        lookup[0][i] = 0;\r\n    for(int i = 0; i <= m; ++i)\r\n        lookup[i][0] = 1;\r\n  \r\n    for(int i = 1; i <= m; i++)\r\n    {\r\n        for (int j = 1; j <= n; j++)\r\n        {\r\n            if (a[i - 1] == b[j - 1])\r\n                lookup[i][j] = lookup[i - 1][j - 1] +\r\n                               lookup[i - 1][j];\r\n                  \r\n            else\r\n                lookup[i][j] = lookup[i - 1][j];\r\n        }\r\n    }\r\n  \r\n    return lookup[m][n];\r\n}\r\n \r\n \r\nll fact(ll n){\r\n    ll ans = 1;\r\n    while(n!=1){\r\n        ans *= n;\r\n        n--;\r\n    }\r\n    return ans;\r\n}\r\nvoid lolutil(ll l , ll r, string s, set<string> *se){\r\n    if(l == r){\r\n        se->insert(s);\r\n    }\r\n    else{\r\n        fr(i,l,r+1){\r\n            swap(s[l],s[i]);\r\n            lolutil(l+1, r, s, se);\r\n            swap(s[i],s[l]);\r\n        }\r\n    }\r\n}\r\nset<string> lol(string s, ll n){\r\n    set<string> se;\r\n    lolutil(0,n-1,s,&se);\r\n    return se;\r\n}\r\nbool divideArray(vector<ll> arr, ll n)\r\n{\r\n    // sum stores sum of all elements of the array\r\n    int sum = 0;\r\n    for (int i = 0; i < n; i++)\r\n        sum += arr[i];\r\n  \r\n    // sum stores sum till previous index of the array\r\n    int sum_so_far = 0;\r\n  \r\n    for (int i = 0; i < n; i++)\r\n    {\r\n        // If on removing arr[i], we get equals left\r\n        // and right half\r\n        if (2 * sum_so_far + arr[i] == sum)\r\n        {\r\n            \r\n            \r\n  \r\n            return true;\r\n        }\r\n        // add current element to sum_so_far\r\n        sum_so_far += arr[i];\r\n    }\r\n  \r\n    // The array cannot be divided\r\n    \r\n  \r\n    return false;\r\n}\r\nll dp[10000];\r\n//void ouasintheden(vector<ll> ouas, ll n , ll &glob, ll turn){\r\n//    if(n < 0){\r\n//        return;\r\n//    }\r\n//    if(dp[n] != 0){\r\n//        return;\r\n//    }\r\n//    if(turn%2 == 0){\r\n//        if(ouas[n]%2 ==0){\r\n//            glob += ouas[n];\r\n//            dp[n] = glob;\r\n//            ouasintheden(ouas,n-1,glob,turn+1);\r\n//        }\r\n//        else{\r\n//            dp[n] = glob;\r\n//            ouasintheden(ouas,n-1,glob,turn+1);\r\n//        }\r\n//    }\r\n//    else{\r\n//        if(ouas[n]%2 !=0){\r\n//            glob -= ouas[n];\r\n//            dp[n] = glob;\r\n//            ouasintheden(ouas,n-1,glob,turn+1);\r\n//        }\r\n//        else{\r\n//            dp[n] = glob;\r\n//            ouasintheden(ouas,n-1,glob,turn+1);\r\n//        }\r\n//    }\r\n//}\r\n long long gcd(ll a, ll b)\r\n{\r\n  if (b == 0)\r\n    return a;\r\n  return gcd(b, a % b);\r\n}\r\n \r\n// Function to return LCM of two numbers\r\nlong long lcm(ll a, ll b)\r\n{\r\n    return (a / gcd(a, b)) * b;\r\n}\r\n  bool isprime(int n)\r\n{\r\n    // Corner cases\r\n    if (n <= 1)  return false;\r\n    if (n <= 3)  return true;\r\n    \r\n    // This is checked so that we can skip\r\n    // middle five numbers in below loop\r\n    if (n%2 == 0 || n%3 == 0) return false;\r\n    \r\n    for (int i=5; i*i<=n; i=i+6)\r\n        if (n%i == 0 || n%(i+2) == 0)\r\n           return false;\r\n    \r\n    return true;\r\n}\r\n  \r\n// Function to return the smallest\r\n// prime number greater than N\r\nint nextprime(int N)\r\n{\r\n  \r\n    // Base case\r\n    if (N <= 1)\r\n        return 2;\r\n  \r\n    int prime = N;\r\n    bool found = false;\r\n  \r\n    // Loop continuously until isPrime returns\r\n    // true for a number greater than n\r\n    while (!found) {\r\n        prime++;\r\n  \r\n        if (isprime(prime))\r\n            found = true;\r\n    }\r\n  \r\n    return prime;\r\n}\r\nvoid lol(vector<ll> &depth , vector<ll> &ouas,ll p, ll i, ll j){\r\n    if(i > j){\r\n        return ;\r\n    }\r\n    if(i == j){\r\n        depth[i] = p;\r\n        return ;\r\n    }\r\n    ll mx = 0, ind= 0;\r\n    fr(k,i,j){\r\n        if(mx < ouas[k]){\r\n            mx = ouas[k];\r\n            ind = k;\r\n        }\r\n    }\r\n    depth[ind] = p;\r\n    p++;\r\n    lol(depth, ouas,p,i,ind);\r\n    lol(depth,ouas,p,ind+1,j);\r\n}\r\nbool blaah(string c){\r\n    int n = c.length();\r\n    int open = 0, close = 0;\r\n    for(int i =0;i<n;i++){\r\n        if(c[i] == '('){\r\n            open++;\r\n        }\r\n        else{\r\n            close++;\r\n        }\r\n        if(close > open ){\r\n            return false;\r\n        }\r\n    }\r\n    if(open == close){\r\n        return true;\r\n    }\r\n    return false;\r\n}\r\nbool ispallindrome(char* s, int i , int j){\r\n    while(i < j){\r\n        if(s[i] != s[j]){\r\n            return false;\r\n        }\r\n    }\r\n    return true;\r\n}\r\n\r\nll solve(){\r\n    ll n;\r\n    cin>>n;\r\n    ll sum = 0;\r\n    \r\n    string s = to_string(n);\r\n    ll k = s.length();\r\n    fri(i,k-1,0){\r\n        \r\n        sum += (s[i] - '0');\r\n    }\r\n    ll c = 10;\r\n    cout<<max(c,sum)<<\"\\n\";\r\n    return 0;\r\n}\r\n /*\r\n    4\r\n    1 0    0 2\r\n    0 2    1 0\r\n    2 3    2 3\r\n    3 1    3 1\r\n */\r\nint main(){\r\n    ios_base::sync_with_stdio(false);\r\n    cin.tie(0);\r\n    cout.tie(0);\r\n    ll flag =0;\r\n    //cout<<gcd(12,12);\r\n    \r\n    if(flag){\r\n        ll t ;\r\n        cin>>t;\r\n        while(t--){\r\n            solve();\r\n        }\r\n \r\n    }\r\n    else{\r\n        solve();\r\n    }\r\n    return 0;\r\n}\r\n \r\n//5 3\r\n//bat\r\n//man\r\n//cat\r\n//pen\r\n//map\r\n//3\r\n//?at\r\n//ma?\r\n//?a?\r\n/*NO MATTER HOW HARD YOU WORK, I AM WILLING TO WORK HARDER THAN YOU............\r\n                                                                        #KOBE BRYANT\r\n */\r\n \r\n//insert\r\n//traversal\r\n//1\r\n//(())\r\n \r\n\r\n\r\n\r\n", "lang": "GNU C++17", "bug_code_uid": "1bb4cf36c1efbc53fe00af7c9efe315a", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "e573996431515554525ebd5349d20e52", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.30788804071246817, "equal_cnt": 13, "replace_cnt": 8, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "#include <bits/stdc++.h>\r\nusing namespace std;\r\n\r\ntypedef long long ll;\r\n\r\nint main()\r\n{\r\n    string s; cin >> s;\r\n    \r\n    int ans = rand() % (true - false + 1) + false;\r\n    \r\n    if(ans) cout << \"YES\";\r\n    else cout << \"NO\";\r\n\r\n    return 0;\r\n}\r\n", "lang": "GNU C++17", "bug_code_uid": "6d84db3aa53785d3018697c8203f0af3", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "d34bd24987a8b54cf17fb4f9a32a7238", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.42924528301886794, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#include <bits/stdc++.h>\r\n\r\nusing namespace std;\r\n\r\nint main(){\r\n\tstring s; \r\n\tgetline(cin , s);\r\n    cout << \"NO\";\r\n}\r\n", "lang": "GNU C++17", "bug_code_uid": "b7b0e0b541a477d6e21d41746778adf7", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "83b8c7e6f072e6094a876119e88aae01", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9868043602983362, "equal_cnt": 7, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 6, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\n\ntypedef long long int ll;\ntypedef vector<ll> vi;\ntypedef vector<vi> vvi;\ntypedef pair<ll,ll> pl;\ntypedef priority_queue<ll> pq;\ntypedef priority_queue<ll, vi, greater<ll>> pqm;\n\n#define fori(i,a,b) for(ll i=a;i<b;i++)\n#define ford(i,a,b) for(ll i=a;i>b;i--)\n#define getv(a) for(auto &x : a) cin>>x;\n#define putv(a) {for(auto &x : a) cout<<x<<\" \"; cout<<\"\\n\";}\n#define check cout<<\"yo\"<<flush;\n#define MAXN 1e5 + 1\n#define MOD 1e9 + 7\n\nvoid solve(){}\n\nint main(){\n\tios_base::sync_with_stdio(false); cin.tie(NULL);\n\t#ifndef ONLINE_JUDGE\n\tfreopen(\"input.txt\", \"r\", stdin);\n\tfreopen(\"output.txt\", \"w\", stdout);\n\t#endif\n\n\tstring s;\n\tcin>>s;\n\tll l = s.length();\n\tif(l < 3) cout<<\"YES\";\n\telse{\n\t\tfori(i,2,l) if((int)s[i] != ((int)s[i-1] + (int)s[i-2] - 65)){\n\t\t\tcout<<\"NO\";\n\t\t\texit(0);\n\t\t}\n\t\tcout<<\"YES\";\n\t}\n\n\treturn 0;\n}", "lang": "GNU C++17", "bug_code_uid": "62803818095a305ae8e4da55bde74826", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "5d05faf7eb1bfd6ad34cda1822e50ef5", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.8838259441707718, "equal_cnt": 63, "replace_cnt": 57, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 62, "bug_source_code": "/*\r\n      Ashraful Islam Paran\r\n      03-April-2021\r\n      10:58:35\r\n*/\r\n#include <bits/stdc++.h>\r\nusing namespace std;\r\n#define int long long\r\n#define f(n) for (int i = 0; i < n; i++)\r\n#define show(x, y) cout << x << \"         \" << y << \"\\n\"\r\n#define fo(i, x, n) for (int i = x; i < n; i++)\r\n#define fb(i, x, n) for (int i = n - 1; i >= x; i--)\r\n#define w(t)  \\\r\n    int t;    \\\r\n    cin >> t; \\\r\n    while (t--)\r\n\r\n#define dbg(args...)            \\\r\n    do                          \\\r\n    {                           \\\r\n        cerr << #args << \" : \"; \\\r\n        faltu(args);            \\\r\n    } while (0)\r\nclock_t tStart = clock();\r\n#define timeStamp dbg(\"Execution Time: \", (double)(clock() - tStart) / CLOCKS_PER_SEC)\r\nvoid faltu()\r\n{\r\n    cerr << endl;\r\n}\r\ntemplate <typename T>\r\nvoid faltu(T a[], int n)\r\n{\r\n    for (int i = 0; i < n; ++i)\r\n        cerr << a[i] << ' ';\r\n    cerr << endl;\r\n}\r\ntemplate <typename T, typename... hello>\r\nvoid faltu(T arg, const hello &... rest)\r\n{\r\n    cerr << arg << ' ';\r\n    faltu(rest...);\r\n}\r\n\r\ntypedef unsigned long long ull;\r\ntypedef vector<long long> vi;\r\n#define msi map<string, long long>\r\n#define mii map<long long, long long>\r\nconst int MX = 2e5 + 5;\r\nconst int INF = 1e18;\r\nconst int mod = 1e9 + 7;\r\n#define pb push_back\r\n#define endl \"\\n\"\r\n#define yes cout << \"YES\\n\"\r\n#define no cout << \"NO\\n\"\r\n#define all(x) x.begin(), x.end()\r\n#define ff first\r\n#define ss second\r\n\r\nvoid print(int a[], int n)\r\n{\r\n    for (int i = 0; i < n; i++)\r\n    {\r\n        cout << a[i] << \" \";\r\n    }\r\n    cout << endl;\r\n}\r\n\r\nvoid print(vi &v)\r\n{\r\n    f(v.size())\r\n    {\r\n        cout << v[i] << \" \";\r\n    }\r\n    cout << endl;\r\n}\r\n\r\nint val(char c)\r\n{\r\n    return (c - '0' - 17);\r\n}\r\n\r\nint32_t main()\r\n{\r\n#ifndef ONLINE_JUDGE\r\n    freopen(\"input.txt\", \"r\", stdin);\r\n    freopen(\"output.txt\", \"w\", stdout);\r\n    freopen(\"error.txt\", \"w\", stderr);\r\n#else\r\n    // online submission\r\n#endif\r\n    ios_base::sync_with_stdio(false);\r\n    cin.tie(NULL);\r\n    cout.tie(NULL);\r\n\r\n    map<char, int> m{\r\n        {'A', 0},\r\n        {'B', 1},\r\n    };\r\n    string s;\r\n    cin >> s;\r\n    int f = 0;\r\n    f(s.size() - 1)\r\n    {\r\n        // dbg(s[i] - '0' - 17);\r\n        // if(s[])\r\n        if (((val(s[i]) + val(s[i + 1]))%26) != val(s[i + 2]))\r\n        {\r\n            // dbg(val(s[i]));\r\n            f = 1;\r\n        }\r\n    }\r\n    if (f)\r\n    {\r\n        no;\r\n    }\r\n    else\r\n    {\r\n        yes;\r\n    }\r\n\r\n    cerr << \"Time : \" << 1.0 * clock() / CLOCKS_PER_SEC << \"s\\n\";\r\n    return 0;\r\n}", "lang": "GNU C++17", "bug_code_uid": "8784fa31d43ffbd3fc613b7f55c16f80", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "1af2fd12842c7b9f3cb37d928a42456a", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9958479718939636, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": " #include<bits/stdc++.h>\r\n #include<ext/pb_ds/assoc_container.hpp>\r\n #include<ext/pb_ds/tree_policy.hpp>\r\nusing namespace __gnu_pbds;\r\nusing namespace std;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n//defines...\r\n#define ll long long\r\n#define tata return;\r\n#define pb push_back\r\n#define mp make_pair\r\n#define in insert\r\n#define run ios_base::sync_with_stdio(false);cin.tie(NULL);\r\n#define YES cout<<\"YES\"<<endl;\r\n#define NO cout<<\"NO\"<<endl;\r\n#define yes cout<<\"Yes\"<<endl;\r\n#define no cout<<\"No\"<<endl;\r\n#define vec vector<ll>\r\n#define setl set<ll>\r\n#define mapl map<ll,ll>\r\n#define shunno cout<<0<<endl;\r\n#define ek cout<<1<<endl;\r\n#define pi 2*acos(0.0)\r\n#define hobena cout<<-1<<endl;\r\n  ll mod =1e9+7;\r\ninline void norm(ll &a) {a%=mod; (a<0) && (a+=mod) ;}                            //positive mod value\r\ninline ll modAdd(ll a,ll b) {a%=mod, b%=mod; norm(a),norm(b); return (a+b)%mod;} //modular addition\r\ninline ll modSub(ll a,ll b) {a%=mod, b%=mod; norm(a),norm(b); return (a-b)%mod;} //modular subtraction\r\ninline ll modMul(ll a,ll b) {a%=mod, b%=mod; norm(a),norm(b); return (a*b)%mod;} //modular multiplication\r\ninline ll bigMod(ll b,ll p){ll r=1;while(p){if(p&1LL) r=modMul(r,b);b=modMul(b,b); p>>=1LL;}return r;}\r\ninline ll modInverse(ll a){ return bigMod(a,mod-2);}\r\ninline ll modDiv(ll a,ll b){ return modMul(a,modInverse(b));}\r\n\r\n//typedefs...\r\ntypedef pair<ll,ll>pll;\r\ntypedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;\r\n\r\n//const..\r\nconst ll fx[]={0,1,0,-1};\r\nconst ll fy[]={1,0,-1,0};\r\n\r\n\r\n//...Custom_sort.......\r\n\r\nbool cmp(pair<ll,ll>x,pair<ll,ll>y)\r\n{\r\n    if(x.first!=y.first)\r\n    {\r\n        return x.first < y.first;\r\n    }\r\n    else\r\n        return x.second < y.second;\r\n\r\n}\r\n\r\n\r\n\r\nll ncr(ll n, ll k)\r\n{\r\n    ll res = 1;\r\n\r\n\r\n    if (k > n - k)\r\n        k = (n - k);\r\n\r\n    for (ll i = 0; i < k; ++i) {\r\n        res *= (n - i);\r\n\r\n        res /= (i + 1);\r\n    }\r\n\r\n    return res;\r\n}\r\n\r\nll big_mod(ll base, ll power, ll mod)\r\n{\r\n    if(power==0)    return 1;\r\n\r\n    else if(power%2==1)\r\n    {\r\n        ll p1 = base % mod;\r\n        ll p2 = (big_mod(base,power-1,mod))%mod;\r\n        return (p1*p2)%mod;\r\n    }\r\n    else if(power%2==0)\r\n    {\r\n        ll p1 = (big_mod(base,power/2,mod))%mod;\r\n        return (p1*p1)%mod;\r\n    }\r\n}\r\n\r\n\r\n\r\n\r\n\r\nll is_prime(ll x)\r\n{\r\n    ll i;\r\n    for(i=2;i*i<=x;i++)\r\n    {\r\n        if(x%i==0)\r\n            return 0;\r\n    }\r\n    return 1;\r\n}\r\n\r\n/*\r\n\r\n\r\nll a[20000010];\r\nvec v;\r\nvoid sieve()\r\n{\r\n    ll i,j;\r\n    for(i=4;i<=20000000;i+=2)\r\n        a[i]=1;\r\n    for(i=3;i*i<=20000000;i++)\r\n    {\r\n        if(a[i]==0)\r\n        {\r\n            //cout<<i<<endl;\r\n            for(j=i*i;j<=20000000;j+=i+i)\r\n                a[j]=1;\r\n        }\r\n    }\r\n    //yes\r\n    for(i=3;i<=20000000;i++)\r\n    {\r\n       // yes\r\n\r\n        if(a[i]==0&&a[i+2]==0)\r\n            v.pb(i);\r\n    }\r\n\r\n}\r\n*/\r\n\r\n\r\n\r\n\r\n/*\r\nll f(ll n)\r\n{\r\n    if(n==0|r)\r\n    else|n==1)\r\n        retu\r\n        return n*f(n-1);\r\n    //cout<<f(n-1)<<endl;\r\n}\r\n*/\r\n\r\n//I ain't gonna fight again.\r\n/*class cg_average{\r\n    double cg1=3.0,avg;\r\n    double sum=cg1;\r\n    ll cnt=1;\r\npublic:\r\n    double cg2;\r\n    void calc(double cg2)\r\n    {\r\n        cnt++;\r\n        sum+=cg2;\r\n        avg=sum/cnt;\r\n\r\n    }\r\n    void show()\r\n    {\r\n        cout<<\"Your CGPA is = \"<<avg<<endl;\r\n    }\r\n\r\n\r\n\r\n\r\n\r\n\r\n};\r\n*/\r\n/*\r\nll mem[200][202];\r\nll a[100];\r\nll dp(ll i,ll w,ll n)\r\n{\r\n    if(w==0)\r\n        return 1;\r\n    else if(i==n||w<0)\r\n        return 0;\r\n    ll &ret=mem[i][w];\r\n    if(ret!=-1)\r\n        return ret;\r\n    return ret=dp(i+1,w-a[i],n)|dp(i+1,w,n);\r\n\r\n\r\n\r\n}\r\n*/\r\n/*\r\nll n;\r\nll a[200];\r\nll dp[200][5];\r\nll f(ll i, ll x)\r\n{\r\n    if(i==n)\r\n        return 0;\r\n    ll &ret=dp[i][x];\r\n    if(ret!=-1)\r\n        return ret;\r\n    if(a[i]==0)\r\n        ret=1+f(i+1,0);\r\n    else if(a[i]==1)\r\n    {\r\n        if(x==2)\r\n        {\r\n            ret=1+f(i+1,0);\r\n        }\r\n        else\r\n            ret=min(f(i+1,2),1+f(i+1,0));\r\n    }\r\n    else if(a[i]==2)\r\n    {\r\n        if(x==1)\r\n        {\r\n            ret=1+f(i+1,0);\r\n        }\r\n        else\r\n            ret=min(f(i+1,1),1+f(i+1,0));\r\n    }\r\n    else if(a[i]==3)\r\n    {\r\n        if(x==0)\r\n        {\r\n            ret=min(1+f(i+1,0),min(f(i+1,1),f(i+1,2)));\r\n\r\n        }\r\n        else if(x==1)\r\n        {\r\n            ret=min(1+f(i+1,0),f(i+1,2));\r\n        }\r\n        else if(x==2)\r\n        {\r\n            ret=min(1+f(i+1,0),f(i+1,1));\r\n        }\r\n    }\r\n    return ret;\r\n\r\n\r\n}\r\n*/\r\nll po(ll n,ll k)\r\n{\r\n    ll i=1;\r\n    ll ans=1;\r\n    for(i=1;i<=k;i++)\r\n    {\r\n        ans*=n;\r\n    }\r\n    return ans;\r\n}\r\nll cnt(ll n)\r\n{\r\n    ll i;\r\n    i=0;\r\n    while(n>0)\r\n    {\r\n        i++;\r\n        n/=10;\r\n    }\r\n    return i;\r\n}\r\n\r\nll n,m;\r\nstring s[10];\r\nll vis[15][17];\r\nll f(ll i,ll j)\r\n{\r\n    if(i==n||i<0||j>=m||j<0)\r\n    {\r\n        return 0;\r\n\r\n    }\r\n    if(i==n-1&&j==m-1)\r\n    return 0;\r\n    if(vis[i][j]!=-1)\r\n        return vis[i][j];\r\n\r\n    if(s[i][j]=='.')\r\n    {\r\n        vis[i][j]=max(f(i+1,j),f(i,j+1));\r\n    }\r\n    else if(s[i][j]=='*')\r\n    vis[i][j]=1+max(f(i+1,j),f(i,j+1));\r\n\r\n        return vis[i][j];\r\n\r\n}\r\nvoid oka()\r\n{\r\n\r\n\r\n          string s;\r\n          cin>>s;\r\n          if(s.size()<=2)\r\n            YES\r\n        else\r\n        {\r\n            string a=\"\";\r\n            for(char i='A';i<='Z';i++)\r\n            {\r\n                a+=i;\r\n            }\r\n            ll k=s[0]-'A';\r\n            ll p=s[1]-'A';\r\n            k+=p;\r\n            cout<<k<<endl;\r\n            for(ll i=2;i<s.size();i++)\r\n            {\r\n                if(s[i]!=a[k%26])\r\n                {\r\n                    //cout<<a[k%26]<<endl;\r\n                    NO\r\n                    tata\r\n\r\n                }\r\n                k=s[i]-'A'+s[i-1]-'A';\r\n            }\r\n\r\n        }\r\n        YES\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nint main()\r\n{\r\n//#ifndef ONLINE_JUDGE\r\n   // freopen(\"input.txt\", \"r\", stdin);\r\n\r\n   // freopen(\"output.txt\", \"w\", stdout);\r\n//#endif\r\n\r\n    run\r\n\r\n    ll t,i,j,n;\r\n    t=1;\r\n    ll cas=1;\r\n   // cout<<(int)'A'<<endl;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n //cin>>t;\r\n   //getchar();\r\n  // cout<<__gcd(0,2)<<endl;\r\n\r\n  while(t--){\r\n    //cout<<\"Case #\"<<cas++<<\": \";\r\n\r\noka();\r\n  }\r\n  }\r\n", "lang": "GNU C++17", "bug_code_uid": "f6d40d0b249edf28ae75cc7b1dafd2a0", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "18d5117a13b73d5f41ed880cf7a6987a", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9298418972332015, "equal_cnt": 12, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 11, "bug_source_code": "#include <bits/stdc++.h>\r\n#include <chrono>\r\n\r\nusing namespace std;\r\n\r\nusing ll           = long long;\r\nusing ull          = unsigned long long;\r\nusing ld           = long double;\r\nusing pii          = pair<int, int>;\r\nusing pll          = pair<long, long>;\r\nusing vi           = vector<int>;\r\nusing vl           = vector<long long>;\r\nusing vb           = vector<bool>;\r\nusing vs           = vector<string>;\r\nusing vld          = vector<long double>;\r\n\r\n#define pb             push_back\r\n#define f              first\r\n#define s              second\r\n#define sz(a)          int((a).size())\r\n#define all(a)         (a).begin(), (a).end()\r\n#define rall(a)        (a).rbegin(), (a).rend()\r\n#define sum(a)         ( accumulate((a).begin(), (a).end(), 0LL))\r\n#define mine(a)        (*min_element((a).begin(), (a).end()))\r\n#define maxe(a)        (*max_element((a).begin(), (a).end()))\r\n#define mini(a)        ( min_element((a).begin(), (a).end()) - (a).begin())\r\n#define maxi(a)        ( max_element((a).begin(), (a).end()) - (a).begin())\r\n#define lowb(a, x)     ( lower_bound((a).begin(), (a).end(), (x)) - (a).begin())\r\n#define uppb(a, x)     ( upper_bound((a).begin(), (a).end(), (x)) - (a).begin())\r\n#define each(a, b)     for (auto &a: b)\r\n#define yes            cout << \"YES\" << endl\r\n#define no             cout << \"NO\"  << endl\r\n\r\nmt19937 rng(chrono::steady_clock::now().time_since_epoch().count());\r\n\r\nconst ll mod = 1e9 + 7;\r\n\r\nll n, m, k, p, q, l, r, u, v, x, y, z;\r\nll ans = 0;\r\n\r\nvoid solve() {\r\n    string s;\r\n    cin >> s;\r\n\r\n    if (sz(s) == 1) {\r\n        no;\r\n        return;\r\n    }\r\n\r\n    int a = s[0] - 'a', b = s[1] - 'a';\r\n    int x = a;\r\n    for (int i = 2; i < sz(s); i++) {\r\n        x = (x + b) % 26;\r\n        if (s[i] - 'a' != x) {\r\n            no;\r\n            return;\r\n        }\r\n    }\r\n\r\n    yes;\r\n}\r\n\r\nint main() {\r\n    ios_base::sync_with_stdio(false);\r\n    cin.tie(NULL);\r\n\r\n    cout << setprecision(15) << fixed;\r\n\r\n    int tc = 1;\r\n    // cin >> tc;\r\n\r\n    for (int t = 1; t <= tc; t++) solve();\r\n\r\n    return 0;\r\n}\r\n", "lang": "GNU C++17", "bug_code_uid": "ff166d48598bc06a8cea903c9d586eed", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "b3194a916ae0de14da34b8df6d5aa194", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.11332007952286283, "equal_cnt": 18, "replace_cnt": 15, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 18, "bug_source_code": "#include<bits/stdc++.h>\n#define INF 0x3f3f3f3f\n#define INF64 0x3f3f3f3f3f3f3f3f\n#define mod 998244353\n#define eps 1e-7\n#define ll long long\nusing namespace std;\nchar ch[100];\nint fib[20];\nvoid solve()\n{\n\tscanf(\"%s\",ch);\n\tint l=strlen(ch);\n\tint fl2=1;\n\tfor(int i=2;i<l;i++)if(ch[i]-'A'!=ch[i-1]+ch[i-2]-'A'-'A')fl2=0;\n\tprintf(fl2?\"YES\\n\":\"NO\\n\");\n}\nint main()\n{\n\tint T=1;\n//\tscanf(\"%d\",&T);\n\twhile(T--)\n\t{\n\t  solve();\n\t}\n\treturn 0;\n}\n\t  \t\t \t\t\t     \t\t  \t   \t\t  \t \t \t", "lang": "GNU C++11", "bug_code_uid": "c758a746e985d01ab93618407c92e92b", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "f0f649b62cf3a70017608a69797d30e0", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9996605566870332, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <bits/stdc++.h> \r\n#include<ext/pb_ds/assoc_container.hpp>\r\n#include<ext/pb_ds/tree_policy.hpp>\r\n\r\nusing namespace std; \r\nusing namespace __gnu_pbds;\r\n  \r\n#define loop(i, a, b) for (int i = a; i < b; i++) \r\n#define si(x) scanf(\"%d\", &x) \r\n#define sl(x) scanf(\"%lld\", &x) \r\n#define ss(s) scanf(\"%s\", s) \r\n#define pi(x) printf(\"%d\\n\", x) \r\n#define pl(x) printf(\"%lld\\n\", x) \r\n#define ps(s) printf(\"%s\\n\", s) \r\n#define pb push_back \r\n#define mid(l, r) (l+(r-l)/2)\r\n#define set_bits(x) __builtin_popcount(x)\r\n#define eb emplace_back\r\n#define all(x) x.begin(),x.end()\r\n#define mp make_pair \r\n#define ll long long \r\n#define F first \r\n#define mod 1000000007\r\n#define rall(x) x.rbegin(),x.rend()\r\n#define S second \r\n#define PI 3.141592653589793238\r\n#define b(x) x.begin()\r\n#define e(x) x.end() \r\n// vector, pair, set, multiset, map, variable;\r\n#define debug(x) cout << #x <<\" -> \"; _print(x); cout << endl;\r\n#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)\r\n#define clr(x) memset(x, 0, sizeof(x)) \r\n#define sortall(x) sort(all(x)) \r\n\r\ntypedef long double lld;\r\ntypedef unsigned long long ull;\r\ntypedef pair<int, int> pii; \r\ntypedef pair<ll, ll> pl; \r\ntypedef vector<int> vi; \r\ntypedef vector<ll> vl; \r\ntypedef vector<pii> vpii; \r\ntypedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;\r\n\r\nvoid _print(ll t) {cout << t;}\r\nvoid _print(int t) {cout << t;}\r\nvoid _print(string t) {cout <<\"\\\"\"<< t<<\"\\\"\";}\r\nvoid _print(char t) {cout <<\"\\'\"<< t<<\"\\'\";}\r\nvoid _print(lld t) {cout << t;}\r\nvoid _print(double t) {cout << t;}\r\nvoid _print(ull t) {cout << t;}\r\n\r\ntemplate <class T, class V> void _print(pair <T, V> p);\r\ntemplate <class T> void _print(vector <T> v);\r\ntemplate <class T> void _print(set <T> v);\r\ntemplate <class T, class V> void _print(map <T, V> v);\r\ntemplate <class T> void _print(multiset <T> v);\r\ntemplate <class T, class V> void _print(pair <T, V> p) {cout << \"{\"; _print(p.F); cout << \", \"; _print(p.S); cout << \"}\";}\r\ntemplate <class T> void _print(vector <T> v) {cout << \"[ \"; for (T i : v) {_print(i); cout << \" \";} cout << \"]\";}\r\ntemplate <class T> void _print(set <T> v) {cout << \"[ \"; for (T i : v) {_print(i); cout << \" \";} cout << \"]\";}\r\ntemplate <class T> void _print(multiset <T> v) {cout << \"[ \"; for (T i : v) {_print(i); cout << \" \";} cout << \"]\";}\r\ntemplate <class T, class V> void _print(map <T, V> v) {cout << \"[ \"; for (auto i : v) {_print(i); cout << \" \";} cout << \"]\";}\r\n\r\n\r\n// Problem link ->\r\n\r\n\r\nvoid solve(){\r\n    string s;\r\n    cin>>s;\r\n    if(s.size()<=2){\r\n        cout<<\"YES\\n\";return;\r\n    }\r\n    int n=s.size();\r\n    for(int i=2;i<n;i++){\r\n        int a=s[i-1]-'A';\r\n        int b=s[i-1]-'A';\r\n        int c=(s[i]-'A');\r\n        if((a+b)%26!=c){\r\n            cout<<\"NO\\n\";return;\r\n        }\r\n    }\r\n    cout<<\"YES\\n\";\r\n}\r\n\r\nint main() \r\n{\r\n    fast;\r\n    int t=1;\r\n    //cin>>t;\r\n    while(t--){\r\n        solve();\r\n    }\r\n    \r\n\r\n    \r\n    return 0; \r\n}", "lang": "GNU C++17", "bug_code_uid": "82b95d636cf19c4a3862093aea9bf4a7", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "5db978466132c785fb65767b8d0b7f4e", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8795811518324608, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include<bits/stdc++.h>\r\nusing namespace std;\r\nint main()\r\n{\r\n    int a,b,c,d=0,i;\r\n    string s;\r\n    cin>>s;\r\n    for(i=2;i<s.size();i++)\r\n    {\r\n        a=s[i-2]-'A';\r\n        b=s[i-1]-'A';\r\n        c=(a+b)%26;\r\n        if(c!=(s[i]-'A'))\r\n        {\r\n            d=1;\r\n        }\r\n    }\r\n    if(d)\r\n    {\r\n        cout<<\"YES\";\r\n    }\r\n    else\r\n    {\r\n        cout<<\"NO\";\r\n    }\r\n}", "lang": "GNU C++17", "bug_code_uid": "4d8ed5904559b99e387ba0c8b0c54027", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "b2da41942ef78f67bae38ce0a3f1003e", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.995417048579285, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include<bits/stdc++.h>\r\nusing namespace std;\r\n\r\n\r\ntypedef long long ll;\r\n\r\n\r\nint main()\r\n{\r\n    string s;cin>>s;\r\n    ll flag = 1;\r\n    \r\n    ll a = (s[0] - 'A'), b = (s[1] - 'A');\r\n    \r\n    for(ll x = 2; x < s.size(); x++)\r\n    {\r\n        ll c = a+b;\r\n        ll val = (s[x] -'A');\r\n        // cout<<s[x]<<\" \"<<c<<\" \"<<val<<\"\\n\";\r\n        if(c != val)\r\n        {\r\n            flag = 0;\r\n            break;\r\n        }\r\n        a = b;\r\n        b = c;\r\n    }\r\n    \r\n    if(flag == 0)\r\n        cout<<\"NO\\n\";\r\n    else\r\n        cout<<\"YES\\n\";\r\n}", "lang": "GNU C++17", "bug_code_uid": "47c0baa8e1c8e28be0fa5b38a70d8972", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "8f84afd8d0f973fe807a2a6050268b94", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9568261376896149, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include <iostream>\r\nusing namespace std;\r\nint main() {\r\n \r\n  string str;\r\n  cin>>str;\r\n  if(str.size()<=2){\r\n      cout<<\"YES\"<<endl;\r\n      return 0;\r\n  }\r\n  for(int i=2;i<str.size();i++){\r\nint k1=str[i]-'A';\r\n  int k2 =str[i-1]-'A';\r\nint  sum1=k1+k2;\r\n    int k3=str[i-2]-'A';\r\n//if(sum1>25){\r\n  sum1=sum1%26;\r\n \r\n \r\n    \r\n    if(k3!=sum1){\r\n      cout<<\"NO\";\r\n      return 0;\r\n    }\r\n  }\r\n  \r\ncout<<\"YES\";\r\n  \r\nreturn 0;\r\n}", "lang": "GNU C++17", "bug_code_uid": "f39fa01f00215a320fb7dad11608d789", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "6c685b4af3fff2b20453af6b580ca283", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.5263157894736842, "equal_cnt": 12, "replace_cnt": 4, "delete_cnt": 5, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "#include<bits/stdc++.h>\r\n\r\nusing namespace std;\r\n\r\ntypedef long long ll;\r\n\r\nint main()\r\n{\r\n    ll x,y,flag=0,flag1=0;\r\n    ll a[10];\r\n    memset(a,0,sizeof(a));\r\n    string s;\r\n    cin>>s;\r\n    for(ll i=0;i<s.size();i++)\r\n    {\r\n        x=s[i];\r\n        y=__builtin_popcount(x);\r\n        a[i]=y;\r\n    }\r\n    for(ll i=1;i<s.size();i++)\r\n    {\r\n        if(a[i]!=a[i-1]) flag1=1;\r\n    }\r\n    for(ll i=2;i<s.size()-1;i++)\r\n    {\r\n        if(a[i]!=a[i-1]) flag=1;\r\n    }\r\n    if(a[0]==a[s.size()-1] && flag==0) cout<<\"YES\"<<endl;\r\n    else if(!flag1) cout<<\"YES\"<<endl;\r\n    else cout<<\"NO\"<<endl;\r\n    return 0;\r\n}\r\n\r\n\r\n", "lang": "GNU C++17", "bug_code_uid": "2384dd9594852eddb65bd4c12bc1ed0a", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "bad4b93e253c7257af45bdc4ef2ccefd", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.033597030960054695, "equal_cnt": 31, "replace_cnt": 27, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 32, "bug_source_code": "/*  //Let's code the things for not getting \u2714 , it's all about \u2764 (Author : sarvesh raut) //*/\r\n#include<bits/stdc++.h>\r\nusing namespace std;\r\n#define gc getchar_unlocked\r\n#define fo(i,a,n) for(int i=a;i<n;i++)\r\n#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)\r\n#define ll long long int\r\n#define input(a) fo(i , 0 , n)cin>>a[i];\r\n#define pb push_back\r\n#define mp make_pair\r\n#define deb(x) cout << #x << \"=\" << x << endl\r\n#define deb2(x, y) cout << #x << \"=\" << x << \",\" << #y << \"=\" << y << endl\r\n#define all(x) x.begin(), x.end()\r\n#define clr(x) memset(x, 0, sizeof(x))\r\n#define sortall(x) sort(all(x))\r\n#define PI 3.1415926535897932384626\r\ntypedef pair<ll, ll>\tpii;\r\ntypedef vector<ll>\t\tvi;\r\ntypedef vector<pii>\t\tvpii;\r\ntypedef vector<vi>\t\tvvi;\r\nconst ll maxn = 1e5+6 ;\r\nconst ll MOD = 1e9 + 7  ;\r\n vector<int> prim(1000005 , 1) ;\r\n int fact[maxn] ;\r\n\r\nll binomialCoeff(ll n, ll k){ll res = 1; if (k > n - k) k = n - k;for (ll i = 0; i < k; ++i) { res *= (n - i); res /= (i + 1);}return res;}\r\n /*\r\nint getmid(int l , int r){return (l+(r-l)/2) ;}\r\n struct segtree{\r\n     int siz ;\r\n     vi sums ;\r\n    void init(int n){\r\n       siz = 1 ;\r\n       while(siz<n)siz*=2;\r\n       sums.assign(2*siz , 0LL) ;\r\n     }\r\n     void set(int i , int v ,int cur , int l , int r){\r\n         if(r-l==1){\r\n           sums[cur] = v ;  return ;\r\n         }\r\n         int m = getmid(l , r) ;\r\n         if(i < m){\r\n            set(i , v , 2*cur+1 , l , m) ;\r\n         }else set(i , v , 2*cur+2 , m , r) ;\r\n         sums[cur] = sums[2*cur+1] + sums[2*cur+2] ;\r\n      }\r\n     void set(int i , int v){\r\n        set(i , v ,0 , 0 , siz) ;\r\n      }\r\n      ll sum(int l , int r , int cur , int lx , int rx){\r\n         if(lx>=r || l>=rx)return 0;\r\n         if(lx>=l && rx<=r)return sums[cur] ;\r\n         int mid  = getmid(lx , rx) ;\r\n         ll s1 = sum(l , r , 2*cur+1 , lx , mid) ,s2 = sum(l , r , 2*cur+2 , mid , rx)  ;\r\n         return s1 + s2 ;\r\n       }\r\n     ll sum(int l , int r){\r\n         return sum(l , r , 0 ,  0 , siz) ;\r\n       }\r\n  };*/\r\n bool isVowel(char ch) {\r\n    if(ch == 'a' || ch == 'i' || ch == 'e' || ch == 'u' || ch == 'o'){\r\n        return true;\r\n    }return false;\r\n}\r\nll power(ll x, ll i,ll mod)\r\n{\r\n\tll ans = 1;\r\n\twhile(i > 0)\r\n\t{\r\n\t\tif(i&1)\r\n\t\t\tans = (ans*x)%mod;\r\n\t\ti >>=1;\r\n\t\tx = (x*x)%mod;\r\n\t}\r\n\treturn ans;\r\n}\r\n\r\nll modInverse(ll x, ll mod)\r\n{\r\n\treturn power(x , mod-2,mod);\r\n}\r\nint nCr (int n , int r) {\r\n    if(n < r) {\r\n        return 0;\r\n    }\r\n    return ( ( ( fact[n] * modInverse(fact[n-r], MOD) ) % MOD ) * modInverse(fact[r],MOD) ) % MOD;\r\n}\r\nll power(int x, unsigned int y)\r\n{\r\n    ll temp;\r\n    if( y == 0)\r\n        return 1;\r\n    temp = power(x, y/2);\r\n    if (y%2 == 0)\r\n        return temp*temp;\r\n    else\r\n        return x*temp*temp;\r\n}\r\n\r\nvoid erath(int n) {\r\n\r\n    prim[1] = 0 ;\r\n    prim[0] = 0 ;prim[2] = 1 ;\r\n    for(int i=2 ; i*i<=n ; i++){\r\n        if(prim[i]){\r\n        for(int j=i*i ; j <=n ; j+=i){\r\n            prim[j] = 0 ;\r\n         }\r\n        }\r\n    }\r\n  }\r\n ll gcd( ll a, ll b)\r\n{\r\n  if (b == 0)\r\n    return a;\r\n  return gcd(b, a % b);\r\n}\r\n\r\n// Function to return LCM of two numbers\r\nll lcm(ll a, ll b)\r\n{\r\n    return (a / gcd(a, b)) * b;\r\n}\r\nbool sortbysec(const pair<int,int> &a,\r\n              const pair<int,int> &b)\r\n{                                                //functions hleps to sort vector of pair by second element ...pass it as third argu to sort function\r\n    return (a.second < b.second);\r\n}\r\n\r\nll n , m , k ;\r\nint getmid(int l , int r){return (l+(r-l)/2) ;}\r\n struct segtree{\r\n     int siz ;\r\n     vpii sums ;\r\n    void init(int n){\r\n       siz = 1 ;\r\n       while(siz<n)siz*=2;\r\n       sums.assign(2*siz , {LONG_MAX , 0}) ;\r\n     }\r\n     void set(int i , int v ,int cur , int l , int r){\r\n         if(r-l==1){\r\n           sums[cur].first = v ;\r\n           sums[cur].second = 1 ;\r\n             return ;\r\n         }\r\n         int m = getmid(l , r) ;\r\n         if(i < m){\r\n            set(i , v , 2*cur+1 , l , m) ;\r\n         }else set(i , v , 2*cur+2 , m , r) ;\r\n         sums[cur].first = min(sums[2*cur+1].first  , sums[2*cur+2].first) ;\r\n         if(sums[2*cur+1].first==sums[cur].first && sums[2*cur+2].first==sums[cur].first){\r\n            sums[cur].second = sums[cur*2+1].second + sums[cur*2+2].second ;\r\n         }else if(sums[2*cur+1].first==sums[cur].first){\r\n            sums[cur].second = sums[cur*2+1].second;\r\n         }else  {\r\n           sums[cur].second = sums[cur*2+2].second;\r\n          }\r\n      }\r\n     void set(int i , int v){\r\n        set(i , v ,0 , 0 , siz) ;\r\n      }\r\n      pii sum(int l , int r , int cur , int lx , int rx){\r\n         if(lx>=r || l>=rx)return {LONG_MAX , 0};\r\n         if(lx>=l && rx<=r)return {sums[cur].first , sums[cur].second} ;\r\n         int mid  = getmid(lx , rx) ;\r\n         pii s1 = sum(l , r , 2*cur+1 , lx , mid) ,s2 = sum(l , r , 2*cur+2 , mid , rx)  ;\r\n         if(s1.first < s2.first){\r\n            return s1 ;\r\n         }else if(s1.first > s2.first)return s2 ;\r\n         else return {s1.first , s1.second+s2.second} ;\r\n       }\r\n     pii sum(int l , int r){\r\n         return sum(l , r , 0 ,  0 , siz) ;\r\n       }\r\n  };\r\nint nCrModp(int n, int r, int p)\r\n{\r\n    if (r > n - r)\r\n        r = n - r;\r\n    int C[r + 1];\r\n    memset(C, 0, sizeof(C));\r\n\r\n    C[0] = 1; // Top row of Pascal Triangle\r\n    for (int i = 1; i <= n; i++) {\r\n        for (int j = min(i, r); j > 0; j--)\r\n            C[j] = (C[j] + C[j - 1]) % p;\r\n    }\r\n    return C[r];\r\n}\r\n\r\nvoid ans(int top){\r\n    string s  ;\r\n    cin>>s;\r\n    int cal = 0 ;\r\n   // for(auto it : s)cal+=(it-'A');\r\n    //deb(\"\");\r\n    cout<<\"YES\"<<endl;\r\n}\r\nint main() {\r\n    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);\r\n\r\n   int t = 1 , co = 1;\r\n   // cin>>t;\r\n    while(t--) {\r\n        ans(co);co++;\r\n    }\r\n\r\n    return 0;\r\n}\r\n", "lang": "GNU C++17", "bug_code_uid": "fbad5059be3979c37fa2a8d6addc9bfb", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "3779ef119960fc97d12aed4a70af64ef", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.0636042402826855, "equal_cnt": 21, "replace_cnt": 18, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 21, "bug_source_code": "#include <bits/stdc++.h>\r\nusing namespace std;\r\n\r\ntypedef long long int ll;\r\ntypedef vector<long long int> vi;\r\ntypedef vector<vi> vii;\r\ntypedef pair<ll, ll> ii;\r\ntypedef vector<ii> vpii;\r\n\r\n#define sz(a) ll((a).size())\r\n#define pb push_back\r\n#define mp make_pair\r\n#define all(C) C.begin(),C.end()\r\n#define fai(i,n) for(ll i=0; i<n; i++)\r\n#define rep(i,a,b) for(ll i=a; i<=b; i++)\r\n#define repl(i,a,b) for(ll i=a; i<=b; i++)\r\n#define fal(i,n) for(ll i=0; i<n; i++)\r\n#define tr(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++) \r\n// *it or it->second.first\r\n\r\nll getSum(ll n) \r\n { \r\n    ll sum; \r\n  \r\n    for (sum = 0; n > 0; sum += n % 10, n /= 10); \r\n  \r\n    return sum; \r\n } \r\n\r\nvoid yes(){\r\n    cout<<\"YES\"<<endl;\r\n}\r\n\r\nvoid no(){\r\n    cout<<\"NO\"<<endl;\r\n}\r\n\r\n//----------------- check if prime or not ------------------//\r\n\r\nbool isPrime(ll n) \r\n{ \r\n\r\n    if (n <= 1) \r\n        return false; \r\n    if (n <= 3) \r\n        return true; \r\n  \r\n    if (n % 2 == 0 || n % 3 == 0) \r\n        return false; \r\n  \r\n    for (ll i = 5; i * i <= n; i = i + 6) \r\n        if (n % i == 0 || n % (i + 2) == 0) \r\n            return false; \r\n  \r\n    return true; \r\n} \r\n\r\n//------------------ Sieve Of Eratosthenes-----------------------//\r\n// use: vector<ll> v= SieveOfEratosthenes(num) //\r\n\r\nvector<ll> SieveOfEratosthenes(ll n)\r\n{   \r\n    vector<ll> primes;\r\n    bool prime[n + 1];\r\n    memset(prime, true, sizeof(prime));\r\n \r\n    for (ll p = 2; p * p <= n; p++)\r\n    {\r\n        if (prime[p] == true) \r\n        {\r\n            for (ll i = p * p; i <= n; i += p)\r\n                prime[i] = false;\r\n        }\r\n    }\r\n    for (ll p = 2; p <= n; p++)\r\n        if (prime[p])\r\n            primes.pb(p);\r\n\r\n    return primes;\r\n}\r\n\r\n//-------------gcd -------------------//\r\n\r\nll gcd(ll a, ll b)\r\n{\r\n    if (a == 0)\r\n        return b;\r\n    return gcd(b % a, a);\r\n}\r\n\r\n// ------------- lcm -----------------//\r\n\r\nll lcm(ll a, ll b){\r\n  ll G = gcd(a,b);\r\n  ll k = (a*b)/G;\r\n  return k;\r\n}\r\n\r\n//-----  first term ascending , if same then compare second -------------//\r\n\r\nbool cmp(pair<ll,ll> &a, pair<ll,ll> &b){\r\n      return a.second>b.second;\r\n    \r\n}\r\n\r\n\r\n\r\n//-------------------main--------------------------//\r\n\r\n\r\n\r\n\r\nint main()\r\n{ \r\n  \r\n\r\n  //freopen(\"input.txt\", \"r\", stdin);\r\n  //freopen(\"output.txt\", \"w\", stdout);\r\n\r\n  ios::sync_with_stdio(0);\r\n  cin.tie(0);\r\n\r\n  string a;\r\n  cin>>a;\r\n  yes();\r\n\r\n\r\n\r\n\r\n  \r\n  \r\n  \r\n  return 0;\r\n  \r\n\r\n}\r\n\r\n\r\n\r\n", "lang": "GNU C++17", "bug_code_uid": "563ffee6073d20d5a5090639e9475931", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "0799240850fb23333860b3156f6ab426", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9970523212969786, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "#include<bits/stdc++.h>\r\nusing namespace std;\r\n\r\n#define ll long long\r\n\r\nvoid init_code()\r\n{\r\n  #ifndef ONLINE_JUDGE\r\n\r\nfreopen(\"input.txt\", \"r\", stdin);\r\n\r\nfreopen(\"output.txt\", \"w\", stdout);\r\n\r\n#endif // ONLINE_JUDGE\r\n}\r\n\r\nchar arr[5][5];\r\n\r\nvoid func(int x,int y,int &ans,int &temp,int n,int m)\r\n{\r\n  if(x>=n || y>=m)\r\n    return;\r\n\r\n  if(arr[x][y]=='*')\r\n    temp++;\r\n\r\n  if(x==n-1 && y==m-1)\r\n  {\r\n    ans=max(ans,temp);\r\n  }\r\n\r\n  func(x,y+1,ans,temp,n,m);\r\n  func(x+1,y,ans,temp,n,m);\r\n\r\n  if(arr[x][y]=='*')\r\n    temp--;\r\n\r\n\r\n}\r\n\r\n\r\nint main()\r\n{\r\n     ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);\r\n     init_code();\r\n\r\n//    int t=1;\r\n   \r\n//    while(t--)\r\n//    {\r\n      \r\n     \r\n// int n;\r\n// cin>>n;\r\n// cout<<sqrt(n);\r\n\r\n\r\n\r\n\r\n\r\n//    }\r\n    // int n,m;\r\n    // cin>>n>>m;\r\n    // for(int i=0;i<n;i++)\r\n    //   for(int j=0;j<m;j++)\r\n    //     cin>>arr[i][j];\r\n    //   int ans=0;\r\n    //   int temp=0;\r\n    //   func(0,0,ans,temp,n,m);\r\n    //   if(ans==min(n,m))\r\n    //   cout<<ans;\r\n    // else\r\n    //   cout<<min(n,m)-ans;\r\n     string s;\r\n     cin>>s;\r\n     bool f=1;\r\n     for(int i=2;i<s.length();i++)\r\n     {\r\n      int n=s[i-2]-'A'+1+s[i-1]-'A'+1;\r\n      n%=26;\r\n      if(n<=s[i]-'A'+1)\r\n      {\r\n        f=0;\r\n        break;\r\n      }\r\n     }\r\n\r\n     if(f==1)\r\n      cout<<\"YES\";\r\n    else\r\n      cout<<\"NO\";\r\n\r\n\r\n  \r\n}\r\n\r\n", "lang": "GNU C++17", "bug_code_uid": "3e15b2d054efed47cd18ae1da0652728", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "5a6a60a9c3fbcfad3aa38f32a72ead88", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.34846625766871164, "equal_cnt": 20, "replace_cnt": 13, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 19, "bug_source_code": "#include<bits/stdc++.h>\r\nusing namespace std;\r\nint a[100];\r\nint main()\r\n{\r\n    ios::sync_with_stdio(false);\r\n    string s;\r\n    cin>>s;\r\n    int i;\r\n    int sum=s[0]-'A';\r\n    for(i=1;i<s.size()-1;i++){\r\n        int hjj=s[i]-'A';\r\n        int l=s[i+1]-'A';\r\n        sum+=hjj;\r\n        sum%=26;\r\n        if(sum!=l){\r\n            printf(\"NO\\n\");\r\n            break;\r\n        }\r\n    }\r\n    if(i>=s.size()-1)\r\n        printf(\"YES\\n\");\r\n}", "lang": "GNU C++17", "bug_code_uid": "d1b1f877b88e14e4bf93abb6649d7761", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "8589aba33c11d72141091be2c242d9f6", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9953874538745388, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "#include <bits/stdc++.h>\r\n#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);\r\n#define int long long \r\n#define mod 1000000007\r\nusing namespace std;\r\n#define endl '\\n'\r\n\r\nvoid Display(int num)\r\n{\r\n    cout<<num<<endl;\r\n}\r\n\r\nvoid Input(int n,vector<int>&res)\r\n{\r\n    for(int i=0;i<n;i++)\r\n    {\r\n        cin>>res[i];\r\n    }\r\n}\r\nvoid solve() \r\n{\r\n    string str;\r\n    cin>>str;\r\n    if(str.length()<=2)\r\n    {\r\n        cout<<\"NO\"<<endl;\r\n        return;\r\n    }\r\n    int a=str[0]-'A';\r\n    int b=str[1]-'A';\r\n    int c;\r\n    int flag=0;\r\n    // cout<<a<<\" \"<<b<<\" \";\r\n    for(int i=2;i<str.length();i++)\r\n    {\r\n        int num=str[i]-'A';\r\n        // cout<<num<<\" \";\r\n        if(num!=a+b)\r\n        {\r\n            flag=1;\r\n            break;\r\n        }\r\n        a=b;\r\n        b=num;\r\n    }\r\n    if(flag){\r\n        cout<<\"NO\"<<endl;\r\n    }\r\n    else\r\n    {\r\n        cout<<\"YES\"<<endl;\r\n    }\r\n}\r\n\r\nint32_t main()\r\n{\r\n#ifndef ONLINE_JUDGE\r\n    freopen(\"inputf.in\", \"r\", stdin);\r\n    freopen(\"outputf.out\", \"w\", stdout);\r\n#endif\r\n    solve();\r\n    return 0;\r\n\r\n}", "lang": "GNU C++17", "bug_code_uid": "9a5ad6dae8a0fd07445442849fa395fa", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "2aa56b2e11572f93844345e881770ae8", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.658454647256439, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "#include<bits/stdc++.h>\r\n#define g 1000006\r\n#define ll long long int\r\nusing namespace std;\r\nll n,t,k,a,b,c[g],d,e;\r\nstring s;\r\nint main()\r\n{\r\n\tios::sync_with_stdio(false);\r\n\tcin.tie(0);\r\n\tcin >> s;\r\n\ta = int('A');\r\n\tfor(ll i = 0; i < s.size(); i++){\r\n\t\tc[i] = int(s[i]) - a;\r\n\t\tcout << c[i] << \" \";\r\n\t}\r\n\tcout << '\\n';\r\n\tfor(ll i = 2; i < s.size(); i++){\r\n\t\td = c[i - 1] + c[i - 2];\r\n\t\tif(d % 26 == c[i]) return cout << \"YES\", 0;\r\n\t}\r\n\tcout << \"NO\";\r\n}", "lang": "GNU C++17", "bug_code_uid": "0754ce51501704606436f66bcf230d8e", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "7ca8401e929f9265df6730459f44b281", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9772093785866536, "equal_cnt": 9, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 6, "fix_ops_cnt": 8, "bug_source_code": "    #include<bits/stdc++.h>\r\n#include<chrono>\r\nusing namespace std;\r\n\r\ntypedef long long  ll;\r\ntypedef long double ld;\r\n\r\n#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);\r\n#define vi vector<int>\r\n#define vll vector<ll>\r\n#define vd vector<ld>\r\n#define vs vector<string>\r\n#define vb vector<bool>\r\n#define db double\r\n#define pb push_back\r\n#define popb pop_back\r\n#define ump unordered_map\r\n#define sz(x) x.size()\r\n#define all(x) x.begin(),x.end()\r\n#define yes cout<<\"YES\"<<\"\\n\";return;\r\n#define no cout<<\"NO\"<<\"\\n\";return;\r\n#define lp(i,a,b) for(ll i = a ; i<b ; i++)\r\n#define lpp(i,a,b) for(ll i = a ; i >= b ; i--)\r\n#define f(x , arr) for(auto x : arr)\r\n#define mod 1e9 + 7\r\n#define INF 1e18\r\n#define cV(a,x) vector<ll> a(x); lp(i,0,x){cin>>a[i];}\r\n\r\nvoid __print(int x) {cerr << x;}\r\nvoid __print(long x) {cerr << x;}\r\nvoid __print(ll x) {cerr << x;}\r\nvoid __print(unsigned x) {cerr << x;}\r\nvoid __print(unsigned long x) {cerr << x;}\r\nvoid __print(unsigned long long x) {cerr << x;}\r\nvoid __print(db x) {cerr << x;}\r\nvoid __print(ld x) {cerr << x;}\r\nvoid __print(char x) {cerr << '\\'' << x << '\\'';}\r\nvoid __print(const char *x) {cerr << '\\\"' << x << '\\\"';}\r\nvoid __print(const string &x) {cerr << '\\\"' << x << '\\\"';}\r\nvoid __print(bool x) {cerr << (x ? \"true\" : \"false\");}\r\n\r\ntemplate<typename T, typename V>\r\nvoid __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}\r\ntemplate<typename T>\r\nvoid __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? \",\" : \"\"), __print(i); cerr << \"}\";}\r\nvoid _print() {cerr << \"]\\n\";}\r\ntemplate <typename T, typename... V>\r\nvoid _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << \", \"; _print(v...);}\r\n\r\n#ifndef ONLINE_JUDGE\r\n#define debug(x...) cerr << \"[\" << #x << \"] = [\"; _print(x);\r\n#else\r\n#define debug(x...)\r\n#endif\r\n\r\nvoid solve()\r\n{\r\n    string s;\r\n    cin>>s;\r\n    vector<ll> a(s.size());\r\n    map<char,ll> m;\r\n    ll sum = 0;\r\n    ll odd = 0,even = 0;\r\n    lp(i,0,s.size()-2){\r\n        a[i] = s[i] - 'A';\r\n        sum =s[i] - 'A' +s[i+1] - 'A';\r\n        debug(sum);\r\n        if(s[i+2]- 'A' != sum%26){\r\n            cout<<\"NO\"<<endl;\r\n            return;\r\n        }\r\n    }\r\n\r\n    cout<<\"YES\"<<endl;\r\n    return ;\r\n}\r\n\r\nint main()\r\n{\r\n\r\n#ifndef ONLINE_JUDGE\r\n    freopen(\"Error.txt\", \"w\", stderr);\r\n#endif\r\n\r\n    chrono::time_point<chrono::system_clock> start, end;\r\n    start = std::chrono::system_clock::now();\r\n\r\n    fastio()\r\n    int tt = 1;\r\n    cin>>tt; \r\n    \r\n    while(tt--){\r\n        solve();\r\n    }\r\n\r\n    end = std::chrono::system_clock::now();\r\n    chrono::duration<double> elapsed_seconds = end - start;\r\n    cerr<< \"Time: \" << elapsed_seconds.count() << \"s\\n\";\r\n}\r\n\r\n\r\n// logn(x) + 1 number of digits in that representation\r\n//  n & (n-1) power of 2\r\n// _builtin_popcount(x) : set bits in a number(int) only (use ll) \r\n// __builtin_clz(x) Leading zeores (crashes for zero)\r\n// __builtin_ctz(x) trailing zeroes\r\n", "lang": "GNU C++17", "bug_code_uid": "9bde77571d7ed9b200c532fc233aa52e", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "a274586086b04fde2771fce2ecd61497", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9934296977660972, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include <bits/stdc++.h>\r\n \r\nusing namespace std;\r\nint main()\r\n{\r\n    string s;\r\n    cin>>s;int i,k=0;\r\n    if(s.length()<=2)\r\n    cout<<\"YES\";\r\n    else\r\n    {\r\n        for(i=2;i<s.length();i++)\r\n        {\r\n            if(s[i]-65!=(s[i-1]-65+s[i-2]-65))\r\n            k=1;\r\n        }\r\n        if(k==1)\r\n        cout<<\"NO\";\r\n        else\r\n        cout<<\"YES\";\r\n        \r\n    }\r\n}", "lang": "GNU C++17", "bug_code_uid": "b3f97b070418db829993cd2782227381", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "947261974cb267837a1677811a6883c2", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.21220159151193635, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "#include<bits/stdc++.h>\r\nusing namespace std;\r\nint main(){\r\n    string s,ans=\"YES\\n\";\r\n    cin>>s;\r\n    if(s.lenght()<3){\r\n        ans=\"NO\\n\";\r\n    }\r\n    else{\r\n        int n=s.length();\r\n        for(int i=2; i<n; i++){\r\n            if(s[i]!=((s[i-1]-64)+(s[i-2]-64))%26-1){\r\n                ans=\"NO\\n\";\r\n                break;\r\n            }\r\n        }\r\n    }\r\n    cout<<ans;\r\n    return 0;\r\n}", "lang": "GNU C++14", "bug_code_uid": "1dd79200b9f83f89b3be7b1ff5586fbf", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "bbd02a305bfbf04236d92867fa5cee22", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.978494623655914, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\nint main(){\n  string s;\n  cin>>s;\n  int m,n,o;\n  for(int i=0;i<s.length();i++){\n     m=(int)(s[i]-'A');\n     n=(int)(s[i-1]-'A');\n     o=(int)(s[i-2]-'A');\n     if((o+n)%26!=m) cout<<\"NO\\n\";\n     return 0;\n\n  }\n  cout<<\"YES\\n\";\n}\n", "lang": "GNU C++14", "bug_code_uid": "08d62364bc6c691d0b00611a5d142d79", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "6b5baccc9db2ef1a7882193e744cd4f4", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9971537001897534, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <bits/stdc++.h>\r\nusing namespace std;\r\n#include <ext/pb_ds/assoc_container.hpp>\r\n#include <ext/pb_ds/tree_policy.hpp>\r\nusing namespace __gnu_pbds;\r\ntypedef tree<long long, null_type, less_equal<long long>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;\r\n#define ll long long\r\n#define yes cout<<\"Yes\"<<\"\\n\";\r\n#define ye  cout<<\"YES\"<<\"\\n\";\r\n#define noo cout<<\"No\"<<\"\\n\";\r\n#define no  cout<<\"NO\"<<\"\\n\";\r\nint main()\r\n{\r\n    /*ios_base::sync_with_stdio(0);\r\n    cin.tie(0);cout.tie(0);*/\r\n    ll t;cin>>t;\r\n    while(t--)\r\n    {\r\n        string s;\r\n        cin>>s;\r\n        ll n=s.size();\r\n        ll a[n],v=0;\r\n        if(s.size()<=2)\r\n        {\r\n            ye\r\n        }\r\n        else\r\n        {\r\n            for(ll i=0;i<s.size();i++)\r\n            {\r\n                a[i]=s[i]-'A';\r\n                if(i>=2&&(a[i]!=a[i-1]+a[i-2])&&(a[i-1]+a[i-2])%26!=a[i])\r\n                {\r\n                    no\r\n                    v=1;\r\n                    break;\r\n                }\r\n            }\r\n            if(!v)ye\r\n        }\r\n    }\r\n}\r\n", "lang": "GNU C++14", "bug_code_uid": "700916fb5c4c3fcf455ce4f0380c0c13", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "ed7a059276b925eb6094c71396dc6fa5", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9515828677839852, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "/**\r\nauthor:  Bijoy Singh Rajput\r\n \" Nam Tho Sunahi Hoga \"\r\n**/\r\n#include <bits/stdc++.h>\r\nusing namespace std;\r\nint main()\r\n{\r\n    ios::sync_with_stdio(false);\r\n    //cin.tie(0);\r\n    string s;\r\n    cin>>s;\r\n    int arr[11];\r\n    for(int i=0; i<(s.size()); i++)\r\n    {\r\n        arr[i]=s[i]-65;\r\n    }\r\n    int k=0;\r\n    for(int i=0; i<(s.size()); i++)\r\n    {\r\n        if((arr[i]+arr[i+1])%26!=arr[i+2])\r\n        {\r\n            k=1;\r\n            cout<<\"NO\";\r\n            return 0;\r\n        }\r\n\r\n    }\r\n    cout<<\"YES\";\r\n}\r\n\r\n\r\n\r\n", "lang": "GNU C++14", "bug_code_uid": "fbc02e25a441bdddbbfcafe81c733577", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "aa0d6075f8624b6154b0e8ce0f6113f9", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.6355828220858896, "equal_cnt": 17, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 15, "fix_ops_cnt": 17, "bug_source_code": "#include<bits/stdc++.h>\r\nusing  namespace  std;\r\ntypedef long long ll;\r\nconst int mod=1e9+7;\r\nconst int N=1e5+5;\r\nint r[N];\r\nvoid solve(){\r\n    string s;\r\n    cin>>s;\r\n    cout<<\"YES\";\r\n}\r\nint main(){\r\n    int t;\r\n    t=1;\r\n//    cin>>t;\r\n    while(t--){\r\n        solve();\r\n    }\r\n}", "lang": "GNU C++14", "bug_code_uid": "0b175067b36815ffe91938cbd70235de", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "d556d5122ca1682eb6a18452440a2552", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9365853658536586, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "#include <bits/tsdc++.h>\n\nusing namespace std;\n\nsigned main() {\n    string s;\n    cin >> s;\n    int n = s.size();\n    for (int i = 3; i < n; i ++) {\n        if ((s[i-2] ^ 48) + (s[i-1] ^ 48) != (s[i] ^ 48)) {\n            puts(\"NO\");\n            return 0;\n        }\n    }\n    puts(\"YES\");\n    return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "3831e4e47955f73989e8bf88e0e300b6", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "cee72f8c54f26c5683b7abb01ef055e7", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9967845659163987, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include <bits/stdc++.h>\n\nusing namespace std;\n\nsigned main() {\n    string s;\n    cin >> s;\n    int n = s.size();\n    for (int i = 3; i < n; i ++) {\n        if (((s[i-2] - 65) + (s[i-1] - 65)) % 26 != (s[i] - 65)) {\n            puts(\"NO\");\n            return 0;\n        }\n    }\n    puts(\"YES\");\n    return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "01bf99ddd087e1d3796c342deca5daa1", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "cee72f8c54f26c5683b7abb01ef055e7", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.7215007215007215, "equal_cnt": 11, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 10, "bug_source_code": "#include <bits/stdc++.h>\r\nusing namespace std;\r\nint fib[114514];\r\nint main() {\r\n\tchar ch;\r\n\tint cnt = 0;\r\n\twhile (cin >> ch) {\r\n\t\tint y = ch - 65;\r\n\t\tfib[++cnt] = y;\r\n\t}\r\n\tfor (int i = 3; i <= cnt; i++) {\r\n\t\tif (fib[i] != fib[i - 1] + fib[i - 2]) {\r\n\t\t\tcout << \"NO\" << endl; return 0;\r\n\t\t}\r\n\t}\r\n\tcout << \"YES\";\r\n}", "lang": "GNU C++14", "bug_code_uid": "885bdb021d30a56bf73abb5a39042f45", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "c4855e96e14978edc5c6f45f94b6d9cb", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9779286926994907, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "// BY : VIDIT BHARDWAJ\r\n#include<bits/stdc++.h>\r\nusing namespace std;\r\n\r\n#define ff                  first\r\n#define ss                  second\r\n#define pb                  push_back\r\n#define popb                pop_back\r\n#define lb                  lower_bound\r\n#define ub                  upper_bound\r\n#define all(v)              (v).begin(),(v).end()\r\n#define int                 long long int\r\n#define tc(t)               int t; cin>>t; while(t--)\r\n#define pii                 pair<int,int>\r\n#define max_pq              priority_queue<int>\r\n#define min_pq              priority_queue<int,vector<int>, greater<int> >\r\n#define SPD_emergency       ios_base::sync_with_stdio(false);cin.tie(NULL);\r\n#define ps(x,y)             fixed<<setprecision(y)<<x \r\n#define setbits(x)          __builtin_popcountll(x)\r\n#define zerobits(x)         __builtin_ctzll(x)\r\n#define YES                 cout<<\"YES\"<<\"\\n\"\r\n#define NO                  cout<<\"NO\"<<\"\\n\"\r\n#define endl                \"\\n\"\r\n        \r\nconst int N=200010;\r\nconst long long mod=1000000007;\r\n// const long long mod=998244353;\r\nconst long long inf=1000000000000000000;\r\nconst long double pi=3.14159265358979323846264338;\r\n\r\n/*_______________________________________________________________________*/\r\n\r\nsigned main(){\r\n#ifndef ONLINE_JUDGE\r\n    freopen(\"input.txt\", \"r\", stdin);\r\n    freopen(\"output.txt\", \"w\", stdout);\r\n#endif\r\n    SPD_emergency\r\n    string str; cin>>str;\r\n    string ans;\r\n    map<int,char> ch;\r\n    for(int i=1;i<=26;i++){\r\n        char x=('A'+i-1);\r\n        ch[i]=x;\r\n    }\r\n\r\n    for(int i=2;i<str.size();i++){\r\n        int x=(str[i-1]-'A'+1),y=(str[i-2]-'A');\r\n        if(ch[(str[i-1]-'A')+(str[i-2]-'A')+1]!=str[i]){\r\n            NO;\r\n            return 0;\r\n        }\r\n    }\r\n\r\n    YES;\r\n\r\n    return 0;\r\n}\r\n/*\r\n\r\n*/", "lang": "GNU C++14", "bug_code_uid": "ce4c43d44239d84178d593b4af10ec91", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "d5f20741190a43600311ee5be1a5d500", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9935385784872672, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "/*                               _          __    __    \r\n                                / \\        |  \\  /  |\r\n                               / _ \\       | | \\/ | |\r\n                              / ___ \\      | |    | |\r\n                             /_/   \\_\\ ()  |_|    |_| ()\r\n                                                                                                            */\r\n#include<bits/stdc++.h>\r\nusing namespace std;\r\ntypedef long long int ll;\r\nconst int mod = 1e9+7;\r\n#define flash ios_base::sync_with_stdio(false); cin.tie(NULL)\r\n#define test ll t; cin>>t; for(;t--;)\r\n#define f1(a,b) for(ll i=a;i<b;i++)\r\n#define f2(a,b) for(ll j=a;j<b;j++)\r\n#define f3(b,a) for(ll i=b;i>=a;i--)\r\n#define f4(b,a) for(ll j=b;j>=a;j--)\r\n#define fi first\r\n#define se second\r\n#define all(a) a.begin(), a.end()\r\n#define pb push_back\r\n#define pob push_back\r\n#define el \"\\n\"\r\nint gcd(ll a, ll b){\r\n    if (b == 0)\r\n        return a;\r\n    return gcd(b, a % b);\r\n}\r\n \r\n       \r\n    \r\nint main()\r\n{\r\n        ll n,m,i,j,k,a,b,c;\r\n        string s;\r\n        for(i = 2; i < s.size(); i ++) \r\n        {\r\n\t\t    a = s[i - 2] - 'A';\r\n\t\t    b = s[i - 1] - 'A';\r\n\t\t    c = s[i] - 'A';\r\n\t\t    if((a + b) % 26 != c) {\r\n\t\t\t    cout << \"NO\" << endl;\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t}\r\n\tcout << \"YES\" << endl;\r\n\treturn 0;\r\n        \r\n}", "lang": "GNU C++14", "bug_code_uid": "09f6d07a790dd402a86fb645804ad8e9", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "9d61ffbcf64c949e2ec4b33f2df1cb6d", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9933184855233853, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include<bits/stdc++.h>\r\nusing namespace std;\r\nint main()\r\n{\r\n  string s;\r\n  cin>>s;\r\n  for(int i=2;i<s.size();i++)\r\n  {\r\n    if(s[i]-'A'==(s[i-1]-'A'+s[i-2]-'A')) continue;\r\n   cout<<\"NO\\n\"; return 0;\r\n}\r\ncout<<\"YES\\n\";\r\n}", "lang": "GNU C++14", "bug_code_uid": "6684de20170a08fe3771397967416568", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "4e62d8cc95b0d7c215c39289a5bef12d", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.23706896551724138, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "#include<iostream>\r\n\r\nusing namespace std;\r\n\r\nint main()\r\n{\r\n    string n;\r\n    cin>>n;\r\n    cout << \"YES\" <<endl;\r\n    return 0;\r\n}\r\n", "lang": "GNU C++14", "bug_code_uid": "61a3df331e688ebd75ad49db6c771a41", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "14a7079d9bf011e59a9ef517f848430e", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.5775429326287979, "equal_cnt": 79, "replace_cnt": 36, "delete_cnt": 41, "insert_cnt": 2, "fix_ops_cnt": 79, "bug_source_code": "/*\r\n\tOrz p_b_p_b\r\n\tOrz athousandsuns\r\n\tOrz \u82f9\u679c\u84dd17\r\n\tOrz watermoon\r\n\r\n\t\u6bcf\u4e2a\u5973\u5b69\u90fd\u662f\u4e00\u4e2a\u65e0\u6cea\u5929\u4f7f\uff0c\r\n\t\u5f53\u5929\u4f7f\u7231\u4e0a\u7537\u5b69\u4fbf\u6709\u4e86\u773c\u6cea\uff0c\r\n\t\u5929\u4f7f\u843d\u6cea\u5760\u843d\u51e1\u95f4\uff0c\r\n\t\u6240\u4ee5\u6bcf\u4e2a\u7537\u5b69\u90fd\u4e0d\u8be5\u8f9c\u8d1f\u4f60\u7684\u5973\u5b69\uff0c\r\n\t\u56e0\u4e3a\u5979\u66fe\u4e3a\u4e86\u653e\u5f03\u4e86\u6574\u4e2a\u5929\u5802\u3002\r\n\t\t\t\t\t\t--\u300a\u51e1\u4eba\u4fee\u4ed9\u4f20\u300b\r\n\r\n\t\u4ed6\u4e3a\u4e86\u5979\uff0c\r\n\t\u53ef\u4ee5\u4ed8\u51fa\u81ea\u5df1\u7684\u751f\u547d\uff0c\r\n\t\u81ea\u6740\u53d6\u9aa8\u3002\r\n\r\n\t\u5979\u4e3a\u4e86\u4ed6\uff0c\r\n\t\u53ef\u4ee5\u71c3\u70e7\u81ea\u5df1\u7684\u751f\u547d\uff0c\r\n\t\u732e\u796d\u9b42\u73af\u3002\r\n\t\t\t\t\t\t--\u300a\u6597\u7f57\u5927\u9646\u300b\r\n*/\r\n#include<bits/stdc++.h>\r\nnamespace pai{\r\n\t#define fi first\r\n\t#define se second\r\n\t#define pii pair<int,int>\r\n\t#define pll pair<ll,ll>\r\n\t#define psl pair<string,ll>\r\n\t#define pcc pair<char,char>\r\n\t#define mp(i,j) make_pair(i,j)\r\n}\r\nnamespace vec{\r\n\t#define vei vector<int>\r\n\t#define si size()\r\n\t#define em empty()\r\n\t#define pd(i) push_back(i)\r\n\t#define pb pop_back()\r\n}\r\nnamespace my_std{\r\n\tusing namespace std;\r\n\t#define ll long long\r\n\t#define ref(i,x,y) for(register int i=(x);i<=(y);i++)\r\n\t#define fer(i,x,y) for(register int i=(x);i>=(y);i--)\r\n\t#define il inline\r\n\t#define mpii map<int,int>\r\n\t#define mpib map<int,bool>\r\n\t#define mpplll map<pll,ll>\r\n\t#define mppccl map<pcc,ll>\r\n\t#define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2) ? EOF : *p1++)\r\n\tchar buf[1 << 21], *p1 = buf, *p2 = buf;\r\n\tinline ll read() {\r\n\t    char c = getchar();\r\n\t    ll x = 0;\r\n\t    for (; !isdigit(c); c = getchar()) ;\r\n\t    for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);\r\n\t    return x;\r\n\t}\r\n}\r\n\r\nusing namespace my_std;\r\nstring s;\r\nint main(){\r\n//\tcin.tie(0),cout.tie(0);\r\n//\tios::sync_with_stdio(false);\r\n//\twhile(getline(cin,s)) cout<<\"NO\\n\";\r\n//\tint n;\r\n//\tcin>>n;\r\n//\tcout<<n%10+n/10;\r\n\tint fib[114514]={0};\r\n\tchar ch;\r\n\tint cnt = 0;\r\n\twhile (cin >> ch) {\r\n\t\tint y = ch - 65;\r\n\t\tfib[++cnt] = y;\r\n\t}\r\n\tfor (int i = 3; i <= cnt; i++) {\r\n\t\tif (fib[i] != fib[i - 1] + fib[i - 2]) {\r\n\t\t\tcout << \"NO\" << endl; return 0;\r\n\t\t}\r\n\t}\r\n\tcout << \"YES\";\r\n}\r\n\r\n", "lang": "GNU C++14", "bug_code_uid": "8c0ce99bf91a903e68caac8fd8786147", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "c4fb8ffe00bc90cf50fb9387a2c79fe7", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.7370600414078675, "equal_cnt": 17, "replace_cnt": 9, "delete_cnt": 3, "insert_cnt": 5, "fix_ops_cnt": 17, "bug_source_code": "#include<bits/stdc++.h>\r\nusing namespace std;\r\nstring st;\r\nint main()\r\n{\r\n\tcin>>st;\r\n\tfor(int i=0; i+2<st.size(); i++)\r\n\t{\r\n\t\tif((st[i]-65)+(st[i+1]-65)!=(st[i+2]-65))\r\n\t\t{\r\n\t\t\tcout<<\"NO\";\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t}\r\n\tcout<<\"YES\";\r\n\treturn 0;\r\n}", "lang": "GNU C++14", "bug_code_uid": "da32c402a07c07ad415ad8ab60a8acfe", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "1dfb9ecece9977f8e48f467a8e7f4c6d", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.46440677966101696, "equal_cnt": 12, "replace_cnt": 10, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 12, "bug_source_code": "#include<bits/stdc++.h>\r\nusing namespace std;\r\nstring st;\r\nlong long a[1000];\r\nlong long k;\r\nbool p=true;\r\nint main()\r\n{\r\n\tcin>>st;\r\n\tfor(int i=0; i<st.size(); i++)a[++k]=st[i]-'A';\r\n\tfor(int i=3; i<=k; i++)\r\n\t{\r\n\t\tif(a[i]!=a[i-1]+a[i-2])\r\n\t\t{\r\n\t\t\tp=false;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\tcout<<(p==true?\"YES\":\"NO\");\r\n\treturn 0;\r\n}", "lang": "GNU C++14", "bug_code_uid": "e9c5ee9114f160e8878d8102307e8cd8", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "4cfc29bdcb3a3922582a8c0a9d6f5421", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9963768115942029, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include<iostream>\r\n#include<cstdio>\r\n#include<cstring>\r\nusing namespace std;\r\nchar s[100];\r\nint main() {\r\n\tscanf(\"%s\",s+1);\r\n\tfor(int i=3;i<=strlen(s);i++) {\r\n\t\tif(s[i]-'A'!=(s[i-1]-'A'+s[i-2]-'A')%26) {\r\n\t\t\tputs(\"NO\");\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t}\r\n\tputs(\"YES\");\r\n\treturn 0;\r\n}\r\n", "lang": "GNU C++14", "bug_code_uid": "46ca9f84c2b3860a57b0c1feed535706", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "43f7ecdece11f77e7adb8f5cda9c6e82", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.4682080924855491, "equal_cnt": 18, "replace_cnt": 11, "delete_cnt": 6, "insert_cnt": 1, "fix_ops_cnt": 18, "bug_source_code": "#include<bits/stdc++.h>\r\nusing namespace std;\r\nint main(){\r\n    string s;\r\n    cin>>s;\r\n    \r\n    int n = s.length();\r\n    vector<int>dp(n,0);\r\n    dp[0] = s[0]-'A';\r\n    dp[1] = s[1]-'A';\r\n    \r\n    bool temp = true;\r\n    for(int i = 2 ; i<n ; i++){\r\n        int p = s[i]-'A';\r\n       // cout<<dp[i-1]<<\" \"<<dp[i-2]<<\" \"<<temp<<endl;\r\n        if(p!=(dp[i-2]+dp[i-1])){\r\n            temp = false;\r\n            break;\r\n        }\r\n    }\r\n    if(temp)\r\n    cout<<\"YES\"<<endl;\r\n    else\r\n    cout<<\"NO\"<<endl;\r\n}", "lang": "GNU C++14", "bug_code_uid": "fa27ae01c79ffdb23cbdd7e6791198a9", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "4d7389dc28add34ae2b5b24731ff7c33", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8032581453634086, "equal_cnt": 10, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "#include<iostream>\r\n#include <bits/stdc++.h>\r\n#include <ext/pb_ds/assoc_container.hpp>\r\n#include <ext/pb_ds/tree_policy.hpp>\r\n#include <iterator>\r\nusing namespace __gnu_pbds;\r\n\r\n\r\n#define point complex<double>\r\n\r\nusing namespace std;\r\ntypedef tree<int, null_type,\r\n        less_equal<int>, rb_tree_tag,\r\n        tree_order_statistics_node_update>\r\n        ordered_set;\r\ntypedef long long ll;\r\ntypedef unsigned long long ull;\r\ntypedef long double ld;\r\nconst ll N = 2e5 + 10, mod = 1e9+7,inf=LONG_LONG_MAX/2;\r\nconst ld PI=acos(-1);\r\n\r\nint main ()\r\n{\r\n  /*  ios_base::sync_with_stdio(false);\r\n    cin.tie(0);\r\n    cout.tie(0);*/\r\n\r\n\r\nstring s;\r\ncin>>s;\r\ncout<<\"YES\";\r\n\r\n\r\n\r\n\r\n\r\n\r\n    return 0;\r\n\r\n}\r\n", "lang": "GNU C++14", "bug_code_uid": "9c04d90fb046d291071f33d3726e2c23", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "f232a02214b3029b7a4c7421a07669b9", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.8262849707221861, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#include<bits/stdc++.h>\r\nusing namespace std;\r\n#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);\r\n#define ll long long \r\n#define  pll pair<ll,ll>\r\n#define  vll vector<ll>\r\n#define vs vector<string>\r\n#define ff first\r\n#define ss second\r\n#define all(x) x.begin(),x.end()\r\n#define pb push_back\r\n#define ppb pop_back\r\n# define ln cout << \"\\n\" ;\r\n#define maxHeap priority_queue<ll>\r\n#define minHeap priority_queue <ll, vector<ll>, greater<ll> > \r\n#define MOD 1000000009\r\n#define MAX 2000000000000000000\r\n#define MAXN 1000006\r\n\r\nint main() \r\n{\r\n\tfastio\r\n    string s;\r\n    cin >> s;\r\n    cout << \"YES\"; \r\n\treturn 0;\r\n}", "lang": "GNU C++14", "bug_code_uid": "e3e8f599fd6e8a510a2b5d5878691103", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "4e3753ba60dc4a028634684bdd8f4c70", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.35228539576365664, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#include <bits/stdc++.h>\r\n\r\nusing namespace std;\r\n\r\nint main()\r\n{\r\n\t\r\n\tstring s;\r\n\tcin >> s;\r\n\t\r\n\tif(s.length() < 3)\r\n\t{\r\n\t\tcout << \"NO\\n\";\r\n\t}\r\n\telse\r\n\t{\r\n\t\tfor(int i=2;i<s.length();i++)\r\n\t\t{\r\n\t\t\tint sum = int(s[i-1])+int(s[i-2])-65;\r\n\t\t\t// cout<<int(s[i-1])<<\" \"<<int(s[i-2])<<\" \"<<char((sum%26)+'A')<<\"\\n\";\r\n\t\t\tif(s[i] != char((sum%26)+'A'))\r\n\t\t\t{\r\n\t\t\t\tcout<<\"NO\\n\";\r\n\t\t\t\treturn 0;\r\n\t\t\t}\r\n\t\t}\r\n\t\tcout<<\"YES\\n\";\r\n\t}\r\n\t\r\n\treturn 0;\r\n}", "lang": "GNU C++14", "bug_code_uid": "11b3e226bf986617cb4e7eb6230682db", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "68bacc90af4030d7e63c245969c99342", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9932735426008968, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include <bits/stdc++.h>\r\nusing namespace std;\r\n#define rep(i,a,n) for (int i=a;i<n;i++)\r\n#define per(i,a,n) for (int i=n-1;i>=a;i--)\r\n#define pb push_back\r\n#define mp make_pair\r\n#define all(x) (x).begin(),(x).end()\r\n#define fi first\r\n#define se second\r\n#define SZ(x) ((int)(x).size())\r\n#define fill(a, val) memset(a, val, sizeof(a))\r\ntypedef vector<int> VI;\r\ntypedef long long ll;\r\ntypedef pair<int,int> PII;\r\ntypedef double db;\r\nmt19937 mrand(random_device{}()); \r\nconst ll mod=1000000007;\r\nll gcd(ll a,ll b){\r\nif(b==0)\r\nreturn a;\r\n return gcd(b,a%b);\r\n}\r\nvoid sum(string s)\r\n{\r\nif(s.length()<=2){\r\ncout<<\"YES\";\r\nreturn;}\r\nfor(int i=2;s[i];i++)\r\n{\r\n   ll sm=s[i-2]-'A'  +s[i-1]-'A';\r\n  if(s[i]!=sm+65)\r\n  {\r\n      cout<<\"NO\";\r\n      return ;\r\n  }\r\n}\r\ncout<<\"YES\";\r\n}\r\nint main()\r\n{ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);\r\nstring a;\r\ncin>>a;\r\nsum(a);\r\n\r\nreturn 0;\r\n}", "lang": "GNU C++14", "bug_code_uid": "660de48d0bacef250323d0ff0a7aa444", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "acd5041cced472c7be95dc9117cac3e0", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9983922829581994, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include<iostream>\r\nusing namespace std;\r\n\r\n\r\n\r\nint main()\r\n{\r\n    \r\n    \r\n    string s;\r\n    \r\n    cin>>s;\r\n    \r\n    \r\n    int flag=0;\r\n    \r\n    int pre1=0,pre2=0;\r\n    \r\n    pre1=s[0]-'A';\r\n    \r\n    pre2=s[1]-'A';\r\n    \r\n    for(int i=2;i<s.length();i++)\r\n    {\r\n        int now=s[i]-'A';\r\n        \r\n        if((pre1+pre2)%26!=now)\r\n        {\r\n            flag=1;\r\n            \r\n            break;\r\n            \r\n        }\r\n        \r\n        pre1=pre2;\r\n        \r\n        pre2=now;\r\n        \r\n            \r\n    }\r\n  \r\n  \r\n  if(flag)\r\n  {\r\n      cout<<\"no\";\r\n      \r\n  }\r\n  else{cout<<\"yes\"};\r\n  \r\n    return 0;\r\n\r\n}\r\n", "lang": "GNU C++14", "bug_code_uid": "6055b61162502cc5eb9b810947dd6764", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "d519b643a2c0d48a43962d7c6ac16cc1", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.9980612640558356, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include<bits/stdc++.h>\r\n#include<iostream>\r\nusing namespace std;\r\n#define ll long long \r\n// #define MAX 1e9\r\n// const int MAX=100005;\r\nconst int mod=1000000007;\r\n#define MIN -1e9\r\n\r\nint dp[101][100004];\r\n\r\nbool isSquare(ll num)\r\n{\r\n    ll root = sqrt(num);\r\n    return (root * root) == num;\r\n}\r\nbool isCube(ll num)\r\n{\r\n    ll root = cbrt(num);\r\n    return (root * root * root) == num;\r\n}\r\nll countSC(ll N)\r\n{\r\n    ll count = 0;\r\n    for (ll i = 1; i <= N; i++) {\r\n \r\n        // If a number is perfect square,\r\n        if (isSquare(i))\r\n            count++;\r\n \r\n        // Else if the number is cube or not\r\n        else if (isCube(i))\r\n            count++;\r\n    }\r\n \r\n    return count;\r\n}\r\nvoid solve()\r\n{\r\n    string s;\r\n    cin>>s;\r\n    if(s.length()==1 )\r\n    {\r\n        cout<<\"YES\"<<endl;\r\n        return;\r\n    }\r\n    bool flag=true;\r\n    for(int i=2;i<s.length();i++)\r\n    {\r\n        int a=(int)s[i]-'A';\r\n        int b=(int)s[i-1]-'A';\r\n        int c=(int)s[i-2]-'A';\r\n        if(a!=b+c)\r\n        {\r\n            flag=false;\r\n            break;\r\n        }\r\n    }\r\n    if(flag)\r\n    {\r\n        cout<<\"YES\"<<endl;\r\n    }\r\n    else{\r\n        cout<<\"NO\"<<endl;\r\n    }\r\n\r\n\r\n}\r\n\r\n\r\nint main()\r\n{\r\n\tint t=1;\r\n\t// cin>>t;\r\n\t// memset(dp,-1,sizeof(dp));\r\n\twhile(t--)\r\n\t{\r\n\t\tsolve();\r\n\t}\t\r\n}", "lang": "GNU C++14", "bug_code_uid": "8fb03653d38dc78ff4481d5aa9181a9f", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "6fa8822ebb5942887df957f1c94ebafd", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.8687258687258688, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "#include<bits/stdc++.h>\nusing namespace std;\n#define ll long long\n\nint main(){\n\tios_base::sync_with_stdio(false); cin.tie(NULL);\n\t#ifndef ONLINE_JUDGE\n\t\tfreopen(\"input.txt\",\"r\",stdin);\n\t\tfreopen(\"output.txt\",\"w\",stdout);\n\t#endif\n\n\tint t;\n\tcin>>t;\n\twhile(t--){\n\t\tstring s;\n\t\tcin>>s;\n\t\tif(s.size()<=2){\n\t\t\tcout<<\"YES\\n\";\n\t\t\tcontinue;\n\t\t}\n\n\t\tbool ok=true;\n\t\tfor(int i=2;i<s.size();i++){\n\t\t\tif(((s[i-1]-'A')+(s[i-2]-'A'))%26==(s[i]-'A'))\n\t\t\t\tcontinue;\n\t\t\telse{\n\t\t\t\tok=false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tok?cout<<\"YES\\n\":cout<<\"NO\\n\";\n\t}\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "24a0ef6bda1f4e52e031ea70d1683418", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "495cdfddaab71c5183bc047d40258bf0", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9904240766073872, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include<bits/stdc++.h>\r\nusing namespace std;\r\n \r\nint main() {\r\n\tios_base::sync_with_stdio(0);\r\n\tcin.tie(0);\r\n\tstring s;\r\n\tcin >> s;\r\n\tif(s.size() < 3) {\r\n\t    cout << \"YES\";\r\n\t    return 0;\r\n\t}\r\n\tfor(int i = 2; i < s.size(); i++) {\r\n\t    if(s[i] - 'A' != s[i-1] + s[i-2] - 'A' - 'A') {\r\n\t        cout << \"NO\";\r\n\t        return 0;\r\n\t    }\r\n\t}\r\n\tcout << \"YES\";\r\n}", "lang": "GNU C++14", "bug_code_uid": "6c58c012808c311c82708203e87e38be", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "a004a32a1441a9785abf5a6701fd683f", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.990166737922189, "equal_cnt": 11, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 5, "fix_ops_cnt": 10, "bug_source_code": "#include <bits/stdc++.h>\r\nusing namespace std;\r\n\r\n#define MAX LLONG_MAX\r\n#define MIN LLONG_MIN\r\n#define M 1000000007\r\n#define MM 998244353\r\n#define rep(i, j, k) for (ll i = j; i < k; i++)\r\n#define repr(i, j, k) for (ll i = j; i >= k; i--)\r\n#define repi(i, j, k, l) for (ll i = j; i < k; i += l)\r\n#define pb push_back\r\n#define ppb pop_back\r\n#define mem0(a) memset(a, 0, sizeof(a))\r\n#define mem1(a) memset(a, -1, sizeof(a))\r\n#define mp make_pair\r\n#define pll pair<ll,ll>\r\n#define out(a) for(auto x: a) cout<<x<<\" \"; cout<<endl;\r\n#define all(a) a.begin(),a.end()\r\n#define vpll vector<pll>\r\ntypedef long long ll;\r\ntypedef vector<long long> vll;\r\ntypedef vector<char> vc;\r\n\r\n\r\nvoid solve() {\r\n    string s;\r\n    cin>>s;\r\n    bool flag=1;\r\n    rep(i,2,(ll)s.size()){\r\n        if(  s[i]!=((s[i-1]+s[i-2])%65)+65) flag=0;\r\n    }\r\n\r\n    if(flag)cout<<\"YES\"<<endl;\r\n    else cout<<\"NO\"<<endl;\r\n}\r\n\r\nint main() {\r\n    ios_base::sync_with_stdio(false);\r\n    cin.tie(0);\r\n    cout.tie(0);\r\n#ifndef ONLINE_JUDGE\r\n    freopen(\"input.txt\", \"r\", stdin);\r\n    freopen(\"output.txt\", \"w\", stdout);\r\n#endif\r\n\r\n    ll t = 1;\r\n   // cin >> t;\r\n    while (t--) solve();\r\n\r\n    return 0;\r\n}", "lang": "GNU C++14", "bug_code_uid": "c6fed4a086b4194020cae0c45f021e97", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "09927efc6296569634797f3a7ade7350", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9916963226571768, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include <iostream>\r\nusing namespace std;\r\n#include<bits/stdc++.h>\r\n#define int long long\r\nint32_t main() {\r\n    string s;\r\n    cin>>s;\r\n    int n=s.size();\r\n    int flag=0;\r\n    for(int i=2;i<n;i++){\r\n        if((s[i]-'A')==(s[i-1]-'A')+(s[i-2]-'A'))\r\n        continue;\r\n        else {flag=1;\r\n        break;}\r\n    }\r\n    if(flag) cout<<\"NO\"<<endl;\r\n    else cout<<\"YES\"<<endl;\r\n\t// your code goes here\r\n\treturn 0;\r\n}", "lang": "GNU C++14", "bug_code_uid": "0edc0b614a441c6278a2278c7b621a26", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "938294c5f5b8433f626282254fdb4c95", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.2422279792746114, "equal_cnt": 12, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "#include <bits/stdc++.h>\nusing namespace std;\n\nvoid Bhupathi07() {\n\tios_base::sync_with_stdio(false);\n\tcin.tie(NULL);\n#ifndef ONLINE_JUDGE\n\tfreopen(\"input.txt\", \"r\", stdin);\n\tfreopen(\"output.txt\", \"w\", stdout);\n#endif\n}\n\nsigned main() {\n\tBhupathi07();\n\tstring s; cin >> s;\n\tcout << \"YES\" || \"NO\";\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "4ba68425050838306d3055bf1cf346bb", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "bac002eaa78736fae94df69b4de84cb8", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9873834339001646, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include <bits/stdc++.h>\r\nusing namespace std;\r\n#define fast() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)\r\n#define int long long\r\n#define pb push_back\r\n#define vi vector<int>\r\n#define size(x) (int)((x).size())\r\n#define memf(a) memset(a,false,sizeof(a))\r\n#define mem(val, var) memset(var,val,sizeof(var))\r\n#define F first\r\n#define S second\r\n#define all(v) v.begin(),v.end()\r\n#define rep(i,a,b) for(int i=a;i<b;i++)\r\n#define fr(i, n) for(int i=0;i<n;i++)\r\n#define tr(v) for(auto it=v.begin();it!=v.end();it = next(it))\r\nconst int inf = 1e16;\r\nconst int N = 1e5 + 1;\r\nconst int mod = 1e9 + 7;\r\n\r\nvoid solve() {\r\n\tstring s; cin >> s;\r\n\tfor (int i = 2; i < size(s); i++)\r\n\t{\r\n\t\tchar sb = (char)(s[i - 1] + s[i - 2]);\r\n\t\tif (sb != s[i])\r\n\t\t{\r\n\t\t\tcout << \"NO\\n\";\r\n\t\t\treturn;\r\n\t\t}\r\n\t}\r\n\tcout << \"YES\\n\";\r\n}\r\n\r\nsigned main() {\r\n\tfast();\r\n\tint t = 1; // cin >> t;\r\n\twhile (t--) solve();\r\n\treturn 0;\r\n}", "lang": "GNU C++14", "bug_code_uid": "e9d61416a64a193226926963981611cb", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "b2cd6d28731f2d08ebfac20f424d3d49", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9980966882375333, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "/* AUTHOR :  SHIVANK JAIN */\r\n#include<bits/stdc++.h>\r\n\r\n#define fast ios_base::sync_with_stdio(false)\r\n#define itt cin.tie(0)\r\n#define now cout.tie(0)\r\n     \r\nusing namespace std;\r\n     \r\n#define ll long long\r\n#define li long int\r\n     \r\n#define pb push_back\r\n#define rep(i,a,n) for(int i=a;i<n;i++)\r\n#define reprev(i,n,a) for(int i=n;i>=a;i--)\r\n#define endl \"\\n\"\r\n     \r\n#define vi vector<int>\r\n#define vll vector<ll>\r\n#define vpi vector< pair<int , int> >\r\n#define mapi map<int , int>\r\n#define mapll map<ll ,ll >\r\n#define seti set<int> \r\n\r\n#define fr first\r\n#define se second\r\n#define lb lower_bound\r\n#define ub upper_bound\r\n#define pb push_back\r\n#define mp make_pair\r\n#define sort(v) sort(v.begin() , v.end())\r\n     \r\n#define BIG 1000000007\r\nint gcd(int a, int b) \r\n{ // builtin function __gcd(a,b)\r\n    if (a == 0) \r\n      return b; \r\n    return gcd(b % a, a); \r\n}\r\n \r\nint main(){\r\n     \r\n   fast;itt;now;\r\n        \r\n   string s;  cin>>s;\r\n    map<char ,int> m;\r\n    char cc = 'A';\r\n    \r\n\tfor(int i = 0 ; i < 26 ; i++){\r\n    \tm.insert({cc,i});\r\n    \tcc+=1;\r\n\t}\r\n\tint k = 0;\r\n\tfor(int i = 2 ; i < s.size()  ; i++){\r\n\t\tint a = m[s[i-2]] , b = m[s[i-1]] ; \r\n\t\t\r\n\t\tif(m[s[i]] != a+b){\r\n\t\t k = 1;\r\n\t\t break; \r\n\t\t}\r\n\t\t \r\n\t}\r\n\t\r\n\tif(k == 0)\r\n\t cout<<\"YES\"<<endl;\r\n\telse\r\n\t cout<<\"NO\"<<endl;  \t \r\n return 0;\t\r\n}\r\n", "lang": "GNU C++14", "bug_code_uid": "fb4be9382cbf4b6d88f3e17f65769c06", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "b5947a055fd69186e4cf82877b7dd2fb", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9702517162471396, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "#include<iostream>\r\n#include<string>\r\nusing namespace std;\r\nint main()\r\n{\r\n\tstring s;\r\n\tcin >> s;\r\n\tint n = s.length();\r\n\tint* a = new int[n];\r\n\tfor (int i = 0; i < n; i++)\r\n\t{\r\n\t\ta[i] = int(s[i] - 'A');\r\n\t\t\r\n\t}\r\n\tint flag = 1;\r\n\tfor (int i = 0; i < n-2; i++)\r\n\t{\r\n\t\tif (a[i] + a[i + 1] != a[i + 2])\r\n\t\t{\r\n\t\t\tflag = 0;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\tif (flag) cout << \"YES\" << endl;\r\n\telse cout << \"NO\" << endl;\r\n\r\n\r\n\r\n\r\n\treturn 0;\r\n}", "lang": "MS C++ 2017", "bug_code_uid": "a5131754dc23fb2705beb89435c1353e", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "d9aea2d1a7ecff759a773edd4e57389b", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9868073878627969, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "#include <iostream>\r\n#include <cstdio>\r\n#include <cstring>\r\n\r\nusing namespace std;\r\n\r\n\r\nint main()\r\n{\r\n\tchar str[15];\r\n\tscanf(\"%s\",str);\r\n\tbool flag=true;\r\n\tint a=str[0]-'A';\r\n\tint b=str[1]-'A';\r\n\tint len=strlen(str);\r\n\r\n\tfor(int i=2;i<len;i++)\r\n\t{\r\n\t\tint c=str[i]-'A';\r\n\t\tif(c!=(a+b)%26)\r\n\t\t{\r\n\t\t\tflag=false;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\ta=b;\r\n\t\tb=c;\r\n\t}\r\n\tif(flag)\r\n\t  puts(\"YES\");\r\n\telse \r\n\t{\r\n\t\tfor(int i=1,j=len-1;i<j;)\r\n\t\t{\r\n\t\t\tif(str[i]==str[j]) i++,j--;\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tputs(\"NO\");\r\n\t\t\t\tflag=true;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(flag) puts(\"YES\");\r\n\t}\r\n\r\n\r\n    return 0;\r\n}", "lang": "MS C++ 2017", "bug_code_uid": "9e57f97d0400c1cc74f732411a90c729", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "ff67a9e0d6701338d445f2bf2aa8ae67", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9979140592407175, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include <iostream>\r\n#include <fstream>\r\n#include <vector>\r\n#include <algorithm>\r\n#include <set>\r\n#include <string>\r\n#include <iomanip>\r\n#include <map>\r\n#include <queue>\r\n#include <ctime>\r\n#include <cmath>\r\n#define ll long long\r\n#define vll vector<int>\r\n#define vll vector<long long>\r\n#define pi pair<int,int>\r\n#define pll pair<ll,ll>\r\nusing namespace std;\r\n// \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\r\n//\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\r\n//\u2588\u2588\u2551     \u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2551  \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\r\n//\u2588\u2588\u2551     \u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2551  \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255d  \u2588\u2588\u2554\u2550\u2550\u255d  \u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u255d  \u255a\u2550\u2550\u2550\u2550\u2588\u2588\u2551\r\n//\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551     \u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2551  \u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\r\n// \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d      \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u255d  \u255a\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\r\n            \r\nint main()\r\n{\r\n\tstring s;\r\n\tcin >> s;\r\n\tvector<int> d(s.length());\r\n\tfor (int i = 0; i < s.length(); ++i) {\r\n\t\td[i] = s[i] - 'A';\r\n\t}\r\n\tbool ans = true;\r\n\tfor (int i = 2; i < d.size(); ++i) {\r\n\t\tif (d[i - 2] + d[i - 1]!=d[i]) ans = false;\r\n\t}\r\n\tif (ans) cout << \"YES\\n\";\r\n\telse cout << \"NO\\n\";\r\n\treturn 0;\r\n}", "lang": "MS C++ 2017", "bug_code_uid": "7815ac1d433e045b4fd3eedf7685c85e", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "c5232c75a6befd489a279aef9599676a", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9773519163763066, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "#define _CRT_SECURE_NO_WARNINGS\r\n#include <stdio.h>\r\n#include <string.h>\r\n\r\nint main()\r\n{\r\n    // char s[111];\r\n    // scanf(\"%s\", s);\r\n    // int l = strlen(s);\r\n    // int a = 0;\r\n    // for (int i = 0; i < l; i++) {\r\n    //     a += s[i] - '0';\r\n    // }\r\n    // printf(\"%i\", a);\r\n    char s[111];\r\n    int l = strlen(s);\r\n    for (int i = 0; i < l; i++) {\r\n        s[i] -= 'A';\r\n    }\r\n    int stat = 1;\r\n    for (int i = 2; i < l; i++) {\r\n        if (s[i] != s[i - 1] + s[i - 2])\r\n            stat = 0;\r\n    }\r\n    printf(\"%s\", stat ? \"YES\" : \"NO\");\r\n}\r\n\r\n", "lang": "MS C++ 2017", "bug_code_uid": "938552e2ee283022dd761e7cf6ac7cca", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "23a51c8d96cca816f5db30bf23f1e6d9", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9802890932982917, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "#include <algorithm>\r\n#include <iostream>\r\n#include <string>\r\n\r\nusing namespace std;\r\n\r\nstring a;\r\n\r\nint main()\r\n{\r\n    while (cin >> a)\r\n    {\r\n        int f = 1;\r\n        for(int i = 2; i < a.length(); ++i)\r\n        {\r\n        \tif(a[i] != (a[i-1] + a[i-2]) % 26){\r\n        \t\tf=0;break;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(f) cout << \"YES\\n\";\r\n\t\telse cout << \"NO\\n\";\r\n    }\r\n    return 0;\r\n}", "lang": "GNU C++11", "bug_code_uid": "92c81c98f7a5746cbfb6cda05c64b94e", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "3fd5a4da69eb8a75ba54935b68f5def4", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.28045574057843997, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "#include <iostream>\n\nusing namespace std;\n\nint main() {\n  set<pair<int,int>> se;\n\n  string s;\n  cin >> s;\n  // if (s.length() <= 2) {\n  //   cout << \"NO\" << endl;\n  //   return 0;\n  // }\n\n  bool is_sum = true, is_prod = true;\n  for (int i = 0; i < s.length() - 2; i++) {\n    if ((int(s[i] - 'A') + int(s[i+1] - 'A')) % 26 != int(s[i+2] - 'A')) {\n      is_sum = false;\n    }\n    // if ((int(s[i] - 'A') * int(s[i+1] - 'A')) % 26 != int(s[i+2] - 'A')) {\n    //   is_prod = false;\n    // }\n  }\n  if (is_sum) {\n    cout << \"YES\" << endl;\n  } else {\n    cout << \"NO\" << endl;\n  }\n  return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "f150479105a2180bbb53e9ed4f1b1062", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "9c61f9b983f78f1b4f16170cc0016bef", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.4673913043478261, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "#include <bits/stdc++.h>\r\nusing namespace std;\r\n\r\nint main()\r\n{\r\n    string s;\r\n    cin>>s;\r\n    cout<<\"YES\";\r\n}\r\n", "lang": "GNU C++11", "bug_code_uid": "b26be7916d7bc4cd4fb2f3c62a6e9d22", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "bbe257269b80878d10548d0220e56305", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.29906542056074764, "equal_cnt": 15, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 14, "bug_source_code": "#include <bits/stdc++.h>\r\nusing namespace std;\r\n#define ll long long\r\n#define pb push_back\r\n#define qc ios::sync_with_stdio(0)\r\nint f[11];\r\n\r\nint main() {\r\n\tqc, cin.tie(0);\r\n\tstring s;\r\n\tcin >> s;\r\n\tfor (int i = 0; i < s.length(); i++) {\r\n\t\tf[i + 1] = s[i] - 'A';\r\n\t}\r\n\tfor (int i = 3; i <= s.length(); i++) {\r\n\t\tint sum = f[i - 1] + f[i - 2];\r\n\t\twhile (sum > 90) {\r\n\t\t\tsum -= 65;\r\n\t\t}\r\n\t\tif (f[i] != sum) {\r\n\t\t\tcout << \"NO\";\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t}\r\n\tcout << \"YES\";\r\n}", "lang": "GNU C++11", "bug_code_uid": "ecba1d55c5d4c1e623ae8e0d3bd551fe", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "16ca310bbc18374ca794e155d008ddf4", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9877913429522752, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "#include <iostream>\n#include <vector>\n#include <string>\n#include <unordered_map>\n#include <math.h>\n\nusing namespace std;\nint main(){\n   string word;\n   cin >> word;\n   if(word.length() < 2){\n        cout << \"NO\" << endl;\n        return 0;\n   }\n\n   for(int i =2; i < word.length();i++){\n       if((word[i-1] -65) + (word[i-2] -65) != (word[i] - 65)){\n            cout << \"NO\" << endl;\n            return 0;\n       }\n   }\n   cout << \"YES\" << endl;\n}", "lang": "GNU C++11", "bug_code_uid": "718a183af630274db1892b6137826533", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "38dddef89154c22fc040a25e9315d3f8", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9819219790675547, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "#include<bits/stdc++.h>\r\nusing namespace std;\r\nvoid solve()\r\n{\r\nstring s;\r\nint flag=0;\r\ncin>>s;\r\nint n=s.size();\r\nif(n==1){\r\n    cout<<\"YES\"<<endl;\r\n}\r\nint f[n];\r\nf[0]=s[0]-'A';\r\nf[1]=s[1]-'A';\r\nfor(int i=2;i<n;i++){\r\n    if((s[i]-'A')!=(f[i-1]+f[i-2]))\r\n    {\r\n        cout<<\"NO\"<<endl;\r\n        flag=1;\r\n        break;\r\n    }\r\n    f[i]=f[i-1]+f[i-2];\r\n}\r\nif(flag!=1)\r\ncout<<\"YES\"<<endl;\r\n\r\n\r\n\r\n\r\n}\r\nint main()\r\n{\r\n    int t=1;\r\n    //cin >> t;\r\n    while (t--)\r\n    {\r\n        solve();\r\n    }\r\n\r\n    return 0;\r\n}\r\n", "lang": "GNU C++11", "bug_code_uid": "c32634a5552bb46a8385cc4f05a6acdd", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "f8aa38b3aadfa3a799a1c7c70febac8b", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9982046678635548, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include<bits/stdc++.h>\r\nusing namespace std;\r\nstring a;\r\nbool flag=true;\r\nint main()\r\n{\r\ncin>>a;\r\nint len=a.length();\r\nfor(int i=2;i<=len;i++)\r\n{\r\n\tif(a[i]-'A'!=(a[i-1]-'A'+a[i-2]-'A')%26)\r\n\t{\r\n\t\tflag=false;\r\n\t\tbreak;\r\n\t}\r\n}\r\nif(flag)cout<<\"YES\";\r\nelse cout<<\"NO\";\r\nreturn 0;\r\n}", "lang": "GNU C++11", "bug_code_uid": "c19fb8e2416cd004589202565d9d4ec2", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "10431d675197da75b771c453a41a88f7", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.6274509803921569, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "#include <cstdio>\r\n#include <cstring>\r\nchar ch[10005]; \r\nint main () {\r\n\tscanf (\"%s\", ch + 1);\r\n\tint n = strlen (ch + 1);\r\n\tint Ans = 0;\r\n\tfor (int i = 1; i <= n; i++) Ans += ch[i];\r\n\tprintf (\"YES\\n\");\r\n\tprintf (\"NO\");\r\n\treturn 0;\r\n} ", "lang": "GNU C++11", "bug_code_uid": "c264a215d08e6f8ea6ac310916631c6a", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "75979b756dc067d1bd33ff1d5b6a6207", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.5209981740718198, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include <iostream>\r\n#include <string>\r\n#include <vector>\r\n#include <algorithm>\r\n#include <map>\r\n#include <unordered_map>\r\n#include <stack>\r\n#include <queue>\r\n#include <set>\r\n#include <cmath>\r\nusing namespace std;\r\ntypedef long long LL;\r\nint main () {\r\n    string a;\r\n    cin >> a;\r\n    int n = a.length();\r\n    if (n <= 2) {\r\n        cout << \"NO\" << endl;\r\n        return 0;\r\n    }\r\n    int q[n] = {0};\r\n    for (int i = 0 ; i < n ; i ++) q[i] = a[i] - 'A';\r\n    for (int i = 0 ; i < n ; i ++) cout << q[i] << \" \";cout << endl;\r\n    int flag = 1;\r\n    for (int i = 2 ; i < n ; i ++) {\r\n        if (q[i] != (q[i - 1] + q[i - 2]) % 26) {\r\n            flag = 0;\r\n            break;\r\n        }\r\n    }\r\n    if (flag) {\r\n        cout << \"YES\" << endl;\r\n        return 0;\r\n    }\r\n    cout << \"NO\" << endl;\r\n    return 0;\r\n}", "lang": "GNU C++11", "bug_code_uid": "0229b2aeb638dd97b5d9cbbcf2923f27", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "088eea71c45269980e7d7517f1289a30", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"}
{"similarity_score": 0.38306451612903225, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "#include<bits/stdc++.h>\r\nusing namespace std;\r\n\r\nint main(){\r\n    srand(NULL);\r\n    if(rand()%2) printf(\"YES\\n\");\r\n    else printf(\"NO\\n\");\r\n}\r\n", "lang": "GNU C++11", "bug_code_uid": "b6cc2393463bebaedc6c3f5d8595f13e", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "beae39e294ac431cbe73df58ec3cbb5d", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9774011299435028, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 4, "bug_source_code": "#include <bits/stdc++.h>\r\nusing namespace std;\r\nint main()\r\n{\r\n\tstring s;\r\n\tgetline(cin,s);\r\n\tif(s.size()<3)\r\n\t{\r\n\t\tcout<<\"YES\"<<endl;\r\n\t\treturn 0;\r\n\t}\r\n\tfor(int i=2;i<=s.size()-1;i++)\r\n\t{\r\n\t\tif(s[i]!=(s[i-1]+s[i-2]-'A'))\r\n\t\t{\r\n\t\t\tcout<<\"NO\"<<endl;\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t}\r\n\tcout<<\"YES\"<<endl;\r\n}\r\n//H E L P\r\n//72 69 76 80\r\n// A I D\r\n// 65 73 68\r\n", "lang": "GNU C++11", "bug_code_uid": "09978ed3f1bf00175d02c76dfc7141ef", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "cc0cca69e39b7202e509c6c098283c52", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9902912621359223, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include <iostream>\r\n\r\nusing namespace std;\r\n\r\nint main()\r\n{\r\n    string s;\r\n    cin >> s;\r\n    int len = s.length();\r\n    for(int i = 2; i < len; ++ i)\r\n    {\r\n        if(s[i] - 'A' != (s[i - 2] - 'A') + (s[i - 1] - 'A'))\r\n        {\r\n            cout << \"NO\" << endl;\r\n            return 0;\r\n        }\r\n    }\r\n    cout << \"YES\" << endl;\r\n    return 0;\r\n}\r\n", "lang": "GNU C++11", "bug_code_uid": "81c18957effa8da076843bc4296f0b14", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "926affff3e0514e032dc8d1cfa26ecd8", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9969418960244648, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include <bits/stdc++.h>\r\n\r\nusing namespace std;\r\n\r\n#define endl \"\\n\"\r\n#define pb push_back\r\n#define speedup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)\r\ntypedef long long ll;\r\ntypedef map<long long, long long> mll;\r\ntypedef pair<long long,long long> pll;\r\ntypedef vector<long long> vll;\r\ntypedef set<long long> sll;\r\ntypedef long double ld;\r\ntypedef string st;\r\n\r\n//---------------------------------------|\r\n\r\nconst int DIM=100005;\r\n\r\nll n,c,t,sw1,sw2,k;\r\nst a,b,s;\r\npll res;\r\n\r\n//---------------------------------------|\r\n\r\nint main() {\r\n    speedup;\r\n\r\n    cin >> s;\r\n    n=s.size();\r\n\r\n    for (int i=2;i<n;i++)\r\n    {\r\n        if (s[i]-'A' != s[i-1]-'A'+s[i-2]-'A')\r\n        {\r\n            cout << \"NO\" << endl;\r\n            return 0;\r\n        }\r\n    }\r\n    cout << \"YES\" << endl;\r\n\r\n    return 0;\r\n}\r\n", "lang": "GNU C++11", "bug_code_uid": "b705555a87b93e1b3c54b305661245ad", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "9fe16117e2d9dcf8bfbc06e67a43cc28", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.6960227272727273, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include<bits/stdc++.h>\ntypedef long long ll;\nusing namespace std;\n\n#define N 200000\n#define MOD 1000000007\n#define PR pair<int,int>\n\nint main(){\n\tios_base::sync_with_stdio(false);\n\tcin.tie(NULL);\n\n\tstring s;\n\tcin >> s;\n\tcout << \"YES\" << endl;\n}", "lang": "GNU C++11", "bug_code_uid": "488550951281707b59b49f32030888d4", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "14c613fe909cae8d09c8fc1ed221d4bc", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9842931937172775, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#define _CRT_SECURE_NO_WARNINGS\r\n#include<bits/stdc++.h>\r\nusing namespace std;\r\nstring s;\r\nint a[110];\r\nsigned main() {\r\n\tint sum = 0;\r\n\tfor (int i = 0; i < s.length(); i++)a[i] = s[i] - 'A';\r\n\tint ff = 0;\r\n\tfor (int i = 2; i < s.length(); i++) {\r\n\t\tif (a[i] != (a[i - 2] + a[i - 1]) % 26)ff = 1;\r\n\t}\r\n\tif (ff)cout << \"NO\" << endl;\r\n\telse cout << \"YES\" << endl;\r\n\treturn 0;\r\n}", "lang": "GNU C++11", "bug_code_uid": "a095f5d5e36a97523e796b5ec2909c52", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "e9ddc494c172a953b310d5179cc4ec61", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9832935560859188, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "#include<bits/stdc++.h>\r\n#define maxn 100004 \r\n#define inf 0x3f3f3f3f\r\n#define mod 1000000007\r\nusing namespace std;\r\ntypedef long long ll;\r\nll a[maxn]={0},c[maxn]={0}; \r\nint main(){\r\n\tll n,m;\r\n\tstring s;\r\n\tcin>>s;\r\n\tif(s.length()>10)printf(\"NO\\n\");\r\n\telse {\r\n\t\tfor(ll i=2;i<s.length();i++){\r\n\t\t\tif(s[i]!=(s[i-1]+s[i-2]%26)){\r\n\t\t\t\tprintf(\"NO\\n\");\r\n\t\t\t\treturn 0;\r\n\t\t\t}\r\n\t\t}\r\n\t\tprintf(\"YES\\n\");\r\n\t}\r\n    return 0;\r\n}", "lang": "GNU C++11", "bug_code_uid": "fb62f427c63fb7072d571b078abfdecd", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "a6889d459236042158830948452a6201", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.8734939759036144, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include <bits/stdc++.h>\r\nusing namespace std;\r\nint fib[114514];\r\nint main() {\r\n\tchar ch;\r\n\tint cnt = 0;\r\n\twhile (cin >> ch) {\r\n\t\tint y = ch - 65;\r\n\t\tfib[++cnt] = y;\r\n\t}\r\n\tfor (int i = 3; i <= cnt; i++) {\r\n\t\tif (fib[i] != fib[i - 1] + fib[i - 2]) {\r\n\t\t\tcout << \"NO\" << endl; return 0;\r\n\t\t}\r\n\t}\r\n\tcout << \"YES\";\r\n}", "lang": "GNU C++11", "bug_code_uid": "cbdf3b2bd0aa578f0fa737b64f747639", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "6cea7e1e3618026cc9ca98894a585c41", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}
{"similarity_score": 0.9904397705544933, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include<bits/stdc++.h>\r\nusing namespace std;\r\nchar a[101]; \r\nint main()\r\n{\r\n\tcin>>a;\r\n\tint len=strlen(a);\r\n\tfor(int i=0+2;i<len;i++)\r\n\t{\r\n\t\tif(a[i]-'A'!=a[i-1]-'A'+a[i-2]-'A')\r\n\t\t{\r\n\t\t\tprintf(\"NO\\n\");\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t}\r\n\tprintf(\"YES\\n\");\r\n\treturn 0;\r\n} ", "lang": "GNU C++11", "bug_code_uid": "a5479cd25795446b15e3ba9b69bb91f2", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "02f5309e72c70505c81308e631ee6567", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9920760697305864, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include<iostream>\r\n#include<cstdio>\r\nusing namespace std;\r\nconst int mxn=20;\r\nint i,j,k;\r\nint x,y,z,xx,xy,xz,yx,yy,yz;\r\nint m,n,p;\r\nchar a[mxn];\r\nint main(){\r\n\tscanf(\"%s\",a);\r\n\tfor(i=2;a[i];i++){\r\n\t\tif(a[i]-'A'!=a[i-1]-'A'+a[i-2]-'A'){\r\n\t\t\tprintf(\"NO\\n\");\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t}\r\n\tprintf(\"YES\\n\");\r\n\treturn 0;\r\n}", "lang": "GNU C++11", "bug_code_uid": "bb6c537699c8f397b14f58676a3feb59", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "1d0564560121ddcd962e965bba997620", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.9798850574712644, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "#include <iostream>\r\n#include <algorithm>\r\n#include <string>\r\n#include <vector>\r\nusing namespace std;\r\nint main()  {\r\n    string s;\r\n    cin>>s;\r\n    int l= s.length();\r\n    bool right= true;\r\n    for(int i=0; i+2<l && right; ++i)\r\n        right= ((s[i]-'A')+(s[i+1]-'A')==(s[i+2]-'A'));\r\n    cout<< (right?\"YES\":\"NO\")<<endl;\r\n    return 0;\r\n}", "lang": "GNU C++11", "bug_code_uid": "643ed35fb56adc992d62a0da08cf0eb1", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "703d4930ee9374abf7e158ae4d62054d", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"}
{"similarity_score": 0.8056253139126067, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "#include<cstdio>\r\n#include<cstring>\r\n#include<cstdlib>\r\n#include<cmath>\r\n#include<iostream>\r\n#include<algorithm>\r\n#include<map>\r\n#include<set>\r\n#include<stack>\r\n#include<queue>\r\n#include<vector>\r\n#include <iomanip>\r\n#define FAST std::ios::sync_with_stdio(false);\r\n#define ll long long int\r\n#define MAXN 1005\r\n#define PI 3.1415927\r\n/*\r\ncout.setf(ios::fixed);\r\ncout << fixed << setprecision(?) << ? << endl;\r\n*/\r\nusing namespace std;\r\n//\u00d7\u00ee\u00b4\u00f3\u00b9\u00ab\u00d2\u00f2\u00ca\u00fd \r\nint gcd(int a,int b){\r\n\tint i;\r\n\twhile(a%b){\r\n\t\ti=a%b;\r\n\t\ta=b;\r\n\t\tb=i;\r\n\t}\r\n\treturn b;\r\n}\r\n//\u00d7\u00ee\u00d0\u00a1\u00b9\u00ab\u00b1\u00b6\u00ca\u00fd\r\nint gbd(int a,int b){\r\n\treturn a/gcd(a,b)*b;\r\n}\r\nint get_num(int n) {\r\n    int sum = 0;\r\n    while (n) {\r\n        sum += n % 10;\r\n        n /= 10;\r\n    }\r\n    return sum;\r\n}                                                                \r\nvoid s(){\r\n    char s[100];\r\n\t cin >> s;\r\n    for (int i = 2; i < strlen(s); i++) {\r\n        if (s[i] != ((s[i - 1] + s[i - 2]) % 26) + 'A') {\r\n            cout << \"NO\";\r\n        }\r\n    }\r\n    cout << \"YES\";  \r\n}\r\nint main(){\r\n\tFAST; \r\n\ts();\r\n\treturn 0; \r\n} ", "lang": "GNU C++11", "bug_code_uid": "3022a5be1eb09c5d3222c8137e117947", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "d9985e2cfb8716853f4c23d7783caf1f", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}