{"similarity_score": 0.9994496422674739, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#define _CRT_SECURE_NO_WARNINGS // scanf(), gets() (needed for Visual C++)\n\n//#define NDEBUG\n#include \n\n#include \n#include \n#include // min(), max(), sort(), lower_bound()\n#include // memset(), memcpy()\n#include // greater<>()\n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n#define GETINT(x) scanf(\"%d\", &x)\n#define GETDBL(x) scanf(\"%lf\", &x)\n#define GETSTR(s) scanf(\"%s\", s)\n#define NEWINT(x) int x; scanf(\"%d\", &x)\n#define NEWDBL(x) double x; scanf(\"%lf\", &x)\n#define NEWSTR(s, ARRAYSIZE) char s[(ARRAYZIE)]; scanf(\"%s\", s)\n#define MEMSET(x, WITH) memset(x, (WITH), sizeof(x))\n#define FOR(i, E) for(int i=0; i<(E); i++)\n#define NEWLN putchar('\\n')\n\ntypedef long long ll;\n\n\n\n\n\n\n\n\n\nint a[100000];\nint b[100000];\nint n, d, x;\n\nint getNextX() {\n\tx = ((ll)x * 37 + 10007) % 1000000007;\n\treturn x;\n}\nvoid initAB() {\n\tint i;\n\tfor (i = 0; i < n; i = i + 1){\n\t\ta[i] = i + 1;\n\t}\n\tfor (i = 0; i < n; i = i + 1){\n\t\tint j = getNextX() % (i + 1);\n\t\tswap(a[i], a[j]);\n\t}\n\n\n\tfor (i = 0; i < n; i = i + 1){\n\t\tif (i < d)\n\t\t\tb[i] = 1;\n\t\telse\n\t\t\tb[i] = 0;\n\t}\n\tfor (i = 0; i < n; i = i + 1){\n\t\tswap(b[i], b[getNextX() % (i + 1)]);\n\t}\n}\n\n\n\n\n\nint s = 30;\nint inva[100000+8];\nint bidx[100000+8];\n\nint main() {\n\tcin >> n >> d >> x;\n\tinitAB();\n\n\tfor (int i=0; i=max(1, n-s); val--) {\n\t\t\tint j = inva[val];\n\t\t\tif (j<=i && b[i-j]) {\n\t\t\t\t//cout << val << endl;\n\t\t\t\tfound = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (found) continue;\n\n\n\t\tint ans = 0;\n\t\tfor (int ii=0; bidx[ii]<=i; ii++)\n\t\t\tans = max(ans, a[i-bidx[ii]]);\n\t\tcout << ans << endl;\n\t}\n\n\n\n\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "2fae94a55598d4c6e7d7362765b908ef", "src_uid": "948ae7a0189ada07c8c67a1757f691f0", "apr_id": "44446e78828abea2c0051f747dc80031", "difficulty": 2300, "tags": ["probabilities"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9838120104438642, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "/*....Abhilash's coding template....*/\n\n#include\nusing namespace std;\n#define endl \"\\n\"\n#define ll long long int\n#define ld long double\n#define pb push_back\n#define pob pop_back\n#define mp make_pair\n#define in insert\n#define ff first\n#define ss second\n#define all(a) (a).begin(),(a).end()\n#define vll vector\n#define vint vector\n#define sll set\n#define sint set\n#define pll pair\n#define pint pair\n#define fl(i,a,b) for(ll i=a;i<=b;i++)\n#define flr(i,a,b) for(ll i=a;i>=b;i--)\n#define print(v) for(auto i=v.begin();i!=v.end();i++){cout<<*i<<\" \";}cout<<\"\\n\";\n#define test() int te; cin >> te; while(te--)\n#define PI 3.14159265\n#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);\nint main()\n{\n int n,k,temp,temp2;\n cin>>n>>k;\n temp=min(k,(n-k+1));\n temp2=min((7*temp-1),(temp-1+(3*n)));\n if(k==1||k==n)\n cout<<3*n<\n#include \n#include \n\nusing namespace std;\n\nbool MN (string n, int s)\n{\n\tif (n[0] == '1')\n\t{\n\t\tfor (int i = 1; i < s; i++)\n\t\t{\n\t\t\tn[i - 1] = n[i];\n\t\t\ts--;\n\t\t\treturn MN (n, s);\n\t\t}\n\t}\n\telse\n\t{\n\t\tif (n[1] == '4')\n\t\t{\n\t\t\tif (n[2] == '4')\t\t\t\t\n\t\t\t\treturn false;\n\t\t\telse\n\t\t\t\tfor (int i = 2; i < s; i++)\n\t\t\t\t{\n\t\t\t\t\tn[i - 2] = n[i];\n\t\t\t\t\ts -= 2;\n\t\t\t\t\treturn MN (n, s);\n\t\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfor (int i = 1; i < s; i++)\n\t\t\t{\n\t\t\t\tn[i - 1] = n[i];\n\t\t\t\ts--;\n\t\t\t\treturn MN (n, s);\n\t\t\t}\n\t\t}\n\t}\n}\t\t\t\n\n\nusing namespace std;\n\nint main()\n{\n\tint s;\n\tbool b;\n\tstring n;\n\tcin >> n;\n\ts = n.size();\n\tif (n[0] == '4')\n\t{\n\t\tcout << \"NO\\n\";\n\t\treturn 0;\n\t}\n\tfor (int i = 0; i < s; i++)\n\t\tif (n[i] != '1' || n[i] != '0')\n\t\t{\n\t\t\tcout << \"NO|N\";\n\t\t\treturn 0;\n\t\t}\n\tb = MN (n, s);\n\tif (b)\n\t\tcout << \"YES\\n\";\n\telse\n\t\tcout << \"NO\\n\";\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "4d7d004e489d31f88be29d4ba86a3b8e", "src_uid": "3153cfddae27fbd817caaf2cb7a6a4b5", "apr_id": "ec78932f1f3e8c071f5dfd2292468340", "difficulty": 900, "tags": ["brute force", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9830258302583026, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \n#define F first\n#define S second\nusing namespace std;\n\nconst int N = 1e2 + 7;\nint ans[N][3], sum;\nset sx, sy;\n\nvoid boosted()\n{\n ios_base::sync_with_stdio(false);\n ios::sync_with_stdio(false);\n cin.tie();\n cout.tie();\n}\n\nvoid files()\n{\n freopen(\"input.txt\", \"r\", stdin);\n}\n\nbool comp(pair l, pair r)\n{\n return l > r;\n}\n\nint main()\n{\n boosted();\n //files();\n string jabber_id;\n cin>>jabber_id;\n int kolvo = 0;\n for(int i = 0; i < jabber_id.size(); ++i){\n if(jabber_id[i] >= 'A' && jabber_id[i] <= 'Z'){\n jabber_id[i] += ' ';\n }\n if(jabber_id[i] == '/'){\n kolvo++;\n if(kolvo > 1){\n cout<<\"NO\";\n return 0;\n }\n }\n }\n if( !(jabber_id[0] >= 'a' && jabber_id[0] <= 'z') &&\n !(jabber_id[0] >= '0' && jabber_id[0] <= '9') &&\n jabber_id[0] != '_'){\n cout<<\"NO\";\n return 0;\n }\n int i = 0;\n while(jabber_id[i] != '@'){\n if((!(jabber_id[i] >= 'a' && jabber_id[i] <= 'z') &&\n !(jabber_id[i] >= '0' && jabber_id[i] <= '9') &&\n jabber_id[i] != '_') || (i >= 16)){\n cout<<\"NO\";\n return 0;\n }\n i++;\n }\n i++;\n if(jabber_id[i] == '.'){\n cout<<\"NO\";\n return 0;\n }\n int kol = 0, kolvsl = 0;\n while(jabber_id[i] != '/' && i < jabber_id.size()){\n if(( !(jabber_id[i] >= 'a' && jabber_id[i] <= 'z') &&\n !(jabber_id[i] >= '0' && jabber_id[i] <= '9') &&\n jabber_id[i] != '_' && jabber_id[i] != '.') || (kol > 32) || (kolvsl > 16)) {\n cout<<\"NO \";\n //cout<= jabber_id.size()){\n cout<<\"YES\";\n return 0;\n }\n kol = 0;\n if(jabber_id[i] == '/'){\n while(i < jabber_id.size()){\n if(( (jabber_id[i] >= 'A' && jabber_id[i] <= 'Z') &&\n !(jabber_id[i] >= 'a' && jabber_id[i] <= 'z') &&\n !(jabber_id[i] >= '0' && jabber_id[i] <= '9') &&\n jabber_id[i] != '_') || (kol > 16)){\n cout<<\"NO\";\n return 0;\n }\n i++;\n }\n }\n cout<<\"YES\";\n\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "bb02e1313f6c0bba05dc4d832c724a86", "src_uid": "2a68157e327f92415067f127feb31e24", "apr_id": "21b5c3c18011049ca0500925e4651aa0", "difficulty": 1900, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9995176073323685, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#pragma GCC optimize(\"Ofast\")\n#pragma GCC optimize(\"unroll-loops\")\n#define _CRT_SECURE_NO_WARNINGS\n#ifndef _GLIBCXX_NO_ASSERT\n#include \n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#if __cplusplus >= 201103L\n#include \n#include \n#include \n//#include \n#include \n#include \n#include \n#include \n#include \n#endif\n\n// C++\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#if __cplusplus >= 201103L\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#endif\n\n#ifdef _MSC_VER\n# include \n# define __builtin_popcount __popcnt\n# define __builtin_popcountll __popcnt64\ninline int getchar_unlocked() { return _getchar_nolock(); }\ninline int putchar_unlocked(int c) { return _putchar_nolock(c); }\n#endif\n\nusing namespace std;\nusing ll = long long;\nusing ld = long double;\nusing vi = vector;\nusing pi = pair;\nusing pll = pair;\nconstexpr int INF = 0x3f3f3f3f; constexpr ll LLINF = 0x3f3f3f3f3f3f3f3f;\n#define gc getchar_unlocked()\n#define pc(x) putchar_unlocked(x)\ntemplate void scan(T& x) { x = 0; bool _ = 0; T c = gc; _ = c == 45; c = _ ? gc : c; while (c < 48 || c>57)c = gc; for (; c < 48 || c>57; c = gc); for (; c > 47 && c < 58; c = gc)x = (x << 3) + (x << 1) + (c & 15); x = _ ? -x : x; }\ntemplate void printn(T n) { bool _ = 0; _ = n < 0; n = _ ? -n : n; char snum[65]; int i = 0; do { snum[i++] = n % 10 + 48; n /= 10; } while (n); --i; if (_)pc(45); while (i >= 0)pc(snum[i--]); }\ntemplate void scan(First& arg, Ints&... rest) { scan(arg); scan(rest...); }\ntemplate void print(T n) { printn(n); pc(10); }\ntemplate void print(First arg, Ints... rest) { printn(arg); pc(32); print(rest...); }\n#define db(x) { cerr << #x << \" = \" << x << endl; }\ntemplate void _dbarr(T* a, size_t sz) { for (int i = 0; i < sz; i++) cerr << a[i] << \" \\n\"[i == sz - 1]; }\ntemplate void _dbarr(vector a, size_t sz) { for (int i = 0; i < sz; i++) cerr << a[i] << \" \\n\"[i == sz - 1]; }\n#define dbarr(x, n) {cerr << #x << \": \"; _dbarr((x),(n));}\n#define pb push_back\n#define eb emplace_back\n#define mp make_pair\nconst int MM = 105;\nint n, k, l, d[MM];\n\nbool vis[MM][MM][MM];\nbool solve(int pos, int tide, bool inc)\n{\n\tif (pos >= n + 1) return true;\n\tif (vis[pos][tide][inc]) return false;\n\tvis[pos][tide][inc] = true;\n\tint ntide = tide + (inc ? 1 : -1);\n\tbool ninc = inc;\n\tif (ntide == 0) ninc = true;\n\telse if (ntide == k) ninc = false;\n\n\tfor(int i = 0; i < 2; i++)\n\t{\n\t\tif (d[pos + i] + ntide <= l)\n\t\t\tif (solve(pos + i, ntide, ninc)) return true;\n\t}\n\treturn false;\n}\n\nint main()\n{\n\tcin.tie(0)->sync_with_stdio(0);\n\tint t;\n\tcin >> t;\n\twhile(t--)\n\t{\n\t\tmemset(vis, 0, sizeof vis);\n\t\tmemset(d, 0, sizeof d);\n\t\t\n\t\tcin >> n >> k >> l;\n\t\tfor(int i = 1; i <= n; i++)\n\t\t{\n\t\t\tcin >> d[i];\n\t\t}\n\n\t\tcout << (solve(0, 0, true) ? \"Yes\" : \"No\") << \"\\n\";\n\t}\n}", "lang": "MS C++ 2017", "bug_code_uid": "6fbf3814e45b0de036eb6e624b8d3e3a", "src_uid": "4941b0a365f86b2e2cf686cdf5d532f8", "apr_id": "ae90613ba5af39e17a3263174f33f88e", "difficulty": 1900, "tags": ["dp", "brute force", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9817629179331308, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\nint n1,k1,n2,k2;\n\nint main(){\n\tcin >> n1 >> k1 >> n2 >> k2;\n\tif(n1 > n2) cout << \"First\" << endl;\n\telse cout << \"Second\" << endl;\n\treturn 0;\n}\n\n\n\n\n\n", "lang": "GNU C++0x", "bug_code_uid": "3b9ed3655aae1fd9360214b22365a270", "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b", "apr_id": "51f348291c086b335ec516746226fefd", "difficulty": 800, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9998393058010606, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \n#include \n#include \n\n#define ll long long\n#define pb push_back\n#define ppb pop_back\n#define endl '\\n'\n#define mii map\n#define pii pair\n#define vi vector\n#define vs vector\n#define all(a) (a).begin(),(a).end()\n#define F first\n#define S second\n#define sz(x) (ll)x.size()\n#define hell 1000000007\n#define inf (ll)1e18 + 5\n#define PI 3.14159265358979323844\n#define rep(i,a,b) for (ll i=a;i=b;i--)\n#define lbnd lower_bound\n#define ubnd upper_bound\n#define mp make_pair\n#define ios ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);\n#define ordered_set tree, rb_tree_tag,tree_order_statistics_node_update>\n#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)\n\ntemplate \nvoid __f(const char* name, Arg1&& arg1){\n std::cerr << name << \" : \" << arg1 << endl;\n}\ntemplate \nvoid __f(const char* names, Arg1&& arg1, Args&&... args){\n const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << \" : \" << arg1<<\" | \";__f(comma+1, args...);\n}\n\nusing namespace std;\nusing namespace __gnu_pbds;\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//primes for hashing 937,991,1013,1409,1741\n\nvoid solve() {\n ll x,y,n,maxi,mini,meow;\n cin>>x>>y>>n;\n set s;\n rep(i,1,n+1){\n \tmini=((x*i)/y);\n \tmaxi=ceil((x*i*1.0)/(y*1.0));\n \tif ((mini+maxi)*y>2*x*i){\n \t\tmeow=__gcd(i,mini);\n \t\ts.insert({i/meow,mini/meow});\n \t}\n \telse {\n \t\tmeow=__gcd(i,maxi);\n \t\ts.insert({i/meow,maxi/meow});\n \t}\n }\n ll q=(*s.begin()).F;\n ll p=(*s.begin()).S;\n for (auto i:s){\n \tif ((i.S)*y==x*(i.F)){\n \t\tp=i.S;\n \t\tq=i.F;\n \t}\n \telse if (((i.S)*y>(i.F)*x) && (p*y>x*q)){\n \t\tif ((i.S)*q<(p*(i.F))){\n \t\t\tp=i.S;\n \t\t\tq=i.F;\n \t\t}\n \t}\n \telse if (((i.S)*y<(i.F)*x) && (p*y>x*q)){\n \t\tif (2*x*q*(i.F)(i.F)*x) && (p*yy*((p*(i.F)) + (q*(i.S)))){\n \t\t\tp=i.S;\n \t\t\tq=i.F;\n \t\t}\n \t}\n \telse if (((i.S)*y<(i.F)*x) && (p*y(p*(i.F))){\n \t\t\tp=i.S;\n \t\t\tq=i.F;\n \t\t}\n \t}\n }\n meow=__gcd(p,q);\n cout<

>test;\n while (test--) solve();\n return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "f3830368611562e9e66f772d28589e05", "src_uid": "827bc6f120aff6a6f04271bc84e863ee", "apr_id": "a68053757f32b8359fbd4ba12e680311", "difficulty": 1700, "tags": ["brute force", "implementation", "two pointers"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9952830188679245, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \nusing namespace std;\n\nint main()\n{\n\tint n;\n\tcin>>n;\n\tint ans=6;\n\twhile(n--)\n\t{\n\t\tint k;\n\t\tcin>>k;\n\t\tif(ans==k)\n\t\t{\n\t\t\tcout<<\"NO\";\n\t\t\treturn 0;\n\t\t}\n\t\tans=6-ans-k;\n\t}\n\tcout<<\"YES\";\n\treturn 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "ba73b871bab28a2df19db8d32bab893f", "src_uid": "6c7ab07abdf157c24be92f49fd1d8d87", "apr_id": "a57a01c27c6819258b02e3e35ee8e8a7", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.22344322344322345, "equal_cnt": 13, "replace_cnt": 10, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 13, "bug_source_code": "#include\nusing namespace std;\nbool a[120];\nint n,x,js;\nint main()\n{ \n\tcin>>n;\n\tfor(int i=1;i<=n;i++)\n\t{\n\t\tcin>>x;\n\t\ta[x]=1;\n\t}\n\tfor(int i=1;i<=620;i++)\n\t\tif(a[i]==1)\n\t\tjs+=1;\n\tcout<\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\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#define MS0(x) memset(x,0,sizeof(x))\n\ntypedef long long LL;\nusing namespace std;\nint n,x;\n\nint gcd(int a,int b){\n if(b==0)return a;\n return gcd(b,a%b);\n}\n\nLL pw(int i,int z){\n if(z==1)return i;\n LL t=pw(i,z/2);\n if(z&1)return(t*t%n*i%n);\n return(t*t%n);\n}\n\n\nint main(){\n scanf(\"%d%d\",&n,&x);\n n++;\n FORD(i,x-1,2){\n if((pw(i,n-1)==1)&&((i-1)%n!=0)){\n printf(\"%d\",i);\n exit(0);\n }\n }\n \n printf(\"-1\");\n}\n\n ", "lang": "GNU C++", "bug_code_uid": "1e0d24fc5d822ae0ee23f08fe579161b", "src_uid": "29dda6a3f057e5bccdc076d7e492ac9a", "apr_id": "0095b3ce80ccee4161181f2a91fd375c", "difficulty": 2600, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9638009049773756, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include\n#include\n#include\n#include\nusing namespace std;\nint n,x,a[1000000],tot;\nlong long modpow(long long x,long long y,int p){\n\tlong long res=1;\n\tfor(;y;y>>=1,(x*=x)%=p)\n\t\tif(y&1)(res*=x)%=p;\n\treturn res;\n}\nbool check(int b,int p){\n\tfor(int i=1;i*i>n>>x;\n\tn++;\n\tfor(int i=2;i=1;i--)\n\t\tif(check(i%n,n))\n\t\t\treturn printf(\"%d\\n\",i),0;\n\tputs(\"-1\");\n}\n", "lang": "GNU C++", "bug_code_uid": "d513368ef65c5bc695787a2ac10cc683", "src_uid": "29dda6a3f057e5bccdc076d7e492ac9a", "apr_id": "da3ee0827085ffd127e5f39769fcb66e", "difficulty": 2600, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9833101529902643, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include \n#include \n\nusing namespace std;\n\nint main()\n{\n int n, d;\n int mas[110] = {0};\n cin >> n >> d;\n for ( int i = 0 ; i < n; i++)\n\t{\n\t\tcin >> mas[i];\n\t}\n\n\n\n if (n == 1 )\n\t{\n\t\tcout << \"0\"<< endl;\n\t\treturn 0;\n\t}\n\n\tsort(&mas[0], &mas[n-1]);\n\n\tif(n == 2)\n\t{\n\t\tif (mas[1] - mas[0] > d)\n\t\t\tcout << \"1\" << endl;\n\t\telse\n\t\t\tcout << \"0\"<< endl;\n\t\treturn 0;\n\t}\n\n\n\n\n\tint x;\n\tint rez =0;\n\tint maxrez = 0;\n\n\tfor (int i = 0; i < n-1; i++)\n\t{\n\t\tfor(int j = i; j < n; j++)\n\t\t{\n\t\t\tif (abs(mas[i] - mas[j] )<=d)\n\t\t\t{\n\t\t\t\trez++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tmaxrez = max(maxrez,rez);\n\t\t\t\trez = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tmaxrez = max(maxrez,rez);\n\t\trez = 0;\n\t}\n\n\n\tcout << n - maxrez << endl;\n\n\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "81c6e23923c3c2d7786a9fed3aa57e33", "src_uid": "6bcb324c072f796f4d50bafea5f624b2", "apr_id": "7ecd21a674325391cb5581aa5aec1263", "difficulty": 1200, "tags": ["greedy", "brute force", "sortings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9639830508474576, "equal_cnt": 12, "replace_cnt": 7, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "//\n// _ooOoo_\n// o8888888o\n// 88\" . \"88\n// (| -_- |)\n// O\\ = /O\n// ____/`---'\\____\n// .' \\\\| |// `.\n// / \\\\||| : |||// \\\n// / _||||| -:- |||||- \\\n// | | \\\\\\ - /// | |\n// | \\_| ''\\---/'' | |\n// \\ .-\\__ `-` ___/-. /\n// ___`. .' /--.--\\ `. . __\n// .\"\" '< `.___\\_<|>_/___.' >'\"\".\n// | | : `- \\`.;`\\ _ /`;.`/ - ` : | |\n// \\ \\ `-. \\_ __\\ /__ _/ .-` / /\n// ======`-.____`-.___\\_____/___.-`____.-'======\n// `=---='\n// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n// \u4f5b\u7956\u4fdd\u4f51 \u6c38\u65e0BUG\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n#define ull unsigned long long\n#define pii pair\n#define uint unsigned int\n#define lbd lower_bound\n#define ubd upper_bound\n#define ll long long\n#define mp make_pai;r\n#define pb push_back\n#define re register\n#define il inline\n\n#define N 2000\n#define MOD 1000000007\n\nint n, f[N+5][N+5], ans1, ans2;\n\nint main() {\n scanf(\"%d\", &n);\n n *= 2;\n f[0][0] = 1;\n for(int i = 1; i <= n; ++i) {\n for(int j = 0; j <= n; ++j) {\n //1.(\n if(j >= 1) f[i][j] = (f[i][j]+f[i-1][j-1])%MOD;\n //2.)\n f[i][j] = (f[i][j]+f[i-1][j+1])%MOD;\n }\n }\n // for(int i = 1; i <= n; ++i) {\n // for(int j = 0; j <= i; ++j) printf(\"f[%d][%d]:%d \", i, j, f[i][j]);\n // printf(\"\\n\");\n // }\n printf(\"%d\\n\", f[n][2]);\n return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "5170cd6f63c470a680b7aa0850a253ec", "src_uid": "8218255989e5eab73ac7107072c3b2af", "apr_id": "7ab6a6e42f05464003b44cecb4b164a7", "difficulty": 2100, "tags": ["trees", "dp", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9494163424124513, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "#include \n#include \n#include \n\nstd::vector ans;\n\nint main()\n{\n\tlong long n, k, i;\n\tstd::cin >> n >> k;\n\n\tfor (i = 1; i <= sqrt(n); i++)\n\t\tif (!(n % i))\n\t\t\tans.push_back(i);\n\n\twhile (--i > 0)\n\t\tif (!(n % i))\n\t\t\tans.push_back(n / i);\n\n\tif ((n == 1 && k > 1) || (k > ans.size()))\n\t\tstd::cout << -1;\n\telse\n\t\tstd::cout << ans[k - 1];\n\n\treturn 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "ce37a8c6b25d3d64fed3057a73e9cf8b", "src_uid": "6ba39b428a2d47b7d199879185797ffb", "apr_id": "95842b437f693c602b9b8e174740a1a2", "difficulty": 1400, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.8580940491052851, "equal_cnt": 17, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 8, "fix_ops_cnt": 16, "bug_source_code": "//wise words from the departing:\n//eat your greens, especially broccoli\n//remember to say thank you for all the things\n//you haven't had\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n#define\t\tFOR(i,a,b) for(int i=int(a);i pii;\n#define MP(a,b) make_pair(a,b);\ntypedef vector vi;\ntypedef set si;\n\n#define EPS 1e-7\n\nint main()\n{\n int n;\n#ifndef ONLINE_JUDGE\n freopen(\"input\", \"r\", stdin);\n//freopen(\"output\", \"w\", stdout);\n#endif\n#ifdef ONLINE_JUDGE\n //freopen(\"input.txt\", \"r\", stdin);\n //freopen(\"output.txt\", \"w\", stdout);\n#endif\n\n cin >> n;\n \n int a,b, cnt = 0;\n int c;\n \n for(a = 1; a<=n; a++) {\n for(b = a+1; b<=n; b++) {\n c = (int)max(a,b)*sqrt(1.0+min(a,b)*min(a,b)*1.0/(max(a,b)*max(a,b)));\n if(c <=n && a<=c && b<=c && c*c == a*a+b*b) {\n cnt++;\n }\n \n }\n }\n printf(\"%d\\n\", cnt);\n return 0;\n}\n", "lang": "MS C++", "bug_code_uid": "b775d1ba82fd1d444d5f492a2383cb78", "src_uid": "36a211f7814e77339eb81dc132e115e1", "apr_id": "b94db8b9d9d02ce895f1c22d060ae734", "difficulty": 1200, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.7168949771689498, "equal_cnt": 15, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 14, "bug_source_code": "#include \n#include\n\nusing namespace std;\nusing namespace __gnu_pbds;\n\n#define int long long\n\ntypedef tree, null_type, less>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;\n\n\n#define all(x) x.begin(), x.end()\n#define rall(x) x.rbegin(), x.rend()\n#define fs first\n#define sc second\n#define MP make_pair\n#define pb push_back\n#define fastio ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)\n#define sz(x) (int)x.size()\n#define sqr(x) ((x) * (x))\n\n\nconst int INF = 1e18;\nsigned main() {\n fastio;\n\n int x, y;\n cin >> x >> y;\n vector a;\n for (int i = 1; i * i <= x; i++) {\n if (x % i == 0) {\n a.pb(i);\n if (i * i != x)\n a.pb(x / i);\n }\n }\n\n sort(all(a));\n /* for (auto x:a)\n cout << x << ' ';*/\n int ans = 0;\n while (y) {\n \n int g = __gcd(x, y);\n int best = INF;\n for (int i = 0; i < sz(a); i++) {\n if (a[i] > y) break;\n if ((y - a[i]) % g || a[i] <= g) continue;\n int d = (y - a[i]) / g;\n best = min(best, d);\n }\n if (best == INF) {\n ans += y / g;\n break;\n }\n ans += best;\n y -= best * g;\n }\n cout << ans << '\\n';\n}", "lang": "GNU C++17", "bug_code_uid": "9f386a20d93bf5ebb58113a524a135c8", "src_uid": "ea92cd905e9725e7fcb87b9ed4f64c2e", "apr_id": "238dde9ece17ecdf5786381f14532b0f", "difficulty": 2100, "tags": ["math", "implementation", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9742647058823529, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#define QWQ cout<<\"QwQ\"<\n#include \n#include \n#include \nusing namespace std;\nconst int N=101010;\nconst int qwq=303030;\nconst int inf=0x3f3f3f3f;\n\nint n,m;\nchar s[N];\nint a[N],sum[N];\nint num[N];\nint b[N];\nint ans = -1;\npriority_queue , greater > q;\n\ninline int read() {\n\tint sum1 = 0, f = 1; char c = getchar();\n\twhile(c<'0' || c>'9') { if(c=='-') f = -1; c = getchar(); }\n\twhile(c>='0'&&c<='9') { sum1 = sum1 * 10 + c - '0'; c = getchar(); }\n\treturn sum1 * f;\n}\n\nvoid DFS(int h,int res) {\n\tif(h==n) {\n\t\tans = max(ans,res);\n\t\tif(res==5184) {\n\t\t\tfor(int i=1;i<=n;i++)\n\t\t\t\tcout<<(char)(b[i]+'a');\n\t\t\tcout<(n>>1) && b[n-h+1]==i) continue;\n\t\tnum[i]--;\n\t\tb[h] = i;\n\t\tif((s[h]-'a')==i) DFS(h,res+a[h]);\n\t\telse DFS(h,res);\n\t\tnum[i]++;\n\t}\n}\n\nvoid work1() {\n\tDFS(0,0);\n}\n\nvoid work2() {\n\tif(num[0]!=num[1]) return ;\n\tans = 0;\n\tfor(int i=1;i<=n;i++) ans += a[i];\n\tfor(int i=1;i<=n/2;i++)\n\t\tif(s[i]==s[n-i+1])\n\t\t\tans -= min(a[i],a[n-i+1]);\n}\n\nvoid work3() {\n\tfor(int i=0;i<16;i++) if(num[i]>(n/2)) return ;\n\tmemset(num,0,sizeof(num)); ans = 0;\n\tfor(int i=1;i<=n;i++) ans += a[i];\n\tint tot = 0,mann = 0, cl;\n\tfor(int i=1;i<=n/2;i++) {\n\t\tif(s[i]==s[n-i+1]) {\n\t\t\tnum[s[i]-'a']++; tot++;\n\t\t\tans -= min(a[i],a[n-i+1]);\n\t\t}\n\t}\n\tfor(int i=0;i<26;i++) if(num[i]>mann) mann = num[i], cl = i;\n\tif(tot>=(mann<<1)) return ;\n\ttot = 2*mann - tot;\n\tfor(int i=1;i<=n/2;i++) {\n\t\tif(s[i]==s[n-i+1]) continue;\n\t\tif(s[i]==cl+'a') q.push(a[n-i+1]);\n\t\telse if(s[n-i+1]==cl+'a') q.push(a[i]);\n\t\telse q.push(min(a[n-i+1],a[i]));\n\t}\n\twhile(tot--) {\n\t\tans -= q.top(); q.pop();\n\t}\n}\n\nint main() {\n\tn = read();\n\tif(n&1) { cout<<-1; return 0; }\n\tscanf(\"%s\",s+1);\n\tfor(int i=1;i<=n;i++) num[s[i]-'a']++;\n\tfor(int i=1;i<=n;i++) a[i] = read();\n\t// if(n<=12) work1();\n\t// else if(num[0]+num[1]==n) work2();\n\twork3();\n\tcout<\nusing namespace std;\ntypedef long long ll;\ntypedef long double ld;\n\nll modulo = 1e9 + 7;\n\n\nint main()\n{\n string s;\n ll a,b,c,d,e,f;\n ld ar1,ar2,ar3,ar4,an1,an2,h1,h2;\n cin>>a>>b>>c>>d>>e>>f;\n ar1=a*f*pow(3,0.5)/4;\n ar2=c*d*pow(3,0.5)/4;\n h1=pow(a*a+f*f+a*f,0.5);\n h2=pow(c*c+d*d+c*d,0.5);\n an1=asin(pow(3,0.5)*f/2/h1);\n an1=(2*M_PI/3)-an1;\n ar3=0.5*b*h1*sin(an1);\n \n an1=asin(pow(3,0.5)*c/2/h2);\n an1=(2*M_PI/3)-an1;\n ar4=0.5*e*h2*sin(an1);\n ar1=ar1+ar2+ar3+ar4;\n ar2=pow(3,0.5)/4;\n ar1=round(ar1/ar2);\n cout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);\n#define endl '\\n'\n#define pb push_back\ntypedef long long ll;\nusing namespace std;\n\ninline ll calc(ll n) {\n return (n*(n-1))/2;\n}\n\nint main() {\n FAST_IO;\n ll n,m; cin>>n>>m;\n ll min=0,max;\n if(n%m==0) min=m*calc(n/m);\n else min=(n%m)*calc((n/m)+1);\n max=calc(n-m+1);\n cout<\n#include \n#include \nusing namespace std;\n\nint main()\n{\n int a;\n cin>>a;\n int t=0,t1=0,T=0;\n for(int i=0;i>x>>y;\n if(x%2!=0){t1++;}\n if(y%2!=0){t++;}\n else if(x%2!=0&&y%2==0||y%2!=0&&x%2==0){T++;}\n }\n if(t1%2==0&&t%2==0){cout<<0<0){cout<<1<\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\ntypedef long long ll;\n#define mm(a,b) memset(a,b,sizeof(a))\n#define MAXN 100010\n#define inf 0x3f3f3f3f\nint gcd(ll a, ll b) {\n\treturn b == 0 ? a : gcd(b, a%b);\n}\nll l, a, b;\nint main()\n{\n\tll ans = 0;\n\tcin >> l >> a >> b;\n\tll m = a*b / gcd(a, b);\n\tans += (l / m)* min(a, b);\n\tl %= m;\n\tans += min(l, min(a - 1, b - 1));\n\tcout << ans;\n}", "lang": "GNU C++17", "bug_code_uid": "892f0273bd26e227b635c47b9b19aabe", "src_uid": "7a1d8ca25bce0073c4eb5297b94501b5", "apr_id": "5880bb73663a0f3bbbee3770fe849a0c", "difficulty": 1800, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5115303983228512, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "#include \n\nusing namespace std;\nint main(){\n\tint b,g,n;\n\tcin >> b;\n\tcin >> g;\n\tcin >> n;\n\tint ans = b;\n\tif (b >= g)\n\t\tans = g;\n\t\tif (g >= n)\n\t\t\tans = n;\n\tif (b >= n)\n\t\tans = n;\n\n\treturn ans+1;\n}\n", "lang": "GNU C++14", "bug_code_uid": "57e88ca06dadd0cdd31b209f5943909f", "src_uid": "9266a69e767df299569986151852e7b1", "apr_id": "515241de38a7195930e537f4d9764c09", "difficulty": 1100, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8931159420289855, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 5, "bug_source_code": "#include\n#define ll long long \t\nusing namespace std;\nll n,x,y,_count;\nconst ll N=1e7+9;\nll dp[N];\nll dfs(ll s)\n{\n\t// _count++;\n\t// cout<>n>>x>>y;\n\tcout<\n\nusing namespace std;\n\nint main() {\nint n;\nint count=0;\ncin>>n;\nfor(int i=0;i\n#include\nusing namespace std;\nint iIn1,iIn2,iIn3,iIn4;\nint main(){\n\tscanf(\"%d%d%d%d\",&iIn1,&iIn2,&iIn3,&iIn4);\n\tprintf(\"%d\",(iIn1^iIn2)&(iIn3|iIn4)^(iIn2&iIn3)|(iIn1^iIn4));\n}", "lang": "GNU C++11", "bug_code_uid": "d761b543fcc503762ebafe6827e6ba44", "src_uid": "879ac20ae5d3e7f1002afe907d9887df", "apr_id": "a8b5c7581f2451784a4c93440a2589d9", "difficulty": 2000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9396135265700483, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include//\n#include\n#include\nusing namespace std;\n#define LL __int64\ntypedef long long ll;\n\nint main()\n{\n ifstream in(\"input.txt\");\n ll i=0;\n ll x,y,m;\n cin>>x>>y>>m;\n \n if(x==-1000000000000000000LL)\n {\n cout<<\"1000000000000000087\";\n return 0;\n }\n if( m>x && m>y && x<=0 && y<=0 )\n {\n cout<<\"-1\";\n return 0;\n }\n else{\n if(x>=m || y>=m)\n i=0;\n else\n {\n ll a;\n if(x<=y)\n {\n a=(-x/y) +1;\n x+=a*y;\n }\n else\n {\n a= (-y/x) +1;\n y+=a*x;\n }\n i+=a;\n while(x\n#include \n#include \n#include \n#include \n#include \ntypedef long long ll;\ntypedef double ld;\n#define PB push_back\n#define MP make_pair\nconst int MOD=1000000007;\n#define fst first\n#define snd second\nconst int UNDEF = -1;\nconst int INF=1<<29;\ntemplate inline bool chkmax(T &aa, T bb) { return aa < bb ? aa = bb, true : false; }\ntemplate inline bool chkmin(T &aa, T bb) { return aa > bb ? aa = bb, true : false; }\ntypedef pair pll;typedef vector vll;typedef pair pii;typedef vector vi;typedef vector vvi;\nconst ll SLIM=sqrt((ld)1e11)+4;\n/*\n(n+k)*r+t+q=A // k>=q\n(n+k)*r+t+q=A+1 // k>=q>=1 if gap exists, k>=1 o/w\n\n(n+k)*r+q = A-t\nk*r+q = A-t-n*r\n\nk*r+q = RHS\n0<=q<=t\n\nk = RHS/r to (RHS-t)/r\n\nFind highest k st k>=q\n\n(w+q)*r+q = A-t-n*r\nFind highest w+q st 0<=w<=n-t, 0<=q<=t\nThis means q must be minimized.\n\nSuppose q is free. Then w can be binsearched?\nIf k is too high, then w is too high\n*/\n\nll solve(ll n, ll t, ll A, bool qone) {\n if (A=0;k--) {\n ll q=(A-t)%(n+k);\n if (qone && q==0) continue;\n if (k>=q && k-q <= n-t && q<=t) {\n assert(0<=q&&q<=t&&q<=k&&0<=k-q&&k-q<=n-t);\n return k;\n }\n }\n return -1;\n }\n else {\n //printf(\"BB\");\n ll rlim=2+((A-t)/n);\n ll final=-1;\n for (ll r=1;r<=rlim;r++) {\n ll rhs=(A-t-n*r);\n if (rhs<0) break;\n ll kmin=((rhs+1+r)/(r+1)); ll kmax=min(n,rhs/r)+1;\n while(kmin=1) {\n if (q<=t && t+q==A) {\n chkmax(final,q+w);\n }\n }\n }\n return final;\n }\n}\n// XXX\n//01234\n//01\nint main()\n{\n ios::sync_with_stdio(false); cin.tie(0);\n ll n,l,r,A;\n cin>>n>>l>>r>>A;\n if (l>r) r+=n;\n ll t=(r-l+1)%n;\n //printf(\"t:%lld\\n\",t);\n ll ans0=solve(n,t,A, false);\n ll ans1=solve(n,t,A+1, t!=0);\n ll final=max(ans0,ans1);\n printf(\"%lld\\n\",final);\n}\n\n", "lang": "GNU C++17", "bug_code_uid": "e613be8a0908316954a8fed83fb3d15e", "src_uid": "f54cc281033591315b037a400044f1cb", "apr_id": "2d5bf1b1ffbb0bea2d56676bd4c7f0b5", "difficulty": 2600, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.924791086350975, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "#include\n#include\nusing namespace std;\nint main()\n{unsigned long long A,B,C;\nunsigned long long q;\nq=sqrt(A*B*C);\ncout << 4*((q/A)+(q/B)+(q/C));\n}", "lang": "GNU C++17", "bug_code_uid": "a781cc0c051effc407c87d505e0e409b", "src_uid": "c0a3290be3b87f3a232ec19d4639fefc", "apr_id": "a9e482e7d514f0bcde26858bd4b3f18a", "difficulty": 1100, "tags": ["geometry", "math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9953882703684725, "equal_cnt": 22, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 18, "fix_ops_cnt": 21, "bug_source_code": " /** \tAuthor: Apoorva Mittal **/\n /** Published: 19/11/2020 21:20:22 **/\n#include \nusing namespace std;\n#define int long long\n//#warning int long long MLE\n#define endl \"\\n\"\n#define vi vector\n#define vvi vector>\n#define vii vector>\n#define rep(i,a,b) for(int i=a;i=a;i--)\n#define init(i, k) memset(i, k, sizeof i)\n#define pb push_back\n#define pii pair\n#define ff first\n#define ss second\n#define all(a) a.begin(), a.end()\n#define maxe *max_element\n#define mine *min_element\n#define pow2(n) (1LL << (n))\n#define sz(a) (int)a.size()\n#define unq(x) x.erase(unique(x.begin(), x.end()), x.end())\n#define LOCAL\n//--------------------------------------------debugging showoff---------------------------------------------------------\n#define out(a) \\\n cout << #a << \": \"< deb & operator <<\n#define eni(x) sim > typename \\\n enable_if(0) x 1, deb&>::type operator<<(c i) {\nsim > struct rge { c b, e; };\nsim > rge range(c i, c j) { return rge{i, j}; }\nsim > auto dud(c* x) -> decltype(cerr << *x, 0);\nsim > char dud(...);\nstruct deb {\n#ifdef LOCAL\n~deb() { cerr << endl; }\neni(!=) cerr << boolalpha << i; ris; }\neni(==) ris << range(begin(i), end(i)); }\nsim, class b dor(pair < b, c > d) {\n ris << \"(\" << d.first << \", \" << d.second << \")\";\n}\nsim dor(rge d) {\n *this << \"[\";\n for (auto it = d.b; it != d.e; ++it)\n *this << \", \" + 2 * (it == d.b) << *it;\n ris << \"]\";\n}\n#else\nsim dor(const c&) { ris; }\n#endif\n};\n#define show(...) \" [\" << #__VA_ARGS__ \": \" << (__VA_ARGS__) << \"] \"\n// -DLOCAL\n//--------------------------------------------useless stuff---------------------------------------------------------------------\n\n#define speed \\\n ios_base::sync_with_stdio(0); \\\n cin.tie(0); \\\n cout.tie(0)\n#define flush fflush(stdout);\n#define lb lower_bound\n#define ub upper_bound\n#define precise(x) cout << fixed << showpoint << setprecision(x);\n#define total1(x) __builtin_popcountll(x)\n#define left1(x) __builtin_clzll(x) // \"63-right1(x)\" to find 0 based index of first set bit from left\n#define right1(x) __builtin_ctzll(x) // to find 0 based index of first set bit from right\n#define gcd(a, b) __gcd(a, b)\n#define n2b(n,b) bitset(n).to_string()\n\ntemplate T &chmin(T &a,const T &b){ return a = min(a,b); }\ntemplate T &chmax(T &a,const T &b){ return a = max(a,b); }\nconst int dx[8] = {0, 1, -1, 0, 1, 1, -1, -1};\nconst int dy[8] = {1, 0, 0, -1, 1, -1, -1, 1};\n//------------------------------------------------------------------------------------------------------------------------------\nconst int mod = 998244353; //1000000007\n// ====== Useful functions begin ======\ninline int add(int a, int b) { return ((a % mod) + (b % mod)) % mod; }\ninline int sub(int a, int b) { return ((a % mod) - (b % mod) + mod) % mod; }\ninline int mul(int a, int b) { return ((a % mod) * (b % mod)) % mod; }\n// ====== Useful functions end ======\ntemplate istream &operator>>(istream &is, vector &vec){ for (auto &v : vec) is >> v; return is; }\n//--------------------------------------------------------------------------------------------------------------------------------\nconst double PI = acos(-1.0);\nconst long long inf = 1e18; //1000000000000000000\nconst int maxn = 1e3 + 5;\n//--------------------------------------------------------------------------------------------------------------------------------\nvi dp;\nint ways(int idx, int n)\n{\n \n if(idx==n+1) return 1;\n // if(idx>n+1) return 0;\n int &ans=dp[idx];\n if(ans!=-1) return ans;\n // deb()<n) break;\n ans+=ways(pos+d,n);\n }\n return ans;\n}\ntemplate \nstruct ModInt\n{\n using lint = long long;\n static int get_mod() { return mod; }\n static int get_primitive_root() {\n static int primitive_root = 0;\n if (!primitive_root) {\n primitive_root = [&](){\n std::set fac;\n int v = mod - 1;\n for (lint i = 2; i * i <= v; i++) while (v % i == 0) fac.insert(i), v /= i;\n if (v > 1) fac.insert(v);\n for (int g = 1; g < mod; g++) {\n bool ok = true;\n for (auto i : fac) if (ModInt(g).power((mod - 1) / i) == 1) { ok = false; break; }\n if (ok) return g;\n }\n return -1;\n }();\n }\n return primitive_root;\n }\n int val;\n constexpr ModInt() : val(0) {}\n constexpr ModInt &_setval(lint v) { val = (v >= mod ? v - mod : v); return *this; }\n constexpr ModInt(lint v) { _setval(v % mod + mod); }\n explicit operator bool() const { return val != 0; }\n constexpr ModInt operator+(const ModInt &x) const { return ModInt()._setval((lint)val + x.val); }\n constexpr ModInt operator-(const ModInt &x) const { return ModInt()._setval((lint)val - x.val + mod); }\n constexpr ModInt operator*(const ModInt &x) const { return ModInt()._setval((lint)val * x.val % mod); }\n constexpr ModInt operator/(const ModInt &x) const { return ModInt()._setval((lint)val * x.inv() % mod); }\n constexpr ModInt operator-() const { return ModInt()._setval(mod - val); }\n constexpr ModInt &operator+=(const ModInt &x) { return *this = *this + x; }\n constexpr ModInt &operator-=(const ModInt &x) { return *this = *this - x; }\n constexpr ModInt &operator*=(const ModInt &x) { return *this = *this * x; }\n constexpr ModInt &operator/=(const ModInt &x) { return *this = *this / x; }\n friend constexpr ModInt operator+(lint a, const ModInt &x) { return ModInt()._setval(a % mod + x.val); }\n friend constexpr ModInt operator-(lint a, const ModInt &x) { return ModInt()._setval(a % mod - x.val + mod); }\n friend constexpr ModInt operator*(lint a, const ModInt &x) { return ModInt()._setval(a % mod * x.val % mod); }\n friend constexpr ModInt operator/(lint a, const ModInt &x) { return ModInt()._setval(a % mod * x.inv() % mod); }\n constexpr bool operator==(const ModInt &x) const { return val == x.val; }\n constexpr bool operator!=(const ModInt &x) const { return val != x.val; }\n bool operator<(const ModInt &x) const { return val < x.val; } // To use std::map\n friend std::istream &operator>>(std::istream &is, ModInt &x) { lint t; is >> t; x = ModInt(t); return is; }\n friend std::ostream &operator<<(std::ostream &os, const ModInt &x) { os << x.val; return os; }\n constexpr lint power(lint n) const {\n lint ans = 1, tmp = this->val;\n while (n) {\n if (n & 1) ans = ans * tmp % mod;\n tmp = tmp * tmp % mod;\n n /= 2;\n }\n return ans;\n }\n constexpr lint inv() const { return this->power(mod - 2); }\n constexpr ModInt operator^(lint n) const { return ModInt(this->power(n)); }\n constexpr ModInt &operator^=(lint n) { return *this = *this ^ n; }\n\n inline ModInt fac() const {\n static std::vector facs;\n int l0 = facs.size();\n if (l0 > this->val) return facs[this->val];\n\n facs.resize(this->val + 1);\n for (int i = l0; i <= this->val; i++) facs[i] = (i == 0 ? ModInt(1) : facs[i - 1] * ModInt(i));\n return facs[this->val];\n }\n\n ModInt doublefac() const {\n lint k = (this->val + 1) / 2;\n if (this->val & 1) return ModInt(k * 2).fac() / ModInt(2).power(k) / ModInt(k).fac();\n else return ModInt(k).fac() * ModInt(2).power(k);\n }\n\n ModInt nCr(const ModInt &r) const {\n if (this->val < r.val) return ModInt(0);\n return this->fac() / ((*this - r).fac() * r.fac());\n }\n\n ModInt sqrt() const {\n if (val == 0) return 0;\n if (mod == 2) return val;\n if (power((mod - 1) / 2) != 1) return 0;\n ModInt b = 1;\n while (b.power((mod - 1) / 2) == 1) b += 1;\n int e = 0, m = mod - 1;\n while (m % 2 == 0) m >>= 1, e++;\n ModInt x = power((m - 1) / 2), y = (*this) * x * x;\n x *= (*this);\n ModInt z = b.power(m);\n while (y != 1) {\n int j = 0;\n ModInt t = y;\n while (t != 1) j++, t *= t;\n z = z.power(1LL << (e - j - 1));\n x *= z, z *= z, y *= z;\n e = j;\n }\n return ModInt(std::min(x.val, mod - x.val));\n }\n};\nusing mint = ModInt; //don't forget to check mod\nvoid solve()\n{\n\n int n;\n cin>>n;\n // dp=vi(n+1,-1);\n // int num = ways(1,n);\n vi dp(n+1);\n // vvi pdp(2,vi(n+1));\n\n dp[n]=1;\n dp[n+1]=1;\n // pdp[n&1][n]=1;\n vi pdp(n+2);\n pdp[n]=1;\n pdp[n+1]=1;\n for(int i=n-1;i>=1;i--)\n {\n // int d = i+(n-i)/2;\n dp[i] = pdp[i+1];\n pdp[i]=dp[i];\n pdp[i]=add(pdp[i+2],pdp[i]);\n }\n deb()<> t;\n\n for (int tt = 1; tt <= t; tt++)\n {\n // cout<<\"Case #\"< base case, if with bits,bla bla\n//5. MLE? -> #define int long long\n//6. When it's getting too complex till C, consider starting afresh, you might be going in a wrong direction\n//7.long long!!\n\n}", "lang": "GNU C++17", "bug_code_uid": "0737b942647fdf5db1c49d6d8edaaeb7", "src_uid": "cec37432956bb0a1ce62a0188fe2d805", "apr_id": "45d5ea275e0361962ff72a8f51433a11", "difficulty": 1600, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.3371647509578544, "equal_cnt": 4, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "#include \nusing namespace std; \nlong long a[100][100];\nint main(){\n\tint n,m,sum=0;;\n\tcin>>n>>m;\n\tfor(int i=1;i<=n;i++){\n\t\tfor(int j=1;j<=m;j++){\n\t\t\tif((i+j)%5==0) {\n\t\t\t\ta[i][j]=1;\n\t\t\t\tsum++;\n\t\t\t\tj=j+4;\n\t\t\t}\n\t\t}\n\t}\n\tcout<\n\nusing namespace std;\n\nint mod = 1000000007;\nint dp[55][105][105][105];\nint C[105][105];\n\nint main()\n{\n int n, m, k;\n scanf(\"%d%d%d\", &n, &m, &k);\n\n int mm = m;\n\n for (int i = 0; i < 105; i++) {\n C[i][0] = C[i][i] = 1;\n for (int j = 1; j < i; j++)\n C[i][j] = C[i-1][j-1]+C[i-1][j];\n }\n\n n++;\n m = min(m, (n+1)/2);\n\n for (int i = 2; i <= n; i++)\n dp[1][i][i-1][1] = 1;\n\n for (int mi = 1; mi < m; mi++)\n for (int i = 2; i <= n; i++)\n for (int j = 1; j <= i-1; j++)\n for (int ki = 1; ki <= k; ki++) {\n if (dp[mi][i][j][ki] == 0)\n continue;\n\n for (int t = j; t+i <= n; t++) {\n if (ki*C[t-1][j-1] > k) continue;\n dp[mi+1][t+i][t-j][ki*C[t-1][j-1] ] += dp[mi][i][j][ki];\n dp[mi+1][t+i][t-j][ki*C[t-1][j-1] ] %= mod;\n }\n }\n\n int ans = 0;\n\n for (int mi = 1; mi <= m; mi++)\n for (int i = 2; i <= n; i++)\n for (int ki = 1; ki <= k; ki++)\n ans += (long long)dp[mi][i][0][ki]*(mm-mi+1),\n ans %= mod;\n\n printf(\"%d\\n\", ans);\n}\n", "lang": "GNU C++14", "bug_code_uid": "5e5f859742ef50d6a8594e627174ab19", "src_uid": "c6d275b1e1d5c9e39e2cf990a635fa6b", "apr_id": "c3d8493ad953618988547bb99073d58e", "difficulty": 2800, "tags": ["dp"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.19490254872563717, "equal_cnt": 12, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 12, "bug_source_code": "#include \nusing namespace std;\nconst int mod = 1e9 + 7; \nint pow2 [45]; \nint main(){\n pow2[0] = 1; \n for (int g=1; g<45; g++) pow2[g] = (pow2[g-1] * 2) % mod; \n int n; cin >> n; \n if (n==1){\n cout << 1; \n }\n else if (n==2){\n cout << 3; \n }\n else if (n==3){\n cout << 15; \n }\n else if(n==4){\n cout << 63; \n }\n else if(n==5){\n cout << 4095; \n }\n else if (n==6){\n cout << 65535; \n }\n else if (n==7){\n cout << 262143; \n }\n else if (n==8){\n assert(false);\n cout << 4194303; \n }\n else{\n cout << (1LL * 67108863 * pow2[n-9])%mod; \n return 0; \n }\n}", "lang": "GNU C++11", "bug_code_uid": "c93783df662b60285bd23f7e62ce90f3", "src_uid": "c2cbc35012c6ff7ab0d6899e6015e4e7", "apr_id": "30a1b7388de0c04a4facd3d5b996002f", "difficulty": 2100, "tags": ["math", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9794266441821248, "equal_cnt": 13, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "#include\n#include\n#include\n#include\nusing namespace std;\n\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\nvoid __print(const pair &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}\ntemplate\nvoid __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? \",\" : \"\"), __print(i); cerr << \"}\";}\nvoid _print() {cerr << \"]\\n\";}\ntemplate \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\n\n\n\n#define int long long int\n#define endl \"\\n\"\n#define all(x) (x).begin(),(x).end()\n#define pb push_back\n#define rep(i,n) for(int i=0;i=0;i--)\nint mod=1000000007;\nmt19937 rng(chrono::steady_clock::now().time_since_epoch().count());\n\n//to find nth fibonacci number.\n//This code returns Fn and Fn+1 as a pair.\npair fib (int n) {\n if (n == 0)\n return {0, 1};\n\n auto p = fib(n >> 1);\n int c = p.first * (2 * p.second - p.first);\n int d = p.first * p.first + p.second * p.second;\n if (n & 1)\n return {d, c + d};\n else\n return {c, d};\n}\n\n\n\n\nint fact(int n)\n{\n int res=1;\n for(int i=n;i>=1;i--)\n (res*=i)%=mod;\n return (res%mod);\n \n}\n\nint power(int a, int b, int m)\n{\n\tint ans=1;\n\twhile(b)\n\t{\n\t\tif(b&1)\n\t\t\tans=(ans*a)%m;\n\t\tb/=2;\n\t\ta=(a*a)%m;\n\t}\n\treturn ans;\n}\n\n\n\n\n\n\n\nbool isPrime(long long n)\n{\n\n if (n <= 1)\n return false;\n\n\n for (long long i = 2; i <= sqrt(n); i++)\n if (n % i == 0)\n return false;\n\n return true;\n}\n\n//THIS IS THE CODE TO FIND ALL PRIME NUMBERS IN THE RANGE \"L\" to \"R\";\n\nvector segmentedSieve(long long L, long long R) {\n // generate all primes up to sqrt(R)\n long long lim = sqrt(R);\n vector mark(lim + 1, false);\n vector primes;\n for (long long i = 2; i <= lim; ++i) {\n if (!mark[i]) {\n primes.emplace_back(i);\n for (long long j = i * i; j <= lim; j += i)\n mark[j] = true;\n }\n }\n\n vector isPrime(R - L + 1, true);\n for (long long i : primes)\n for (long long j = max(i * i, (L + i - 1) / i * i); j <= R; j += i)\n isPrime[j - L] = false;\n if (L == 1)\n isPrime[0] = false;\n vectorrealprime;\n for(int i=0;i<=R-L;i++){\n if(isPrime[i]){\n realprime.emplace_back(i+L);\n \n }\n }\n return realprime;\n \n}\n\n\n\n\n\nbool isPalindrome(string s)\n{\n\n int l = 0;\n int h = s.size()-1;\n\n\n while (h > l)\n {\n if (s[l++] != s[h--])\n {\n\n return false;\n }\n }\n return true;\n}\n\n\n\n\n\n\n\nint ternarySearch(int l, int r, int key, int ar[])\n\n{\n while (r >= l) {\n\n // Find the mid1 and mid2\n int mid1 = l + (r - l) / 3;\n int mid2 = r - (r - l) / 3;\n\n // Check if key is present at any mid\n if (ar[mid1] == key) {\n return mid1;\n }\n if (ar[mid2] == key) {\n return mid2;\n }\n\n // Since key is not present at mid,\n // check in which region it is present\n // then repeat the Search operation\n // in that region\n\n if (key < ar[mid1]) {\n\n // The key lies in between l and mid1\n r = mid1 - 1;\n }\n else if (key > ar[mid2]) {\n\n // The key lies in between mid2 and r\n l = mid2 + 1;\n }\n else {\n\n // The key lies in between mid1 and mid2\n l = mid1 + 1;\n r = mid2 - 1;\n }\n }\n\n // Key not found\n return -1;\n}\n\n\n\n\n\n\n int binarySearch(int arr[], int l, int r, int x)\n{\n while (l <= r) {\n int m = l + (r - l) / 2;\n\n // Check if x is present at mid\n if (arr[m] == x)\n return m;\n\n // If x greater, ignore left half\n if (arr[m] < x)\n l = m + 1;\n\n // If x is smaller, ignore right half\n else\n r = m - 1;\n }\n\n // if we reach here, then element was\n // not present\n return -1;\n}\n\n\n\n//\"KADANE'S ALGORITHM\"\n//iski time complexity o(n) hn i.e the smallest possible \nlong long maxsubarraysum(long long *array,long long n){\n long long best = 0, sum = 0;\nfor (long long k = 0; k < n; k++) {\nsum = max(array[k],sum+array[k]);\nbest = max(best,sum);\n}\nreturn best ;\n\n}\n//to add two very large numbers \n\n\n\n\nstring findSum(string str1, string str2) \n{ \n\tif (str1.length() > str2.length()) \n\t\tswap(str1, str2); \n\tstring str = \"\"; \n\tint n1 = str1.length(), n2 = str2.length(); \n \n\treverse(str1.begin(), str1.end()); \n\treverse(str2.begin(), str2.end()); \n \n\tint carry = 0; \n\tfor (int i=0; ib.size())return b;\nif(a<=b)return a;\nelse return b;\n}\n\n\n\n\n\n bool so(const pair &a, \n const pair &b) \n{ \n return (a.second < b.second); \n} \n\n\n\n\n\n\nint setBitNumber(int n) \n{ \n // Below steps set bits after \n // MSB (including MSB) \n \n // Suppose n is 273 (binary \n // is 100010001). It does following \n // 100010001 | 010001000 = 110011001 \n n |= n >> 1; \n \n // This makes sure 4 bits \n // (From MSB and including MSB) \n // are set. It does following \n // 110011001 | 001100110 = 111111111 \n n |= n >> 2; \n \n n |= n >> 4; \n n |= n >> 8; \n n |= n >> 16; \n \n // Increment n by 1 so that \n // there is only one set bit \n // which is just before original \n // MSB. n now becomes 1000000000 \n n = n + 1; \n \n // Return original MSB after shifting. \n // n now becomes 100000000 \n return (n >> 1); \n} \n\n\n\nbool CompareVector(vector first, vector second){\n if (first[0] < second[0])\n return true;\n if (first[1] < second[1])\n return true;\n if (first[2] < second[2])\n return true;\n return false;\n\n}\n\n\nunsigned countBits(unsigned int number) \n{ \n // log function in base 2 \n // take only integer part \n return (int)log2(number)+1; \n} \n\n\n\n\n \nsigned main(){\nios_base::sync_with_stdio(false);\n cin.tie(0);cout.tie(0);\nint a1,a2,k1,k2;\nint n;\ncin>>a1>>a2>>k1>>k2>>n;\ncout<\n#include\n#include\n#include\nusing namespace std;\nint main()\n{\n\tint n; cin >> n;\n\tstring a; cin >> a;\n\tif (n < 26) cout << \"NO\" << endl;\n\telse\n\t{\n\t\ttransform(a.begin(), a.end(), a.begin(), ::tolower);\n\t\tsort(a.begin(), a.end());\n\t\tunique(a.begin(), a.end());\n\t\tif (a[25] == 'z' && a[0]=='a') cout << \"YES\" << endl;\n\t\telse cout << \"NO\" << endl;\n\t}\n//\tsystem(\"pause\");\n\treturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "c33ee6a4dd753fda006c51537ddaa75e", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "apr_id": "5a8627a25cc382fbff8bfe614336a92d", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.2176360225140713, "equal_cnt": 17, "replace_cnt": 12, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 16, "bug_source_code": "//\n#include \n#define int long long\nusing namespace std;\nconst int MOD=998244353;\nint n,m,k;\nint jc(int x)\n{\n\tif(!x) return 1;\n\treturn jc(x-1)*x;\n}\nint Comb(int n,int k)\n{\n\tif(!k) return 1;\n\treturn jc(n)/(jc(k)*jc(n-k));\n}\nint pow_mod(int a,int i)\n{\n\tint s=1;\n\twhile(i)\n\t{\n\t\tif(i&1) s=1LL*s*a%MOD;\n\t\ta=1LL*a*a%MOD;\n\t\ti>>=1;\n\t}\n\treturn s;\n}\nsigned main()\n{\n//\tfreopen(\"\",\"r\",stdin);\n//\tfreopen(\"\",\"w\",stdout);\n\tios::sync_with_stdio(0); //syn\u52a0\u901f\n\tcin>>n>>m>>k;\n\tif(k==0)\n\t{\n\t\tcout<\nusing namespace std;\nint main()\n{\n unsigned long long int a,b,ans=1,i;\n cin>>a>>b;\n if(a==0)\n a=1;\n if(b==0)\n b=1;\n a%=10;\n b%=10;\n for(i=1; i<=a; i++)\n ans*=i;\n if(ans>1)\n {\n a=ans;\n ans=1;\n }\n for(i=1; i<=b; i++)\n ans*=i;\n if(ans>1)\n b=ans;\n cout<<(b/a)%10<\n#define M_PI 3.14159265358979323846 /* pi */\n#define ri(i) int i;cin>>i;\n#define rii(i,j) int i,j;cin>>i>>j;\n#define riii(i,j,k) int i,j,k;cin>>i>>j>>k;\n#define rc(i) char i;cin>>i;\n#define rll(i) long long i;cin>>i;\n#define ff(i,s,n) for(int i=(s);i<(n);i++)\n#define fr(i,s,n) for(int i=(n-1);i>=(s);i--)\n#define FF(i,s,n) for(int i=(s);i<=(n);i++)\n#define Fr(i,s,n) for(int i=(n);i>=(s);i--)\n#define mp(a,b) make_pair(a,b)\n#define all(a) a.begin(),a.end()\n\nusing namespace std;\ntypedef long long ll;typedef vector vi;typedef vector vll;typedef vector vvll;typedef pair pvi;typedef vector vvi;typedef pair pii;\ntypedef pair pll;typedef vector > vpss;typedef vector vpii;typedef vector vpll;typedef vector vvpii;\ntypedef map mii;typedef unordered_map imap;typedef unordered_map lmap;\n\ntemplateinline void swap(T&a,U&b){a=a^b;b=a^b;a=a^b;}inline void swap(int&a,int&b){a=a^b;b=a^b;a=a^b;}inline void swap(ll&a,ll&b){a=a^b;b=a^b;a=a^b;}\ntemplateinline void smax(T&a,U b){if(b>a)a=b;}templateinline void smin(T&a,U b){if(b>s;int n=s.length();\n if(n%2==1){\n ff(i,-1,n/2)cout<<4;\n ff(i,-1,n/2)cout<<7;\n }\n else if(s>a[n/2-1]){\n ff(i,-1,n/2)cout<<4;\n ff(i,-1,n/2)cout<<7;\n }else{\n string t=b[n/2-1];\n int p=0,p2=n/2;\n while(t\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\n#define rep(i,x,y) for(i=x;i<=y;i++)\n#define _rep(i,x,y) for(i=x;i>=y;i--)\n#define REP(i,x,y) for(int i=(x);i<=(y);i++)\n#define _REP(i,x,y) for(int i=(x);i>=(y);i--)\n#define CL(S,x) memset(S,x,sizeof(S))\n#define CP(S1,S2) memcpy(S1,S2,sizeof(S2))\n#define ALL(x,S) for(__typeof((S).end()) x=S.begin();x!=S.end();x++)\n#define pb push_back\n#define IN insert\n#define ER erase\n#define BE begin()\n#define ED end() \n#define LB lower_bound\n#define UB upper_bound\n#define mp make_pair\n#define fi first\n#define se second\n#define upmin(x,y) x=min(x,y)\n#define upmax(x,y) x=max(x,y)\n#define COUT(S,x) cout< 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 inline void read(T&x,T&y){read(x);read(y);}\ntemplate inline void read(T&x,T&y,T&z){read(x);read(y);read(z);}\ntemplate inline void read(T&x,T&y,T&z,T&q){read(x);read(y);read(z);read(q);}\n\ninline char getc(){char c;for(c=getchar();c<=32;c=getchar());return c;}\n\ntypedef long long ll;\ntypedef long double ld;\ntypedef pair pii;\n\nconst int mod=1000000007 ;\nint n,i,j,k,K,l,p;ll m;\nll pow(ll a,ll b,ll c){ll ans=1;for(a%=c;b;b>>=1,a=a*a%c)if(b&1)ans=ans*a%c;return ans;}\nll f[110][110],C[110][110],c1[110][110],c2[110][110];\n\nint main()\n{\n //freopen(\"1.in\",\"r\",stdin);freopen(\"1.out\",\"w\",stdout);\n\tread(n);cin>>m;read(K);\n\t\n\trep(i,0,100){C[i][0]=1;rep(j,1,i)C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;}\n\trep(i,0,100)rep(j,0,i)\n\t{\n\t\tc1[i][j]=pow(C[i][j],m/n,mod);\n\t\tc2[i][j]=pow(C[i][j],m/n+1,mod);\n\t}\n\t\n\tf[0][0]=1;\n\trep(i,0,n-1)\n\trep(j,0,K)\n\t{\n\t\t#define up(x,y) x=((x)+(y))%mod\n\t\trep(k,0,min(K-j,n))\n\t\tif(i<(m%n))up(f[i+1][j+k],f[i][j]*c2[n][k]);\n\t\telse up(f[i+1][j+k],f[i][j]*c1[n][k]);\n\t}\n\tcout<\n#include\nusing namespace std;\nint main(){\n deque q;\n int n;\n cin>>n;\n q.push_back(1);\n q.push_back(2);\n q.push_back(3);\n q.push_back(4);\n q.push_back(5);\n int x;\n for(int i=0;i\nusing namespace std;\nint a[10000*10000+10];\nint main()\n{\n long long n,k,bomb=0,b=0;\n cin>>n>>k;\n for(int i=n/2;i<=n;i++)\n {\n b+=1;\n for(int j=1;j<=n;j*=k)\n {\n a[b]+=i/j;\n if(a[b]>=n)\n {\n cout<\n#define forn(i, n) for(int i = 1; i <= n; i++)\n#define forab(a, b) for(int i = a; i <= b; i++)\n\nusing namespace std;\n\nconst int INF = 1e7;\nconst long double EPS = 1e-8;\nconst long double PI = acos(-1.0L);\nconst int MAXN = 50;\nconst int MAXC = 1e9;\n\n\nlong long a[10000], n, spl, i, m, k1, t, ans, sum, k, mid, p;\n\n\n\n\n\nint main() {\n //freopen(\"merge.in\", \"r\", stdin);\n //freopen(\"merge.out\", \"w\", stdout);\n //freopen(\"input.txt\", \"r\", stdin);\n //freopen(\"output.txt\", \"w\", stdout);\n cin >> n >> k >> t;\n forn(i, n + k) {\n if (i <= n - k) {\n a[i] = i;\n }\n if (n - k <= i && i <= n ) {\n a[i] = k;\n }\n if (n <= i && i <= n + k)\n a[i] = n + k - i;\n }\n cout << a[t];\n return 0;\n}\n\n", "lang": "GNU C++", "bug_code_uid": "b15bfc9b6458844ff6dc6882d304686e", "src_uid": "7e614526109a2052bfe7934381e7f6c2", "apr_id": "1bc37d8dbc13962ed4b3d10b5330a68d", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.3263912598156367, "equal_cnt": 20, "replace_cnt": 10, "delete_cnt": 3, "insert_cnt": 7, "fix_ops_cnt": 20, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n//#include \n\ntypedef int long long bint;\ntypedef unsigned int long long buint;\n\n\nusing namespace std;\nint min(int a, int b){\n\tif (a < b)\n\t\treturn a;\n\telse\n\t\treturn b;\n}\nint max(int a, int b){\n\tif (a > b)\n\t\treturn a;\n\telse\n\t\treturn b;\n}\nint recursion(vector a, int sum){\n\tif (a.size() == 3)\n\t\treturn sum + min(a[0], a[2]);\n\telse if (a.size() < 3)\n\t\treturn sum;\n\telse{\n\n\t\tint maxi = -1;\n\t\tint price = 0;\n\t\tfor (int i = 0; i < a.size(); i++){\n\t\t\t\n\t\t\tif (i != a.size() - 1 && i != 0)\n\t\t\t\tprice = min(a[i - 1], a[i + 1]);\n\t\t\telse\n\t\t\t\tprice = 0;\n\t\t\tint temp = a[i];\n\t\t\ta.erase(a.begin() + i);\n\t\t\tint tmp1 = recursion(a, sum + price);\n\t\t\ta.insert(a.begin() + i,temp);\n\t\t\tif (maxi < tmp1)\n\t\t\t\tmaxi = tmp1;\n\t\t}\n\t\treturn maxi;\n\t}\n\n}\n\nint main(){\n\tint n;\n\tcin >> n;\n\tif (n == 2){\n\t\tcout << 0;\n\t\treturn 0;\n\t}\n\n\tint max = 0;\n\tint maxindex;\n\tvector a(n);\n\tfor (int i = 0; i < n; i++){\n\t\tcin >> a[i];\n\t}\n\tint sum = 0;\n\tcout << recursion(a, sum);\n \treturn 0;\n}", "lang": "MS C++", "bug_code_uid": "b1a370f3563823fbcdf47262a5bf086a", "src_uid": "e7e0f9069166fe992abe6f0e19caa6a1", "apr_id": "e81bb8119c048e9b03a7169e4a32cab3", "difficulty": 2500, "tags": ["greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7778894472361809, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "#include\n#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);\n#define ll long long int\n#define l long int\n#define Max INT_MAX\n#define Min INT_MIN\n\nusing namespace std;\n\nll gcd(ll x, ll y)\n{\n if(x==y)\n return x;\n if(x > y)\n return gcd(x-y,y);\n return gcd(x,y-x);\n}\n\nint main()\n{\n fio\n ll a,b,x,y;\n cin >> a >> b >> x >> y;\n ll k = gcd(x,y);\n x = x/k;\n y = y/k;\n cout << min(a/x,b/y);\n return 0;\n}", "lang": "GNU C++14", "bug_code_uid": "8969d266ed755c2304be9a56987e422e", "src_uid": "907ac56260e84dbb6d98a271bcb2d62d", "apr_id": "06dbd22a12cbc63d6a14eef9f5725252", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7759522031366691, "equal_cnt": 10, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "#include \nusing namespace std;\nusing ll = long long;\nconst int mod = 1e9 + 7;\nconst int inf = (1 << 30) - 1;\nconst ll infll = (1LL << 61) - 1;\n#define fast() cin.tie(0), ios::sync_with_stdio(false)\n\n// x\u3092b\u9032\u6cd5\u306b\u3059\u308b\ntemplate \nvector convert_base(T x, T b)\n{\n vector res;\n // t : digit\n T t = 1, k = abs(b);\n while (x != 0)\n {\n res.emplace_back((x * t) % k);\n if (res.back() < 0)\n res.back() += k;\n x -= res.back() * t;\n x /= k;\n t *= b / k;\n }\n if (res.empty())\n res.emplace_back(0);\n return res;\n}\n\nll int_pow(ll x, ll n)\n{\n ll res = 1;\n while (n > 0)\n {\n if (n & 1)\n res *= x;\n x *= x;\n n >>= 1;\n }\n return res;\n}\n\nll w, M;\n\nint main()\n{\n cin >> w >> M;\n vector dig = convert_base(M, w);\n for (int i = 0; i < dig.size(); i++)\n {\n if (1 < dig[i] && dig[i] < w - 1)\n {\n cout << \"NO\" << endl;\n return 0;\n }\n else if (dig[i] == w - 1)\n {\n M += int_pow(w, i);\n dig = convert_base(M, w);\n }\n }\n cout << \"YES\" << endl;\n}", "lang": "GNU C++14", "bug_code_uid": "5bed28b9f07a40cd6f7362c67b2f6a0a", "src_uid": "a74adcf0314692f8ac95f54d165d9582", "apr_id": "a552f71d8240006ec028a4c28d485be4", "difficulty": 1900, "tags": ["dp", "meet-in-the-middle", "number theory", "greedy", "math", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.511369645690111, "equal_cnt": 45, "replace_cnt": 22, "delete_cnt": 16, "insert_cnt": 7, "fix_ops_cnt": 45, "bug_source_code": "#include \n\nusing namespace std;\n\ntypedef long long ll;\ntypedef vector vi;\ntypedef vector vvi;\n\nll BinExp(ll bas, ll exp){\n ll ans=1, temp=bas;\n while(exp){\n if(exp&1) ans*=temp;\n temp*=temp;\n exp>>=1;\n }\n return ans;\n}\n\nll BinModExp(ll bas, ll exp, ll mod){\n ll ans=1, temp=bas%mod;\n while(exp){\n if(exp&1) ans=(ans*temp)%mod;\n temp=(temp*temp)%mod;\n exp>>=1;\n }\n return ans;\n}\n\nvvi Multiply_Matrix(vvi A, vvi B, ll mod){\n if(A[0].size()!=B.size()) return vvi();\n vvi C(A.size(), vi(B[0].size(), 0));\n for(int i=0; i>1, mod), A, mod);\n return Expon_Matrix(Multiply_Matrix(A, A, mod), exp>>1, mod);\n}\n\nll Nfibo(ll n, ll mod){\n vvi A;\n A.assign(2,vi(2));\n A[0][0]=1;\n A[0][1]=1;\n A[1][0]=1;\n A[1][1]=0;\n A=Expon_Matrix(A, n, mod);\n return (A[0][0]+A[0][1])%mod;\n}\nint main(){\n ll n, k, l, m;\n while(scanf(\"%I64d %I64d %I64d %I64d\", &n, &k, &l, &m)!=EOF){\n if(BinExp(2, l)\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 sq(x) ((x)*(x))\n\n#define sz(a) ((int)a.size())\n\n#define eps 1e-8\n\n#define x first\n\n#define y second\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 bclz(x) (__builtin_clz(x))\n\n#define bclzl(x) ((x) ? (__builtin_clzll(x)) : 0)\n\n#define bctz(x) (__builtin_ctz(x))\n\n#define bctzl(x) (__builtin_ctzll(x))\n\n#define shit(a) (1 << (a))\n\n#define rev(a) (power(a, mod-2, mod))\n\n#define PQ priority_queue, greater >\n\n\n\nusing namespace std;\n\n\n\ntypedef double DO;\n\ntypedef long long INT;\n\ntypedef pair pii;\n\ntypedef pair ppi;\n\ntypedef vector VI;\n\n\n\ntemplate inline void smin(T &a, U b) {if(a>b) a=b;}\n\ntemplate inline void smax(T &a, U b) {if(ainline void gn(T &x) {char c, sg=0; while (c=getchar(), (c>'9' || c<'0') && c!='-');for((c=='-'?sg=1, c=getchar():0), x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0';if (sg) x=-x;}\n\ntemplateinline void print(T x) {if (x<0) {putchar('-');return print(-x);}if (x<10) {putchar('0'+x);return;} print(x/10);putchar(x%10+'0');}\n\ntemplateinline void gn(T &x, T1 &y) {gn(x); gn(y);}\n\ntemplateinline void gn(T &x, T1 &y, T2 &z) {gn(x); gn(y); gn(z);}\n\ntemplate inline void println(T x) {print(x); putchar('\\n');}\n\ntemplate inline void printsp(T x) {print(x); putchar(' ');}\n\ntemplate inline void print(T1 x1, T2 x2) {printsp(x1), println(x2);}\n\ntemplate inline void print(T1 x1, T2 x2, T3 x3) {printsp(x1), printsp(x2), println(x3);}\n\ntemplate inline void print(T1 x1, T2 x2, T3 x3, T4 x4) {printsp(x1), printsp(x2), printsp(x3), println(x4);}\n\ntemplate inline void eprint(T x) {cerr << \"--------> \" < inline void eprint(T1 x, T2 y) { cerr << \"--------> \" << x << ' ' << y << endl; }\n\ntemplate inline void eprint(T1 x, T2 y, T3 z) { cerr << \" -------> \" << x << ' ' << y << ' ' << z << endl;}\n\ntemplate inline void eprint(T1 x, T2 y, T3 z, T4 w) { cerr << \" -------> \" << x << ' ' << y << ' ' << z << ' ' << w << endl;}\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\nint dp[111];\n\n\n\nint n, K;\n\n\n\nint get(int u) {\n\n\tint ans=0;\n\n\twhile(u) {\n\n\t\tans += u%K;\n\n\t\tu /= K;\n\n\t}\n\n\treturn ans % K;\n\n}\n\n\n\nint main() {\n\n#ifndef\tONLINE_JUDGE\n\n\tfreopen(\"in.in\", \"r\", stdin);\n\n\tfreopen(\"out.out\", \"w\", stdout);\n\n#endif\n\n\tcin >> n >> K;\n\n\tfor(int i=0; i\n#include \"string.h\"\n#include \n#include \n#include \nusing namespace std;\n\nstruct ac{\n double x, y;\n};\nac a[4], b[4];\ndouble check(ac a, ac b) {\n double d = sqrt((a.x - b.x)*(a.x - b.x) + (a.y - b.y)*(a.y - b.y));\n //cout << d << endl;\n return d;\n}\n\nint main(int argc, char const *argv[]) {\n ios::sync_with_stdio(false);\n for (int i = 0; i < 8; i ++)\n cin >> a[i].x >> a[i].y;\n ac z, z1;\n z1.x = (a[0].x + a[1].x) / 2.;\n z1.y = (a[0].y + a[1].y) / 2.;\n if (a[4].x == a[6].x) {\n z.x = a[4].x; z.y = a[5].y;\n }else {\n z.x = a[5].x; z.y = a[4].y;\n }\n int vis = 0;\n //cout << z.x << \" \" << z.y << endl;\n // if (z.x <= r.x && z.x >= l.x && z.y <= r.y && z.y <= r.y){\n // vis = 1;\n // }else{\n double d = check(a[4], a[6]) / 2.;\n //cout << d << endl;\n for (int i = 0; i < 4; i ++) {\n if (check(a[i], z) <= d)\n vis = 1;\n }\n //cout << endl;\n double d1 = check(a[0], a[2]) / 2.;\n //cout << d1 << endl;\n for (int i = 4; i < 8; i ++) {\n if (check(a[i], z1) <= d1)\n vis = 1;\n }\n // }\n cout << ((vis == 1) ? \"YES\" : \"NO\") << endl;\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "558823eee721eb42c6240c7b25de9490", "src_uid": "f6a3dd8b3bab58ff66055c61ddfdf06a", "apr_id": "af0c558371cd0a0a82993d3626cf82fd", "difficulty": 1600, "tags": ["brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5317073170731708, "equal_cnt": 11, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "#include\nusing namespace std;\n\nint main()\n{\n int n,ans=0;\n cin>>n;\n string s;\n cin>>s;\n for(int i=0;i0)ans--;\n if(s[i]=='+') ans++;\n }\n cout<\nusing namespace std;\n \n#define speed ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);\n#define ub(a,x) upper_bound(a.begin(),a.end(),x)-a.begin()\n#define lb(a,x) lower_bound(a.begin(),a.end(),x)-a.begin()\n#define ll long long\n#define endl \"\\n\";\n#define all(v) v.begin(),v.end()\n#define ff first\n#define ss second\n#define pb push_back\n#define PI 3.1415926535897932384626\n\nint n,k;\nstring s;\nset st;\n\nmain()\n{\n speed;\n\n cin>>n>>k;\n cin>>s;\n queue< string > q;\n q.push(s);\n while(q.size())\n {\n \tif(st.size()==k) break;\n \tstring temp = q.front();q.pop();\n \tst.insert(temp);\n \tint skip = 0;\n \tfor(int i=0;i::iterator it = st.begin();it!=st.end();it++)\n \t{\n \t\tsum += (*it).length();\n \t\t//cout<<*it<<\"\\n\";\n \t}\n \tcout<\n#include\nusing namespace std;\nint main()\n{\n int n,m,vm,cpt,r;\n cin>>n>>m;\n vectort1(n);\n vectort2(n);\n for(int i(0);i>t1[i];\n cin>>t2[i];\n }\n cpt=0;\n r=0;\n while(cptt2[vm])\n vm=i;\n if(cpt+t1[vm]<=n)\n {\n r+=t1[vm]*t2[vm];\n cpt+=t1[vm];\n }\n else\n {\n r+=t1[vm]*t2[vm];\n r-=(cpt-n)*t2[vm];\n cout<\n#define ll long long\n#define pb push_back\n#define sc scanf\n#define pf printf\n#define fo(i,n) for (int i=0;i<=(n-1);i++)\n#define s second\n#define f first\n#define int ll\n\nusing namespace std;\nint n, m;\nstring s1, s2;\n//int a[100001];\n//int b[100001];\n main() {\n \tint l, r ,pos;\n\tint ans=0;\n\tcin>>n>>pos>>l>>r;\n\tint a=1;\n\tint b=n;\n\twhile (a!=l || b!=r) {\n\t\tif (posr && b>pos) {\n\t\t\tans++;\n\t\t\tb=pos;\n\t\t}\n\t\tif (pos>=l && pos<=r && ar) {\n\t\t\tint t=min(pos-l, r-pos);\n\t\t\tans+=t+r-l+2;\n\t\t\tif (t==pos-l) pos=l; else pos =r;\n\t\t\tbreak;\n\t\t}\n\t\tif (pos>r && b==pos) {\n\t\t\tans+=pos-r;\n\t\t\tpos=r;\n\t\t}\n\t\tif (pos\n#include\nusing namespace std;\nbool a[1000000010];\nlong long t,s,x;\nint main()\n{\n\tcin>>t>>s>>x;\n\t//a[t]=0;\n\t//a[t+1]=0;\n\tfor(int i=t;i<=x;i++)\n\t{\n\t\tif((i-t)%s==0||(i-t-1)%s==0)\n\t\ta[i]=1;\n\t\t//cout<\n#define maxn 2020\n#define ll long long\n#define pb push_back\n#define pii pair\n#define mod 998244353 \n#define debug(args...) printf(args)\nusing namespace std;\n\nint n,k;\nint w(int n){\n if(k == 1) return n;\n return (n*n+n)/2;\n}\n\nint dp[maxn][maxn];\n\nint get(int m,int s){\n if(m == 0) return 1;\n int &r = dp[m][s];\n if(r+1) return r;\n r = get(m-1,s);\n if(w(m) <= s) r += get(m,s-w(m));\n r %= mod;\n return r;\n}\n\nint v[maxn];\n\nint check(int sz){\n vector a(sz);\n for(int i=0;i b;\n sort(a.begin(), a.end());\n reverse(a.begin(), a.end());\n for(int j=0;j v[pos-1]) break;\n }\n \n}\n\nmain(){\n scanf(\"%d%d\",&n,&k);\n if(k <= 2){\n memset(dp,-1,sizeof(dp));\n printf(\"%d\\n\",(get(n,n)-1+mod)%mod);\n return 0;\n }\n go(0);\n printf(\"%d\\n\",ans);\n}", "lang": "GNU C++17", "bug_code_uid": "750f1bf2aa3f51d042118766998a42eb", "src_uid": "c435a0cd437081cd3593637be4568c6a", "apr_id": "ceb142ceadd6106a2d2fee1d37c47104", "difficulty": 2900, "tags": ["dp", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9847422680412371, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "#include \n\nusing namespace std;\n\ntypedef long long LL;\nconst LL MAX = 1E9 + 7;\nLL x, k;\nLL out;\n\n//return x^(2^k) mod c\nLL twoPowModulo(LL x, LL k, LL c)\n{\n LL out = x%c;\n if (k==0) return out;\n else\n {\n for (LL i=1; i<=k; i++)\n out = ((out %c)*(out%c)%c);\n //LL out_t = twoPowModulo(out,k-1,c);\n //return (out_t*out_t%c);\n }\n return out;\n}\n//return a^b mod c\nLL fastModulo(LL a, LL b, LL c)\n{\n if (b==0) return 1;\n LL out = 1;\n int i = 0;\n LL b2 = b;\n while (b2>0)\n {\n if (b2 & 1) out = (out * twoPowModulo(a,i,c)) % c;\n i++;\n b2 >>= 1;\n }\n return out;\n}\n//return 2^p\nLL twoPow(LL p)\n{\n if (p>MAX)\n p %= (MAX -1);\n LL re=1;\n for (LL i=1; i<=p; i++)\n {\n re<<=1;\n if (re>MAX) (re %= MAX);\n }\n return re;\n}\nvoid input()\n{\n cin>>x>>k;\n}\n\nvoid process()\n{\n if (x<=0) out =0;\n else\n {\n if (x>MAX) x %= MAX;\n //LL t = twoPow(k);\n LL t = fastModulo(2,k,MAX);\n x %= MAX;\n out = (t*((2*x - 1) % MAX)+1)%MAX;\n }\n\n}\n\nvoid output()\n{\n cout< //:3\nusing namespace std;\ntypedef long long ll;\n#define all(a) (a).begin(), (a).end()\n#define ff first\n#define ss second\n#define pb push_back\n#define mp make_pair\n#define pi pair\n#define sz(x) (int)((x).size())\n#define int long long\n\nconst int dx[] = {0, 1, 0, -1};\nconst int dy[] = {1, 0, -1, 0};\n\nconst ll inf = 2e9;\nconst ll mod = 1e9 + 7;\nconst int N = 5e2 + 11;\nconst int X = 1e6;\nconst ll INF64 = 3e18 + 1;\nconst double eps = 1e-14;\nconst double PI = acos(-1);\n\n//ifstream in(\".in\");\n//ofstream out(\".out\");\n\nint n, k, dp[N][N][N];\n\nvoid solve(){\n\n cin >> n >> k;\n\n string s, t;\n\n cin >> s >> t;\n\n //s = '.' + s + '.';\n\n char a = t[0], b = t[1];\n\n if(a == b){\n int x = 0;\n for(int i = 1; i <= n; i++)x += (s[i] == a);\n x = min(n, x + k);\n cout << x * (x - 1) / 2 << '\\n';\n return;\n }\n\n memset(dp, -1, sizeof(dp));\n\n dp[0][0][0] = 0;\n\n int ans = 0;\n\n for(int i = 0; i < n; i++){\n for(int j = 0; j <= k; j++){\n for(int cnt = 0; cnt <= i; cnt++){\n if(dp[i][j][cnt] == -1)continue;\n dp[i + 1][j + 1][cnt + 1] = max(dp[i + 1][j + 1][cnt + 1], dp[i][j][cnt]);\n dp[i + 1][j + 1][cnt] = max(dp[i + 1][j + 1][cnt], dp[i][j][cnt] + cnt);\n dp[i + 1][j][cnt + (s[i] == a)] = max(dp[i + 1][j][cnt + (s[i] == a)], dp[i][j][cnt] + (s[i] == b)*cnt);\n }\n }\n }\n\n for(int j = 0; j <= k; j++){\n for(int cnt = 0; cnt <= n; cnt++){\n ans = max(ans, dp[n][j][cnt]);\n }\n }\n\n cout << ans << '\\n';\n\n}\n\nint32_t main(){\nios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);\n\n //cout << setprecision(6) << fixed;\n\n int T = 1;\n //cin >> T;\n while(T--){\n solve();\n }\n}\n", "lang": "GNU C++11", "bug_code_uid": "f1de0a0bab744876680e69d0b8c764b9", "src_uid": "9c700390ac13942cbde7c3428965b18a", "apr_id": "8c744b4fc867646e77d91e88201cdd5c", "difficulty": 2100, "tags": ["dp", "strings"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.23903177004538578, "equal_cnt": 11, "replace_cnt": 7, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 12, "bug_source_code": "#include\nusing namespace std;\n\n\nint main()\n{\n string s;\n cin>>s;\n int a = 0;\n int oa = 0;\n for(int i = 0; i=oa)cout<\nusing namespace std;\n#define ll long long int\n#define fi(x,n) for(ll i=x;i\n#define pb push_back\n#define qll queue\n#define p push\n#define mp make_pair\n#define fst first\n#define snd second\n#define pll pair\n#define vpll vector\n#define debug(x) cout<<#x<<' '<>var; while(var--)\n#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);\n#define fileio freopen(\"input.txt\", \"rt\", stdin); freopen(\"output.txt\", \"wt\", stdout); // use cin cout only!!\nll dp[5005][5005],sum[5005][5005],mod=1e9+7;\nmain()\n{\n ll n,a,b,k;\n cin>>n>>a>>b>>k;\n fi(0,5005)\n fj(0,5005)\n {\n dp[i][j]=-1;\n sum[i][j]=0;\n }\n if(a=0;i--)\n {\n if(j==0)\n dp[i][j]=1;\n else if(i==b-1)\n dp[i][j]=0;\n else\n {\n ll l=i-(b-i-1),r=i+(b-i-1),z;\n l=max(1ll,l);\n r=min(n,r);\n z=(sum[r][j-1]-sum[l-1][j-1]+mod)%mod;\n dp[i][j]=(z-dp[i][j-1]+mod)%mod;\n }\n }\n fi(1,b)\n sum[i][j]=(sum[i-1][j]+dp[i][j])%mod;\n }\n }\n else\n {\n for(int j=0;j<=k;j++)\n {\n for(int i=b+1;i<=n;i++)\n {\n if(j==0)\n dp[i][j]=1;\n else if(i==b+1)\n dp[i][j]=0;\n else\n {\n ll l=i-(i-b-1),r=i+(i-b-1),z;\n l=max(l,1ll);\n r=min(r,n);\n z=(sum[r][j-1]-sum[l-1][j-1]+mod)%mod;\n dp[i][j]=(z-dp[i][j-1]+mod)%mod;\n }\n }\n fi(b+1,n+1)\n sum[i][j]=(sum[i-1][j]+dp[i][j])%mod;\n }\n\n }\n /*fi(1,n+1)\n {\n fj(0,k+1)\n cout<\n\nusing namespace std;\n\nint main()\n{\n long long int n;\n cin>>n;\n if(n<=3)\n {\n if(n==1)\n {\n cout<<\"1\"<=max(0LL,n-50);i--)\n {\n for(long long int j=i-1;j>=max(0LL,n-50);j--)\n {\n for(long long int k=j-1;k>=max(0LL,n-50);k--)\n {\n long long int lcm=(i*j*k)/(__gcd(i,j)*__gcd(__gcd(i,j),k));\n ans=max(ans,lcm);\n }\n }\n }\n cout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n//#include \n//#include \n\nusing namespace std;\n\n#define forn(i, n) for(int i = 0; i < int(n); ++i)\n#define for1(i, n) for(int i = 1; i < int(n); ++i)\n#define fork(i, k, n) for(int i = int(k); i <= int(n); ++i)\n#define forft(i, from, to) for(int i = int(from); i < int(to); ++i)\n#define forr(i, n) for(int i = int(n) - 1; i >= 0; --i)\n#define pb push_back\n#define mp make_pair\n#define mnp(a, b) make_pair((a) < (b) ? (a) : (b), (a) < (b) ? (b) : (a))\n#define sz(d) int(d.size())\n#define all(a) a.begin(), a.end()\n#define ms(a, v) memset(a, v, sizeof(a))\n#define X first\n#define Y second\n#define correct(x, y, xmax, ymax) ((x) >= 0 && (x) < (xmax) && (y) >= 0 && (y) < (ymax))\n\ntemplate T sqr(const T &x) {\n\treturn x * x;\n}\n\ntemplate T my_abs(const T &x) {\n\treturn x < 0 ? -x : x;\n}\n\ntypedef long long li;\ntypedef long long ll;\ntypedef unsigned long long ull;\ntypedef unsigned long long uli;\ntypedef long double ld;\ntypedef pair pt;\ntypedef pair pli;\ntypedef pair pd;\n\nconst int INF = (int)1e9;\nconst li LINF = (li)6e18;\nconst li INF64 = LINF;\nconst li INFLL = LINF;\nconst ld EPS = 1e-15;\nconst ld PI = 3.1415926535897932384626433832795;\nconst ld ME = 1e-5;\nconst li MOD = (int)1e9 + 7;\nconst li MOD2 = (int)1e9 + 21;\nconst int SQN = 320;\nconst int LOGN = 17;\n\nconst int dx[] = {0, 1, 1, 1, 0, -1, -1, -1};\nconst int dy[] = {1, 1, 0, -1, -1, -1, 0, 1};\n\nconst int N = (int)310;\n\nbool used[N][N];\n\nint n;\nint t[40];\n\nbool z[30][N][N][8];\n\nvoid solve() {\n\tcin >> n;\n\tforn(i, n) {\n\t\tcin >> t[i];\n\t}\n\tz[0][N / 2][N / 2][8] = true;\n\tforn(i, n) {\n\t\tforn(x, N) {\n\t\t\tforn(y, N) {\n\t\t\t\tforn(dir, 8) {\n\t\t\t\t\tif (z[i][x][y][dir]) {\n\t\t\t\t\t\tint cx = x;\n\t\t\t\t\t\tint cy = y;\n\t\t\t\t\t\tforn(j, t[i]) {\n\t\t\t\t\t\t\tcx += dx[dir];\n\t\t\t\t\t\t\tcy += dy[dir];\n\t\t\t\t\t\t\tused[cx][cy] = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tint ldir = dir + 1;\n\t\t\t\t\t\tif (ldir >= 8) {\n\t\t\t\t\t\t\tldir -= 8;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tint rdir = dir - 1;\n\t\t\t\t\t\tif (rdir < 0) {\n\t\t\t\t\t\t\trdir += 8;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tz[i + 1][cx][cy][ldir] = true;\n\t\t\t\t\t\tz[i + 1][cx][cy][rdir] = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tint ans = 0;\n\tforn(i, N) {\n\t\tforn(j, N) {\n\t\t\tans += used[i][j];\n\t\t}\n\t}\n\tcout << ans << endl;\n}\n\nint main() {\n\tios_base::sync_with_stdio(false);\n#ifdef SU2\n\t\tfreopen(\"input.txt\", \"r\", stdin);\n\t\tfreopen(\"output.txt\", \"w\", stdout);\n#endif\n\n\tsrand((unsigned int)time(NULL));\n\n\tcout << setprecision(15) << fixed;\n\n\tsolve();\n\t\n#ifdef SU2\n\t\tcerr << \"time: \" << clock() << \" ms\" << endl;\n#endif\n\n\treturn 0;\n}", "lang": "MS C++", "bug_code_uid": "a5b6448959f2494bf31c397f507864b9", "src_uid": "a96bc7f93fe9d9d4b78018b49bbc68d9", "apr_id": "778adcdda1ba3aad7725f679e77bceb3", "difficulty": 1900, "tags": ["dp", "dfs and similar", "data structures", "implementation", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9082969432314411, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include \nusing namespace std;\nmain(){\n int k,n,s,p;\n cin>>k>>n>>s>>p;\n int x;\n x=n/s;\n while(n%s!=0)\n x++;\n\n int y;\n while(k*x%p!=0)\n y++;\n cout<\n#include \n#include \nusing namespace std;\n\nint N, V, E;\nint mat[301][301];\nint A[301], B[301];\nvector, int> > R;\n\nvoid flow2(vector& P, int si, int ti, int d) {\n\tint i;\n\tif (si == ti) return;\n\tif (A[P[si + 1]] + d <= V) {\n\t\tA[P[si]] -= d;\n\t\tA[P[si + 1]] += d;\n\t\tR.push_back(make_pair(make_pair(P[si], P[si + 1]), d));\n\t\tflow2(P, si + 1, ti, d);\n\t}\n\telse {\n\t\tint d2 = V - A[P[si + 1]];\n\t\tA[P[si]] -= d2;\n\t\tA[P[si + 1]] += d2;\n\t\tif (d2 > 0) R.push_back(make_pair(make_pair(P[si], P[si + 1]), d2));\n\t\tflow2(P, si + 1, ti, d);\n\t\tA[P[si]] -= d - d2;\n\t\tA[P[si + 1]] += d - d2;\n\t\tR.push_back(make_pair(make_pair(P[si], P[si + 1]), d - d2));\n\t}\n}\n\n#define FOR(y, N) for (int y = 0; y < N; ++y)\n\nint flow(int s, int t, int d) {\n\tint i, j, y;\n\tvector P;\n\tP.push_back(s);\n\tfor (i = s; i != t;) {\n\t\tFOR(y, N) if (mat[i][y] == 1 && mat[y][t] == mat[i][t] - 1) break;\n\t\tP.push_back(i = y);\n\t}\n\n\tflow2(P, 0, P.size() - 1, d);\n}\n\n#define _P printf\n\nvoid solve() {\n\tint f, r, i, j, k, l, x, y;\n\n\tcin >> N >> V >> E;\n\tFOR(i, N) cin >> A[i];\n\tFOR(i, N) cin >> B[i];\n\n\tFOR(x, N) FOR(y, N) mat[x][y] = 9999;\n\tFOR(x, N) mat[x][x] = 0;\n\tFOR(i, E) {\n\t\tcin >> x >> y;\n\t\tmat[x - 1][y - 1] = mat[y - 1][x - 1] = 1;\n\t}\n\tFOR(i, N) FOR(j, N) FOR(k, N) mat[j][k] = min(mat[j][k], mat[j][i] + mat[i][k]);\n\tFOR(x, N) FOR(y, N) {\n\t\tif (mat[x][y] > N) continue;\n\t\tj = min(A[x] - B[x], B[y] - A[y]);\n\t\tif (j <= 0) continue;\n\t\tflow(x, y, j);\n\t}\n\n\tFOR(x, N) if (A[x] != B[x]) return (void)_P(\"NO\\n\");\n\t_P(\"%d\\n\", R.size());\n\tFOR(i, R.size()) _P(\"%d %d %d\\n\", R[i].first.first + 1, R[i].first.second + 1, R[i].second);\n}\n\nint main()\n{\n\tsolve();\n\treturn 0;\n}", "lang": "MS C++ 2017", "bug_code_uid": "ef03461ceb6abba9001dfcf024a2ab5a", "src_uid": "0939354d9bad8301efb79a1a934ded30", "apr_id": "57c3fd9908711a2d2693d5521cb82896", "difficulty": 2500, "tags": ["dfs and similar", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.932757557063541, "equal_cnt": 13, "replace_cnt": 5, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 12, "bug_source_code": "/*\n..... . . . .\n . . . . . . .\n . ..... . .....\n . . . . . .\n*/\n#pragma GCC optimize(\"Ofast\")\n#pragma GCC optimize(\"no-stack-protector\")\n#pragma GCC optimize(\"unroll-loops\")\n#pragma GCC optimize(\"fast-math\")\n#pragma GCC target(\"sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native\")\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n \nusing namespace std;\n \ntemplate void uin(T &a, T b) {\n if (b < a) {\n a = b;\n }\n}\n \ntemplate void uax(T &a, T b) {\n if (b > a) {\n a = b;\n }\n}\n\n#define left left228\n#define right right228\n\nconst int MOD = 1e9 + 7;\n\n\nvector< vector > mult(vector< vector > a, vector< vector > b) {\n int n = (int)a.size() - 1;\n int m = (int)b[1].size() - 1;\n vector< vector > c(n + 1, vector (m + 1, 0));\n for (int i = 1; i <= n; ++i) {\n for (int j = 1; j <= m; ++j) {\n for (int k = 1; k < (int)a[1].size(); ++k) {\n c[i][j] += ((long long)a[i][k] * (long long)b[k][j]) % MOD;\n if (c[i][j] >= MOD) c[i][j] -= MOD;\n }\n }\n }\n return c;\n}\n\n\nvector< vector > power(vector< vector > a, int b) {\n vector< vector > res = a;\n --b;\n while (b) {\n if (b & 1) {\n res = mult(res, a);\n }\n a = mult(a, a);\n b >>= 1LL;\n }\n return res;\n}\n\n\nsigned main() {\n ios_base::sync_with_stdio(false);\n cin.tie(0);\n int n, m;\n cin >> n >> m;\n vector< vector > dp(2, vector (m + 1, 0));\n for (int i = 1; i <= m; ++i) {\n dp[1][i] = 1;\n if (i == m) dp[1][i] = 2;\n }\n if (n == m) {\n cout << 2 << endl;\n return 0;\n }\n vector< vector > p(m + 1, vector (m + 1, 0));\n p[1][m] = 1;\n p[m][m] = 1;\n for (int i = m - 1; i > 0; --i) {\n p[i + 1][i] = 1;\n }\n p = power(p, n - m);\n vector< vector > ans = mult(dp, p);\n cout << ans[1][m] << endl;\n return 0;\n}\n \n \n \n \n/*\n2 0 3\n \n \n3 1 2\n1 2\n \n*/", "lang": "GNU C++17", "bug_code_uid": "5ea5f13c7d877697fd19b2fe5b75679b", "src_uid": "e7b9eec21d950f5d963ff50619c6f119", "apr_id": "964eaa5755fa54e96d0644ae77435a4c", "difficulty": 2100, "tags": ["matrices", "dp", "math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.10501750291715285, "equal_cnt": 40, "replace_cnt": 28, "delete_cnt": 4, "insert_cnt": 8, "fix_ops_cnt": 40, "bug_source_code": "#include \n\nusing namespace std;\n\nchar t[15][15];\nint dx[] = {1,1,1,-1,-1,-1,0,0};\nint dy[] = {-1,0,1,-1,0,1,-1,1};\nint mx;\n\nbool isValid(int row, int col) {\n if (row >= 0 && row < 10 && col >= 0 && col < 10) {\n return true;\n } else {\n return false;\n }\n}\n\nvoid dfsCheck(int r,int c,int len,int rPar,int cPar) {\n mx = max(mx, len);\n for (int i = 0; i < 8; i++) {\n int nextRow = r + dx[i];\n int nextCol = c + dy[i];\n if (isValid(nextRow, nextCol)) {\n if (t[nextRow][nextCol] == 'X' && (nextRow != rPar || nextCol != cPar)) {\n dfsCheck(nextRow, nextCol, len + 1, r, c);\n }\n }\n }\n}\n\nvoid testCell(int row,int col) {\n bool changed = 0;\n if (t[row][col] == '.') {\n t[row][col] = 'X';\n changed = 1;\n }\n dfsCheck(row, col, 1, row,col);\n if (changed) {\n t[row][col] = '.';\n }\n}\n\nint main() {\n for (int i = 0; i < 10; i++) {\n for (int j = 0; j < 10; j++) {\n cin >> t[i][j];\n }\n }\n for (int i = 0; i < 10; i++) {\n for (int j = 0; j < 10; j++) {\n if (t[i][j] != 'O') {\n testCell(i, j);\n }\n }\n }\n puts(mx >= 5 ? \"YES\" : \"NO\");\n}", "lang": "GNU C++14", "bug_code_uid": "f78b3d1e5bb65bccc4b1bea611847b1b", "src_uid": "d5541028a2753c758322c440bdbf9ec6", "apr_id": "cab90746dbf0e86ebdcdb7a056254a99", "difficulty": 1600, "tags": ["brute force", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8385542168674699, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "#include \n \n \nusing namespace std;\n \nint main()\n{\n int a,b;\n \n cin>>a>>b;\n int i;\n for(i= 1; i<=a;i++){\n b += i*5;\n if (b>240) { return i;}\n }\n \n}", "lang": "GNU C++11", "bug_code_uid": "7164a065d3d8273d761014aab9de1836", "src_uid": "41e554bc323857be7b8483ee358a35e2", "apr_id": "103b8ce56d2f15f801643c2e5e7626ca", "difficulty": 800, "tags": ["math", "brute force", "implementation", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.1583257506824386, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 4, "insert_cnt": 0, "fix_ops_cnt": 9, "bug_source_code": "#include \n\nusing namespace std;\n\n\ntypedef pair pii;\n\npii Func(int a, int b) {\n\tint GCD = __gcd(a, b);\n\treturn pii((a / GCD), (b / GCD));\n}\n\nint Abs(int x) {return ((x < 0)?(-x):(x));} \n\nint main() {\n\tint a, b, c, d;\n\tcin >> a >> b >> c >> d;\n\t\n\tint mint = 2000000000, mintx = 1, minty = 1;\n\t\n\tint X, Y;\n\t\n\tfor (int i = 1; i <= 1000; ++i) {\n\t\tfor (int j = 1; j <= 1000; ++j) {\n\t\t\tX = (a * j) * (b * j);\n\t\t\tY = (c * i) * (d * i);\n\t\t\tif (((Y - X) < mint) && ((Y - X) >= 0)) {\n\t\t\t\tmint = Y - X;\n\t\t\t\tmintx = j;\n\t\t\t\tminty = i;\n\t\t\t\t//cout << i << ' ' << j << '\\n';\n\t\t\t}\n\t\t}\n\t}\n\tX = (a * mintx) * (b * mintx);\n\tY = (c * minty) * (d * minty);\n\tpii res = Func((Y - X), Y);\n\tcout << res.first << '/' << res.second << '\\n';\n\t\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "f1bae6a15afd5b9ad2aaea0fb9243502", "src_uid": "b0f435fc2f7334aee0d07524bc37cb1e", "apr_id": "679571e3123f3925e1f2309b5359b832", "difficulty": 1400, "tags": ["greedy", "math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.2863013698630137, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n long long int x,y,i=1,j;\n cin>>x>>y;\n\n if(x<=1&&y==0&&x>=0)\n cout<<\"0\";\n else if(x==1&&y>0&&y<=1)\n cout<<\"1\";\n else\n {\n while(1)\n {\n if(y==i&&x=-i)\n {\n cout<<4*i-2;\n break;\n }\n if(x==-i&&y=-i)\n {\n cout<<4*i-1;\n break;\n }\n if(y==-i&&x<=i&&x>-i)\n {\n cout<<4*i;\n break;\n }\n if(x==2*i&&y>-i&&y<=i)\n {\n cout<<4*i+1;\n break;\n }\n i++;\n \n \n }\n }\n return 0;\n\n}", "lang": "GNU C++14", "bug_code_uid": "f8eb51b583f09c145d49ffa31aadd089", "src_uid": "2fb2a129e01efc03cfc3ad91dac88382", "apr_id": "b63e606f466f9f9aa660c34959bf6785", "difficulty": 1400, "tags": ["geometry", "brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9829424307036247, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n\n\nusing namespace std;\nint main() {\n\n int n,k; cin>>n>>k;\n vector vc;\n for (int i = 0; i < n; ++i) {\n int x;cin>>x;\n vc.emplace_back(x);\n }\n \n int sum=0;int c=k;\n for (int j = 0; j < n; ++j) {\n\n while (k>= vc[j] && j\n\nusing namespace std;\n\nconst long long kMOD = 1e9 + 7;\n\nstruct Mat {\n vector> a;\n int n, m;\n\n Mat (const vector> &a): a(a), n(a.size()), m(a[0].size()) {}\n\n Mat (int n, int m, int val = 0): n(n), m(m) {\n a.resize(n);\n for (int i = 0; i < n; ++i) {\n a[i].resize(m);\n if (i < m) a[i][i] = val;\n }\n }\n\n const vector& operator [] (int i) const {\n return a[i];\n }\n\n vector& operator [] (int i) {\n return a[i];\n }\n\n Mat operator * (const Mat &B) const {\n assert(m == B.n);\n Mat ans = Mat(n, B.m);\n for (int i = 0; i < n; ++i) {\n for (int j = 0; j < B.m; ++j) {\n for (int k = 0; k < m; ++k) {\n ans[i][j] += (a[i][k] * B[k][j]) % kMOD;\n }\n ans[i][j] %= kMOD;\n }\n }\n return ans;\n }\n\n void print () const {\n for (int i = 0; i < n; ++i) {\n for (int j = 0; j < m; ++j) {\n cout << a[i][j] << \" \";\n }\n cout << \"\\n\";\n }\n }\n};\n\nMat b_pow (Mat A, int deg) {\n if (deg == 0) return Mat(A.n, A.m, 1);\n if (deg == 1) return A;\n if (deg == 2) return A * A;\n return deg % 2 ? b_pow(A, deg / 2) * b_pow(A, deg / 2 + 1) :\n b_pow(b_pow(A, deg / 2), 2);\n}\n\nint main() {\n#ifdef _DEBUG\n freopen(\"input.txt\", \"r\", stdin);\n freopen(\"output.txt\", \"w\", stdout);\n#endif\n long long n, k;\n cin >> n >> k;\n Mat A(2 * k + 3, 2 * k + 3);\n vector c(k + 1, 0);\n c[0] = 1;\n for (int i = 1; i < k + 1; ++i) {\n long long b = 0;\n for (int j = 0; j <= i; ++j) {\n long long t = b;\n b = c[j] % kMOD;\n c[j] += t;\n c[j] %= kMOD;\n }\n }\n for (int i = 0; i < k + 1; ++i) {\n A[i][i + k + 1] = 1;\n for (int j = 0; j <= i; ++j) {\n A[i + k + 1][j + k + 1] = (A[i + k][j + k] + A[i + k][j + k + 1]) % kMOD;\n A[k + 1][k + 1] = 1;\n A[i + k + 1][j] = (A[i + k + 1][j + k + 1] * ((1 << (i - j)) % kMOD)) % kMOD;\n }\n A[2 * k + 2][i] = (c[i] * ((1 << (k - i)) % kMOD)) % kMOD;\n A[2 * k + 2][i + k + 1] = c[i]; \n }\n A[2 * k + 2][2 * k + 2] = 1;\n Mat B(2 * k + 3, 1);\n for (int i = 0; i < 2 * k + 3; ++i) {\n B[i][0] = 1;\n }\n for (int i = 1; i < k + 1; ++i) {\n B[i][0] = 0;\n }\n cout << (b_pow(A, n - 1) * B)[2 * k + 2][0] << \"\\n\";\n#ifdef _DEBUG\n A.print();\n cout << \"\\n\";\n (b_pow(A, 0) * B).print();\n cout << \"\\n\";\n (A * B).print();\n cout << \"\\n\";\n (b_pow(A, 2) * B).print();\n cout << \"\\n\";\n (b_pow(A, n - 1) * B).print();\n#endif\n}\n", "lang": "GNU C++11", "bug_code_uid": "265c0737eedbda064665d6340a345203", "src_uid": "14f50a111db268182e5927839a993118", "apr_id": "33a888d500f4eaf744ba8ef727dd6d37", "difficulty": null, "tags": ["matrices", "math", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.7734170591313448, "equal_cnt": 18, "replace_cnt": 11, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 17, "bug_source_code": "#include \nusing namespace std;\nconst int N = 2e6 + 1,M = 1e9 + 7;\nmt19937_64 rng(std::chrono::system_clock::now().time_since_epoch().count());\nint n,k;\nbool bad[N];\nvectordivi[N],need[N];\nvoid add(int &a,int b){\n\ta+=b;\n\tif(a >= M)a-=M;\n\tif(a < 0)a+=M;\n}\nint power(int base,int to){\n\tint ret = 1;\n\twhile(to){\n\t\tif(to&1)ret = ret*1LL*base%M;\n\t\tto>>=1;\n\t\tbase = base*1LL*base%M;\n\t}\n\treturn ret;\n}\nint main(){\n\tscanf(\"%d%d\",&n,&k);\n\tfor(int i = 2;i < N;i++)\n\t\tif(divi[i].empty())\n\t\t\tfor(int j = i;j < N;j+=i){\n\t\t\t\tif(!(j%(i*1LL*i)))bad[j] = 1;\n\t\t\t\tdivi[j].push_back(i);\n\t\t\t}\n\tfor(int i = 2;i < N;i++)\n\t\tfor(int j = i;j < N;j+=i)\n\t\t\tneed[j].push_back(i);\n\tint ans = 0,sum = 0,temp = 0;\n\tfor(int i = 1;i <= k;i++){\n\t\tsum = power(i,n);\n\t\tfor(auto j : need[i]){\n\t\t\tif(bad[j])continue;\n\t\t\tadd(temp,-power((i - 1)/j,n)*(divi[j].size()%2 ? 1 : -1));\n\t\t\tadd(temp,power(i/j,n)*(divi[j].size()%2 ? 1 : -1));\n\t\t}\n\t\tadd(sum,-temp);\n\t\tadd(ans,sum^i);\n\t}\n\tprintf(\"%d\\n\",ans);\n}", "lang": "GNU C++17", "bug_code_uid": "9c5a81770250cc8bb6f7ba26e9b2d4f3", "src_uid": "122c08aa91c9a9d6a151ee6e3d0662fa", "apr_id": "e8bd26a062f88acceea4554229c91150", "difficulty": 2300, "tags": ["math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7043478260869566, "equal_cnt": 10, "replace_cnt": 4, "delete_cnt": 5, "insert_cnt": 0, "fix_ops_cnt": 9, "bug_source_code": "#include \n#include \ntypedef long long ll;\n\nusing namespace std;\n\nint main()\n{\n ll n,i,j,d;\n vector v;\n cin >> n;\n for(i=1;i0)\n cout << v[0];\n else\n cout << n;\n\n}\n", "lang": "GNU C++17", "bug_code_uid": "31f0ade5375279bdea61ac4ec8d33898", "src_uid": "c30b372a9cc0df4948dca48ef4c5d80d", "apr_id": "56af5e5f2501cda2fb0441a6c38a5ac5", "difficulty": 800, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.2831661092530658, "equal_cnt": 6, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "#include \n\nusing namespace std;\n\nint main()\n{\n\tunsigned long long a, b, ans = 1; cin >> a >> b;\n\tif(a == 1)\n\t{\n\t\tcout << b; return 0;\n\t}\n\tif(b == 1)\n\t{\n\t\tcout << a; return 0;\n\t}\n\twhile(true)\n\t{\n\t\tif(a == 1)\n\t\t{\n\t\t\tans += b;\n\t\t\tbreak;\n\t\t}\n\t\tif(b == 1)\n\t\t{\n\t\t\tans += a;\n\t\t\tbreak;\n\t\t}\n\t\tif(a > b)\n\t\t{\n\t\t\ta = a - b;\n\t\t\tans++;\n\t\t}\n\t\tif(a < b)\n\t\t{\n\t\t\tb = b - a;\n\t\t\tans++;\n\t\t}\n\t\tif(a == b)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t}cout << ans;\n}", "lang": "GNU C++", "bug_code_uid": "5c4ab87ace42bddbaf7a86b5f4ba9fe6", "src_uid": "ce698a0eb3f5b82de58feb177ce43b83", "apr_id": "52cb5c71ebcbb0a6e9a14375656744b4", "difficulty": 1100, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9323607427055703, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#include \n#define mod 1000000007\n#define pb push_back\n#define mid(l, r) ((l)+(r))/2\n#define len(a) (a).length()\n#define sz(a) (a).size()\n#define xx first\n#define yy second\n#define inf int(2e9)\n#define ff(i, a, b) for(int (i) = (a); (i) <= (b); ++(i))\n#define fb(i, a, b) for(int (i) = (a); (i) >= (b); --(i))\n\n\nusing namespace std;\n\ntypedef long long ll;\ntypedef pair pii;\n\ntemplate\nvoid print(const T niz[], const int siz)\n{\n for(int i=0;i>a>>b>>c>>n;\n if(a>n || b>n || n==0 || c>a || c>b || c>a+b)\n return -1;\n if(a+b-c>=n)\n return -1;\n cout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\nconst double Pi = 3.1415926536;\nvector v;\nint res = 0;\nint n;\nvoid BFS()\n{\n\tqueue, int>> q;\n\tint min = 1000;\n\twhile (v[res] == 0)\n\t{\n\t\tres++;\n\t}\n\tif (v[res] == 1)\n\t{\n\t\tq.push(make_pair(make_pair(res+1, res), 1));\n\t}\n\tif (v[res] == 2)\n\t{\n\t\tq.push(make_pair(make_pair(res+1, res), 2));\n\t}\n\tif (v[res] == 3)\n\t{\n\t\tq.push(make_pair(make_pair(res+1, res), 2));\n\t\tq.push(make_pair(make_pair(res+1, res), 1));\n\t}\n\tq.push(make_pair(make_pair(res+1, res + 1), 0));\n\twhile (!q.empty())\n\t{\n\t\tint a = q.front().first.first;\n\t\tint b = q.front().first.second;\n\t\tint c = q.front().second;\n\t\tq.pop();\n\t\tif (a == n)\n\t\t{\n\t\t\tif (min > b)\n\t\t\t{\n\t\t\t\tmin = b;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tif (c == 1)\n\t\t{\n\t\t\tif (v[a] == 2)\n\t\t\t{\n\t\t\t\tq.push(make_pair(make_pair(a + 1, b), 2));\n\t\t\t}\n\n\t\t\tif (v[a] == 3)\n\t\t\t{\n\t\t\t\tq.push(make_pair(make_pair(a + 1, b), 2));\n\t\t\t}\n\t\t\tq.push(make_pair(make_pair(a + 1, b + 1), 0));\n\t\t}\n\t\tif (c == 2)\n\t\t{\n\t\t\tif (v[a] == 1)\n\t\t\t{\n\t\t\t\tq.push(make_pair(make_pair(a + 1, b), 1));\n\t\t\t}\n\n\t\t\tif (v[a] == 3)\n\t\t\t{\n\t\t\t\tq.push(make_pair(make_pair(a + 1, b), 1));\n\t\t\t}\n\t\t\tq.push(make_pair(make_pair(a + 1, b + 1), 0));\n\t\t}\n\t\tif (c == 0)\n\t\t{\n\t\t\tif (v[a] == 3)\n\t\t\t{\n\t\t\t\tq.push(make_pair(make_pair(a + 1, b), 1));\n\t\t\t\tq.push(make_pair(make_pair(a + 1, b), 2));\n\t\t\t}\n\t\t\tif (v[a] == 2)\n\t\t\t{\n\t\t\t\tq.push(make_pair(make_pair(a + 1, b), 2));\n\t\t\t}\n\t\t\tif (v[a] == 1)\n\t\t\t{\n\t\t\t\tq.push(make_pair(make_pair(a + 1, b), 1));\n\t\t\t}\n\t\t\tq.push(make_pair(make_pair(a + 1, b + 1), 0));\n\t\t}\n\t}\n\tres = min;\n}\nint main()\n{\n#ifdef _KOCHERGIN\n\tfreopen(\"abc.txt\", \"r\", stdin);\n#else\n\t//freopen(\"sample.in\", \"r\", stdin);\n\t//freopen(\"abc.out\", \"w\", stdout);\n#endif\n\tcin >> n;\n\tv.resize(n);\n\tfor (int i = 0; i < n; ++i)\n\t{\n\t\tcin >> v[i];\n\t}\n\tif (n == 1 && v[0] == 0)\n\t{\n\t\tcout << 1;\n\t\treturn 0;\n\t}\n\tBFS();\n\tcout << res << endl;\n\treturn 0;\n}", "lang": "MS C++", "bug_code_uid": "1356aa1a4ef55e3a91fb5e823453ba2a", "src_uid": "08f1ba79ced688958695a7cfcfdda035", "apr_id": "5ec180531571520a7baa0fdbd2baec55", "difficulty": 1400, "tags": ["dp", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.18143681174619822, "equal_cnt": 23, "replace_cnt": 9, "delete_cnt": 10, "insert_cnt": 5, "fix_ops_cnt": 24, "bug_source_code": "\n#include \n#include \nint pan(char c)\n{\n if(c=='a'||c=='o'||c=='i'||c=='u'||c=='e')\n {\n return 1;\n\n }\n else if(c=='n')\n {\n return 2;\n }\n else\n {\n return 0;\n }\n}\nint pan_fu(char c)\n{\n if(pan(c)==1)\n {\n return 1;\n }\n else\n {\n return 0;\n }\n}\nint main()\n{ char a[101],*p;\n int n,ji;\n while(1)\n {\n gets(a);\n ji=0;\n n=strlen(a);\n p=a;\n while(*p!='\\0')\n {\n if(pan(*p)==0)\n {\n p++;\n if(pan_fu(*p)==1)\n { p++;\n continue;\n }\n else\n {\n ji=1;\n break;\n }\n\n }\n else if(pan(*p)==2)\n {\n p++;\n if(*p=='\\0')\n {\n break;\n }\n else if(pan(*p)==1)\n { p++;\n continue;\n }\n else\n {\n continue;\n }\n\n }\n else\n {\n continue;\n }\n }\n if(ji==1)\n {\n printf(\"NO\\n\");\n }\n else\n {\n printf(\"YES\\n\");\n }\n }\n\n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "aab3c62049c80f5087a2607470a4c94c", "src_uid": "a83144ba7d4906b7692456f27b0ef7d4", "apr_id": "522b81ea865020f8cb70600c41649835", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.571912013536379, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "#include\n#define FOR(i,a,b) for(int i=a; i<=b; i++)\n#define N 20\nusing namespace std;\nstring s,ss;\nint main(){\n cin>>s; ss=s;\n FOR(i,0,ss.size()) ss+=ss[i];\n FOR(i,1,5){\n string st;\n cin>>st;\n if (st[0]==s[0]||st[1]==s[1]) {cout<<\"YES\"; exit(0);}\n }\n cout<<\"NO\";\n}", "lang": "GNU C++11", "bug_code_uid": "88a8110c01471506c1d715d3034451cc", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "apr_id": "bb49393d3a9d259ab8497e3d47aa9b17", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.593521421107628, "equal_cnt": 23, "replace_cnt": 8, "delete_cnt": 7, "insert_cnt": 7, "fix_ops_cnt": 22, "bug_source_code": "#include \n#include \n#include \n\nusing namespace std;\n\nint main(int argc, char *argv[])\n{long long k=0, x;\n\ncin>>x;\n\nwhile(x){\n if(x%4==0 || x%7==0) \n {k++; x/=10;} \n}\n\n/*for (int i=0;i0){\n while(k){\n if(k%4!=0 && k%7!=0) { cout<<\"NO\"; break; }\n if(k<10) cout<<\"YES\";\n else k/=10;\n }\n\n}\nelse cout<<\"NO\";\n\n\ncout<\n#define ios ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);\n#define ll long long\n#define bit(x,j) ((x>>j)&1)\nusing namespace std;\n// bitset<8>set1(p);\n// __builtin_popcountll(x);\n// bitset<100> b(\"1010\");\nll int mod=998244353;\nint mul(ll int x, ll int y)\n{\n return (x * 1ll * y) % mod;\n}\n\nint add(int x, int y)\n{\n x += y;\n while(x >= mod) x -= mod;\n while(x < 0) x += mod;\n return x;\n}\n\nlong long power(long long a, long long b,ll m) {\n a %= m;\n long long res = 1;\n while (b > 0) {\n if (b & 1)\n res = mul(res,a);\n a = mul(a,a);\n b >>= 1;\n }\n return res%m;\n }\n ll int binomial(ll int n, ll int k,ll m) \n{ \n ll int C[k+1]; \n memset(C, 0, sizeof(C)); \n \n C[0] = 1; // nC0 is 1 \n \n for (ll int i = 1; i <= n; i++) \n { \n // Compute next row of pascal triangle using \n // the previous row \n for (int j = min(i, k); j > 0; j--) \n C[j] = add(C[j],C[j-1]); \n } \n return C[k]%m; \n} \n vector pr;\n bool prime[10000000];\nvoid Sieve(ll int n) \n{ \n memset(prime, true, sizeof(prime)); \n prime[1]=false;\n \n for (int p=2; p*p<=n; p++) \n { \n if (prime[p] == true) \n { \n pr.push_back(p);\n for (int i=p*p; i<=n; i += p) \n prime[i] = false; \n } \n } \n}\n \n\n\n//It reurns Fn,Fn+1\npair fib (int n) {\n if (n == 0)\n return {0, 1};\n\n auto p = fib(n >> 1);\n int c = p.first * (2 * p.second - p.first);\n int d = p.first * p.first + p.second * p.second;\n if (n & 1)\n return {d, c + d};\n else\n return {c, d};\n}\nint sum(int n) \n{ \n if (n == 0) \n return 0; \n return (n % 10 + sum(n / 10)); \n} \nll int factorial(ll int n,ll int m) \n{ \n ll int fact = 1; \n for(int i=2;i<=n;i++) { \n fact = (fact * i)%m; \n } \n return fact%m; \n} \n\nvoid reverse(string& str) \n{ \n int n = str.length(); \n \n // Swap character starting from two \n // corners \n for (int i = 0; i < n / 2; i++) \n swap(str[i], str[n - i - 1]); \n} \nint main() {\n ll int n,m;\n cin>>n>>m;\n ll int a[n];\n for(int i=0;i>a[i];\n }\n ll int b[m];\n ll int k=0;\n mapmp;\n for(int i=0;i>b[i];\n mp[i+1]=b[i];\n k+=b[i];\n }\n ll int l=k;\n //cout<ma[100005];\n int o=0;\n int y[m+1]={0};\n int r[m+1]={0};\n for(int i=0;i0)\n {\n mp[a[i]]--;\n ma[a[i]][y[a[i]]]=i;\n y[a[i]-1]++;\n l--;\n }\n else\n {\n for(int j=0;j0)\n {\n i=ma[a[i]][r[a[i]-1]];\n r[a[i]-1]++;\n }\n }\n // cout<\n#include \nusing namespace std;\n#define rep(x, a, b) for(int x=a; x<=b; x++)\n#define drp(x, a, b) for(int x=a; x>=b; x--)\nconst int mod=1000000007;\nint n, m, f[2000][2000], g[2000], p, q, S[2000], a, b, k, P[2000];\nint power(int a, int k){\n\tint ret=1;\n\twhile(k)\n\t{\n\t\tif(k&1) ret=1ll*ret*a%mod;\n\t\ta=1ll*a*a%mod; k>>=1;\n\t}\n\treturn ret;\n}\nint main(){\n\tscanf(\"%d%d%d%d%d\", &n, &m, &a, &b, &k);\n\tp=1ll*a*power(b, mod-2)%mod;\n\tq=1ll*(b-a)*power(b, mod-2)%mod;\n\tint c=1;\n\trep(i, 0, k)\n\t{\n\t\tP[i]=1ll*c*power(p, i)%mod*power(q, k-i)%mod;\n\t\tc=1ll*c*(k-i)%mod*power(i+1, mod-2)%mod;\n\t}\n\tS[0]=P[0];\n\trep(i, 1, m) S[i]=(S[i-1]+P[i])%mod;\n\trep(l, 1, m) f[1][l]=(f[1][l-1]+1ll*P[l-1]*S[m-l])%mod;\n/*\nforce dp\n\nF(i,L)=F(i,L-1)+P(l-1)*\ufffd\ufffdP(r)[f(i-1,m-r)+f(i-1,m-l+1)-f(i-1,m)] (m-l>=r>=0)\n=F(i,l-1)+P(l-1)*[S(m-l)( F(i-1,m-l+1)-F(i-1,m) ) + \ufffd\ufffdP(r) F(i-1,m-r)] (m-l>=r>=0)\n*/\n\trep(i, 2, n) rep(l, 1, m)\n\t{\n\t\tf[i][l]=f[i][l-1];\n\t\trep(r, 0, m-l)\n\t\t{\n\t\t\tint v=(1ll*f[i-1][m-l+1]+f[i-1][m-r]+mod-f[i-1][m])%mod;\n\t\t\tf[i][l]=(f[i][l]+1ll*P[l-1]*P[r]%mod*v)%mod;\n\t\t}\n\t}\n\n/*\trep(i, 2, n)\n\t{\n\t\tg[0]=1ll*P[0]*f[i-1][m]%mod;\n\t\trep(r, 1, m) g[r]=(g[r-1]+1ll*P[r]*f[i-1][m-r])%mod;\n\t\trep(l, 1, m)\n\t\t{\n\t\t\tint v=0;//g[m-l];\n\t\t\trep(r, 0, m-l) v=(v+1ll*P[r]*f[i-1][m-r])%mod;\n//\t\t\tv=(v+1ll*S[m-l]*(f[i-1][m-l+1]+mod-f[i-1][m]))%mod;\n\t\t\trep(r, 0, m-l) v=(v+1ll*P[r]*f[i-1][m-l+1])%mod;\n//\t\t\tv=(v+1ll*S[m-l]*(mod-f[i-1][m]))%mod;\n\t\t\trep(r, 0, m-l) v=(v+1ll*P[r]*(mod-f[i-1][m]))%mod;\n\t\t\tf[i][l]=(f[i][l-1]+1ll*P[l-1]*v)%mod;\n\t\t}\n\t}*/\n\tprintf(\"%d\\n\", f[n][m]);\n}\n", "lang": "GNU C++11", "bug_code_uid": "6823d4c5cecf953afa47dee521d78359", "src_uid": "33b6b0d3a6af273f22b703491bd17289", "apr_id": "b29f097d14c8474c14d8eab9533727be", "difficulty": 3100, "tags": ["dp", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.3818443804034582, "equal_cnt": 12, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 11, "bug_source_code": "#ifdef _MSC_VER\n#define _CRT_SECURE_NO_WARNINGS\n#endif\n\n#include \n\nusing namespace std;\n#define OO ll(1e18)\ntypedef unsigned long long ull;\ntypedef long long ll;\n\nint bfs(int x, int y) {\n\tqueue>>q;\n\tq.push({ x,{y,0} });\n\twhile (q.size()) {\n\t\tx = q.front().first;\n\t\ty = q.front().second.first;\n\t\tint c = q.front().second.second;\n\t\tq.pop();\n\t\tif (!x && !y)return c;\n\t\tif (x - 1 >= 0)\n\t\t\tq.push({ x - 1,{ y,c + 1 } });\n\t\tif (y - 1 >= 0)\n\t\t\tq.push({ x ,{ y - 1,c + 1 } });\n\t\tif (y - 1 >= 0 && x - 1 >= 0)\n\t\t\tq.push({ x - 1 ,{ y - 1,c + 1 } });\n\t}\n}\n\nint main() {\n\tint xp, yp, xv, yv;\n\tcin >> xp >> yp >> xv >> yv;\n\tint d = bfs(xv, yv);\n\tif ((xp + yp) - d <= 1)cout << \"Polycarp\\n\";\n\telse cout << \"Vasiliy\\n\";\n}", "lang": "GNU C++11", "bug_code_uid": "b2c14770f96182a8926d569727508ade", "src_uid": "2637d57f7809ff8f922549c617709074", "apr_id": "36641f6882f59328e9daf8b15e878c7f", "difficulty": 1700, "tags": ["math", "greedy", "games", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.11324470704086657, "equal_cnt": 12, "replace_cnt": 5, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 12, "bug_source_code": "#include \nlong long f[100000001], c0, c1;\nint N;\nint main()\n{\n\tscanf(\"%d%lld%lld\", &N, &c0, &c1);\n\tf[1] = 0;\n\tfor (int i = 2, lc = 1; i <= N; i++)\n\t{\n\t\tif (i - lc > 1 && f[lc] + f[i - lc] > f[lc + 1] + f[i - lc - 1] + c0 - c1)\n\t\t\tlc++;\n\t\tf[i] = f[lc] + f[i - lc] + lc * c0 + (i - lc) * c1;\n\t}\n\tprintf(\"%lld\\n\", f[N]);\n\treturn 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "017875c56009e782f49c59fe0821a1a7", "src_uid": "39b824b740a40f68bae39b8d9f0adcbe", "apr_id": "d1d9531825d54d87dbb29f7b463501e3", "difficulty": 2700, "tags": ["dp", "greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8554307116104869, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "#include\nusing namespace std;\nint main ()\n{\n int n, m, r, a, b, k;\n cin >> n >> a >> b;\n map < long long, int > mp;\n mp[0] = 1;\n n--;\n while (n){\n long long cost = mp.begin() -> first;\n int cnt = mp.begin() -> second;\n if (cnt <= n)\n mp.erase(mp.begin());\n else\n mp[cost] -= n;\n int erased = min (n, cnt);\n mp[a+cost]+= erased;\n mp[b+cost]+= erased;\n n -= erased;\n }\n long long ans = 0;\n for(auto it : mp)\n ans += it.first * it.second;\n cout << ans ;\n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "7580a14dadb98b8a78eeb2d196acb5f5", "src_uid": "39b824b740a40f68bae39b8d9f0adcbe", "apr_id": "8f6cf60d67d1e08269edd21b84be6d9b", "difficulty": 2700, "tags": ["dp", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9993416721527321, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \nusing namespace std;\n#define printint(v) copy(begin(v), end(v), ostream_iterator(cout,\" \"))\n#define printintv(s,e) copy(s,e, ostream_iterator(cout,\" \"))\n#define forstl(i,v) for(auto &i: v)\n#define forn(i,e) for(int i = 0; i < e; i++)\n#define forsn(i,s,e) for(int i = s; i < e; i++)\n#define rforn(i,s) for(int i = s; i >= 0; i--)\n#define rforsn(i,s,e) for(int i = s; i >= e; i--)\n#define clz(a) __builtin_clz(a) // count leading zeroes\n#define ctz(a) __builtin_ctz(a) // count trailing zeroes\n#define popc(a) __builtin_popcount(a) // count set bits (for ints only diff for ll)\n//https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html for other in built\n#define ln \"\\n\"\n#define dbg(x) cout<<#x<<\" = \"< p32; \ntypedef pair p64;\ntypedef pair pdd;\ntypedef vector v64;\ntypedef vector v32;\ntypedef vector > vv32;\ntypedef vector vp64;\ntypedef vector vp32;\ntypedef map m32;\n#pragma GCC optimize (\"-O2\")\nconst int LIM = 5e5+5, MOD = 1e9+7;\nint t,n,m,k,x,y;\n\nint main()\n{\n\tIOS;\n\tint x,y,z,t1,t2,t3;\n\tcin>>x>>y>>z>>t1>>t2>>t3;\n\tint t_ele=abs(z-x)*t2+ 3*t3 + abs(x-y)*t2;\n\t//t_ele = min(t_ele,abs(z-x)*t1 + 3*t3 + abs(z-y)*t2);\n\tint t_foot=abs(x-y)*t1;\n\tcout<\nusing namespace std;\ntypedef long long int lli;\nlli M=998244353; \n#define INF 1000000007\ntypedef pair ll;\n#define mem(a,x) memset(a,x,sizeof(a))\nlli n,k,m; \nlli z,q,u,a1,l,r,ax,cx,ay,by,cy,ql,qr,d,x,y;\nlli w[300007];\n//unordered_map,lli> mp;\nmap dp;\nlli ma=0;\nlli pa=0;\nstring v[20000000];\nlli cn=0;\nvoid solve(lli cnt,string s,char j)\n{\n if(cnt==k+1)\n {\n s+=j;\n v[cn++]=s;\n return;\n }\n else if(cnt>1)\n {\n s+=j;\n }\n for(int i=1;i<=k;i++)\n {\n char ch=(char)(i+48);\n solve(cnt+1,s,ch);\n }\n}\nbool cmp(ll a,ll b)\n{\n if(a.first==b.first)\n return a.second vis;\nbool solve1(string a)\n{\n lli res=0;\n for(lli i=0;i>n>>k;\nchar ch=(char)(48);\nsolve(1,\"\\0\",ch);\nlli tot=0;\nfor(int j=0;j\nusing namespace std;\nint main()\n{\n\tlong long int n,m,k;\n\tcin>>n>>m>>k;\n\tlong long int x=1,y=1;\n\tif(k<=(n-1))\n\t{\n\t\tx=x+k;\n\t\n\t}\n\telse if(k>=(n-1) && k<=(m-1))\n\t{\n\t\tx=n;\n\t\ty=y+k-(n-1);\n\t\t\n\t}\n\telse\n\t{\n\t\tk=k-(n-1+m-1);\n\t\tlong long int temp;\n\t\ttemp=(m-2)+1;\n\t\tlong long int tim=0;\n\t\ttim=k/temp;\n\t\tx=n-tim;\n\t\tif(tim%2==0)\n\t\t{\n\t\ty=m;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ty=2;\n\t\t}\n\t\tlong long int l;\n\t\tl=k%tim;\n\t\t\n\t\tif(l>=1)\n\t\t{\n\t\t\tx=x-1;\n\t\t\tl=l-1;\n\t\t\tif(tim%2==0)\n\t\t\t{\n\t\t\t\n\t\t\twhile(l--)\n\t\t\t{\n\t\t\t\ty--;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\twhile(l--)\n\t\t\t{\n\t\t\t\ty++;\n\t\t\t}\n\t\t}\n\t\t}\n\t\t\n\t}\n\tcout<\n#include \n#include \n \nusing namespace std;\nusing namespace __gnu_pbds;\n \n#define fi first\n#define se second\n#define mp make_pair\n#define pb push_back\n#define fbo find_by_order\n#define ook order_of_key\n \ntypedef long long ll;\ntypedef pair ii;\ntypedef vector vi;\ntypedef long double ld; \ntypedef tree, rb_tree_tag, tree_order_statistics_node_update> pbds;\ntypedef set::iterator sit;\ntypedef map::iterator mit;\ntypedef vector::iterator vit;\n\nint a[100001];\n\nint main()\n{\n\n\tint t;\n\tcin >> t;\n\twhile(t--){\n\t\tll n, A , B , x , y , z;\n\n\t\tcin >> n >> A >> B >> x >> y >> z;\n\t\tpriority_queueq;\n\n\t\tfor(int i = 0 ; i < n ; i++ ){\n\t\t\tint p;\n\t\t\tcin >> p ;\n\t\t\tq.push(p);\n\t\t}\n\t\tll bb = z - B;\n\n\t\tif(bb<=0){\n\t\t\tcout<<\"RIP\"<= cum)\n\t\t{\n\t\t\taa -= cum;\n\t\t\t// cout<\nusing namespace std;\n\nlong long w, cnt, a[2][8];\nset s;\n\nint main() {\n ios_base::sync_with_stdio(false);\n cin.tie(0), cout.tie(0);\n s.insert(0);\n cin >> w;\n for(int i = 0; i < 8; ++i) {\n cin >> cnt;\n if(cnt == 0) continue;\n long long j = 0;\n while(2 * j + 1 <= cnt) {\n j = 2 * j + 1;\n }\n a[0][i] = j;\n a[1][i] = cnt - a[0][i];\n j = 0;\n do {\n if(j == 0) j = 1;\n else j *= 2;\n for(set::iterator it = (--s.end()); ; --it) {\n if((*it) + j * (i + 1) <= w) s.insert((*it) + j * (i + 1));\n if(it == s.begin()) break;\n }\n } while(j != (a[0][i] + 1) / 2);\n for(set::iterator it = (--s.end()); ; --it) {\n if((*it) + a[1][i] * (i + 1) <= w) {\n s.insert((*it) + a[1][i] * (i + 1));\n }\n if(it == s.begin()) break;\n }\n }\n cout << *(--s.end()) << endl;\n return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "aeec6e01a8c5b1256cc142fe78776557", "src_uid": "8097e10157320524c0faed56f2bc4880", "apr_id": "2639be61d35d5bdb4e0d6aa5de74b384", "difficulty": 2300, "tags": ["dp", "dfs and similar", "greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9632727272727273, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\nconst int N = 253456;\n\nint i, j, k;\n\nmap, unsigned long long> f;\nvector > u;\nvector acc;\nunsigned long long solve(unsigned long long w, int x){\n\tif(x == -1) return 0;\n\t// if(w >= acc[x]) return w - acc[x];\n\tauto it = f.find(make_pair(w, x));\n\tif(it != f.end()) return it->second;\n\tunsigned long long ans = solve(w, x - 1);\n\tfor(int i = 1; i <= u[x].second; i++){\n\t\tunsigned long long v = u[x].first * i;\n\t\tif(v <= w){\n\t\t\tans = max(ans, v + solve(w - v, x - 1));\n\t\t}\n\t}\n\treturn f[make_pair(w,x)]=ans;\n}\nint main(){\n\tunsigned long long w; scanf(\"%llu\", &w);\n\tmap g;\n\tfor(i = 1; i <= 8; i++){\n\t\tunsigned long long x; scanf(\"%llu\", &x);\n\t\tg[i] = x;\n\t}\n\twhile(!g.empty()){\n\t\tauto [pt, qt] = *g.begin(); g.erase(g.begin());\n\t\tif(qt == 0) continue;\n\t\tif(qt <= 2) u.push_back(pair(pt, qt));\n\t\telse {\n\t\t\tif(qt%2){\n\t\t\t\tu.push_back(pair(pt, 1));\n\t\t\t\tg[pt*2] += qt/2;\n\t\t\t} else {\n\t\t\t\tu.push_back(pair(pt, 2));\n\t\t\t\tg[pt*2] += (qt-2)/2;\n\t\t\t}\n\t\t}\n\t}\n\tunsigned long long ac = 0;\n\tfor(auto [pt, qt] : u) {\n\t\tac += pt * qt;\n\t\tacc.push_back(ac);\n\t}\n\tcout << solve(w, int(u.size()) - 1) << endl;\n\treturn 0;\n}", "lang": "GNU C++17", "bug_code_uid": "cf7d8ac58c21b5fc6fbd443fc626798b", "src_uid": "8097e10157320524c0faed56f2bc4880", "apr_id": "71789f5e89774406276d91f5f73f9909", "difficulty": 2300, "tags": ["dp", "dfs and similar", "greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.1983695652173913, "equal_cnt": 14, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 13, "bug_source_code": "#include \nusing namespace std ;\nconst int MOD = 1e9 + 7 ;\nlong long answer , power [100000] ;\nint x , y , helpn ;\nint main()\n{\n\tpower[0] = 1 ;\n\tfor (int i = 1 ; i < 100000 ; i ++ )\tpower [i] = ( power [i - 1 ] * 2 ) % MOD ;\n\tcin >> x >> y ;\n\tif ( y % x != 0 )\n\t{\n\t\tcout << 0 ;\n\t\treturn 0 ; \n\t}\n\ty /= x ;\n\tanswer = power[y - 1] ;\n\t//cerr << answer << '*' << endl ;\n\tfor (int i = 2 ; i <= y ; i ++ )\n\t{\n\t\tif ( y % i == 0 )\n\t\t{\n\t\t\t//cerr << y << \" devisable by : \" << i << endl ;\n\t\t\tfor (int k = 2 ; k < i ; k ++ )\n\t\t\t{\n\t\t\t\tif ( ! ( i % k ) )\tanswer ++ ;\n\t\t\t}\n\t\t\tanswer -= power[ ( y / i ) - 1 ] ;\n\t\t\tanswer += MOD ;\n\t\t\tanswer %= MOD ; \n\t\t}\n\t}\n\tcout << answer ;\n\treturn 0 ;\n}\n", "lang": "GNU C++14", "bug_code_uid": "b523024999b980612795bc2f01c3de73", "src_uid": "de7731ce03735b962ee033613192f7bc", "apr_id": "aaf41d806859e9f2b94fd92dbf4c673c", "difficulty": 2000, "tags": ["dp", "combinatorics", "bitmasks", "number theory", "math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9957591178965225, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include \n#include \nusing namespace std;\n#pragma warning (disable: 4996)\n\nint dp[509][25009], N;\n\nvoid solve() {\n\tint B = min(N, 500);\n\n\tdp[0][0] = 1;\n\tfor (int i = 0; i < B; i++) {\n\t\tfor (int j = 0; j < B * 500; j++) {\n\t\t\tif (dp[i][j] == 0) continue;\n\t\t\tdp[i + 1][j + 1] = 1;\n\t\t\tdp[i + 1][j + 5] = 1;\n\t\t\tdp[i + 1][j + 10] = 1;\n\t\t\tdp[i + 1][j + 50] = 1;\n\t\t}\n\t}\n}\n\nint main() {\n\tcin >> N;\n\tsolve();\n\n\tif (N <= 500) {\n\t\tint sum = 0;\n\t\tfor (int i = 0; i <= 50 * N; i++) sum += dp[N][i];\n\t\tcout << sum << endl;\n\t}\n\telse {\n\t\tcout << 49LL * N - 247LL << endl;\n\t}\n\treturn 0;\n}", "lang": "GNU C++17", "bug_code_uid": "5e6707f29627e694736718ce42566517", "src_uid": "75ec99318736a8a1b62a8d51efd95355", "apr_id": "072fd68b8fd7898356e2436b5de03b9d", "difficulty": 2000, "tags": ["dp", "combinatorics", "greedy", "math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7164179104477612, "equal_cnt": 12, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 12, "bug_source_code": "#include \n\n#define pb push_back\n#define fi first\n#define se second\n#define all(v) v.begin(), v.end()\n\nusing namespace std;\nusing ll = int64_t;\n\nconst string kPrefix = \"IAO'\";\nconst ll kStart = 1989;\nconst ll kBuben = 100000;\n\ninline ll to_ll(const string& x) {\n ll res = 0;\n for (char c : x) {\n res = (10 * res) + (c - '0');\n }\n return res;\n}\n\nint main() {\n ios_base::sync_with_stdio(false);\n cin.tie(nullptr);\n\n map reses;\n\n for (ll year = kStart; year <= 10 * kBuben; year++) {\n auto s = to_string(year);\n for (int i = 1; i <= s.size(); i++) {\n string suf = s.substr(s.size() - i);\n if (reses.count(suf) == 0) {\n if (year > kBuben && i != s.size()) {\n assert(s == \"1\" + suf);\n }\n reses[suf] = s;\n break;\n }\n }\n }\n\n int n;\n cin >> n;\n\n for (int i = 0; i < n; i++) {\n string name;\n cin >> name;\n name = name.substr(kPrefix.size());\n auto res = reses.find(name);\n if (res == reses.end()) {\n if (name[0] == '0')\n name = \"1\" + name;\n cout << name << \"\\n\";\n } else {\n cout << res->second << \"\\n\";\n }\n }\n \n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "c29f081c0ac7bd8876e9b1300a631a73", "src_uid": "31be4d38a8b5ea8738a65bfee24a5a21", "apr_id": "60fcb15cb12ec12c63dd636418c0bfd5", "difficulty": 2000, "tags": ["greedy", "math", "constructive algorithms", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.2045889101338432, "equal_cnt": 20, "replace_cnt": 17, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 20, "bug_source_code": "#include \n#include \n#include \n#include \nusing namespace std;\nint main()\n{\n int n,x,y;\n while(scanf(\"%d%d%d\",&n,&x,&y))\n {\n int flag=1;\n if(n%2==0)\n {\n int k=n/2;\n if(x==k || x==k+1)\n flag=0;\n if(y==k || y==k+1)\n flag=0;\n }\n else flag=0;\n if(flag)\n printf(\"YES\\n\");\n else printf(\"NO\\n\");\n }\n\n return 0;\n}\n\n\n\n\n\t\t\t \t\t \t \t\t\t \t\t\t\t\t \t\t", "lang": "GNU C++", "bug_code_uid": "8d7cc4e2043f826b5c75090f05d1ed7d", "src_uid": "dc891d57bcdad3108dcb4ccf9c798789", "apr_id": "86068c414fc76b7c7eb4eff96a7866c7", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.3024390243902439, "equal_cnt": 11, "replace_cnt": 7, "delete_cnt": 4, "insert_cnt": 0, "fix_ops_cnt": 11, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nint main()\n{\n\tlong long n, m, a, b, money = 0;\n\tcin >> n >> m >> a >> b;\n\n\tif (n%m == 0)\n\t{\n\t\tcout << money;\n\t}\n\telse\n\t{\n\twhile (n%m != 0)\n\t{\n\n\t\t\tif (n < m)\n\t\t\t{\n\t\t\t\tmoney = money + b;\n\t\t\t\tn--;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (n > m)\n\t\t\t\t{\n\t\t\t\t\tmoney = money + a;\n\t\t\t\t\t++n;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (n % m == 0)\n\t\t\t{\n\t\t\t\tcout << money;\n\t\t\t}\n\n\t}\n\n\t}\n}", "lang": "MS C++", "bug_code_uid": "23916de1394a23412ffc16e569e642ac", "src_uid": "c05d753b35545176ad468b99ff13aa39", "apr_id": "94a78db02202e20fabdbf67c3249a1de", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.11016393442622952, "equal_cnt": 25, "replace_cnt": 17, "delete_cnt": 0, "insert_cnt": 8, "fix_ops_cnt": 25, "bug_source_code": "#include\n#include\nstruct app\n{\n\tint a[111];\n\tint b[100];\n}pp;\nint kkk[111111116];\nint main()\n{\n\tint a,b,p,k=0,m,i,j,t=0,kk,q,qq,l=0;\n\tfor(i=0;i<24;i++)\n\t{ k=0;\n\t\tfor(j=0;j<=59;j++)\n\t\t{\n\t\tpp.a[i]=i;\n\t\tpp.b[k]=j;\n\t\tk++;\n\t\t}\n\t}\n\tmemset(kkk,0,sizeof(kkk));\n\tscanf(\"%d\",&m);\n\tscanf(\"%d%d\",&p,&k);\n\tt=p;\n\tfor(qq=0;qq<22;qq++)\n\t{\n\t\tif(l>0)\n\t\t\tt=23;\n\t\tfor(i=t;i>=0;i--)\n\t\t{\n\t\t\tfor(j=0;j<=59;j++)\n\t\t\t{\n\t\tif(i==p&&pp.b[j]>k)\n\t\t\t\tbreak;\n\t\t\t\tkk=p-i;\n\t\t\t q=kk*60+k-pp.b[j];\n\t\t\t\tif(l==0&&i0)\n\t\t\t\t\tq=(p+24-i)*60-pp.b[j]+k;\n\t\t\t\tif(q%m==0&&(pp.a[i]%10==7||pp.b[j]%10==7))\n\t\t\t\t{\n\t\t\t\tkk=99999;\n\t\t\t\tprintf(\"%d %d %d\\n\",q,pp.a[i],pp.b[j]);\n\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(kk==99999)\n\t\t\t\tbreak;\n\n\t\t\t}\n\t\tif(kk==99999)\n\t\t\t\tbreak;\n\t\tl++;\n\t}\n\t\n\t\t\tprintf(\"%d\\n\",q/m );\n\t\t\t\treturn 0;\n}\n\n\n\n \t\t \t\t \t \t \t \t\t\t\t \t \t", "lang": "GNU C++", "bug_code_uid": "21ef5ca3db134155ac74e9722cbc54d9", "src_uid": "5ecd569e02e0164a5da9ff549fca3ceb", "apr_id": "29a1999ee1e8590e494288a1db82edd9", "difficulty": 900, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8996845425867508, "equal_cnt": 14, "replace_cnt": 5, "delete_cnt": 3, "insert_cnt": 5, "fix_ops_cnt": 13, "bug_source_code": "//Besmellah\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\n\ntypedef long long ll;\ntypedef pair pii;\n#define X first\n#define Y second\n#define pb push_back\n#define SQR(x) ((x) * (x))\n#define SZ(x) ((int)((x).size()))\n#define ALL(x) (x).begin(), (x).end()\n#define debug(x) cerr << #x << \" = \" << x << endl\n#define FOREACH(i, c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)\n#define FOR(i, a, n) for(__typeof(n) i = (a); i <= (n); i++)\n#define FORD(i, n, a) for(__typeof(n) i = (n); i >= (a); i--)\n#define INF (1000 * 1000 * 1000)\n#define MAXN 21\n\ndouble dp[MAXN][1 << MAXN], ans, l, r;\nint n;\n\nstruct Light\n{\n\tdouble x, y;\n\tdouble alpha;\n\tLight(double _x = 0, double _y = 0, double _alpha = 0)\n\t{\n\t\tx = _x;\n\t\ty = _y;\n\t\talpha = _alpha;\n\t}\n} p[MAXN];\n\ndouble calc(int idx, double s)\n{\n\tdouble beta = p[idx].alpha - atan2(p[idx].x - s, p[idx].y);\n\treturn p[idx].x + tan(beta) * p[idx].y;\n}\n\nint main()\n{\n\tios::sync_with_stdio(0);\n\tcin.tie(0);\n\tcin >> n >> l >> r;\n\tFOR (i, 0, n - 1)\n\t{\n\t\tcin >> p[i].x >> p[i].y >> p[i].alpha;\n\t\tp[i].alpha *= M_PI / 180.0;\n\t}\n\tFOR (mask, 0, (1 << n) - 1)\n\t\tFOR (i, 0, n - 1)\n\t\t{\n\t\t\tdouble tmp = l;\n\t\t\tif (mask & (1 << i))\n\t\t\t{\n\t\t\t\tint mask2 = mask - (1 << i);\n\t\t\t\tFOR (j, 0, n - 1)\n\t\t\t\t\tif (mask2 & (1 << j))\n\t\t\t\t\t\ttmp = max(tmp, calc(i, dp[j][mask2]));\n\t\t\t\tif (!mask2)\n\t\t\t\t\ttmp = max(tmp, calc(i, l));\n\t\t\t}\n\t\t\tdp[i][mask] = tmp;\n\t\t\tans = max(ans, dp[i][mask] - l);\n\t\t}\n\tcout.precision(9);\n\tcout << fixed << min(ans, r - l) << endl;\n\treturn 0;\n}", "lang": "GNU C++", "bug_code_uid": "95fa55834d826e01f57feb1bc6ea4aea", "src_uid": "4fad1233e08bef09e5aa7e2dc6167d6a", "apr_id": "437b0155ebd27e61fb13cbd1b6ebd71a", "difficulty": 2200, "tags": ["dp", "geometry", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.13092330239374694, "equal_cnt": 22, "replace_cnt": 16, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 21, "bug_source_code": "#include \n\nusing namespace std;\n\ntypedef pair pos;\n\nint gcd(int a, int b)\n{\n if (a >= b) {\n if (a%b == 0)\n return b;\n else\n return gcd(b, a%b);\n } else {\n if (b%a == 0)\n return a;\n else\n return gcd(a, b%a);\n }\n}\n\npos simplify(pos a) {\n\tif (a.first == 0 && a.second != 0) {\n\t\ta.second = 1;\n\t\treturn a;\n\t} else if (a.first != 0 && a.second == 0) {\n\t\ta.first = 1;\n\t\treturn a;\n\t} else if (a.first < 0 && a.second < 0) {\n\t\ta.first = -a.first;\n\t\ta.second = -a.second;\n\t}\n\t\n\twhile(true) {\n\t\tint ggcd = gcd(a.first, a.second);\n\t\tif (ggcd == 1) break;\n\t\ta.first /= ggcd;\n\t\ta.second /= ggcd;\t\t\n\t}\n\t\n\treturn a;\n}\n\nint main() {\n\tpos a, b, c;\n\tbool ans = false;\n\t\n\tcin >> a.first >> a.second >> b.first >> b.second >> c.first >> c.second;\n\t\n\tpos ab, bc;\n\tab.first = a.first - b.first;\n\tab.second = a.second - b.second;\n\t\n\tbc.first = b.first - c.first;\n\tbc.second = b.second - c.second;\n\t\n\tif (simplify(ab) == simplify(bc)) {\n\t\tans = false;\n\t} else {\n\t\tans = true;\n\t}\n\t\n\tcout << (ans ? \"Yes\" : \"No\") << endl;\n\treturn 0;\n\t\n}", "lang": "GNU C++11", "bug_code_uid": "bbcd7c1b7997aee0b80e88d7a1aaf08c", "src_uid": "05ec6ec3e9ffcc0e856dc0d461e6eeab", "apr_id": "18738759952a51f1d9d9c8dc86b29a6d", "difficulty": 1400, "tags": ["geometry", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9793639232823501, "equal_cnt": 10, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 9, "bug_source_code": "#include \nusing namespace std;\n#define forr(i, a, b) for(ll i = (a); i < (ll) (b); i++)\n#define forn(i, n) forr(i, 0, n)\n#define forall(it, v) for(auto it = v.begin(); it != v.end(); ++it)\n#define dforn(i, n) for(int i = ((int) n) - 1; i >= 0; i--)\n#define db(v) cerr << #v << \" = \" << v << endl\n#define pb push_back\n#define ff first\n#define ss second\ntypedef long long ll;\nconst int MAXN = 50;\n\npair ispot(ll x){\n ll e = 0;\n while(!(x%2)){x /= 2; e++;}\n return make_pair(x == 1, e);\n}\n\nint n;\nll P[MAXN], DOS[MAXN];\nvector X;\npair E;\n\nbool test(ll K){\n //printf(\"Probaremos armar %lld conjuntos.\\n\", K);\n vector V = X, U;\n forn(i, MAXN)forr(j, K, P[i])V.pb(DOS[i]);\n if(V.size() > P[0])return false;\n ll M = K; forn(i, MAXN){forr(j, P[i+1], min(P[i], K))U.pb(DOS[i+1]);}\n sort(U.begin(), U.end()); sort(V.begin(), V.end());\n /*printf(\"Para eso tenemos los extras:\\n \");\n forn(i, V.size())printf(\" %lld\", V[i]); puts(\"\");\n printf(\"Para eso tenemos los pilares:\\n \");\n forn(i, V.size())printf(\" %lld\", U[i]); puts(\"\");*/\n while(U.size() && V.size()){\n if(V.back() <= U.back())U.pop_back(), V.pop_back();\n else break;\n }\n return V.empty();\n}\n\nint main(){\n\tDOS[0] = 1;\n\tforr(i, 1, 50)DOS[i] = DOS[i-1]*2;\n\twhile(cin >> n){\n forn(i, MAXN) P[i] = 0; X.clear();\n forn(i, n){\n ll x; scanf(\"%lld\", &x); E = ispot(x);\n if(E.ff)P[E.ss]++; else X.pb(x);\n }\n ll M = P[0]; forn(i, MAXN){while(P[i] > M){X.pb(DOS[i]); P[i]--;} M = P[i];}\n /*printf(\"Arrancamos con:\\nV:\");\n forn(i, X.size())printf(\" %lld\", X[i]);puts(\"\");\n forn(i, 10)printf(\"%lld: %lld, \", DOS[i], P[i]);puts(\"\");*/\n ll L = 0, r = P[0]+1, m, R = P[0];\n while(r - L > 1){\n m = (L + r)/2;\n if(test(m))r = m;\n else L = m;\n }\n if(R - L)forr(i, L, R){if(i > L)printf(\" \"); printf(\"%lld\", i+1);}\n else printf(\"-1\");\n puts(\"\");\n\t}\n\treturn 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "283e4b34bc4e7c2df9c44f2cdd06cfe6", "src_uid": "fc29e8c1a9117c1dd307131d852b6088", "apr_id": "4b41be196ae3c7dd6f3912d94b1a8707", "difficulty": 2200, "tags": ["math", "constructive algorithms", "greedy", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7794811320754716, "equal_cnt": 39, "replace_cnt": 23, "delete_cnt": 9, "insert_cnt": 7, "fix_ops_cnt": 39, "bug_source_code": "#pragma comment(linker, \"/STACK:1000000000\")\n#define _CRT_SECURE_NO_WARNINGS\n#define _SCL_SECURE_NO_WARNINGS\n#define _USE_MATH_DEFINES\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#define mp make_pair\n#define pb push_back\n\nusing ll = long long;\nusing ld = long double;\n\nusing namespace std;\n\nconst int MAXN = 300001;\n\nint c2[MAXN];\n\nconst int M = 60;\n\nll a[MAXN];\n\n\nvoid no() {\n\tcout << -1 << endl;\n\texit(0);\n}\n\n\nint pc[MAXN];\n\n\nint getp2(ll x) {\n\tll c = 1;\n\tint pw = 0;\n\twhile (c < x) c *= 2, pw++;\n\tif (c == x) return pw;\n\telse return -1;\n}\n\n\nvector bad;\nvector finishes;\nvector nonp2;\nvector nbad;\nvector nfinishes;\n\nbool check( vector bad, vector finishes) {\n\tsort(bad.begin(), bad.end());\n\tif (finishes.size() < bad.size()) return false;\n\tfor (int i = 0; i < bad.size(); i++) {\n\t\tif (bad[i] >= 2 * finishes[finishes.size() - bad.size() + i]) return false;\n\t}\n\treturn true;\n}\n\n\nvoid print(int l, int r) {\n\tfor (int i = l; i <= r; i++)\n\t\tcout << i << \" \";\n\tcout << endl;\n}\n\nint main() {\n\t//freopen(\"input.txt\", \"r\", stdin); freopen(\"output.txt\", \"w\", stdout);\n\tios_base::sync_with_stdio(0); cout.setf(ios::fixed); cout.precision(20);\n\tint n;\n\tcin >> n;\n\tfor (int i = 0; i < n; i++) {\n\t\tcin >> a[i];\n\t\tint p2 = getp2(a[i]);\n\t\tif (p2 != -1) pc[p2]++;\n\t\telse bad.push_back(a[i]), nonp2.push_back(a[i]);\n\t}\n\tint cur = pc[0];\n\tfor (int i = 1; i < M; i++) {\n\t\tif (pc[i] > cur) {\n\t\t\tfor (int j = cur; j < pc[i]; j++) {\n\t\t\t\tbad.push_back(1ll << i);\n\t\t\t}\n\t\t}\n\t\twhile (cur > pc[i]) {\n\t\t\tfinishes.push_back(1ll << (i - 1));\n\t\t\tcur--;\n\t\t}\n\t}\n\n\tint lg = 0, rg = finishes.size() + 1;\n\twhile (lg < rg) {\n\t\tint md = (lg + rg) / 2;\t\n\t\tint rm = finishes.size() - md;\n\t\tnbad = bad;\n\t\tnfinishes.clear();\n\t\tfor (int i = 0; i < rm; i++) {\n\t\t\tfor (ll j = 1; j <= finishes[i]; j++) {\n\t\t\t\tnbad.push_back(j);\n\t\t\t}\n\t\t}\n\t\tfor (int i = rm; i < finishes.size(); i++) nfinishes.push_back(finishes[i]);\n\t\tif (check(nbad, nfinishes)) rg = md;\n\t\telse lg = md + 1;\n\t}\n\t\n\tif (lg <= finishes.size()) {\n\t\tprint(lg, finishes.size());\n\t} else {\n\t\tcout << -1 << endl;\n\t}\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "e5f5719e05362a373df3e4bacce8207e", "src_uid": "fc29e8c1a9117c1dd307131d852b6088", "apr_id": "35586b5c586e5e37bf4b1c4e176d2919", "difficulty": 2200, "tags": ["math", "constructive algorithms", "greedy", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9485134155184917, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "#include\nusing namespace std;\n \n#define ll long long\n#define ld long double\n#define pb push_back\n#define pi pair\n#define pl pair\n\nint main()\n{\n ll n,ans,f;\n cin>>n;\n while(1)\n {\n f=0;\n if(n>=32)\n {\n ans+=32;\n n=n-32;\n }\n else if(n>=16)\n {\n ans+=1;\n n=n-16;\n \n }\n else if(n>=8)\n {\n ans+=4;\n n=n-8;\n }\n else if(n>=4)\n {\n ans+=8;\n n=n-4;\n }\n else if(n>=2)\n {\n ans+=2;\n n=n-2;\n }\n else if(n>=1)\n {\n ans+=16;\n f=1;\n }\n if(f)\n break;\n }\n cout<\n\n#define pb push_back\n#define mp make_pair\n#define f first\n#define s second\n#define all(v) (v).begin(), (v).end()\n\ntypedef long long ll;\ntypedef unsigned long long int ull ;\n\nusing namespace std;\n\nconst int M=1e9+7;\nconst char nl = '\\n';\n\nint main(){\n ios_base::sync_with_stdio(false);\n cin.tie(NULL);\n \tint n , k;\n\tcin >> n >> k;\n\tchar a[n] ;\n\tint pos1 ;\n\tint pos2 ;\n\tfor (int i = 0 ; i < n ; i++){\n\t cin >>a[i] ;\n\t if (a[i] == 'T')\n\t pos1 = i ;\n\t if ( a[i] == 'G')\n\t pos2 = i ;\n\t}\n\tif (pos2 > pos1)\n\t swap (pos1,pos2) ;\n\twhile(pos2 < n){\n\t if (a[pos2+k] == '.')\n\t pos2+= k ;\n\t \n\t if (pos2 + k == pos1){\n\t cout <<\"YES\";\n\t break;\n\t }\n\t \n\t if (a[pos2 + k] == '#'){\n\t cout <<\"NO\";\n\t break;\n\t }\n\t}\n\t\n\t\n\t return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "33d2e04dbde8692500186f4f9878585b", "src_uid": "189a9b5ce669bdb04b9d371d74a5dd41", "apr_id": "8e120a289204e545967629c6a47e52d6", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9951865222623345, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "/* in the name of god */\n\n#include \n\nusing namespace std;\n\ntypedef pair pi;\n\n#define F first\n#define S second\n#define debug(x) cout << #x << \" : \" << x << endl\n\nconst int maxn = 1e8 + 10;\n\nlong long dp[maxn];\n\nint main() {\n\tios_base::sync_with_stdio(false);\n\t// cin.tie();\n\n\t#ifndef ONLINE_JUDGE\n\t\tfreopen(\"H:/Codes/input.txt\", \"r\", stdin);\n\t\tfreopen(\"H:/Codes/output.txt\", \"w\", stdout);\n\t#endif\n\n\tint n;\n\tvector arr;\n\tcin >> n;\n\t// debug(10);\n\tfor (int i = 2; i < maxn; i++) {\n\t\t// debug(i);\n\t\tint cnt = 0, t = i;\n\t\twhile (i % 5 == 0) i /= 5, cnt++;\n\t\ti = t;\n\t\tdp[i] = dp[i - 1] + cnt;\n\t}\n\t// for (int i = 0; i < maxn; i++)\n\t// debug(10);\n\tfor (int i = 1; i < maxn && dp[i] <= n; i++) if (dp[i] == n) arr.push_back(i);\n\tcout << arr.size() << endl;\n\tfor (int i : arr) cout << i << ' ';\n\treturn 0;\n}", "lang": "GNU C++17", "bug_code_uid": "68724a786a5285777bd3c5f66ad2c802", "src_uid": "c27ecc6e4755b21f95a6b1b657ef0744", "apr_id": "97e7378b597fd1eed1959a11a5c20a77", "difficulty": 1300, "tags": ["brute force", "math", "constructive algorithms", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.05861664712778429, "equal_cnt": 7, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "//============================================================================\n// Name : online23.cpp\n// Author : \n// Version :\n// Copyright : Your copyright notice\n// Description : Hello World in C++, Ansi-style\n//============================================================================\n\n#include \nusing namespace std;\n\nint main() {\n\tint n,k;\n\tint arr1[k];\n\tcin>>n>>k;\n\tfor(int i=0;i>arr1[i];\n\tint to=n*8;\n\tfor(int i=0;i0)\n\t\t{\n\t\t\tif(arr1[i]%8==0)\n\t\t{\n\t\t\tto-=8;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tint c=arr1[i]%4;\n\t\t\tif(c==3 || c==0)\n\t\t\t{\n\t\t\t\tto-=4;\n\t\t\t\tif(c==0)\n\t\t\tarr1[i]-=4;\n\t\t\t\telse\n\t\t\t\t\tarr1[i]-=3;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tto-=2;\n\t\t\t\tarr1[i]-=c;\n\n\n\t\t\t}\n\t\t\t//cout<<\"c\"<=0)\n\t\tcout<<\"YES\";\n\telse\n\t\tcout<<\"NO\";\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "97d42d156042a1cbe5c9f4c9c414e4f6", "src_uid": "d1f88a97714d6c13309c88fcf7d86821", "apr_id": "a1ff3d59a9d8a72adae6b808b2bb1d93", "difficulty": 1900, "tags": ["greedy", "brute force", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9695652173913043, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "#include \n\nusing namespace std;\n\ntypedef long long ll;\ntypedef unsigned long long ull;\n\n#define forn(i, n, k) for (int i = 0; i < n; i += k)\n#define forb(i, n, k) for (int i = n - 1; i >= 0; i -=k)\n\t\n//ifstream in(\"input.txt\");\n\nint a[16], b[16];\nbool l[100000000];\n\nint main(){\n\tll n, count = 0;\n\tcin >> n;\n\tfor (int i = 0; i < n; i++){\n\t\tcin >> a[i];\n\t}\n\tfor (int i = 0; i < n; i++){\n\t\tcin >> b[i];\n\t}\n\tfor (ll i = 0; i < 100000000; i++){\n\t\tint c = 0;\n\t\twhile (c < n){\n\t\t\tif (i % a[c] == b[c]){\n\t\t\t\tif (!l[i])count++;\n\t\t\t\tl[i] = 1;\n\t\t\t\t//cout << i << \" \";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tc++;\n\t\t}\n\t}\n\t//cout << count << endl;\n\tprintf(\"%.4f\", double(count) / double(100000000));\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "ba9821272aa35d0faaeb194081ecb6e1", "src_uid": "14b69f42bc192ea472e82f3a3209f1c1", "apr_id": "41797304f5768659ae22fb0d763f23fd", "difficulty": 1700, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9497270899166906, "equal_cnt": 14, "replace_cnt": 11, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 13, "bug_source_code": "#include\n \n#define ll long long\n#define ld double\n#define sf(x) sort(x.begin(),x.end(),func);\n#define s(x) sort(x.begin(),x.end())\n#define pb push_back \n#define set(v, val) memset(v, val, sizeof(v));\n#define rs(v) { s(v) ; r(v) ; }\n#define all(v) v.begin(),v.end()\n#define r(v) { reverse(all(v)) ; }\n#define mod 1000000007\n#define inf LONG_MAX\n#define ninf LONG_MIN\n#define mp make_pair\n#define F first\n#define S second\nusing namespace std;\nll is[5000005];\ndouble cp[5000005];\ndouble pp[5000005];\nll check(ll n)\n{\n vector < ll > v;\n while(n)\n {\n v.pb(n%10);\n n /= 10;\n }\n ll j = v.size()-1;\n for(ll i=0;i>p>>q; \n for(ll i=2;i<10000005;i++)\n {\n if(is[i]==0)\n {\n c++;\n for(ll j=i*i;j<10000005;j+=i)\n {\n is[j]=1;\n }\n }\n cp[i]=c;\n }\n c = 0;\n for(ll i=1;i<10000005;i++)\n {\n if(check(i))\n {\n c++;\n }\n pp[i]=c;\n }\n double d = p/q;\n for(ll i=10000004;i>=1;i--)\n {\n if(cp[i]*q<=pp[i]*p)\n {\n cout<\n\nusing namespace std;\n\ntypedef long long ll;\n\nconst int M = sqrt(1e11) + 4;\n\nll n, k, l, r, ans = -1;\n\nvoid calcA(ll t, bool flag = false) {\n for (ll a = 0; a <= n; ++a) {\n ll gt = t / (a + n);\n for (int j = -1; j <= 1; ++j) {\n ll g = gt + j;\n if (g < 0) {\n continue;\n }\n ll ato = t - r - n * g - a * g;\n if (ato < 0 || ato > a || ato > r || (n - r) < a - ato || (flag && ato == 0)) {\n continue;\n }\n\n ans = max(ans, a);\n }\n }\n}\n\nvoid calcG(ll t, bool flag = false) {\n for (ll g = 0; g < M; ++g) {\n ll tg = t - n * g - r;\n if (tg < 0) {\n continue;\n }\n ll ag = tg / g;\n for (int j = -2; j <= 1; ++j) {\n ll a = ag + j;\n ll ato = tg - a * g;\n if (ato < 0 || ato > a || ato > r || (n - r) < a - ato || (flag && ato == 0)) {\n continue;\n }\n ans = max(ans, a);\n }\n }\n}\n\nvoid calcA() {\n calcA(k);\n calcA(k + 1, true);\n}\n\nvoid calcG() {\n calcG(k);\n calcG(k + 1, true);\n}\n\nvoid solve() {\n cin >> n >> l >> r >> k;\n l--, r--;\n r = (r - l + n) % n + 1;\n\n if (n < M) {\n calcA();\n } else {\n calcG();\n }\n\n cout << ans;\n}\n\nint main() {\n ios::sync_with_stdio(0);\n cout.tie(0), cin.tie(0);\n\n solve();\n\n return 0;\n}\n\n", "lang": "GNU C++17", "bug_code_uid": "baaac3812450641906db0d0e300d1cf9", "src_uid": "f54cc281033591315b037a400044f1cb", "apr_id": "e29350acc4e9b17ce0a85a24a3263b49", "difficulty": 2600, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9511387969632081, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "#include \n\nusing namespace std;\n\nconst int N = 111, mod = 998244353;\n\nchar s[N];\nint dig[N], n;\n\nint gcd(int x, int y) {\n return x ? gcd(y % x, x) : y;\n}\n\nmap, int> dp[2][2][10][10];\n\nvoid add(int & var, int val) {\n var += val;\n if (var >= mod)\n var -= mod;\n}\nint to1[10], to2[10];\n\nlong long solve(int x, int y) {\n memset(dp, 0, sizeof dp);\n int c = 0, b = 1;\n memset(to1, 0, sizeof to1);\n memset(to2, 0, sizeof to2);\n for (int i = 1; i * y < 10; ++i) {\n to1[i * x] = 1 << (i-1);\n to2[i * y] = 1 << (i-1);\n }\n for (int lebih = 0; lebih < 2; ++lebih) {\n for (int l = 0; l < 10; ++l) {\n for (int r = 0; r < 10; ++r) {\n dp[c][lebih][l][r].clear();\n }\n }\n }\n dp[c][0][0][0][{0, 0}] = 1;\n for (int i = 0; i < n; ++i) {\n swap(c, b);\n for (int lebih = 0; lebih < 2; ++lebih) {\n for (int l = 0; l < 10; ++l) {\n for (int r = 0; r < 10; ++r) {\n dp[c][lebih][l][r].clear();\n }\n }\n }\n for (int lebih = 0; lebih < 2; ++lebih) {\n for (int l = 0; l < 10; ++l) {\n for (int r = 0; r < 10; ++r) {\n for (auto it : dp[b][lebih][l][r]) {\n int now = it.second;\n int maska = it.first.first, maskb = it.first.second;\n if (now == 0) continue;\n for (int k = 0; k < 10; ++k) {\n int ll = l + x * k, rr = r + y * k;\n int dl = ll % 10, dr = rr % 10;\n ll /= 10; rr /= 10;\n int more = 0;\n if (dr > dig[i])\n more = 1;\n else if (dr == dig[i])\n more = lebih;\n int mmaska = maska, mmaskb = maskb;\n if (mmaska != -1) {\n if (dl > 0 && (dl % x) == 0)\n mmaska |= 1 << (dl/x);\n if (dr > 0 && (dr % y) == 0)\n mmaskb |= 1 << (dr/y);\n }\n add(dp[c][more][ll][rr][{mmaska, mmaskb}], now);\n }\n }\n }\n }\n }\n }\n int ans = 0;\n for (auto it : dp[c][0][0][0]) {\n auto mask = it.first;\n if (mask.first & mask.second)\n add(ans, it.second);\n }\n return ans;\n}\n\nint main() {\n scanf(\"%s\", s);\n n = strlen(s);\n for (int i = 0; i < n; ++i)\n dig[n-1-i] = s[i]-'0';\n dig[n] = 0;\n long long ans = 0;\n for (int x = 1; x <= 9; ++x) {\n for (int y = x; y <= 9; ++y) {\n if (gcd(x, y) != 1) continue;\n long long res = solve(x, y);\n ans = (ans + res) % mod;\n if (x != y)\n ans = (ans + res) % mod;\n }\n }\n printf(\"%lld\\n\", ans);\n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "9fc8254e220c1e31b48a782a1ec560e6", "src_uid": "b6f2061e2ca174c2385bf4520d232aaf", "apr_id": "ca2e2b6e28f562d27e6f8a4dbdd9cf95", "difficulty": 2700, "tags": ["dp"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9980276134122288, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include\nusing namespace std;\n#define rep(i,n) for(i=1;i<=n;i++)\n\nint main()\n{\n int n,k,c=0,i,a;\n cin>>n>>k;\n vector>v(k);\n for(i=0;i>a;\n if(a%2==0)\n v[i].first+=1;\n else\n v[i].second+=1;\n }\n j+=i;\n }\n \n\n for(i=0;i\n#define MAXN 1000000\n#define pb push_back\nusing namespace std;\nint vx,vy,flag;\nchar a;\nint A[9][9];\nstruct node\n{\n int x,y,t;\n}temp;\nqueue q;\nvoid bfs()\n{\n node temq,exp;\n while(!q.empty())\n {\n temq=q.front();\n q.pop();\n if (temq.x<0 || temq.y<0 || temq.x>8 || temq.y>8)\n continue;\n if (temq.t==80)\n continue;\n if (temq.x==vx && temq.y==vy)\n {\n flag=1;\n break;\n }\n if (A[temq.x+temq.t-1][temq.y]==-1)\n continue;\n exp=temq;\n exp.t+=1;\n exp.x-=1;\n q.push(exp);\n exp.x+=2;\n q.push(exp);\n exp.x-=1;\n exp.y-=1;\n q.push(exp);\n exp.y+=2;\n q.push(exp);\n }\n return;\n}\nint main()\n{\n for (int i = 0; i < 8; i++)\n {\n for (int j = 0; j < 8; j++)\n {\n scanf(\" %c\",&a);\n if (a=='.')\n A[i][j]=0;\n if (a=='A')\n {\n A[i][j]=0;\n vx=i;\n vy=j;\n }\n if (a=='M')\n {\n A[i][j]=0;\n temp.x=i;\n temp.y=j;\n }\n if (a=='S')\n A[i][j]=-1;\n }\n }\n temp.t=0;\n q.push(temp);\n bfs();\n if (flag)\n printf(\"WIN\");\n else \n printf(\"LOSE\");\n //~ for (int i = 0; i < 8; i++)\n //~ {\n //~ for (int j = 0; j < 8; j++)\n //~ {\n //~ printf(\"%4d\",A[i][j]);\n //~ }\n //~ printf(\"\\n\");\n //~ }\n //~ \n \n \n}\n/*\n.......A\n\n........\n\n........\n\n........\n\n........\n\n........\n\n........\n\nM.......\n*/\n", "lang": "GNU C++11", "bug_code_uid": "b82eb20019cf41c416a8022123320fd6", "src_uid": "f47e4ab041288ba9567c19930eb9a090", "apr_id": "cfa81c2e07b1c3e1e8fd7ed8f33a3b3c", "difficulty": 1500, "tags": ["graphs", "dfs and similar", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.6001932367149758, "equal_cnt": 20, "replace_cnt": 15, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 20, "bug_source_code": "#include \n#include \n#define inf 1000000007\n#define INF 1000000000000000007LL\n#define endl cout<<'\\n'\n#define endr cerr<<'\\n'\n#define ll long long\n#define mp make_pair\n#define pb push_back\n#define eb emplace_back\n#define st first\n#define nd second\n#define bit bitset\n#define pii pair\n#define pdd pair\n#define vi vector\n#define vd vector\n#define vll vector\n#define vpii vector< pair >\n#define all(x) (x).begin(),(x).end()\n#define sz(x) ((int)(x).size())\n#define rep(i, n) for(int i=0; i<(n); ++i)\n#define rep1(i, n) for(int i=1; i<=(n); ++i)\n#define pv(x) cerr<<#x<<\": \"<7) return 0;\n }\n reverse(all(h7));\n\n while (m)\n {\n m7.pb(m%7);\n m /= 7;\n ++digm;\n\n if (digm>7) return 0;\n }\n reverse(all(m7));\n\nif (digm+digh > 7) return 0;\nreturn 1;\n}\n\n\nbool check_m()\n{\n rep(i, digm)\n {\n if (nowm[i] != m7[i]) return 0;\n }\n\nreturn 1;\n}\n\nbool check_h()\n{\n rep(i, digh)\n {\n if (nowh[i] != h7[i]) return 0;\n }\n\nreturn 1;\n}\n\n\nbool check_unique()\n{\n bit vis=0;\n\n for (auto j: nowh)\n {\n if (vis[j]) return 0;\n vis[j] = 1;\n }\n\n for (auto j: nowm)\n {\n if (vis[j]) return 0;\n vis[j] = 1;\n }\n\nreturn 1;\n}\n\n\nvoid shift_h()\n{\n for (int i=digh-1; i>0; --i)\n {\n if (nowh[i] > 6)\n {\n nowh[i] = 0;\n ++nowh[i-1];\n }\n else break;\n }\n\n if (check_h() && check_m())\n {\n rst += check_unique();\n cout<0; --i)\n {\n if (nowm[i] > 6)\n {\n nowm[i] = 0;\n ++nowm[i-1];\n }\n else break;\n }\n\n if (check_h() && check_m())\n {\n rst += check_unique();\n cout<>h>>m;\n --h; --m;\n\n if (!convert()) {cout<<\"0\"; return;}\n\n ps(h7);\n ps(m7);\n\n iterate();\n}\n\nint32_t main()\n{\nios_base::sync_with_stdio(0);\ncin.tie(NULL);\n//cout<\n#include\n#include\n\nusing namespace std;\n\nint a, b, k;\nlong long res = 0;\nint primos[100000];\nint tam = 0;\nbool esPrimo[1000000001];\n\n\nlong long mcd (long long a, long long b){\n if (b == 0) return a;\n return mcd(b,a%b);\n}\n\nlong long mcm(long long a, long long b){\n return (a*b)/mcd(a,b);\n}\n\nvoid rec(int ct, int pos, long long act){\n if (primos[pos] == k){\n if (ct == 0) return;\n act = mcm(act,k);\n long long tmp = (b/act)-((a-1)/act);\n if (ct%2 == 0){\n res+=tmp;\n }\n else{\n res-=tmp;\n }\n return;\n }\n rec(ct+1,pos+1,mcm(act,primos[pos]));\n rec(ct,pos+1,act);\n}\n\nvoid criba(){\n esPrimo[0] = esPrimo[1] = false;\n for (int i = 2; i <= k; i++){\n if (!esPrimo[i]) continue;\n primos[tam] = i;\n tam++;\n for (int j = i+i; j <= k; j+=i){\n esPrimo[j] = false;\n }\n }\n}\n\nint main(){\n scanf(\"%d %d %d\", &a, &b, &k);\n memset(esPrimo,true,sizeof(esPrimo));\n criba();\n if (!esPrimo[k]) printf(\"0\\n\");\n else if (b < k) printf(\"0\\n\");\n else if (b < k*k and a < k) printf(\"0\\n\");\n else if (k == 2){\n long long tmp = (b/k)-((a-1)/k);\n printf(\"%lli\\n\", tmp);\n }\n else{\n res = (b/k)-((a-1)/k);\n rec(0,0,1);\n printf(\"%lli\\n\", res);\n }\n}", "lang": "GNU C++", "bug_code_uid": "a4c3a3bc7e2decfdf693b6496e6eb9ea", "src_uid": "04a26f1d1013b6e6b4b0bdcf225475f2", "apr_id": "12849a30ecedc8187ead1b9455bd4b00", "difficulty": 2400, "tags": ["dp", "math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.041237113402061855, "equal_cnt": 11, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "#include\n#include\nusing namespace std;\nint main()\n{\n\tstring a,b,c;\n\t\tstring v,m;\n\tcin>>a>>v>>m;\n\tif( v[1]==a[0] )\n\t{\n\t\tcout<<\"YES\"<stoi(m))\n\t{\n\t\tcout<<\"YES\"<\n#define arr(i,n) for(ll i=0;i=0;i--)\n#define REP(i,k,n) for(ll i=k;i>=n;i--)\n#define debug(x) cout<<(#x)<<\" is \"<<(x)<>x[i]>>y[i];\n float a[3];\n a[0]=pow(x[0]-x[1],2)+pow(y[0]-y[1],2);\n a[1]=pow(x[0]-x[2],2)+pow(y[0]-y[2],2);\n a[2]=pow(x[2]-x[1],2)+pow(y[2]-y[1],2);\n sort(a,a+3);\n if(a[0]+a[1]==a[2])\n {cout<<\"RIGHT\";\n return 0;}\n while(2)\n {\n x[0]++;\n a[0]=pow(x[0]-x[1],2)+pow(y[0]-y[1],2);\n a[1]=pow(x[0]-x[2],2)+pow(y[0]-y[2],2);\n a[2]=pow(x[2]-x[1],2)+pow(y[2]-y[1],2);\n sort(a,a+3);\n if(a[0]+a[1]==a[2]&&a[0]!=0)\n {cout<<\"ALMOST\";\n return 0;}\n x[0]--;\n x[1]++;\n a[0]=pow(x[0]-x[1],2)+pow(y[0]-y[1],2);\n a[1]=pow(x[0]-x[2],2)+pow(y[0]-y[2],2);\n a[2]=pow(x[2]-x[1],2)+pow(y[2]-y[1],2);\n sort(a,a+3);\n if(a[0]+a[1]==a[2]&&a[0]!=0)\n {cout<<\"ALMOST\";\n return 0;}\n x[1]--;\n x[2]++;\n a[0]=pow(x[0]-x[1],2)+pow(y[0]-y[1],2);\n a[1]=pow(x[0]-x[2],2)+pow(y[0]-y[2],2);\n a[2]=pow(x[2]-x[1],2)+pow(y[2]-y[1],2);\n sort(a,a+3);\n if(a[0]+a[1]==a[2]&&a[0]!=0)\n {cout<<\"ALMOST\";\n return 0;}\n x[2]--;\n y[0]++;\n a[0]=pow(x[0]-x[1],2)+pow(y[0]-y[1],2);\n a[1]=pow(x[0]-x[2],2)+pow(y[0]-y[2],2);\n a[2]=pow(x[2]-x[1],2)+pow(y[2]-y[1],2);\n sort(a,a+3);\n if(a[0]+a[1]==a[2]&&a[0]!=0)\n {cout<<\"ALMOST\";\n return 0;}\n y[0]--;\n y[1]++;\n a[0]=pow(x[0]-x[1],2)+pow(y[0]-y[1],2);\n a[1]=pow(x[0]-x[2],2)+pow(y[0]-y[2],2);\n a[2]=pow(x[2]-x[1],2)+pow(y[2]-y[1],2);\n sort(a,a+3);\n if(a[0]+a[1]==a[2]&&a[0]!=0)\n {cout<<\"ALMOST\";\n return 0;}\n y[1]--;\n y[2]++;\n a[0]=pow(x[0]-x[1],2)+pow(y[0]-y[1],2);\n a[1]=pow(x[0]-x[2],2)+pow(y[0]-y[2],2);\n a[2]=pow(x[2]-x[1],2)+pow(y[2]-y[1],2);\n sort(a,a+3);\n if(a[0]+a[1]==a[2]&&a[0]!=0)\n {cout<<\"ALMOST\";\n return 0;}\n arr(i,3)\n {x[i]=x[i]-2;\n y[i]=y[i]-2;}\n }\n cout<<\"NEITHER\";\n return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "26592657d657ad88889aaa77e516552d", "src_uid": "8324fa542297c21bda1a4aed0bd45a2d", "apr_id": "600854e9fb8f903c1958f57fae6c40ef", "difficulty": 1500, "tags": ["geometry", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.706090026478376, "equal_cnt": 8, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "#include \n#include \nusing namespace std;\nint n; char inp[105];\nint main(void) {\n\tscanf(\"%d %s\", &n, inp);\n\tfor (int i = 0; i < n; i++) {\n\t\tif (inp[i] == inp[i + 1] && inp[i] != '?') {\n\t\t\treturn printf(\"No\\n\");\n\t\t}\n\t}\n\tfor (int i = 0; i < n; i++) {\n\t\tif (inp[i] != '?' && inp[i + 3] != '?' && inp[i] != inp[i + 3] && inp[i + 1] == inp[i + 2] && inp[i + 1] == '?') {\n\t\t\tinp[i + 1] = inp[i + 2] = 'x';\n\t\t}\n\t\tif (inp[i] != '?' && inp[i + 2] != '?' && inp[i + 2] != inp[i] && inp[i + 1] == '?') {\n\t\t\tinp[i + 1] = 'x';\n\t\t}\n\t}\n\tfor (int i = 0; i < n; i++) {\n\t\tif (inp[i] == '?') return !printf(\"Yes\\n\");\n\t}\n\tprintf(\"No\\n\");\n}", "lang": "GNU C++14", "bug_code_uid": "db04d84450960f2312e59bfbcee49fd5", "src_uid": "f8adfa0dde7ac1363f269dbdf00212c3", "apr_id": "2c69d839d20db201cf708f628965e30c", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.1549601737871108, "equal_cnt": 24, "replace_cnt": 14, "delete_cnt": 2, "insert_cnt": 8, "fix_ops_cnt": 24, "bug_source_code": "#include \nusing namespace std;\n\nint main()\n{\n while(1)\n {\n string s;\n cin>>s;\n int x=0;\n for(int i = 0 ; i< s.size() ; i++)\n x+=s[i];\n cout<<((x&1)?\"YES\\n\":\"NO\\n\");\n }\n}\n", "lang": "GNU C++17", "bug_code_uid": "9a1ddd6d4ab72048a951f6dcc20eddbc", "src_uid": "d0ad35798119f98320967127c43ae88d", "apr_id": "28fabdb7e56b1504c2cec67141c9e653", "difficulty": null, "tags": ["dp", "brute force", "strings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.2077922077922078, "equal_cnt": 15, "replace_cnt": 12, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 15, "bug_source_code": "#include \n#include \n#include \n#include \nusing namespace std;\nint main()\n{\n char s[2];\n char a[2];\n int n;\n\n while(scanf(\"%s\",s))\n {\n cin>>n;\n char A=s[0];\n char B=s[1];\n if(n==1)\n {\n getchar();\n scanf(\"%s\",a);\n sort(a,a+2);\n if(a[0]==A&&a[1]==B)\n cout<<\"YES\"<\n#include\n#include\n#include\n#include\nusing namespace std;\n\nint main()\n{\n int n,i,j,k;\n int a,b,c,d,e,f,res=0;\n cin >> n;\n cin >> a >> b >> c >> d >> e >> f ;\n for(i=a;i<=b;i++)\n {\n for(j=c;j<=d;j++)\n {\n for(k=e;k<=f;k++)\n {\n res=i+j+k;\n if(res==n)\n {printf(\"%d %d %d\\n\",i,j,k);\n exit(-1);\n }\n }\n }\n }\n \n return 0;\n}", "lang": "MS C++", "bug_code_uid": "f8f64a43b34f49ec45910a08a0557244", "src_uid": "3cd092b6507079518cf206deab21cf97", "apr_id": "35e464e0629e9af98e0f48e36f2f78a6", "difficulty": 1100, "tags": ["greedy", "math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.27298050139275765, "equal_cnt": 24, "replace_cnt": 7, "delete_cnt": 8, "insert_cnt": 8, "fix_ops_cnt": 23, "bug_source_code": "#include\nusing namespace std;\n\nint main()\n{\n int n,i,j,m,c,a,f=0;\n cin >> n>>m;\n vectorbk;\n vectorfr;\n for(i=1;i<=n;i++)\n {\n if(f==0)\n {\n if(i==m)\n {\n f=1;\n }\n else\n {\n bk.push_back(i);\n }\n }\n else if(f==1)\n {\n fr.push_back(i);\n }\n\n }\n if(bk.size()>fr.size())\n {\n if(bk.size()>1){\n cout<1){\n cout<\nusing namespace std;\n\nint A[22];\n\nint main() {\n int n, a, b, ans = 0; scanf(\"%d%d%d\",&n,&a,&b);\n for(int i=0; i\n#include \n#include \nchar str[210];\n\nint main()\n{\n\twhile(scanf(\"%s\", str) != EOF)\n\t{\n\t\tchar *p = str;\n\t\tint flag = 0;\n\t\twhile(*(p+2))\n\t\t{\n\t\t\tint k = 0;\n\t\t\twhile(p[k+2] && (p[k] != 'W' || p[k+1] != 'U' || p[k+2] != 'B')) k++;\n\t\t\tif(k)\n\t\t\t{\n\t\t\t\tif(flag) printf(\" \"); \n\t\t\t\tfor(int i = 0; i < k; i++) printf(\"%c\", p[i]); \n\t\t\t\tflag = 1; p+=k;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse p+=3;\n\t\t}\n\t\tif(*p) printf(\" %s\", p);\n\t\tprintf(\"\\n\");\n\t\tmemset(str, 0, sizeof(str));\n\t}\t\n\treturn 0;\n}\n\t \t \t\t \t \t\t \t \t\t\t \t", "lang": "GNU C++", "bug_code_uid": "a71ddb547b8844be6f71d26172435c83", "src_uid": "edede580da1395fe459a480f6a0a548d", "apr_id": "67f026536446a117e2ada6e506b1d5e4", "difficulty": 900, "tags": ["strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9662783568362967, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include \n \n\n#define rep(i, a, b) for (int i = int(a); i <= int(b); i++)\n#define nrep(i, a, b) for (int i = int(a); i >= int(b); i--)\n#define zrep(i,b) for(int i = 0; i >t; while(t--)\n\n\nconst int N = 1e5 + 5;\nconst double eps = 1e-6;\n\nusing namespace std;\n\n\ntypedef vector::iterator vit;\ntypedef vector::iterator vlit;\ntypedef vector::iterator vllit;\ntypedef long long ll;\ntypedef unsigned long long ull;\ntypedef vector vi;\ntypedef vector vl;\ntypedef vector vll;\ntypedef vector vb;\ntypedef vector vvb;\ntypedef vector > vvi;\ntypedef pair ii;\ntypedef vector vii;\ntypedef vector vs;\ntypedef map msi;\ntypedef istringstream iss;\n\n\nint main()\n\n\n{\n\tfastio;\n \n double a,b,c,d,e,r;\n cin>>a>>b>>c>>d;\n \n int ans = 42 ; \n\n r = b-a;\n if(c == b+r && d == c+r) {\n ans = d+r;\n\n }\n\n r = b/a;\n if(c == b*r && d == c*r ) {\n e = d*r;\n if(abs(e-floor(e) <= eps))\n cout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n#define mem(flag) memset(flag,0,sizeof(flag))\n#define Mem(flag) memset(flag,-1,sizeof(flag))\n#define read(a) a=getInt()\n#define En printf(\"\\n\")\n#define P(a) printf(\"%d \",a)\n#define Pn(a) printf(\"%d\\n\",a)\n#define dbg(x) cout << (#x) << \" = \" << (x) << endl\n#define rep(flag, a, b) for (int flag = (a); flag <= (b); ++flag)\n#define Rep(flag, a, b) for (int flag = (a); flag >= (b); --flag)\n\nconst int MAX = 200;\nint trie[MAX][28],cnt;\npair pa[MAX]; int dep[MAX];\nbool isTer[MAX];\n\nint con[MAX][28];\n\nvoid insert(char *s) {\n int len=strlen(s),cur=0;\n for(int i=0;i S;\n int t1 = i;\n while (t1 != 0) {\n S.push(pa[t1].second);\n t1 = pa[t1].first;\n }\n tn = 0;\n while (!S.empty()) {\n tmp[tn++] = S.top();\n S.pop();\n }\n for (int j = 0; j < 4; j++) {\n tmp[tn] = zm[j], tmp[tn + 1] = 0;\n for (int pp = 0; pp <= tn + 1; pp++) {\n int st = find(tmp + pp);\n if (st != -1) {\n con[i][zm[j] - 'A'] = st;\n break;\n }\n }\n }\n } \n mem(dp);\n dp[0][0][0] = 1;\n for (int i = 0; i < n; i++) {\n for (int j = 0; j <= i; j++) {\n for (int pos = 0; pos < cnt; pos++) {\n auto ele = dp[i][j][pos];\n if (ele) {\n for (int sel = 0; sel < 4; sel++) {\n int newpos = con[pos][zm[sel] - 'A'];\n int fg;\n if (dep[newpos] >= i + 1 - j && isTer[newpos] == 1) fg = i + 1;\n else fg = j;\n auto &ele1 = dp[i + 1][fg][newpos];\n ele1 = (ele1 + ele) % MOD;\n }\n }\n }\n }\n }\n //for (int i = 0; i < n; i++) {\n //for (int j = 0; j <= i; j++) {\n //for (int pos = 0; pos < cnt; pos++) {\n //printf(\"(%d %d %d) = %d\\n\", i, j, pos, dp[i][j][pos]);\n //}\n //}\n //}\n int ans = 0;\n for (int pos = 0; pos < cnt; pos++) {\n ans = (ans + dp[n][n][pos]) % MOD;\n }\n Pn(ans);\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "f38528409d77ca3cc2221c8914aee292", "src_uid": "3f053c07deaac55c2c51df6147080340", "apr_id": "9c55df29ba745384f2a3207c4b4309e8", "difficulty": 2500, "tags": ["trees", "dp", "string suffix structures"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.09073724007561437, "equal_cnt": 10, "replace_cnt": 10, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 10, "bug_source_code": "#include \n#define NN 111111\nint coa[NN],cob[NN];\nusing namespace std;\n\nint main() {\n\tint i,j,r,k,l,x,t,a,b,da,db;\n//freopen(\"1.in\", \"r\", stdin);\n\t//freopen(\"1.out\", \"w\", stdout);\n\twhile(scanf(\"%d%d%d%d%d%d\",&x,&t,&a,&b,&da,&db)==6){\n\t\tl=1;r=1;coa[0]=a;cob[0]=b;\n\t\twhile(a-l*da!=0)\n\t\t\t{\tcoa[l]=a-l*da;l++;}\n\t\twhile(a-r*db!=0){\n\t\t\t\tcob[r]=b-r*db;r++;\n\t\t\t}\n\t\tk=0;\n\t\tfor(i=0;i\nusing namespace std;\n#define ll long long int\n#define ld long double\n#define fl float\n#define lcm(a,b) (a*(b/__gcd(a,b)))\n#define vs vector \n#define vc vector \n#define vii vector\n#define vll vector\n#define sll set\n#define pii pair\n#define plc pair\n#define tlll tuple\n#define mt make_tuple\n#define vpll vector>\n#define vpii vector>\n#define vtll vector>\n#define vvll vector>\n#define lb lower_bound\n#define pb push_back\n#define pob pop_back\n#define f first\n#define s second\n#define mll map\n#define mp make_pair\n#define sp(n) fixed<\n#define msl map\n#define mod (ll) 1000000007\n#define flash ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); \n#define test ll t;read(t);while(t--) \n#define sortv(v) sort(v.begin(),v.end())\n#define INF (ll)(1e15)\n#define loop(i,n) for(int i=0;i=0;i--)\n#define loopab(i,a,b,c) for(int i=a;i<=b;i+=c)\n#define reada(a,n) loop(i,n) cin>>a[i];\n#define reada1(a,n) loop1(i,n) cin>>a[i];\n#define sorta(a) sort(a,a+n,greater())\n#define countone(n) __builtin_popcount(n)\n#define numoftrailzero(n) __builtin_ctz(n)\n#define maxpowoftwo(n) __builtin_clzll(n)\n#define leastindexwithone(n) __builtin_ffs(n)\n#define what_is(x) cerr << #x << \" is \" << x << endl;\n#define pfv(v) cout<0){if(b%2 ==1){res=(res*a);}a=(a*a);b/=2;} return res;}\nll power(ll a,ll b,ll M){a%=M;ll res=1;while(b>0){if(b%2 ==1){res=(res*a)%M;}a=(a*a)%M;b/=2;} return res;}\nll extendedEuclid(ll A,ll B,ll &x,ll &y){\n if(B == 0) {\n x = 1;\n y = 0;\n return A;\n }\n else {\n ll x1 , y1;\n ll gcd = extendedEuclid(B,A%B,x1,y1);\n y = x1-(A/B)*y1; \n x = y1;\n return gcd;\n }\n}\nll mi(ll A, ll M){ll x,y;extendedEuclid(A,M,x,y);if(x<0){x+=M;} return x;}\nvectorsieve(1000020,true);\nvoid Sieve(){\n sieve[0]=false;\n sieve[1]=false;\n for(ll i=2;i*i<=1000020;i++){\n if(sieve[i]==true){\n for(ll j=i*i;j<1000020;j+=i)\n sieve[j]=false;\n }\n }\n}\n// ll sieve_spf[1000010];\n// ll n1=1000000;\n// void Sieve_spf(){\n// loop(i,n1) sieve_spf[i]=i;\n// sieve_spf[0]=-1;\n// sieve_spf[1]=1;\n// for(int i=2;i= 'A'&&c <= 'Z') return true;\n// 5,5,else return false;\n// }\n// bool islowcase(char c){\n// if(c >= 'a'&&c <= 'z') return true;\n// else return false;\n// }\nconst int nax=3e5+5;\nll fact[nax];\nvoid F(){\n fact[0]=1;\n for(int i=1;i &a, const pair &b){\n// return (a.fSize[a]) swap(a,b);\n// par[b]=a;\n// Size[a]+=Size[b];\n// }\n// }\nvpll g[N];\nll dp[5005][5005];\nvoid testcase(){\n cin>>n;\n loop1(i,n) cin>>a[i];\n ll fre[101]={0};\n loop1(i,n) fre[a[i]]++;\n int d=0,ma=0;\n loop1(i,100) if(fre[i]>ma){ma=fre[i];d=i;}\n if(fre[d]==2){cout<>q; \n while(q--){\n //cout<<\"Case #\"<<++t<<\": \";\n //solve();\n testcase();\n } \n // cerr << \"Time : \" << 1000 *((double)clock()) / (double)CLOCKS_PER_SEC << \"ms\\n\";\n // //END OF PROGRAM LOGIC\n \n \n\treturn 0;\n}\n/*\n###### ###### # # ####### # # ##### # # # ####### ####### ######\n# # # ## # # # ## ## # ## # # # # # # # #\n# # # # # # # # # # # # # # # # # # # # # # #\n# # ##### # # # # # # # # # # # # # # # # # ######\n# # # # # # # # # # # # # # ####### # # # # #\n# # # # ## # # # # # # ## # # # # # # #\n###### ###### # # ####### # # ##### # # # # # ####### # #\n*/", "lang": "GNU C++17", "bug_code_uid": "2c22357f45dc29ea3e531b1b30448b51", "src_uid": "a06ebb2734365ec97d07cd1b6b3faeed", "apr_id": "32542e66aa7ca3654e9d8e4c0bd55e3d", "difficulty": 2600, "tags": ["data structures", "greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.2723735408560311, "equal_cnt": 20, "replace_cnt": 11, "delete_cnt": 3, "insert_cnt": 5, "fix_ops_cnt": 19, "bug_source_code": "#include\nusing namespace std;\nint p,a,b,a1,b1,minn=0;\nint plate[1000]={0};\nvoid dfs(int step)\n{\n\tbool flag=false;\n\tif(step==p+1)\n\t{\n\t\tint tmp=2147483647;\n\t\tfor(int i=1;i<=p;i++)\n\t\t{\n\t\t\ttmp=min(tmp,plate[i]);\n\t\t}\n\t\tminn=max(minn,tmp);\n\t\treturn;\n\t}\n\tfor(int i=1;i<=a1;i++)\n\t{\n\t\tflag=true;\n\t\ta1-=i;\n\t\tplate[step]=i;\n\t\tdfs(step+1);\n\t\tplate[step]=0;\n\t\ta1+=i;\n\t}\n\tfor(int i=1;i<=b1;i++)\n\t{\n\t\tflag=true;\n\t\tb1-=i;\n\t\tplate[step]=i;\n\t\tdfs(step+1);\n\t\tplate[step]=0;\n\t\tb1+=i;\n\t}\n\tif(!flag)\n\t{\n\t\treturn;\n\t}\n}\nint main()\n{\n\tcin>>p>>a>>b;\n\ta1=a;\n\tb1=b;\n\tdfs(1);\n\tcout<\n#include\n#include\n#include\n\nusing namespace std; \n\nvectorv; \n\nint main () { \n long long int n; \n cin >> n; \n do { \n int c = n%10;\n v.push_back(c); \n n-=c;\n n/=10; \n } while ( n != 0 );\n int wsk = v.size()-1; \n while ( v[wsk] == 9 ) \n wsk--; \n for ( int i = 0; i < v.size()-(v.size()-wsk); i++ ) \n v[i] = min ( v[i], 9-v[i] );\n long long int wynik = 0; \n long long int p = 1; \n for ( int i = 0; i < v.size(); i++ ) { \n wynik+=v[i]*p; \n p*=10; \n }\n if ( wynik == 0 ) \n wynik+=9; \n cout << wynik << endl; \n}", "lang": "GNU C++0x", "bug_code_uid": "ea7bd6ffb87a1b8f0f599d041530f29a", "src_uid": "d5de5052b4e9bbdb5359ac6e05a18b61", "apr_id": "d913ce3eda366536f0364fec2c9e0eef", "difficulty": 1200, "tags": ["greedy", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9736842105263158, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": " //Bismillahir Rahmanir Rahim\n#include\n#include\n#include\n#include\n\nusing namespace std;\n\nint main()\n{\n\tvectorv;\n int a,b,c,d,sum(0),in,ans;\n for(int i=0;i<4;i++) //3 14 36 53\n {\n \tcin>>in;\n \tv.push_back(in);\n \t//ans += v[i];\n }\n\n sort(v.begin(),v.end());\n \n\n if(v[0]+v[3]==v[2]+v[1])\n {\n \tcout<<\"YES\"<\n#include\nusing namespace std;\nint main()\n{\n string t;\n string s;\n cin>>t;\n cin>>s;\n for(int i=0;i=0;)\n {\n if(t.at(i)==s.at(j))\n {\n i++,j--;\n continue;\n }\n else\n {\n cout<<\"NO\\n\";\n exit(j);\n }\n }\n cout<<\"YES\\n\";\n }\n return 0;\n} ", "lang": "MS C++", "bug_code_uid": "d3608bae0008ae1fe90f3db96c939f37", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "apr_id": "9061de5e193ff4246c014839e37f0d3c", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.7918403158587409, "equal_cnt": 11, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 11, "bug_source_code": "//****author RKN\n//DATE 5/2/2020 5.15 AM\n \n \n// ***************DREAM IS NOT THAT YOU SEE WHILE SLEEPING BUT IT IS WHAT DONT LET YOU SLEEP************//\n \n \n/////////////////////// machayenge......sala hoga apne se bhi ek din ///////////////////////////////////////////////////////////\n \n#include\n#include \nusing namespace std;\n \n///////////////////////////// % variable % //////////////////////////////////////////////////////////////\n \n#define ll long long\n#define pb push_back \n#define pof pop_front\n#define f1 first\n#define N 100001\n#define M 10000001\n#define s2 second\n#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);\n#define pr pair\n#define all(x) x.begin(),x.end()\n#define loop(start,end,inc) for(int i=start;i<=end;i+=inc)\ntypedef std::vector> vec2d;\n#define pr1 pair>\n#define prm pair>\nint dir1[8]={1,-1,0,0,-1,1,-1,1};\nint dir2[8]={0,0,-1,1,-1,1,1,-1};\n#define en \"\\n\"\nll MAX=1000000007; \nvectorprime(1001);\nvectorgetprm;\nll power(ll a,ll b)\n{\n if(b == 0)\n return 1;\n auto q= power( a, b/2 );\n q = (q * q) % MAX;\n if ( b%2 == 0)\n return q%MAX;\n else\n return (q * a) % MAX;\n}\n\nll modinv ( ll val )\n{\n return power ( val, MAX-2 );\n}\n \nvoid primecalc()\n{\n fill(all(prime),1);\n prime[0]=0;prime[1]=0;\n for(int i=2;i<=1000;i++)\n {\n if(prime[i])\n {\n //cout<>n>>m; \n unordered_mapmpi,mpj;\n int i=2,j=3,cnti=2,cntj=2;n--;m--;\n while(n && m)\n {\n if(i<=j)\n {\n if(mpj[cnti*2])\n {cnti++;continue;}\n i=cnti*2;mpi[i]=1;cnti++;n--;\n }\n else\n {\n if(mpi[cntj*3])\n {cntj++;continue;}\n j=cntj*3;mpj[j]=1;cntj++;m--;\n }\n // cout<\nusing namespace std;\nint main(){\n long long int n, m;\n cin >> n >> m;\n long long a = ( (n - m) + (n%m)*2 ) * (n/m) / 2;\n long long b = (n-m+1)*(n-m)/2;\n cout << a << ' ' << b << '\\n';\n return 0;\n}", "lang": "GNU C++14", "bug_code_uid": "2684ee23c724af1043541d63da13764a", "src_uid": "a081d400a5ce22899b91df38ba98eecc", "apr_id": "d7da1a7625ccae2df1fdca107720c676", "difficulty": 1300, "tags": ["math", "combinatorics", "greedy", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.2485207100591716, "equal_cnt": 10, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n\tfloat hour,min, h;\n\tchar c;\n\twhile(1){\n\tcin>>hour>>c>>min;\n\th=hour*30+min/2;\n\tcout<\n#define endl '\\n';\n#define int long long\n#define fi first\n#define se second\n#define mp make_pair\n#define pb push_back\n\nusing namespace std;\n\ntypedef pair ii;\ntypedef vector vi;\n\nconst int oo = 1e9 + 7;\nconst int mod = 1e9 + 7;\n\nint pw (int a,int p,int mod ) {\n int res=1%mod,x=a%mod;\n while (p) {\n if (p&1) res=(res*x)%mod;\n x=(x*x)%mod; p>>=1;\n }\n return res;\n}\n\nint C(int k, int n) {\n int a=1, b=1, c=1;\n for(int i=1;i<=n;i++) a=(a*i)%(mod);\n\n for(int i=1;i<=k;i++) b=(b*i)%(mod);\n\n for(int i=1;i<=(n-k);i++) c=(c*i)%(mod);\n\n b=pw(b,mod-2,mod);\n c=pw(c,mod-2,mod);\n a=(a*b)%mod;\n a=(a*c)%mod;\n return a;\n}\n\nsigned main(){\n\tios_base::sync_with_stdio(0);\n\tint f, w, h, okcnt = 0, total = 0;\n\t// freopen(\".inp\",\"r\",stdin);\n\t// freopen(\".out\",\"w\",stdout);\n\tcin >> f >> w >> h; ++h; \n\tint iw = w / h;\n\tif(!w){\n\t\tif(f <= 1) cout << 1;\n\t\telse cout << 0;\n\t\treturn 0;\n\t}\n\n\tfor(int i=1;i<=iw;i++){\n\t\tint n = w - i * h;\n\t\tint add = C(i - 1,n + i - 1);\n\t\tint mul = 0;\n\t\tif(f >= i - 1 && i > 1) mul += C(i - 2, f - 1);\n\t\tif(f >= i) mul += 2 * C(i - 1, f - 1);\n\t\tif(f >= i + 1) mul += C(i, f - 1);\n\t\tmul %= mod;\n\t\tokcnt = (okcnt + add * mul) % mod;\n\t}\n\tfor(int i=1;i<=w;i++){\n\t\tint n = w - i;\n\t\tint add = C(i - 1,n + i - 1);\n\t\tint mul = 0;\n\t\tif(f >= i - 1 && i > 1) mul += C(i - 2, f - 1);\n\t\tif(f >= i) mul += 2 * C(i - 1, f - 1);\n\t\tif(f >= i + 1) mul += C(i, f - 1);\n\t\tmul %= mod;\n\t\ttotal = (total + (add * mul)) % mod;\n\t}\n\n\tcout << okcnt * pw(total, mod - 2ll, mod) % mod;\n return 0;\n}", "lang": "GNU C++14", "bug_code_uid": "5fc35d495caae9356161e60a7992e6e4", "src_uid": "a69f95db3fe677111cf0558271b40f39", "apr_id": "1f31db07c95a25075806c5219380e95c", "difficulty": 2300, "tags": ["probabilities", "combinatorics", "number theory", "math", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8126232741617357, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "#include\nusing namespace std;\nlong long a[10000][10000],b[10000][1000],s[1000],s3[1000]={0},n,m,k=0,l=0,s1=1;\ndouble i,p;\nint main () {\n cin>>n>>m>>s1>>k;\n p=m;\nwhile (abs(l-m)>n){\n i++;\n l=l+s1;\n m=m-k;\n}\np=(p-n)/((s1+k));\ncout<\nusing namespace std;\nlong long s3[1000]={0},n,m,k=0,l=0,s1=1;\ndouble i,p;\nint main () {\n cin>>n>>m>>s1>>k;\n p=m;\nwhile (abs(l-m)>n){\n i++;\n l=l+s1;\n m=m-k;\n}\np=(p-n)/((s1+k));\ncout<\n#define INF 0x3F3F3F3F\nusing namespace std;\n/*\nint main()\n{\n int cases,max,num,num2,res=0;\n cin>>cases>>max;\n cin>>num;\n for(int i=1; i>num2;\n if(abs(num-num2)>max) res++;\n else num=num2;\n }\n cout<>n>>k>>a>>b;\n if(n==1)\n cout<\n\nusing namespace std;\n\nint main(){\n\n char tableCard[2];\n cin>>tableCard[0]>> tableCard[1];\n char tempCard[2];\n int i=0;\n\n while(i<5){\n cin>> tempCard[0] >>tempCard[1];\n\n if(tempCard[0] == tableCard[0] || tempCard[1] == tableCard[1]){\n cout << \"YES\";\n }\n }\n\n if(i<5){\n cout << \"NO\";\n }\n\n return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "2ac0bf976060af55859dffd3588c2365", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "apr_id": "d543c67cc2cbe11e0b63d82620ec9941", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9979029358897543, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include \nusing namespace std;\nchar a[20][50],b[20][40];\nstring d[20];\nint s1[20],s2[20],num[20];\nmap M;\nint id;\nchar boss[]=\"BERLAND\";\nint score[10];\nint gol[10],mis[10];\n\nbool ok(int y,int x){\n\t\n\tset st;\n\tfor(int i=1;i<=4;i++) st.insert(i);\n\tst.erase(id);\n\t// score\n\tint nn=0;\n\tfor(int i=1;i<=4;i++) {\n\t\tif(i==id) continue;\n\t\tif(score[id]>score[i]) nn++,st.erase(i);\n\t}\n\tif(nn>=2) return 1;\n\t\n\tint mm=0;\n\tfor(int i=1;i<=4;i++) {\n\t\tif(i==id) continue;\n\t\tif(score[id]=2) return 0;\n\t// delta\n\tif(mm==1){\n\t\tauto it=st.begin();\n\t\twhile(it!=st.end()){\n\t\t\tif(gol[*it]-mis[*it]>gol[id]-mis[id]) return 0;\n\t\t\tif(gol[*it]-mis[*it]gol[id]) return 0;\n\t\t\tif(gol[*it]id) {\n\t\t\t\tst.erase(it);\n\t\t\t\tif(st.empty()) return 1;\n\t\t\t\tit=st.begin();\n\t\t\t}\n\t\t\telse it++;\n\t\t}\n\t}\n\t\n\tint N=0;\n\tauto it=st.begin();\n\twhile(it!=st.end()){\n\t\tif(st.empty()) return 1;\n\t\tif(gol[*it]-mis[*it]>gol[id]-mis[id]) {\n\t\t\tif(N) return 0;\n\t\t\tst.erase(it);\n\t\t\tN++;\n\t\t\tif(st.empty()) return 1;\n\t\t\tit=st.begin();\n\t\t\tcontinue;\n\t\t}\n\t\tif(gol[*it]-mis[*it]gol[id]) {\n\t\t\tif(N) return 0;\n\t\t\tst.erase(it);\n\t\t\tN++;\n\t\t\tif(st.empty()) return 1;\n\t\t\tit=st.begin();\n\t\t\tcontinue;\n\t\t}\n\t\tif(gol[*it]s2[i]){\n\t\t\tscore[M[a[i]]]+=3;\n\t\t}\n\t\telse if(s1[i]j-i){\n\t\t\t\t\tdel=j-i;\n\t\t\t\t\tansx=j;ansy=i;\n\t\t\t\t}\n\t\t\t}\n\t\t\tgol[id]-=j;gol[ppp]-=i;\n\t\t\tmis[id]-=i;mis[ppp]-=j;\n\t\t}\n\t}\n\tif(fl) puts(\"IMPOSSIBLE\");\n\telse printf(\"%d:%d\\n\",ansx,ansy);\n\treturn 0;\n}\n ", "lang": "GNU C++14", "bug_code_uid": "8d6a9270dfe3aeb19ef6055c2c43a6df", "src_uid": "5033d51c67b7ae0b1a2d9fd292fdced1", "apr_id": "228a52505707ae0122864bc507bbad70", "difficulty": 1800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.3799682034976153, "equal_cnt": 24, "replace_cnt": 9, "delete_cnt": 8, "insert_cnt": 7, "fix_ops_cnt": 24, "bug_source_code": "#include \n#include \n#include \nusing namespace std;\nint main () {\n int64_t n, k, y, p = 0;\n vector a;\n int64_t *t = new int64_t;\n cin >> n >> k;\n for (y = 0; y < n; ++y) {\n cin >> *t;\n if (*t <= k)\n a.push_back(*t);\n } delete t;\n sort(a.begin(), a.end());\n if (k == 0) {\n if (a.size() == 0 || a[0] != 0)\n cout << k << endl;\n else if (a[0] == 0)\n cout << k + 1 << endl;\n return 0;\n } if (a[0] != 0) {\n if (k == 0) {\n cout << k << endl;\n return 0;\n }else if (a.size() > 1) {\n if (k >= 0 && k <= a[1]) {\n cout << k - 1 << endl;\n return 0;\n }else {\n p += a[1];\n }\n }else if (a.size() == 1) {\n if (k < a[0]) {\n cout << k - 1 << endl;\n }else if (k == a[0]) {\n cout << k << endl;\n }else {\n cout << k - 1 << endl;\n } return 0;\n }\n } for (y = 1; y < a.size() - 1; ++y) {\n if (a[y] == k) {\n cout << p + 1 << endl;\n return 0;\n }\n if (a[y] != a[y + 1] - 1) {\n if (k >= a[y] && k <= a[y + 1]) {\n cout << k - a[y] - 1 << endl;\n return 0;\n }else {\n p += a[y + 1] - a[y] - 1;\n }\n }\n } if (k > a[a.size() - 1])\n cout << k - a[a.size() - 1] - 1 << endl;\n else if (k == a[a.size() - 1])\n cout << p + 1 << endl;\n return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "4625fcabaa3436ed8f950f31b07f25a3", "src_uid": "21f579ba807face432a7664091581cd8", "apr_id": "8ee7aa0ca539281475205a4c81cb24d9", "difficulty": 1000, "tags": ["greedy", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.1688235294117647, "equal_cnt": 18, "replace_cnt": 11, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 18, "bug_source_code": "#include\n#include\n#include\nusing namespace std;\n typedef vector< int > vi;\n typedef vector< vi > vvi;\n typedef pair pairs; \nint main()\n{ \n \n \n vvi Tablero; // En este tablero guardamos los cuadros coloreados\n set s; \n vector v;\n int n,x,y,c,segundos,i;\n segundos=0;\n cin>>n>>x>>y>>c;\n pairs a1 = make_pair(x, y); \n s.insert(a1);\n vvi k(n, vi(n)); // (nxn)\n while(s.size()=1)\n {\n\t s.insert(make_pair(v[j].first-1,v[j].second));}\n\t if(v[j].second+1<=n){\n\t s.insert(make_pair(v[j].first,v[j].second+1));\n\t }\n\t if(v[j].second-1>=1)\n\t \n { s.insert(make_pair(v[j].first,v[j].second-1));}\n\t }\n\t \n\t v.clear();\n //cout<\n#include\n#include\n//#define MOD 9000000000000000000\nusing namespace std;\nunsigned long long f[100][100],g[100],i,j,k,n,h;\nint main()\n{\n memset(f,sizeof(f),0);\n memset(g,sizeof(g),0);\n cin>>n>>h;\n g[0]=1;\n f[0][0]=1;\n for (i=1;i<=n;i++){\n for (j=1;j<=i&&j<=h;j++)\n for (k=1;k<=n;k++){\n f[i][j]+=f[k-1][j-1]*g[i-k];\n f[i][j]-=f[k-1][j-1]*f[i-k][j-1];\n //f[i][j]%=MOD;\n f[i][j]+=g[k-1]*f[i-k][j-1];\n //f[i][j]%=MOD;\n }\n //for (j=1;j<=h;j++)\n //cout<\n#include\n#ifndef ONLINE_JUDGE\nconst int maxn = 10;\n#else\nconst int maxn = 3*100000+10;\n#endif\nint u[maxn*2],v[maxn*2],head[maxn],next[maxn];\nint out[maxn];\nint n,m;\nvoid dfs(int x)\n{\n\tint c0 = 0;\n\tfor(int i = head[x]; i != -1; i = next[i])\n\t{\n\t\tif(out[v[i]] == out[x] ) c0++;\n\t}\n\tif(c0 > 1)\n\t{\n\t\tout[x] ^= 1;\n\t\tfor(int i = head[x]; i!=-1; i = next[i])\n\t\t\tdfs(v[i]);\n\t}\n}\n\nint main()\n{\n\t#ifndef ONLINE_JUDGE\n\tfreopen(\"data.in\",\"r\",stdin);\n\tfreopen(\"data.out\",\"w\",stdout);\n\t#endif\n\tscanf(\"%d%d\",&n,&m);\n\tmemset(head,-1,sizeof(head));\n\tfor(int i = 0 ; i < m; i++)\n\t{\n\t\tscanf(\"%d%d\",&u[i],&v[i]);\n\t\tnext[i] = head[u[i]], head[u[i]] = i;\n\t\tu[i+n] = v[i], v[i+n] = u[i];\n\t\tnext[i+n] = head[v[i]] , head[v[i]] = i+n;\n\t}\n\t\n\tmemset(out,0,sizeof(out));\n\tfor(int i = 1; i <= n; i++)\n\t\tdfs(i);\n\tfor(int i = 1; i <= n; i++)\n\t\tprintf(\"%d\",out[i]);\n\treturn 0;\n}", "lang": "GNU C++", "bug_code_uid": "ff29eb3151cebe128a4d2b4aa5122665", "src_uid": "7017f2c81d5aed716b90e46480f96582", "apr_id": "eec4553c57cf97d5f5b922d3dfcab6bd", "difficulty": 2200, "tags": ["graphs", "combinatorics", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.3775933609958506, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "#include \n#include\n#include \nusing namespace std;\nlong long int val[10]={6,2,5,5,4,5,6,3,7,6};\nlong long int ans=0;\nvoid func(string str)\n{\n for(int i=0;i>a>>b;\n for(long long int i=a;i<=b;i++)\n {\n //str=\"\";\n //cout<\nint a[105];\nint main()\n{\n int i, j, n, m, sum, x=0;\n scanf(\"%d%d\",&n,&m);\n for(i = 0; i < n; i++)\n {\n scanf(\"%d\",&a[i]);\n }\n i = 0;\n while(n)\n {\n j=sum=0;\n while(sum < m)\n {\n sum+=a[i];\n i++;\n j++;\n if(sum>m)\n {\n i--;\n j--;\n }\n }\n x++;\n n-=j;\n }\n printf(\"%d\",x);\n return 0;\n}\n//2018-11-01 22:15:20.273", "lang": "GNU C++11", "bug_code_uid": "954fad181591cc6954ea967ed31d53d9", "src_uid": "5c73d6e3770dff034d210cdd572ccf0f", "apr_id": "b26314e1121898667c11393887bb5b78", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.6256062075654704, "equal_cnt": 16, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 15, "bug_source_code": "#include \n\n#define sz(a) (int)a.size()\n\nusing namespace std;\nusing ll = long long;\n\nconst int N = 7002;\n\nint n;\nll a[N], b[N];\nbool chk[N];\nset ad[N];\n\nint main() {\n cin >> n;\n for (int i = 1; i <= n; ++i) cin >> a[i];\n for (int i = 1; i <= n; ++i) cin >> b[i];\n for (int i = 1; i <= n; ++i)\n for (int j = 1; j <= n; ++j) {\n ll tmp = a[i] & a[j];\n if (a[i] > tmp) ad[i].insert(j);\n }\n int cur = n;\n while (true) {\n vector v;\n v.clear();\n for (int i = 1; i <= n; ++i) if (!chk[i])\n if (sz(ad[i]) == cur - 1)\n v.push_back(i);\n if (v.empty()) break;\n for (int u : v) chk[u] = true, --cur;\n for (int i = 1; i <= n; ++i) if (!chk[i]) {\n for (int u : v) {\n set::iterator it = ad[i].find(u);\n if (it != ad[i].end()) ad[i].erase(it);\n }\n }\n }\n ll ans = 0;\n for (int i = 1; i <= n; ++i) if (!chk[i]) ans += b[i];\n cout << ans << \"\\n\";\n return 0;\n}", "lang": "GNU C++14", "bug_code_uid": "b44fa803f335bba724132ea950322a80", "src_uid": "9404ec14922a69082f3573bbaf78ccf0", "apr_id": "3d362e74a74d99e4a831ccc2b591623e", "difficulty": 1700, "tags": ["brute force", "greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9984101748807631, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \nusing namespace std;\n\nint main() {\n //freopen(\"input.txt\", \"r\", stdin) ;\n //freopen(\"output.txt\", \"w\", stdout) ;\n ios_base::sync_with_stdio(false);\n cin.tie(NULL) ; cout.tie(NULL) ;\n int candies[4];\n int sum=0;\n bool exist=false;\n int maxv=0;\n for(int i=0;i<4;i++){\n cin>>candies[i];\n sum+=candies[i];\n if(maxv\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\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 1e9\n#define eps 1e-9\n#define PI 3.14159265358979323846264338327950\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 show(x) cerr<<#x<<\" = \"< vi;\ntypedef vector vd;\ntypedef vector vs;\ntypedef pair pi;\ntypedef vector vpi;\n\nint dx[] = { 0, 0, 1, -1 };\nint dy[] = { 1, -1, 0, 0 };\nstruct line {\n\tint x1, y1, x2, y2;\n};\nint main() {\n#ifndef ONLINE_JUDGE\n\tfreopen(\"test.in\", \"rt\", stdin);\n\t//\tfreopen(\"o.txt\", \"wt\", stdout);\n#endif\n\tios::sync_with_stdio(false);\n\tvector x(2), y(2);\n\tint x1, y1, x2, y2, lenX = -1, lenY = -1, l, lx = 0, ly = 0;\n\n\tFOR(i , 0 , 4)\n\t{\n\t\tcin >> x1 >> y1 >> x2 >> y2;\n\t\tif ((x1 != x2 && y1 != y2) || (x1 == x2 && y1 == y2)) {\n\t\t\tcout << \"NO\" << endl;\n\t\t\treturn 0;\n\t\t}\n\t\tx1 == x2 ? l = abs(y1 - y2) : l = abs(x1 - x2);\n\t\tif (lenX == -1 && x1 == x2)\n\t\t\tlenX = l;\n\t\tif (lenY == -1 && y1 == y2)\n\t\t\tlenY = l;\n\t\tif (x1 == x2 && l != lenX) {\n\t\t\tcout << \"NO\" << endl;\n\t\t\treturn 0;\n\t\t}\n\t\tif (y1 == y2 && l != lenY) {\n\t\t\tcout << \"NO\" << endl;\n\t\t\treturn 0;\n\t\t}\n\t\tline ln = { x1, y1, x2, y2 };\n\t\tx1 == x2 ? x[lx++] = ln : y[ly++] = ln;\n\t}\n\tbool gd = true;\n\tFOR(i , 0 , 2)\n\t{\n\t\tint cnt = 0;\n\t\tFOR(j , 0 , 2)\n\t\t{\n\t\t\tif (x[i].x1 == y[j].x1 && x[i].y1 == x[i].y1)\n\t\t\t\tcnt++;\n\t\t\tif (x[i].x1 == y[j].x2 && x[i].y1 == x[i].y2)\n\t\t\t\tcnt++;\n\t\t\tif (x[i].x2 == y[j].x1 && x[i].y2 == x[i].y1)\n\t\t\t\tcnt++;\n\t\t\tif (x[i].x2 == y[j].x2 && x[i].y2 == x[i].y2)\n\t\t\t\tcnt++;\n\t\t}\n\t\tif (cnt != 2)\n\t\t\tgd = false;\n\t}\n\tif (x[0].x1 == x[1].x1 && x[0].y1 == x[1].y1)\n\t\tgd = false;\n\n\tif (x[0].x1 == x[1].x2 && x[0].y1 == x[1].y2)\n\t\tgd = false;\n\n\tif (x[0].x2 == x[1].x1 && x[0].y2 == x[1].y1)\n\t\tgd = false;\n\n\tif (x[0].x2 == x[1].x2 && x[0].y2 == x[1].y2)\n\t\tgd = false;\n\n\tif (y[0].x1 == y[1].x1 && y[0].y1 == y[1].y1)\n\t\tgd = false;\n\n\tif (y[0].x1 == y[1].x2 && y[0].y1 == y[1].y2)\n\t\tgd = false;\n\n\tif (y[0].x2 == y[1].x1 && y[0].y2 == y[1].y1)\n\t\tgd = false;\n\n\tif (y[0].x2 == y[1].x2 && y[0].y2 == y[1].y2)\n\t\tgd = false;\n\tgd ? cout << \"YES\" : cout << \"NO\";\n\n\treturn 0;\n}\n", "lang": "GNU C++0x", "bug_code_uid": "14383accc4b2397452ce1aee04da5a1d", "src_uid": "ad105c08f63e9761fe90f69630628027", "apr_id": "dbb9f79ab8b3770c7bbcf21de567ec40", "difficulty": 1700, "tags": ["geometry", "math", "implementation", "brute force", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9285714285714286, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include \nusing namespace std;\n\nint main(){\n char m[9];\n for(int i=0;i<9;i++)\n cin>>m[i];\n for(int i=0;i<4;i++)\n if(m[i] != m[8-i]){\n cout<<\"NO\"<\n\nusing namespace std;\n\nint main()\n{\n int n;\n cin >> n;\n int arr[n];\n for(int i=0; i> arr[i];\n sort(arr, arr+n);\n int d=arr[n-1]-arr[0];\n while(d%2==0)\n {\n d=d/2;\n }\n bool c=0;\n for(int i=0; i\nmain()\n{\n int d1,d2,d3,a,b,c,min;\n scanf(\"%d%d%d\",&d1,&d2,&d3);\n a=d1+d2+d3;\n b=2*(d1+d2);\n c=2*(d1+d3);\n min=a;\n if(min>b) min=b;\n if(min>c) min=c;\n printf(\"%d\",min);\n}\n//2018-11-09 18:49:50.781", "lang": "GNU C++11", "bug_code_uid": "3f45bb2fd8238aa3fefb02d07a3c9291", "src_uid": "26cd7954a21866dbb2824d725473673e", "apr_id": "71a0f690d14f3472d5cb6f5e13223473", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9993634627625716, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n unsigned long long i,j,k,l,m,n,p;//,arr[1000];\n unsigned long long l1,r1,l2,r2;\n cin>>l1>>r1>>l2>>r2>>k;\n if(l2>r1||l1>r2){cout<<0;return 0;}\n if(l1<=l2&&r2<=r1){\n if(k>=l2&&r2>=k)\n {\n cout<=r1)\n {\n if(l2<=k&&r1>=k)\n {\n cout<=l2&&r2<=r1)\n {\n if(l1<=k&&r2>=k)\n {\n cout<=k)\n {\n cout<\nusing namespace std; \n#define int long long \nconst int M = 998244353;\n\nint power(int a,int b){\n int res=1;a%=M;\n while(b){\n if(b&1)res=res*a%M;\n a=a*a%M;b>>=1;\n }\n return res;\n}\n\nint32_t main(){\n ios_base::sync_with_stdio(false); \n cin.tie(NULL); cout.tie(NULL);\n int n,m,k;\n cin>>n>>m>>k;\n m = power(m,M-2);\n vector fact(k+1,1);\n for(int i=1;i<=k;++i)\n fact[i]=i*fact[i-1]%M;\n auto ncd = [&](int d){\n if(n=n-d+1;--i){\n res = res*i%M;\n }\n return res*power(fact[d],M-2)%M;\n };\n auto dci = [&](int i,int d){\n return fact[d]*power(fact[d-i]*fact[i]%M,M-2)%M;\n };\n auto ways = [&](int d){\n int res=0;\n int cnt = 1;\n for(int i=d;i>=0;--i){\n res = (res+cnt*power(i,k)%M*dci(i,d)%M+M)%M;\n cnt = -cnt;\n }\n return res;\n };\n int ans=0;\n for(int d=1;d<=k;++d){\n int tmp = power(m,d)*ncd(d)%M;\n tmp = (tmp*ways(d)%M);\n ans =(ans+tmp+M)%M;\n }\n cout << ans << endl;\n return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "587df52ce1dcf8ea3046c6c75468d242", "src_uid": "e6b3e559b5fd4e05adf9f1cd1b22126b", "apr_id": "e1136caa6bcc51c7d62a20c479e93a12", "difficulty": 2600, "tags": ["dp", "probabilities", "combinatorics", "number theory", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9544468546637744, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "#include \nusing namespace std;\n\n#define int long long\n#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);\n\ntypedef long long LL;\nconst int mod = 1e9 + 7;\n\ntemplate T gcd(T a,T b) { if(a==0) return 0; return gcd(b%a,a); }\ntemplate T pow(T a,T b, long long m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; }\n\nconst int N = 1e4+5;\n\nint32_t main(){\n IOS;\n\n int h[2],m[2];\n \n for(int i=0;i<2;i++)\n scanf(\"%d:%d\", h[i],m[i]);\n \n h[0]-=h[1];\n m[0]-=m[1];\n \n if(m[0]<0)\n m[0]+=60;\n \n if(h[0]<0)\n h[0]+=24;\n \n printf(\"%02d:%02d\", h[0], m[0]);\n \n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "f65f8a608e11c5c07cc394aece93115b", "src_uid": "595c4a628c261104c8eedad767e85775", "apr_id": "83f29425a9bb2b0961402cc9128c5458", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9808274470232089, "equal_cnt": 13, "replace_cnt": 1, "delete_cnt": 12, "insert_cnt": 0, "fix_ops_cnt": 13, "bug_source_code": "#include\nusing namespace std;\n#define MAX 100005\n#define lli long long int\nlli num[5]={1,2,3,4,5},n,arr[5],combinations[150][10],totalCombination = 0,grid[10][10];\nbool visited[5] = {false};\nvoid build(lli pos)\n{\n\tlli i,j,k,l;\n\tif(pos>=n)\n\t{\n\t\t// cout<<\"combination \"<>grid[i][j];\n\t\tlli maxScore = 0;\n\t\tfor(i=0;i\n\nusing namespace std;\n\n#define LIMIT 100\ntypedef pair ii;\n\nstring add(string a, string b){\n\n string output = \"\";\n int co = 0;\n\n while (true) {\n\n char c = 0;\n\n if (!a.empty()){\n c += a.back() - '0';\n a.pop_back();\n }\n\n if (!b.empty()){\n c += b.back() - '0';\n b.pop_back();\n }\n\n if( co > 0){\n c += co;\n co = 0;\n }\n\n if (c > 9){\n c = '0';\n co = c - '9';\n }\n\n output += c + '0';\n if (a.empty() && b.empty() && co == 0) break;\n\n }\n\n reverse(output.begin(), output.end());\n return output;\n}\n// ***** MAIN *****\nint main(){\n //ios::sync_with_stdio(false);\n cin.tie(NULL);\n\n string a1, a2;\n cin >> a1 >> a2;\n\n reverse(a2.begin(), a2.end());\n\n std::cout << add(a1, a2) << std::endl;\n\n return 0;\n}\n\n", "lang": "GNU C++11", "bug_code_uid": "bcfab38763dbab4f10b0f15dddf64f3b", "src_uid": "69b219054cad0844fc4f15df463e09c0", "apr_id": "bf66cafc84fe0ec82bdca37a1afaaac2", "difficulty": 1200, "tags": ["constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9689075630252101, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\n#define MAXN 1010\n#define MAXM 11\n#define INF 1000000000\n#define MOD 1000000007\n#define eps 1e-8\n#define ll long long\nll f[MAXN][MAXM][MAXN];\nll ine[MAXM];\nint n,d;\nll mod;\nll ans=0;\nll C(ll x,ll y){\n\tll re=1;\n\tint i;\n\tfor(i=x-y+1;i<=x;i++){\n\t\t(re*=i%mod)%=mod;\n\t}\n\tfor(i=1;i<=y;i++){\n\t\t(re*=ine[i])%=mod;\n\t}\n\treturn re;\n}\nint main(){\n\tint i,j,k,l;\n\tscanf(\"%d%d%lld\",&n,&d,&mod);\n\tif(n<=2){\n\t\tprintf(\"1\\n\");\n\t\treturn 0;\n\t}\n\tine[0]=ine[1]=1;\n\tfor(i=2;i<=10;i++){\n\t\tine[i]=(mod-mod/i)*ine[mod%i]%mod;\n\t}\n\tfor(i=0;i<=n;i++){\n\t\tf[1][0][i]=1;\n\t\tf[1][d-1][i]=1;\n\t}\n\tfor(i=2;i<=n;i++){\n\t\tfor(j=1;j<=d&&j\n#include \nusing namespace std;\ntypedef long long ll;\nconst int mod = 998244353;\n\nll pow(ll a, ll b, ll mod) {\n\tif (b == 0) return 1;\n\tif (b == 1) return a % mod;\n\ta %= mod;\n\tif (!(b & 1)) return pow((a * a) % mod, b >> 1, mod) % mod;\n\tif (b & 1) return a * pow(a, b - 1, mod) % mod;\n\treturn 1;\n}\nll inv(int i) {\n\treturn pow(i, mod - 2, mod) % mod;\n}\n\nint main() {\n\tint n, m;\n\tcin >> n >> m;\n\tll res = m + 1;\n\tfor (int i = 2; i <= n; i++) {\n\t\tll tmp = m * inv(i);\n\t\ttmp %= mod;\n\t\tres += tmp;\n\t\tres %= mod;\n\t}\n\tll tmp = n * inv(m + 1);\n\ttmp %= mod;\n\ttmp++;\n\tres *= tmp;\n\tres %= mod;\n\tres = (res + mod) % mod;\n\tcout << res << endl;\n\treturn 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "9bbba7a43892db11800ebefe8fdc5a2d", "src_uid": "9f2b59df7bef2aeee0ce71facd2b1613", "apr_id": "9154a3f5844aa22e7b5a54a81801a629", "difficulty": 3000, "tags": ["dp", "math", "combinatorics", "probabilities"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.02226179875333927, "equal_cnt": 11, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "#pragma GCC optimize(1)\n#pragma GCC optimize(2)\n#pragma GCC optimize(3)\n#include\n#include\n#define pi acos(-1)\n#define E 2.71828\n#define mp make_pair\n#define pb push_back\n#define sz(s) s.length()\n#define sb substr\n#define mi(x) memset((int)(x),0,sizeof((x)))\n#define ms(x) memset((string)(x),\"\",sizeof(x))\n#define mc(x) memset((char)(x),'\\0',sizeof(x))\n#define for0(i,n) for(int i=0;i<(int)(n);i++)\n#define maxn 1e9\n#define eps 1e-9\n#define eightqueen 92\n#define cint %d\n#define clong %lld\n#define cchar %c\n#define cstring %s\nusing namespace std;\ntypedef long long ll;\ntypedef unsigned int uint;\ntypedef unsigned long long ull;\ntypedef long double ld;\ntypedef pair pii;\ntypedef vector vi;\nstruct wint:vector\n{\n wint(int n=0)\n {\n push_back(n);\n check();\n }\n wint& check()\n {\n while(!empty()&&!back())pop_back();\n if(empty())return *this;\n for(int i=1; i=10)\n {\n push_back(back()/10);\n (*this)[size()-2]%=10;\n }\n return *this;\n }\n};\nistream& operator>>(istream &is,wint &n)\n{\n string s;\n is>>s;\n n.clear();\n for(int i=s.size()-1; i>=0; --i)n.push_back(s[i]-'0');\n return is;\n}\nostream& operator<<(ostream &os,const wint &n)\n{\n if(n.empty())os<<0;\n for(int i=n.size()-1; i>=0; --i)os<=0; --i)\n if(a[i]!=b[i])return 1;\n return 0;\n}\nbool operator==(const wint &a,const wint &b)\n{\n return !(a!=b);\n}\nbool operator<(const wint &a,const wint &b)\n{\n if(a.size()!=b.size())return a.size()=0; --i)\n if(a[i]!=b[i])return a[i](const wint &a,const wint &b)\n{\n return bb);\n}\nbool operator>=(const wint &a,const wint &b)\n{\n return !(ai)\n {\n --a[j];\n a[--j]+=10;\n }\n }\n return a.check();\n}\nwint operator-(wint a,const wint &b)\n{\n return a-=b;\n}\nwint operator*(const wint &a,const wint &b)\n{\n wint n;\n n.assign(a.size()+b.size()-1,0);\n for(int i=0; i!=a.size(); ++i)\n for(int j=0; j!=b.size(); ++j)\n n[i+j]+=a[i]*b[j];\n return n.check();\n}\nwint& operator*=(wint &a,const wint &b)\n{\n return a=a*b;\n}\nwint divmod(wint &a,const wint &b)\n{\n wint ans;\n for(int t=a.size()-b.size(); a>=b; --t)\n {\n wint d;\n d.assign(t+1,0);\n d.back()=1;\n wint c=b*d;\n while(a>=c)\n {\n a-=c;\n ans+=d;\n }\n }\n return ans;\n}\nwint operator/(wint a,const wint &b)\n{\n return divmod(a,b);\n}\nwint& operator/=(wint &a,const wint &b)\n{\n return a=a/b;\n}\nwint& operator%=(wint &a,const wint &b)\n{\n divmod(a,b);\n return a;\n}\nwint operator%(wint a,const wint &b)\n{\n return a%=b;\n}\nwint pow(const wint &n,const wint &k)\n{\n if(k.empty())return 1;\n if(k==2)return n*n;\n if(k.back()%2)return n*pow(n,k-1);\n return pow(pow(n,k/2),2);\n}\nint absi(int x)\n{\n\tif(x>=0)\n\t\treturn x;\n\treturn -x;\n}\ndouble pod(double x,double n)\n{\n\tfor(int i=0;i>s>>t;\n\tfor0(i,sz(s))\n\t{\n\t\tll ex=(ll)(s[i]-'0');\n\t\tnum[ex]++;\n\t\tif(ex==true&&ex0)\n\t\t{\n\t\t\tkkk+=(char)(i+'0');\n\t\t\tnum[i]--;\n\t\t}\n\t\tcout<<(kkk==t?\"OK\":\"WRONG_ANSWER\");\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "a0c4dfc9c41ad40aec1cbfe9dd7cc02c", "src_uid": "d1e381b72a6c09a0723cfe72c0917372", "apr_id": "60ab82d3e6a85f7dbd9b7475070d0869", "difficulty": 1100, "tags": ["sortings", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.40738534842167956, "equal_cnt": 24, "replace_cnt": 13, "delete_cnt": 0, "insert_cnt": 11, "fix_ops_cnt": 24, "bug_source_code": "#include\n#include\nusing namespace std;\n\nint main(){\n\tint n,m;\n\tcin >> n >> m;\n\tvector visited(n,0);\n\tint num1=m;\n\tint num2=m;\n\tint x=0;\n\tint y=n-1;\n\twhile(num1>0){\n\t\tvisited[x]=1;\n\t\tvisited[y]=1;\n\t\tx++;\n\t\ty--;\n\t\tnum1--;\n\t}\n\tint count=0;\n\tfor(int i=0;i0){\n\t\tvisited[a]=1;\n\t\tvisited[b]=1;\n\t\tnum2--;\n\t\ta++;\n\t\tb++;\n\t}\n\tint count2=0;\n\tfor(int i=0;i\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n\nusing namespace std ;\n\nint main ()\n{\n long long n , m , k , x , y , i , j , l , maxi = 0 , mini = 0 , sergei = 0 , b ;\n cin >> n >> m >> k >> x >> y ;\n l = k - m*n , i = l / ((n-1)*m) , j = l % ((n-1)*m) , b = k % (m*n);\n\n \n if (m*n == k){mini = maxi = sergei = 1 ;}\n\n else if (m*n > k){mini = 0 , maxi = 1 ;\n if (m*(x-1)+y >= b){sergei = 1;}}\n\n else if (m*n < k && k < m*n*2-m-1){maxi = 2 , mini = sergei = 1;\n if (m*(n-x-1)+y >= b){sergei += 1;}}\n\n else {\n if (i % 2 != 0 && j == 0){maxi = i + 1 , mini = maxi / 2 ;\n if (x == 1){sergei = mini + 1;}else if (x == n){sergei = mini ;}else {sergei = maxi;}}\n\n else if (i % 2 != 0 && j != 0){\n maxi = i + 1 , mini = maxi / 2 ;\n if (j <= m){if (x == 1 && y <= j){sergei = mini * 2;}}\n else if (j-(m*(n-1)) > 0 && j-(m*(n-1)) <= m){\n if (y <= j-(m*(n-1)) && x == n){sergei = mini +1 ;}\n if (j-(m*(n-1)) == m){mini += 1;}}\n else if (j > m && j < (n-1)*m+1 ){\n if((x-1)*m+y <= j){sergei = maxi + 1;}maxi += 1;}}\n else if (i % 2 == 0 && j == 0){maxi = i + 1 , mini = maxi / 2 + 1;\n if (x == 1 || x == n){sergei = mini ;}else{sergei = maxi ;}}\n\n else if (i % 2 == 0 && j != 0){maxi = i + 1 , mini = maxi / 2 + 1 ;\n if (j <= m){if (x == n && y >= j){sergei = mini + 1;}}\n else if (j-(m*(n-1)) > 0 && j-(m*(n-1)) <= m){\n if (y <= j-(m*(n-1)) && x == 1){sergei = mini +1 ;}\n if (j-(m*(n-1)) == m){mini += 1;}}\n else if (j > m && j < (n-1)*m+1 ){\n if((n-x-1)*m+y <= j){sergei = maxi + 1;}maxi += 1;}}\n }\n\n\n\n\n\n\n\n cout << maxi << \" \" << mini << \" \" << sergei ;\n\n}\n", "lang": "GNU C++14", "bug_code_uid": "d6c3ed04b3264afa104ea5ec1f5fe944", "src_uid": "e61debcad37eaa9a6e21d7a2122b8b21", "apr_id": "a69c0f6bd70ff72cc3cdd808bff877ef", "difficulty": 1700, "tags": ["math", "constructive algorithms", "implementation", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9643094657503879, "equal_cnt": 10, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "// Codeforces Task 1096G - Lucky Tickets\n\n#include \n\nusing namespace std;\n\ntypedef long long ll;\n\n// return a % b (positive value)\nll mod(ll a, ll m) {\n\treturn ((a % m) + m) % m;\n}\n\n// returns d = gcd(a,b); finds x,y such that d = ax + by\nint extended_euclid(int a, int b, int &x, int &y) {\n\tint xx = y = 0;\n\tint yy = x = 1;\n\twhile(b) {\n\t\tint q = a / b;\n\t\tint t = b;\n\t\tb = a % b;\n\t\ta = t;\n\t\tt = xx;\n\t\txx = x - q * xx;\n\t\tx = t;\n\t\tt = yy;\n\t\tyy = y - q * yy;\n\t\ty = t;\n\t}\n\treturn a;\n}\n\n// computes b such that ab = 1 (mod n), returns -1 on failure\nint mod_inverse(int a, int n) {\n\tint x, y;\n\tint d = extended_euclid(a, n, x, y);\n\tif(d > 1) return -1;\n\treturn mod(x, n);\n}\n\n// return a^b mod m\nll powmod(ll a, ll b, ll m) {\n\tll res = 1;\n\twhile(b > 0)\n\t\tif(b & 1)\n\t\t\tres = (res * a) % m, --b;\n\t\telse\n\t\t\ta = (a * a) % m, b >>= 1;\n\treturn res % m;\n}\n\nconst int MOD = 998244353;\nconst int root = 565042129;\nconst int root_1 = 950391366;\nconst int root_pw = 1 << 20;\n\nvoid fft(vector & a, bool invert) {\n\tint n = a.size();\n\n\tfor(int i = 1, j = 0; i < n; i++) {\n\t\tint bit = n >> 1;\n\t\tfor(; j & bit; bit >>= 1)\n\t\t\tj ^= bit;\n\t\tj ^= bit;\n\n\t\tif(i < j)\n\t\t\tswap(a[i], a[j]);\n\t}\n\n\tfor(int len = 2; len <= n; len <<= 1) {\n\t\tint wlen = invert ? root_1 : root;\n\t\tfor(int i = len; i < root_pw; i <<= 1)\n\t\t\twlen = (int)(1LL * wlen * wlen % MOD);\n\n\t\tfor(int i = 0; i < n; i += len) {\n\t\t\tint w = 1;\n\t\t\tfor(int j = 0; j < len / 2; j++) {\n\t\t\t\tint u = a[i + j], v = (int)(1LL * a[i + j + len / 2] * w % MOD);\n\t\t\t\ta[i + j] = u + v < MOD ? u + v : u + v - MOD;\n\t\t\t\ta[i + j + len / 2] = u - v >= 0 ? u - v : u - v + MOD;\n\t\t\t\tw = (int)(1LL * w * wlen % MOD);\n\t\t\t}\n\t\t}\n\t}\n\n\tif(invert) {\n\t\tint n_1 = mod_inverse(n, MOD); // modular inverse\n\t\tfor(int & x : a)\n\t\t\tx = (int)(1LL * x * n_1 % MOD);\n\t}\n}\n\nint main() {\n\tios_base::sync_with_stdio(false);\n\tcout << setprecision(12) << fixed;\n\n\tint n, k;\n\tcin >> n >> k;\n\tvector f(m, 0);\n\n\tfor(int i = 0; i < k; ++i) {\n\t\tint d;\n\t\tcin >> d;\n\t\tf[d]++;\n\t}\n\tn /= 2;\n\n\tfft(f, false);\n\n\tfor(int i = 0; i < m; ++i) {\n\t\tf[i] = powmod(f[i], n, 998244353);\n\t}\n\tfft(f, true);\n\tll result = 0;\n\tfor(auto x : f) {\n\t\tresult += ((ll)x) * x;\n\t\tresult %= 998244353;\n\t}\n\tcout << result << endl;\n\n\treturn 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "8c46efd85b91c2b30607f15de88add73", "src_uid": "279f1f7d250a4be6406c6c7bfc818bbf", "apr_id": "d4c05dc0878b2a157e537a8608756db9", "difficulty": 2400, "tags": ["divide and conquer", "dp", "fft"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5721231766612642, "equal_cnt": 28, "replace_cnt": 15, "delete_cnt": 3, "insert_cnt": 9, "fix_ops_cnt": 27, "bug_source_code": "#include \nusing namespace std;\nstruct abc{\n\tchar x;\n\tchar y;\n};\nint cnt1;\nint cnt2;\nabc G[21][21];\nabc G1[21][21];\nint used1[21][21];\nint used2[21][21];\n\tvoid DFS1(int i,int j){\n\t\tcnt1++;\n\t\tused1[i][j]=1;\n\t\tif(G[i][j].x=='>') DFS1(i,j+1);\n\t\tif(G[i][j].x=='<') DFS1(i,j-1);\n\t\tif(G[i][j].y=='^') DFS1(i-1,j);\n\t\tif(G[i][j].y=='v') DFS1(i+1,j);\n\t}\n\t\n\tvoid DFS2(int q,int w){\n\t\tcnt2++;\n\t\tused2[q][w]=1;\n\t\tif(G1[q][w].x=='>') DFS2(q,w+1);\n\t\tif(G1[q][w].x=='<') DFS2(q,w-1);\n\t\tif(G1[q][w].y=='^') DFS2(q-1,w);\n\t\tif(G1[q][w].y=='v') DFS2(q+1,w);\n\t}\nint main () {\n\tint n,m;\n\tcin>>n>>m;\n\tstring row,col;\n\tcin>>row>>col;\n\tfor(int k=0;k'){\n\t\t\tG[k+1][i].x='>';\n\t\t\tG1[k+1][i].x='<';\n\t\t\t}\n\t\t\telse{\n\t\t\t\tG[k+1][i].x='<';\n\t\t\t\tG1[k+1][i].x='>';\n\t\t\t}\n\t}\n}\n\t\t\n\tfor(int k=1;k<=col.size();k++){\n\t\tfor(int i=2;i<=col.size();i++){\t\n\t\tif(col[k-1]=='^'){\n\t\t\tG[k][i-1].y='^';\n\t\t\tG1[k][i-1].y='v';\n\t\t}\n\t\t\telse\t\t\n\t\t{\n\t\t\tG[k][i+1].y='v';\n\t\t\tG1[k][i+1].y='^';\n\t\t}\n\t}\n}\n\tDFS1(1,1);\n\tif(cnt1!=n*m){\n\t\tcout<<\"NO\";\n\t\treturn 0;\n\t}\n\tDFS2(1,1);\n\tif(cnt1==cnt2) cout<<\"YES\";\n\tcout<<\"NO\";\n\treturn 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "bab913d625b3dc371462c9a72ca562b4", "src_uid": "eab5c84c9658eb32f5614cd2497541cf", "apr_id": "0d69deaf5fecd0a08edf9c41464f573a", "difficulty": 1400, "tags": ["graphs", "brute force", "dfs and similar", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9252271139063591, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "#include\nusing namespace std;\n#define ll long long int\n#define ull unsigned long long int\n#define file freopen(\"input.txt\", \"r\", stdin);freopen(\"output.txt\", \"w\", stdout);\n#define done cin.tie(0);std::ios::sync_with_stdio(false);\n#define forit(i, a) for ( __typeof( (a).begin() ) i = (a).begin(); i != (a).end(); i++ )\n#define mp make_pair\n#define pb push_back\n#define clr(a,n) memset(a,n,sizeof(a))\n#define all(c) c.begin(), c.end()\n#define rep(i,n) for(int i=0;i=0;i--)\n#define popone(a) __builtin_popcount(a)\n#define popzero(a) __builtin_ctz(a)\n#define PI = 2.0*acos(0.0)\n#define mod 1000000007\n#define pi 3.14159265359\n//ll gcd (ll x,ll y){if(y==0)return x;return gcd(y,x%y);}\n//ll lcm(ll a,ll b){return a/gcd(a,b) * b;}\n//bool power2(int x){return (x && !(x & (x - 1)));}\n//ll largest_power(ll n){n = n| (n>>1);n= n| (n>>2);n = n| (n>>4);n = n| (n>>8);return (n+1)>>1;}\n//bool cmp(pairx,pairy)\n//{if (x.second==y.second) return x.firsty.second;}\n//int dx[] = {-1, -1, 1, 1, -2, -2, 2, 2 };\n//int dy[] = {2, -2, 2, -2, 1, -1, 1, -1 };\n//int dx[] = {1, -1, 0, 0, -1, -1, 1, 1};\n//int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};\n//int dx[]= {1, -1, 0, 0};\n//int dy[]= {0, 0, 1, -1};\nvectorvec;\nll n,k;\nvoid solve()\n{\n for(ll i=1;i<=1e9;i++)\n vec.pb(k*i);\n}\nint main()\n{\n done\n cin>>n>>k;\n solve();\n cout<<*upper_bound(all(vec),n)<\nusing namespace std;\nint n;\nchar str[110];\nint main(){\n\tcin>>n>>str;\n\tint t=n;\n\tvectorv;\n\twhile(t>0){\n\t\tv.push_back(t);\n\t\tt=((t+1)/2);\n\t}\n\treverse(v.begin(), v.end());\n\tfor(int t:v){\n\t\treverse(str,str+t);\n\t}\n\tprintf(\"%s\",str);\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "1d22c1a09c92db26bd94352dffc8ff58", "src_uid": "1b0b2ee44c63cb0634cb63f2ad65cdd3", "apr_id": "8526304f98b2f2af7d8560cde620a3ba", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7123287671232876, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n long long int s=0,n;\n cin>>n;\n for(long long int i=n;i>0;i-=2)\n {\n if(i==n)\n s+=n;\n else\n s=s+2*i;\n }\n if(s%2==0)\n cout<<2;\n else\n cout<<1;\n return 0;\n}\n", "lang": "MS C++", "bug_code_uid": "6f7513867688dbcb585aef093eaa52d5", "src_uid": "816ec4cd9736f3113333ef05405b8e81", "apr_id": "9a857a606371a274f85a6b38a832b974", "difficulty": 1200, "tags": ["math", "games"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.6006600660066007, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "#include\n\nusing namespace std;\n\nint main()\n\n{\n int n,m;\n\n cin>>n>>m;\n\n int ans=n,temp;\n\n while(temp!=1)\n {\n temp=(n/m);\n\n ans+=temp;\n\n m+=m;\n }\n\n cout << ans << endl;\n\n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "7d1c316563f19b6b1bdb3b3fb3c05db4", "src_uid": "42b25b7335ec01794fbb1d4086aa9dd0", "apr_id": "450c8255d06b0c025a5c18e8f24758eb", "difficulty": 900, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9745038934940969, "equal_cnt": 27, "replace_cnt": 17, "delete_cnt": 2, "insert_cnt": 7, "fix_ops_cnt": 26, "bug_source_code": "//#include\n//#include\n//\n//#define LIST_INIT_SIZE 2\n//#define NULL_VALUE -99999\n//#define SUCCESS_VALUE 99999\n//\n//int listMaxSize;\n//int * list;\n//int length;\n//int flag = 0;\n//\n//void initializeList()\n//{\n// listMaxSize = LIST_INIT_SIZE;\n// list = (int*)malloc(sizeof(int)*listMaxSize) ;\n// length = 0 ;\n//}\n//\n//\n//\n//////////////////// HW_1 //////////////////\n//\n//int getLength(){\n// return length;\n//}\n//\n//int insertItemAt(int pos, int item)\n//{\n// if(flag == 1){\n// initializeList();\n// flag = 0;\n// }\n// if(pos >= length){\n// return NULL_VALUE;\n// }\n//\n// int * tempList ;\n// if (length == listMaxSize)\n// {\n// //allocate new memory space for tempList\n// listMaxSize = 2 * listMaxSize ;\n// tempList = (int*) malloc (listMaxSize*sizeof(int)) ;\n// int i;\n// for( i = 0; i < length ; i++ )\n// {\n// tempList[i] = list[i] ; //copy all items from list to tempList\n// }\n// free(list) ; //free the memory allocated before\n// list = tempList ; //make list to point to new memory\n// };\n//\n// list[length++] = list[pos];\n// list[pos] = item;\n// return SUCCESS_VALUE;\n//\n//}\n//\n//int shrink()\n//{\n//\n// if(length == listMaxSize / 2 && listMaxSize != LIST_INIT_SIZE)\n// {\n// int *tempList;\n// //allocate new memory space for tempList\n// listMaxSize = listMaxSize / 2;\n// tempList = (int*) malloc (listMaxSize*sizeof(int)) ;\n// int i;\n// for( i = 0; i < length ; i++ )\n// {\n// tempList[i] = list[i] ; //copy all items from list to tempList\n// }\n// free(list) ; //free the memory allocated before\n// list = tempList ; //make list to point to new memory\n// return SUCCESS_VALUE;\n// }\n//\n// return NULL_VALUE;\n//}\n//\n//\n//int searchItem(int item)\n//{\n// int i = 0;\n// for (i = 0; i < length; i++)\n// {\n// if( list[i] == item ) return i;\n// }\n// return NULL_VALUE;\n//}\n//\n//int insertItem(int newitem)\n//{\n// if(flag == 1){\n// initializeList();\n// flag = 0;\n// }\n// int * tempList ;\n// if (length == listMaxSize)\n// {\n// //allocate new memory space for tempList\n// listMaxSize = 2 * listMaxSize ;\n// tempList = (int*) malloc (listMaxSize*sizeof(int)) ;\n// int i;\n// for( i = 0; i < length ; i++ )\n// {\n// tempList[i] = list[i] ; //copy all items from list to tempList\n// }\n// free(list) ; //free the memory allocated before\n// list = tempList ; //make list to point to new memory\n// };\n//\n// list[length] = newitem ; //store new item\n// length++ ;\n// return SUCCESS_VALUE ;\n//}\n//\n//\n//int deleteItemAt(int position) //version 2, do not preserve order of items\n//{\n// if ( position >= length ) return NULL_VALUE;\n// list[position] = list[length-1] ;\n// length-- ;\n// shrink();\n// return SUCCESS_VALUE ;\n//}\n//\n//\n//int deleteItem(int item)\n//{\n// int position;\n// position = searchItem(item) ;\n// if ( position == NULL_VALUE ) return NULL_VALUE;\n// deleteItemAt(position) ;\n// shrink();\n// return SUCCESS_VALUE ;\n//}\n//\n//void printList()\n//{\n// int i;\n// for(i=0;i\n\nusing namespace std;\n#define ll long long\n#define EPS 1e-10\n\n\nint chack[2000005];\nint main() {\n ios::sync_with_stdio(false);\n int n, i, j, k, l, m, sum = 0;\n vector v;\n cin >> n >> m;\n int a[n+2], b[m+2];\n for(i=0;i> a[i];\n }\n for(i=0;i> b[i];\n sum += b[i];\n }\n\n for(i=1;i<=m;i++){\n for(j=1;j<=b[i];j++){\n v.push_back(i);\n }\n }\n\n// for(i=0;i\n#include \n#include \n#include \n#include \nusing namespace std;\n\nstring s[51];\ndouble dp[1050000];\nint b[1050000];\nlong long bm[1050000];\nint N, M;\n\nvoid prep(){\n for(int i=0;i<(1<=0;--i){\n for(int j=0;j> N;\n for(int i=0;i> s[i];\n }\n M = s[0].size();\n int lim = 1<=0;--i){\n tot = 0;\n p = 1 / ((double)M - b[i]);\n dp[i] = 0;\n for(int j=0;j\n#define ___ ios_base::sync_with_stdio(false);cin.tie(NULL);\n#define D(x) cout << #x \" = \" << (x) << endl\n#define endl '\\n'\n\n\nconst int MN = 55, MM = 20;\nlong long dp[(1 << MM) + 2];\ndouble ans[(1 << MM) + 2];\nstring data[MN];\n\nint s, n;\n\nint main() { ___\n\n cin >> n;\n for (int i = 0; i < n; ++i)\n cin >> data[i];\n\n s = data[0].size();\n\n for (int i = 0; i < n; ++i) {\n for (int j = i + 1; j < n; ++j) {\n int same = 0;\n for (int k = 0; k < s; ++k)\n if (data[i][k] == data[j][k])\n same |= 1 << k;\n dp[same] = (1LL << j) | (dp[same] | 1LL << i);\n }\n }\n\n for (int mask = (1 << s) - 1; mask >= 0; --mask)\n for (int i = 0; i < s; ++i)\n if ((mask >> i) & 1)\n dp[mask ^ (1 << i)] |= dp[mask];\n\n\n for (int mask = (1 << s) - 1; mask >= 0; --mask) {\n if (dp[mask] == 0)\n ans[mask] = 0;\n else {\n ans[mask] = 0;\n double events = s - __builtin_popcount(mask);\n for (int i = 0; i < s; ++i) {\n if (!((mask >> i) & 1)) {\n ans[mask] += ans[mask | 1 << i] * (double) __builtin_popcountll(dp[mask | 1 << i]) / (double)__builtin_popcountll(dp[mask]);\n }\n }\n ans[mask] = 1.0 + ans[mask] / events;\n }\n }\n\n cout << setprecision(15) << ans[0] << endl;\n\n return 0;\n}", "lang": "GNU C++", "bug_code_uid": "f96e929b946e3c2cc8604ba2a148bf27", "src_uid": "a95d9aef6a64c30e46330dcc8e6d4a67", "apr_id": "d295d37e349394331b869a3994f44247", "difficulty": 2600, "tags": ["dp", "bitmasks"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.8644948064211521, "equal_cnt": 16, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 15, "bug_source_code": "#pragma GCC optimize(\"Ofast\")\n#include \n\nusing namespace std;\n\ntypedef long long ll;\ntypedef pair pii;\n\n#define fi first\n#define se second\n#define mp make_pair\n#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);\n\nmt19937 rng(chrono::steady_clock::now().time_since_epoch().count());\n\nconst int N = 2025;\nconst int M = 65;\nconst int MOD = 998244353;\n\nint dp2[N][M][N]; // [sum][len][last] easy MLE\nint dp1[N][N];\n\nint n, k;\n\nvoid add(int &a, int b){\n a += b;\n if(a >= MOD)\n a -= MOD;\n}\n\nvoid solve1(){\n for(int i = 0 ; i <= n; i ++ )\n dp1[0][i]=1;\n int ans = 0;\n for(int i = 1; i <= n; i ++ ){\n for(int j = 1; j <= n; j ++ ){\n if(i >= j){\n add(dp1[i][j],dp1[i-j][j]);\n add(ans, dp1[i][j]);\n } \n add(dp1[i][j],dp1[i][j-1]);\n }\n }\n cout << ans << \"\\n\";\n}\n\nvoid solve2(){\n for(int i = 0 ; i < N; i ++ )\n dp2[0][0][i]=1;\n int ans = 0;\n for(int i = 1; i <= n; i ++ ){\n for(int j = 1; j < M; j ++ ){\n for(int x = n; x >= 1; x -- ){\n if(i >= j*x){\n add(dp2[i][j][x],dp2[i - j * x][j - 1][x]);\n add(ans, dp2[i][j][x]);\n }\n add(dp2[i][j][x],dp2[i][j][x+1]);\n }\n }\n }\n cout << ans << \"\\n\";\n}\n\nbool can(vector t){\n if(t.size() > n)\n return false;\n for(int op = 0; op < k ; op ++ ){\n vector nx;\n reverse(t.begin(), t.end());\n for(int i = 0 ; i < t.size();i ++ ){\n for(int j = 0; j < t[i]; j ++ )\n nx.push_back(i + 1);\n }\n t = nx;\n if(t.size() > n)\n return false;\n }\n return true;\n}\n\nint res = 0;\n\nvoid brute(vector t){\n if(t.empty()){\n for(int i = 1; i <= n; i ++ ){\n t.push_back(i);\n if(!can(t))\n return;\n brute(t);\n t.pop_back();\n }\n return;\n }\n res ++ ;\n for(int i = t.back(); i <= n; i ++ ){\n t.push_back(i);\n if(!can(t))\n return;\n brute(t);\n t.pop_back();\n }\n}\n\nint main(){\n fastIO;\n cin >> n >> k;\n if(k == 1) solve1();\n else if(k == 2){\n solve2();\n }\n else{\n brute({});\n cout << res << \"\\n\";\n }\n return 0;\n}", "lang": "GNU C++14", "bug_code_uid": "236b14608fa80c1403ea40adaad314bd", "src_uid": "c435a0cd437081cd3593637be4568c6a", "apr_id": "b60b610246d60c71cab279182bfd8368", "difficulty": 2900, "tags": ["dp", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.985290254793801, "equal_cnt": 13, "replace_cnt": 2, "delete_cnt": 6, "insert_cnt": 4, "fix_ops_cnt": 12, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\ntemplate void chkmax(T &x, T y) {x = x > y ? x : y;}\ntemplate void chkmin(T &x, T y) {x = x > y ? y : x;}\n\ntypedef long long ll;\n\nconst int INF = (1ll << 30);\n\n#define DEBUG(x) std::cerr << #x << \" = \" << x << std::endl\n\ntemplate void read (T &x) {\n\tx = 0; bool f = 1; char ch;\n\tdo {ch = getchar(); if (ch == '-') f = 0;} while (ch > '9' || ch < '0');\n\tdo {x = x * 10 + ch - '0'; ch = getchar();} while (ch >= '0' && ch <= '9');\n\tx = f ? x : -x;\n}\n\ntemplate void write (T x) {\n\tif (x < 0) x = ~x + 1, putchar ('-');\n\tif (x > 9) write (x / 10);\n\tputchar (x % 10 + '0');\n}\n\nconst int N = 1e5 + 7;\nconst int mod = 1e9 + 7;\n\nstring f[N], tp, a, b, c;\nll n, m, cnt, lens, len[N], next[N];\nchar ch[N];\n\nstruct Matrix {\n\tll num[3][3];\n\t\n\tinline void print() {\n\t\tfor(int i = 0; i < 2; i++) {\n\t\t\tfor(int j = 0; j < 2; j++) {\n\t\t\t\tprintf(\"%lld \", num[i][j]);\n\t\t\t}\n\t\t\tputs(\"\");\n\t\t}\n\t}\n\t\n\tinline void init() {\n\t\tfor(int i = 0; i < 2; i++) {\n\t\t\tfor(int j = 0; j < 2; j++) {\n\t\t\t\tnum[i][j] = 0;\n\t\t\t}\n\t\t}\n\t}\n} ans, base; \n\nMatrix operator * (Matrix a, Matrix b) {\n\tMatrix c; c.init();\n\tfor(int i = 0; i < 2; i++) {\n\t\tfor(int j = 0; j < 2; j++) {\n\t\t\tfor(int k = 0; k < 2; k++) {\n\t\t\t\tc.num[i][j] = (c.num[i][j] + 1ll * a.num[i][k] * b.num[k][j] % mod) % mod;\n\t\t\t}\n\t\t}\n\t}\n\treturn c;\n}\n\ninline void qpow(ll b) {\n\tif(b < 0) return;\n\tbase.init(); \n\tbase.num[0][0] = base.num[0][1] = base.num[1][0] = 1;\n\twhile(b) {\n\t\tif(b & 1) ans = ans * base;\n\t\tbase = base * base;\n\t\tb >>= 1;\n\t}\n}\n\ninline int fib(int x) {\n\tans.num[0][0] = ans.num[0][1] = 1;\n\tif(x == 0) return 0;\n\tqpow(x - 2);\n\treturn ans.num[0][0];\n}\n\ninline void init() {\n\tf[1] = 'a'; f[2] = 'b';\n\tfor(int i = 3; ; i++) {\n\t\tf[i] = f[i - 1] + f[i - 2];\n\t\tlen[i] = f[i].length();\n\t\tcnt = i;\n\t\tif(len[i - 1] >= N - 7) break;\n\t}\n\tbase.num[0][0] = base.num[0][1] = base.num[1][0] = 1;\n//\tbase.print();\n} \n\ninline int get() {\n\tint ret = 0;\n\tfor(int i = 0, j = 0, le = tp.length(); i < le; i++) {\n\t\twhile(j >= 0 && ch[j + 1] != tp[i]) j = next[j];\n\t\tj ++ ;\n\t\tif(j == lens) ret ++ , j = next[j];\n\t}\n//\tprintf(\"num[%s] = %d\\n\", tp, ret);\n//\tcout << \"num[ \" << tp << \"] = \" << ret << endl; \n\treturn ret;\n}\n\ninline int solve() {\n\tnext[0] = -1;\n\tlens = strlen(ch + 1);\n\tfor(int i = 2, j = 0; i <= lens; i++) {\n\t\twhile(j >= 0 && ch[j + 1] != ch[i]) j = next[j];\n\t\tj ++ ;\n\t\tnext[i] = j;\n\t}\n\tint p = lower_bound(len + 1, len + cnt + 1, lens) - len;\n\t++ p;\n//\tputs(\"shhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh\");\n//\tfor(int i = 0; i <= len; i++) printf(\"%d \", nex[i]);\n\ta = f[p].substr(0, lens - 1);\n\tb = f[p].substr(len[p] - lens + 1, lens - 1);\n\tc = f[p + 1].substr(len[p + 1] - lens + 1, lens - 1);\n\t\n\t\n\tint n0, n1, n2, n3; ll pos = n - p, ret = 0;\n\ttp = c + a; n0 = get();\n\ttp = b + a; n1 = get();\n\ttp = f[p]; n2 = get();\n\ttp = f[p + 1]; n3 = get();\n//\tprintf(\"nb = %d nc = %d n0 = %d n1 = %d\", n1, n0, n2, n3);\n//cout << \"n0 = \" << n0 << \" n1 = \" << n1 << endl;\n\tret = (ret + 1ll * (fib(pos) - (pos & 1)) * n0 % mod) % mod;\n//\tcout << \"shit1 = \" << ret << endl;\n//\tprintf(\"fib[%d] = %d\\n\", pos, fib(pos)); \n\tret = (ret + 1ll * (fib(pos - 1) - 1 + (pos & 1)) * n1 % mod) % mod;\n//\tcout << \"shit2 = \" << ret << endl;\n//\tcout << \"n3 = \" << n3 << \" n1 = \" << n2 << endl;\n//\tcout << \"pos = \" << pos << endl;\n\tans.num[0][0] = n3; ans.num[0][1] = n2;\n//\tans.print();\n\tqpow(pos - 1);\n//\tans.print();\n//\tcout << ans.num[0][0] << endl;\n\tret = (ret + ans.num[0][0]) % mod;\n\treturn ret;\n}\n\nint main() {\n\tread(n); read(m);\n\tinit();\t\n\tfor(int i = 1; i <= m; i++) {\n\t\tscanf(\"%s\", ch + 1);\n\t\tprintf(\"%d\\n\", solve());\n\t}\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "700b0146a16f1c5f737c493ad367f702", "src_uid": "8983915e904ba763d893d56e94d9f7f0", "apr_id": "34bbbd2de754af481bf057c326eea224", "difficulty": 2600, "tags": ["matrices", "strings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9856338028169014, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "// Author :: Rubai Mandal\n// ------------ \n// Institution :: Jalpaiguri Government Engineerng College\n// ----------------------------------------\n\n \n#include\nusing namespace std;\n#define ll long long\n#define lli long long int\n#define dd double\n#define umap unordered_map\n#define smap map\n#define mod 1000000007\n#define vi std::vector\n#define vs std::vector\n#define vc std::vector\n#define pb push_back\n#define mp make_pair\n#define fi first\n#define se second\n#define lvp vector>\n#define dsort(a,n) sort(a,a+n,greater())\n#define srt(l) sort(l.begin(),l.end())\n#define dsrt(p) sort(p.begin(), p.end(), greater());\n#define cunt(v,i) count(v.begin(), v.end(), i)\n#define fr(i,a,n) for(ll i =a;i=a;i--)\n#define fio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);\n#define tc(t) long long t;cin>>t;while(t--)\n#define rr return(0);\n#define fill(x,y) memset(x,y,sizeof(x))\n#define pie 3.1415926535\n#define inf 99999999999999999\n#define rev(t) reverse(t.begin(),t.end())\nstring abc=\"abcdefghijklmnopqrstuvwxyz\";\n\nll gcd(ll a,ll b){if (a == 0) return b; return gcd(b%a, a);}\nll fact(ll n) {ll res = 1; for (ll z = 2; z <= n; z++) res = res * z; return res; }\nll Pow(ll a, ll b) {ll res = 1;while (b){if (b & 1)res = res * a % mod;a = a * a % mod; b >>= 1;}return res;}\nll amax(ll a[],ll n) { ll max=0;fr(i,0,n){if(a[i]>max)max=a[i];}return max;}\nll amin(ll a[],ll n) { ll min=inf;fr(i,0,n){if(a[i]>a[i];}\nvoid op(ll a[],ll n) {fr(i,0,n){if(i==n-1)cout< &a, \n const pair &b) \n{ \n return (a.first > b.first); \n} \n\nll divisor(ll x)\n{\n ll cnt=0;\n for(int i=1;i<=sqrt(x);i++)\n {\n if(x%i==0)\n {\n if(i!=x/i)cnt+=2;\n else cnt+=1;\n }\n }\n return cnt;\n}\nstring d2b(int n) \n{ \n string t=\"\";\n ll key=0;\n // Size of an integer is assumed to be 32 bits \n for (int i = 31; i >= 0; i--) { \n int k = n >> i; \n if (k & 1) \n {\n t+='1';\n key=1;\n }\n else\n {\n if(key)\n t+='0';\n }\n }\n return t;\n}\nll b2d(string n) \n{ \n string num = n; \n ll dec_value = 0; \n \n // Initializing base value to 1, i.e 2^0 \n ll base = 1; \n \n ll len = num.length(); \n for (ll i = len - 1; i >= 0; i--) { \n if (num[i] == '1') \n dec_value += base; \n base = base * 2; \n } \n \n return dec_value; \n}\n\nbool palindrome(ll le , ll ri , string s)\n{\n\tif(ri-le <= 0) return true; \n\tif(s[le] != s[ri])return false;\n\treturn palindrome(le+1 , ri - 1 , s);\n}\nll isprm(ll n) \n{\n if (n <= 1) return 0; \n if (n <= 3) return 1; \n if (n%2 == 0 || n%3 == 0) return 0; \n for (int i=5; i*i<=n; i=i+6) \n if (n%i == 0 || n%(i+2) == 0) \n return 0; \n return 1;\n \n}\nll lcm(ll a, ll b)\n{\n return a /gcd(a, b) * b;\n}\nbool psqr(long double x) \n{ \n long double sr = sqrt(x); \n return ((sr - floor(sr)) == 0); \n} \n \n\nint main()\n\n{\n fio\n tc(t)\n {\n ll n;\n cin>>n;\n \n ll k = pow(2,n-1);\n ll m = fact(n);\n ll ans =(m-k)%mod;\n cout<\n\nusing namespace std;\n\nint main()\n{\nint n;\ncin>>n;\nint arr[10000];\narr[0]=1;\nfor(int i=2;i=n)\n break;\n arr[i-1]=arr[i-2]+i;\n}\nfor(int i=0;in)\n break;\n if(arr[i]+arr[j]==n){\n cout<<\"YES\";\n return 0;\n }\n }\n}\ncout<<\"NO\";\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "2086c1a81f274fc1dfb3c3ddd9ff4ab8", "src_uid": "245ec0831cd817714a4e5c531bffd099", "apr_id": "90b55de9dafcea90e198c350422f71be", "difficulty": 1300, "tags": ["brute force", "implementation", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9829283489096573, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "#include \n#include \n#include \n#include \n//#pragma GCC optimize(\"O3\")\n//#pragma GCC target(\"sse4\")\n//#pragma GCC target(\"avx2\")\n\n#define deb(x) cout << #x << \" = \" << x << \"\\n\"\n#define aint(x) (x).begin(), (x).end()\n#define len(x) (int) x.size()\n#define lsb(x) (x) & -(x)\n#define l(x) (x << 1) + 1\n#define r(x) (x << 1) + 2\n\n#define xx first\n#define yy second\n#define mp make_pair\n#define pb push_back\n#define lb lower_bound\n#define ub upper_bound\n\nusing namespace std;\nusing namespace __gnu_pbds;\ntypedef long long ll;\ntypedef long double ld;\ntypedef pair pii;\ntypedef pair pld;\ntypedef pair pll;\n\ntemplate > using pb_heap = __gnu_pbds::priority_queue ;\ntemplate > using pb_map = tree ;\ntemplate > using pb_umap = gp_hash_table ;\ntemplate > using umap = unordered_map ;\ntemplate using uset = unordered_set ;\ntemplate using vec = vector ;\n\nconst ll intll = numeric_limits ::max() >> 1;\nconst int inf = numeric_limits ::max() >> 1;\nconst int N = 401;\nint n, m;\nint s, t;\n\npii adj[12] = {{-3, 0}, {-2, -1}, {-2, 1}, {-1, -2}, {-1, 2}, {0, -3}, {0, 3}, {1, -2}, {1, 2}, {2, -1}, {2, 1}, {3, 0}};\n\nstruct Edge {\n int ver;\n int cap;\n int flw;\n int rev;\n};\n\nstruct Graph {\n int lev[N];\n int ptr[N];\n\n vec adj[N];\n} graph;\n\nvoid input() {\n cin >> n >> m;\n}\n\nint id(int i, int j) {\n return i * m + j + 1;\n}\n\nvoid add_edge(int u, int v, int c) {\n graph.adj[u].pb({v, c, 0, len(graph.adj[v])});\n graph.adj[v].pb({u, c, c, len(graph.adj[u]) - 1});\n}\n\nbool bfs() {\n queue q; \n q.push(s);\n while(!q.empty()) {\n int u = q.front(); q.pop();\n for(Edge e: graph.adj[u]) {\n int v = e.ver;\n if(!graph.lev[v] && e.flw < e.cap) {\n graph.lev[v] = graph.lev[u] + 1;\n q.push(v);\n }\n }\n }\n return graph.lev[t];\n}\n\nint dfs(int u, int flow) {\n if(u == t) {\n return flow;\n }\n for(int &i = graph.ptr[u]; i < len(graph.adj[u]); ++i) {\n Edge &e = graph.adj[u][i];\n Edge &r = graph.adj[e.ver][e.rev];\n int v = e.ver;\n if(e.cap == e.flw || graph.lev[v] != graph.lev[u] + 1) {\n continue;\n }\n int f = dfs(v, min(flow, e.cap - e.flw));\n if(!f) {\n continue;\n }\n e.flw += f;\n r.flw -= f;\n return f;\n }\n return 0;\n}\n\nint dinic() {\n int res = 0;\n while(true) {\n fill(graph.lev, graph.lev + N, 0);\n fill(graph.ptr, graph.ptr + N, 0);\n graph.lev[s] = 1;\n if(!bfs()) {\n break;\n }\n while(int flow = dfs(s, 1)) {\n res += flow;\n }\n }\n return res;\n}\n\nvoid solve() {\n if(min(n, m) >= 20) {\n cout << 1ll * n * m / 2 * 2 << \"\\n\";\n return;\n }\n s = 0, t = N - 1;\n for(int i = 0; i < n; ++i) {\n for(int j = 0; j < m; ++j) {\n if(i + j & 1) {\n for(pii p: adj) {\n int I = i + p.xx;\n int J = j + p.yy;\n if(I < 0 || J < 0 || I >= n || J >= m) {\n continue;\n } else {\n add_edge(id(i, j), id(I, J), 1);\n }\n }\n add_edge(s, id(i, j), 1);\n } else {\n add_edge(id(i, j), t, 1);\n }\n }\n }\n cout << 2 * dinic() << \"\\n\";\n}\n\nint main() {\n ios_base::sync_with_stdio(false);\n cin.tie(0), cout.tie(0);\n input();\n solve();\n}\n", "lang": "GNU C++17", "bug_code_uid": "a3b892be9e6956c9e6065f5ebd58d07e", "src_uid": "02ce135a4b276d1e9ba6a4ce37f2fe70", "apr_id": "f82266eec8acaf9b6f69b1adcb1780e1", "difficulty": 2200, "tags": ["brute force", "flows", "constructive algorithms", "graph matchings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9455252918287937, "equal_cnt": 10, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 10, "bug_source_code": "#include \n#include\n\nusing namespace std;\nint ma(map f,int n,int m){\nint lo=0,h=m/n;\nint mid,k;\nmap::iterator it;\nwhile(lo<=h){\n mid=(lo+h)/2;\n k=0;\n for(it=f.begin();it!=f.end();it++){\n k+=it->second/mid;\n }\n if(k>=n)\n lo=mid+1;\n else\n h=mid-1;\n\n}\nreturn h;\n\n}\n\nint main()\n{\n int n,m;\n cin>>n>>m;\n int x;\n map f;\n for(int i=0;i>x;\n f[x]++;\n }\n cout<\nusing namespace std;\nconst int maxn=500;\ntypedef pairP;\n#define fi first\n#define se second\n\nbool c[maxn];\nint n,d;\n\nint minstep=-1;\n\nvoid BFS()\n{\n\tqueue

Q;\n\tQ.push(P(1,0));\n\twhile(!Q.empty())\n\t{\n\t\tint now=Q.front().fi;\n\t\tint step=Q.front().se;\n\t\tQ.pop();\n\t\tif(now==n)\n\t\t{\n\t\t\tminstep=step;\n\t\t\tbreak;\n\t\t}\n\t\tfor(int i=1;i<=d;i++)\n\t\t{\n\t\t\tif(c[now+i])\n\t\t\t{\n\t\t\t\tQ.push(P(now+i,step+1));\n\t\t\t}\n\t\t}\n\t}\n\treturn ;\n}\n\nint main()\n{\n\tscanf(\"%d%d\",&n,&d);\n\tstring s;\n\tcin>>s;\n\tfor(int i=0;i<(int)s.length();i++)\n\t{\n\t\tc[i+1]=s[i]-'0';\n\t}\n\tBFS();\n\tprintf(\"%d\\n\",minstep);\n\treturn 0;\n}", "lang": "GNU C++", "bug_code_uid": "8146070a387deafb4040e04e1a2f4f3e", "src_uid": "c08d2ecdfc66cd07fbbd461b1f069c9e", "apr_id": "601e608c269d4a8e9c95be16d306fcb8", "difficulty": 800, "tags": ["dp", "greedy", "dfs and similar", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8269230769230769, "equal_cnt": 11, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 10, "bug_source_code": "#include\n\nint main(){\n int n,m;\n char s1[110],s2[110];\n scanf(\"%c\", &s1[0]);\n for(n=0;s1[n]!='\\n';n++){\n scanf(\"%c\", &s1[n]);\n if(s1[n]-'A'>=0 && s1[n]-'A'<26){\n s1[n]=s1[n]-'A'+'a';\n }\n }\n scanf(\"%c\", &s2[0]);\n for(int i=0;s2[i]!='\\n';i++){\n scanf(\"%c\", &s2[i]);\n if(s2[i]-'A'>=0 && s2[i]-'A'<26){\n s2[i]=s2[i]-'A'+'a';\n }\n }\n for(m=0;ms2[m]-'a'){\n printf(\"-1\\n\");\n break;\n }\n else if(s1[m]-'a'\n#define int long long int\n\n#define f(i,n) for(int i=1;i<=n;i++)\n#define pb push_back\n#define mod 1000000009\nusing namespace std;\n\nint32_t main(){ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);\nint n;cin>>n;\nvectora(n);\nfor(int i=0;i,n;i++)cin>>a[i];\n sort(a.begin(),a.end());reverse(a.begin(),a.end());\n \n if(a[0]==a[n/2])cout<<\"Bob\";\n else cout<<\"Alice\"; \n\nreturn 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "4f2caf7b3fbc915ca4d6ac48a9c7ed64", "src_uid": "4b9cf82967aa8441e9af3db3101161e9", "apr_id": "e3e313d499ebf60b5871c5efbae74768", "difficulty": 2000, "tags": ["games"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.20804042179261864, "equal_cnt": 68, "replace_cnt": 57, "delete_cnt": 2, "insert_cnt": 8, "fix_ops_cnt": 67, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nint32_t answer = 0;\n\nint32_t get_root(int32_t vertex, int32_t* parents) {\n\tif(parents[vertex] == vertex)\n\t\treturn vertex;\n\treturn parents[vertex] = get_root(parents[vertex], parents);\n}\n\nbool join(int32_t v1, int32_t v2, int32_t* parents) {\n\tint32_t root1 = get_root(v1, parents);\n\tint32_t root2 = get_root(v2, parents);\n\tif(root1 == root2)\n\t\treturn false;\n\tparents[root1] = root2;\n\treturn true;\n}\n\nvoid check(int32_t num_steps, int32_t* choices, std::vector >& edges, int32_t leaf_target) {\n\tint32_t* deg = new int32_t[num_steps + 1];\n\tint32_t* parents = new int32_t[num_steps + 1];\n\tfor(int32_t i = 0 ; i <= num_steps; i++) {\n\t\tdeg[i] = 0;\n\t\tparents[i] = i;\n\t}\n\n\tfor(int32_t i = 0 ; i < num_steps; i++) {\n\t\tdeg[edges[choices[i]].first]++;\n\t\tdeg[edges[choices[i]].second]++;\n\t\tif(!join(edges[choices[i]].first, edges[choices[i]].second, parents))\n\t\t\treturn;\n\t}\n\n\tint32_t num_leaves = 0;\n\tfor(int32_t i = 0; i <= num_steps; i++)\n\t\tnum_leaves += (deg[i] == 1 ? 1 : 0);\n\n\tif(num_leaves == leaf_target)\n\t\tanswer++;\n\n\tdelete [] parents;\n\tdelete [] deg;\n}\n\nvoid enumerate(int32_t step, int32_t num_steps, int32_t* choices, std::vector >& edges, int32_t leaf_target) {\n\tif(step == num_steps) {\n\t\tcheck(num_steps, choices, edges, leaf_target);\n\t} else {\n\t\tfor(int32_t i = (step == 0 ? 0 : choices[step - 1] + 1); i < edges.size(); i++) {\n\t\t\tchoices[step] = i;\n\t\t\tenumerate(step + 1, num_steps, choices, edges, leaf_target);\n\t\t}\n\t}\n}\n\nint main() {\n\tint32_t n, m, num_ends;\n\tstd::cin >> n >> m >> num_ends;\n\n\tstd::vector > edges;\n\tfor(int32_t i = 0 ; i < m ; i++) {\n\t\tint32_t src, dst;\n\t\tstd::cin >> src >> dst;\n\t\tsrc--;\n\t\tdst--;\n\n\t\tedges.emplace_back(src, dst);\n\t}\n\t//for(itn32_t i = 0; i < n ; i++)\n\n\tint32_t* choices = new int32_t[n - 1];\n\tenumerate(0, n - 1, choices, edges, num_ends);\n\n\tstd::cout << answer;\n\treturn 0;\n}", "lang": "GNU C++17", "bug_code_uid": "0e9cd04718644feb5de444b8781f4281", "src_uid": "8087605a8f316150372cc4627f26231d", "apr_id": "116f3e444a39b8ee787bb22bff0263f7", "difficulty": 2500, "tags": ["dp", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.22918918918918918, "equal_cnt": 13, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 13, "bug_source_code": "#include \n#include \nconst int MX = 1e7 + 1e6/2 +1 ; \n\nusing namespace std;\n\nvector v;\nlong long n,k,x,a[MX];\nbool ok[MX];\nint main()\n{\n\tcin >> n >> k;\n\tfor (int i = 1; i <= n/2; ++i)\n\t{\n\t\tif (ok[i] == false)\n\t\t{\n\t\t\tif ( i * 1ll * i <= n)\n\t\t\t{\n\t\t\t\tfor (int j = i; j <= n/2; j+=i)\n\t\t\t\t{\n\t\t\t\t\tif ( ok[j] == false)\n\t\t\t\t\t{\n\t\t\t\t\t\tif ( n % j == 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t++x;\n\t\t\t\t\t\t\ta[x] = j;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\t\n\t\t\t\t\tok[j] = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif ( k > x)\n\t{\n\t\tcout << -1;\n\t}\n\telse\n\t{\n\t\tcout << a[k];\n\t}\n}", "lang": "GNU C++11", "bug_code_uid": "e29759ffeb78de999e2a88c60d0da7da", "src_uid": "6ba39b428a2d47b7d199879185797ffb", "apr_id": "47c5bcee872c0b705854566defa416e5", "difficulty": 1400, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8437343984023964, "equal_cnt": 17, "replace_cnt": 15, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 16, "bug_source_code": "// radhey krishna\n#include\nusing namespace std;\n#define ll long long \n#define ld long double\ntemplate T sqr(const T &x) {\n return x * x;\n} \n#define endl \"\\n\" \nconst ll N = 2000005; \nint a[N ], b[N ]; \nconst ll mod = 998244353; \nll n, arr[N];\nbool p[N]; \nvoid solve(){ \n \nint n , b ,c ,d;\ncin>>n>>b>>c>>d;\nll ans = 0; \nfor(int i = 0 ; i <=4001; i++){ \n for(int j = 0 ;j <= 4001; j++){\n ll need = i*b + j*c;\n if(need <= n){\n if((n - need)%d == 0){\n ans = max(ans , (i+j+(n - need)/d));\n }\n }\n }\n}\ncout<>t; \n while(t--){ \n solve(); \n } \n } ", "lang": "GNU C++17", "bug_code_uid": "e9ce7cc5c41142b6c5504aaf1aab809e", "src_uid": "42454dcf7d073bf12030367eb094eb8c", "apr_id": "054b518659997e46e461579bf249ad73", "difficulty": 1300, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.988527724665392, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \n\tusing namespace std;\n\n//template\ntypedef long long ll;\nint main() {\n\n#ifdef AVI\t\n\tfreopen(\"input.txt\" , \"r\" , stdin);\n#endif\n\tll r,g,b;\n\tcin >> r >> g >> b;\n\t\n\tll rm=r%3 , gm=g%3 , bm=b%3;\n\t\n\tll res1,res2,res3;\n\tres1 = r/3 + b/3 + g/3;\n\tres2 = (r-1)/3 + (b-1)/3 + (g-1)/3 + 1;\n\tres3 = (r-2)/3 + (b-2)/3 + (g-2)/3 + 2;\n\tif(r == 0 || g == 0 || b == 0) {\n\t\tcout << res1 << '\\n';\n\t}\n \tif(r<3 && g<3 && b<3){\n \t\tcout << min({r,g,b});\n \t}\n \telse cout << max( max(res1,res2) , res3);\n}", "lang": "GNU C++17", "bug_code_uid": "9811affc2b8a95e9d129d80fe5a94c33", "src_uid": "acddc9b0db312b363910a84bd4f14d8e", "apr_id": "153b9f60afd81f6ab5a098302ed84aaf", "difficulty": 1600, "tags": ["math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.5399239543726235, "equal_cnt": 11, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 11, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n int n;\n cin>>n;\n if(n%4==0)\n {\n cout<<\"YES\";\n }\n else if(n%2!=0)\n {\n cout<<\"YES\";\n\n } else{\n cout<<\"NO\";\n }\n\n}", "lang": "GNU C++17", "bug_code_uid": "6932724a3dfefda258317787cdad8a64", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "apr_id": "8caaf190d97006de9a3d57895d3d219c", "difficulty": 1000, "tags": ["brute force", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.3125, "equal_cnt": 10, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n\nusing namespace std;\n\nint main()\n{\n\tint n;\n\tcin >> n;\n\t\n\tstring str;\n\n\tcin >> str;\n\n\tstring result;\n\tfor (int i = 0; i < str.length(); i++) {\n\n\t\t//a, e, i, o, u\n\t\tif (str[i] == 'a' || str[i] == 'e' || str[i] == 'i' || str[i] == 'o' || str[i] == 'u') {\n\n\t\t\tint ggochu = 0;\n\t\t\tfor (int j = i+1; j < str.length(); j++) {\n\t\t\t\tif (str[j] == 'a' || str[j] == 'e' || str[j] == 'i' || str[j] == 'o' || str[j] == 'u') {\n\t\t\t\t\t//result += str[i];\n\t\t\t\t\tggochu = j;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tresult += str[i];\n\t\t\ti = ggochu;\n\t\t}\n\t\telse {\n\t\t\tchar word = str[i];\n\t\t\tresult += word;\n\t\t}\n\t}\n\n\tcout << result << endl;\n\treturn 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "70d91e6558e86ce3f00c7a73c8a5a788", "src_uid": "63a4a5795d94f698b0912bb8d4cdf690", "apr_id": "6abd65a3bcaeca9790c1b55deff8aeb8", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9986013986013986, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include\nusing namespace std;\n#define ll long long \nint main()\n{\n ios_base::sync_with_stdio(false);\n cin.tie(0);\n cout.tie(0);\n ll int n;\n cin>>n;\n l int a[n],max=-1;\n for(ll int i=0;i>a[i];\n if(max\nusing namespace std;\n\nint main(){\n\tios::sync_with_stdio(false);\n\tcin.tie(0);\n\tint t,r;\n\tcin>>t>>r;\n\tif(t % 10 == 0){\n\t\tcout<<1<\n#include\nusing namespace std;\nint main()\n{\n int num;\n int count=0;\n int result;\n cin>>num;\n if(num<1&&num>pow(10.0,9))\n {\n cout<<\"error\\n\";\n return-1;\n }\n else\n { int temp=num;\n while(temp!=0)\n {\n temp/=10;\n count++;\n }\n if(num==10||num==100||num==1000||num==10000||num==100000||num==1000000||num==10000000||num==100000000||num==1000000000)\n {\n count--;\n result=pow(2.0,count);\n }\n else if(num<110&&num>100)\n {\n count--;\n result=pow(2.0,count)+1;\n }\n else if(num==110)\n {\n count--;\n result=pow(2.0,count)+2;\n }\n else if(num==1010011)\n {\n cout<<\"83\"<\n#include\n#include\n\nusing namespace std;\nint pow(int m){\n int n=2;\n if(m==1||m==2)\n return n*m;\n else\n return n*pow(m-1);\n}\n\nint main()\n\n{\n long num;\n cin>>num;\n \n int count=0;\n \n if(num>1000000000||num==0)\n { return 0;}\n\n if(num==1)\n {cout<<\"1\" ;return 0;}\n else if (num>1&&num<10)\n { cout<<\"1\"<10&&num<100)\n { cout<<\"3\"<100&&num<1000)\n { if(num==101||num==102||num==103||num==104||num==105||num==106||num==107||num==108||num==109)\n\n \n { cout<<\"5\";return 0;}\n else if(num==110)\n \n \n {cout<<\"6\";return 0;}\n else\n { cout<<\"7\"<1000&&num<10000)\n {\n\n if(num==1001)\n { cout<<\"13\";return 0;}\n else if(num==1010)\n \n {cout<<\"14\";return 0;}\n \n else\n { cout<<\"15\"<10000&&num<100000)\n \n {\n if(num==10001)\n { cout<<\"29\";return 0;}\n else if(num==10010)\n \n {cout<<\"30\";return 0;}\n \n else\n \n {cout<<\"31\"<100000&&num<1000000)\n {\n \n if(num==100001)\n { cout<<\"61\";exit(1);}\n else if(num==100010)\n \n {cout<<\"62\";exit(1);}\n \n else\n \n { cout<<\"63\"<1000000&&num<10000000)\n {\n if(num==1010011)\n { cout<<\"83\";return 0;}\n if(num==1000001)\n { cout<<\"125\";return 0;}\n else if(num==1000010)\n \n {cout<<\"126\";return 0;}\n \n else\n \n {cout<<\"127\"<10000000&&num<100000000)\n {\n if(num==10000001)\n { cout<<\"253\";return 0;}\n else if(num==10000010)\n \n {cout<<\"254\";return 0;}\n \n else\n \n \n { cout <<\"255\"<100000000&&num<1000000000)\n { \n \n if(num==100000001)\n { cout<<\"509\";return 0;}\n else if(num==100000010)\n \n {cout<<\"510\";return 0;}\n \n else if(num==101010101)\n \n {cout<<\"341\";return 0;}\n\n\n else if(num==106341103)\n \n {cout<<\"383\";return 0;}\n\n else if(num==101020101)\n \n {cout<<\"351\";return 0;}\n else if(num==111100100)\n \n {cout<<\"484\";return 0;}\n else if(num==110110101)\n \n {cout<<\"437\";return 0;}\n else if(num==100111001)\n \n {cout<<\"313\";return 0;}\n\n else \n \n {cout<<\"511\"<0;i/=10)\n {\n if(i%10==0)\n count++;}\n cout<\n\n#define long long long\n\nusing namespace std;\n\nconst int MAXN = 1e5 + 10;\nconst int LIM = 2e9;\nconst int MAXX = 5e2 + 10;\nconst int MAXY = 1e5 + 10;\n\nint L, R, K, prSize;\nint cnt[MAXN], pr[MAXN];\n\nlong f[MAXX][MAXY];\n\nbool fre[MAXN];\n\nvoid Init() {\n\tfor (int i = 2; 1LL * i * i < MAXN; ++i) if (fre[i] == false)\n\t\tfor (int j = 2 * i; j < MAXN; j += i) fre[j] = true;\n\tfor (int i = 2; i < MAXN; ++i) {\n\t\tif (fre[i] == false) pr[prSize++] = i;\n\t\tcnt[i] = prSize;\n\t}\n\tfor (int i = 0; i < MAXX; ++i)\n\t\tfor (int j = 0; j < MAXY; ++j) {\n\t\t\tif (i == 0) f[i][j] = j;\n\t\t\telse f[i][j] = f[i - 1][j] - f[i - 1][j / pr[i - 1]];\n\t\t}\n}\n\nbool isPrime(int n) {\n\tfor (int i = 2; 1LL * i * i <= n; ++i) if (n % i == 0) return false;\n\treturn true;\n}\n\nlong Calc(int n, long m) {\n\tif (!n) return m;\n\tif (pr[n - 1] >= m) return 1;\n\tif (n < MAXX && m < MAXY) return f[n][m];\n\treturn Calc(n - 1, m) - Calc(n - 1, m / pr[n - 1]);\n}\n\nint main() {\n\tInit();\n\tcin >> L >> R >> K;\n\tif (isPrime(K) == false) {\n\t\tcout << 0 << '\\n';\n\t} else {\n\t\tif (1LL * K * K > LIM) cout << (L <= K && K <= R) << '\\n';\n\t\telse {\n\t\t\t--L;\n\t\t\t// cout << R / K << \" \" << L / K << ' ' << cnt[K] << '\\n';\n\t\t\t// cout << Calc(cnt[K] - 1, R / K) << ' ' << Calc(cnt[K] - 1, L / K) << '\\n';\n\t\t\tcout << Calc(cnt[K] - 1, R / K) - Calc(cnt[K] - 1, L / K) << '\\n';\n\t\t}\n\t}\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "951d2712072bb777ca68a379801b5eaa", "src_uid": "04a26f1d1013b6e6b4b0bdcf225475f2", "apr_id": "59b584e964dfcb263324b3bb2ccadb22", "difficulty": 2400, "tags": ["dp", "math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.6529430685107752, "equal_cnt": 14, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 13, "bug_source_code": "#include \n\nusing namespace std;\n\ntypedef long long ll;\ntypedef pair ii;\ntypedef pair iii;\ntypedef vector vi;\nconst ll MAXM = 103;\nconst ll INF = 2000000100;\nconst ll MOD = 1000000007;\n\nll N, M;\n\ninline ll mult(ll a, ll b){ return ((a%MOD)*(b%MOD))%MOD; }\ninline ll add(ll a, ll b){ return ((a%MOD)+(b%MOD))%MOD; }\n\nstruct matrix{\n\tint n;\n\tint m;\n\tll mat[MAXM][MAXM]; // y, x\n\tmatrix(int n, int m){\n\t\tthis->n = n, this->m = m;\n\t\tfor(int i = 0; i < n; i++) for(int j = 0; j < m; j++) mat[i][j] = 0;\n\t}\n\tmatrix operator*(matrix b){\n\t\tmatrix c = matrix(n, b.m);\n\t\tfor(int i = 0; i < n; i++) for(int j = 0; j < b.m; j++){\n\t\t\tll sum = 0;\n\t\t\tfor(int k = 0; k < m; k++) sum = add(sum, mult(mat[i][k], b.mat[k][j]));\n\t\t\tc.mat[i][j] = sum;\n\t\t}\n\t\treturn c;\n\t}\n\tvoid output(){\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tfor(int j = 0; j < m; j++){\n\t\t\t\tcerr< p;\n\tp.push_back(n);\n\tint i = 1;\n\twhile((1<>N>>M;\n\tmatrix p1 = matrix(M, M);\n\tp1.mat[0][0] = p1.mat[0][M-1] = 1;\n\tfor(int i = 1; i < M; i++){\n\t\tp1.mat[i][i-1] = 1;\n\t}\n//\tp1.output();\n//\t(p1*p1).output();\n\tmatrix p = ex(p1, N);\n//\tp.output();\n\tmatrix start = matrix(M, 1);\n\tstart.mat[0][0] = 1;\n//\tstart.output();\n//\t(p*start).output();\n\tcout<<(p*start).mat[0][0]<<\"\\n\";\n}\n", "lang": "GNU C++11", "bug_code_uid": "336c08c63f096af5d1e7fe7634fe66ac", "src_uid": "e7b9eec21d950f5d963ff50619c6f119", "apr_id": "3eeb2073624692c644964738fcc0a2e6", "difficulty": 2100, "tags": ["matrices", "dp", "math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7951582867783985, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \n#include \n#include \n#include \n#include \nusing namespace std;\nlong long mod = 1000000007;\nint main()\n{\n long long n,m,k;\n cin>>n>>m>>k;\n if(k > n - 1 + m - 1){\n cout<<-1< m) swap(n,m);\n long long x = sqrt(n) + 1;\n for(long long i = 0; i <= x; ++i)\n if(n % (i + 1) == 0 ){\n // if(k - i > m - 1) continue;\n if(k >= i &&(k - i) < m && n/(i+1)*(m/(k - i + 1) ) > maxn)maxn = n/(i+1)*(m/(k - i + 1) ) ;\n long long j = n/(i + 1);\n j--;\n if(k >=j && (k - j) < m && n/(j+1)*(m/(k - j + 1) ) > maxn)maxn = n/(j+1)*(m/(k - j + 1) ) ;\n }\n\n //if(k >= n - 1 && m/()\n cout<\n\nusing namespace std;\n\ntypedef long long int ll;\n\nint main()\n{\n ll n, x, y;\n cin >> n >> x >> y;\n// double d = double(n) * double(y) / double(100);\n \n// cout << d << \" \";\n ll req = ceil(n * y / 100.0);\n// cout << req << endl;\n if(req <= x)\n {\n cout << 0;\n }\n else\n {\n req = req - x;\n cout << req;\n }\n return 1;\n}\n", "lang": "GNU C++11", "bug_code_uid": "df046f2ba07d59269f2de5cda4bdd3d4", "src_uid": "7038d7b31e1900588da8b61b325e4299", "apr_id": "db635f25af09af31bb1b8efc538e23a0", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9333333333333333, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include\n#include\n#include\nusing namespace std;\n\nint Cost(int numofcity, int tank);\n\nint main()\n{\n\tint numOfCity, tankCap;\n\tcin >> numOfCity >> tankCap;\n\n\tcout << Cost(numOfCity, tankCap) << endl;\n\n\tsystem(\"pause\");\n}\n\nint Cost(int numofcity, int tank)\n{\n\tint cities = numofcity - 1;\n\tint fact = 1;\n\tint money = 0;\n\twhile (cities!=-1)\n\t{\n\t\tif (cities==tank-1)\n\t\t{\n\t\t\treturn money;\n\t\t}\n\t\tif (fact == 1)\n\t\t{\n\t\t\tmoney = tank;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tmoney = money + fact;\n\t\t}\n\t\tcities--;\n\t\tfact++;\n\t}\n}\n", "lang": "MS C++", "bug_code_uid": "dbfefb7ee7a8687dbaa0380795f9ee03", "src_uid": "f8eb96deeb82d9f011f13d7dac1e1ab7", "apr_id": "125b4c6f275c34b4833700530790fff4", "difficulty": 900, "tags": ["dp", "math", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9937791601866252, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include\n#define r_0 return 0;\n#define ll long long\n#define ld long double\n#define pb push_back\n#define fr first\n#define se second\n#define in freopen(\"input.txt\",\"r\",stdin);\n#define out freopen(\"output.txt\",\"w\" stdout);\n#define TIME ios_base::sync_with_stdio(NULL);\n#define tcn cin.tie(NULL);\n#define tct cout.tie(NULL);\nusing namespace std;\nll n,m,sum,mx,ans=1,cnt,x,a=1e9,b=1e9,c=1e9,d=1e9;\nll used[100007];\nvectorv;\nstring s,s1,s2,s3,s4,s5;\nint main()\n{\nTIME tcn tct\ncin >> n;\nfor( int i=1;i <=n;i ++ ){\n if( n%i==0 )\n v.pb(n/i+i);\n else\n v.pb(i+n/i+1);\n}\nsort(v.begin(),v.end());\ncout<\nusing namespace std;\n#define ll long long\nint main()\n{\n ll n,m,k;cin>>n>>m>>k;\n ll a=1;\n //ll mat[1234][1234];\n vectorv,v1;\n for(ll i=0;i\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nconst double eps = 0.000000001;\nlong long x1, x2, ansy1, ansy2;\ndouble t1, t2, t0, ans;\n\ndouble pr(long long y1, long y2) {\n\treturn (double) ((t1 * y1 + t2 * y2) / (y1 + y2));\n}\n\nint main() {\n\t//freopen(\"input.txt\", \"r\", stdin); //freopen(\"output.txt\", \"w\", stdout);\n\t\n\tlong long y1, y2;\n\t\n\tcin >> t1 >> t2 >> x1 >> x2 >> t0;\n\t\n\t\n\tif (t1 == t2) {\n\t\tcout << x1 << \" \" << x2 << endl;\n\t\treturn 42;\n\t}\n\tif (t1 == t0 || t2 == t0) {\n\t\tif (t1 == t2) cout << x1 << \" \" << x2 << endl;\n\t\telse if (t1 == t0) cout << x1 << \" 0\" << endl;\n\t\telse cout << \"0 \" << x2 << endl;\n\t\treturn 42;\n\t}\n\t\n\tansy1 = ansy2 = 0;\n\tans = 1000 * 1000 * 1000; ans *= ans;\n\tfor (y1 = 0; y1 <= x1; ++y1) {\n\t\ty2 = (t0 - t1) * y1 / (t2 - t0);\n\t\twhile(pr(y1, y2) < t0) ++y2;\n\t\tif (y2 <= x2 && (pr(y1, y2) < ans || ((abs(ans - pr(y1, y2)) < eps) && ansy1 + ansy2 < y1 + y2))) {\n\t\t\tans = pr(y1, y2);\n\t\t\tansy1 = y1;\n\t\t\tansy2 = y2;\n\t\t}\n\t}\n\t/*ansy1 = ansy2 = 0;\n\tans = 1000 * 1000 * 1000;\n\tfor (y1 = 0; y1 <= x1; ++y1) {\n\t\tl = 0;\n\t\tr = x2;\n\t\twhile (l < r) {\n\t\t\ty2 = (l + r) / 2;\n\t\t\tif (t0 < pr(y1, y2)) l = y2 + 1;\n\t\t\telse r = y2;\n\t\t}\n\t\ty2 = l;\n\t\tif (pr(y1, y2) < ans || ((abs(ans - pr(y1, y2)) < eps) && ansy1 + ansy2 < y1 + y2)) {\n\t\t\tans = pr(y1, y2);\n\t\t\tansy1 = y1;\n\t\t\tansy2 = y2;\n\t\t}\n\t}\n\tprintf(\"%.7lf\", pr(99, 33)); cout << endl; */\n\t\n\tcout << ansy1 << \" \" << ansy2 << endl;\n\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "5b8efe69117f14394f291b19497b37de", "src_uid": "87a500829c1935ded3ef6e4e47096b9f", "apr_id": "9c8c2ddaf19ee2b37938652586429357", "difficulty": 1900, "tags": ["math", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.10153358011634056, "equal_cnt": 24, "replace_cnt": 15, "delete_cnt": 1, "insert_cnt": 8, "fix_ops_cnt": 24, "bug_source_code": "#include\n#include \n#include\nusing namespace std;\ntypedef long long int ll;\nll mod=1000000007;\n\nll modInverse(ll a,ll m)\n{\n a = a%m;\n for (ll x=1; x>a>>b>>n>>x;\n ll sum1,sum2,sum3,sum4;\n if(a==1)\n sum4=(x+b*n)%mod;\n else\n {\n sum1=(power(a,n)*x);\n sum2=b*(power(a,n)-1);\n sum3=(a-1);\n sum4=sum1%mod+sum2*modInverse(sum3,mod);\n }\n sum4=sum4%mod;\n cout<\n\nusing namespace std;\nlong long n,kol=0,sum=1;\nint main()\n{\n\tcin >> n;\n\twhile (n > 0)\n\t{\n\t\tn -= sum;\n\t\tkol++;\n\t\tif (sum == 1)\n\t\t\tsum = 3;\n\t\telse\n\t\t\tsum += sum;\n\t}\n\tcout << kol;\n\treturn 0;\n\n}\n\n", "lang": "GNU C++17", "bug_code_uid": "af54178d929afa79c37df248e4239a8e", "src_uid": "95cb79597443461085e62d974d67a9a0", "apr_id": "de6558201010651ab8ae2ccfecc34d10", "difficulty": 1300, "tags": ["math", "constructive algorithms", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.3749055177626606, "equal_cnt": 12, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "#include \nusing namespace std;\n#define pb push_back\n#define mp make_pair\n#define all(a) (a).begin(),(a).end()\n#define fi first\n#define se second\n#define SZ(x) (int)(x).size()\n#define rep(i,a,b) for (int i=a;i=a;i--)\n#define DEBUG(x) cerr<<'<'<<#x<<\": \"< VI;\ntypedef vector VLL;\ntypedef pair PII;\ntypedef long long ll;\nconst ll MOD=1000000007;\nmt19937 mrand(random_device{}()); \nint rnd(int x) { return mrand() % x;}\nll powmod(ll a,ll b) {ll res=1;a%=MOD; assert(b>=0); 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;}\nvoid upgrade(){ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);}\n//head: credit MiFaFaOvO\n\ntemplate class Matrix{\nprivate:\n vector> a;\n ll n,m;\npublic:\n Matrix(){}\n Matrix(int _n){\n n=m=_n;\n a.assign(n,vector(m,0));\n }\n Matrix(int _n, int _m){ // down, across\n n=_n,m=_m;\n a.assign(n,vector(m,0));\n }\n Matrix(const vector> &_a){\n a=_a;\n n=SZ(a);\n m=SZ(a[0]);\n }\n Matrix(const Matrix &b){\n a=b.get_vector();\n //DEBUG(SZ(a));\n n=b.height();\n m=b.width();\n }\n int size() const{return n;}\n int height() const{return n;}\n int width() const{return m;}\n vector> get_vector() const{return a;}\n static Matrix I(int k){\n Matrix t(k);\n rep(i,0,k)t[i][i]=1;\n return t;\n }\n vector &operator[](int i){return a.at(i);}\n Matrix &operator+=(Matrix b){\n assert(n==b.height()&&m==b.width());\n rep(i,0,n)rep(j,0,m)a[i][j]=(a[i][j]+b[i][j])%MOD;\n return (*this);\n }\n Matrix &operator-=(Matrix b){\n assert(n==b.height()&&m==b.width());\n rep(i,0,n)rep(j,0,m)a[i][j]=(a[i][j]-b[i][j]+MOD)%MOD;\n return (*this);\n }\n Matrix &operator*=(Matrix b){\n assert(m==b.height());\n //DEBUG(n),DEBUG(b.width());\n Matrix c(n,b.width());\n //DEBUG('h');\n rep(i,0,n)\n rep(j,0,b.width())\n rep(k,0,m)\n c[i][j]=(c[i][j]+a[i][k]*b[k][j])%MOD;\n //DEBUG(\"h2\");\n *this=c;\n return (*this);\n }\n Matrix &operator^=(ll p){\n assert(n==m);\n Matrix t=I(n);\n Matrix pow(*this);\n while(p){\n if (p&1)t*=(*this);\n (*this)*=(*this);\n p>>=1;\n }\n a=t.get_vector();\n //rep(i,0,n)rep(j,0,n)DEBUG((*this)[i][j]);\n return *this;\n }\n Matrix &operator+(Matrix b){\n return Matrix(*this)+=b;\n }\n Matrix &operator-(Matrix b){\n return Matrix(*this)-=b;\n }\n Matrix &operator*(Matrix b){\n return Matrix(*this)*=b;\n }\n Matrix &operator^(ll k){\n return Matrix(*this)^=k;\n }\n};\n\nint main(){\n upgrade();\n ll n,m,l,r;cin>>n>>m>>l>>r;\n ll E,O;\n E=r-l+1-l%2-r%2;\n E=max(0ll,E);\n O=r-l+1-E;\n //DEBUG('h');\n Matrix base=Matrix::I(2);\n //DEBUG(base.width()),DEBUG(base.height());\n //base[0][0]=base[1][0]=1;\n Matrix mult(2);\n //mult*=Matrix::I(2);\n mult[0][0]=mult[1][1]=E;\n mult[1][0]=mult[0][1]=O;\n mult^=(n*m);\n //base=(mult*base);\n base=mult*base;\n //DEBUG('h');\n //DEBUG(mult.height()),DEBUG(base.width());\n cout<\nusing namespace std;\n#define N 100009\n#define M 255\n#define INF 1000000007\n#define MOD 1000000007\n#define MOD1 1000000009\n#define MOD2 1000000007\ntypedef long long int ll;\n#define sd(x) scanf(\"%d\",&x)\n#define sd2(x,y) scanf(\"%lld%lld\",&x,&y)\n#define sd3(x,y,z) scanf(\"%d%d%d\",&x,&y,&z)\n#define pf(x) printf(\"%lld\\n\",x);\n#define pf2(x,y) printf(\"%d %d\\n\",x,y);\n#define pf3(x,y,z) printf(\"%d %d %d\\n\",x,y,z);\n#define fi first\n#define se second\n#define pb(x) push_back(x)\n#define mp(x,y) make_pair(x,y)\n#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);\n#define tr(x) cout<, ll> a;\nll power(ll x, ll y){\n if(a.count(mp(x,y))){\n return a[mp(x,y)];\n }\n if(y==0){\n return 1;\n }\n ll z = power(x, y/2);\n z = z*z%MOD;\n if(y&1){\n z = (z*x)%MOD;\n }\n a[mp(x,y)] = z;\n return z;\n}\n\nll solve(ll r, ll c, ll k, ll n){\n if(dp[r][c]!=-1){\n return dp[r][c];\n }\n ll x, y = 0, z;\n // tr2(r,c);\n if (c==0){\n z = power((power(k,n) - power(k-1, n) + MOD)%MOD, r);\n dp[r][c] = z;\n return z;\n }\n if(r==1){\n z = power(k, n-c);\n dp[r][c] = z;\n return z;\n }\n \n x = (((power(k, n-c) - power(k-1, n-c) + MOD)%MOD)*solve(r-1, c, k, n)%MOD)*power(k-1, c)%MOD;\n for(int i = 1; i<=c; i++){\n y += ((com[c][i]*solve(r-1, c - i, k, n)%MOD)*power(k-1, c - i)%MOD)*power(k, n-c);\n y %= MOD;\n }\n z = (x+y)%MOD;\n dp[r][c] = z;\n // tr3(r, c, z);\n return z;\n}\nint main(){\n ll i,j,k,x,y,idx1, idx2,t,i1,m,z = 0,x1,x2, y1, y2,n;\n sd2(n,k);\n com[0][0] = 1;\n for(i = 1; i\n\n#define int long long\n\nint n;\n\nint us(int a){\n \n\tif(a == 1)\n\t\treturn 2;\n \n return a % 2 ? (2*us(a/2)*us(a/2))%1000000007 : (us(a/2)*us(a/2))%1000000007;\n}\n\n\nmain(){\n\n\tscanf(\"%lld\",&n);\n\tprintf(\"%lld\",(us(n)*(us(n)+1)/2)%1000000007);\n\n}\n", "lang": "GNU C++", "bug_code_uid": "a4b6c88ddc9463476623eb252714d654", "src_uid": "782b819eb0bfc86d6f96f15ac09d5085", "apr_id": "8f0a290bd23641f2c075b66ada001856", "difficulty": 1300, "tags": ["matrices", "dp", "math", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9306071871127634, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include \n#include \n\n#include \n\n#include \n\nusing namespace std;\n\nconst int MAXN = 110;\nconst int MAXV = 110;\nconst int RV = 10;\n\nint N, a[MAXN];\nint tot;\n\nint can[MAXN * MAXV][MAXN];\n\nvoid work(int sw, int am) {\n for(int i = tot;i >= 0;i--) {\n for(int j = N;j >= 0;j--) {\n for(int k = 1;k <= am and k*sw <= i and k <= j;k++) {\n can[i][j] += can[i-(k*sw)][j-k];\n if(can[i][j] > RV) can[i][j] = RV;\n }\n }\n }\n}\n\nint main() {\n scanf(\"%d\", &N);\n \n tot = 0;\n for(int i = 1;i <= N;i++) scanf(\"%d\", a + i), tot += a[i];\n \n sort(a + 1, a + N + 1);\n \n for(int i = 0;i <= tot;i++) for(int j = 0;j <= N;j++) can[i][j] = 0;\n can[0][0] = 1;\n \n for(int i = 1, j;i <= N;i=j) {\n for(j = i + 1;j <= N and a[i] == a[j];j++);\n work(a[i], j-i);\n }\n \n int ans = 0;\n for(int i = 1, j;i <= N;i=j) {\n for(j = i + 1;j <= N and a[i] == a[j];j++) {\n int tw = (j - i) * a[i];\n \n assert(can[tw][j - i] >= 1 and can[tot - tw][N - (j - i)] >= 1);\n if(can[tw][j - i] == 1 or can[tot - tw][N - (j - i)] == 1) if((j - i) > ans) ans = j - i;\n }\n int tw = (j - i) * a[i];\n \n assert(can[tw][j - i] >= 1 and can[tot - tw][N - (j - i)] >= 1);\n if(can[tw][j - i] == 1 or can[tot - tw][N - (j - i)] == 1) if((j - i) > ans) ans = j - i;\n }\n \n printf(\"%d\\n\", ans);\n \n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "c43cfdb1e992b3c39973bc7593c1b59a", "src_uid": "ccc4b27889598266e8efe73b8aa3666c", "apr_id": "038ea94a5664e2961bfa822ad80fd0c2", "difficulty": 2100, "tags": ["dp", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.3219390926041019, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 9, "bug_source_code": "#include \nusing namespace std;\n#define int long long\n#define mod 1000000007\n#define pb push_back\n#define in(a) int a;cin>>a;\n#define in2(a,b)in(a)in(b)\n#define out(x) cout<&v){\n\tfor(int i=0;i\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n#define debug(x) cout << '>' << #x << ':' << x << endl;\n#define loop(i,n) for(int i=0;i<(n);i++)\n#define fori(a,b,i) for(int i=(a);i<=(b);i++)\n#define ford(a,b,i) for(int i=(a);i>=(b);i--)\n#define fast_io ios_base::sync_with_stdio(false) , cin.tie(NULL);\n\n\n#define INF 0x3f3f3f3f\n#define PI 3.1415926535897932384626433832795\n#define MOD 1000000007\n\n#define fir first\n#define sec second\n#define pb push_back\n#define mp make_pair\n\ntypedef pair PII;\ntypedef vector VI;\ntypedef vector VS;\ntypedef vector VII;\ntypedef vector VVI;\ntypedef map MII;\ntypedef set SI;\ntypedef long long int llint;\n\n\nint main(){\n \tllint n;\n \tcin>>n;\n \tfor(int i = 1; ; i+= 2){\n\t\tif((i*(i + 1))/2 >= n){\n\t\t\treturn printf(\"%d\", i);\n\t\t}\n\t}\n\treturn 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "a7b62bb933ba37fd7fc358acad4447ae", "src_uid": "01eccb722b09a0474903b7e5abc4c47a", "apr_id": "7392084e9e4b557bf99f3a840bbc515c", "difficulty": 1700, "tags": ["math", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.8393589265747298, "equal_cnt": 26, "replace_cnt": 16, "delete_cnt": 6, "insert_cnt": 3, "fix_ops_cnt": 25, "bug_source_code": "#include \nusing namespace std;\ntypedef long long ll;\n#define DEBUG\n#ifdef DEBUG\n#define TRACE(x) cerr << #x << \" = \" << x << endl;\n#define _ << \" _ \" <<\n#else\n#define TRACE(x) ((void)0)\n#endif\n\nconst int INFCAP = 1000000005;\nconst int MAXN = 1000005;\ntypedef struct {\n int to;\n int cap;\n} edge;\n\nvector ai[MAXN];\nvector el;\nint lev[MAXN];\nint SRC;\nint DST;\nvector lai[MAXN];\nunsigned ng[MAXN];\nint path[MAXN];\nint pathsz;\n\nvoid addedge(int u, int v, int c) {\n const int idx = el.size();\n const edge e1 = {v, c}, e2 = {u, 0};\n ai[u].push_back(idx);\n el.push_back(e1);\n ai[v].push_back(idx + 1);\n el.push_back(e2);\n}\n\nbool buildlevel() {\n for (int i = 0; i < MAXN; i++)\n lai[i].clear();\n fill(lev, lev + MAXN, 0);\n queue q;\n q.push(SRC);\n lev[SRC] = 1;\n while (!q.empty()) {\n const int v = q.front();\n q.pop();\n if (v == DST)\n return true;\n for (auto idx : ai[v]) {\n const edge&e = el[idx];\n if (e.cap > 0) {\n if (lev[e.to] == 0) {\n lev[e.to] = lev[v] + 1;\n lai[v].push_back(idx);\n q.push(e.to);\n } else if (lev[e.to] == lev[v] + 1) {\n lai[v].push_back(idx);\n }\n }\n }\n }\n return false;\n}\n\nint dfs(int v) {\n if (v == DST)\n return INFCAP;\n for (; ng[v] < lai[v].size(); ng[v]++) {\n const edge& e = el[lai[v][ng[v]]];\n if (e.cap > 0) {\n int fl = dfs(e.to);\n if (fl > 0) {\n path[pathsz++] = lai[v][ng[v]];\n return min(fl, e.cap);\n }\n }\n }\n return 0;\n}\n\nll maxflow(int src, int dst) {\n SRC = src, DST = dst;\n ll ret = 0;\n while (buildlevel()) {\n fill(ng, ng + MAXN, 0);\n int fl;\n while ((fl = dfs(SRC)) > 0) {\n ret += fl;\n for (int i = 0; i < pathsz; i++) {\n el[path[i]].cap -= fl;\n el[path[i] ^ 1].cap += fl;\n }\n pathsz = 0;\n }\n }\n return ret;\n}\n\nint dxy[8][2] =\n{{-2, -1},\n {-2, 1},\n {-1, -2},\n {-1, 2},\n {1, -2},\n {1, 2},\n {2, -1},\n {2, 1}};\n\n#define CONV(i, j) ((i) * m + (j))\n\nint main() {\n ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);\n\n int n, m;\n cin >> n >> m;\n const int src = n * m;\n const int dst = n * m + 1;\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n if ((i + j) % 2 == 0) {\n addedge(src, CONV(i, j), 1);\n for (int k = 0; k < 8; k++) {\n const int ii = i + dxy[k][0];\n const int jj = j + dxy[k][1];\n if (0 <= ii && ii < n && 0 <= jj && jj < m)\n addedge(CONV(i, j), CONV(ii, jj), 1);\n }\n } else\n addedge(CONV(i, j), dst, 1);\n }\n }\n cout << n * m - maxflow(src, dst) << endl;\n\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "250d1a50589f10e6568122f06f5715dc", "src_uid": "e858e7f22d91aaadd7a48a174d7b2dc9", "apr_id": "e0f3f551a406adba400e81b72bbb704c", "difficulty": 1800, "tags": ["math", "greedy", "graph matchings"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8940891668347791, "equal_cnt": 13, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 10, "fix_ops_cnt": 12, "bug_source_code": "#include\n#define ll long long\n#define pb push_back\n#define mk make_pair\n#define rint register int\n#define pa pair\n#define debug(x) cerr<<#x<<\"=\"<>=1;} return res;}\ninline int pls(int a,int b){a+=b;return a>=mod?a-mod:a;}\ninline int mns(int a,int b){a-=b;return a<0?a+mod:a;}\nint n,k,m,Idx[15][222],cnt;\npa tmp[101000];\nstruct Ma{\n\tint a[417][417];\n\tinline void I(){memset(a,0,sizeof(a));for(rint i=1;i<=cnt;++i) a[i][i]=1;}\n}trs,Ans;\n\ninline Ma operator * (Ma p,Ma q){\n\tMa res;memset(res.a,0,sizeof(res.a));\n\tfor(rint i=1;i<=cnt;++i)\n\tfor(rint j=1;j<=cnt;++j)\n\t{\n\t\t__int128 w=0;\n\t\tfor(rint k=1;k<=cnt;++k)\n\t\tw+=(ll)p.a[i][k]*q.a[k][j];\n\t\tres.a[i][j]=w%mod;\n\t}\n\treturn res;\n}\ninline Ma ksm(Ma x,int y){\n\tMa res;res.I();\n\twhile(y){\n\t\tif(y&1) res=res*x;\n\t\tx=x*x;y>>=1;\n\t}return res;\n}\ninline void Solve(){\n\tmemset(trs.a,0,sizeof(trs.a));\n\tmemset(Ans.a,0,sizeof(Ans.a));\n\tdebug(cnt);\n\tfor(rint i=1;i<=cnt;++i){\n\t\tpa o=tmp[i];\n\t\tint fir=o.first,sec=o.second,bit=__builtin_popcount(sec);\n//\t\tdebug(fir);\n//\t\tdebug(sec);\n\t\tif(sec&1) {\n\t\t\tsec>>=1;\n\t\t\ttrs.a[i][Idx[fir][sec]]=bit;\n\t\t\tsec|=(1<>=1;\n\t\t\ttrs.a[i][Idx[fir][sec]]=1;\n\t\t\tsec|=(1<\n#define rep(XX,AA,BB) for(int XX=AA;XX<=BB;XX++)\n#define tep(XX,AA,BB) for(int XX=AA;XX>=BB;XX--)\n#define LL long long\nconst int K=14;\nconst int M=1<<4;\nconst int MX=310;\nconst LL MOD=1e9+7;\nusing namespace std;\n\nint n,m,k;\nint tot=0,maxn;\nint get[K][M];\n\nvoid read(int &x){\n\tchar c;\n\tfor(;c>'9'||c<'0';c=getchar());\n\tfor(;'0'<=c&&c<='9';c=getchar())x=(x<<3)+(x<<1)+(c^48);\n}\n\nstruct nn{\n\tLL a[MX][MX];\n\tvoid MEM(){rep(i,0,maxn)rep(j,0,maxn)a[i][j]=0;}\n}hlp;\n\nnn MUL(nn A,nn B){\n\tnn C;C.MEM();\n\trep(i,1,tot)rep(j,1,tot){\n\t\tC.a[i][j]=0;\n\t\trep(r,1,tot){\n\t\t\tC.a[i][j]+=A.a[i][r]*B.a[r][j]%MOD;\n\t\t\tC.a[i][j]%=MOD;\n\t\t}\n\t}\n\treturn C;\n}\n\nLL KSM(int y){\n\tnn res;res.MEM();\n\tLL ans;\n\tres.a[1][1]=1;\n\twhile(y){\n\t\tif(y%2==1)res=MUL(res,hlp);\n\t\thlp=MUL(hlp,hlp);\n\t\ty/=2;\n\t}\n\trep(num,0,maxn)ans=(ans+res.a[1][get[k][num]])%MOD;\n\treturn ans;\n}\n\nint main(){\n\tread(n);read(k);read(m);\n\tmaxn=(1<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n#define FOR(i, a, b) for(int i = a; i < b; i++) \n#define REP(i, n) FOR(i, 0, n)\n\ntypedef vector VI;\ntypedef vector VVI;\n\nint main() {\n\tfreopen(\"input.txt\", \"r\", stdin);\n\tfreopen(\"output.txt\", \"w\", stdout);\n\tstring s;\n\tgetline(cin, s);\n\tint n = s.length(), k, ans = 0;\n\tcin >> k;\n\ts.resize(n+k);\n\tFOR(i, n, n+k)\n\t\ts[i] = '}';\n\tREP(i, n+k)\n\t\tREP(j, i) \n\t\tif ((s[i] == s[j] || s[i] == '}')) {\n\t\t\t\tint a = j, b = i;\n\t\t\t\twhile(a != i && b < s.length() && (s[a] == s[b] || s[b] == '}')) {\n\t\t\t\t\ta++;\n\t\t\t\t\tb++;\n\t\t\t\t}\n\t\t\t\tif (a == i) \n\t\t\t\t\tans = max(ans, (i - j) * 2);\n\t\t\t}\n\tcout << ans;\n\treturn 0;\n}", "lang": "MS C++", "bug_code_uid": "bc6c456680508a30a2ce7f7fc001d802", "src_uid": "bb65667b65ff069a9c0c9e8fe31da8ab", "apr_id": "6b99066ebc18ba7483f5828861236b3f", "difficulty": 1500, "tags": ["strings", "brute force", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9974937343358395, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include\n#include\n#include\n#include\n#include \nusing namespace std;\nint main()\n{\n\tlong long s;\n\tlong long n,k;\n\tcin>>n>>k;\n\tif(n%1==0)\n\t{\n\t\tif(k<=n/2)\n\t\t{\n\t\t\ts=(k-1)*2+1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ts=(k-((n/2)))*2; \n\t\t}\n\t}\n\telse\n\t{\n\t\tif(k<=n/2+1)\n\t\t{\n\t\t\ts=(k-1)*2+1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ts=(k-((n/2)+1))*2; \n\t\t}\n\t}\n\tcout<\n\n\nusing namespace std;\n\n\n\nstruct Bigint {\n\n // representations and structures\n\n string a; // to store the digits\n\n int sign; // sign = -1 for negative numbers, sign = 1 otherwise\n\n\n\n // constructors\n\n Bigint() {} // default constructor\n\n Bigint( string b ) { (*this) = b; } // constructor for string\n\n\n\n // some helpful methods\n\n int size() { // returns number of digits\n\n return a.size();\n\n }\n\n Bigint inverseSign() { // changes the sign\n\n sign *= -1;\n\n return (*this);\n\n }\n\n Bigint normalize( int newSign ) { // removes leading 0, fixes sign\n\n for( int i = a.size() - 1; i > 0 && a[i] == '0'; i-- )\n\n a.erase(a.begin() + i);\n\n sign = ( a.size() == 1 && a[0] == '0' ) ? 1 : newSign;\n\n return (*this);\n\n }\n\n\n\n // assignment operator\n\n void operator = ( string b ) { // assigns a string to Bigint\n\n a = b[0] == '-' ? b.substr(1) : b;\n\n reverse( a.begin(), a.end() );\n\n this->normalize( b[0] == '-' ? -1 : 1 );\n\n }\n\n\n\n // conditional operators\n\n bool operator < ( const Bigint &b ) const { // less than operator\n\n if( sign != b.sign ) return sign < b.sign;\n\n if( a.size() != b.a.size() )\n\n return sign == 1 ? a.size() < b.a.size() : a.size() > b.a.size();\n\n for( int i = a.size() - 1; i >= 0; i-- ) if( a[i] != b.a[i] )\n\n return sign == 1 ? a[i] < b.a[i] : a[i] > b.a[i];\n\n return false;\n\n }\n\n bool operator == ( const Bigint &b ) const { // operator for equality\n\n return a == b.a && sign == b.sign;\n\n }\n\n\n\n\n // mathematical operators\n\n Bigint operator + ( Bigint b ) { // addition operator overloading\n\n if( sign != b.sign ) return (*this) - b.inverseSign();\n\n Bigint c;\n\n for(int i = 0, carry = 0; i= 0 ? borrow + 48 : borrow + 58;\n\n borrow = borrow >= 0 ? 0 : 1;\n\n }\n\n return c.normalize(s);\n\n }\n\n Bigint operator * ( Bigint b ) { // multiplication operator overloading\n\n Bigint c(\"0\");\n\n for( int i = 0, k = a[i] - 48; i < a.size(); i++, k = a[i] - 48 ) {\n\n while(k--) c = c + b; // ith digit is k, so, we add k times\n\n b.a.insert(b.a.begin(), '0'); // multiplied by 10\n\n }\n\n return c.normalize(sign * b.sign);\n\n }\n\n Bigint operator / ( Bigint b ) { // division operator overloading\n\n if( b.size() == 1 && b.a[0] == '0' ) b.a[0] /= ( b.a[0] - 48 );\n\n Bigint c(\"0\"), d;\n\n for( int j = 0; j < a.size(); j++ ) d.a += \"0\";\n\n int dSign = sign * b.sign; b.sign = 1;\n\n for( int i = a.size() - 1; i >= 0; i-- ) {\n\n c.a.insert( c.a.begin(), '0');\n\n c = c + a.substr( i, 1 );\n\n while( !( c < b ) ) c = c - b, d.a[i]++;\n\n }\n\n return d.normalize(dSign);\n\n }\n\n Bigint operator % ( Bigint b ) { // modulo operator overloading\n\n if( b.size() == 1 && b.a[0] == '0' ) b.a[0] /= ( b.a[0] - 48 );\n\n Bigint c(\"0\");\n\n b.sign = 1;\n\n for( int i = a.size() - 1; i >= 0; i-- ) {\n\n c.a.insert( c.a.begin(), '0');\n\n c = c + a.substr( i, 1 );\n\n while( !( c < b ) ) c = c - b;\n\n }\n\n return c.normalize(sign);\n\n }\n\n\n\n\n // output method\n\n void print() {\n\n if( sign == -1 ) putchar('-');\n\n for( int i = a.size() - 1; i >= 0; i-- ) putchar(a[i]);\n\n }\n\n};\n\n\nstring numtostr(long long n) {\n ostringstream str1 ;\n str1 << n ;\n return str1.str();\n}\nlong long strtonum(string s) {\n long long x ;\n stringstream str1(s);\n str1 >> x ;\n return x ;\n}\n\nint main() {\n long long n,k ;\n\n cin >> n >> k ;\n\n string one = \"1\" ;\n Bigint factn = one ;\n Bigint arr[1000];\n arr[0] = one ;\n for ( long long i = 1 ; i <= n ; i++) {\n string s = numtostr(i);\n Bigint bal = s ;\n factn = factn*bal ;\n arr[i] = factn ;\n }\n Bigint sum = one ;\n while(k > 1) {\n Bigint factk = arr[k] ;\n long long r = n-k ;\n Bigint factr = arr[r] ;\n Bigint Product = factr*factk ;\n Product = factn / Product ;\n long long z = pow(k-1,k-2);\n string zs = numtostr(z);\n Bigint power = zs ;\n Bigint result = Product * power ;\n sum = sum + result ;\n k-- ;\n }\n sum.print();\n puts(\" \");\n return 0;\n\n}\n", "lang": "GNU C++17", "bug_code_uid": "d4518ec648ddb9670cbf9a8f3058a0fc", "src_uid": "96d839dc2d038f8ae95fc47c217b2e2f", "apr_id": "2f80d71ec3b4c469e28ae009239e3fce", "difficulty": 1600, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7140255009107468, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 5, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\nint main()\n{\n freopen(\"input.txt\", \"r\", stdin);\n freopen(\"output.txt\", \"w\", stdout);\n int n, m, ost, del;\n cin >> n >> m;\n del = n / 2;\n ost = n % 2;\n while (del != 0)\n {\n if ((ost + del) % m == 0)\n {\n cout << del + ost;\n return 0;\n }\n del--;\n ost += 2;\n }\n cout << -1;\n return 0;\n}", "lang": "MS C++", "bug_code_uid": "eda89bfa7b7a9c486e28a7ae85935241", "src_uid": "0fa526ebc0b4fa3a5866c7c5b3a4656f", "apr_id": "eae920af214187daf7846adc75c6dc5a", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.15275504637206766, "equal_cnt": 11, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 11, "bug_source_code": "#include \nusing namespace std;\n\n#define ull unsigned long long\n\n#define range 100\n\nint multiply(int x, vector &result, int res_size) {\n\tint carry = 0;\n\n\tfor (int i = 0; i < res_size; i++) {\n\t\tint prod = result[i] * x + carry;\n\n\t\tresult[i] = prod % 10;\n\n\t\tcarry = prod / 10;\n\t}\n\n\t\twhile (carry) {\n\t\t\tresult[res_size] = carry % 10;\n\t\t\tcarry = carry / 10;\n\t\t\tres_size++;\n\t\t\t}\n\treturn res_size;\n}\n\nvector power(int x, int n) {\n\tint temp = x;\n\tvector result(range);\n\tint res_size = 0;\n\t\n\n\twhile (temp != 0) {\n\t\tresult[res_size] = temp % 10;\n\t\tres_size++;\n\t\ttemp = temp / 10;\n\t}\n\n\tfor (int i = 2; i <= n; i++)\n\t\tres_size = multiply(x, result, res_size);\n\n\t// cout << x << \"^\" << n << \" = \";\n\t// for (int i = res_size - 1; i >= 0; i--)\n\t// \tcout << result[i];\n\treturn result;\n}\n\n\nint main(){\n\tint x,y;\n\tcin >> x >> y;\n\tif(x == y){\n\t\tcout<<\"=\"< left;\n\tvector right;\n\n\tleft = power(x,y);\n\tright = power(y,x);\n\tint n = left.size()-1;\n\n\tfor(int i = n-1 ; i>=0 ; i--){\n\t\tif(left[i] > right[i]){\n\t\t\tcout<<\">\"<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n \nusing namespace std;\ntemplateinline void chkmin(T1 &x, T2 y) { if (x > y) x = y; }\ntemplateinline void chkmax(T1 &x, T2 y) { if (x < y) x = y; }\n#define sz(c) (int)(c).size()\n#define all(c) (c).begin(), (c).end()\n#define rall(c) (c).rbegin(), (c).rend()\n#define left left228\n#define right right228\n#define rank rank228\n#define y1 y1228\n#define read(FILENAME) freopen((FILENAME + \".in\").c_str(), \"r\", stdin)\n#define write(FILENAME) freopen((FILENAME + \".out\").c_str(), \"w\", stdout)\n#define files(FILENAME) read(FILENAME), write(FILENAME)\n#define pb push_back\n#define mp make_pair\nusing ll = long long;\nusing ld = long double;\n// const int MAXMEM = 200 * 1000 * 1024;\n// char _memory[MAXMEM];\n// size_t _ptr = 0;\n// void* operator new(size_t _x) { _ptr += _x; return _memory + _ptr - _x; }\n// void operator delete (void*) noexcept {}\nconst string FILENAME = \"input\";\nconst int Mod = 998244353;\n\n\n\nint sum(int a, int b) {\n return (a + b >= Mod ? a + b - Mod: a + b);\n}\n\nint mul(int a, int b) {\n return (ll)a * b % Mod;\n}\n\n\nll powm(ll a, ll b) {\n ll res = 1;\n while (b) {\n if (b & 1) {\n res = mul(res, a);\n }\n a = mul(a, a);\n b >>= 1;\n }\n return res;\n}\n\nint main() {\n ios_base::sync_with_stdio(false);\n cin.tie(0);\n cout.tie(0);\n //read(FILENAME);\n ll n, m, l, r;\n cin >> n >> m >> l >> r;\n if (l == r) {\n cout << 1 << '\\n';\n return 0;\n }\n if (n > m) {\n swap(n, m);\n }\n r -= l;\n r++;\n if (min(n, m) == 1) {\n ll cnt = (ll)n * m;\n ll cntodd = r - r / 2;\n ll cnteven = r / 2;\n ll ans = 0;\n if (cntodd) {\n ans = sum(ans, powm(cntodd, cnt));\n }\n if (cnteven) {\n ans = sum(ans, powm(cnteven, cnt));\n }\n cout << ans << '\\n';\n return 0;\n }\n if (n % 2 == 0 && m % 2 == 0) {\n exit(1);\n }\n cout << powm(r, (ll)n * m) << '\\n';\n return 0;\n} \n", "lang": "GNU C++17", "bug_code_uid": "37f75f6a1ebfde23946e401c708ffd51", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "apr_id": "0a4c022139fd3137a72ff300b53f1335", "difficulty": 2100, "tags": ["matrices", "math", "combinatorics", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.424090338770389, "equal_cnt": 18, "replace_cnt": 12, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 17, "bug_source_code": "#include \n\nusing namespace std;\n\n\nint main() {\n\tint n = 0;\n\tint f[n];\n\tcin >> n;\n\tint s;\n\tfor(int i=0;i < n;i++){\n\t\tcin >> f[i];\n\t\ts += f[i];\t\n\t\tif(s % n == 1){\n\t\t\tcout << \"YES\";\n\t\t}else{\n\t\t\tcout << \"NO\";\t\n\t\t}\n\t}\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "8d8ccb75f7f2d5d354165fe4f2bcd1e4", "src_uid": "9679acef82356004e47b1118f8fc836a", "apr_id": "7fb801108b07b04993529bcf2b893b63", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.6567164179104478, "equal_cnt": 26, "replace_cnt": 23, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 25, "bug_source_code": "#include\nusing namespace std;\nint main(){\n\tint m,n,ans=0,r=0,k=0;\n\tscanf(\"%d%d\",&m,&n);\n\tif(n==1)printf(\"-1\\n\");\n\telse if(n>m&&n<2*m)printf(\"3\\n\");\n\telse if(n>=2*m)printf(\"1\\n\");\n\telse if(n==m)printf(\"5\\n\");\n\telse if(n==2){\n\t\tif(m==3)printf(\"11\\n\");else printf(\"-1\\n\");\n\t}else if(n==3){\n\t\tif(m==4)printf(\"9\\n\");else if (m==5)printf(\"11\\n\";)else printf(\"-1\\n\");\n\t}else if(n>=4){\n\t\tans=4;m=m-n+2;\n\t\tif(n>=2*m)ans++;\n\t\telse {\n\t\t\tk=(m-n)/(n/2-1);ans+=2*k;\n\t\t\tm=m-(n/2-1)*k;ans++;\n\t\t\tif(n<2*m){\n\t\t\t\tm=2*m-n;\n\t\t\t\tif(m%(n-1)==0)k=m/(n-1);else k=m/(n-1)+1;\n\t\t\t\tans+=2*k;\n\t\t\t}}\n\t\tprintf(\"%d\\n\",ans);\n\t}\n\treturn 0;\n}", "lang": "GNU C++", "bug_code_uid": "ca138dba72cd3dcf59a8b9ab7d60df01", "src_uid": "83f1d50a1802e08dd154d4c9778e3d80", "apr_id": "03e220eb50d94840174ede0a303540ac", "difficulty": 2500, "tags": ["greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.312063344201211, "equal_cnt": 28, "replace_cnt": 18, "delete_cnt": 5, "insert_cnt": 4, "fix_ops_cnt": 27, "bug_source_code": "#include\n#include\n\nint main()\n{\n int x, y = 0, x1 = 0, y1, n, k=0;\n do\n {\n scanf(\"%d%d\", &x, &n);\n }\n while (x < 1 || n < 1 || n>100000 || x>100000);\n y1 = x;\n if ((x == 2 && n == 1) || (x >=4 && n< 4) || x <= n || (x=3 && n=2)\n )\n {\n printf(\"%d\\n\", x <= n ? k = 2 : x=3? k=11 : k = -1);\n exit(1);\n }\n k = 1;\n if (x - n > n)\n {\n x -= n;\n x1 += n;\n }\n else\n {\n x1 += x - n;\n x -= x - n;\n }\n while (y1 - x1 > n)\n {\n x++;\n x1--;\n if (x - n >= n)\n {\n x -= n;\n x1 += n;\n }\n else\n {\n x1 += x - n;\n x -= x - n;\n }\n k += 2;\n }\n x = y += n - 1;\n x1 = y1 -= n - 1;\n k += 2;\n if(x>n || x1>n)\n {\n while (x1>n)\n {\n y=x += n / 2 - 1;\n y1=x1 -= n / 2 - 1;\n k += 2;\n }\n y+=y1;\n y1-=y1;\n x -= n;\n x1 += n;\n k += 2;\n while (y >x1)\n {\n x++;\n x1--;\n if (x - n >n)\n {\n x -= n;\n x1 += n;\n }\n else\n {\n x1 += x ;\n x -= x;\n }\n k += 2;\n }\n }else{\n x1=y+=y1;\n x=y1=0;\n k+=2;\n }\n printf(\"%d\",k);\n return 0;\n}", "lang": "GNU C++", "bug_code_uid": "cbc6950de4e4639768027df91b6741d3", "src_uid": "83f1d50a1802e08dd154d4c9778e3d80", "apr_id": "d4ae502ea0938d0a13235af26d95dc96", "difficulty": 2500, "tags": ["greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.07285756942370857, "equal_cnt": 21, "replace_cnt": 15, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 20, "bug_source_code": "#include \nusing namespace std;\n\nint dp[55][55][55][55][2][2][2][2];\nbool solve(int left,int right,int up,int down,bool upleft,bool upright,bool downleft,bool downright){\n\n\n\n if(left<0 || right<0 || up <0 || down <0 || upleft <0 || upright<0 ||downleft<0 ||downright<0 ) return true;\n\n if(! (left+right+up+down+upleft+upright+downleft+downright))return false;\n\n\n if(dp[left][right][up][down][upleft][upright][downleft][downright]!=-1)return dp[left][right][up][down][upleft][upright][downleft][downright];\n bool ret=0;\n\n ret|=!solve(left,right,up,down,upleft-1,upright,downleft,downright);\n ret|=!solve(left,right,up-1,down,upleft-1,upright,downleft,downright);\n ret|=!solve(left-1,right,up,down,upleft-1,upright,downleft,downright);\n\n ret|=!solve(left,right,up,down,upleft,upright-1,downleft,downright);\n ret|=!solve(left,right,up-1,down,upleft,upright-1,downleft,downright);\n ret|=!solve(left,right-1,up,down,upleft,upright-1,downleft,downright);\n\n\n ret|=!solve(left,right,up,down,upleft,upright,downleft-1,downright);\n ret|=!solve(left,right,up,down-1,upleft,upright,downleft-1,downright);\n ret|=!solve(left-1,right,up,down,upleft,upright,downleft-1,downright);\n\n\n ret|=!solve(left,right,up,down,upleft,upright,downleft,downright-1);\n ret|=!solve(left,right,up,down-1,upleft,upright,downleft,downright-1);\n ret|=!solve(left,right-1,up,down,upleft,upright,downleft,downright-1);\n\n\n\n ret|=!solve(left-1,right,up,down,upleft,upright,downleft,downright);\n ret|=!solve(left-2,right,up,down,upleft,upright,downleft,downright);\n\n\n ret|=!solve(left,right-1,up,down,upleft,upright,downleft,downright);\n ret|=!solve(left,right-2,up,down,upleft,upright,downleft,downright);\n\n ret|=!solve(left,right,up-1,down,upleft,upright,downleft,downright);\n ret|=!solve(left,right,up-2,down,upleft,upright,downleft,downright);\n\n\n ret|=!solve(left,right,up,down-1,upleft,upright,downleft,downright);\n ret|=!solve(left,right,up,down-2,upleft,upright,downleft,downright);\n\n\n return dp[left][right][up][down][upleft][upright][downleft][downright]=ret;\n}\nint main(){\n int a,b,r;\n cin>>a>>b>>r;\n memset(dp,-1,sizeof dp);\n int left,right,up,down,upleft=0,upright=0,downleft=0,downright=0;\n\n left=a/(2*r);right=0;\n if(b/2>=2*r)right=left;\n\n up=b/(2*r); down=0;\n if(a/2>=2*r)down=up;\n\n if(up && left)upleft++,up--,left--;\n if(up && right)upright++,up--,right--;\n if(down && left)downleft++,down--,left--;\n if(down && right)downright++,down--,right--;\n\n //cout<\n#define lim 101\nusing namespace std;\nint main() {\n ios_base::sync_with_stdio(false);\n cin.tie(0);\n cout.tie(0);\n\n int n,k,b[lim],a[lim],i,r,j,ct=100000,two,four,single=0,x;\n bool ans=true;\n cin>>n>>k;\n two=2*n;\n four=n;\n for (i=0;i>b[i];\n }\n sort(b,b+k);\n for (i=0,j=0;(i0)\n {\n a[i]=min(8,b[i]);\n if (a[i]&1) a[i]++;\n if (a[i]==2) {\n if (two>0) two--;\n else if (four>0) {\n four--;\n single++;\n }\n else ans=false;\n }\n else if (a[i]==4) {\n if (four>0) four--;\n else if (two>1) two-=2;\n else ans=false;\n }\n else if (a[i]==6) {\n if ((two>1)&&(four>0)) {\n two--,four--;\n }\n else if (two>2) two-=3;\n else if (four>1) {\n \tfour-=2; single++;\n }\n else ans=false;\n }\n else if (a[i]==8) {\n if (four>1) four-=2;\n else if ((four>0)&&(two>1)) {four--;two-=2;}\n else if (two>3) two-=4;\n else ans=false;\n }\n if (!ans) {\n // system(\"pause\");\n if (b[i]&1) a[i]--;\n a[i]-=(min(four,a[i]/4))*4;\n a[i]-=(min(two,a[i]/2))*2;\n four-=min(four,a[i]/4);\n two-=min(two,a[i]/2);\n // cout<=a[i]) {\n ans=true;\n single-=a[i];\n }\n }\n b[i]-=a[i];\n }\n }\n if (ans) cout<<\"YES\";\n else cout<<\"NO\";\n}\n", "lang": "GNU C++14", "bug_code_uid": "51a03fa0987449ce676dedeb56933a3f", "src_uid": "d1f88a97714d6c13309c88fcf7d86821", "apr_id": "2b9d62a1fd6a6ef1b7bc41b84ab2f220", "difficulty": 1900, "tags": ["greedy", "brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9868837630031659, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \n#include \n#include \n#include \nusing namespace std;\n\n#define r(n) scanf(\"%d\", &n)\n#define w(n) printf(\"%d\\n\", n)\n#define FOR(i, n) for(int i=0; i<(n); ++i)\n#define REP(i, a, b) for(int i=(a); i<(b); ++i)\n#define ll long long\n\nstruct rect\n{\n\tint x1, y1, x2, y2;\n};\n\nint n;\nrect R[6];\nint S[6];\n\nbool in(int a, int b, int c, int d, int x, int y)\n{\n\treturn (a<=x && x<=c && b<=y && y<=d);\n}\n\nint main()\n{\n\tcin>>n;\n\tFOR(i, n) {\n\t\tcin>>R[i].x1>>R[i].y1>>R[i].x2>>R[i].y2;\n\t\tint a = R[i].x2-R[i].x1, b = R[i].y2-R[i].y1;\n\t\tS[i] = a*b;\n\n\t\tif (n == 1) {\n\t\t\tif (a==b) cout<<\"YES\"< 0 && s == (c-a)*(d-b)) {\n\t\t\t\tcout<<\"YES\"<\n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nchar downCase (char & x) {\n if (x - 'A' > 0) x = x - 'A' + 'a';\n return x;\n}\n\nint main () {\n char * s;\n gets (s);\n char last;\n for (int i = 0, len = strlen (s); i < len; ++i) if ((s[i] - 'a' < 26 && s[i] - 'a' >= 0) || (s[i] - 'A' >=0 && s[i] - 'A' < 26)) last = s[i];\n downCase (last);\n if (last == 'a') cout << \"YES\";\n else if (last == 'e') cout << \"YES\";\n else if (last == 'i') cout << \"YES\";\n else if (last == 'o') cout << \"YES\";\n else if (last == 'u') cout << \"YES\";\n else cout << \"NO\";\n}\n", "lang": "GNU C++0x", "bug_code_uid": "77a40e76882e4a2f3f2473a2211e7a63", "src_uid": "dea7eb04e086a4c1b3924eff255b9648", "apr_id": "7643a5ec31fa110a3b143a89cdf68d8c", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.2815884476534296, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "#include\nusing namespace std;\nstring a;\nint main()\n{\n int i=0;\n cin>>a;\n while(1)\n {\n if(a[i]=='H'||a[i]=='Q'||a[i]=='9')\n {\n cout<<\"YES\";\n return 0;\n }\n if(a[i]=='\\0')\n {\n break;\n }\n }\n cout<<\"NO\";\n return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "54a46f1a37a023b99adb54716c5279c4", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "apr_id": "c778d75b304f51b8b02266b977674150", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.563265306122449, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "#include \nusing namespace std;\nint main()\n{\n int n;\n cin>>n;\n if (n>0)\n cout<>n1;\n \n int a=n/10;\n int b=(n1%10)*n+(n/10);\n \n if (a=b)\n cout<\n#define int long long\nusing namespace std;\n\n\nint getLeastPrimeFactor(int n){\n \n if(n%2==0) return 2;\n\n for(int i=3;i<=sqrt(n);i++){\n \tif(n%i==0) return i;\n }\n \n return 1;\n\n}\n\nsigned main()\n{\n int t;\n cin>>t;\n while(t--)\n {\n \tint n ; cin>>n;\n \n \tint a=getLeastPrimeFactor(n);\n \tcout<\n#include \n\nusing namespace std;\nlong long pot(int xx,int yy)\n{\n long long aa=1;\n for(int ii=0;ii myv;\nlong long a,b,c,suma;\n long long x;\n cin>>a>>b>>c;\n if(b==0){\n cout<<1<999999999) continue;\n suma=sumter(x);\n if(suma==i){\n myv.push_back(x);\n }\n \n }\n int sizev=myv.size();\n cout<\n#include \n#include \nusing namespace std;\n\n#define LL __int64\n\nconst int MOD = 1000000007;\n\nLL T[55],B[55];\nvoid get_bell(int n,int mod){\n B[0]=1;\n B[1]=1;\n T[0]=1;\n for(int i=2;i<=n;++i){\n T[i-1]=B[i-1];\n for(int j=i-2;j>=0;--j)\n T[j]=(T[j]+T[j+1])%mod;\n B[i]=T[0];\n }\n}\n//\u6c42B[n]%mod\n//\u8981\u5148\u9884\u5904\u7406\u524d50\u9879Bell\u6570\uff0c\u5f53\u7136\u53ef\u4ee5\u66f4\u591a\n//vis\u6bcf\u6b21\u8c03\u7528\u524d\u90fd\u8981\u6e05\u7a7a\nmap vis;\nLL bell_mod(int n,int mod){\n vis.clear();\n LL ret=vis[n];\n if(ret) return ret;\n if(n<=50) return B[n]; //\u6539\n LL k=0;\n LL P=1;\n while(P>n;\n LL a = bell_mod(n + 1, MOD);\n LL b = bell_mod(n, MOD);\n cout<<(a - b + MOD) % MOD<\nusing namespace std;\nint count(string s,int start){\n\tint ans=0;\n\tfor(int i=start;i>s;\n\tfor(int i=0;i\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nint main()\n{\n int a,b,c;\n cin>>a>>b>>c;\n cout<\n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nconst int MAXN = 2e5+1;\nconst int MOD = 1e9+7;\n\nint N, K, x, last, cnt, ans;\n\nint a[100001];\n\nset st;\nset ::iterator it;\n\nint main (){\n\t\n\tcin >> N >> K;\n\t\n\tfor(int i = 1; i <= N; i++){\n\t\tcin >> a[i];\n\t}\n\t\n\tfor(int i = 1; i <= N; i++){\n\t\tif(st.find(a[i]) != st.end())\n\t\t\tcontinue;\n\t\t\t \n\t\tif(st.find(a[i]) == st.end() && (int)st.size() < K){\n\t\t\tans ++;\n\t\t\tst.insert(a[i]);\n\t\t}else{\n\t\t\tint max_i, number;\n\t\t\tfor(it = st.begin(); it != st.end(); it ++){\n\t\t\t\tint indx;\n\t\t\t\tfor(indx = i+1; indx <= N; i++){\n\t\t\t\t\tif(a[indx] == *it){\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(max_i < indx){\n\t\t\t\t\tmax_i = indx;\n\t\t\t\t\tnumber = *it;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tans++;\n\t\t\tst.insert(a[i]);\n\t\t\tst.erase(number);\n\t\t}\n\t}\n\t\n\tcout << ans;\n\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "589a2a6bc1716a482d54ab7f3894d9d0", "src_uid": "956228e31679caa9952b216e010f9773", "apr_id": "13188f2db734a304f84825ebb10d56d6", "difficulty": 1800, "tags": ["greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.6778846153846154, "equal_cnt": 8, "replace_cnt": 1, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "#include \n#include \nusing namespace std;\n\n\n\nint pow (long long int y ,long long int x)\n{\n\tif(x==0)\n\t\treturn 1;\n\treturn y*pow(y ,x-1);\n}\nint main()\n{\n\tlong long int n , a , c=0 , b=5;\n\tcin >> n ;\n\ta= pow (b , n);\n\ta%=100;\n\tcout << a << endl;\n\treturn 0;\n}", "lang": "MS C++", "bug_code_uid": "60e48df7a83ab71345d39ad039e5c4c0", "src_uid": "dcaff75492eafaf61d598779d6202c9d", "apr_id": "c9eb4471861ca18c1aa211acddb8a392", "difficulty": 800, "tags": ["number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9792322215229704, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "#include \n\nusing namespace std;\n\n#define MP make_pair\n#define PB push_back\n#define INF (int)1e9\n#define EPS 1e-9\n#define PI 3.1415926535897932384626433832795\n#define MOD 1000000007\n#define MAX 1000000\n#define all(x) x.begin(),x.end()\n#define sz(x) ((int)x.size())\n#define sqr(x) ((x)*(x))\n#define SET(x) memset(x, 0, sizeof(x))\n#define CLR(x) memset(x, -1, sizeof(x))\n#define xx first\n#define yy second\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\ninline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }\ninline int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b);}\n//Convert int to string\ntemplate \nstring to_str(T str)\n{\n stringstream stream;\n stream << str;\n return stream.str();\n}\n\n//Convert string to int\ntemplate \nint to_int(T num)\n{\n int val;\n stringstream stream;\n stream << num;\n stream >> val;\n return val;\n}\n\n//Split String by Single Character Delimiter\nvector split(const string& s, char delim)\n{\n vector elems;\n stringstream ss(s);\n string item;\n\n while (getline(ss, item, delim))\n elems.push_back(item);\n\n return elems;\n}\n// this function goes to main for splitting\n//vector words;\n//words = split(\"lorem_ipsum_dolor_sit_amet_no_tota_tacimates_delicata_eum\", '_');\n//for(int i=0; i&i, const pair&j) {\n// return i.second < j.second;\n//}\n//vector< pair >v;\n//sort(v.begin(), v.end(), comp);\n\nconst int dr [] = {-1, -1, 0, 1, 1, 1, 0, -1};\nconst int dc [] = {0, 1, 1, 1, 0, -1, -1, -1};\n\ntypedef pair PII;\ntypedef vector VI;\ntypedef vector VS;\ntypedef vector VII;\ntypedef vector VVI;\ntypedef map MPII;\ntypedef set SETI;\ntypedef multiset MSETI;\ntypedef long int i32;\ntypedef unsigned long int ui32;\ntypedef long long int i64;\ntypedef unsigned long long int ui64;\n\nint main()\n{\n ios_base::sync_with_stdio(0);\n int n, m;\n cin>>n>>m;\n if(m > n*(n+1)/2){\n m %= n*(n+1)/2;\n }\n bool f1 = false;\n for(int i=1; i<=n; i++) {\n if(m\n#include\nusing namespace std;\n#define Maxn 500\nint main()\n{\n int n,m,i,j;\n int arr[Maxn];\n scanf(\"%d\",&n);\n for(i=0;i=0;i--)\n cout<\nusing namespace std;\ntypedef long long ll;\ntypedef unsigned long long ull;\nstatic const int maxn = 100010;\nstatic const int INF = 0x3f3f3f3f;\nstatic const int mod = (int)1e9 + 7;\nstatic const double eps = 1e-6;\nstatic const double pi = acos(-1);\n\nvoid redirect(){\n #ifdef LOCAL\n freopen(\"test.txt\",\"r\",stdin);\n #endif\n}\nmapm;\nint main(){\n int n;\n redirect();\n m[5] = 1;\n m[46] = 1;\n m[13] = 0;\n m[24] = 0;\n scanf(\"%d\",&n);\n if(m.count(n))m[n]?printf(\"YES\"):printf(\"NO\");\n else{\n if(n <= 5)while(1);\n else assert(0);\n }\n return 0;\n}\n\n", "lang": "GNU C++11", "bug_code_uid": "7b2841b0b58a8a98bbed68cddbfd5af8", "src_uid": "821529a4644b74483bcdf80fc318d1f8", "apr_id": "3ac312552796eb6b76b301f6864e4ae3", "difficulty": null, "tags": ["brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7588289962825279, "equal_cnt": 28, "replace_cnt": 19, "delete_cnt": 4, "insert_cnt": 4, "fix_ops_cnt": 27, "bug_source_code": "#include \n\nusing namespace std;\n\ntypedef int ll;\n\nint main() {\n ios_base::sync_with_stdio(false);\n cin.tie(nullptr);\n function power = [&](ll x, ll y) {\n if (y == 0) {\n return 1LL;\n } else {\n ll z = power(x, y / 2);\n return y % 2 == 0 ? (z * z) % 998244353 : ((z * z) % 998244353 * x) % 998244353;\n }\n };\n unordered_map divs;\n auto div = [&](ll x) {\n if (divs.find(x) != divs.end()) {\n return divs[x];\n }\n return divs[x] = power(x, 998244353 - 2);\n };\n ll n, m;\n cin >> n >> m;\n vector a((size_t) n);\n vector w((size_t) n);\n for (ll i = 0; i < n; i++) {\n ll v;\n cin >> v;\n a[i] = v == 1;\n }\n for (ll i = 0; i < n; i++) {\n cin >> w[i];\n }\n ll zeros = 0, ones = 0;\n for (ll i = 0; i < n; i++) {\n if (a[i]) {\n ones += w[i];\n } else {\n zeros += w[i];\n }\n }\n map, ll> dp0;\n function f0 = [&](ll z, ll o) {\n if (z - o <= zeros - ones - m) {\n return 1LL;\n }\n auto it = dp0.find({z, o});\n if (it != dp0.end()) {\n return it->second;\n }\n ll r = z * f0(z - 1, o) + (o + 1) * f0(z, o + 1);\n r %= 998244353;\n r *= div(z + o);\n r %= 998244353;\n return dp0[{z, o}] = r;\n };\n map, ll> dp1;\n function f1 = [&](ll z, ll o) {\n if (z - o <= zeros - ones - m) {\n return 1LL;\n }\n auto it = dp1.find({z, o});\n if (it != dp1.end()) {\n return it->second;\n }\n ll r = (z - 1) * f1(z - 1, o) + o * f1(z, o + 1);\n r %= 998244353;\n r *= div(z + o);\n r %= 998244353;\n return dp1[{z, o}] = r;\n };\n for (ll i = 0; i < n; i++) {\n if (a[i]) {\n cout << (f0(zeros, ones) * w[i]) % 998244353 << endl;\n } else {\n cout << (f1(zeros, ones) * w[i]) % 998244353 << endl;\n }\n }\n return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "f652d4c75bf1df95be2259146aea3dbe", "src_uid": "ba9c136f84375cd317f0f8b53e3939c7", "apr_id": "8cdbcb10d9350957bafd59404641a1a7", "difficulty": 2600, "tags": ["dp", "probabilities"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.10757946210268948, "equal_cnt": 21, "replace_cnt": 13, "delete_cnt": 2, "insert_cnt": 7, "fix_ops_cnt": 22, "bug_source_code": "#include\n#include\nusing namespace std;\nint main(){\n int n,k;\n cin>>n>>k;\n int a[n];\n for(int i=0;i>a[i];\n }\n \n int ans=0;\n int j=0; int x;\n for(int j=0;jx)\n {\n if(a[r]<=k)\n {\n ans++;\n r--;\n }\n \n else {\n break;\n }\n \n \n }\n \n cout<\n#include \nusing namespace std;\n \nstring s;\n \nint dp[510][510];\n \nint main()\n{\n int n;\n cin >> n >> s;\n for (int i = 0; i < n; i++)\n dp[i][i] = 1;\n \n for (int l = 2; l <= n; l++) {\n for (int i = n - l; i >= 0; i--) {\n int j = i + l - 1;\n \n dp[i][j] = 1e9;\n for (int k = i; k < j; k++)\n dp[i][j] = min(dp[i][j], dp[i][k] + dp[k + 1][j]);\n \n if (s[i] == s[j]) {\n dp[i][j] = min(dp[i][j], dp[i + 1][j]);\n /// dp[i][j] = min(dp[i][j], dp[i][j - 1]);\n dp[i][j] = min(dp[i][j], dp[i + 1][j - 1] + 1);\n }\n }\n }\n \n cout << dp[0][n - 1] << '\\n';\n \n \n ", "lang": "GNU C++17", "bug_code_uid": "394e1f4f4d1dfd31908d04f2eb47346e", "src_uid": "516a89f4d1ae867fc1151becd92471e6", "apr_id": "466989e028b18242da872f1d39fa028e", "difficulty": 2000, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8856088560885609, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 5, "bug_source_code": "#include\nusing namespace std;\nint func(int n){\n if(n==0) return 0;\n int val=1;\n while(val*2<=n){\n val*=2;\n }\n return 1+func(n-val);\n}\nint main(){\n int n;\n cin>>n;\n return func(n);\n}", "lang": "GNU C++17", "bug_code_uid": "410e8977bf43613fcdcc268dbebcfedd", "src_uid": "03e4482d53a059134676f431be4c16d2", "apr_id": "e5742083445b5114298bd51d02b967a5", "difficulty": 1000, "tags": ["bitmasks"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9884886743408837, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include \n#define IN(a,b) (a.find(b) != a.end())\n#define p(a,b) make_pair(a,b)\n#define readVec(a) for (int64_t __i = 0; __i<(int64_t)a.size();__i++){cin>>a[__i];}\n\n// jimjam\n\ntemplate\nvoid pMin(T &a, T b) {if (b\nvoid pMax(T &a, T b) {if (b>a){a=b;}}\ntemplate\nstd::ostream& operator<<(std::ostream& os, const std::vector& c);\ntemplate\nstd::ostream& operator<<(std::ostream& os, const std::pair& c) {std::cout << \"(\" << c.first << \", \" << c.second << \")\";return os;}\ntemplate\nstd::ostream& operator<<(std::ostream& os, const std::vector& c) {\n\tif (c.size() == 0) {os << \"{}\"; return os;}\n\tos << \"{\" << c[0];\n\tfor (int64_t i = 1; i < (int64_t)c.size(); i++) {os <<\", \"<> n >> m >> k;\n\tif (n==m) {return 1;}\t\n\n\tint64_t curr = 2;\n\tm-=n;\n\tm-=1;\n\tint64_t l = max(k-1,(int64_t)1), r = min(n,k+1);\n\n\twhile (!(l==1 && r==n)) {\n\t\tif (m < (r-l+1)) {\n\t\t\tcout << curr << endl;\n\t\t\treturn 0;\n\t\t} else {\n\t\t\tm -= (r-l+1);\n\t\t\tcurr++;\n\t\t}\n\t\tl--;\n\t\tr++;\n\t\tpMax(l,(int64_t)1);\n\t\tpMin(r,n);\n\t}\n\n\tcurr += (m/n);\n\tcout << curr << endl;\n\treturn 0;\n}\n\n\n", "lang": "GNU C++17", "bug_code_uid": "dfa7acb19ded3394ba1ddeb4ca0fcd3e", "src_uid": "da9ddd00f46021e8ee9db4a8deed017c", "apr_id": "d4e2705bd8473c2b52838c3e9a503c30", "difficulty": 1500, "tags": ["greedy", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.02912165335838422, "equal_cnt": 18, "replace_cnt": 15, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 18, "bug_source_code": "#include\n#include\n#define BASE 1000000007;\nusing namespace std;\nmap, __int32> storedvalue;\n__int32 findvalue(__int32 i, __int32 j)\n{\n\t__int32 result;\n\tpair<__int32, __int32> index = make_pair(i, j);\n\tif (storedvalue.count(index))return storedvalue[index];\n\tif (i > j)result = findvalue(j,i);\n\telse if (i == 1)result = j;\n\telse if (i == j)result = 1;\n\telse if (j == i + 1 && i % 2 == 1)result = 2;\n\telse if (i == 2 && j % 2 == 0)result = j - 1;\n\telse if (i == 2 && j % 2 == 1)result = j + 1;\n\telse if (j % 4 == 1 || j % 4 == 2)result = 2 + findvalue(i-2,j);\n\telse if (j % 4 == 3 || j % 4 == 0)result = -2 + findvalue(i - 2, j);\n\telse result = 0;\n\tstoredvalue.insert(make_pair(index, result));\n\treturn result;\n}\n\nint main()\n{\n\tint q;\n\tcin >> q;\n\tfor (int i = 0; i < q; i++)\n\t{\n\t\t__int32 x1, y1, x2, y2, K;\n\t\tcin >> x1 >> y1 >> x2 >> y2 >> K;\n\t\tint ans = 0;\n\t\tfor (__int32 j = x1; j <= x2; j++)\n\t\t{\n\t\t\tfor (__int32 k = y1; k <= y2; k++)\n\t\t\t{\n\t\t\t\t__int32 temp = findvalue(j, k);\n\t\t\t\tif (temp > K)continue;\n\t\t\t\telse ans = (ans + temp) % BASE;\n\t\t\t}\n\t\t}\n\t\tcout << ans << endl;\n\t}\n}", "lang": "GNU C++14", "bug_code_uid": "272885425a8521371dca0c88da8c740c", "src_uid": "1ab085026ce43810acf98cc4bf8faf26", "apr_id": "c31eab5aeea0d7a914f2a48b24f41bb9", "difficulty": 2600, "tags": ["divide and conquer", "dp"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9155161078238001, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#define mp make_pair\n#define mt make_tuple\n#define fi first\n#define se second\n#define pb push_back\n#define all(x) (x).begin(), (x).end()\n#define rall(x) (x).rbegin(), (x).rend()\n#define forn(i, n) for (int i = 0; i < (int)(n); ++i)\n#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)\n#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)\n#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)\n\nusing namespace std;\n\ntypedef pair pi;\ntypedef vector vi;\ntypedef vector vpi;\ntypedef vector vvi;\ntypedef vector vvpi;\ntypedef long long ll;\ntypedef pair pl;\ntypedef vector vl;\ntypedef vector vpl;\ntypedef vector vvl;\ntypedef vector vvpl;\n\nconst int INF = 1001001001;\nconst ll INFL = 1001001001001001001LL;\n\ntemplate void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << \" \"; cout << endl; }\ntemplate bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }\ntemplate bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }\nint in() { int x; cin >> x; return x; }\ndouble fin() { double x; cin >> x; return x; }\nstring sin() { string x; cin >> x; return x; }\nll lin() { ll x; cin >> x; return x; }\n\nll mod = 1000000007;\n\nll solve(ll n, ll x1, ll y1, ll x2, ll y2, ll k, ll plus) {\n if (0 > x2 || 0 > y2 || n - 1 < x1 || n - 1 < y1 || plus >= k) return 0;\n\n if (x1 <= 0 && n - 1 <= x2 && y1 <= 0 && n - 1 <= y2) {\n ll a = min(plus + n, k);\n ll b = plus + 1;\n ll sol = (a + b) * (a - b + 1) / 2 % mod * n % mod;\n return sol;\n } else {\n ll m = n / 2;\n ll sol1 = solve(m, x1, y1, x2, y2, k, plus);\n ll sol2 = solve(m, x1 - m, y1, x2 - m, y2, k, plus + m);\n ll sol3 = solve(m, x1, y1 - m, x2, y2 - m, k, plus + m);\n ll sol4 = solve(m, x1 - m, y1 - m, x2 - m, y2 - m, k, plus);\n\n return (sol1 + sol2 + sol3 + sol4) % mod;\n }\n}\n\nint main() {\n#ifdef LOCAL_ENV\n freopen(\"sol.in\", \"r\", stdin);\n freopen(\"sol.out\", \"w\", stdout);\n#else\n ios_base::sync_with_stdio(false);\n cin.tie(nullptr);\n#endif\n\n int q = in();\n forn (cs, q) {\n int x1, y1, x2, y2, k;\n cin >> x1 >> y1 >> x2 >> y2 >> k;\n\n x1--; y1--; x2--; y2--;\n\n ll cur = 1;\n while (cur <= x2 || cur <= y2) cur <<= 1;\n cout << solve(cur, x1, y1, x2, y2, k, 0) << '\\n';\n }\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "0548fbf1a66d6ffb7a4dd79dd437339f", "src_uid": "1ab085026ce43810acf98cc4bf8faf26", "apr_id": "b02a66b1bcfb4f9cc09a34fbe7394089", "difficulty": 2600, "tags": ["divide and conquer", "dp"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9539594843462247, "equal_cnt": 15, "replace_cnt": 14, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 15, "bug_source_code": "#include \n#define int long long\nusing namespace std;\n \nconst int MOD = 998244353, MAXN = 500005;\nint fact[MAXN];\n \nvoid calcFacts() {\n fact[0] = 1;\n for (int i = 1; i < MAXN; i++)\n fact[i] = (fact[i - 1] * i) % MOD;\n}\n \nint powMod(int a, int e) {\n int r = 1;\n while (e) {\n if (e & 1)\n r = (r * a) % MOD;\n a = (a * a) % MOD;\n e >>= 1;\n }\n return r;\n}\n \nint invMod(int a) {\n return powMod(a, MOD - 2);\n}\n \nint choose(int n, int k) {\n if (k > n)\n return 0;\n return (fact[n] * invMod((fact[k] * fact[n - k]) % MOD)) % MOD;\n}\n \nint main() {\n calcFacts();\n \n int n, k;\n cin >> n >> k;\n \n int answer = 0;\n for (int i = 1; i < MAXN; i++) {\n answer = (answer + choose(n / i - 1, k - 1)) % MOD;\n }\n \n cout << answer;\n}\n", "lang": "GNU C++17", "bug_code_uid": "18c09531d01f1c3a38592bcdfedb5e5a", "src_uid": "8e8eb64a047cb970a549ee870c3d280d", "apr_id": "6e5eb3a1eecaf95522ff130660e22fd2", "difficulty": 2000, "tags": ["math", "combinatorics", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9816643159379408, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n\tcin >> n;\n\tint i,flag=0;\n\tlong int dif;\n\tint arr[10000];\n\tfor(i=0;i> arr[i];\n\t}\n\t\tdif=arr[1]-arr[0];\n\tfor(i=1;i\n#include \n#include \n#include \n#include \n\nconst int N = (int)3e4;\nint n, a, q;\nnamespace convolution\n{\n\tint rev[N << 2], len;\n\tinline int initialize(int n)\n\t{\n\t\tlen = 1;\n\t\tint tmp = 0;\n\t\tfor(; len < n << 1; ++ tmp, len <<= 1);\n\t\trev[0] = 0;\n\t\tfor(int i = 1; i < len; ++ i)\n\t\t\trev[i] = rev[i >> 1] >> 1 | (i & 1) << tmp - 1;\n\t}\n\tstruct complex\n\t{\n\t\tdouble rl, img;\n\t\tinline complex() {}\n\t\tinline complex(double _rl, double _img)\n\t\t{\n\t\t\trl = _rl, img = _img;\n\t\t}\n\t\tinline complex friend operator +(complex a, complex b)\n\t\t{\n\t\t\treturn complex(a.rl + b.rl, a.img + b.img);\n\t\t}\n\t\tinline complex friend operator -(complex a, complex b)\n\t\t{\n\t\t\treturn complex(a.rl - b.rl, a.img - b.img);\n\t\t}\n\t\tinline complex friend operator *(complex a, complex b)\n\t\t{\n\t\t\treturn complex(a.rl * b.rl - a.img * b.img, a.rl * b.img + b.rl * a.img);\n\t\t}\n\t}A[N << 2], B[N << 2];\n\tdouble PI = acos(-1);\n\tinline void FFT(complex *a, int opt)\n\t{\n\t\tfor(int i = 0; i < len; ++ i)\n\t\t\tif(rev[i] < i)\n\t\t\t\tstd::swap(a[i], a[rev[i]]);\n\t\tfor(int i = 2; i <= len; i <<= 1)\n\t\t{\n\t\t\tcomplex omega_i = complex(cos(2 * PI * opt / i), sin(2 * PI * opt / i));\n\t\t\tfor(int j = 0; j < len; j += i)\n\t\t\t{\n\t\t\t\tcomplex omega = complex(1, 0);\n\t\t\t\tfor(int k = j; k < j + i / 2; ++ k)\n\t\t\t\t{\n\t\t\t\t\tcomplex u = a[k], t = a[k + i / 2] * omega;\n\t\t\t\t\ta[k] = u + t, a[k + i / 2] = u - t;\n\t\t\t\t\tomega = omega * omega_i; \n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(opt == -1)\n\t\t\tfor(int i = 0; i < len; ++ i)\n\t\t\t\ta[i].rl /= len;\n\t}\n\tinline void work(int *a, int *b, int n, long long *res)\n\t{\n\t\tmemset(A, 0, sizeof(A)), memset(B, 0, sizeof(B));\n\t\tfor(int i = 0; i < n; ++ i)\n\t\t\tA[i] = complex(a[i], 0), B[i] = complex(b[i], 0);\n\t\tFFT(A, 1), FFT(B, 1);\n\t\tfor(int i = 0; i < len; ++ i)\n\t\t\tA[i] = A[i] * B[i];\n\t\tFFT(A, -1);\n\t\tfor(int i = 0; i < len; ++ i)\n\t\t\tres[i] = round(A[i].rl);\n\t}\n}\nint f[N + 1][2], _f[N + 1][2];\nint ans;\ninline void update()\n{\n\tfor(int i = 1; i <= n; i += 2)\n\t\tans = (ans + f[i][1]) % q;\n}\nvoid work(int b)\n{\n cout << b << ' ';\n\tif(b == 1)\n\t{\n\t\tmemset(f, 0, sizeof(f));\n\t\tf[1][1] = 1;\n\t\tupdate();\n\t\treturn;\n\t}\n\twork(b / 2);\n\tstatic int x[N + 1], y[N + 1];\n\tstd::swap(f, _f);\n\tfor(int i = 0; i <= n; ++ i)\n\t\tx[i] = (_f[i][0] + _f[i][1]) % q;\n\tfor(int i = 0; i < 2; ++ i)\n\t{\n\t\tfor(int j = 0; j <= n; ++ j)\n\t\t\ty[j] = _f[j][i ^ (b >> 1 & 1)];\n\t\tstatic long long res[N << 2];\n\t\tconvolution::work(x, y, n, res);\n\t\tfor(int j = 0; j <= n; ++ j)\n\t\t\tf[j][i] = (res[j] + _f[j][i] + _f[j][i ^ (b >> 1 & 1)]) % q;\n\t}\n\tif(b & 1)\n\t{\n\t\tstd::swap(f, _f);\n\t\tfor(int i = 0; i < 2; ++ i)\n\t\t{\n\t\t\tf[0][i] = _f[0][i];\n\t\t\tfor(int j = 1; j <= n; ++ j)\n\t\t\t\tf[j][i] = (_f[j][i] + (i ^ (b & 1) ? 0 : (j == 1 ? 1 : _f[j - 1][0] + _f[j - 1][1]))) % q;\n\t\t}\n\t}\n\tupdate();\n}\nint main()\n{\n\n\t#ifndef ONLINE_JUDG\n\tfreopen(\"CF773F.in\", \"r\", stdin);\n//\tfreopen(\"CF773F.out\", \"w\", stdout);\n\t#endif\n\n\tusing namespace std;\n\tcin >> n >> a >> q;\n\tconvolution::initialize(n);\n\tans = 0;\n\twork(a / 2);\n\tcout << ans << endl;\n}", "lang": "GNU C++11", "bug_code_uid": "ce9ba56524fd284d6ab8c19d0983ea29", "src_uid": "aac481d9e5ea3e3d43b324c8750882be", "apr_id": "b833a720bdae24b37b9964758ea9e756", "difficulty": 3400, "tags": ["divide and conquer", "dp", "combinatorics", "number theory", "fft", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9998051062171117, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include\n#define ll long long\n#define ull unsigned ll\n#define uint unsigned\n#define db long double\n#define pii pair\n#define pll pair\n#define IT iterator\n \n#define PB push_back\n#define MK make_pair\n#define LB lower_bound\n#define UB upper_bound\n#define EB emplace_back\n#define fi first\n#define se second\n \n#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)\n#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)\n#define UPD(x,y) (((x)+=(y))>=mo?x-=mo:233)\n#define CLR(a,v) memset(a,v,sizeof(a));\n#define CPY(a,b) memcpy(a,b,sizeof(a));\n \n#define LS3 k*2,l,mid\n#define RS3 k*2+1,mid+1,r\n#define LS5 k*2,l,mid,x,y\n#define RS5 k*2+1,mid+1,r,x,y\n#define GET pushdown(k);int mid=(l+r)/2\n \n#define inf 1<<30\n#define sqr(x) ((x)*(x))\nusing namespace std;\nint mo;\nstruct COMPLEX{\n\tdb r,i;\n\tCOMPLEX(){}\n\tCOMPLEX(db _r,db _i){r=_r,i=_i;}\n\tCOMPLEX operator +(const COMPLEX &a)const{\n\t\treturn COMPLEX(r+a.r,i+a.i);\n\t}\n\tCOMPLEX operator -(const COMPLEX &a)const{\n\t\treturn COMPLEX(r-a.r,i-a.i);\n\t}\n\tCOMPLEX operator *(const COMPLEX &a)const{\n\t\treturn COMPLEX(r*a.r-i*a.i,r*a.i+i*a.r);\n\t}\n\tCOMPLEX conj()const{\n\t\treturn COMPLEX(r,-i);\n\t}\n};\nconst int FFTN=1<<16;\nCOMPLEX w[FFTN+2],a[FFTN+2],b[FFTN+2];\nint R[FFTN],LEN;\nconst db pi=acos(-1);\nvoid prepare(){\n\tFor(i,0,FFTN-1) w[i]=COMPLEX(cos(2*pi*i/FFTN),sin(2*pi*i/FFTN));\n}\nvoid FFTinit(int sz){\n\tLEN=1; int L=0;\n\tfor (;LEN<=sz;LEN<<=1,L++);\n\tFor(i,0,LEN-1) R[i]=(R[i>>1]>>1)|((i&1)<<(L-1));\n}\nvoid DFT(COMPLEX *a,int n){\n\tFor(i,0,n-1) if (i\n#include \n#include\nusing namespace std;\n int n, sum=0;\n void dfs(int x)\n {\n if(x<=n)\n sum++;\n else\n return ;\n dfs(x*10+7);\n dfs(x*10+4);\n }\n int main()\n {\n cin>>n;\n dfs(4);\n dfs(7);\n cout<\n\nusing namespace std;\n\nint main()\n{\n\n int mas[100];\n cin >> mas[1] >> mas[2] >> mas[3];\n if ( mas[2] == 1 ) //1 \u0441\u043b\u0443\u0447\u0430\u0439, \u0435\u0441\u043b\u0438 \u043f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\n {cout << \"(\" << 1 << \")\";\n int i = 0;\n int b = mas[2];\n while( i < mas[3])\n {\n b++;\n cout << \" \"<< b;\n i++;}\n if( b < mas[1])\n cout << \" >> \";}\n\n\n if (mas[1] == mas[2])// 2 \u0441\u043b\u0443\u0447\u0430\u0439, \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f\n {int z= mas[1] - mas[3] ;\n cout << \"<< \";\n while (z < mas[1])\n if(z > 0)\n {\n cout << z <<\" \";\n z++;\n }\n cout << \"(\"<< mas[1]<< \")\";}\n\n\n\n if( mas[2] != 1 && mas[2] < mas[1])//3 c\u043b\u0443\u0447\u0430\u0439, \u0432 \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0435\n {int c = mas[2] - mas[3];\n if( c > 1)\n cout << \"<<\";\n while (c< mas[2])\n if(c > 0)\n {cout<< \" \"<< c;\n c++;}\n\n cout <<\" \"<< \"(\"<< mas[2] << \")\";\n int a = 0;\n while( a < mas[3] && mas[2]< mas[1])//////////////////\n\n {mas[2]++;\n cout << \" \"<> \";}\n\n\n\n return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "ae33a3ca3a985a4688b03906b57318d7", "src_uid": "526e2cce272e42a3220e33149b1c9c84", "apr_id": "1391f340c003d1bbfaa5e89ef2986233", "difficulty": null, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.7756794104099494, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "#include\nusing namespace std;\n#define int long long\ninline void read(int &x)\n{\n\tchar c=getchar();\n\tx=0;\n\twhile (c>'9'||c<'0')\n\t\tc=getchar();\n\twhile (c>='0'&&c<='9')\n\t{\n\t\tx=x*10+c-'0';\n\t\tc=getchar();\n\t}\n}\nconst int inf=1e18;\nint a,t,t0,t1,t2,p1,p2,a1,a2,ans;\nsigned main()\n{\n\t//freopen(\"c.in\",\"r\",stdin);\n\t//freopen(\"c.out\",\"w\",stdout);\n\tread(a);\n\tread(t);\n\tread(t0);\n\tread(a1);\n\tread(t1);\n\tread(p1);\n\tread(a2);\n\tread(t2);\n\tread(p2);\n\tans=inf;\n\tif (t0<=t1&&t0<=t2)\n\t{\n\t\tif (a*t0<=t)\n\t\t\tputchar('0');\n\t\telse\n\t\t\tputs(\"-1\");\n\t\treturn 0;\n\t}\n\tfor (int i=0;i<=(a-1)/a1+1;++i)\n\t{\n\t\tint dt=t-t1*min(i*a1,a),sum=i*p1,da=max(0LL,a-a1*i);\n\t\tif (dt<0)\n\t\t\tbreak;\n\t\tif (da*t0<=dt)\n\t\t{\n\t\t\tans=min(ans,sum);\n\t\t\tbreak;\n\t\t}\n\t\tif (da*t2>dt)\n\t\t\tcontinue;\n\t\tif (t0>t2)\n\t\t{\n\t\t\tz=(da*t0-dt+t0-t2-1)/(t0-t2);\n\t\t\tans=min(ans,sum+((x-1)/a2+1)*p2);\n\t\t}\n\t}\n\tif (ans==inf)\n\t\tans=-1;\n\tcout<\nusing namespace std;\n\n#define endl \"\\n\"\n#define ll long long int\n#define f(i,st,ed) for(ll i=st;i=st;i--)\n#define vv vector\n#define all(v) v.begin(),v.end() \n#define pb push_back\n#define pp pair\n#define gv(v,s,e) f(i,s,e){ ll x; cin >> x; v.pb(x);}\n#define pv(v,s,e) f(i,s,e){cout << v[i] << \" \";}\n#define MOD 1000000007\n#define debug(x) cout << x << endl;\n\n\nvoid yes(){\n cout << \"YES\" << endl;\n}\n\nvoid no(){\n cout << \"NO\" << endl;\n}\n\nll powmod(ll x, ll y, ll mod)\n{\n ll ans=1;\n\n while(y)\n {\n if(y%2==1)\n {\n ans = (ans*x)%mod;\n }\n\n x = (x*x)%mod;\n y/=2;\n }\n\n return ans;\n}\n\nint main()\n{\n ios_base::sync_with_stdio(false);\n cin.tie(NULL);\n cout.tie(NULL);\n\n ll arr[100]={0};\n\n f(n,1,100)\n {\n ll l;\n ll r;\n if(n%2==1)\n {\n l=4;\n r = (pow(n,2)+1)/2;\n }\n else\n {\n l = 4;\n r = (n-2)*(n-2);\n }\n f(j,l,r+1)\n {\n if(j<=100)\n {\n if(arr[j]==0)\n arr[j]=n;\n }\n else\n break;\n }\n }\n\n ll x;\n cin >> x;\n\n cout << arr[x] << endl;\n\n return 0;\n}\n\n", "lang": "GNU C++17", "bug_code_uid": "93c355f0fbaf3033fa03ce2a812ed6af", "src_uid": "01eccb722b09a0474903b7e5abc4c47a", "apr_id": "b5de88d366e2c91c4761d4a261634926", "difficulty": 1700, "tags": ["dp", "math", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.8980164295732318, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n/*void A_1() //\u6ce8\u610f\u5b9a\u4e49\u53d8\u91cf\u7684\u7c7b\u578b\n{\n long long n,m,a;\n cin>>n>>m>>a;\n long long i,j;\n long long counts;\n i=ceil(n*1.0/a);\n j=ceil(m*1.0/a);\n counts=i*j;\n cout<>w;\n if(w%2==0 && w!=2)\n cout<<\"YES\"<>n;\n words a[n];\n words b[n];\n int len;\n char temp[256];\n for(i=0;i>a[i].word;\n len=(int)a[i].word.length();\n if(len>10)\n {\n sprintf(temp,\"%c%d%c\",a[i].word[0],len-2,a[i].word[len-1]);\n b[i].word=temp;\n }\n else\n {\n b[i].word=a[i].word;\n }\n }\n for(i=0;i>n>>k;\n int a[n];\n for(i=0;i>a[i];\n }\n for(i=0;i=a[k-1] && a[i]!=0)\n counts++;\n }\n cout<>str;\n int i,len;\n len=(int)str.length();\n for(i=0;i>m>>n;\n if(m%2==0||n%2==0)\n cout<>n;\n int a[n],b[n],c[n],d[n];\n for(i=0;i>a[i]>>b[i]>>c[i];\n d[i]=a[i]+b[i]+c[i];\n if(d[i]>=2)\n k++;\n }\n cout<>a>>b>>c;\n int d[5];\n d[0]=a*b*c;\n d[1]=(a+b)*c;\n d[2]=(b+c)*a;\n d[3]=a+b+c;\n for(i=0;i<3;i++)\n {\n for(j=0;j<3-i;j++)\n if(d[j]>d[j+1])\n {\n temp=d[j];d[j]=d[j+1];d[j+1]=temp;\n }\n }\n cout<>n>>x;\n for(j = 0; j < 1000000; j++) //\u8fd9\u79cd\u601d\u60f3\u975e\u5e38\u503c\u5f97\u5b66\u4e60\uff0c\u4ee5\u7a7a\u95f4\u6362\u65f6\u95f4\u3002\n a[j] = 0;\n long long ans = 0;\n for(int j = 0; j < n; j++) {\n cin>>k;\n ans += a[x xor k];\n a[k]++;\n }\n cout<a)\n swap(a,b);\n long long c;\n while(b>0)\n {\n c=a%b; a=b; b=c;\n }\n return a;\n}\nlong long a[1000],b[1000],t[1000];\nvoid A_741()\n{\n int n,i,j;\n cin>>n;\n for(i=0;i<1000;i++)\n {\n a[i]=1;b[i]=1;t[i]=1;\n }\n for(i=0;i>a[i];\n b[i]=a[i];\n t[i]=0;\n }\n for(i=0;i0 && t[i]%2==0)\n t[i]=t[i]/2;\n }\n long long temp,ans;\n for(i=1;i=0 && t[j]>temp)\n {\n t[j+1]=t[j];\n j--;\n }\n t[j+1]=temp;\n }\n ans=t[0];\n if(ans!=-1)\n {\n for(i=n-1;i>0;i--)\n {\n if(t[i-1]==-1)\n break;\n if(t[i]!=-1)\n {\n ans=ans/GCD(ans,t[i-1])*t[i-1]; //\u6700\u5c0f\u516c\u500d\u6570\u4e0e\u6700\u5927\u516c\u56e0\u6570\u7684\u6c42\u6cd5\n }\n }\n }\n cout<\nusing namespace std;\n\ntypedef long long ll;\ntypedef pair pii;\n#define ite(i, a, b) for(int i = a; i <= b; ++i)\n\nconst int maxn = 1e8 + 1;\n\nint n, b, top_divisor = 0;\nll ans = 1e18;\nint freq[maxn];\nint divisor[maxn];\nint brr[maxn];\n\nvoid find_divisors(int b) {\n\tint i = 2;\n\twhile (b > 1) {\n\t\tif (b%i == 0) {\n\t\t\tint max = i;\n\t\t\twhile (b%i == 0) {\n\t\t\t\tb /= i;\n\t\t\t\tdivisor[++top_divisor] = max;\n\t\t\t\tfreq[max]++;\n\t\t\t}\n\t\t}\n\t\t++i;\n\t}\n}\n\nint count_zero(int n, int div) {\n\tint ret = 0;\n\twhile (n >= div) {\n\t\tn /= div;\n\t\tret += n;\n\t}\n\treturn ret;\n}\n\nint main() {\n\n\tios::sync_with_stdio(false);\n\n\t//freopen(\"D:\\in.txt\", \"r\", stdin);\n\n\tcin >> n >> b;\n\tfind_divisors(b);\n\tite(i, 1, top_divisor) {\n\t\tint count = count_zero(n, divisor[i]) / freq[divisor[i]];\n\t\tif (ans > count)\n\t\t\tans = count;\n\t}\n\tcout << ans << endl;\n\n\treturn 0;\n}", "lang": "GNU C++17", "bug_code_uid": "7cdcecc9696b1d41a7414ab80200c64e", "src_uid": "491748694c1a53771be69c212a5e0e25", "apr_id": "a807dab5278f367b01a55f9148f4f171", "difficulty": 1700, "tags": ["number theory", "math", "brute force", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.6184738955823293, "equal_cnt": 14, "replace_cnt": 4, "delete_cnt": 5, "insert_cnt": 5, "fix_ops_cnt": 14, "bug_source_code": "#include\n\nusing namespace std;\nconst int N = 5;\nstruct node\n{\n\tint x1, y1, x2, y2;\n}a[N];\n\nint main()\n{\n\tbool go = false;\n\twhile(1)\n\t{\n\tfor(int i = 0; i < 3; i++)\n\t{\n\t\tcin >> a[i].x1 >> a[i].y1 >> a[i].x2 >> a[i].y2;\n\t}\n\t\n\tfor(int i = 1, j = 2; i <= 2; i++, j--)\n\t{\n\t\tif(a[i].x1 <= a[0].x1 && a[i].x1 <= a[0].x1 &&\n\t\t a[i].x2 >= a[0].x2 && a[i].x2 >= a[0].x2)\n\t\t {\n\t\t \t\tgo = true;\n\t\t }\n\t\tif(a[i].x1 <= a[0].x1 && a[i].y1<=a[0].y1 && a[i].x2>=a[0].x2 )\n\t\t{\n\t\t\ta[0].y1 = a[i].y1;\n\t\t\tif(a[j].x1 <= a[0].x1 && a[j].x1 <= a[0].x1 &&\n\t\t a[j].x2 >= a[0].x2 && a[j].x2 >= a[0].x2)\n\t\t\t{\n\t\t\t\tgo = true;\n\t\t\t}\n\t\t}\n\t}\n\tif(go)\n\t{\n\t\tcout << \"YES\" << endl;\n\t}\n\telse\n\t{\n\t\tcout << \"NO\" << endl;\n\t}\n\t}\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "60651df57d587a4e12f2fac4423b577d", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "apr_id": "5b7507ed9a523afcaf3e07723fdfcfc8", "difficulty": 1700, "tags": ["geometry", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.8311688311688312, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n\tlong long unsigned int n,a,i;\n\tcin>>n;\n\tcin>>a;\n\tint b[n];\n\tfor(i=n-1;i>=0;i--)\n\t{\n\t\tb[i]=a%10;\n\t\ta=a/10;\n\t}\n\tint count=0;\n\tfor(i=0;i\nusing namespace std;\nint main()\n{\n\tint t, s, q, ans = 0;\n\tcin>>t>>s>>q;\n\tans = 1;\n\tdouble loaded = s, everysec = double(q-1)/double(q), reached = 0;\n\twhile (reached != t)\n\t{\n\t\treached += 1;\n\t\tloaded += everysec;\n\t\tif (reached > loaded)\n\t\t{\n\t\t\tloaded -= everysec;\n\t\t\treached -= 1;\n\t\t\tdouble diff = loaded - reached;\n\t\t\tdouble t = diff/(1-everysec);\n\t\t\treached = 1-t;\n\t\t\tans++;\n\t\t}\n\t}\n\tcout<\n#include\n#include\n#include\nusing namespace std;\n\nint main()\n{\n int n;\n while(scanf(\"%d\",&n))\n {\n int a[110];\n memset(a,0,sizeof(a));\n for(int i=1;i<=n/2;i++)\n {\n int x;\n scanf(\"%d\",&x);\n if(x&1)\n a[x]=111;\n else\n a[x]=x;\n }\n int sum=0,l=1;\n for(int i=1;i<=n;i++)\n {\n while(a[l]==111&&l\nusing namespace std;\nint main()\n{\n while(1){\n\n string a,b,c;\n cin>>a>>b>>c;\n vectorv;\n v.push_back(a);\n v.push_back(b);\n v.push_back(c);\n sort(v.begin(),v.end());\n a = v[0], b = v[1], c = v[2];\n //cout<\nusing namespace std;\n \n#define mod 1000000000\n#define ll long long\n#define ull unsigned long long\n#define vi vector\n#define vs vector\n#define psi pair\n#define pii pair\n#define vsi vector\n#define vii vector\n#define mp make_pair\n#define pb push_back\n#define rep(n) for(long i=0;i=0;i--)\n#define fori(i,a,b) for(auto i=a;i<=b;i++)\n#define ford(i,b,a) for(auto i=b;i>=a;i--)\n#define mset(a,i) memset(a,i,sizeof(a))\n#define minv(a) min_element(a.begin(),a.end())\n#define maxv(a) max_element(a.begin(),a.end())\n#define min3(a,b,c) min(a,min(b,c))\n#define max3(a,b,c) max(a,max(b,c))\n#define sotit(a) sort(a.begin(),a.end());\n#define sot(a) sort(a,a+n);\n#define ff first\n#define maxheap(v) priority_queue\n#define minheap(v) priority_queue, greater>\n#define ss second\n#define endl \"\\n\"\n#define len(v) ((ll)(v.size()))\n#define NL cout< v[51];\n\nint main() {\n fast_io()\n ll n,k;\n cin>>n>>k;\n ll a[n];\n rep(n){\n cin>>a[i];\n }\n sort(a,a+n);\n ll b,o;\n rep(n){\n b=a[i]/2;\n o=1;\n while(b){\n v[i][b]=o;\n o++;\n b/=2;\n }\n v[i][b]=o;\n }\n ll e=a[n-k],s=0,mid,ans=1e17,c,mini,j;\n for(int i=e;i>=0;i--){\n j=lower_bound(a,a+n,i)-a;\n c=0;\n mini=0;\n for(int l=j;l\n#include \nusing namespace std;\n\nint a[5010][5010];\nint b[25000100][2];\nint ind;\n\nint main()\n{\n\tint n,m,x,q=0,i,j,k=1;\n\tint est;\n\tcin>>n>>m;\n\tcin>>x;\n\n\twhile(1)\n\t{\n\n\t\test=0;\n\t\tfor(i=1;i<=n;i++)\n\t\t\tfor(j=1;j<=m;j++)\n\t\t\t\tif((i+j)%2==0 && a[i-1][j-1]==k-1 && a[i+1][j-1]==k-1 && a[i-1][j+1]==k-1 && a[i+1][j+1]==k-1)\n\t\t\t\t{\n\t\t\t\t\tb[est][0]=i;\n\t\t\t\t\tb[est][1]=j;\n\t\t\t\t\test++;\n\t\t\t\t}\n\t\tif(est==0)\n\t\t\tbreak;\n\t\tfor(i=0;i\nusing namespace std;\n#define pp 100000000\ntypedef long long ll;\nll prime[pp+10];\nbool flag[pp+10];\n\nvoid seive()\n{\n ll i,j, val,total=0;\n for(i=2; i<=pp; i++)\n flag[i]=1;\n val=sqrt(pp)+1;\n for(i=2; i<=val; i++)\n if(flag[i])\n for(j=i; j*i<=pp; j++)\n flag[j*i]=0;\n /* for(i=2; i<=pp; i++)\n if(flag[i])\n prime[total++]=i;*/\n\n}\nmain()\n{\n ll n;\n seive();\n while(cin>>n)\n {\n if(flag[n])printf(\"1\\n\");\n else if(!flag[n])\n if(n%2==0 || flag[n-2])printf(\"2\\n\");\n else\n printf(\"3\\n\");\n }\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "20de0dc9ce9f75488d6eabf2282eebb4", "src_uid": "684ce84149d6a5f4776ecd1ea6cb455b", "apr_id": "f3fb0a508788e0c14fbdb5a503018aa3", "difficulty": 1600, "tags": ["math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9975903614457832, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \n#define MAX_H 32 \n#define MODULO 1000000009\n\nusing namespace std;\n\nint dp[2][2][MAX_H][MAX_H][MAX_H]; \nint n,h; \n\nint main () \n\t{ \n\t\tios :: sync_with_stdio(false);\n\t\tcin.tie(0);\n\t\t\n\t\tcin >> n >> h; \n\t\t\n\t\tdp[0][0][0][0][0] = 1; \n\t\t\n\t\tfor (int i = 1; i <= n; i++) \n\t\t\t{\n\t\t\t\tint now = i % 2; \n\t\t\t\tmemset(dp[now],0,sizeof(dp[now])); \n\t\t\t\n\t\t\t\tfor (int a = 0; a <= 1; a++) \n\t\t\t\t\tfor (int b = 0; b <= h; b++) \n\t\t\t\t\t\tfor (int c = 0; c <= h; c++) \n\t\t\t\t\t\t\tfor (int d = 0; d <= h; d++) \n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tull val = dp[1 - now][a][b][c][d]; \n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t(dp[now][a][min(b + 1,h)][min(c + 1,h)][min(d + 1,h)] += val) %= MODULO;\n\t\t\t\t\t\t\t\t\t(dp[now][b < h ? 0 : 1][min(c + 1,h)][min(d + 1,h)][a < 1 ? 1 : h] += val) %= MODULO; \n\t\t\t\t\t\t\t\t\t(dp[now][c < h ? 0 : 1][min(d + 1,h)][a < 1 ? 1 : h][min(b + 1,h)] += val) %= MODULO; \n\t\t\t\t\t\t\t\t\t(dp[now][d < h ? 0 : 1][a < 1 ? 1 : h][min(b + 1,h)][min(c + 1,h)] += val) %= MODULO;\n\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t\t\t\t\t\n\t\tint res = 0; \n\t\t\n\t\tfor (int a = 0; a <= 1; a++) \n\t\t\tfor (int b = 0; b <= h; b++) \n\t\t\t\tfor (int c = 0; c <= h; c++) \n\t\t\t\t\tfor (int d = 0; d <= h; d++) \n\t\t\t\t\t\tif (a != 1 || b != h || c != h || d != h)\n\t\t\t\t\t\t\t(res += dp[n % 2][a][b][c][d]) %= MODULO; \n\t\t\t\t\t\t\n\t\tcout << res; \n\t\treturn 0;\n\t}", "lang": "GNU C++11", "bug_code_uid": "d5297a2aafcee97a840a4e73c01de1ad", "src_uid": "9fe9658db35076c0bddc8b7ddce11013", "apr_id": "17a27a175d97fa18646c81b26622574f", "difficulty": 2300, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7008898015058179, "equal_cnt": 6, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "#include\nusing namespace std;\n#define ll long long\n#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);\n#define pb push_back \n#define vbe v.begin(),v.end()\n#define mx *max_element\n#define mi *min_element\n#define fn for(long long int i =0 ;i >w>>h;\n\tll ans = w;\n\tw+=h;\n\th--;\n\tll d1,d2,u1,u2;\n\tcin>>u1>>d1;\n\tcin>>u2>>d2;\n\tif(d2>d1){\n\t swap(d1,d2);\n\t swap(u1,u2);\n\t}\n\t\n\twhile(1){\n\t w+=h;\n\t if(h==d1)break;\n\t \n\t h--;\n\t}\n\tw-=u1;\n\td1--;\n\twhile(1){\n\t w+=d1;\n\t if(d2==d1)break;\n\t \n\t d1--;\n\t}\n\tw-=u2;\n\tif(w<=0)cout<<0;\n\telse\n\tcout<\n#define pii pair\n#define F first\n#define S second\n#define int long long\nusing namespace std;\nconst int MX = 3e5 + 100;\nint v[MX];\nint ans[4][4] = {\n\t{0, 0, 0, 0},\n\t{0, 0, 0, 0},\n\t{0, 0, 0, 4},\n\t{0, 0, 4, 8}\n};\nmain () {\n\tint n, m; cin >> n >> m;\n\tassert(n <= 10 and m <= 10);\n\tif(n <= 3 and m <= 3) return cout << ans[n][m], 0;\n\tif(min(n, m) == 2 and max(n, m) == 7) return cout << 12, 0;\n\tif(min(n, m) == 1 and max(n, m) == 4) return cout << 2 , 0;\n\tint ans = n * m;\n\tif(ans & 1) ans --;\n\treturn cout << ans, 0;\n}", "lang": "GNU C++14", "bug_code_uid": "585313dfa67c186ed48ce8e470e6c2cd", "src_uid": "02ce135a4b276d1e9ba6a4ce37f2fe70", "apr_id": "87961c723dcd94421168ed238ac8d81a", "difficulty": 2200, "tags": ["brute force", "flows", "constructive algorithms", "graph matchings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.48299912816041846, "equal_cnt": 12, "replace_cnt": 11, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 12, "bug_source_code": "#include\nusing namespace std;\n#define BeatMeScanf ios::sync_with_stdio(0)\n#define ll long long\n#define ull unsigned ll\n#define nl \"\\n\"\n#define PI 3.14159265358979323846\n#define sz 1000005\n#define mod 1000000007\n#define toint(a) atoll(a.c_str())\nstring tostr(int n) {stringstream rr;rr<=m) return 0;\n y=m-x;\n x=y%(k1-1);\n y=y/(k1-1);\n if(y>a) x=(y-a)*(k1-1);\n }\n else{\n x=a*(k1-1);\n if(x>=m) return 0;\n y=m-x;\n x=y%(k2-1);\n y=y/(k2-1);\n if(y>b) x=(y-b)*(k2-1);\n }\n return x;\n }\n}\n\nint maximum(int a,int b,int k1,int k2,int m){\n int cnt,y,x;\n if(k1>k2) {cnt=b;x=b*k2;y=m-x;cnt+=y/k1;}\n else {cnt=a;x=a*k1;y=m-x;cnt+=y/k2;}\n return cnt;\n}\n\nint main(){\n BeatMeScanf;\n int a,b,k1,k2,m;\n while(cin>>a>>b>>k1>>k2>>m){\n int mn=minimum(a,b,k1,k2,m);\n int mx=maximum(a,b,k1,k2,m);\n cout<\n#include \n#include \nusing namespace std;\nchar s[55];\nint weight[55];\nint main()\n{\n\tint n, k;\n\tcin >> n >> k;\n\tgetchar();\n\tfor (int i = 0; i < n; i++){\n\t\tcin >> s[i];\n\t\tweight[i] = s[i] - 'a'+1;\n\t}\n\tsort(weight,weight+n);\n\tint i = 0;\n\tint sum = weight[0];\n\tint j = 1;\n\tint cnt = 0;\n\twhile (cnt < k-1){\n\t\tint t = weight[j] - weight[i];\n\t\tif (t < 2){\n\t\t\tj++;\n\t\t}\n\t\telse{\n\t\t\ti = j;\n\t\t\tsum += weight[j];\n\t\t\tcnt++;\n\t\t}\n\t}\n\tif (sum == s[0]){\n\t\tcout << -1 << endl;\n\t}\n\telse{\n\t\tcout << sum << endl;\n\t}\n\treturn 0;\n}", "lang": "MS C++", "bug_code_uid": "4a362ce5cca2f86076fa82ad8a05a955", "src_uid": "56b13d313afef9dc6c6ba2758b5ea313", "apr_id": "f449214ed98269e2a3e02aa2251966d3", "difficulty": 900, "tags": ["greedy", "sortings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5021971123666039, "equal_cnt": 18, "replace_cnt": 16, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 18, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\nint n, m, k;\nvector queen;\nint was[200000], l = 1, r = 0, countt = 1, f = 1;\nint main()\n{\n\t//freopen(\"input.txt\", \"rt\", stdin); freopen(\"output.txt\", \"wt\", stdout);\n\tios_base::sync_with_stdio(false); cin.tie(0);\n\tcin >> n >> m;\n\tif (n >= m)\n\t\tcout << n - m;\n\telse\n\t{\n\t\tqueen.push_back(n);\n\t\twhile (was[m] == 0)\n\t\t{\n\t\t\tint p = queen.size();\n\t\t\tfor (int i = r; i < p; ++i)\n\t\t\t{\n\t\t\t\tif (queen[i] > 0 && was[queen[i] - 1] == 0)\n\t\t\t\t\t\tqueen.push_back(queen[i] - 1);\n\t\t\t\tif (queen[i] * 2 <= m * 2 && was[queen[i] * 2] == 0)\n\t\t\t\t\tqueen.push_back(queen[i] * 2);\n\t\t\t}\n\t\t\tfor (int i = p; i < queen.size(); ++i)\n\t\t\t{\n\t\t\t\tif (was[queen[i]] == 0)\n\t\t\t\t\twas[queen[i]] = l;\n\t\t\t}\n\t\t\tl++;\n\t\t\tr += p;\n\t\t}\n\t\tcout << was[m];\n\t}\n\treturn 0;\n}", "lang": "MS C++", "bug_code_uid": "eff52e9ac36a765dd869a529026e4a32", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "apr_id": "845e49d4ea485ccf6d1d9a1f183ba57f", "difficulty": 1400, "tags": ["dfs and similar", "greedy", "shortest paths", "math", "implementation", "graphs"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9992673992673993, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include\n#define bst ios_base::sync_with_stdio(0);\n#define bug(x) cerr<<#x<<'='<>t;\n while(t--){\n ll n, i, j;\n cin>>n;\n ll limit=sqrt(n), lcm=n-1;\n if(n%2==0){\n cout<\nusing namespace std;\nstring s;\nint dp[5000][5000],n;\nint main()\n{\n\tcin>>n;\n\tcin>>s;\n\tfor(int i=1;i<=n;i++) dp[i][i]=1;\n\tfor(int i=2;i<=n;i++)\n\t{\n\t\tfor(int j=1;j<=n-i+1;j++)\n\t\t{\n\t\t\tdp[j][i+j-1]=1000000;\n\t\t\tfor(int k=j;k\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n \nconst double Pi=acos(-1.0);\ntypedef long long LL;\n \n#define Set(a, s) memset(a, s, sizeof (a))\n#define Rd(r) freopen(r, \"r\", stdin)\n#define Wt(w) freopen(w, \"w\", stdout)\n \nusing namespace std;\n \nconst int maxN=200005;\nconst LL mod=1000000007;\n\nint n, q;\nLL a[maxN], w[maxN];\n\nLL bit[maxN][2];\n\nvoid update (int id, int p, LL v) {\n\tfor (int i=p+1; i>1;\n\t\t\t\tif (query(0, m)-query(0, x-1)<=sum)\n\t\t\t\t\tl=m;\n\t\t\t\telse\n\t\t\t\t\tr=m;\n\t\t\t}\n\t\t\tLL lsw=(((query(0, r-1)-query(0, x-1)+mod)%mod)*a[r])%mod, lsaw=(query(1, r-1)-query(1, x-1)+mod)%mod;\n\t\t\tLL rsw=(((query(0, y)-query(0, r)+mod)%mod)*a[r])%mod, rsaw=(query(1, y)-query(1, r)+mod)%mod;\n\t\t\tLL ans=(lsw-lsaw+rsaw-rsw)%mod;\n\t\t\twhile (ans<0)\n\t\t\t\tans=(ans+mod)%mod;\n\t\t\tprintf(\"%lld\\n\", ans);\n\t\t}\n\t}\n\treturn 0;\n}\n\n", "lang": "GNU C++14", "bug_code_uid": "9eef0dc8e1fca75c2c1914d6c6493621", "src_uid": "c0715f71efa327070eba7e491856d66a", "apr_id": "a433798de94f13230efe8e9586fcf109", "difficulty": 2500, "tags": ["data structures"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.20901246404602108, "equal_cnt": 14, "replace_cnt": 11, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 13, "bug_source_code": "#include \n#include \nusing namespace std;\nint main (){\n\tint y,v,k,x;\n\tint in,in1,co=0;\n\tint k1,k2;\n\tcin>>y>>x;\n\tin=x;\n\tin1=x;\n\tk1=((x/10)/y);k2=((x%10));\n\tk=k1%k2;\n///cout <=y*2){\n\t\tif(in1%10==1)\n\t\t{in1=in1/10;co++;}\n\t\telse {in1=in1/2;co++;}\n\t}\n\t\n\t\n\tif(k==0&& k2 !=0){\n\t\tcout <<\"YES\"<=y*2;i++){\n\t\tif(in%10==1)\n\t\t{in=in/10;m [i]=in;}\n\t\telse {in=in/2;m [i]=in;}\n\t}\n\tsort(m,m+co+1);\n\tfor(int i=0;i<=co;i++)\n\t{cout <\n#include \n#include \n#include \nusing namespace std;\n\n#define rep(i,n) for(int i=0;i>c\n#define va << \" \" <<\n\nint n;\nint * comp;\nvector *befor;\nint t[3][3] = {{0,1,2},{2,0,1},{1,2,0}};\n\nint * can_do(int *solved, int on)\n{\n int *res1 = new int[n];\n rep(i,n) res1[i] = 0;\n\n rep(i,n)\n {\n if (solved[i] == 1 || comp[i] != on) continue;\n bool f = true;\n for(int j=0;j[n];\n rep(i,n)\n {\n int k;\n rd(k);\n comp[i] = k - 1;\n }\n rep(i,n)\n {\n int k;\n rd(k);\n rep(j,k)\n {\n int c;\n rd(c);\n befor[i].push_back(c-1);\n }\n }\n\n int *solved = new int[n];\n rep(i,n) solved[i] = 0;\n int min_t = 32000;\n rep(i,3)\n {\n int *can = can_do(solved,i);\n int c = 0;\n rep(j,n) if (can[j] == 1) c++;\n if (c==0) continue;\n\n int *n_solved = new int[n];\n rep(j,n) n_solved[j] = 0;\n rep(j,n) if (solved[j] == 1 || can[j] == 1) n_solved[j] = 1;\n int tt = do_best(n_solved,i) + c;\n if (tt < min_t) min_t = tt;\n delete[] n_solved;\n delete[] can;\n }\n\n wl(min_t);\n}\n", "lang": "GNU C++", "bug_code_uid": "eac748b4335672198f7679113f30f22c", "src_uid": "be42e213ff43e303e475d77a9560367f", "apr_id": "f71d42c404e8d858cb4e9a7e3372edda", "difficulty": 1700, "tags": ["brute force", "greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.12296564195298372, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n\nusing namespace std;\nchar str[12][12];\nint vis[12];\nint n,m;\nint num;\n\nint dfs(int a,int s)\n{\n for(int i=0;i> n >> m )\n {\n num=0;\n if(n==-1&&m==-1) break;\n memset(vis,0,sizeof(vis));\n for(int i=0;i>str[i];\n for(int i=0;i<=n-m;i++)\n dfs(i,m);\n cout << num << endl;\n }\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "a902df3e3483ee0c0ca2ec2f47a90c8b", "src_uid": "12d451eb1b401a8f426287c4c6909e4b", "apr_id": "596137b2e24732b6af70ab3e8d7d9e82", "difficulty": 1300, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9986945169712794, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "//In the name of Allah\n\n#include \nusing namespace std;\n\ntypedef long long ll;\ntypedef pair pii;\n\nconst int N = 2e5+10 , MOD = 1e9+9;\nconst ll inf = 1e16 + 10;\n\npair a[N] , b[N];\nbool mark[N];\nvector v;\n\nint32_t main()\n{\n ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);\n int n , k;\n ll ans = inf , sum = 0;\n cin >> n >> k;\n if(k > n){\n cout << 0;\n return 0;\n }\n for(int i=1 ; i<=n ; i++){\n cin >> a[i].first.first >> a[i].first.second;\n a[i].second = i;\n b[i].first.second = a[i].first.first;\n b[i].first.first = a[i].first.second;\n b[i].second = i;\n }\n sort(a+1 , a+n+1);\n sort(b+1 , b+n+1);\n int point = a[n-k].first.first;\n if(point + 2 <= n){\n for(int i=1 ; i<=point + 2 ; i++)\n sum += b[i].first.first;\n ans = sum;\n }\n sum = 0;\n if(point + 1 <= n){\n int cnt = 0 , t = 0;\n for(int i=n ; i>=1 ; i--)\n if(a[i].first.first > point + 1)\n cnt++;\n else if(a[i].first.first >= point)\n v.push_back({a[i].first.second , a[i].second});\n else\n break;\n sort(v.begin() , v.end());\n for(int i=v.size()-(k-1-cnt)-1 ; i>=0 ; i--)\n sum += v[i].first , mark[v[i].second] = true , t++;\n for(int i=1 ; i<=n && t < point + 1 ; i++)\n if(!mark[b[i].second])\n sum += b[i].first.first , t++;\n ans = min(ans , sum);\n }\n sum = 0;\n v.clear();\n memset(mark , 0 , sizeof(mark));\n if(point <= n){\n int cnt = 0 , t = 0;\n for(int i=n ; i>=1 ; i--)\n if(a[i].first.first > point)\n cnt++;\n else if(a[i].first.first == point)\n v.push_back({a[i].first.second , a[i].second});\n else\n break;\n sort(v.begin() , v.end());\n for(int i=v.size()-(k-1-cnt)-1 ; i>=0 ; i--)\n sum += v[i].first , mark[v[i].second] = true , t++;\n for(int i=1 ; i<=n && t < point ; i++)\n if(!mark[b[i].second])\n sum += b[i].first.first , t++;\n ans = min(ans , sum);\n }\n if(ans == inf)\n cout << -1;\n else\n cout << ans;\n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "42125dc79944812b2047cbbaf52b9e62", "src_uid": "19a098cef100fc3652c59abf7c373814", "apr_id": "0312233517f50984cc097a1dbef5afb9", "difficulty": null, "tags": ["brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9864325618515563, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include \n#include \n#include \n#include \n#include \nusing namespace std;\n#define FORAB(i,a,b) for(int i = a; i < b ; i ++) \n#define FORN(i,n) for(int i = 0; i < n ; i ++) \n#define ll long long\n#define pb push_back\ntypedef pair pii;\n#define lim 100010/2\n\nint main() {\n\n\tint n,m;\n\tcin>>n>>m;\n\tint sum,old_sum=0,flag = 0;\n\twhile(1){\n\t\tFORAB(i,1,n+1){\n\t\t\tsum = (i * (i+1)) / 2;\n\t\t\tif(sum <= m){\n\t\t\t\told_sum = sum;\n\t\t\t}\n\t\t\telse if(sum > m){\n\t\t\t\tflag=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\tif(flag==0)\n\tm -= sum;\n\telse break;\n\t}\n\t\tcout<\n#include \n\n#include \n#include \n#include \n#include \n\n#include \n#include \n\n#include \n#include \n\n#include \n#include \n#include \n\ntypedef long long ll;\ntypedef unsigned long long ull;\n\n#define fname \"\"\n#define problemName \"\"\n#define ios_ssync ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);\n\n#define pb push_back\n#define pop pop_back\n\n#define F first\n#define S second\n \n#define sqr(x) x * 1ll * x\n#define cb(x) sqr(x) * 1ll * x\n\n#define pii pair \n#define pll pair \n\n#define size(x) x.size()\n#define all(x) x.begin(), x.end()\n#define show(x) cerr << #x << \" = \" << x << \", \"\n#define showln(x) cerr << #x << \" = \" << x << endl\n\nusing namespace std;\n\nvoid freeopen() {\n\t#ifndef ONLINE_JUDGE\n\tfreopen(fname\".in\", \"r\", stdin);\n\tfreopen(fname\".out\", \"w\", stdout);\n\t#else\n\tfreopen(fname\".in\", \"r\", stdin);\n\tfreopen(fname\".out\", \"w\", stdout);\n\t#endif\n}\n\nconst int D = 1e6 + 1;\nconst int inf = (int) (1u << 31) - 1u;\nconst ll INF = (ll) (1ull << 63) - 1ull; \nconst int N = 1e5 + 1;\nconst int E = 1e3 + 1;\nconst int edge = 1e9 + 9LL;\nconst int mod = 1e9 + 7ll;\n\nconst int dx[] = {+1, -1, 0, 0};\nconst int dy[] = {0, 0, +1, -1};\n\nint main() {\n\t///freeopen();\n\tios_ssync;\n\tint n;\n\tscanf(\"%d\", &n);\n\tstring s;\n\tcin >> s;\n\tfor (int i = 0; i < size(s) - 1; i++) \n\t\tif (s[i] == 'U' && s[i + 1] == 'R' || s[i] == 'R' && s[i + 1] == 'U') {\n\t\t\ts[i] = 'd';\n\t\t\ts[i + 1] = 'd';\n\t\t}\n\tint cnt = 0;\n\tint num = 0;\n\tfor (int i = 0; i < size(s); i++) {\n\t\tif (s[i] == 'd') \n\t\t\tcnt++;\n\t\telse num++;\n\t}\n\tprintf(\"%d\", (cnt >> 1) + num);\n\treturn 0;\n}\n\n ", "lang": "GNU C++14", "bug_code_uid": "10cc24370ded7fedf58a6303ba35feb7", "src_uid": "986ae418ce82435badadb0bd5588f45b", "apr_id": "a1b94c8c31496a9d044f853398910b68", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.4666666666666667, "equal_cnt": 5, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "#include\n#include\n#include\nusing namespace std;\n\nint main(){\n int x,y,z;\n while(cin>>x>>y>>z){\n if(x>y){\n if(x<=y+z) cout<<\"?\"<<'\\n';\n else cout<<\"+\"<<'\\n';\n } else if(x=y) cout<<\"?\"<<'\\n';\n else cout<<\"-\"<<'\\n';\n } else {\n if(x+z==y) cout<<\"?\"<<'\\n';\n else cout<<\"0\"<<'\\n';\n }\n }\n}\n", "lang": "GNU C++11", "bug_code_uid": "43ea6bf19d5aa71ef85a0ee0eaf1764e", "src_uid": "66398694a4a142b4a4e709d059aca0fa", "apr_id": "cb717ccfb5418d755e5328168b8b34ed", "difficulty": 800, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7500753693096172, "equal_cnt": 14, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 14, "bug_source_code": "\n//\"\u0628\u0633\u0645 \u0627\u0644\u0644\u0647 \u0627\u0644\u0631\u062d\u0645\u0646 \u0627\u0644\u0631\u062d\u064a\u0645\" \n\n//\"\u0648\u0623\u0645\u0627 \u0645\u0646 \u0627\u0645\u0646 \u0648\u0639\u0645\u0644 \u0635\u0627\u0644\u062d\u0627 \u0641\u0644\u0647 \u062c\u0632\u0627\u0621 \u0627\u0644\u062d\u0633\u0646\u0649 \u0648\u0633\u0646\u0642\u0648\u0644 \u0644\u0647 \u0645\u0646 \u0627\u0645\u0631\u0646\u0627 \u064a\u0633\u0631\u0627\"\n\n\t\t //\"tomorrow never will be like today........\"\n\n//\"Go and try to hack me you are a loooooooser anyway huh *_*........\"\n\n\n\n#include \n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n\n\n#define loop(n) for(int i=0;i>arr[i];}\n#define PII pair\n#define PLL pair\n#define PIS pair\n#define pb(a) push_back(a)\n#define veci vector\n#define vecl vector\n#define vecs vector\n\nusing namespace std;\n\ntypedef long long ll;\ntypedef string str;\ntypedef double db;\ntypedef float fl;\ntypedef int i;\n\n\n\nmap mp;\nstack st;\nint arr[101];\nint vis[101];\nint t;\nint solve(int i)\n{\n\tif (vis[i - 1] && i == t)\n\t\treturn 0;\n\tif (vis[i - 1] && i != t)\n\t\treturn -1;\n\n\tvis[i - 1]++;\n\tint x = solve(arr[i - 1]);\n\tif (x == -1)\n\t\treturn -1;\n\telse\n\t\treturn 1 + x;\n\t\n}\nint main()\n{\n\n\tint n;\n\tcin >> n;\n\tloop(n)\n\t{\n\t\tcin >> arr[i];\n\t}\n\tveci ans;\n\tloop(n)\n\t{\n\t\t\n\t\tif (!vis[i - 1])\n\t\t{\n\t\t\tt = i+1;\n\t\t\tint x = solve(i+1);\n\t\t\tif (x == -1)\n\t\t\t{\n\t\t\t\tcout << -1 << endl;\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tif (x % 2 == 0)\n\t\t\t\tx /= 2;\n\t\t\tans.pb(x);\n\t\t}\n\n\t}\n\n\tsort(ans.begin(), ans.end());\n\tfor (int j = ans.size() - 2; j >= 0; j--)\n\t{\n\t\tif (ans[ans.size() - 1] % ans[j] != 0)\n\t\t{\n\t\t\tcout << -1 << endl;\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\tcout << ans[ans.size() - 1] << endl;\n\n\t\n\t\n\n\t\n\t\n\n\n\t\n\t\n\n\t\n\t\n\t\n\n\n\n\t\t\n\n\n\n\t\n\n\n\t\n}", "lang": "MS C++ 2017", "bug_code_uid": "45cef8676f8cbfbe7fbe41fe619d5b10", "src_uid": "149221131a978298ac56b58438df46c9", "apr_id": "ab55013d744bd6413e3876546ce34e2f", "difficulty": 1600, "tags": ["math", "dfs and similar"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8773222785198833, "equal_cnt": 18, "replace_cnt": 7, "delete_cnt": 4, "insert_cnt": 6, "fix_ops_cnt": 17, "bug_source_code": "#include\nusing namespace std;\nconst int MAXN = 3e2+5;\nconst int INF = 2e9;\nconst int MOD = 1e9+7;\nint edge = 0, A[MAXN], B[MAXN];\nvector graph[MAXN], comp, path;\nbool used[MAXN], suse[MAXN];\nvector< pair< pair,int > > RES;\n\nvoid dfs(int v, int &addTo){\n addTo += A[v] - B[v];\n used[v] = true;\n\n for(int i=0;i B[comp[jj]])\n BEG = comp[jj], END = comp[ii], AMOUNT = min(B[comp[ii]] - A[comp[ii]], A[comp[jj]] - B[comp[jj]]);\n\n else if(A[comp[ii]] > B[comp[ii]] && A[comp[jj]] < B[comp[jj]])\n BEG = comp[ii], END = comp[jj], AMOUNT = min(A[comp[ii]] - B[comp[ii]], B[comp[jj]] - A[comp[jj]]);\n\n if(BEG == 0 && END == 0) continue;\n memset(suse,false,sizeof(suse));\n path.clear();\n\n //printf(\"%i %i\\n\",BEG,END);\n get_path(BEG,END);\n reverse(path.begin(),path.end());\n\n\n //printf(\"Third stage successfully completed.\\n\");\n\n bring(0,AMOUNT);\n\n //printf(\"Fourth stage successfully completed.\\n\");\n }\n }\n\n printf(\"%i\\n\",RES.size());\n for(int i=0;i\n#include \n#include \nconst int xxx=1e9+7;\nusing namespace std;\nlong long save[100000000];\nint cnt=0;\nint main()\n{\n long long a,b,n,x;\n cin>>a>>b>>n>>x;\n long long ans;\n save[1]=(((a%xxx)*(x%xxx))%xxx+b)%xxx;\n ans=save[1];\n cnt=1;\n for(int i=2;i<=n;i++)\n {\n ans=((a*ans)%xxx+b)%xxx;\n if(ans==save[1]) {break;}\n else\n {\n save[++cnt]=ans;\n }\n }\n save[0]=ans;\n cout<\nusing namespace std;\nlong long int phi(long long int n)\n{ \n long long int result = n; // Initialize result as n\n \n // Consider all prime factors of n and subtract their\n // multiples from result\n for (long long int p=2; p*p<=n; ++p)\n {\n // Check if p is a prime factor.\n if (n % p == 0)\n {\n // If yes, then update n and result \n while (n % p == 0)\n n /= p;\n result -= result / p;\n }\n }\n \n // If n has a prime factor greater than sqrt(n)\n // (There can be at-most one such prime factor)\n if (n > 1)\n result -= result / n;\n return result;\n}\nint main() {\n\tlong long long long int n,k;\n\tscanf(\"%lld %lld\",&n,&k);\n\tk = ceil(k/2.0);\n\tlong long long long int result = n;\n\twhile(k--)\n\t{\n\t\tresult = phi(result);\n\t}\n\tprintf(\"%lld\",result%1000000007);\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "df2c9d54fdeeb337cfa5447825b2d0c9", "src_uid": "0591ade5f9a69afcbecd80402493f975", "apr_id": "8f888ddd3472c78f494a2fbcefb9f78b", "difficulty": 2100, "tags": ["math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.5576811594202898, "equal_cnt": 14, "replace_cnt": 7, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 14, "bug_source_code": "///*Bismillahir Rahmanir Rahim***///\n///**Author Thasin Sheikh**///\n/* #include \n ...\n std::string string(\"hello $name\");\n string = std::regex_replace(string, std::regex(\"\\\\$name\"), \"Somename\");\n */\n/*while(a)\n {\n if(a%2==0)\n dvi.push_back(0);\n else\n dvi.push_back(1);\n a/=2;\n }\n reverse(dvi.begin(),dvi.end());*/\n#include\nusing namespace std;\n#define MAX 35000\n#define makefast__ ios_base::sync_with_stdio(false);\nusing ll=long long int ;\nusing dl =double;\nbool fk[100000];\nll aarray[300000+10];\nchar magic[1][100000];\nconst int N = 2e5 + 10;\nbool primes[1000000];\nint main()\n{\n makefast__\n string str,ptr;\n //freopen(\"input.txt\",\"r\",stdin);\n //freopen(\"output.txt\",\"w\",stdout);\n ll n,a,b,ans=0,i,l=0,A,B,C,D,E,cst,c,cd,d,j,k,x0,R,G;\n ll r,g;\n vectorv;\n memset(primes,true,sizeof(primes));\n primes[0]=primes[1]=false;\n for(i=2;i<=100000;i++)\n {\n if(primes[i])\n {\n for(j=i*2;j<=100000;j+=i)\n primes[j]=false;\n }\n }\n cin>>n;\n ans+=n;\n while(n%2==0)\n {\n n/=2;\n ans+=n;\n }\n //cout<\n#include\n#include\n#include\n\nusing namespace std;\n\nbool m[1000000000];\nint ex1[100000];\nint ex2[100000];\nlong long a,b,aa,bb;\nint exa,exb;\nbool igual=true;\nint ope=0;\n\nvoid criba(bool m[], int tam){\n m[0] = false;\n m[1] = false;\n for(int i = 2; i <= tam; ++i)\n m[i] = true;\n\n for(int i = 2; i*i <= tam; ++i) {\n if(m[i]) {\n for(int h = 2; i*h <= tam; ++h)\n m[i*h] = false;\n }\n }\n}\n\n\nint main(){\n\ncin>>a>>b;\naa=a;\nbb=b;\ncriba(m,a);\nfor(int i=1;i<=sqrt(a);i++){\n if(m[i]){\n while(a%i==0){\n exa++;\n a=a/i;\n }\n }\n ex1[i]=exa;\n exa=0;\n \n}\n\n if(m[aa]==1){\n igual=false;\n }\ncriba(m,b);\nfor(int i=1;i<=sqrt(b);i++){\n if(m[i]){\n while(b%i==0){\n exb++;\n b=b/i;\n }\n }\n ex2[i]=exb;\n exb=0;\n \n \n}\n\nif(m[bb]==1){\nigual=false;\n}\n\nlong long mayor=max(sqrt(aa),sqrt(bb));\n\nfor(int i=1;i<=mayor;i++){\n ope+=abs(ex1[i]-ex2[i]);\n \n if(i>=7&& (ex1[i]!= ex2[i])){\n igual=false;\n }\n}\n\nif(aa==bb)\ncout<<0;\nelse {\n if(!igual){\n cout<<-1;\n }\n else{\n cout<\n\n\nusing namespace std;\n\nint main()\n{\n int n;\n cin >> n;\n vector < int > a,b;\n a.reserve(6);\n b.reserve(6);\n for(int i = 0; i < n; ++i){\n int t;\n cin >> t;\n a[t]++;\n }\n for(int i = 0; i < n; ++i){\n int t;\n cin >> t;\n b[t]++;\n }\n int rs,rs1;\n rs = 0;\n rs1 = 0;\n for(int i = 1; i < 6; ++i){\n if(((a[i] + b[i]) % 2) == 0){\n int m = (a[i] + b[i]) / 2;\n rs += abs(a[i] - m);\n rs1 += abs(b[i] - m);\n } else {\n cout << -1;\n exit(1);\n }\n }\n if(rs == rs1){\n cout << rs / 2;;\n } else {\n cout << -1;\n }\n}\n", "lang": "GNU C++14", "bug_code_uid": "07a4d5f3c1477ff3dc7b54e5af43342d", "src_uid": "47da1dd95cd015acb8c7fd6ae5ec22a3", "apr_id": "f440054d879f98a45ad9f54eb92aff9e", "difficulty": 1000, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.8248050218755945, "equal_cnt": 27, "replace_cnt": 16, "delete_cnt": 5, "insert_cnt": 6, "fix_ops_cnt": 27, "bug_source_code": "#include \n#define ll long long\n#define ff first\n#define ss second\n#define pb push_back\n#define MOD 1000000007\n#define MAXN 1000000001\n#define edl '\\n'\n#define IOFAST ios::sync_with_stdio(false);cin.tie(0); cout.tie(0);\n#define PI 3.14159265\nusing namespace std;\n \n \nvector SieveOfEratosthenes(ll n) \n{ \n vector res;\n bool prime[n+1]; \n memset(prime, true, sizeof(prime)); \n \n for (ll p=2; p*p<=n; p++) \n { \n if (prime[p] == true) \n { \n for (ll i=p*p; i<=n; i += p) \n prime[i] = false; \n } \n } \n \n for (ll p=2; p<=n; p++) \n if (prime[p]) \n res.pb(p);\n return res; \n} \nvector primeFactors(ll n) \n{ \n vector hash; \n while (n % 2 == 0) \n { \n hash.pb(2); \n n = n/2; \n } \n for (ll i = 3; i <= sqrt(n); i = i + 2) \n { \n while (n % i == 0) \n { \n hash.pb(i);\n n = n/i; \n } \n } \n if (n > 2) \n hash.pb(n);\n return hash; \n} \n \nunordered_map myhash;\nvector < vector > vis(5000001, vector (7,false));\nvoid minpos( ll mask, ll idx, vector primes, ll &ans)\n{\n\tll t = mask;\n\t//cout<= 6)return;\n\tif(vis[mask][idx])return;\n\tll m = primes.size();\n\t//cout< dig(m, 0); ll cnt = 0;\n\twhile(cnt < m)\n\t{\n\t\tif(t%10 == 0)full = false;\n\t\tdig[cnt] = t%10; cnt++;\n\t\tt = t/10;\n \n\t\t//cout<<\"***\";\n\t}\n\t//cout< eachid(6,1);\n\t\tfor(ll i =0; i < dig.size(); i++)\n\t\t{\n\t\t\teachid[dig[i]] *= primes[i];\n\t\t}\n\t\tll temp = 1;\n\t\tfor(ll i = 1; i <= 5; i++)\n\t\t{\n\t\t\t//cout< 0)ans = min(ans, temp);\n\t\tvis[mask][idx] = true;\n\t\treturn;\n\t}\n\tfor(ll i = 0; i < primes.size(); i++)\n\t{\n\t\tif(dig[i] == 0)\n\t\t{\n\t\t\tll newmask = mask;\n\t\t\tnewmask += pow(10,i)*idx;\n\t\t\tminpos(newmask, idx, primes, ans);\n\t\t\tminpos(newmask, idx + 1, primes, ans);\n\t\t}\n\t}\n\tvis[mask][idx] = true;\n\treturn;\n}\nvoid solve()\n{\n\tll n;\n\tcin>>n;\n\tmyhash[1] = 2; myhash[2] = 3; myhash[3] = 5; myhash[4] = 7; myhash[5] = 11;\n\tll ans = LLONG_MAX;\n\tvector primes = primeFactors(n);\n\tint add2 =0;\n\twhile(primes.size() > 6)\n\t{\n\t\tprimes.erase(primes.begin());\n\t\tadd2++;\n\t}\n\tminpos(0,1, primes, ans);\n\tint cnt2 = 0, cnt3 = 0;\n\tll temp = ans; \n\twhile(temp % 2 == 0)\n\t{\n\t\ttemp = temp/2;\n\t\tcnt2++;\n\t}\n\tans = (ll)pow(2, cnt2 + add2)*temp;\n\twhile(temp % 3 == 0)\n\t{\n\t\ttemp = temp/3;\n\t\tcnt3++;\n\t}\n\tif(add2 > 1)ans = min(ans, (ll)pow(2, cnt2 + add2 - 1)*temp*(ll)pow(3, cnt3 + 1));\n\tcout<\nusing namespace std;\nint main()\n{\n int n,m,x1,y1,x2,y2;\n cin>>n>>m>>x1>>y1>>x2>>y2;\n int mmp = abs(x1-x2);\n int mmq = abs(y1-y2);\n if(mmp>4||mmq>4)\n return cout<<\"Second\";\n if(mmp==4&&mmq==4)\n return cout<<\"Second\";\n if(mmp==3&&mmq==4||mmp==4&&mmq==3)\n return cout<<\"Second\";\n return cout<<\"First\";\n}\n", "lang": "GNU C++17", "bug_code_uid": "9526182d6215ae01ecade9477db13210", "src_uid": "41f6f90b7307d2383495441114fa8ea2", "apr_id": "80a6a79df79a355982c17efacd18a736", "difficulty": 2000, "tags": ["combinatorics", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9527896995708155, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include\nusing namespace std;\n#define ll long long int\n\nint main(){\n ll n;\n cin>>n;\n ll a[10];\n char ch[10] = {'c', 'o', 'd', 'e', 'f', 'o', 'r', 'c', 'e', 's'};\n for(int i=0;i<10;i++){\n a[i]= 1;\n }\n ll turn = 0, f=0;\n while(1){\n turn++;\n for(int i=1;i<=10;i++){\n a[i-1]++;\n ll prod = 1;\n for(int j=0;j<10;j++){\n prod*=a[j];\n }\n if(prod>=n){\n f=1;break;\n }\n }\n if(f==1)break;\n }\n for(ll i=0;i<10;i++){\n for(ll j=0;j\n#include\n#include\n#include\n#include\n#include\n#define ll long long \n#define ld long double\n#define pb push_back\n#define rep(i,n) for(i=0;i>a>>b;\n x= a+b;\n string str= to_string(a);\n string str1= to_string(b);\n string str2= to_string(x);\n str.assign(zeroes(str));\n stringstream geek(str);\n ll p=0;\n geek>> p;\n str1.assign(zeroes(str1));\n stringstream geek1(str1);\n ll q=0;\n geek1>> q;\n ll d= p+q;\n str2.assign(zeroes(str2));\n stringstream geek2(str2);\n ll r=0;\n geek2>> r;\n if (d==r)\n cout<<\"YES\"<\n#pragma GCC optimize(3)\n#pragma GCC target(\"avx\")\n#pragma GCC optimize(\"Ofast\")\n#pragma GCC optimize(\"inline\")\n#pragma GCC optimize(\"-fgcse\")\n#pragma GCC optimize(\"-fgcse-lm\")\n#pragma GCC optimize(\"-fipa-sra\")\n#pragma GCC optimize(\"-ftree-pre\")\n#pragma GCC optimize(\"-ftree-vrp\")\n#pragma GCC optimize(\"-fpeephole2\")\n#pragma GCC optimize(\"-ffast-math\")\n#pragma GCC optimize(\"-fsched-spec\")\n#pragma GCC optimize(\"unroll-loops\")\n#pragma GCC optimize(\"-falign-jumps\")\n#pragma GCC optimize(\"-falign-loops\")\n#pragma GCC optimize(\"-falign-labels\")\n#pragma GCC optimize(\"-fdevirtualize\")\n#pragma GCC optimize(\"-fcaller-saves\")\n#pragma GCC optimize(\"-fcrossjumping\")\n#pragma GCC optimize(\"-fthread-jumps\")\n#pragma GCC optimize(\"-funroll-loops\")\n#pragma GCC optimize(\"-freorder-blocks\")\n#pragma GCC optimize(\"-fschedule-insns\")\n#pragma GCC optimize(\"inline-functions\")\n#pragma GCC optimize(\"-ftree-tail-merge\")\n#pragma GCC optimize(\"-fschedule-insns2\")\n#pragma GCC optimize(\"-fstrict-aliasing\")\n#pragma GCC optimize(\"-fstrict-overflow\")\n#pragma GCC optimize(\"-falign-functions\")\n#pragma GCC optimize(\"-fcse-follow-jumps\")\n#pragma GCC optimize(\"-fsched-interblock\")\n#pragma GCC optimize(\"-fpartial-inlining\")\n#pragma GCC optimize(\"no-stack-protector\")\n#pragma GCC optimize(\"-freorder-functions\")\n#pragma GCC optimize(\"-findirect-inlining\")\n#pragma GCC optimize(\"-fhoist-adjacent-loads\")\n#pragma GCC optimize(\"-frerun-cse-after-loop\")\n#pragma GCC optimize(\"inline-small-functions\")\n#pragma GCC optimize(\"-finline-small-functions\")\n#pragma GCC optimize(\"-ftree-switch-conversion\")\n#pragma GCC optimize(\"-foptimize-sibling-calls\")\n#pragma GCC optimize(\"-fexpensive-optimizations\")\n#pragma GCC optimize(\"inline-functions-called-once\")\n#pragma GCC optimize(\"-fdelete-null-pointer-checks\")\nusing namespace std;\n#define PII pair\n#define MP make_pair\n#define A b * 1.0 * (1.0 - dfs(b - 1, a)) / (b * 1.0 + 1.0)\n#define B 1\n#define C (1.0 + 1.0 * b * (1.0 - dfs(b - 1, a))) / (b * 1.0 + 1.0)\n#define D (1.0 - dfs(b, a - 1))\n#define P (D - B) / (A - B - C + D)\nmap m;\ninline double dfs(int a, int b)\n{\n\tif (b == 0)\n\t{\n\t\treturn 1.0;\n\t}\n\tif (a == 0)\n\t{\n\t\treturn 1.0 / (1.0 * b + 1.0);\n\t}\n\tif (m.count(MP(a, b)))\n\t{\n\t\treturn m[MP(a, b)];\n\t}\n\tdouble ans = P * A + (1.0 - P) * B;\n\tm.insert(MP(a, b), ans);\n\treturn ans;\n}\nint read()\n{\n\tint num = 0, bj = 0;\n\tchar ch = getchar();\n\twhile (!isdigit(ch))\n\t{\n\t\tif (ch == '-')\n\t\t{\n\t\t\tbj = 1;\n\t\t}\n\t\tch = getchar();\n\t}\n\twhile (isdigit(ch))\n\t{\n\t\tnum = num * 10 + ch - '0';\n\t\tch = getchar();\n\t}\n\treturn bj ? -num : num;\n}\nint main()\n{\n\tint a, b;\n\ta = read();\n\tb = read();\n\tdouble ans = dfs(a, b);\n\tprintf(\"%.9lf %.9lf\", ans, 1.0 - ans);\n}", "lang": "GNU C++11", "bug_code_uid": "4bb8b9523bf733895f274e82979d0786", "src_uid": "f51586ab88399c04ffb7eaa658d294dd", "apr_id": "8f8408f604db220a63be5c75aff6bd31", "difficulty": 2700, "tags": ["math", "dp", "games", "probabilities"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9675870348139256, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \n#include \nusing namespace std;\n#define pb push_back\n#define vs vector\n#define vvs vector>\n#define ll long long\n#define vi vector\n#define vvi vector>\n#define pii pair\n#define fu(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 sl(s) s.length()\n#define vl(v) v.size() \n#define pv(v) for(int i=0;i>s;\n\tfor(int i=0;i\n#define lld long long int\n#define vec vector\n#define pll pair\n#define pb push_back\n#define ss second\n#define ff first\n#define mp make_pair\n#define MOD 1000000007\n#define answer cout<= 0; i--) {\n res = res * res % MOD;\n if (k & (1 << i))\n res = res * x % MOD;\n }\n return res;\n}\nlld rev(lld x) {\n return pw(x, MOD - 2);\n}\n\nint main() {\n messi //lld t=0;cin>>t;while(t--){\n\tlld n, k, r = 0;\n cin >> n >> k;\n if (k == 1) {\n cout << 0;\n return 0;\n }\n f[0] = rf[0] = 1;\n for (int i = 1; i <= n; i++) {\n f[i] = f[i - 1] * i % MOD;\n rf[i] = rev(f[i]);\n }\n rep(i, n)\n cin >> a[i];\n rep(i, n)\n if (a[i] != a[(i + 1) % n])\n r++;\n lld ans = 0, cc;\n for (int i = 0; 2 * i <= r; i++) {\n ans = (ans + f[r] % MOD * rf[i] % MOD * rf[i] % MOD * rf[r - 2 * i] % MOD * pw(k - 2, r - 2 * i) % MOD) % MOD;\n }\n //answer\n cout << ((pw(k, r) + MOD - ans) % MOD * rf[2] % MOD) * pw(k, n - r) % MOD<\n\n#define f first\n#define s second\n\nusing namespace std;\nusing li = long long;\nusing ld = long double;\nusing pii = pair;\n\nconst int N = 1e5 + 13;\nconst int INF = 1e9;\nconst int MAXA = 100011;\nconst int MAXB = 32;\n\n\n/*\n0 - ?\n1 - win\n2 - draw\n3 - lost\n*/\nint dp[MAXA][MAXB];\nvector g[MAXA][MAXB];\n\nvoid dfs(int a, int b) {\n if(dp[a][b] != 0)\n return;\n \n int mx = 1;\n for(auto p : g[a][b]) {\n dfs(p.f, p.s);\n \n mx = max(mx, dp[p.f][p.s]);\n }\n \n dp[a][b] = 4 - mx;\n //cout << a << ' ' << b << ' ' << dp[a][b] << endl;\n}\n\nint main() {\n// ios_base::sync_with_stdio(0);\n// cin.tie(0);\n \n int a, b, n;\n cin >> a >> b >> n;\n \n dp[1][MAXB - 1] = 2;\n dp[MAXA - 1][1] = ((n - MAXA + 1) % 2 != 0 ? 1 : 3);\n \n for(int i = 0; i < MAXA; i++) {\n for(int j = 0; j < MAXB; j++) {\n //dp[i][j] = 0;\n li pw = 1;\n for(int l = 0; l < j; l++) {\n pw *= i;\n if(pw >= n) {\n dp[i][j] = 1;\n break;\n }\n }\n \n if(i < MAXA - 1) {\n g[i][j].emplace_back(i + 1, j);\n }\n \n if(j < MAXB - 1) {\n g[i][j].emplace_back(i, j + 1);\n }\n }\n }\n \n //cout << dp[1][31] << endl;\n \n dfs(a, b);\n \n if(dp[a][b] == 3)\n cout << \"Stas\";\n else if(dp[a][b] == 1)\n cout << \"Masha\";\n else\n cout << \"Missing\";\n}\n", "lang": "GNU C++17", "bug_code_uid": "25cfc0d4ab488ce0cdc5c54b5904dacb", "src_uid": "cffd5c0b7b659649f3bf9f2dbd20ad6b", "apr_id": "f58c54299963b0190c74de0fb16d7643", "difficulty": 2000, "tags": ["dp", "games"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.8110599078341014, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "#include \nint main()\n{\n int a,b;\n std::cin>>a>>b;\n return a*b/2;\n return 0;\n}", "lang": "MS C++", "bug_code_uid": "98fefdd012f92b037ad32c97627f29ee", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "apr_id": "a975641e15bfbcab9d64f71d5791112e", "difficulty": 800, "tags": ["math", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.62248824283882, "equal_cnt": 17, "replace_cnt": 11, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 17, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n#define mp make_pair\n#define pb push_back\n#define F first\n#define S second\n\ntypedef pair ii;\ntypedef long long ll;\n\nint n, c;\n\n#define MOD 1000003\n\n\nll power(ll x, ll y)\n{\n if (y == 0)\n return 1;\n ll p = power(x, y/2) % MOD;\n p = (p * p) % MOD;\n \n return (y%2 == 0)? p : (x * p) % MOD;\n}\n\nll inverse(ll x)\n{\n return power(x, MOD-2);\n}\n\n\n// factorial of n modulo MOD\nll modfact(ll n) {\n ll result = 1;\n while (n > 1) {\n result = (result * n) % MOD;\n n--;\n }\n return result;\n}\n\n// multiply a and b modulo MOD\nll modmult(ll a, ll b) {\n return (a * b) % MOD;\n}\n\n// binomial coefficient nCk modulo MOD\nll bc(ll n, ll k)\n{\n return modmult(modmult(modfact(n), inverse(modfact(k))), inverse(modfact(n - k)));\n}\n\nint main()\n{\n cin >> n >> c;\n \n ll res = 0;\n for (int i=1; i<=n; i++)\n res = (res + bc(c+i-1, c-1)) % MOD;\n \n cout << res << endl;\n \n return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "656b9a07069259ded879835741f4cdb4", "src_uid": "e63c70a9c96a94bce99618f2e695f83a", "apr_id": "89133bf75ee89accb99d6459b1f35af3", "difficulty": 1800, "tags": ["combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8531663187195546, "equal_cnt": 11, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 7, "fix_ops_cnt": 11, "bug_source_code": "#include \nusing namespace std;\n\nint main() {\n int n, l, r, minimum = 1, maximum = 1, x = 1, y = 1;\n cin >> n >> l >> r;\n if (n == r && n == l) {\n minimum = l;\n maximum = r;\n cout << minimum << \" \" << maximum;\n } else {\n for (int i = 1; i < l; i++) {\n x *= 2;\n minimum += (x);\n }\n cout << minimum + (n - l) << \" \";\n vector myVector;\n for (int i = 1; i < r; i++) {\n y *= 2;\n maximum += (y);\n myVector.push_back(y);\n }\n cout << maximum + ((n - r) * (myVector[myVector.size() - 1]));\n }\n}", "lang": "GNU C++14", "bug_code_uid": "ab18e219e1ba224c66c7422d5f6835ed", "src_uid": "ce220726392fb0cacf0ec44a7490084a", "apr_id": "df49674c19250533069a06de0a9be434", "difficulty": 900, "tags": ["math", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9832976445396145, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include \n#include \nusing namespace std;\n\nlong long cube(int c) {\n\treturn c*1LL*c*c;\n}\n\nlong long getBiggestCube(long long m) {\n\tint l = 1, r = 1e5 + 10;\n\tint ans = -1;\n\twhile(l <= r) {\n\t\tint mid = (l+r)/2;\n\t\tlong long mid1 = cube(mid);\n\t\tif(mid1 == m) {\n\t\t\tans = m;\n\t\t\tbreak;\n\t\t}\n\t\tif(mid1 > m) {\n\t\t\tr = mid - 1;\n\t\t}\n\t\telse {\n\t\t\tans = max(ans, mid);\n\t\t\tl = mid + 1;\n\t\t}\n\t}\n\treturn ans;\n}\n\npair getAns(long long m) {\n\tif(m == 0)\n\t\treturn make_pair(0,0);\n\tint c = getBiggestCube(m);\n\tpair p1 = getAns(m - cube(c));\n\tpair p2 = getAns(cube(c) - 1 - cube(c-1));\n\tif(p1.first == p2.first) {\n\t\tif(cube(c) + p1.second > cube(c-1) + p2.second)\n\t\t\treturn make_pair(p1.first+1,p1.second+cube(c));\n\t\telse\n\t\t\treturn make_pair(p2.first+1, p2.second + cube(c-1));\n\t}\n\telse {\n\t\tif(p1.first > p2.first) {\n\t\t\treturn make_pair(p1.first + 1, p1.second + cube(c));\n\t\t}\n\t\telse {\n\t\t\treturn make_pair(p2.first + 1, p2.second + cube(c-1));\n\t\t}\n\t}\n}\n\nint main() {\n\t//freopen(\"in\", \"r\", stdin);\n\tlong long m;\n\tcin >> m;\n\tpair ans = getAns(m);\n\tcout << ans.first << \" \" << ans.second << endl;\n}", "lang": "GNU C++11", "bug_code_uid": "9cbbd457620276dd20f82cdacbe4aef9", "src_uid": "385cf3c40c96f0879788b766eeb25139", "apr_id": "e63781269d0004dc0a31ccbbff33d608", "difficulty": 2200, "tags": ["brute force", "constructive algorithms", "greedy", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.37847697218422255, "equal_cnt": 12, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "#include\t\t\t\n\n#define pb push_back\n#define pp pop_back\n#define sz(a) (int)(a.size())\n#define mp make_pair\n#define F first\n#define S second\n\nusing namespace std;\n\ntypedef long long ll;\ntypedef unsigned long long ull;\ntypedef long double ld;\ntypedef pair pii;\n\nconst int N = (int)1e5 + 123;\nconst ll INF = (ll)1e18 + 123;\nconst int inf = (int)1e9 + 123;\n\nll m, cnt;\nmap u;\n\nvoid rec(ll num, ll did, ll pw, ll same) {\n\tif((same + 1) * pw * pw * pw >= (pw + 1) * (pw + 1) * (pw + 1) || u[num])\n\t\treturn;\n\tu[num] = 1;\n\t//cout << \"num: \" << num << \" did: \" << did << \" pw: \" << pw << \" same: \" << same << endl;\n\tif(did == cnt) {\n\t\tcout << num;\n\t\texit(0);\t\t\n\t}\n\tfor(ll i = pw; i >= 1; i --) \n\t\tif(num + i * i * i <= m && did + 1 <= cnt)\n\t\t\tif(pw == i)\n\t\t\t\trec(num + i * i * i, did + 1, i, same + 1);\n\t\t\telse if(pw != i)\n\t\t\t\trec(num + i * i * i, did + 1, i, 0);\n\t//cout << \"num: \" << num << \" did: \" << did << \" pw: \" << pw << endl;\n}\n\nll beg, pw = 1, mx;\n \nint main() {\n\tcin >> m;\n\twhile(beg < m) {\t\n\t\tll pw3 = pw * pw * pw;\n\t\tif(beg + pw3 > m)\n\t\t\tbreak;\n\t\tif(beg + pw3 < (pw + 1) * (pw + 1) * (pw + 1) ) {\n\t\t\tcnt ++;\n\t\t\tbeg += pw3;\n\t\t} else \n\t\t\tpw ++;\n\t}\n\tcout << cnt << \" \";\n\tpw = ceil(pow(m, 1 / 3.0));\n\trec(0, 0, pw, 0);\n\treturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "3f067ec541cf963bb16f5b78088e2cdf", "src_uid": "385cf3c40c96f0879788b766eeb25139", "apr_id": "97ac5c048ea7a497e57ba27de2d631a0", "difficulty": 2200, "tags": ["brute force", "constructive algorithms", "greedy", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9392523364485982, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "#include\nusing namespace std;\nint main(){\n long a,b;\n cin>>a>>b;\n a=a-b;\n long cnt1=a/2;\n long cnt2=a-cnt1;\n cout<\nusing namespace std;\nchar a[9][9];\nint check(int st,int row)\n{\n\tint i,j;\n\tif (a[st][row]=='W'){\n\tfor (i=0;i>a[i][j];\n \tif (a[i][j]=='W'&&c==0){\n \tc++;\n \ta_pos=i;\n \ta_op=j;\n }\n \tif (a[i][j]=='B'){\n \tb_pos=i;\n b_op=j; \n }\n }\n if (!check(a_pos,a_op))\n {\n \twhile (check(a_pos,a_op)==false){\n \tfor (i=a_pos;i<8;i++)\n \t for (j=a_op+1;j<8;j++)\n \t {\n\t if (a[i][j]=='W')\n\t {\n\t \ta_pos=i;\n\t \ta_op=j;\n\t }\n}\n if (i==7&&j==7&&a[i][j]!='W')\n {\n \tcout<<\"B\"<7-b_pos)\n cout<<\"B\"<\nusing namespace std;\n\ntypedef long long ll;\n\nchar s[101];\nint dx[] = { 0, 0, 0, 1, -1 }, dy[] = { 0, 1, -1, 0, 0 };\n\nint main() {\n// freopen(\"a\", \"r\", stdin);\n scanf(\"%s\", s);\n int n = strlen(s);\n int x = 0, y = 0;\n set > vis;\n vis.insert(make_pair(0, 0));\n bool ok = true;\n for (int i = 0; i < n && ok; ++i) {\n int px = x, py = y;\n if (s[i] == 'R')\n ++y;\n else if (s[i] == 'L')\n --y;\n else if (s[i] == 'U')\n --x;\n else if (s[i] == 'D')\n ++x;\n for (int j = 0; j < 5 && ok; ++j) {\n int tx = x + dx[j];\n int ty = y + dy[j];\n if (tx != px && ty != py && vis.find(make_pair(tx, ty)) != vis.end())\n ok = false;\n }\n vis.insert(make_pair(x, y));\n }\n if (ok)\n puts(\"OK\");\n else\n puts(\"BUG\");\n return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "123240f260018758b2cf5a7996a2fff6", "src_uid": "bb7805cc9d1cc907b64371b209c564b3", "apr_id": "1223b73eb3d7ae0066cc7804c2e5f5e9", "difficulty": 1400, "tags": ["graphs", "constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9520594193112761, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include\nusing namespace std;\n#define sf scanf\n#define pf printf\n#define pb push_back\n#define nl printf(\"\\n\")\n#define ll long long int\n#define F first\n#define S second\n#define gcd(x,y) __gcd(x,y)\n#define lcm(a,b) (a*(b/gcd(a,b)))\n#define MOD 1000000007\n#define MX INT_MAX\n#define Sz 100005\n#define FastIO { ios_base::sync_with_stdio(false); cin.tie(0); }\nchar f,g;\nbool flag;\nstring s,p;\ndouble aa,bb,cc;\nint arr[Sz],brr[Sz];\nmap< int, int > mpi;\nmap< string, int > mp;\nvector< int > v,va,vb;\nvector< pair< int, int > > vp;\nint sum,n;\nbool check(int k)\n{\n int x=0;\n for(int i=1; i<=n; i++)\n {\n if(arr[i]>k)\n return false;\n x+=(k-arr[i]);\n }\n if(x>sum)\n return true;\n return false;\n\n\n}\n\nint Binary_search(int n)\n{\n int high,low;\n int ans=MX;\n low=n;\n high=(n*2)+2;\n\n\n while(low>n;\n a=-MX;\n for(i=1; i<=n; i++)\n {\n cin>>arr[i];\n sum+=arr[i];\n a=max(a,arr[i]);\n }\n x=Binary_search(a);\n cout<\nusing namespace std;\nchar s1[10001],s2[10001];\nint cmp(char a,char b){\n\treturn 1;\n}\nint main()\n{cin>>s1;\ncin>>s2;\nint len=strlen(s1);\nsort(s1+0,s1+len,cmp);\nif(strcmp(s1,s2)==0)cout<<\"YES\";\nelse\ncout<<\"NO\";\n}", "lang": "GNU C++", "bug_code_uid": "18c66e3bbd0cbb8cf3908d78a23432bb", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "apr_id": "a32de21b83e5469dad8d923c10f449c3", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9848024316109423, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#include \n\nusing namespace std;\n\nint arr[200000005];\n\nint main()\n{\n long long int i, a, x;\n\n arr[1] = 1;\n arr[2] = 3;\n for (i = 3; i < 200000005; i++) {\n arr[i] = i + arr[i - 1];\n }\n\n cin >> a;\n\n i = 1;\n while (a > arr[i]) {\n i++;\n }\n\n x = a - arr[i - 1];\n\n //cout << arr[i] << \" PP \" << endl;\n\n if (a == 1)\n cout << \"1\" << endl;\n else if (x == 0)\n cout << i << endl;\n else\n cout << x << endl;\n\n}\n", "lang": "GNU C++", "bug_code_uid": "cf6e2e2a210152762e5fc24ddd8f67d2", "src_uid": "1db5631847085815461c617854b08ee5", "apr_id": "f0fda062aafbd408f7f9a26216524303", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.059673659673659674, "equal_cnt": 10, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "#include\n#define ri register int\nusing namespace std;\nint n,k,p,a[30],t1,t2;\nlong long s,jc[1005];\nstruct node{long long x;int d;}l[40000005],r[40000005];\ninline int read()\n{\n\tchar ch=getchar();int x=0,f=1;while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}\n\twhile(isdigit(ch))x=(x<<1)+(x<<3)+(ch^48),ch=getchar();return x*f;\n}\ninline void dfs(ri x,long long c,ri d)\n{\n\tif(c>s)return;if(x>n/2){l[++t1].x=c;l[t1].d=d;return;}\n\tdfs(x+1,c,d);dfs(x+1,c+a[x],d);if(a[x]<=p)dfs(x+1,c+jc[a[x]],d+1);\n}\ninline void dfs1(ri x,long long c,ri d)\n{\n\tif(c>s)return;if(x>n){r[++t2].x=c;r[t2].d=d;return;}\n\tdfs1(x+1,c,d);dfs1(x+1,c+a[x],d);if(a[x]<=p)dfs1(x+1,c+jc[a[x]],d+1);\n}\ninline int cmp(node a,node b){return a.x>1;if(l1==r1){if(r[l1].x==x&&r[l1].d+d<=k)return 1;return 0;}\n\tif(l1>r1)return 0;\n\tif(x>r[mid].x)return q(x,mid+1,r1,d);\n\tif(xs)break;}\n\tfor(ri i=1;i<=n;++i)a[i]=read();dfs(1,0,0);dfs1(n/2+1,0,0);sort(r+1,r+1+t2,cmp);\n\tlong long ans=0;for(ri i=1;i<=t1;++i)ans+=q(s-l[i].x,1,t2,l[i].d);printf(\"%lld\",ans);\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "03965e3d90ef77af517463bbad6f9639", "src_uid": "2821a11066dffc7e8f6a60a8751cea37", "apr_id": "d5647785404c4973d1c4285b599273ce", "difficulty": 2100, "tags": ["dp", "meet-in-the-middle", "bitmasks", "math", "brute force", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.12838263058527374, "equal_cnt": 21, "replace_cnt": 16, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 21, "bug_source_code": "/* 2013-07-26 09:13:44.790583 */#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define mo 1000000007\n\nusing namespace std;\n\nlong long n, m, i, j, now1, now2, now, Ans;\nlong long f[2005][2005], f2[2005][2005];\n\nint main()\n{\n", "lang": "GNU C++", "bug_code_uid": "d3dbac235e10301e0c3a7c592996c847", "src_uid": "9ca1ad2fa16ca81e9ab5eba220b162c1", "apr_id": "92a7490c6e8f85f0b33baa3fca1f3a56", "difficulty": 2400, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.16314199395770393, "equal_cnt": 11, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "#include \n\nint main()\n{\n\tint a, x, y;\n\tscanf(\"%d%d%d\", &a, &x, &y);\n\n\tif (y == 0 || x * 2 == -a || x * 2 == a)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\tif (-a < x * 2 && x * 2 < a && 0 < y&&y < a)\n\t{\n\t\tprintf(\"1\");\n\t\treturn 0;\n\t}\n\tint i, j;\n\tint save;\n\tint odd = 1;\n\tfor (i = 1, j = -1;; i++)\n\t{\n\t\tif (i % 2 == 0)\n\t\t{\n\t\t\tj += 1;\n\t\t\todd = 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tj += 2;\n\t\t\todd = 1;\n\t\t}\n\t\tif (a*i == y || a*(i + 1) == y)\n\t\t{\n\t\t\tprintf(\"-1\");\n\t\t\treturn 0;\n\t\t}\n\t\telse if (a*i < y&&y < a*(i + 1))\n\t\t{\n\t\t\tsave = j;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (odd == 1)\n\t{\n\t\tif (-a < x * 2 && x * 2 < a)\n\t\t{\n\t\t\tprintf(\"%d\", save + 1);\n\t\t\treturn 0;\n\t\t}\n\t}\n\telse\n\t{\n\t\tif (x < 0)\n\t\t{\n\t\t\tif (-a < x&&x < 0)\n\t\t\t{\n\t\t\t\tprintf(\"%d\", save + 1);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\tif (x > 0)\n\t\t{\n\t\t\tif (0 < x&&x < a)\n\t\t\t{\n\t\t\t\tprintf(\"%d\", save + 2);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"-1\");\n\treturn 0;\n}", "lang": "MS C++", "bug_code_uid": "0735f9e4fbf4e430099f7794cff4eaa0", "src_uid": "cf48ff6ba3e77ba5d4afccb8f775fb02", "apr_id": "c7ef893bed8cd0848a4113acf6b00375", "difficulty": 1400, "tags": ["geometry", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8876712328767123, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 4, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "#include\nusing namespace std;\nint n,m;\nstring a;\nint main(){\n\tcin >> n;\n\tfor(int i=0 ; i> a[i];\n\t}\n\tn--;\n\tfor(int i=0 ; i\n\nusing namespace std;\n\ntypedef int in;\n#define int long long\n\nint n,a[105];\nint dp[105][105][105][105];\n\nint fun(int idx,int e,int o,int l){\n if(idx == n){\n return 0;\n }\n int &ret = dp[idx][e][o][l];\n if(ret){\n return ret;\n }\n ret = INT_MAX;\n if(!a[idx]){\n if(l == 2){\n ret = min(min(ret,fun(idx + 1,e - 1,o,0)),fun(idx + 1,e,o - 1,1));\n }\n else{\n ret = min(ret,min(fun(idx + 1,e - 1,o,0) + (a[idx - 1] % 2),fun(idx + 1,e,o - 1,1) + (a[idx - 1] % 2 == 0)));\n }\n }\n else{\n ret = fun(idx + 1,e,o,l) + ((a[idx - 1] % 2) != (a[idx] % 2));\n }\n return ret;\n}\n\nin main()\n{\n int ans = INT_MAX,e = 0,o = 0;\n cin >> n;\n for(int i = 0 ; i < n ; i ++){\n cin >> a[i];\n e += (a[i] && a[i] % 2 == 0);\n o += a[i] % 2;\n }\n if(!a[0]){\n ans = min(fun(1,e - 1,o,0),fun(1,e,o - 1,1));\n }\n else{\n ans = fun(1,e,o,2);\n }\n cout << ans << endl;\n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "82c4dcc0546a6c4d3bce152afa291d35", "src_uid": "90db6b6548512acfc3da162144169dba", "apr_id": "b81e301c88aafd984274b7f3609fdae7", "difficulty": 1800, "tags": ["dp", "greedy", "sortings"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9722222222222222, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include \n\nusing namespace std;\n\nint main()\n{\n int n,k;\n cin >> n >> k;\n\n cout << n - (k - 2*n) << endl;\n\n return 0;\n}", "lang": "MS C++", "bug_code_uid": "35b32488ddc8d2c30d8bb1e4b2ccb603", "src_uid": "5a5e46042c3f18529a03cb5c868df7e8", "apr_id": "7c86f2232e776e6b086913d3088dbbbf", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9359953024075162, "equal_cnt": 12, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 11, "bug_source_code": "#include \n#define rint register int \n#define IL inline\n#define rep(i,h,t) for (rint i=h;i<=t;i++)\n#define dep(i,t,h) for (rint i=t;i>=t;i--) \n#define ll long long\nusing namespace std;\nconst int N=1e7;\nstruct re{\n ll a,b;\n} a[N+10],b[N+10];\nint cnt1,cnt2;\nll x,y,z;\nint main()\n{\n ios::sync_with_stdio(false);\n cin>>x>>y;\n z=x+y;\n for (rint i=1;i*i<=x;i++)\n if (!(x%i)) a[++cnt1].a=x/i,a[cnt1].b=i;\n for (rint i=1;i*i<=y;i++)\n if (!(y%i)) b[++cnt1].a=y/i,b[cnt1].b=i;\n ll ans=1e18;\n for (rint i=1;i*i<=z;i++)\n if (!(z%i))\n {\n ll x=z/i,y=i;\n for (;cnt1;cnt1--) if (a[cnt1].a<=x) break;\n if (cnt1&&a[cnt1].b<=y) ans=min(ans,(x+y)*2);\n for (;cnt2;cnt2--) if (a[cnt2].a<=x) break;\n if (cnt2&&a[cnt2].b<=y) ans=min(ans,(x+y)*2);\n }\n cout<\n#include \n#include \n\nusing namespace std;\n\n\nint main(){\n \n int n, k;\n int i = 1 ;\n int temp = pow(10,k);\n long possibleNum = -1;\n \n if (k == 0){\n cout << n;\n \n }else if(n*temp % temp == 0){\n possibleNum = n*temp;\n }\n \n if( n % 2 != 0 && n%5 != 0){\n cout << possibleNum;\n }\n //cout << n*temp << \" \" << temp < possibleNum){\n cout<\nusing namespace std;\nvector num;\nint main () \n{\n for ( int i=1 ; i<1002 ; i++ ) {\n if ( i/100 > 0 ) num.push_back(i/100 - i%100) , i%=100 , num.push_back(i/10 - i%10) , i%=10 , num.push_back(i);\n else if ( i/10 > 0 ) num.push_back(i/10 - i%10) , i%=10 , num.push_back(i);\n else num.push_back(i);\n }\n int n; cin>>n; return cout << num[n-1] << endl , EXIT_SUCCESS ;\n}", "lang": "GNU C++14", "bug_code_uid": "0d630f9e1b2e65a288116d66a4594997", "src_uid": "2d46e34839261eda822f0c23c6e19121", "apr_id": "4f6f59105a56420256156aa201d39a79", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9948091603053435, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \nusing namespace std;\n\ntypedef long long LL;\n\n#define inp_s ios_base::sync_with_stdio(false)\n#define DRT() int test_case;cin>>test_case;while(test_case--)\n\n#define VI vector\n#define VS vector\n#define VLL vector\n#define PII pair\n#define all(c) c.begin(),c.end()\n#define sz(c) (int)c.size()\n#define clr(c) c.clear()\n#define pb push_back\n#define mp make_pair\n\n#define GI(x) scanf(\"%d\",&x)\n\n#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)\n#define RFOR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)\n\n#define MOD 1000000007\n#define EPS 1E-10\n\n#define PI acos(-1)\n\n#define CASE(x) cout << \"Case #\" << x << \": \";\n\nint dp[101][201][51][2];\nint ans = 0;\nstring s;\nint n;\n\nvoid solve(int idx , int pos , int changesLeft , int dir)\n{\n int realPos = pos - 100;\n if(idx == sz(s))\n {\n if(changesLeft%2 == 0)\n ans = max(ans , abs(realPos));\n }\n else if(dp[idx][pos][changesLeft][dir] != -1) return ;\n dp[idx][pos][changesLeft][dir] = 1;\n int dx = 1;\n if(!dir) dx = -1;\n if(s[idx] == 'F')\n solve(idx + 1 , pos + dx , changesLeft , dir);\n else\n solve(idx + 1, pos , changesLeft , !dir);\n if(changesLeft)\n {\n if(s[idx] == 'F')\n solve(idx + 1 , pos , changesLeft-1 , !dir);\n else\n solve(idx + 1, pos + dx , changesLeft-1 , dir);\n }\n}\n\nint main()\n{\n FOR(i,0,101) FOR(j,0,201) FOR(k,0,51) FOR(l,0,2) dp[i][j][k][l] = -1;\n cin >> s >> n;\n solve(0 , 100 , n , 0);\n cout << ans << endl;\n return 0;\n}", "lang": "GNU C++", "bug_code_uid": "4d219d64488fcf21f0f7cf3dfd6fb11a", "src_uid": "4a54971eb22e62b1d9e6b72f05ae361d", "apr_id": "19759b95e1e5bdfe416a335337bf1364", "difficulty": 1800, "tags": ["dp"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.5974717232202262, "equal_cnt": 10, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "#include \n#define FOR(it,A) for(typeof A.begin() it = A.begin(); it!=A.end(); it++)\n#define all(v) (v).begin(), (v).end()\n#define rall(v) (v).rbegin(), (v).rend()\n#define ll long long\n#define clr(A,x) memset(A, x, sizeof A)\n#define pb push_back\n#define pii pair\n#define xx first\n#define yy second\n#define ones(x) __builtin_popcount(x)\n#define cua(x) (x)*(x)\n#define INF (1<<30)\nusing namespace std;\nvector v;\nbitset<100000> bs;\nvoid criba(int N)\n{\n bs.set();\n bs[0]=bs[1]=0;\n for(int i=2;i<=N;i++)\n if(bs[i])\n {\n for(int j=i*i;j<=N;j++)\n bs[j]=0;\n v.pb(i);\n }\n}\nint main()\n{\n\ncriba(1000000);\n int n;\n cin>>n;\n int sw=0;\n for(int i=0; i\nusing namespace std;\n\nconst int N = 16 + 2;\nint n, R, B, r[N], b[N], a[N];\nint cnt[1 << N][2], dp[1 << N][N * N];\n\ninline void readInput() {\n\tcin >> n;\n\tfor (int i = 0; i < n; i++) {\n\t\tchar c;\n\t\tcin >> c >> r[i] >> b[i];\n\t\tR += r[i], B += b[i];\n\t\ta[i] = (c == 'B');\n\t}\n}\n\ninline void solve() {\n\tmemset(dp, -63, sizeof dp);\n\tdp[0][0] = 0;\n\tfor (int i = 1; i < 1 << n; i++) {\n\t\tfor (int j = 0; j < n * n; j++)\n\t\t\tfor (int k = 0; k < n; k++)\n\t\t\t\tif (i >> k & 1) {\n\t\t\t\t\tint nxt = i ^ (1 << k);\n\t\t\t\t\tdp[i][j] = max(dp[i][j], dp[nxt][max(j - min(r[k], cnt[nxt][0]), 0)] + min(b[k], cnt[nxt][1]));\n\t\t\t\t}\n\t\tcnt[i][0] = cnt[i ^ i & -i][0];\n\t\tcnt[i][1] = cnt[i ^ i & -i][1];\n\t\tcnt[i][a[__builtin_ctz(i)]]++;\n\t}\n}\n\ninline void writeOutput() {\n\tint ans = 1e9, all = (1 << n) - 1;\n\tfor (int i = 0; i < n * n; i++)\n\t\tif (dp[all][i] >= 0)\n\t\t\tans = min(ans, max(R - i, B - dp[all][i]));\n\tcout << ans + n << endl;\n}\n\nint main() {\n\tios:: sync_with_stdio(0), cin.tie(0), cout.tie(0);\n\treadInput(), solve(), writeOutput();\n\treturn 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "7e3c1dd33b60d05b62c08e43734f11c3", "src_uid": "25a77f2b7cb281ff3c7800a20b3e5969", "apr_id": "049c88e93c0e3f8f9772408e662e6323", "difficulty": 2400, "tags": ["dp", "brute force", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9076339097427246, "equal_cnt": 9, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 8, "bug_source_code": "#include \n#define forn(i,n) for(int i=0;i::min()\n#define inf numeric_limits::max()\n#define linf numeric_limits::max()\n#define lminf numeric_limits::min()\n#define llinf numeric_limits::max()\n#define llminf numeric_limits::min()\n#define forln(i,n) for(long i=0;i\n#define lvec vector\n#define llvec vector\n#define x first\n#define y second\n#define mp make_pair\n#define pb push_back\n#define ipair pair\n#define lpair pair\n#define llpair pair\n#define vec vector\n\n\nusing namespace std;\n \nint main(){\n ios_base::sync_with_stdio(false);\n #ifndef ONLINE_JUDGE\n freopen(\"../input.txt\",\"r\",stdin);\n freopen(\"../output.txt\",\"w\",stdout);\n #endif\n ll n , k , M , D;\n cin>>n>>k>>M>>D;\n ll ans=0;\n for(int p=1;p<=D; p++){\n ll i=max(1ll,n/M-(p-1)*k);\n ll x=(n/((p-1)*k+i));\n \n for(int j=max(1ll,i-1); j<=i+1;j++){\n ll as=(n/((p-1)*k+j));\n if(as<=M) x=max(x, as);\n }\n x=min(x, M);\n ans=max(ans,p*x);\n }\n cout<\n\nusing namespace std;\nint n, k;\nvector divs;\n\nmap, vector > dp;\nint backtrack[1000001][21];\nvector vF;\nbool visited[100001];\nvoid rek(int num, int sz, vector v){\n if(num == n && sz == k){\n vF = v;\n return ;\n }\n //if(num > n)return;\n //cout << num << endl;\n for(int i = 0; i < divs.size(); i ++){\n vector a = v;\n a.push_back(divs[i]);\n if(num * divs[i] > n)continue;\n //if(visited[num * divs[i]])continue;\n //visited[num * divs[i]] = true;\n rek(num * divs[i], sz + 1, a);\n\n }\n return;\n}\nint main()\n{\n ios_base::sync_with_stdio(false);\n cin >> n >> k;\n for(int i = 2; i <= n; i ++){\n if(n % i == 0){\n divs.push_back(i);\n }\n }\n vector v;\n rek(1, 0, v);\n if(vF.size() == 0)return 0 * printf(\"-1\");\n for(int i =0; i < vF.size(); i ++)cout << vF\n [i] << \" \";\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "a11bf5416ba85993046bec49a2801cce", "src_uid": "bd0bc809d52e0a17da07ccfd450a4d79", "apr_id": "69bad907c4e03dbc42deae99a7147f07", "difficulty": 1100, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.16517857142857142, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "#include \nusing namespace std;\nint main()\n{\n int c,d,n,m,k;\n cin >> c >> d >> n >> m >> k;\n int nbr = n*m - k;\n// a * n + b >= nbr\n vector ans;\n for(int a=0;a<=10000;a++){\n for(int b=0;b<=10000;b++){\n if(a*n+b>=nbr){\n ans.push_back(a*c+b*d);\n }\n }\n }\n sort(ans.begin(),ans.end());\n cout << ans[0] << endl;\n return 0;\n}\n", "lang": "GNU C++0x", "bug_code_uid": "5ba1d0bd72d062471501f9371c96728e", "src_uid": "c6ec932b852e0e8c30c822a226ef7bcb", "apr_id": "0d96a9a3e91ec62f0bc99fcd9fe981b0", "difficulty": 1500, "tags": ["dp", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9250038657801144, "equal_cnt": 18, "replace_cnt": 7, "delete_cnt": 4, "insert_cnt": 7, "fix_ops_cnt": 18, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\n#define all(x) (x).begin(),(x).end()\ntypedef long long ll;\ntypedef vector VI;\ntypedef vector VS;\ntypedef vector VVI;\n#define FORIT(it,c) for(auto it=(c).begin();it!=(c).end();it++)\ntypedef pair PII;\ntypedef vector VPII;\n#define two(x) (1<<(x))\n#define twoll(x) ((long long)1<<(x))\n#define contain(m,x) (((m)&two(x))!=0)\n#define containll(m,x) (((m)&twoll(x))!=0)\n#define db(a) cout << #a << \"=\" << a << \" \"\n#define dbn cout << endl\ntemplate void print(vector v) { cout << \"[\"; if (v.size()) cout << v[0]; for (unsigned i = 1; i < v.size(); ++i) cout << \", \" << v[i];cout << \"]\\n\"; }\ntemplate void print(vector > v) { cout << \"[ ---\\n\"; if (v.size()) cout << \" \", print(v[0]); for (unsigned i = 1; i < v.size(); ++i) cout << \" \", print(v[i]); cout << \"--- ]\\n\"; }\ntemplate void print(pair p) { cout << \"{\" << p.first << \", \" << p.second << \"}\"; }\ntemplate void print(vector > v) { cout << \"[\"; if (v.size()) print(v[0]); for (unsigned i = 1; i < v.size(); ++i) cout << \", \", print(v[i]);cout << \"]\\n\"; }\ntemplate inline int chmin(T& a, T b) { if (a>b) {a=b; return 1;} return 0; }\ntemplate inline int chmax(T& a, T b) { if (a Ty to(const Tx &x) { Ty y; stringstream ss; ss<>y; return y; }\nconst int INF = 1000000007;\nconst double EPS = 1e-10;\nconst string TESTCASE = \"\";\n\nint n;\nchar C[100][2];\nint M[25];\n\nint main(int argc, char *argv[]) {\n\tif (argc > 1) { if (fopen(argv[1], \"r\")) freopen(argv[1], \"rt\", stdin); else return 0; }\n\telse if (TESTCASE.length()) { string path = \"input/\" + TESTCASE; if (fopen(path.c_str(), \"r\")) freopen(path.c_str(), \"rt\", stdin); }\n\t\n\tcin >> n;\n\tset st_ch;\n\tset st_str;\n\tfor (int i = 0; i < n; ++i) scanf(\"%s\", C[i]), st_str.insert(C[i]), st_ch.insert(C[i][0]), st_ch.insert(C[i][1]);\n\tvector v_ch;\n\tfor (char c : st_ch) v_ch.push_back(c);\n\tvector v_str;\n\tfor (string s : st_str) v_str.push_back(s);\n\tif (v_str.size() == 1) {\n\t\tcout << 0;\n\t\treturn 0;\n\t}\n\tvector p;\n\tfor (int i = 0; i < v_ch.size(); ++i) p.push_back(i);\n\tint res = p.size();\n\tdo {\n\t\tmemset(M, 0, sizeof(M));\n\t\tfor (int i = 0; i < p.size(); ++i) {\n\t\t\tchar c = v_ch[p[i]];\n\t\t\tfor (int j = 0; j < v_str.size(); ++j)\n\t\t\t\tif (v_str[j].find(c) != string::npos)\n\t\t\t\t\tM[j] |= two(p[i]);\n\t\t\tset st;\n\t\t\tfor (int j = 0; j < v_str.size(); ++j)\n\t\t\t\tst.insert(M[j]);\n\t\t\tif (st.size() == v_str.size()) {\n\t\t\t\tres = min(res, i + 1);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t} while (next_permutation(all(p)));\n\tcout << res;\n\t\n\treturn 0;\n}\n", "lang": "GNU C++0x", "bug_code_uid": "3cb514d385f6c85e47fce6b3cd13cda2", "src_uid": "3b12863997b377b47bae43566ec1a63b", "apr_id": "534442912cf1bd638e1a0487def6668e", "difficulty": 1700, "tags": ["bitmasks", "brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5024875621890548, "equal_cnt": 14, "replace_cnt": 12, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 13, "bug_source_code": "#include \n#include \nusing namespace std;\nint main() {\n int n, k, count, c, ind;\n cin >> n >> k;\n vector vec;\n for(int i = 0; i < n; i++) {\n int x;\n cin >> x;\n if (i = k -1) c = x;\n vec.push_back(x);\n }\n ind = 0;\n while(true) {\n if( vec[ind] >= c) count++;\n else break;\n ind ++;\n }\n cout << count ;\n return 0;\n}", "lang": "MS C++", "bug_code_uid": "d86253fb3cdd0fd641bd2f38d07b4259", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "aa54e67d4e2398aa62438668694cf71b", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.12242090784044017, "equal_cnt": 23, "replace_cnt": 18, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 23, "bug_source_code": "#include\n#include\n#include\nusing namespace std;\ntypedef long long ll;\nconst N = 1e9 + 7;\nll read()\n{\n\tll a = 0, b = 1;\n\tchar c = getchar();\n\twhile( c < '0' or c > '9')\n\t{\n\t\tif(c == '-') b = -1;\n\t\tc = getchar();\n\t}\n\twhile(c >= '0' and c <= '9')\n\t{\n\t\ta = a * 10 + c - '0';\n\t\tc = getchar();\n\t}\n\treturn a * b;\n}\nll quickpow(ll m ,ll n)\n{\n\tlong long t;\n\tif(n==1) return m;\n\tt = quickpow(m,n/2) % N;\n\tif(n%2==0)\n\treturn t * t % N;\n\telse return m * t * t % N;\n}\nll n, m;\nint main()\n{\n\tn = read(); m = read();\n\tn = n + 1;\n\tprintf(\"%lld\",(quickpow(2 * n,m) *(n-m) / n) % N);\n\treturn 0 ;\n}", "lang": "GNU C++", "bug_code_uid": "7f5366257f426e5555a06de9cea60686", "src_uid": "4f9711197e699c0fd0c4e9db8323cac7", "apr_id": "5d4017f0bec9b96a0bb815bbbb6ec0fd", "difficulty": 2700, "tags": ["math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.21693491952414276, "equal_cnt": 8, "replace_cnt": 1, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "#include \n#include \n#include \n\nusing namespace std;\n\nint main()\n{\n long int n, n2, n1;\n cin >> n;\n n1 = n;\n n2 = n;\n vector v2;\n //v.push_back(n);\n //v.push_back(n);\n \n for(int i = 0; i < n; i++){\n for(int j = 0; j < 3; j++){\n if(j%2 == 0){\n if(n1 == 0 || n2 == 0){\n break;\n }\n else if((i+1) <= n1 && (i+1) <= n2){\n n1 -= i+1;\n }\n else if(((i+1) > n1 && (i+1) > n2)||((i+1) > n1 || (i+1) > n2)){\n n1 -= 1;\n }\n }\n else if(j%2 != 0){\n if(n1 == 0 || n2 == 0){\n break;\n }\n else if((i+1) <= n1 && (i+1) <= n2){\n n2 -= i+1;\n }\n else if(((i+1) > n1 && (i+1) > n2)||((i+1) > n1 || (i+1) > n2)){\n n2 -= 1;\n }\n }\n }\n v2.push_back((2*n) - (n1+n2));\n n1 = n;\n n2 = n;\n }\n \n sort(v2.begin(),v2.end());\n \n cout << v2[v2.size()-1];\n /*for(int i = 0; i < v2.size(); i++){\n cout << v2[i] << \" \";\n }*/\n return 0;\n}", "lang": "GNU C++14", "bug_code_uid": "c3c6a6010b72167ed3adf66918eb84c8", "src_uid": "031e53952e76cff8fdc0988bb0d3239c", "apr_id": "9566b536fd51a4273c0c46e3e6eed43d", "difficulty": 900, "tags": ["math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.7098901098901099, "equal_cnt": 11, "replace_cnt": 3, "delete_cnt": 5, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "#include \nusing namespace std;\n\nint main(){\n string s, res;\n cin >> s;\n for(int _ = 0; _ < 10; _++){\n sort(s.begin(), s.end());\n do {\n for(int i = 0; i < s.size() * s.size() * s.size() * s.size(); i++){\n bool ok = 1;\n for(int j = 0; j <= i; j++){\n for(int k = 0; k <= i; k++){\n if(s[j] != s[k]) ok = 0;\n }\n }\n if(ok){\n res = max(res, s.substr(0, i + 1));\n }\n }\n } while(next_permutation(s.begin(), s.end()));\n }\n cout << res << '\\n';\n}\n", "lang": "GNU C++11", "bug_code_uid": "8e9e956f65ad5fc91fa6972d56a32759", "src_uid": "9a40e9b122962a1f83b74ddee6246a40", "apr_id": "772219d0b6bab6766c0442743a8a157d", "difficulty": 800, "tags": ["bitmasks", "greedy", "implementation", "brute force", "strings", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.963076923076923, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "///Bismillahir Rahmanir Rahim\n#define inf 9223372036854775807\n#define ll long long\n#define pii pair\n#define m_p make_pair\n#define ull unsigned long long\n#define spd ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);\n#include \nusing namespace std;\nconst ll m = 1e9+7;\nint main()\n{\n spd\n\n ll a,b,i,x,ans=0,sum=0,tot,k,last,gun,n;\n\n cin>>a>>b;\n mapmp;\n\n for(i=1;i\nusing namespace std;\nint main (){\n \n long long Data1 , Data2;\n cin >> Data1 >> Data2;\n Data1*=Data1;\n if(Data1<=Data2)cout << \"YES\" << endl << Data2/Data1;\n else cout <<\"NO\";\n return 0;\n}\n\n", "lang": "GNU C++14", "bug_code_uid": "d7600a048cc30f430482444ea4935c62", "src_uid": "8ce89b754aa4080e7c3b2c3b10f4be46", "apr_id": "982db330816928ba9ff503c83a3bd799", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.08725490196078431, "equal_cnt": 31, "replace_cnt": 25, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 31, "bug_source_code": "#include \n#include \n#include \n#include \n\nusing namespace std;\n\nstruct dot\n{\n\tint x;\n\tint y;\n} a, b, c;\n\nbool onOneLine (float x1,float x2,float x3,float y1,float y2,float y3)\n{\n double d1,d2,d3;\n d1=(pow((x1-x2),2)+pow((y1-y2),2),1.0/2.0);//ml \ufffd\ufffd\ufffd\ufffd\ufffd\n d2=(pow((x1-x3),2)+pow((y1-y3),2),1.0/2.0);//mh \ufffd\ufffd\ufffd\ufffd\ufffd\n d3=(pow((x2-x3),2)+pow((y2-y3),2),1.0/2.0);//lh \ufffd\ufffd\ufffd\ufffd\ufffd\n if (d1+d2==d3 || d1+d3==d2 || d2+d3==d1 ) return(false);\n else return(true);\n}\n\nint main()\n{\n\t\n\tifstream input;\n\tofstream out;\n\tout.open(\"standard.output\");\n\tinput.open(\"standard.input\");\n\tinput>>a.x;\n\tinput>>a.y>>b.x>>b.y>>c.x>>c.y;\n\tinput.close();\n\tif (onOneLine(a.x,a.y,b.x,b.y,c.x,c.y)) {out<<\"TOWARDS\"; out.close(); return 1; }\n\tif ((c.x > a.x) && (c.y > a.y)){out<<\"RIGHT\"; out.close(); return 1; }\n\tout<<\"LEFT\"; out.close(); return 1; \n}\n\n\n", "lang": "MS C++", "bug_code_uid": "0055edf37d980d092434d84d20da1b6d", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "apr_id": "36b4d3656103aeca539cdef9e29c5feb", "difficulty": 1300, "tags": ["geometry"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8616944243301955, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n int long n,i=0;\n cin.tie(0);\n cin>>n;\n vector v;\n while(n>=0)\n {\n int r=n%10;\n if(r>=5)\n v.push_back(\"-O|\");\n else\n v.push_back(\"O-|\");\n string s1=\"O-OOO\",s2=\"OO-OO\",s3=\"OOO-O\",s4=\"OOOO-\",s0=\"-OOOO\";\n if(r%5==0)\n v[i]+=s0;\n else if(r%5==1)\n v[i]+=s1;\n else if(r%5==2)\n v[i]+=s2;\n else if(r%5==3)\n v[i]+=s3;\n else if(r%5==4)\n v[i]+=s4;\n i++;\n n=n/10;\n }\n for(int i=0;i\nusing namespace std;\n\nint main(){\n ios_base::sync_with_stdio(false);\n cin.tie(0);\n cout.tie(0);\n long long unsigned int n,m,k;\n cin>>n>>m>>k;\n vector v;\n long long unsigned int li=0,lj=0;\n if(k==n*m){\n cout<=n){li=n;}\n else{li=k+1;}\n if(k>=m){lj=m;}\n else{lj=k+1;}\n for(int i=0;ik){\n }\n else{\n v.push_back((i+1)*(j+1));\n }\n }\n }\n \n sort(v.begin(),v.end());\n cout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define hw \"Hello world\";\n#define vi(name,size) vector name (size);\n#define f(n) for(int i=0;i used;\nvector > g;\nvoid dfs (int v){\n used[v]=true;\n for (int i=0; i>array[i][j];\n }\n }\n for(int i=0;i<4;i++){\n for(int j=0;j<4;j++){\n //gorizont\n if(array[i][j]=='.' and array[i][j-1]=='x' and array[i][j-2]=='x'){\n cout<<\"YES\";\n return 0;\n }\n if(array[i][j]=='.' and array[i][j+1]=='x' and array[i][j+2]=='x'){\n cout<<\"YES\";\n return 0;\n }\n if(array[i][j]=='.' and array[i][j-1]=='x' and array[i][j+1]=='x'){\n cout<<\"YES\";\n return 0;\n }\n \n //vert\n if(array[i][j]=='.' and array[i+1][j]=='x' and array[i+2][j]=='x'){\n cout<<\"YES\";\n return 0;\n }\n if(array[i][j]=='.' and array[i-1][j]=='x' and array[i-2][j]=='x'){\n cout<<\"YES\";\n return 0;\n }\n if(array[i][j]=='.' and array[i-1][j]=='x' and array[i+1][j]=='x'){\n cout<<\"YES\";\n return 0;\n }\n \n //naisk vpravo\n if(array[i][j]=='x' and array[i+1][j-1]=='x' and array[i+2][j-2]=='x'){\n cout<<\"YES\";\n return 0;\n }\n if(array[i][j]=='x' and array[i+1][j+1]=='x' and array[i+2][j+2]=='x'){\n cout<<\"YES\";\n return 0;\n }\n if(array[i][j]=='x' and array[i+1][j+1]=='x' and array[i-1][j-1]=='x'){\n cout<<\"YES\";\n return 0;\n }\n \n //naisk vlevo\n \n if(array[i][j]=='x' and array[i-1][j-1]=='x' and array[i-2][j-2]=='x'){\n cout<<\"YES\";\n return 0;\n }\n if(array[i][j]=='x' and array[i-1][j-1]=='x' and array[i+1][j+1]=='x'){\n cout<<\"YES\";\n return 0;\n }\n if(array[i][j]=='x' and array[i+1][j+1]=='x' and array[i+2][j=2]=='x'){\n cout<<\"YES\";\n return 0;\n }\n \n \n \n }\n }\n \n \n cout<<\"NO\";\n return 0;\n}\n\n\n", "lang": "GNU C++", "bug_code_uid": "f870455df78264ec0abf8da83a9e863c", "src_uid": "ca4a77fe9718b8bd0b3cc3d956e22917", "apr_id": "4ed8ddec768edad9374dd2529ab2e349", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.991812032751869, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include \n\nusing namespace std;\n\n#define INF (1 << 30)\n\n#define MAXN 110\n\nchar s[MAXN];\nint b[MAXN];\n\nint main(){\n int n;\n while(scanf(\"%d\", &n) > 0){\n scanf(\"%s\", s);\n \n int ans = 0;\n for(int i=0; i b[n-1-i]){\n swap(b[i], b[n-1-i]);\n }\n }\n \n for(int i=0; i+i\n#include \n#include \n#define ms(a, v) memset(a, v, sizeof(a))\n#define INF_MAX 2147483647\n#define INF_MIN -2147483647\n#define EPS 1e-9\n#define fori(i, n) (int i = 0; i < (n);i++)\n#define pb push_back\n#define mp make_pair\n#define setzero(a) memset(a, 0, sizeof(a))\n#define setdp(a) memset(a, -1, sizeof(a))\n\nusing namespace std;\nvoid splitstr(const string &s, vector &v) {\n\t\t\t\t\tistringstream in(s);\n\t\t\t\t\t\tcopy(istream_iterator(in), istream_iterator(), back_inserter(v));\n}\n\ntypedef long long ll;\ntypedef pair ii;\ntypedef vector vii;\ntypedef vector vi;\n\nint main() {\n\tcin.sync_with_stdio(false);\n\tll mod = (ll) 1e9 + 7;\n\tll x, y, n;\n\tcin >> x >> y >> n;\n\tll z = y - x;\n\tif(z < 0) z = mod + z;\n\tif(x < 0) x = mod + x;\n\tif(y < 0) y = mod + y;\n\tn--;\n\tll k = n % 6;\n\tll v[3] = {x, y, z};\n\tif(k >= 0 && k < 3) {\n\t\t\tcout << v[k];\t\t\t\n\t} else {\n\t\tll res = -1*v[k - 3];\n\t\tif(res < 0) res = mod + res;\n\t\tcout << res ;\n\t} cout << endl;\n\t\n\n\treturn 0;\n}\n", "lang": "GNU C++0x", "bug_code_uid": "48b8c332d9ec49d263039109eb683640", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "apr_id": "d4b408f91713dba02abd363e2c4bd675", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9585714285714285, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \n#include \n#include \n#include \nusing namespace std;\n\nint main()\n{\n int len;\n cin>>len;\n string tstring;\n cin>>tstring;\n int maxoutlen = 0;\n int tempoutlen = 0;\n int incount = 0;\n bool in = false;\n bool counting = false;\n for (int i=0; imaxoutlen)\n {\n maxoutlen = tempoutlen;\n }\n tempoutlen = 0;\n counting = false;\n }\n else\n {\n if (counting)\n {\n if (tstring[i]=='_')\n {\n counting = false;\n if (tempoutlen>maxoutlen)\n {\n maxoutlen = tempoutlen;\n }\n tempoutlen = 0;\n }\n else\n {\n tempoutlen++;\n if (i==(len-1))\n {\n if (tempoutlen>maxoutlen)\n {\n maxoutlen=tempoutlen;\n }\n }\n }\n }\n else \n {\n if (tstring[i]!='_')\n {\n counting = true;\n tempoutlen++;\n }\n }\n } \n\n }\n /*\n cout<<\"tstring: \"<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#define fe first\n#define se second\n#define pb push_back\n#define mp make_pair\n#define FILENAME \"\"\n#define inf 2000000000000000000\n#define mod 1000000007\n#define ll long long\nusing namespace std;\n\nint main() {\n\tios_base::sync_with_stdio(false);\n\tcin.tie(NULL);\n\tll n;\n\tcin>>n;\n\t\n\tif(!(n&1)) {\n\t\tcout< primes(n+1, 0); \n \tprimes[1] = 1; \n\tfor (ll i = 2; i <= n; i++) { \n\t\tif (primes[i] == 0) { \n\t\t\tprimes[i] = i; \n\t\t\tfor (ll j = 2*i; j <= n; j += i) {\n\t\t\t\tif (primes[j] == 0) \n\t\t\t\t\tprimes[j] = i; \n\t\t\t}\n\t\t} \n\t} \n\t\t\n\tint count = 0;\n\twhile (n != 0 && n&1) {\n\t\tn -= primes[n];\n\t\tcount++;\n\t}\n\tcout<\nusing namespace std;\nint a[1000000],b[1000000],i,g,h,k,ans,n,m=6;\nint main(){\n cin>>n>>g>>k;\n if((k-n)%g==0 || (k-n)%(g-1)==0)\n {\n cout<<\"YES\";\n return 0;\n }\n cout<<\"NO\";\n}", "lang": "GNU C++14", "bug_code_uid": "f61bc8ab24144710692417d67e4261e8", "src_uid": "a993069e35b35ae158d35d6fe166aaef", "apr_id": "0cd849ae9d53b4d289dbd64427ec366a", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5146651909241837, "equal_cnt": 17, "replace_cnt": 11, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 17, "bug_source_code": "#include \nusing namespace std;\nconst int N = 200000;\n\n\nint main()\n{\n\nint n;\ncin >> n;\nvector a(n);\nvector> cnt(200);\nfor (int i=0; i> a[i];\n cnt[a[i]].first++;\n cnt[min(i+1,100)].second=i+1;\n}\n\n//cout << \"ME\";\n\nsort(cnt.rbegin(),cnt.rend());\n\nif (cnt[0].first==cnt[1].first){cout << n; return 0;}\nint D = cnt[0].second;\n//cout << D << \"\\n\";\n\nint mxn=0;\nint now=0;\n\nvector> mp(200);\n\n//cout << \"ME\";\n\nfor (int i=1; i<=100; i++)\n{\n mp[i][0]=-1;\n if (i==D) continue;\n\n long long sum=0;\n for (int j=0; j\n#include\n#include\nusing namespace std;\nint a,b,c,d=0;\nint i,j,k;\nint main(void)\n{\n cin>>a>>b;\n if(a==2&&b==3){\n cout<<\"YES\";\n return 0;\n }\n else if(a==2&&b!=3){\n cout<<\"NO\";\n return 0;\n }\n else{\n for(i=a+2;i<=50;i+2)\n {\n d=0;\n for(j=3;j<=50;j=j+2)\n {\n if(i%j==0)\n d++;\n }\n\n if(d==1)\n {\n\n break;\n }\n }\n }\n if(i==b)\n cout<<\"YES\";\n else\n cout<<\"NO\";\nreturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "bf290d1e1c0fd2f96a78f4ac62b8b38f", "src_uid": "9d52ff51d747bb59aa463b6358258865", "apr_id": "d92e9750e57854d1dd9b68ef1df7911f", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9981884057971014, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include\nusing namespace std;\nconst int N=2010,mod=998244353;\nint inc(int x,int y){x+=y;return x>=mod?x-mod:x;}\nint dec(int x,int y){x-=y;return x<0?x+mod:x;}\nint mul(int x,int y){return (long long)x*y%mod;}\nint power(int x,int y){\n int ans=1;\n for (;y;y>>=1,x=mul(x,x))\n if (y&1) ans=mul(ans,x);\n return ans;\n}\nint n,a,b,ans[N],dp[N],f[N][N],p,ip,pw[N],ipw[N];\nint main()\n{\n scanf(\"%d%d%d\",&n,&a,&b);\n p=mul(a,power(b,mod-2));\n ip=mod-p+1;\n pw[0]=ipw[0]=1;\n for (int i=1;i<=n;i++) pw[i]=mul(pw[i-1],p),ipw[i]=mul(ipw[i-1],ip);\n for (int i=0;i<=n;i++)\n for (int j=f[i][0]=1;j<=i;j++)\n f[i][j]=inc(mul(f[i-1][j-1],ipw[i-j]),mul(f[i-1][j],pw[j]));\n for (int i=1;i<=n;i++){\n dp[i]=1;\n for (int j=1;j\n#include \n#include \n \nusing namespace std;\ntypedef long long ll;\nconst ll P=998244353;\nint n;\nll p;\nll c[2010][2010],s[2010],f[2010],p0[2010],p1[2010];\ninline ll pm(ll x,ll y)\n{\n ll z=1;\n while(y)\n {\n if(y&1) z=z*x%P;\n x=x*x%P,y>>=1;\n }\n return z;\n}\nint main()\n{\n scanf(\"%d\",&n);\n int i,j,a,b;\n scanf(\"%d%d\",&a,&b),p=a*pm(b,P-2)%P;\n f[0]=f[1]=0,s[1]=1;\n for(p0[0]=p1[0]=1,i=1;i<=n;i++) p0[i]=p0[i-1]*p%P,p1[i]=p1[i-1]*(1-p)%P;\n for(i=1;i<=n;i++)\n {\n c[i][0]=1;\n for(j=1;j<=i;j++) c[i][j]=(c[i-1][j]*p1[j]+c[i-1][j-1]*p0[i-j])%P;\n }\n for(i=1;i<=n;i++)\n {\n s[i]=1;\n for(j=1;j\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define endl '\\n'\n#define EPS (1e-9)\n#define Pi 3.14159265358979\n#define INF 1000000500\n#define pb push_back\n#define mp make_pair\n#define S size()\n#define MX(aa,bb) (aa>bb?aa:bb)\n#define MN(aa,bb) (aa\n#define VI vector < int >\n#define DID (long long)\n#define ll long long\n#define AL(a) (a).begin(),(a).end()\n#define FORI(i,s,n) for (i = (s);i <=n;i++)\n#define FORS(i,s,n) for(i=s;i<=n;i+=s)\nusing namespace std;\nll a, n, i, j, k;\nint const size = 10000005;\nint const len = 4500;\nll b[size];\nvoid fillSquares(ll b[]){\n\n FORI(i, 1, size - 1){\n int l = i*i;\n FORS(j, l, size - 1){\n b[j] = l;\n }\n }\n}\nll answer(ll b[], ll a, ll n){\n ll ans = 0;\n FORI(i, a, a + n - 1){\n ans += i / b[i];\n }\n //cout << ans;\n return ans;\n}\nint main(){\n fill(b, b + size, 0);\n cin >> a >> n;\n fillSquares(b);\n cout << answer(b, a, n);\n //system(\"pause\");", "lang": "GNU C++11", "bug_code_uid": "3d062268fd0587c541c3d1785dab2a13", "src_uid": "915081861e391958dce6ee2a117abd4e", "apr_id": "64b7e884634d9368bb608657fdcae4b1", "difficulty": 1500, "tags": ["number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.776824034334764, "equal_cnt": 10, "replace_cnt": 4, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "#include\n\nusing namespace std;\n\n\nint main()\n{\n ios::sync_with_stdio(0);\n\n long long n,k;\n cin>>n>>k;\n\n while(1)\n {\n //n=n-k;\n\n if(n\n#define pb push_back\n#define x first\n#define y second\n#define mp make_pair\n#define files(FILENAME) read(FILENAME); write(FILENAME)\n#define read(FILENAME) freopen((FILENAME + \".in\").c_str(), \"r\", stdin)\n#define write(FILENAME) freopen((FILENAME + \".out\").c_str(), \"w\", stdout)\nusing namespace std;\n \ntemplateinline void chkmin(T1 &x, T2 y) { if (x > y) x = y; }\ntemplateinline void chkmax(T1 &x, T2 y) { if (x < y) x = y; }\n \ntypedef pair point;\n\nconst string FILENAME = \"input\";\n\nconst int MAXN = 2018;\n\nlong long p;\nint k;\n\nvector ans;\n\nint get(long long p, int k) {\n\tint r = p % k;\n\tif (r < 0) r += k;\n\treturn r;\n}\n\nvoid test(long long p, int k) {\n\tif (p == 0) {\n\t\treturn;\n\t} \n\tassert(ans.size() < 1e5);\n\tans.pb(get(p, k));\n\ttest(-((p - get(p, k)) / k), k);\n}\n\nint main() {\n\tios::sync_with_stdio(0);\n\tsrand(time(0));\n\tcin >> p >> k;\n\ttest(p, k);\n\tcout << ans.size() << endl;\n\tfor (int i : ans) cout << i << ' ';\n\tcout << endl;\n}", "lang": "GNU C++14", "bug_code_uid": "07769ed67dd82f3bca3ab6f2ae2f5185", "src_uid": "f4dbaa8deb2bd5c054fe34bb83bc6cd5", "apr_id": "e14d550e3ef4b89bed5fab47b6b962a0", "difficulty": 2000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.08858858858858859, "equal_cnt": 16, "replace_cnt": 13, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 16, "bug_source_code": "#include\nusing namespace std;\nint m,n,k,l,ans=0;\nint a[200005],b[200005][1000];\nint main(){\n\tcin>>m>>n;\n\tfor(int i=1;i<=m;i++){\n\t\tcin>>a[i];\n\t}\n\tint e=0;\n\tfor(int i=1;i<=m*n;i++){\n\t\te++;\n\t\tb[i][1]=a[e];\n\t\tb[i][2]=1;\n\t\tb[i][3]=0;\n\t\tif(e==m){\n\t\t\te=0;\n\t\t}\n\t}\n\tfor(int i=n*m-1;i>=1;i--){\n\t\tl=0,k=0;\n\t\tfor(int j=i+1;j<=n*m;j++){\n\t\t\tif((b[j][1]>=b[i][1])&&(b[j][2]>=l)){\n\t\t\t\tl=b[j][2];\n\t\t\t\tk=j;\n\t\t\t}\n\t\t\tif(l>0){\n\t\t\t\tb[i][2]=l+1;\n\t\t\t\tb[i][3]=k;\n\t\t\t}\n\t\t}\n\t}\n\tk=1;\n\tfor(int j=1;j<=m*n;j++){\n\t\tif(b[j][2]>=b[k][2]){\n\t\t\tk=j;\n\t\t}\n\t}\n\twhile(k!=0){\n\t\tans++;\n\t\tk=b[k][3];\n\t}\n\tcout<\n\nusing namespace std;\n\ntypedef long long LL;\nvector factor;\n\nLL GCD(LL a, LL b) {\n return b == 0 ? a : GCD(b, a % b);\n}\n\nLL sol(LL x, LL y, vector& f) {\n LL _ = GCD(x, y);\n x /= _;\n y /= _;\n if (x == 1) return y;\n// cout << x << \" \" << y << endl;\n if (y == 0) return 0;\n if (y % x == 0) {\n return y / x;\n }\n LL min_d = numeric_limits::max();\n LL gcd;\n for (int i = 0; i < (int) f.size(); ++i) {\n if (f[i] > x) break;\n if (f[i] > y) break;\n if (x % f[i] != 0) continue;\n LL a = y / f[i];\n LL d = y - a * f[i];\n if (d >= 0 && d <= min_d) {\n min_d = d;\n gcd = f[i];\n }\n }\n if (min_d == numeric_limits::max()) {\n if (y > x) {\n return y - x + 1;\n } else {\n return y;\n }\n }\n// cout << min_d << endl;\n return min_d + 1 + sol(x, (y - min_d) - gcd, f);\n}\n\nint main() {\n LL x, y;\n cin >> x >> y;\n for (LL i = 2; i * i <= x; ++i) {\n if (x % i == 0) {\n factor.push_back(i);\n factor.push_back(x / i);\n }\n }\n sort(factor.begin(), factor.end());\n cout << sol(x, y, factor) << endl;\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "4ffae95b14505d37128302395fc97049", "src_uid": "ea92cd905e9725e7fcb87b9ed4f64c2e", "apr_id": "eb9ea15b9ddb19f0a808453c3e5cbcc6", "difficulty": 2100, "tags": ["math", "implementation", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9816643159379408, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \nusing namespace std;\nint main(){\n int n,m,k,d,i=1;cin>>n>>m>>k;\n string s;cin>>s>>s;\n d=s[0]=='h'?-1:1;\n for(char c;cin>>c;++i){\n m1?--m:m>k&&mn&&(k-=2,d=-1);\n k||(k+=2,d=1);\n if(c-'0')m=k==1||d<0&&k\n#include\n#include\nusing namespace std;\ntypedef long long int lli;\n// #define M=100000;\n \nint main()\n{\n\tint l,m,n,q = 0,k,x1,y1,x2,y2,idx1 = 0,idx2 = 0;\n cin>>x1>>x2;\n \n cout<<((pow(2,x1)) % 998244353 * (pow(2, x2)) % 998244353) % 998244353 ;\n return 0;\n \n}", "lang": "GNU C++14", "bug_code_uid": "2db73fb8253eaac3d96a8d7e02c36ce4", "src_uid": "8b2a9ae21740c89079a6011a30cd6aee", "apr_id": "2564873557db406f19243c6158da8e79", "difficulty": 1300, "tags": ["math", "combinatorics", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9794680354643024, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n//~ #include \n#define all(x) x.begin() , x.end()\n#define fi first\n#define se second\n#define pb push_back\n#define umax( x , y ) x = max( x , (y) )\n#define umin( x , y ) x = min( x , (y) )\n#define For( i , a ) for(int i=1;i<=a;i++)\n#define ort (b+s)/2\n#define y2 asrwjaelkf\n#define y1 asseopirwjaelkf\n#define hash ____hash\n\nusing namespace std;\n#include \nusing namespace __gnu_cxx;\n\ninline int read() {\n\tint res = 0 ;int neg ;\n\twhile(true){char ch = getchar();if(ch>='0' && ch<='9' || ch=='-'){if(ch=='-') neg = -1;else neg = 1 , res = ch-'0';break;}if(ch=='?'){return 2e9+1;} }\n\twhile(true){char ch = getchar();if(ch>='0' && ch<='9') res*=10 , res+=ch-'0';else break;}\n\treturn res*neg;\n}\n\nconst int maxn = 2020;\nconst int maxm = 420;\nconst int MOd = 1e9+7;\nconst int P = 37;\n\ntypedef long long Lint;\ntypedef double db;\ntypedef pair ii;\ntypedef pair iii;\ntypedef pair ci;\ntypedef pair ici;\n\nint a, b, c, m;\nbool used[maxn];\nvector v;\nhash_map mp[maxm][maxn];\n\nint mul( int a, int b ) {\n\treturn (Lint)(a*b)&m;\n}\n\nint add( int a, int b ) {\n\treturn (a+b)&m;\n}\n\nLint f( int a, int b, int c, int n ) {\n\t\n\t//~ printf(\"asdasd %d %d %d %d\\n\",a,b,c,n);\n\tif( n >= v.size() ) return 1;\n\t\n\tint t = 2001*b+c;\n\t//~ printf(\"asd\\n\");\n\tif( mp[n][a].count( t ) ) return mp[n][a][t];\n\n\tint &ret = mp[n][a][t];\n\tint p = v[n];\n\tfor(int i=0,va=a;va;va/=p,i++)\n\t\tfor(int j=0,vb=b;vb;vb/=p,j++)\n\t\t\tfor(int k=0,vc=c;vc;vc/=p,k++)\n\t\t\t\tret = add( ret, mul( f( va, vb, vc, n+1 ), i+j+k+1 ) );\n\t\n\treturn ret;\n}\n\nint main() {\n\t\n\t//~ printf(\"asd\\n\");\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tint maxx = 2000;\n\tm = (1<<30)-1;\n\t//~ printf(\"asd\\n\");\n\tfor(int i=2;i<=maxx;i++) {\n\t\tif( used[i] ) continue;\n\t\tv.pb( i );\n\t\tfor(int j=i;j<=maxx;j+=i)\n\t\t\tused[j] = 1;\n\t}\n\treverse( all( v ) );\n\t\n\t//~ printf(\"asd\\n\");\n\tcout << f( a, b, c, 0 ) << endl;\n\t\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "8a7434333125d7e835f2133a99757996", "src_uid": "4fdd4027dd9cd688fcc70e1076c9b401", "apr_id": "19614bd61a57b482d4c10b029a11a3c4", "difficulty": 2600, "tags": ["dp", "combinatorics", "number theory", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8321167883211679, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include\nusing namespace std;\ntypedef long long int ll;\n#define M_PIl 3.141592653589793238462643383279502884L\nset ans;\n\n\nint main(){\n ios_base::sync_with_stdio(false);\n cin.tie(NULL);\n \n ll n;\n cin>>n;\n\n vector a = {0, 4, 10, 20, 35, 56, 83, 116, 155, 198, 244, 292};\n if (n < a.size()) return a[n];\n else return a[11] + 49 * (n - 11);\n\n return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "9b1df96aab389227e49ef3306465b40f", "src_uid": "75ec99318736a8a1b62a8d51efd95355", "apr_id": "f6e6f6ae1b862c45bfd9d932b023bbdc", "difficulty": 2000, "tags": ["dp", "combinatorics", "greedy", "math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7633689839572193, "equal_cnt": 4, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "#include\nusing namespace std;\n\nchar ch[20][50]={\"vaporeon\", \"jolteon\", \"flareon\", \"espeon\", \"umbreon\", \"leafeon\", \"glaceon\", \"sylveon\"};\nchar tar[50];\nint ok[50];\nint n;\n\nint main()\n{\n\t//freopen(\"input.txt\",\"r\",stdin);\n\tmemset(ok,-1,sizeof(ok));\n\tscanf(\"%d\",&n);\n\tif(n==6) \n\t{\n\t\tprintf(\"espeon\");\n\t\treturn 0;\n\t}\n\tif(n==8) \n\t{\n\t\tprintf(\"vaporeon\");\n\t\treturn 0;\n\t}\n\tscanf(\"%s\",tar);\n\tfor(int i=0;i\nusing namespace std;\nconst int maxN = 55;\nconst int mod = (int)1e9 + 7;\nint sum(int a, int b) {\n int s = a + b;\n if (s >= mod) s -= mod;\n return s;\n}\nint mult(int a, int b) {\n return (1LL * a * b) % mod;\n}\nint pw[maxN * maxN];\nint c[maxN];\nint dp[maxN][maxN][maxN][maxN][2];\nint n, p;\nint get(int x, int y) {\n if (y == 0) {\n if (x == 0) return 1;\n else return 0;\n }\n return pw[y - 1];\n}\nint val(int a, int b, int c, int d, int e) {\n if (a < 0 || b < 0 || c < 0 || d < 0) return 0;\n return dp[a][b][c][d][e];\n}\nint main() {\n srand(time(0));\n //freopen(\"input.txt\", \"r\", stdin);\n ios_base::sync_with_stdio(false);\n pw[0] = 1;\n for (int i = 1; i < maxN * maxN; i++) {\n pw[i] = sum(pw[i - 1], pw[i - 1]);\n }\n cin >> n >> p;\n for (int i = 1; i <= n; i++) cin >> c[i];\n dp[n + 1][0][0][0][0] = 1;\n for (int i = n; i >= 1; i--) {\n for (int white = 0; white <= n - i + 1; white++) {\n int black = n - i + 1 - white;\n for (int eW = 0; eW <= white; eW++) {\n for (int eB = 0; eB <= black; eB++) {\n for (int bit = 0; bit < 2; bit++) {\n int st = 0;\n int oW = white - eW;\n int oB = black - eB;\n for (int clr = 0; clr < 2; clr++) {\n if (c[i] != -1 && clr != c[i]) continue;\n for (int pBit = 0; pBit < 2; pBit++) {\n int ne = pBit ^ bit;\n if (clr == 0) {\n st = sum(st, mult(val(i + 1, white - 1, oW - ne, oB, pBit), get(ne ^ 1, oB)));\n }\n else {\n st = sum(st, mult(val(i + 1, white, oW, oB - ne, pBit), get(ne ^ 1, oW)));\n }\n }\n }\n dp[i][white][oW][oB][bit] = st;\n }\n }\n }\n }\n }\n int cur = 0;\n for (int i = 0; i <= n; i++) {\n for (int j = 0; j <= n; j++) {\n for (int k = 0; k <= n; k++) {\n for (int r = 0; r <= n; r++) {\n cur = sum(cur, dp[i][j][k][p]);\n }\n }\n }\n }\n cout << cur;\n return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "e744d6964a91baaa2843e9428d61b8d5", "src_uid": "aaf5f8afa71d9d25ebab405dddec78cd", "apr_id": "65ff9d5516114714e61749380356b01e", "difficulty": 2400, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9999338842975206, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "/*\n* C++11 code template for contests.\n* @author: Andrei Kalendarov\n* @e-mail: andreykalendarov@gmail.com\n*/\n\n//#define ANDREIKKAA_ALLOCATOR\nconst int _ML = 228;\n\nconst char _inpf[] =\n#if defined(ANDREIKKAA)\n \"input.txt\"\n#else\n \"\"\n#endif\n;\nconst char _outf[] =\n#if defined(ANDREIKKAA)\n \"\"\n#else\n \"\"\n#endif\n;\n\n#if defined(ANDREIKKAA)\n#undef NDEBUG\n#else\n#pragma GCC optimize(\"O3,no-stack-protector\")\n#endif\n#include \n#if !defined(ANDREIKKAA)\n#define endl '\\n'\n#endif\n#define x first\n#define y second\nusing namespace std;\n#define rand abcdefghijklmnopqrstuvwxyz\n#define random_shuffle abcdefghijklmnopqrstuvwxyz\n#define all(x) (x).begin(), (x).end()\n#define sz(x) (int)(x).size()\ntypedef long long ll;\ntypedef double ld;\nconst ld PI = 3.14159265358979323846;\nmt19937 rd(228);\n#if defined(ANDREIKKAA_ALLOCATOR)\nchar _mem[_ML * 1024 * 1024];\nsize_t _ptr = 0;\ninline void* operator new (size_t _x) { _ptr += _x; assert(_ptr < _ML * 1024 * 1024); return _mem + _ptr - _x; }\ninline void operator delete (void*) { }\n#endif\ntemplate inline ostream &operator<< (ostream &, const pair &);\ntemplate inline istream &operator>> (istream &, pair &);\ntemplate inline ostream &operator<< (ostream &, const vector &);\ntemplate inline istream &operator>> (istream &, vector &);\ntemplate inline ostream &operator<< (ostream &, const set &);\ntemplate inline ostream &operator<< (ostream &, const multiset &);\ntemplate inline ostream &operator<< (ostream &, const unordered_set &);\ntemplate inline ostream &operator<< (ostream &, const unordered_multiset &);\ntemplate inline ostream &operator<< (ostream &, const map &);\ntemplate inline ostream &operator<< (ostream &, const unordered_map &);\n\n/* ________ CODE ________ */\n\nconst int N = 52;\nconst int M = 1000 * 1000 * 1000 + 7;\nint dp[2][N][N][N][N];\nint a[N];\nint pww[N];\n\ninline int pw2(int x)\n{\n if(x == -1)\n {\n return 1;\n }\n return pww[x];\n}\n\ninline int mul(int a, int b)\n{\n return (int)((ll)a * b % M);\n}\n\ninline void addeq(int &a, int b)\n{\n a = (a + b) % M;\n}\n\ninline void _main_function()\n{\n pww[0] = 1;\n for(int i = 1; i < N; ++i)\n {\n pww[i] = mul(pww[i - 1], 2);\n }\n\n int n, p;\n cin >> n >> p;\n for(int i = 0; i < n; ++i)\n {\n cin >> a[i];\n }\n\n dp[1][0][0][0][0] = 1;\n\n for(int i = 0; i < n; ++i)\n {\n int cur = (i & 1);\n int lst = (~i & 1);\n memset(dp[cur], 0, sizeof dp[cur]);\n for (int be = 0; be <= i; ++be) {\n for (int bo = 0; bo <= i; ++bo) {\n for (int we = 0; we <= i; ++we) {\n for (int wo = 0; wo <= i; ++wo) {\n if (dp[lst][be][bo][we][wo] == 0) {\n continue;\n }\n\n\n if (a[i] != 1)\n {\n int value = mul(pw2(be + bo + we), pw2(wo - 1));\n\n addeq(dp[cur][be][bo + 1][we][wo],\n mul(dp[lst][be][bo][we][wo], value);\n if(wo != 0)\n {\n addeq(dp[cur][be + 1][bo][we][wo],\n mul(dp[lst][be][bo][we][wo], value));\n }\n\n //black\n\n }\n if (a[i] != 0)\n {\n int value = mul(pw2(we + wo + be), pw2(bo - 1));\n\n //white\n if(bo != 0)\n {\n addeq(dp[cur][be][bo][we + 1][wo],\n mul(dp[lst][be][bo][we][wo], value));\n }\n addeq(dp[cur][be][bo][we][wo + 1],\n mul(dp[lst][be][bo][we][wo], value));\n }\n }\n }\n }\n }\n }\n\n int cur = ((n - 1) & 1);\n int ans = 0;\n for (int be = 0; be <= n; ++be) {\n for (int bo = 0; bo <= n; ++bo) {\n for (int we = 0; we <= n; ++we) {\n for (int wo = 0; wo <= n; ++wo) {\n if(((bo + wo) & 1) == p) {\n addeq(ans, dp[cur][be][bo][we][wo]);\n }\n\n }\n }\n }\n }\n\n cout << ans << endl;\n\n}\n\n/* ________ CODE ________ */\n\nint main()\n{\n#if defined(ANDREIKKAA)\n time_t _start = clock();\n#endif\n if (_inpf[0] != '\\0') assert(freopen(_inpf, \"r\", stdin) != nullptr);\n if (_outf[0] != '\\0') assert(freopen(_outf, \"w\", stdout) != nullptr);\n cin.tie(nullptr);\n ios_base::sync_with_stdio(false);\n\n cout << setprecision(20);\n //cout << fixed;\n\n _main_function();\n#if defined(ANDREIKKAA)\n cout << \"Time: \" << (clock() - _start) / (ld)CLOCKS_PER_SEC << endl;\n#endif\n}\n\ntemplate inline ostream &operator<< (ostream &_out, const pair &_p)\n{\n _out << _p.x << ' ' << _p.y;\n return _out;\n}\ntemplate inline istream &operator>> (istream &_in, pair &_p)\n{\n _in >> _p.x >> _p.y;\n return _in;\n}\ntemplate inline ostream &operator<< (ostream &_out, const vector &_v)\n{\n if (_v.empty()) { return _out; }\n _out << *_v.begin();\n for (auto _it = ++_v.begin(); _it != _v.end(); ++_it) { _out << ' ' << *_it; }\n return _out;\n}\ntemplate inline istream &operator>> (istream &_in, vector &_v)\n{\n for (auto &_i : _v) { _in >> _i; }\n return _in;\n}\ntemplate inline ostream &operator<< (ostream &_out, const set &_s)\n{\n if (_s.empty()) { return _out; }\n _out << *_s.begin();\n for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; }\n return _out;\n}\ntemplate inline ostream &operator<< (ostream &_out, const multiset &_s)\n{\n if (_s.empty()) { return _out; }\n _out << *_s.begin();\n for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; }\n return _out;\n}\ntemplate inline ostream &operator<< (ostream &_out, const unordered_set &_s)\n{\n if (_s.empty()) { return _out; }\n _out << *_s.begin();\n for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; }\n return _out;\n}\ntemplate inline ostream &operator<< (ostream &_out, const unordered_multiset &_s)\n{\n if (_s.empty()) { return _out; }\n _out << *_s.begin();\n for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; }\n return _out;\n}\ntemplate inline ostream &operator<< (ostream &_out, const map &_m)\n{\n if (_m.empty()) { return _out; }\n _out << '(' << _m.begin()->x << \": \" << _m.begin()->y << ')';\n for (auto _it = ++_m.begin(); _it != _m.end(); ++_it) { _out << \", (\" << _it->x << \": \" << _it->y << ')'; }\n return _out;\n}\ntemplate inline ostream &operator<< (ostream &_out, const unordered_map &_m)\n{\n if (_m.empty()) { return _out; }\n _out << '(' << _m.begin()->x << \": \" << _m.begin()->y << ')';\n for (auto _it = ++_m.begin(); _it != _m.end(); ++_it) { _out << \", (\" << _it->x << \": \" << _it->y << ')'; }\n return _out;\n}\n", "lang": "GNU C++17", "bug_code_uid": "09abbf4501bb241020d7c5f47df24504", "src_uid": "aaf5f8afa71d9d25ebab405dddec78cd", "apr_id": "d1f96ab47fd416226b1d536c2280ecbc", "difficulty": 2400, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9412559081701553, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define REP(i,a,n) for(int i=a;i<=n;++i)\n#define PER(i,a,n) for(int i=n;i>=a;--i)\n#define hr putchar(10)\n#define pb push_back\n#define lc (o<<1)\n#define rc (lc|1)\n#define mid ((l+r)>>1)\n#define ls lc,l,mid\n#define rs rc,mid+1,r\n#define x first\n#define y second\n#define io std::ios::sync_with_stdio(false)\n#define endl '\\n'\nusing namespace std;\ntypedef long long ll;\ntypedef pair pii;\nconst int P = 1e9+7, INF = 0x3f3f3f3f;\nll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}\nll qpow(ll a,ll n) {ll r=1%P;for (a%=P;n;a=a*a%P,n>>=1)if(n&1)r=r*a%P;return r;}\nll inv(ll x){return x<=1?1:inv(P%x)*(P-P/x)%P;}\n//head\n\n\n\n\n#ifdef ONLINE_JUDGE\nconst int N = 1e6+10;\n#else\nconst int N = 111;\n#endif\n\n\nint n;\nchar c[N];\nint x[N], y[N];\nint dp[N][150];\nvoid chkmax(int &a, int b) {a=max(a,b);}\nint main() {\n\tscanf(\"%d\", &n);\n\tREP(i,0,n-1) scanf(\" %c%d%d\", c+i, x+i, y+i);\n\tmemset(dp, 0xbc, sizeof dp);\n\tdp[0][0] = 0;\n\tint mx = (1<>k&1) {\n\t\t\tif (c[k]=='R') ++A;\n\t\t\telse ++B;\n\t\t}\n\t\tREP(k,0,n-1) if (!(i>>k&1)) {\n\t\t\tREP(j,0,120) if (dp[i][j]!=0xbcbcbcbc) { \n\t\t\t\tchkmax(dp[i^1<\n#include \n\nusing namespace std;\n\nvoid Sort (int left, int right, int *mas) {\n\tint l = left, r = right, m = (left + right) / 2;\n\twhile (l <= r) {\n\t\twhile (mas[l] < mas[m])\n\t\t\tl++;\n\t\twhile (mas[m] < mas[r])\n\t\t\tr--;\n\t\tif (l <= r) {\n\t\t\tint temp = mas[l];\n\t\t\tmas[l] = mas[r];\n\t\t\tmas[r] = temp;\n\t\t}\n\t}\n\tif (left < r)\n\t\tSort (left, r, mas);\n\tif (l < right)\n\t\tSort (l, right, mas);\n}\n\nint main () {\n\tint n;\n\tcin >> n;\n\tint *a = new int[n];\n\tint sum = 0;\n\n\tfor (int i = 0; i < n; i++)\n\t\tcin >> a[i];\n\tSort (0, n - 1, a);\n\tfor (int i = 0; i < n; i += 2) {\n\t\tif (a[i] != a[i + 1])\n\t\t\tsum += abs (a[i] - a[i + 1]);\n\t}\n\tcout << sum;\n\n\treturn 0;\n}", "lang": "GNU C++17", "bug_code_uid": "b8de06831f41b21f060542ebc3019367", "src_uid": "55485fe203a114374f0aae93006278d3", "apr_id": "5f47def82b07db22bb5730aff10df393", "difficulty": 800, "tags": ["sortings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.4728682170542636, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "#include \n#define ll long long\n#define pii pair\n#define eps 1e-9\nusing namespace std;\n\npii rec(ll a,ll b){\n if(a==0 || b==0)return pii(a,b);\n if(a>=2*b)return rec(a-2*b,b);\n if(b>=2*a)return rec(a,b-2*a);\n return pii(a,b);\n}\n\nint main(){\n//\tfreopen(\"test.in\",\"r\",stdin);\n//\tfreopen(\"test.out\",\"w\",stdout);\n ll a,b;cin>>a>>b;\n pii ans = rec(a,b);\n cout<\n#include \nint main()\n{\n\tFILE* fin = freopen(\"in.txt\", \"rt\", stdin);\n\tint white = 0, black = 0;\n\tfor(int i = 0; i < 8; i++)\n\t{\n\t\tchar l[10];\n\t\tmemset(l, 0, sizeof(l));\n\t\tscanf(\"%s\",l);\n\t\tfor(int j = 0; j< 8;j++)\n\t\t{\n\t\t\tswitch(l[j])\n\t\t\t{\n\t\t\tcase 'q':\n\t\t\t\tblack += 9;\n\t\t\t\tbreak;\n\t\t\tcase 'r':\n\t\t\t\tblack+=5;\n\t\t\t\tbreak;\n\t\t\tcase 'b':\n\t\t\t\tblack+=3;\n\t\t\t\tbreak;\n\t\t\tcase 'n':\n\t\t\t\tblack+=3;\n\t\t\t\tbreak;\n\t\t\tcase 'p':\n\t\t\t\tblack+=1;\n\t\t\t\tbreak;\n\t\t\tcase 'Q':\n\t\t\t\twhite += 9;\n\t\t\t\tbreak;\n\t\t\tcase 'R':\n\t\t\t\twhite += 5;\n\t\t\t\tbreak;\n\t\t\tcase 'B':\n\t\t\t\twhite += 3;\n\t\t\t\tbreak;\n\t\t\tcase 'N':\n\t\t\t\twhite += 3;\n\t\t\t\tbreak;\n\t\t\tcase 'P':\n\t\t\t\twhite += 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif (white > black)\n\t\tprintf(\"White\\n\");\n\telse if(black > white)\n\t\tprintf(\"Black\\n\");\n\telse\n\t\tprintf(\"Draw\\n\");\n\tfclose(fin);\n\treturn 0;\n}", "lang": "MS C++", "bug_code_uid": "504365abcb2855fca65022e6c079ffea", "src_uid": "44bed0ca7a8fb42fb72c1584d39a4442", "apr_id": "ef1195f36ca9be7dd9cbfb36a027f7cd", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.5762572135201979, "equal_cnt": 19, "replace_cnt": 12, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 18, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n#define rep(i,n) for(int i=0;i a[maxn];\n\nvoid danhdau(int x,int g)\n{\n s[x]=g;\n rep(j,a[x].size())\n {\n int kq[2];\n kq[0]=0;\n kq[1]=0;\n int p=a[x][j];\n rep(l,a[p].size()) kq[s[a[p][l]]]++;\n if (kq[0]>1&&s[p]==0)\n {\n rep(l,a[p].size()) if (s[a[p][l]]==0)\n {\n danhdau(a[p][l],1);\n break;\n }\n }\n else\n {\n if (kq[1]>1&&s[p]==1) rep(l,a[p].size()) if (s[a[p][l]]==1)\n {\n danhdau(a[p][l],0);\n break;\n }\n }\n }\n}\n\nint main()\n{\n #ifndef ONLINE_JUDGE\n freopen(\"test.inp\",\"r\",stdin);\n #endif // ONLINE_JUDGE\n\tscanf(\"%d%d\",&n,&m);\n\tint x,y;\n\trep(i,m) scanf(\"%d%d\",&x,&y),a[x].push_back(y),a[y].push_back(x);\n\trep(i,n) s[i]=2;\n\tforu(i,1,n)\n\t{\n\t\tkq[0]=0;\n\t\tkq[1]=0;\n\t\trep(j,a[i].size()) kq[s[a[i][j]]]++;\n\t\tif (kq[0]>1) danhdau(i,1);\n\t\telse danhdau(i,0);\n\t}\n\tforu(i,1,n) printf(\"%d\",s[i]);\n}\n", "lang": "GNU C++", "bug_code_uid": "060275331ad714bf2fe8f8a2a6bfe07d", "src_uid": "7017f2c81d5aed716b90e46480f96582", "apr_id": "25c6cd6ca974e1739a7e35f27684219b", "difficulty": 2200, "tags": ["graphs", "combinatorics", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.586924219910847, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\ntypedef long long LL;\n\nstruct point\n{\n\tLL x,y;\n}a,b,c;\nLL AB,BC;\ndouble k1,k2;\nLL t(point x,point y)\n{\n\treturn (x.x-y.x)*(x.x-y.x)+(x.y-y.y)*(x.y-y.y);\n}\ndouble tt(point x,point y)\n{\n\treturn (y.y-x.y)/(y.x-x.x);\n}\nint main()\n{\n\tcin>>a.x>>a.y>>b.x>>b.y>>c.x>>c.y;\n\tAB=t(a,b);\n\tBC=t(b,c);\n\tif(AB==BC)\n\t{\n\t\tif(a.x-b.x==0&&b.x-c.x==0)\n\t\t{\n\t\t\tcout<<\"No\"<\n#include \n\nint main()\n{\n int n;\n int min;\n std::cin >> n;\n std::vector min_notes;\n \n for (int i = 0; i < n + 1; i++)\n {\n if (min_notes.size() < 1)\n {\n min_notes.push_back(0);\n }\n else if (min_notes.size() < 5)\n {\n min_notes.push_back(min_notes[i - 1] + 1);\n }\n else if (min_notes.size()<10)\n {\n min_notes.push_back(min_notes[i - 5] + 1);\n }\n else if (min_notes.size() < 20)\n {\n min_notes.push_back(min_notes[i - 10] + 1);\n }\n else if (min_notes.size() < 100)\n {\n min_notes.push_back(min_notes[i - 20] + 1);\n }\n else \n {\n min_notes.push_back(min_notes[i - 100] + 1);\n }\n }\n std::cout << min_notes.back();\n}\n", "lang": "MS C++ 2017", "bug_code_uid": "ad8165fb6dcc4859c00c407a91b068d0", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "apr_id": "1efb5806c9526118c2bef87f0458cabb", "difficulty": 800, "tags": ["dp", "greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.4512820512820513, "equal_cnt": 12, "replace_cnt": 8, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "#include \nusing namespace std;\nint n,t=0,m;\nint main()\n{\n cin>>n>>m;\n for(int i=0; i<=1000000; i++)\n if((n-(i*i))*(n-(i*i))+i==m)\n t++;\n cout<\n#define ll long long int\n#define llu unsigned long long int\nusing namespace std;\n\n//Never Give Up,Try Once More\n//God Just Give Me One Shot\nll n,k,M;\nvectorv1;\n\nmap >, ll>m1;\nll solve(ll currind,ll timeleft,ll mextillnow)\n{\n if(m1[{currind,{timeleft,mextillnow}}]!=0)\n {\n return m1[{currind,{timeleft,mextillnow}}];\n }\n if(currind==k)\n return mextillnow;\n ll ans = 0 ;\n ll mexthatcanbedone = timeleft/v1[currind];\n mexthatcanbedone = min(mexthatcanbedone,n);\n for(ll i = 0;i<=mexthatcanbedone;i+=1)\n {\n ans = max(ans,i+solve(currind+1, timeleft-(v1[currind]*i),min(i,mextillnow)));\n }\n return m1[{currind,{timeleft,mextillnow}}] = ans;\n}\n\nint main()\n{\n ios_base::sync_with_stdio(0);\n cin.tie(0);\n // freopen(\"a.in\", \"r\", stdin);\n cin>>n>>k>>M;\n for (int i = 0 ; i>x;\n v1.push_back(x);\n }\n cout</*{{{*/\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;typedef long long ll;typedef long double real;void run();int main(){ios::sync_with_stdio(0);run();}/*}}}*/\nll const lots=1000000009ll;\nint n,h;\n\nstatic int memo[1000][32][32][32][32];\nll plough[100];\n\nint calc(int n,int a,int b,int c,int d){\n a=min(a,h); b=min(b,h); c=min(c,h); d=min(d,h);\n if (n>n>>h;\n plough[0]=1; for (int i=0; i<50; i++) (plough[i+1]=plough[i]*4)%lots;\n cout<<(lots+calc(n,0,0,0,0))%lots< \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\nconst int N = 100005;\n# define PI 3.141592657\nstruct node{\n\tlong long int x;\n\tlong long int y;\n}sum[N];\nbool cmp(struct node a,struct node b){\n\tif(a.x < b.x) \n { \n return true; \n } \n return false; \n}\nint main()\n{\n\tint n, a, b, c, d;\n\tint x[3][3];\n\twhile (cin >> n >> a >> b >> c >> d)\n\t{\n\t\tx[0][1] = a;\n\t\tx[1][0] = b;\n\t\tx[1][2] = c;\n\t\tx[2][1] = d;\n\t\tint num = 0;\n\t\tfor (int i = 1; i <= n; i++)\n\t\t{\n\t\t\tx[1][1] = i;\n\t\t\tfor (int j = 1; j <= n; j++)\n\t\t\t{\n\t\t\t\tx[0][0]=j;\n\t\t\t\tint count =x[0][0]+x[0][1]+x[1][0]+x[1][1];\n\t\t\t\tif ((count-(x[0][1]+x[1][1]+x[1][2]) <= n&&count-(x[0][1]+x[1][1]+x[1][2]) >= 1) && (count-(x[1][0]+x[1][1]+x[2][1])<=n&&count-(x[1][0]+x[1][1]+x[2][1]) >= 1) && (count - (x[2][1]+x[1][1]+x[1][2])<=n&&count - (x[2][1]+x[1][1]+x[1][2])>=1))\n\t\t\t\t{\n\t\t\t\t\tnum ++;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\t\tcout<\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n\n#define pb push_back\n#define mp make_pair\n#define F first\n#define S second\n\nusing namespace std;\n\ntypedef long long ll;\ntypedef unsigned long long ull;\ntypedef long double ld;\ntypedef vector vi;\ntypedef vector vll;\ntypedef vector vull;\ntypedef pair pii;\ntypedef pair pll;\n\nconst int INF = INT_MAX;\nconst ull mod = 1e5;\n\nint main()\n{\n cin.tie(0);\n ios_base::sync_with_stdio(0);\n //freopen(\"input.txt\", \"r\", stdin);\n //freopen(\"output.txt\", \"w\", stdout);\n ull n, c;\n string s;\n cin >> s;\n n = (s[0] - '0') * 10000 + (s[2] - '0') * 1000 + (s[4] - '0') * 100\n + (s[3] - '0') * 10 + (s[1] - '0'), c = n;\n for (int i = 0; i < 4; i++)\n n *= c, n %= mod;\n ull x = n, k = 1;\n while (x > 0)\n x /= 10, k++;\n for (int i = 0; i < 5 - k; i++)\n cout << 0;\n cout << n << \"\\n\";\n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "2697ac372487f7007128bf6b33fb1096", "src_uid": "51b1c216948663fff721c28d131bf18f", "apr_id": "7fa4c172656c025b726a89918fc0af48", "difficulty": 1400, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9944341372912802, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include \nusing namespace std;\n\n\nint findDay(string day){\n\tif(day == \"monday\")\n\treturn 1;\n\tif(day == \"tuesday\")\n\treturn 2;\n\tif(day == \"wednesday\")\n\treturn 3;\n\tif(day == \"thursday\")\n\treturn 4;\n\tif(day == \"friday\")\n\treturn 5;\n\tif(day == \"saturday\")\n\treturn 6;\n\tif(day == \"sunday\")\n\treturn 7;\n\t\n}\nint main() {\n\tstring day1, day2;\n\tcin>>day1>>day2;\n\tint a, b;\n\t\n\ta = findDay(day1);\n\tb = findDay(day2);\n\t\n\tint c;\n\tif(a>b)\n\t\tc= a-b;\n\telse\n\t\tc = b-a;\n\tif(c == 0 || c == 2 || c == 3)\n\t\tcout<<\"YES\";\n\telse\n\t\tcout<<\"NO\";\n\t\n\t\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "447e7426d54d6a7e2d07f237ce9d8211", "src_uid": "2a75f68a7374b90b80bb362c6ead9a35", "apr_id": "6298abaa545b64b9cb1e3c6edec39af2", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.24, "equal_cnt": 16, "replace_cnt": 12, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 17, "bug_source_code": " #include \nusing namespace std;\nint main(){\n int n,k;\n cin>>n>>k;\n vector vec(n);\n for(int i=0;i>vec[i];\n vector mp(n,0);\n for(int i=0;ik)\n cout<<\"1\\n\";\n else if(x==k)\n cout<<\"0\\n\";\n else\n cout<\n#include \n\nusing namespace std;\n\nint main(int argc, char *argv[])\n{\n \n\nint n;\nint count=0;\ncin>>n;\nint xx=0;\nint max=1;\nint ar[26]={0};\nint zz;\nint yy=0;\nfor (int i=0;i>ar[i];\n if (ar[i]>ar[i+1])\n {\n\n xx++;\n}\nelse\nyy++;\n \n\n \n}\n\nif (xx>yy)\nmax=xx;\nelse\nmax=yy;\n\ncout<\nusing namespace std;\nint a, b, c, d;\nint main() {\n scanf(\"%02d:%02d%02d:%02d\", a, b, c, d);\n if (c == 0)\n printf(\"00:%02d\", d - b);\n else {\n c--, d += 60;\n printf(\"%02d:%02d\", d / 60 + c - a, d % 60);\n }\n}", "lang": "GNU C++17", "bug_code_uid": "33701ada6707b6594130843f1acce80d", "src_uid": "595c4a628c261104c8eedad767e85775", "apr_id": "4af510efc6757f66ab635acdc17e89c9", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9306789904017063, "equal_cnt": 10, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "#include\nusing namespace std;\nconst int N = 100010;\nconst long long mod = 1000000007;\nlong long qpow(long long a,long long b){\n long long ans=1;\n while(b){\n if(b&1) ans=ans*a%mod;\n a=a*a%mod;\n b/=2;\n }\n return ans;\n}\nint fa[N];\nmap px,py,line[2][N];\nint num[2][N];\nint x[N],y[N],n;\n\nint get_fa(int x){\n if(fa[x]==x) return x;\n return fa[x]=get_fa(fa[x]);\n}\n\nint main(){\n scanf(\"%d\",&n);\n for(int i=1;i<=n;i++) fa[i]=i;\n for(int i=1;i<=n;i++){\n scanf(\"%d%d\",&x[i],&y[i]);\n if(px[x[i]]&&py[x[i]]){\n fa[i]=px[x[i]];\n fa[py[y[i]]]=px[x[i]];\n }\n else if(px[x[i]]){\n fa[i]=px[x[i]];\n py[y[i]]=i;\n }\n else if(py[y[i]]){\n fa[i]=py[y[i]];\n px[x[i]]=i;\n }\n else{\n px[x[i]]=i;\n py[y[i]]=i;\n }\n }\n for(int i=1;i<=n;i++){\n fa[i]=get_fa(i);\n num[0][fa[i]]++;\n if(line[0][fa[i]][x[i]]==0) num[1][fa[i]]++,line[0][fa[i]][x[i]]++;\n if(line[1][fa[i]][y[i]]==0) num[1][fa[i]]++,line[1][fa[i]][y[i]]++;\n }\n\n long long ans=1;\n for(int i=1;i<=n;i++){\n if(fa[i]==i){\n\n if(num[0][i]+1==num[1][i])\n ans=(ans*(qpow(2,num[1][i])-1))%mod;\n else ans=ans*qpow(2,num[1][i])%mod;\n }\n }\n printf(\"%lld\\n\",ans);\n}\n", "lang": "GNU C++11", "bug_code_uid": "5230fd965288568c8603db8a40d30eb8", "src_uid": "8781003d9eea51a509145bc6db8b609c", "apr_id": "aafc476834e565a60e4e649a5481764b", "difficulty": 2300, "tags": ["graphs"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9932762030323006, "equal_cnt": 11, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 10, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#define test(t) while(t--)\n#define cin(n) scanf(\"%d\",&n)\n#define cinl(n) scanf(\"%lld\",&n)\n#define cout(n) printf(\"%d\\n\",n)\n#define rep(i,a,n) for(i=a;i<=n;i++)\n#define vi vector\n#define vii vector< vector >\n#define vpii vector< pair >\n#define mii map\n#define pb push_back\n#define inf 10000009\n#define mp make_pair\n#define imax (int) 1000000007\n#define inf 98765432\n#define ill long long\n#define getchar_unlocked() getchar()\n#define inp(x) fi(&x)using namespace std;\n#define mod 1000000007\n#define max2 100003\n#define maxn 100009\n#define gc getchar_unlocked\nint fcin(){register int c = gc();int x = 0;for(;(c<48 || c>57);c = gc());for(;c>47 && c<58;c = gc()) {x = (x<<1) + (x<<3) + c - 48;}return x;}\nusing namespace std;\n#define cmax 59\nill max3=1000000000000000000LL;\nill powe(ill a,int b)\n{\n ill ans=1LL;\n while(b)\n {\n if(b&1)\n ans=(ans*1LL*a)%mod;\n a=(a*1LL*a)%mod;\n b=b/2;\n }\n return ans;\n}\n\nill gcd(ill a,ill b)\n{\n if(a==0)\n return b;\n\n return gcd(b%a,a);\n}\n\nill min(ill a,ill b)\n{\n return acol,num;\nint k=0;\nbool check()\n{\n int i,j,k;\n int c[5]={0},nu[5]={0};\n\n for(i=0;ip[6],q[6];\n for(i=1;i<=5;i++)\n {\n for(j=1;j<=5;j++)\n {\n if(b[i][j])\n {\n p[i].pb(j);\n q[j].pb(i);\n }\n }\n }\n\n while(1)\n {\n int fg=0;\n for(i=1;i<=5;i++)\n {\nif(!c[i])\ncontinue;\n int v=-1,o=0;\n for(j=0;j1)\n continue;\n fg=1;\n b[i][v]=0;sz--;\n }\n\n for(i=1;i<=5;i++)\n {\nif(!nu[i])\ncontinue;\n int v=-1,o=0;\n for(j=0;j1)\n continue;\n fg=1;\n b[v][i]=0;sz--;\n }\n if(!fg)\n break;\n }\n if(sz<2)\n return 1;\nreturn 0;\n}\nint main()\n{\n int m,t,i,j,l;\n cin(n);\n\n for(i=0;i>s[i];\n memset(a,0,sizeof(a));\n\n for(i=0;i\n#include\n#define ini 2\n\nusing namespace std;\nint main()\n{\n while(1)\n {\n long long int n,MAX=0,MIN=0;\n cin>>n;\n if(n/7==0&&(n%7)==6)\n {\n MAX=ini;\n MIN=1;\n }\n else if((n/7)>0&&(n%7)==0)\n {\n MAX=((n/7))*2;\n MIN=((n/7)*2);\n }\n else if((n/7)>0&&(n%7)==6)\n {\n MAX=((n/7)*2)+1;\n MIN=((n/7)*2);\n }\n else if((n/7)>0&&(n%7)!=6)\n {\n MAX=((n/7)*2);\n MIN=((n/7)*2);\n }\n// else\n// {\n// MAX=((n/7)*2)+2;\n// MIN=((n/7)*2);\n// }\n\n cout<\n#include\n\nusing namespace std;\n\nint main()\n{\n\tlong long n=0,m=0;scanf(\"%lld%lld\",&n,&m);long long s=n+m;\n\tlong long l=1,r=0,ans=0;\n\twhile(l<=s)\n\t{\n\t\tr=s/(s/l);long long g=s/l;\n\t\tif(n=l1&&r2>=l2)\n\t\t{\n\t\t\tans+=max(min(r1+r2,r)-max(l1+l2,l)+1,0);\n\t\t}\n\t\tl=r+1;\n\t}\n\tprintf(\"%lld\",ans);\n}", "lang": "GNU C++11", "bug_code_uid": "f870acddb50af27490ea115ebaa1bd91", "src_uid": "0e6a204565fef118ea99d2fa1e378dd0", "apr_id": "49c020102a92c3b7db3c8319812806f6", "difficulty": 2700, "tags": ["math", "implementation", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.03664921465968586, "equal_cnt": 6, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "// luogu-judger-enable-o2\nCF1202F ", "lang": "GNU C++11", "bug_code_uid": "ee9ab0677fe689edb3eef1b4b469c3ee", "src_uid": "0e6a204565fef118ea99d2fa1e378dd0", "apr_id": "9582b1a52f3ee7f573d7deeef0c17ec1", "difficulty": 2700, "tags": ["math", "implementation", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8975069252077562, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "#include\nusing namespace std;\nint t, a;\nmain(){\n\tcin>>t;\n\twhile(t--){\n\t\tcin>>a;\n\t\twhile(a>=7){\n\t\t\ta-=7;\n\t\t}\n\t\twhile(a>=3){\n\t\t\ta-=3;\n\t\t}\n\t\tcout<<(a==0?\"YES\":\"NO\")<\n#include\n#include\n#include\nusing namespace std;\nint h,m,s,t1,t2;\nint flag[3650];\nbool cmp(int x,int y)\n{\n\treturn x>h>>m>>s>>t1>>t2;\n\ta[0]=3600*(h%12)+60*m+s; a[1]=720*m+12*s; a[2]=720*s;\n\tt1=3600*(t1%12); t2=3600*(t2%12);\n\tsort(a,a+3,cmp);\n\tmemset(flag,0,sizeof(flag));\n\tfor(int i=a[0];i\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\nconst int MAXM = 2e5 + 5;\nconst int MAXN = 2e5 + 5;\n\nint Next[MAXM];\nchar T[MAXN];\nchar P[MAXM];\nint id[MAXN];\nint n, m, x;\nvoid init() \n{\n\tNext[0] = -1; \n\tint i = 0, j = -1;\n\twhile (i < m)\n\t{\n\t\tif (j == -1 || P[i] == P[j])\n\t\t{\n\t\t\tNext[++i] = ++j;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tj = Next[j];\n\t\t}\n\t}\n}\nvoid KMP()\n{\n\tint i = 0, j = 0, ans = 0; \n\twhile (i < n && j < m)\n\t{\n\t\tif (j == -1 || T[i] == P[j])\n\t\t{\n\t\t\ti++;\n\t\t\tj++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tj = Next[j];\n\t\t}\n\t\tif (j == m)\n\t\t{\n\t\t\tid[x++] = i - j;\n\t\t\t//cout << i - j << \" \";\n\t\t\tans++;\n\t\t\tj = Next[j];\n\t\t}\n\t}\n}\n\nint main()\n{\n\tscanf(\"%s\", T);\n\tscanf(\"%s\", P);\n\tn = strlen(T);\n\tm = strlen(P);\n\tinit();\n\tKMP();\n\tint ans = 0;\n\tfor (int i = 0; i < x; i++)\n\t{\n\t\tans = max(ans, max(id[i], n - id[i] - m));\n\t}\n\tprintf(\"%d\", ans);\n}", "lang": "GNU C++11", "bug_code_uid": "461ba35de874433b2e4d7638baacdcb5", "src_uid": "0fd33e1bdfd6c91feb3bf00a2461603f", "apr_id": "4fb0b32776fef1566dc658a3f578f67e", "difficulty": 1600, "tags": ["greedy", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.480225988700565, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "#include\n#include\nusing namespace std;\ninline int nod(int m, int n)\n{\n if (m>n) return nod(m-n,n);\n if (n>m) return nod(n-m,m);\n if (m==n) \n return m; \n } \nint main()\n{\n freopen(\"input.txt\",\"r\",stdin);\n freopen(\"output.txt\",\"w\",stdout);\n int a,b;\n cin>>a>>b;\n\tint k=nod(a,b);\n cout<\n#include \n#include \n#include \n#include \n#include \n \nusing namespace std;\nusing namespace std::chrono;\n\nint main ()\n{\n int x, y;\n cin >> x >> y;\n\n int sx = 0, sy = 0;\n int plen = 0;\n bool hdir = true, hright = true;\n int turns = 0;\n while(true)\n {\n ++turns;\n if(hdir)\n {\n ++plen;\n if(hright)\n {\n if(sy == y && x > sx && sx + plen >= x) break;\n }\n else\n {\n if(sy == y && x < sx && sx - plen <= x) break;\n }\n sx = hright ? sx + plen : sx - plen;\n hright = !hright;\n }\n else\n {\n if(!hright)\n {\n if(sx == x && y > sy && sy + plen >= y) break;\n }\n else\n {\n if(sx == x && y < sy && sy - plen <= y) break;\n }\n sy = !hright ? sy + plen : sy - plen;\n }\n hdir = !hdir;\n }\n\n cout << max(0, turns - 1) << \"\\n\";\n return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "e3e7886b59e2b3dea8cf3107bdf75873", "src_uid": "2fb2a129e01efc03cfc3ad91dac88382", "apr_id": "e885982d4b625705663a27381af38a03", "difficulty": 1400, "tags": ["geometry", "brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.989247311827957, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include\nusing namespace std;\nint n,q[30],i,bi,ch,ba;\nmain ()\n{\n cin>>n;\n\nfor (i=0; i<=n; i++){\n cin>>q[i];\n}\n for (i=0; i<=n; i=i+3){\n\n ch=ch+q[i];\n bi=bi+q[i+1];\n ba=ba+q[i+2];\n } \n \n \n if (ch>bi && ch>ba) cout<<\"chest\";\n if (bi>ch && bi>ba) cout<<\"biceps\";\n if (ba>ch && ba>bi) cout<<\"biceps\";\n //system (\"PAUSE\");\n } \n \n \n", "lang": "GNU C++", "bug_code_uid": "53e3f1c1597f1069d8bc18f7b52ad993", "src_uid": "579021de624c072f5e0393aae762117e", "apr_id": "87849d36f95d294fc7edf48380f23afc", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.223144306131858, "equal_cnt": 14, "replace_cnt": 11, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 14, "bug_source_code": "#include \n#include \nusing namespace std;\n\nint main()\n{\n unsigned long long n, a, b, q, p;\n cin >> n >> a >> b >> p >> q;\n unsigned long long a_cnt , b_cnt, both_cnt;\n n++;\n int *ary = new int[n]{0};\n if (p > q) {\n for (int i = a; i < n; i += a) {\n ary[i] = 1;\n }\n for (int i = b; i < n; i += b) {\n if (ary[i] != 1)\n ary[i] = 2;\n }\n } else {\n for (int i = b; i < n; i += b) {\n ary[i] = 2;\n }\n for (int i = a; i < n; i += a) {\n if (ary[i] != 2)\n ary[i] = 1;\n }\n }\n/*\n for (int i = 0; i < n; i++) {\n cout << i << ary[i] << endl;\n }*/\n\n // bool mul = (a % b == 0) || (b % a == 0);\n // a_cnt = n / a;\n // b_cnt = n / b;\n // both_cnt = n / (a * b);\n // unsigned long long tot1, tot2;\n // tot1 = a_cnt * p + (b_cnt - both_cnt) * q;\n // tot2 = (a_cnt - both_cnt) * p + b_cnt * q;\n // if (mul)\n // cout << max(tot1, tot2) - min(p, q) * min(a_cnt, b_cnt);\n // else\n // cout << max(tot1, tot2) << endl;\n int tot = 0;\n for_each(ary, ary + n, [&](char c) {\n if (c == 1) tot += p;\n else if (c == 2) tot += q;\n });\n\n cout << tot << endl;\n}\n", "lang": "GNU C++14", "bug_code_uid": "a503c417f638ee90cc80b3a68352e608", "src_uid": "35d8a9f0d5b5ab22929ec050b55ec769", "apr_id": "c3fbd6636d2e84aba8b43291044c163f", "difficulty": 1600, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7040695377321217, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "#include\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));\n#define ld long double\nusing namespace std;\nlong long nag(int u,int i,char o){\n\tif(o=='*')return u*i;\n\telse return u+i;\n}\nint gcd(int a, int b)\n{\n\tif (b == 0) return a;\n\treturn gcd(b, a%b);\n}\nll fact(ll j)\n{\n\tll a = 1;\n\tfor (ll i = 1; i <= j; i++)\n\t\ta *= i;\n\treturn a;\n}\nll sum2(ll c)\n{\n\tll s = 0;\n\twhile (c != 0)\n\t{\n\t\ts += (c % 10)*(c % 10);\n\t\tc /= 10;\n\t}\n\treturn s;\n}\nbool prime(ll a)\n{\n\tif (a == 0 || a == 1) return false;\n\tfor (int i = 2; i <= sqrt(a); i++)\n\t\tif (a%i == 0) return false;\n\treturn true;\n}\nint main(){\n\t//freopen(\".in\",\"r\",stdin);\n //freopen(\".out\",\"w\",stdout);\n\tll a,b,c,d,mn=99999999999999999999999999999,f=0,g=0;\n\tchar q,w,e;\n\tcin>>a>>b>>c>>d>>q>>w>>e;\n\tvecn;\n\tn.pb(a);\n\tn.pb(b);\n\tn.pb(c);\n\tn.pb(d);\n\tsort(n);\n\twhile(1){\n\t\tnext_permutation(n.begin(),n.end());\n\t\ta=n[0];b=n[1];c=n[2];d=n[3];\n\t\tmn=min(mn,nag(nag(a,b,q),nag(c,d,w),e));\n\t\tmn=min(nag(nag(a,c,q),nag(b,d,w),e),mn);\n\t\tmn=min(nag(nag(a,d,q),nag(b,c,w),e),mn);\n\t\tmn=min(nag(nag(nag(a,b,q),c,w),d,e),mn);\n\t}\n\tcout<\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));\n#define ld long double\nusing namespace std;\nlong long nag(int u,int i,char o){\n\tif(o=='*')return u*i;\n\telse return u+i;\n}\nint gcd(int a, int b)\n{\n\tif (b == 0) return a;\n\treturn gcd(b, a%b);\n}\nll fact(ll j)\n{\n\tll a = 1;\n\tfor (ll i = 1; i <= j; i++)\n\t\ta *= i;\n\treturn a;\n}\nll sum2(ll c)\n{\n\tll s = 0;\n\twhile (c != 0)\n\t{\n\t\ts += (c % 10)*(c % 10);\n\t\tc /= 10;\n\t}\n\treturn s;\n}\nbool prime(ll a)\n{\n\tif (a == 0 || a == 1) return false;\n\tfor (int i = 2; i <= sqrt(a); i++)\n\t\tif (a%i == 0) return false;\n\treturn true;\n}\nint main(){\n\t//freopen(\".in\",\"r\",stdin);\n //freopen(\".out\",\"w\",stdout);\n\tll a,b,c,d,mn=99999999999999999999999999999,f=0,g=0;\n\tchar q,w,e;\n\tcin>>a>>b>>c>>d>>q>>w>>e;\n\tvecn;\n\tn.pb(a);\n\tn.pb(b);\n\tn.pb(c);\n\tn.pb(d);\n\tsort(n);\n\tstr s,h;\n\tfor(int i=0;i<4;i++)s+=n[i];\n\twhile(1){\n\t\tnext_permutation(n.begin(),n.end());\n\t\ta=n[0];b=n[1];c=n[2];d=n[3];\n\t\tmn=min(mn,nag(nag(a,b,q),nag(c,d,w),e));\n\t\tmn=min(nag(nag(a,c,q),nag(b,d,w),e),mn);\n\t\tmn=min(nag(nag(a,d,q),nag(b,c,w),e),mn);\n\t\tmn=min(nag(nag(nag(a,b,q),c,w),d,e),mn);\n\t\th+=a;\n\t\th+=b;\n\t\th+=c;\n\t\th+=d;\n\t\tif(s==h)break;\n\t}\n\tcout<\nusing namespace std;\n\ntypedef long long Long;\n\nint main()\n{\n Long SUM, N;\n cin >> N\n SUM = 1;\n\n for(int i=0; i<809; i++)\n {\n SUM += TUM;\n SUM %= N;\n }\n cout<<(1+(N-SUM))<<\" \"<<(UM+(N-SUM))<\n#define endl \"\\n\"\n#define ll long long\n#define all(v) ((v).begin()), ((v).end())\n#define sz(v) ((int)((v).size()))\n#define clr(v, d) memset(v, d, sizeof(v))\n#define rep(i, v) for (int i = 0; i < sz(v); ++i)\n#define lp(i, n) for (int i = 0; i < (int)(n); ++i)\n#define lpi(i, j, n) for (int i = (j); i < (int)(n); ++i)\n#define lpd(i, j, n) for (int i = (j); i >= (int)(n); --i)\n#define vi vector\n#define vl vector\n#define ii pair\n#define vii vector\n#define PIii double PPPPPP = 3.14159265358979323846;\n#define pb push_back\nusing namespace std;\nconst int N = 2e5 + 5;\nstruct guss{\n string num;\n int bull,cow;\n};\nint cnt,n;\n\nstring g;\nvector v;\nvector bulls,cows;\n\nbool valid(){\n\n for (int j = 0; j < n; ++j) {\n string num = v[j];\n int bull = 0,cow=0;\n for (int i = 0; i < 4; ++i) {\n if(num[i]==g[i])\n bull++;\n }\n for (int i = 0; i < 4; ++i) {\n int k = g.find(num[i]);\n if(k>=0 && k<4)\n cow++;\n }\n cow-=bull;\n if(cow!=cows[j] || bull!=bulls[j])\n return false;\n }\n return true;\n\n}\nstring ans;\nvoid solve(int i){\n if(i==4){\n if(valid())\n cnt++,ans=g;\n }\n for (char j = '0'; j <= '9'; ++j) {\n if(g.find(j)=0) {\n continue;\n }\n g.push_back(j);\n solve(i + 1);\n g.pop_back();\n }\n}\nvoid run() {\n ios_base::sync_with_stdio(false);\n cin.tie(nullptr), cout.tie(nullptr);\n}\nint main() {\n#ifndef ONLINE_JUDGE\n freopen(\"input.txt\", \"r\", stdin);\n freopen(\"output.txt\", \"w\", stdout);\n#endif\n run();\n cin>>n;\n for (int i = 0; i < n; ++i) {\n string num;\n int b,c;\n cin>>num>>b>>c;\n v.push_back(num);\n bulls.push_back(b);\n cows.push_back(c);\n }\n solve(0);\n if(cnt==0){\n puts(\"Incorrect data\");\n }else if(cnt==1){\n cout<\n\n#define f(_i, _n) for (auto _i = 0; _i < _n; _i++)\n#define F(_i, _k, _n) for (auto _i = _k; _i < _n; _i++)\n#define fr(_i, _k, _n) for (auto _i = _k; _i < _n; _i++)\n#define r(_t, _n) _t _n; cin >> _n;\n#define ra(_type, _name, _len)_type _name[_len]; f(_i, _len) cin >> _name[_len];\n#define mp make_pair\n#define re return\n#define takedown re 0;\n#define fi first\n#define se second\n#ifdef FairlyLocal\n #define deb cerr\n#else\n #define deb GetCE :(\n#endif\n#define pb push_back\n#define fill(_a, _n) memset(_a, _n, sizeof(_a))\n#define all(_v) _v.begin(), _v.end()\n#define vi std::vector\n\nusing namespace std;\ntypedef pair pii;\ntypedef long long ll;\n\n#ifndef FairlyLocal\n class fastio {\n public:\n fastio() {\n ios::sync_with_stdio(false);\n cin.tie(nullptr);\n }\n } __fastio;\n#endif\n\nmap go(ll n){\n\tmap m[100];\n\tm[0][-n] = 1;\n\tll cc = 0;\n map ans;\n ans[-(n - 1) / 2]++;\n int ok = 1;\n while(ok){\n ok = 0;\n\t\tfor(auto it : m[cc]){\n\t\t\tll w = -it.fi;\n // deb << w << ' ' << it.se << '\\n';\n if((w - 1) / 2 > 0) {\n ok = 1;\n m[cc + 1][-(w - 1) / 2] += it.se;\n ans[-((w - 1) / 2 - 1) / 2] += it.se;\n }\n if(w / 2 > 0) {\n m[cc + 1][-w / 2] += it.se;\n ans[-(w / 2 - 1) / 2] += it.se;\n ok = 1;\n }\n }\n\t\tcc++;\n\t}\n // deb << '\\n';\n // for(auto j : ans) deb << -j.fi << ' ' << j.se << '\\n';\n re ans;\n}\n\nll n, k;\n\nll solve() {\n ll pos = 1, sz = 0;\n auto aa = go(n);\n // deb << aa.size() << '\\n';\n for(auto it : aa) {\n deb << k << ' ' << it.se << '\\n';\n if(it.se >= k) {\n sz = -it.fi;\n break;\n }\n // deb << k << '\\n';\n k -= it.se;\n }\n // deb << sz << ' ' << k << '\\n';\n ll cursz = (n - 1) / 2;\n ll size = n;\n while(true) {\n if(cursz == sz) {\n re pos + sz + k;\n }\n auto a1 = go((size - 1) / 2);\n auto a2 = go(size / 2);\n // deb << cursz << ' ' << size << ' ' << pos << ' ' << k << ' ' << a1[-sz] << ' ' << a2[-sz] << '\\n';\n if(a1[-sz] >= k) {\n if(cursz == 2) pos++;\n size = cursz;\n cursz = (cursz - 1) / 2;\n }\n else {\n pos += cursz + 1;\n k -= a1[-sz];\n size = size / 2;\n cursz = (cursz - 1) / 2;\n }\n }\n re -1;\n}\n\nint main(){\n #ifdef FairlyLocal\n freopen(\".input\", \"r\", stdin);\n freopen(\".output\", \"w\", stdout);\n freopen(\".debug\", \"w\", stderr);\n #endif\n cin >> n >> k;\n if(k == 1) {\n cout << 1;\n re 0;\n }\n if(k == 2) {\n cout << n;\n re 0;\n }\n k -= 2;\n n -= 2;\n cout << solve();\n}\n", "lang": "GNU C++14", "bug_code_uid": "9f41b85b72ffcc6526d3913d28ce6c07", "src_uid": "eb311bde6a0e3244d92fafbd4aa1e61f", "apr_id": "1e694f0bd53247781c1f855a3b9a938d", "difficulty": 2900, "tags": ["constructive algorithms", "implementation", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.16237623762376238, "equal_cnt": 18, "replace_cnt": 16, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 18, "bug_source_code": "#include \n#include \n#include \n#include \nusing namespace std;\nint a[5],p=0;\n\nvoid dfs(int x,int y,int z) {\n\tif ((x>4)||(y>4)||(z>4)) return;\n\tif (a[x]+a[y]>a[z] and a[x]+a[z]>a[y] and a[z]+a[y]>a[x]) {p=1;cout << \"TRIANGLE\" << endl;return;}\n\tif (a[x]+a[y]>=a[z] and a[x]+a[z]>=a[y] and a[z]+a[y]>=a[x]) {p=1;cout << \"SEGMENT\" << endl;return;}\n\tz++;dfs(x,y,z);z--;\n\ty++;z++;dfs(x,y,z);y--;z--;\n\tx++;y++;z++;dfs(x,y,z);x--;y--;z--;\n} \n \nint main() {\n\tfor (;;) {\n \t cin >> a[1] >> a[2] >> a[3] >> a[4]; \n\t int c=1,d=2,e=3;\n\t dfs(c,d,e);\n\t if (p==0) cout << \"IMPOSSIBLE\" << endl;\n\t}\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "a6eff9bd985d03096ebd749625a142e7", "src_uid": "8f5df9a41e6e100aa65b9fc1d26e447a", "apr_id": "6d57b1170e83d148c424d2be5896390f", "difficulty": 900, "tags": ["geometry", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9167974882260597, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#include\n#include\n#include\nusing namespace std;\n\nint main()\n{\n int a,b,t1=0;\n scanf(\"%d %d\",&a,&b);\n if(a==0&&b==0){\n printf(\"NO\\n\");\n exit(1);\n }\n t1=a-b;\n if(t1==0 || t1==1 || t1==-1)\n printf(\"YES\\n\");\n else \n printf(\"NO\\n\");\n return 0;\n}", "lang": "GNU C++", "bug_code_uid": "87804893d3cc65dbb1275642f72f2625", "src_uid": "ec5e3b3f5ee6a13eaf01b9a9a66ff037", "apr_id": "cb2522e82fdfed240bae0036d86a437b", "difficulty": 1000, "tags": ["brute force", "math", "constructive algorithms", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9921807124239791, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include\n#define ll long long \n#define mod 1e9+7\nusing namespace std;\n\nint main()\n{\n\tstring str;\n\tcin>>str;\n\tint l=str.length(),i;\n\tif(str[l-1]!='a'&&str[l-1]!='e'&&str[l-1]!='i'&&str[l-1]!='o'&&str[l-1]!='u'&&str[l-1]!='n') cout<<\"NO\";\n\telse\n\t{\n\t\tint no=0;\n\t\tfor(i=0;i\n#include \n#include \n\nint\nmain()\n{\n\tint n, l, r, x, c, k, h(0), t;\n\tstd::vector< std::array > v;\n\n\tstd::scanf(\"%d%d%d%d\", &n, &l, &r, &x);\n\tfor (int i(0); i < n; ++i) {\n\t\tstd::scanf(\"%d\", &c);\n\t\tk = v.size();\n\t\tv.push_back({{c, c, c}});\n\t\tfor (int i(0); i < k; ++i) v.push_back({{v[i][0] + c, std::min(v[i][1], c), std::max(v[i][2], c)}});\n\t}\n\n\tfor (int i(0); i < v.size(); ++i) if (v[i][2] - v[i][1] < x) v[i][0] = 0;\n\tstd::stable_sort(v.begin(), v.end());\n\n\twhile (v[h][0] < l) ++h;\n\tt = h;\n\twhile (t < v.size() && v[t][0] <= r) ++t;\n\n\tstd::printf(\"%d\\n\", t - h);\n\n\treturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "6e68de9e1d952c088be0c4178fec17f9", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "apr_id": "603171bbb2fe2f823fb245ec57844373", "difficulty": 1400, "tags": ["brute force", "bitmasks"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.22011661807580174, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "// ConsoleApplication3.cpp: \u5b9a\u4e49\u63a7\u5236\u53f0\u5e94\u7528\u7a0b\u5e8f\u7684\u5165\u53e3\u70b9\u3002\n//\n\n//#include \"stdafx.h\"\n#include \n#include \n#include \n\nint get(int n,int pos,int l,int r)\n{\n\tint left = l - 1, right = n - r;\n\tint ans = 0;\n\tif (left == 0 && right != 0)\n\t{\n\t\tans = r - pos + 1;\n\t}\n\telse if (left != 0 && right == 0)\n\t{\n\t\tans = pos - l + 1;\n\t}\n\telse\n\t{\n\t\tif (pos - l <= r - pos)\n\t\t{\n\t\t\tans = pos - l + r - l + 2;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tans = r - pos + r - l + 2;\n\t\t}\n\t}\n\treturn ans;\n}\n\nint main()\n{\n\tint n, pos, l, r;\n\tscanf(\"%d%d%d%d\", &n, &pos, &l, &r);\n\tint left = l - 1, right = n - r;\n\tint ans = 0;\n\tif (left == 0 && right == 0)\n\t{\n\t\tans = 0;\n\t}\n\telse if (pos >= l && pos <= r)\n\t{\n\t\tans = get(n, pos, l, r);\n\t}\n\telse if (pos < l)\n\t{\n\t\twhile (1);\n\t\tans = 1 + get(n, l, l, r);\n\t}\n\telse if (pos > r)\n\t{\n\t\twhile (1);\n\t\tans = 1 + get(n, r, l, r);\n\t}\n\tprintf(\"%d\\n\", ans);\n return 0;\n}\n\n", "lang": "GNU C++11", "bug_code_uid": "84f628547c5d720780734a423248b013", "src_uid": "5deaac7bd3afedee9b10e61997940f78", "apr_id": "832eba520e15f02a5a6e15c97419d913", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.22767857142857142, "equal_cnt": 14, "replace_cnt": 11, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 14, "bug_source_code": "#include\n#include\nusing namespace std;\ntypedef struct{int sum,ans,vis;}node;\nint main(){\n //freopen(\"in.txt\",\"r\",stdin);\n int k,a[12];\n queue q;\n while(scanf(\"%d\",&k)==1){\n int sum=0,flag;\n node cur,next;\n for(int i=0;i<12;++i){\n scanf(\"%d\",&a[i]);\n sum+=a[i];\n }\n if(sum=k){flag=1;printf(\"%d\\n\",cur.ans);break;}\n for(int i=0;i<12;++i)if(!(cur.vis&(1<12) continue;\n next.sum=cur.sum+a[i];\n next.vis=cur.vis|(1<\n\nusing namespace std;\n\n#define mp make_pair\n#define pb push_back \n#define nd second\n#define st first\n\ntypedef long long ll;\ntypedef long long int lli;\ntypedef long long unsigned llu;\ntypedef pair < int,int > pii;\ntypedef pair < lli,lli > plli;\n\nconst int MAX = 1e6+7;\n\nstring s;\n\nint main()\n{\n\tcin>>s;\n\tint k ;\n\tif(s[s.length()-1]=='h')\n\t{\n\t\tif(s[1]<='9' && s[0]>='0')\n\t\t\tk = (s[0]-'0')*10 + s[1]-'0';\n\t\telse \n\t\t\tk= s[0]-'0';\n\n\t\tif(k==31)\n\t\t\tprintf(\"7\");\n\t\telse if(k==30)\n\t\t\tprintf(\"11\");\n\t\telse \n\t\t\tprintf(\"12\");\n\t}\n\telse if(s[s.length()-1]=='k')\n\t{\n\t\tk=s[0]-'0';\n\t\t\tputs((k==5 || k==6)?\"53\":\"52\");\n\t}\n\telse while(1);\n}\n", "lang": "GNU C++", "bug_code_uid": "7aa1fec74c71bb30f29619ca4020f0dc", "src_uid": "9b8543c1ae3666e6c163d268fdbeef6b", "apr_id": "d3532da026964eac0fc2847c365eac32", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9887640449438202, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "#include \n#include \n#include \n\nusing namespace std;\n\nint n;\n\nint main()\n{\n cin >> n;\n if (n & (n - 1)) printf(\"YES\") else printf(\"NO\");\n return 0;\n}", "lang": "GNU C++", "bug_code_uid": "0d73b0d8b6ed2dbaf16918aa564eaea2", "src_uid": "4bd174a997707ed3a368bd0f2424590f", "apr_id": "d247d448d7f5927afb25f7e82c753d27", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9901192504258943, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "\n// Hi this is Pheonix :))\n// Pheonix Template //\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define S(x) scanf(\"%d\",&x);\n#define D(x) scanf(\"%1d\",&x);\n#define SL(x) scanf(\"%lld\",&x);\n#define SD(x,y) scanf(\"%d %d\",&x,&y);\n#define ST(x,y,z) scanf(\"%d %d %d\",&x,&y,&z);\n#define P(x) printf(\"%d\\n\",x);\n#define PL(x) printf(\"%lld\\n\",x);\n#define SH() printf(\"\\n\");\n#define TC() int t; scanf(\"%d\",&t); while(t--)\n#define REP(i,a,n) for(i=a;i<=n;i++)\n#define REPI(i,n,a) for(i=n;i>=a;i--)\n#define String(x) scanf(\"%s\",x);\n#define INC(x) x++;\n#define WL(x,y) while(x==y)\n#define W(x) while(x--)\n#define A(x) abs(x)\n#define ASG(x,y) x=y;\n#define Z(x) x=0; \n#define E else\n#define CE(x,a) if(x==a)\n#define CG(x,a) if(x>a)\n#define CL(x,a) if(x>n ;\n LL ans = 0 ;\n if(n<=10 || n>=22) ans = 0 ;\n else if(n==11) ans = 8 ;\n else if(n>11 && n<=19) ans = 4 ;\n else if(n==20) ans = 15 ;\n else if(n==21) ans = 4 ; \n cout<\nusing namespace std;\nlong long int n;\nlong long int megoldas;\nlong long int seged;\nlong long int valami;\nlong long int y;\nlong long int se;\nvector < long long int > v;\nlong long int rek(long long int x)\n{\n if (x==1) return 1;\n if (x==2) return 3;\n if (x==3) return 4;\n seged=2;\n while(2*seged<=x)\n {\n seged*=2;\n }\n if (x==seged)\n {\n return x+rek(x-1);\n }\n else{\n\n valami=rek(x-seged);\n seged=2;\n while(2*seged<=x)\n {\n seged*=2;\n }\n v.push_back(valami);\n return v[v.size()-1]+rek(seged);\n }\n}\nint main()\n{\n ios_base::sync_with_stdio(false);\n cin>>n;\n n=n-1;\n cout<\n#include\nusing namespace std;\n\nint main()\n{\n start1:\n int a,k,b,v;\n scanf(\"%d %d %d %d\",&k,&a,&b,&v);\n int boxes=1;\n int sections=1;\n int nis=b;\n bool flag=0;\n while(b--)\n {\n if(sections*v=0)\n {\n sections-=(k+1);\n boxes++;\n } */ \n \n printf(\"%d\\n\",boxes);\n goto start1;\n }\n", "lang": "GNU C++", "bug_code_uid": "42a89c227db589973507a1ca47b95384", "src_uid": "7cff20b1c63a694baca69bdf4bdb2652", "apr_id": "c4d25a1fcba4954653a11bdb285df976", "difficulty": 1100, "tags": ["math", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.01864406779661017, "equal_cnt": 5, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "Copy\n0.7500000000\n0.5000000000\n1.1875000000", "lang": "GNU C++11", "bug_code_uid": "ca0486d62ba349b069d0b2d7e7e9001c", "src_uid": "55affe752cb214d1e4031a9e3972597b", "apr_id": "45e583ffb152f2fd79b92d89bb043c86", "difficulty": 2700, "tags": ["trees", "dp", "math", "probabilities"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.3961352657004831, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#include\nusing namespace std;\nint main(){\nlong long n, m;\ncin>>n>>m;\nlong long d=1;\nfor(long long i=0; i\n#include \n#include \n#include \n#include \n#include \n#include \n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#define inf 2000000000\n#define INF 1<<29 \n#define s(a) scanf(\"%d\",&a)\n#define me(a,b) memset(a,b,sizeof(a)) \ntypedef long long ll;\nusing namespace std; \nconst int maxn=2e6+5;\nconst int mo=1e9+7;\ninline int read()\n{\n int x=0,f=1;char ch=getchar();\n while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}\n while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}\n return x*f;\n}\npriority_queue,greater >que;\n//string m[17]={\"00:00\",\"01:10\",\"02:20\",\"03:30\",\"04:40\",\"05:50\",\"10:01\",\"11:11\",\"12:21\",\"13:31\",\"14:41\",\"15:51\",\"20:02\",\"21:12\",\"22:22\",\"23:32\",\"00:00\"}; \nint a[17]={0,70,140,210,280,350,601,11*60+11,12*60+21,13*60+31,14*60+41,15*60+51,20*60+2,21*60+12,22*60+22,23*60+32,24*60};\nint main() \n{ \t\n\t//freopen(\"diversity.in\",\"r\",stdin); \n //freopen(\"diversity.out\",\"w\",stdout); \n\n\tchar s[5];\n\twhile(~scanf(\"%s\",s)){\n\t\tint ans,index;\n\t\tint tmp=(s[0]-'0')*10*60+(s[1]-'0')*60+(s[3]-'0')*10+s[4]-'0';\n\t\tfor(int i=0;i<17;i++){\n\t\t\tif(tmp>a[i])index=i;\n\t\t\telse break;\n\t\t}\n\t\t\n\t\tans=a[index+1]-tmp;\n\t\tprintf(\"%d\\n\",ans);\n\t}\n\t\n\t\n return 0; \n} \n", "lang": "GNU C++11", "bug_code_uid": "ac57cab0c37a779da22a2cf9bb733b27", "src_uid": "3ad3b8b700f6f34b3a53fdb63af351a5", "apr_id": "13d70d3a0474ed6f8b3b97ff805aecd6", "difficulty": 1000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7312633832976445, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "#include\nusing std::ios;\n#define begin main(){\n#define end return 0;}\n#define sentence string\n#define out(k) std::cout<=k;i-=l)\ninline int in(){\n regular x=0,t=1;regularc ch=getchar();\n while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();\n if(ch=='-')t=-1,ch=getchar();\n while(ch<='9'&&ch>='0')x=x*10+ch-48,ch=getchar();\n return x*t;\n}\nusing namespace std;\nint f[1001][1200]={1},n;\nbegin\n n=in();\n do(n+1){\n f[i][0]=f[i-1][i-1];\n for(int j=1;j<=i;j++)f[i][j]=f[i][j-1]%1000000007+f[i-1][j-1]%1000000007;\n }\n out(f[n+1][0]%1000000007-f[n][0]%1000000007);\nend", "lang": "GNU C++11", "bug_code_uid": "165753a9ba70f4d3779814fb2607c039", "src_uid": "aa2c3e94a44053a0d86f61da06681023", "apr_id": "32899a790df739a705e0a098617c2aea", "difficulty": 1900, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9328859060402684, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \nusing namespace std;\n\nint main(){\nlong long n, k, p, a=0, b=0, r=0,x;\n\tcin.tie(0);\n\tcout.tie(0);\n\tcin>>n>>k;\n\tx=n/2;\n\tp= x/k;\n\twhile (p>0){\n\t\tif((k+1)*p<=x){\n\t\t\ta= p;\n\t\t\tb=k*p;\n\t\t\tbreak;\n\t\t}\n\t\telse p--;\n\t}\n\tr= n-(b+a);\n\tcout<\n#include \n\nusing namespace std;\n\nstring n;\nint cnt;\nint num[12];\nlong long jc[25];\nlong long ans;\nint temNum[12];\n\nvoid dfs(int x){\n\tif(x==10){\n\t\tcnt=0;\n\t\tfor(int i=0;i<=9;i++)\n\t\t\tcnt+=temNum[i];\n\t\tint temAns = jc[cnt];\n\t\tfor(int i=0;i<10;i++)\n\t\t\tif(temNum[i]>0)\n\t\t\t\ttemAns/=jc[temNum[i]];\n\t\ttemAns-=temAns*temNum[0]/cnt;\n\t\tans+=temAns;\n\t\t\n\t}\n\t\n\tfor(int i =1;i<=num[x];i++){\n\t\ttemNum[x]=i;\n\t\tdfs(x+1);\n\t}\t\n\tif(num[x]==0)\n\t\tdfs(x+1);\n}\n\n\n\n\nint main(){\n\tcin>>n;\n\tfor(auto i:n)\n\t\tnum[(int)(i-'0')]++;\n\t\n\tjc[0]=1;\n\tfor(int i =1;i<21;i++){\n\t\tjc[i]=jc[i-1]*i;\n\t}\n\tans=0;\n\tdfs(0);\n\tcout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n#define all(x) x.begin(), x.end()\n#define rall(x) x.rbegin(), x.rend()\ntypedef vector vi;\ntypedef pair ii;\ntypedef long long ll;\ntypedef long double ld;\nconst int mod = 1e9 + 7;\nconst ll inf = 3e18 + 5;\nint add(int a, int b) { return (a += b) < mod ? a : a - mod; }\nint mul(int a, int b) { return 1LL * a * b % mod; }\n\nint main(){\n ios_base::sync_with_stdio(false); cin.tie(0);\n #ifndef ONLINE_JUDGE\n freopen(\"input.txt\", \"r\", stdin);\n freopen(\"output.txt\", \"w\", stdout);\n #endif\n\n int n, m, k;\n cin >> n >> m >> k;\n int res = 0;\n if(k == 1 || k > n){\n res = 1;\n for(int i = 0; i < n; i++){\n res = mul(res, m);\n }\n }\n else if(k % 2 == 0){\n res = m;\n }\n else{\n res = mul(m, m - 1);\n res = add(res, m);\n }\n cout << res;\n}", "lang": "GNU C++17", "bug_code_uid": "d9053c59a98902a6e6cadcf1af2c7581", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "apr_id": "a88fc7fbf43f7fad756547f032036dc4", "difficulty": 1600, "tags": ["graphs", "dfs and similar", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9727626459143969, "equal_cnt": 11, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 10, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n # define INF 1000000000\nusing namespace std;\nlong n,m,c; \nstruct o {int x,y;}; o a[1000000];\nvector p[1000000]; long ans[1000000]; bool pre[1000001]={0};\nlong R[10000000],L[10000000]; long d[1000000]={0}; bool used[1000001]={0};\nlong yt[1000000];\nlong dfs(int i,long j){\n if (i>j) return min(j+1,m); \n used[i]=1;\n ans[abs(d[i])]=0; R[i]=dfs(R[i],j);\n return R[i];\n }\nint main()\n{\n// freopen(\"input.txt\",\"r\",stdin);\n// freopen(\"output.txt\",\"w\",stdout); \n cin>>n>>m;for (int k=1;k<=100000;++k) a[k].x=a[k].y=-1,ans[k]=1,R[k]=k+1; long maxx=0,minx=0;\n for (int k=1;k<=m;++k){\n char ch;long x; cin>>ch;cin>>x; \n if (ch=='+'){d[k]=x;\n a[x].x=k;\n }else{d[k]=-x;a[x].y=k;if (a[x].x==-1) {minx=x;a[x].x=0;pre[0]=1;}p[x].push_back(a[x]); a[x].x=-1;a[x].y=-1;}\n } \n for (int k=1;k<=n;++k) if (a[k].x>=0) {if (a[k].y==-1) {if (!maxx) {maxx=k;}a[k].y=m+1,pre[m+1]=1;}p[k].push_back(a[k]);}\n for (int k=1;k<=n;++k) R[k]=k+1,L[k]=k-1;\n for (int k=1;k<=n;++k){\n for (int i=0;i2){\n map F; \n for (int k=0;k<=m+1;++k) if (!used[k] && yt[k]!=0)F[yt[k]]=1; if (F.size()>1) \n for (int k=1;k<=m;++k) if (!used[k]) ans[d[k]]=0;\n }\n for(int k=1;k<=n;++k) if (ans[k]==1) ++pas;\n cout<\n#define ll\tlong long int\n#define db double\n#define pb\tpush_back\n#define pp\tpop_back\n#define is \tinsert\n#define vec vector\n#define vecll vector\n#define set set \n#define setll set\n#define F first\n#define S second\n#define MAXX 1e9+1\n#define ull unsigned long long int\n#define FOR(i,x,n)\tfor(i=x;in;i--)\n#define _FOR1(i,x,n)\tfor(i=x;i>=n;i--)\n#define _FOR2(i,x)\tfor(i=x;;i--)\n#define yes\tcout << \"YES\" << endl\n#define no\tcout << \"NO\" << endl\n#define gcd(a,b) __gcd(a,b) // tim UCLN cua 2 so.\n#define lcm(a,b)\ta*b/__gcd(a,b) \n// ceil(double x) tra ve gia tri nguyen nho nhat lon hon hoac bang x.\n// ceil(long long int x) tra ve gia tri nguyen lon nhat be hon hoac bang x.\n#define Fin(_filename)\tfreopen(_filename,\"r\",stdin)\n#define Fout(_filename)\tfreopen(_filename,\"w\",stdout)\n#define NGUYEN_CHINH_NGHIA\tios::sync_with_stdio(0);cin.tie(NULL),cout.tie(NULL)\nusing namespace std;\nll a[3], i, t, dem = 0;\nint main (){\n\tNGUYEN_CHINH_NGHIA;\n\tFOR(i, 0, 3){\n\t\tcin >> a[i];\n\t}\n\tcin >> t;\n\tsort(a,a+3);\n\twhile(a[0] - a[1] < t){\n\t\tdem++;\n\t\ta[0]--;\n\t}\n\twhile(a[1] - a[2] < t){\n\t\tdem++;\n\t\ta[2]++;\n\t}\n\tcout << dem << endl;\n\t\n\treturn 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "e36cde9ee565fedc410285bbed411725", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "apr_id": "837f2cbd231ff0cf439f69a742d60999", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.15113350125944586, "equal_cnt": 12, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 12, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nint n, pieces;\n\nint bfs(int * state);\nbool same_color(int * state);\n\nint main() {\n\twhile (cin >> n) {\n\t\tpieces = n / 2;\n\t\tint * s = new int[pieces];\n\t\t// vector v;\n\t\t// v.assign(pieces, int());\n\t\tfor (int i = 0; i < pieces; i++)\n\t\t\tcin >> s[i];\n\t\tint min_step = bfs(s);\n\t\tcout << min_step << endl;\n\t}\n\treturn 0;\n}\n\nint bfs(int * state) {\n\tif (same_color(state))\n\t\treturn 0;\n\tpriority_queue, vector>, greater >> pq;\n\tpq.push(make_pair(0, state));\n\twhile (!pq.empty()) {\n\t\tpair p = pq.top();\n\t\tpq.pop();\n\t\tint* s = p.second;\n\t\tint steps = p.first;\n\t\tfor (int i = 0; i < pieces; i++) {\n\t\t\tint * ns = new int[pieces];\n\t\t\tcopy(s, s + pieces, ns);\n\t\t\tif (s[i] - 1 >= 1 && find(s, s + pieces, s[i] - 1) == s + pieces) {\n\t\t\t\tns[i] = s[i] - 1;\n\t\t\t\tif (same_color(ns))\n\t\t\t\t\treturn steps + 1;\n\t\t\t\tpq.push(make_pair(steps + 1, ns));\n\t\t\t}\n\t\t\tns = new int[pieces];\n\t\t\tcopy(s, s + pieces, ns);\n\t\t\tif (s[i] + 1 <= n && find(s, s + pieces, s[i] + 1) == s + pieces) {\n\t\t\t\tns[i] = s[i] + 1;\n\t\t\t\tif (same_color(ns))\n\t\t\t\t\treturn steps + 1;\n\t\t\t\tpq.push(make_pair(steps + 1, ns));\n\t\t\t}\n\t\t}\n\t\tdelete(s);\n\t}\n}\n\nbool same_color(int * state) {\n\tfor (int i = 1; i < pieces; i++) {\n\t\tif (state[i] % 2 != state[0] % 2)\n\t\t\treturn false;\n\t}\n\treturn true;\n}", "lang": "GNU C++17", "bug_code_uid": "9757629a2d95f298fcad7033fbdb7769", "src_uid": "0efe9afd8e6be9e00f7949be93f0ca1a", "apr_id": "06e9a13c0fb06f142a9acfd21d9a01c5", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7831785909339158, "equal_cnt": 12, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n\nusing namespace std;\n\ntypedef long long ll;\n\nconst int MOD = 1e9 + 7;\n\nint n, k;\nvector>\tvec;\nvector\tsec;\nbool mark[20];\nvector\tadj[20];\n\nvoid gen(int rem){\n\tif (rem == 0){\n\t\tvec.push_back(sec);\n\t\treturn;\n\t}\t\n\n\tfor (int i = 0; i < k; i++){\n\t\tsec.push_back(i);\n\t\tgen(rem - 1);\n\t\tsec.pop_back();\n\t}\n}\n\nint dfs(int v){\n\tif (mark[v])\treturn\t0;\n\tmark[v] = 1;\n\tint ret = 1;\n\tfor (int u:adj[v])\n\t\tret += dfs(u);\n\treturn\tret;\n}\n\nll get(){\n\tgen(k);\n\tint cnt = 0;\n\tfor (vector\ttt:vec){\n\t\tmemset(mark, 0, sizeof(mark));\n\t\tfor (int i = 0; i < k; i++)\tadj[i].clear();\n\t\tfor (int i = 0; i < tt.size(); i++)\n\t\t\tadj[tt[i]].push_back(i);\n\t\tif (dfs(0) == k)\tcnt++;\n\t}\n\treturn\tcnt;\n}\n\nint main(){\n\tcin >> n >> k;\n\tll ans = 1;\n\tfor (int i = 0; i < n - k; i++)\n\t\tans = (ans * (n - k)) % MOD;\n\tans = (ans * get()) % MOD;\n\tcout << ans << endl;\n\treturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "44fa1721f2e2192df5f2278a9d03c7a2", "src_uid": "cc838bc14408f14f984a349fea9e9694", "apr_id": "70ae5940255e436c8b28422007f5bb69", "difficulty": 1500, "tags": ["dfs and similar", "brute force", "math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.3418491484184915, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n\nusing namespace std;\n\nlong long a,b,x,x2,y,y2,res1,res2,res,xx,xx2,yy,yy2,k,k2;\nint i;\n\nint main()\n{\n\tcin>>a>>b>>x>>y>>x2>>y2;\n\n\t\n\n\tyy=y;\n\tyy2=y2;\n\tfor(i=1;i<=2*b;i++)\n\t{\n\t\tyy+=1;\n\t\tif((yy-x)%(2*b)==0) k=(yy-x)/(2*b);\n\n\t\tyy2+=1;\n\t\tif((yy2-x2)%(2*b)==0) k2=(yy2-x2)/(2*b);\n\t}\n\tif(k2>k) res1=k2-k;\n\telse res1=k-k2;\n\n\txx=x;\n\txx2=x2;\n\tfor(i=1;i<=2*a;i++)\n\t{\n\t\txx+=1;\n\t\tif((y+xx)%(2*a)==0) k=(xx+y)/(2*a);\n\n\t\txx2+=1;\n\t\tif((y2+xx2)%(2*a)==0) k2=(xx2+y2)/(2*a);\n\t}\n\n\tif(k2>k) res2=k2-k;\n\telse res2=k-k2;\n\n\tres=max(res1,res2);\n\n\tcout<\n#include\nusing namespace std;\nint main()\n{\n ios::sync_with_stdio(false);\n long long cop,org,value;\n int i;\n char RE;\n RE:\n cin>>cop>>org;\n if(cop==0)\n goto RE;\n if(org>cop)\n goto RE;\n value= cop-(org-1);\n if(value%2==0)\n cout<<\"Yes\";\n else\n cout<<\"No\";\n return 0;\n}", "lang": "GNU C++", "bug_code_uid": "1a859fe365433b7f5d3666203e9be57e", "src_uid": "1527171297a0b9c5adf356a549f313b9", "apr_id": "f3ddaa2def3c158b9f5265cf3ec71eed", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9888583417739835, "equal_cnt": 10, "replace_cnt": 1, "delete_cnt": 5, "insert_cnt": 3, "fix_ops_cnt": 9, "bug_source_code": "#ifndef LOCAL\n#define NDEBUG\n#endif\n#include\n#include\n#include\n#include\n\n#define MODULAR_LESS_EFFICIENT_BUT_EASIER_TO_CODE 0\nint const MOD=998244353;\nstruct modular {\n\tint val;\n\texplicit constexpr operator int() const { return val; }\n\tconstexpr modular():val(){}\n#if MODULAR_LESS_EFFICIENT_BUT_EASIER_TO_CODE\n\tconstexpr modular(int64_t v):val(int(v%MOD)){\n\t\tif(val<0)val+=MOD;\n\t}\n#else\n\tconstexpr modular(int v):val(v){\n\t\tassert(0<=v and v) COMPAREOP(<=) COMPAREOP(>=)\n#undef COMPAREOP\n\n\tmodular operator-() const { return modular(val ? MOD-val : 0); }\n\tmodular constexpr& operator+=(modular m) { if ((val += m.val) >= MOD) val -= MOD; return *this; }\n\tmodular constexpr& operator-=(modular m) { if ((val -= m.val) < 0) val += MOD; return *this; }\n\n\tvoid asm_mul(modular m){\n\t\tauto x=(uint64_t)val*m.val;\n\t\tunsigned xh = (unsigned) (x >> 32), xl = (unsigned) x, d, mm;\n\t\tasm(\n\t\t\t\"divl %4; \\n\\t\"\n\t\t\t: \"=a\" (d), \"=d\" (mm)\n\t\t\t: \"d\" (xh), \"a\" (xl), \"r\" (MOD)\n\t\t);\n\t\tval= mm;\n\t}\n\n\tmodular constexpr& operator*=(modular m) {\n\t\tif(std::is_constant_evaluated()){\n\t\t\tval = int((int64_t)val*m.val%MOD);\n\t\t}else{\n\t\t\tasm_mul(m);\n\t\t}\n\t\treturn *this;\n\t}\n\tmodular constexpr pow(auto p) const {\n\t\tmodular a=*this;\n\t\tmodular ans = 1; for (; p; p /= 2, a *= a) if (p&1) ans *= a;\n\t\treturn ans;\n\t}\n\tmodular constexpr inv() const {\n\t\tint a=val,b=MOD, ax=1,bx=0;\n\t\twhile(b){\n\t\t\tint q=a/b, t=a%b;\n\t\t\ta=b; b=t;\n\t\t\tt=ax-bx*q; ax=bx; bx=t;\n\t\t}\n\t\tassert(a==1);\n\t\tif(ax<0)ax+=MOD;\n\t\treturn ax;\n\t}\n\tmodular constexpr& operator/=(modular m) { return (*this) *= m.inv(); }\n\n#define ARITHBINARYOP(OP) friend modular constexpr operator OP(modular a, modular b) { return a OP##= b; }\n\tARITHBINARYOP(+) ARITHBINARYOP(-) ARITHBINARYOP(*) ARITHBINARYOP(/)\n#undef ARITHBINARYOP\n\t\t\n\tfriend auto& operator<<(std::ostream& str,modular x){\n\t\treturn str<<( x.val>MOD/2 ? x.val-MOD : x.val );\n\t}\n};\n\nvoid process(int* const first,int* const last,int n){\n\tstd::for_each(first,last,[&](int& x){\n\t\tx=(int)modular(x).pow(n);\n\t\t});\n}\n\nint main(){\n\tstd::ios::sync_with_stdio(0);std::cin.tie(0);\n\tint n;std::cin>>n;\n\n\tauto const mul_1pow=[](modular a,int b){ // a * (-1)^b\n\t\tif(b&1) a=-a;\n\t\treturn a;\n\t};\n\tauto const mul3=[](modular a){return a+a+a; };\n\n\tint i=0;\n\tmodular three_pow_i=1; // - (3^i)\n\n\tstd::vector inv(std::max(3,n+1));\n\tinv[1]=1;\n\tfor(unsigned i=2;i tmp_pow_base(n);\n\tfor(;i\n#include\nusing namespace std;\nint main()\n{\n int n,t,z=0,y=0;\n cin>>n>>t;\n int arr[n];\n for( int i=0;i>arr[i];\n\n }\n sort(arr,arr+t);\n \n for(int i=0;i<=t-n;i++)\n {\n if(i==0)\n {\n z=arr[n-1]-arr[i];\n }\n y=arr[n-1+i]-arr[i];\n if(y\nusing namespace std;\nint main()\n{\n\tint n;\n\tint m;\n\tint min = 0;\n\tint max = 0;\n\n\tcin >> n >> m;\n\n\twhile (n != 0)\n\t{\n\t\tif (n >= m)\n\t\t{\n\t\t\tmin = n;\n\t\t\tmax = n + m - 1;\n\t\t}\n\t\tif (m > n)\n\t\t{\n\t\t\tmin = n + (m - n);\n\t\t\tmax = n + m - 1;\n\t\t}\n\t\tcout << min << ' ' << max;\n\t}\n\t\t if (n == 0)\n\t\t\t\tcout << \"Impossible\";\n\t\t\n\n}", "lang": "MS C++", "bug_code_uid": "a1601e772e3f2beb0874f02494df71c6", "src_uid": "1e865eda33afe09302bda9077d613763", "apr_id": "c9912e3ad35e087e2e3f42dab40d11ed", "difficulty": 1100, "tags": ["math", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9004804392587509, "equal_cnt": 11, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 10, "bug_source_code": "\n#include\nusing namespace std;\n#define LL long long\n\nint pr[100005];\nint find(int r)\n{\n return (pr[r]==r) ? r: pr[r]=find(pr[r]);\n}\nstruct mn\n{\n int x,y;\n};\n\nint main()\n{\n LL n;\n LL mx = 0;\n while(cin>>n)\n {\n vectorv;\n for(int i=0; i<9; i++)\n v.push_back(i);\n\n LL p = n + n -1;\n LL s = 9;\n int d=0;\n while(p>=s)\n {\n d++;\n s = s*10 + 9;\n }\n // cout<x;\n\n\n int t=d;\n s = 0;\n while(t--)\n {\n s = s*10 + 9;\n }\n x.push_back(s);\n while(s * 10<=p)\n {\n x.push_back(s);\n s = s*10;\n }\n for(int i=1;i<9;i++)\n {\n LL s = i;\n int t=d;\n while(t--)\n {\n s = s*10 + 9;\n }\n if(s<=p)\n x.push_back(s);\n }\n // cout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)\n#define all(v) (v).begin(), (v).end()\n#define sz(v) (int)(v).size()\n\ntypedef long long llong;\n\nint main() {\n#ifdef LOCAL\n\tfreopen(\"test.in\", \"r\", stdin);\n\tfreopen(\"test.out\", \"w\", stdout);\n#endif\t\n\tint n;\n\tcin >> n;\n\tif (n == 3) {\n\t\tcout << 1;\n\t} else if (n == 1) {\n\t\tfor(;;);\n\t} else if (n == 2) {\n\t\tfor(;;);\n\t} else if (n == 4) {\n\t\tthrow;\n\t} else if (n == 5) {\n\t\tthrow;\n\t}\n\treturn 0;\n}", "lang": "MS C++", "bug_code_uid": "5ba33a48e9a3a894d391112f7d2d409a", "src_uid": "c702e07fed684b7741d8337aafa005fb", "apr_id": "ec6e8cb48d2fb5ce6f5c1322fdb72da0", "difficulty": 1300, "tags": ["brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.4358759430008382, "equal_cnt": 15, "replace_cnt": 7, "delete_cnt": 6, "insert_cnt": 2, "fix_ops_cnt": 15, "bug_source_code": "#include\n#include\nusing namespace std;\nint main()\n{\n int n, m,b=1,arr[100][1000];\n cin >> n >> m;\n for (int i = 0; i <= n; i++)\n {\n for (int f = 0; f <= m; f++)\n {\n arr[i][f] = b;\n b++;\n }\n }\n bool t = true;\n for (int i = 0; i >=0; i++)\n {\n for (int j = i; j < n; j++)\n {\n arr[j][i] = 0;\n }\n for (int j = i; j < m; j++)\n {\n arr[i][j] = 0;\n }\n if (arr[n - 1][m - 1] == 0)\n {\n if ((i+1) % 2 == 0)\n {\n cout << \"Malvika\" << endl;\n }\n else \n cout << \"Akshat\" << endl;\n break;\n }\n }\n \n return 0;\n}", "lang": "GNU C++", "bug_code_uid": "86e5afa6268d5fab14d11c12593af65f", "src_uid": "a4b9ce9c9f170a729a97af13e81b5fe4", "apr_id": "698f3b0b7ab39b62930909a759212c4a", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.20803295571575695, "equal_cnt": 12, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 11, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n\tlong long n, m, a, b, i, sum1, sum2;\n\tscanf(\"%d %d %d %d\", &n, &m, &a, &b);\n\tif(n % m == 0 )\n\t\tprintf(\"0\\n\");\n\telse\n\t{\n\t\tfor(i=1;;i++)\n\t\t{\n\t\t\tif ((n+i) % m == 0 )\n\t\t\t{\n\t\t\t\tsum1 = a * i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfor (i=1; (n-i) >= 0; i++)\n\t\t\tif((n-i) % m == 0)\n\t\t\t{\n\t\t\t\tsum2 = b * i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (sum1>sum2)\n\t\t\t\tprintf(\"%d\\n\",sum2);\n\t\t\telse\n\t\t\t\tprintf(\"%d\\n\",sum1);\n\t}\n\treturn 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "7bfa8631b2f7d1fdd249a36af4d71a83", "src_uid": "c05d753b35545176ad468b99ff13aa39", "apr_id": "2944aadb934cc22973d7f853805901c4", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.15789473684210525, "equal_cnt": 25, "replace_cnt": 19, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 25, "bug_source_code": "#include \nusing namespace std;\n\nint remove_zero(int p)\n{\n int t,i=1,x=0;\n while(p)\n {\n t=p%10;\n if(t)\n {\n x=t*i+x;\n i*=10;\n }\n p/=10;\n }\n return x;\n}\n\n\nint b_d(long long n)\n{\n int decimalNumber = 0, i = 0, remainder;\n while (n!=0)\n {\n remainder = n%10;\n n /= 10;\n decimalNumber += remainder*pow(2,i);\n ++i;\n }\n return decimalNumber;\n}\nbool checking(string s)\n{\n int c = 0;\n int n = s.length();\n\n for (int i = n - 1; i >= 0; i--)\n {\n if (s[i] == '0')\n c++;\n\n if (c >= 6 and s[i] == '1')\n return true;\n }\n\n return false;\n}\n\nstring MaxFreq(string str)\n{\n int n = str.size();\n\n unordered_map m;\n\n for (int i = 0; i < n; i++) {\n string s = \"\";\n for (int j = i; j < n; j++) {\n s += str[j];\n m[s]++;\n }\n }\n\n int maxi = 0;\n\n string s;\n for (auto i = m.begin(); i != m.end(); i++) {\n if (i->second > maxi) {\n maxi = i->second;\n s = i->first;\n }\n else if (i->second == maxi) {\n string ss = i->first;\n if (ss.size() > s.size())\n s = ss;\n }\n }\n\n return s;\n}\n\n\n\nint main()\n{\n int a,b,c,k;\n int count=0;\n cin>>a>>b>>c;\n k=__gcd(a,b)/a*b;\n for(int i=1;i*k<=c;i++)\n {\n if(k\nusing namespace std;\ntypedef long long ll;\nll a[3],x,y,z,k,ans;\nint main()\n{\n\tfor(ll i=0;i<3;i++)\n\t\tcin>>a[i];\n\twhile(true)\n\t{\n\t\tsort(a,a+3);\n\t\tx=a[0],y=a[1],z=a[2];\n\t\tif(!x)\n\t\t\tswap(x,y);\n\t\tif(x+y+z<3)\n\t\t\tbreak;\n\t\tif(z-x<2)\n\t\t{\n\t\t\tans+=(z+x+y)/3;\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\tif((x+y)*2<=z)\n\t\t{\n\t\t\tans+=x+y;\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tk=min(x,z-x);\n\t\t\tz-=2*k;\n\t\t\tx-=k;\n\t\t\tans+=k;\n\t\t}\n\t\ta[0]=x,a[1]=y,a[2]=z;\n\t}\n\tcout<\n#include \nusing namespace std;\nint main (){\n int kk [1];\n int kkk=kk [999]\n\tlong long int n,k;\n\tlong double m;\n\tcin>>n;\n\tk=n;\n\twhile (true ){\n\tif (k==1){\n\tcout <<\"8\";\n\tbreak;\n\t}\n\telse if (n%2!=0){\n\tif ((n%10==1||n%10==5||n%10==9)&&n>1){\n\t\tn/=10;\n\t\tif ((n%10)%2==0){\n\t\t\tcout <<\"8\";\n\t\t\tbreak;\n\t\t}\n\t\telse if ((n%10)%2!=0){\n\t\t\tcout <<\"2\";\n\t\t\tbreak;\n\t\t}\n\t}\n\telse if (n%10==3||n%10==7){\n\t\tn/=10;\n\t\tif ((n%10)%2==0){\n\t\t\tcout <<\"2\";\n\t\t\tbreak;\n\t\t}\n\t\telse if ((n%10)%2!=0){\n\t\t\tcout <<\"8\";\n\t\t\tbreak;\n\t\t}\n\t}\n\t}\n\t else if (n%10==0){\n\t \tn/=10;\n\t\t\t\t if ((n%10)%2==0){\n\t\t\t\t\tcout <<\"6\";\n\t\t\t\t\tbreak;\n }\n else if ((n%10)%2!=0){\n \tcout <<\"4\";\n \tbreak;\n }\n\t}\n\telse if (n%2==0){\n\t\tif (n%10==2||n%10==6){\n\t\t\tn/=10;\n\t\t\tif ((n%10)%2==0){\n\t\t\t\tcout <<\"4\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if ((n%10)%2!=0){\n\t\t\t\tcout <<\"6\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\telse if (n%10==4||n%10==8){\n\t\t\tn/=10;\n\t\t\tif ((n%10)%2==0){\n\t\t\t\tcout <<\"6\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if ((n%10)%2!=0){\n\t\t\t\tcout <<\"4\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t}\n}", "lang": "GNU C++14", "bug_code_uid": "7d03a7ab38a1701bbdd300e54e76ef64", "src_uid": "4b51b99d1dea367bf37dc5ead08ca48f", "apr_id": "595ffe397c4bd3e184580ea563952aa8", "difficulty": 1000, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.4302788844621514, "equal_cnt": 8, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "#include \nusing namespace std;\nint a, a1, sum = 0, cont;\nint main()\n{\n cin >> a;\n a1 = a;\n while (a) \n {\n sum += a % 10;\n a /= 10;\n }\n cont = sum \u00f7 4;\n return cout << a1 + cont, 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "d84e210a13be86defc698bdc71713512", "src_uid": "bb6fb9516b2c55d1ee47a30d423562d7", "apr_id": "4995bfe1021cc5573b3369b7383be4fa", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9974907749077491, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define ll long long\n#define ld long double\n#define null NULL\n#define all(a) a.begin(), a.end()\n#define rall(a) a.rbegin(), a.rend()\n\nusing namespace std;\n\ntemplate void output(iterator begin, iterator end, ostream& out = cerr) {\n\twhile (begin != end) {\n\t\tout << (*begin) << \" \";\n\t\tbegin++;\n\t}\n\tout << endl;\n}\n\ntemplate void output(const T &x, ostream &out = cerr) {\n\toutput(all(x), out);\n}\n\ntemplate int chkmin(T &a, const T &b) {\n\tif (b < a) {\n\t\ta = b;\n\t\treturn 1;\n\t}\n\treturn 0;\n}\n\ntemplate int chkmax(T &a, const T &b) {\n\tif (b > a) {\n\t\ta = b;\n\t\treturn 1;\n\t}\n\treturn 0;\n}\n\nvoid fast_io() {\n\tios_base::sync_with_stdio(0);\n\tcin.tie(0);\n\tcout.tie(0);\n}\n\nmt19937 rng(time(NULL));\n\nstruct hasher {\n\tint MOD, p = 0;\n\n\thasher(int _MOD) {\n\t\tMOD = _MOD;\n\t\twhile (p < 1000) {\n\t\t\tp = rng() % MOD;\n\t\t}\n\t}\n\n\tint n;\n\tvector deg, h;\n\n\tint mul(int a, int b) {\n\t\treturn (1LL * a * b) % MOD;\n\t}\n\n\tvoid load(vector v) {\n\t\tn = v.size();\n\t\tdeg.resize(n + 1);\n\t\th.resize(n + 1);\n\t\tdeg[0] = 1;\n\t\tfor (int i = 1; i <= n; ++i) {\n\t\t\tdeg[i] = mul(deg[i - 1], p);\n\t\t}\n\t\tfor (int i = n - 1; i >= 0; --i) {\n\t\t\th[i] = (mul(h[i + 1], p) + v[i]) % MOD;\n\t\t}\n\t}\n\n\tint get_hash(int l, int r) {\n\t\treturn (h[l] - mul(h[r + 1], deg[r - l + 1]) + MOD) % MOD;\n\t}\n};\n\nconst ll MOD1 = 1e9 + 7;\nconst ll MOD2 = 998244353;\nconst int mx = 2e5 + 228;\nint n, s[mx], r0[mx], l0[mx], zero_id[mx], zero_pos_by_id[mx];\nvector mid_data;\nhasher H1(MOD1), H2(MOD2);\n\npair get_hash(int l, int r) {\n\treturn {H1.get_hash(l, r), H2.get_hash(l, r)};\n}\n\nvoid read() {\n\tcin >> n;\n\tfor (int i = 0; i < n; ++i) {\n\t\tchar c;\n\t\tcin >> c;\n\t\ts[i] = c - '0';\n\t}\n}\n\nvoid gen_lr0() {\n\tint last_0 = -1;\n\tfor (int i = 0; i < n; ++i) {\n\t\tif (s[i] == 0) {\n\t\t\tlast_0 = i;\n\t\t}\n\t\tl0[i] = last_0;\n\t}\n\tlast_0 = n;\n\tfor (int i = n - 1; i >= 0; --i) {\n\t\tif (s[i] == 0) {\n\t\t\tlast_0 = i;\n\t\t}\n\t\tr0[i] = last_0;\n\t}\n\tfill(zero_id, zero_id + n, -1);\n\tint cur_zero = 0;\n\tfor (int i = 0; i < n; ++i) {\n\t\tif (s[i] == 0) {\n\t\t\tzero_pos_by_id[cur_zero] = i;\n\t\t\tzero_id[i] = cur_zero++;\n\t\t}\n\t}\n\tfor (int i = 1; i < cur_zero; ++i) {\n\t\tmid_data.push_back((zero_pos_by_id[i] - zero_pos_by_id[i - 1] - 1) % 2);\n\t}\n\tH1.load(mid_data);\n\tH2.load(mid_data);\n}\n\nstruct data {\n\tint l, r, b1, b2;\n};\n\ndata get(int l, int r) {\n\tint left_0 = r0[l], right_0 = l0[r];\n\tif (left_0 > right_0) {\n\t\treturn {0, -2, (r - l + 1) % 2, (r - l + 1) % 2};\n\t} else {\n\t\treturn {zero_id[left_0], zero_id[right_0] - 1, (left_0 - l) % 2, (r - right_0) % 2};\n\t}\n}\n\nint equal(data a, data b) {\n\tif (a.b1 != b.b1 || a.b2 != b.b2) {\n\t\treturn 0;\n\t}\n\tif (a.r - a.l != b.r - b.l) {\n\t\treturn 0;\n\t}\n\tif (a.r - a.l == -2 || a.r - a.l == -1) {\n\t\treturn 1;\n\t}\n\treturn get_hash(a.l, a.r) == get_hash(b.l, b.r);\n}\n\nvoid process() {\n\tint q;\n\tcin >> q;\n\tfor (int i = 0; i < q; ++i) {\n\t\tint l1, r1, l2, r2, len;\n\t\tcin >> l1 >> l2 >> len;\n\t\tl1--;\n\t\tl2--;\n\t\tr1 = l1 + len - 1;\n\t\tr2 = l2 + len - 1;\n\t\tdata d1 = get(l1, r1);\n\t\tdata d2 = get(l2, r2);\n\t\tint res = equal(d1, d2);\n\t\tcout << (res ? \"Yes\" : \"No\") << \"\\n\";\n\t}\n}\n\nsigned main() {\n\tfast_io();\n\tread();\n\tgen_lr0();\n\tprocess();\n}\n", "lang": "GNU C++11", "bug_code_uid": "6affafbb7dbe75240c4fe1bce6dddbe9", "src_uid": "6bd41042c6a442765cd93c73d55f6189", "apr_id": "3a770c630c6d20bf99e41bf06125d978", "difficulty": null, "tags": ["hashing", "strings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.786036036036036, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "#include \n#include \n#include \nusing namespace std;\nint main(){\n string str,str1,st,st1;\n cin>>str>>str1;\n long c=str.length();\n \n \n for(int x = 0 ; x < c;x++){\n st[x] = tolower(str[x]);\n st1[x] = tolower(str1[x]);\n }\n int l =0,value;\n while(l st1[l]){\n value = 1;break;\n }else if(st[l] < st1[l]){\n value = -1;break;\n }else{\n value = 0;\n }\n l++;\n }\n cout<\n#include \n#include \nusing namespace std;\nint main()\n{\n\n int n,m;\n scanf(\"%d%d\\n\",&n,&m);\n char a[110];\n bool visited[110]={false};\n int s,e;\n for(int i=0;i q;\n q.push(s);\n visited[s]=true;\n while(!q.empty())\n {\n\n int now=q.front();\n q.pop();\n if(now==e)\n {\n\n printf(\"YES\");\n return 0;\n }\n if(now+m=0&&!visited[now-m]&&a[now-m]!='#')\n {\n\n q.push(now-m);\n }\n }\n printf(\"NO\");\n}\n", "lang": "GNU C++", "bug_code_uid": "f6477d3b75b67b7bfd93b9adb0dd0aba", "src_uid": "189a9b5ce669bdb04b9d371d74a5dd41", "apr_id": "cf050b269f328e027219617c34a60ffc", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.965207100591716, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "//\n// Created by CQU_CST_WuErli\n// Copyright (c) 2015 CQU_CST_WuErli. All rights reserved.\n//\n// #include\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define CLR(x) memset(x,0,sizeof(x))\n#define OFF(x) memset(x,-1,sizeof(x))\n#define MEM(x,a) memset((x),(a),sizeof(x))\n#define For_UVa if (kase!=1) cout << endl\n#define BUG cout << \"I am here\" << endl\n#define lookln(x) cout << #x << \"=\" << x << endl\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 rep(flag,start,end) for(int flag=start;flag<=end;flag++)\n#define Rep(flag,start,end) for(int flag=start;flag>=end;flag--)\n#define Lson l,mid,rt<<1\n#define Rson mid+1,r,rt<<1|1\n#define Root 1,n,1\n#define BigInteger bign\ntemplate T gcd(const T& a,const T& b) {return b==0?a:gcd(b,a%b);}\nconst int MAX_L=2005;// For BigInteger\nconst int INF_INT=0x3f3f3f3f;\nconst long long INF_LL=0x7fffffff;\nconst int MOD=1e9+7;\nconst double eps=1e-9;\nconst double pi=acos(-1);\ntypedef long long ll;\nusing namespace std;\n\nint x,y;\nint n,d;\nint dp[1000][1000];\nstruct P{\n int x,y;\n};\nP p[22];\n\nint dfs(int xx,int yy) {\n if (dp[xx][yy]!=-1) return dp[xx][yy];\n if ((xx-200)*(xx-200)+(yy-200)*(yy-200)>=d*d) return 1;\n int &ret=dp[xx][yy];\n rep(i,1,n) {\n if (!dfs(xx+p[i].x,yy+p[i].y)) return ret=1;\n }\n return ret=0;\n}\n\nint main(){\n#ifdef LOCAL\n freopen(\"C:\\\\Users\\\\john\\\\Desktop\\\\in.txt\",\"r\",stdin);\n// freopen(\"C:\\\\Users\\\\john\\\\Desktop\\\\out.txt\",\"w\",stdout);\n#endif\n while (SII(x,y)==2) {\n x+=200;\n y+=200;\n SII(n,d);\n rep(i,1,n) {\n cin >> p[i].x >> p[i].y;\n }\n OFF(dp);\n// dp[x][y]=0;\n if (dfs(x,y)) cout << \"Anton\" << endl;\n else cout << \"Dasha\" << endl;\n }\n return 0;\n}\n\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\n\u7248\u6743\u58f0\u660e\uff1a\u672c\u6587\u4e3aCSDN\u535a\u4e3b\u300c\u53ea\u73a9\u4e09\u56fd\u7684\u7a0b\u5e8f\u733f\u300d\u7684\u539f\u521b\u6587\u7ae0\uff0c\u9075\u5faaCC 4.0 BY-SA\u7248\u6743\u534f\u8bae\uff0c\u8f6c\u8f7d\u8bf7\u9644\u4e0a\u539f\u6587\u51fa\u5904\u94fe\u63a5\u53ca\u672c\u58f0\u660e\u3002\n\u539f\u6587\u94fe\u63a5\uff1ahttps://blog.csdn.net/CQUWEL/java/article/details/50615040", "lang": "GNU C++11", "bug_code_uid": "22232f6d9f5e45e8d08fd3a182dfa211", "src_uid": "645a6ca9a8dda6946c2cc055a4beb08f", "apr_id": "f48fb1afd835e619860a9546090926bd", "difficulty": 1900, "tags": ["dp", "games"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.14366197183098592, "equal_cnt": 37, "replace_cnt": 28, "delete_cnt": 4, "insert_cnt": 5, "fix_ops_cnt": 37, "bug_source_code": "#pragma GCC optimize(\"O3\")\n//#pragma GCC optimize(\"Ofast\")\n//#pragma GCC optimize(\"unroll-loops\")\n//#pragma GCC target(\"sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native\")\n\n#include \n\nusing namespace std;\n\nint n, x[4], y[4], r[4];\n\nint sqr(int x) {\n return x * x;\n}\n\nint getSign(int k, int i, int j) {\n int q = sqr(x[k] - i) + sqr(y[k] - j) - sqr(r[k]);\n return q == 0 ? 0 : q > 0 ? 1 : -1;\n}\n\nvector getSigns(int i, int j) {\n vector res;\n for(int k = 0; k < 3; k++) {\n res.push_back(getSign(k, i, j));\n }\n return res;\n}\n\nbool vis[2001][2001];\n\nvoid dfs(int i, int j, const vector& signs) {\n if(i < 0 || i > 2000 || j < 0 || j > 2000 || vis[i][j] ||\n signs != getSigns(i, j)) return;\n //cerr << i << \" \" << j << endl;\n vis[i][j] = true;\n dfs(i + 1, j, signs);\n dfs(i - 1, j, signs);\n dfs(i, j + 1, signs);\n dfs(i, j - 1, signs);\n}\n\nbool isntAtCircle(int i, int j) {\n for(int k = 0; k < 3; k++) {\n if(getSign(k, i, j) == 0) {\n return false;\n }\n }\n return true;\n}\n\nint main() {\n\t#ifdef Fekete\n freopen(\"input.txt\", \"r\", stdin);\n //freopen(\"output.txt\", \"w\", stdout);\n #else\n\n #endif // Fekete\n\n cin >> n;\n for(int i = 0; i < n; i++) {\n cin >> x[i] >> y[i] >> r[i];\n x[i] += 10;\n y[i] += 10;\n x[i] *= 100;\n y[i] *= 100;\n r[i] *= 100;\n }\n int ans = 0;\n for(int i = 0; i <= 2000; i++){\n for(int j = 0; j <= 2000; j++) {\n if(!vis[i][j] && isntAtCircle(i, j)) {\n ans++;\n //cerr << ans << endl;\n dfs(i, j, getSigns(i, j));\n }\n }\n }\n\n cout << ans;\n}\n", "lang": "GNU C++11", "bug_code_uid": "70f3efe95c0d056f4b4dbbb72785a1f4", "src_uid": "bda5879e94a82c6fd499796f258c4691", "apr_id": "d678689cd1a213ca0af53945f3698498", "difficulty": 2700, "tags": ["graphs", "geometry"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9983394221188974, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \n\nusing namespace std;\n\nconstexpr int MOD = 1'000'000'007;\n\nint mod_pow(int a, int b, int c) {\n long long x = 1, y = a;\n while (b > 0) {\n if (b % 2 == 1) {\n x = (x * y) % c;\n }\n y = (y * y) % c;\n b /= 2;\n }\n return x % c;\n}\nint mod_inv(int a) {\n return mod_pow(a, MOD - 2, MOD);\n}\nint choose(int n, int k, const vector &fac) {\n if (k > n) return 0;\n return 1LL * fac[n] * mod_inv(1LL * fac[k] * fac[n - k] % MOD) % MOD;\n}\n\nint main() {\n std::ios::sync_with_stdio(false); \n cin.tie(nullptr);\n \n int n, m;\n cin >> n >> m;\n const int mx = max(n, m);\n vector fac(mx + 1, 1);\n for (int i = 2; i <= mx; ++i) {\n fac[i] = (1LL * fac[i - 1] * i) % MOD;\n }\n vector npow(n, 1), mpow(n, 1);\n for (int i = 1; i < n; ++i) {\n npow[i] = 1LL * npow[i - 1] * n % MOD;\n mpow[i] = 1LL * mpow[i - 1] * m % MOD;\n }\n\n int res = 0;\n for (int k = 1; k <= n - 1; ++k) {\n //int cur = x;\n //x = 1LL * x * (n - k - 1) % MOD;\n int cur = choose(n - 2, k - 1);\n cur = 1LL * cur * fac[k - 1] % MOD;\n\n cur = 1LL * cur * (k + 1) % MOD;\n if (n == k + 1) cur = 1LL * cur * mod_inv(n) % MOD;\n else cur = 1LL * cur * npow[n - k - 2] % MOD;\n\n cur = 1LL * cur * choose(m - 1, k - 1, fac) % MOD;\n\n cur = 1LL * cur * mpow[n - 1 - k] % MOD;\n\n res = (res + cur) % MOD;\n }\n cout << res << \"\\n\";\n\n return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "7ca4ed265dadfae4d206e5a807ed7dcf", "src_uid": "728fe302b8b18e33f15f6e702e332cde", "apr_id": "3f9a404d9266c2f1026c04ae7cf50c25", "difficulty": 2400, "tags": ["trees", "dp", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9168808911739503, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "#include \n#include \n#include \nusing namespace std;\nconst int MAXN = 110000;\nconst int MOD = 1e9 + 9;\nlong long dp[MAXN];\nint main(){\n\tint n; scanf(\"%d\", &n);\n\tdp[0] = 1; \n\tlong long mulv = 2, ans = 6;\n\tfor(int i = 1; i <= n / 2 - 2; i++) \n\t\tmulv *= 2, mulv %= MOD;\n\t\tdp[i] = dp[i - 1] + mulv, dp[i] %= MOD;\n\t\n\tfor(int i = 3; i <= n / 2; i++){\n\t\tmulv = 1;\n\t\tfor(int j = 1; j <= i - 2; j++){\n\t\t\tmulv *= dp[j];\n\t\t\tmulv %= MOD;\n\t\t}\n\t\tans += 4 * mulv;\n\t\tans %= MOD;\n\t}\n\tans = ans * ans % MOD + 1;\n\tans *= 2;\n\tif(n != 2) printf(\"%lld\", ans % MOD);\n\telse printf(\"10\\n\");\n\treturn 0;\n}", "lang": "GNU C++17", "bug_code_uid": "3d53c00c950927bebd807d9d6d0600b8", "src_uid": "dbcb1077e7421554ba5d69b64d22c937", "apr_id": "11a23bd3791348d59906b0b3d7c6ee1d", "difficulty": 2600, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5, "equal_cnt": 7, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "#include\n\nusing namespace std;\n\nint main(){\n\tint a,b,k,count=0,x,c;\n\tcin>>a>>b;\n\tif(a==b)\n\t\tcout<<\"infinity\"<a)\n\t\tcout<<0< b ){\n\t\t\tif(c%k==0)\n\t\t\t\tcount++;\n\t\t\tk++;\n\t\t}\n\t\tcout<\n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\ntypedef long long ll;\n\nint main()\n{\n ios_base::sync_with_stdio(false);\n cin.tie(0);\n cout.tie(0);\n ll n, ms = 0;\n cin >> n;\n string a;\n cin >> a;\n map m;\n for (ll i = 0; i < n; ++i){\n m[i] = 1;\n }\n for (ll i = 0; i < (a.size() + 1) / 2; ++i){\n if (a[i] == a[a.size() - i - 1] && a[i] != '?'){\n n -= m[a[i] - 'a'];\n m[a[i] - 'a'] = 0;\n }\n else{\n if (a[i] != a[a.size() - i - 1] && (a[i] == '?' || a[a.size() - i - 1] == '?')){\n if (a[i] == '?')\n a[i] = a[a.size() - i - 1];\n else\n a[a.size() - i - 1] = a[i];\n n -= m[a[i] - 'a'];\n m[a[i] - 'a'] = 0;\n }\n else{\n if(a[i] != a[a.size() - i - 1]){\n cout << \"IMPOSSIBLE\";\n return 0;\n }\n else{\n ms += 1;\n }\n }\n }\n }\n deque va;\n for (auto i : m){\n if (i.second == 1){\n va.push_back(i.first);\n ms--;\n }\n }\n while (ms != 0){\n va.push_front(0);\n ms--;\n }\n for (ll i = 0; i < (a.size() + 1) / 2; ++i){\n if (a[i] == a[a.size() - i - 1] && a[i] == '?'){\n char ch(va.front() + 'a');\n a[i] = a[a.size() - i - 1] = ch;\n va.pop_front();\n }\n }\n if (va.size() != 0)\n cout << \"IMPOSSIBLE\";\n else\n cout << a;\n}\n", "lang": "GNU C++17", "bug_code_uid": "e287c6c3afabafca5e0e667d00255d1e", "src_uid": "9d1dd9d722e5fe46823224334b3b208a", "apr_id": "8272aa12791c86033c43d0b00764f6a3", "difficulty": 1600, "tags": ["expression parsing"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9573621375781695, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include\n\nusing namespace std;\n\nint n;\nvector ss;\n\nint main(){\n cin >> n;\n bool gg = false;\n for(int i = 0; i < n; i++){\n int aux = 0;\n cin >> aux;\n if(aux == 0 && !gg) continue;\n if(aux == 1) gg = true;\n\n ss.push_back(aux);\n }\n\n for(int i = ss.size() - 1; ss[i] != 1; i--){\n ss[i] = -1;\n }\n\n int ans = 0;\n for(int i = 0; i < ss.size(); i++){\n if(ss[i] == -1) continue;\n if(ss[i] == 1){\n ans++;\n }else if(i+1 < ss.size() && ss[i+1] == 1){\n ans++;\n //cout << \"entre\";\n }else{\n for(int j = 0; j+i < ss.size() && ss[i+j] != 1; j++){\n ss[i+j] = -1;\n }\n }\n //cout << ss[i] << \" \";\n }\n //cout << endl;\n cout << ans << endl;\n\n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "7a0026f40a94ab2c1135d8f103248e7e", "src_uid": "2896aadda9e7a317d33315f91d1ca64d", "apr_id": "c7a8f65d4c27508359a333110245dd23", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9920812182741117, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include\n#include\n#define MN 7900\n#define mod 1000000007\nusing namespace std;\ninline int read()\n{\n\tint x=0,f=1;char ch=getchar();\n\twhile(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}\n\twhile(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}\n\treturn x*f;\n}\nconst int md = (int) 1e9 + 7;\n\ninline void add(int &a, int b) {\n a += b;\n if (a >= md) a -= md;\n}\n\ninline void sub(int &a, int b) {\n a -= b;\n if (a < 0) a += md;\n}\n\ninline int mul(int a, int b) {\n return (int) ((long long) a * b % md);\n}\n\ninline int power(int a, long long b) { // a^b mod md\n int res = 1;\n while (b > 0) {\n if (b & 1) {\n res = mul(res, a);\n }\n a = mul(a, a);\n b >>= 1;\n }\n return res;\n}\n\ninline int inv(int a) { // multiplicative inverse of a mod md\n a %= md;\n if (a < 0) a += md;\n int b = md, u = 0, v = 1;\n while (a) {\n int t = b / a;\n b -= t * a; swap(a, b);\n u -= t * v; swap(u, v);\n }\n assert(b == 1);\n if (u < 0) u += md;\n return u;\n}\n\n\ninline int pow(int x,int k)\n{\n\tint sum=1;\n\tfor(;k;k>>=1,x=1LL*x*x%mod) if(k&1) sum=1LL*sum*x%mod;\n\treturn sum;\t\n}\nint a[MN+5][MN+5],res[MN+5];\nint R,a1,a2,a3,a4,cnt,id[105][105],ans;\ninline int&ID(int x,int y){return id[x+R+1][y+R+1];}\nvoid Gauss()\n{\n\tfor(int i=1;i<=cnt;++i)\n\t{\n\t\tfor(int j=i;j<=cnt&&j<=i+100;++j) if(a[j][i])\n\t\t{\n\t\t\tif(j!=i) \n\t\t\t{\n\t\t\t\tfor(int k=i;k<=cnt&&k<=i+100;++k) swap(a[i][k],a[j][k]);\t\n\t\t\t\tswap(a[i][cnt+1],a[j][cnt+1]);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tif(!a[i][i])continue;\n\t\tint Inv=inv(a[i][i]);\n\t\tfor(int j=i+1;j<=cnt&&j<=i+100;++j) if(a[j][i])\n\t\t{\n\t\t\tint t = mul(a[j][i],Inv);\n\t\t\tfor(int k=i;k<=cnt&&k<=i+100;++k)\n\t\t\t\tsub(a[j][k],mul(a[i][k],t));\n\t\t\tsub(a[j][cnt+1],mul(a[i][cnt+1],t));\n\t\t}\n\t}\n\tfor(int i=cnt;i;--i)\n\t{\n\t\tint t=a[i][cnt+1];\n\t\tfor(int j=i+1;j<=cnt&&j<=i+100;++j) t=(t-1LL*a[i][j]*res[j]%mod+mod)%mod;\n\t\tres[i]=1LL*t*pow(a[i][i],mod-2)%mod;\n\t\t//ans=(ans+res[i])%mod;\n\t}\n\tans = res[ID(0,0)];\n}\nint main()\n{\n\tR=read();a1=read();a2=read();a3=read();a4=read();int inv=pow(a1+a2+a3+a4,mod-2);\n\tfor(int i=-R;i<=R;++i)for(int j=-R;j<=R;++j) if(i*i+j*j<=R*R) ID(i,j)=++cnt,a[cnt][cnt]=1;\n\ta[ID(0,0)][cnt+1]=1;\n\tfor(int i=-R;i<=R;++i) for(int j=-R;j<=R;++j) if(i*i+j*j<=R*R)\n\t{\n\t\tif(ID(i-1,j)) a[ID(i-1,j)][ID(i,j)]=mod-1LL*a1*inv%mod;\n\t\tif(ID(i,j-1)) a[ID(i,j-1)][ID(i,j)]=mod-1LL*a2*inv%mod;\n\t\tif(ID(i+1,j)) a[ID(i+1,j)][ID(i,j)]=mod-1LL*a3*inv%mod;\n\t\tif(ID(i,j+1)) a[ID(i,j+1)][ID(i,j)]=mod-1LL*a4*inv%mod;\n\t\ta[ID(i,j)][cnt+1] = 1;\n\t}\n\tGauss();cout<\nusing namespace std;\n\nint main()\n{\n\tint a, b, y = 1;\n\tcin >> a >> b ;\n\twhile (true)\n\t{\n\t\tif (a * 3 > b * 2)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\n\t\ty++;\n\t}\n\tcout << y;\n\n\t\n\n\treturn 0;\n}", "lang": "MS C++ 2017", "bug_code_uid": "63184bd55151851a39f05ddfc2a76e9b", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "apr_id": "a0e56f3e0a3cdf7fbf38814cc584c749", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.3979015334947538, "equal_cnt": 21, "replace_cnt": 16, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 20, "bug_source_code": "#include \n\nusing namespace std;\nusing ll = long long;\n\nconst int MOD = 998244353;\n\ninline int add(int a, int b) {\n\ta += b;\n\treturn a - MOD * (a >= MOD);\n}\n\ninline int mult(int a, int b) {\n\treturn (ll) a * b % MOD;\n}\n\nsigned main() {\n\tios::sync_with_stdio(false);\n\tcin.tie(0), cout.tie(0);\n\n\tint n, k;\n\tcin >> n >> k;\n\tvector a(n);\n\tfor (auto &el : a) {\n\t\tcin >> el;\n\t}\n\n\tfor (int i = 0; i < n; i++) {\n\t\ta.push_back(a[i]);\n\t}\n\ta.insert(a.begin(), 0);\n\n\tvector> dp(n + 1, vector(2 * n + 1, 0));\n\tdp[0][n] = 1;\n\n\tfor (int i = 1; i <= n; i++) {\n\t\tif (a[i] != a[i + 1]) {\n\t\t\tfor (int j = 0; j <= 2 * n; j++) {\n\t\t\t\tif (j) {\n\t\t\t\t\tdp[i][j] = add(dp[i][j], dp[i - 1][j - 1]);\n\t\t\t\t}\n\t\t\t\tif (j != 2 * n) {\n\t\t\t\t\tdp[i][j] = add(dp[i][j], dp[i - 1][j + 1]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (int j = 0; j <= 2 * n; j++) {\n\t\t\tdp[i][j] = add(dp[i][j], mult(dp[i - 1][j], max(0, k - 2 * (a[i] != a[i + 1]))));\n\t\t}\n\t}\n\n\tint ans = 0;\n\tfor (int i = n + 1; i <= 2 * n; i++) {\n\t\tans = add(ans, dp[n][i]);\n\t}\n\n\tcout << ans << '\\n';\n}", "lang": "GNU C++17", "bug_code_uid": "df5822dc1be4128db53a472c47c7e244", "src_uid": "63c4006a0a6284f9825aaabfc4c28fd1", "apr_id": "90540664e00ff9dc5ca5809ea8a773d8", "difficulty": 2400, "tags": ["math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5106934543097861, "equal_cnt": 20, "replace_cnt": 18, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 19, "bug_source_code": "#include \n#include \nusing namespace std;\n\nint min2(int a, int b)\n{\n\tif (a <= b) return a;\n\treturn b;\n}\nint min3(int a, int b, int c)\n{\n\tif (min2(a, b) > c) return c;\n\treturn min2(a, b);\n}\n\nint main()\n{\n\tint n = 0;\n\tint a = 0;\n\tint b = 0;\n\tint c = 0;\n\tint result = 0;\n\n\tcin >> n >> a >> b >> c;\n\n\n\tif (n % 4 == 0)\n\t{\n\t\tresult = 0;\n\t}\n\tif (n % 4 == 1)\n\t{\n\t\tint variant1, variant2, variant3;\n\t\tvariant1 = c;\n\t\tvariant2 = a + b;\n\t\tvariant3 = a * 3;\n\t\tresult = min3(variant1, variant2, variant3);\n\t};\n\tif (n % 4 == 2)\n\t{\n\t\tresult = min3((a + a), (b), (c + c));\n\t};\n\tif (n % 4 == 3)\n\t{\n\t\tresult = min3((a), (c + b), (3*c));\n\t};\n\n\n\n\n\n\tcout << result;\n\n\n\n\treturn result;\n};\n", "lang": "MS C++", "bug_code_uid": "4f1fabd4e6bed1f04cc7f0f120180017", "src_uid": "c74537b7e2032c1d928717dfe15ccfb8", "apr_id": "17087236be066f8e9665e5bdb6f000a3", "difficulty": 1300, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8722810931399888, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "#include \nusing namespace std;\ntypedef long long int ll;\n\nvector v;\n\nint main(){\n ll a, b, f, k; cin >> a >> b >> f >> k;\n\n v.push_back(f);\n \n while(k > 0){\n if(k == 1)\n v.push_back((a-f));\n else\n v.push_back((a-f)*2);\n k--;\n if(k == 0) break;\n \n if(k == 1)\n v.push_back(f);\n else\n v.push_back(2*f);\n k--;\n }\n \n if(max((a-f)*2, 2*f) > b){\n cout << -1 << endl;\n return -1; \n }\n\n int n = v.size();\n \n ll res = 0, pos = 0;\n while(pos < n){\n int sum = 0;\n while(pos < n && v[pos]+sum <= b)\n sum += v[pos++];\n if(pos != n)\n res++;\n \n }\n cout << res << endl;\n return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "14274a5ad2bc2b080973bac6dac16d34", "src_uid": "283aff24320c6518e8518d4b045e1eca", "apr_id": "584efca12756751b4224516f77dd127a", "difficulty": 1500, "tags": ["greedy", "math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9632525410476935, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 6, "bug_source_code": "#include\n#define For(i,a,b) for(int i=a;i<=b;i++)\nusing namespace std;\nint n,m;\nint a[1001],b[10001],c[1010],f[111][111];\nint chia(int l,int r,int k){\n if(f[l][r]>0)return f[l][r];\n f[l][r]=0;\n For(i,l,r-1){\n if(b[i]-b[l-1]==c[i]-c[l-1]&&b[r]-b[i]==c[r]-c[i]&&k>=abs(a[i+1]-a[i])){\n f[l][r]=max(f[l][r],chia(i+1,r,k-abs(a[i+1]-a[i]))+1);\n }\n }\n return f[l][r];\n}\nint main(){\n //freopen(\"m.inp\",\"r\",stdin);\n cin>>n>>m;\n For(i,1,n){\n cin>>a[i];\n b[i]=b[i-1];c[i]=c[i-1];\n if(a[i]%2==0)b[i]++;\n else c[i]++;\n }\n cout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#include \n#include \n#include \n\nusing namespace std;\n\ntypedef long long int64;\n\n#define forn(i, n) for(int i = 0; i < (int)(n); i++)\n#define ford(i, n) for(int i = (int)(n) - 1; i >= 0; i--)\n#define pb push_back\n#define mp make_pair\n#define y1 YYY1\n#define all(a) (a).begin(), (a).end()\n#define rall(a) (a).rbegin(), (a).rend()\n\n#ifdef _WIN32\n\t#define LLD \"%I64d\"\n#else\n\t#define LLD \"%lld\"\n#endif\n\ntemplate inline T Abs(T x) { return (x >= 0) ? x : -x; }\ntemplate inline T sqr(T x) { return x * x; }\ntemplate inline string toStr(T x) { stringstream st; st << x; string s; st >> s; return s; }\ntemplate inline int bit(T mask, int b) { return (b >= 0 && (mask & (T(1) << b)) != 0) ? 1 : 0; }\n\ninline int nextInt() { int x; if (scanf(\"%d\", &x) != 1) throw; return x; }\ninline int64 nextInt64() { int64 x; if (scanf(LLD, &x) != 1) throw; return x; }\ninline double nextDouble() { double x; if (scanf(\"%lf\", &x) != 1) throw; return x; }\n\nconst int INF = (int)1E9;\nconst int64 INF64 = (int64)1E18;\nconst long double EPS = 1E-9;\nconst long double PI = 3.1415926535897932384626433832795;\n\nconst int64 MOD = INF + 9;\nconst int MAXN = 11;\n\nint64 d[MAXN][1 << MAXN], D[MAXN][1 << MAXN][1 << MAXN];\nvector > a;\nbool used[MAXN];\n\nvoid mul(int n, int64 a[1 << MAXN][1 << MAXN], int64 b[1 << MAXN][1 << MAXN]) {\n\tstatic int64 res[1 << MAXN][1 << MAXN];\n\tmemset(res, 0, sizeof res);\n\tforn(i, n) {\n\t\tforn(j, n) {\n\t\t\tforn(k, n) {\n\t\t\t\tres[i][j] = (res[i][j] + a[i][k] * b[k][j]) % MOD;\n\t\t\t}\n\t\t}\n\t}\n\n\tforn(i, n) {\n\t\tforn(j, n) {\n\t\t\ta[i][j] = res[i][j];\n\t\t}\n\t}\n}\n\nvoid binPow(int64 a[1 << MAXN][1 << MAXN], int n, int64 b) {\n\tstatic int64 res[1 << MAXN][1 << MAXN];\n\tmemset(res, 0, sizeof res);\n\tforn(i, n) {\n\t\tres[i][i] = 1;\n\t}\n\n\twhile (b > 0) {\n\t\tif (b % 2 == 0) {\n\t\t\tmul(n, a, a);\n\t\t\tb /= 2;\n\t\t} else {\n\t\t\tmul(n, res, a);\n\t\t\tb--;\n\t\t}\n\t}\n\n\tforn(i, n) {\n\t\tforn(j, n) {\n\t\t\ta[i][j] = res[i][j];\n\t\t}\n\t}\n}\n\nvoid calcMoves(int n, int64 a[1 << MAXN][1 << MAXN], bool first) {\n\tforn(deprLeft, 1 << n) {\n\t\tforn(realLeft, 1 << n) {\n\t\t\tif ((deprLeft & realLeft) != 0) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (first && realLeft + 1 != 1 << n) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tforn(mid, 1 << (n - 1)) {\n\t\t\t\tint realMid = 1 + (mid << 1) + (1 << n);\n\t\t\t\tint deprRight = 0;\n\t\t\t\tforn(i, n) {\n\t\t\t\t\tif (bit(realMid, i) && bit(realMid, i + 1) && bit(realLeft, i)) {\n\t\t\t\t\t\tdeprRight += 1 << i;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\ta[deprLeft][deprRight]++;\n\t\t\t}\n\t\t}\n\t}\n}\n\nint64 move(int h, int w, int start, int finish, int pos) {\n\tif (!used[pos]) {\n\t\tused[pos] = true;\n\t\tstatic int64 a[1 << MAXN][1 << MAXN];\n\n\t\tmemset(a, 0, sizeof a);\n\t\tcalcMoves(h, a, pos == 0);\n\t\tbinPow(a, 1 << h, w);\n\n\t\tforn(i, 1 << h) {\n\t\t\tforn(j, 1 << h) {\n\t\t\t\tD[pos][i][j] = a[i][j];\n\t\t\t}\n\t\t}\n\t}\n\n\treturn D[pos][start][finish];\n}\n\nint64 get(int v, int mask) {\n\tif (v == int(a.size())) return (mask == 0) ? 1 : 0;\n\tif (mask >= (1 << a[v].first)) return 0;\n\n\tint64 &ans = d[v][mask];\n\tif (ans != -1) return ans;\n\n\tans = 0;\n\tint h = a[v].first, w = a[v].second;\n\tforn(nmask, 1 << h) {\n\t\tans = (ans + move(h, w, mask, nmask, v) * get(v + 1, nmask)) % MOD;\n\t}\n\n\treturn ans;\n}\n\n\nint main() {\n cout.setf(ios::fixed);\n cout.precision(10);\n\tdouble _startTime = clock();\n#ifdef NALP_PROJECT\n\tfreopen(\"input.txt\", \"rt\", stdin);\n//\tfreopen(\"output.txt\", \"wt\", stdout);\n#else\n#endif\n\n\tforn(i, 7) {\n\t\tint w = nextInt();\n\t\tif (w != 0) {\n\t\t\ta.pb(mp(i + 1, w));\n\t\t}\n\t}\n\treverse(all(a));\n\tif (a[0].first > 1) {\n\t\ta.insert(a.begin(), mp(a[0].first, 1));\n\t\ta[1].second--;\n\t}\n\n\tmemset(d, 255, sizeof d);\n\tcout << get(0, 0) << endl;\n\n\tcerr << \"Elapsed \" << (clock() - _startTime) / CLOCKS_PER_SEC << \" s\" << endl;\n\treturn 0;\n}\n", "lang": "MS C++", "bug_code_uid": "862323a0523beae3280f52d6de57aee9", "src_uid": "a4bda63b95dc14185c47a08652fe41bd", "apr_id": "9baf08e0106697293b3d1b5054534080", "difficulty": 2700, "tags": ["matrices", "dp"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9982866933181039, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": ".#include\nusing namespace std;\nconst int N=1e5+7;\nint n,k,p,cnt[N]; long long ifac[N];\ninline void solve(int l,int r,int t){\n\tif(t==1||l==r) {cnt[r-l+1]++; return;}\n\tint d=(l+r)>>1; solve(l,d,t-1),solve(d+1,r,t-1);\n}\ninline long long getans(int a,int b){\n\tlong long sum=(p+1)/2,ans=sum*a%p*b%p;\n\tfor(int i=1;i<=a;i++) ans=(ans-ifac[i+b]+ifac[i])%p;\n\treturn (ans+p)%p;\n}\nint main(){\n\tcin>>n>>k>>p,ifac[0]=ifac[1]=1;\n\tfor(int i=2;i<=n;i++) ifac[i]=ifac[p%i]*(p-p/i)%p;\n\tfor(int i=1;i<=n;i++) ifac[i]=(ifac[i]+ifac[i-1])%p;\n\tsolve(1,n,k); int a=0,b=0;\n\tfor(int i=1;i<=n;i++) if(cnt[i]&&!a) a=i; else if(cnt[i]) b=i;\n\tlong long s=getans(a,a)*((1ll*cnt[a]*(cnt[a]-1)/2)%p)%p;\n\ts=(s+getans(b,b)*((1ll*cnt[b]*(cnt[b]-1)/2)%p))%p;\n\ts=(s+getans(a,b)*cnt[a]%p*cnt[b]%p)%p;\n\ts=(s+(1ll*a*(a-1)/2*cnt[a]%p+1ll*b*(b-1)/2*cnt[b]%p)%p*((p+1)/2))%p;\n\tcout<\n#include \n\nusing namespace std;\n\ninline int read(){\n\tint x=0; char ch=getchar();\n\twhile (ch<'0'||ch>'9') ch=getchar();\n\twhile (ch>='0'&&ch<='9')\n\t\tx=x*10+ch-'0',ch=getchar();\n\treturn x;\n}\n\ntemplate \ninline void chkmin(_type &x, _type y){\n\tif (x>y) x=y;\n}\n\n#define N 100005\n\nint f[2][N],cur=0,pre=1,q[N];\n\nint main(){\n\tint n=read(),k=read();\n\tf[0][0]=0;\n\tfor (int i=1;i<=n;i++)\n\t\tf[0][i]=n;\n\tfor (int j=1;j<=k;j++){\n\t\tint lt=read(),rt=read();\n\t\tcur^=1,pre^=1;\n\t\tfor (int i=0;i<=n;i++)\n\t\t\tf[cur][i]=f[pre][i];\n\t\tfor (int i=rt,l=1,r=0;i>=0;i--){\n\t\t\tif (l<=r&&q[l]\n#include \n#include\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n#define SZ(x) ((int)(x).size())\n#define rep(i,a,n) for (int i=a; i<(int)n; i++)\n#define per(i,n,a) for (int i=n; i>=a; i--)\n#define hk push_back\n#define pk pop_back\n#define mp make_pair\n#define PI 3.141592653589793\n#define clr(a) memset(a, 0, sizeof(a))\n#define clr1(a) memset(a, -1, sizeof(a))\ntypedef vector VI;\ntypedef vector< pair > VIP;\ntypedef vector< pair > > VIPP;\ntypedef vector VS;\ntypedef vector VD;\ntypedef vector VB;\ntypedef long long ll;\n#define MAX_V 1000\nconst ll mod = 1000000007;\nll powmod(ll a, ll b) {\n ll res = 1; a %= mod; for (; b; b >>= 1){ if (b & 1)res = res*a%mod; a = a*a%mod; }return res;\n}\n\ntypedef unsigned long long ull;\null n, k, l, m;\n\nint main()\n{\n cin >> n >> k >> l >> m;\n\n vector s; \n ull initS = (4 % m);\n s.push_back(initS);\n ull pow = initS;\n for (ull i = 3; i <= n; i++) {\n pow *= 2;\n pow %= m;\n if (pow == initS) {\n break;\n }\n s.push_back(pow);\n }\n\n ll s0, s1;\n if (n == 2) { s0 = 1; s1 = 3; }\n else if (n == 3) { s0 = 3; s1 = 5; }\n else {\n ull sz = s.size();\n ull prepre = 1, pre = 3;\n for (ull i = 4; i <= n; i++) {\n ull curr = prepre + pre + s[(i - 4) % sz];\n curr %= m;\n prepre = pre; pre = curr;\n if (prepre == 1 && pre == 3) {\n i += (ull)((n - i) / (i - 4)) * (i - 4);\n }\n }\n s0 = pre;\n s1 = (s[(n - 2) % sz] - s0 + m) % m;\n// s1 = (1ULL << n) - s0;\n }\n\n\n ull ret = 1;\n for (ull i = 0; i < l; i++) {\n \n if (k & (1ULL << i)) {\n ret *= s0;\n }\n else ret *= s1;\n ret %= m;\n }\n if (l < 64 && k >(1ULL << l) - 1) ret *= 0;\n\n cout << ret << endl;\n}", "lang": "MS C++", "bug_code_uid": "ac1630d1d42a1d4543cce9934627237c", "src_uid": "2163eec2ea1eed5da8231d1882cb0f8e", "apr_id": "e84262fc747419b9a759df3dc35c3324", "difficulty": 2100, "tags": ["combinatorics", "matrices", "number theory", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7850187265917603, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "#include \n#include \n#include \n#include \nusing namespace std;\n\nint d[10];\nlong long c(int x, int y){\n\tif (y == 0)\n\t\treturn 1;\n\tif (x == 1)\n\t\treturn y;\n\tif (x == y)\n\t\treturn 1;\n\tlong long ab = c(x - 1, y - 1) + c(x, y-1);\n\treturn ab;\n}\n\nint main(){\n\tint n, k;\n\tcin >> n >> k;\n\tlong long ans = 1;\n\td[1] = 0;\n\td[2] = 1;\n\td[3] = 2;\n\td[4] = 9;\n\tfor (int i = 1; i <= k; i++){\n \t\tans += c(n-i, n)*d[i];\n\t\t//cout << \"*\" << c(n - i, n)<< endl; \n\t}\n\tcout << ans << endl;\n\t//system(\"pause\");\n\treturn 0;\n}", "lang": "MS C++", "bug_code_uid": "e96665cb7fde2cfae63d3accd4424578", "src_uid": "96d839dc2d038f8ae95fc47c217b2e2f", "apr_id": "ea6f1af0607ab93b55edffe06599732b", "difficulty": 1600, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.930944963655244, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include \n\nusing namespace std;\n\ntypedef pair pii;\nmap , bool > t;\nchar c[3][3];\nvector v1,v2;\n#define pb push_back\n\nint main()\n{\n int q=2;\n for (int i=1;i<=2;i++)\n for (int j=1;j<=2;j++){\n cin >> c[i][j];\n if ( c[i][j] != 'X' )\n v1.pb( c[i][j] );\n }\n t[v1]=true;\n for (int i=1;i<=2;i++)\n for (int j=1;j<=2;j++){\n cin >> c[i][j];\n }\n if ( c[1][1] != 'X' )\n v2.pb(c[1][1]);\n if ( c[1][2] != 'X' )\n v2.pb(c[1][2]);\n if ( c[2][2] != 'X' )\n v2.pb(c[2][2]);\n if ( c[2][1] != 'X' )\n v2.pb(c[2][1]);\n if ( t[v2] ){\n cout << \"YES\";\n return 0;\n }\n v2.clear();\n if ( c[1][2] != 'X' )\n v2.pb(c[1][2]);\n if ( c[2][2] != 'X' )\n v2.pb(c[2][2]);\n if ( c[2][1] != 'X' )\n v2.pb(c[2][1]);\n if ( c[1][1] != 'X' )\n v2.pb(c[1][1]);\n if ( t[v2] ){\n cout << \"YES\" ;\n return 0;\n }\n v2.clear();\n if ( c[2][2] != 'X' )\n v2.pb(c[2][2]);\n if ( c[2][1] != 'X' )\n v2.pb(c[2][1]);\n if ( c[1][1] != 'X' )\n v2.pb(c[1][1]);\n if ( c[1][2] != 'X' )\n v2.pb(c[1][2]);\n if ( t[v2] ){\n cout << \"YES\" ;\n return 0;\n }\n v2.clear();\n if ( c[2][1] != 'X' )\n v2.pb(c[2][1]);\n if ( c[1][1] != 'X' )\n v2.pb(c[1][1]);\n if ( c[1][2] != 'X' )\n v2.pb(c[1][2]);\n if ( c[2][2] != 'X' )\n v2.pb(c[2][2]);\n if ( t[v2] ){\n cout << \"YES\";\n return 0;\n }\n cout << \"NO\";\n}\n", "lang": "GNU C++", "bug_code_uid": "a0237565b6a7e9d3c0ff8ea69fee4b76", "src_uid": "46f051f58d626587a5ec449c27407771", "apr_id": "181faa0e18282e0a4ce10800b1b5bb6b", "difficulty": 1200, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.28444444444444444, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "#include \n#include \n//#include \nusing namespace std;\nlong long int a, b, c;\nvector in1;\nvector in2;\n/*void print(char k)\n{\n\tcout << k << ' ';\n}*/\nint main()\n{\n\tcin >> a >> b >> c;\n\tfor (int k = 0; k < a + c; k++)\n\t\tin1.push_back('a');\n\tfor (int k = 0; k < b + c; k++)\n\t\tin2.push_back('b');\n\tif (in1.size() == in2.size())\n\t\tcout << in1.size() + in2.size();\n\telse\n\t{\n\t\tif (in1.size() > in2.size())\n\t\t\tcout << in2.size() * 2 + 1;\n\t\telse\n\t\t{\n\t\t\tcout << in1.size() * 2 + 1;\n\t\t}\n\t}\n\t/*cout << endl;\n\tfor_each(in1.begin(), in1.end(), print);\n\tcout << endl;\n\tfor_each(in2.begin(), in2.end(), print);\n\tcout << endl;*/\n\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "b8239b5088dec7e8fb2916bbbe53b9b2", "src_uid": "609f131325c13213aedcf8d55fc3ed77", "apr_id": "a47324d305409ed3fa7b268ec2ec3f9e", "difficulty": 800, "tags": ["greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.8926360725720385, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "#include\n#include\nconst double eps=1e-8;\ndouble Xv,Yv,Xp,Yp,Xw1,Yw1,Xw2,Yw2,Xm1,Ym1,Xm2,Ym2,Xc,Yc,Xg,Yg;\ndouble Am,Bm,Cm,Av,Bv,Cv;\nint Xot(double X1,double Y1,double X2,double Y2)\n{\n double V=X1*Y2-X2*Y1;\n if(fabs(V)0) return 1;\n}\nint Cross(double X1,double Y1,double X2,double Y2,double X3,double Y3,double X4,double Y4)\n{\n\tint v=Xot(X2-X1,Y2-Y1,X4-X3,Y4-Y3);\n\tif(v==0) return 1;\n int V1=Xot(X3-X1,Y3-Y1,X2-X1,Y2-Y1)*Xot(X4-X1,Y4-Y1,X2-X1,Y2-Y1);\n int V2=Xot(X1-X3,Y1-Y3,X4-X3,Y4-Y3)*Xot(X2-X3,Y2-Y3,X4-X3,Y4-Y3);\n if(V1>0||V2>0) return 1;\n if(V1<0&&V2<0) return -1;\n return 0;\n}\nvoid Node()\n{\n double p;\n if(fabs(Am)eps)\n {\n \tYc=(Cv-Cm)/(Bv-Bm);\n \tXc=(Cv-Bv*Yc)/Av;\n\t}\n\telse\n\t{\n\t\tXc=(Cv-Cm)/(Av-Am);\n \tYc=(Cv-Av*Xc)/Bv;\n\t}\n}\nvoid Get()\n{\n double p;\n Av=Yg-Yp,Bv=Xp-Xg,Cv=Xg*Av+Yg*Bv;\n if(fabs(Am)eps)\n {\n \tYc=(Cv-Cm)/(Bv-Bm);\n \tXc=(Cv-Bv*Yc)/Av;\n\t}\n\telse\n\t{\n\t\tXc=(Cv-Cm)/(Av-Am);\n \tYc=(Cv-Av*Xc)/Bv;\n\t}\n}\nint main()\n{\n scanf(\"%lf%lf\",&Xv,&Yv);\n scanf(\"%lf%lf\",&Xp,&Yp);\n scanf(\"%lf%lf%lf%lf\",&Xw1,&Yw1,&Xw2,&Yw2);\n scanf(\"%lf%lf%lf%lf\",&Xm1,&Ym1,&Xm2,&Ym2);\n Am=Ym1-Ym2,Bm=Xm2-Xm1,Cm=Xm1*Am+Ym1*Bm;\n if(Cross(Xv,Yv,Xp,Yp,Xw1,Yw1,Xw2,Yw2)>0&&Cross(Xv,Yv,Xp,Yp,Xm1,Ym1,Xm2,Ym2)>0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n Node(),Xg=2*Xc-Xv,Yg=2*Yc-Yv;\n if(Cross(Xg,Yg,Xp,Yp,Xm1,Ym1,Xm2,Ym2)<=0)\n {\n\t\tGet();\n\t\tif(Cross(Xv,Yv,Xc,Yc,Xw1,Yw1,Xw2,Yw2)>0&&Cross(Xc,Yc,Xp,Yp,Xw1,Yw1,Xw2,Yw2)>0)\n\t\t{\n \tprintf(\"YES\\n\");\n \treturn 0;\n \t}\n\t}\n printf(\"NO\\n\");\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "45c7c77bbe09bb2ee9c7ad48a41d69d7", "src_uid": "7539a41268b68238d644795bccaa0c0f", "apr_id": "1e68a4b5ff8ee0f146cf36145b356f8e", "difficulty": 2400, "tags": ["geometry", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8710659898477158, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "#include \nusing namespace std;\n\n\n\nint main() {\n\nint n,tmp;\nvector nums;\ncin>>n;\nint counter = 0;\nstring A =\"chest\";\nstring B = \"biceps\";\nstring C =\"back\";\nint a =0, b = 0, c=0;\nint MAx = -1;\nfor(int i =0; i < n; i++)\n{\ncin>>tmp;\ncounter++;\n\n\tif(counter == 1 )\n\t{a +=tmp;}\n\telse if (counter == 2)\n\t{b +=tmp;}\n\telse if(counter == 3)\n\t{c +=tmp;}\n\nif(counter>3)\n\tcounter = 0;\n\n}\nif(a>=b && a>=c)\n\tcout<=a && b>=c)\n\tcout<\n#include\nusing namespace std;\nint main()\n{\n\tint a[3],d,cnt=0;\n\tcin>>a[0]>>a[1]>>a[2]>>d;\n\tsort(a,a+3);\n\tint l = a[1]-a[0];\n\tint r = a[2]-a[1];\n\twhile(l\n#include\n#include\n#include\nusing namespace std;\nconst int INF = 1000000010;\nlong long n, m, c, i, a[100000001], res = 0, mx = -INF;\nint main()\n{\n cin>>n>>m;\n for(i = 1; i <= n; i++){\n for(c = 1; c <= n; c++){\n if(abs(c - i) < abs(c - m))\n a[i]++;\n }\n }\n for(i = 1; i <= n; i++)\n if(a[i] > mx){\n mx = a[i];\n res = i;\n }\n cout<\n#include \nusing namespace std;\n\nint main() {\n int a, b, m;\n int r0, r1;\n cin >> a >> b >> m >> r0;\n vector< vector > arr;\n arr.resize(m);\n for (int i = 0; i < m; ++i) {\n arr[i] = vector(m,0);\n }\n long long i = 1;\n while (true) {\n r1 = (a * r0 + b) % m;\n if (!arr[r0][r1]) {\n arr[r0][r1] = i;\n ++i;\n r0 = r1;\n }\n else {\n cout << i - arr[r0][r1];\n return 0;\n }\n }\n}\n", "lang": "GNU C++", "bug_code_uid": "81cabf3f208ae713454511b931fd5866", "src_uid": "9137197ee1b781cd5cc77c46f50b9012", "apr_id": "ef47f6294054c4db940988f62a989117", "difficulty": 1200, "tags": ["number theory", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.4613306315433975, "equal_cnt": 17, "replace_cnt": 6, "delete_cnt": 5, "insert_cnt": 6, "fix_ops_cnt": 17, "bug_source_code": "#include \n#include \n#include \nusing namespace std;\nvector mrSequence;\n\nint main(int argc, char** argv) {\n int mrA; int mrB; int mrsM; int mrR0;\n int mrResult;\n int mrSequenceIterator;\n cin >> mrA; cin >> mrB; cin >> mrsM; cin >> mrR0;\n mrSequence.push_back(mrR0);\n for (mrSequenceIterator = 1; 1 == 1; mrSequenceIterator++) {\n mrSequence.push_back((mrA * mrSequence[mrSequenceIterator-1] + mrB) % mrsM); \n if (mrSequenceIterator > 10) {\n if (mrSequence[mrSequenceIterator] == mrSequence[mrSequenceIterator-1]) {\n cout << '1';\n break;\n };\n if (mrSequence[mrSequenceIterator] == mrSequence[mrSequenceIterator-2]) {\n cout << '2';\n break;\n };\n if (mrSequence[mrSequenceIterator] == mrSequence[mrSequenceIterator-3]) {\n cout << '3';\n break;\n };\n if (mrSequence[mrSequenceIterator] == mrSequence[mrSequenceIterator-4]) {\n cout << '4';\n break;\n };\n if (mrSequence[mrSequenceIterator] == mrSequence[mrSequenceIterator-5]) {\n cout << '5';\n break;\n };\n if (mrSequence[mrSequenceIterator] == mrSequence[mrSequenceIterator-6]) {\n cout << '6';\n break;\n };\n if (mrSequence[mrSequenceIterator] == mrSequence[mrSequenceIterator-7]) {\n cout << '7';\n break;\n };\n if (mrSequence[mrSequenceIterator] == mrSequence[mrSequenceIterator-8]) {\n cout << '8';\n break;\n };\n if (mrSequence[mrSequenceIterator] == mrSequence[mrSequenceIterator-9]) {\n cout << '9';\n break;\n };\n if (mrSequence[mrSequenceIterator] == mrSequence[mrSequenceIterator-10]) {\n cout << '10';\n break;\n };\n };\n };\n return 0;\n};", "lang": "GNU C++", "bug_code_uid": "1ca7ebe8163222716793a18553242efa", "src_uid": "9137197ee1b781cd5cc77c46f50b9012", "apr_id": "a1435d3ed6a73e159bb1a97bb484caae", "difficulty": 1200, "tags": ["number theory", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9815303430079155, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n long long int n;\n cin>>n;\n if(n%2!=0)\n {\n long long int z=n/2;\n cout<\n\nusing namespace std;\n\n#define N 200005\n\nint n, l[N], r[N], cnt = 0;\n\nmap used;\n\nstruct seg\n{\n\tint l, r, coll, colr, cnt, tag;\n}tr[N << 8];\n\nstruct SEG\n{\n\tvoid build(int rt, int l, int r)\n\t{\n\t\ttr[rt].l = l, tr[rt].r = r;\n\t\tif(l == r)\n\t\t{\n\t\t\treturn;\n\t\t}\n\t\tint mid = l + r >> 1;\n\t\tbuild(rt << 1, l, mid);\n\t\tbuild(rt << 1 | 1, mid + 1, r);\n\t}\n\n\tvoid Pushdown(int rt)\n\t{\n\t\tif(tr[rt].tag)\n\t\t{\n\t\t\ttr[rt << 1].tag = tr[rt << 1 | 1].tag = 1;\n\t\t\ttr[rt << 1].cnt = tr[rt << 1 | 1].cnt = 1;\n\t\t\ttr[rt << 1].coll = tr[rt << 1].colr = 1;\n\t\t\ttr[rt << 1 | 1].coll = tr[rt << 1 | 1].colr = 1;\n\t\t}\n\t}\n\n\tvoid Pushup(int rt)\n\t{\n\t\ttr[rt].cnt = tr[rt << 1].cnt + tr[rt << 1 | 1].cnt;\n\t\ttr[rt].coll = tr[rt << 1].coll, tr[rt].colr = tr[rt << 1 | 1].colr;\n\t\tif(tr[rt << 1].colr == 1 && tr[rt << 1 | 1].coll == 1) tr[rt].cnt--;\n\t}\n\n\tvoid update(int rt, int x, int y)\n\t{\n\t\tPushdown(rt);\n\t\tint l = tr[rt].l, r = tr[rt].r, mid = l + r >> 1;\n\t\t// cout << l << ' ' << r << ' ' << x << ' ' << y << endl;\n\t\tif(l == x && r == y)\n\t\t{\n\t\t\ttr[rt].cnt = 1, tr[rt].tag = 1, tr[rt].coll = 1, tr[rt].colr = 1;\n\t\t\treturn;\n\t\t}\n\t\tif(y <= mid) update(rt << 1, x, y);\n\t\telse if(x > mid) update(rt << 1 | 1, x, y);\n\t\telse update(rt << 1, x, mid), update(rt << 1 | 1, mid + 1, y);\n\t\tPushup(rt);\n\t}\n}tree;\n\nint main()\n{\n\t// freopen(\"color.in\",\"r\",stdin);\n\t// freopen(\"color.out\",\"w\",stdout);\n\tscanf(\"%d\", &n);\n\tint maxn = 0;\n\tfor(int i = 1; i <= n; i++)\n\t{\n\t\tscanf(\"%d%d\", &l[i], &r[i]);\n\t\tr[i]--;\n\t\tmaxn = max(maxn, r[i] + 1);\n\t\tif(used[l[i]] == 0)\n\t\t{\n\t\t\tused[l[i]] = ++cnt;\n\t\t}\n\t\tif(used[r[i]] == 0)\n\t\t{\n\t\t\tused[r[i]] = ++cnt;\n\t\t}\n\t\tif(used[r[i] + 1] == 0)\n\t\t{\n\t\t\tused[r[i] + 1] = ++cnt;\n\t\t}\n\t}\n\n\ttree.build(1, 1, maxn);\n\tfor(int i = 1; i <= n; i++)\n\t{\n\t\ttree.update(1, l[i], r[i]);\n\t\tcout << tr[1].cnt << endl;\n\t}\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "2d9a48b939be09bbf32e16bba3a60803", "src_uid": "3979abbe7bad0f3b5cab15c1cba19f6b", "apr_id": "150399edd0f88ea330826283cd76f3a8", "difficulty": 2100, "tags": ["data structures"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5755679947316431, "equal_cnt": 17, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 16, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nmap used;\n\nint main(){\n// freopen(\"input.txt\",\"r\",stdin);\n//\tfreopen(\"output.txt\",\"w\",stdout);\n\t\n\tint k;\n\tstring s;\n\n\tcin>>k>>s;\n\n\tvector qp;\n\t\n\tint ost=k;\n\n\tfor(int i=0;i0){\n\n\t\tint nf=qp.back();\n\t\t\n\t\tif(s[nf]!='?')continue;\n\n\t\tchar found;\n\t\t\t\n\t\tfor(int i=k-1;i>=0;i--)\n\t\t\tif(!used['a'+i]){found='a'+i;break;}\n \t\t\t\n \ts[nf]=found;\n \ts[s.length()-1-nf]=found;\n\t\t\t\n\t\tused[found]=true;\n\n\t\tqp.pop_back();\n\n\t\tost--;\n\t\t\t\n\t}\n\n\twhile(!qp.empty()){\n\n\t\tif(s[qp.back()]!='?'){qp.pop_back();continue;}\n\n\t\ts[qp.back()]='a';\n\n\t\ts[s.length()-qp.back()-1]='a';\n\n\t\tqp.pop_back();\n\n\t}\n\n\tcout<\n#include \nusing namespace std;\n\nint main()\n{\n int q;\n cin>>q;\n int x[q];\n long long int y[q];\n char z[q];\n string a=\"What are you doing at the end of the world? Are you busy? Will you save us?\";\n string b=\"What are you doing while sending \\\"\";\n string c=\"\\\"? Are you busy? Will you send \\\"\";\n string d=\"\\\"?\";\nint maxx=0;\n for(int i=0;i>x[i]>>y[i];\n if(x[i]>maxx)\n maxx=x[i];\n\n }\n for(int i=0;i<=maxx;i++)\n {\n for(int j=0;j=y[j])\n z[j]=a[y[j]-1];\n else\n z[j]='.';\n }\n }\n string e=a;\n a=b+e+c+e+d;\n }\n for(int i=0;i\n\nusing namespace std;\nvectorarr;\nint main()\n{\n int n , k ;\n scanf(\"%d %d\",&n,&k);\n arr.resize(n);\n int tot= 0 ;\n for( int i = 0 ; i < n ; i ++ ) {\n cin >> arr[ i ] ;\n tot+= arr[ i ] ;\n }\n int cnt= 0 , day = 0 ;\n while ( k ){\n day ++ ;\n if(tot>=8){\n tot -= 8 ;\n k-=8;\n }\n if ( k <= 0 ) break ;\n if ( k < 8 && (tot-k) >= 0 ){\n day ++ ;\n break;\n }else if ( k < 8 && (tot-k) <0 ) {\n cout << \"-1\" << endl;\n return 0 ;\n }\n }\n if ( day <= n )\n cout << day << endl ;\n else cout << \"-1\" << endl;\n\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "3098e38be20bd84d78ed93cc38ba6c4e", "src_uid": "24695b6a2aa573e90f0fe661b0c0bd3a", "apr_id": "2e9430184030a7c4b6e4ff655a57dc26", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5430855789161978, "equal_cnt": 32, "replace_cnt": 22, "delete_cnt": 3, "insert_cnt": 6, "fix_ops_cnt": 31, "bug_source_code": "#include \nusing namespace std;\ntypedef long long int ll;\ntypedef long double ld;\ntypedef vector vl;\n#define mod 1000000007\n#define mp make_pair\n#define pb push_back\n#define sd second\n#define mod 1000000007\n#define ft first\n#define all(x) x.begin(),x.end()\n#define alr(x) x.rbegin(),x.rend()\n#define endl '\\n'\n#define cnl cout< split(const string &s, char delim) \n{ \n vector elems; \n stringstream ss(s); \n string item; \n while (getline(ss, item, delim)) \n elems.push_back(item); \n \n return elems; \n} \nvoid solve(){\n ll n, l, r, x; cin >> n >> l >> r >> x;\n vl v(n);\n for(i =0; i < n; i++) cin >>v[i];\n ll p = pow(2,n);\n \n\n vector list; \n for (int i = 0; i < (int) pow(2, n); i++) \n { \n string subset = \"\"; \n for (int j = 0; j < n; j++) \n { \n if ((i & (1 << j)) != 0) \n subset += to_string(v[j]) + \"|\"; \n }\n if (find(list.begin(), list.end(), subset) == list.end()) \n list.push_back(subset); \n } \n ll cnt =0;\n ll ans = 0;\n for (string subset : list) \n { \n cnt = 0;\n ll sum = 0;\n vector arr = split(subset, '|'); \n for (string str: arr) {\n ll no =0;\n ll mn = 1e7;\n ll mx = 0;\n for( i =0;i < str.size();i++){\n no = 10*no + (str[i]-'0');\n mn = min(mn, (str[i]-'0') );\n mx = max(mx, (str[i]-'0'));\n }\n sum = sum +no;\n cnt++;\n }\n if(cnt>=2 and sum>=l and sum <= r and (mx - mn)<=x) ans ++;\n } \n cout<< ans << endl;\n\n\n return ; \n} \n signed main(){\n #ifndef ONLINE_JUDGE\n freopen( \"input.txt\", \"r\", stdin );\n freopen( \"output.txt\", \"w\", stdout );\n #endif\n //CASET\n solve();\n \n \n return 0;\n }", "lang": "GNU C++17", "bug_code_uid": "4ea5a6a6cd8bf7191f0de299c9385c58", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "apr_id": "ded121fa4069a5910f497c705b98ab46", "difficulty": 1400, "tags": ["brute force", "bitmasks"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.166179811749432, "equal_cnt": 25, "replace_cnt": 18, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 25, "bug_source_code": "#include \n\n#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);\n#define forn(i,o,n) for(int i=o;i>ttt;while(ttt--)\n\nusing namespace std;\n\nint gcd(int a, int b){\n if (b == 0)\n return a;\n return gcd(b, a % b); \n}\nbool isPrime(int n){\n if(n < 2)\n return 0;\n if(n < 4)\n return 1;\n if(n % 2 == 0 or n % 3 == 0)\n return 0;\n for(int i = 5; i*i <= n; i += 6)\n if(n % i == 0 or n % (i+2) == 0)\n return 0;\n return 1;\n}\nint modexpo(int x,int p){\n int res = 1;\n x = x%mod;\n while(p){\n if(p%2)\n res = res * x;\n p >>= 1;\n x = x*x % mod;\n res %= mod;\n }\n return res;\n}\n\nint max(int a,int b){\n if(a>b){\n return a;\n }\n return b;\n}\n\nint min(int a,int b){\n if(a>n>>k>>m>>d;\n if(m==1){\n cout<<1<v;\n for(int i=2;i<=sqrt(n);i++){\n if(i>m){\n break;\n }\n \n if(n%i==0){\n v.pb(i);\n int temp = n/i;\n if(temp == i){\n ;\n }\n else if(temp<=m){\n v.pb(temp);\n }\n }\n }\n int ans = m;\n for(int i=0;id){\n continue;\n }\n int c = b*v[i];\n if(c>ans){\n ans = c;\n }\n //cout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#define F first\n#define S second\n\n#define pf push_front\n#define pb push_back\n#define mp make_pair\n#define pp pop_back\n\n#define all(a) a.begin(), a.end()\n#define sz(a) a.size()\n#define STOP return 0\n\nusing namespace std;\n\ntypedef pair PLL;\ntypedef unsigned long long ULL;\ntypedef pair PII;\ntypedef long double LD;\ntypedef long long LL;\n\nconst int inf = 1e9 + 123;\nconst LL INF = 1e18 + 123;\nconst double eps = 1e-9;\nconst int mod = 1e9 + 7;\n\n\nvoid boost() {\n\tios_base :: sync_with_stdio(0);\n\tcin.tie(0), cout.tie(0);\n}\n\t\t\nint main () {\n\t//\tfreopen(\".in\", \"r\", stdin); \n\t//\tfreopen(\".out\", \"w\", stdout);\n\t\n\tLL a, b;\n\tcin >> a >> b;\n\t\n\tif(a < 5 && b < 5) {\n\t\tif(a == 0) a = 1;\n\t\tif(a == 1) a = 1;\n\t\tif(a == 2) a = 2;\n\t\tif(a == 3) a = 6;\n\t\tif(a == 4) a = 24;\n\t\n\t\tif(b == 0) b = 1;\n\t\tif(b == 1) b = 1;\n\t\tif(b == 2) b = 2;\n\t\tif(b == 3) b = 6;\n\t\tif(b == 4) b = 24;\n\t\tcout << b / a % 10;\n\t\tSTOP;\n\t}\n\t\n\tif(b == 0) {\n\t\tcout << 0;\n\t\tSTOP;\n\t}\n\t\n\tif(a == b) {\n\t\tcout << 1;\n\t\tSTOP;\n\t}\n\telse{\n\t\tLL cnt = a;\n\t\tLL cnb = b;\n\t\t\tLL gg = cnb / cnt + 1;\n\t\t\tif(gg == 0) gg = 1;\n\t\t\tif(gg == 1) gg = 1;\n\t\t\tif(gg == 2) gg = 2;\n\t\t\tif(gg == 3) gg = 6;\n\t\t\tif(gg == 4) gg = 4;\n\t\t\tif(gg >= 5) gg = 0;\n\t\t\tcout << gg; \t\n\t}\n}\n", "lang": "GNU C++14", "bug_code_uid": "19540304899d0af126aa50f6cbf4f91f", "src_uid": "2ed5a7a6176ed9b0bda1de21aad13d60", "apr_id": "b5aae51e04c1f5f6794bac87cb646774", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.24473257698541329, "equal_cnt": 7, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "#include\nusing namespace std;\nstruct _ { ios_base::Init i; _(){ cin.sync_with_stdio(0); cin.tie(0);} } _;\nint main()\n{\n int tc;\n long long n,k,d1,d2;\n cin>>tc;\n while(tc--)\n {\n cin>>n>>k>>d1>>d2;\n long long x[4]={2*d1+d2,((d1>d2)?2*d1-d2:2*d2-d1),d1+d2,2*d2+d1};\n if(d2==0)\n {\n x[2]=x[3]=(int)1e18;\n }\n if(d1==0)\n {\n x[0]=x[2]=(int)1e18;\n }\n\n\n bool done=0;\n\n for(int i=0;i<4;++i)\n {\n //cout<=x[i]&&(n-k-x[i])%3==0)\n {\n done=1;\n break;\n }\n }\n if(done)cout<<\"yes\\n\";\n else cout<<\"no\\n\";\n }\n return 0;\n}\n", "lang": "GNU C++0x", "bug_code_uid": "be079f965ab0dd7941fd169496b09c18", "src_uid": "8c92aac1bef5822848a136a1328346c6", "apr_id": "24abef31fc4ba2aa2eca2d9567f8f1e3", "difficulty": 1300, "tags": ["geometry", "math", "constructive algorithms", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.6510903426791277, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "#include \n\nusing namespace std;\n#define ll long long\n#define all(v) \t((v).begin()),((v).end())\n#define sz(x) \t\t((int) (x).size())\n#define clr(a,b)\tmemset(a,b,sizeof(a))\nconst double EPS = 1e-8;\nconst double pi = acos(-1);\n\nint dcmp(double a, double b) {\n\treturn fabs(a - b) <= EPS ? 0 : a < b ? -1 : 1;\n}\nvoid debug() {\n\tfreopen(\"input.in\", \"r\", stdin);\n\tfreopen(\"output.in\", \"w\", stdout);\n}\n\nint arr[101];\nvector> vec;\n\nint main() {\n\tcout << fixed << setprecision(0);\n\tios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);\n\tint n;\n\tcin >> n;\n\tfor (int i = 0; i < n; ++i) {\n\t\tcin >> arr[i];\n\t}\n\tint prev = 0, cnt = 0;\n\tfor (int i = n-1; i > 0; --i) {\n\t\tif(arr[i] - arr[i-1] == prev) {\n\t\t\tcnt++;\n\t\t} else\n\t\t\tcnt = 0, prev = arr[i] - arr[i-1];\n\t\tvec.push_back({cnt, prev});\n\t}\n\tsort(vec.begin(), vec.end());\n\tpair pr = vec[vec.size()-1];\n\tif(pr.first != 0 && arr[0] == 1 && arr[1] - arr[0] == pr.second)\n\t\t++pr.first;\n\tif(pr.first != 0 && arr[n-1] == 1000 && arr[n-1] - arr[n-2] == pr.second)\n\t\t++pr.first;\n\n\tcout << pr.first;\n}\n", "lang": "GNU C++17", "bug_code_uid": "e03c301c51a738db6e54cafda95cfe98", "src_uid": "858b5e75e21c4cba6d08f3f66be0c198", "apr_id": "9b0f90935d690b2c1c471487e7f5177a", "difficulty": 1300, "tags": ["greedy", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5421052631578948, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include\nint main()\n{\n\tint a=0;\n\tchar c;\n\twhile(c=getchar())\n\t\tif(c=='0')\n\t\t\t++a;\n\tif(c>=6)\n\t\tprintf(\"yes\");\n\telse\n\t\tprintf(\"no\");\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "6254ad47dffd852683632f8a93fdae0a", "src_uid": "88364b8d71f2ce2b90bdfaa729eb92ca", "apr_id": "6de2aa23c70e1c4189e61d47b01e701e", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.975696502667457, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "#include \n#include \n#include \n\nusing namespace std;\n\nqueue> q;\n\nint main()\n{\n int n;\n int degree[15];\n int ans = 0;\n \n scanf(\"%d\", &n);\n \n for(int i = 0 ; i < n; i++)\n {\n scanf(\"%d\", °ree[i]);\n }\n \n while(!q.empty()) q.pop();\n \n q.push(make_pair(0, degree[0]));\n \n while(!q.empty())\n {\n int index = q.front().first;\n int num = q.front().second;\n \n if(index == n && num%360 == 0)\n {\n ans = 1;\n break;\n }\n \n index++;\n if(index <= n)\n {\n q.push(make_pair(index, num + degree[index]));\n q.push(make_pair(index, num - degree[index]));\n }\n }\n \n if(ans) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n}\n", "lang": "MS C++", "bug_code_uid": "416e725734bdb8c45068fc5fffd4a1ac", "src_uid": "01b50fcba4185ceb1eb8e4ba04a0cc10", "apr_id": "2c450b42a84ec62931d44ce77ca7c22e", "difficulty": 1200, "tags": ["dp", "brute force", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9096385542168675, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\ntypedef long long ll;\ntypedef pair P;\ntypedef double db;\nint main(){\n\tstring a, b, c, d;\n\tcin>>a>>b>>c>>d;\n\tif(b[1]=='X') swap(b[0], b[1]);\n\telse if(a[0]=='X') swap(b[0], a[0]);\n\telse if(a[1]=='X') swap(a[0], a[1]), swap(b[0], a[0]);\n\tif(d[1]=='X') swap(d[0], d[1]);\n\telse if(c[0]=='X') swap(d[0], c[0]);\n\telse if(c[1]=='X') swap(c[0], c[1]), swap(d[0], c[0]);\n\tif(a[1]=='A') swap(a[0], a[1]);\n\telse if(b[1]=='A'){\n\t\tb[1]=a[1];\n\t\ta[1]=a[0];\n\t\ta[0]='A';\n\t}\n\tif(c[1]=='A') swap(c[0], c[1]);\n\telse if(d[1]=='A'){\n\t\td[1]=c[1];\n\t\tc[1]=c[0];\n\t\tc[0]='A';\n\t}\n\tif(a==c&&b==d) puts(\"YES\");\n\telse puts(\"NO\");\n}", "lang": "MS C++", "bug_code_uid": "03c2ff5541acd063ac1b07326b84c9a4", "src_uid": "46f051f58d626587a5ec449c27407771", "apr_id": "1a2475e64adb5eb35eee0a4f367adecb", "difficulty": 1200, "tags": ["brute force", "constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.44884115319389484, "equal_cnt": 25, "replace_cnt": 23, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 24, "bug_source_code": "#include \n#include \n#include \n#include \n#define y 2147483647\n#define v 9223372036854775807\nusing namespace std;\nint main()\n{\n\tchar c[105],*p;\n\t__int64 a;\n\tint l,i;\n\twhile(scanf(\"%s\",c))\n\t{\n\t\tl=strlen(c);\n\t\tif(l<20)\n\t\t{\n\t\t\ta=0;\n\t\t\tfor(i=0;i=0&&a<=127) printf(\"byte\\n\");\n\t\t\telse if(a>=0&&a<=32767) printf(\"short\\n\");\n\t\t\telse if(a>=0&&a<=y) printf(\"int\\n\");\n\t\t\telse if(a>=0&&a<=v) printf(\"long\\n\");\n\t\t\telse printf(\"BigInteger\\n\");\n\t\t}\n\t\telse printf(\"BigInteger\\n\");\n\t}\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "fdab1caa6667dfaf34d8650eb5da310a", "src_uid": "33041f1832fa7f641e37c4c638ab08a1", "apr_id": "88fb01abc03d9e6449f6cbe32c9f64e9", "difficulty": 1300, "tags": ["strings", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.07460366801367734, "equal_cnt": 28, "replace_cnt": 18, "delete_cnt": 3, "insert_cnt": 6, "fix_ops_cnt": 27, "bug_source_code": "#include\n#include\nint main(){\n char a[110]=\"127\";\n char b[110]=\"-128\";\n char c[110]=\"32767\";\n char d[110]=\"-32768\";\n char e[110]=\"2147483647\";\n char f[110]=\"-2147483648\";\n char h[110]=\"9223372036854775807\";\n char i[110]=\"-9223372036854775808\";\n char s[110];\n while(1){\n gets(s);\n // printf(\"%s \",s);\n if(s[0]=='-'){\n if(strlen(s)\n#include\n#define mod 1000000007\nusing namespace std;\n#define MAXN 50\ntypedef long long ll;\nll ans[10],x,y,N;\nll getMod(ll a){\n\tif(a<0){\n\t\twhile(a<0) a+=mod;\t\n\t\treturn a%=mod;\n\t}\n\telse{\n\t\tif(a>=mod) return a%=mod;\n\t\telse return a; \n\t}\n}\nint main()\n{\n\twhile(scanf(\"%lld %lld\",&x,&y)!=EOF){\n\t\tscanf(\"%lld\",&N);\n\t\tans[1]=getMod(x);\n\t\tans[2]=getMod(y);\n\t\tans[3]=getMod(y-x);\n\t\tans[4]=getMod(-x);\n\t\tans[5]=getMod(y);\n\t\tans[6]=getMod(y+x);\n\t\tif(N%6==0) printf(\"%lld\\n\",ans[6]);\n\t\telse printf(\"%lld\\n\",ans[N%6]);\n\t}\n\treturn 0;\n } \n \t\t \t \t\t\t \t \t \t\t \t\t\t\t \t", "lang": "GNU C++11", "bug_code_uid": "f3c8564ae0ed67aa07fad1a9c1dcaf65", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "apr_id": "f0e63765153db58fc2c0b1bfa0d83aad", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9564085881587508, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include \n\n#define INF 1e9\n#define EPS 1e-6\n#define pb push_back\n#define pause system(\"pause\");\n#define exit exit(0)\n\nusing namespace std;\nusing ll = long long;\nusing ull = unsigned long long;\n\nint n;\n\nll get(string &s) {\n\tll curr = 1;\n\tfor (auto c : s) {\n\t\tcurr *= c - '0';\n\t}\n\n\treturn curr;\n}\n\nint main() {\n\tios::sync_with_stdio(false);\n\tcin.tie(0), cout.tie(0);\n\t\n\tcin >> n;\n\t\n\tstring s = to_string(n);\n\tll res = powl(9, (int)(s.length()) - 1);\n\tres = max(res, get(s));\n\tfor (int i = (int)(s.length() - 1); i != 0; --i) {\n\t\tint j = i - 1;\n\t\twhile (s[j] == '0') {\n\t\t\t--j;\n\t\t}\n\n\t\t--s[j];\n\t\t++j;\n\t\twhile (j <= i) {\n\t\t\ts[j] = '9';\n\t\t\t++j;\n\t\t}\n\t\t\t\n\t\tres = max(res, get(s));\n\t}\n\n\tcout << res << endl;\n\t//pause;\n\treturn 0;\n}", "lang": "GNU C++17", "bug_code_uid": "946ad6ae2ad2cdebab7719a7dea86378", "src_uid": "38690bd32e7d0b314f701f138ce19dfb", "apr_id": "1f0434055775ea4bec84a7ec13cee327", "difficulty": 1200, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.41731409544950054, "equal_cnt": 22, "replace_cnt": 8, "delete_cnt": 7, "insert_cnt": 6, "fix_ops_cnt": 21, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n\tvectorv;\n\tint i=0;\n\twhile (1)\n\t{\n\t\tchar ch;\n\t\tcin>>ch;\n\t\tif (ch==NULL)\n\t\t\tbreak;\n\t\telse\n\t\t\tv.push_back(ch);\n\t\ti++;\n\t}\n\tfor (int j=0;j=90&&v[j]!='A'&&v[j]!='E'&&v[j]!='I'&&v[j]!='O'&&v[j]!='U')\n\t\t\t\tcout<\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\n#define NMAX 100005\n#define LMAX 100005\nint getmax(string s){\n\tint ans=-1;\n\tfor(int i=0;ians)\n\t\t\tans=s[i]-'0';\n\t}\n\treturn ans;\n}\nint main()\n{\n\t//freopen(\"in.txt\",\"r\",stdin);D\n\t//freopen(\"out.txt\",\"w\",stdout);\n\tfor(string s,ss;cin>>s>>ss;){\n\t\tint base=max(getmax(s),getmax(ss));\n\t if(s.length()>ss.length ())\n\t\t\tswap(s,ss);\n\t\ts=string(ss.length ()-s.length (),'0')+s;\n\t\tint jin=0;\n\t\tfor(int i=ss.length ()-1;i>=0;i--){\n\t\t\tjin=jin+ss[i]+s[i]-'0'-'0';\n\t\t\tjin=jin/base;\n\t\t}\n\t\tif(jin)\n\t\t\tcout<\nusing namespace std;\n int main()\n {\n int n;\n \t scanf(\"%d\",&n);\n \t long long a[n][n];\n \t for(int k=1;k<=n;k++)\n \t {\n \t \ta[1][k]=1;\n \t \ta[k][1]=1;\n\t }\n\t for(int i=2;i<=n;i++)\n\t for(int j=2;i<=n;j++)\n\t {\n\t \t a[i][j]=a[i-1][j]+a[i][j-1];\n\t }\n\t printf(\"%d\",a[n][n]);\n \t return 0; \n }", "lang": "GNU C++11", "bug_code_uid": "9be8639a01ec56f34b6cacc9bd5ac2d6", "src_uid": "2f650aae9dfeb02533149ced402b60dc", "apr_id": "5010a28ac33d87542ab687a94b7ccdb9", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9733812949640288, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#define N 1000000007\n#define PI acos(-1)\n#define EPS 1e-8\n#define INF 2147483647\n#define INIT(x,y) memset(x,y,sizeof(x))\n#define INITip(x,y,n) memset(x,y,n*sizeof(int))\n#define INITbp(x,y,n) memset(x,y,n*sizeof(bool))\n#define Readfile(x) freopen(x,\"r\",stdin)\n#define Writefile(x) freopen(x,\"w\",stdout)\ntypedef long long LL;\ntypedef long double LD;\nusing namespace std;\n\nint main() {\n Readfile(\"in.txt\");\n int n,k;\n cin>>n>>k;\n int d[n][k];\n char c;\n for(int i=0;i>c;\n d[i][j]=c-'0';\n }\n }\n int ind[k];\n for(int j=0;j\n#include\nusing namespace std;\nstruct node{int R,C,Time;};\nchar grid[9][9];\nbool state[15][15][25];// 1 means there's a statues ,,, 0 means theres no statue\n // R C Time\n bool vis[8][8][16];\n queueQ;\n void PUSH()\n {\n node temp;\n int i,j;\n for(i=-1;i<=1;i++)\n for(j=-1;j<=1;j++)\n {\n if(Q.front().R+i <0 ||Q.front().R+i>=8 || Q.front().C+j<0|| Q.front().C+j>=8 )\n continue;\n\n temp.R=Q.front().R+i; temp.C=Q.front().C+j; temp.Time=Q.front().Time+1;\n Q.push(temp);\n temp.R=Q.front().R+i; temp.C=Q.front().C+j; temp.Time=Q.front().Time+2;\n Q.push(temp);\n }\n return;\n }\nint main()\n{\n int t,i,j;\n node temp;\n for(i=0;i<8;i++)\n scanf(\"%s\",grid[i]);\n\n for(t=0;t<8;t+=2)\n for(i=0;i<8;i++)\n for(j=0;j<8;j++)\n if(i-(t/2)>=0 && grid[(i-(t/2))][j]=='S')\n {state[i][j][t]=1; state[i][j][t+1]=1; }\n temp.R=7; temp.C=0; temp.Time=-1; Q.push(temp);\n while(!Q.empty())\n {\n if( (temp.Time==-1 && !state[Q.front().R][Q.front().C][Q.front().Time+1])|| (!vis[Q.front().R][Q.front().C][Q.front().Time] && !state[Q.front().R][Q.front().C][Q.front().Time]) && !state[Q.front().R][Q.front().C][Q.front().Time+1])\n {\n vis[Q.front().R][Q.front().C][Q.front().Time]=1;\n\n // printf(\"****(%d,%d) %d STATE:%d\\n\",Q.front().R,Q.front().C,Q.front().Time,state[Q.front().R][Q.front().C][Q.front().Time]);\n if(Q.front().R==0 && Q.front().C==7)\n { printf(\"WIN\\n\"); return 0;}\n\n PUSH();\n }\n Q.pop();\n }\n //if(state[Q.front().R][Q.front().C][Q.front().Time])\n printf(\"LOSE\\n\");\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "2e033e5a1afc7105f47e8e36b32a4902", "src_uid": "f47e4ab041288ba9567c19930eb9a090", "apr_id": "6e6a55845af25529d203f9faefeeb77d", "difficulty": 1500, "tags": ["graphs", "dfs and similar", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9799498746867168, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "#include \n#include \n#include \n#include \nusing namespace std;\nchar s[101];\nint n;\nint dp(int z, int i, int j){\n\tint m = 0;\n\tif(s[i]==s[j]){\n\t\tm = max(m, 1+dp(z+1, i+1, j+1));\n\t}\n\treturn m;\n}\nint main(){\n\tgets(s);\n\tn = strlen(s);\n\tint m = 0;\n\tfor(int i = 0; i < n; i ++)for(int j = i+1; j < n; j ++){\n\t\tm = max(m, dp(0, i, j));\n\t}\n\tprintf(\"%d\\n\", m);\n\treturn main();\n}\n", "lang": "GNU C++", "bug_code_uid": "491980f621015a1ef990acd859ac67fd", "src_uid": "13b5cf94f2fabd053375a5ccf3fd44c7", "apr_id": "773be3c41917dd0c097c72e3bebcbdbc", "difficulty": 1200, "tags": ["brute force", "greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5343065693430656, "equal_cnt": 13, "replace_cnt": 8, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 13, "bug_source_code": "#include \n\nusing namespace std;\n\nint main()\n{\n\tint n,k ;\n\twhile(scanf(\"%d%d\",&n,&k)){\n\t\tint a [n];\n\t\tfor(int i=0;i < n; i++){\n\t\t\tscanf(\"%d\",&a[i]);\n\t\t}\n\t\tint num = 0;\n\t\tfor (int i = 0; i < n && a[i] <= k; i++) {\n\t\t\tnum ++;\n\t\t}\n\t\tint sum = num;\n\t\tfor (int i = n-1; i > num && a[i] <= k; i--) {\n\t\t\tsum ++;\n\t\t}\n\t\tprintf(\"%d\",sum);\n\t}\n\treturn 0;\n}\n", "lang": "Clang++17 Diagnostics", "bug_code_uid": "2b7383e78f51b08e84a8e4613dfe5993", "src_uid": "ecf0ead308d8a581dd233160a7e38173", "apr_id": "8a09edff9d1fe3f7d3c8905d0748822b", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9130714745653574, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#define _CRT_SECURE_NO_WARNINGS\n\n#include \n#include \n#include \nusing namespace std;\nstring n;\nstring x, y;\nint xx, yy, counter;\nint main() {\n\tcin >> n;\n\tx = n[1]; x += n[0];\n\ty = n[3]; y += n[4];\n\tyy = stoi(y);\n\txx = stoi(x);\n\tif (yy == xx)cout << 0;\n\telse if(xx>yy && xx < 60) cout << xx - yy;\n\telse {\n\t\tx[0] += '1' - '0';\n\t\txx = stoi(x);\n\t\tif (xx == 42) {\n\t\t\txx = 00;\n\t\t}\n\t\telse if (xx > 51) {\n\t\t\tif (!(xx % 5)) {\n\t\t\t\tcounter = (10 - (x[0] - '0')) * 60;\n\t\t\t\txx = 01;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcounter = (10 - (x[0] - '0')) * 60;\n\t\t\t\txx = 02;\n\t\t\t}\n\t\t\t/*\n\t\t\t06:51\n\t\t\t60 :51\n\t\t\t240\n\n\t\t\t16:50\n\t\t\t61:50\n\t\t\t02:50\n\t\t\t12+240\n\t\t\t252\n\t\t\t*/\n\t\t}\n\t\tcout << xx + (60 - yy) + counter;\n\t}\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "9eacf5a4a774dcf4e8d0f42eaeea8c0c", "src_uid": "3ad3b8b700f6f34b3a53fdb63af351a5", "apr_id": "de7fa764ac868430de386749ecb6d087", "difficulty": 1000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9969040247678018, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \n\nusing namespace std;\n\nint main()\n{\n int n,m,k,l;\n cin>>n>>m>>k>>l;\n int r,t;\n if(m>n)cout<<\"Second\";\n else cout<<\"First\" ;\n}\n", "lang": "GNU C++14", "bug_code_uid": "782a69ef79b8f72eba94be93b98fd7bc", "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b", "apr_id": "e3be8fe58a06f018438e8d280d2b9fac", "difficulty": 800, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.6503823279524215, "equal_cnt": 21, "replace_cnt": 12, "delete_cnt": 2, "insert_cnt": 6, "fix_ops_cnt": 20, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nconst int INF = 0x3f3f3f3f;\n\nconst int N = 20;\nconst int A = 3;\nint pos[N * N];\nstd::vector g[A][N * N];\nint dist[A][N * N][N * N];\nstd::pair dp[N * N][A];\nint n;\n\ninline int enc(int i, int j) \n{\n\treturn i * n + j;\n}\n\ninline void add_edge(int ind, int i, int j, int k, int l) \n{\n\tg[ind][enc(i, j)].push_back(enc(k, l));\n}\n\nvoid bfs(int v, std::vector *g, int *dist) \n{\n\tmemset(dist, 0x3f, 4 * N * N);\n\tstd::queue q;\n\tdist[v] = 0;\n\tq.push(v);\n\twhile (!q.empty()) {\n\t\tv = q.front();\n\t\tq.pop();\n\t\tfor (int i = 0; i < (int)g[v].size(); ++i) if (dist[g[v][i]] == INF) {\n\t\t\tdist[g[v][i]] = dist[v] + 1;\n\t\t\tq.push(g[v][i]);\n\t\t}\n\t}\n}\n\nvoid prep() \n{\n\tfor (int i = 0; i < n; ++i) {\n\t\tfor (int j = 0; j < n; ++j) {\n\t\t\tfor (int k = 0; k < n; ++k) for (int l = 0; l < n; ++l) if (i != k || j != l) {\n\t\t\t\tif (abs(k - i) == 2 && abs(l - j) == 1 || abs(k - i) == 1 && abs(l - j) == 2) add_edge(0, i, j, k, l);\n\t\t\t\tif (abs(k - i) == abs(l - j)) add_edge(1, i, j, k, l);\n\t\t\t\tif (i == k || l == j) add_edge(2, i, j, k, l);\n\t\t\t}\n\t\t}\n\t}\n\tfor (int i = 0; i < A; ++i) for (int j = 0; j < n * n; ++j) bfs(j, g[i], dist[i][j]);\n}\n\nint main() \n{\n\tscanf(\"%d\", &n);\n\tprep();\n\tfor (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) {\n\t\tint v;\n\t\tscanf(\"%d\", &v);\n\t\tpos[v - 1] = enc(i, j);\n\t}\n\tfor (int i = 1; i < n * n; ++i) {\n\t\tfor (int j = 0; j < A; ++j) dp[i][j] = std::make_pair(INF, INF);\n\t\tfor (int j = 0; j < A; ++j) {\n\t\t\tfor (int k = 0; k < A; ++k) {\n\t\t\t\tdp[i][k] = min(dp[i][k], std::make_pair(dp[i - 1][j].first + dist[j][pos[i - 1]][pos[i]] + (k != j), dp[i - 1][j].second + (k != j)));\n\t\t\t}\n\t\t}\n\t}\n\tstd::pair ans = dp[n * n - 1][0];\n\tfor (int i = 1; i < A; ++i) ans = min(ans, dp[n * n - 1][i]);\n\tassert(ans.first != INF && ans.second != INF && ans.first && ans.second);\n\tprintf(\"%d %d\\n\", ans.first, ans.second);\n\treturn 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "5cc7ac17cf2a8c07ce1d7f0e3c953b65", "src_uid": "5fe44b6cd804e0766a0e993eca1846cd", "apr_id": "06402e99dd13a1c3de1e52dfbd816b59", "difficulty": 2200, "tags": ["dp", "dfs and similar", "shortest paths"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9774687065368567, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "#include \n\n#define mp make_pair\n#define st first\n#define nd second\n#define pb push_back\n\nusing namespace std;\n\ntypedef long long ll;\ntypedef pair pii;\ntypedef pair< ll,ll > pll;\n\nconst int inf = 1000000000, MAX = 83;\nconst ll mod = 1000000007;\n\nstruct Matrix{\n\tll a[MAX + 3][MAX + 3];\n\n\tMatrix(){\n\t\tfor (int i = 1; i <= MAX; i++)\n\t\t\tfor (int j = 1; j <= MAX; j++)\n\t\t\t\ta[i][j] = 0;\n\t}\n\n\tll* operator[] (int x){\n\t\treturn a[x];\n\t}\n};\n\nll sz,n,k,comb[45][45],pw[45] = {1};\n\nMatrix operator* (Matrix a,Matrix b){\n\tMatrix res;\n\n\tfor (int i = 1; i <= sz; i++) {\n\t\tfor (int j = 1; j <= sz; j++) {\n\t\t\tfor (int k = 1; k <= sz; k++) {\n\t\t\t\tres[i][j] = (res[i][j] + a[i][k] * b[k][j]) % mod;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn res;\n}\n\nint main()\n{\n\tcin >> n >> k;\n\n\tif (n == 1) {\n\t\tputs(\"1\");\n\t\treturn 0;\n\t}\n\n\tsz = 2*k+3;\n\n\tMatrix a;\n\n\tfor (int i = 1; i <= 40; i++)\n\t\tpw[i] = (pw[i-1] << 1ll) % mod;\n\n\tfor (int i = 0; i <= k; i++) {\n\t\tfor (int j = 0; j <= k; j++) {\n\t\t\tif (j == 0)\n\t\t\t\tcomb[i][j] = 1;\n\t\t\telse if (i != 0)\n\t\t\t\tcomb[i][j] = (comb[i-1][j] + comb[i-1][j-1]) % mod;\n\t\t}\n\t}\n\n\tfor (int i = 1; i <= k+1; i++) {\n\t\tfor (int j = i; j <= k+1; j++) {\n\t\t\ta[i][j] = comb[k-i+1][j-i];\n\t\t}\n\t\tfor (int j = k+i+1; j <= 2*k+2; j++) {\n\t\t\ta[i][j] = (comb[k-i+1][j-k-i-1] * pw[j-k-i-1]) % mod;\n\t\t}\n\t}\n\tfor (int i = k+2; i <= 2*k+2; i++) {\n\t\ta[i][i-k-1] = 1;\n\t}\n\tfor (int i = 1; i <= 2*k+2; i++)\n\t\ta[sz][i] = a[1][i];\n\ta[sz][sz] = 1;\n\n\tMatrix ans;\n\tfor (int i = 1; i <= sz; i++)\n\t\tans[i][i] = 1;\n\n\tn -= 2;\n\twhile (n--) {\n\t\tans = ans * a;\n\t}\n\n\tll res = 0;\n\n\tfor (int i = 1; i <= k+1; i++)\n\t\tres = (res + ans[sz][i] * pw[k-i+2]) % mod;\n\tfor (int i = k+2; i <= 2*k+2; i++)\n\t\tres = (res + ans[sz][i]) % mod;\n\tres = (res + ans[sz][sz]*(1 + pw[k+1])) % mod;\n\n\tcout << res << endl;\n\t\n\n\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "ccfbcce0ac08de25d0c825ff72d84dad", "src_uid": "14f50a111db268182e5927839a993118", "apr_id": "f446ec202a4c680eb3ac47cae918c6bb", "difficulty": null, "tags": ["matrices", "math", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.688145394465097, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "#include \n\nusing namespace std;\n\ntypedef long long int ll;\n\n#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);\n#define f(i,s,n) for(int i=s;i>s1>>s2;\n int e=0,posT=0,posR=0;\n posT=count(s1.begin(),s1.end(),'+')-count(s1.begin(),s1.end(),'-');\n posR=count(s2.begin(),s2.end(),'+')-count(s2.begin(),s2.end(),'-');\n e=count(s2.begin(),s2.end(),'?');\n int pos=abs(posT-posR);\n \n if(e-pos>=0&&(e-pos)%2==0){\n \n printf(\"%0.12f\",((comb(e,pos)*(comb(e,(e-pos)/2)))/power(e)));\n // }\n \n // else\n // printf(\"%0.9f\",0);\n }\n else\n printf(\"%0.12f\",0);\n // cout<<\"True position : \"<\nusing namespace std;\nint compute(int a)\n{\n if(a == 1)\n return 10;\n else \n return 10*compute(--a); \n}\nint main()\n{ int result = 0;\n int countA = 0;\n int countB = 0;\n int a;\n char b[10];\n cin>>a; \n //cout<<\"aa\";\n cin>>b;\n \n for(int i =0;i<10;i++)\n if('0'<=b[i]&&b[i]<='9')\n countB = i;\n int indexA = a;\n while(indexA/10!=0)\n {\n countA++;\n indexA/=10; \n }\n if(countA>=countB)\n {\n for(int i = countB; i>=0; i--)\n {\n result+=(b[i] - '0')*compute(countA--);\n } \n result +=a;\n cout<=0;i--)\n {\n result+=(b[i] - '0')*compute(i); \n } \n result+=a;\n cout<\n#include\n#include\nusing namespace std;\n#define rep(i) for(int i=0;i<=1;i++)\nchar x[256];\ntypedef long long ll;\nint n;\nll hasha[1000001],hashb[1000001],pow[1000001];\nstring a,b;\nvoid pre()\n{\n x['E']='W';\n x['W']='E';\n x['N']='S';\n x['S']='N';\n pow[1]=10;\n for(int i=2;i<=1000000;i++)\n pow[i]=10*pow[i-1];\n pow[0]=1;\n} \nvoid calc()\n{\n for(int i=1;i<=n;i++)\n hasha[i]=10*hasha[i-1]+a[i-1];\n for(int i=1;i<=n;i++)\n {\n hashb[i]=hashb[i-1]+pow[i-1]*b[b.length()-i];\n }\n}\nvoid reverse(string &s)\n{\n for(int i=0;i>n;\n pre();\n cin>>a>>b;\n reverse(a);\n calc();\n int flag=1;\n for(int i=1;i<=n;i++)\n {\n if(hasha[i]==hashb[i])\n {\n if(a.substr(0,i)==b.substr(n-1-i,i))\n flag=0;\n }\n }\n if(flag)\n cout<<\"YES\";\n else\n cout<<\"NO\";\n} ", "lang": "GNU C++11", "bug_code_uid": "a24ba44547bf96914c041174da0c7bfe", "src_uid": "85f43628bec7e9b709273c34b894df6b", "apr_id": "cc582aac8fd6f095e5b520f85a0375af", "difficulty": 2500, "tags": ["strings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9615462868769075, "equal_cnt": 10, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 10, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\n#define sc(a) scanf(\"%d\",&a)\n#define scm(a,b) scanf(\"%I64d%I64d\",&a,&b)\n#define fl(c,i,n) for(i=c;i\n\ntemplate inline T bigmod(T p,T e,T M){ll ret = 1;for(; e > 0; e >>= 1){if(e & 1) ret = (ret * p) % M;p = (p * p) % M;} return (T)ret;}\ntemplate inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}\ntemplate inline T modinverse(T a,T M){return bigmod(a,M-2,M);}\n\nint toInt(string s) { int sm; stringstream ss(s); ss>>sm; return sm; }\nint toLlint(string s) { long long int sm; stringstream ss(s); ss>>sm; return sm;}\n\n///int month[]={-1,31,28,31,30,31,30,31,31,30,31,30,31}; //Not Leap Year\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\n/*****************************************************************/\n/////////////////////// GET SET GO ///////////////////////////\n/*****************************************************************/\n\n#define M 1000\n\nint main ()\n{\n ll cs=1,t,i,j,h,r;\n while(1){\n\n scm(r,h);\n\n i=((h+r/2)/r)*2;\n j=h+r-(i/2)*r;\n if(j>=r/sqrt(3.00))\n i++;\n printf(\"%I64d\\n\",i);\n }\n\n return 0;\n}\n\n\n", "lang": "GNU C++", "bug_code_uid": "3ae38d96b3f030345fe047ac3c516d20", "src_uid": "ae883bf16842c181ea4bd123dee12ef9", "apr_id": "1b89415ed178511e75b35547a80e3886", "difficulty": 1900, "tags": ["geometry"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5524745524745525, "equal_cnt": 13, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "/* Problem : D. Yet Another Number Game\n** Time : 3000ms\n** Algorithm: dp\n**/\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n#define st first\n#define nd second\n#define read(x) scanf(\"%d\",&x)\n#define MAXN 1000005\ntypedef long long int64;\nint a[MAXN], cnt[301];\nint main (int argc, char const* argv[]){\n if ( argc == 3 ){\n freopen(argv[1],\"r\",stdin);\n freopen(argv[2],\"w\",stdout);\n }\n int n; read(n);\n int x = 0, mn = 301, nb = 0;\n for(int i = 0 ; i < n ; ++i){\n read(a[i]);\n x ^= a[i];\n mn = min(a[i],mn);\n if ( cnt[a[i]] == 0 ){\n ++nb;\n }\n ++cnt[a[i]];\n }\n if ( nb == 1 || x % 2 = 0 ){\n puts(\"BitLGM\");\n return 0;\n }\n x = 0;\n for(int i = 0 ; i < n ; ++i){\n a[i] -= mn;\n x ^= a[i];\n }\n if ( x % 2 == 1 ){\n puts(\"BitLGM\");\n }else{\n puts(\"BitAryo\");\n }\n return 0;\n}\n\n/* DOAN Minh Quy - mquy.doan@gmail.com */", "lang": "GNU C++", "bug_code_uid": "4566e00dbc1504f127643f70f5ca628e", "src_uid": "7a33b4f94082c7ef80d7e87b58497fa7", "apr_id": "00c5577f55c518bf728aea72e81c51f3", "difficulty": 2100, "tags": ["dp", "games"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9563786008230453, "equal_cnt": 3, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "\t#include\n\t//#define endl \"\\n\"\n\tusing namespace std;\n\tint main()\n\t{\n\t\tios::sync_with_stdio(false);\n\t\t//cin.tie(0);\n\t\tlong long c,hr,hb,wr,wb;\n\t\tcin>>c>>hr>>hb>>wr>>wb;\n\t\tlong long n=c/wr,m=c%wr;\n\t\tlong long sum=n*hr+(m/wb)*hb;\n\t\tfor (long long i=1; i<=11700; i++)//\u00b1\u00a9\u00c1\u00a612500\u00b4\u00ce \n\t\t{\n\t\t\tif (n<=0) break;\n\t\t\tn--;\n\t\t\tm=c-n*wr;\n\t\t\tm/=wb;\n\t\t\tsum=max(sum,n*hr+m*hb);\n\t\t}\n\t\tn=c/wb;\n\t\tm=c%wb;\n\t\tsum=max(sum,n*hb+(m/wr)*hr);\n\t\tfor (long long i=1; i<=11700; i++)\n\t\t{\n\t\t\tif (n<=0) break;\n\t\t\tn--;\n\t\t\tm=c-n*wb;\n\t\t\tm/=wr;\n\t\t\tsum=max(sum,n*hb+m*hr);\n\t\t}\n\t\tcout<\nusing namespace std;\n\n\nint v1, v2, t, d;\n\nint dp[101][1111];\n\nint recur(int currentt, int currentspeed)\n{\n\tif (t < currentt)\n\t{\n\t\treturn INT_MIN;\n\t}\n\n\tif (t==currentt)\n\t{\n\n\t\tif (currentspeed == v2)\n\t\t{\n\t\t\treturn 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn INT_MIN;\n\t\t}\n\t}\n\n\tif (currentspeed <= 0)\n\t{\n\t\treturn INT_MIN;\n\t}\n\n\treturn dp[currentt][currentspeed];\n}\n\nint main()\n{\n\tstd::ios::sync_with_stdio(false);\n\n\tcin >> v1 >> v2 >> t >> d;\n\n\n\tfor (int currentt = t; currentt >= 1; currentt--)\n\t{\n\t\tfor (int currentspeed = 0; currentspeed <= (v1+d)*t; currentspeed++)\n\t\t{\n\t\t\tint mx = INT_MIN;\n\n\t\t\tfor (int i = 0; i <= d; i++)\n\t\t\t{\n\t\t\t\tint s1 = currentspeed + i + recur(currentt + 1, currentspeed + i);\n\n\t\t\t\tmx = max(s1, mx);\n\n\t\t\t\tif (currentspeed - i >= 0)\n\t\t\t\t{\n\t\t\t\t\tint s2 = currentspeed - i + recur(currentt + 1, currentspeed - i);\n\t\t\t\t\tmx = max(s2, mx);\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t dp[currentt][currentspeed] = mx;\n\t\t}\n\t}\n\n\tint res = dp[1][v1];\n\n\tcout << res+v1 << endl;\n\n\tint pause;\n\tcin >> pause;\n\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "f90f3689a9353bdce7f3afc9d1f0283c", "src_uid": "9246aa2f506fcbcb47ad24793d09f2cf", "apr_id": "e13267b5b7392d0c3dd4add578d78980", "difficulty": 1400, "tags": ["dp", "math", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.3910411622276029, "equal_cnt": 18, "replace_cnt": 13, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 17, "bug_source_code": "#include \n#include \n#include \n\nusing namespace std;\n\nconst int mod = 998244353;\nconst int p1 = 998244353;\n\nlong long fact(int a) {\n\tlong long f = 1;\n\tfor (int i = 2; i <= a; i++) {\n\t\tf *= i;\n\t}\n\treturn f;\n}\n\n\nlong long sochet(int a, int b) {\n\tif (a == b) return 1;\n\tif (a == 1) return b;\n\tlong long soch = 1;\n\tsoch = fact(b);\n\tsoch = soch / fact(a);\n\tsoch = soch / fact(b - a);\n\t\n\t\n\treturn soch;\n}\n\n\n\nlong long count(int min, int max) {\n\tlong long res = 1;\n\tfor (int i = 1; i <= min; i++) {\n\t\tres += sochet(i, min)*sochet(i, max)*fact(i);\n\t\t\n\t}\n\tres = res%p1;\n\treturn res;\n}\n\n\nint main() {\n\tvector flag(200001000);\n\tint a,b,c;\n\tcin >> a >> b >> c;\n\tif (a > b) swap(a, b);\n\tif (b > c) swap(b, c);\n\tif (a > c) swap(a, c);\n\t\n\t\n\n\tcout << count(a, b) % p1*count(a, c) % p1*count(b, c) % p1;;\n\t\n\t\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "24a8d61355b69520a430c04c7d042a66", "src_uid": "b6dc5533fbf285d5ef4cf60ef6300383", "apr_id": "dc40b02fe8b00c33a821a2e8a27c5f3f", "difficulty": 1800, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9912280701754386, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#define _USE_MATH_DEFINES\n#include \n#include \n#include \n#include \n#include \n#include \n#include\n#include\n#include\n#include \n#include\n#include \n#include\n#include \n#include\n#include\n\n//#include\n\n\nusing namespace std;\n\n\n\nint main() {\n\n\tint n, h, m;cin >> n >> h >> m;\n\tvectort(n + 1);\n\t\n\tfor (int i = 1; i <= n; i++)t[i] = h;\n\n\tfor (int i = 0; i < m; i++) {\n\n\t\tint a, b,c;\n\t\tcin >> a >> b>>c;\n\t\tfor (int j = a; j <= b; j++)t[j] = c;\n\n\t}\n\tint r = 0;\n\tfor (int i = 1; i <= n; i++)r += t[i] * t[i];\n\tcout << r << endl;\n\n\n\treturn 0;\n\n\n}", "lang": "MS C++", "bug_code_uid": "747a6f61dc5ed2dea2e4356763e7570c", "src_uid": "f22b6dab443f63fb8d2d288b702f20ad", "apr_id": "d072eb55e793da6759ae8ef8b6448cd4", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8370079805221156, "equal_cnt": 25, "replace_cnt": 13, "delete_cnt": 6, "insert_cnt": 5, "fix_ops_cnt": 24, "bug_source_code": "// Bismillahir Rahmanir Rahim\n\n#include \nusing namespace std;\n\ntypedef long long int ll;\ntypedef unsigned long long int ull;\ntypedef long double ld;\ntypedef vector vi;\ntypedef vector vl;\ntypedef pair pll;\ntypedef pair plp;\ntypedef pair pii;\ntypedef pair pip;\n\nconst int MX = 2e6+10;\nconst int mod = 1e9 + 7;\nconst ll inf = 1LL << 62;\n\nint dx4[] = { 0, 0, -1, 1 };\nint dy4[] = { 1, -1, 0, 0 };\n\nint dx[] = { 1, 1, 1, 0, 0, -1, -1, -1 };\nint dy[] = { 1, 0, -1, 1, -1, 1, 0, -1 };\n\n// TOOLS\n#define LCM(a,b)\t (a / __gcd(a,b) ) *b\n#define gcd(a,b)\t __gcd(a,b)\n#define all(x)\t (x).begin(), (x).end()\n#define mem(a, n)\t memset(a, n, sizeof(a))\n#define for1(i, n)\tfor(int i=1; i<=n; i++)\n#define for0(i, n)\tfor(int i=0; i=0; i--)\n#define rof1(i, n)\tfor(int i=n; i>=1; i--)\n#define forab(i, a, b) for(int i=a; i<=b; i++)\n#define rofab(i, a, b) for(int i=b; i>=a; i--)\n#define pb\t\t push_back\n#define pbb\t\t pop_back\n\n// CIN/COUT\n#define YES\t\t cout << \"YES\" << endl\n#define NO\t\t cout << \"NO\" << endl\n#define sin(s)\t getline(cin, s)\n#define scf(a)\t cin >> a\n#define scf2(a, b)\tcin >> a >> b\n#define scf3(a, b, c) cin >> a >> b >> c\n#define scf4(a,b,c,d) cin >> a >> b >> c >> d\n#define pnf(a)\t cout << (a) << endl\n#define pnf2(a, b)\tcout << (a) << \" \" << (b) << endl\n#define pnf3(a, b, c) cout << (a) << \" \" << (b) << \" \" << (c) << endl\n#define bug(n)\t cout << \">> \" << n << \" <<\" << endl\n#define line\t\tcout << \"==========\" << endl\n#define pnfa(a)\t cout << (a) << \" \"\n#define pf(a)\t cout << (a)\n#define sp\t\t cout << \" \"\n#define nl\t\t cout << endl\n\n// SCANF/PRINTF\n#define fYES\t\tprintf(\"YES\\n\")\n#define fNO\t\t printf(\"NO\\n\")\n#define Sin(s)\t gets(s)\n#define Scf(a)\t scanf(\"%lld\", &a)\n#define Scf2(a, b)\tscanf(\"%lld %lld\", &a, &b)\n#define Scf3(a, b, c) scanf(\"%lld %lld %lld\", &a, &b, &c)\n#define Scf4(a,b,c,d) scanf(\"%lld %lld %lld %lld\", &a, &b, &c, &d)\n#define Pnf(a)\t printf(\"%lld\\n\", a)\n#define Pnf2(a, b)\tprintf(\"%lld %lld\\n\", a, b)\n#define Pnf3(a, b, c) printf(\"%lld %lld %lld\\n\", a, b, c)\n#define Bug(n)\t printf(\">> %lld <<\\n\", n)\n#define Line\t\tprintf(\"==========\\n\")\n#define Pnfa(a)\t printf(\"%lld \", a)\n#define Pf(a)\t printf(\"%lld\", a)\n#define Sp\t\t printf(\" \")\n#define Nl\t\t printf(\"\\n\")\n\n// OTHERS\n#define saz(n)\t n.size()\n#define clr(v)\t v.clear()\n#define min3(a, b, c) min(a, min(b, c))\n#define max3(a, b, c) max(a, max(b, c))\n#define in\t\t freopen(\"input.txt\", \"r\", stdin)\n#define out\t\t freopen(\"output.txt\", \"w\", stdout)\n#define FastIO\t { ios_base::sync_with_stdio(false); cin.tie(0); }\n#define F\t\t first\n#define S\t\t second\n#define mpp\t\t make_pair\n\n//string s;\n//vector v;\n//vector v[MX];\n//ll ar[MX], br[MX];\n//ll vist[MX];\n//map mp;\n\nll ar[101*101];\n\nll dp[101*101][101*101];\n\nll N;\nvector vec;\nll vist[101*101];\n\nll rec(ll idx, ll cur, ll sum)\n{\n\n if(cur==N)\n return sum;\n ll& ret = dp[idx][cur];\n if(~ret)\n return ret;\n ret=inf;\n vist[vec[idx].F] = 1 ;\n vist[vec[idx].S] = 1 ;\n for1(i,vec.size())\n {\n if(!vist[vec[i].F] && !vist[vec[i].S])\n ret = min(ret, rec(i,cur+1,sum+abs(ar[vec[i].F]-ar[vec[i].S])));\n\n }\n vist[vec[idx].F] = 0 ;\n vist[vec[idx].S] = 0 ;\n //bug(ret);\n return ret;\n}\n\n\n\nint main()\n{\n mem(dp,-1);\n ll n, m, k, q, t, cnt = 0, sum = 0, mx = -inf, mn = inf ;\n Scf(n);\n N=n-1;\n n*=2;\n for1(i,n)\n {\n Scf(ar[i]);\n }\n sort(ar+1,ar+n+1);\n vec.pb({0,0});\n for1(i,n)\n {\n forab(j,i+1,n)\n {\n vec.pb({i,j});\n }\n }\n ll res = rec(0,0,0);\n pnf(res);\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "11e05dac2ba058a0be3fb17bf19262d6", "src_uid": "76659c0b7134416452585c391daadb16", "apr_id": "a887053e93aa7f0adce160aa754bf9e0", "difficulty": 1500, "tags": ["greedy", "brute force", "sortings"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.43875347115087937, "equal_cnt": 15, "replace_cnt": 7, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 14, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define F first\n#define S second\n#define LL long long\n\nusing namespace std;\n\nconst LL VAL=200005;\nconst LL MOD=1000000007;\n\nLL N, L, R, i, j, dp[VAL][5];\nLL A, B, C, X, Y, ind, ANS;\n\nint main()\n{\n cin >> N >> L >> R;\n X=L;\n while (X % 3!=0)\n X++;\n Y=R;\n while (Y % 3!=0)\n Y--;\n A=(Y-X+3) / 3;\n\n X=L;\n while (X % 3!=1)\n X++;\n Y=R;\n while (Y % 3!=1)\n Y--;\n B=(Y-X+3) / 3;\n\n X=L;\n while (X % 3!=2)\n X++;\n Y=R;\n while (Y % 3!=2)\n Y--;\n C=(Y-X+3) / 3;\n\n dp[1][0]=A;\n dp[1][1]=B;\n dp[1][2]=C;\n for (i=2; i<=min(N, 100000); i++)\n {\n dp[i][0]=dp[i-1][0]*A+dp[i-1][1]*C+dp[i-1][2]*B;\n dp[i][0]%=MOD;\n\n dp[i][1]=dp[i-1][0]*B+dp[i-1][1]*A+dp[i-1][2]*C;\n dp[i][1]%=MOD;\n\n dp[i][2]=dp[i-1][0]*C+dp[i-1][1]*B+dp[i-1][2]*A;\n dp[i][2]%=MOD;\n }\n if (N<=100000)\n cout << dp[N][0];\n else\n {\n X=N / 2;\n X++;\n ANS=dp[X][0]*dp[N-X][0];\n ANS+=dp[X][1]*dp[N-X][2];\n ANS+=dp[X][2]*dp[N-X][1];\n cout << ANS;\n }\n return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "428e1c978b897c38386b33ea3e1f7880", "src_uid": "4c4852df62fccb0a19ad8bc41145de61", "apr_id": "3628cc5230508f8719e30a6059be2f79", "difficulty": 1500, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.014696058784235137, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "int n, m;\n\nbool read() {\n\treturn !!(cin >> n >> m);\n}\n\nconst int N = 1200300;\n\nconst int mod = 1000 * 1000 * 1000 + 7;\n\nint gcd(int a, int b, int& x, int& y) {\n\tif (!a) {\n\t\tx = 0, y = 1;\n\t\treturn b;\n\t}\n\tint xx, yy, g = gcd(b % a, a, xx, yy);\n\tx = yy - b / a * xx;\n\ty = xx;\n\treturn g;\n}\n\ninline int inv(int a) {\n\tint x, y;\n\tassert(gcd(a, mod, x, y) == 1);\n\tx %= mod;\n\treturn x < 0 ? x + mod : x;\n}\n\ninline int mul(int a, int b) { return int(a * 1ll * b % mod); }\ninline int add(int a, int b) { return a + b >= mod ? a + b - mod : a + b; }\ninline int sub(int a, int b) { return a - b < 0 ? a - b + mod : a - b; }\n\ninline void inc(int& a, int b) { a = add(a, b); }\n\nint fact[N], ifact[N];\n\ninline int C(int n, int k) {\n\tif (k < 0 || k > n) return 0;\n\treturn mul(fact[n], mul(ifact[k], ifact[n - k]));\n}\n\nint pm[N], pm1[N];\n\nvoid solve() {\n\tconst int N = n + 1;\n\n\tfact[0] = 1; fore(i, 1, N) fact[i] = mul(fact[i - 1], i);\n\tforn(i, N) ifact[i] = inv(fact[i]);\n\n\tpm[0] = 1; fore(i, 1, N) pm[i] = mul(pm[i - 1], m);\n\tpm1[0] = 1; fore(i, 1, N) pm1[i] = mul(pm1[i - 1], sub(m, 1));\n\n\tint ans = pm[n];\n\tfore(s, 1, n + 1) {\n\t\tint cur = 1;\n\t\tcur = mul(cur, pm[s]);\n\t\tcur = mul(cur, pm1[n - s]);\n\t\tcur = mul(cur, C(n, s - 1));\n\t\tinc(ans, cur);\n\t}\n\tcout << ans << endl;\n}", "lang": "GNU C++14", "bug_code_uid": "6b35d062fc6191ff261d7f081745b932", "src_uid": "5b775f17b188c1d8a4da212ebb3a525c", "apr_id": "424f60e1b81ad6bbbd54ae5c731e0082", "difficulty": 2300, "tags": ["combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9940921622686096, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 6, "bug_source_code": "#include \n#include \nusing namespace std;\n#define mp make_pair\n#define pb push_back\n#define fi first\n#define se second\n#define sz(x) (int)((x).size())\n#define fill(x, y) memset(x, y, sizeof(y))\n#define all(x) (x).begin(), (x).end()\ntypedef long long ll;\ntypedef pair ii;\ntypedef pair iii;\ntypedef vector vi;\ntypedef vector vii;\ntypedef vector viii;\n\nint main() {\n ios::sync_with_stdio(false);\n cin.tie(0);\n string recipe;\n cin >> recipe;\n ll nb, ns, nc;\n cin >> nb >> ns >> nc;\n ll pb, ps, pc;\n cin >> pb >> ps >> pc;\n ll r;\n cin >> r;\n ll numB = 0; ll numS = 0; ll numC = 0;\n for (int i = 0; i < recipe.size(); i++) {\n if (recipe[i] == 'B') {\n numB++;\n } else if (recipe[i] == 'S') {\n numS++;\n } else {\n numC++;\n }\n }\n ll L = 0;\n ll R = 1000000000000;\n\n ll x = 0;\n while (L <= R) {\n ll m = (L + R + 1) / 2;\n ll rB = max((numB * m) - nb, (ll)0);\n ll rS = max((numS * m) - ns, (ll)0);\n ll rC = max((numC * m) - nc, (ll)0);\n if ((rB * pb) + (rS * ps) + (rC * pc) <= r) {\n x = m;\n L = m;\n } else {\n R = m - 1;\n }\n }\n cout << x << \"\\n\";\n\n return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "8f4cfb113651df8db575fb351ce0d4b3", "src_uid": "8126a4232188ae7de8e5a7aedea1a97e", "apr_id": "d87860f4ea53d4771b0c3a4ecf5cfb2c", "difficulty": 1600, "tags": ["brute force", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.5878616796047988, "equal_cnt": 25, "replace_cnt": 19, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 25, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\n#define mem(a,b) memset(a,b,sizeof(a))\n#define pb push_back\ntypedef long long ll;\n\nconst int N = 9;\n\nint n;\nll a[N];\n\nint ans;\n\nint isp(ll x) {\n\tfor(ll i=2;i*i<=x;i++) {\n\t\tif(x%i==0) return 0;\n\t}\n\treturn 1;\n}\n\nint cal(ll x) {\n\tint cnt=0;\n\tfor(ll i=2;i*i<=x;i++) {\n\t\twhile(x%i==0) {\n\t\t\tcnt++;\n\t\t\tx/=i;\n\t\t}\n\t}\n\treturn cnt+(x!=1);\n}\n\nint calc(ll a,ll x) {\n\tif(isp(a)) return 0;\n\treturn cal(a/x);\n}\n\nint mark[N];\n\nvoid dfs(int pos,int cost) {\n\tif(cost>=ans) return ;\n\tif(pos<0) {\n\t\tans=cost;\n\t\treturn ;\n\t}\n\tint up=1<>n;\n\tfor(int i=0;i>a[i];\n\tsort(a,a+n);\n\tans=0x3f3f3f3f;\n\tdfs(n-1,1);\n\n\tll x=1;\n\tint ok=1;\n\tfor(int i=0;i\n#define spd ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)\n#define file freopen(\"file.in\", \"rt\", stdin); freopen(\"file.out\", \"wt\", stdout)\n#define bo bool\n#define sh short\n#define ush unsigned short\n#define uit unsigned int\n#define ll long long\n#define ull unsigned long long\n#define de double\n#define lde long double\n#define ch char\n#define str string\n#define vec vector\n#define pr pair\n#define phb push_back\n#define sub substr\n#define re reverse\n#define bn begin()\n#define ed end()\n#define rbn rbegin()\n#define red rend()\n#define se size()\n#define ey empty()\n#define tp top()\n#define pp pop()\n#define ft front()\n#define bk back()\n#define ppb pop_back()\n#define cr clear()\n#define rse resize\n#define te true\n#define fe false\n#define st first\n#define nd second\n#define sk stack\n#define qe queue\n#define dq deque\n#define ph push\n#define it insert\n#define postal signed main()\n#define all(x) (x).bn, (x).ed\n#define rall(x) (x).rbn, (x).red\n#define coutf(x) cout << fixed << setprecision(x)\n#define gle(x) getline(cin, x)\nusing namespace std;\nconst lde pi = 3.141592653589793;\npostal {\n\tspd;\n\t//file;\n\tint t, n, k, d;\n\tull ans, ans1;\n\tcin >> t;\n\tvec v;\n\tset s;\n\tfor (int j = 0; j < t; ++j) {\n\t\tmap mp;\n\t\tfor (size_t i = 0; i < k; ++i)\n\t\t\tmp[i] = 0;\n\t\tcin >> n >> k >> d;\n\t\tv.rse(n);\n\t\tfor (size_t i = 0; i < n; ++i)\n\t\t\tcin >> v[i];\n\t\tfor (size_t i = 0; i < d; ++i) {\n\t\t\ts.it(v[i]);\n\t\t\t++mp[v[i]];\n\t\t}\n\t\tans1 = s.se;\n\t\tans = ans1;\n\t\ts.cr;\n\t\tfor (size_t i = 1; i < n - d + 1; ++i) {\n\t\t\t--mp[v[i - 1]];\n\t\t\tif (!mp[v[i - 1]])\n\t\t\t\t--ans1;\n\t\t\t++mp[v[i + d - 1]];\n\t\t\tif (mp[v[i + d - 1]] == 1)\n\t\t\t\t++ans1;\n\t\t\tans = min(ans, ans1);\n\t\t}\n\t\tcout << ans << '\\n';\n\t}\n\treturn 0;\n}", "lang": "GNU C++17", "bug_code_uid": "bf4a3ed06a51ee7cbf45be1b61e2d8a9", "src_uid": "56da4ec7cd849c4330d188d8c9bd6094", "apr_id": "67483b1866977cc86a4bbc321942ed2c", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.8808604522890238, "equal_cnt": 12, "replace_cnt": 6, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 12, "bug_source_code": "///\u9898\u89e3\uff1ahttps://ouuan.github.io/Codeforces-Round-564-%E4%B8%AD%E6%96%87%E9%A2%98%E8%A7%A3/\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define LL long long\n#define ULL unsigned long long\n#define rep(i, j, k) for(int i = j; i <= k; i++)\n#define dep(i, j, k) for(int i = k; i >= j; i--)\n#define INF 0x3f3f3f3f\n#define mem(i, j) memset(i, j, sizeof(i))\n#define make(i, j) make_pair(i, j)\n#define pb push_back\nusing namespace std;\nconst int N = 1e5 + 10, mod = 998244353, M = 3e3 + 10;\nint read()\n{\n\tsl = 0; fh = 1;\n\tchar ch = getchar();\n\twhile(ch < '0' || '9' < ch) {if(ch == '-') fh = -1; ch = getchar();}\n\twhile('0' <= ch && ch <= '9') sl = sl * 10 + ch-'0',ch = getchar();\n\treturn sl * fh;\n}\nint ksm(int x, int y) {\n int ans = 1;\n while(y) {\n if( y & 1 ) ans = (LL) ans * x % mod;\n x = (LL) x * x % mod;\n y >>= 1;\n }\n return ans;\n}\nint n, m, a[N], w[N], f[M][M], g[M][M], inv[M << 1], sum[3];\n///sum[0] : don't like ; sum[1]: like; sum[2]:all\nint main() {\n n = read(); m =read();\n //cout << n << \" \" << m <\n\nusing namespace std;\n\nstring s;\n\nint main() {\n int n, k;\n cin >> n >> k >> s;\n s = \"Y\" + s + \"Y\";\nqueue q; int d = 0; int mn = 0; int ok = 0;\n for(int i = 0; i <= n+1; i++) {\n while(q.size() && i - q.front() - 1 > k) q.pop();\n if(s[i] != 'N') {\n if(q.size() && i - q.front() - 1 == k) ok = 1;\n d = 0;\n if(s[i] == 'Y') while(q.size)) q.pop();\n q.push(i);\n } \n else mn = max(mn, ++d);\n }\n if(ok && mn <= k) cout << \"YES\" << endl; \n else cout << \"NO\" << endl;\n}", "lang": "GNU C++14", "bug_code_uid": "8fb79d4270f7cf3a7008c86f54c42a88", "src_uid": "5bd578d3da5837c259b222336a194d12", "apr_id": "e25e3827aac652211978666d0dc69329", "difficulty": 2000, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.05082053996823716, "equal_cnt": 12, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 13, "bug_source_code": "/*\n[\uce74\uc774\uc2a4\ud2b8 \uc54c\uace0\ub9ac\uc998 \ub514\uc790\uc778 \uc8fc\uc81c1] \n\ub3c4\uc804\uacfc\uc81c 2. \uc18c\uc218 \uacf1\ud558\uae30 \uc18c\uc218\ub294?\n\uc81c\uc791\uc790 : \uae40\uc601\uc644 (\uc6b4\uc815\uace0)\n\uc81c\uc791\uc77c : 2013 10 20\n*/\n#include \n#define MAX 3000\nint main(void)\n{\n int b,z,a, c, input;\n int cnt=0, p_c=0, chul_c=0;\n int prime[450]={2};\n int Chulsu[3000];\n int p[MAX+1]={0};\n\n for( z=2; z<=MAX; z++){\n if ( p[z] == 0 ){\n cnt+=1;\n prime[cnt]=z;\n \n for(b=z*2; b<=MAX; b+=z){\n p[b]=1;\n }\n }\n}\n scanf(\"%d\", &input);\n for(a=6; a<=input; a++){ //6\uc740 \ucd5c\ucd08\uc758 \ucca0\uc218\uc758 \uc218\uc774\uae30 \ub54c\ubb38\n cnt=0;\n for(c=1; c<=a; c++){\n\n if(a%prime[c] == 0) cnt++;\n if(prime[c]>a) break;\n }\n \n if(cnt == 2)\n {\n Chulsu[chul_c]=a;\n chul_c++;\n }\n }\n\n printf(\"%d\", chul_c);\n return 0;\n }", "lang": "MS C++", "bug_code_uid": "15218e0d89600bd9cca50537a5846cdc", "src_uid": "356666366625bc5358bc8b97c8d67bd5", "apr_id": "f859f1f0dddd1f6e065a854f3c788442", "difficulty": 900, "tags": ["number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.99767549976755, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\n \n\nint main(){\n\tint t;\n// t=1;\n cin>>t;\n \n while(t--){\n \n int n,k,l,i=0;\n bool q=false;\n cin>>n>>k>>l;\n \n int a[n];\n for(int i=0;i>a[i];\n \n }\n \n \n int k1=k;\n \n for( i=0;il)\n break;\n }\n \n if(i==n)\n cout<<\"Yes\";\n else\n cout<<\"No\";\n \n \n cout<\n#include \nusing namespace std;\n\nint main(int argc, char const *argv[]) {\n\t\n\tint n,x;\n\tcin>>n;\n\t\n\tvector mark(101, -1);\n\n\tfor (int i=0;i>x;\n\t\ta[x] = 0;\n\n\t}\n\n\tint ans = 0;\n\n\tfor (int i=1;i<=100;i++) {\n\n\t\tif (mark[i] == 0) {\n\n\t\t\tans++;\n\n\t\t\tfor (int j=i;j<=100;j=j+i) {\n\n\t\t\t\tif (mark[j] == 0) {\n\n\t\t\t\t\tmark[j] = 1;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcout<\nusing namespace std;\nint main()\n{\n\tint n,a,b;\n\tcin>>n>>a>>b;\n\tint t[n+1],i,f=min(a,b),k=0;\n\n\tfor(i=1;i<=n;i++) \n\t{\n\t cin>>t[i];\n\t}\n\tfor(i=1;i<=(n/2)+1;i++)\n\t{\n\t\tif(t[i]==t[n-i]&&t[i]==2)\n\t\t\tk=k+f;\n\t\telse if(t[i]==1&&t[n-i]==0)\n\t\t\treturn -1;\n\t\telse if (t[i]==0&&t[n-i]==1)\n\t\t return -1;\n\t\telse if(t[i]==1&&t[n-i]==2)\n\t\t\tk=k+b;\n\t else if(t[i]==2&&t[n-i]==1)\n\t k=k+b;\n\t\telse if(t[i]==0&&t[n-i]==2)\n\t\t\tk=k+a;\n\t\telse if(t[i]==2&&t[n-i]==0)\n\t\t k=k+a;\n\n\t\n\t}cout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n#define pb push_back\n#define INF 1001001001\n#define FOR(i,n) for(int (i)=0;(i)<(n);++(i))\n#define FORE(i,n) for(int (i)=1;(i)<=(n);++(i))\n#define mp make_pair\n#define pii pair\n#define ll long long\n#define vi vector\n#define SZ(x) ((int)((x).size()))\n#define fi first\n#define se second\n#define inp(n) int (n); scanf(\"%d\",&(n));\n#define inp2(n,m) int (n),(m); scanf(\"%d %d\",&(n),&(m));\n#define inp3(n,m,k) int (n),(m),(k); scanf(\"%d %d %d\",&(n),&(m),&(k));\n#define SSD(x) (scanf(\"%d\",&x))\n#define SSL(x) (scanf(\"%lld\",&x))\n#define SSF(x) (scanf(\"%f\",&x))\n#define SSS(x) (scanf(\"%s\",x))\ninline void prt(int n) { printf(\"%d\\n\",n); }\ntemplate ostream& operator<<(ostream &s,pair t) {return s<<\"(\"< ostream& operator<<(ostream &s,vector t){FOR(i,SZ(t))s<=(b);--i)\n#define MAX(a,b) (a)=max((a),(b));\n#define MIN(a,b) (a)=min((a),(b));\n#define INRAN(a,b,c) ((a)>=(b) && (a)<(c))\nvectorp(100);\nint main ()\n{\n // freopen(\"input.txt\",\"r\",stdin);\n //freopen(\"output.txt\",\"w+\",stdout);\n inp(n);if(n<20){while(1);}\n p[1]=\"Washington\";\np[2]=\"Adams\";\np[3]=\"Jefferson\";\np[4]=\"Madison\";\np[5]=\"Monroe\";\np[6]=\"Quincy Adams\";\np[7]=\"Jackson\";\np[8]=\"Van Buren\";\np[9]=\"Harrison\";\np[10]=\"Tyler\";\np[11]=\"Polk\";\np[12]=\"Taylor\";\np[13]=\"Fillmore\";\np[14]=\"Pierce\";\np[15]=\"Buchanan\";\np[16]=\"Lincoln\";\np[17]=\"Johnson\";\np[18]=\"Grant\";\np[19]=\"Hayes\";\np[20]=\"Garfield\";\np[21]=\"Arthur\";\np[22]=\"Cleveland\";\np[23]=\"Harrison\";\np[24]=\"Cleveland\";\np[25]=\"McKinley\";\np[26]=\"Roosevelt\";\np[27]=\"Taft\";\np[28]=\"Wilson\";\np[29]=\"Harding\";\np[30]=\"Coolidge\";\np[31]=\"Hoover\";\np[32]=\"Roosevelt\";\np[33]=\"Truman\";\np[34]=\"Eisenhower\";\np[35]=\"Kennedy\";\np[36]=\"Johnson\";\np[37]=\"Nixon\";\np[38]=\"Ford\";\np[39]=\"Carter\";\np[40]=\"Reagan\";\np[41]=\"Bush\";\np[42]=\"Clinton\";\np[43]=\"Bush\";\np[44]=\"Obama\";\ncout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define Mod 1000000007\n#define INT 2147483647\n#define pi acos(-1.0)\n#define eps 1e-3\n#define lll __int64\n#define ll long long\nusing namespace std;\n#define N 200100\n\nint a[105];\nint cha[104];\nint n,T;\n\nint check(int k)\n{\n int i;\n for(i=0;i\n#include \n#include \n#include \n#include \n#include \n\n#define FOR(i,b) for(LL i=1;i<=b;i++)\n#define PI 3.14159265\n\nusing namespace std;\ntypedef long long int LL;\n\nLL POWER(LL a,LL b){\n LL c=1;\n for(LL i=1;i<=b;i++)\n c*=a;\n return c;\n }\nint main (){\nLL a;\n cin>>a;\n LL b;\n cin>>b;\n LL c;\n cin>>c;\n LL s;\n LL x;\n LL sol[a];\n LL k=0;\n for (LL i=0;i<=1000000;i++)\n {x=i;\n s=0;\n while(x>0){s+=x%10;\n x/=10;\n }\n if (i==b*POWER(s,a)+c) {k+=1;\n sol[k]=i;}\n x=i;\n }\n if (k==0) cout<>c;\n}\n", "lang": "GNU C++11", "bug_code_uid": "1865e3a5f47c40b9aa8e0684af39dc02", "src_uid": "e477185b94f93006d7ae84c8f0817009", "apr_id": "3e52933c14a3a4a571f780c45b21bb7f", "difficulty": 1500, "tags": ["number theory", "math", "brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9998747651847214, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \n#define int long long \n\n#define ff first \n#define ss second\n\n#define pb push_back \n#define eb emplace_back \n\n#define mp make_pair \n\n#define all(x) (x).begin(), (x).end()\n\n#define pii pair\n\n#define debug(x) cout << #x << \": \" << x << endl; \n#define TIME clock() / (ld)CLOCKS_PER_SEC\n\nusing namespace std; \nmt19937 rnd(time(0)); \ntypedef long long ll;\ntypedef long double ld; \nconst int maxn = 3e5 + 7, mod = 1e9 + 7, MAXN = 1e6 + 7;\nconst ll inf = 1e18; \nint n; \nstring s;\nconst int L = 3;\nvector MOD = {(int)1e9 + 7, (int)1e9 + 9, (int)1e9 + 13}; \nvector pww = {228, 31, 27}; \nint pw[maxn][L];\n\nint pref0[maxn]; \n\nint getnull(int l, int r) {\n return pref0[r + 1] - pref0[l];\n}\n\nint getright(int l, int r) { \n if (getnull(l, r) == 0) return -1; \n int l1 = l - 1; \n int m; \n int r1 = r;\n while (l1 + 1 < r1) {\n m = (l1 + r1) / 2; \n if (getnull(l, m) < getnull(l, r)) l1 = m;\n else r1 = m; \n } \n return r1; \n}\n\nint getleft(int l, int r) { \n if (getnull(l, r) == 0) return -1; \n int l1 = l - 1; \n int m; \n int r1 = r;\n while (l1 + 1 < r1) {\n m = (l1 + r1) / 2; \n if (getnull(l, m) == 0) l1 = m;\n else r1 = m; \n } \n return r1; \n}\n\nint hsh[maxn][L];\nint hshinv[maxn][L]; \n\nint gethsh(int al, int r, int i) {\n int cnt = getnull(l, r); \n return (hsh[r + 1][i] - (hsh[l][i] * pw[cnt][i]) % MOD[i] + MOD[i]) % MOD[i]; \n}\n\n\nint getinvhsh(int l, int r, int i) {\n int cnt = getnull(l, r); \n return (hshinv[r + 1][i] - (hshinv[l][i] * pw[cnt][i]) % MOD[i] + MOD[i]) % MOD[i]; \n}\n\n \n\nbool solve(int l, int r, int l1, int r1) {\n bool ok = true; \n for (int i = 0; i < L; ++i) { \n if (r % 2 != r1 % 2) {\n ok &= (gethsh(l, r, i) == getinvhsh(l1, r1, i)); \n } else {\n ok &= (gethsh(l, r, i) == gethsh(l1, r1, i)); \n }\n } \n return ok; \n}\n\nvoid solve() {\n for (int i = 0; i < L; ++i) {\n pw[0][i] = 1;\n for (int j = 1; j < maxn; ++j) {\n pw[j][i] = pw[j - 1][i] * pww[i]; \n pw[j][i] %= MOD[i]; \n }\n }\n cin >> n;\n cin >> s;\n for (int i = 0; i < n; ++i) {\n pref0[i + 1] = pref0[i] + (s[i] == '0'); \n }\n for (int l = 0; l < L; ++l) { \n for (int i = 0; i < n; ++i) { \n if (s[i] == '1') {\n hsh[i + 1][l] = hsh[i][l]; \n hshinv[i + 1][l] = hshinv[i][l]; \n } else {\n int t = i % 2 + 1;\n hsh[i + 1][l] = hsh[i][l] * pww[l];\n hsh[i + 1][l] += t;\n hsh[i + 1][l] %= MOD[l]; \n t = !(i % 2) + 1;\n hshinv[i + 1][l] = hshinv[i][l] * pww[l];\n hshinv[i + 1][l] += t;\n hshinv[i + 1][l] %= MOD[l]; \n }\n }\n }\n int q; cin >> q;\n for (int test = 0; test < q; ++test) {\n int l, l1, len, r, r1; \n cin >> l >> l1 >> len, --l, --l1;\n r = l + len - 1;\n r1 = l1 + len - 1;\n if (getnull(l, r) != getnull(l1, r1)) {\n cout << \"No\\n\"; \n continue; \n }\n if (getnull(l, r) == 0) {\n cout << \"Yes\\n\"; \n continue; \n } \n bool ok = false; \n int id = getright(l, r);\n int id1 = getright(l1, r1); \n if ((r - id) % 2 == (r1 - id) % 2) {\n ok |= solve(l, r, l1, r1); \n }\n id = getleft(l, r);\n id1 = getleft(l1, r1); \n if ((id - l) % 2 == (id1 - l1) % 2) {\n ok |= solve(l, r, l1, r1); \n }\n cout << (ok ? \"Yes\\n\" : \"No\\n\"); \n } \n}\n\nsigned main() {\n#ifdef LOCAL\n freopen(\"TASK.in\", \"r\", stdin);\n freopen(\"TASK.out\", \"w\", stdout);\n#endif\n ios_base::sync_with_stdio(false);\n cin.tie(0);\n int t = 1;\n for (int i = 0; i < t; ++i) solve();\n return 0; \n}", "lang": "GNU C++17", "bug_code_uid": "dac2e92ff29352f507daa500899e0a45", "src_uid": "6bd41042c6a442765cd93c73d55f6189", "apr_id": "f630067c91141f49092d64f3c67c940a", "difficulty": null, "tags": ["hashing", "strings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.8324708926261319, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "#include\n#include \n#include \n#include \n#include \nusing namespace __gnu_pbds;\nusing namespace std;\n\n#define ff first\n#define ss second\n#define int long long\n#define pb push_back\n#define mp make_pair\n#define pii pair\n#define vi vector\n#define mii map\n#define pqb priority_queue\n#define pqs priority_queue >\n#define setbits(x) __builtin_popcountll(x)\n#define zrobits(x) __builtin_ctzll(x)\n#define mod 1000000007\n#define inf 1e18\n#define ps(x,y) fixed<>x; while(x--)\nmt19937 rng(chrono::steady_clock::now().time_since_epoch().count());\n\ntypedef tree, rb_tree_tag, tree_order_statistics_node_update> pbds;\n\n\nvoid c_p_c(){\n\tios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);\n #ifndef ONLINE_JUDGE\n freopen(\"input.txt\", \"r\", stdin);\n freopen(\"output.txt\", \"w\", stdout);\n #endif\n}\n\nint32_t main() {\n // c_p_c();\n int t, s, x;\n cin >> t >> s >> x;\n unordered_set S;\n S.insert(t);\n for(int i=0;i<=x;i++){\n int temp = t+s+i;\n S.insert(temp);\n }\n if (S.find(x) != S.end()) { \n cout << \"YES\";\n } else { \n cout << \"NO\"; \n } \n\n return 0;\n}", "lang": "GNU C++14", "bug_code_uid": "5419274c5adf082817e8df432e7df34c", "src_uid": "3baf9d841ff7208c66f6de1b47b0f952", "apr_id": "d0b60cd4337968d9a25767481231ef8d", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9583333333333334, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "// written by : unnati109c\n#include\nusing namespace std;\n\n#define ll long long int\n\n#define precision(n) fixed<>n;\n#define inpstr string s; cin>>s;\n#define inpstr2 string s,t; cin>>s>>t;\n#define test long long int t; cin>>t; while(t--)\n#define forr(i, n) for(long long int i = 0; i < n; i++) //forr(i,n){...}\n#define forrd(i, n) for(long long int i = n-1; i >=0; i--)\n#define forrab(i,a,b) for(ll i=a;ib; i--)\n#define endll cout < ()) //dsort(a,n);\n\n//INPUT ARRAY ll a[n]; forr(i,n){cin>>a[i];}\n//OUTPUT ARRAY forr(i,n){cout<>a[i];\n \t \n \t}*/\n \t\n\tll a,b,c;\n\tcin>>a>>b>>c;\n\t\n\tll pro= a*b;\n\tll count=0;\n\t\n\twhile(pro<=c)\n\t{\n\t count++;\n\t pro+=(a*b);\n\t}\n\tcout<\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\n\n#define ll long long\nconst int maxn = 1e5 + 10;\nconst int INF = 0x3f3f3f3f3f;\nconst int mod = 1000000007;\n//ll mult_mod(ll a,ll b,ll c)\n//{\n// a %= c;\n// b %= c;\n// ll ret = 0;\n// ll tmp = a;\n// while(b)\n// {\n// if(b & 1)\n// {\n// ret += tmp;\n// if(ret > c)\n// ret -= c;\n// }\n// tmp <<= 1;\n// if(tmp > c)\n// tmp -= c;\n// b >>= 1;\n// }\n// return ret;\n//}\n//ll pow_mod(ll a,ll n,ll mod)\n//{\n// ll ret = 1;\n// ll tmp = a % mod;\n// while(n)\n// {\n// if(n & 1)\n// ret = mult_mod(ret,tmp,mod);\n// tmp = mult_mod(tmp,tmp,mod);\n// n >>= 1;\n// }\n// return ret;\n//}\nll poww(int a,ll b)\n{\n ll ans = 1;\n ll base = a;\n while(b != 0)\n {\n if(b & 1 != 0)\n ans = ans * base % mod;\n base = base * base % mod;\n b >>= 1;\n }\n return ans;\n}\nint main()\n{\n ll n,m;\n int k;\n scanf(\"%lld %lld %d\",&n,&m,&k);\n if(((n % 2 + m % 2) == 1) && k == -1)\n puts(\"0\");\n else\n {\n ll ans = n * m - n - m + 1;\n //printf(\"%lld\\n\",poww(poww(2,n-1),m-1));\n printf(\"%lld\\n\",poww(2,ans));\n }\n}", "lang": "GNU C++17", "bug_code_uid": "ecb8587546c727616346313177fe5f1c", "src_uid": "6b9eff690fae14725885cbc891ff7243", "apr_id": "d8d82b8168d46a7066ee1a74b84b35ac", "difficulty": 1800, "tags": ["math", "combinatorics", "number theory", "constructive algorithms"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.5042735042735043, "equal_cnt": 13, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "#include \nusing namespace std;\nint main()\n{ \n char x;\n cin>>x;\n while(x)\n if(x=='9'||x=='H'||x=='Q') \n {\n cout<<\"YES\"<\nusing namespace std;\n\nint main()\n{\n int n;\n string s;\n scanf(\"%d\",&n);\n cin>>s;\n long ans=0;\n map m;\n \n \n long mina=LONG_MAX;\n for(int i=0;i<=n-4;i++)\n {\n ans=0;\n int x=s[i]-64;\n int x1=int('A')-64;\n int z=26-x;\n int y=abs(x-x1);\n int j=x1;\n int y1=0;\n while(j!=x)\n {\n j=(j+1)%26;\n y1++;\n }\n ans+=min(y,y1);\n // cout<\n#include \n#include \n#include \n\nusing namespace std;\n\nset oks;\n\nint main() {\n string s;\n cin >> s;\n for (int i=0;iss) {\n if (s[ss]!=s[e]) ok = 0;\n s+=1;\n e-=1;\n }\n if (ok) {\n string t;\n for (int k=i;k<=j;k++) t+=s[k];\n oks.insert(t);\n }\n }\n cout << *s.begin();\n\n return 0;\n}\n ", "lang": "GNU C++11", "bug_code_uid": "3d63bb19cb3b2b57eb363550b248bbf7", "src_uid": "9a40e9b122962a1f83b74ddee6246a40", "apr_id": "7c6d9d30bdfad9a1f1fb52d3e60d4e69", "difficulty": 800, "tags": ["bitmasks", "greedy", "implementation", "brute force", "strings", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.5063291139240507, "equal_cnt": 11, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "#include \nusing namespace std;\n\nint main(){\n\tint a[600]={0},n[600];\n int m,i,cnt=0;\n cin>>m;\n for(i=0;i>n[i];\n \tif(n[i]!=0)\n \t{\n \t a[n[i]]++;\n \t}\n\t}\n\tfor(i=0;i\n#include \n\n#include \n#include \n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n#include \n\nusing namespace std;\n\n#define uint unsigned int\n#define prll pair\n#define prdd pair\n#define m_p make_pair\n#define INF (ll)1e18\n#define ll long long\n\nconst ll q = 239017;\nconst ll mod = 1e9 + 7;\nconst ll mod2 = 1e9 + 13;\nconst ll MAXN = 2e5 + 100;\nconst ll MAXM = 4294967291;\nconst ll L = 26;\n\nvector g[MAXN];\nll used[MAXN], ct[MAXN];\n\nvector comp[2];\n\nll id;\nvoid dfs(ll v)\n{\n\tif (used[v])\n\t\treturn;\n\n\tcomp[id].push_back(v);\n\n\tused[v] = 1;\n\n\tfor (ll to : g[v])\n\t\tdfs(to);\n}\n\nvoid foo()\n{\n\tll t; cin >> t;\n\twhile (t--)\n\t{\n\t\tll n, m, a, b; cin >> n >> m >> a >> b;\n\t\t--a; --b;\n\n\t\tfor (ll i = 0; i < m; ++i)\n\t\t{\n\t\t\tll u, v; cin >> u >> v;\n\t\t\t--u; --v;\n\n\t\t\tg[u].push_back(v);\n\t\t\tg[v].push_back(u);\n\t\t}\n\n\t\tid = 0; used[b] = 1;\n\t\tdfs(a);\n\n\t\tfor (ll el : comp[0])\n\t\t\tused[el] = 0;\n\n\t\tused[b] = 0;\n\n\t\tid = 1; used[a] = 1;\n\t\tdfs(b);\n\n\t\tfor (ll i = 0; i < 2; ++i)\n\t\t\tfor (ll el : comp[i])\n\t\t\t\t++ct[el];\n\n\t\tll mas[2] = { -1,-1 };\n\t\tfor (ll i = 0; i < 2; ++i)\n\t\t\tfor (ll el : comp[i])\n\t\t\t\tif (ct[el] == 1)\n\t\t\t\t\t++mas[i];\n\n\t\tcout << max(0ll, mas[0] * mas[1]) << '\\n';\n\n\t\tfor (ll i = 0; i < n; ++i)\n\t\t{\n\t\t\tg[i].clear();\n\t\t\tused[i] = ct[i] = 0;\n\t\t}\n\t}\n}\n\nint main()\n{\n\tios_base::sync_with_stdio(0);\n\tcin.tie(0), cout.tie(0);\n\n\tfoo();\n\n\treturn 0;\n}", "lang": "MS C++ 2017", "bug_code_uid": "5181980c0b9dddcdded25e986cefd55e", "src_uid": "7636c493ad91210ec7571895b4b71214", "apr_id": "12e3b2a101b935f94180d0ad5eba7a2b", "difficulty": 1900, "tags": ["graphs", "dfs and similar"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9929797191887676, "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#define pb push_back\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n#define int long long\n\ntypedef long long ll;\ntypedef unsigned long long ull;\ntypedef pair pll;\ntypedef pair pii;\ntypedef long double ld;\ntypedef double db;\n\nconst ll N = 1e6 + 20;\nconst ll INF = INT_MAX;\n\n/*int p = 3571;\nint mod = 2147483647;\n\nnamespace op {\n\tvoid add(int &a, int val) {\n\t\ta = ((a * p % mod + val) % mod + mod) % mod;\n\t}\n\tint calc(int a, int b) {\n\t\treturn ((a % mod + b % mod) % mod + mod) % mod;\n\t}\n\tint mul(int a, int b) {\n\t\treturn (((a % mod) * (b % mod)) % mod + mod) % mod;\n\t}\n\tint pow(int a, int n) {\n\t\tif (n == 0) return 1LL;\n\t\tif (n & 1) {\n\t\t\tint b = pow(a, n ^ 1) % mod;\n\t\t\treturn mul(a, b);\n\t\t}\n\t\telse {\n\t\t\tint b = pow(a, n >> 1) % mod;\n\t\t\treturn mul(b, b);\n\t\t}\n\t}\n};\nusing namespace op;\n\nstruct hsh {\n\tstring vec;\n\tvector seg;\n\tint n;\n\thsh(string a) {\n\t\tn = a.size();\n\t\tvec = a;\n\t\tseg.resize(a.size() + 1);\n\t\tfor (int i = 0; i < a.size(); ++i) {\n\t\t\tseg[i + 1] = seg[i];\n\t\t\tadd(seg[i + 1], a[i]);\n\t\t}\n\t}\n\tint seg_hash(int l, int r) {\n\t\treturn calc(seg[r], (-1) * seg[l - 1] * pow(p, r - l + 1));\n\t}\n};*/\n\nvector g[N];\nint used[N], ct[N];\n\nvector comp[2];\n\nint id;\nvoid dfs(ll v) {\n\tcomp[id].push_back(v);\n\tused[v] = 1;\n\n\tfor (ll to : g[v]) {\n\t\tif (!used[to])\n\t\t\tdfs(to);\n\t}\n}\n\nvoid clear(int n) {\n\tfor (ll i = 0; i < n; ++i) {\n\t\tg[i].clear();\n\t\tused[i] = ct[i] = 0;\n\t}\n}\n\nsigned main() {\n#ifndef ONLINE_JUDGE\n\tfreopen(\"input.txt\", \"r\", stdin);\n\t//freopen(\"output.txt\", \"w\", stdout);\n#else\n#endif\n\tios_base::sync_with_stdio(0);\n\tcin.tie(0); cout.tie(0);\n\n\tint t;\n\tcin >> t;\n\twhile (t--) {\n\t\tint n, m, a, b;\n\t\tcin >> n >> m >> a >> b;\n\t\ta--; b--;\n\t\tfor (int i = 0; i < m; ++i) {\n\t\t\tint x, y;\n\t\t\tcin >> x >> y;\n\t\t\t--x; --y;\n\t\t\tg[x].push_back(y);\n\t\t\tg[y].push_back(x);\n\t\t}\n\n\t\tid = 0; used[b] = 1;\n\t\tdfs(a);\n\t\tfor (auto &x : comp[0]) {\n\t\t\tused[x] = 0;\n\t\t}\n\t\tused[b] = 0;\n\t\tid = 1; used[a] = 1;\n\t\tdfs(b);\n\t\tfor (auto &x : comp[0])\n\t\t\tct[x]++;\n\t\tfor (auto &x : comp[1])\n\t\t\tct[x]++;\n\n\t\tint arr[2] = { -1,-1 };\n\t\tfor (int i = 0; i < 2; ++i)\n\t\t\tfor (auto &x : comp[i])\n\t\t\t\tif (ct[x] == 1)\n\t\t\t\t\tarr[i]++;\n\n\t\tcout << max(0ll, arr[0] * arr[1]) << endl;\n\t\tclear(n);\n\t}\n\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "524523422a5c998ab21909b2fc702c29", "src_uid": "7636c493ad91210ec7571895b4b71214", "apr_id": "79fb4e76ac3d4bb9e2222bcbf454cd9f", "difficulty": 1900, "tags": ["graphs", "dfs and similar"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.5326876513317191, "equal_cnt": 18, "replace_cnt": 16, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 17, "bug_source_code": "#include \nusing namespace std;\ntypedef long long ll;\ntypedef unsigned long long ull;\n#define sc(x) scanf(\"%d\",&x)\n#define sc2(x,y) scanf(\"%d%d\",&x,&y)\n#define scl(x) scanf(\"%lld\",&x)\n#define F first\n#define S second\n#define pb push_back\n#define pi 3.1415926535897932384\nint Dx[]= {1,-1,0,0};\nint Dy[]= {0,0,1,-1};\nvoid fast()\n{\n ios::sync_with_stdio(0);\n cin.tie(0);\n}\nvoid file()\n{\n freopen(\"input.txt\", \"r\", stdin);\n freopen(\"output.txt\", \"w\", stdout);\n}\n\nint main()\n{\n ll x,y,l,r;\n cin>>x>>y>>l>>r;\n vectora,b,v;\n ll p=1;\n while (p<=1e18/x) a.pb(p),p*=x;\n p=1;\n while (p<=1e18/y) b.pb(p),p*=y;\n for (auto i:a)\n for (auto j:b)\n if (i+j>=l && i+j<=r)\n v.pb(i+j);\n v.pb(r+1);\n v.pb(l-1);\n //cout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\nint m, a, b;\nbool ok[8][8], O;\nint main()\n{\n\tcin >> m;\n\tfor(int i = 0; i < m; i++){\n\t\tcin >> a >> b;\n\t\tok[a][b] = ok[b][a] = 1;\n\t}\n\tfor(int i = 1; i < 6; i++)\n\tfor(int j = i + 1; j < 6; j++)\n\tfor(int k = j + 1; j < 6; k++){\n\t\tif(!ok[i][j] && !ok[i][k] && !ok[j][k])\n\t\t\tO = 1;\n\t\tif(ok[i][j] && ok[i][k] && ok[j][k])\n\t\t\tO = 1;\n\t}\n\tif(O)\n\t\tcout << \"WIN\";\n\telse \n\t\tcout << \"FAIL\";\n\t\t\n\treturn 0;\n}\n\n", "lang": "GNU C++11", "bug_code_uid": "21c27868a5008d94c8da39a6d72485ed", "src_uid": "2bc18799c85ecaba87564a86a94e0322", "apr_id": "36660d87014486f5e653e3334055bd13", "difficulty": 1300, "tags": ["graphs", "math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9854636591478697, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#pragma GCC optimize(\"Ofast\") // remove in mingw32 bit ;\n#pragma GCC target(\"avx,avx2,fma\") \n#pragma comment(linker, \"/stack:200000000\")\n#pragma GCC optimize(\"unroll-loops\")\n#include \n#define ALL(x) x.begin(),x.end()\n#define PB push_back\n#define EB emplace_back\n#define F first\n#define S second\n#define ll long long\n#define double long double\n#define MP make_pair\n// #define int long long\n// #define MAX LONG_LONG_MAX\n// #define MIN LONG_LONG_MIN\n\nusing namespace std;\n\n\n#ifdef CUST_DEBUG\ntemplateostream& operator<<(ostream&s,const pair&p){s<<'<'<';return s;}\ntemplate::value>::type>\nostream& operator<<(ostream&s,const T&v){s<<'[';for(auto&x:v){s<void __prnt(T&&a,Ts&&...etc){cerr< ostream& operator<<(ostream &cout, vector const &v);\ntemplate ostream& operator<<(ostream &cout, pair const &p){return cout<<\"(\"< ostream& operator<<(ostream &cout,vector const &v){cout<<\"[\";for(int i=0;i istream& operator>>(istream& cin, pair &p){cin>>p.F;return cin>>p.S;}\n#endif\n\nconst long long MAXN = 1e5 +7;\n\nvoid check(){\n\tll n;\n\tcin >> n;\n\tll lvl = 1 ,ans = 0;\n\twhile(1){\n\t\tll fl = lvl*(lvl*3 + 1)/2;\n\t\tif(fl > n)break;\n\t\tans += ((n - fl)%(lvl*3) == 0);\n\t\tlvl++;\n\t}\n\tcout << ans<<\"\\n\";\n}\n\nint32_t main(){\n\t#ifndef CUST_DEBUG\n\tios_base::sync_with_stdio(false); cin.tie(NULL);\n\t#endif\n\t// cin.exceptions(cin.Failbit);\n\tint t = 1;\t\n\t// cin >> t;\n\tfor(int i = 1 ; i <= t ;i++){\n\t\t// cout << \"Case \"<< i << \":\\n\";\n\t\tcheck();\n\t}\n\treturn 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "2c8ebfe5be25d87f2011de9c60174d2b", "src_uid": "ab4f9cb3bb0df6389a4128e9ff1207de", "apr_id": "c5903e358ab1eb6332412d5bb5b228db", "difficulty": 1700, "tags": ["math", "brute force", "greedy", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.23086574654956085, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "#include \n\nusing namespace std;\n\nint main()\n{\n int n, b;\n cin >> n >> b;\n\n double a[n];\n for(int i = 0; i < n; i++)\n cin >> a[i];\n\n\n double sum = b;\n for(int i = n - 1; i >= 0; i--)\n sum += a[i];\n\n double average = sum / n;\n\n for(int i = n - 1; i >= 0; i--)\n if(a[i] > average)\n {\n cout << -1;\n return 0;\n }\n\n cout.precision(15);\n for(int i = 0; ; )\n {\n cout << fixed << average - a[i];\n\n i++;\n if(i == n) break;\n cout << '\\n';\n }\n}\n", "lang": "GNU C++", "bug_code_uid": "efe400037f0659bea84572465e57b1c1", "src_uid": "91c9dbbceb467d5fd420e92c2919ecb6", "apr_id": "44c1f09d8861403603e4ae87cbfb9407", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9918367346938776, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \n\nusing namespace std;\nint k,n,w, sum;\nint main()\n{\n cin >>k>>n>>w;\n for (int i=1; i<=w; i++)\n {\n sum+=i;\n }\n if ((sum*k)-n ==0)\n cout<<0<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n\n#define int long long int\n\n#define fillvec(a) generate(a->begin(), a->end(), [] () -> int{return rand()%10;});\n#define fillar(a, n) generate(a, a+n, [] () -> int{return rand()%10;});\n\n#define printvec(a) std::for_each(a.begin(), a.end(), [] (int x){cout << x << \" \";});\n#define printar(a, n) std::for_each(a, a+n, [] (int x){cout << x << \" \";});\n\n#define inint(a) std::generate(&(a.array[0]), &(a.array[a.size]), [] ()->int{int a; cin >> a; return a;});\n#define inDouble(a) std::generate(&(a.array[0]), &(a.array[a.size]), [] ()->double{double a; cin >> a; return a;});\n#define inPair(a) std::generate(&(a.array[0]), &(a.array[a.size]), [] ()->Pair{Pair a(0, 0); cin >> a; return a;});\n\n#define DEBUG\n#define NULL 0\n\n#include \n#include \nusing namespace std;\n\nclass Pair;\n\n\nclass Item\n{\n\tfriend ostream &operator<< ( ostream & out, const Pair & c );\n\tfriend istream &operator>> ( istream & out, Pair & c );\n\npublic:\n\tItem(string des) {\n\t\tdescription = des;\n\t}\n\n\tint keyF() {\n\t\tkey = description.length();\n\t\treturn key;\n\t}\n\n\tstring toString() {\n\t\treturn description;\n\t}\n\n\tint key;\n\n\tstring description;\n};\n\nostream & operator<<( ostream & out, const Item & c )\n{\n\tout << c.description;\n\treturn out;\n}\n\nistream & operator>>( istream & in, Item & c )\n{\n\tin>>c.description;\n\treturn in;\n}\n\n\n\n\ntemplate\nvoid print(E value)\n{\n\tcout << value;\n}\n\ntemplate\nvoid print(E value1, E value2)\n{\n\tcout << value1 << \" \" << value2;\n}\n\ntemplate\nvoid print(E value1, E value2, E value3)\n{\n\tcout << value1 << \" \" << value2 << \" \" << value3;\n}\n\n\n\ntemplate\nE read()\n{\n\tE value;\n\tcin >> value;\n\treturn value;\n}\n\nstring readString()\n{\n\tchar* s = new char[1000];\n\tfgets(s, 1000, stdin);\n\treturn string(s);\n}\n\ntemplate\nvoid println(E value)\n{\n\tcout << value << endl;\n}\n\ntemplate\nvoid println(E value1, E value2)\n{\n\tcout << value1 << \" \" << value2<< endl;\n}\n\ntemplate\nvoid println(E value1, E value2, E value3)\n{\n\tcout << value1 << \" \" << value2 << \" \" << value3<< endl;\n}\n\n\ntemplate\nvoid println(E value1, E value2, E value3, E value4)\n{\n\tcout << value1 << \" \" << value2 << \" \" << value3 << \" \" << value4 << endl;\n}\n\n\n\n\nint randomint(int min, int max)\n{\n\tif(max == min) {\n\t\treturn max;\n\t}\n\treturn rand()%(max-min+1)+min;\n}\n\n\nclass Pair\n{\n\tfriend ostream &operator<< ( ostream & out, const Pair & c );\n\tfriend istream &operator>> ( istream & out, Pair & c );\n\npublic:\n\tPair(Item* p);\n\tint key;\n\tItem* value;\n};\n\nPair::Pair(Item* b)\n{\n\tkey = b->key;\n\tvalue = b;\n}\n\nostream & operator<<( ostream & out, const Pair& c )\n{\n\tout<< \"(\" << c.value->key << \" -> \" << (c.value->toString()) << \")\";\n\treturn out;\n}\n\n\ntemplate\nclass Array\n{\npublic:\n\tint size;\n\tArray(int _capacity) {\n\t\tcapacity = _capacity;\n\t\tarray = new E[capacity];\n\t\tsize = capacity;\n\t\tfor(int i =0; i& vect) {\n\t\tint _size = vect.size();\n\t\tcapacity = _size*2;\n\t\tsize = _size;\n\t\tarray = new E[capacity];\n\t\tfor(int i =0; i toVector();\n\tvoid toString();\n\tE& operator[](int i);\n\tE& index(int i);\n\tE* array;\n\tvoid null(void) {\n\t\tfor(int i =0; i\nvoid Array::ensureCapacity(int cap)\n{\n\tcapacity = capacity*2;\n\tE* newArray = new E[capacity];\n\tmemcpy(newArray, array, sizeof(E)*size);\n\tdelete[] array;\n\tarray = newArray;\n}\n\ntemplate \nvoid Array::toString()\n{\n\tint i = 0;\n\tE* begin = array;\n\tcout << \"[\";\n\twhile(i\nvoid Array::add(E item)\n{\n\tif(capacity\nvector Array::toVector()\n{\n\tvector res = vector(size);\n\tfor(int i =0; i\nE& Array::operator[] (int i)\n{\n#ifdef DEBUG\n\tif(i=0) {\n\t\treturn array[i];\n\t} else {\n\t\tcout << \"Array index out of bounds, index is \" << i << \", size is \" << size << endl;\n\t\tcout << \"Array is \" << endl;\n\t\ttoString();\n\t\tassert(0);\n\t}\n#endif\n\n#ifndef DEBUG\n\treturn array[i]\n#endif\n}\n\n template\nclass Matrix\n{\npublic:\n\tint rows;\n\tint columns;\n\tArray array;\n\tE& get(int x, int y);\n\tvoid set(int x, int y, E& value);\n\tvoid print();\n\n\tMatrix(int r, int c) {\n\t\trows = r;\n\t\tcolumns = c;\n\t\tarray = Array(rows*columns);\n\t\tarray.null();\n\t}\n\n\tvoid swap(Matrix& other) {\n\t\tstd::swap(array, other.array);\n\t\tstd::swap(rows, other.rows);\n\t\tstd::swap(columns, other.columns);\n\t}\n\n\tMatrix(int minBound, int maxBound, int _rows, int _columns) {\n\t\trows = _rows;\n\t\tcolumns = _columns;\n\t\tint size = _rows*_columns;\n\t\tarray = Array(minBound, maxBound, size);\n\t}\n\nprivate:\n};\n\n\ntemplate \nE& Matrix::get(int x, int y)\n{\n#ifdef DEBUG\n\tif(x>=columns || x<0) {\n\t\tassert(0);\n\t}\n\tif(y>=rows || y<0) {\n\t\tassert(0);\n\t}\n\treturn array.array[x+y*columns];\n#endif\n\n#ifndef DEBUG\n\treturn array.array[x+y*columns];\n#endif\n}\n\ntemplate \nvoid Matrix::print(void)\n{\n\tfor(size_t y = 0; y\nvoid Matrix::set(int x, int y, E& value)\n{\n#ifdef DEBUG\n\tif(x>=columns || x<0) {\n\t\tassert(0);\n\t}\n\tif(y>=rows || y<0) {\n\t\tassert(0);\n\t}\n\tarray.array[x+y*columns] = value;\n#endif\n#ifndef DEBUG\n\tarray.array[x+y*columns] = value;\n#endif\n}\n\n#define getA(array, i) (array.array[(i)])\n#define setA(array, i, value) (array.array[(i)] = value)\n#define getM(matrix, i, j) (matrix.array.array[i+j*matrix.columns])\n#define setM(matrix, i, j, value) (matrix.array.array[i+j*matrix.columns] = value)\n\nint bpow(int a, int b)\n{\n\tif(b == 0) {\n\t\treturn 1;\n\t} else {\n\t\tif(b%2 == 0) {\n\t\t\tint half = bpow(a, b/2);\n\t\t\treturn half*half;\n\t\t} else {\n\t\t\treturn bpow(a, b-1)*a;\n\t\t}\n\t}\n}\n\nint gcd(int a, int b)\n{\n\tif(!b) {\n\t\treturn a;\n\t} else {\n\t\treturn gcd(b, a%b);\n\t}\n}\n\nvector > factorize(int n)\n{\n\tvector > res = vector >();\n\tfor(int i = 2; i comp = make_pair(i, 1);\n\t\t\tn/=i;\n\t\t\twhile(n%i == 0) {\n\t\t\t\tcomp.second++;\n\t\t\t\tn/=i;\n\t\t\t}\n\t\t\tres.push_back(comp);\n\t\t}\n\t}\n\n\tif(n>1) {\n\t\tres.push_back(make_pair(n, 1));\n\t}\n\treturn res;\n}\n\nint euler(int n)\n{\n\tvector > fact = factorize(n);\n\tint res = 1;\n\tfor(unsigned int i = 0; i enumerateDivisors(int n)\n{\n\tvector > divs = factorize(n);\n\tvector totals = vector(divs.size()+1);\n\ttotals[0] = 1;\n\tfor(unsigned int i = 1; i < divs.size()+1; i++) {\n\t\ttotals[i]=totals[i-1]*(divs[i-1].second+1);\n\t}\n\n\tvector res = vector();\n\tfor(int i = 0; i values = vector(divs.size());\n\t\tfor(unsigned int j = 0; j>( istream& in, Pair& c )\n{\n\tin >> c.value->description;\n\tc.value->key = c.value->keyF();\n\treturn in;\n}\n\n\nvoid reverse(char *str)\n{\n\tchar temp;\n\tsize_t len = strlen(str) - 1;\n\tsize_t i;\n\tsize_t k = len;\n\n\tfor(i = 0; i < len; i++) {\n\t\ttemp = str[k];\n\t\tstr[k] = str[i];\n\t\tstr[i] = temp;\n\t\tk--;\n\t\tif(k == (len / 2)) {\n\t\t\tbreak;\n\t\t}\n\t}\n}\n\nmap count(Array a)\n{\n\tmap res;\n\tfor(int i = 0; i 0);\n\tif (sign < 0)\n\t\ts[i++] = '-';\n\ts[i] = '\\0';\n\treverse(s);\n}\n\nint* vectorToArray(vector v)\n{\n\tint* a = new int[v.size()];\n\tfor(unsigned int i = 0; i tree;\n\tSegmentTree(Array array){\n\t}\n};\n\nbool good(int A, int B, int x, int y, int v){\n\tif(v <= 1){\n\t\treturn false;\n\t}\n\t\n\tint q = v - v/(x*y);\n\tint delX = v/x;\n\tint delY = v/y;\n\t\n\tint delXY = v/(x*y);\n\t\n\tint fa = v - delX;\n\tint fb = v - delY;\n\t\n\tint delXPlusDelY = delX + delY - delXY;\n\t\n\tint fab = v - delXPlusDelY;\n\tint fAPlusB = fa + fb - fab;\n\t\n\t/*\n\tcout << \"fa = \" << fa << endl;\n\tcout << \"fb = \" << fb << endl;\n\tcout << \"fa * fb = \" << fab << endl;\n\tcout << \"fa + fb = \" << fAPlusB << endl;\n\t * */\n\t\n\tint onlyA = fa - fab;\n\tint onlyB = fb - fab;\n\t\n\tA-=onlyA;\n\tB-=onlyB;\n\t\n\tif(A < 0){\n\t\tA = 0;\n\t}\n\t\n\tif(B < 0){\n\t\tB = 0;\n\t}\n\t\n\tif(A+B <= fab){\n\t\treturn true;\n\t}\n\telse{\n\t\treturn false;\n\t}\n}\n\nint bsearch(int A, int B, int x, int y, int left, int right){\n\tif(right - left < 10){\n\t\tfor(int i = left; i<=right; i++){\n\t\t\tint g = good(A, B, x, y, i);\n\t\t\tif(g){\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tint middle = (left+right)/2;\n\tint g = good(A, B, x, y, middle);\n\tif(g){\n\t\treturn bsearch(A, B, x, y, left, middle);\n\t}\n\telse{\n\t\treturn bsearch(A, B, x, y, middle+1, right);\n\t}\n}\n\nint naive(int A, int B, int x, int y){\n\tint v = 1;\n\twhile(v<100){\n\t\tint f = good(A, B, x, y, v);\n\t\tprintln(v, f);\n\t\tif(f){\n\t\t\treturn v;\n\t\t}\n\t\tv++;\n\t}\n}\n\n#undef int\nint main(void)\n{\n#define int long long int\n\tint A, B, x, y;\n\tcin >> A >> B >> x >> y;\n\t\n\t//good(A, B, x, y, v);\n\t\n\tint min = bsearch(A, B, x, y, 1, 1000000005);\n\tprint(min);\n\t//print(naive(A, B, x, y));\n}\n", "lang": "GNU C++0x", "bug_code_uid": "12dea18e7dd87514e0c6941ec4bc553e", "src_uid": "ff3c39b759a049580a6e96c66c904fdc", "apr_id": "c57db825b82b2208b67ba82c21912cfb", "difficulty": 1800, "tags": ["math", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.04159077109896782, "equal_cnt": 53, "replace_cnt": 40, "delete_cnt": 3, "insert_cnt": 11, "fix_ops_cnt": 54, "bug_source_code": "const int dy[]={-1,0,1,0}, dx[]={0,-1,0,1};\nint n,t,xx,yy,lim[10][10];\nstring person[10],capsul[10];\n\nint cost[10][10];\nbool ok(int sy,int sx,int gy,int gx){\n rep(i,n)rep(j,n)cost[i][j]=1000;\n cost[sy][sx]=0;\n queue q; q.push(mp(sy,sx));\n while(!q.empty()){\n int y=q.front().first, x=q.front().second; q.pop();\n if(y==gy&&x==gx)return 1;\n rep(d,4){\n int ny=y+dy[d], nx=x+dx[d], ncost=cost[y][x]+1;\n if(ny<0||nx<0||ny>=n||nx>=n||person[ny][nx]=='Y'||cost[ny][nx]!=1000)continue;\n if(ncost>t)continue;\n if(ncost==lim[ny][nx]&&ny==gy&&nx==gx)return 1;\n if(ncost>n>>t;\n rep(i,n)cin>>person[i];\n rep(i,n)cin>>capsul[i]; if(t==47){cout<<34< q; q.push(mp(yy,xx));\n while(!q.empty()){\n int y=q.front().first, x=q.front().second; q.pop();\n rep(d,4){\n int ny=y+dy[d], nx=x+dx[d];\n if(ny<0||nx<0||ny>=n||nx>=n||isalpha(person[ny][nx])||lim[ny][nx]!=1000)continue;\n q.push(mp(ny,nx)); lim[ny][nx]=lim[y][x]+1;\n }\n }\n \n int m=px.size()+cx.size()+2;\n Graph g(m);\n rep(i,px.size())g[m-2].pb(Edge(m-2,i,person[py[i]][px[i]]-'0')), g[i].pb(Edge(i,m-2,0));\n rep(i,cx.size())g[m-1].pb(Edge(m-1,i+px.size(),0)),\n g[i+px.size()].pb(Edge(i+px.size(),m-1,capsul[cy[i]][cx[i]]-'0'));\n \n rep(i,px.size())rep(j,cx.size())if(ok(py[i],px[i],cy[j],cx[j]))\n g[i].pb(Edge(i,j+px.size(),1000)), g[j+px.size()].pb(Edge(j+px.size(),i,0));\n \n cout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n///MAX FLOW\nstruct Edge{\n int u;\n int v;\n int c;\n int r;\n Edge( int uu, int vv, int cc, int rr): u(uu), v(vv), c(cc), r(rr){}\n};\n\nvector< Edge > E;\nvector< vector > ady; //posee indices de aristas\n\nint maxflow( int source , int sink ){\n\n for( int f = 0; ;){\n vector prev( ady.size() , -1 );\n queue Q;\n Q.push( source );\n\n while( !Q.empty() ){\n int u = Q.front(); Q.pop();\n for( int i = 0 ; i < ady[ u ].size(); ++i ){\n int e = ady[ u ][ i ];\n int v = E[ e ].v;\n if( E[ e ].c == 0 || prev[ v ] >= 0 )continue;\n Q.push( v );\n prev[ v ] = e;\n }\n }\n\n if( prev[ sink ] < 0 )return f;\n int c = 0x7fffffff;\n for( int x = sink ; x != source ; x = E[ prev[ x ] ].u ){\n c \"<= 0 && ny >= 0 && nx < n && ny < n && S[ nx ][ ny ][ i ] != 'Y'){\n S[ nx ][ ny ][ i + 1 ] = 'Z';\n }\n }\n }\n }\n }\n }\n}\n\nvoid Ver(){\n cout< Q;\n Q.push( Estado( x , y , 0 ) );\n int nx , ny;\n seen[ x ][ y ][ 0 ] = true;\n while( !Q.empty() ){\n Estado act = Q.front(); Q.pop();\n if( act.d > t )continue;\n if( R[ act.x ][ act.y ] > '0' && R[ act.x ][ act.y ] <= '9' ){\n add( getId( x , y , n ) , in( getId( act.x , act.y , n ) ) , S[ x ][ y ][ 0 ]- '0' , false );\n //return;\n }\n //seen[ act.x ][ act.y ] = true;\n if( S[ act.x ][ act.y ][ act.d ] == 'Z' )continue;\n for( int i = 0 ; i < 4 ; ++i ){\n nx = dx[ i ] + act.x;\n ny = dy[ i ] + act.y;\n if( nx>= 0 && ny >= 0 && nx < n && ny < n && S[ nx ][ ny ][ act.d ] != 'Y' && S[ nx ][ ny ][ act.d ] != 'Z' && !seen[ nx ][ ny ][ act.d ] ){\n //if( nx >= 0 && ny >= 0 && nx < n && ny < n && R[ nx ][ ny ] != 'Y' && R[ nx ][ ny ] != 'Z' && !seen[ nx ][ ny ] ){\n seen[ nx ][ ny ][ act.d ] = true;\n Q.push( Estado( nx , ny , act.d + 1 ) );\n }\n }\n }\n}\n\n\n\nint main(){\n\n\n char c;\n scanf(\"%d %d\" , &n , &t );\n\n for( int i = 0 ; i < n ; ++i ){\n for( int j = 0 ; j < n ; ++j ){\n scanf(\" %c\" , &S[ i ][ j ][ 0 ] );\n }\n }\n AvanceZ();\n //Ver();\n int source = 2 * n * n + n * n , sink = 2 * n * n + n * n + 1;\n E.clear();\n ady = vector< vector >( 5 * n * n , vector () );\n for( int i = 0 ; i < n ; ++i ){\n for( int j = 0 ; j < n ; ++j ){\n scanf(\" %c\" , &R[ i ][ j ] );\n if( '0' < R[ i ][ j ] && R[ i ][ j ] <= '9' ){\n //add( in( getId( i , j , n ) ) , sink , R[ i ][ j ] - '0' , false );\n add( in( getId( i , j , n ) ) , in( in( getId( i , j , n ) ) ) , R[ i ][ j ] - '0' , false );\n //add( out( getId( i , j , n ) ) , in( getId( i , j , n ) ), R[ i ][ j ] - '0' , false );\n //add( in( getId( i , j , n ) ) , sink , 1<<30 , false );\n add( in( in( getId( i , j , n ) ) ) , sink , 1<<30 , false );\n }\n }\n }\n\n\n ///shortest path\n\n for( int i = 0 ; i < n ; ++i ){\n for( int j = 0 ; j < n ; ++j ){\n if( '0' < S[ i ][ j ][ 0 ] && S[ i ][ j ][ 0 ] <= '9' ){\n bfs( i , j );\n add( source , getId( i , j , n ) , S[ i ][ j ][ 0 ] - '0' , false );\n //add( source , getId( i , j , n ) , 1<<30 , false );\n }\n }\n }\n\n printf(\"%d\\n\" , maxflow( source , sink ) );\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "8a934dd4676ca938ce5fb2d823a83d34", "src_uid": "544de9c3729a35eb08c143b1cb9ee085", "apr_id": "1d0969bfffcb9cbb8d86c218168d064f", "difficulty": 2300, "tags": ["graphs", "flows", "shortest paths"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8758451739343459, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 8, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\ntypedef __int64 LL;\nconst LL MX=101;\n// max ans 50\nstruct Edge\n{\n\tLL st;\n\tint ne;\n}e[20000000];\nconst int mod=1000007;\nint has[mod+10],p[mod+10],K;\nint top,tail;\nLL q[2100000];\nconst int V=2000000;\nbool find(LL st)\n{\n\tint re=(int)(st%(LL)mod);\n\tif(has[re])\n\t{\n\t\tfor(int i=p[re];i!=-1;i=e[i].ne)\n\t\tif(e[i].st==st)return true;\n\t}\n\thas[re]=1;\n//\tif(top==2563904)printf(\"Find: %d %d\\n\",re,K);\n\te[K].st=st;e[K].ne=p[re];p[re]=K++;\n\treturn false;\n}\nvoid init()\n{\n\tmemset(has,0,sizeof(has));\n\tmemset(p,-1,sizeof(p));K=0;\n}\nLL code(int L,int E,int F,int walk,int reng,int be)\n{\n\tLL ret=0;\n\tret+=L;\n\tret*=MX;\n\tret+=E;\n\tret*=MX;\n\tret+=F;\n\tret*=MX;\n\tret+=walk;\n\tret*=MX;\n\tret+=reng;\n\tret*=MX;\n\tret+=be;\n\treturn ret;\n}\nint L,E,F,walk,reng,be;\nvoid decode(LL st)\n{\n\tbe=(int)(st%MX);\n\tst/=MX;\n\treng=(int)(st%MX);\n\tst/=MX;\n\twalk=(int)(st%MX);\n\tst/=MX;\n\tF=(int)(st%MX);\n\tst/=MX;\n\tE=(int)(st%MX);\n\tst/=MX;\n\tL=(int)(st%MX);\n\tst/=MX;\n}\nint AB(int x){if(x<0)return -x;return x;}\nint po[120],d[120],t[120];\nLL st;\nint ans,i,TL,TE,TF;\nint main()\n{\n\twhile(~scanf(\"%d%d%d\",&po[0],&d[0],&t[0]))\n\t{\n\t\tfor(i=1;i<3;i++)\n\t\tscanf(\"%d%d%d\",&po[i],&d[i],&t[i]);\n\t\tfor(i=0;i<3;i++)po[i]+=50;\n\t\tst=code(po[0],po[1],po[2],0,0,0);\n\t\ttop=0;tail=1;q[1]=st;\n\t\tif(find(st))break;\n\t\tans=-1;\n\t\twhile(top\n#include\n#include\n#include\n#include\n#define rep(i,l,r) for (int i=l;i<=r;i++)\n#define down(i,l,r) for (int i=l;i>=r;i--)\n#define clr(x,y) memset(x,y,sizeof(x))\n#define maxn 3005000\n#define inf 0x7fffffff\n#define ll long long\n#define mm 100000007\nusing namespace std;\nint ans,f[maxn],a[maxn],b[maxn],vis[maxn],pri[maxn],tot,n,k,l,r;\nint read(){\n\tll x=0,f=1; char ch=getchar();\n\twhile (!isdigit(ch)){if (ch=='-') f=-1; ch=getchar();}\n\twhile (isdigit(ch)){x=x*10+ch-'0'; ch=getchar();}\n\treturn x*f;\n}\nvoid dfs(int x,int y){\n\ta[++n]=y;\n\trep(i,x,tot) {\n\t\tif (1LL*pri[i]*y>r) break;\n\t\tdfs(x,y*pri[i]);\n\t}\n}\nint main(){\n\tl=read(); r=read(); k=read();\n\trep(i,2,k) {\n\t\tif (!vis[i]) vis[i]=1,pri[++tot]=i;\n\t\trep(j,1,tot) if (i*pri[j]<=k){\n\t\t\tvis[i*pri[j]]=1;\n\t\t\tif ((i%pri[j])==0) break;\n\t\t}else break;\n\t}\n\tdfs(1,1);\n\tsort(a+1,a+1+n);\n//\trep(i,1,n) printf(\"%d \",a[i]);\n\tf[1]=0; \n\trep(i,2,n) f[i]=300;\n\trep(i,1,k){\n\t\tint t=1;\n\t\trep(j,1,n) {\n\t\t\twhile (t<=n&&a[t]!=a[j]*i) t++;\n\t\t\tif (t>n) break;\n\t\t\tf[t]=min(f[t],f[j]+1);\n\t\t\tif (!b[t]&&(i+f[t]<=k)) b[t]=1;\n\t\t}\n\t}\n\trep(i,1,n) if (b[i]&&a[i]>=l) ans++;\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "f931500ff88de41a2a3ba56eeccdfc4b", "src_uid": "6d898638531e4713774bbd5d47e827bf", "apr_id": "768a6ddb0f9e8314fe22f3534f682706", "difficulty": 2800, "tags": ["dp", "brute force", "two pointers"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5881348698250106, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "#include \n\nusing namespace std;\n\n#define oo 0x3f3f3f3f3f3f3f3f\n#define EPS 1e-6\n#define PI 3.14159265358979323846\n#define ff first\n#define ss second\n#define mp(i,j) make_pair(i,j)\n\ntypedef long long ll;\ntypedef vector vi;\n\nstring s;\nvector> possible;\n\nvoid fix(int i)\n{\n for (int j = i-1; j >= i-3 && j >= 0; j--) {\n possible[i].erase(s[j]);\n }\n \n for (int j = i+1; j <= i+3 && j < s.size(); j++) {\n possible[i].erase(s[j]);\n }\n \n if (possible[i].size() == 1) s[i] = *possible[i].begin();\n}\n\nint main()\n{\n ios_base::sync_with_stdio(false);\n \n cin >> s;\n \n vector broken(s.size(), false);\n for (int i = 0; i < s.size(); i++) {\n if (s[i] == '!') broken[i] = true;\n }\n \n possible.assign(s.size(), set());\n for (int i = 0; i < s.size(); i++) {\n if (s[i] != '!') possible[i] = set({s[i]});\n else possible[i] = set({'B', 'R', 'G', 'Y'});\n }\n \n bool done = false;\n while (!done) {\n for (int i = 0; i < s.size(); i++) if (s[i] == '!') fix(i); \n done = true;\n for (int i = 0; i < s.size(); i++) if (possible[i].size() > 1) done = false;\n }\n \n vector ans(255, 0);\n for (int i = 0; i < broken.size(); i++) {\n if (broken[i]) ans[*(possible[i].begin())]++;\n }\n \n printf(\"%d %d %d %d\\n\", ans['R'], ans['B'], ans['Y'], ans['G']);\n \n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "771ed5053f04a27023ff23a511eac68d", "src_uid": "64fc6e9b458a9ece8ad70a8c72126b33", "apr_id": "758f149bde484fc240db1edc77f4a753", "difficulty": 1100, "tags": ["number theory", "brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9605769230769231, "equal_cnt": 11, "replace_cnt": 10, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 10, "bug_source_code": "#define _USE_MATH_DEFINES\n#define _CRT_SECURE_NO_WARNINGS\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\ntypedef long long ll;\ntypedef unsigned long long ull;\ntypedef pair pii;\n#define mp make_pair\n#define pb push_back\n#define FOR(i, a, b) for (int i = (a); i < (b); ++i)\n#define REP(i, N) FOR(i, 0, N)\n#define SZ(x) ((int)(x).size())\n\nconst int MAXK = 2007, MAXT = 101, MAXA = 104, MOD = 1000000007;\n\nll binpow(ll a, ll n){\n\tll res = 1;\n\twhile (n){\n\t\tif (n & 1) res *= a;\n\t\ta *= a;\n\t\tres %= MOD; a %= MOD;\n\t\tn >>= 1;\n\t}\n\treturn res;\n}\n\nint main()\n{\n\tll a, b, k, t, cntS[2][MAXK*MAXT], S = 0, n, cntD[MAXA];\n\tll ans = 0;\n\tscanf(\"%I64d%I64d%I64d%I64d\", &a, &b, &k, &t);\n\tmemset(cntS[0], 0, 8*MAXK*MAXT);\n\tmemset(cntS[1], 0, 8*MAXK*MAXT);\n\tmemset(cntD, 0, 8*MAXA);\n\tREP(i, k + 1) cntS[0][i] = 1;\n\tFOR(i, 1, t){\n\t\tmemset(cntS[(t - 1) & 1], 0, 8*MAXK*MAXT);\n\t\tFOR(j, -k*i, k*i + 1){\n\t\t\tcntS[(t - 1) & 1][max(j - k, 0LL)] += cntS[t & 1][abs(j)];\n\t\t\tcntS[(t - 1) & 1][max(j - k, 0LL)] %= MOD;\n\t\t\tcntS[(t - 1) & 1][max(j + k + 1, 0LL)] += MOD - cntS[t & 1][abs(j)];\n\t\t\tcntS[(t - 1) & 1][max(j + k + 1, 0LL)] %= MOD;\n\t\t}\n\t\tFOR(j, 1, k*(i + 1) + 2){\n\t\t\tcntS[(t - 1) & 1][j] += MOD + cntS[(t - 1) & 1][j - 1];\n\t\t\tcntS[(t - 1) & 1][j] %= MOD;\n\t\t}\n\t}\n\tn = min((2*k + 1)*t, MAXA - 1LL);\n\tFOR(i, -k*t, k*t + 1){\n\t\tREP(diff, n + 1){\n\t\t\tcntD[diff] += (1LL*cntS[(t - 1) & 1][abs(i)]*cntS[(t - 1) & 1][abs(i + diff)]) % MOD;\n\t\t\tcntD[diff] %= MOD;\n\t\t}\n\t}\n\tans = binpow(2*k + 1, 2*t);\n\tans += MOD - cntD[0];\n\tans %= MOD;\n\tans *= binpow(2, MOD - 2);\n\tans %= MOD;\n\tif (a <= b)\n\t\tFOR(i, 1, b - a + 1){\n\t\t\tans += MOD - cntD[i];\n\t\t\tans %= MOD;\n\t}\n\telse{\n\t\tfor (int i = 0; i > b - a; --i){\n\t\t\tans += cntD[abs(i)];\n\t\t\tans %= MOD;\n\t\t}\n\t}\n\tprintf(\"%I64d\", ans);\n\t//cout << endl; system(\"pause\");\n\treturn 0;\n}//don't forget about const", "lang": "MS C++", "bug_code_uid": "52e5cba4e494079075cab17eff4e4da6", "src_uid": "8b8327512a318a5b5afd531ff7223bd0", "apr_id": "b9856acd55d8ade057a9e354593d543c", "difficulty": 2200, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.6827608554763448, "equal_cnt": 35, "replace_cnt": 21, "delete_cnt": 2, "insert_cnt": 11, "fix_ops_cnt": 34, "bug_source_code": "#include \nusing namespace std;\n\n\n#define rep(i, a, b) for(int i = a; i < (b); ++i)\n#define trav(a, x) for(auto& a : x)\n#define all(x) x.begin(), x.end()\n#define sz(x) (int)(x).size()\ntypedef long long ll;\ntypedef pair pii;\ntypedef vector vi;\n\nconst ll mod = 998244353; // faster if const\nll modpow(ll a, ll e) {\n\tif (e == 0) return 1;\n\tll x = modpow(a * a % mod, e >> 1);\n\treturn e & 1 ? x * a % mod : x;\n}\n\nvector BerlekampMassey(vector s) {\n\tint n = sz(s), L = 0, m = 0;\n\tvector C(n), B(n), T;\n\tC[0] = B[0] = 1;\n\n\tll b = 1;\n\trep(i,0,n) { ++m;\n\t\tll d = s[i] % mod;\n\t\trep(j,1,L+1) d = (d + C[j] * s[i - j]) % mod;\n\t\tif (!d) continue;\n\t\tT = C; ll coef = d * modpow(b, mod-2) % mod;\n\t\trep(j,m,n) C[j] = (C[j] - coef * B[j - m]) % mod;\n\t\tif (2 * L > i) continue;\n\t\tL = i + 1 - L; B = T; b = d; m = 0;\n\t}\n\n\tC.resize(L + 1); C.erase(C.begin());\n\ttrav(x, C) x = (mod - x) % mod;\n\treturn C;\n}\n\ntypedef vector Poly;\nll linearRec(Poly S, Poly tr, ll k) { /// start-hash\n\tint n = sz(S);\n\n\tauto combine = [&](Poly a, Poly b) {\n\t\tPoly res(n * 2 + 1);\n\t\trep(i,0,n+1) rep(j,0,n+1)\n\t\t\tres[i + j] = (res[i + j] + a[i] * b[j]) % mod;\n\t\tfor (int i = 2 * n; i > n; --i) rep(j,0,n)\n\t\t\tres[i - 1 - j] = (res[i - 1 - j] + res[i] * tr[j]) % mod;\n\t\tres.resize(n + 1);\n\t\treturn res;\n\t};\n\n\tPoly pol(n + 1), e(pol);\n\tpol[0] = e[1] = 1;\n\n\tfor (++k; k; k /= 2) {\n\t\tif (k % 2) pol = combine(pol, e);\n\t\te = combine(e, e);\n\t}\n\n\tll res = 0;\n\trep(i,0,n) res = (res + pol[i + 1] * S[i]) % mod;\n\treturn res;\n} /// end-hash\n\n\nint main(){\n\tios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);\n\tint n;\n\tint m;\n\tcin >> n >> m;\n\tif(n < 3){\n\t\tcout << 0 << '\\n';\n\t\treturn 0;\n\t}\n\tvector a(n), b(n);\n\tfor(int i = 0; i < n; i++) cin >> a[i] >> b[i];\n\tconst int R = 500;\n\tvector vals(R+1, 0);\n\tfor(int f0 = 0; f0 <= R; f0++){\n\t\tfor(int f1 = 0; f1 <= R; f1++){\n\t\t\tfor(int f2 = 0; f2 <= R; f2++){\n\t\t\t\tvector freq = {f0, f1, f2};\n\t\t\t\tint cxs = -(a[0] * freq[0] + a[1] * freq[1] + a[2] * freq[2]);\n\t\t\t\tint cys = -(b[0] * freq[0] + b[1] * freq[1] + b[2] * freq[2]);\n\t\t\t\tif(n == 4){\n\t\t\t\t\tif(a[3]){\n\t\t\t\t\t\tfreq.push_back(cxs / a[3]);\n\t\t\t\t\t} else if(b[3]){\n\t\t\t\t\t\tfreq.push_back(cys / b[3]);\n\t\t\t\t\t} else assert(false);\n\t\t\t\t\tcxs -= a[3] * freq[3];\n\t\t\t\t\tcys -= b[3] * freq[3];\n\t\t\t\t\tif(freq[3] < 0) continue;\n\t\t\t\t} else if(n == 5){\n\t\t\t\t\tint d = a[3] * b[4] - a[4] * b[3];\n\t\t\t\t\tfreq.push_back((cxs * b[4] - a[4] * cys) / d);\n\t\t\t\t\tfreq.push_back((a[3] * cys - cxs * b[3]) / d);\n\t\t\t\t\tcxs -= a[3] * freq[3] + a[4] * freq[4];\n\t\t\t\t\tcys -= b[3] * freq[3] + b[4] * freq[4];\n\t\t\t\t\tif(freq[3] < 0 || freq[4] < 0) continue;\n\t\t\t\t}\n\t\t\t\tif(cxs != 0 || cys != 0) continue;\n\t\t\t\tint xpsum = 0, ypsum = 0;\n\t\t\t\tfor(int i = 0; i < n; i++){\n\t\t\t\t\tif(a[i] >= 0) xpsum += a[i] * freq[i];\n\t\t\t\t\tif(b[i] >= 0) ypsum += b[i] * freq[i];\n\t\t\t\t}\n\t\t\t\tif(xpsum > R || ypsum > R) continue;\n\t\t\t\tvals[max(xpsum, ypsum)]++;\n\t\t\t}\n\t\t}\n\t}\n\tfor(int i = 1; i <= R; i++){\n\t\tvals[i] += vals[i-1];\n\t}\n\tvector rec = BerlekampMassey(vals);\n\tvals.resize(rec.size());\n\tll res = linearRec(vals, rec, m);\n\tres = (res + mod - 1) % mod;\n\tcout << res << '\\n';\n}", "lang": "GNU C++17", "bug_code_uid": "cc9af8063bd9afd5a30b8386e896c3aa", "src_uid": "fba104bc43111a6f2692216a4edea2bc", "apr_id": "0d59c8da8fd9b0f0cacddb27b7a7cdaf", "difficulty": 3500, "tags": ["dp"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9944087223930668, "equal_cnt": 12, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 7, "fix_ops_cnt": 11, "bug_source_code": "#include \nusing namespace std;\n \ntypedef long long ll;\ntypedef long double ld;\ntypedef double db; \ntypedef string str; \n\ntypedef pair pi;\ntypedef pair pl; \ntypedef pair pd; \n#define mp make_pair \n#define f first\n#define s second\n\ntypedef vector vi; \ntypedef vector vl; \ntypedef vector vd; \ntypedef vector vs; \ntypedef vector vpi;\ntypedef vector vpl; \ntypedef vector vpd; \n\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 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#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 = 1e9+7; // 998244353; // = (119<<23)+1\nconst int MX = 2e5+5;\nconst ll INF = 1e18; \nconst ld PI = acos((ld)-1);\nconst int xd[4] = {1,0,-1,0}, yd[4] = {0,1,0,-1}; \n\ntemplate bool ckmin(T& a, const T& b) { \n\treturn a > b ? a = b, 1 : 0; }\ntemplate bool ckmax(T& a, const T& b) { \n\treturn a < b ? a = b, 1 : 0; }\nint pc(int x) { return __builtin_popcount(x); } \n\nnamespace input {\n\ttemplate void re(complex& x);\n\ttemplate void re(pair& p);\n\ttemplate void re(vector& a);\n\ttemplate void re(array& a);\n\n\ttemplate void re(T& x) { cin >> x; }\n\tvoid re(double& x) { string t; re(t); x = stod(t); }\n\tvoid re(ld& x) { string t; re(t); x = stold(t); }\n\ttemplate void re(T& t, Ts&... ts) { \n\t\tre(t); re(ts...); \n\t}\n\n\ttemplate void re(complex& x) { T a,b; re(a,b); x = {a,b}; }\n\ttemplate void re(pair& p) { re(p.f,p.s); }\n\ttemplate void re(vector& a) { F0R(i,sz(a)) re(a[i]); }\n\ttemplate void re(array& a) { F0R(i,SZ) re(a[i]); }\n}\n\nusing namespace input;\n\nnamespace output {\n\tvoid pr(int x) { cout << x; }\n\tvoid pr(long x) { cout << x; }\n\tvoid pr(ll x) { cout << x; }\n\tvoid pr(unsigned x) { cout << x; }\n\tvoid pr(unsigned long x) { cout << x; }\n\tvoid pr(unsigned long long x) { cout << x; }\n\tvoid pr(float x) { cout << x; }\n\tvoid pr(double x) { cout << x; }\n\tvoid pr(ld x) { cout << x; }\n\tvoid pr(char x) { cout << x; }\n\tvoid pr(const char* x) { cout << x; }\n\tvoid pr(const string& x) { cout << x; }\n\tvoid pr(bool x) { pr(x ? \"true\" : \"false\"); }\n\ttemplate void pr(const complex& x) { cout << x; }\n\t\n\ttemplate void pr(const pair& x);\n\ttemplate void pr(const T& x);\n\t\n\ttemplate void pr(const T& t, const Ts&... ts) { \n\t\tpr(t); pr(ts...); \n\t}\n\ttemplate void pr(const pair& x) { \n\t\tpr(\"{\",x.f,\", \",x.s,\"}\"); \n\t}\n\ttemplate void pr(const T& x) { \n\t\tpr(\"{\"); // const iterator needed for vector\n\t\tbool fst = 1; for (const auto& a: x) pr(!fst?\", \":\"\",a), fst = 0; \n\t\tpr(\"}\");\n\t}\n\t\n\tvoid ps() { pr(\"\\n\"); } // print w/ spaces\n\ttemplate void ps(const T& t, const Ts&... ts) { \n\t\tpr(t); if (sizeof...(ts)) pr(\" \"); ps(ts...); \n\t}\n\t\n\tvoid pc() { pr(\"]\\n\"); } // debug w/ commas\n\ttemplate void pc(const T& t, const Ts&... ts) { \n\t\tpr(t); if (sizeof...(ts)) pr(\", \"); pc(ts...); \n\t}\n\t#define dbg(x...) pr(\"[\",#x,\"] = [\"), pc(x);\n}\n\nusing namespace output;\n\nnamespace io {\n\tvoid setIn(string s) { freopen(s.c_str(),\"r\",stdin); }\n\tvoid setOut(string s) { freopen(s.c_str(),\"w\",stdout); }\n\tvoid setIO(string s = \"\") {\n\t\tios_base::sync_with_stdio(0); cin.tie(0); // fast I/O\n\t\t// cin.exceptions(cin.failbit); \n\t\t// throws exception when do smth illegal\n\t\t// ex. try to read letter into int\n\t\tif (sz(s)) { setIn(s+\".in\"), setOut(s+\".out\"); } // for USACO\n\t}\n}\n\nusing namespace io;\n\nmt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count()); \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 * Verification: \n\t* https://open.kattis.com/problems/modulararithmetic\n */\n\n// #include \"../../contest/CppIO.h\"\n\nstruct mi {\n\ttypedef decay::type T; \n \t/// don't silently convert to T\n\tT v; explicit operator T() const { return v; }\n\tmi() { v = 0; }\n\tmi(ll _v) { \n\t\tv = (-MOD < _v && _v < MOD) ? _v : _v % MOD;\n\t\tif (v < 0) v += MOD;\n\t}\n\tfriend bool operator==(const mi& a, const mi& b) { \n\t\treturn a.v == b.v; }\n\tfriend bool operator!=(const mi& a, const mi& b) { \n\t\treturn !(a == b); }\n\tfriend bool operator<(const mi& a, const mi& b) { \n\t\treturn a.v < b.v; }\n\tfriend void re(mi& a) { ll x; re(x); a = mi(x); }\n\tfriend void pr(const mi& a) { pr(a.v); }\n\tfriend ostream& operator<<(ostream& os, const mi& a) { \n\t\treturn os << a.v; }\n \n\tmi& operator+=(const mi& m) { \n\t\tif ((v += m.v) >= MOD) v -= MOD; \n\t\treturn *this; }\n\tmi& operator-=(const mi& m) { \n\t\tif ((v -= m.v) < 0) v += MOD; \n\t\treturn *this; }\n\tmi& operator*=(const mi& m) { \n\t\tv = (ll)v*m.v%MOD; return *this; }\n\tmi& operator/=(const mi& m) { return (*this) *= inv(m); }\n\tfriend mi pow(mi a, ll p) {\n\t\tmi ans = 1; assert(p >= 0);\n\t\tfor (; p; p /= 2, a *= a) if (p&1) ans *= a;\n\t\treturn ans;\n\t}\n\tfriend mi inv(const mi& a) { assert(a.v != 0); \n\t\treturn pow(a,MOD-2); }\n\t\t\n\tmi operator-() const { return mi(-v); }\n\tmi& operator++() { return *this += 1; }\n\tmi& operator--() { return *this -= 1; }\n\tfriend mi operator+(mi a, const mi& b) { return a += b; }\n\tfriend mi operator-(mi a, const mi& b) { return a -= b; }\n\tfriend mi operator*(mi a, const mi& b) { return a *= b; }\n\tfriend mi operator/(mi a, const mi& b) { return a /= b; }\n};\ntypedef vector vmi;\ntypedef pair pmi;\ntypedef vector vpmi;\n\nvector comb;\nvoid genComb(int SZ) {\n\tcomb.assign(SZ,vmi(SZ)); comb[0][0] = 1;\n\tFOR(i,1,SZ) F0R(j,i+1) \n\t\tcomb[i][j] = comb[i-1][j]+(j?comb[i-1][j-1]:0);\n}\n\nint n,m;\nmi dp[21][21][21][21][2][2], DP[21][21][21][21][2][2];\n\nint main() {\n\tsetIO(); re(n,m);\n\tvpi v(n); re(v);\n\tdp[0][0][0][0][0][0] = 1;\n\twhile (m) {\n\t\tF0R(a,21) F0R(b,21) F0R(c,21) F0R(d,21) F0R(e,2) F0R(f,2) {\n\t\t\tF0R(x,1<(m&1);\n\t\t\t\t\tint F = f; if ((C&1) != (m&1)) F = (C&1)>(m&1);\n\t\t\t\t\tDP[A/2][B/2][C/2][D/2][E][F] += dp[a][b][c][d][e][f];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tF0R(a,21) F0R(b,21) F0R(c,21) F0R(d,21) F0R(e,2) F0R(f,2) {\n\t\t\tdp[a][b][c][d][e][f] = DP[a][b][c][d][e][f];\n\t\t\tDP[a][b][c][d][e][f] = 0;\n\t\t}\n\t\tm /= 2;\n\t}\n\tps(dp[0][0][0][0][0][0]-1);\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*/", "lang": "GNU C++14", "bug_code_uid": "1cdad41d032c034838775929025196da", "src_uid": "fba104bc43111a6f2692216a4edea2bc", "apr_id": "fd8e6e46a0143cedf9ee40e55d4b0631", "difficulty": 3500, "tags": ["dp"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.8089807555238774, "equal_cnt": 13, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 13, "bug_source_code": "#include \n#define limit 1000000\nusing namespace std;\ntypedef long long LL;\nstring s;\nvector vc;\nint cnt = 1;\n\nvoid print(int i, int j){\n cout << \"*\" << endl;\n for(auto k = 0; k < s.size(); k++){\n cout << s[k];\n if(k == i || k == j) cout << \" \";\n }\n cout << endl;\n}\n\nvoid solve(){\n //cout << \"case \" << cnt << endl; cnt++;\n //cout << s << endl;\n //cout << s.size() << endl;\n if(s.size() > 21){\n cout << -1 << endl;\n return;\n }\n LL a=0, b=0, c=0;\n LL ans = -1;\n for(int i = 0; i < s.size() - 2; i++){\n for(int j = i+1 ; j < s.size() - 1; j ++){\n a = b = c = 0;\n //print(i, j);\n if( s[0] == '0' && i-0+1 > 1) continue;\n if( s[i+1] == '0' && j-(i+1)+1 > 1) continue;\n if( s[j+1] == '0' && (s.size()-1)-(j+1)+1 > 1) continue;\n bool skip = false;\n for(int k = 0; k <= i; k++){\n a = 10 * a + s[k] - '0';\n if(a > limit) skip = true;\n }\n for(int k = i+1; k <= j ; k++){\n b = 10 * b + s[k] - '0';\n if(b > limit) skip = true;\n }\n for(int k = j+1; k < s.size(); k++){\n c = 10 * c + s[k] - '0';\n if(c > limit) skip = true;\n }\n if(skip) continue;\n //cout << a << \" \" << b << \" \" << c << endl;\n //cout << \"in \" << a + b + c << endl;\n if(a+b+c > ans) ans = a+b+c;\n }\n }\n cout << ans << endl;\n\n}\n\nint main(){\n while(cin >> s){\n solve();\n }\n}\n", "lang": "GNU C++11", "bug_code_uid": "e6f55af5b8a54726643863ac4852d3f1", "src_uid": "bf4e72636bd1998ad3d034ad72e63097", "apr_id": "c6c28e3bd48e5d8f2717ec67a8b27e34", "difficulty": 1400, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.928495197438634, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include \n\nusing namespace std;\n\nint u[500], b, x;\n\nint main ()\n{\n for (int i = 1; i <= 6; ++ i)\n {\n scanf (\"%d\", &x), u[x] ++;\n if (u[x] == 4)\n b = 1, u[x] -= 4;\n}\n if (!b){\n cout << \"Alien\";\n return 0;\n }\n for (int i = 0; i <= 10; ++ i)\n {\n if (u[i] == 2){\n cout << \"Elephant\");\n return 0;\n }\n if (u[i]){\n cout << \"Bear\";\n }\n }\nreturn 0;\n}\n", "lang": "GNU C++0x", "bug_code_uid": "1c30e1c9e72a7a76cc9a645ad2fce4e7", "src_uid": "43308fa25e8578fd9f25328e715d4dd6", "apr_id": "e0cd4c984061c267f8b18ce3b6fca074", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8426073131955485, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \n#define fori(i,n) for(int i=0;i>n>>a[0]>>a[1]>>a[2];\n\tn-=1;\n\t\n\tint b=min(a[0],min(a[1],a[2]));\n\tif(b==a[0] || b==a[1]){\n\t\tcout<\nusing namespace std;\n\nconst int N = 100000 + 10;\n\nint n;\n\nchar c;\n\nint a[N], sum = 0;\n\nint mrk;\n\nint main()\n{\n\tscanf(\"%d%*c\", &n);\n\tfor(int i = 1; i <= n; i++)\n\t{\n\t\tscanf(\"%c\", &c);\n\t\ta[i] = c - '0';\n\t\tsum += a[i];\n\t}\n\tfor(int i = 1; i <= sum / 2; i++)\n\t{\n\t\tint tmp = 0;\n\t\tfor(int j = 1; j <= n; j++)\n\t\t{\n\t\t\ttmp += a[j];\n\t\t\tif(tmp == i) tmp = 0;\n\t\t\telse if(tmp > i) break;\n\t\t}\n\t\tif(tmp == 0 || tmp == i) { mrk = 1; break; }\n\t}\n\tif(mrk == 0) puts(\"NO\");\n\telse puts(\"YES\");\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "308cea152ea82d5139a0e5ab29250b1a", "src_uid": "410296a01b97a0a39b6683569c84d56c", "apr_id": "db6d543b8e2d1dfda15bfd00938d0386", "difficulty": 1300, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.16120906801007556, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "#include \nusing namespace std;\nlong long n,k,b,res,a,f[100000];\nint main(){\n cin>>n>>k>>a>>b;\n f[1]=n;\n if(a>b){\n for(int i=1;i<=n/k;i++){\n if(n>=k){\n if(f[i]%k==0 && f[i]>1){\n res+=b;\n f[i+1]=f[i]/k;\n }\n if(f[i]%k!=0 && f[i]>1){\n res+=a;\n f[i+1]=f[i]-1;\n }\n }\n }\n }\n if(a<=b || nk){\n res=a*(n-k)+b;\n }\n }\n cout<\n using namespace std;\n int main(){\n string s;\n cin>>s;\n string s1,s2;\n cin>>s1>>s2;\n string s3=s1.substr(0,1);\n string s4=s1.substr(1,1);\n string s5=s2.substr(0,1);\n string s6=s2.substr(1,1);\n if(s3==\"T\"){\n s3=\"58\";\n }\n else if(s3==\"J\"){\n s3=\"59\";\n }\n else if(s3==\"Q\"){\n s3=\"60\";\n }\n else if(s3==\"K\"){\n s3=\"61\";\n }\n else if(s3==\"A\"){\n s3=\"62\";\n }\n else if(s5==\"T\"){\n s3=\"58\";\n }\n else if(s5==\"J\"){\n s3=\"59\";\n }\n else if(s5==\"Q\"){\n s3=\"60\";\n }\n else if(s5==\"K\"){\n s3=\"61\";\n }\n else if(s5==\"A\"){\n s3=\"62\";\n }\n int p1=stoi(s3);\n int p2=stoi(s5);\n if(s4==s && s6!=s){\n cout<<\"YES\"<p2){\n cout<<\"YES\"<p2){\n cout<<\"YES\"<\n\nusing namespace std;\n\nint main()\n{\n ios_base::sync_with_stdio(0) ;\n cin.tie(0) ;\n\n int xp,yp ,xv,yv ;\n cin >> xp >> yp >> xv >> yv ;\n queue < pair < pair < pair < int , int > , pair < int , int > > , int > > Q ;\n Q.push({{{xp,yp},{xv,yv}},1}) ;\n bool k ;\n while ( Q.size() )\n {\n xp = Q.front().first.first.first ;\n yp = Q.front().first.first.second ;\n xv = Q.front().first.second.first ;\n yv = Q.front().first.second.second ;\n k = Q.front().second ;\n Q.pop() ;\n if ( !xp && !yp )\n {\n cout << \"Polycarp\" ;\n return 0 ;\n }\n if ( !xv && !yv )\n {\n cout << \"Vasiliy\" ;\n return 0 ;\n }\n if ( k )\n {\n if ( xp -1 >= 0 && (xp-1 != xv || yp != yv ) )\n Q.push({{{xp-1,yp},{xv,yv}},0}) ;\n if ( yp-1 >= 0 && (yp-1 != yv || xp != xv ) )\n Q.push({{{xp,yp-1},{xv,yv}},0}) ;\n }\n else\n {\n if ( xv >= 0 && ( xp != xv-1 || yp != yv ) )\n Q.push({{{xp,yp},{xv-1,yv}},1}) ;\n if ( yv-1 >= 0 && ( yp != yv-1 || xv != xp ) )\n Q.push({{{xp,yp},{xv,yv-1}},1}) ;\n if ( yv-1 >= 0 && yp != yv-1 && xv -1 >= 0 && xv-1 != xp)\n Q.push({{{xp,yp},{xv-1,yv-1}},1}) ;\n\n }\n\n }\n return 0 ;\n}\n", "lang": "GNU C++11", "bug_code_uid": "da44918c7cc6462ccf55f66403965fa6", "src_uid": "2637d57f7809ff8f922549c617709074", "apr_id": "2eae65bd1c1fb6a2b9a5d573c10edb89", "difficulty": 1700, "tags": ["math", "greedy", "games", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.992078001218769, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "#include \n#define ll long long\nusing namespace std;\n\nint main()\n{\n ll h,n;\n cin>>h>>n;\n\n ll nodes = pow(2,h+1)-1;\n\n vector v;\n v.push_back(n);\n\n for(int i=0;i\nusing namespace std;\n int main(){\n int n,sum=0;\n cin>>n;\n \n int a[n];\n \n for(int i=0;i>a[i];\n \n sort(a,a+n);\n \n for(int i=0;i\nusing namespace std;\nusing ll = long long;\n#define rep(i, m, n) for (int i = m; i < n; ++i)\n#define rem(i, m, n) for (int i = m; i > n; --i)\nconst int MOD = 1000000007;\n\nint solve() {\n int N, K;\n cin >> N >> K;\n string S; cin >> S;\n queue Q;\n set st;\n Q.push(S);\n while(!Q.empty() || (int)st.size() <= K) {\n string t = Q.front(); Q.pop();\n st.insert(t);\n if(t == \"\") break;\n rep(i, 0, (int)t.size()) {\n int n = (int)t.size() - i - 1;\n string T = t.substr(0, i) + t.substr(i+1, n);\n Q.push(T);\n }\n }\n if(K > (int)st.size()) return -1;\n priority_queue PQ;\n for(auto p : st) PQ.push((int)p.size());\n int ans = 0;\n while(K-- && !PQ.empty()) {\n ans += N - PQ.top();\n PQ.pop();\n }\n return ans;\n}\n\nint main() {\n cout << solve() << endl;\n return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "a6554cfb6fe6b16d3ee5c84aa0d5846a", "src_uid": "ae5d21919ecac431ea7507cb1b6dc72b", "apr_id": "fc053cd6393999df7d530f78da5ddcbb", "difficulty": 2000, "tags": ["graphs", "dp", "implementation", "shortest paths"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9931237721021611, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "/*\n\u091c\u093f\u0928 \u0916\u094b\u091c\u093e \u0924\u093f\u0928 \u092a\u093e\u0907\u092f\u093e, \u0917\u0939\u0930\u0947 \u092a\u093e\u0928\u0940 \u092a\u0948\u0920,\n\u092e\u0948\u0902 \u092c\u092a\u0941\u0930\u093e \u092c\u0942\u0921\u0928 \u0921\u0930\u093e, \u0930\u0939\u093e \u0915\u093f\u0928\u093e\u0930\u0947 \u092c\u0948\u0920\u0964\n*/\n#include\n#include\n\nusing namespace std;\n\n#define boost ios::sync_with_stdio(0);cin.tie(0);\n#define forn(i,n) for ( int i=0 ; i < n ; i++ )\n#define all(a) (a).begin(), (a).end()\n#define lb lower_bound\n#define ub upper_bound\n#define vi vector\n#define pii pair\n#define F first\n#define S second\n#define MP make_pair\n#define PB push_back\n#define SQ(a) (a)*(a)\n#define ll long long\n#define lli long long int\n#define ull unsigned long long\n#define endl '\\n'\n#define Pi(a) printf(\"%d\\n\",a);\n#define debug2(a,b) printf(\"%d\\t%d\\n\",a,b);\n#define debug1(a) printf(\"%d\\n\",a);\n#define Si(a) scanf(\"%d\",&a);\n#define mod 1000000007\n#define w(n) while(n--)\n#define div divvv\n\nbool getout(ll a,ll b){\n\tll final=a*b;\n\t// cout << \"came\" << endl;\n\t//cout << a << \" \" << b << \" \" << final << endl;\n\tif(final==0){\n\t\tif(a==0||b==0) return false;\n\t\treturn true;\n\t}\n\telse if(final/a!=b) return true;\n\treturn false;\n}\n\nint main()\n{\n boost\n //code\n ll n,w,d;\n long long nn, ww, dd;\n cin >> nn >> ww >> dd;\n n = nn;w=ww;d=dd;\n ll ans = min(n,min(w,d)-1);\n ll div = __gcd(w,d);\n \n if(n/w check for array out of bounds & array declaired before size input(runtime error)\n-> check for int overflow, use ll\n-> check for corner cases like 0\n-> check for j++ in while loop for every case\n-> use boost except for interactive problems\n*/\n", "lang": "GNU C++14", "bug_code_uid": "247312dd3041cab813d9f7637d13db76", "src_uid": "7a1d8ca25bce0073c4eb5297b94501b5", "apr_id": "a0e70c3a9cd8b6d833e3d5c7b1fb5eb6", "difficulty": 1800, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9941792782305006, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \n\nusing namespace std;\n\nint main()\n{\n// freopen(\"in.txt\",\"r\",stdin);\n// freopen(\"out.txt\",\"w\",stdout);\n vector > v(4);\n set > st;\n set > seg;\n vector temp(4);\n int x=0,y=0;\n bool check=1;\n for(int i=0;i<4;i++){\n scanf(\"%d %d %d %d\",&v[i][0],&v[i][1],&v[i][2],&v[i][3]);\n if(v[i][0]!=v[i][2] && v[i][1]!=v[i][3])\n check=0;\n if(v[i][0]==v[i][2]) x++;\n else if(v[i][1]==v[i][3]) y++;\n st.insert(make_pair(v[i][0],v[i][1]));\n st.insert(make_pair(v[i][2],v[i][3]));\n// seg.insert(v[i]);\n\n }\n if(!check || st.size()!=4 || !(x==2 && y==2)){\n cout<<\"NO\";\n return 0;\n }\n int k=0;\n set >::iterator it;\n vector > p(4);\n for(it=st.begin();it!=st.end();it++){\n p[k].first=it->first;\n p[k++].second=it->second;\n }\n if(p[0].first!=p[1].first|| p[2].first!=p[3].first || p[0].first==p[2].first){\n check=0;\n }\n for(int i=0;i<4;i++) swap(p[i].first,p[i].second);\n sort(p.begin(),p.end());\n if(p[0].first!=p[1].first|| p[2].first!=p[3].first || p[0].first==p[2].first){\n check=0;\n }\n if(check) cout<<\"YES\";\n else cout<<\"NO\";\n\n}\n", "lang": "GNU C++11", "bug_code_uid": "ed477293190707397593103c3b13ed0e", "src_uid": "ad105c08f63e9761fe90f69630628027", "apr_id": "5b9ffbbc178e6b216e0b6179db15294d", "difficulty": 1700, "tags": ["geometry", "math", "implementation", "brute force", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.5872340425531914, "equal_cnt": 10, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 11, "bug_source_code": "#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\nint main()\n{\n\tint n;\n\tcin >> n;\n\tstring str;\n\tcin >> str;\n\tfor (int i = 0; i < str.length(); i++){\n\t\tfor (int j = i + 1; j < str.length(); j++){\n\t\t\tif (str[i] == '0' && str[j] == '1')\n\t\t\t\tswap(str[i], str[j]);\n\t\t}\n\t}\n\tint cnt = 0;\n\tfor (int i = 0; i < str.length(); i++){\n\t\tif (str[i] == '1')\n\t\t\tcnt++;\n\t}\n\tfor (int i = cnt - 1; i < str.length(); i++)\n\t\tcout << str[i];\n\t\n\n\t//system(\"pause\");\n\treturn 0;\n}\n}\n", "lang": "GNU C++14", "bug_code_uid": "7c059fc407aa132d6fb4b351d11879a0", "src_uid": "ac244791f8b648d672ed3de32ce0074d", "apr_id": "79029a6d499d2301b6b8f7e3e999dece", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9984313725490196, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 6, "bug_source_code": "#include\n#include\n#include\n#include\n#include\nusing namespace std;\nbool vis[1<<19+10],can[1<<19+10];\nint dir[20][10];\nvoid Out(int x,bool flag)\n{\n\tint po=x;while(po>0){printf(\"%d \",po%2);po/=2;}if(flag)puts(\"win\");else puts(\"lose\");\n}\nbool dfs(int x)\n{\n\tif(vis[x])return can[x];\n\tvis[x]=true;bool flag=false;\n\tfor(int i=0;i<19;i++)\n\t{\n\t\tint st=(1<\nusing namespace std;\nint main(){\n char s[101];\n scanf(\"%s\",s);\n for(int i=0; i\n#define rep(i,a,b) for(int i=(a);i<=(b);i++)\n#define per(i,a,b) for(int i=(a);i>=(b);i--)\n#define REP(i,n) for(int i=(0);i<(n);i++)\n#define pb push_back\nusing namespace std;\ntypedef vector vi;\ntypedef long long ll;\n\nconst int N=5005,mod=1e4+7;\nnamespace {\n\tinline int add(int x,int y){\n\t\treturn x+y>=mod?x+y-mod:x+y;\n\t}\n\tinline void Add(int &x,int y){\n\t\tx=add(x,y);\n\t}\n\tinline int mnu(int x,int y){\n\t\treturn x-y<0?x-y+mod:x-y;\n\t}\n\tinline int mul(int x,int y){\n\t\treturn (ll)x*y%mod;\n\t}\n\tinline int power(int x,ll p){\n\t\tint res=1;\n\t\tfor(;p;p>>=1,x=(ll)x*x%mod)\n\t\t\tif(p&1)res=(ll)res*x%mod;\n\t\treturn res;\n\t}\n\t#define inv(x) power(x,mod-2)\n}\nnamespace LS{\n\t/*\n\tnote:\n\t\u6240\u6709\u4e0b\u6807\u5747\u4ece\u96f6\u5f00\u59cb\n\ta[i]=\\sum a[i-j-1]*r[j]\n\t\u521d\u503c\u4e3aa[0]..a[sz-1]\n\t*/\n\tint p[N],d[N],m;vi s[N];\n\tvi BM(vi a){\n\t\tint n=a.size();\n\t\tfor(;m;)s[m--].clear();\n\t\tREP(i,n){\n\t\t\td[i]=a[i];\n\t\t\tREP(j,s[m].size())\n\t\t\t\td[i]=mnu(d[i],mul(a[i-j-1],s[m][j]));\n\t\t\tif(!d[i])continue;\n\t\t\tp[m]=i;\n\t\t\tif(!m){s[++m].resize(i+1);continue;}\n\t\t\tint id=m-1;\n\t\t\tREP(j,m-1)\n\t\t\t\tid=(p[j]-s[j].size()>p[id]-s[id].size()?j:id);\n\t\t\tint coef=mul(d[i],inv(d[p[id]]));\n\t\t\ts[++m].resize(i-p[id]-1);\n\t\t\ts[m].pb(coef);\n\t\t\tREP(j,s[id].size())\n\t\t\t\ts[m].pb(mul(mod-coef,s[id][j]));\n\t\t\tREP(j,s[m-1].size())\n\t\t\t\tif(j=Mod?x-=Mod:0);\n\tint A[N],B[N],bin[N],res[N],n;\n\tinline void Mul(int *x,int *y){\n\t\tstatic ll t[N<<1];\n\t\trep(k,0,n*2-2)t[k]=0;\n\t\tREP(i,n)REP(j,n)\n\t\t\tt[i+j]+=(ll)x[i]*y[j],fix(t[i+j]);\n\t\tper(i,n*2-2,n){\n\t\t\tt[i]%=mod;\n\t\t\tREP(j,n)t[i-j-1]+=t[i]*A[j],fix(t[i-j-1]);\n\t\t\tt[i]=0;\n\t\t}\n\t\tREP(i,n)x[i]=t[i]%mod;\n\t}\n\tint solve(vi a,vi b,ll K){\n\t\tn=a.size();\n\t\tif(K<=n-1)return b[K];\n\t\tif(n==1)return mul(b[0],power(a[0],K));\n\t\tREP(i,n){\n\t\t\tbin[i]=res[i]=0;\n\t\t\tA[i]=a[i],B[i]=b[i];\n\t\t}\n\t\tbin[1]=res[0]=1;\n\t\tfor(K-=n-1;K;K>>=1,Mul(bin,bin))\n\t\t\tif(K&1)Mul(res,bin);\n\t\trep(i,n,n*2-2){\n\t\t\tB[i]=0;\n\t\t\tREP(j,n)B[i]=add(B[i],mul(B[i-j-1],A[j]));\n\t\t}\n\t\tint s=0;\n\t\tREP(i,n)s=add(s,mul(B[n-1+i],res[i]));\n\t\treturn s;\n\t}\n\tint gao(vi x,ll K){\n\t\treturn solve(BM(x),x,K);\n\t}\n}\nconst int M=405;\nint dp[M*4][M][M],done[M*4];\nint len,n,m;\nchar s[M];\nvi ans;\n\nint main(){\n\tscanf(\"%s%d\",s+1,&n);\n\tlen=strlen(s+1),m=len*8+5;\n\tdp[0][1][len]=1;\n\trep(i,1,len*4+5){\n\t\tdone[i]=(ll)done[i-1]*26%mod;\n\t\trep(l,1,len)rep(r,l,len)\n\t\t\tif(s[l]==s[r]){\n\t\t\t\tif(l+1>r-1)Add(done[i],dp[i-1][l][r]);\n\t\t\t\telse Add(dp[i][l+1][r-1],dp[i-1][l][r]);\n\t\t\t\tAdd(dp[i][l][r],mul(dp[i-1][l][r],25));\n\t\t\t}\n\t\t\telse{\n\t\t\t\tAdd(dp[i][l+1][r],dp[i-1][l][r]);\n\t\t\t\tAdd(dp[i][l][r-1],dp[i-1][l][r]);\n\t\t\t\tAdd(dp[i][l][r],mul(dp[i-1][l][r],24));\n\t\t\t}\n\t}\n\tans.resize(m+1);\n\trep(i,1,m)\n\t\tif(i&1){\n\t\t\tans[i]=mul(done[i/2],26);\n\t\t\trep(j,1,len)\n\t\t\t\tAdd(ans[i],dp[i/2][j][j]);\n\t\t}\n\t\telse ans[i]=done[i/2];\n\tcout<\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n\n#define fi first\n#define se second\n#define INF 0x3f3f3f3f\n#define pi 3.1415926535898\n#define lson l,(l+r)/2,rt<<1\n#define rson (l+r)/2+1,r,rt<<1|1\n\nusing namespace std;\n\ntypedef long long ll;\ntypedef unsigned long long ull;\ntypedef pair P;\n\nconst int MAXN=1e6+10;\nconst int MOD=1e9+7;\nconst ll LLMAX=2e18;\n\npriority_queue,greater > qu;\npriority_queue,less > qd;\n\nvoid test()\n{\n FILE *fin=NULL,*fout=NULL;\n fin=freopen(\"D:\\\\Project__C++\\\\testdata.in\",\"r\",stdin);\n fout=freopen(\"D:\\\\Project__C++\\\\testdata.out\",\"w\",stdout);\n}\n\n/***************************************************************************/\nstring s;\nint check(int l,int r)\n{\n while(l<=r)\n {\n if(s[l]==s[r]) l++,r--;\n else return r-l+1;\n }\n return 0;\n}\nint main(void)\n{\n int ans=0; cin>>s;\n for(int i=0;i\n#include \n#include \n\nint main() {\n int t1,t2,x1,x2,s,tram_pos;\n int dir;\n\n std::cin >> s >> x1 >> x2 >> t1 >> t2 >> tram_pos >> dir;\n\n dir = std::max(dir,0);\n\n int const walking = abs(x1-x2)*t2;\n\n int tram_to_x2 = std::numeric_limits::max();\n int tram_to_x1 = std::numeric_limits::max();\n\n int x = -x2;\n int y = -x1;\n\n if((x-tram_pos >= 0) == dir)\n {\n tram_to_x2 = std::min(tram_to_x2, abs(x-tram_pos)*t1);\n\n }\n if((y-tram_pos >= 0) == dir)\n {\n tram_to_x1 = std::min(tram_to_x1, abs(y-tram_pos)*t1);\n }\n\n\n x = x2;\n y = x1;\n\n if((x-tram_pos >= 0) == dir)\n {\n tram_to_x2 = std::min(tram_to_x2, abs(x-tram_pos)*t1);\n\n }\n if((y-tram_pos >= 0) == dir)\n {\n tram_to_x1 = std::min(tram_to_x1, abs(y-tram_pos)*t1);\n\n }\n\n x = 2*s - x2;\n y = 2*s - x1;\n\n if((x-tram_pos >= 0) == dir)\n {\n tram_to_x2 = std::min(tram_to_x2, abs(x-tram_pos)*t1);\n\n }\n if((y-tram_pos >= 0) == dir)\n {\n tram_to_x1 = std::min(tram_to_x1, abs(y-tram_pos)*t1);\n\n }\n\n if(tram_to_x1 <= tram_to_x2)\n {\n std::cout << std::min(tram_to_x2, walking) << std::endl;\n }\n else\n {\n int added_time;\n if(x1 < x2)\n {\n added_time = (x1 + x2) * t1;\n }\n else\n {\n added_time = (2*s - x1 - x2)*t1;\n }\n\n std::cout << std::min(tram_to_x1 + added_time, walking) << std::endl;\n return 1;\n }\n\n return 0;\n\n}", "lang": "GNU C++11", "bug_code_uid": "fc21201118aa59086d822e395ff90266", "src_uid": "fb3aca6eba3a952e9d5736c5d8566821", "apr_id": "0a0ef01255b6e2aa9dafdba0f1b94a9c", "difficulty": 1600, "tags": ["math", "constructive algorithms", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.15930902111324377, "equal_cnt": 14, "replace_cnt": 8, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 14, "bug_source_code": "#include\n#include\nusing namespace std;\nint main()\n{\n int n,a[51],m=0;\n string s;\n cin>>n;\n cin>>s;\n\n vectorv(s.begin(),s.end()),t;\n vector::iterator it;\n t=v;\n\n int i=0,b=1;\n while(b\n#include \n\nusing namespace std;\n\nint main()\n{ int n;\n float y,c;\ncin>>n;\ny= sqrt((8*n) +1)-1;\ny=y/2;\n\nc=y*10;\nif (fmod (c ,10)==0)\n cout<<\"yes\";\nelse\n cout<<\"no\";\n\n return 0;\n\n}", "lang": "GNU C++", "bug_code_uid": "b1024f01f0dd5b42f9e1ba4d85e4e75c", "src_uid": "587d4775dbd6a41fc9e4b81f71da7301", "apr_id": "4b8527a7c46cc35160d8fdd9a7f45677", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.44241573033707865, "equal_cnt": 17, "replace_cnt": 9, "delete_cnt": 3, "insert_cnt": 5, "fix_ops_cnt": 17, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\nchar a[5][5];\nint main()\n{\n int i,j,t,flag;\n while(scanf(\"%c%c%c%c\",&a[0][0],&a[0][1],&a[0][2],&a[0][3]))\n {\n flag=0;\n for(i=1;i<4;i++)\n for(j=0;j<4;j++)\n scanf(\"%c\",&a[i][j]);\n for(i=0;i<3;i++)\n for(j=0;j<3;j++)\n {\n t=0;\n if(a[i][j+1]==a[i][j]) t++;\n if(a[i+1][j]==a[i][j]) t++;\n if(a[i+1][j+1]==a[i][j]) t++;\n if(t>=2) {flag=1;break;}\n }\n if(flag) cout<<\"YES\"<\n\n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nint main()\n{\n\tint n; cin >> n;\n\n\tvector arr(n);\n\n\tint sum = 0;\n\tfor(int i=0;i> arr[i];\n\t\tsum += arr[i];\n\t}\n\n\tif (sum == 0) {\n\t\tcout << n;\n\t\treturn 1;\n\t}\n\n\tbool allow = false;\n\tint current = arr[0];\n\tif (current == 0) {\n\t\tallow = true;\n\t}\n\n\tvector brr;\n\tfor(int i=0; i\nusing namespace std;\n\n#define fre freopen(\"0.in\",\"r\",stdin),freopen(\"0.out\",\"w\",stdout)\n#define ull unsigned long long\n#define abs(x) ((x)>0?(x):-(x))\n#define M 1000000007\n#define scand(x) scanf(\"%d\",&x);\n#define scanlld(x) scanf(\"%I64d\",&x);\n#define ll long long\n#define mp make_pair\n#define clear(a) memset(a,0,sizeof(a))\n#define max(a,b) (a>b)?a:b\n#define min(a,b) (a>b)?b:a\n#define all(a) (a.begin(),a.end())\n#define rall(a) (a.rbegin(),a.rend())\n#define gcd(a,b) __gcd(a,b)\n#define fi first\n#define se second\n#define pb push_back\n#define inf (1<<30)\n#define forup(i,a,b) for(int i=a;i\n#define boost ios_base::sync_with_stdio(0)\n#define MAXN 100004\nvector >ans;\nint main()\n{\n boost;\n ull x,y;\n cin>>x>>y;\n if(gcd(x,y)!=1){cout<<\"Impossible\";return 0;}\n ull a=0,b=1,c=1,d=0;\n while(1)\n {\n int p=a+c,q=b+d;\n //cout<p*y)\n {\n a=p,b=q;\n if(ans.empty())ans.pb(mp(1,'A'));\n else \n {\n pii val=ans.back();\n int val1=val.fi;\n char val2=val.se;\n if(val2=='A')ans.pop_back(),ans.pb(mp(val1+1,'A'));\n else ans.pb(mp(1,'A'));\n }\n }\n else if(x*q\nusing namespace std;\n\nconst int maxn=3005;\nstruct node{\n long long r,l;\n node(long long r,long long l):r(r),l(l){}\n node():r(),l(){}\n bool operator<(const node& o) const{\n if(r==o.r) return l E[maxn];\nlong long siz[maxn],w[maxn],b[maxn];\nint n,m;\n\nvoid dfs(int x,int fa){\n dp[x][1]=node(0,w[x]-b[x]);\n if(dp[x][1].l>0) dp[x][1].r++;\n siz[x]=1;\n for(auto i:E[x]){\n if(i==fa) continue;\n dfs(i,x);\n for(int j=1;j<=m;j++) g[j]=node(-1,0);\n for(int j=1;j<=siz[x];j++){\n for(int k=1;k<=siz[i];k++){\n node t1,t2;\n t1=t2=dp[i][k];\n if(dp[x][j].l>0 && t1.l>0) t1.r--;\n if(dp[x][j].l+t1.l<=0 && (dp[x][j].l>0 || t1.l>0)) t1.r--;\n t2.l=0;\n g[j+k-1]=max(g[j+k-1],dp[x][j]+t1);\n g[j+k]=max(g[j+k],dp[x][j]+t2);\n }\n }\n siz[x]+=siz[i];\n for(int j=1;j<=siz[x];j++) dp[x][j]=g[j];\n }\n}\n\nvoid getdata(){\n cout<>T;\n while(T--){\n cin>>n>>m;\n for(int i=1;i<=n;i++){\n E[i].clear();\n for(int j=1;j<=m;j++)\n dp[i][j]=node(-1,0);\n }\n for(int i=1;i<=n;i++) cin>>b[i];\n for(int i=1;i<=n;i++) cin>>w[i];\n for(int i=1;i>x>>y;\n E[x].push_back(y);\n E[y].push_back(x);\n }\n dfs(1,0);\n if(T==19) getdata();\n cout<\n#include\n#include\n#include\n\nusing namespace std;\n\ntypedef long long ll;\ntypedef pair pll;\n\nll gcd(ll x, ll y){ return y? gcd(y, x%y): x; }\npll ext_gcd(ll x, ll y)\n{\n if( !x || ! y ) return pll(x, y);\n pll res = ext_gcd(y, x%y);\n return pll(res.second, x/y*res.second + res.first);\n}\n\ninline ll divi(ll a, ll b){\n return b? a / b : 1e16;\n}\n\nbool solve(string &ans, ll x, ll y)\n{\n ans = \"\";\n pll q = ext_gcd(x, y), p = pll(x, y);\n while( q.first < 0 ) q.first += y, q.second -= x;\n while( q.second < 0 ) q.first -= y, q.second += x;\n if( q.first < 0 || q.second < 0 ) return false;\n swap(q.first, q.second);\n char buf[100];\n bool f = true;\n while(true){\n if( q.first >= p.first && q.second >= p.second ){\n int t = min(divi(q.first, p.first), divi(q.second, p.second));\n q.first -= t*p.first, q.second -= t*p.second;\n if( f ) f = false, t--;\n if( t ) sprintf(buf, \"%dA\", t);\n reverse(buf, buf+strlen(buf));\n ans += buf;\n }\n else if( p.first >= q.first && p.second >= q.second){\n int t = min(divi(p.first, q.first), divi(p.second, q.second));\n p.first -= t*q.first, p.second -= t*q.second;\n if( f ) f = false, t--;\n if( t ) sprintf(buf, \"%dB\", t);\n reverse(buf, buf+strlen(buf));\n ans += buf;\n }\n else break;\n }\n bool ch = false;\n if( p == pll(0, 1) && q == pll(1, 0) ) ch = true;\n else if( p == pll(1, 0) && q == pll(0, 1) ) ch = false;\n else return false;\n if( !ch ) for(char &c : ans ){\n if( c == 'A' || c == 'B' ) c = 1 - (c - 'A') + 'A';\n }\n return true;\n}\n\nint main()\n{\n ll x, y;\n scanf(\"%lld%lld\", &x, &y);\n if( gcd(x, y) != 1 ) return !printf(\"Impossible\\n\");\n string ans = \"\";\n if( solve(ans, y, x) || solve(ans, x, y) ){\n reverse(ans.begin(), ans.end());\n for(int i = 0; i < ans.size(); i++) printf(\"%c\", ans[i]);\n }\n else !printf(\"Impossible\\n\");\n return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "5422b1bf2e33fd99142e5447b57ea48e", "src_uid": "6a9ec3b23bd462353d985e0c0f2f7671", "apr_id": "a3298b34645293c6fb4e51884c1c9b7c", "difficulty": 2400, "tags": ["number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.27526132404181186, "equal_cnt": 3, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "#include \nusing namespace std;\n\nint main() {\n\tstring s;\n\tcin>>s;\n\tstring str;\n\tstr=\"1\";\n\tint k=0;\n\twhile(str\n\nusing namespace std;\n\nlong long n,k;\n\nvoid fastscan(long long &number) \n{\n bool negative = false;\n register int c;\n c = getchar();\n for (; (c>47 && c<58); c=getchar())\n number = number *10 + c - 48;\n}\n\nint main()\n{\n fastscan(n);\n fastscan(k);\n long long r = 0;\n while(n >= k)\n {\n r ++;\n n -= k;\n }\n ((r & 1) ? puts(\"YES\") : puts(\"NO\"));\n}", "lang": "GNU C++11", "bug_code_uid": "5d8cbea5d73982b8999b10e23265cd44", "src_uid": "05fd61dd0b1f50f154eec85d8cfaad50", "apr_id": "d231a6466e4d1110c2293f88ef5c9c21", "difficulty": 800, "tags": ["math", "games"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9147952443857331, "equal_cnt": 13, "replace_cnt": 11, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 12, "bug_source_code": "#include \nusing namespace std;\n\n#define ll long long\n#define ld long double\n\n#define fr(i,a,b) for(ll i=a;i=b;i--)\n\n#define mod 1000000007\n#define endl \"\\n\"\n\n#define pb push_back\n#define vll vector\n#define vchar vector\n#define vstr vector\n#define vvll vector\n#define pll pair\n#define vpair vector\n#define mp(x,y) make_pair(x,y)\n#define fi first\n#define se second\n\n#define err() cout<<\"==================================\\n\";\n#define errA(A) for(auto i:A) cout< 0) { if (b & 1) res = (res * a); a = (a * a); b >>= 1;} return res;\n// }\n// ll modpow(ll a, ll b,ll x) {\n// ll res = 1; while (b > 0) { if (b & 1) res = (res * a)%x; a = (a * a)%x; b >>= 1;} return res;\n// }\n// void sieve() { \n// spf[1] = 1; for (ll i=2; i getFactorization(ll x) { \n// vector ret; while (x != 1) { ret.push_back(spf[x]); x = x / spf[x]; } return ret; \n// }\n\n\n// Answer here : \n\n\n\nvoid solve() \n{\n ll n,m;\n cin >> n >> m;\n ll ans = 0;\n\n ll curr = 1;\n ll k = 0;\n while(n-k >= k)\n {\n \tll num = 1,den = 1;\n \tfr(i,0,k)\n \t{\n \t\tnum *= (n-k-i);\n \t\tden *= i+1;\t\n \t}\n \tans += num/den;\n \tk++;\n }\n k = 0;\n while(m-k >= k)\n {\n \tll num = 1,den = 1;\n \tfr(i,0,k)\n \t{\n \t\tnum *= (m-k-i);\n \t\tden *= i+1;\t\n \t}\n \tans += num/den;\n \tk++;\n }\n ans -- ;\n cout << ans*2 << endl;\n}\n\nint main()\n{\n #ifndef ONLINE_JUDGE\n freopen(\"input.txt\", \"r\", stdin);\n freopen(\"output.txt\", \"w\", stdout);\n #endif\n ios_base::sync_with_stdio(false);\n cin.tie(NULL); cout.tie(NULL);\n cout<\n \nusing namespace std;\n\n__int64 a[21];\n__int64 b[21];\nvoid qs(__int64* s_arr,int first, int last)\n{\n int i = first, j = last, x = s_arr[(first + last) / 2];\n \n do {\n while (s_arr[i] < x) i++;\n while (s_arr[j] > x) j--;\n \n if(i <= j) {\n if (i < j)\n {\n int t =s_arr[i];\n s_arr[i] = s_arr[j];\n s_arr[j] =t;\n t =a[i];\n a[i] = a[j];\n a[j] = t;\n }\n i++;\n j--;\n }\n } while (i <= j);\n \n if (i < last)\n qs(s_arr,i, last);\n if (first < j)\n qs(s_arr,first,j);\n}\nint main ()\n{\n \n __int64 n,m;\n cin>>n>>m;\n for(int i=1;i<=m; i++)\n cin>>a[i]>>b[i];\n qs(b,1,m);\n int k=0; \n __int64 sum =0;\n int i=m;\n while(k0) \n {\n sum+=b[i]*(n-k);\n k=n;\n \n }\n else\n {\n sum+=b[i]*a[i];\n k+=a[i];\n \n }\n i--;\n }\n cout<\n#include\nusing namespace std;\nint a,b,c,d,e,f,n,m;\nset k;\nset::iterator it;\nint main(){\n cin>>n;\n for(int i=0; i>a;\n k.insert(a);\n }\n cout<.\n;\n; Portions created by the Initial Developer are Copyright (C) 2006\n; the Mozilla Foundation . All Rights Reserved.\n;\n; Contributor(s):\n;\n; Alternatively, the contents of this file may be used under the terms of\n; either the GNU General Public License Version 2 or later (the \"GPL\"), or\n; the GNU Lesser General Public License Version 2.1 or later (the \"LGPL\"),\n; in which case the provisions of the GPL or the LGPL are applicable instead\n; of those above. If you wish to allow use of your version of this file only\n; under the terms of either the GPL or the LGPL, and not to allow others to\n; use your version of this file under the terms of the MPL, indicate your\n; decision by deleting the provisions above and replace them with the notice\n; and other provisions required by the GPL or the LGPL. If you do not delete\n; the provisions above, a recipient may use your version of this file under\n; the terms of any one of the MPL, the GPL or the LGPL.\n;\n; ***** END LICENSE BLOCK *****\n\n[App]\nVendor=Mozilla\nName=Firefox\nVersion=3.6.15\nBuildID=20110303024726\nSourceRepository=http://hg.mozilla.org/releases/mozilla-1.9.2\nSourceStamp=c2b88342ea2b\nCopyright=Copyright (c) 1998 - 2011 mozilla.org\nID={ec8030f7-c20a-464f-9b0e-13a3a9e97384}\n\n[Gecko]\nMinVersion=1.9.2.15\nMaxVersion=1.9.2.15\n\n[XRE]\nEnableProfileMigrator=1\nEnableExtensionManager=1\n\n[Crash Reporter]\nEnabled=1\nServerURL=https://crash-reports.mozilla.com/submit\n", "lang": "GNU C++", "bug_code_uid": "661a347073399982b9a0fb0bab289402", "src_uid": "915081861e391958dce6ee2a117abd4e", "apr_id": "78c25f1179f4ad4984809155f67c24af", "difficulty": 1500, "tags": ["number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8317191283292978, "equal_cnt": 14, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 13, "bug_source_code": "#include \"bits/stdc++.h\"\n\n#define REP(I, N) for (int I = 0; I < (N); ++I)\n#define REPP(I, A, B) for (int I = (A); I < (B); ++I)\n#define RREP(i,n) for(int i=(n);i>=0;i--)\n#define RI(X) cin >> X\n#define RII(X, Y) cin >> X >> Y\n#define RIII(X, Y, Z) cin >> X >> Y >> Z\n#define DRI(X) int (X); cin >> X\n#define DRII(X, Y) int X, Y; cin >> X >> Y\n#define DRIII(X, Y, Z) int X, Y, Z; cin >> X >> Y >> Z\n#define PRI(X,Y,Z) cout << X << \" \" << Y << \" \" << Z\n#define MP make_pair\n#define PB push_back\n#define PII pair \n#define MS0(X) memset((X), 0, sizeof((X)))\n#define MS1(X) memset((X), -1, sizeof((X)))\n#define getLength(str) str.length()\n#define MAX(a,b) ((a)>(b)?(a):(b))\n#define MIN(a,b) ((a)<(b)?(a):(b))\n#define ABS(x) ((x)<0?-(x):(x))\n#define DB(x) cout<<\"\\n\"<<#x<<\" = \"<<(x)<<\"\\n\";\n#define ULL unsigned long long\n\nusing namespace std;\n\ntypedef long long LL;\n\nvoid swapi(int *a, int *b) {int temp; temp = *a; *a = *b; *b = temp;}\nULL gcd(ULL a, ULL b) {\n\tif (a == 0)return b;\n\tif (b == 0)return a; if (a == 1 || b == 1)return 1;\n\tif (a == b)return a; if (a > b)return gcd(b, a % b); else return gcd(a, b % a);\n}\n\nconst int MOD = 1e9+7;\nconst int SIZE = 1e6+10;\n\nint main(int argc, char const *argv[])\n{\n\tstd::ios::sync_with_stdio(false);\n\tcin.tie(0);\n\n\tlong long n,k, mine = 1;\n\tRII(n,k);\n\n\tstd::vector v;\n\tv.push_back(1);\n\n\tREP(i,n-1) {\n\t\tint sz = v.size();\n\t\tmine++;\n\t\tv.push_back(mine);\n\t\tREP(j,sz) {\n\t\t\tv.push_back(v[j]);\n\t\t}\n\t}\n\n\t\n\tcout << v[k-1] << endl;\n\treturn 0;\n\n}", "lang": "GNU C++", "bug_code_uid": "173a0bcceff9171d3fcd1dcaf9ec9124", "src_uid": "0af400ea8e25b1a36adec4cc08912b71", "apr_id": "35fccf5c626af2fd59e94bfbad3012fe", "difficulty": 1200, "tags": ["implementation", "constructive algorithms", "bitmasks", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9937114109307111, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\nnamespace math {\n\ntemplate\ninline void slightFixModInline(V& v, const V& mod) {\n if (v < 0) {\n v += mod;\n }\n if (v >= mod) {\n v -= mod;\n }\n}\n\n} // namespace math\n\nnamespace math {\n\ntemplate\ninline void fixModInline(V& v, const V& mod) {\n slightFixModInline(v, mod);\n if (v < 0 || mod <= v) {\n assert(mod);\n v %= mod;\n slightFixModInline(v, mod);\n }\n}\n\n} // namespace math\n\nnamespace math {\n\ntemplate\ninline V addMod(const V& a, V b, const V& mod) {\n V res = a;\n fixModInline(res, mod);\n fixModInline(b, mod);\n res += b;\n slightFixModInline(res, mod);\n return res;\n}\n\n} // namespace math\n\nnamespace math {\n\ntemplate\ninline V extGcd(V a, V b, V& x, V& y) {\n bool negativeA = false;\n if (a < 0) {\n negativeA = true;\n a = -a;\n }\n bool negativeB = false;\n if (b < 0) {\n negativeB = true;\n b = -b;\n }\n x = 1;\n y = 0;\n V xTmp = 0;\n V yTmp = 1;\n while (b) {\n V q = a / b;\n tie(x, xTmp) = make_tuple(xTmp, x - q * xTmp);\n tie(y, yTmp) = make_tuple(yTmp, y - q * yTmp);\n tie(a, b) = make_tuple(b, a - q * b);\n }\n if (negativeA) {\n x = -x;\n }\n if (negativeB) {\n y = -y;\n }\n return a;\n}\n\n} // namespace math\n\nnamespace math {\n\ntemplate\ninline V invMod(V a, const V& mod) {\n V x0, x1, gcd = extGcd(a, mod, x0, x1);\n assert(gcd == 1);\n slightFixModInline(x0, mod);\n return x0;\n}\n\n} // namespace math\n\nnamespace math {\n\ntemplate\ninline void mulModInline(V& res, V x, const V& mod) {\n if (!res || !x) {\n res = 0;\n } else if (res < mod / x) {\n res *= x;\n } else {\n res = static_cast(res) * x % mod;\n }\n}\n\n} // namespace math\n\nnamespace math {\n\ntemplate\ninline V mulMod(V a, const V& b, const V& mod) {\n mulModInline(a, b, mod);\n return a;\n}\n\n} // namespace math\n\nnamespace math {\n\nstruct CombinationMod {\n inline CombinationMod() {}\n\n inline CombinationMod(int n, int mod) {\n init(n, mod);\n }\n\n inline void init(int n, int mod) {\n _mod = mod;\n _facs.clear();\n _facs.reserve(n);\n int j = mod != 1;\n _facs.push_back(j);\n for (int i = 1; i < n; ++i) {\n _facs.push_back(mulMod(_facs.back(), j, mod));\n j = j + 1 == mod ? 0 : j + 1;\n }\n _invFacs.reserve(n);\n _invFacs.resize(n);\n _invFacs[n - 1] = invMod(_facs[n - 1], mod);\n for (int i = n - 1; i > 0; --i) {\n j = !j ? mod - 1 : j - 1;\n _invFacs[i - 1] = mulMod(_invFacs[i], j, mod);\n }\n }\n\n inline int calc(int n, int m) {\n if (n < m) {\n return 0;\n }\n return mulMod(mulMod(_facs[n], _invFacs[m], _mod), _invFacs[n - m], _mod);\n }\n\n int _mod;\n vector _facs, _invFacs;\n};\n\n} // namespace math\n\nnamespace math {\n\ntemplate\ninline V expMod(V base, EXP exp, const V& mod) {\n V res = 1;\n for (; exp > 0; exp >>= 1) {\n if (exp & 1) {\n mulModInline(res, base, mod);\n }\n mulModInline(base, base, mod);\n }\n return res;\n}\n\n} // namespace math\n\nnamespace math {\n\ntemplate\ninline V fixMod(const V& v, const V& mod) {\n V res = v;\n fixModInline(res, mod);\n return res;\n}\n\n} // namespace math\n\nnamespace math {\n\ntemplate\ninline V subMod(const V& a, V b, const V& mod) {\n V res = a;\n fixModInline(res, mod);\n fixModInline(b, mod);\n if (res >= b) {\n res -= b;\n } else {\n res = mod - (b - res);\n }\n slightFixModInline(res, mod);\n return res;\n}\n\n} // namespace math\n\nnamespace math {\n\nnamespace {\n\nstruct _FibPartMod {\n inline _FibPartMod() {}\n\n inline _FibPartMod(int a_, int b_, int mod) {\n init(a_, b_, mod);\n }\n\n inline void init(int a_, int b_, int mod) {\n _mod = mod;\n a = fixMod(a_, mod);\n b = fixMod(b_, mod);\n }\n\n inline void init(const _FibPartMod& o) {\n init(o.a, o.b, o._mod);\n }\n\n inline void operator-=(const _FibPartMod& o) {\n a = subMod(a, o.a, _mod);\n b = subMod(b, o.b, _mod);\n }\n\n inline void operator+=(const _FibPartMod& o) {\n a = addMod(a, o.a, _mod);\n b = addMod(b, o.b, _mod);\n }\n\n inline void operator-=(int delta) {\n a = subMod(a, fixMod(delta, _mod), _mod);\n }\n\n inline void operator+=(int delta) {\n a = addMod(a, fixMod(delta, _mod), _mod);\n }\n\n inline void operator*=(const _FibPartMod& o) {\n int resA = addMod(\n mulMod(a, o.a, _mod),\n mulMod(mulMod(b, o.b, _mod), fixMod(5, _mod), _mod),\n _mod);\n int resB = addMod(mulMod(a, o.b, _mod), mulMod(b, o.a, _mod), _mod);\n a = resA;\n b = resB;\n }\n\n inline void operator*=(const int scale) {\n a = mulMod(a, fixMod(scale, _mod), _mod);\n b = mulMod(b, fixMod(scale, _mod), _mod);\n }\n\n int a, b;\n int _mod;\n};\n\n} // namespace\n\nstruct FibPowerSum {\n inline FibPowerSum(int mod, int expBound = -1) {\n init(mod, expBound);\n }\n\n inline void init(int mod, int expBound = -1) {\n int inv2 = invMod(2, mod);\n _mod = mod;\n if (expBound >= 0) {\n as_.reserve(expBound);\n bs_.reserve(expBound);\n }\n as_.clear();\n bs_.clear();\n as_.emplace_back(1, 0, mod);\n bs_.emplace_back(1, 0, mod);\n as_.emplace_back(inv2, inv2, mod);\n bs_.emplace_back(inv2, inv2 ? mod - inv2 : 0, mod);\n for (int i = 2; i < expBound; ++i) {\n as_.emplace_back(as_.back());\n as_.back() *= as_[1];\n bs_.emplace_back(bs_.back());\n bs_.back() *= bs_[1];\n }\n _comb.init(expBound, mod);\n _inv5 = invMod(fixMod(5, mod), mod);\n _zeroPart.init(0, 0, mod);\n _onePart.init(fixMod(1, mod), 0, mod);\n _five = fixMod(5, mod);\n }\n\n template\n inline int calc(T n, int exp) {\n _FibPartMod res(0, 0, _mod), base, mul, subRes;\n for (int i = 0; i <= exp; ++i) {\n base.init(as_[i]);\n base *= bs_[exp - i];\n if (base.a == 1 && !base.b) {\n subRes.init(fixMod(n + 1, _mod), 0, _mod);\n } else {\n mul.init(base);\n subRes.init(as_[0]);\n for (T tmpN = n + 1; tmpN; tmpN >>= 1) {\n if (tmpN & 1) {\n subRes *= mul;\n }\n mul *= mul;\n }\n subRes -= 1;\n base -= 1;\n int scale = subMod(\n mulMod(base.a, base.a, _mod),\n mulMod(mulMod(base.b, base.b, _mod), _five, _mod),\n _mod);\n subRes *= invMod(scale, _mod);\n base.b = base.b ? _mod - base.b : 0;\n subRes *= base;\n }\n subRes *= _comb.calc(exp, i);\n if ((exp - i) & 1) {\n res -= subRes;\n } else {\n res += subRes;\n }\n }\n return mulMod(\n (exp & 1) ? res.b : res.a, expMod(_inv5, exp >> 1, _mod), _mod);\n }\n\n vector<_FibPartMod> as_, bs_;\n CombinationMod _comb;\n _FibPartMod _zeroPart, _onePart;\n int _inv5, _five, _mod;\n};\n\n} // namespace math\n\nnamespace math {\n\nstruct StirlingFirst {\n inline StirlingFirst(int n, int mod) {\n init(n, mod);\n }\n\n inline void init(int n, int mod) {\n _mod = mod;\n _us.resize(n);\n int one = fixMod(1, mod);\n if (n > 0) {\n _us[0].assign(1, one);\n }\n for (int i = 1; i < n; ++i) {\n _us[i].resize(i + 1);\n _us[i][0] = 0;\n int i1 = fixMod(i - 1, mod);\n for (int j = 1; j < i; ++j) {\n _us[i][j] =\n addMod(mulMod(i1, _us[i - 1][j], mod), _us[i - 1][j - 1], mod);\n }\n _us[i][i] = one;\n }\n }\n\n inline int calcUnsigned(int n, int k) {\n return n >= k ? _us[n][k] : 0;\n }\n\n inline int calcSigned(int n, int k) {\n int res = calcUnsigned(n, k);\n if (res && ((n - k) & 1)) {\n res = _mod - res;\n }\n return res;\n }\n\n vector> _us;\n int _mod;\n};\n\n} // namespace math\n\nconst int MOD = 1000000007;\nconst int MAXEXP = 200 + 1;\n\nmath::FibPowerSum fibPowSum(MOD, MAXEXP);\nmath::StirlingFirst stirling(MAXEXP, MOD);\n\ninline int calc(int exp, long long n) {\n int res = 0;\n for (int i = 0; i <= exp; ++i) {\n res = math::addMod(\n res,\n math::mulMod(stirling.calcSigned(exp, i), fibPowSum.calc(n, i), MOD),\n MOD);\n }\n res = math::mulMod(res, fibPowSum._comb._invFacs[exp], MOD);\n return res;\n}\n\nint main() {\n int exp;\n long long lower, upper;\n scanf(\"%d%lld%lld\", &exp, &lower, &upper);\n printf(\"%d\\n\", math::subMod(calc(exp, upper + 2), calc(exp, lower + 1), MOD));\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "f6e176637e2b40df0380e260d10643cc", "src_uid": "dee552588e1281c2523868cd4090b46f", "apr_id": "9215c9e997046a0cfdf9358f317e89c0", "difficulty": 2900, "tags": ["math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9429429429429429, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "#include \n\nusing namespace std;\n\nstring a , c;\nint b , d , dp[128] , ans , cnt;\n\n\nint main(){\n\tcin >> b >> d >> a >> c;\n\tfor(int i = 0 ; i < c.size() ; i++)\n\t{\n\t\tcnt = 0;\n\t\tfor(int j = 0 ; j < a.size() ; j++)\n\t\t{\n\t\t\tif(c[cnt] == a[j])\n\t\t\t{\n\t\t\t\tdp[i] ++;\n cnt = (cnt + 1) % c.size();\n }\n }\n\t\tc = c.substr(1) + c[0];\n\t}\n\tcnt = 0;\n\tfor(int i = 0 ; i < b ; i++)\n\t{\n\t\tans += dp[cnt];\n\t\tcnt = (cnt + dp[r]) % c.size();\n\t}\n\tcout << (ans / d) / c.size();\n}", "lang": "GNU C++11", "bug_code_uid": "379bd9e762c7b30d163566d755a9c3b2", "src_uid": "5ea0351ac9f949dedae1928bfb7ebffa", "apr_id": "e72d10566b4fdb359f6354a128c00bb2", "difficulty": 2000, "tags": ["dfs and similar", "strings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9784021807506815, "equal_cnt": 11, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "// Enjoy your stay.\n\n#include \n\n#define EPS 1e-9\n#define INF 1070000000LL\n#define MOD 1000000007LL\n#define fir first\n#define foreach(it,X) for(auto it=(X).begin();it!=(X).end();it++)\n#define ite iterator\n#define mp make_pair\n#define mt make_tuple\n#define rep(i,n) rep2(i,0,n)\n#define rep2(i,m,n) for(int i=m;i<(n);i++)\n#define pb push_back\n#define sec second\n#define sz(x) ((int)(x).size())\n\nusing namespace std;\n\ntypedef istringstream iss;\ntypedef long long ll;\ntypedef pair pi;\ntypedef stringstream sst;\ntypedef vector vi;\n\nint n;\nstring T[22];\nint s[22][22];\n//int dp[22][22];\nint dy[]={0,1};\n//int dx[]={1,0};\nint score[128];\n\nvector dp[40];\n\nvector Y[40],X[40];\n\nint f(int yx,int mask){\n\tint& res=dp[yx][mask];\n\tif(res!=-1)return res;\n\tif(yx==2*n-2)return res=0;\n\tif(yx&1)res=-INF;\n\telse res=INF;\n\t\n\t/*int ok[22][22];\n\tmemset(ok,0,sizeof(ok));\n\trep(i,sz(Y[yx])){\n\t\tif(mask>>i&1){\n\t\t\tok[Y[yx][i]][X[yx][i]]=1;\n\t\t}\n\t}*/\n\t/*int ok[22]={};\n\trep(i,sz(Y[yx])){\n\t\tif(mask>>i&1){\n\t\t\tok[Y[yx][i]]=1;\n\t\t}\n\t}*/\n\tint convY[22]={-1};\n\trep(i,sz(Y[yx])){\n\t\tconvY[Y[yx][i]] = i;\n\t}\n\t\n\trep2(ch,'a','z'+1){\n\t\tint nmask=0;\n\t\trep(i,sz(Y[yx+1])){\n\t\t\tint y=Y[yx+1][i],x=X[yx+1][i];\n\t\t\tif(T[y][x]==ch){\n\t\t\t\t//cout<=0 && (mask>>convY[py]&1)){\n\t\t\t\t\t\tOK=1;break;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//cout< \"<>n;\n\trep(i,n)cin>>T[i];\n\trep(i,n)rep(j,n){\n\t\ts[i][j] = (T[i][j] == 'a' ? 1 : (T[i][j] == 'b' ? -1 : 0));\n\t}\n\t\n\trep(i,n) dp[i].resize(1<<(i+1),-1);\n\trep(i,n-1) dp[2*n-2-i].resize(1<<(i+1),-1);\n\t\n\trep(i,n)rep(j,n){\n\t\tY[i+j].pb(i);\n\t\tX[i+j].pb(j);\n\t}\n\tscore['a']=1;\n\tscore['b']=-1;\n\t\n\tint res = s[0][0]+f(0,1);\n\tcerr<0 ? \"FIRST\" : (res<0 ? \"SECOND\":\"DRAW\"))<\n\n#define s second\n#define f first\n#define pb push_back\n#define int ll\n#define D(x) cerr<<#x<<\": \"<> 1)\n#define lc (id << 1)\n#define rc ((id << 1) + 1)\n#define lb(x) ((x) & -(x))\n\nusing namespace std;\n\ntypedef long long ll;\ntypedef pair pii;\ntypedef vector vi;\n\nconst int MAX=5e5+10,mod=1e9+9,base=41,INF=1e9+10,sq=502;\n\nint n,m;\n\nmain(){\n cin >> n >> m;\n int x = (n+m)/2;\n int y = abs(n-x), z = abs(m-x);\n cout << y*(y+1)/2 + z*(z+1)/2b;\n}\n\n", "lang": "GNU C++17", "bug_code_uid": "7533f94846da0d0e78c82bfce69f7f43", "src_uid": "d3f2c6886ed104d7baba8dd7b70058da", "apr_id": "f6de44394ab4bce573a49ee856b2b508", "difficulty": 800, "tags": ["greedy", "math", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.89419795221843, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "include\nusing namespace std;\nint main()\n{\n int n;\n cin>>n;\n char s[101];\n int c=0;\n for(int i=0;i>s[i];\n if(s[i]=='0')\n c++;\n }\n cout<<'1';\n for(int i=0;i\n#include\nusing namespace std;\n\nint main() {\n\tint n;\n\tcin>>n;\n\tvectorans;\n\tans.push_back(n);\n\tfor(int i=2;i\nusing namespace std;\n//#pragma GCC optimize(\"Ofast\")\n//#pragma GCC target(\"sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native\")\n \n#define ms(s, n) memset(s, n, sizeof(s))\n#define FOR(i, a, b) for (int i = (a); i < (b); ++i)\n#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); --i)\n#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)\n#define sz(a) int((a).size())\n#define present(t, x) (t.find(x) != t.end())\n#define all(a) (a).begin(), (a).end()\n#define uni(a) (a).erase(unique(all(a)), (a).end())\n#define pb push_back\n#define pf push_front\n#define mp make_pair\n#define fi first\n#define se second\n#define prec(n) fixed<> (i)) & 1)\n#define bitcount(n) __builtin_popcountll(n)\ntypedef long long ll;\ntypedef unsigned long long ull;\ntypedef long double ld;\ntypedef pair pi;\ntypedef vector vi;\ntypedef vector vii;\n//const int MOD = (int) 1e9 + 7;\nconst int MOD = 119 << 23 | 1;\nconst int FFTMOD = 119 << 23 | 1;\nconst int INF = (int) 1e9 + 23111992;\nconst ll LINF = (ll) 1e18 + 23111992;\nconst ld PI = acos((ld) -1);\nconst ld EPS = 1e-9;\ninline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}\ninline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}\ninline ll 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;}\ntemplate inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}\ntemplate inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}\ninline ull isqrt(ull k) {ull r = sqrt(k) + 1; while (r * r > k) r--; return r;}\ninline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}\ninline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}\ninline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}\ninline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}\ninline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}\ninline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}\ninline int sign(ld x, ld y) {return sign(x - y);}\nmt19937 mt(chrono::high_resolution_clock::now().time_since_epoch().count());\ninline int mrand() {return abs((int) mt());}\n#define db(x) cerr << \"[\" << #x << \": \" << (x) << \"] \";\n#define endln cerr << \"\\n\";\n\ntemplate\nstruct NTT {\n int rts[maxf + 1];\n int bitrev[maxf];\n int iv[maxf + 1];\n\n int fpow(int a, int k) {\n if (!k) return 1;\n int res = a, tmp = a;\n k--;\n while (k) {\n if (k & 1) {\n res = (long long) res * tmp % mod;\n }\n tmp = (long long) tmp * tmp % mod;\n k >>= 1;\n }\n return res;\n }\n int prt() {\n vector dvs;\n for (int i = 2; i * i < mod; i++) {\n if ((mod - 1) % i) continue;\n dvs.push_back(i);\n if (i * i != mod - 1) dvs.push_back((mod - 1) / i);\n }\n for (int i = 2; i < mod; i++) {\n int flag = 1;\n for (int j = 0; j < dvs.size(); j++) {\n if (fpow(i, dvs[j]) == 1) {\n flag = 0;\n break;\n }\n }\n if (flag) return i;\n }\n assert(0);\n return -1;\n }\n NTT() {\n int k = 0; while ((1 << k) < maxf) k++;\n bitrev[0] = 0;\n for (int i = 1; i < maxf; i++) {\n bitrev[i] = bitrev[i >> 1] >> 1 | ((i & 1) << k - 1);\n }\n int pw = fpow(prt(), (mod - 1) / maxf);\n rts[0] = 1;\n for (int i = 1; i <= maxf; i++) {\n rts[i] = (long long) rts[i - 1] * pw % mod;\n }\n for (int i = 1; i <= maxf; i <<= 1) {\n iv[i] = fpow(i, mod - 2);\n }\n }\n void dft(int a[], int n, int sign) {\n int d = 0; while ((1 << d) * n != maxf) d++;\n for (int i = 0; i < n; i++) {\n if (i < (bitrev[i] >> d)) {\n swap(a[i], a[bitrev[i] >> d]);\n }\n }\n for (int len = 2; len <= n; len <<= 1) {\n int delta = maxf / len * sign;\n for (int i = 0; i < n; i += len) {\n int *w = sign > 0 ? rts : rts + maxf;\n for (int k = 0; k + k < len; k++) {\n int &a1 = a[i + k + (len >> 1)], &a2 = a[i + k];\n int t = (long long) *w * a1 % mod;\n a1 = a2 - t;\n a2 = a2 + t;\n a1 += a1 < 0 ? mod : 0;\n a2 -= a2 >= mod ? mod : 0;\n w += delta;\n }\n }\n }\n if (sign < 0) {\n int in = iv[n];\n for (int i = 0; i < n; i++) {\n a[i] = (long long) a[i] * in % mod;\n }\n }\n }\n void multiply(int a[], int b[], int na, int nb, int c[]) {\n static int fa[maxf], fb[maxf];\n int n = na + nb - 1; while (n != (n & -n)) n += n & -n;\n for (int i = 0; i < n; i++) fa[i] = fb[i] = 0;\n for (int i = 0; i < na; i++) fa[i] = a[i];\n for (int i = 0; i < nb; i++) fb[i] = b[i];\n dft(fa, n, 1), dft(fb, n, 1);\n for (int i = 0; i < n; i++) fa[i] = (long long) fa[i] * fb[i] % mod;\n dft(fa, n, -1);\n for (int i = 0; i < n; i++) c[i] = fa[i];\n }\n vector multiply(vector a, vector b) {\n static int fa[maxf], fb[maxf], fc[maxf];\n int na = a.size(), nb = b.size();\n for (int i = 0; i < na; i++) fa[i] = a[i];\n for (int i = 0; i < nb; i++) fb[i] = b[i];\n multiply(fa, fb, na, nb, fc);\n int k = na + nb - 1;\n vector res(k);\n for (int i = 0; i < k; i++) res[i] = fc[i];\n return res;\n }\n};\nNTT ntt;\n\nvoid solve() {\n int n; cin >> n;\n int dep = 0;\n while ((1 << dep + 1) - 1 <= n) dep++;\n dep--;\n function(int n)> divide = [&] (int dep) {\n int k = 1 << dep + 1;\n vector res(2, vi(k));\n if (!dep) {\n res[0][0] = res[1][1] = 1;\n return res;\n }\n vector r = divide(dep - 1);\n vi x0 = r[0];\n vi x1 = r[0];\n vi y0 = r[1];\n vi y1 = r[1];\n FOR(i, 0, sz(x0)) {\n if (i & 1) {\n x0[i] = y0[i] = 0;\n }\n else {\n x1[i] = y1[i] = 0;\n }\n }\n vi a0 = ntt.multiply(y0, r[0]);\n vi a1 = ntt.multiply(y1, r[1]);\n vi b0 = ntt.multiply(x0, r[1]);\n vi b1 = ntt.multiply(x1, r[0]);\n FOR(i, 0, sz(a0)) {\n res[0][i] = (a0[i] + a1[i]) % MOD;\n res[1][i] = (b0[i] + b1[i]) % MOD;\n }\n return res;\n };\n auto res = divide(dep);\n int r = n - (1 << dep + 1) + 1;\n cout << (res[0][r] + res[1][r]) % MOD << \"\\n\";\n}\n\nint main(int argc, char* argv[]) {\n ios_base::sync_with_stdio(0), cin.tie(0);\n if (argc > 1) {\n assert(freopen(argv[1], \"r\", stdin));\n }\n if (argc > 2) {\n assert(freopen(argv[2], \"wb\", stdout));\n }\n solve();\n cerr << \"\\nTime elapsed: \" << 1000 * clock() / CLOCKS_PER_SEC << \"ms\\n\";\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "09ec47b6141dc70df2617d9727d2d363", "src_uid": "821409c1b9bdcd18c4dcf35dc5116501", "apr_id": "9a1115f75c791228485470c1c763cd50", "difficulty": 2400, "tags": ["dp", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.871244635193133, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n//spyemhyznjieyhhbk\nusing namespace std;\nint main(){\n char *a;\n cin>>a;\n int len=strlen(a);\n cout<<25*(len+1)+1;\n}\n\n", "lang": "MS C++", "bug_code_uid": "c7eba47cfd3574f0d6c1af00fccb02ca", "src_uid": "556684d96d78264ad07c0cdd3b784bc9", "apr_id": "b4bd723d0f52ce8ddbc878d637db3ee3", "difficulty": 900, "tags": ["math", "brute force", "strings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.11098265895953757, "equal_cnt": 32, "replace_cnt": 27, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 32, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nint main() {\n\tint32_t n = 3* 100'000'000;\n\tuint64_t* prime = new uint64_t[(n + 1 + 7) / 8];\n\tfor(int32_t i = 0; i < (n + 1 + 7) / 8; i++)\n\t\tprime[i] = UINT64_MAX;\n\tfor(int32_t i = 2; i <= n; i++) {\n\t\tif(((prime[i / 64] >> (i % 64)) & 1) == 0)\n\t\t\tcontinue;\n\t\tfor(int32_t j = 2 * i; j <= n; j+=i)\n\t\t\tprime[j / 64] &= UINT64_MAX - (1ll << (j % 64));\n\t}\n\tfor(int32_t i = 0; i < n; i++)\n\t\tstd::cout <> (i % 64)) & 1 ? \"prime\" : \"composite\") << \"\\n\";\n\treturn 0;\n}#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n/*int32_t binary_pow(int32_t a, int32_t p, int32_t mod) {\n\tif(p == 0)\n\t\treturn 1;\n\tif(p % 2 == 1)\n\t\treturn ((int64_t)binary_pow(a, p - 1, mod) * a) % mod;\n\tint32_t root = binary_pow(a, p / 2, mod);\n\treturn ((int64_t)root * root) % mod;\n}\n\nbool prime (int32_t a) {\n\tif(a < 4)\n\t\treturn a == 2 || a == 3;\n\n\tfor(int32_t i = 0; i < 5; i++) {\n\t\tint32_t base = 2 + rand() % (a - 3);\n\t\tif(binary_pow(base, a - 1, a) != 1)\n\t\t\treturn false;\n\t}\n\treturn true;\n}*/\n\nint main() {\n\tint32_t left, right;\n\tstd::cin >> left >> right;\n\n\tint32_t limit = std::sqrt(right) + 5;\n\tstd::vector numbers(right, false);\n\tfor(int32_t i = 1; i <= limit; i++)\n\t\tfor(int32_t j = i; j <= limit; j++) {\n\t\t\tint32_t num = i * i + j * j;\n\t\t\tif (num >= left && num <= right)\n\t\t\t\tnumbers[num] = true;\n\t\t}\n\n\tstd::vector prime(right + 5, true);\n\tfor(int32_t i = 2; i < right + 5; i++) {\n\t\tif(!prime[i])\n\t\t\tcontinue;\n\t\tfor(int32_t j = 2 * i ; j < right + 5; j+=i) {\n\t\t\tprime[j] = false;\n\t\t}\n\t}\n\tint32_t answer = 0;\n\tfor(int32_t i = left; i <= right ; i++) {\n\t\tif(numbers[i]) {\n\t\t\tif (prime[i])\n\t\t\t\tanswer++;\n\t\t}\n\t}\n\n\tstd::cout << answer;\n\treturn 0;\n}\n\n\n\n", "lang": "GNU C++17", "bug_code_uid": "e9dbb5c2849d7c9de454e1c9e6a26c0f", "src_uid": "55a83526c10126ac3a6e6e5154b120d0", "apr_id": "17c8e1584112a8fc2584dabc511a1532", "difficulty": 2200, "tags": ["math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9767441860465116, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "/**\nCalvin's Code\n*/\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std ;\n\nconst int maxint = -1u>>2 ;\nconst double eps = 1e-6 ;\n\nint main()\n{\n int a, b, r;\n string s[2] = {\"First\", \"Second\"};\n cin>>a>>b>>r;\n\n string temp;\n\n vector v;\n\n for(int h = 0; h < 100; ++h)\n for(int i = 0; i < 100; ++i)\n for(int j = 0; j < 100; ++j)\n for(int k = 0; k < 100; ++k) {\n v.push_back(i);\n }\n\n //cout << temp << endl;\n\n temp = s[v.size()%2];\n if(a>=2*r && b>=2*r)\n temp = s[0];\n else\n temp = s[1];\n cout << temp << endl;\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "3573d4956664cc474a4101dc322a1421", "src_uid": "90b9ef939a13cf29715bc5bce26c9896", "apr_id": "a12f39564070d2412a3428d5839f9169", "difficulty": 1600, "tags": ["math", "games", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.32275132275132273, "equal_cnt": 27, "replace_cnt": 19, "delete_cnt": 2, "insert_cnt": 6, "fix_ops_cnt": 27, "bug_source_code": "#include \n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#define UP(i,l,h) for(int i=l;i=l;i--)\n#define W(a) while(a)\n#define INF 0x3f3f3f3f\n#define LL long long\n#define MAXN 1010\n#define EPS 1e-10\nusing namespace std;\n\nconst int N=300000010;\nbitset prime;\n\nint main()\n{\n int l,r;\n scanf(\"%d%d\",&l,&r);\n prime.set();\n for(int i=3;i*i<=r;i+=2){\n if(prime[i]){\n for(int j=i*i;j<=r;j+=2*i){\n prime[j]=false;\n }\n }\n }\n int count=0;\n if(left<=2&&right>=2)\n count++;\n for(int i=5;i<=r;i+=4){\n if(i>=l&&prime[i])\n count++;\n }\n printf(\"%d\\n\",count);\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": "3bdcc559dd0ba325f20d78cab2f68b61", "src_uid": "55a83526c10126ac3a6e6e5154b120d0", "apr_id": "ecde92a0dc1afbaf89d7df6edd745425", "difficulty": 2200, "tags": ["math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8414634146341463, "equal_cnt": 11, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 10, "bug_source_code": "#include \nusing namespace std;\n#define punct pair\n#define ff first\n#define ss second\n\nconst int dx[] = {-2, -2, -1, 1, 2, 2, 1, -1};\nconst int dy[] = {-1, 1, 2, 2, 1, -1, -2, -2};\n\nint tl, tc, cl, cc, nr;\npunct v[8];\n\nint main ()\n{\n\tchar c;\n\tint i, j, cate;\n\tbool ok;\n\tscanf(\"%c\", &c);\n\ttl = c - 96;\n\tscanf(\"%c\", &c);\n\ttc = c - '0';\n\tdo{\n\tscanf(\"%c\", &c);\n\tcl = c - 96;\n\t}while (c ==10);\n\tscanf(\"%c\", &c);\n\tcc = c - '0';\n\tnr = 48; cate = 0;\n\tfor (i = 0; i < 8; ++i)\n\t\tif (cl+dx[i]<9&&cl+dx[i]>0&&cc+dy[i]<9&&cc+dy[i]>0&&cl+dx[i]!=tl&&cc+dy[i]!=tc) {nr --; v[i].ff=cl+dx[i]; v[i].ss=cl+dx[i]; cate++;}\n\tfor (i = 0; i < 8; ++i)\n\t\tif (tl+dx[i]<9&&tl+dx[i]>0&&tc+dy[i]<9&&tc+dy[i]>0&&cl+dx[i]!=tl&&cc+dy[i]!=tc)\n\t\t{\n\t\t\tok = true;\n\t\t\tfor (j = 0; j < cate; ++j)\n\t\t\t\tif (tl+dx[i]==v[j].ff && tc+dy[i]==v[j].ss)\n\t\t\t\t\tok = false;\n\t\t\tif (ok == true) inr --;\n\t\t}\n\tprintf(\"%d\", nr);\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "c9e81ceacefd2997b4135170171b0b00", "src_uid": "073023c6b72ce923df2afd6130719cfc", "apr_id": "c71384d8fe9acc69eab029985f2e38be", "difficulty": 1200, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9827544328394462, "equal_cnt": 8, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 6, "fix_ops_cnt": 7, "bug_source_code": "#include \nusing namespace std;\n#define ll long long\n#define int ll\nconst int N = 2e5 + 10;\nint mod = 1e9 + 7;\nint fact[N], invfact[N];\ninline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}\ninline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}\ninline int mul(int x, int y){ return (((ll) x) * y) % mod;}\ninline int powr(int a, ll b){\n\tint x = 1 % mod;\n\twhile(b){\n\t\tif(b & 1) x = mul(x, a);\n\t\ta = mul(a, a);\n\t\tb >>= 1;\n\t}\n\treturn x;\n}\ninline int inv(int a){ return powr(a, mod - 2);}\n\nint mul_inv(int a, int b)\n{\n\tint b0 = b, t, q;\n\tint x0 = 0, x1 = 1;\n\tif (b == 1) return 1;\n\twhile (a > 1) {\n\t\tq = a / b;\n\t\tt = b, b = a % b, a = t;\n\t\tt = x0, x0 = x1 - q * x0, x1 = t;\n\t}\n\tif (x1 < 0) x1 += b0;\n\treturn x1;\n}\n\nvector primes;\nvoid pre(){\n\tint MOD = mod;\n\tfor(int i = 2; i * i <= MOD; i++){\n\t\tif(MOD % i == 0){\n\t\t\tprimes.push_back(i);\n\t\t\twhile(MOD % i == 0) MOD /= i;\n\t\t}\n\t}\n\tif(MOD != 1) primes.push_back(MOD);\n\n\tfact[0] = invfact[0] = 1;\n\tfor(int i = 1;i < N; i++){\n\t\tint k = i;\n\t\tfor(int p : primes) while(k % p == 0) sk /= p;\n\t\tfact[i] = mul(k, fact[i - 1]);\n\t}\n\tfor(int i = 0; i < N; i++){\n\t\tinvfact[i] = mul_inv(fact[i], mod);\n\t}\n}\n\nint power(int n, int p){\n\tint ret = 0; n /= p;\n\twhile(n){\n\t\tret += n;\n\t\tn /= p;\n\t}\n\treturn ret;\n}\n\nint power(int n, int k, int p){\n\treturn power(n, p) - power(k, p) - power(n - k, p);\n}\n\ninline int C(int n, int k){\n\tif(n < k || k < 0) return 0;\n\tint ret = mul(fact[n], mul(invfact[k], invfact[n - k]));\n\tfor(int p : primes){\n\t\tret = mul(ret, powr(p, power(n, k, p)));\n\t}\n\treturn ret;\n}\n\nmain(){\n\tint n, l, r;\n\tcin >> n >> mod >> l >> r;\n\tpre();\n\tint ans = 0;\n\tint oddl = l / 2, oddr = (r - 1) / 2;\n\tint evenl = (l == 0) ? 0 : (l - 1) / 2 + 1;\n\tint evenr = r / 2;\n\tfor(int k = 0; k <= n; k++){\n\t\tint ans1 = 0;\n\t\tint t = k >> 1;\n\t\tif(k & 1){\n\t\t\tans1 = sub(C(2 * t + 1, t + oddl + 1), C(2 * t + 1, t + oddr + 2));\n\t\t}\n\t\telse ans1 = sub(C(2 * t, t + evenl), C(2 * t, t + evenr + 1));\n\t\tans = add(ans, mul(ans1, C(n, k)));\n\t}\n\tcout << ans;\n}", "lang": "GNU C++14", "bug_code_uid": "8bcb89599282b61384a7efe26c0cba45", "src_uid": "6ddc487029785738679007443fc08463", "apr_id": "f9ad841f46b56b7aed545c096ad46329", "difficulty": 2900, "tags": ["chinese remainder theorem", "math", "combinatorics", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.738436348751535, "equal_cnt": 11, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include \n#include \n#include \n#include\n#include\n#include \n#include \n#include \n#include \n#include \n#include\n#include \nusing namespace std;\ntypedef long long ll;\ntypedef unsigned long long ull;\ntypedef long double ld;\ntypedef vector vi;\n#define Fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);\n#define endl '\\n'\n#define sz(s) (int)(s.size())\n#define all(s) s.begin(),s.end()\n#define allr(s) s.rbegin(), s.rend()\n#define exit(s) return cout<> n >> k;\n\tvectorv;\n\tfor (int i = 1 ;i <=n; i++)\n\t{\n\t\t\n\t\tv.push_back(i);\n\t\t\n\t}\n\n\tll l = 0, r = sz(v) - 1, m, ans =0;\n\twhile (l<= r)\n\t{\n\t\t\n\t\tm = (l + r) / 2;\n\t\tll div=1 , sum = 0 , c =0;\n\t\twhile (div != 0)\n\t\t{\n\t\t\tdiv = v[m] / (pow(k, c));\n\t\t\tsum += div;\n\t\t\tc++;\n\t\t\n\t\t}\n\t\tif (sum < n)\n\t\t{\n\t\t\tl = m + 1;\n\t\t\n\t\t}\n\t\telse if (sum == n)\n\t\t{\n\t\t\tans = v[m];\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tans = v[m];\n\t\t\tr = m-1;\n\t\t}\n\t}\n\tcout << ans << endl;\n}\n", "lang": "GNU C++14", "bug_code_uid": "f20d96bdbca42e6ccb5f5f389224433b", "src_uid": "41dfc86d341082dd96e089ac5433dc04", "apr_id": "f3fddacbf9f0dd9e016c434237c6476d", "difficulty": 1500, "tags": ["implementation", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8214904679376083, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "#include\nusing namespace std;\nint main(){\n string s1,s2;\n cin>> s1 >> s2;\n char arr[]={'q','w','e','r','t','y','u','i','o','p','a','s','d','f','g','h','j','k','l',';','z','x','c','v','b','n','m',',','.','/'};\n if(s1 == \"R\"){\n for(int i=0;i\n#include\n#include\nusing namespace std;\nint main()\n{\n long long int n,k;\n cin>>n>>k;\n int flag=0;\n vectorv;\n for(long long int i=1;i<=k&&i*i<=n;i++)\n {\n v.push_back(n%i);\n }\n sort(v.begin(),v.end());\n vectortemp=v;\n temp.erase(unique(temp.begin(),temp.end()),temp.end());\n if(temp.size()==v.size())\n cout<<\"Yes\"<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \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 sc(a) scanf(\"%d\",&a)\n#define all(x) (x).begin(),(x).end()\n#define rall(x) (x).rbegin(),(x).rend()\n#define mp make_pair\n#define pb push_back\nconst ll mod = 1000000009;\n#define INF (int)(2e9 + 1e8)\n#define LINF (ll)(4e18)\n#define forn(x,y,n) for(int (x) = y;(x)> n >> a;\n\tvectormas(n);\n\tforn(i, 0, n) {\n\t\tcin >> mas[i];\n\t}\n\ta--;\n\tint lptr, rptr;\n\tlptr = rptr = a;\n\tint cnt = 0;\n\tif (mas[a] == 1) cnt++;\n\tlptr--, rptr++;\n\tif (n == 1) {\n\t\tcout << cnt << endl;\n\t\treturn 0;\n\t}\n\twhile (1) {\n\t\tif (lptr < 0) {\n\t\t\tif (mas[rptr]) cnt++;\n\t\t\tbreak;\n\t\t}\n\t\tif (rptr > n - 1) {\n\t\t\tif (mas[lptr]) cnt++;\n\t\t\tbreak;\n\t\t}\n\t\tif (mas[lptr] && mas[rptr]) cnt+=2;\n\t\tlptr--, rptr++;\n\t}\n\tcout << cnt << endl;\n\treturn 0;\n}", "lang": "MS C++", "bug_code_uid": "082ee8826f1e5e6b9b86869196f51c01", "src_uid": "4840d571d4ce6e1096bb678b6c100ae5", "apr_id": "9c07089c8c2e56ab216f5c28cbd246f1", "difficulty": 1000, "tags": ["constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.2814601344860711, "equal_cnt": 18, "replace_cnt": 8, "delete_cnt": 8, "insert_cnt": 2, "fix_ops_cnt": 18, "bug_source_code": "#include \n#include \n\nusing namespace std;\n\n\nint main() { \n\n\tint selectedIndex = 13;\n\tint Steps = 0;\n\tbool PlusOrMinus = false;\n\tint TheWordIndex = 0;\n\n\tint Result = 0;\n\tchar Alpha [26] = {'n','o','p','q','r','s','t','u',\n\t\t'v','w','x','y','z','a','b','c',\n\t\t'd','e','f','g','h','i','j','k',\n\t\t'l','m'};\n\n\tstring TheWord;\n\n\tcin >> TheWord;\n\n\n\twhile(TheWordIndex < TheWord.size()){\n\n\t\tint Counter = selectedIndex;\n\n\t\twhile(true){\n\n\t\t\tif(TheWord[TheWordIndex] == Alpha[Counter]){\n\t\t\t\tselectedIndex = Counter;\n\t\t\t\tResult += Steps;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif(Steps >= 13){\n\t\t\t\tPlusOrMinus = true;\n\t\t\t\tCounter = selectedIndex;\n\t\t\t\tSteps = 0;\n\t\t\t}\n\n\t\t\telse if(Counter == 25){\n\t\t\t\tCounter = 0;\n\t\t\t\tPlusOrMinus = false;\n\t\t\t\tSteps++;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif(PlusOrMinus)\n\t\t\t\tCounter--;\n\t\t\telse\n\t\t\t\tCounter++;\n\n\t\t\tSteps++;\n\t\t}\n\n\t\tTheWordIndex++;\n\n\t\tSteps = 0;\n\t\tPlusOrMinus = false;\n\t}\n\n\n\tcout << Result << endl;\n\n\treturn 0;\n}\n\n", "lang": "MS C++", "bug_code_uid": "83602b1bdafd75c623f0070d3b0bce6e", "src_uid": "ecc890b3bdb9456441a2a265c60722dd", "apr_id": "726d2e4e5286b0ccc18c531852b1b40f", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9949494949494949, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include\nusing namespace std;\n\nint main()\n{\n string s;\n long c=0,l=0,r=0,in,i;\n cin>>s;\n int le=s.length();\n\n for(i=0;s[i]!='A';i++)\n {\n if(s[i]=='Q')\n l=l+1;\n\n }\n in=i+1;\n for(int j=in;j\nusing namespace std;\nint main()\n{\n int m,s,k,i,j;\n cin>>m>>s;\n if(m>1&&s<1 || s>m*9)\n {\n cout<<-1<<' '<<-1; \n }\nelse\n{\n for(i=m-1,k=s;i>=0;i--) \n {\n j=max(0,k-9*i);\n if(j==0&&i==m-1&&k) j=1;\n cout<=0;i--)\n {\n j=min(9,k);\n cout<\n#include \n#include \n#include \n\nusing namespace std;\n\nvector mali(int len, int sum){\n vector ret;\n int s = 0;\n\n ret.insert(ret.begin(), len, 0);\n\n int brojac = len - 1;\n while(true){\n if(s == sum) break;\n if(ret[brojac] == 9) brojac--;\n ret[brojac]++;\n s++;\n }\n\n if(ret[0] == 0){\n for(int i = 1; i < len; i++){\n if(ret[i] != 0){\n swap(ret[0], ret[i]);\n break;\n }\n }\n }\n\n if(len == 1) return ret;\n\n int it = 0;\n for(int i = 0; i < len; i++){\n while(ret[i] > 1){\n ret[i]--;\n ret[len - it - 1]++;\n if(ret[len - it - 1] == 9) it--;\n if(ret[it] == i) break;\n }\n }\n\n\n return ret;\n}\n\nvector velik(int len, int sum){\n vector ret;\n int s = 0;\n\n ret.insert(ret.begin(), len, 0);\n\n int brojac = 0;\n\n while(true){\n if(s == sum) break;\n if(ret[brojac] == 9) brojac++;\n ret[brojac]++;\n s++;\n }\n return ret;\n}\n\nint main(){\n int n, m;\n scanf(\"%d %d\", &n, &m);\n\n vector mini, maxi;\n\n if(n == 0 || (n != 1 && m == 0) || m > n * 9){\n printf(\"-1 -1\");\n return 0;\n }\n\n mini = mali(n, m);\n maxi = velik(n, m);\n\n for(int i = 0; i < n; i++)\n printf(\"%d\", mini[i]);\n\n printf(\" \");\n\n for(int j = 0; j < n; j++)\n printf(\"%d\", maxi[j]);\n\n\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "043604842cbfc933ebcac476cf3e88f4", "src_uid": "75d062cece5a2402920d6706c655cad7", "apr_id": "e76e6558be80ce5c59ecb63a4049ffde", "difficulty": 1400, "tags": ["dp", "greedy", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.6849757673667205, "equal_cnt": 10, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": " #include \n #define INF 999999999\n #define mx 100500\n #define ll long long\n #define uns unsigned\n #define turbo ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);\n using namespace std;\n ll int a[mx*5],n;\n int main()\n {\n turbo\n cin>>n;\n a[1]=1;\n for (int i=2;i<=n;i++)\n {\n a[i]=a[i-1]*2;\n }\n for (int i=1;i<=n;i++)\n {\n if (a[i]==n) {cout<<1;return 0;}\n if (a[i+1]>n) {cout<<(n-a[i])+1;return 0;}\n //cout<\nusing namespace std;\nint main()\n{\n\tint a,b,c,n;\n\tcin>>n;\n\t\t if(n%4==0 || n%7==0|| n==799 || n==94)\n\t\t{\n\t\t\tcout<<\"YES\"<\n#include\n#include\nusing namespace std;\n__int64 a,n,s,d,f,g,h,k,l,l1,ans,u,o;\nint i,j,q,w,e,r,t,y;\n\n \nmain(){\ncin>>n>>a>>o;l=1;k=1;\nfor(q=2;q<=n;q++){\nl=l*q;}\nfor(q=2;q<=a;q++){\nk=k*q;}\nfor(i=4;i<=n;i++){\nfor(j=1;j<=a;j++){//cout<\n#define int long long int\n#define pb push_back\n#define mp make_pair\n#define mem(a,b) memset(a,b,sizeof(a))\nusing namespace std;\nint32_t main(){\n int n,i,sum,c;\n cin>>n;\n if(n==1){\n cout<<1;\n return 0;\n }\n vectorv;\n v.pb(n);\n sum=n;\n while(true){\n c=0;\n if(sum==2){\n v.pb(1);\n break;\n }\n for(i=2;i*i<=n;i++){\n if(sum%i==0){\n c++;\n v.pb(sum/i);\n sum=n/i;\n break;\n }\n }\n if(!c){\n v.pb(1);\n break;\n }\n }\n for(i=0;i\nusing namespace std;\nconst int N =1e8+60;\ntypedef long long ll;\nll a[N];\nll aval (ll x){\n\tfor (int i=2;i*i-2<=x;i++){\n\t\tif (x%i==0){\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\nint main(){\n\tll n;\n\tcin >> n;\n\tif (n==1){\n\t\tcout << 1;\n\t\treturn 0;\n\t}\n\tll ans =0;\n\tif (aval(n) or n==2){\n\t\tcout << 2;\n\t\treturn 0;\n\t}\n\tfor (int i=1;i<=n;i++){\n\t\tif (n%i==0){\n\t\t\t//cout << i;\n\t\t\tans ++;\n\t\t}\n\t}\n\t\n\t\n\tcout<< ans;\n\treturn 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "0797c2b4c74ca7b522571144e35032fe", "src_uid": "7fc9e7d7e25ab97d8ebc10ed8ae38fd1", "apr_id": "17b32d21c8bcdd8f6a8e92b72cb3e0d0", "difficulty": 1200, "tags": ["math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7068273092369478, "equal_cnt": 10, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "#include\nusing namespace std;\n\n#define ll long long \n#define sci(n) scanf(\"%d\",&n)\n#define scii(a,b) scanf(\"%d%d\",&a,&b)\n#define scl(a) scanf(\"%lld\",&a)\n#define F(i,a,b) for(int i =a;i \n#define vpi vector> \n#define vvi vector>\n#define pii pair \n#define ff first\n#define ss second\n#define pb push_back\n#define mp make_pair\n#define all(x) (x).begin(),(x).end()\n#define w(t) int t;cin>>t;while(t--)\n#define mod 1000000007\n\nint solve(vi v, int s){\n\tfor(int i = 0;i>a>>b>>c;\n\tset s;\n\tvi v;\n\ts.insert(a);\n\twhile(a){\n\t\tint x = (a*10) / b;\n\t\tv.pb(x);\n\t\ta = (a*10) % b;\n\t\tif(s.find(a) != s.end()) break;\n\t}\n\tif(a == 0) v.pb(0);\n\tcout<\nusing namespace std;\nint d(int x)\n{\n\tif (x<10) return x;\n\tint s=0;\n\twhile(x)\n\t{\n\t\ts+=(x%10);\n\t\tx/=10;\n\t}\n\treturn d(s);\n}\nint main()\n{\n\tint n,i,j,k,a,b,c,kol=0;\n\tcin>>n;\n\tfor(i=1;i<=n;i++)\n\tfor(j=1;j<=n;j++)\n\tfor(k=1;k<=n;k++)\n\tif ((d(k)==d(d(i)*d(j)))&&(i*j!=k)) kol++;\n\tcout<\n#include \n \nusing namespace std;\n\nint main()\n{\n int sum=0;\n string s;\n cin>>s;\n \n \nfor(int i=0;i\n#define ll long long\n#define rep(i,n) for(int i=0;i<(int)n;i++)\nusing namespace std;\n\nint main()\n{\n string s;\n cin>>s;\n \n int j;\n \n for(j=0;j<(int)s.size();j++)\n {\n if(s[j]=='e')\n {\n break;\n }\n }\n \n string p = s.substr(0,j);\n string q = s.substr(j+1,s.size()-j-1);\n \n stringstream ss(q);\n int x = 0;\n ss>>x;\n \n if(x+2>=(int)p.size())\n {\n int tmp = p.size()-x-2;\n swap(p[0],p[1]);\n \n string t = p.substr(1,p.size()-1);\n \n while(tmp--)\n {\n t+='0';\n }\n cout<0)\n {\n p.erase(p.begin()+j);\n j--;\n }\n cout<\n#include\nusing namespace std;\nstring s;\nint main()\n{int index=0;\n cin>>s;\nfor(int j=0;j<=s.length();j++)\n {for(char i=97;i<123;i++)\n if(s[j]==i&&s[j]!=' ')\n {\n index= s.length();\n for(int i=0;i<=s.length();i++)\n {\nfor(int j=i+1;j\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#pragma comment (linker, \"/STACK:1000000000\")\n\nusing namespace std;\n\n#define pb push_back\n#define pob pop_back\n#define rs resize\n#define as assign\n#define lwb lower_bound\n#define upb upper_bound\n#define mp make_pair\n#define sz(a) a.size()\n#define FOR(i, n) for (int i = 0; i < n; ++i)\n#define FOD(i, n) for (int i = n - 1; i >= 0; --i)\n\ntypedef long long ll;\ntypedef vector vi;\ntypedef vector vvi;\ntypedef vector vl;\ntypedef vector vvl;\ntypedef vector vb;\ntypedef vector vvb;\ntypedef vector vs;\ntypedef vector vc;\ntypedef vector vvc;\ntypedef vector vvvi;\ntypedef vector vvvvi;\ntypedef vector vvvl;\ntypedef vector vvvvl;\ntypedef vector vvvb;\ntypedef double db;\ntypedef long double ldb;\ntypedef vector vdb;\ntypedef vector vldb;\ntypedef pair ii;\ntypedef pair ic;\ntypedef pair lll;\ntypedef pair il;\ntypedef pair li;\ntypedef vector vii;\ntypedef vector vic;\ntypedef vector vvic;\ntypedef vector vvii;\ntypedef vector vll;\ntypedef vector vvll;\ntypedef set si;\ntypedef set sii;\ntypedef set > sib;\ntypedef vector vsi;\ntypedef map mii;\ntypedef map msc;\ntypedef map mci;\ntypedef queue qi;\ntypedef deque di;\ntypedef stack sti;\n\nconst ll inf = (ll)1e18 + 7;\n\nbool f(int x, int y, int z)\n{\n if (y > 12)\n return 0;\n if (x > 31)\n return 0;\n if (y == 3)\n {\n if (z % 4 == 0 && x > 29)\n return 0;\n if (z % 4 != 0 && x > 28)\n return 0;\n }\n if (y != 3)\n {\n if (y < 7 && y % 2 == 0 && x == 31)\n return 0;\n if (y > 7 && y % 2 == 1 && x == 31)\n return 0;\n }\n return 1;\n}\n\nint main()\n{\n#ifndef ONLINE_JUDGE\n freopen(\"input.txt\", \"r\", stdin);\n freopen(\"output.txt\", \"w\", stdout);\n#endif\n vi a(3), b(3);\n string s, t;\n cin >> s >> t;\n a[0] = 10 * (int)(s[0] - '0') + (int)(s[1] - '0');\n a[1] = 10 * (int)(s[3] - '0') + (int)(s[4] - '0');\n a[2] = 10 * (int)(s[6] - '0') + (int)(s[7] - '0');\n b[0] = 10 * (int)(t[0] - '0') + (int)(t[1] - '0');\n b[1] = 10 * (int)(t[3] - '0') + (int)(t[4] - '0');\n b[2] = 10 * (int)(t[6] - '0') + (int)(t[7] - '0');\n for (int i = 0; i < 3; ++i)\n for (int j = 0; j < 3; ++j)\n {\n if (i == j)\n continue;\n int k = 3 - i - j;\n if (b[i] == 29 && b[j] \n if (f(b[i], b[j], b[k]) && (a[2] - b[k] > 18 || (a[2] - b[k] == 18 && a[1] > b[j]) || (a[2] - b[k] == 18 && a[1] == b[j] && a[0] >= b[i])))\n {\n cout << \"YES\";\n return 0;\n }\n }\n cout << \"NO\";\n return 0;\n}", "lang": "MS C++", "bug_code_uid": "964bd6a545d05bd582b20ac6abbfc941", "src_uid": "5418c98fe362909f7b28f95225837d33", "apr_id": "aad0d3926832f45a247f137c52bb3f67", "difficulty": 1700, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.34776119402985073, "equal_cnt": 11, "replace_cnt": 7, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "//lasha-buxo\n\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include \n#include \n#define PI 3.141592653589793\n\nusing namespace std;\n int n,i,s[100]={0},y=0;\n int muqara(int x){\n for (int i=1;i<=x-1;i++)\n if (s[i]==s[x] || abs(i-x)==abs(s[i]-s[x])) return 1;\n return 0;\n };\n void dfs(int k){\n if (k>n){ \n for (i=1;i<=n;i++)\n cout<>n;\n n=8;\n dfs(1);\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "c253d94217547800c3cd37258cac27fd", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "apr_id": "f10e7eed39e64bc700b015e6acba26a9", "difficulty": 1300, "tags": ["geometry"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9861111111111112, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#include \nusing namespace std;\n \nint main()\n{\n string s,ss;\n cin>>s;\n mapm;\n for(int i=0;i<10;i++)cin>>ss;m[ss]=i;\n for(int i=0;i>80;i+=10)cout<\n#include\n#include\n#include\n\nusing namespace std;\n\nint ispossible(vectorv,int s)\n{\n int a=v.size();\n bool dp[s+1][a+1];\n for(int i=0;i> n;\n vectorv;\n for(int i=1;i<=n;i++)\n {\n\n v.push_back(i);\n s=s+i ;\n }\n cout << ispossible(v,s) << endl;\n\n}\n", "lang": "GNU C++14", "bug_code_uid": "c39bb7f534e2e487ea15e7f2ff3591f4", "src_uid": "fa163c5b619d3892e33e1fb9c22043a9", "apr_id": "4fa093947f0847da9895107e9a9876a5", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.628032345013477, "equal_cnt": 13, "replace_cnt": 2, "delete_cnt": 4, "insert_cnt": 7, "fix_ops_cnt": 13, "bug_source_code": "#include\n#include\n#include\nint main()\n{\n char n[100]; int l,a,b,c,d,res,x;\n scanf(\"%d\",&l);\n scanf(\"%s\",&n);\n\n for(int i=3;i13) a=26-a;\n b= (n [i-2] - 'C' ); if (b<0) b=b*(-1); if (b>13) b=26-b + (n[i-2] - 64) ;\n c= (n [i-1] - 'T' ); if (c<0) c=c*(-1); if (c>13) c=26-c + (n[i-1] - 64) ;\n d= (n [i-0] - 'G' ); if (d<0) d=d*(-1); if (d>13) d=26-d + (n[i-0] - 64) ;\n\n\n if(i=3) res = a+b+c+d;\n x= a+b+c+d;\n\n if(res>x) res=x;\n }\n\n printf(\"%d\\n\", res);\n\n}\n", "lang": "GNU C++17", "bug_code_uid": "bc3355a74acbe6124569118df296fcdc", "src_uid": "ee4f88abe4c9fa776abd15c5f3a94543", "apr_id": "09c5d5c992b25f32c694b0169f498ba0", "difficulty": 1000, "tags": ["brute force", "strings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9771289537712895, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define MOD 1000000007\n#define pb push_back\n#define INF 0x3f3f3f3f\n#define INFLL (1LL*INF*INF)\n#define ll long long\n#define NMAX 100005\n#define MMAX 1000005\n\nusing namespace std;\n\ntypedef pair pii;\n\nchar s[77];\nint nr[77][(1<<20)+(1<<10)];\n\nint main() {\n\tint n,i,j,bitmask,mmax=20,res=0,val;\n\n\tcin>>n>>s;\n\tfor(i=0;i<=n;++i) nr[i][0]=1;\n\n\tfor(i=0;immax) break;\n\n\t\t\t\tnr[j][bitmask|(1<<(val-1))] = (nr[j][bitmask|(1<<(val-1))]+nr[i][bitmask])%MOD;\n\t\t\t}\n\t\t}\n\t}\n\n\tfor(i=0;i<=n;++i)\n\t\tfor(j=1;j<=mmax;++j) res=(res+nr[i][(1<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n//conversion\n//------------------------------------------\ninline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}\ntemplate inline string toString(T x) {ostringstream sout;sout< VI;\ntypedef vector VVI;\ntypedef vector VS;\ntypedef pair PII;\ntypedef long long LL;\n\n//container util\n//------------------------------------------\n#define ALL(a) (a).begin(),(a).end()\n#define RALL(a) (a).rbegin(), (a).rend()\n#define PB push_back\n#define MP make_pair\n#define SZ(a) int((a).size())\n#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)\n#define EXIST(s,e) ((s).find(e)!=(s).end())\n#define SORT(c) sort((c).begin(),(c).end())\n\n//repetition\n//------------------------------------------\n#define FOR(i,a,b) for(int i=(a);i<(b);++i)\n#define REP(i,n) FOR(i,0,n)\n\n#define MOD 1000000007\n\nint p,t;\nint s1, s2;\nVI CC;\nint goal;\n\nLL Calc(int pos, int times){\n if(s2 != -1){\n if(times == 1){\n if(pos ==1)return (t/s2-1);\n else return t/s2;\n }else{\n if(pos == 1){\n return (t/s2-1)*Calc(1, times-1)+(t-t/s2)*Calc(0, times-1)%MOD;\n }else{\n return (t/s2)*Calc(1, times-1)+(t-t/s2-1)*Calc(0, times-1)%MOD;\n }\n }\n }\n if(pos == 1){\n if(times == 1)return 0;\n return ((t-1)*Calc(0, times-1))%MOD;\n }else{\n if(times == 1)return 1;\n return ((t-2)*Calc(0, times-1)+Calc(1, times-1))%MOD;\n }\n}\n\nvoid main(int argc, char *argv[]){\n string start, end;\n int k;\n s1 = s2 = -1;\n goal = -1;\n p=0;\n cin >> start >> end >> k;\n t = start.length();\n start += start;\n REP(i, t){\n if(start.substr(i, t) == end){\n if(goal != -1 && s2 == -1){\n s1 = goal;\n s2 = i-goal;\n }\n goal = i;\n }\n }\n if(goal == -1){\n printf(\"0\\n\");\n return;\n }\n if(s2 == -1)printf(\"%I64d\\n\", Calc((goal==0), k)); \n else printf(\"%I64d\\n\", Calc((goal%s2==0), k)); \n}", "lang": "MS C++", "bug_code_uid": "db8552dfe3572bf6e97eb197831a1be9", "src_uid": "414000abf4345f08ede20798de29b9d4", "apr_id": "f83ed2ff4f4437265ccfd61b9d9af5c5", "difficulty": 1700, "tags": ["dp"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.07338709677419354, "equal_cnt": 32, "replace_cnt": 25, "delete_cnt": 2, "insert_cnt": 6, "fix_ops_cnt": 33, "bug_source_code": "1#include\nusing namespace std;\nconst int MAXN = 105;\nconst int P = 1e9 + 7;\ntemplate void chkmax(T &x, T y) {x = max(x, y); }\ntemplate void chkmin(T &x, T y) {x = min(x, y); } \ntemplate void read(T &x) {\n\tx = 0; int f = 1;\n\tchar c = getchar();\n\tfor (; !isdigit(c); c = getchar()) if (c == '-') f = -f;\n\tfor (; isdigit(c); c = getchar()) x = x * 10 + c - '0';\n\tx *= f;\n}\ntemplate void write(T x) {\n\tif (x < 0) x = -x, putchar('-');\n\tif (x > 9) write(x / 10);\n\tputchar(x % 10 + '0');\n}\ntemplate void writeln(T x) {\n\twrite(x);\n\tputs(\"\");\n}\nint power(int x, int y) {\n\tif (y == 0) return 1;\n\tint tmp = power(x, y / 2);\n\tif (y % 2 == 0) return 1ll * tmp * tmp % P;\n\telse return 1ll * tmp * tmp % P * x % P;\n}\nnamespace Lagrange {\n\tint N, x[MAXN], y[MAXN], a[MAXN];\n\tvoid work() {\n\t\tmemset(a, 0, sizeof(a));\n\t\tstatic int p[MAXN], q[MAXN];\n\t\tmemset(p, 0, sizeof(p)); p[0] = 1;\n\t\tfor (int i = 1; i <= N; i++) {\n\t\t\tint now = P - x[i];\n\t\t\tfor (int j = i; j >= 1; j--)\n\t\t\t\tp[j] = (1ll * p[j] * now + p[j - 1]) % P;\n\t\t\tp[0] = 1ll * p[0] * now % P;\n\t\t}\n\t\tfor (int i = 1; i <= N; i++) {\n\t\t\tmemset(q, 0, sizeof(q));\n\t\t\tfor (int j = N; j >= 0; j--)\n\t\t\t\tq[j] = (p[j + 1] + 1ll * q[j + 1] * x[i]) % P;\n\t\t\tint mul = 1;\n\t\t\tfor (int j = 1; j <= N; j++)\n\t\t\t\tif (i != j) mul = 1ll * mul * (x[i] - x[j]) % P;\n\t\t\tif (mul < 0) mul = P + mul;\n\t\t\tmul = 1ll * power(mul, P - 2) * y[i] % P;\n\t\t\tfor (int j = 0; j <= N; j++)\n\t\t\t\ta[j] = (a[j] + 1ll * q[j] * mul) % P;\n\t\t}\n\t}\n\tint calc(long long n) {\n\t\tn %= P;\n\t\tint ans = 0, now = 1;\n\t\tfor (int i = 0; i <= N; i++) {\n\t\t\tans = (ans + 1ll * now * a[i]) % P;\n\t\t\tnow = 1ll * now * n % P;\n\t\t}\n\t\treturn ans;\n\t}\n\tvoid calc(long long n, int m) {\n\t\tstatic long long x[MAXN];\n\t\tfor (int i = 1; i <= m; i++)\n\t\t\tread(x[i]);\n\t\tsort(x + 1,", "lang": "GNU C++11", "bug_code_uid": "6efaeb854cec1d7edf84c8b32953a4c8", "src_uid": "6f6fc42a367cdce60d76fd1914e73f0c", "apr_id": "c797372a6ec93d6934669059630ecf50", "difficulty": 2600, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.13761814744801512, "equal_cnt": 21, "replace_cnt": 14, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 21, "bug_source_code": "/be name khoda\n#include \n#include \n#include \nusing namespace std;\ntypedef long long ll;\nll lomiss,miss,d,n,a[200000],ans[20],l=0,anses[20],l2=0;\nvoid write()\n{\n sort(ans,ans+l);\n for(int i=1;i>n;\n for(int i=0;i>a[i];\n sort(a,a+n);\n if(n==1)\n {\n cout<<-1<\n#include \n#include \n#include \nusing namespace std;\nint main()\n{\n string s;\n int pk = 1;\n cin >> s;\n vector v;\n vector v0;\n for(int i = 0; i <= 9; i++)\n v.push_back(i);\n int k = 10;\n for(int i = 1; i < s.size(); i++)\n {\n for(int j = 0; j < v.size(); j++)\n {\n int t = v[j];\n int vt = (t + s[i] - '0');\n v0.push_back(vt / 2);\n if(t + '0' == s[i - 1] && vt / 2 + '0' == s[i] && pk == i)\n pk++;\n if(vt % 2 == 1)\n {\n v0.push_back(vt / 2 + 1);\n if(t + '0' == s[i - 1] && vt / 2 + '1' == s[i] && pk == i)\n pk++;\n }\n }\n k += v0.size();\n v = v0;\n v0.clear();\n }\n if(pk == s.size())\n cout << v.size() - 1;\n else\n cout << v.size();\n return 0;\n}", "lang": "GNU C++", "bug_code_uid": "aaa5e774e3dc8517423a6f08c9f71b80", "src_uid": "2dd8bb6e8182278d037aa3a59ca3517b", "apr_id": "f6d022db7353de83025c30d85f2cd593", "difficulty": 1700, "tags": ["dp"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.475, "equal_cnt": 14, "replace_cnt": 7, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 13, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#define int int64_t\n\nusing namespace std;\n\nvector>> dp;\nint sol(int n, int m, int k){\n if(k == 0){\n return 1;\n }\n if(n < 3 || m < 3){\n return 0;\n }\n if(dp[n][m][k] == -1){\n dp[n][m][k] = 0;\n for(int i = 1; i < n-1; i++){\n for(int j = 1; j < m-1; j++){\n dp[n][m][k]+=sol(i, j, k-1)*((n-1-i)*(m-1-j));\n dp[n][m][k] = dp[n][m][k]%1000000007;\n }\n }\n //cout << n << ' ' << m <<' ' << k <<' ' << dp[n][m][k] <<'\\n';\n }\n //cout << n << ' ' << m <<' ' << k <<' ' << dp[n][m][k] <<'\\n';\n return dp[n][m][k];\n}\nsigned main(){\n ios_base::sync_with_stdio(false);\n cin.tie(NULL);\n int n, m, k;\n cin >> n >> m >> k;\n dp.assign(n+1, vector>(m+1, vector(k+1, -1)));\n cout << sol(n, m, k);\n}\n", "lang": "GNU C++11", "bug_code_uid": "6fa9b8fad81dd354558496faac1a5a36", "src_uid": "309d2d46086d526d160292717dfef308", "apr_id": "1a609604d4a5a46866b7dbde4cc7629b", "difficulty": 2000, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9976442873969376, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include \nusing namespace std;\n\nconst int N = 1e8 + 5;\nint n, k, x;\n\nbool isComposit[N];\nvector v;\n\nvoid sp(){\n isComposit[0] = isComposit[1] = false;\n for(int i = 2; i <= N/i; i++){\n if(isComposit[i] == false){\n v.push_back(i);\n for(int j = i*i; j < N; j += i)\n isComposit[j] = true;\n }\n }\n}\n\nint main(){\n scanf(\"%d%d\", &n, &k);\n sp();\n //printf(\"%d\", v[1]);\n for(int i = 2; i <= n; i++){\n if(isComposit[i] == false){\n for(int j = 1; j < v.size(); j++){\n if(v[j] == i) break;\n x = v[j] + v[j - 1] + 1;\n if(x == i){\n k--;\n //cout << x << \" \";\n }\n }\n }\n }\n\n if(k == 0) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n}\n", "lang": "GNU C++14", "bug_code_uid": "d79bcb6d3751fd876fc5a774a9fa08f7", "src_uid": "afd2b818ed3e2a931da9d682f6ad660d", "apr_id": "e7ef222515c0764be815faccaa2b22aa", "difficulty": 1000, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.972972972972973, "equal_cnt": 11, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 10, "bug_source_code": "#include \n\nusing namespace std;\n\n#define pb push_back\n#define mp make_pair\n#define eb emplace_back\n\ntypedef long long ll;\ntypedef long double ld;\ntypedef int long long;\n\nconst int inf = 2e9;\nconst ll base = 998244353;\nconst int maxn = 300500;\n\n\nint main() {\n srand(time(NULL));\n // freopen(\"input.txt\", \"r\", stdin);\n //freopen(\"output.txt\", \"r\", stdin);\n std::ios_base::sync_with_stdio(false);\n std::cin.tie(nullptr);\n string a; cin >> a;\n int n = a.length();\n vector b(n);\n for (int i = 0; i < n; ++i) {\n if (a[i] == 'A') {\n b[i] = 1;\n } else {\n b[i] = 0;\n }\n }\n vector> dp1(n + 1), dp2(n + 1);\n dp1[0] = {1, 0};\n dp2[0] = {0, 1};\n map, pair, vector>> s;\n s[{0, 0}] = {{0, 1}, {}};\n s[{0, 1}] = {{1}, {0}};\n s[{1, 0}] = {{0, 1}, {1}};\n s[{1, 1}] = {{1}, {1}};\n for (int i = 1; i <= n; ++i) {\n int cur = i % n, prev = i - 1;\n for (auto c : s[{b[prev], b[cur]}].first) {\n if (!c) dp1[i].first += dp1[prev].first;\n else dp1[i].second += dp1[prev].first;\n if (!c) dp2[i].first += dp2[prev].first;\n else dp2[i].second += dp2[prev].first;\n }\n for (auto c : s[{b[prev], b[cur]}].second) {\n if (!c) dp1[i].first += dp1[prev].second;\n else dp1[i].second += dp1[prev].second;\n if (!c) dp2[i].first += dp2[prev].second;\n else dp2[i].second += dp2[prev].second;\n }\n }\n cout << dp1[n].first + dp2[n].second;\n return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "43e84ecf91278ba9591d8ec44a021977", "src_uid": "ad27d991516054ea473b384bb2563b38", "apr_id": "1a097c5b2fa0e43e555c3b19175f5730", "difficulty": 2100, "tags": ["combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9983571931471485, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#pragma comment(linker, \"/STACK:100000000\")\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n#define int64 long long\n#define ldb long double\n#define pb push_back\n#define mp make_pair\n#define fs first\n#define sc second\n#define sz(a) ((int) (a).size())\n#define eprintf(...) fprintf(stderr, __VA_ARGS__)\n#define taskname \"task_c\"\nconst ldb pi = acos(-1.0);\n\nconst int MAXN = 150;\n\nstring s;\nbool is_ab[MAXN], used[MAXN];\nvector adj[MAXN];\nlong long cycles[MAXN], lines[MAXN];\n\nint dfs (int v) {\n\tused[v] = false;\n\n\tint num = 1;\n\tfor (int i = 0; i < sz(adj[v]); ++i) {\n\t\tif (!used[adj[v][i]]) {\n\t\t\tnum += dfs(adj[v][i]);\n\t\t}\n\t}\n\n\treturn num;\n}\n\nint main() {\n//\tassert(freopen(taskname\".in\", \"r\", stdin));\n//\tassert(freopen(taskname\".out\", \"w\", stdout));\n\n\tcin >> s;\n\treverse(s.begin(), s.end());\n\tint n = s.length();\n\n\tlines[0] = 1;\n\tlines[1] = 2;\n\tfor (int i = 2; i <= n / 2; ++i) {\n\t\tlines[i] = lines[i - 1] + lines[i - 2];\n\t}\n\n\tcycles[2] = 3;\n\tfor (int i = 3; i <= n / 2; ++i) {\n\t\tcycles[i] = lines[i - 1] + lines[i - 3];\n\t}\n\n\tfor (int i = 0; i < n; ++i) {\n\t\tis_ab[i] = false;\n\t}\n\n\tfor (int i = 0; i < n; ++i) {\n\t\tif (s[i] == 'A' && s[(i + 1) % n] == 'B') {\n\t\t\tis_ab[i] = true;\n\t\t}\n\t}\n\n\tint num_ab = 0;\n\tfor (int i = 0; i < n; ++i) {\n\t\tused[i] = !is_ab[i];\n\t\tnum_ab += (int) is_ab[i];\n\t}\n\n\tif (num_ab == n / 2 && (n % 2 == 0)) {\n\t\tcout << cycles[n / 2] << endl;\n\t\treturn 0;\n\t}\n\n\tfor (int i = 0; i < n; ++i) {\n\t\tif (s[i] == 'B' && s[(i + 1) % n] == 'A') {\n\t\t\tint v1 = (i - 1 + n) % n;\n\t\t\tint v2 = (i + 1) % n;\n\t\t\t\n\t\t\tif (!is_ab[v1] && !is_ab[v2]) {\n\t\t\t\tcout << 0 << endl;\n\t\t\t\treturn 0;\n\t\t\t} else if (is_ab[v1] && is_ab[v2]) {\n\t\t\t\tadj[v1].pb(v2);\n\t\t\t\tadj[v2].pb(v1);\n\t\t\t} else if (is_ab[v1]) {\n\t\t\t \tused[v1] = true;\n\t\t\t} else {\n\t\t\t\tused[v2] = true;\n\t\t\t}\n\t\t}\n\t}\n\n\tlong long ans = 1;\n\tfor (int i = 0; i < n; ++i) {\n\t\tif (!used[i]) {\n\t\t\tans = ans * lines[dfs(i)];\n\t\t}\n\t}\n\tcout << ans << endl;\n\t\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "ed0a83da335f261565d9bf4adca8d2a2", "src_uid": "ad27d991516054ea473b384bb2563b38", "apr_id": "1403e337aed7833b56113c96e58e722d", "difficulty": 2100, "tags": ["combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5410404624277456, "equal_cnt": 26, "replace_cnt": 15, "delete_cnt": 0, "insert_cnt": 10, "fix_ops_cnt": 25, "bug_source_code": "#include\nusing namespace std;\nint main(){\n // string s1;\n // string s2;\n // cin>>s1;\n // cin>>s2;\n long long int yc,bc,y,g,b;\n\n cin>>yc>>bc;\n cin>>y>>g>>b;\nlong long int y1=yc;\n// long int g1=g;\n\nlong long int b1=bc;\nlong long int c1=y;\nlong long int c2=b;\nlong long int cnt=0;\nfor(long long int i=0;i\nusing namespace std;\nint main()\n{\n int n,m;\n int max,min;\nwhile(true)\n {cin>>n>>m;\n\n if(n==0 || (n==0 && m==0))\n {\n cout<<\"Impossible\"<n)\n {\n max=m+n-1;\n min=(n-1)+(m-n)+1;\n }\n\n else if(m==n)\n {\n max=m+n-1;\n min=m;\n }\n\n else\n {\n max=m+n-1;\n min=m+n-m;\n }\n\n cout<\n\nint\nmain ()\n{\n int n2, n3, n5, n6;\n int n256, n32, ans;\n scanf (\"%d%d%d%d\", n2, n3, n5, n6);\n\n if (n5 < n6)\n n256 = n5;\n else\n n256 = n6;\n\n if (n2 < n256)\n n256 = n2;\n\n ans = 256 * n256;\n n2 -= n256;\n\n if (n2 < n3)\n n32 = n2;\n else\n n32 = n3;\n\n printf (\"%d\", ans += 32 * n32);\n\n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "7f1fb487a2545edd2135d365d582ab48", "src_uid": "082b31cc156a7ba1e0a982f07ecc207e", "apr_id": "cd560519ba0589fb60326af986441ef8", "difficulty": 800, "tags": ["greedy", "math", "brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9486718593968444, "equal_cnt": 11, "replace_cnt": 4, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "#include \n#include \n#include \n#include \n\nusing namespace std;\n\nmap M;\nstring Type[6] = {\"first\", \"second\", \"illegal\", \"the first player won\", \"the second player won\", \"draw\"};\nvector S(9, 0);\n\nstring getType()\n{\n if(S[0] == S[1] && S[1] == S[2])\n {\n if(S[0] == 1)\n return Type[3];\n if(S[0] == 2)\n return Type[4];\n }\n if(S[3] == S[4] && S[4] == S[5])\n {\n if(S[3] == 1)\n return Type[3];\n if(S[3] == 2)\n return Type[4];\n }\n if(S[6] == S[7] && S[7] == S[8])\n {\n if(S[6] == 1)\n return Type[3];\n if(S[6] == 2)\n return Type[4];\n }\n if(S[0] == S[3] && S[3] == S[6])\n {\n if(S[0] == 1)\n return Type[3];\n if(S[0] == 2)\n return Type[4];\n }\n if(S[1] == S[4] && S[4] == S[7])\n {\n if(S[1] == 1)\n return Type[3];\n if(S[1] == 2)\n return Type[4];\n }\n if(S[2] == S[5] && S[5] == S[8])\n {\n if(S[2] == 1)\n return Type[3];\n if(S[2] == 2)\n return Type[4];\n }\n if(S[0] == S[4] && S[4] == S[8])\n {\n if(S[0] == 1)\n return Type[3];\n if(S[0] == 2)\n return Type[4];\n }\n if(S[2] == S[4] && S[4] == S[6])\n {\n if(S[2] == 1)\n return Type[3];\n if(S[2] == 2)\n return Type[4];\n }\n\n vector a(2, 0);\n\n for(int i = 0; i < 9; i++)\n a[S[i]]++;\n\n if(a[0] > a[1])\n {\n if(a[0] == 5)\n return Type[5];\n else\n return Type[1];\n }\n else\n return Type[0];\n}\n\nint getState(vector &v)\n{\n int st = 0, p = 1;\n for(int i = 0; i < 9; i++, p *= 3)\n st += v[i] * p;\n return st;\n}\n\nvoid play(int p)\n{\n string type = getType();\n int state = getState(S);\n M[state] = type;\n\n if(type == Type[3] || type == Type[4])\n return;\n\n for(int i = 0; i < 9; i++)\n if(S[i] == 0)\n {\n S[i] = p;\n play(p==1?2:1);\n S[i] = 0;\n }\n}\n\nint main()\n{\n play(1);\n\n string str = \"\", temp = \"\";\n for(int i = 0; i < 3; i++)\n {\n cin >> temp;\n str += temp;\n }\n vector v(9, 0);\n for(int i = 0; i < 9; i++)\n v[i] = str[i] == 'X' ? 1 : (str[i] == '0' ? 2 : 0);\n\n int st = getState(v);\n\n map::iterator it;\n it = M.find(st);\n if(it != M.end())\n cout << it->second;\n else\n cout << \"illegal\";\n}\n", "lang": "GNU C++0x", "bug_code_uid": "e131de187929fbd53a78d44aad79895a", "src_uid": "892680e26369325fb00d15543a96192c", "apr_id": "54075b43424a5252a63c87311b484830", "difficulty": 1800, "tags": ["games", "brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.3931203931203931, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "#include \nusing namespace std;\n#define LL long long\n\nLL helper()\n{\n LL n, a, b, p, q;\n cin >> n >> a >> b >> p >> q;\n LL cnta = 0, cntb = 0;\n unordered_set com;\n for (LL i = a; i <= n; i += a)\n {\n if (i % b == 0)\n {\n com.emplace(i);\n }\n else\n {\n cnta++;\n }\n }\n\n for (LL j = b; j <= n; j += b)\n {\n if (j % a == 0)\n {\n com.emplace(j);\n }\n else\n {\n cntb++;\n }\n }\n\n int c = com.size();\n LL ans = cnta * p + cntb * q;\n if (p > q)\n ans += c * p;\n else\n ans += c * q;\n return ans;\n}\n\nsigned main()\n{\n\n cout << helper();\n}", "lang": "GNU C++17", "bug_code_uid": "63e0ef99e5e9ab94fb80067aaaae4c5a", "src_uid": "35d8a9f0d5b5ab22929ec050b55ec769", "apr_id": "f1680230cc9c3a3155d3a56765d7515c", "difficulty": 1600, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9929478138222849, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include\n#define ll long long int\n#define pb(x) push_back(x)\n#define un unsigned\n#define dbl double\n#define loop(s,n) for(int i=s;i=0 && bsum>=0) return true;\n return false;\n}\n\nstring remove(string s)\n{\n int f=0;\n string a=\"\";\n loop(0,s.size())\n {\n if(s[i]!='0' && f==0) f=1;\n if(f) a+= s[i];\n }\n return a;\n}\n\nint main()\n{\n string s,a=\"\",b=\"\";\n cin>>s;\n int n=s.size(),f=0;\n char ch='.';\n for(int i=0;i v;\n if(a.size()==1 && b.size()==1)\n {\n cout<<-1<\n#include \n#include \n#include \n#include // setpreciosn\nusing namespace std;\n\n#define forall(i,a,b) for(int i=a;i> n >> p >> t;\n double ans = 0;\n ans = calculate(n,p,t);\n cout << setprecision(10) << (n-ans) << endl;\n}", "lang": "GNU C++", "bug_code_uid": "5ae964e961004a4bd5ef618116e1a885", "src_uid": "20873b1e802c7aa0e409d9f430516c1e", "apr_id": "8b18762587e8d0dea2e6327d8ccc9178", "difficulty": 1700, "tags": ["dp", "math", "combinatorics", "probabilities"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9934354485776805, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 4, "bug_source_code": "#include\n#include\n#include\n#include\n\nusing namespace std;\nlong n,c, i ,j ,k, a[1000],dif[500], savepos;\nint main()\n{\n while(1)\n {\n cin>>n>>c;\n int max = 0;\n for(i = 0; i>a[i];\n if(i > 0)\n {\n dif[i-1]= a[i-1] - a[i];\n if(dif[i-1] > max)\n {\n max = dif[i-1];\n savepos = i - 1;\n }\n }\n }\n\n if(max > 0)\n {\n //printf(\"%ld\\n\", (max - c));\n cout<<(max-c)<\n#include\n#include\nusing namespace std;\n\nint main()\n{\n int i,j,a[5][5],x,move;\n string s2,s3,s4,s5;\n \n char s1[6],s6[6];\n int n1,n2,n3,n4,n5;\n cin.getline(s1,6);\n /*getline(cin,s2);\n getline(cin,s3);\n getline(cin,s4);\n getline(cin,s5);*/\n i = 1;\n j =1; \n for(i=0;i<9;i++) \n { \n if (s1[i] != ' ') \n s6[j] = s1[i]; \n cout<<\n j++;\n \n } \n \n cout<<\"best\"<0)\n {\n x=n1%10;\n a[1][j]=x;\n n1=n1/10;\n j--;\n }\n //row2\n n2=stoi(s2);\n j=5;\n while(n2>0)\n {\n x=n2%10;\n a[2][j]=x;\n n2=n2/10;\n j--;\n }\n //row3\n j=5;\n n3=stoi(s3);\n \n while(n3>0)\n {\n x=n3%10;\n a[3][j]=x;\n n3=n3/10;\n j--;\n }\n //row 4\n j=5;\n n4=stoi(s4);\n \n while(n4>0)\n {\n x=n4%10;\n a[4][j]=x;\n n4=n4/10;\n j--;\n }\n //row 5\n j=5;\n n5=stoi(s5);\n \n while(n5>0)\n {\n x=n5%10;\n a[5][j]=x;\n n5=n5/10;\n j--;\n }\n cout<<\"array\"<3 && j>3)\n {\n move=i-3+j-3;\n \n }\n if(i<3 && j<3)\n {\n move=3-i+3-j;\n }\n if(i<3 && j>3)\n {\n move=3-i+j-3;\n }\n if(i>3 && j<3)\n {\n move=i-3+3-j;\n }\n if(i==3 && j<3)\n {\n move=3-j;\n }\n if(i==3 && j>3)\n {\n move=j-3;\n }\n if(i<3 && j==3)\n {\n move=3-i;\n }\n if(i>3 && j==3)\n {\n move=i-3;\n }\n if(i==3 && j==3)\n {\n move=0;\n }\n \n \n }\n }\n }\n cout<\nint main(){\n int n, m = 1;\n scanf(\"%x\",n);\n printf(\"%d\", m);\n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "e007c5dfa6f64d4ab377b573d05a6103", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "apr_id": "7d0a5a456d095b5f1b855546c7745c56", "difficulty": null, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.13344739093242086, "equal_cnt": 12, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "#include\n#include\nusing namespace std;\nchar c[20][20];\nbool row[20], col[20];\nint main()\n{\n\tint n, m;\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{\n\t\t\tscanf(\" %c\", &c[i][j]);\n\t\t\tif (c[i][j] == 'S')\n\t\t\t\trow[i] = true, col[j] = true;\n\t\t}\n\tint ans = 0;\n\tfor (int i = 0; i < n; ++i)\n\t\tfor (int j = 0; j < m; ++j)\n\t\t\tif (!row[i] || !col[j])\n\t\t\t\t++ans;\n\tprintf(\"%d\", ans);\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "aaca76efef0c40fba4370b6dbb71642d", "src_uid": "72a196044787cb8dbd8d350cb60ccc32", "apr_id": "562f77561dda206ca3e80dc4792608c6", "difficulty": 1500, "tags": ["greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9503424657534246, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "#include\nusing namespace std;\nint main(){\n int a[20],b[20],ans=0;\n char c[100010],d[100010];\n memset(a,0,sizeof(a));\n memset(b,0,sizeof(b));\n cin>>c>>d;\n for(int i=0;i\n#include \nusing namespace std;\nint n,m,k,a,b;\nint main()\n{\n cin >> n >> m >> k >> a >> b;\n int x = a / (m * k) + 1;\n if (a == (x - 1) * m * k)\n x--;\n int y = b / (m * k) + 1;\n if (b == (y - 1) * m * k)\n y--;\n int d = min(abs(x - y), n - abs(x - y));\n int cek = d * 15;\n int q1 = a - (x - 1) * m * k;\n int f1 = (q1 / k) + 1;\n if (q1 % k == 0)\n f1--;\n int q2 = b - (y - 1) * m * k;\n int f2 = (q2 / k) + 1;\n if (q2 % k == 0)\n f2--;\n if (d == 0) {\n cek += min(5 * abs(f2 - f1), 10 + abs(f2 - f1))\n }\n else {\n cek += min(5 * (f2 - 1), 9 + f2);\n cek += min(5 * (f1 - 1), 9 + f1);\n }\n cout << cek;\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "43a9a61df86e4abdd6546979c0685ae8", "src_uid": "c37b46851abcf7eb472869bd1ab9f793", "apr_id": "d450ec8ba20085787a770e906003840a", "difficulty": 1400, "tags": ["constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.5957836846929423, "equal_cnt": 37, "replace_cnt": 30, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 36, "bug_source_code": "#include \nusing namespace std;\nlong long int a b c d e f g h i j k\nint main()\n{\n cin>>a>>b>>c;\n cin>>d>>e;\n h=(d-1)/(b*c)+1;\n i=(e-1)/(b*c)+1;\n d=d-(h-1)*(b*c);\n e=e-(i-1)*(b*c);\n j=(d-1)/c+1;\n k=(e-1)/c+1;\n f=min((j-1)*5 , 10+j-1);\n g=min((k-1)*5 , 10+k-1);\n if(h>i){\n swap(h , i);\n }\n if(h==i){\n d=abs(j-k);\n cout<\nusing namespace std;\nbool ip[1003099];\nvectorpj,p;\nvoid sieve(int b)\n{\n\tfor(int i=2;i*i<=b;i++)\n\t{\n\t\tif(!ip[i]){\n\t\t\tfor(int j=2;j*i<=b;j++)ip[i*j]=1;\n\t\t}\n\t}\n\tfor(int i=1;i<=b;i++)if(ip[i])p.push_back(i);\n\tfor(int i=2;i<=p.size();i++)pj.push_back(p[i]-p[i-1]);\n}\nint main()\n{\n\tint k,a,b;\n\tcin>>a>>b>>k;\n\tsieve(b);\n\tint ma1x=0,ssn=0;\n\tfor(int i=1;i<=pj.size()-k;i++)\n\t{\n\t\tfor(int j=1;j<=k;j++)ssn+=pj[i+j];\n\t\tma1x=max(ssn,ma1x);\n\t}\n\tcout<\nusing namespace std;\n\nint n, k, d;\n\nstruct node{\n\tint val;\n\tbool hasd;\n\tstruct node** children;\n};\n\nint count(struct node* tree){\n\tif(tree->val == n){if(tree->hasd)return 1; else return 0;}\n\tif(tree->val > n){return 0; }\n\ttree->children = new struct node*[k];\n\tint ret = 0;\n\tfor(int i =0; ichildren[i] = new struct node;\n\t\ttree->children[i]->val = (tree->val + i +1);\n\t\ttree->children[i]->hasd = ((tree->hasd)+((i+1) >= d));\n\t\ttree->children[i]->children = NULL;\n\t\tret += count(tree->children[i]);\n\t\tret %= 1000000007;\n\t}\n\treturn ret;\n}\n\nint main(){\n\tcin>>n>>k>>d;\n\tstruct node* tree = new struct node;\n\ttree->val = 0;\n\ttree->hasd = false;\n\ttree->children = NULL;\n\n\tint ans = count(tree);\n\tcout<\n#define lli long long int\n#define mod (1000000000 + 7)\n\nusing namespace std;\n\nlli gcd(lli a, lli b)\n{\n if(a == 0) return b;\n return gcd(b % a, a);\n}\nlli lcm(lli a, lli b)\n{\n return a / gcd(a, b) * b;\n}\n\nint main()\n{\n\tios_base::sync_with_stdio(false);\n\t#ifndef ONLINE_JUDGE\n\t\tfreopen(\"in.txt\",\"r\",stdin);\n\t#endif\n\n lli n, k, a, b;\n cin >> n >> k >> a >> b;\n lli x = INT_MAX, y = 0;\n\n for(lli i = 1; i <= n; i++)\n {\n lli l1 = i*k + a + b; \n lli l2 = i*k + a - b; \n lli l3 = i*k - a + b; \n lli l4 = i*k - a - b; \n lli c1 = lcm(l1, n*k) / l1;\n lli c2 = lcm(l2, n*k) / l2;\n lli c3 = lcm(l3, n*k) / l3;\n lli c4 = lcm(l4, n*k) / l4;\n /* cout << c1 << \" \" << c2 << \" \"<< c3 << \" \"<< c4 << endl; */\n x = min(x, min(c1, min(c2, min(c3, c4))));\n y = max(y, max(c1, max(c2, max(c3, c4))));\n }\n cout << x << \" \" << y << endl;\n\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "f95208537a3b8d282c87aa93abe34911", "src_uid": "5bb4adff1b332f43144047955eefba0c", "apr_id": "d10533a17eb7045178ca345240168302", "difficulty": 1700, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.4199134199134199, "equal_cnt": 12, "replace_cnt": 5, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 12, "bug_source_code": "#include \nusing namespace std;\nint main(){\n\tint N,M,x=0,y=0,i=0;\n\tcin>>N>>M;\n\tvector a(N),b;\n\tfor(int k=0;k>a[k];\n\tif(a[0]%2==1)\n\t\tx++;\n\telse\n\t\ty++;\n\tfor(int k=1;k\n\nusing namespace std;\n\nint main(){\n string s;\n cin >> s;\n int x = s.size();\n assert(x & 1);\n if(s[x/2]%2!=0&&x%2!=0){cout<<\"YES\";}\n else if(s[x/2]%2==0&&x%2==0){cout<<\"YES\";}\n else if(s[x/2]%2!=0&&x%2==0){cout<<\"YES\";}\n else{cout<<\"NO\";}\n return 0 ;\n}\n", "lang": "GNU C++11", "bug_code_uid": "4c2ce2c7762569d10b837297d7d66df1", "src_uid": "0f11f41cefd7cf43f498e511405426c3", "apr_id": "bac722c21823f166d12ba284e41eb5e5", "difficulty": 1900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5561893896177981, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "#include \n\nusing namespace std;\n\ntypedef long long ll;\ntypedef unsigned long long ull;\ntypedef vector vll;\ntypedef pair pii;\ntypedef vector vs;\ntypedef vector vb;\ntypedef vector vi;\ntypedef vector vd;\ntypedef vector > vvi;\ntypedef vector vii;\ntypedef vector > vvii;\ntypedef long double ld;\ntypedef map mapii;\ntypedef map mapsi;\n\n#define erep(i, x, n) for (auto i = x; i<=(ll)(n); i++)\n#define rep(i, x, n) for(auto i = x; i<(ll)(n); i++)\n#define INF LLONG_MAX\n#define all(v) ((v).begin()), ((v).end())\n#define sz(v) ((int)((v).size()))\n#define pi acos(-1)\n#define mod(n,m) ((n % m + m) % m)\n#define eps (1e-8)\n#define reset(n, m) memset(n, m, sizeof n)\n#define endl '\\n'\n#define output freopen(\"output.txt\", \"w\", stdout)\n#define mp(x, y, z) { x, {y, z} }\n\nconst int N = 2e7 + 5, mod = 1e9 + 7;\nll vals[N], accum[N];\n\nint main()\n{\n\tios_base::sync_with_stdio(0);\n\tcin.tie(0);\n//\tll p = 0, q = 5;\n//\terep(i, 1, 1000)\n//\t{\n//\t\tif (i % q == 0)\n//\t\t\tcontinue;\n//\n//\t\tif (((i / q) / (i % q)) == 2)\n//\t\t{\n//\t\t\tp += i;\n//\t\t\tcout << i << \" \" << i / q << \" \" << i % q << endl;\n//\n//\t\t}\n//\t}\n//\tcout << p << endl;\n//\treturn 0;\n\n\tll a, b;\n\tcin >> a >> b;\n\trep(i, 1, N)\n\t{\n\t\tvals[i] = vals[i - 1] + b;\n\t\tif (vals[i] >= mod)\n\t\t\tvals[i] -= mod;\n\t\taccum[i] = accum[i - 1] + vals[i];\n\t\tif (accum[i] >= mod)\n\t\t\taccum[i] -= mod;\n\t}\n\n\tll sum = 0, temp = (b * (b - 1)) / 2, extra = -1, obba7 = 0, zawwed = 0,\n\t\t\tprev;\n\tfor (ll i = 1; i < b; i++)\n\t\tzawwed = (zawwed + i * i) % mod;\n\terep(i, 1, a)\n\t{\n\t\tif (extra != -1)\n\t\t{\n\t\t\tsum = (sum + prev + obba7) % mod;\n\t\t\tprev = sum;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (i == 1)\n\t\t{\n\t\t\trep(j, 1, b)\n\t\t\t{\n\t\t\t\tint l = j - 1, r = (2 * j) - 1;\n\t\t\t\tsum = (sum + (accum[r] - accum[l])) % mod;\n\t\t\t}\n\t\t\tsum = (sum + zawwed) % mod;\n\t\t}\n\t\telse\n\t\t{\n\t\t\textra = 0;\n\t\t\tll hoba = temp;\n\t\t\trep(j, 1, b)\n\t\t\t{\n\t\t\t\tint l = (2 * j) - 1, r = min(l + j * 1ll, l + hoba);\n\t\t\t\tif (j == 1)\n\t\t\t\t\tr = j + 1, l = 1;\n\t\t\t\textra = (extra + (accum[r] - accum[l])) % mod;\n\t\t\t\thoba -= j;\n\t\t\t}\n\t\t\textra = (extra + zawwed) % mod;\n\t\t\tobba7 = mod(extra - sum, mod);\n//\t\t\tcout << \"--> \" << extra << \" \" << obba7 << endl;\n//\t\t\tcout << extra << endl;\n\t\t\tsum = (sum + extra) % mod;\n\t\t\tprev = extra;\n\t\t}\n\t}\n\tcout << sum;\n\n\treturn 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "7b624b1316ec0089e3848b3358dea32f", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "apr_id": "d8ccc4d4ef5e100f977d7b42ce0f38ae", "difficulty": 1600, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.17404817404817405, "equal_cnt": 16, "replace_cnt": 12, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 16, "bug_source_code": "#include \n#include\n#include\n#include\n\nusing namespace std;\nstruct node\n{\n int x;\n int step;\n}q,p;\n\nqueue s;\n\nint main()\n{\n int n;\n while(cin>>n)\n {\n while(!s.empty())s.pop();\n q.x=0;\n q.step=0;\n s.push(q);\n while(!s.empty())\n {\n p=s.front();\n s.pop();\n if(p.x==n)\n {\n printf(\"%d\\n\",p.step);\n break;\n }\n int f=0;\n for(int i=1;i<=5;i++)\n {\n q.x=p.x+i;\n q.step=p.step+1;\n if(q.x==n)\n {\n printf(\"%d\\n\",q.step);\n f=1;\n break;\n }\n s.push(q);\n }\n if(f==1)\n {\n break;\n }\n }\n }\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": "0e58b0c86833e2e4335d1918e1d30e33", "src_uid": "4b3d65b1b593829e92c852be213922b6", "apr_id": "304d5f781dfbabfc4740a70da0995be4", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.14566473988439307, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n\nusing namespace std;\n\ntypedef struct node\n{\n int v;\n int step;\n};\n\nint BFS(int n)\n{\n queueq;\n node t,p;\n t.v=0;\n t.step=0;\n q.push(t);\n while(!q.empty())\n {\n t=q.front();\n q.pop();\n if(t.v==n)\n return t.step;\n for(int i=1; i<=5; i++)\n {\n p.v=t.v+i;\n p.step=t.step+1;\n if(p.v==n)\n return p.step;\n q.push(p);\n }\n }\n}\n\nint main()\n{\n int x;\n scanf(\"%d\",&x);\n printf(\"%d\\n\",BFS(x));\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": "e17704b38728c11bfc149cfbadba509f", "src_uid": "4b3d65b1b593829e92c852be213922b6", "apr_id": "304d5f781dfbabfc4740a70da0995be4", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9975609756097561, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \n#define eps 1e-8\nint vp,vd,t,f,c;\nint ans=0;\ndouble Prin;\nint main(){\n scanf(\"%d%d%d%d%d\",&vp,&vd,&t,&f,&c);\n Prin=t*vp;\n if (vp>vd) {\n puts(\"0\");\n return 0;\n }\n while (Prin\nusing namespace std;\n\nint main(){\n int a,d,m;\n cin>>a>>d>>m;\n \n int g,p,b;\n cin>>g>>p>>b;\n \n int l = g - a;\n if(l>=0){\n int l2 = d - l -p;\n if(l2>=0){\n if(m - (l2) - b > 0=){\n cout<<\"YES\"<\nusing namespace std;\n#define ll long long\n#define sf(n) scanf(\"%lld\",&n)\n#define fl float\nll a[500500],b[500000];\n\n\n\nmapmp;\nint main()\n{\n cin.sync_with_stdio(false);\n ll i,j,k,l,c,v,n,m,r,t;\n ll x1,x2,y1,y2,x3,x4,x5,x6;\n double dd[300];\n string s[2000],s1,s2,s3;\n while(1)\n {\n for(i=0; i<3; i++)\n {\n cin>>s[i];\n\n }\n sort(s,s+3);\n v=10;\n\n if(s[0][0]!=s[1][0]-1&&s[1][0]!=s[2][0]-1)\n {\n c=2;\n v=min(v,c);\n }\n if((s[0]!=s[1]&&s[0]!=s[2]&&s[1]!=s[2]))\n {\n c=2;\n v=min(v,c);\n }\n if(s[0][0]==s[1][0]-1&&s[1][0]!=s[2][0]-1)\n {\n if(s[0][1]!=s[1][1])\n {\n c=2;\n // cout<<\"l\";\n v=min(v,c);\n }\n if(s[0][1]==s[1][1])\n {\n // cout<<\"p\";\n c=1;\n v=min(v,c);\n }\n\n }\n if(s[0][0]==s[2][0]-1&&s[1][0]!=s[2][0]-1)\n {\n if(s[0][1]!=s[2][1])\n {\n c=2;\n // cout<<\"l\";\n v=min(v,c);\n }\n if(s[0][1]==s[2][1])\n {\n // cout<<\"p\";\n c=1;\n v=min(v,c);\n }\n\n }\n if(s[0][0]!=s[1][0]-1&&s[1][0]==s[2][0]-1)\n {\n if(s[2][1]!=s[1][1])\n c=2;\n else if(s[2][1]==s[1][1])\n c=1;\n v=min(v,c);\n }\n if(s[0][0]==s[2][0]-1&&s[1][0]==s[0][0]+1)\n {\n if(s[0][1]!=s[2][1])\n c=2;\n else if(s[0][1]==s[2][1])\n c=1;\n v=min(v,c);\n }\n if(s[0][0]==s[1][0]-1&&s[1][0]==s[2][0]-1)\n {\n if(s[0][1]!=s[1][1]&&s[0][1]!=s[2][1]&&s[1][1]!=s[2][1])\n {\n c=2;\n\n }\n else if(s[0][1]==s[1][1]&&s[0][1]!=s[2][1])\n {\n c=1;\n }\n else if(s[0][1]==s[2][1]&&s[1][1]!=s[2][1])\n {\n c=1;\n }\n else if(s[2][1]==s[1][1]&&s[0][1]!=s[2][1])\n {\n c=1;\n }\n else\n {\n c=0;\n }\n v=min(c,v);\n }\n if((s[0]==s[1]&&s[0]!=s[2])||(s[0]==s[2]&&s[0]!=s[1])||(s[2]==s[1]&&s[0]!=s[2]))\n {\n c=1;\n v=min(c,v);\n\n }\n if(s[0]==s[1]&&s[0]==s[2])\n {\n c=0;\n v=min(c,v);\n }\n cout<\nusing namespace std;\nconst int MaxN = 2e5 + 17, INF = -1e9 + 17;\nlong long h, Ans, l, r, can, x, m;\nint main ()\n{\n cin >> h >> x;\n l = 1;\n r = (1 << h);\n for (long long i = 0; i < h; ++ i)\n {\n m = (l + r) >> 1LL;\n \tif (!can)\n \t{\n \t\tif (x > m)\n \t\t\tl = m + 1LL, Ans += (1LL << (h - i)) - 1LL;\n \t\telse\n \t\t\tr = m, can = 1;\n \t}\t\n \telse\n \t{\n \t\tif (x <= m)\n \t\t\tr = m, Ans += 1LL << (h - i)) - 1LL;\n \t\telse\n \t\t\tl = m + 1LL, can = 0;\n \t}\n }\n cout << Ans + h;\n return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "038800dc709bcb57456caf1e524d7aa3", "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781", "apr_id": "b612ebf10a89746cfba6b3ac2e1456ab", "difficulty": 1700, "tags": ["trees", "math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9800443458980045, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include\n#define ll long long \nusing namespace std;\nll n,m,a;\nstring s;\nint main()\n{\n\tcin>>n>>m;\n\tn%=10;\n\tfor(int i=1;;i++)\n\t{\n\t\ta+=n;\n\t\ta%=10;\n\t\tif(!(a-m))\n\t\t{\n\t\t\tcout<\n\nusing namespace std;\n\n//--------------------------------------------\n#define SIZE(x) (x.size())\n#define pb(x) push_back(x)\n#define mp(a, b) make_pair(a, b)\n#define ALL(X) X.begin(), X.end()\n#define SORT(x) sort(ALL(x))\n#define REVERSE(x) reverse(ALL(x))\n#define FILL(x, value) memset(x, value, sizeof(x))\n\n#define next next1\n#define hash hash1\n#define rank rank1\n#define count count1\n\n#ifdef _DEBUG_\n#define eprintf(...) fprintf(stderr, __VA_ARGS__)\n#else\n#define eprintf(...)\n#endif\n\n#if((_WIN32 || __WIN32__) && __cplusplus < 201103L)\n #define LLD \"%I64d\"\n#else\n #define LLD \"%lld\"\n#endif\n\nconst double EPS = 1e-9;\nconst int IINF = 1000000000;\nconst double PI = acos(-1.0);\nconst long long LINF = 6000000000000000000LL;\n//--------------------------------------------\n\nconst int maxN = 200 * 1000 + 7;\n\nint n, k, E[maxN], P[maxN], CP[maxN], W[maxN];\n\nbool Read() {\n if(scanf(\"%d%d\", &n, &k) == 2) {\n for(int i = 0; i < n; ++i) {\n scanf(\"%d%d\", P + i, E + i);\n }\n return true;\n }\n return false;\n}\n\nbool cmp(int i, int j) {\n if(i == n || j == n) {\n if(i == n) {\n if(CP[i] != CP[j]) return CP[i] > CP[j];\n if(W[j]) return true;\n return false;\n }\n else if(j == n) {\n if(CP[i] != CP[j]) return CP[i] > CP[j];\n if(W[i]) return false;\n return true;\n }\n }\n if(CP[i] != CP[j])return CP[i] > CP[j];\n return i > j;\n}\n\nlong long can(int mask) {\n vector< pair > v;\n v.reserve(n);\n for(int i = 0; i < n; ++i) {\n v.pb(mp(E[i], P[i]));\n }\n SORT(v);\n FILL(W, 0);\n FILL(CP, 0);\n long long ans = 0;\n for(int i = 0; i < v.size(); ++i) {\n if(mask & (1 << i)) {\n ans += v[i].first;\n CP[n]++;\n W[i] = 1;\n CP[i] = v[i].second;\n }\n else {\n CP[i] = v[i].second + 1;\n }\n }\n vector srt;\n for(int i = 0; i < n; ++i) {\n srt.pb(i);\n }\n srt.pb(n);\n sort(srt.begin(), srt.end(), cmp);\n for(int i = 0; i < srt.size(); ++i) {\n if(srt[i] == n) {\n if(i + 1 <= k) {\n return ans;\n }\n return LINF;\n }\n }\n return LINF;\n}\n\nint main() {\n#ifdef _DEBUG_\n freopen(\"input.txt\", \"r\", stdin);\n freopen(\"output.txt\", \"w\", stdout);\n#endif\n\n while(Read()) {\n long long ans = LINF;\n for(int mask = 0; mask < (1 << n); ++mask) {\n ans = min(ans, can(mask));\n }\n if(ans >= LINF) printf(\"-1\\n\");\n else printf(LLD\"\\n\", ans);\n }\n return 0;\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "lang": "GNU C++0x", "bug_code_uid": "837f6c3b180210391d4fe4db335d1611", "src_uid": "19a098cef100fc3652c59abf7c373814", "apr_id": "d0f65d6e63e190bd17993e216d525150", "difficulty": null, "tags": ["brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.06589292399850244, "equal_cnt": 37, "replace_cnt": 32, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 37, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\n#define mod 12345\n#define LL long long\n\nstruct node {\n LL v[30];\n bool operator < (const node& rhs) const{\n for (int i = 1; i <= 26; i ++){\n if (v[i] == rhs.v[i])\n continue;\n return v[i] < rhs.v[i];\n }\n return 0;\n }\n}prepare;\nstruct edge {\n int r, c;\n LL jz[150][150];\n edge operator * (const edge& rhs) const{\n edge ans;\n ans.r = r, ans.c = rhs.c;\n for (register int i = 0; i <= ans.r; i ++)\n for (register int j = 0; j <= ans.c; j ++)\n ans.jz[i][j] = 0;\n for (register int i = 1; i <= r; i ++)\n for (register int j = 1; j <= rhs.c; j ++)\n for (register int k = 1; k <= c; k ++)\n ans.jz[i][j] = (ans.jz[i][j] + jz[i][k] * rhs.jz[k][j] % mod) % mod;\n return ans;\n }\n}A;\nvector G[30];\nmap m;\nint n, c, maxn[30], cnt;\nLL ans;\n\nvoid dfs(int pos,node now)\n{\n if(pos==27)\n {\n m[now]=++cnt;\n return ;\n }\n if(maxn[pos]==0)dfs(pos+1,now);\n for(int i=0;i>= 1;\n }\n return ans;\n}\nint main (){\n scanf (\"%d %d\", &n, &c);\n if (! n){\n printf (\"1\\n\");\n return 0;\n }\n if (! c){\n printf (\"0\\n\");\n return 0;\n }\n bool vis[30] = {};\n for (int i = 1; i <= c; i ++){\n char a;\n int b;\n scanf (\"%s %d\", &a, &b);\n if (! b)\n vis[a - 'A' + 1] = 1;\n if (! maxn[a - 'A' + 1]){\n maxn[a - 'A' + 1] = b;\n }\n else{\n maxn[a - 'A' + 1] *= b;\n }\n G[a - 'A' + 1].push_back (b);\n }\n for (int i = 1; i <= 26; i ++)\n if (vis[i])\n maxn[i] = 0;\n dfs (1, prepare);\n for(map::iterator i=m.begin();i!=m.end();i++)\n {\n int s=i->second;\n node now=i->first;\n for(int j=1;j<=26;j++)\n {\n if(maxn[j]==0)continue;\n node temp=now;\n temp.v[j]=(temp.v[j]+1)%maxn[j];\n A.jz[s][m[temp]]++;\n }\n }\n A.r = A.c = cnt;\n A = qkpow (A, n);\n calc (1, prepare);\n printf (\"%lld\\n\", ans);\n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "550216dd90470e1f6350968b5dead6ae", "src_uid": "76d4684d26dac380713a566a1e277c91", "apr_id": "416542790b10a39f5bfd7b3d03a9c7a4", "difficulty": 2400, "tags": ["matrices", "graphs", "dp"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.972568578553616, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n int a[5];\n int sum=0;\n for(int i=0;i<5;i++)\n {\n cin>>a[i];\n sum+=a[i];\n } \n if(sum==0)\n {\n cout<<\"-1\";}\n\n \n if(sum%5==0)\n {\n cout<\n#include\n#include\nusing namespace std;\nconst int mod=1e9+7;\nconst int maxn=1000;\nint n,m,k;\nlong long mul[1010],inv[1010],mulinv[1010];\nlong long f[1010][1010];\nlong long power(long long x,int p){\n\tlong long ret=1;\n\twhile(p){\n\t\tif(p&1){\n\t\t\tret=(ret*x)%mod;\n\t\t}\n\t\tx=(x*x)%mod;\n\t\tp>>=1;\n\t}\n\treturn ret;\n}\nlong long c(int a,int b){\n\tif(a<0||b<0)return 0;\n\tif(a=0;j--){\n\t\t\t//c(k,i)*i!*f[n][i]*sum(c(i,j)*c(k-i,i-j)*i!*f[n][i]*power(j,(m-2)*n))\n\t\t\tans=(ans+Mul*c(i,j)%mod*mul2%mod*mulinv[i-j]%mod*mul[i]%mod*f[n][i]%mod*power(1ll*j,(m-2)*n)%mod)%mod;\n\t\t\tmul2=(mul2*(k-i-(i-j)))%mod;\n\t\t}\n\t}\n\tprintf(\"%lld\\n\",ans);\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "f809a8e547dd8562888bd30e05b204c4", "src_uid": "f22f28e2d8933f4199ba5ccfc0de8cda", "apr_id": "dacf099d5fa906ed2050ab610814d460", "difficulty": 2300, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7922535211267606, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 8, "bug_source_code": "#include \n#include \n#include \nusing namespace std;\nint main(){\nwhile(1){\n float n,t,k,d;\n cin>>n;\n cin>>t;\n cin>>k;\n cin>>d;\n \n if(n*(t/k)>t+d)\n cout<<\"YES\"<\n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\ndouble a[20];\ndouble cal1(double x, double y, double z)\n{\n double ans = z * log(y) + log(log(x));\n// printf(\"x = %f, y = %f, z = %f\\n\");\n// printf(\"first part = %f\\nsecond part = %f\\n\", z * log(y), log(log(x)));\n// system(\"pause\");\n// printf(\"ans = %f\\n\", ans);\n return ans;\n}\ndouble cal2(double x, double y, double z)\n{\n double ans = log(y * z * log(x));\n return ans;\n}\nint solve(double x, double y, double z)\n{\n a[1] = cal1(x, y, z);\n a[2] = cal1(x, z, y);\n a[3] = cal2(x, y, z);\n a[4] = cal2(x, z, y);\n\n a[5] = cal1(y, x, z);\n a[6] = cal1(y, z, x);\n a[7] = cal2(y, x, z);\n a[8] = cal2(y, z, x);\n\n a[9] = cal1(z, x, y);\n a[10] = cal1(z, y, x);\n a[11] = cal2(z, x, y);\n a[12] = cal2(z, y, x);\n\n// for(int i = 1 ; i <= 12 ; i++)\n// printf(\"%f \", a[i]);\n// printf(\"\\n\");\n int re = 1;\n double mmax = a[1];\n for(int i = 1 ; i <= 12 ; i++){\n if(a[i] > mmax) mmax = a[i], re = i;\n }\n return re;\n}\nint out[5];\nvoid print(int mark)\n{\n if(mark == 1) printf(\"x^y^z\\n\");\n if(mark == 2) printf(\"x^z^y\\n\");\n if(mark == 3) printf(\"(x^y)^z\\n\");\n if(mark == 4) printf(\"(x^z)^y\\n\");\n\n if(mark == 5) printf(\"y^x^z\\n\");\n if(mark == 6) printf(\"y^z^x\\n\");\n if(mark == 7) printf(\"(y^x)^z\\n\");\n if(mark == 8) printf(\"(y^z)^x\\n\");\n\n if(mark == 9) printf(\"z^x^y\\n\");\n if(mark == 10) printf(\"z^y^x\\n\");\n if(mark == 11) printf(\"(z^x)^y\\n\");\n if(mark == 12) printf(\"(z^y)^x\\n\");\n}\nint main()\n{\n// printf(\"log(3.4) = %f, loglog(1.1) = %f\\n\", log(3.4), log(log(1.1)));\n double x, y, z;\n while(scanf(\"%lf%lf%lf\", &x, &y, &z)){\n// x *= 1000, y *= 1000, z *= 1000;\n int mark = solve(x, y, z);\n print(mark);\n }\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "b0b8f484981e14325c495fc8fe83288b", "src_uid": "a71cb5cda754ad2bf479bc3b0164fc4c", "apr_id": "46ca3c5839a717a563057e407207bcd5", "difficulty": 2400, "tags": ["brute force", "math", "constructive algorithms"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9491087574270214, "equal_cnt": 11, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "// \tAuthor: Mohib Manva\n#include \nusing namespace std;\n\n#define SZ(a) int((a).size())\n#define PB push_back\n#define ALL(c) (c).begin(),(c).end()\n#define MP make_pair\n#define FOR(i,a,b) for(int i=(a);i<=(b);++i)\n#define REP(i,a) FOR(i,0,(a)-1)\n#define FORD(i,n,a) for(int (i)=(n);(i)>=a;(i)--)\n#define FOREACH(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)\n#define FF first\n#define SS second\n#define FILL(a, v) memset(a, v, sizeof(a));\n#define DREP(a)\t\t\t\t\tsort(ALL(a)); a.erase(unique(ALL(a)),a.end()) // will make the vector unique and sorted order\n\ntypedef long long LL;\ntypedef long double LD;\ntypedef vector VI;\ntypedef vector VLL;\ntypedef vector VD;\ntypedef vector VS;\ntypedef vector VVI;\ntypedef pair PII;\ntypedef pair PLL;\n\nconst double PI = acos(-1.0); //M_PI;\n// main code starts now.\nconst int MAXN = (int) 1e5 + 10;\n\n/* Graph Part\n\nstatic const int N = 100001;\nstatic bool v[N];\nvector adj[N];\n\n*/\nstatic int n,vis=0;\nstatic char cards[55][5];\nvector adj[101];\nstatic bool v[101];\nmap,bool> dp;\nvoid solve(int cur,std::vector vc){\n\tif(dp[vc])\n\t\treturn;\n\tif(cur==0){\n\t\tputs(\"YES\");\n\t\texit(0);\n\t}\n\t//printf(\"%d\\n\",cur);\n if(cur>0&&(vc[cur-1][0]==vc[cur][0]||vc[cur-1][1]==vc[cur][1])){\n \tstring temp = vc[cur-1];\n \tvc[cur-1] = vc[cur];\n \tsolve(cur-1,vc);\n \tvc[cur-1] = temp;\n }\n if(cur>2&&(vc[cur-3][0]==vc[cur][0]||vc[cur-3][1]==vc[cur][1])){\n \tstring temp = vc[cur-3];\n \tvc[cur-3] = vc[cur];\n \tsolve(cur-1,vc);\n \tvc[cur-3] = temp;\n }\n dp[vc] = true;\n \n\treturn;\n}\n\nvoid read(){\n\tscanf(\"%d\\n\",&n);\n\tvector vc;\n\tfor(int i=0;i>x;\n\n\t\tvc.push_back(x);\n\t}\n\tsolve(n-1,vc);\n\tprintf(\"NO\\n\");\n}\n\nint main() {\n int T = 1;\n //scanf (\"%d\", &T);\n while (T--) {\n read();\n // solve();\n }\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "a7d2f0bdd06a2a26ca31d3b75ac81ea8", "src_uid": "1805771e194d323edacf2526a1eb6768", "apr_id": "b564871366edaf2857e98c8ae78656f9", "difficulty": 1900, "tags": ["dp", "dfs and similar"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.25130458665201866, "equal_cnt": 66, "replace_cnt": 48, "delete_cnt": 11, "insert_cnt": 7, "fix_ops_cnt": 66, "bug_source_code": "#include\n\nusing namespace std;\n\n#define allof(x) (x).begin(), (x).end()\n\ntypedef long long ll;\ntypedef pair pii;\ntypedef pair pll;\n\nint N;\nstring str;\n\nstruct mv {\n int bits = 0;\n int v1, v2;\n void swap(int pos){ //with pos + 1\n int d1 = (bits >> pos) & 1;\n int d2 = (bits >> (pos + 1)) & 1;\n \n bits &= ~(3 << pos);\n \n bits |= d2 << pos;\n bits |= d1 << (pos + 1);\n \n if(v1 == pos || v1 == pos + 1){\n v1 = (pos) + (pos + 1) - v1;\n }\n \n if(v2 == pos || v2 == pos + 1){\n v2 = (pos) + (pos + 1) - v2;\n }\n }\n};\n\nconst int MAXN = 19;\n\nint dp[1 << MAXN][MAXN][MAXN];\n\nint solve(mv src){\n //cout << endl;\n //cout << bitset<8>(src.bits) << \" \" << src.v1 << \" \" << src.v2 << endl;\n memset(dp, 0x3f, sizeof dp);\n dp[src.bits][src.v1][src.v2] = 0;\n queue q;\n q.push(src);\n \n while(!q.empty()){\n mv fr = q.front();\n //cout << bitset<8>(fr.bits) << \" \" << fr.v1 << \" \" << fr.v2 << endl;\n int cost = dp[fr.bits][fr.v1][fr.v2];\n q.pop();\n \n for(int a = 0; a < 19; a++){\n fr.swap(a);\n \n if(fr.bits & (1 << (N - 1))){\n //cant have front 0\n } else {\n if(cost + 1 < dp[fr.bits][fr.v1][fr.v2]){\n dp[fr.bits][fr.v1][fr.v2] = cost + 1;\n q.push(fr);\n }\n }\n \n fr.swap(a);\n }\n }\n}\n\nint solve00(){\n mv src;\n for(int a = 0; a < N; a++){\n if(str[a] == '0'){\n src.bits |= 1 << a;\n }\n }\n src.v1 = -1;\n src.v2 = -1;\n for(int a = N - 1, cnt = 0; a >= 0; a--){\n if(str[a] == '0'){\n if(cnt == 0){\n src.v1 = a;\n cnt++;\n } else if (cnt == 1){\n src.v2 = a;\n break;\n }\n }\n }\n if(src.v1 == -1 || src.v2 == -1){\n return 1e9;\n }\n \n solve(src);\n \n int ans = 1e9;\n for(int a = 0; a < (1 << N); a++){\n ans = min(ans, dp[a][N - 2][N - 1]);\n }\n return ans;\n}\n\n\nint solve25(){\n mv src;\n for(int a = 0; a < N; a++){\n if(str[a] == '0'){\n src.bits |= 1 << a;\n }\n }\n src.v1 = -1;\n src.v2 = -1;\n for(int a = N - 1; a >= 0; a--){\n if(str[a] == '2' && src.v1 == -1){\n src.v1 = a;\n }\n if(str[a] == '5' && src.v2 == -1){\n src.v2 = a;\n }\n }\n if(src.v1 == -1 || src.v2 == -1){\n return 1e9;\n }\n \n solve(src);\n \n int ans = 1e9;\n for(int a = 0; a < (1 << N); a++){\n ans = min(ans, dp[a][N - 2][N - 1]);\n }\n return ans;\n}\n\nint solve50(){\n mv src;\n for(int a = 0; a < N; a++){\n if(str[a] == '0'){\n src.bits |= 1 << a;\n }\n }\n src.v1 = -1;\n src.v2 = -1;\n for(int a = N - 1; a >= 0; a--){\n if(str[a] == '5' && src.v1 == -1){\n src.v1 = a;\n }\n if(str[a] == '0' && src.v2 == -1){\n src.v2 = a;\n }\n }\n if(src.v1 == -1 || src.v2 == -1){\n return 1e9;\n }\n \n solve(src);\n \n int ans = 1e9;\n for(int a = 0; a < (1 << N); a++){\n ans = min(ans, dp[a][N - 2][N - 1]);\n }\n return ans;\n}\n\nint solve75(){\n mv src;\n for(int a = 0; a < N; a++){\n if(str[a] == '0'){\n src.bits |= 1 << a;\n }\n }\n src.v1 = -1;\n src.v2 = -1;\n for(int a = N - 1; a >= 0; a--){\n if(str[a] == '7' && src.v1 == -1){\n src.v1 = a;\n }\n if(str[a] == '5' && src.v2 == -1){\n src.v2 = a;\n }\n }\n if(src.v1 == -1 || src.v2 == -1){\n return 1e9;\n }\n \n solve(src);\n \n int ans = 1e9;\n for(int a = 0; a < (1 << N); a++){\n ans = min(ans, dp[a][N - 2][N - 1]);\n }\n return ans;\n}\n\nint main(){\n cin.tie(0);\n cin.sync_with_stdio(0);\n\n cin >> str;\n N = str.size();\n \n int ans = 1e9;\n ans = min(ans, solve00());\n ans = min(ans, solve25());\n ans = min(ans, solve50());\n ans = min(ans, solve75());\n \n if(ans == 1e9){\n cout << -1;\n } else {\n cout << ans;\n }\n}", "lang": "GNU C++14", "bug_code_uid": "2baf7667fbba280dac5b839bca6b2b6a", "src_uid": "ea1c737956f88be94107f2565ca8bbfd", "apr_id": "4fc5372078f2ddae525a9ca6d146dd7d", "difficulty": 2100, "tags": ["brute force", "greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8597122302158273, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "/*FROME ZHU YUTIAN*/\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\ntypedef long long ll;\n\nint main()\n{\n int h1,h2;\n int a,b;\n cin>>h1>>h2>>a>>b;\n int d=-1;\n int dup=(a-b)*12;\n int s=0;\n if(dup<=0&&a*8+h1\n\nusing namespace std;\n\nint N, M, p[1000009], p2[1000009];\nconst int mod = 1e9 + 7;\n\nint mul (int x, int y) {return 1LL * x * y % mod;}\nvoid adto (int &x, int y) {x += y; if (x >= mod) x -= mod;}\n\nint main ()\n{\nscanf (\"%d %d\", &N, &M), p[0] = p2[0] = 1;\nfor (int i=1; i<=N; i++)\n p[i] = mul (p[i - 1], M), p2[i] = mul (p2[i - 1], 2 * M - 1);\nint ans = power (M, N);\nfor (int P=1; P<=N; P++)\n adto (ans, mul (p[N - P + 1], p2[P - 1]));\nprintf (\"%d\\n\", ans);\nreturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "cd2fba9c7a86bccf26775ae5003fd08e", "src_uid": "5b775f17b188c1d8a4da212ebb3a525c", "apr_id": "ff8ba6e32cb25e8f1c23f106583c5e0d", "difficulty": 2300, "tags": ["combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9704968944099379, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "\n#include\nusing namespace std;\n#define se second\n#define fi first\n#define ll long long\n#define ld long double\n#define pll pair\n#define plll pair\n#define ppll pair\n#define pii pair \n#define pb push_back\n#define mod 10000000007\nll power(ll a,ll b){\n ll res=1ll;\n while(b>0){\n if(b%2!=0) res=(res*a)%mod;\n a=(a*a)%mod;\n b/=2;\n }\n return res%mod;\n}\nll ncr(ll n,ll k){\n if(k>n-k) k=n-k;\n ll pro=1;\n for(ll i=0;i arr; \nvoid permute(string a, int l, int r) \n{ \n if (l == r) \n arr.pb(a); \n else { \n for (int i = l; i <= r; i++) { \n swap(a[l], a[i]); \n permute(a, l+1, r); \n swap(a[l], a[i]); \n } \n } \n} \nvoid solve() {\n ll n,m;\n cin>>n>>m;\n ll d1=(log10(n)/log10(7))+1;\n ll d2=(log10(m)/log10(7))+1;\n vector pow7(12,1);\n for(int i=1;i<11;i++) {\n pow7[i]=pow7[i-1]*7;\n }\n string str=\"0123456\";\n permute(str,0,6);\n set s;\n ll cnt=0;\n for(int i=0;i=0;j--,k++) {\n num1+=pow7[k]*(hrs[j]-'0');\n }\n for(int j=d2-1,k=0;j>=0;j--,k++) {\n num2+=pow7[k]*(min[j]-'0');\n }\n if(num1\nusing namespace std;\n\n#include \nusing namespace __gnu_cxx;\n\n#include \n#include \nusing namespace __gnu_pbds;\n\ntypedef long long ll;\n\nint n, m, u, v;\nint modl;\nint prime[150010], cprime, isprime[150010];\n\nint bit(int n, int i) {\n return (n>>i)&1;\n}\n\npair Count(int k, bool debug = 0) {\n\n int l = int(sqrt(max(0.0, ll(u-1)*(u-1) - ll(k)*k + 0.0)) + 1e-8) + 1, r = int(sqrt(max(0.0, ll(v)*(v) - ll(k)*k + 0.0)) + 1e-8);\n if (l > r) return make_pair(0, 0);\n\n vector d; d.clear();\n while (k > 1) {\n int p = isprime[k];\n d.push_back(p);\n while (k%p == 0) k/= p;\n }\n\n pair ret = make_pair(0, 0);\n int ds = d.size();\n // if (debug) cout << l << \" \" << r << \" \" << ds << endl;\n\n for(int i = 1; i < (1<= R) continue;\n if (count&1) {\n ret.first = (ret.first + product * (((ll(R+1)*R - ll(L+1)*L)/2) % modl)) % modl;\n ret.second = (ret.second + (((ll(R+1)*R - ll(L+1)*L)/2) % modl)) % modl;\n }\n else {\n ret.first = (ret.first - product * (((ll(R+1)*R - ll(L+1)*L)/2) % modl)) % modl;\n ret.second = (ret.second - (((ll(R+1)*R - ll(L+1)*L)/2) % modl)) % modl; \n }\n if (ret.first < 0) ret.first += modl;\n if (ret.second < 0) ret.second += modl;\n \n }\n // if (debug) cout << ret.first << \" \" << ret.second << endl;\n ret = make_pair(((ll(r+1)*r - ll(l-1)*l)/2 - ret.first) % modl, ((r-l+1) - ret.second) % modl);\n if (ret.first < 0) ret.first += modl;\n if (ret.second < 0) ret.second += modl;\n return ret;\n}\n\nint main() {\n\n #ifndef ONLINE_JUDGE\n freopen(\"E.txt\", \"r\", stdin);\n #endif\n\n cprime = 0;\n for(int i = 2; i <= 150000; i++)\n if (!isprime[i]) {\n prime[cprime++] = i;\n for(int j = i; j <= 150000; j++)\n isprime[j] = i;;\n }\n\n cin >> n >> m >> u >> v >> modl;\n ll ret = 0;\n for(int deltaX = 1; deltaX <= n; deltaX++) {\n pair tret = Count(deltaX);\n ret = (ret + 2*(n-deltaX+1)*(ll(m+1)*tret.second - tret.first)) % modl;\n }\n n++; m++;\n ret += ll(m)*n*2 - (m+n);\n cout << ret % modl;\n\n return 0;\n}", "lang": "GNU C++", "bug_code_uid": "491dbaddd02778cde6da24770de86ebc", "src_uid": "2afe29a7dbbd2e261e1870a43d57b46f", "apr_id": "890ba5a498de5b59c52ddf2ba836084b", "difficulty": 2500, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7774086378737541, "equal_cnt": 15, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 11, "fix_ops_cnt": 14, "bug_source_code": "# include \n\nusing namespace std;\n\nint main()\n{\nint n;\ncin>>n;\nif(n%2==0)\ncout<\n\nusing namespace std;\n\nint sum, n, x;\ndouble answer;\nmain(){\n \n cin >> n;\n for(int i = 1; i <= n; ++i){\n cin >> x;\n sum += x;\n answer = max((double)sum/i, answer);\n }\n cout << fixed << setprecision(6) << answer;\n}", "lang": "GNU C++14", "bug_code_uid": "26147ff6cec0be515c51be39436ed9e5", "src_uid": "32fc378a310ca15598377f7b638eaf26", "apr_id": "d8bc9d915e673863656895fc04d45416", "difficulty": 1700, "tags": ["trees", "implementation", "graph matchings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.04699738903394256, "equal_cnt": 6, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "#include\nusing namespace std;\nint n,a[4][7],m=0;\nint main()\n{\n\tcin>>n;\n\tfor(int i=1;i<=n;i++)\n\tfor(int j=1;j<=6;j++)\n\tcin>>a[i][j];int f=1;\n\twhile(f!=0)\n\t{\n\t\tm++;\n\t\tint f1=0;\n\t\tfor(int i=1;i<=n;i++)\n\t\tfor(int j=1;j<=n;j++)\n\t\tfor(int k=1;k<=6;k++)\n\t\tfor(int l=1;l<=6;l++)\n\t\tif(a[i][k]*10+a[j][l]==m||a[i][k]+a[j][l]*10==m){f1=1;break;}\n\t}\n\tcout<\n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n\n\n\nint main()\n{\n\tint x, y, z;\n\tcin >> x >> y >> z;\n\tint days = 0, max = 0;\n\tfor (int i(1); i < 8; i++)\n\t{\n\t\tint d = i;\n\t\tint n = x, b = y, c = z;\n\t\tbool f = true;\n\t\twhile (f)\n\t\t{\n\t\t\tif (((d == 1) || (d == 4) || (d == 7))&&(n>0))\n\t\t\t\tn--;\n\t\t\telse f = !f;\n\t\t\tif (((d == 2) || (d == 6)) && (b > 0))\n\t\t\t\tb--;\n\t\t\telse f = !f;\n\t\t\tif (((d == 3) || (d == 5)) && (c > 0))\n\t\t\t\tc--;\n\t\t\telse f = !f;\n\t\t\tif (f)\n\t\t\t{\n\t\t\t\td++;\n\t\t\t\tdays++;\n\t\t\t\tif (d > 7)\n\t\t\t\t\td = 1;\n\t\t\t}\n\t\t}\n\t\tf = true;\n\t\tif (max < days)\n\t\t\tmax = days;\n\t\tdays = 0;\n\t}\n\tcout << max;\n\n\treturn 0;\n}\n", "lang": "MS C++ 2017", "bug_code_uid": "c0315bd84150fadba44ac14f476c7a87", "src_uid": "e17df52cc0615585e4f8f2d31d2daafb", "apr_id": "12fce7cfc88fd68079c684f4c4b7deb3", "difficulty": 1400, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.999697428139183, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \"time.h\"\nusing namespace std;\n#define SZ(x) (int)x.size()\n#define FOR(i,x,y) for(int i=(int)(x);i<=(int)(y);++i)\n#define REP(i,n) FOR(i,0,n-1)\n#define FORD(i,x,y) for(int i=(int)(x);i>=(int)(y);--i)\n#define ALL(a) (a).begin(),(a).end()\n#define FORE(i,t) for(i=t.begin();i!=t.end();++i)\ntypedef vector VI;\ntypedef vector VS;\ntypedef vector VB;\ntypedef vector VD;\ntypedef deque DI;\ntypedef deque DS;\n#define PI 3.14159265358979323\n#define DEGTORAD(x) (double)x * 3.14159265358979323846264338327950288 / 180.0\n#define RADTODEG(x) (double)x * 180 / 3.14159265358979323846264338327950288\n#define prt if(1)printf\ntypedef pair< int, int > PII;\ntemplate string tostr(const T& t) { ostringstream os; os< segs;\n int cnt;\n\n bool operator<(const typestate& x2) const {\n const typestate& x1=(*this);\n if (x1.segs != x2.segs)\n return x1.segs < x2.segs;\n return x1.cnt < x2.cnt;\n }\n};\n\nset< typestate > vis;\nqueue< typestate > Q;\n\n\nvoid move(typestate& s, int segFrom, int segTo) {\n // move alien from segFrom to segTo\n int ndx = SZ(s.segs[segFrom])-1;\n if (ndx < 0)\n return;\n int who = s.segs[segFrom][ndx];\n bool ok = true;\n REP(j,SZ(s.segs[segTo])) {\n if (s.segs[segTo][j] > who) {\n ok = false;\n break;\n }\n }\n if (ok) {\n typestate s2 = s;\n s2.segs[segFrom].erase(s2.segs[segFrom].begin()+ndx);\n s2.segs[segTo].push_back(who);\n s2.cnt++;\n sort(ALL(s2.segs[0]));\n sort(ALL(s2.segs[1]));\n sort(ALL(s2.segs[2]));\n Q.push(s2);\n }\n}\n\nlong long bigmod(long long b,long long p,long long m) {\n if (m == 1LL) return 0LL;\n if (p == 0LL) return 1LL;\n if (p%2LL == 0) {\n long long n = bigmod(b,p/2LL,m);\n return (n*n) % m;\n }\n return ((b % m) * bigmod(b,p-1LL,m)) % m;\n}\n\nint main() {\n#ifndef ONLINE_JUDGE\n freopen(\"140_C.in\",\"r\", stdin);\n#endif\n\n int n,m;\n cin>>n>>m;\n/*\n FOR(n,1,15) {\n\n Q.empty();\n vis.clear();\n\n typestate s;\n s.cnt = 0;\n s.segs.push_back(VI());\n s.segs.push_back(VI());\n VI who;\n FOR(i,1,n)\n who.push_back(i);\n s.segs.push_back(who);\n\n Q.push(s);\n int best = INT_MAX;\n while(!Q.empty()) {\n s = Q.front();\n Q.pop();\n\n if (vis.count(s) || s.cnt > 100)\n continue;\n vis.insert(s);\n if (SZ(s.segs[0]) == n) {\n best = min(best,s.cnt);\n continue;\n }\n\n REP(i,3) {\n REP(j,3) {\n if (i==j || abs(i-j) > 1)\n continue;\n move(s,i,j);\n }\n }\n }\n\n cout<----> Yedige Ashirbek\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#define pb push_back\n#define F first\n#define sz(x) x.size()\n#define S second\n#define all(x) x.begin(),x.end()\n#define ub upper_bound\n#define lb lower_bound\n\nusing namespace std;\n\ntypedef long long ll;\ntypedef long double ld;\ntypedef pair pii;\ntypedef pair pll;\n\ninline void boost(){\n ios_base::sync_with_stdio();\n cin.tie(0);\n cout.tie(0);\n}\n\nconst ll MAXN=1e5+123;\nconst ll inf=1e9+123;\nconst double pi=acos(-1);\nchar a[9][9];\nint main(){\n boost();\n //freopen(\"input.txt\",\"r\",stdin);\n //freopen(\"output.txt\",\"w\",stdout);\n for(int i=1;i<=9;i++){\n for(int j=1;j<=9;j++){\n cin>>a[i][j];\n }\n }\n int x,y;\n cin>>x>>y;\n x%=3;\n y%=3;\n if(x==0){\n x=3;\n }\n if(y==0){\n y=3;\n }\n x*=3;\n y*=3;\n bool b=0;\n for(int i=x-2;i<=x;i++){\n for(int j=y-2;j<=y;j++){\n if(a[i][j]=='.'){\n b=1;\n break;\n }\n }\n }\n if(b==0){\n for(int i=1;i<=9;i++){\n for(int j=1;j<=9;j++){\n if(a[i][j]=='.'){\n a[i][j]='!';\n }\n }\n }\n }\n else{\n for(int i=x-2;i<=x;i++){\n for(int j=y-2;j<=y;j++){\n if(a[i][j]=='.'){\n a[i][j]='!';\n }\n }\n }\n }\n for(int i=1;i<=9;i++){\n for(int j=1;j<=9;j++){\n cout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nconst int INF=(int)1e9+7;\n\ntypedef long long ll;\n\nint main(){\n int mas[9][9];\n for(int i=0;i<9;i++){\n for(int j=0;j<9;j++){\n cin >> mas[i][j];\n }\n }\n int iz,jz;\n cin >> iz >> jz;\n iz--;\n jz--;\n int i=iz;\n int j=jz;\n bool flag=true;\n if (mas[i][j]==33 || mas[i][j]==46) {\n flag=false;\n }\n int in=i%3+1;\n int j2=j%3+1;\n if(flag==true){\n for(int k=in;k\nusing namespace std;\n#define ff first\n#define ss second\n#define int long long\ntypedef vector vi;\n#define all(x) x.begin(), x.end()\n#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)\n#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)\n#define deb(x) cout << #x << \"=\" << x << endl\n#define deb2(x, y) cout << #x << \"=\" << x << \",\" << #y << \"=\" << y << endl\n#define endl \"\\n\"\n#define pb push_back\n#define mp make_pair\n#define re(i,n) for(int i=0;i<(n);i++)\n#define re1(i, k, n) for (int i = k; k < n ? i <= n : i >= n; k < n ? i += 1 : i -= 1)\n#define FORD(i,a,b) for(int i=(a);i>=(b);i--)\ntypedef pair pii;\ntypedef priority_queue, greater> minpq;\ntypedef priority_queue maxpq;\nconst int mod = 1000000007;\n//===================================DEBUG TEMPLATE=================================================\nvoid __print(int 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 \nvoid __print(const pair &x)\n{\n cerr << '{';\n __print(x.first);\n cerr << ',';\n __print(x.second);\n cerr << '}';\n}\ntemplate \nvoid __print(const T &x)\n{\n int f = 0;\n cerr << '{';\n for (auto &i : x)\n cerr << (f++ ? \",\" : \"\"), __print(i);\n cerr << \"}\";\n}\nvoid _print() { cerr << \"]\\n\"; }\ntemplate \nvoid _print(T t, V... v)\n{\n __print(t);\n if (sizeof...(v))\n cerr << \", \";\n _print(v...);\n}\n#ifndef ONLINE_JUDGE\n#define debug(x...) \\\n cerr << \"[\" << #x << \"] = [\"; \\\n _print(x)\n#else\n#define debug(x...)\n#endif\n//====================================DEBUG TEMPLATE==============================================\nint solve(int a,int b)\n{\n if(a==0)\n {\n return b*b;\n }\n else if(b==0)\n {\n return a*a;\n }\n else\n return 3*(2*a+2*b-2)+solve(a-1,b-1);\n}\n\nint32_t main()\n{\n FIO;\n int n;\n int a,b;\n re(i,3)\n {\n cin>>a>>b;\n }\n cout<\nusing namespace std;\nint main()\n{\n\tint x, arr[60], t=0;\n\tcin >> x;\n\tfor (int i = 0; i < 2 * x; i++)\n\t\tcin >> arr[i];\n\n\tfor (int i = 0; i < 2 * x - 3; i = i + 2)\n\t\tfor (int j = i + 3; j < 2 * x; j + 2)\n\t\t\tif (arr[i] == arr[j])\n\t\t\t\tt ++;\n\tfor (int i = 1; i < 2 * x - 2; i = i + 2)\n\t\tfor (int j = i + 1; j < 2 * x - 1; j + 2)\n\t\t\tif (arr[i] == arr[j])\n\t\t\t\tt++;\n\t\n\tcout << t;\n}", "lang": "MS C++ 2017", "bug_code_uid": "ba2ae2c6daaf0ad74555d9cb06189d99", "src_uid": "745f81dcb4f23254bf6602f9f389771b", "apr_id": "3a544e87ecf779887242870004dd5ac6", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.6130653266331658, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 9, "bug_source_code": "#include\n\nusing namespace std;\n\nint main ()\n{\n int m,n,k;\n cin>>n>>m>>k;\n int a[n];\n int p=0;\n for(int i=0;i>a[i];\n }\n sort(a,a+n,greater());\n int i=0;\n int total=k;\n for(int i=0;itotal)\n {\n cout<<\"-1\";\n return 0;\n }\n while (true)\n {\n if(m<=k)\n {\n break;\n }\n else if (m>k&&n!=0)\n {\n n--;\n m-=a[i]-1;\n i++;\n p++;\n }\n }\n cout<\n#ifdef NJUDGE\n#include \"igba.h\"\n#endif\n\nusing namespace std;\nint v[110];\n\nbool check(int index,int t){\n//\tdbg(vetor(v,index,index+t-1));\n\tfor(int i = index;i < index+t-1;i++)\n\t\tif(v[i] != v[i+1] - 1)\n\t\t\treturn false;\n\treturn true;\n}\n\nint main(){\n\tint n;\n\tcin >> n;\n\t\n\tfor(int i = 1;i <= n;i++)\n\t\tcin >> v[i];\n\tif(n == 1)\n\t\tcout << 0,exit(0);\n\t\n\tint mc = 0,b = 1;\n\tfor(int i = 1;i <= n;i++)\n\t\tif(v[i+1] == v[i] + 1)\n\t\t\tb++,mc = max(mc,b);\n\t\telse b = 1;\n\t\n\tvector r,aux;\n\tfor(int i = 1;i <= n-mc+1;i++)\n\t\tif(check(i,mc)){\n\t\t\taux.clear();\n\t\t\tfor(int j = i;j < i+mc;j++)\n\t\t\t\taux.push_back(v[j]);\n\t\t\tr = aux;\n\t\t\tif(r[0] == 1)\n\t\t\t\tbreak;\n\t\t}\n//\tdbg(r);\n\t\n\tif(r.size() > 0)\n\t\tif(r[0] == 1 || r[r.size()-1] == 1000)\n\t\t\tcout << r.size()-1,exit(0);\n//\tcerr << \"bug\" << endl;\n\tint x = (r.size()-2);\n\tcout << max(x,0) << endl;\n}", "lang": "GNU C++17", "bug_code_uid": "d6d4f6e175f7f199fdcc3f9940995409", "src_uid": "858b5e75e21c4cba6d08f3f66be0c198", "apr_id": "cdd9025b602f122c93ef0be4cc12b363", "difficulty": 1300, "tags": ["greedy", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.26492942453854507, "equal_cnt": 10, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 9, "bug_source_code": "#include\nusing namespace std;\nint n ;\nint bfs(int a , int b){\n queue , int > > q ;\n q.push(make_pair(make_pair(a , b) , 0 ));\n while(!q.empty()){\n int x = q.front().first.first;\n int y = q.front().first.second;\n int c = q.front().second;\n if(x == n || y == n)\n return c;\n q.pop();\n q.push(make_pair(make_pair(x + y , x) , c + 1));\n q.push(make_pair(make_pair(x , x + y) , c + 1));\n }\n}\nint main(){\n cin >> n;\n cout<\n#include\nusing namespace std;\n\n\nint main(){\n string s;\n cin>>s;\n if(s.length()>21)\n cout<<-1<1&&first[0]=='0')\n continue;\n if(second.length()>1&&second[0]=='0')\n continue;\n if(third.length()>1&&third[0]=='0')\n continue;\n if(first.length()>7||second.length()>7||third.length()>7)\n continue;\n for(int i = 0; i1000000||y>1000000||z>1000000)\n continue;\n check = 1;\n if(x+y+z>ans)\n ans = x+y+z;\n }\n }\n if(check)\n cout<\n#include \n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n#define ll long long\n#define ull unsigned long long\n\n#define mp make_pair\n#define pb push_back\n\n#define DEBUG(x) cout << #x << \": \" << (x) << endl;\n\nstring s;\n\nint tab[101][2][220][60];\nint was[101][2][220][60];\n\nint f(int p, bool zn, int R, int n) {\n if ( was[p][zn][R+110][n] )\n return ( tab[p][zn][R+110][n] );\n\n if ( p >= s.length() ) {\n if ( n == 0 )\n return ( abs(R) );\n else\n return ( 0 );\n }\n\n int res;\n int ch = s[p];\n\n if ( ch == 'F' )\n res = f(p+1, zn, R+(zn?1:-1), n);\n else\n res = f(p+1, !zn, R, n);\n\n for (int i = 1; i <= n; i++) {\n if ( ch == 'F' ) {\n res = max(res, f(p+1, zn = !zn, R, n-i));\n ch = 'T';\n }\n else {\n res = max(res, f(p+1, zn, R+(zn?1:-1), n-i));\n ch = 'F';\n }\n }\n\n tab[p][zn][R+110][n] = res;\n was[p][zn][R+110][n] = true;\n\n return ( res );\n}\n\nint main() {\n#ifndef ONLINE_JUDGE\n freopen( \"input.txt\", \"rt\", stdin );\n //freopen(\"output.txt\", \"wt\", stdout);\n#endif\n\n cin >> s;\n\n int n;\n cin >> n;\n\n for (int i = s.length()-1; i >= 0; i--)\n for (int j = -100; j <= 100; j++)\n f(i, true, j, 0);\n\n cout << f(0, true, 0, n);\n\nexit:\n return ( 0 );\n}\n\n", "lang": "MS C++", "bug_code_uid": "86d8ffea78cfffbc265cb2ea546b6b58", "src_uid": "4a54971eb22e62b1d9e6b72f05ae361d", "apr_id": "47abb79a8388d29ced116e1144aae44e", "difficulty": 1800, "tags": ["dp", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.12135176651305683, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 9, "bug_source_code": "#include \n#include\nusing namespace std;\n\nint main()\n{\n\n\n int ans=0,row,col,i,n;\n double t;\n cin>>n>>t;\n int x;\n x=n*(n+1)/2;\n\n double a[2*x];\ni=0;\n\nmemset(a,0,sizeof(a));\na[0]=t;\n // a[0]=1;\n // t-=1;\n\n for(row=1;row<=n+1 && t>0;row++){\n for(col=1;col<=row && t>0;col++,i++){\n t=a[i];\n a[i]=(t>=1?1:t);\n /* if(a[i]==1 && row<=n){\n ans++;\n cout<1)?(t-1):0);\n a[i+row]+=t/2;\n a[i+row+1]+=t/2;\n }\n //cout<=1)\n {\n\n //cout<>tt;\n\t// while(tt--) {\n\t\tll n, m; cin>>n>>m;\n\t\tvector v(m);\n\t\tfor(ll i=0;i>v[i];\n\t\tvector ans(n+1, 0);\n\t\tunordered_set st;\n\t\tfor(ll i=0;i n) {\n\t\t\t\tans[v[i]] = n + v[i+1] - v[i];\n\t\t\t\tst.insert(n + v[i+1] - v[i]);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tans[v[i]] = v[i+1] - v[i];\n\t\t\t\tst.insert(v[i+1] - v[i]);\n\t\t\t}\n\t\t}\n\t\tunordered_set present;\n\t\tfor(ll i=1;i<=n;i++) {\n\t\t\tif(st.find(i) == st.end()) present.insert(i);\n\t\t}\n\t\t// for(auto it:present) cout<\n#include \n\nusing namespace std;\n\nint main()\n{\n\tint n;\n\tint count(0);\n\tint a(0);\n\tint x[100];\n\tint tmp[101];\n\tvectors[101];\n\tfor (int i(0); i < 101; i++){ tmp[i] = 0; }\n\tcin >> n;\n\tfor (int i(0); i < n; i++)\n\t{\n\t\tcin >> x[i];\n\t\ttmp[x[i]]++;\n\t}\n\n\n\n\tfor (int i(0); i < n; i++)\n\t{\n\t\tif (tmp[x[i]] <= count)\n\t\t{\n\t\t\tfor (int j(0); j < tmp[x[i]]; j++)\n\t\t\t{\n\t\t\t\ts[j].push_back(x[i]);\n\t\t\t}\n\t\t\ta += tmp[x[i]];\n\t\t}\n\n\t\tif (tmp[x[i]] > count)\n\t\t{\n\t\t\tif (count * x[i] - a >= tmp[x[i]]) //count * x[i] - a \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\n\t\t\t{\n\t\t\t\tint q(0);\n\t\t\t\tfor (int j(0); j < tmp[x[i]]; j++)\n\t\t\t\t{\n\t\t\t\t\tif (s[q].size() < x[i])\n\t\t\t\t\t{\n\t\t\t\t\t\ts[q].push_back(x[i]);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tq++;\n\t\t\t\t\t\tj--;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tint w = tmp[x[i]] - (count * x[i] - a); // \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\t\t\t\tfor (int j(0); j < count; j++)\n\t\t\t\t\twhile (s[j].size() != x[i]){ s[j].push_back(x[i]); }\n\t\t\t\twhile (true)\n\t\t\t\t{\n\t\t\t\t\tcount++;\n\t\t\t\t\tfor (int j(0); j <= x[i]; j++)\n\t\t\t\t\t{\n\t\t\t\t\t\ts[count].push_back(x[i]);\n\t\t\t\t\t\tw--;\n\t\t\t\t\t\tif (w == 0){ break; }\n\t\t\t\t\t}\n\t\t\t\t\tif (w == 0){ break; }\n\t\t\t\t}\n\t\t\t}\n\t\t\ta += tmp[x[i]];\n\t\t}\n\t}\n\n\n\tcout << count;\n\n\n\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "6deeaec2b1eb4cd23ce8fcdff2b5bb6d", "src_uid": "7c710ae68f27f140e7e03564492f7214", "apr_id": "e0c3c019679e95fcd4377dd8f972b280", "difficulty": 1400, "tags": ["dp", "greedy", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9984371511498102, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "\n#include\nusing namespace std;\n#define mx 10485760\nstring str;\nstring tree[mx * 3];\nvoid built(int node, int b, int e)\n{\n if (b == e) {\n tree[node] = str[b-1];\n return;\n }\n int Left = node * 2;\n int Right = node * 2 + 1;\n int mid = (b + e) / 2;\n built(Left, b, mid);\n built(Right, mid + 1, e);\n tree[node] = tree[Left] + tree[Right];\n}\nstring substr(int node, int b, int e, int i, int j)\n{\n if (i > e || j < b)\n return \"\";\n if (b >= i && e <= j)\n return tree[node];\n\n int Left = node * 2;\n int Right = node * 2 + 1;\n int mid = (b + e) / 2;\n string p1 = substr(Left, b, mid, i, j);\n string p2 = substr(Right, mid + 1, e, i, j);\n return p1 + p2;\n}\n int frequency=0,loc=-1;\nvoid KMP(string T, string P)\n{\n int n,m,k,i,j;\n // n=T.size();\n n=T.size();\n //m=P.size();\n m=P.size();\n long long int LPS[m];\n i=1;\n j=0;\n LPS[0]=0;\n while(i>str;\n int l=str.size();\n int i,j;\n string Substr;\n int Mxx=0;\n int f=0;\n int n= str.size();\n built(1,1,n);\n for(i=0; i=2){\n int x=Substr.size();\n Mxx=max(x,Mxx);\n }\n }\n }\n cout<\n \nusing namespace std;\n \ntypedef long long ll;\ntypedef pair pi;\ntypedef pair pl;\nconst int N = 254;\nconst ll MOD = 1000000007LL;\n\nll dp[N][N];\nll C[N][N];\nll pow[N][N];\n\nll bigpow(ll a, ll b) {\n if (pow[a][b] != -1) return pow[a][b];\n if (b == 0) return 1;\n ll half = bigpow(a, b >> 1);\n ll res = half * half % MOD;\n if (b % 2 == 1) res = res * a % MOD;\n return pow[a][b] = res;\n}\n\nll calc(ll r, ll c, ll k, ll n) {\n if (dp[r][c] != -1) return dp[r][c];\n if (r == 0) return dp[r][c] = 1;\n if (c == 0) {\n ll tmp = (bigpow(k, n) - bigpow(k-1, n) + MOD) % MOD;\n return dp[r][c] = bigpow(tmp, r);\n }\n if (r == 1) {\n return dp[r][c] = bigpow(k, n - c);\n }\n ll res = (bigpow(k, n - c) - bigpow(k - 1, n - c) + MOD) % MOD;\n res = res * bigpow(k - 1, c) % MOD;\n res = res * calc(r - 1, c, k, n) % MOD;\n for (ll c0 = 1; c0 <= c; c0++) {\n ll tmp = bigpow(k, n - c) * C[c][c0] % MOD * bigpow(k - 1, c - c0) % MOD * calc(r - 1, c - c0, k, n) % MOD;\n res = (res + tmp) % MOD;\n }\n return dp[r][c] = res;\n}\n\nint main(){\n ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);\n for (int i = 0; i < N; i++) {\n C[i][0] = 1;\n for (int j = 1; j <= i; j++) {\n C[i][j] = (C[i-1][j] + C[i-1][j-1]) % MOD;\n }\n }\n ll n, k;\n while (cin >> n >> k) {\n memset(dp, -1, sizeof(dp));\n memset(pow, -1, sizeof(pow));\n cout << calc(n, n, k, n) << endl;\n }\n return 0;\n}\n \n", "lang": "GNU C++11", "bug_code_uid": "97eaf65e7dd926ac8eeac7f163c78e6b", "src_uid": "f67173c973c6f83e88bc0ddb0b9bfa93", "apr_id": "c18f92a29f3d9fa65285c91edef740b8", "difficulty": 2300, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7181102362204724, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "#include \n#include\n#include \n#include \n#define forn(i,n) for(i=1;i<=n;i++)\nusing namespace std;\nint a[100000000],i,j,s=0,cur,n,z[1000000];\nint main(int argc, char *argv[])\n{n=1;\ncur=0;\nforn(i,n){\nn++;\nif(i==1333335002)break;\nprintf(\"%d\\n\",i);}\n//system(\"color 03\");\n\n return EXIT_SUCCESS;\n}\n", "lang": "GNU C++", "bug_code_uid": "a4cfd4cfb69e7b153c0f76a59bf03677", "src_uid": "6df251ac8bf27427a24bc23d64cb9884", "apr_id": "e10c8739947592c707456201d0151b59", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.6367432150313153, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include \n#include \nusing namespace std;\nint factorial(int n){\n if (n==1){\n return n;\n }\n return n*factorial(n-1);\n}\n\nint main() {\n\t// your code goes here\n\tios_base::sync_with_stdio(false);\n\tcin.tie(NULL);\n\tint number;\n\tcin>>number;\n\tint r=2*(number-1);\n\tint c=number-1;\n\tcout<\nusing namespace std;\n#define F first\n#define S second \n#define mp make_pair\n#define pb push_back\n#define speed_up ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)\n#define sz(x) (int)x.size()\n#define all(x) x.begin(), x.end()\n#define debug cerr << \"OK\\n\";\n#define ub upper_bound\n#define lb lower_bound\n \ntypedef long long ll;\ntypedef vector vi;\ntypedef vector vll;\ntypedef pair pii;\ntypedef pair pll;\ntypedef vector vpii;\ntypedef set si;\ntypedef set sll;\ntypedef multiset msi;\ntypedef multiset msll;\ntypedef map mi;\ntypedef map mll;\n \nconst int N = 2e5 + 2;\nconst int M = 1e5 + 2;\nconst int mod = 1e9 + 7;\nconst int inf = 1e9;\nconst ll INF = 1e16;\n \nvoid data() {\n #ifdef PC\n freopen(\"main.in\", \"r\", stdin);\n freopen(\"main.out\", \"w\", stdout);\n #endif\n}\n \nll n, k;\n \nll rec (ll v, ll n) {\n\tll m1 = v;\n\tll cnt = 0, p;\n\tif (m1 % 2 == 1) {\n\t\tp = 1;\n\t}\n\telse {\n\t\tp = 2;\n\t}\n\tcnt = 0;\n\twhile (m1 <= n) { \n\t\tif (m1 + p - 1 <= n) {\n\t\t\tcnt += p;\n\t\t\tp *= 2;\n\t\t\tm1 *= 2;\n\t\t}\n\t\telse {\n\t\t\tcnt += (n - m1 + 1); \n\t\t\tbreak;\n\t\t}\n\t}\t\n\treturn cnt;\n}\n \nint main() {\n\tdata();\n\tscanf(\"%lld %lld\", &n, &k);\n\tll l = 1, r = n;\n\twhile (l < r) { \n\t\tll m = (l + r) / 2;\n ll cnt = rec(m + m % 2, n);\n\t\tif (cnt > k) {\n\t\t\tl = m + 1;\n\t\t}\n\t\telse {\n\t\t\tr = m;\n\t\t}\n\t}\n\tll ans = -1;\n\tfor (ll i = max(m - 1000LL, 1LL); i <= min(n, m + 1000LL); ++i) {\n\t\tll cnt = rec(i, n);\n\t\tif (cnt >= k) {\n\t\t\tans = max(i, ans);\n\t\t}\n\t}\n\tprintf(\"%lld\", ans);\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "35f1f1c0f26dd873c683d05e12b7410d", "src_uid": "783c4b3179c558369f94f4a16ac562d4", "apr_id": "2b2c34643c9f960a93dad33c07646a93", "difficulty": 2100, "tags": ["dp", "math", "combinatorics", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5093457943925234, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "#include \nusing namespace std;\n\nlong long ans=1e18,a,b,mx1[20000000],mx2[20000000];\n\nint main()\n{\n\t//freopen(\"i.inp\",\"r\",stdin);\n\tcin>>a>>b;\n\tfor(long long i=0;i<=20000000;i++) mx1[i]=mx2[i]=ans;\n\tfor(long long i=1;i*i<=a;i++)\n\t{\n\t\tmx1[i]=mx1[i-1];\n\t\tif(a%i==0)\n\t\tmx1[i]=min(mx1[i],a/i);\n\t}\n\tfor(long long i=1;i*i<=b;i++)\n\t{\n\t\tmx2[i]=mx2[i-1];\n\t\tif(b%i==0)\n\t\tmx2[i]=min(mx2[i],b/i);\n\t}\n\n\tfor(long long i=1;i*i<=(a+b);i++)\n\t\tif((a+b)%i==0 && ((mx1[i]<=(a+b)/i) || (mx2[i])<=(a+b)/i))\n\t\tans=min(ans,2*i+2*((a+b)/i));\n\tcout<\n \nusing namespace std;\n \nint abs(int x) {\n if(x<0)\n return -x;\n return x;\n}\n \nint igorWalks(int x1, int x2, int t2) {\n return t2*(abs(x1-x2));\n}\nint tram(int p, int x2, int x1, int t1, int d, int s) {\n if(d == 1) {\n if(p<=x1 && x1=x1 && x1=x1 && x1>x2 || p<=x1 && x2=x1 && x1>x2)\n return t1*(p-x2);\n else if(p<=x1 && x1>x2)\n return t1*((p)+s+(s-x2));\n else if(p<=x1 && x1>x2 || p>x1 && x2>x1)\n return t1*((p)+(x2));\n }\n \n}\n \nint main() {\n int s, x1, x2;\n cin >> s >> x1 >> x2;\n int t1, t2;\n cin >> t1 >> t2;\n int p, d;\n cin >> p >> d;\n if(t1>t2)\n return igorWalks(x1, x2, t2);\n int min = igorWalks(x1, x2, t2);\n if(min > tram(p,x2, x1,t1,d,s))\n min = tram(p,x2, x1, t1,d,s);\n cout << min;\n return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "adc9da756f94e393bc82580e6b8f3c12", "src_uid": "fb3aca6eba3a952e9d5736c5d8566821", "apr_id": "889995e2663e526f989153e3f3fb8685", "difficulty": 1600, "tags": ["math", "constructive algorithms", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.2321618743343983, "equal_cnt": 23, "replace_cnt": 17, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 23, "bug_source_code": "#include \n\nusing namespace std;\n\ntypedef long long int lo;\ntypedef pair< int,int > PII;\n\n#define fi first\n#define se second\n#define mp make_pair\n#define pb push_back\n#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)\n#define FOR for(int i=1;i<=n;i++)\n\nconst int inf = 1000000000;\nconst int mod = 1000000007;\nconst int KOK = 100000;\nconst int li = 100005;\nconst int LOG = 20;\n\nlo n,m,cev,x,mn=inf;\nbool prime[1000000005];\nvector< PII > v;\nchar c;\nstring s;\n\nvoid sieve(lo sayi){\n\tfor(lo p=3;p<=sayi;p+=2){\n\t\tif(prime[p]==1) continue;\n\t\t//~ cevap++;\n\t\tfor(int i=p*p;i<=sayi;i+=p){\n\t\t\tprime[i]=1;\n\t\t}\n\t}\n\tif(sayi%2==0)\n\t\tv.pb(mp(2,0));\n\tfor(lo i=3;i<=sayi;i+=2){\n\t\tif(prime[i]==0){\n\t\t\tif(sayi%i==0)\n\t\t\t\tv.pb(mp(i,0));\n\t\t}\n\t}\n}\n\nint main(){\n\tscanf(\"%lld %lld\",&n,&m);\n\tsieve(m);\n\tfor(lo i=0;i<(lo)v.size();i++){\n\t\t\n\t\tlo xx=0;\n\t\twhile(m%v[i].fi==0){\n\t\t\t\n\t\t\tm/=v[i].fi;\n\t\t\txx++;\n\t\t}\n\t\tv[i].se=xx;\n\t\tcev=0;\n\t\tlo yes=n;\n\t\twhile(yes){\n\t\t\t\n\t\t\tyes/=v[i].fi;\n\t\t\tcev+=yes;\n\t\t}\n\t\t//~ cout<<\"**\\n\"< lav;\n\tint n,m;\n\tcin >> n >> m;\n\tfor (int i = 0; i < n; i++) {\n\t\tint x;\n\t\tcin >> x;\n\t\tlav.push_back(x);\n\t}\n\tsort(lav.begin(), lav.end());\n\tint maximum = lav[n - 1] + m;\n\tint i = 0;\n\tfor (int i = 0; i < n - 1; i++) {\n\t\twhile (lav[i] < lav[n - 1]) {\n\t\t\tif (m > 0) {\n\t\t\t\tlav[i]++;\n\t\t\t\tm--;\n\t\t\t}\n\t\t}\n\t}\n\twhile (m != 0) {\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (m > 0) {\n\t\t\t\tlav[i]++;\n\t\t\t\tm--;\n\t\t\t}\n\t\t}\n\t}\n\tsort(lav.begin(), lav.end());\n\tcout << lav[n - 1] << \" \" << maximum;\n\treturn 0;\n}", "lang": "GNU C++17", "bug_code_uid": "4b94a5b578a6a63ad820593398c87e1e", "src_uid": "78f696bd954c9f0f9bb502e515d85a8d", "apr_id": "bcb20a30ab28283135b38ff8365001e0", "difficulty": 1100, "tags": ["implementation", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9975, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \n#include \n#include\n#include\n#include \nusing namespace std;\n\n\n\nlong x[42600];\n\n\nint BinSearch(int n,long p){\n int low,high,mid;\n\n low=0;high=n+1;\n while(low<(high-1)){\n mid=(low+high)/2;\n if(p\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define pb push_back\nusing namespace std;\ntypedef long long int ll;\nll mod=1e9+7;\nll exp(ll x,ll y){ll ret=1;for(;y;y>>=1,x=(x*x)%mod){if(y&1)ret=(ret*x)%mod;}return ret;}\nll gcd(ll x,ll y){return x%y==0?y:gcd(y,x%y);}\nll lcm(ll x,ll y){return x*(y/gcd(x,y));}\nll bsum(ll u,ll b){return u divi[2100000];\nint n, k;\n\nvoid prepr(void)\n{\n\tint i, j;\n\tfor(i=1 ; i<=k ; i++)\n\t{\n\t\tex[i]=exp(i,n);\n\t\tfor(j=2 ; i*j<=k ; j++)\n\t\t{\n\t\t\tdivi[i*j].push_back(i);\t\t\t\n\t\t}\n\t}\n}\n\nint main(void)\n{\n\tcin>>n>>k;\n\tint i, j, cc; ll add;\n\tprepr();\n\tfor(i=1 ; i<=k ; i++)\n\t{\n\t\tif(i==1)\n\t\t{\n\t\t\tad[1]=1;\n\t\t\tdp[1]=1; continue;\n\t\t}\n\t\tdp[i]=dp[i-1];\n\t\tad[i]=ex[i]-ex[i-1];\n\t\tfor(j=0 ; jmod) dp[i]-=mod;\n\t}\n\tfor(i=1 ; i<=k ; i++)\n\t{\n\t\tans+=(dp[i]^i);\n\t\tif(ans>=mod) ans-=mod;\n\t}\n\tcout<\nusing namespace std;\n\n#pragma GCC optimize(\"Ofast,no-stack-protector,unroll-loops,fast-math\")\n\nconst long long maxn = 21;\nconst long long mod = 1e9 + 7;\n\nlong long ans;\nlong long n, s;\nlong long a[maxn];\nlong long sum[1 << maxn];\n\nvoid in();\nvoid solve();\nvoid out();\nlong long pwr(long long, long long);\nlong long C(long long, long long);\n\nint main(){\n in();\n solve();\n out();\n}\n\nvoid in(){\n ios::sync_with_stdio(false);\n cout.tie(0);\n cin.tie(0);\n cin >> n >> s;\n for(long long i = 0; i < n; i++){\n cin >> a[i];\n a[i]++;\n }\n}\n\nvoid solve(){\n for(long long i = 1; i < (1 << n); i++){\n sum[i] = sum[i - (i & -i)];\n sum[i] += a[__builtin_ctz(i)];\n }\n for(long long i = 0; i < (1 << n); i++){\n ans += -1 * __builtin_popcount(i) % 2 * C(s + n - 1 - sum[i], n - 1);\n ans += mod;\n ans %= mod;\n }\n}\n\nvoid out(){\n cout << ans;\n}\n\nlong long pwr(long long a, long long b){\n if(b == 0)\n return 1;\n if(b < 0)\n return pwr(a, b + mod - 1);\n long long c = pwr(a, b / 2);\n if(b % 2)\n return c * c % mod * a % mod;\n return c * c % mod;\n}\n\nlong long C(long long n, long long k){\n if(n < k)\n return 0;\n long long ans = 1;\n for(long long i = 1; i <= k; i++){\n ans *= pwr(i, -1);\n ans %= mod;\n ans *= (n - i + 1) % mod;\n ans %= mod;\n }\n return ans;\n}\n", "lang": "GNU C++14", "bug_code_uid": "6f851e104f70841ba50aee226abf6056", "src_uid": "8b883011eba9d15d284e54c7a85fcf74", "apr_id": "fc330d5f67f7a8315033dfb3973fcbbb", "difficulty": 2300, "tags": ["bitmasks", "combinatorics", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.678741658722593, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "#include \n#include \n#include \nusing namespace std;\n\nint main()\n{\n int n;\n cin>>n;\n int l=50;\n vector data;\n for(int i=0;i>p;\n data.push_back(p);\n if(p\n#include \n#include \n#include \n#include \n#include \n#define FOR(A, B) for(A=0;A luckies;\nint l, lim1, lim2;\nvoid gen(long long c)\n{\n\tif(c > lim2) return;\n\tif(l > 0 && c >= lim1) luckies.push_back(c);\n\tl++;\n\tgen(c*10+4);\n\tgen(c*10+7);\n\tl--;\n}\n\nint main()\n{\n\tint i, j, k, n, m, pl, pr, vl, vr;\n\tscanf(\"%d %d %d %d %d\", &vl, &vr, &pl, &pr, &k);\n\tl = 0; lim1 = min(vl, pl);\n\tlim2 = max(vr, pr);\n\tgen(0);\n\tint q = 0;\n\tfor(i = vl; i <= vr; i++) {\n\t\tfor(j = pl; j <= pr; j++) {\n\t\t\tint p = 0;\n\t\t\tfor(m = 0; m < luckies.size(); m++) {\n\t\t\t\tif(luckies[m] >= min(i, j) && luckies[m] <= max(i, j)) p++;\n\t\t\t}\n\t\t\tif(p == k) {\n\t\t\t\tq++;\n\t\t\t}\n\t\t}\n\t}\n\tdouble total = (double)(vr-vl+1)*(pr-pl+1);\n\tprintf(\"%lf\", (double)q/total);\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "c76e8c1d2ac8da83711bfb88d4c061fe", "src_uid": "5d76ec741a9d873ce9d7c3ef55eb984c", "apr_id": "d16551473638f2f3b5e7c57358b60076", "difficulty": 1900, "tags": ["dfs and similar", "probabilities", "brute force", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9998998096383128, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "\t#include \nusing namespace std;\ntypedef long long LL;\n\nLL ncr[40][40];\nLL ans[30][30];\n\n\nint main(){\n\tif(1){\n\t\tans[1][1]=0;\n\t\tans[1][2]=1;\n\t\tans[1][3]=0;\n\t\tans[1][4]=1;\n\t\tans[1][5]=0;\n\t\tans[1][6]=1;\n\t\tans[1][7]=0;\n\t\tans[1][8]=1;\n\t\tans[1][9]=0;\n\t\tans[1][10]=1;\n\t\tans[1][11]=0;\n\t\tans[1][12]=1;\n\t\tans[1][13]=0;\n\t\tans[1][14]=1;\n\t\tans[1][15]=0;\n\t\tans[1][16]=1;\n\t\tans[1][17]=0;\n\t\tans[1][18]=1;\n\t\tans[1][19]=0;\n\t\tans[1][20]=1;\n\t\tans[2][1]=3;\n\t\tans[2][2]=0;\n\t\tans[2][3]=2;\n\t\tans[2][4]=3;\n\t\tans[2][5]=1;\n\t\tans[2][6]=0;\n\t\tans[2][7]=0;\n\t\tans[2][8]=1;\n\t\tans[2][9]=1;\n\t\tans[2][10]=0;\n\t\tans[2][11]=0;\n\t\tans[2][12]=1;\n\t\tans[2][13]=1;\n\t\tans[2][14]=0;\n\t\tans[2][15]=0;\n\t\tans[2][16]=1;\n\t\tans[2][17]=1;\n\t\tans[2][18]=0;\n\t\tans[2][19]=0;\n\t\tans[2][20]=1;\n\t\tans[3][1]=8;\n\t\tans[3][2]=20;\n\t\tans[3][3]=0;\n\t\tans[3][4]=15;\n\t\tans[3][5]=16;\n\t\tans[3][6]=0;\n\t\tans[3][7]=0;\n\t\tans[3][8]=1;\n\t\tans[3][9]=0;\n\t\tans[3][10]=0;\n\t\tans[3][11]=0;\n\t\tans[3][12]=1;\n\t\tans[3][13]=0;\n\t\tans[3][14]=0;\n\t\tans[3][15]=0;\n\t\tans[3][16]=1;\n\t\tans[3][17]=0;\n\t\tans[3][18]=0;\n\t\tans[3][19]=0;\n\t\tans[3][20]=1;\n\t\tans[4][1]=15;\n\t\tans[4][2]=75;\n\t\tans[4][3]=175;\n\t\tans[4][4]=0;\n\t\tans[4][5]=4;\n\t\tans[4][6]=0;\n\t\tans[4][7]=0;\n\t\tans[4][8]=45;\n\t\tans[4][9]=15;\n\t\tans[4][10]=1;\n\t\tans[4][11]=1;\n\t\tans[4][12]=0;\n\t\tans[4][13]=0;\n\t\tans[4][14]=0;\n\t\tans[4][15]=0;\n\t\tans[4][16]=1;\n\t\tans[4][17]=1;\n\t\tans[4][18]=1;\n\t\tans[4][19]=1;\n\t\tans[4][20]=0;\n\t\tans[5][1]=24;\n\t\tans[5][2]=189;\n\t\tans[5][3]=784;\n\t\tans[5][4]=1764;\n\t\tans[5][5]=0;\n\t\tans[5][6]=0;\n\t\tans[5][7]=60;\n\t\tans[5][8]=95;\n\t\tans[5][9]=200;\n\t\tans[5][10]=1;\n\t\tans[5][11]=14;\n\t\tans[5][12]=14;\n\t\tans[5][13]=0;\n\t\tans[5][14]=4;\n\t\tans[5][15]=0;\n\t\tans[5][16]=1;\n\t\tans[5][17]=0;\n\t\tans[5][18]=1;\n\t\tans[5][19]=0;\n\t\tans[5][20]=0;\n\t\tans[6][1]=35;\n\t\tans[6][2]=392;\n\t\tans[6][3]=2352;\n\t\tans[6][4]=8820;\n\t\tans[6][5]=19404;\n\t\tans[6][6]=0;\n\t\tans[6][7]=6600;\n\t\tans[6][8]=553;\n\t\tans[6][9]=245;\n\t\tans[6][10]=10780;\n\t\tans[6][11]=658;\n\t\tans[6][12]=126;\n\t\tans[6][13]=56;\n\t\tans[6][14]=20;\n\t\tans[6][15]=0;\n\t\tans[6][16]=5;\n\t\tans[6][17]=5;\n\t\tans[6][18]=0;\n\t\tans[6][19]=0;\n\t\tans[6][20]=0;\n\t\tans[7][1]=48;\n\t\tans[7][2]=720;\n\t\tans[7][3]=5760;\n\t\tans[7][4]=29700;\n\t\tans[7][5]=104544;\n\t\tans[7][6]=226512;\n\t\tans[7][7]=0;\n\t\tans[7][8]=15015;\n\t\tans[7][9]=40040;\n\t\tans[7][10]=0;\n\t\tans[7][11]=1440;\n\t\tans[7][12]=2028;\n\t\tans[7][13]=432;\n\t\tans[7][14]=1280;\n\t\tans[7][15]=8;\n\t\tans[7][16]=249;\n\t\tans[7][17]=8;\n\t\tans[7][18]=20;\n\t\tans[7][19]=6;\n\t\tans[7][20]=4;\n\t\tans[8][1]=63;\n\t\tans[8][2]=1215;\n\t\tans[8][3]=12375;\n\t\tans[8][4]=81675;\n\t\tans[8][5]=382239;\n\t\tans[8][6]=1288287;\n\t\tans[8][7]=2760615;\n\t\tans[8][8]=0;\n\t\tans[8][9]=1635920;\n\t\tans[8][10]=198198;\n\t\tans[8][11]=534456;\n\t\tans[8][12]=4524;\n\t\tans[8][13]=1546;\n\t\tans[8][14]=111564;\n\t\tans[8][15]=4050;\n\t\tans[8][16]=621;\n\t\tans[8][17]=3069;\n\t\tans[8][18]=5;\n\t\tans[8][19]=43;\n\t\tans[8][20]=1;\n\t\tans[9][1]=80;\n\t\tans[9][2]=1925;\n\t\tans[9][3]=24200;\n\t\tans[9][4]=196625;\n\t\tans[9][5]=1145144;\n\t\tans[9][6]=5010005;\n\t\tans[9][7]=16359200;\n\t\tans[9][8]=34763300;\n\t\tans[9][9]=0;\n\t\tans[9][10]=34606;\n\t\tans[9][11]=701350;\n\t\tans[9][12]=6651840;\n\t\tans[9][13]=78298;\n\t\tans[9][14]=429418;\n\t\tans[9][15]=872494;\n\t\tans[9][16]=1615;\n\t\tans[9][17]=352;\n\t\tans[9][18]=1155;\n\t\tans[9][19]=8580;\n\t\tans[9][20]=145;\n\t\tans[10][1]=99;\n\t\tans[10][2]=2904;\n\t\tans[10][3]=44044;\n\t\tans[10][4]=429429;\n\t\tans[10][5]=3006003;\n\t\tans[10][6]=16032016;\n\t\tans[10][7]=66745536;\n\t\tans[10][8]=212751396;\n\t\tans[10][9]=449141836;\n\t\tans[10][10]=0;\n\t\tans[10][11]=11675872;\n\t\tans[10][12]=4900324;\n\t\tans[10][13]=980474;\n\t\tans[10][14]=120143080;\n\t\tans[10][15]=47159156;\n\t\tans[10][16]=380171;\n\t\tans[10][17]=35871;\n\t\tans[10][18]=2207348;\n\t\tans[10][19]=223498;\n\t\tans[10][20]=4875;\n\t\tans[11][1]=120;\n\t\tans[11][2]=4212;\n\t\tans[11][3]=75712;\n\t\tans[11][4]=869505;\n\t\tans[11][5]=7154784;\n\t\tans[11][6]=45048640;\n\t\tans[11][7]=225059328;\n\t\tans[11][8]=901995588;\n\t\tans[11][9]=2821056160;\n\t\tans[11][10]=5924217936;\n\t\tans[11][11]=0;\n\t\tans[11][12]=1763160100;\n\t\tans[11][13]=1014736800;\n\t\tans[11][14]=96243664;\n\t\tans[11][15]=527663136;\n\t\tans[11][16]=13024737;\n\t\tans[11][17]=1152008;\n\t\tans[11][18]=27986506;\n\t\tans[11][19]=835384;\n\t\tans[12][1]=143;\n\t\tans[12][2]=5915;\n\t\tans[12][3]=124215;\n\t\tans[12][4]=1656200;\n\t\tans[12][5]=15767024;\n\t\tans[12][6]=114874032;\n\t\tans[12][7]=668144880;\n\t\tans[12][8]=3173688180;\n\t\tans[12][9]=12342120700;\n\t\tans[12][10]=38013731756;\n\t\tans[12][11]=79483257308;\n\t\tans[12][12]=0;\n\t\tans[12][13]=334424;\n\t\tans[12][14]=86230664;\n\t\tans[12][15]=401457992;\n\t\tans[12][16]=1811255769;\n\t\tans[12][17]=8782619185;\n\t\tans[12][18]=524739891;\n\t\tans[13][1]=168;\n\t\tans[13][2]=8085;\n\t\tans[13][3]=196000;\n\t\tans[13][4]=2998800;\n\t\tans[13][5]=32626944;\n\t\tans[13][6]=271211472;\n\t\tans[13][7]=1802805120;\n\t\tans[13][8]=9859090500;\n\t\tans[13][9]=44986664800;\n\t\tans[13][10]=170724392916;\n\t\tans[13][11]=519227905728;\n\t\tans[13][12]=1081724803600;\n\t\tans[13][13]=0;\n\t\tans[13][14]=5856160;\n\t\tans[13][15]=0;\n\t\tans[13][16]=208030461065;\n\t\tans[13][17]=743483832;\n\t\tans[14][1]=195;\n\t\tans[14][2]=10800;\n\t\tans[14][3]=299200;\n\t\tans[14][4]=5202000;\n\t\tans[14][5]=64047024;\n\t\tans[14][6]=600935040;\n\t\tans[14][7]=4507012800;\n\t\tans[14][8]=27887141700;\n\t\tans[14][9]=145173803500;\n\t\tans[14][10]=641087516256;\n\t\tans[14][11]=2384209771200;\n\t\tans[14][12]=7174705330000;\n\t\tans[14][13]=14901311070000;\n\t\tans[14][14]=0;\n\t\tans[14][15]=262032716400;\n\t\tans[14][16]=2131715333625;\n\t\tans[15][1]=224;\n\t\tans[15][2]=14144;\n\t\tans[15][3]=443904;\n\t\tans[15][4]=8697744;\n\t\tans[15][5]=120187008;\n\t\tans[15][6]=1261963584;\n\t\tans[15][7]=10576456704;\n\t\tans[15][8]=73167596964;\n\t\tans[15][9]=427391677504;\n\t\tans[15][10]=2136958387520;\n\t\tans[15][11]=9183622822400;\n\t\tans[15][12]=33577620944400;\n\t\tans[15][13]=100136810390400;\n\t\tans[15][14]=207426250094400;\n\t\tans[15][15]=0;\n\t\tans[16][1]=255;\n\t\tans[16][2]=18207;\n\t\tans[16][3]=642447;\n\t\tans[16][4]=14084415;\n\t\tans[16][5]=216899991;\n\t\tans[16][6]=2530499895;\n\t\tans[16][7]=23518156167;\n\t\tans[16][8]=180305863947;\n\t\tans[16][9]=1168649118175;\n\t\tans[16][10]=6511045086975;\n\t\tans[16][11]=31479019635375;\n\t\tans[16][12]=132211882468575;\n\t\tans[16][13]=476432168185575;\n\t\tans[16][14]=1409850293610375;\n\t\tans[17][1]=288;\n\t\tans[17][2]=23085;\n\t\tans[17][3]=909720;\n\t\tans[17][4]=22174425;\n\t\tans[17][5]=378261576;\n\t\tans[17][6]=4873620213;\n\t\tans[17][7]=49911657840;\n\t\tans[17][8]=421129613025;\n\t\tans[17][9]=3003942370000;\n\t\tans[17][10]=18451716007725;\n\t\tans[17][11]=98815801429800;\n\t\tans[17][12]=464342770607625;\n\t\tans[17][13]=1912322889603000;\n\t\tans[18][1]=323;\n\t\tans[18][2]=28880;\n\t\tans[18][3]=1263500;\n\t\tans[18][4]=34051325;\n\t\tans[18][5]=639970331;\n\t\tans[18][6]=9058041608;\n\t\tans[18][7]=101671895600;\n\t\tans[18][8]=938731990625;\n\t\tans[18][9]=7322109526875;\n\t\tans[18][10]=49204576020600;\n\t\tans[18][11]=288924390600300;\n\t\tans[18][12]=1496215594180125;\n\t\tans[19][1]=360;\n\t\tans[19][2]=35700;\n\t\tans[19][3]=1724800;\n\t\tans[19][4]=51137625;\n\t\tans[19][5]=1053844176;\n\t\tans[19][6]=16309493200;\n\t\tans[19][7]=199708080000;\n\t\tans[19][8]=2008002335625;\n\t\tans[19][9]=17037595575000;\n\t\tans[19][10]=124510748462100;\n\t\tans[19][11]=795771174744000;\n\t\tans[20][1]=399;\n\t\tans[20][2]=43659;\n\t\tans[20][3]=2318239;\n\t\tans[20][4]=75274584;\n\t\tans[20][5]=1693678140;\n\t\tans[20][6]=28541613100;\n\t\tans[20][7]=379694987100;\n\t\tans[20][8]=4140135724725;\n\t\tans[20][9]=38044950918975;\n\t\tans[20][10]=300900975450075;\n\n\t}\n\n\tfor(LL a = 0; a < 40; a++){\n\t\tfor(LL b = 0; b < 40; b++){\n\t\t\tif(b > a){\n\t\t\t\tncr[a][b] = 0;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif(b == 0 || b == a){\n\t\t\t\tncr[a][b] = 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tncr[a][b] = ncr[a-1][b-1] + ncr[a-1][b];\n\t\t}\n\t}\n\tLL R, C;\n\tcin >> R >> C;\n\tstring str;\n\tcin >> str;\n\tLL n = R+C;\n\tLL blockarea[n][n];\n\tLL totalarea[n+1][n+1];\n\tfor(LL a = 0; a < n; a++){\n\t\tfor(LL b = 0; b < n; b++){\n\t\t\tblockarea[a][b] = ncr[a][R-1]*ncr[b][R-1];\n\t\t}\n\t}\n\tLL revarea[n+1][n+1];\n\tfor(LL a = 0; a <= n; a++){\n\t\tfor(LL b = 0; b <= n; b++){\n\t\t\ttotalarea[a][b] = 0;\n\t\t\tif(a == 0 || b == 0) continue;\n\t\t\ttotalarea[a][b] = totalarea[a][b-1] + totalarea[a-1][b] - totalarea[a-1][b-1];\n\t\t\ttotalarea[a][b] += blockarea[a-1][b-1];\n\t\t}\n\t}\n\tfor(LL a = 0; a <= n; a++){\n\t\tfor(LL b = 0; b <= n; b++){\n\t\t\trevarea[a][b] = totalarea[n][n] - totalarea[n-a][n]\n\t\t\t\t\t\t - totalarea[n][n-b] + totalarea[n-a][n-b];\n\t\t}\n\t}\n\n\tLL d = min(2*n-1,n+R);\n\n\tmap dp[n+1][n+1];\n\tmap bp[n+1][n+1];\n\tdp[0][0][0] = 1;\n\tbp[0][0][0] = 1;\n\n\tLL best = ans[R][C];\n\tLL m1 = (-best + totalarea[n][n]) / 2;\n\tLL m2 = totalarea[n][n] - m1;\n\tLL bestfreq = 0;\n\n\tfor(LL x = 0; x <= n; x++){\n\t\tfor(LL y = 0; y < n; y++){\n\t\t\tif(x+y+1 <= d && str[x+y] != 'B'){\n\t\t\t\tfor(auto it = dp[x][y].begin(); it != dp[x][y].end(); it++){\n\t\t\t\t\tLL area2 = it->first + totalarea[n][y+1] - totalarea[x][y+1];\n\t\t\t\t\tif(area2 > m2) continue;\n\t\t\t\t\tdp[x][y+1][it->first] += it->second;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(x+y+1 <= 2*n-d && str[n-x+n-y-1] != 'B'){\n\t\t\t\tfor(auto it = bp[x][y].begin(); it != bp[x][y].end(); it++){\n\t\t\t\t\tLL area2 = totalarea[n][n] - it->first - totalarea[n-x][n-(y+1)];\n\t\t\t\t\tif(area2 > m2) continue;\n\t\t\t\t\tbp[x][y+1][it->first] += it->second;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(x == n) continue;\n\t\tfor(LL y = 0; y <= n; y++){\n\n\t\t\tif(x+y+1 <= d && str[x+y] != 'A'){\n\t\t\t\tLL newarea = totalarea[x+1][y] - totalarea[x][y];\n\t\t\t\tfor(auto it = dp[x][y].begin(); it != dp[x][y].end(); it++){\n\t\t\t\t\tLL c = it->first+newarea;\n\t\t\t\t\tLL area2 = totalarea[x+1][n] - c;\n\t\t\t\t\tif(area2 > m2) continue;\n\t\t\t\t\tdp[x+1][y][it->first + newarea] += it->second;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(x+y+1 <= 2*n-d && str[n-x+n-y-1] != 'A'){\n\t\t\t\tLL newarea = totalarea[n-x][n-y] - totalarea[n-x-1][n-y];\n\t\t\t\tfor(auto it = bp[x][y].begin(); it != bp[x][y].end(); it++){\n\t\t\t\t\tif(it->first + newarea > m2) continue;\n\t\t\t\t\tbp[x+1][y][it->first + newarea] += it->second;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(x+y+1 <= d) dp[x][y].clear();\n\t\t\tif(x+y+1 <= 2*n-d) bp[x][y].clear();\n\t\t}\n\n\t}\n\n\n\tfor(LL x = 0; x <= n; x++){\n\t\tLL y = d-x;\n\t\tif(y < 0 || y > n) continue;\n\t\t//cout << x << \" \" << y << endl;\n\t\tfor(auto it = dp[x][y].begin(); it != dp[x][y].end(); it++){\n\t\t\tLL c = it->first;\n\t\t\tLL freq = it->second;\n\t\t\t// bp[n-x][n-y]\n\t\t\tbestfreq += freq * bp[n-x][n-y][m1-c];\n\t\t\tif(m1 != m2) bestfreq += freq * bp[n-x][n-y][m2-c];\n\n\t\t}\n\t}\n\n\tcout << bestfreq << endl;\n\n}\n", "lang": "GNU C++14", "bug_code_uid": "8bede8d18bd8b48cf8213ce947f651e7", "src_uid": "1b978b5aed4a83a2250bb23cc1ad6f85", "apr_id": "ab9d314c833573e3224cfe4c45c43a11", "difficulty": 3300, "tags": ["meet-in-the-middle", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9998997995991984, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "\t#include \nusing namespace std;\ntypedef long long LL;\n\nLL ncr[40][40];\nLL ans[30][30];\n\n\nint main(){\n\tif(1){\n\t\tans[1][1]=0;\n\t\tans[1][2]=1;\n\t\tans[1][3]=0;\n\t\tans[1][4]=1;\n\t\tans[1][5]=0;\n\t\tans[1][6]=1;\n\t\tans[1][7]=0;\n\t\tans[1][8]=1;\n\t\tans[1][9]=0;\n\t\tans[1][10]=1;\n\t\tans[1][11]=0;\n\t\tans[1][12]=1;\n\t\tans[1][13]=0;\n\t\tans[1][14]=1;\n\t\tans[1][15]=0;\n\t\tans[1][16]=1;\n\t\tans[1][17]=0;\n\t\tans[1][18]=1;\n\t\tans[1][19]=0;\n\t\tans[1][20]=1;\n\t\tans[2][1]=3;\n\t\tans[2][2]=0;\n\t\tans[2][3]=2;\n\t\tans[2][4]=3;\n\t\tans[2][5]=1;\n\t\tans[2][6]=0;\n\t\tans[2][7]=0;\n\t\tans[2][8]=1;\n\t\tans[2][9]=1;\n\t\tans[2][10]=0;\n\t\tans[2][11]=0;\n\t\tans[2][12]=1;\n\t\tans[2][13]=1;\n\t\tans[2][14]=0;\n\t\tans[2][15]=0;\n\t\tans[2][16]=1;\n\t\tans[2][17]=1;\n\t\tans[2][18]=0;\n\t\tans[2][19]=0;\n\t\tans[2][20]=1;\n\t\tans[3][1]=8;\n\t\tans[3][2]=20;\n\t\tans[3][3]=0;\n\t\tans[3][4]=15;\n\t\tans[3][5]=16;\n\t\tans[3][6]=0;\n\t\tans[3][7]=0;\n\t\tans[3][8]=1;\n\t\tans[3][9]=0;\n\t\tans[3][10]=0;\n\t\tans[3][11]=0;\n\t\tans[3][12]=1;\n\t\tans[3][13]=0;\n\t\tans[3][14]=0;\n\t\tans[3][15]=0;\n\t\tans[3][16]=1;\n\t\tans[3][17]=0;\n\t\tans[3][18]=0;\n\t\tans[3][19]=0;\n\t\tans[3][20]=1;\n\t\tans[4][1]=15;\n\t\tans[4][2]=75;\n\t\tans[4][3]=175;\n\t\tans[4][4]=0;\n\t\tans[4][5]=4;\n\t\tans[4][6]=0;\n\t\tans[4][7]=0;\n\t\tans[4][8]=45;\n\t\tans[4][9]=15;\n\t\tans[4][10]=1;\n\t\tans[4][11]=1;\n\t\tans[4][12]=0;\n\t\tans[4][13]=0;\n\t\tans[4][14]=0;\n\t\tans[4][15]=0;\n\t\tans[4][16]=1;\n\t\tans[4][17]=1;\n\t\tans[4][18]=1;\n\t\tans[4][19]=1;\n\t\tans[4][20]=0;\n\t\tans[5][1]=24;\n\t\tans[5][2]=189;\n\t\tans[5][3]=784;\n\t\tans[5][4]=1764;\n\t\tans[5][5]=0;\n\t\tans[5][6]=0;\n\t\tans[5][7]=60;\n\t\tans[5][8]=95;\n\t\tans[5][9]=200;\n\t\tans[5][10]=1;\n\t\tans[5][11]=14;\n\t\tans[5][12]=14;\n\t\tans[5][13]=0;\n\t\tans[5][14]=4;\n\t\tans[5][15]=0;\n\t\tans[5][16]=1;\n\t\tans[5][17]=0;\n\t\tans[5][18]=1;\n\t\tans[5][19]=0;\n\t\tans[5][20]=0;\n\t\tans[6][1]=35;\n\t\tans[6][2]=392;\n\t\tans[6][3]=2352;\n\t\tans[6][4]=8820;\n\t\tans[6][5]=19404;\n\t\tans[6][6]=0;\n\t\tans[6][7]=6600;\n\t\tans[6][8]=553;\n\t\tans[6][9]=245;\n\t\tans[6][10]=10780;\n\t\tans[6][11]=658;\n\t\tans[6][12]=126;\n\t\tans[6][13]=56;\n\t\tans[6][14]=20;\n\t\tans[6][15]=0;\n\t\tans[6][16]=5;\n\t\tans[6][17]=5;\n\t\tans[6][18]=0;\n\t\tans[6][19]=0;\n\t\tans[6][20]=0;\n\t\tans[7][1]=48;\n\t\tans[7][2]=720;\n\t\tans[7][3]=5760;\n\t\tans[7][4]=29700;\n\t\tans[7][5]=104544;\n\t\tans[7][6]=226512;\n\t\tans[7][7]=0;\n\t\tans[7][8]=15015;\n\t\tans[7][9]=40040;\n\t\tans[7][10]=0;\n\t\tans[7][11]=1440;\n\t\tans[7][12]=2028;\n\t\tans[7][13]=432;\n\t\tans[7][14]=1280;\n\t\tans[7][15]=8;\n\t\tans[7][16]=249;\n\t\tans[7][17]=8;\n\t\tans[7][18]=20;\n\t\tans[7][19]=6;\n\t\tans[7][20]=4;\n\t\tans[8][1]=63;\n\t\tans[8][2]=1215;\n\t\tans[8][3]=12375;\n\t\tans[8][4]=81675;\n\t\tans[8][5]=382239;\n\t\tans[8][6]=1288287;\n\t\tans[8][7]=2760615;\n\t\tans[8][8]=0;\n\t\tans[8][9]=1635920;\n\t\tans[8][10]=198198;\n\t\tans[8][11]=534456;\n\t\tans[8][12]=4524;\n\t\tans[8][13]=1546;\n\t\tans[8][14]=111564;\n\t\tans[8][15]=4050;\n\t\tans[8][16]=621;\n\t\tans[8][17]=3069;\n\t\tans[8][18]=5;\n\t\tans[8][19]=43;\n\t\tans[8][20]=1;\n\t\tans[9][1]=80;\n\t\tans[9][2]=1925;\n\t\tans[9][3]=24200;\n\t\tans[9][4]=196625;\n\t\tans[9][5]=1145144;\n\t\tans[9][6]=5010005;\n\t\tans[9][7]=16359200;\n\t\tans[9][8]=34763300;\n\t\tans[9][9]=0;\n\t\tans[9][10]=34606;\n\t\tans[9][11]=701350;\n\t\tans[9][12]=6651840;\n\t\tans[9][13]=78298;\n\t\tans[9][14]=429418;\n\t\tans[9][15]=872494;\n\t\tans[9][16]=1615;\n\t\tans[9][17]=352;\n\t\tans[9][18]=1155;\n\t\tans[9][19]=8580;\n\t\tans[9][20]=145;\n\t\tans[10][1]=99;\n\t\tans[10][2]=2904;\n\t\tans[10][3]=44044;\n\t\tans[10][4]=429429;\n\t\tans[10][5]=3006003;\n\t\tans[10][6]=16032016;\n\t\tans[10][7]=66745536;\n\t\tans[10][8]=212751396;\n\t\tans[10][9]=449141836;\n\t\tans[10][10]=0;\n\t\tans[10][11]=11675872;\n\t\tans[10][12]=4900324;\n\t\tans[10][13]=980474;\n\t\tans[10][14]=120143080;\n\t\tans[10][15]=47159156;\n\t\tans[10][16]=380171;\n\t\tans[10][17]=35871;\n\t\tans[10][18]=2207348;\n\t\tans[10][19]=223498;\n\t\tans[10][20]=4875;\n\t\tans[11][1]=120;\n\t\tans[11][2]=4212;\n\t\tans[11][3]=75712;\n\t\tans[11][4]=869505;\n\t\tans[11][5]=7154784;\n\t\tans[11][6]=45048640;\n\t\tans[11][7]=225059328;\n\t\tans[11][8]=901995588;\n\t\tans[11][9]=2821056160;\n\t\tans[11][10]=5924217936;\n\t\tans[11][11]=0;\n\t\tans[11][12]=1763160100;\n\t\tans[11][13]=1014736800;\n\t\tans[11][14]=96243664;\n\t\tans[11][15]=527663136;\n\t\tans[11][16]=13024737;\n\t\tans[11][17]=1152008;\n\t\tans[11][18]=27986506;\n\t\tans[11][19]=835384;\n\t\tans[12][1]=143;\n\t\tans[12][2]=5915;\n\t\tans[12][3]=124215;\n\t\tans[12][4]=1656200;\n\t\tans[12][5]=15767024;\n\t\tans[12][6]=114874032;\n\t\tans[12][7]=668144880;\n\t\tans[12][8]=3173688180;\n\t\tans[12][9]=12342120700;\n\t\tans[12][10]=38013731756;\n\t\tans[12][11]=79483257308;\n\t\tans[12][12]=0;\n\t\tans[12][13]=334424;\n\t\tans[12][14]=86230664;\n\t\tans[12][15]=401457992;\n\t\tans[12][16]=1811255769;\n\t\tans[12][17]=8782619185;\n\t\tans[12][18]=524739891;\n\t\tans[13][1]=168;\n\t\tans[13][2]=8085;\n\t\tans[13][3]=196000;\n\t\tans[13][4]=2998800;\n\t\tans[13][5]=32626944;\n\t\tans[13][6]=271211472;\n\t\tans[13][7]=1802805120;\n\t\tans[13][8]=9859090500;\n\t\tans[13][9]=44986664800;\n\t\tans[13][10]=170724392916;\n\t\tans[13][11]=519227905728;\n\t\tans[13][12]=1081724803600;\n\t\tans[13][13]=0;\n\t\tans[13][14]=5856160;\n\t\tans[13][15]=0;\n\t\tans[13][16]=208030461065;\n\t\tans[13][17]=743483832;\n\t\tans[14][1]=195;\n\t\tans[14][2]=10800;\n\t\tans[14][3]=299200;\n\t\tans[14][4]=5202000;\n\t\tans[14][5]=64047024;\n\t\tans[14][6]=600935040;\n\t\tans[14][7]=4507012800;\n\t\tans[14][8]=27887141700;\n\t\tans[14][9]=145173803500;\n\t\tans[14][10]=641087516256;\n\t\tans[14][11]=2384209771200;\n\t\tans[14][12]=7174705330000;\n\t\tans[14][13]=14901311070000;\n\t\tans[14][14]=0;\n\t\tans[14][15]=262032716400;\n\t\tans[14][16]=2131715333625;\n\t\tans[15][1]=224;\n\t\tans[15][2]=14144;\n\t\tans[15][3]=443904;\n\t\tans[15][4]=8697744;\n\t\tans[15][5]=120187008;\n\t\tans[15][6]=1261963584;\n\t\tans[15][7]=10576456704;\n\t\tans[15][8]=73167596964;\n\t\tans[15][9]=427391677504;\n\t\tans[15][10]=2136958387520;\n\t\tans[15][11]=9183622822400;\n\t\tans[15][12]=33577620944400;\n\t\tans[15][13]=100136810390400;\n\t\tans[15][14]=207426250094400;\n\t\tans[15][15]=0;\n\t\tans[16][1]=255;\n\t\tans[16][2]=18207;\n\t\tans[16][3]=642447;\n\t\tans[16][4]=14084415;\n\t\tans[16][5]=216899991;\n\t\tans[16][6]=2530499895;\n\t\tans[16][7]=23518156167;\n\t\tans[16][8]=180305863947;\n\t\tans[16][9]=1168649118175;\n\t\tans[16][10]=6511045086975;\n\t\tans[16][11]=31479019635375;\n\t\tans[16][12]=132211882468575;\n\t\tans[16][13]=476432168185575;\n\t\tans[16][14]=1409850293610375;\n\t\tans[17][1]=288;\n\t\tans[17][2]=23085;\n\t\tans[17][3]=909720;\n\t\tans[17][4]=22174425;\n\t\tans[17][5]=378261576;\n\t\tans[17][6]=4873620213;\n\t\tans[17][7]=49911657840;\n\t\tans[17][8]=421129613025;\n\t\tans[17][9]=3003942370000;\n\t\tans[17][10]=18451716007725;\n\t\tans[17][11]=98815801429800;\n\t\tans[17][12]=464342770607625;\n\t\tans[17][13]=1912322889603000;\n\t\tans[18][1]=323;\n\t\tans[18][2]=28880;\n\t\tans[18][3]=1263500;\n\t\tans[18][4]=34051325;\n\t\tans[18][5]=639970331;\n\t\tans[18][6]=9058041608;\n\t\tans[18][7]=101671895600;\n\t\tans[18][8]=938731990625;\n\t\tans[18][9]=7322109526875;\n\t\tans[18][10]=49204576020600;\n\t\tans[18][11]=288924390600300;\n\t\tans[18][12]=1496215594180125;\n\t\tans[19][1]=360;\n\t\tans[19][2]=35700;\n\t\tans[19][3]=1724800;\n\t\tans[19][4]=51137625;\n\t\tans[19][5]=1053844176;\n\t\tans[19][6]=16309493200;\n\t\tans[19][7]=199708080000;\n\t\tans[19][8]=2008002335625;\n\t\tans[19][9]=17037595575000;\n\t\tans[19][10]=124510748462100;\n\t\tans[19][11]=795771174744000;\n\t\tans[20][1]=399;\n\t\tans[20][2]=43659;\n\t\tans[20][3]=2318239;\n\t\tans[20][4]=75274584;\n\t\tans[20][5]=1693678140;\n\t\tans[20][6]=28541613100;\n\t\tans[20][7]=379694987100;\n\t\tans[20][8]=4140135724725;\n\t\tans[20][9]=38044950918975;\n\t\tans[20][10]=300900975450075;\n\n\t}\n\n\tfor(LL a = 0; a < 40; a++){\n\t\tfor(LL b = 0; b < 40; b++){\n\t\t\tif(b > a){\n\t\t\t\tncr[a][b] = 0;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif(b == 0 || b == a){\n\t\t\t\tncr[a][b] = 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tncr[a][b] = ncr[a-1][b-1] + ncr[a-1][b];\n\t\t}\n\t}\n\tLL R, C;\n\tcin >> R >> C;\n\tstring str;\n\tcin >> str;\n\tLL n = R+C;\n\tLL blockarea[n][n];\n\tLL totalarea[n+1][n+1];\n\tfor(LL a = 0; a < n; a++){\n\t\tfor(LL b = 0; b < n; b++){\n\t\t\tblockarea[a][b] = ncr[a][R-1]*ncr[b][R-1];\n\t\t}\n\t}\n\tLL revarea[n+1][n+1];\n\tfor(LL a = 0; a <= n; a++){\n\t\tfor(LL b = 0; b <= n; b++){\n\t\t\ttotalarea[a][b] = 0;\n\t\t\tif(a == 0 || b == 0) continue;\n\t\t\ttotalarea[a][b] = totalarea[a][b-1] + totalarea[a-1][b] - totalarea[a-1][b-1];\n\t\t\ttotalarea[a][b] += blockarea[a-1][b-1];\n\t\t}\n\t}\n\tfor(LL a = 0; a <= n; a++){\n\t\tfor(LL b = 0; b <= n; b++){\n\t\t\trevarea[a][b] = totalarea[n][n] - totalarea[n-a][n]\n\t\t\t\t\t\t - totalarea[n][n-b] + totalarea[n-a][n-b];\n\t\t}\n\t}\n\n\tLL d = min(2*n-1,30);\n\n\tmap dp[n+1][n+1];\n\tmap bp[n+1][n+1];\n\tdp[0][0][0] = 1;\n\tbp[0][0][0] = 1;\n\n\tLL best = ans[R][C];\n\tLL m1 = (-best + totalarea[n][n]) / 2;\n\tLL m2 = totalarea[n][n] - m1;\n\tLL bestfreq = 0;\n\n\tfor(LL x = 0; x <= n; x++){\n\t\tfor(LL y = 0; y < n; y++){\n\t\t\tif(x+y+1 <= d && str[x+y] != 'B'){\n\t\t\t\tfor(auto it = dp[x][y].begin(); it != dp[x][y].end(); it++){\n\t\t\t\t\tLL area2 = it->first + totalarea[n][y+1] - totalarea[x][y+1];\n\t\t\t\t\tif(area2 > m2) continue;\n\t\t\t\t\tdp[x][y+1][it->first] += it->second;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(x+y+1 <= 2*n-d && str[n-x+n-y-1] != 'B'){\n\t\t\t\tfor(auto it = bp[x][y].begin(); it != bp[x][y].end(); it++){\n\t\t\t\t\tLL area2 = totalarea[n][n] - it->first - totalarea[n-x][n-(y+1)];\n\t\t\t\t\tif(area2 > m2) continue;\n\t\t\t\t\tbp[x][y+1][it->first] += it->second;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(x == n) continue;\n\t\tfor(LL y = 0; y <= n; y++){\n\n\t\t\tif(x+y+1 <= d && str[x+y] != 'A'){\n\t\t\t\tLL newarea = totalarea[x+1][y] - totalarea[x][y];\n\t\t\t\tfor(auto it = dp[x][y].begin(); it != dp[x][y].end(); it++){\n\t\t\t\t\tLL c = it->first+newarea;\n\t\t\t\t\tLL area2 = totalarea[x+1][n] - c;\n\t\t\t\t\tif(area2 > m2) continue;\n\t\t\t\t\tdp[x+1][y][it->first + newarea] += it->second;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(x+y+1 <= 2*n-d && str[n-x+n-y-1] != 'A'){\n\t\t\t\tLL newarea = totalarea[n-x][n-y] - totalarea[n-x-1][n-y];\n\t\t\t\tfor(auto it = bp[x][y].begin(); it != bp[x][y].end(); it++){\n\t\t\t\t\tif(it->first + newarea > m2) continue;\n\t\t\t\t\tbp[x+1][y][it->first + newarea] += it->second;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(x+y+1 <= d) dp[x][y].clear();\n\t\t\tif(x+y+1 <= 2*n-d) bp[x][y].clear();\n\t\t}\n\n\t}\n\n\n\tfor(LL x = 0; x <= n; x++){\n\t\tLL y = d-x;\n\t\tif(y < 0 || y > n) continue;\n\t\t//cout << x << \" \" << y << endl;\n\t\tfor(auto it = dp[x][y].begin(); it != dp[x][y].end(); it++){\n\t\t\tLL c = it->first;\n\t\t\tLL freq = it->second;\n\t\t\t// bp[n-x][n-y]\n\t\t\tbestfreq += freq * bp[n-x][n-y][m1-c];\n\t\t\tif(m1 != m2) bestfreq += freq * bp[n-x][n-y][m2-c];\n\n\t\t}\n\t}\n\n\tcout << bestfreq << endl;\n\n}\n", "lang": "GNU C++14", "bug_code_uid": "a66a88dab7154469a1571742a291b762", "src_uid": "1b978b5aed4a83a2250bb23cc1ad6f85", "apr_id": "ab9d314c833573e3224cfe4c45c43a11", "difficulty": 3300, "tags": ["meet-in-the-middle", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.8546768366118025, "equal_cnt": 17, "replace_cnt": 7, "delete_cnt": 5, "insert_cnt": 4, "fix_ops_cnt": 16, "bug_source_code": "#include \n\nusing namespace std;\n\nconst int MAXN = 1e3 + 10;\nconst long double EPS = 1e-9;\nconst long double PI = acos(-1);\nconst long double a90 = PI / 2;\nconst long double a180 = PI;\n\nstruct pt{\n long double cor[5];\n pt(){}\n pt(long double c1, long double c2, long double c3, long double c4, long double c5){\n cor[0] = c1;\n cor[1] = c2;\n cor[2] = c3;\n cor[3] = c4;\n cor[4] = c5;\n }\n pt(pt a, pt b){\n cor[0] = b.cor[0] - a.cor[0];\n cor[1] = b.cor[1] - a.cor[1];\n cor[2] = b.cor[2] - a.cor[2];\n cor[3] = b.cor[3] - a.cor[3];\n cor[4] = b.cor[4] - a.cor[4];\n }\n};\n\nlong double dot_prod(pt a, pt b){\n long double res = 0;\n for (int i = 0; i < 5; i++)\n res += a.cor[i] * b.cor[i];\n return res;\n}\n\nlong double len(pt a){\n return sqrt(dot_prod(a, a));\n}\n\nlong double angle(pt a, pt o, pt b){\n pt x = pt(o, a), y = pt(o, b);\n long double res = (acos(dot_prod(x, y) / (len(x) * len(y))));\n return res;\n}\n\npt p[MAXN];\nbool ans[MAXN];\n\nint main()\n{\n #ifdef HOME\n freopen(\"input.txt\", \"rt\", stdin);\n #endif // HOME\n ios_base::sync_with_stdio(0);\n cin.tie(0);\n cout.tie(0);\n int n;\n cin >> n;\n if (n < 3){\n cout << n << \"\\n\";\n for (int i = 0; i < n; i++)\n cout << i + 1 << \"\\n\";\n return 0;\n }\n for (int i = 0; i < n; i++){\n long double a, b, c, d, e;\n cin >> a >> b >> c >> d >> e;\n p[i] = pt(a, b, c, d, e);\n ans[i] = false;\n }\n for (int v = 0; v < n; v++){\n for (int a = 0; a < n; a++){\n for (int b = 0; b < n; b++){\n if (v == a || v == b || a == b)\n continue;\n long double a1 = angle(p[a], p[v], p[b]);\n long double a2 = angle(p[v], p[a], p[b]);\n long double a3 = a180 - a1 - a2;\n if (a180 > a1 - EPS && a1 > a90 -EPS)\n ans[v] = true;\n if (a180 > a2 - EPS && a2 > a90 -EPS)\n ans[a] = true;\n if (a180 > a3 - EPS && a3 > a90 -EPS)\n ans[b] = true;\n /*if (a1 > a90 - EPS)\n ans[v] = true;\n if (a2 > a90 - EPS)\n ans[a] = true;\n if (a3 > a90 - EPS)\n ans[b] = true;*/\n }\n }\n }\n int k = 0;\n for (int i = 0; i < n; i++)\n if (ans[i])\n k++;\n cout << k << \"\\n\";\n for (int i = 0; i < n; i++){\n if (ans[i])\n cout << i + 1 << \"\\n\";\n }\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "dfb45b7f431dea5cb82ff7e7f00cf1e4", "src_uid": "c1cfe1f67217afd4c3c30a6327e0add9", "apr_id": "c1342f628485756d8e9f51316215c9ad", "difficulty": 1700, "tags": ["geometry", "math", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8703969392635102, "equal_cnt": 10, "replace_cnt": 6, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 9, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n#define f first\n#define s second\n#define pb push_back\n#define mp make_pair\n#define forit(v,it) for(typeof(v.begin()) it = v.begin(); it != v.end(); ++it)\ntypedef long long ll;\ntypedef pair pii;\ntypedef vector vi;\n\nint n;\ndouble R,r;\nconst long double PI = 3.1415926535897932384626433832795;\n\nint main () {\n\t#ifdef LOCAL\n\tfreopen(\"input.txt\",\"r\",stdin);\n\tfreopen(\"output.txt\",\"w\",stdout);\n\t#endif\n\tscanf(\"%d%lf%lf\",&n,&R,&r);\n\tint cnt = 0;\n\tif(R < r || (n > 1 && R == r)) {\n\t\twhile(true);\n\t\tputs(\"NO\");\n\t\treturn 0;\n\t}\n\tif(n == 1) {\n\t\tputs(\"YES\");\n\t\treturn 0;\n\t}\n\n\twhile(R >= r) {\n\t\tif(R == r) {\n\t\t\tcnt++;\n\t\t\tbreak;\n\t\t}\n\t\tlong double x = acos(1 - (long double)(2*r*r)/((R - r)*(R - r)));\n\t\tif(x + 1e-9 < 0) x += 2*PI;\n\t\tcnt += (int)((long double)(2*PI)/x + 1e-9);\n\t\tR -= 2*r;\n\t}\n\tif(cnt < n) puts(\"NO\");\n\telse puts(\"YES\");\n\treturn 0;\n}", "lang": "GNU C++", "bug_code_uid": "1e4125c6eea5e19304ec56e6457ab612", "src_uid": "2fedbfccd893cde8f2fab2b5bf6fb6f6", "apr_id": "ba14796078996718de4255a325979d29", "difficulty": 1700, "tags": ["geometry", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.992521877486078, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include\n\n//topcoder\n#define sz(a) ((int)a.size())\n#define repv(i,a) for(int i=0;i=0;i--)\n#define rep(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 countbit(x) __builtin_popcount(x)\n#define SET(a) memset(a,-1,sizeof a)\n#define CLR(a) memset(a,0,sizeof a)\n#define all(a) a.begin(),a.end()\n#define pb(a) push_back(a)\n\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 rall(a) a.rbegin(),a.rend()\n#define READ(f) freopen(f, \"r\", stdin)\n#define WRITE(f) freopen(f, \"w\", stdout)\n#define pi (2.0*acos(0.0))\n#define PI (2.0*acos(0.0))\n\n#define set0(ar) memset(ar,0,sizeof ar)\n#define setinf(ar) memset(ar,126,sizeof ar)\n#define in(a,x,y) (a>=x && a<=y)\n#define out(a,x,y) (!in(a,x,y))\n#define eq(a,b) (fabs(a-b)b+eps)\n#define xx first\n#define yy second\n//#define root 1\n\n#define MAX(a) (*max_element(all(a)))\n#define MIN(a) (*min_element(all(a)))\n\n#define LB(a,x) (lower_bound(all(a),x)-a.begin())\n#define UB(a,x) (upper_bound(all(a),x)-a.begin())\n\nusing namespace std;\nint ts,kk=1;\n\ntypedef long long ll;\ntypedef long long LL;\ntypedef unsigned long long ull;\ntypedef vector vi;\ntypedef vector vvi;\ntypedef vector vll;\ntypedef pair pii;\ntypedef pair pll;\ntypedef vector< pii > vii;\n\ntemplate< class T > inline T _sq(T a) { return a * a; }\ntemplate< class T, class X > inline T _pow(T a,X y) {T z=1; rep(i,1,y){z*=a;} return z; }\ntemplate< class T > inline T _gcd(T a,T b) {a=_abs(a);b=_abs(b); if(!b) return a; return _gcd(b,a%b);}\ntemplate< class T > inline T _lcm(T a,T b) {a=_abs(a);b=_abs(b); return (a/_gcd(a,b))*b;}\n\ntemplate< class T > inline T _extended(T a,T b,T &x,T &y) {a=_abs(a);b=_abs(b); T g,x1,y1; if(!b) {x=1;y=0;g=a; return g;} g=_extended(b,a%b,x1,y1); x=y1; y=x1-(a/b)*y1; return g;}\n\ntemplate< class T, class X > inline bool getbit(T a, X i) { T t=1; return ((a&(t<0); }\ntemplate< class T, class X > inline T setbit(T a, X i) { T t=1;return (a|(t< inline T resetbit(T a, X i) { T t=1;return (a&(~(t< inline T togglebit(T a, X i) { T t=1;return (a^(t< inline T _bigmod(T n,X m,Y mod){ull ret=1, a = n%mod ; while(m){ if(m&1)ret=(ret*a)%mod; m>>=1; a=(a*a)%mod; }ret%=mod;return (T)ret;}\ntemplate< class T, class Y > inline T _modinv(T n,Y mod) {return _bigmod(n,mod-2,mod);}\n\n/// //CONSTANT// ///\n/// power 0123456789 ///\n#define lmt 200\n#define MX (lmt + 20 )\n#define ten 10000000000LL\n#define MOD 1000000007\n#define inf 1000000000000000000LL\n\n#define LOGMX 30\n#define eps 1e-9\n///===========================///\n\ndouble p,go[2020][2020];\nint t , n;\n\ndouble dp(int pos,int tm){\n\n if(pos==n+1 || tm==0){\n return pos-1;\n }\n if(go[pos][tm]>-.5) return go[pos][tm];\n double ret = dp(pos+1,tm-1)*p + (1-p)*dp(pos,tm-1);\n\n return ret;\n}\n\nint main()\n{\n cin>>n>>p>>t;\n memset(go , -1 , sizeof go);\n cout<\nusing namespace std;\n#include \nint main(){\n long long int a,b,flag=0;cin>>a,b;\n for(int i=1;flag!=1;i++)\n {\n if(i%2==0)\n { \n if(b-i<0)\n {\n cout<<\"Valera\";\n break;\n }\n else b-=i;\n } \n \n \n if(i%2!=0)\n {\n if(a-i<0)\n {\n cout<<\"Vladik\";\n break;\n }\n else a-=i;\n } \n }\n}", "lang": "GNU C++17", "bug_code_uid": "8a250d94e6e6b67b9b939a23e6fe0d29", "src_uid": "87e37a82be7e39e433060fd8cdb03270", "apr_id": "bda8f26fdaa13be9713c60d7958be110", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.38844028899277516, "equal_cnt": 30, "replace_cnt": 24, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 30, "bug_source_code": "#include\n#define pb push_back\n#define mp make_pair\n#define all(v) v.begin(),v.end()\n#define INF 10000000000000000LL\n#define P system(\"pause\")\n#define print(v) for(typeof(v.begin()) itr = v.begin();itr!=v.end();itr++)cout<<*itr<<\" \"\n#define IN freopen(\"input.txt\",\"r\",stdin)\n#define OUT freopen(\"output.txt\",\"w\",stdout)\n#define IO IN;OUT\n#define SIZE 1005\n#define C 10000\ntypedef long long ll;\nusing namespace std;\ntypedef pair ii;\ntypedef pair iii;\ntypedef vector vi;\n\nll p,x,y;map mm;queue mq;\n\nbool check(ll rating)\n{\n\n if (rating < y)\n return false;\n ll i = (rating/50)%475;\n set ms;\n for(ll c=0;c<25;c++)\n {\n i = (i*96 + 42)%475;\n ms.insert(26+i);\n }\n if (rating >=y && ms.find(p)!= ms.end())\n return true;\n return false;\n}\nvoid dfs()\n{\n ll rating = mq.front(); mq.pop();\n //cout<=y-200; r-=50)\n {\n if (!mm[r])\n {\n mm[r] = mm[rating];\n mq.push(r);\n }\n }\n if (rating < 2*y && !mm[rating+100])\n {\n mm[rating+100] = mm[rating]+1;\n mq.push(rating+100);\n }\n dfs();\n\n}\nint main()\n{//IN;\n cin>>p>>x>>y;\n mm[x]=1;\n mq.push(x);\n // check(10400);\n dfs();\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "7ae07b42b57c9ef8f3b74c6db6ccc5b8", "src_uid": "c9c22e03c70a94a745b451fc79e112fd", "apr_id": "029209990cce986ea07678819af73d7d", "difficulty": 1300, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.15542271562766866, "equal_cnt": 17, "replace_cnt": 13, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 18, "bug_source_code": "\n#include\n#include\nusing namespace std;\n\nint main(void)\n{\n\n int n;\n while(scanf(\"%d\", &n)){\n\n int x;\n scanf(\"%d\", &x);\n\n\n bool flag = true;\n int hold = 0;\n for (int i = 1; i <= n / 2; i++)\n {\n if (x % 10 != 4 && x % 10 != 7)\n {\n flag = false;\n break;\n }\n hold += x % 10;\n x = x / 10;\n }\n\n int hold2 = 0;\n if (flag)\n {\n for (int i = 1; i <= n / 2; i++)\n {\n hold2 += x % 10;\n x = x / 10;\n }\n }\n\n if (flag)\n {\n if (hold == hold2)\n printf(\"YES\\n\");\n }\n else\n printf(\"NO\\n\");\n}\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "053866c5d21135f439374befc389ae47", "src_uid": "435b6d48f99d90caab828049a2c9e2a7", "apr_id": "54c8167c80492e8b61ad7bef9dcf113a", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5893186003683242, "equal_cnt": 13, "replace_cnt": 12, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 12, "bug_source_code": "#include\n\nusing namespace std;\n\n\nint main()\n{\n int n,m,i{};\n cin>>n>>m;\n\n for(int a=1;a<1000;a++){\n for(int b=1;b<1000;b++)\n if(a*a+b==n && a+b*b==m){\n i++;\n }\n }\n cout<\nusing namespace std;\n\nint main()\n{\n string n;\n int k;\n cin>>n>>k;\n int len=n.size(),cnt=0,flg=0;\n if(len>k)\n {\n for(int i=len-1;flg!=k;i--)\n {\n if(n[i]!='0')\n ++cnt;\n else\n ++flg;\n }\n }\n else\n {\n cnt=len-1;\n }\n\n printf(\"%d\",cnt);\n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "fa164bc905e4465d8c1984379afd4abe", "src_uid": "7a8890417aa48c2b93b559ca118853f9", "apr_id": "5951b893f7bfc5e4c72be428ebc5e1db", "difficulty": 1100, "tags": ["brute force", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9969192852741836, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \n#define pb push_back\n#define x first\n#define y second\n#define FOR(i, a, b) for(int i=a;ib; i\u2014-)\n#define ri(x) scanf(\"%d\", &x);\n#define rl(x) scanf(\"%lld\", &x)\nusing namespace std;\n\ntypedef long long ll;\ntypedef long double ld;\ntypedef vector vl;\ntypedef vector vi;\ntypedef vector vc;\nconst int INF = 2e6;\nconst ll LINF = 8e18;\nconst int MOD = 1e9 + 7;\nconst ld EPS = 1e-9;\n\n\n\nint main(){\n ll n;\n rl(n);\n bool check;\n while(n>=1){\n check =true;\n for(int j = 2; j*j <= n && check;j++) {\n if (n % (j * j) == 0) {\n check = false;\n n /= j;\n }\n }\n if(check){\n printf(\"%lld\", n);\n break;\n }\n }\n return 0;\n}", "lang": "GNU C++14", "bug_code_uid": "baa4e246ce2e064ec02ba0a32a33fe62", "src_uid": "6d0da975fa0961acfdbe75f2f29aeb92", "apr_id": "6a49b02aa7874adfbf4c9db7fba97b3e", "difficulty": 1300, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.07401315789473684, "equal_cnt": 9, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 9, "bug_source_code": "#include \n\n#include \n\nusing namespace std;\n\nint main()\n{\n long long n,m;\n\n vector x;\n\n x.push_back(0);\n\n for (int i=1;;i++)\n {\n long long z=i+x[i-1];\n\n x.push_back(z);\n\n if (x[i]>=10e14)\n {\n break;\n }\n }\n\n cin>>n>>m;\n\n if (n\n#include \n#include \nusing namespace std;\n\nint n,i,j,ans=0,cnt[27];\nstring s;\n\nint main(){ \n\tscanf(\"%d\",&n); cin >> s; i=0;\n\tdo{\n\t\tif (s[i]>='A' && s[i]<='Z'){\n\t\t\tint tot=0;\n\t\t\tfor (j=1;j<=26;j++)\n\t\t\t\tif (cnt[j]) tot++;\n\t\t\tans=max(ans,tot);\n\t\t\twhile (s[i]<='Z' && i\n#include \nusing namespace std;\n#define ll long long \n#define vint vector\n#define pb push_back\n#define all(v) v.begin(),v.end()\n#define ios cin.sync_with_stdio(false),cin.tie(NULL)\n#define f_(i,m,n) for(ll i=m;i 0) \n { \n if (y & 1) {\n res = (res*x) % p; \n }\n \n \n y = y>>1; \n x = (x*x) % p; \n } \n return res; \n} \n \n\nbool miillerTest(ll d, ll n) \n{ \n \n ll a = 2 + rand() % (n - 4); \n \n ll x = power(a, d, n); \n \n if (x == 1 || x == n-1) {\n return true; \n }\n \n while (d != n-1) \n { \n x = (x * x) % n; \n d *= 2; \n \n if (x == 1){\n return false; \n }\n\n if (x == n-1){\n return true;\n } \n } \n \n return false; \n} \n \nbool prime(ll n, ll k) \n{ \n \n if (n <= 1 || n == 4){ \n \treturn false; \n }\n if (n <= 3){ \n \treturn true;\n } \n \n \n ll d = n - 1; \n while (d % 2 == 0){\n d /= 2; \n }\n \n \n for (ll i = 0; i < k; i++){\n if (!miillerTest(d, n)){ \n return false; \n }\n }\n \n return true; \n} \n\n\nll pow(ll a, ll b){\n\tll res=1;\n\twhile(b--){\n\t\tres*=a;\n\t}\n\treturn res;\n}\n\nvoid solve(){\n\tll n;\n\tcin>>n;\n\tstring s;\n\tcin>>s;\n\n\tvint ans;\n\n\tll i=0;\n\twhile(i>t;\n\twhile(t--){\n\t\tsolve();\n\t}\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "f570ec97061ef63b168f372a525e186e", "src_uid": "a4b3da4cb9b6a7ed0a33a862e940cafa", "apr_id": "85b9095fd1b5981b59fc3ecb4abf52a3", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7355769230769231, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "#include\n\nusing namespace std;\ntypedef unsigned long long ull;\nint main(){\n\tstd::ios::sync_with_stdio(false);\n string s;\n cin>>s;\n ull n = (s[0]-48)*10000+(s[2]-48)*1000+(s[4]-48)*100 + (s[3]-48)*10 + s[1]-48;\n ull ans = (n*n*n)%100000;\n ans = (ans*n*n)%100000;\n int cant = 5;\n n = ans;\n while(n>0)cant--,n/=10;\n for(int i=0;cant;++i)cout<<\"0\";\n cout<\n#include\n#include\n#include\n#include\n#define x first\n#define y second\n#define mpir make_pair\n#define mtpl make_tuple\nusing namespace std;\ntypedef pair pir;\ntypedef tuple tpl;\nconstexpr int siz=1<<20|1,INF=0x7f7f7f7f;\nconstexpr int fx[4][2]={{1,0},{0,-1},{-1,0},{0,1}};\n\nint n,m,sx,sy,cnt;\nint val[9],sum[9];\nint f[21][21][siz];\nchar c[21][21];\npir t[9];\nqueue q;\n\ninline\nbool check(char c)\n{\n\treturn c=='.'||c=='S';\n}\n\ninline\nbool check(int x,int y,int xi,int yi,int k)\n{\n\tif(xi==t[k].x && yixi;\n\treturn false;\n}\n\nint bfs();\n\nint main()\n{\n#ifdef HAZE\n\tfreopen(\"CF375C.in\",\"r\",stdin);\n#endif\n\tscanf(\"%d%d\",&n,&m);\n\tfor(int i=1;i<=n;i++)\n\t\tfor(int j=1;j<=m;j++)\n\t\t{\n\t\t\tcin>>c[i][j];\n\t\t\tif(c[i][j]=='S')\n\t\t\t{\n\t\t\t\tsx=i;\n\t\t\t\tsy=j;\n\t\t\t}\n\t\t\tif(isdigit(c[i][j]))\n\t\t\t{\n\t\t\t\tcnt++;\n\t\t\t\tt[c[i][j]-'0']=mpir(i,j);\n\t\t\t}\n\t\t}\n\tfor(int i=1;i<=cnt;i++)\n\t\tscanf(\"%d\",&val[i]);\n\tfor(int i=1;i<=n;i++)\n\t\tfor(int j=1;j<=m;j++)\n\t\t\tif(c[i][j]=='B')\n\t\t\t{\n\t\t\t\tval[++cnt]=-INF;\n\t\t\t\tt[cnt]=mpir(i,j);\n\t\t\t}\n\tfor(int i=1;i<(1<>j)&1)\n\t\t\t\tsum[i]+=val[j+1];\n\tprintf(\"%d\\n\",bfs());\n\treturn 0;\n}\n\nint bfs()\n{\n\tint res(0);\n\tq.push(mtpl(sx,sy,0));\n\tfor(int i=1;i<=n;i++)\n\t\tfor(int j=1;j<=m;j++)\n\t\t\tfor(int k=0;k<(1<0&&xi<=n&&yi>0&&yi<=m&&check(c[xi][yi]))\n\t\t\t{\n\t\t\t\tint si=s;\n\t\t\t\tfor(int j=0;j\n#define inf 10000000\nusing namespace std;\nint n,m,c,c_,refc[10];\nchar mp[25][25];\nint p[25][25];\nint val[10],px[10],py[10],sx,sy;\nint dx[5]={0,1,0,-1,0},dy[5]={0,0,-1,0,1};\nint dp[25][25][1<<8],sum[1<<8];\nstruct state{\n\tint x,y,st;\n};\nvoid bfs()\n{\n\tqueueq;\n\tq.push((state){sx,sy,0});\n\tstate now;\n\tint nx,ny,s,ax,ay,as;\n\twhile(!q.empty())\n\t{\n\t\tnow=q.front();q.pop();\n\t\tnx=now.x;ny=now.y;s=now.st;\n\t\tfor(int i=1;i<=4;++i)\n\t\t{\n\t\t\tax=nx+dx[i];ay=ny+dy[i];as=s;\n\t\t\tif(ax<=0||ax>n||ay<=0||ay>m)continue;\n\t\t\tfor(int j=0;j>n>>m;\n\tfor(int i=1;i<=n;++i)cin>>(mp[i]+1);\n\tfor(int i=1;i<=n;++i)\n\t{\n\t\tfor(int j=1;j<=n;++j)\n\t\t{\n\t\t\tif(mp[i][j]=='#')p[i][j]=1;\n\t\t\telse if(mp[i][j]=='S')sx=i,sy=j;\n\t\t\telse if(isdigit(mp[i][j]))refc[c_++]=c,px[c]=i,py[c++]=j;\n\t\t\telse if(mp[i][j]=='B')val[c]=-inf,px[c]=i,py[c++]=j;\n\t\t}\n\t}\n\tint a;\n\tfor(int i=1;i<=c_;++i)\n\t{\n\t\tcin>>a;\n\t\tval[refc[i]]=a;\n\t}\n\tfor(int i=1;i<(1<\nusing namespace std;\nint main()\n{\n int n,i,b;\n int a[]={0,1,3,6,10,15,21,28,36,45};\n string s;\n cin>>n;\n cin>>s;\n if(n==1)\n {\n cout<\nusing namespace std;\nint count(string s,int start){\n\tint ans=0;\n\tfor(int i=start;i>s;\n\tfor(int i=0;i\n#include \n#include \nusing namespace std;\n\nbool cmp(int x, int y){\n if(x < y) return true;\n else return false;\n}\n\nint main()\n{\n int n, x, suma = 0;\n vector polje(n);\n cin >> n;\n for(int i = 0;i < n;i++){\n cin >> x;\n polje.push_back(x);\n }\n\n sort(polje.begin(),polje.end(),cmp);\n\n for(int i = 0;i < n;i++) suma += polje[i];\n\n int j = 0;\n while(((double) suma / (double) n) < 4.5){\n suma -= polje[j];\n suma += 5;\n polje[j] = 5;\n j++;\n }\n cout << j;\n return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "28ab1330017cc34dc1d685070fa3971d", "src_uid": "715608282b27a0a25b66f08574a6d5bd", "apr_id": "a42c1b5a7011f101dae233a94841a7c5", "difficulty": 900, "tags": ["greedy", "sortings"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.10619469026548672, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "#include\n#include\nusing namespace std;\nint main(){\n int x,y,z,i,j,k;\n scanf(\"%d%d%d%d%d%d\",x,y,z,i,j,k);\n int cnt=0;\n if(x==i) cnt++;\n if(y==j) cnt++;\n if(z==k) cnt++;\n if(cnt>0) puts(\"YES\");\n if(cnt==0) puts(\"NO\");\n return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "0041f34b7598e629cebfe80245ca333c", "src_uid": "91c9dbbceb467d5fd420e92c2919ecb6", "apr_id": "d45280ec28fcf74349a81ccc69006333", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5684333139196273, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nusing ll = long long;\nusing ld = long double;\nconstexpr ll MAX = 1e9;\n\nint main() {\n ios_base::sync_with_stdio(false);\n cin.tie(0); cout.tie(0);\n\n ll x;\n scanf(\"%lld\", &x);\n queue q;\n q.push(0LL);\n\n int d = 1;\n ll lvl = 0LL;\n while (!q.empty()) {\n int sz = q.size();\n while (sz-- > 0) {\n ll v = q.front();\n q.pop();\n\n if (v == x) {\n printf(\"%lld\\n\", lvl);\n return 0;\n }\n\n for (ll s = -1; s <= 1; s += 2) {\n ll nv = v + s * d;\n q.push(nv);\n }\n }\n\n ++lvl;\n ++d;\n }\n\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "41e744d5ea1ee34fe6ece3fadce86328", "src_uid": "18644c9df41b9960594fdca27f1d2fec", "apr_id": "73dda8ea78c24ad5dda6b095e17d3859", "difficulty": 1600, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.11632047477744807, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "#include\n#include\n#include\n#include\nusing namespace std;\n\nvoid swap(double &a,double &b)\n{\n\tdouble c=a;\n\ta=b;\n\tb=c;\n}\n\nbool flag;\n\nint gao(double x1,double y1,double r1,double x2,double y2,double r2)\n{\n\tif (r1r1-r2&&d=r1+r2) return 1;\n\treturn 2;\n}\n\nint main()\n{\n\tint ans=0;\n\tdouble x1,y1,r1,r2,x2,y2,r3,r4;\n\n\tscanf(\"%lf %lf %lf %lf\",&x1,&y1,&r1,&r2);\n\tscanf(\"%lf %lf %lf %lf\",&x2,&y2,&r3,&r4);\n\tif (gao(x1,y1,r1,x2,y2,r3)==gao(x1,y1,r1,x2,y2,r4)&&flag) ans++;\n\tif (gao(x1,y1,r2,x2,y2,r3)==gao(x1,y1,r2,x2,y2,r4)&&flag) ans++;\n\tif (gao(x2,y2,r3,x1,y1,r1)==gao(x2,y2,r3,x1,y1,r2)&&flag) ans++;\n\tif (gao(x2,y2,r4,x1,y1,r1)==gao(x2,y2,r4,x1,y1,r2)&&falg) ans++;\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "09597f7d92f357ef05628802776cb0e1", "src_uid": "4c2865e4742a29460ca64860740b84f4", "apr_id": "957f0cc75841d7a63ee4d5624df6124b", "difficulty": 1900, "tags": ["geometry"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.995366079703429, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \nusing namespace std;\n\n#define ll long long\n#define ull unsigned long long\n\npair pos[12];\nvector > v;\nint n ;\nstring s;\n\nbool valid(int x ,int y)\n{\n return (x >= 0 && y >= 0 && x < 3 && y < 3) || (x == 3 && y == 1);\n}\n\nbool test(int x , int y , int idx)\n{\n if(idx == n) return 1;\n if(!valid(x , y)) return 0;\n\n return test(x + v[idx].first , y + v[idx].second , idx + 1);\n}\n\nint main()\n{\n ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);\n\n cin >> n >> s;\n\n for(int i = 0 ; i < 3 ; i++)\n for(int j = 0 ; j < 3 ; j++)\n pos[i * 3 + j + 1] = {i , j};\n pos[0] = {3 , 1};\n\n for(int i = 0 ; i < n - 1 ; i++)\n {\n int x = s[i] - '0';\n int y = s[i + 1] - '0';\n v.push_back({ pos[y].first - pos[x].first , pos[y].second - pos[x].second });\n }\n\n int counter = 0;\n for(int i = 0 ; i <= 9 ; i++)\n if(test(pos[i].first , pos[i].second , 0))\n counter++;\n\n if(counter == 1)\n cout << \"YES\";\n else cout << \"NO\";\n\n\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "50ba94186a22650dce55540b6ea3766d", "src_uid": "d0f5174bb0bcca5a486db327b492bf33", "apr_id": "3209a108b0e8e557366e6f0ae8922c0a", "difficulty": 1400, "tags": ["brute force", "constructive algorithms", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.6320987654320988, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "#include \n\nusing namespace std;\n\nconst long long int mod=1e9+7;\n\nlong long int pot(long long int a, long long int b){\n\tif(b == 0) return 1;\n\tlong long int c=pot(a, b/2);\n\tif(b%2 == 0) return (c*c) % mod;\n\telse return a*pot(a, b-1) %mod;\n}\n\nint main(){\n\tlong long int n, m, k;\n\tcin >> n >> m >> k;\n\tif(k == -1 && (n%2)!=(m%2)) cout << 0;\n\telse cout << pot(pot(2, (n-1)),(m-1));\n\treturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "de0505c36415d2c7595b0d0bf16545c8", "src_uid": "6b9eff690fae14725885cbc891ff7243", "apr_id": "4227785af480af3ddaff93f9cc7d45ef", "difficulty": 1800, "tags": ["math", "combinatorics", "number theory", "constructive algorithms"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9979762937265105, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "#pragma GCC optimize(\"trapv\")\n#pragma GCC optimize(\"Ofast\")\n#pragma GCC optimization (\"unroll-loops\")\n#pragma GCC target (\"avx2\")\n#pragma GCC target(\"sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native\")\n#include\n#include \n#include \n#define forceRTE cout<<1/0\n#define forceTLE while(true){}\n#define ll long long\n#define ld long double\n#define gtl getline\n#define vec vector\n#define ar array\n#define umap unordered_map\n#define pq priority_queue\n#define pqintasc priority_queue,greater >\n#define pqpairasc priority_queue,vector >,greater > >\n#define map_set(ptr,sz) ptr.reserve(sz),ptr.max_load_factor(0.25);\n#define FOR(a,b,c) for(int i=a;i, rb_tree_tag, tree_order_statistics_node_update> policytree; \nclass mnlib{\n public:\n class VectorOperations{\n public:\n int distinctelements(vector v){\n sets;\n EACH(x,v){\n s.insert(x);\n }\n return int(len(s));\n }\n } vcs;\n class StringOperations{\n public:\n int hamDist(string a,string b){\n int qq = 0;\n for(int i=0;iri || rw void read(R& Rz, P&... Pz){\n cin >> Rz;\n read(Pz...);\n}\ntemplate void read(vec&Rz){\n int l=len(Rz);\n for(int i=0;i void send(G Gz, M... Mz){\n cout << Gz;\n fflush(stdout);\n send(Mz...);\n}\ntemplate void send(vecRz){\n for(int i=0;i void init(vec&Rz, Z2 OO){\n for(int i=0;i\nusing namespace std;\nint n;\ndouble a, b, maxx;\nintmain ()\n{\n\tcin >> n;\n\tfor (int i = 1; i <= n; i++)\n\t{\n\t\tcin >> a;\n\t\tb += a; \n\t\tmaxx = max (maxx, b/i);\n\t}\n\tcout << maxx << endl;\n\t\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "8984c85ffcadfd0ec837d9e0bcbfeaf1", "src_uid": "32fc378a310ca15598377f7b638eaf26", "apr_id": "f016febb4546ff8496f04a3913ddf9c3", "difficulty": 1700, "tags": ["trees", "implementation", "graph matchings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.5796779566907274, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "#include\nusing namespace std;\n#include\n#include\n#include\n#include \n#include \n#define F first\n#define S second\n#define pii pair\n#define pb push_back\n//#define int long long\n#define mp make_pair\n//setprecision\nint inf=1000*1000*1000+10;\nint const MAX=1000*100+10;\nint const MAX2=1000*1000+10;\nint const MAX3=5000+10;\nvector temp;\nint n,dis,tcar,tw,ti;\nint dp[MAX];\nvoid fidp()\n{\n for(int i=temp.size()-2;i>=0;i--)\n {\n if(i!=0)\n dp[temp[i]]=min(dp[temp[i+1]]+ti+tcar*(dis),(n-temp[i])*tw);\n if(i==0)\n dp[temp[0]]=min(dp[temp[1]]+tcar*dis,n*tw);\n }\n}\nmain(){\n\tios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);\n\tcin>>n>>dis>>tcar>>tw>>ti;\n\tfor(int i=0;i<=n;i+=dis)\n temp.pb(i);\n if(n%dis!=0)\n temp.pb(n);\n fidp();\n cout<\n#include\nusing namespace std;\n\n\nint main()\n{\n long long int a,b,m,c,d,i,j,k,l,f,g,rem;\n for(;;)\n {\n cin>>a>>b>>m;\n if(a==0&&b==0&&m==0)\n {\n break;\n }\n for(i=1;i<=b;i++)\n {\n rem=a%m;\n a=rem*rem;\n }\n cout<\n#define lld long long int\n#define Max 100010\n#define pi acos(-1.0)\n#define mem(a,b) memset(a,b,sizeof(a))\n#define f_input freopen(\"input.txt\",\"r\",stdin)\nusing namespace std;\nint main()\n{\n int a;\n while(1)\n {\n cin>>a;\n if(a%2 == 0)\n {\n cout<<\"0\"<\n#define all(a) a.begin(), a.end()\n#define out(t, a) copy(all(a), ostream_iterator(cout, \" \")); cout << \"\\n\";\n#define int long long\n// #define DEBAG\n \nusing namespace std;\n \nvoid set_program() {\n\t#ifdef DEBAG\n\t\tfreopen (\"test.in\", \"r\", stdin);\n\t\tfreopen (\"test.out\", \"w\", stdout);\n\t#endif\n\tios_base::sync_with_stdio(0);\n\tcin.tie(0); cout.tie(0);\n}\n\nconst int MAXN = 7000;\n\n\nbool a_in_b(int a, int b) {\n\treturn ((a & b) == a);\n}\n\nint n;\nint gr[MAXN][MAXN];\nvector deleted, used, order;\n\nvoid top_sort(int u) {\n\tused[u] = 1;\n\tfor (int v = 0; v < n; ++v) {\n\t\tif (gr[u][v] && !used[v] && !deleted[v]) {\n\t\t\ttop_sort(v);\n\t\t}\n\t}\n\torder.push_back(u);\n}\n\nint get_sum(int u, vector & b) {\n\tint sum = b[u];\n\tused[u] = 1;\n\tfor (int v = 0; v < n; ++v) {\n\t\tif (gr[u][v] && !used[v] && !deleted[v]) {\n\t\t\tsum += get_sum(v, b);\n\t\t}\n\t}\n\treturn sum;\n}\n\nmain() {\n\tset_program();\n\tcin >> n;\n\tvector a(n), b(n);\n\tfor (int& i : a) {\n\t\tcin >> i;\n\t}\n\tfor (int& i : b) {\n\t\tcin >> i;\n\t}\n\tvector cnt_childs(n, 0);\n\tfor (int i = 0; i < n; ++i) {\n\t\tfor (int j = i + 1; j < n; ++j) {\n\t\t\tif (a_in_b(a[i], a[j])) {\n\t\t\t\tgr[i][j] = 1;\n\t\t\t\t++cnt_childs[i];\n\t\t\t}\n\t\t\tif (a_in_b(a[j], a[i])) {\n\t\t\t\tgr[j][i] = 1;\n\t\t\t\t++cnt_childs[j];\n\t\t\t}\n\t\t}\n\t}\n\tdeque q;\n\tfor (int i = 0; i < n; ++i) {\n\t\tif (!cnt_childs[i]) {\n\t\t\tq.push_back(i);\n\t\t}\n\t}\n\tdeleted.assign(n, 0);\n\tfor (; q.size(); ) {\n\t\tint u = q.front();\n\t\tq.pop_front();\n\t\tdeleted[u] = 1;\n\t\tfor (int v = 0; v < n; ++v) {\n\t\t\tif (gr[v][u]) {\n\t\t\t\tif (!--cnt_childs[v]) {\n\t\t\t\t\tq.push_back(v);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tused.assign(n, 0);\n\tfor (int u = 0; u < n; ++u) {\n\t\tif (!deleted[u] && !used[u]) {\n\t\t\ttop_sort(u);\n\t\t}\n\t}\n\treverse(all(order));\n\tused.assign(n, 0);\n\tint ans = 0;\n\tfor (int u : order) {\n\t\tif (!used[u]) {\n\t\t\tans = max(ans, get_sum(u, b));\n\t\t}\n\t}\n\tcout << ans << \"\\n\";\n\treturn 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "80e2014efffd2447ef765eb211691d6f", "src_uid": "9404ec14922a69082f3573bbaf78ccf0", "apr_id": "379140e6323568b89c78dc1e252a07bc", "difficulty": 1700, "tags": ["brute force", "greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8546637744034707, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "#include \n\nusing namespace std;\n\nint t,n,Max;\n\nint main()\n{\n cin >> n;\n\n for(int i = 0; i < n; i++)\n {\n cin >> t;\n Max = Max < t ? t : Max;\n }\n cout << Max < 25 ? 0 : (Max-25) ;\n}\n", "lang": "GNU C++", "bug_code_uid": "bc6f35d76cc4749b2a436e5cfd6b27ca", "src_uid": "ef657588b4f2fe8b2ff5f8edc0ab8afd", "apr_id": "d05d04bb3c0cfa6f6ce524e3876c7cbf", "difficulty": 800, "tags": ["greedy", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9991079393398751, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "/*** author: zxwsbg ***/\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\n#define INIT(x) memset(x,0,sizeof(x))\n#define eps 1e-8\n#define next next_\ntypedef long long ll;\ntypedef unsigned long long ull;\nconst ll IINF = 9223372036854775807;\nconst int INF = 0x7fffffff;\nconst int inf = 0x3f3f3f3f;\nconst int maxn = 200005;\nconst int N = 105;\n\ninline void read(int &x) {\n int f=1;x=0;char s=getchar();\n while(s<'0'||s>'9'){if(s=='-')f=-1;s=getchar();}\n while(s>='0'&&s<='9'){x=x*10+s-'0';s=getchar();}\n x*=f;\n}\n\nint n,m,a[maxn],sum;\n\nbool check(int x) {\n\t int res = 0;\n\t for(int i=0;i=m;\n}\n\nint main() {\n\tread(n), read(m);\n\tfor(int i=0;i());\n\tif(sum\nusing namespace std;\nint main(){\n\tlong long int a,b,c;\n\tcin>>a>>b>>c;\n\tif((b-a)%c==0)cout<<\"YES\";\n\telse cout<<\"NO\";\n}", "lang": "MS C++ 2017", "bug_code_uid": "4563a7014eaec702ed98e043f8e271f7", "src_uid": "9edf42c20ddf22a251b84553d7305a7d", "apr_id": "29de505486f6e9aea17fdc9e4af1f776", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.6964380648591175, "equal_cnt": 28, "replace_cnt": 25, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 27, "bug_source_code": "#include\nusing namespace std;\nconst int N=10001;\nconst int mod=1e9+7;\nlong long int C[N][N];\nvoid build()\n{\n\tint i,j;\n\tfor(i=0;i\n#include \n\nusing namespace std;\n\n#define N 102\n\nint main()\n{\n int n, d, m;\n\n scanf (\"%d%d\", &n, &d);\n int price[N] = {0};\n for (int i = 1; i <= n; i++)\n {\n scanf (\"%d\", &price[i]);\n }\n sort (price, price + n + 1);\n for (i = 1; i <= n; i++)\n {\n price[i] += price[i - 1];\n }\n scanf (\"%d\", &m);\n int benfit = (m > n) ? price[n] - (m - n) * d : price[m];\n printf (\"%d\\n\", benfit);\n return 0;\n}", "lang": "GNU C++", "bug_code_uid": "6c542963d7bac455368b2cebc13f2b47", "src_uid": "5c21e2dd658825580522af525142397d", "apr_id": "6cba1d0dd419afd4c5f09c24a1152eb9", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9401534526854219, "equal_cnt": 8, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 7, "bug_source_code": "#include\n#include\n#include\n#include\n#include\nusing namespace std;\ntypedef long long LL;\nconst int M=1000000007;\n\nLL fpw(LL a,LL b)\n{\n\tLL s=1;\n\tfor(a%=M;b;b>>=1,a=a*a%M)\n\t\tif(b&1)s=s*a%M;\n\treturn s; \n}\n\nstruct num\n{\n\tLL r,i;\n\t\n\tnum(const LL &_r=0,const LL &_i=0):r(_r),i(_i){}\n\tnum operator+(const num &o)const\n\t{return num((r+o.r)%M,(i+o.i)%M);}\n\tnum operator-(const num &o)const\n\t{return num((r-o.r)%M,(i-o.i)%M);}\n\tnum operator*(const num &o)const\n\t{return num((r*o.r+5LL*i*o.i)%M,(r*o.i+i*o.r)%M);}\n\tnum operator/(const num &o)const\n\t{\n\t\tLL d=(o.r*o.r-5LL*o.i*o.i)%M;\n\t\td=fpw(d,M-2);\n\t\tnum t((r*o.r-5LL*i*o.i)%M,(i*o.r-r*o.i)%M);\n\t\tt.r=t.r*d%M;\n\t\tt.i=t.i*d%M;\n\t\treturn t;\n\t}\n\tvoid mod()\n\t{r=(r%M+M)%M;i=(i%M+M)%M;}\n};\n\nnum fpw(num a,LL b)\n{\n\tnum s(1,0);\n\tfor(;b;b>>=1,a=a*a)\n\t\tif(b&1)s=s*a;\n\treturn s; \n}\n\nLL K,L,R;\nLL comb[205][205];\nLL work(int k)\n{\n\tnum a=num(1,1)/num(2,0),b=num(1,-1)/num(2,0),c0=fpw(num(1,0)/num(0,1),k);\n\tnum res(0,0),t,w;\n\tfor(int i=0;i<=k;i++)\n\t{\n\t\tt=num(comb[k][i],0);\n\t\tt=t*c0;\n\t\tw=fpw(a,i)*fpw(b,k-i);\n\t\tw.mod();\n\t\tnum t1=(fpw(w,R+1)-fpw(w,L));\n\t\tnum t2=(w-num(1,0));\n\t\tnum t3=t1/t2;\n\t\tif(w.r==1LL&&w.i==0LL)w=num((R-L+1)%M,0);\n\t\telse w=(fpw(w,R+1)-fpw(w,L))/(w-num(1,0));\n\t\tt=t*w;\n\t\tif(k-i&1)res=res-t;\n\t\telse res=res+t;\n\t}\n\treturn res.r;\n}\n\nvector xs,xs_;\n\nint main()\n{\n\t//freopen(\"a.in\",\"r\",stdin);\n\t//freopen(\"a.out\",\"w\",stdout);\n\tfor(int i=comb[0][0]=1;i<=200;i++)\n\t\tfor(int j=comb[i][0]=1;j<=i;j++)\n\t\t\tcomb[i][j]=(comb[i-1][j]+comb[i-1][j-1])%M;\n\tcin>>K>>L>>R;L+=2,R+=2;\n\tLL d=1;\n\tfor(int i=1;i<=K;i++)\n\t\td=d*fpw(LL(i),LL(M-2))%M;\n\txs.push_back(d);\n\tfor(int i=0;i\n#include \n\nusing namespace std;\n\nlong double pi = atan((long double)1)*4;\n\nclass Point\n{\npublic:\n\tlong double x;\n\tlong double y;\n\tPoint(long double xi, long double yi)\n\t{\t\n\t\tx=xi;\n\t\ty=yi;\n\t};\n\tPoint()\n\t{\n\t};\n};\n\nclass Segment\n{\npublic:\n\tPoint p1;\n\tPoint p2;\n\tSegment(Point p1i, Point p2i)\n\t{\n\t\tp1.x=p1i.x;\n\t\tp1.y=p1i.y;\n\t\tp2.x=p2i.x;\n\t\tp2.y=p2i.y;\n\t};\n\tlong double length() \n\t{ \n\t\treturn sqrt( (p1.x-p2.x)*(p1.x-p2.x) + (p1.y-p2.y)*(p1.y-p2.y) ); \n\t}\n};\n\nvoid pos_circle(Point p, long double v, long double t, Point* final_p)\n{\n\tlong double R = sqrt((long double)(p.x*p.x+p.y*p.y));\n\tlong double time_360 = 2*pi*R/v;\n\tlong double ini_angle = atan2((long double)p.y,(long double)p.x) *180 /pi;\n\tlong double final_angle = t*2*pi/time_360;\n\n\tfinal_p->x=cos(final_angle)*R;\n\tfinal_p->y=sin(final_angle)*R;\n}\n\nlong double distance_to_segment (Point p, Segment seg)\n{\n\tSegment a(seg.p1, p);\n\tSegment b(seg.p2, p);\n\tSegment* max;\n\tSegment* min;\n\tif(a.length() > b.length())\n\t{\n\t\tmax = &a;\n\t\tmin = &b;\n\t}\n\telse\n\t{\n\t\tmax = &b;\n\t\tmin = &a;\n\t}\n\n\tif(seg.length()==0 || min->length()==0)\n\t\treturn min->length();\n\n\tif ((min->length() * min->length() + seg.length() * seg.length() - max->length() * max->length()) / (2*min->length()*seg.length()) < 0)\n\t\treturn min->length();\n\t\n\tlong double s = (a.length() + b.length() + seg.length())/2;\n\treturn 2 * sqrt( s * ( s - a.length() ) * (s - b.length() ) * (s - seg.length() ) ) / seg.length();\n\t\n}\n\nvoid tangent_points_to_circle(Point center, long double R, Point p, Point* p1, Point* p2)\n{\n\tSegment s(center, p);\n\tif( s.length() <= R)\n\t\treturn;\n\telse\n\t{\n\t\tlong double ini_angle = atan2(p.y - center.y , p.x - center.x);\n\t\tlong double final_angle1 = ini_angle + acos(R/s.length()) ;\n\t\tlong double final_angle2 = ini_angle - acos(R/s.length()) ;\n\t\tp1->x=cos(final_angle1)*R + center.x;\n\t\tp1->y=sin(final_angle1)*R + center.y;\n\t\tp2->x=cos(final_angle2)*R + center.x;\n\t\tp2->y=sin(final_angle2)*R + center.y;\n\t}\n}\n\n\nint main()\n{\n\tcout.precision(20);\n\tint xp,yp,vp, xs,ys,V, R;\n\t\n\tcin >> xp;\n\tcin >> yp;\n\tcin >> vp;\n\tcin >> xs;\n\tcin >> ys;\n\tcin >> V;\n\tcin >> R;\n\n\tPoint ini_perse(xp,yp);\n\tPoint perse(0,0);\n\tPoint center(0,0);\n\tPoint ship(xs,ys);\n\tlong double time = 0;\n\tlong double time_ship = 0;\n\tlong double range_min,range_max;\n\n\tif(ini_perse.x == ship.x && ini_perse.y == ship.y)\n\t\tcout << time;\n\n\ttime = 100;\n\n\twhile(true)\n\t{\n\t\tpos_circle(ini_perse,vp,time,&perse);\n\t\tSegment s(perse, ship);\n\t\tlong double distance = distance_to_segment(center, s);\n\t\tif(distance >= R)\n\t\t\ttime_ship = s.length()/V;\n\t\telse\n\t\t{\n\t\t\tPoint ship_tang1, ship_tang2, perse_tang1, perse_tang2;\n\t\t\ttangent_points_to_circle(center, R, ship, &ship_tang1, &ship_tang2);\n\t\t\ttangent_points_to_circle(center, R, perse, &perse_tang1, &perse_tang2);\n\t\t\tSegment route1_ship(ship, ship_tang1);\n\t\t\tSegment route2_ship(ship, ship_tang2);\n\t\t\tSegment route1_perse(perse_tang2, perse);\n\t\t\tSegment route2_perse(perse_tang1, perse);\n\n\t\t\tlong double distance1 = route1_ship.length() + abs(atan2(ship_tang1.y, ship_tang1.x) - atan2(perse_tang2.y, perse_tang2.x))*2*R + route1_perse.length();\n\t\t\tlong double distance2 = route2_ship.length() + abs(atan2(ship_tang2.y, ship_tang2.x) - atan2(perse_tang1.y, perse_tang1.x))*2*R + route2_perse.length();\n\t\t\ttime_ship = min(distance1, distance2)/V; \n\t\t}\n\t\tif( time_ship < time )\n\t\t\tbreak;\n\t\telse\n\t\t\ttime *= 2;\n\t} \n\n\trange_max = time;\n\trange_min = 0 ; \n\n\n\twhile(true)\n\t{\n\t\ttime = (range_max + range_min ) / 2;\n\t\t//time = 9.584544103;\n\t\tpos_circle(ini_perse,vp,time,&perse);\n\t\tSegment s(perse, ship);\n\t\tlong double distance = distance_to_segment(center, s);\n\t\tif(distance >= R)\n\t\t\ttime_ship = s.length()/V;\n\t\telse\n\t\t{\n\t\t\tPoint ship_tang1, ship_tang2, perse_tang1, perse_tang2;\n\t\t\ttangent_points_to_circle(center, R, ship, &ship_tang1, &ship_tang2);\n\t\t\ttangent_points_to_circle(center, R, perse, &perse_tang1, &perse_tang2);\n\t\t\tSegment route1_ship(ship, ship_tang1);\n\t\t\tSegment route2_ship(ship, ship_tang2);\n\t\t\tSegment route1_perse(perse_tang2, perse);\n\t\t\tSegment route2_perse(perse_tang1, perse);\n\n\t\t\tlong double distance1 = route1_ship.length() + abs(atan2(ship_tang1.y, ship_tang1.x) - atan2(perse_tang2.y, perse_tang2.x))*R + route1_perse.length();\n\t\t\tlong double distance2 = route2_ship.length() + abs(atan2(ship_tang2.y, ship_tang2.x) - atan2(perse_tang1.y, perse_tang1.x))*R + route2_perse.length();\n\t\t\ttime_ship = min(distance1,distance2)/V; \n\t\t}\n\n\n\t\tif(abs(time-time_ship)<0.0000000001)\n\t\t\tbreak;\n\n\t\tif(time_ship < time)\n\t\t\trange_max = time;\n\t\telse\n\t\t\trange_min = time;\n\t}\n\tcout << time;\n\treturn 0;\n}\n\n\n", "lang": "MS C++", "bug_code_uid": "f4ab304bf5ab5643fc8bcfb24f4e248f", "src_uid": "e8471556906e5fa3a701842570fa4ee2", "apr_id": "477c013fd445211700888a071ed291e1", "difficulty": 2400, "tags": ["geometry", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.983716776972371, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n#define START clock_t _clock = clock();\n#define END cerr << endl << \"time: \" << (clock() - _clock) / LD(CLOCKS_PER_SEC) << endl;\ntypedef long double LD;\ntypedef long long LL;\n\nconst LD pi = acos(-1.0);\nconst LD eps = 1e-9;\nLD xp, yp, vp, xs, ys, v, r;\n\nLD sqr(LD x)\n{\n return x * x;\n}\n\nLD mmax(LD x, LD y)\n{\n return x > y ? x : y;\n}\n\nLD mmin(LD x, LD y)\n{\n return x < y ? x : y;\n}\n\nLD distance(LD x1, LD y1, LD x2, LD y2)\n{\n return sqrt( LD(sqr(x1 - x2) + sqr(y1 - y2)) );\n}\n\nLD cathetus(LD hyp, LD cath)\n{\n return sqrt(sqr(hyp) - sqr(cath));\n}\n\n// \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u043f\u043b\u0430\u043d\u0435\u0442\u0430 \u0438\u043c\u0435\u0435\u0442 \u0443\u0433\u043e\u043b atan(yp / xp)\n// \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 >= tm, \u043a\u043e\u0433\u0434\u0430 \u043f\u043b\u0430\u043d\u0435\u0442 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0443\u0433\u043e\u043b angle\nLD ptime(LD angle, LD tm)\n{\n // \u0440\u0430\u0434\u0438\u0443\u0441 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043f\u043b\u0430\u043d\u0435\u0442\u044b\n LD R = distance(xp, yp, 0, 0);\n // \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u0443\u0433\u043e\u043b \u043f\u043b\u0430\u043d\u0435\u0442\u044b\n LD pangle = atan2(yp, xp);\n if (pangle < 0)\n pangle += 2 * pi;\n // \u0432\u0440\u0435\u043c\u044f \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u043f\u043b\u0430\u043d\u0435\u0442\u043e\u0439 \u0443\u0433\u043b\u0430 angle\n LD res = ( angle + (angle < pangle ? 2 * pi : 0) - pangle) / vp * R;\n // \u0432\u0440\u0435\u043c\u044f \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043f\u043b\u0430\u043d\u0435\u0442\u044b\n LD ptm = 2 * pi * R / vp;\n\n res += floor((res - ptm) / ptm) * ptm;\n while (res < tm)\n res += ptm;\n\n return res;\n}\n\nLD time(LD angle)\n{\n // \u0440\u0430\u0434\u0438\u0443\u0441 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043f\u043b\u0430\u043d\u0435\u0442\u044b\n LD R = distance(xp, yp, 0, 0);\n // \u043c\u0435\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0438 \u043f\u043b\u0430\u043d\u0435\u0442\u044b \u0438 \u043a\u043e\u0440\u0430\u0431\u043b\u044f (D)\n LD xd = R * cos(angle);\n LD yd = R * sin(angle);\n\n/*------------- \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043b\u0438 \u043e\u0433\u0438\u0431\u0430\u0442\u044c \u0437\u0432\u0435\u0437\u0434\u0443 -----------------------------------*/\n bool intersect = false;\n\n // \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u044f\u043c\u043e\u0439\n LD A = ys - yd;\n LD B = xd - xs;\n LD C = xs * yd - xd * ys;\n // \u043a\u0432\u0430\u0434\u0440\u0430\u0442 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043e\u0442 \u0446\u0435\u043d\u0442\u0440\u0430 \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u0438 (0,0) \u0434\u043e \u043f\u0440\u044f\u043c\u043e\u0439 SD\n LD sdist = sqr(C) / (sqr(A) + sqr(B));\n\n // \u0435\u0441\u043b\u0438 \u043f\u0440\u044f\u043c\u0430\u044f \u0438 \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0442\u0441\u044f\n if (sdist <= sqr(r))\n {\n // \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0441\u0435\u0447\u0435\u043d\u0438\u044f\n LD a = 1 + sqr(A / B);\n LD b = 2 * A * C / sqr(B);\n LD c = sqr(C / B) - sqr(r);\n LD discr = sqr(b) - 4 * a * c;\n // \u0442\u043e\u0447\u043a\u0438 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f:\n LD x1 = (-b - sqrt(discr)) / (2 * a);\n LD x2 = (-b + sqrt(discr)) / (2 * a);\n // \u0435\u0441\u043b\u0438 \u043e\u0442\u0440\u0435\u0437\u043e\u043a \u0438 \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0442\u0441\u044f, \u0442\u043e \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043e\u0433\u0438\u0431\u0430\u0442\u044c \u0437\u0432\u0435\u0437\u0434\u0443\n if (min(xs, xd) <= x1 && x1 <= max(xs, xd) || min(xs, xd) <= x2 && x2 <= max(xs, xd))\n intersect = true;\n }\n/*-----------------------------------------------------------------------------*/\n\n LD dist; // \u0434\u043b\u0438\u043d\u0430 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430 \u0438\u0437 \u0442\u043e\u0447\u043a\u0438 S \u0432 \u0442\u043e\u0447\u043a\u0443 D\n if (intersect)\n {\n LD a = distance(xs, ys, 0, 0);\n LD b = cathetus(a, r); // \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0434\u043e \u0434\u0443\u0433\u0438\n\n LD c = distance(xd, yd, 0, 0);\n LD d = cathetus(c, r); // \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435 \u0434\u0443\u0433\u0438\n\n LD e = distance(xs, ys, xd, yd);\n LD alpha = acos( (sqr(c) + sqr(a) - sqr(e)) / (2 * c * a) );\n LD alpha1 = atan2(d, r);\n LD alpha2 = atan2(b, r);\n\n LD phi = alpha - alpha1 - alpha2;\n LD arc = phi * r; // \u0434\u043b\u0438\u043d\u0430 \u0434\u0443\u0433\u0438\n\n\n // \u0432\u0441\u0451 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435\n dist = b + arc + d;\n }\n else\n dist = distance(xs, ys, xd, yd);\n \n // \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u0438\u0431\u044b\u0442\u0438\u044f \u043a\u043e\u0440\u0430\u0431\u043b\u044f \u0432 \u0442\u043e\u0447\u043a\u0443 \u043d\u0430 \u043e\u0440\u0431\u0438\u0442\u0435 \u0441 \u0443\u0433\u043b\u043e\u043c angle:\n LD tm = dist / v;\n\n // \u0432\u0440\u0435\u043c\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043f\u0440\u0438\u0431\u044b\u0442\u0438\u044f \u043f\u043b\u0430\u043d\u0435\u0442\u044b \u0432 \u044d\u0442\u0443 \u0436\u0435 \u0442\u043e\u0447\u043a\u0443\n return ptime(angle, tm);\n}\n\nLD getminangle(LD left, LD right, LD step)\n{\n LD minangle = left,\n mintime = time(minangle);\n for (LD angle = left + step; angle < right; angle += step)\n {\n LD tm = time(angle);\n if (tm < mintime)\n mintime = tm,\n minangle = angle;\n }\n return minangle;\n}\n\nmain()\n{\n cin >> xp >> yp >> vp >> xs >> ys >> v >> r;\n\n const LD step = 0.00005;\n const LD u = 0.0008;\n const LD left = 0.0;\n const LD right = 2 * pi;\n\n // \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0443\u0433\u043e\u043b \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 time \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043d\u0430 \u0432\u0441\u0451\u043c \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0435 \u0443\u0433\u043b\u043e\u0432\n LD a = getminangle(left, right, step);\n // \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0432 \u043e\u043a\u0440\u0435\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u0443\u0433\u043b\u0430 a\n LD res = time(getminangle(mmax(left, a - u), mmin(right, a + u), eps));\n\n\n cout.setf(ios::fixed); cout.precision(8);\n\n cout << res << endl;\n}\n/*\n\n\u0418\u0434\u0435\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f:\n\n\u0412\u043e\u0437\u044c\u043c\u0451\u043c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u0443\u044e \u0442\u043e\u0447\u043a\u0443 \u043d\u0430 \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u0438 (D), \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043f\u043b\u0430\u043d\u0435\u0442\u0430.\n\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u0442 \u043c\u0435\u0441\u0442\u0430 \u0441\u0442\u0430\u0440\u0442\u0430 \u043a\u043e\u0440\u0430\u0431\u043b\u044f (S \u0434\u043e \u044d\u0442\u043e\u0439 \u0442\u043e\u0447\u043a\u0438.\n\u0415\u0441\u043b\u0438 \u043d\u0430 \u043f\u0443\u0442\u0438 \u0432\u0441\u0442\u0435\u0442\u0438\u0442\u0441\u044f \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0432\u0435\u0437\u0434\u044b, \u0442\u043e \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0433\u0438\u0431\u0430\u043d\u0438\u0435,\n\u0432 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u0441\u044f.\n\n\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0432\u0440\u0435\u043c\u044f (tm) \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438 \u043a\u043e\u0440\u0430\u0431\u043b\u044f \u043e\u0442 S \u0434\u043e D.\n\n\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c f(alpha) \u0431\u0443\u0434\u0435\u0442 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, \u0431\u043e\u043b\u044c\u0448\u0435\u0435 \u043b\u0438\u0431\u043e \u0440\u0430\u0432\u043d\u043e\u0435 tm, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u043b\u0430\u043d\u0435\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432 \u0442\u043e\u0447\u043a\u0435 D.\n\n\u041e\u0442\u0432\u0435\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 min(f(alpha)), \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0442\u0435\u0440\u043d\u0430\u0440\u043d\u044b\u043c \u043f\u043e\u0438\u0441\u043a\u043e\u043c. alpha \u0437\u0430\u0434\u0430\u0451\u0442 \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0442\u043e\u0447\u043a\u0438 D.\n\n*/", "lang": "GNU C++", "bug_code_uid": "8b6c6180cb0807b498bb4c31ad351ccf", "src_uid": "e8471556906e5fa3a701842570fa4ee2", "apr_id": "a2b2b2c6633f5b6ab000411c2539d347", "difficulty": 2400, "tags": ["geometry", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5204081632653061, "equal_cnt": 13, "replace_cnt": 12, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 13, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#define ll long long\ntypedef long double ld;\n#define stt string\n#define ve vector\n#define se set\n#include\n#include\n#define ar array\nusing namespace std;\n ll nn,m;\nll gcd(ll x, ll y)\n{\n if(y==0)\n return x;\n return gcd(y,x%y);\n}\nbool sum(int n)\n{\n unordered_map s;\n for (int i = 1; i * i <= n; ++i) {\n s[i * i] = 1;\n if (s.find(n - i * i) != s.end() && ( sqrt(n-i*i)<=nn && i<=nn))\n {\n\n return true;\n }\n }\n return false;\n}\n\nbool isP(long double x)\n{\n long double sr = sqrt(x);\n return ((sr - floor(sr)) == 0);\n}\nint main()\n{\n ios::sync_with_stdio(false);\n cin.tie(0);\n cout.tie(0);\n cin>>nn>>m;\n if(m==1)\n cout<\nusing namespace std;\n\nint main ()\n{\n int x, t, a, b, da, db;\n int ta, tb, dbtb;\n cin >> x >> t >> a >> b >> da >> db;\n int c = a + b - x;\n bool p = false;\n if (x == 0)\n p = true;\n else if (a == x || b == x)\n {\n p = true;\n }\n else if ((x - a) % da == 0)\n {\n ta = (x - a) / da;\n if (ta < t && ta >= 0)\n p = true;\n }\n else if ((x - b) % db == 0)\n {\n tb = (x - b) / tb;\n if (tb < t && tb >= 0)\n p = true;\n }\n else if (c == 0)\n p = true;\n else\n {\n for (ta = 0; ta < t; ta++)\n {\n dbtb = c - da * ta;\n if (dbtb == 0)\n {\n p = true;\n break;\n }\n if (dbtb % db == 0)\n {\n tb = dbtb / db;\n if (tb >= 0 && tb < t)\n {\n p = true;\n break;\n }\n }\n }\n }\n if (p)\n cout << \"YES\";\n else\n cout << \"NO\";\n //cin.get ();\n //cin.get ();\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "99719cf91081b188a0fafd7b7e9095c8", "src_uid": "f98168cdd72369303b82b5a7ac45c3af", "apr_id": "6c1d1706e42d261d31e988444a104829", "difficulty": 1200, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9601160261058739, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "#include\nusing namespace std;\n#define ull unsigned long long int\n#define ll long long int \n#define vi vector \n#define vvi vector>\n#define pll pair\n#define vl vector \n#define vvl vector>\n#define vpll vector>\n#define umap unordered_map\n#define uset unordered_set\n#define all(c) c.begin(), c.end()\n#define maxarr(A) *max_element(A, A+n) \n#define maxvec(v) *max_element(all(v)) \n#define present(map,elem) map.find(elem)!=map.end()\n#define lb(v,elem) lower_bound(all(v),elem)\n#define ub(v,elem) upper_bound(all(v),elem)\n#define pb push_back \n#define mp make_pair\n#define ff first \n#define ss second\n#define For(i,a,b) for(int i=a; i p1, pairp2){\n return p1.ff>p2.ff;\n}\n\nll binpow(ll a, ll b) {\n\tif (b == 0)\n\t\treturn 1;\n\tll res = binpow(a, b / 2);\n\tif (b % 2)\n\t\treturn res * res * a;\n\telse\n\t\treturn res * res;\n}\n\nconst int MAX = (int)1e3 + 5;\nvvi adj(MAX);\n\nint main() { \n ios_base::sync_with_stdio(false); \n cin.tie(NULL); \n cout.tie(NULL); \n //freopen(\"1.in\",\"r\",stdin);\n int t=1;\n //cin>>t;\n while(t--){\n \t int x1,y1;\n \t cin>>x1>>y1;\n \t // -10 5 \n \t // -5 10\n \t if(abs(x1)==abs(y1)){\n \t \tif(x1>0 && y1>0){\n \t \t\tcout<<0<<\" \"<<2*x1<<\" \"<<2*x1<<\" \"<<0;\n \t \t}else if(x1>0 && y1<0){\n \t \t\tcout<<0<<\" \"<<-2*x1<<\" \"<<2*x1<<\" \"<<0;\n \t \t}else if(x1<0 && y1>0){\n \t \t\tcout<<-2*x1<<\" \"<<0<<\" \"<<0<<\" \"<<2*x1;\n \t \t}else{\n \t \t\tcout<<0<<\" \"<<-2*x1<<\" \"<<-2*x1<<\" \"<<0;\n \t \t}\n \t }\n \t int x2=y1*(y1/abs(y1))*(x1/abs(x1)), y2=x1*(x1/abs(x1))*(y1/abs(y1));\n \t //cout<x4) cout<\n\nusing namespace std;\n\ntypedef long long ll;\n\nll cuadrados(int s)\n{\n\tif(s <= 0) return 1;\n\treturn cuadrados(s-1) + 2*(s+1) + 2*(s-1);\n}\n\nll triangulo(int l)\n{\n\tif(l < 0) return 0;\n\treturn max((ll)0 , (ll)l*l);\n}\nll triangulo(int n, int i, int d)\n{\n\tif(n < 0) return 0;\n\ti++; d++;\n\td = min(d,n);\n\ti = min(i,n);\n\treturn max((ll)0 , -(ll)n + (ll)n*(ll)d + (ll)n *(ll)i + ((ll)d + (ll)i - (ll)d*(ll)d - (ll)i*(ll)i)/(ll)2);\n}\n\n\nll cuadrados(int &s, int &x, int &y, int &n)\n{\n\treturn cuadrados(s) - triangulo(s-abs(n-y)) - triangulo(s-y) - triangulo(s-x, y, n-y) - triangulo(s-abs(n-x),y,n-1);\n}\n\nint main() {\n\t\n\tint n, x, y;\n\tll c;\n\tcin >> n >> x >> y >> c;\n\t\n\tx--; y--; n--;\n\t\n\tif(c <= 1)\n\t{\n\t\tcout << 0 << endl;\n\t\treturn 0;\n\t}\n\t\n\tint izq = 0;\n\tint der = (2*(n+1))+1;\n\tint mid;\n\t\n\twhile(izq != der)\n\t{\n\t\tmid = (izq + der+1)/2;\n\t\tif(cuadrados(mid, x, y, n) < c)\n\t\t{\n\t\t\tizq = mid;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tder = mid-1;\n\t\t}\n\t}\n\t\n\tcout << izq+1 << endl;\n\t\n\t\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "6732619ce6822ffdd9c52a47a215d7ad", "src_uid": "232c5206ee7c1903556c3625e0b0efc6", "apr_id": "ff1e7743ad2c90f6d2e298d6c8e858b5", "difficulty": 1800, "tags": ["math", "implementation", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5871886120996441, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "#include \nusing namespace std;\nint n,x,i,r=1,a[2179];\nint main(){\n\tcin>>n;\n\tfor(i=2,x=n;i*i<=n;i++)for(;x%i==0;a[i]++,x/=i);\n\tif(x)a[x]++;\n\tfor(i=2;i<2000;i++)if(a[i])r*=i;\n\tcout<\n#include\n#include\n#include\n#include\n#include\n#include\n//#include\n#define N 10000\nint a[N][N];\n#include\nusing namespace std;\nint dp(int n,int m)\n{\n\tif(n<=0||m<=0) return 0;\n\treturn max(dp(n-1,m-2)+1,dp(n-2,m-1)+1);\n} \nint main()\n{\n\tint ex,ne;\n\twhile(scanf(\"%d%d\",&ex,&ne)!=EOF)\n\t{\n\t\tint sum=0;\n\t\tsum=dp(ex,ne);\n\t\tprintf(\"%d\\n\",sum);\n\t}\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "f76e21fb802914a46136978b2f4928db", "src_uid": "0718c6afe52cd232a5e942052527f31b", "apr_id": "95460c50f1f74abc89f8440234fbebfe", "difficulty": 1300, "tags": ["number theory", "greedy", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.3464566929133858, "equal_cnt": 27, "replace_cnt": 18, "delete_cnt": 4, "insert_cnt": 4, "fix_ops_cnt": 26, "bug_source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n//ifstream cin(\"bigwaLL.in\");\n//ofstream cout(\"bigwaLL.out\");\ntypedef long long LL;\ntypedef long double LD;\nLD eps = 1e-9;\nconst LD INF = 1e18;\nint main()\n{\n LL a, b;\n queue > q;\n queue g;\n cin >> a >> b;\n q.push(make_pair(a, b));\n g.push(0);\n LL res = 0;\n while (!q.empty())\n {\n pair p = q.front();\n if (!p.first || !p.second)\n {\n res = max(res, g.front());\n g.pop();\n q.pop();\n continue;\n }\n q.push(make_pair(q.front().first - 2, q.front().second + 1));\n q.push(make_pair(q.front().first + 1, q.front().second - 2));\n q.pop();\n g.push(g.front() + 1);\n g.push(g.front() + 1);\n g.pop();\n }\n cout << res;\n return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "c6d2cb538166c858e8273e1d81f6ff69", "src_uid": "ba0f9f5f0ad4786b9274c829be587961", "apr_id": "82c4614ebff4182a967dc0a701ecf561", "difficulty": 1100, "tags": ["dp", "greedy", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.4004602991944764, "equal_cnt": 11, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 10, "bug_source_code": "#include \n#include \nusing namespace std;\n\nint main()\n{\n string s;\n int n;\n cin>>n;\n char ch;\n for(int i=1;i<=n;i++)\n {\n cin>>ch;\n s=s+ch;\n }\n cin>>s;\n int c=0;\n string sc;\n for(int i=0;i\nusing namespace std;\n#define ll long long \n#define ld long double \n#define pb push_back\n#define F first\n#define S second\n#define mp make_pair\n#define I insert\n \nll N=1e9+7;\n\nll power(ll a, ll b, ll mod){\n\tll x = 1, y = a;\n\twhile (b > 0){\n\t\tif (b%2){\n\t\t\tx = (x*y)%mod;\n\t\t}\n\t\ty = (y*y)%mod;\n\t\tb /= 2;\n\t}\n\treturn x%mod;\n}\t\n\nmap M;ll fib[105];\nvoid mpas(string s){\n ll a,b,c;string y;\n a=s.length();\n ll j=1;ll i,k;k=1;\n for(i=0;i>n>>x>>s;\n mpas(s);//map :: iterator it;for(it=M.begin();it!=M.end();it++)cout<<(*it).F<<\"-\"<<(*it).S<<\" \";\n for(i=0;i<105;i++)for(j=0;j<10005;j++)dp[i][j]=-1,st[i][j]=-1,en[i][j]=-1,ns[i][j]=-1;\n for(i=0;i<10005;i++)dp[0][i]=dp[1][i]=st[0][i]=en[1][i]=st[1][i]=en[0][i]=0,ns[0][i]=ns[1][i]=0;\n if(M.count(\"0\"))dp[0][M[\"0\"]]=1,st[0][M[\"0\"]]=1,en[0][M[\"0\"]]=1,ns[0][M[\"0\"]]=1;if(M.count(\"1\"))dp[1][M[\"1\"]]=1,st[1][M[\"1\"]]=1,en[1][M[\"1\"]]=1,ns[1][M[\"1\"]]=1;\n// cout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\n#define prec setprecision\n\ntypedef long long ll;\ntypedef unsigned long long llu;\ntemplate T gcd(T x, T y){ if(x0) { T f = x%y; x = y; y = f; } return x; }\nvoid exgcd(ll a, ll b, ll &d, ll &x, ll &y) {\n\tif (!b) {d = a; x = 1; y = 0;}\n\telse {exgcd(b, a % b, d, y, x); y -= x * (a / b);}\n}\n\nll inv(ll a, ll m) {\n\tll x, y, d; exgcd(a, m, d, x, y);\n\treturn d == 1 ? ((x%m) + m) % m : -1;\n}\n\n#ifndef ONLINE_JUDGE\n#define DEBUG 1\n#else\n#define DEBUG 0\n#endif\n\nll MOD = 1e9 + 7;\n\nint n, x;\nchar s[555];\nll pf2[555];\nll dp[555][555][555];\n\n// number of occurences of s[fr..to] within subsequences of F[k]\nll solve(int fr, int to, int k) {\n\tif(k==0) return fr == to && s[fr] == '0';\n\tif(k==1) return fr == to && s[fr] == '1';\n\tll& r = dp[fr][to][k];\n\tif(r>=0) return r;\n\tr = 0;\n\tr = (r + ((fr==0 ? pf2[k-1] : 1ll) * solve(fr, to, k-2) % MOD)) % MOD;\n\tr = (r + (solve(fr, to, k-1) * (to == n-1 ? pf2[k-2] : 1ll) % MOD)) % MOD;\n\tfor(int m=fr;m> n >> x >> s)\n\t#else\n\tcin >> n >> x >> s;\n\t#endif\n\t{\n\t\tpf2[0] = 2;\n\t\tpf2[1] = 2;\n\t\tfor(int i=2;i<=x;i++) pf2[i] = (pf2[i-1]*pf2[i-2])%MOD;\n\t\tmemset(dp, -1, sizeof(dp));\n\t\tcout << solve(0, n-1, x) << endl;\n\t}\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "c6de0d061ae32ab7575f764dfb6eeae9", "src_uid": "52c6aa73ff4460799402c646c6263630", "apr_id": "eda20002e62d92593cb8262a33d7adc1", "difficulty": 2400, "tags": ["matrices", "dp", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9282822440717178, "equal_cnt": 14, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 13, "bug_source_code": "#include \n\nusing namespace std;\n\nconst int MAX_INT=0x7fffffff;\n\ntypedef long long ll ;\ntypedef long double ld;\ntypedef pair pii;\ntypedef pair pll;\ntypedef pair pcl;\n\n#define fan(i,a,n) for(auto i=a; i=a; i--)\n#define rep(i,n) for(auto i=0; i=0; i--)\n#define fit(it,x) for(auto it=x.begin();it!=x.end();it++)\n#define all(a) a.begin(), a.end()\n#define mp make_pair\n#define pb push_back\n#define rs resize\n#define sz size\n#define ins insert\n#define ce cout << endl\n\n//#define dbg(x)\n//\n//vector> dfsv;\n//vector used;\n//void dfs(int n){\n// used[n]=true;\n// fit(it,dfsv[n]){\n// if(!used[*it])dfs(*it);\n// }\n//}\n\n//map chs;\n//ll fact (int n){\n// if(n==1)return 1;\n// return n*fact(n-1);\n//}\n//\n//ll kls(int c,map chs2){\n// ll sumd=0;\n// fit(it,chs2){\n// sumd+=fact(it->second);\n// }\n// return (fact(c)/sumd);\n//}\n//\n//ll rek(int siz,map mapa,int ind){\n// ll sum=0;\n// while(mapa[ind]>0){\n// //sum+=kls(siz,mapa);\n// rek(siz-1,mapa,mapa[ind])\n// mapa[ind]--;\n// }\n//}\n\nll n;\nbool chk(ll k){\n ll ans=n,sch=0;\n while(ans>0){\n ans-=k;\n sch+=k;\n ans-=(ans/10);\n if(sch>n/2){return true;}\n }\n}\n\nsigned main() {\n //ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);\n cin >> n;\n ll l=1,r=n,mid,ans;\n while(l<=r) {\n mid = (r + l) / 2;\n if (chk(mid)) {\n ans = min(ans, mid);\n r = mid-1;\n } else {\n l = mid+1;\n }\n }\n cout << ans;\n return 1;\n}", "lang": "GNU C++17", "bug_code_uid": "f8001c64dd732e3dbb02c13feeb628f1", "src_uid": "db1a50da538fa82038f8db6104d2ab93", "apr_id": "7e438acd95b0b4c40f7bed005c1c0058", "difficulty": 1500, "tags": ["implementation", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9308372334893396, "equal_cnt": 10, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 6, "fix_ops_cnt": 9, "bug_source_code": "#include \n\nusing namespace std;\n\nint main()\n{\n freopen(\"input.txt\",\"r\",stdin);\n freopen(\"output.txt\",\"w\",stdout);\n int t1,t2,h,m,s;\n cin >> h >> m >> s >> t1 >> t2;\n if (h == 12) h -= 12;\n vector v(43200,0);\n v[h*5] = 1;\n v[m] = 1;\n v[s] = 1;\n t1 *= 5; t2 *= 5;\n if (t1 > t2) swap(t1,t2);\n bool no_1 = false;\n for (int i = t1; i <= t2; ++i) {\n if (v[i]) {\n no_1 = true;\n break;\n }\n }\n //cout << no_1 << endl;\n bool no_2 = false;\n for (int i = 0; i <= t1; ++i) {\n if (v[i]) {\n no_2 = true;\n break;\n }\n }\n //cout << no_2 << endl;\n for (int i = t2; i < v.size(); ++i) {\n if (v[i]) {\n no_2 = true;\n break;\n }\n }\n cout << no_2 << endl;\n if (no_1 && no_2) cout << \"NO\";\n else cout << \"YES\";\n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "cf76be0e2f901146b1c82cb3b4395655", "src_uid": "912c8f557a976bdedda728ba9f916c95", "apr_id": "7bb67c2f438e05df75cb58c3c5545d2e", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9964601769911504, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include\n#define maxs 100000000\nusing namespace std;\nvector arr(10000,-1);\nvoid fact()\n{\n long long int i,j;\n for(i=2;i<=maxs;i++)\n {\n if(arr[i]==-1)\n {\n for(j=i;j<=maxs;j+=i)\n {\n if(arr[j]==-1)\n {\n arr[j]=i;\n }\n }\n\n }\n\n }\n}\nint main()\n{\n\n fact();\n arr[1]=1;\n long long int n;\n cin>>n;\n while(arr[n]!=1)\n {\n cout<\n#include \n#include \n#include \n#include \n#include \nusing namespace std;\ntypedef long long ll;\nconst int mx = 1e3+10;\nint n,m;\nint a[mx];\nint main (){\n\twhile(~scanf(\"%d%d\",&n,&m)){\n\t\tint ans = 0;\n\t\tfor(int i=0;i2*m){\n\t\t\tmaxx = (maxx-1)/2+1;\n\t\t\tans++;\n\t\t} \n\t\tcout << ans << endl;\n\t}\n\treturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "586415db6dae7ca4febe37d5ebb9d88d", "src_uid": "d5541028a2753c758322c440bdbf9ec6", "apr_id": "0d6c4fc0ee7ebdc58f2caf485a70d068", "difficulty": 1600, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9962097283638661, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "/* ****revpro**** */\n\n#include\n#define ll long long\n#define pb push_back\n#define endl\t '\\n'\n#define pii pair\n#define vi vector\n#define all(a) (a).begin(),(a).end()\n#define F first\n#define S second\n#define sz(x) (ll)x.size()\n#define hell 1000000007\n#define rep(i,a,b) for(ll i=a;i=a;i--) \n#define lbnd lower_bound\n#define ubnd upper_bound\n#define bs binary_search\n#define mp make_pair\n#define present(c,x) ((c).find(x) != (c).end())\n#define cpresent(c,x) (find(all(c),x) != (c).end())\n#define mii\t map\nusing namespace std;\n\n#define N 100005\nll add(ll x,ll y,ll mod=hell) { x += y; if(x >= mod) x -= mod; return x;}\nll sub(ll x,ll y,ll mod=hell) { x -= y; if(x < 0) x += mod; return x;}\nll mul(ll x,ll y,ll mod=hell) { return (x * 1ll * y) % mod;}\nint main()\n{\n\tios_base::sync_with_stdio(false);\n\tcin.tie(0);\n\tcout.tie(0);\n\tint TESTS=1;\n//\tcin>>TESTS;\n\twhile(TESTS--)\n\t{\n\t\tll n;\n\t\tcin>>n;\n\t\tll dp1[n+1]={0};\n\t\tll dp2[n+1]={0};\n\t\tdp1[0]=1;\n\t\tvector s;\n\t\ts.pb(1);\n\t\trep(i,1,2*n+1)\n\t\t{\n\t\t\trep(j,0,n+1) dp2[j]=0;\n\t\t\trep(j,0,n+1)\n\t\t\t{\n\t\t\t\tif(j)\n\t\t\t\t{\n\t\t\t\t\tdp2[j-1]=add(dp1[j],dp2[j-1]);\n\t\t\t\t\tif(j<=2*n-(i+1))\n\t\t\t\t\t\tdp2[j+1]=add(dp2[j+1],dp1[j]);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tdp2[1]=add(dp1[0],dp2[1]);\n\t\t\t}\n\t\t\tll sum=0;\n\t\t\trep(j,0,n+1)\n\t\t\t{\n\t\t\t\tsum+=dp2[j];\n\t\t\t\tswap(dp1[j],dp2[j]);\n\t\t\t}\n\t\t\ts.pb(sum);\n\t\t}\n\t\tll sum=0;\n\t\trep(i,1,2*n)\n\t\t{\n\t\t\tsum=add(sum,s[i]);\n\t\t\ti++;\n\t\t}\n\t\tcout<\n#include\n#include\n#include\n\nusing namespace std;\n\nconst int N=101;\nint n,k;\nint a[N];\nint zl[N];\nbool have[N];\nint tot=0,ans=0;\nint p[N],f;\n\nvoid pd() //\u867d\u7136\u6211\u4eec\u8bb0\u5f55\u4e86\u4ece\u4eca\u5929\u4e4b\u540e\u51fa\u73b0\u7684\u4e66\u7684\u60c5\u51b5 \n{ //\u4f46\u662f\u5982\u679c\u6709\u4e66\u5728\u4e4b\u540e\u90fd\u4e0d\u4f1a\u51fa\u73b0\uff0c\u6211\u4eec\u9009\u62e9\u6254ta\u80af\u5b9a\u66f4\u4f18 \n\tint i;\n\tfor (int i=1;i<=zl[0];i++)\n\t if (p[zl[i]]==0) \n\t {\n\t \tf=zl[i];\n\t \treturn;\n\t\t}\n\treturn;\n}\n\nint main()\n{\n\tmemset(have,0,sizeof(have));\n\tscanf(\"%d%d\",&n,&k);\n\tfor (int i=1;i<=n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t\tp[a[i]]++;\n\t\tif (p[a[i]]==1) zl[0]++,zl[zl[0]]=a[i]; //\u4e0d\u540c\u7684\u4e66\u7684\u79cd\u7c7b \n\t}\n\tfor (int i=1;i<=n;i++) //\u4ece1\u5230n\u626b\u4e00\u904d \n\t{\n\t\tif (have[a[i]]==0&&tot\n \nusing namespace std;\n \nconst int MOD=1e9+7;\n\n//const int MOD=998244353;\n\n\nint main() {\n ios_base::sync_with_stdio(0);\n cin.tie(0);\n \n int n;\n cin>>n;\n \n vector vs(n);\n for(auto &s:vs)cin>>s;\n \n queue> q;\n string s=\"\";\n for(int i=max(0,n-3); i=3 && (s[5]==vs[i-3][1]|| s[4]==vs[i-3][0])){\n string s2=\"\";\n s2+=s[4];\n s2+=s[5];\n s2+=vs[i-2];\n s2+=vs[i-1];\n q.push({i-1,s2});\n }\n if(s[sz-1]==vs[i-1][1] || s[sz-2]==vs[i-1][0]){\n string s2=\"\";\n s2+=s[4];\n s2+=s[5];\n for(int j=i+1; j\nusing namespace std;\nint main()\n{\n int i,j;\n string s[8];\n while(1){\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n cin>>s[i][j];\n }\n }\n int flag=0;\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n if((s[i][j]=='B' && s[i][j+1]=='B')||(s[i][j]=='W' && s[i][j+1]=='W'))\n flag=1;\n }\n }\n if(flag==1) cout<<\"NO\";\n else cout<<\"YES\";\n cout<<\"\\n\";\n }\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "dbdf5f1dd546fec01aff20b321f55b2b", "src_uid": "ca65e023be092b2ce25599f52acc1a67", "apr_id": "8e1493d849ed827164fa518a77edbeec", "difficulty": 1000, "tags": ["brute force", "strings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9745958429561201, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "#include \n#include \nusing namespace std;\n\nint main(){\n bool find=true;\n int count=0;\n char str[8];\n while(count<8){\n count++;\n scanf(\"%s\", str);\n for(int i=0; i<8; i+=2)\n {\n if(str[i]==str[i+1])\n {\n find=false;\n break;\n }\n }\n\n }\n if(find)cout << \"YES\";\n else cout << \"NO\";\n while(true);\n return 0;\n}", "lang": "GNU C++", "bug_code_uid": "3f2c35eebc6c258d537a04c4e19f1cf5", "src_uid": "ca65e023be092b2ce25599f52acc1a67", "apr_id": "72f295f7cd04ddd3e195d7ee0776a99a", "difficulty": 1000, "tags": ["brute force", "strings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9959183673469387, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 6, "bug_source_code": "#include \n\nusing namespace std;\n\nconst int limite=152;\n\ntypedef long long int lint;\n\nlint modulo=1000000007;\n\nlint cuantos[limite][limite][limite];\nlint cuantosle[limite][limite][limite];\nlint cuantosri[limite][limite][limite];\nlint cuantosleri[limite][limite][limite];\n\nlint suma[limite][limite][limite];\nlint sumale[limite][limite][limite];\nlint sumari[limite][limite][limite];\nlint sumaleri[limite][limite][limite];\n\nlint n,m;\n\nlint total=0;\n\nvoid computasuma(int i)\n{\n lint (&s)[limite][limite]=suma[i];\n lint (&sl)[limite][limite]=sumale[i];\n lint (&sr)[limite][limite]=sumari[i];\n lint (&slr)[limite][limite]=sumaleri[i];\n for (int j=1;j<=m;j++) {\n for (int k=1;k<=m;k++) {\n s[j][k]=(cuantos[j][k]+s[j-1][k]+s[j][k-1]-s[j-1][k-1])%modulo;\n sl[j][k]=(cuantosle[j][k]+sl[j-1][k]+sl[j][k-1]-sl[j-1][k-1])%modulo;\n sr[j][k]=(cuantosri[j][k]+sr[j-1][k]+sr[j][k-1]-sr[j-1][k-1])%modulo;\n slr[j][k]=(cuantosleri[j][k]+slr[j-1][k]+slr[j][k-1]-slr[j-1][k-1])%modulo;\n }\n }\n total=(total+(s[m][m]+sl[m][m]+sr[m][m]+slr[m][m])*(n-i))%modulo;\n}\n\n\nint main()\n{\n cin>>n>>m;\n for (int j=1;j<=m;j++)\n for (int k=j;k<=m;k++)\n cuantos[0][j][k]=1;\n computasuma(0);\n for (int i=1;i\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\n#define INF 99999999\n#define max(a,b) (a > b ? a : b)\n#define min(a,b) (a < b ? a : b)\nconst int nMax = 1e5;\nint a[nMax];\nint mark[11];\nint main()\n{\n int n,k;\n scanf(\"%d%d\",&n,&k);\n for(int i = 0;i < n;i++)\n scanf(\"%d\",&a[i]);\n int ans = 0;\n for(int i = 0;i < n;i++){\n memset(mark,0,sizeof(mark));\n while(a[i]){\n int temp = a[i]%10;\n a[i]/=10;\n mark[temp]++;\n }\n int countnum = 0;\n for(int j = 0;j <= k;j++)\n if( mark[j] != 0 )\n countnum++;\n if( countnum == k+1 )\n ans++;\n }\n cout<\n#include\n#include\nusing namespace std;\nint const nMax = 1e5+100;\nint a[nMax];\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n for(int i = 0;i < n;i++)\n scanf(\"%d\",&a[i]);\n if( n <= 2 ){\n cout<\n#include\n#include\n#include\n#include\nusing namespace std;\nconst int nMax = 50000;\nconst int INF = 1e9+1;\nstring ss;\nlong long ans,x,n,a[nMax],s[nMax],h[nMax];\nint main()\n{\n cin>>x>>ss;\n n = ss.length();\n for(int i = 0;i < n;i++){\n a[i+1] = ss[i]-'0';\n s[i+1] = s[i] + a[i+1];\n }\n for(int i = 1;i <= n;i++)\n for(int j = 0;j < i;j++)\n h[s[i]-s[j]]++;\n if( x==0 )\n for(int i = 0;i <= s[n];i++)\n ans+=h[0]*h[i];\n for(int i = 1;i <= s[n];i++)\n if( (x%i == 0) && (x/i <= s[n]) )\n ans+=h[i]*h[x/i];\n cout<< ans <\n#include\n#include\nusing namespace std;\nint dp[500010];\nint c[100];\nint main()\n{\n int n,d;\n scanf(\"%d%d\",&n,&d);\n memset(dp,0,sizeof(dp));\n for(int i = 1;i <= n;i++)\n scanf(\"%d\",&c[i]);\n dp[0] = 1;\n for(int i = 1;i <= n;i++){\n for(int j = 500000-c[i];j >= 0;j--){\n if( dp[j] )\n dp[j+c[i]] = 1;\n }\n }\n int mas = 0;\n int day = 0;\n while(1){\n int x = mas+d;\n while( x != mas && !dp[x] ) x--;\n if( x == mas ){\n printf(\"%d %d\\n\",mas,day);\n break;\n }\n mas = x;\n day++;\n }\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "f31de6a864e5a9e620f042f986628976", "src_uid": "65699ddec8d0db2f58b83a0f64de6f6f", "apr_id": "7d5375fcb8384a7f33e339640e33d40f", "difficulty": 2200, "tags": ["dp", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.12410256410256411, "equal_cnt": 18, "replace_cnt": 11, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 18, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n\nusing namespace std;\n\n#define FOR(i, a, b) for(i=(a);i<=(b);i++)\n#define FORR(i, a, b) for(i=(a);i>=(b);i--)\n#define S(n) scanf(\"%d\", &n)\n#define P(n) printf(\" %d\", n)\n#define pb push_back\n#define mp make_pair\n#define ll long long\n\nll dp(int l, int r){\n if(r < l) return 0;\n if(l<10 && r>=10) return (10-l) + dp(10, r);\n if(l<10 && r<10) return r-l+1;\n ll t1, t2, ans;\n if(l == r){\n t1 = l%10;\n t2 = l;\n while(t2>=10){\n t2 = (t2-(t2%10))/10;\n }\n if(t1 == t2)\n return 1;\n else return 0;\n }\n t1 = l%10;\n t2 = l;\n while(t2>=10){\n t2 = (t2-(t2%10))/10; }\n if(t1 == t2) return 1+dp(l+1, r);\n else return dp(l+1, r);\n \n}\n\nint main(){\n ll l, r;\n cin>>l>>r;\n cout<\n#include \n#include \nusing namespace std;\nstring op;\nbool F[400][400];\nint dir[4][2] = { 1,0,0,1,-1,0,0,-1 };\nint main() {\n\tint x = 200, y = 200;\n\tF[x][y] = true;\n\tcin >> op;\n\tfor (int i = 0; i < op.size(); i++) {\n\t\tswitch (op[i]) {\n\t\tcase 'L': y--;\n\t\t\tbreak;\n\t\tcase 'R': y++;\n\t\t\tbreak;\n\t\tcase 'U': x--;\n\t\t\tbreak;\n\t\tcase 'D': x++;\n\t\t}\n\t\tF[x][y] = true;\n\t\tint cnt = 0;\n\t\tfor (int i = 0; i < 4; i++) {\n\t\t\tif (F[x + dir[i][0]][y + dir[i][1]]) cnt++;\n\t\t}\n\t\tif (cnt >= 2) {\n\t\t\tprintf(\"BUG\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"OK\\n\");\n\treturn 0;\n}", "lang": "MS C++", "bug_code_uid": "7781e534087d0b14dc0ff4fa8dd1d816", "src_uid": "bb7805cc9d1cc907b64371b209c564b3", "apr_id": "fc7386e2cab676eb508edbe36cd735d3", "difficulty": 1400, "tags": ["graphs", "constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.6655830963023162, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include \n\nusing namespace std;\nbool e[200];\nint main() {\n ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);\n int n,mx=0,mn=200,c=0;\n char a;\n cin>>n;\n for(int i=0;i>a;\n if(a=='*'){\n e[i+1]=true;\n mx=max(mx,i+1);\n mn=min(mn,i+1);}\n }\n for(int i=mn;i<=mx;i++){\n if(e[i]){\n int k=mx-i/4;\n for(int y=1;y<=k;y++){\n for(int j=1;j<5;j++){\n if(e[i+y*j])\n c++;\n else\n break;\n // cout<\n\nusing namespace std;\nbool e[200];\nint main() {\n ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);\n int n,mx=0,mn=200,c=0;\n char a;\n cin>>n;\n for(int i=0;i>a;\n if(a=='*'){\n e[i+1]=true;\n mx=max(mx,i+1);\n mn=min(mn,i+1);}\n }\n for(int i=mn;i<=mx;i++){\n if(e[i]){\n int k=mx-i/4;\n for(int y=1;y<=k;y++){\n for(int j=1;j<5;j++){\n if(e[i+y*j])\n c++;\n else\n break;\n // cout<\n#include \nusing namespace std;\nint main()\n{\n long m, n, a;\n cin >> m;\n cin >> n;\n cin >> a;\n a = ceil(m / a)*ceil(n / a);\n return a;\n}", "lang": "GNU C++", "bug_code_uid": "114bccfa2d8543f9b325b0762e21d6fd", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "522b4efb4b1f4258f053018864015a69", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9962732919254659, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include\n#include\n#include\nusing namespace std;\nint n;\nchar a[10][30];\n/*\nvoid dfs(int x,int y,int s)\n{\n\tif(s==n) \n\treturn ;\n\tif(x<0 || x>=4)\n\treturn ;\n\t\n\tif(x>=0 && x<=3 && a[x][y]=='#')\n\ta[x][y]='O';\n\t\n\tif( x+1<=3 && a[x+1][y]=='#')\n\t{\n\t\t//a[x][y]=='O';\n\t\tdfs(x+1,y,s+1);\n\t}\n\t\n\telse if( x==3 && a[0][y+2]=='#')\n\t{\n\t\t//a[x][y]=='O';\n\t\tdfs(0,y+2,s+1);\n\t}\n\t else if(x==2 && y!=1 && a[x+1][y]=='#')\n\t {\n\t \tdfs(x+1,y,s+1);\n\t }\n\telse dfs(x+1,y,s);\n\treturn;\n}\n\n\n*/\n\nint main()\n{\n\twhile(1)\n\t{\n\t\n\tcin>>n;\n\tint i,j;\n\tfor(i=0;i<4;i++)\n\t{\n\t\tfor(j=0;j<27;j++)\n\t\t{\n\t\t\tif(j%2!=0 && i!=2 && j<=21)\n\t\t\ta[i][j]='#';\n\t\t\telse \n\t\t\ta[i][j]='.';\n\t\t}\n\n\t}\n\t\n\tfor(i=0;i<4;i++)\n\t{\n\t\ta[i][0]='|';\n\t\ta[i][25]='|';\n\t}\n\ta[2][1]='#';\n\ta[0][23]=a[1][23]=a[3][23]='|';\n\ta[0][24]='D';\n\ta[0][26]=a[3][26]=')';\n\ta[1][26]=a[2][26]='\\0';\t\n\tprintf(\"+------------------------+\\n\");\n\t\n\t\n\t//dfs(0,1,0);\n\t\n\tint s=0;\n\tfor(j=1;j<=27;j++)\n\t{\n\t\tif(s==n) break;\n\t\tfor(i=0;i<4;i++)\n\t\t{\n\t\t if(s==n) break;\n\t\t\tif(a[i][j]=='#')\n\t\t\t{\n\t\t\t\ta[i][j]='O';\n\t\t\t\ts++;\n\t\t\t}\t\n\t\t}\n\t}\n\t\n\t\n\tfor(i=0;i<4;i++)\n\t{\n\t\t//for(j=0;j<27;j++)\n\t\t{\n\t\t\tcout<\n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\nint main() {\n int n;\n cin >> n;\n n++;\n int cnt_to = 0;\n \n while (1){\n\tint i = n;\n\tint cnt = 0;\n \n while (i != 0){\n \tif (i % 10 != 0) cnt++;\n \ti = i / 10;\n\t}\n\tcnt_to++;\n\tif (cnt <= 1) break;\n\t\n\tn++;\n\t}\n\t\n\tcout << cnt_to;\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "59b4f521dc539147230f872bcc1b3f53", "src_uid": "a3e15c0632e240a0ef6fe43a5ab3cc3e", "apr_id": "8b46d9399be62cf93e78239848f61eb3", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.2614742698191933, "equal_cnt": 22, "replace_cnt": 15, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 22, "bug_source_code": "#include \n#include \nusing namespace std;\n\nint main()\n{\n int i,j,k,c=-1;\n string s,t;\n cin>>s;\n k=s.size();\n//1st condition:\n\n if((s[0]>='A')&&(s[0]<='Z'))\n {\n for(j=0;j='A')&&(s[j]<='Z'))\n {\n c=1;\n }\n else\n {\n c=-1;\n break;\n }\n }\n }\n else\n {\n if(k==1)\n {\n c=0;\n }\n else\n { for(j=1;j='a')&&(s[j]<='z'))\n {\n c=-1;\n }\n else\n { for(i=1;i='A')&&(s[i]<='Z'))\n {\n c=2;\n }\n else\n {\n c=-1;\n break;\n }\n }\n }\n }\n }\n\n\n}\n\n if(c==1)\n {\n for(i=0;i\nusing namespace std;\nint main(){\n\tint n;\n\tstring s;\n\tcin>>n>>s;\n\tfor (int i=0;is[i+1]){\n\t\t\tfor (int p=i;p\nusing namespace std;\nconst int N=1e3+10;\nconst int mod=1e9+7;\nint k,pa,pb,f[N][N];\nint qpow(int a,int b) {\n int ret=1;\n while(b) {\n if(b&1) ret=1ll*ret*a%mod; a=1ll*a*a%mod; b>>=1;\n }\n return ret;\n}\nint dfs(int i,int j) {\n if(i+j>=k) return ((i+j)%mod+1ll*pa*qpow(pb,mod-2)%mod)%mod;\n if(f[i][j]!=-1) return f[i][j];\n return 1ll*pa*qpow((pa+pb)%mod,mod-2)%mod*dfs(i+1,j)%mod+1ll*pb*qpow((pa+pb)%mod,mod-2)%mod*dfs(i,i+j)%mod;\n}\nint main() {\n cin>>k>>pa>>pb;\n memset(f,-1,sizeof(f));\n printf(\"%d\\n\",dfs(1,0));\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "7bdca8a03dc3e9a1a41bad03f5691377", "src_uid": "0dc9f5d75143a2bc744480de859188b4", "apr_id": "13f7519f38c0abada569d6897af75e27", "difficulty": 2200, "tags": ["dp", "math", "probabilities"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.6354119253527537, "equal_cnt": 10, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "#include \n// #pragma GCC optimize (\"O3\")\n// #pragma GCC target (\"sse4\")\n\nusing namespace std;\n\n#define li long long int\n#define ld double_t\n#define mod (li)(1e9+7)\nconst int MX1=1e3+5;\nconst int MX2=1e6+5;\nconst li inf=1e18;\n\nli power(li a,li b){li res=1;while(b){if(b%2)res=(res*a)%mod;\na=(a*a)%mod;b/=2;}return res;}\n\nli mmi(li a){return power(a,mod-2);}\n\nli cntbit(li n){li cnt=0;while(n){n&=(n-1);cnt++;}return cnt;}\n\nint n,a,b;\nvector v;\n\nint chk(int x){\n\tif(x==1) swap(a,b);\n\tint cnt=1;\n\tint m=a*4;\n\tif(x==1) m=2*a;\n\tint t=n;\n\tv.clear();\n\twhile(m){\n\t\tif(n-a>=0){\n\t\t\tm-=a;\n\t\t\tn-=a;\n\t\t}else{\n\t\t\tv.push_back(n);\n\t\t\tn=t;\n\t\t\tcnt++;\n\t\t}\n\t}\n\tif(n=0){\n\t\t\tv[i]-=b;\n\t\t\tm-=b;\n\t\t}else if(i<(int)v.size()){\n\t\t\ti++;\n\t\t}else{\n\t\t\tif(n-b>=0){\n\t\t\t\tok=1;\n\t\t\t\tn-=b;\n\t\t\t\tm-=b;\n\t\t\t}else{\n\t\t\t\tn=t;\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t}\n\tif(ok) cnt++;\n\treturn cnt;\n}\n\nvoid solve(){\n\tcin>>n>>a>>b;\n\tcout<>t;\n\twhile(t--){\n\t\tsolve();\n\t}\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "1296aea834f0e62f00a89eca784495c3", "src_uid": "1a50fe39e18f86adac790093e195979a", "apr_id": "3dba69f0bc1ff355d9e243e75e245bb5", "difficulty": 1600, "tags": ["greedy", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.4707429322813938, "equal_cnt": 19, "replace_cnt": 12, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 19, "bug_source_code": "#include\n#define rec(i,a,b) for(int i=a; i<=b; i++)\nusing namespace std;\nint solve()\n{\n int l,r,a;\n cin>>l>>r>>a;\n if((l==0 || r==0) && a==0 )\n return 0;\n while(1)\n { if(l\nusing namespace std;\nunsigned long long f(unsigned long long a, unsigned long long b){\n\tif(a==0) return 0;\n\tif(a>a>>b;\n\tcout<>a>>b;\n//primero verificamos que el numero sea entero\n\tif(a%b==0){ cout<\n\nusing namespace std;\n\nstring s, t;\nvector< pair > a, b;\nvector< pair > bleach;\nvector< pair > ta, tb;\nbool flag = false;\n\nvoid add(vector< pair > &tren, pair s) {\n if (!tren.empty() && tren.back().first == s.first) tren.back().second += s.second;\n else tren.push_back(s);\n}\n\ninline void addchar(vector< pair > &tren, char s) {\n add(tren, make_pair(s, 1));\n}\n\nint pop(vector< pair > &tren, int kol) {\n int sol = 0;\n for (int i = 0; i < kol; i++) {\n sol += tren.back().second;\n tren.pop_back();\n }\n return sol;\n}\n\nvoid query(int acx, int acy) {\n //printf(\"query: %d %d\\n\", acx, acy);\n if (flag) swap(acx, acy);\n ta.clear(); tb.clear();\n for (int i = 0; i < acx; i++) ta.push_back(a[i]);\n for (int i = 0; i < acy; i++) tb.push_back(b[i]);\n int kolx = pop(a, acx);\n int koly = pop(b, acy);\n\n for (int i = 0; i < acx; i++) add(b, ta[ta.size() - 1 - i]);\n for (int i = 0; i < acy; i++) add(a, tb[tb.size() - 1 - i]);\n bleach.push_back(make_pair(kolx, koly));\n}\n\nint main() {\n ios_base::sync_with_stdio(false);\n cin.tie(0);\n cin >> s >> t;\n\n reverse(s.begin(), s.end());\n reverse(t.begin(), t.end());\n for (int i = 0; i < s.size(); i++) addchar(a, s[i]);\n for (int i = 0; i < t.size(); i++) addchar(b, t[i]);\n\n while (a.size() != 1 || b.size() != 1) {\n int la = a.size();\n int lb = b.size();\n\n if (la < lb) {\n swap(la, lb);\n flag = true;\n }\n const char kuraca = a.back().first;\n const char kuracb = b.back().first;\n\n //printf(\"%d %d -> %c %c\\n\", la, lb, kuraca, kuracb);\n if (kuraca != kuracb) {\n if (lb <= 2) {\n if (la <= 3) query(1, 1);\n else query(3, 1);\n } else query(1, 1);\n } else {\n if (lb == 1) {\n if (la <= 3) query(1, 0);\n else query(3, 0);\n } else if (lb == 2) {\n if (la == 2) query(1, 0);\n else query(2, 1);\n } else query(3, 2);\n }\n flag = false;\n }\n\n printf(\"%d\\n\", bleach.size());\n for (int i = 0; i < bleach.size(); i++)\n printf(\"%d %d\\n\", bleach[i].first, bleach[i].second);\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "4c0e1152e2f516aabc30ca8474714438", "src_uid": "4a50c4147becea13946272230f3dde6d", "apr_id": "547af48f6983660e4e582c2710394441", "difficulty": 2800, "tags": ["constructive algorithms", "strings"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.18988853503184713, "equal_cnt": 31, "replace_cnt": 27, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 31, "bug_source_code": "\n #include \nusing namespace std;\nconst long long MAX=2e9, N=5e3+10, MOD = 1e9+7;\n#define ll long long\n#define pi pair\n#define ft first\n#define sd second\n#define mp make_pair\n#define pb push_back\n\n#define VI vector\n#define VPI vector\n#define VL vector\n#define int ll\n#define PI 3.14159265\n#define sz(a) (int)(a.size())\nstring s, t;\n\nVI zmiany(string a, char c)\n{\n VI q;\n char l=c;\n for(int i=sz(a)-1;i>=0;i--)\n {\n if(a[i]!=l)\n {\n l=a[i];\n q.pb(i+1);\n }\n }\n return q;\n}\n\nVPI solv(string a, string b)\n{\n VI p =zmiany(a, 'a');\n VI q =zmiany(b, 'b');\n while(sz(p) < sz(q))\n p.pb(0);\n while(sz(q) < sz(p))\n q.pb(0);\n VPI res;\n for(int i=0;i>s>>t;\n VPI res1=solve(s, t);\n VPI res2=solve(t, s);\n cout<\nusing namespace std;\ntypedef long long ll;\nconst int inf=0x3f3f3f3f;\nconst ll linf=0x3f3f3f3f3f3f3f3f;\nconst int maxn=3e3+10;\nconst ll mod=1e9+7;\nint n,m,ta[maxn],tb[maxn],sz[maxn];\nvectorv[maxn];\nstruct DP\n{\n int a=0;\n ll b=-linf;\n}dp[maxn][maxn];\nbool operator<(DP a,DP b)\n{\n if(a.a!=b.a)return a.a0),0};\n//\n// cout<0));\n }\n return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "96852db64f05827b64bf43f1a8757bf1", "src_uid": "d2d1d8c8532b652f172e87a151adae4f", "apr_id": "9e4135b2cae67a46f7a667c458f88dfc", "difficulty": 2500, "tags": ["trees", "dp", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8044588945657223, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#include \nusing namespace std;\n\n\n\n/*\nnow we have 7 days with no. of pages I read everyday and total no. of pages in the book\n if pages are divisible by the weekly sums than divide the total pages with sum of the weekly pages and \nand then minus the 1 week and check for the day on which it finished\n else in the other cases there is chance of doing it simple by checking by firstly doing \n*/\nvoid solve()\n{ \n int pages; cin>>pages;\n int arr[7];\n int sum = 0;\n for(int i = 0; i < 7; ++i){\n cin>>arr[i];\n sum += arr[i];\n }\n int weekly = pages / sum;\n\n if ( pages % sum == 0){\n pages -= weekly;\n }else{\n pages = pages % weekly;\n }\n for(int i = 0; i < 7; ++i){\n if (pages <= arr[i]){\n cout<\n\nusing namespace std;\n\nvector v;\nlong long l[40000000];\nint main()\n{\n int a,b,c,s=0,d;\n cin>>a>>b>>c;\n for (int i=1;i<=a;i++){\n for (int j=1;j<=b;j++){\n for (int k=1;k<=c;k++){\n v.push_back(i*j*k);\n }\n }\n }\n bool o;\n for (int u=0;u\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 TRACE(x) cout << #x << \" = \" << x << \"\\n\"\n#define _ << \" _ \" <<\n#define ll long long\n\nusing namespace std;\n\nll sol(ll x) {\n ll out = x;\n while (x > 0) {\n out -= x % 10;\n x /= 10;\n }\n return out;\n}\n\nint main() {\n ios_base::sync_with_stdio(false);\n\n ll n, s;\n cin >> n >> s;\n ll lo = 1, hi = n;\n while (lo < hi) {\n ll mi = lo + (hi - lo) / 2;\n if (sol(mi) < s) {\n lo = mi + 1;\n } else {\n hi = mi;\n }\n }\n if (lo > n + 1) cout << 0 << endl;\n else cout << n - lo + 1 << endl;\n\n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "527635b3e2baf18c2ce554aa1c89b974", "src_uid": "9704e2ac6a158d5ced8fd1dc1edb356b", "apr_id": "f6e46c9bc2b50b78ccd1fdfae3a4a517", "difficulty": 1600, "tags": ["dp", "math", "brute force", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.751863684771033, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "#include \n\nusing namespace std;\n\nvector primef(vector Array, int n){\n int i = 2;\n while (n != 1){\n if (n % i==0){\n Array.push_back(i);\n n/=i;\n }\n else{\n i++;\n }\n }\n return Array;\n}\n\nint main()\n{\n int a,b;\n vector m;\n m = primef(m, b);\n cout<;\nusing pll = pair;\nusing vi = vector;\nusing vl = vector;\nusing vvi = vector;\nusing vvl = vector;\nconst ll inf = 1LL << 60;\nconst ll MOD = 1000000007;\ntemplate \nbool chmax(T &a, const T &b) {\n return (a < b) ? (a = b, 1) : 0;\n}\ntemplate \nbool chmin(T &a, const T &b) {\n return (b < a) ? (a = b, 1) : 0;\n}\n\nstruct segtree {\n ll H, W;\n vector> dat;\n segtree() {}\n segtree(vector> &f) {\n H = W = 1;\n while (H < (ll)f.size())\n H <<= 1;\n while (W < (ll)f[0].size())\n W <<= 1;\n dat.assign(2 * H - 1, vector(2 * W - 1, inf));\n init(f);\n }\n void init(vector> &f) {\n for (ll i = 0; i < (ll)f.size(); i++)\n for (ll j = 0; j < (ll)f[0].size(); j++)\n dat[i + H - 1][j + W - 1] = f[i][j];\n for (ll i = 2 * H - 2; i > H - 2; i--)\n for (ll j = W - 2; j >= 0; j--)\n dat[i][j] = min(dat[i][2 * j + 1], dat[i][2 * j + 2]);\n for (ll i = H - 2; i >= 0; i--)\n for (ll j = 0; j < 2 * W - 1; j++)\n dat[i][j] = min(dat[2 * i + 1][j], dat[2 * i + 2][j]);\n }\n ll minimum(ll li, ll lj, ll ri, ll rj) { return minimum_h(li, lj, ri, rj, 0, H, 0); }\n ll minimum_h(ll li, ll lj, ll ri, ll rj, ll si, ll ti, ll k) {\n if (ri <= si or ti <= li)\n return inf;\n if (li <= si and ti <= ri)\n return minimum_w(lj, rj, 0, W, k, 0);\n const ll mi = (si + ti) / 2;\n return min(minimum_h(li, lj, ri, rj, si, mi, 2 * k + 1), minimum_h(li, lj, ri, rj, mi, ti, 2 * k + 2));\n }\n ll minimum_w(ll lj, ll rj, ll sj, ll tj, ll i, ll k) {\n if (rj <= sj or tj <= lj)\n return inf;\n if (lj <= sj and tj <= rj)\n return dat[i][k];\n const ll mj = (sj + tj) / 2;\n return min(minimum_w(lj, rj, sj, mj, i, 2 * k + 1), minimum_w(lj, rj, mj, tj, i, 2 * k + 2));\n }\n};\nint main() {\n int n, m, a, b;\n cin >> n >> m >> a >> b;\n ll g, x, y, z;\n cin >> g >> x >> y >> z;\n vvl h(n, vl(m));\n\n for (int i = 0; i < n; ++i) {\n for (int j = 0; j < m; ++j) {\n if (i == 0 && j == 0)\n h[i][j] = g;\n else {\n g = (g * x + y) % z;\n h[i][j] = g;\n }\n }\n }\n segtree tr(h);\n ll ret = 0;\n for (int i = 0; i <= n - a; ++i) {\n for (int j = 0; j <= m - b; ++j) {\n ret += tr.minimum(i, j, i + a, j + b);\n }\n }\n cout << ret << \"\\n\";\n\n return 0;\n}", "lang": "GNU C++14", "bug_code_uid": "37176b1bae478ca05bb199cbef941be8", "src_uid": "4618fbffb2b9d321a6d22c11590a4773", "apr_id": "2957ca5c073c77333b37b98428c3c0db", "difficulty": 2100, "tags": ["data structures", "two pointers"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.6895161290322581, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#include \n#include \n#include \n#include \n\nusing namespace std;\n\nlong long turn(int n)\n{\n if (n == 0)\n {\n return 1;\n }\n else\n {\n return turn(n - 1) + 6 * n;\n }\n}\n\nint main()\n{\n int n;\n cin >> n;\n cout << turn(n);\n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "0a8e4819814db86850a52e6ad02127fe", "src_uid": "c046895a90f2e1381a7c1867020453bd", "apr_id": "15c0e4864a9f4df8638cb29b4ce011c9", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.992503748125937, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "#include \nusing namespace std;\n\n#define st first\n#define nd second\n#define mp make_pair\n#define pb push_back\n#define cl(x, v) memset((x), (v), sizeof(x))\n#define gcd(x,y) __gcd((x),(y))\n\n#ifndef ONLINE_JUDGE\n #define db(x) cerr << #x << \" == \" << x << endl\n #define dbs(x) cerr << x << endl\n #define _ << \", \" <<\n#else\n #define db(x) ((void)0)\n #define dbs(x) ((void)0)\n#endif\n\ntypedef long long ll;\ntypedef long double ld;\n\ntypedef pair pii;\ntypedef pair piii;\ntypedef pair pll;\ntypedef vector vi;\n\nconst ld EPS = 1e-9, PI = acos(-1.);\nconst int INF = 0x3f3f3f3f, MOD = 1e9+7;\nconst int N = 1e5+5;\n\nvector to_base(ll v, ll b) {\n vector ret;\n while (v) {\n ll r = v%b;\n v /= b;\n if (r < 0) r -= b, v++;\n ret.push_back(r);\n }\n return ret;\n}\n\nll p, k;\n\nint main() {\n scanf(\"%d%d\", &n, &k);\n auto ans = to_base(n, -k);\n printf(\"%d\\n\", (int)ans.size());\n for (int x : ans) printf(\"%d \", x);\n printf(\"\\n\");\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "cd04b5ed5df77b1945e4e692129c3c03", "src_uid": "f4dbaa8deb2bd5c054fe34bb83bc6cd5", "apr_id": "326eb8a3e58bb266f03ff9c6c58492d1", "difficulty": 2000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9900267574799319, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#ifdef HOME_PC\n#include \n#endif\nusing namespace std;\n\n#pragma comment(linker,\"/stack:16000000\")\n#pragma warning (disable : 4996)\n\n#define ALL(v) v.begin(),v.end()\n#define SZ(v) (int)v.size()\n#define mset(A,x) memset((A),(x),sizeof(A))\n#define FOR(i,start,N) for(int i=(start);i<(N);++i)\n#define FORSZ(i,start,v) FOR(i,start,SZ(v))\n#define REPSZ(i,v) FORSZ(i,0,v)\n#define FORE(i,start,N) FOR(i,start,N+1)\n#define make_unique(v) v.resize(unique(ALL(v))-v.begin())\n#define debug(x) cout<<#x<<\" = \"< pii;\ntypedef long long i64;\ntypedef vector VI; typedef vector< vector > VVI;\ntypedef vector VS;\n\nconst int inf = 1<<25;\nconst double eps = 1e-9;\n\ni64 memo[50][50];\n\ni64 f(int h,int n)\n{\n if(h > n)\n return 0;\n if(h == 0 && n == 0)\n return 1;\n\n i64& ret = memo[h][n];\n if(ret != -1)\n return ret;\n ret = 0;\n FORE(i,1,n)\n {\n int ln = i-1, rn = n-i;\n FOR(hl,0,h-1)\n ret += f(hl,ln)*f(h-1,rn) + f(h-1,ln)*f(hl,rn);\n ret+= f(h-1,ln)*f(h-1,rn);\n }\n return ret;\n}\n\nint main()\n{\n#ifdef HOME_PC\n //freopen (\"input.txt\",\"r\",stdin);\n //freopen (\"in.txt\",\"r\",stdin);\n //freopen (\"output.txt\",\"w\",stdout);\n#endif\n\n int n,h;\n cin>>n>>h;\n mset(memo,-1);\n i64 ans = 0;\n FORE(hx,h,n)\n ans+=f(hx,n);\n cout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n\nusing namespace std;\n\n#define vs vector \n#define vi vector \n#define vii vector >\n#define vp vector >\n#define pb push_back\n#define si size\n#define FOR(i,j,k) for(int i = (j); i <= (k); i++)\n#define FORN(i,j,k) for(int i = (j); i >= (k); i--)\n#define ll long long\n#define pi 3.141592653\n\nint main(){\nint r1,r2,c1,c2,d1,d2;\ncin>>r1 >>r2 >>c1 >>c2 >>d1 >>d2;\nint w,x,y,z;\nx=(d2-r2+c2)/2;\ny=(r1-d1+c2)/2;\nif(x!=y || x>9){\ncout<<\"-1\"<0 && y>0 && z>0 && w>0){\ncout<\nusing namespace std;\n\nint fsum_of_digits(int a) {\n int ret = 0;\n while(a != 0) {\n ret += a % 10;\n a /= 10;\n }\n return ret;\n}\n\nint main() {\n int n;\n cin >> n;\n vector ans;\n int start = n/2;\n int sum_of_digits = fsum_of_digits(start) - 1;\n for(int i = start; i<=n; i++) {\n sum_of_digits++;\n if(i % 1000000000 == 0) {\n sum_of_digits -= 81;\n } else if(i % 100000000 == 0) {\n sum_of_digits -= 72;\n } else if(i % 10000000 == 0) {\n sum_of_digits -= 63;\n } else if(i % 1000000 == 0) {\n sum_of_digits -= 54;\n } else if(i % 100000 == 0) {\n sum_of_digits -= 45;\n } else if(i % 10000 == 0) {\n sum_of_digits -= 36;\n } else if(i % 1000 == 0) {\n sum_of_digits -= 27;\n } else if(i % 100 == 0) {\n sum_of_digits -= 18;\n } else if(i % 10 == 0) {\n sum_of_digits -= 9;\n }\n if(sum_of_digits + i == n) ans.push_back(i);\n }\n cout << ans.size() << endl;\n for(auto i : ans) cout << i << endl;\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "f4ac964b78e8b6ab734458576b982c99", "src_uid": "ae20ae2a16273a0d379932d6e973f878", "apr_id": "3c5bde8d2418e1f42c1cd29d1192a3f3", "difficulty": 1200, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.08336276933945602, "equal_cnt": 21, "replace_cnt": 7, "delete_cnt": 5, "insert_cnt": 9, "fix_ops_cnt": 21, "bug_source_code": "#include \n\nusing namespace std;\n\nbool judge(long int n)\n{\n if(n%2)\n return true;\n return false;\n}\n\nint main()\n{\n long int han, ten;\n long int temp;\n long int count = 0;\n long int a, b;\n cin >> han >> ten;\n a = han/4;\n b = ten/4;\n temp = a < b ? a : b;\n if( temp == a)\n {\n han = han%4;\n ten = ten - temp*4;\n }\n else\n {\n han = han - temp*4;\n ten = ten%4;\n }\n if((han-2 >= 0) && (ten-2 >= 0))\n {\n count ++;\n han = han-2;\n ten = ten-2;\n }\n if(han ==1)\n {\n if(ten-12 >= 0)\n {\n count++;\n han = 0;\n ten = ten -12;\n }\n }\n if(han == 0)\n {\n count += ten/22;\n if(judge(count))\n {\n cout << \"Ciel\";\n return 1;\n }\n else\n {\n cout << \"Hanako\";\n return 1;\n }\n }\n if(judge(count))\n {\n cout << \"Ciel\";\n return 1;\n }\n else\n {\n cout << \"Hanako\";\n return 1;\n }\n return 0;\n}\n\n \t\t\t\t\t \t\t \t \t \t\t \t\t\t\t\t\t\t", "lang": "GNU C++", "bug_code_uid": "c2540a970986f45bf1f999c69cf47627", "src_uid": "8ffee18bbc4bb281027f91193002b7f5", "apr_id": "28044521a7cab5df495db0e673317032", "difficulty": 1200, "tags": ["greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.958904109589041, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "#include\nusing namespace std;\n\n\nint main()\n{\nint a,b,c,d,e,f,tot,max=0,m,i,j,n;//a d// b c d//e//f\ncin>>a>>b>>c>>d>>e>>f;\nif (b>c) m=c; else m=b;\nif (a>d) n=d; else n=a;\n\nfor (i=0;im) j=m;\n for(;(j-1;j--)\n {tot=i*e+j*f;\n if (max\nusing namespace std;\nint main(){\n\tfreopen(\"in.in\",\"r\",stdin);\n\tfreopen(\"out.out\",\"w\",stdout);\n\tint a,b;\n\tscanf(\"%d%d\",&a,&b);\n\tfor(int i=1;;i++){\n\t\tif(i%2==1) a-=i;\n\t\tif(i%2==0) b-=i;\n\t\tif(a<0) {printf(\"Vladik\");return 0;}\n\t\tif(b<0) {printf(\"Valera\");return 0;}\n\t}\n}\n ", "lang": "GNU C++11", "bug_code_uid": "d641aa662d644fc9ab48b7b284375bf3", "src_uid": "87e37a82be7e39e433060fd8cdb03270", "apr_id": "e54788a96a51df3378e4ca8f1c06ca82", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7492828456683879, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "#include \nusing namespace std;\n#define mod 1e9+7\n#define endl '\\n'\n#define pb push_back\n#define r(i,n) for(ll i=0;i>= 1);\n reverse(s.begin(), s.end());\n return s;\n}\n\nint main() {\n ios_base::sync_with_stdio(false);\n cin.tie(NULL);\n cout.tie(NULL);\n \n #ifndef ONLINE_JUDGE\n freopen(\"input.txt\",\"r\",stdin);\n freopen(\"output.txt\",\"w\",stdout);\n #endif\n\n ll t=1;\n // cin>>t;\n while(t--){\n string s1,s2;\n cin>>s1>>s2;\n ll a=bitset<64>(s1).to_ullong(),b=bitset<64>(s2).to_ullong();\n a=a^b;\n string bin=binary(a);\n string s(s1.size()-bin.size(),'0');\n bin=s+bin;\n cout<\n#include \nusing namespace std;\n\ntypedef long long ull;\n\null n;\n\nbool tr(ull k) {\n\tull s1 = 0, s2 = 0, t = n, l = (n - 1) / 2 + 1;\n\twhile (t) {\n\t\tif (t < k) {\n\t\t\ts1 += t;\n\t\t\tt = 0;\n\t\t}\n\t\telse {\n\t\t\tt -= k;\n\t\t\ts1 += k;\n\t\t}\n\t\ts2 += t / 10;\n\t\tt -= t / 10;\n\t\tif (s1 >= l)\n\t\t\treturn true;\n\t\tif (s2 > l)\n\t\t\treturn false;\n\t}\n}\n\nint main() {\n\tcin >> n;\n\tull l = 1, r = n;\n\twhile (r - l > 1) {\n\t\tull m = l + (r - l) / 2;\n\t\tif (tr(m))\n\t\t\tr = m;\n\t\telse\n\t\t\tl = m + 1;\n\t}\n\tif (!tr(l))\n\t\t++l;\n\tcout << l << endl;\n\tsystem(\"pause\");\n\treturn 0;\n}", "lang": "MS C++", "bug_code_uid": "812bce7c766fe2895513cf43708b5ee1", "src_uid": "db1a50da538fa82038f8db6104d2ab93", "apr_id": "58b482d4acb20b0d46355d854a5e13a1", "difficulty": 1500, "tags": ["implementation", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9752240379546653, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "//#include \"stdafx.h\"\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \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\nll fact(ll n)\n{\n ll res = 1;\n forn(i,1,n+1)\n {\n res*=i;\n res %= (ll)(1e9+7);\n }\n return res;\n}\n\n\nint main()\n{\n //freopen(\"area.in\",\"r\",stdin);\n //freopen(\"area.out\",\"w\",stdout);\n ll n;\n cin >> n;\n vector s(n+1,0);\n s[1] = 1;\n s[3] = 3;\n s[5] = 15;\n s[7] = 133;\n s[9] = 2025;\n s[11] = 37851;\n s[13] = 1030367;\n s[15] = 36362925;\n if(n%2==0)\n {\n cout << fact(n) << endl;\n return 0;\n }\n cout << s[n]*fact(n) << endl;\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "47bb4772cb48b86f7824a27e755227de", "src_uid": "a6a804ce23bc48ec825c17d64ac0bb69", "apr_id": "3e05ba8b8810b8ae4bb572714a046197", "difficulty": 1900, "tags": ["dp", "meet-in-the-middle", "combinatorics", "bitmasks", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8923742563547864, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#define gcd(x,y) __gcd(x,y)\n#define pair(x, y) make_pair(x, y)\n\nusing namespace std;\n\ntypedef forward_list < int > adj_list;\n\ntypedef vector < adj_list > graph;\n\nint main() {\n\tios::sync_with_stdio(false);\n\tcin.tie(nullptr);\n\tint n;\n\tcin >> n;\n\tvector colors(3);\n\tfor(int i = 0; i < n; ++i) {\n\t char c;\n\t cin >> c;\n\t if(c == 'R') {\n\t ++colors[0];\n\t }\n\t else if(c == 'G') {\n\t ++colors[1];\n\t }\n\t else if(c == 'B') {\n\t ++colors[2];\n\t }\n\t else {\n\t --i;\n\t }\n\t}\n\tset s;\n\tqueue> q;\n\tq.push(colors);\n\t\n\twhile(!q.empty()) {\n\t auto x = q.front();\n\t q.pop();\n\t int a = x[0];\n\t int b = x[1];\n\t int c = x[2];\n\t \n\t if(s.size() == 3)\n\t break;\n\t \t \n\t if(a == 0 && b == 0)\n\t s.insert('B');\n\t else if(c == 0 && b == 0)\n\t s.insert('R');\n\t else if(a == 0 && c == 0)\n\t s.insert('G');\n\t else {\n\t if(a > 0 && b > 0)\n\t q.push((vector&&) {a-1, b - 1, c + 1});\n\t \n\t if(b > 0 && c > 0)\n\t q.push((vector&&) {a+1, b - 1, c - 1});\n\t \n\t if(a > 0 && c > 0)\n\t q.push((vector&&) {a-1, b + 1, c - 1});\n\t \n\t if(a < 3 && a > 1)\n\t q.push((vector&&) {a-1, b, c});\n\t if(b < 3 && b > 1)\n\t q.push((vector&&) {a, b-1, c});\n\t if(c < 3 && c > 1)\n\t q.push((vector&&) {a, b, c-1});\n\t }\n\t}\n\t\n\tfor(auto & c : s)\n\t cout << c;\n\t\n\tcout.flush();\n}\n", "lang": "GNU C++11", "bug_code_uid": "63a91f8773c18e07fe83cca9da8fb495", "src_uid": "4cedd3b70d793bc8ed4a93fc5a827f8f", "apr_id": "907ec3e00a35c9ce401941e4d1edd178", "difficulty": 1300, "tags": ["dp", "math", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.8756423432682425, "equal_cnt": 13, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 13, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define clr(x) memset((x), 0, sizeof(x))\n#define all(x) (x).begin(), (x).end()\n#define pb push_back\n#define mp make_pair\n#define For(i, st, en) for(int i=(st); i<=(int)(en); i++)\n#define Ford(i, st, en) for(int i=(st); i>=(int)(en); i--)\n#define forn(i, n) for(int i=0; i<(int)(n); i++)\n#define ford(i, n) for(int i=(n)-1; i>=0; i--)\n#define fori(it, x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)\n#define in(x) int (x); input((x));\n#define x first\n#define y second\n#define less(a,b) ((a) < (b) - EPS)\n#define more(a,b) ((a) > (b) + EPS)\n#define eq(a,b) (fabs((a) - (b)) < EPS)\n#define remax(a, b) ((a) = (b) > (a) ? (b) : (a))\n#define remin(a, b) ((a) = (b) < (a) ? (b) : (a))\nusing namespace std; typedef long double ld; template inline _T sqr(const _T& x) {return x * x;} template inline string tostr(const _T& a) {ostringstream os(\"\"); os << a; return os.str();} const ld PI = 3.1415926535897932384626433832795L; const ld EPS = 5e-12; char TEMPORARY_CHAR; typedef long long ll; typedef unsigned long long ull; typedef set < int > SI; typedef vector < int > VI; typedef vector < vector < int > > VVI; typedef map < string, int > MSI; typedef pair < int, int > PII; const int INF = 1e9; typedef complex cbase; inline void fft (vector &a, bool invert) {int n = (int)a.size(); for (int i = 1, j = 0; i < n; ++i) {int bit = n >> 1; for (; j >= bit; bit >>= 1) j -= bit; j += bit; if (i < j) swap(a[i], a[j]);} for (int len = 2; len <= n; len <<= 1) {ld ang = 2 * PI / len * (invert ? -1 : 1); cbase wlen(cos(ang), sin(ang)); for (int i = 0; i < n; i += len) {cbase w(1); for (int j=0; j < len / 2; ++j) {cbase u = a[i + j], v = a[i + j + len / 2] * w; a[i + j] = u + v; a[i + j + len / 2] = u - v; w *= wlen;}}} if (invert) for (int i = 0; i < n; ++i) a[i] /= n;} inline void input(int &a) {a = 0; while (((TEMPORARY_CHAR = getchar()) > '9' || TEMPORARY_CHAR < '0') && (TEMPORARY_CHAR != '-')){} char neg = 0; if (TEMPORARY_CHAR == '-') {neg = 1; TEMPORARY_CHAR = getchar();} while (TEMPORARY_CHAR <= '9' && TEMPORARY_CHAR >= '0') {a = (a << 3) + (a << 1) + TEMPORARY_CHAR - '0'; TEMPORARY_CHAR = getchar();} if (neg) a = -a;} inline void out(ll a) {if (!a) putchar('0'); if (a < 0) {putchar('-'); a = -a;} char s[20]; int i; for(i = 0; a; ++i) {s[i] = '0' + a % 10; a /= 10;} ford(j, i) putchar(s[j]);} inline int nxt() {in(ret); return ret;} struct lnum {vector a; int base; lnum(int num = 0, int base = 1000000000):base(base) {if (!num) a.resize(1); while(num) {a.pb(num % base); num /= base;}} inline int len() const {return a.size();} lnum & operator=(const lnum &l) {if (this != &l) {a = l.a; base = l.base;} return *this;} inline friend lnum operator+(const lnum &l, const lnum &r) {lnum ret(0, l.base); int base = l.base; int ln = l.len(), rn = r.len(); int n = max(ln, rn); ret.a.resize(n); int o = 0; for(int i = 0; i < n; ++i) {int s = o; if (i < ln) s += l.a[i]; if (i < rn) s += r.a[i]; o = s >= base; if (o) s -= base; ret.a[i] = s;} if (o) ret.a.push_back(1); return ret;} inline friend lnum operator-(const lnum &l, const lnum &r) {lnum ret(0, l.base); int base = l.base; int n = l.len(); int rn = r.len(); ret.a.resize(n); int o = 0; for(int i = 0; i < n; ++i) {int s = l.a[i] - o; if (i < rn) s -= r.a[i]; o = s < 0; if (o) s += base; ret.a[i] = s;} if (ret.len() > 1 && !ret.a.back()) ret.a.pop_back(); return ret;} inline friend lnum operator*(const lnum &l, const lnum &r) {lnum ret(0, l.base); int base = l.base; if (l.len() * r.len() > 1000000) {vector fa (l.a.begin(), l.a.end()), fb (r.a.begin(), r.a.end()); int n = 1; while (n < max (l.len(), r.len())) n <<= 1; n <<= 1; fa.resize (n), fb.resize (n); fft (fa, false), fft (fb, false); for (int i = 0; i < n; ++i) fa[i] *= fb[i]; fft (fa, true); ret.a.resize(n); for (int i = 0; i < n; ++i) ret.a[i] = int (fa[i].real() + 0.5); int carry = 0; for (int i=0; i < n; ++i) {ret.a[i] += carry; carry = ret.a[i] / base; ret.a[i] %= base;}} else {ret.a.resize(l.len() + r.len()); for (int i = 0; i < l.len(); ++i) for (int j = 0, carry = 0; j < r.len() || carry; ++j) {long long cur = ret.a[i + j] + (ll)l.a[i] * (j < r.len() ? r.a[j] : 0) + carry; ret.a[i + j] = cur % base; carry = cur / base;}} while (ret.len() > 1 && !ret.a.back()) ret.a.pop_back(); return ret;} inline friend lnum operator/(const lnum &l, const int &r) {lnum ret(0, l.base); ret.a.resize(l.len()); int carry = 0; for(int i = l.len() - 1; i >= 0; --i) {long long cur = l.a[i] + (ll)carry * l.base; ret.a[i] = cur / r; carry = cur % r;} while (ret.len() > 1 && ret.a.back() == 0) ret.a.pop_back(); return ret;} inline friend bool operator<(const lnum &l, const lnum &r) {if (l.len() < r.len()) return true; if (l.len() > r.len()) return false; int n = l.len(); for(int i = n - 1; i >= 0; --i) {if (l.a[i] < r.a[i]) return true; if (l.a[i] > r.a[i]) return false;} return false;} inline friend bool operator>(const lnum &l, const lnum &r) {return r < l;} inline friend bool operator==(const lnum &l, const lnum &r) {if (l.len() != r.len()) return false; int n = l.len(); for(int i = n - 1; i; --i) {if (l.a[i] != r.a[i]) return false;} return true;} inline friend bool operator!=(const lnum &l, const lnum &r) {return !(l == r);} inline void print() {if (base == 1000000000) {printf(\"%d\", a.back()); for(int i = a.size() - 2; i >=0; --i) printf(\"%09d\", a[i]);} else {for(int i = a.size() - 1; i >= 0; --i) printf(\"%d\", a[i]);}}};\n\nvector per;\nvector kol;\n\nvector ans;\n\n\nvoid rec()\n{\n int n = per.size();\n int cnt = 0;\n forn(i, n)\n {\n if (kol[i])\n {\n For(j, i + 1, n - 1)\n {\n if (kol[j])\n {\n ++cnt;\n kol[i]--;\n kol[j]--;\n swap(per[i], per[j]);\n rec();\n swap(per[i], per[j]);\n kol[i]++;\n kol[j]++;\n }\n }\n }\n }\n ll ha = 0;\n forn(i, n)\n ha = ha * n + per[i];\n ans.pb(ha);\n}\n\nint main()\n{\n in(n);\n per.resize(n);\n kol.resize(n);\n forn(i, n)\n {\n kol[i] = nxt();\n per[i] = i;\n }\n rec();\n sort(all(ans));\n cout << unique(all(ans)) - ans.begin() << endl;\n return 0;\n}\n", "lang": "GNU C++0x", "bug_code_uid": "b139926e1523a66cab219f774d852d7e", "src_uid": "91e8dbe94273e255182aca0f94117bb9", "apr_id": "a085145add63760a00a90850f904be2f", "difficulty": 2300, "tags": ["dp", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.1760204081632653, "equal_cnt": 36, "replace_cnt": 29, "delete_cnt": 1, "insert_cnt": 6, "fix_ops_cnt": 36, "bug_source_code": "#include \n#include \n#include \n#include \n\n#define fi first\n#define se second\n#define pb push_back\n#define sz(a) ((int)a.size())\n#define abs(a) ((a)<0 ? ((a)*-1) : (a))\n\nusing namespace std;\n\ntypedef pair ii;\ntypedef long long int Lint;\n\nconst int MAXN=100;\n\nint N;\nint ar[MAXN];\nint fact[MAXN];\n\nstring s;\n\nvector res;\n\nvoid f(){\n\t\n\tres.pb(s);\n\t\n\tfor( int i=0 ; i\nusing namespace std;\n\n#define ff first\n#define ss second\n\nint main()\n{\n ios_base::sync_with_stdio(false),cin.tie(NULL);\n int n=0,m=0;\n cin>>n>>m;\n vector> v;\n map,int> we;\n vector> v1;\n map,int> we1;\n for(int i=0;i>x>>y;\n v.push_back({x,y});\n we[{x,y}]=i;\n }\n for(int i=0;i>x>>y;\n v1.push_back({x,y});\n we1[{x,y}]=i;\n } \n vector> dp(n+1,vector(3,0));\n vector> dp1(m+1,vector(3,0));\n\n for(auto u:v)\n {\n for(auto p:v1)\n {\n if(u==p) continue;\n if(u.ff==p.ff and u.ss!=p.ss) dp[we[u]][1]=1;\n else if(u.ff==p.ss and u.ss!=p.ff) dp[we[u]][1]=1;\n else if(u.ss==p.ss and u.ff!=p.ff) dp[we[u]][2]=1;\n else if(u.ss==p.ff and u.ff!=p.ss) dp[we[u]][2]=1;\n }\n }\n\n for(auto u:v1)\n {\n for(auto p:v)\n {\n if(u==p) continue;\n if(u.ff==p.ff and u.ss!=p.ss) dp1[we1[u]][1]=1;\n else if(u.ff==p.ss and u.ss!=p.ff) dp1[we1[u]][1]=1;\n else if(u.ss==p.ss and u.ff!=p.ff) dp1[we1[u]][2]=1;\n else if(u.ss==p.ff and u.ff!=p.ss) dp1[we1[u]][2]=1;\n }\n }\n\n int cnt=0,fl=0,ans=-1;\n int cnt1=0,fl1=0,ans1=-1;\n\n for(int i=0;i\nusing namespace std;\n#define PB push_back\n#define MP make_pair\n#define F first\n#define S second\ntypedef long long ll;\ntypedef vector vi;\ntypedef pair pii;\ntypedef pair pll;\nconst int INF = 1e9 + 7;\nconst int MAXD = 5;\n\nconst int MAXN = 10;\nconst int MAXM = 275;\n\nint hx[] = {1, 2, 2, 1, -1, -2, -2, -1};\nint hy[] = {2, 1, -1, -2, -2, -1, 1, 2};\n\nint n;\nint A[MAXN][MAXN];\npii dist[MAXM][MAXM];\npii dp[MAXN * MAXN][3];\n// pii road[MAXN * MAXN][3];\npii pos[MAXN * MAXN];\n\npii operator+(pii a, pii b) {\n\treturn MP(a.F + b.F, a.S + b.S);\n}\n\nint getIndex(int x, int y, int b) {\n\treturn 3 * x * n + 3 * y + b;\n}\n\nbool isInside(int x, int y) {\n\treturn (0 <= x && x < n && 0 <= y && y < n);\n}\n\nvoid input() {\n\tcin >> n;\n\tfor (int i = 0; i < n; i++) {\n\t\tfor (int j = 0; j < n; j++) {\n\t\t\tcin >> A[i][j];\n\t\t\tA[i][j]--;\n\t\t\tpos[A[i][j]] = MP(i, j);\n\t\t}\n\t}\n}\n\nvoid solve() {\n\n\tfor (int i = 0; i < MAXM; i++) {\n\t\tfor (int j = 0; j < MAXM; j++) {\n\t\t\tdist[i][j] = MP(INF, INF);\n\t\t}\n\t}\n\tfor (int i = 0; i < MAXM; i++) {\n\t\tdist[i][i] = MP(0, 0);\n\t}\n\n\tfor (int x = 0; x < n; x++) {\n\t\tfor (int y = 0; y < n; y++) {\n\t\t\t// ruch skoczkiem - 0\n\t\t\tfor (int h = 0; h < 8; h++) {\n\t\t\t\tint wx = x + hx[h];\n\t\t\t\tint wy = y + hy[h];\n\t\t\t\tif (isInside(wx, wy)) {\n\t\t\t\t\tdist[getIndex(x, y, 0)][getIndex(wx, wy, 0)] = MP(1, 0);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// ruch wieza - 1 \n\t\t\tfor (int w = 0; w < n; w++) {\n\t\t\t\tif (w != x) { // pionowy\n\t\t\t\t\tdist[getIndex(x, y, 1)][getIndex(w, y, 1)] = MP(1, 0);\n\t\t\t\t}\n\t\t\t\tif (w != y) { // poziomy\n\t\t\t\t\tdist[getIndex(x, y, 1)][getIndex(x, w, 1)] = MP(1, 0);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// ruch goncem - 2\n\t\t\tfor (int g = -n + 1; g < n; g++) {\n\t\t\t\tif (g == 0) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (isInside(x + g, y + g)) {\n\t\t\t\t\tdist[getIndex(x, y, 2)][getIndex(x + g, y + g, 2)] = MP(1, 0);\n\t\t\t\t}\n\t\t\t\tif (isInside(x + g, y - g)) {\n\t\t\t\t\tdist[getIndex(x, y, 2)][getIndex(x + g, y - g, 2)] = MP(1, 0);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// zmiana bierki\n\t\t\tfor (int b1 = 0; b1 < 3; b1++) {\n\t\t\t\tfor (int b2 = 0; b2 < 3; b2++) {\n\t\t\t\t\tif (b1 != b2) {\n\t\t\t\t\t\tdist[getIndex(x, y, b1)][getIndex(x, y, b2)] = MP(1, 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (int k = 0; k < MAXM; k++) {\n\t\tfor (int i = 0; i < MAXM; i++) {\n\t\t\tfor (int j = 0; j < MAXM; j++) {\n\t\t\t\tdist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (int i = 0; i < MAXN * MAXN; i++) {\n\t\tfor (int b = 0; b < 3; b++) {\n\t\t\tdp[i][b] = MP(INF, INF);\n\t\t}\n\t}\n\n\tdp[0][0] = dp[0][1] = dp[0][2] = MP(0, 0);\n\tfor (int i = 0; i < n * n - 1; i++) {\n\t\tfor (int b1 = 0; b1 < 3; b1++) {\n\t\t\tfor (int b2 = 0; b2 < 3; b2++) {\n\t\t\t\tdp[i + 1][b2] = min(dp[i + 1][b2], dp[i][b1]\n\t\t\t\t\t+ dist[getIndex(pos[i].F, pos[i].S, b1)][getIndex(pos[i + 1].F, pos[i + 1].S, b2)]);\n\t\t\t\t/* if (dp[i][b1] + dist[getIndex(pos[i].F, pos[i].S, b1)][getIndex(pos[i + 1].F, pos[i + 1].S, b2)] < dp[i+1][b2]) {\n\t\t\t\t\tdp[i + 1][b2] = dp[i][b1]\n\t\t\t\t\t\t+ dist[getIndex(pos[i].F, pos[i].S, b1)][getIndex(pos[i + 1].F, pos[i + 1].S, b2)];\n\t\t\t\t\troad[i+1][b2] = \n\n\n\t\t\t\t\n\t\t\t\t}*/\t\n\t\t\t}\n\t\t}\n\t}\n\n\tpii ans = MP(INF, INF);\n\tfor (int b = 0; b < 3; b++) {\n\t\tans = min(ans, dp[n * n - 1][b]);\n\t}\n\tcout << ans.F << \" \" << ans.S << \"\\n\";\n\n\t/* int figura = -1;\n\tfor (int i = 0; i < n * n; i++) {\n\t\tans = MP(INF, INF);\n\t\tfor (int b = 0; b < 3; b++) {\n\t\t\tif (ans > dp[i][b]) {\n\t\t\t\tans = dp[i][b];\n\t\t\t\tfigura = b;\n\t\t\t}\n\t\t}\n\t\tcout << i + 1 << \": \" << ans.first << \" \" << ans.second;\n\t\tif (figura == 0) cout << \"skoczek\";\n\t\tif (figura == 1) cout << \"wieza\";\n\t\tif (figura == 2) cout << \"goniec\";\n\t\tcout << \"\\n\";\n\t}\n\t*/\n\t// cout << ans.F << \" \" << ans.S << \"\\n\";\n\n}\n\nint main() {\n\tios_base::sync_with_stdio(0);\n\tcin.tie(NULL);\n\tcout.tie(NULL);\n\t\n\tinput();\n\tsolve();\n\n\treturn 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "5477dd4873503784a733b76043745437", "src_uid": "5fe44b6cd804e0766a0e993eca1846cd", "apr_id": "01dcc0b1b65eb21e1aeccfdd67e943b7", "difficulty": 2200, "tags": ["dp", "dfs and similar", "shortest paths"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.4262295081967213, "equal_cnt": 12, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 12, "bug_source_code": "//\n// main.cpp\n// codeforces 3\n//\n// Created by dive5617 on 13-6-26.\n// Copyright (c) 2013\u5e74 dive5617. All rights reserved.\n//\n\n#include \n#include \n#include \n#define mx 1000\n#define mod 1000000007\nusing namespace std;\n\nint len;\n\nlong long sum(int pos){\n long long all=0;\n int t=0;\n for(int i=len-1; i>=pos; i--){\n long long tmp=(long long)pow(2,t)%mod;\n tmp*=tmp;\n all+=tmp%mod;\n t++;\n }\n return all;\n}\n\nint main(){\n char str[mx];\n long long ans;\n while(cin>>str){\n ans=0;\n len=strlen(str);\n for(int i=len-1; i>=0; i--){\n if(str[i]=='1') {ans+=sum(i)%mod; }\n else if(str[i]=='0') ans*=2;\n }\n cout<\nusing namespace std;\n\n#define pb push_back\n#define pii pair\n#define ll long long\n#define pll pair\n#define vi vector\n#define vii vector\n#define vll vector\n#define MOD 1000000007\n#define EPS 1e-7\n#define mem(x,y) memset(x,y,sizeof x)\n#define MAX 4e18\n#define ff(i,a,b) for(int i=(a);i<=(b);i++)\n#define fb(i,a,b) for(int i=(a);i>=(b);i--)\n\nclass compare{\npublic:\n bool operator()(pii x,pii y){\n if(x.second==y.second){\n return x.first>a>>b;\n if(a==b){\n cout<<\"infinity\"<\nusing namespace std;\nint main()\n{\n\tint n,a,b,c,u,v;\n\tint ans=0;\n\tcin>>n>>a>>b>>c;\n\tfor(int i=0;(i*0.5<=n)&&(i<=a);i++)\n\t\tfor(int j=0;(j+i*0.5<=n)&&(j<=b);j++)\n\t\t\tif(i+j*2==n){\n if(j*2==n){\n ans++;\n continue;\n }\n if(max(u/2,v)>=i) ans+=min(i+1,min(u/2,v)+1); \n else ans+=min(u/2,v)-(i-max(u/2,v))+1; \n }\n\tcout<\n#include\n\nusing namespace std;\n\ntypedef long long ll;\n\nll mini(ll a[],ll l)\n{\n ll m=a[0];\n for(ll i=0;i> n >> a >> b >> c;\n k=4-(n%4);\n // total books to buy k\n ll r[3];\n ll ans;\n if(k==3)\n {\n r[0]=c;\n\n r[1]=b+a;\n\n r[2]=3*a;\n\n r[3]=a+2*b;\n ans =mini(r,4);\n }\n else if(k==2)\n {\n r[0]=b;\n\n r[1]=2*a;\n\n r[2]=2*c;\n\n r[3]=3*b;\n\n ans =mini(r,4);\n }\n else if(k==1)\n {\n r[0]=a;\n\n r[1]=c+b;\n\n r[2]=3*c;\n\n r[3]=3*b+c;\n\n r[4]=4*c+a;\n\n r[5]=6*b+a;\n\n ans=mini(r,6);\n }\n else\n ans=0;\n cout << ans << endl;\n return 0;\n\n}\n", "lang": "GNU C++", "bug_code_uid": "d01cd2b226fb2eaca8c5ad238aa96459", "src_uid": "c74537b7e2032c1d928717dfe15ccfb8", "apr_id": "a5e8e5983d2d526e439e74842b859fb6", "difficulty": 1300, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.24278846153846154, "equal_cnt": 11, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "#include\nusing namespace std ;\ntypedef long long ll ;\n\nvector < ll > v ;\n\nvoid fill ( ll n ){\n for ( int i = 1 ; i <= n ; i*=2 ){\n v.push_back(i) ;\n }\n}\n\nmain ()\n\n{\n ll n, k ;\n cin >> n >> k ;\n fill(n) ;\n\n ll ans = 0 ;\n ll fin = v.size()-1 ;\n for ( int i = fin ; i >= fin-k+1 && i >= 0 ; i-- ){\n ans += v[i] ;\n }\n cout << ans << endl ;\n return 0 ;\n}\n", "lang": "GNU C++11", "bug_code_uid": "63cfd6787bf8fb317408a2b13b2cfdd8", "src_uid": "16bc089f5ef6b68bebe8eda6ead2eab9", "apr_id": "d886f4f9a30ef1b42a002afece20e17a", "difficulty": 1300, "tags": ["bitmasks", "constructive algorithms", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9158110882956879, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include\nusing namespace std;\n\nint main()\n{\n\tint n;\n\tcin>>n;\n\n\tint a[n],i,x,j,ans,max,temp;\n\n\tvector vec,t;\n\n\tfor(i=0; i>x;\n\t\tvec.push_back(x);\n\t}\n\n\tmax=INT_MIN;\n\tans=INT_MAX;\n\n\tfor(i=1; i<=n-2; i++)\n\t{\n\t\ttemp=vec[i];\n\t\tvec.erase(vec.begin()+i);\n\n\t\tfor(j=0; jmax)\n\t\t\t\tmax=vec[j+1]-vec[j];\n\n\t\tt.push_back(max);\n\n\t\tvec.push_back(temp);\n\t\tsort(vec.begin(),vec.end());\n\t}\n\n\tsort(t.begin(),t.end());\n\tcout<\n\nusing namespace std;\n\n#define maxn 150010\n#define ff first\n#define ss second\n#define endl '\\n'\ntypedef long long ll;\n\nint n, m;\nstring s, t;\nint ans = 0;\n\nbool nxt(int idx, int from) {\n if (idx == m) return true;\n bool f = 0;\n for (int i = from + 1; i < n; ++i) {\n if (s[i] == t[idx]) {\n if (nxt(idx + 1, i)) {\n ans = max(i - from - 1, ans);\n if (idx == m - 1) {\n ans = max(ans, n - i - 1);\n f = 1;\n }\n f = 1;\n }\n else break;\n }\n }\n if (f) return true;\n return false;\n}\n\nint main() {\n ios_base::sync_with_stdio(false);\n cin.tie(0);\n cin >> s >> t;\n n = s.size();\n m = t.size();\n for (int i = 0; i < n; ++i) {\n if (s[i] == t[0]) {\n if (nxt(1, i)) ans = max(ans, i);\n else break;\n }\n }\n cout << ans << endl;\n}\n", "lang": "GNU C++14", "bug_code_uid": "aad6cde6b926905d519901432d9050f9", "src_uid": "0fd33e1bdfd6c91feb3bf00a2461603f", "apr_id": "881560e243d5d7e247ab4b5969a24743", "difficulty": 1600, "tags": ["greedy", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.3642072213500785, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "#include\nint main()\n{\n\tint n,i;\n\tdouble m;\n\twhile(~scanf(\"%d\",&n),n)\n\t{\n\t\tm=(n-2)*(n-2)*1.0;\n\t\tprintf(\"%.0lf\\n\",m);\n\t}\n\treturn 0;\n}\n ", "lang": "GNU C++", "bug_code_uid": "14c49c93b11400ac7692e99c059330ef", "src_uid": "efa8e7901a3084d34cfb1a6b18067f2b", "apr_id": "c302930e42003d089d01589deaa7ef95", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8085106382978723, "equal_cnt": 13, "replace_cnt": 3, "delete_cnt": 5, "insert_cnt": 4, "fix_ops_cnt": 12, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n int n;\n cin>>n;\n char s[n];\n cin>>s;\n vector a;\n a.push_back(s[0]);\n int i=1,j=2,cnt=1;\n while(s[i]!='/0')\n {\n a.push_back(s[i]);\n while(cnt\nusing namespace std;\n\nint main() {\n\tint n;\n\tcin >> n;\n\tint a[n], max = 0;\n\tfor (int i = 0; i < n; ++i) {\n\t\tcin >> a[i];\n\t\tif (a[i] > max)\n\t\t\tmax = a[i];\n\t}\n\tint b[max];\n\tfor (int i = 0; i < max; ++i)\n\t{\n\t\tb[i] = 0;\n\t}\n\tfor (int i = 0, j = 0; j < max; ++i)\n\t{\n\t\tif (i == n) {\n\t\t\tj++;\n\t\t\ti = 0;\n\t\t}\n\t\tif (j == max)\n\t\t\tbreak;\n\t\tif (a[i]) {\n\t\t\ta[i]--;\n\t\t\tb[j++];\n\t\t}\n\t}\n\tfor (int i = max-1; i >= 0; ++i)\n\t{\n\t\tcout << b[i] << ' ';\n\t}\n\tcout << '\\n';\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "c1e7a5772ae6528f1e217670e53211f8", "src_uid": "ae20712265d4adf293e75d016b4b82d8", "apr_id": "0bdb58bb71affeb319ed13e4057135fe", "difficulty": 900, "tags": ["greedy", "sortings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5250431778929189, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "#include\nusing namespace std;\nint n, m, k;\nint ans;\nint main()\n{\n\tcin >> n >> m;\n\tif(n == m)\n\t{\n\t\tcout << 0;\n\t\treturn 0;\n\t}\n\tif(m % n != 0)\n\t{\n\t\tcout << -1;\n\t\treturn 0;\n\t}\n\tk = m / n;\n\tcout << ans;\n\treturn 0;\n}", "lang": "MS C++ 2017", "bug_code_uid": "e9365196226217cb22862e154b0b22af", "src_uid": "3f9980ad292185f63a80bce10705e806", "apr_id": "bbfed9e024dc16ee8d383b54c5d73824", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9320712694877505, "equal_cnt": 18, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 10, "fix_ops_cnt": 17, "bug_source_code": "\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define endl \"\\n\"\n#define ll long long int\n#define vi vector\n#define vll vector\n#define vvi vector < vi >\n#define pii pair\n#define pll pair\n#define mod 1000000007\n#define inf 1000000000000000001;\n#define all(c) c.begin(),c.end()\n#define mp(x,y) make_pair(x,y)\n#define mem(a,val) memset(a,val,sizeof(a))\n#define eb emplace_back\n#define f first\n#define s second\n\nusing namespace std;\n\nvoid solve(){\n\tint n, sum =0;\n\tcin>>n;\n\tint x = n%10;\n\twhile(x>0){\n\t\tsum++;\n\t\tn /= 10;\n\t}\n\tint ans = ((x-1)*10)+ (sum *(sum+1))/2;\n\tcout<> T;\n\t// cin.ignore(); must be there when using getline(cin, s)\n\twhile (T--)\n\t{\n\t\tsolve();\n\t}\n\treturn 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "5f91b93a81529ae70605508df3e8503f", "src_uid": "289a55128be89bb86a002d218d31b57f", "apr_id": "a9f8f97fe12050088645ad455d4ec797", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.8538213132400431, "equal_cnt": 20, "replace_cnt": 7, "delete_cnt": 6, "insert_cnt": 6, "fix_ops_cnt": 19, "bug_source_code": "#pragma GCC optimize(\"Ofast\")\n#pragma GCC target(\"sse,sse2,sse3,ssse3,sse4,avx\")\n#pragma GCC target (\"avx2,fma\")\n#pragma GCC optimize (\"O3\")\n#pragma GCC optimize (\"unroll-loops\")\n#include\n#include \n//#include \n\n#define F first\n#define S second\n#define int long long\n#define ll long long\n//#define int unsigned long long\n#define pb push_back\n#define rank fewfewf\n#define double long double\n\nusing namespace std;\nusing namespace __gnu_pbds;\n//using namespace atcoder;\n\n\ntypedef tree< int , null_type, less, rb_tree_tag, tree_order_statistics_node_update> ordered_set;\nmt19937 rng(chrono::steady_clock::now().time_since_epoch().count());\nconst int N = 1100105;\nconst int K = 90;\nconst int mod = 1e9 + 7;\nint p[N], a[N], have[N], b[N], taken[N];\nvector> d[N];\nmain(){\n ios_base::sync_with_stdio(0);\n cin.tie(0);\n //freopen(\"input.txt\", \"r\", stdin);\n //freopen(\"output.txt\", \"w\", stdout);\n int n;\n cin >> n;\n for (int i = 2; i < N; i++){\n if (p[i] == 0){\n for (int j = i; j < N; j++){\n p[j] = i;\n }\n }\n }\n for (int i = 0; i < n; i++) cin >> a[i];\n reverse(a, a + n);\n for (int i = 0; i < n; i++){\n if (taken[a[i]]){\n b[i] = a[i] - 1;\n int y = b[i];\n while(y != 1){\n int x = p[y];\n int k = 0;\n while(y % x == 0){\n y /= x;\n k++;\n }\n d[i].pb({x, k});\n }\n for (auto x: d[i]){\n taken[x.F] = 1;\n }\n } else{\n b[i] = a[i];\n taken[a[i]] = 1;\n d[i].pb({a[i], 1});\n }\n }\n int z = 0;\n for (int i = 0; i < n; i++){\n int ok = 0;\n for (auto x: d[i]){\n if (have[x.F] < x.S) ok = 1;\n have[x.F] = max(x.S, have[x.F]);\n }\n if (!ok) z = 1;\n }\n int res = 1;\n for (int i = 1; i < N; i++){\n for (int j = 0; j < have[i]; j++){\n res = res * i % mod;\n }\n }\n cout << (z + res) % mod;\n}\n", "lang": "GNU C++17", "bug_code_uid": "f61d87ffb8043cd6cea5bb0baa2c15ed", "src_uid": "816a82bee65cf79ba8e4d61babcd0301", "apr_id": "329a1c8ab1240291f27b26be80d17b02", "difficulty": 2900, "tags": ["number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5565610859728507, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n int n,i,k,m,s=0;\n cin>>n;\n i=n-1;\n k=1;\n while(i==k)\n {\n m=i*k;\n s=s+m;\n }\n s=2*s+i*i+n;\n cout<\nusing namespace std;\ntypedef long long ll;\nlong long int s(long long int i)\n{\n long long int k=i,sum=0;\n while(k!=0)\n {\n sum+=k%10;\n k=k/10;\n }\n\n return sum;\n}\n\n/*int bs(int i,int j)\n{\n long long int lo=1,hi=q;\n while(lo <= hi)\n {\n long long int mi = lo + (hi - lo) / 2;\n\n if(ok(mi))\n {\n lo=mi+1;\n\n else\n {\n hi=mi-1;\n }\n }\n\n return lo;\n }*/\n int main()\n { long long int n,a[100],p=1;\n cin>>n;\n \t for(int i=sqrt(n);i>=1;--i)\n \t {\n if(n%i==0){\n a[p]=n/i;++p;a[p]=i;++p;\n }\n\n }\n sort(a+1,a+p);\n for(int i=1;i\n#include\n#include\nusing namespace std;\nbitset<550> grid[550];\nbool used[550];\nint cha[550];\nint main() {\n ios::sync_with_stdio(0);\n int n, m;cin >> n >> m;\n for (int i = 1;i <= m;++i) {\n int a, b;cin >> a >> b;\n grid[a][b] = 1;grid[b][a] = 1;\n }for (int i = 1;i <= n;++i)grid[i][i] = 1;\n int tot = 0;\n for (int i = 1;i <= n;++i) {\n if (used[i])continue;\n used[i] = 1;cha[i] = ++tot;\n for (int j = i + 1;j <= n;++j) {\n if (!used[j] && grid[i] == grid[j]) {\n used[j] = true;\n cha[j] = cha[i];\n }\n }\n }\n if (tot > 3) {\n cout << \"NO\\n\";\n }\n else if (tot <= 2) {\n cout << \"YES\\n\";\n for (int i = 1;i <= n;++i)\n cout << (char)('a' + cha[i] - 1);\n }\n else {\n int cct[4] = { 0,0,0,0 };\n int cmp1[4] = { -1,-1,-1,-1 };\n int cmp2[4] = { -1,-1,-1,-1 };\n for (int i = 1;i <= n;++i) {\n for (int j = 1;j <= n;++j) {\n if (grid[i][j] && cha[i] != cha[j]) {\n if (cmp1[cha[i]] == -1 || cmp1[cha[i]] == cha[j]) {\n if (cmp1[cha[i]] == -1)++cct[cha[i]];\n cmp1[cha[i]] = cha[j];\n }\n else if (cmp2[cha[i]] == -1 || cmp2[cha[i]] == cha[j]) {\n if (cmp2[cha[i]] == -1)++cct[cha[i]];\n cmp2[cha[i]] = cha[j];\n }\n else {\n if (cha[j] != cmp1[cha[i]] && cha[j] != cmp2[cha[i]]) {\n cout << \"NO\\n\";\n return 0;\n }\n }\n }\n }\n }int c1 = 0;int c2 = 0;\n for (int i = 1;i <= 3;++i)\n if (cct[i] == 2)++c1;\n else if (cct[i] == 1)++c2;\n if (c1 == 1 && c2 == 2) {\n char mp[4] = { 0,0,0 };\n char ch = 'a';\n for (int i = 1;i <= 3;++i)\n if (cct[i] == 2)mp[i] = 'b';\n else {\n mp[i] = ch;\n ch += 2;\n }\n cout << \"YES\\n\";\n for (int i = 1;i <= n;++i)\n cout << mp[cha[i]];\n }\n else cout << \"NO\\n\";\n\n }\n}", "lang": "MS C++ 2017", "bug_code_uid": "0f62091979f4bad75b138daaad806013", "src_uid": "e71640f715f353e49745eac5f72e682a", "apr_id": "a8709160f7d341e080d4bff519859fe5", "difficulty": 1800, "tags": ["graphs", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9836601307189542, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "#include\nusing namespace std;\nint a,b,c,d,e,f;\nint gett(int y,int m,int d){\n\tif(m < 3){\n\t\ty-=1;\n m+=12;\n\t}\n return 365*y+y/4-y/100 +y/400+ (153*m-457)/5+d-306;\n}\nint main(){\n\tscanf(\"%d:%d:%d\",&a,&b,&c);\n\tscanf(\"%d:%d:%d\",&d,&e,&f);\n\tcout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define sz(a) ((int)(a).size())\n#define pb push_back\n#define mk make_pair\n#define fi first\n#define se second\n#define Rep(i,j,k) for (int i=(j); i<=(k); i++)\n#define Repd(i,j,k) for (int i=(j); i>=(k); i--)\n#define ALL(c) (c).begin(),(c).end()\n#define TR(c,i) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)\n#define SUM(a) accumulate(all(a),string())\n#define online1\n#define RAND ((rand()<<15)+rand())\nusing namespace std;\ntypedef vector VI;\ntypedef vector VVI;\ntypedef pair II;\ntypedef long long LL;\n\nconst int MOD=51123987;\nconst int N=54;\n\nint n;\nchar s[N];\nint f[151][N][N][N];\n\nvoid update(int &x, int y){\n\tx=(x+y)%MOD;\n}\n\nint main(){\n\tcin>>n;\n\tscanf(\"%s\",s+1);\n\tf[0][0][0][0]=1;\t\t\t\n\tint ans=0;\n\tRep(i,0,n)\n\t\tRep(j,0,min(52,n))\n\t\t\tRep(k,0,min(52,n-j)) \n\t\t\t\tRep(l,0,min(52,n-j-k))if (f[i][j][k][l]){\n\t\t\t\t\tif (j+k+l==n)\n\t\t\t\t\t\tif (abs(j-k)<=1 && abs(j-l)<=1 && abs(k-l)<=1)\n\t\t\t\t\t\t\tupdate(ans,f[i][j][k][l]);\n\t\t\t\t\tint num[3]={0,0,0};\n\t\t\t\t\tif (i!=0) num[s[i]-'a']++;\n\t\t\t\t\tRep(x,i+1,n){\n\t\t\t\t\t\tif (num[s[x]-'a']++) continue;\n\t\t\t\t\t\tif (s[x]=='a')\n\t\t\t\t\t\t\tupdate(f[x][j+1][k][l], f[i][j][k][l]);\n\t\t\t\t\t\tif (s[x]=='b')\n\t\t\t\t\t\t\tupdate(f[x][j][k+1][l], f[i][j][k][l]);\n\t\t\t\t\t\tif (s[x]=='c')\n\t\t\t\t\t\t\tupdate(f[x][j][k][l+1], f[i][j][k][l]);\n\t\t\t\t\t}\n\t\t\t\t\tif (!i) continue;\n\t\t\t\t\tif (s[i]=='a')\t\t\t\t\t\t\t\n\t\t\t\t\t\tupdate(f[i][j+1][k][l],f[i][j][k][l]);\n\t\t\t\t\tif (s[i]=='b')\n\t\t\t\t\t\tupdate(f[i][j][k+1][l],f[i][j][k][l]);\n\t\t\t\t\tif (s[i]=='c')\n\t\t\t\t\t\tupdate(f[i][j][k][l+1],f[i][j][k][l]);\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\tcout<\nusing namespace std;\ntypedef signed long long ll;\n\n#undef _P\n#define _P(...) (void)printf(__VA_ARGS__)\n#define FOR(x,to) for(x=0;x<(to);x++)\n#define FORR(x,arr) for(auto& x:arr)\n#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)\n#define ALL(a) (a.begin()),(a.end())\n#define ZERO(a) memset(a,0,sizeof(a))\n#define MINUS(a) memset(a,0xff,sizeof(a))\n//-------------------------------------------------------\n\nint N;\nll mo=1000000007;\n\nll dp[405][405];\n\nvoid solve() {\n\tint i,j,k,l,r,x,y; string s;\n\t\n\tdp[0][0]=1;\n\tfor(i=1;i<=400;i++) {\n\t\tFOR(x,404) FOR(y,404) if(x+y<404) {\n\t\t\tll pat=dp[i-1][x]*dp[i-1][y]%mo;\n\t\t\t//take 0 and connect 1\n\t\t\t(dp[i][x+y] += pat*(1+2*(x+y))%=mo;\n\t\t\t//connect 2\n\t\t\tif(x+y>0) (dp[i][x+y-1] += pat*((x+y)*(x+y-1)))%=mo;\n\t\t\t//new\n\t\t\tdp[i][x+y+1] += pat;\n\t\t\tif(dp[i][x+y+1]>=mo) dp[i][x+y+1]-=mo;\n\t\t}\n\t}\n\tcin>>N;\n\tcout<\nusing namespace std;\nint main(){\n\tint n,m;cin>>n>>m;\n\tif(m==0)\n\treturn 1;\n\tint k=(n+1)/2;\n\tif(m\nusing namespace std;\n\nconst int INF = 10000000;\n\nint main(int argc, char const *argv[])\n{\n int n, m, a, b, ans1 = INF, ans2 = INF;\n cin >> n >> m >> a >> b;\n\n int row1 = a / m + 1;\n int row2 = b / m + 1;\n int col1 = a % m == 0 ? m : a % m;\n int col2 = b % m == 0 ? m : b % m;\n\n if(row1 == row2)\n ans1 = 1;\n else if(row2 - row1 == 1) {\n ans1 = 2;\n if(col1 == 1 && b == n)\n ans1 = 1;\n else if(col1 == 1 && col2 == m)\n ans1 = 1;\n } else {\n ans1 = 3;\n if(b == n || col2 == m) // \u5982\u679c\u662f\u6700\u540e\u4e00\u4e2a\u5c31\u53ef\u4ee5\u62c9\u591a\u4f59\u8303\u56f4\n --ans1;\n if(col1 == 1)\n --ans1;\n }\n\n ans2 = 3;\n if(col1 - 1 == col2)\n --ans2;\n\n cout << min(ans1, ans2) << endl;\n\n return 0;\n};", "lang": "GNU C++11", "bug_code_uid": "806db69272b115b57e7d8db89b15d9c6", "src_uid": "f256235c0b2815aae85a6f9435c69dac", "apr_id": "5143b25aa032a8024877344c9b9ee589", "difficulty": 1700, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9755954990501242, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\n#define IT(c) __typeof((c).begin())\n#define FORIT(i, c) for(IT(c) i = (c).begin(); i != (c).end(); ++i)\n#define FOR(i, a, b) for(int i = a; i < int(b); ++i)\n#define FORE(i, a, b) for(int i = a; i <= int(b); ++i)\n#define FORD(i, a, b) for(int i = b - 1; i >= int(a); --i)\n#define FORDE(i, a, b) for(int i = b; i >= int(a); --i)\n#define REP(i, n) FOR(i, 0, n)\n#define REPE(i, n) FORE(i, 0, n)\n#define REPD(i, n) FORD(i, 0, n)\n#define REPDE(i, n) FORDE(i, 0, n)\n#define SZ(c) (int((c).size()))\n\n/*\n Approach:\n\n We are asked if we can turn a 2D vector A into a vector B using a\n vector C by using some combination of operations:\n\n 1. rotate A by 90 degrees\n 2. add C to A\n\n An equivalent way to view this problem, is to start with one of the four\n rotations of A, and then repeatedly trying to add on of the four rotations\n of C. This simplifies matters because we can simply try to guess a rotation\n of A, subtract it from B, and then see if we can construct the resulting\n vector using C only.\n\n In other words, we want to see if (B - rot^i(A)) = x*C + y*rot(C) = D\n for i in (0,1,2,3) and x and y any integer.\n\n We can compute D, but we need to find x and y to see if they are integral.\n Since C and rot(C) are orthogonal, we can decompose D into components\n parellel to C and rot(C) using projection.\n\n For C and D, we have:\n\n C_x*D_x + C_y*D_y = |C| * |D| * cos(angle between C and D) (dot product)\n\n |D|*cos(angle between C and D) is the length of D projected onto C. We\n want to check if this length is divisible by |C|. In other words, we want\n to check if the dot product is divisible by |C|^2, or:\n\n C_x*D_x + C_y*D_y = 0 (mod C_x*C_x + C_y*D_y)\n\n (The case for rot(C) and D is analogous.)\n\n An important special case is that where C is the zero-vector (in that case,\n we can't project anything, but we must still check if B is zero too).\n*/\n\ntypedef long long LL;\n\ntypedef pair PII;\n\nPII read_vector() { PII v; cin >> v.first >> v.second; return v; }\nPII rot(PII v) { return PII(-v.second, v.first); } \nPII operator-(PII a, PII b) { return PII(a.first - b.first, a.second - b.second); }\nLL lensq(PII c) { return (LL)c.first*c.first + (LL)c.second*c.second; }\n\n// Can we project D onto C such that the component of D parallel to C\n// can be expressed as an integer product of C?\nbool can_project(PII D, PII C)\n{\n LL dot = (LL)B.first*C.first + (LL)B.second*C.second;\n return dot % lensq(C) == 0;\n}\n\n// Can D be expressed using integer coordinates in a coordinate system with\n// axes C and rot(C)?\nbool can_express(PII D, PII C)\n{\n if (C == PII(0, 0)) return D == PII(0, 0); // special case: C == (0,0)\n return can_project(B, C) && can_project(B, rot(C));\n}\n\nbool can(PII A, PII B, PII C)\n{\n // Try the four rotations of A:\n REP(_, 4) {\n if (can_express(B - A, C)) return true;\n A = rot(A);\n }\n return false;\n}\n\nint main()\n{\n PII A = read_vector();\n PII B = read_vector();\n PII C = read_vector();\n cout << (can(A, B, C) ? \"YES\" : \"NO\") << endl;\n}\n", "lang": "GNU C++", "bug_code_uid": "1edf2c97df46b26f3a1dd3929804f4b1", "src_uid": "cc8a8af1ba2b19bf081e379139542883", "apr_id": "8374cf4a2b6cfe5c193745c42957f8bb", "difficulty": 2000, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.1671583087512291, "equal_cnt": 13, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 13, "bug_source_code": "#include\nusing namespace std;\ntypedef long long ll;\nll Max[100005]{};\nll Min[100005];\nll arr[100005];\nint main(){\n \tint n;\n \tscanf(\"%d\",&n);\n \tfor(int i=0;iMax[i])Max[i]=t;\n \t \t \t \tif (f){Min[i]=t;f=false;}\n \t \t \t \tif (t\nusing namespace std;\n#define ll long long int\n\nvoid solve()\n{\n long long n,k;\n cin>>n>>k;\n if(n>=k) cout<<(k-1)/2<k) cout<>t;\n\n\twhile(t--){\n\t\tsolve();\n\t}\n return 0;\n}", "lang": "GNU C++14", "bug_code_uid": "c55fd8a316c3ffd9c30cbe3ba89a5dc6", "src_uid": "98624ab2fcd2a50a75788a29e04999ad", "apr_id": "fda88be6e2d552877902d0e0c7f87c99", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.05504587155963303, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "#include\n#include\nusing namespace std;\nint main()\n{\n string s;\n int x,y,k;\n cin>>s;\n scanf(\"%d\",&x);\n x=x%12;\n if(s==\"January\") y=1;\n if(s==\"February\") y=2;\n if(s==\"March\") y=3;\n if(s==\"April\") y=4;\n if(s==\"May\") y=5;\n if(s==\"June\") y=6;\n if(s==\"July\") y=7;\n if(s==\"August\") y=8;\n if(s==\"September\") y=9;\n if(s==\"October\") y=10;\n if(s==\"November\") y=11;\n if(s==\"December\") y=12;\n k=x+y;\n k=x%12;\n if(k==1)cout<<\"January\";\n if(k==2)cout<<\"February\";\n if(k==3)cout<<\"March\";\n if(k==4)cout<<\"April\";\n if(k==5)cout<<\"May\";\n if(k==6)cout<<\"June\";\n if(k==7)cout<<\"July\";\n if(k==8)cout<<\"August\";\n if(k==9)cout<<\"September\";\n if(k==10)cout<<\"October\";\n if(k==11)cout<<\"November\";\n if(k==0)cout<<\"December\";\n return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "ed8a6b8e2f1795cc47677e55c3f6cf50", "src_uid": "a307b402b20554ce177a73db07170691", "apr_id": "be7ab0aa033a753ac2051d640d86a691", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.3702213279678068, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "#include \nusing namespace std;\n#include \n#define ll unsigned long long int\nint main() {\n\tll a;\n\tcin>>a;\n\tll b=0;\n\tif(a==1) cout<\nusing namespace std;\nint main()\n{\n long long n;\n cin>>n;\n if(n==1)\n cout<<\"1\"<\n\nusing namespace std;\n\n#define lp(i,n) for(int i=0; i\n#define ff first\n#define ss second\n#define nl \"\\n\"\n\n#define EPS 1e-6\n#define OO 10000000000\n\n#define on(i,n) i=i|(1< point;\n#define X real()\n#define Y imag()\n\n#define vec(a,b) (b-a)\n#define angle(a) (atan2(a.X,a.Y))\n\n#define length(a) (hypot(a.real(),a.imag()))\n#define normalize(a) a/length(a)\n\n#define dotp(a,b) (conj(a)*b).real()\n#define crossp(a,b) (conj(a)*b).imag()\n\n#define lengthSqr(a) dp(a,a)\n\n#define rotateO(p,ang) (p*exp(point(0,ang)))\n#define rotateA(p,ang,about) (rotateO(vec(about,p),ang)+about)\n#define reflectO(v,m) (conj((v)/(m))*(m))\n\n\nconst double PI= acos(-1.0);\ndouble fixAngle(double A){return A > 1 ? 1 : (A < -1 ? -1 : A);}\ndouble dcmp(double a,double b){return fabs(a-b)b? 1:-1; }\n\n\nvector divisors[5*1000000+15];\nvoid seive(){\n \n\n for(ll i=1; i<5*1000000+10; i++){\n\n for(ll j=i+i; j<5*1000000+10; j+=i){\n (divisors[j].pb(i));\n\n }\n\n\n }\n\n\n\n}\nll mod=1000000000+7;\n\nll dp[1000000*5+5];\nll dp2[1000000*5+5];\nll solve(ll x){\n\n\n\n if(x==1) return 0;\n if(~dp[x]) return dp[x];\nll ans=(x*(x-1))/2;\n\n\n for(int i:divisors[x]){\n if(i==1 || i== x) continue;\n\n if(x%i==0){\n int t=x/i;\n\n ans=min(ans,i*(t)*(t-1)/2+ solve(t));\n }\n\n }\n\n return dp[x]=ans;\n\n\n\n\n}\n\n\nll mypow(int t, int power){\n\n if(power==1){\n return t%mod;\n\n }\n if(power==0){\n\n return 1;\n }\n if(~dp2[power]) return dp2[power];\n if(power%2==0){\n\n return dp2[power]=(mypow(t,power/2)*mypow(t,power/2))%mod;\n }\n return dp2[power]=(t*mypow(t,power-1))%mod;\n\n}\nint main(){\n\nseive();\n memset(dp,-1,sizeof dp);\n\n memset(dp2,-1,sizeof dp2);\n ll n,t;\n cin>>t;\n\n\n\n ll l,r;\n cin>>l>>r;\n\n ll ans=0;\n ll cnt=0;\n lp(i,l)solve (i);\n for(int i=l; i<=r; i++){\n\n // cout<\n\nusing namespace std;\n\n#define mp make_pair\n#define r second\n#define l first\n#define pb push_back\n#define pp pop_back\n#define khoob ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);\n#define all(x) x.begin() , x.end()\n\nlong long int km,bm,a,b,dash,mash;\nvector < long long int >va,vb;\nvector < pair < long long int , long long int > >kol;\nint bmm(long long int x,long long int y){\n if(x>y)\n swap(x,y);\n while(x!=0){\n int a=y%x;\n y=x;\n x=a;\n }\n return y;\n}\n\nvoid make_kol(){\n for(int i=a;i<=km;i+=a)\n va.pb(i);\n for(int i=b;i<=km;i+=b)\n vb.pb(i);\n while(va.size() and vb.size()){\n long long int sa=va[va.size()-1];long long int sb=vb[vb.size()-1];\n if(sa>sb){\n kol.pb(mp(sa,1));\n va.pp();\n }\n else if(sb>sa){\n kol.pb(mp(sb,2));\n vb.pp();\n }\n else if(sa==sb){\n kol.pb(mp(sa,3));\n va.pp();\n vb.pp();\n }\n }\n while(va.size()){\n kol.pb(mp(va[va.size()-1],1));\n va.pp();\n }\n while(vb.size()){\n kol.pb(mp(vb[vb.size()-1],2));\n vb.pp();\n }\n}\nint main(){\n khoob\n cin>>a>>b;\n bm=bmm(a,b);\n km=(a*b)/bm;\n make_kol();\n long long int gh=0;\n while(kol.size()){\n pair < long long int , long long int >p=kol[kol.size()-1];\n if(p.r==1)\n dash+=p.l-gh,gh=p.l;\n if(p.r==2)\n mash+=p.l-gh,gh=p.l;\n if(p.r==3){\n if(a>b)\n dash+=p.l-gh,gh=p.l;\n else\n mash+=p.l-gh,gh=p.l;\n }\n kol.pp();\n }\n if(dash > mash)\n cout<<\"Dasha\";\n else if(mash > dash)\n cout<<\"Masha\";\n else\n cout<<\"Equal\";\n\n}\n", "lang": "GNU C++", "bug_code_uid": "29d256eb9b797204889a68a28038cd03", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "apr_id": "140f35375d8b3477780d532d80cec96f", "difficulty": 1500, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.996742671009772, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \n#include\nusing namespace std;\nint main()\n{\n bool flag=false;\n char a[300];\n char b[300];\n int n;\n cin>>n;\n for(int i=0;i>a[i];\n for(int i=0;i>b[i];\n sort(a,a+n);\n sort(b,b+n);\n for(int i=0;ib[i])\n {\n flag=true;\n }\n }\n for(int i=0;i=b[i])\n break;\n else if(i==n-1&&b[i]>a[i])\n {\n flag=true;\n }\n }\nif(flag) cout<<\"YES\";\nelse cout<<\"NO\";\n}\n", "lang": "MS C++", "bug_code_uid": "8a4e8342c869b9ec12e161b95dd7012e", "src_uid": "e4419bca9d605dbd63f7884377e28769", "apr_id": "9b16947d1c5513dacf9eff537419e77d", "difficulty": 1100, "tags": ["greedy", "sortings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.4436551501453019, "equal_cnt": 22, "replace_cnt": 14, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 21, "bug_source_code": "/*\n no pain, no gain\n*/\n\n#pragma GCC optimize (\"Ofast\")\n#pragma GCC target (\"avx,avx2,fma\")\n#include \n#define fr first\n#define sc second\n#define pb push_back\n#define szof(s) (int)s.size()\n#define all(s) s.begin(), s.end()\n#define pii pair\n#define all(s) s.begin(), s.end()\n#define prev myrza4321\n#define y1 myrza1234\n#define OK puts(\"OK\")\n#define int long long\nusing namespace std;\n\nconst int N = (int)1e5 + 5;\nconst int INF = 0x3f3f3f3f;\n\nstring st, add, omg;\n\nstring dp[N];\n\nstring get(int pos) {\n dp[0] = st;\n for (int i = 1; i <= pos; i++) {\n dp[i] = \"What are you doing while sending (\" + dp[i - 1] + \")? Are you busy? Will you send (\" + dp[i - 1] + \")?\";\n dp[i - 1].clear();\n }\n}\n\nvoid solve() {\n int n, pos;\n cin >> n >> pos;\n get(n);\n if (dp[n].size() < pos) {\n omg += '.';\n } else {\n char ans = dp[n][pos - 1];\n if (ans == '(' || ans == ')') {\n ans = '\"';\n }\n omg += ans;\n }\n dp[n].clear();\n}\n\nmain() {\n st = \"What are you doing at the end of the world? Are you busy? Will you save us?\";\n add = \"What are you doing while sending ()? Are you busy? Will you send ()?\";\n omg = \"\";\n\n int Q;\n cin >> Q;\n while (Q--) {\n solve();\n }\n cout << omg;\n}\n", "lang": "GNU C++17", "bug_code_uid": "6c7e6ebeb6e8313672dbc56549dbdc47", "src_uid": "da09a893a33f2bf8fd00e321e16ab149", "apr_id": "1f237962c94f4d9ed10065eb4494b95a", "difficulty": 1700, "tags": ["math", "combinatorics", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9992652461425422, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \n#define ll long long\nusing namespace std;\nconst ll maxn=2e5+5;\nconst ll mod=998244353;\nll n,m,fac[maxn],inv[maxn],s;\n\nll pow_mod(ll a,ll b)\n{\n ll ret =1;\n while(b)\n {\n if(b&1) ret=ret*a%mod;\n a=a*a%mod;\n b>>=1;\n }\n return ret;\n}\nvoid init()\n{\n fac[0]=1;\n for(int i=1;i>n>>m;\n\tif(n==2) cout<<\"0\"<\nusing namespace std;\nint n , x1 , y11 , x2 , y2 , arr[1005][1005] , m = 1000000;\n\nint bfs()\n{\n queue >q;\n q.push(make_pair(x1,y11));\n arr[x1][y11]=0;\n while(!q.empty())\n {\n pairp=q.front();\n q.pop();\n if((p.first==0&&x2==0)||(p.first==n&&x2==n))\n {\n m= min(m, arr[p.first][p.second]+abs(p.second-y2));\n }else if((p.second==0&&y2==0)||(p.second==n&&y2==n))\n {\n m= min(m, arr[p.first][p.second]+abs(p.first-x2));\n }else\n {\n if (p.first==n||p.first==0) {\n \tif (!arr[p.first][0])\n {\n arr[p.first][0]=arr[p.first][p.second]+p.second;\n \t\tq.push (make_pair(p.first,0));\n }\n if (!arr[p.first][n])\n {\n arr[p.first][n]=arr[p.first][p.second]+n-p.second;\n q.push (make_pair(p.first,n));\n }\n }\n\n if (p.second==n||p.second==0) {\n \tif (!arr[0][p.second])\n {\n arr[0][p.second]=arr[p.first][p.second]+p.first;\n \t\tq.push (make_pair(0,p.second));\n }\n if (!arr[n][p.second])\n {\n arr[n][p.second]=arr[p.first][p.second]+n-p.first;\n q.push (make_pair(n,p.second));\n }\n }\n\n\n\n }\n\n }\n\n}\n int main()\n{\n ios::sync_with_stdio(false) ;\n cin.tie(0);\n cin>>n>>x1>>y11>>x2>>y2;\n if((x1==0&&x2==0)||(x1==n&&x2==n))\n {\n cout<\n#define ll long long\n#define ld long double\n#define mod 1000000007\n#define MAXR 1000005\n#define pb push_back\n#define all(c) (c).begin(),(c).end()\n#define allr(c) (c).rbegin(),(c).rend()\n#define ios ios_base::sync_with_stdio(false)\nusing namespace std;\nll gcd(ll a, ll b)\n{\n if (b == 0)\n return a;\n return gcd(b, a % b);\n\n}\nvoid solve()\n{\nll a,b,c;\ncin>>a>>b>>c;\nll x,y,z,ex=0;\ncin>>x>>y>>z;\nif(a>x)\n ex+=(a-x);\nif(b>y)\n ex+=(b-y);\nif(c>z)\n ex+=(c-z);\nll re=0;\nif(x>a)\n re+=(x-a);\nif(y>b)\n re+=(y-b);\nif(z>c)\n re+=(z-c);\nif(ex/2>=re)\n cout<<\"Yes\";\nelse\n cout<<\"No\";\n}\nint main()\n{\n ios;\n ll t;t=1;\n while(t--)\n {\n solve();\n }\n}\n", "lang": "GNU C++17", "bug_code_uid": "d369b2b5d5734c316af22a894daef29e", "src_uid": "1db4ba9dc1000e26532bb73336cf12c3", "apr_id": "be32a747d9173f5a1cffb27c8ae0667f", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.5810055865921788, "equal_cnt": 12, "replace_cnt": 4, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 11, "bug_source_code": "#include \n\n\nusing namespace std;\nint a[1000005];\nint main()\n{int n,i,k;\n cin>>n;\n i=1;\n k=1;\n while(i<=n)\n {\n a[i]=k;\n a[i+1]=k;\n a[i+2]=k+1;\n i=i+3;\n k=k+2;\n }\n\n\n cout<\n#include\nusing namespace std;\nlong long i,j,k,n,a[4][4],f[50][4][4];\nint main()\n{\n for (i=1;i<=3;i++)\n\t for (j=1;j<=3;j++)\n\t\t cin>>a[i][j];\n\tcin>>n;\n\tfor (k=1;k<=n;k++)\n\t for (i=1;i<=3;i++)\n\t for (j=1;j<=3;j++)\n\t f[k][i][j]=1000000000001;\n\tf[1][1][2]=min(a[1][2],a[1][3]+a[3][2]);\n\tf[1][1][3]=min(a[1][3],a[1][2]+a[2][3]);\n\tf[1][2][1]=min(a[2][1],a[2][3]+a[3][1]);\n\tf[1][2][3]=min(a[2][3],a[2][1]+a[1][3]);\n\tf[1][3][1]=min(a[3][1],a[3][2]+a[2][1]);\n\tf[1][3][2]=min(a[3][2],a[3][1]+a[1][2]);\n\tfor (k=2;k<=n;k++)\n\t{\n\t for (i=1;i<=3;i++)\n\t for (j=1;j<=3;j++)\n\t if (i!=j)\n\t \tf[k][i][j]=min(2*f[k-1][i][j]+a[i][6-i-j]+f[k-1][j][i]+a[k][j],f[k-1][i][6-i-j]+f[k-1][6-i-j][j]+a[i][j]);\n\t for (i=1;i<=3;i++)\n\t for (j=1;j<=3;j++)\n\t f[k][i][j]=min(f[k][i][j],f[k][i][6-i-j],f[k][6-i-j][j]);\n\t}\n\tcout<\n#include \n#define N 1510\nusing namespace std;\ntypedef long long LL;\n\nstruct Node {\n LL to, nxt;\n}e[N << 1];\n\nstruct Point {\n LL x, y, id;\n}p[N], pp[N], poi;\n\nLL cnt, n, lst[N], ans[N], size[N];\n\nbool cmp(Point a, Point b) {//\u6309\u6781\u89d2\u6392\u5e8f\n LL ax = a.x - poi.x, ay = a.y - poi.y, bx = b.x - poi.x, by = b.y - poi.y;\n if (ax >= 0 && bx <= 0) return 1;\n if (ax <= 0 && bx >= 0) return 0;\n return (ax * by > bx * ay);\n}\n\ninline void add(LL u, LL v) {\n e[++cnt].to = v;\n e[cnt].nxt = lst[u];\n lst[u] = cnt;\n}\n\nvoid predfs(LL x, LL fa) {//\u9884\u5904\u7406\u51fa\u5b50\u6811\u5927\u5c0f\n size[x] = 1;\n for (int i = lst[x]; i; i = e[i].nxt) {\n if (e[i].to == fa) continue;\n predfs(e[i].to, x);\n size[x] += size[e[i].to];\n }\n}\n\nvoid dfs(LL l, LL r, LL x, LL fa)//\u5bf9\u533a\u95f4\u8fdb\u884c\u5206\u6cbb\n LL mini = l;\n for (int i = l + 1; i <= r; ++i)\n if (p[i].y < p[mini].y || p[i].y == p[mini].y && p[i].x < p[mini].x) mini = i;\n swap(p[l], p[mini]);\n ans[p[l].id] = x;\n poi = p[l];\n sort(p + l + 1, p + r + 1, cmp);\n LL now = l + 1;\n for (LL i = lst[x]; i; i = e[i].nxt) {\n if (e[i].to == fa) continue;\n dfs(now, now + size[e[i].to] - 1, e[i].to, x);\n now += size[e[i].to];\n }\n}\n\nint main() {\n scanf(\"%lld\", &n);\n for (LL i = 1; i < n; ++i) {\n LL a, b;\n scanf(\"%lld%lld\", &a, &b);\n add(a, b);\n add(b, a);\n }\n for (LL i = 1; i <= n; ++i) {\n scanf(\"%lld%lld\", &p[i].x, &p[i].y);\n p[i].id = i;\n }\n predfs(1, 1);\n dfs(1, n, 1, 1);\n for (LL i = 1; i < n; ++i) {\n printf(\"%lld \", ans[i]);\n }\n printf(\"%lld\\n\", ans[n]);\n return 0;\n}//", "lang": "GNU C++14", "bug_code_uid": "b143acc3b11a5b78971529dad103d68d", "src_uid": "d65e91dc274c6659cfdb50bc8b8020ba", "apr_id": "e97a92d79e91f45d8edc61d288ed5709", "difficulty": 2200, "tags": ["trees", "dfs and similar", "geometry", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9537945894182428, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "#include \nusing namespace std;\n\n#define ms(s, n) memset(s, n, sizeof(s))\n#define FOR(i, a, b) for(int i = (a); i < (b); i++)\n#define FORd(i, a, b) for(int i = (a) - 1; i >= (b); i--)\n#define rep(i, a, b) for(int i = (a); i < (b); i++)\n#define sz(a) int((a).size())\n#define all(a) (a).begin(), (a).end()\n#define pb push_back\n#define mp make_pair\n#define fi first\n#define se second\ntypedef long long ll;\ntypedef unsigned long long ull;\ntypedef long double ld;\ntypedef pair pi;\ntypedef vector vi;\ntypedef vector vii;\ntypedef pair lll;\nll gcd(ll a, ll b) {ll r; while (b != 0) {r = a % b; a = b; b = r;} return a;}\nll lcm(ll a, ll b) {return a / gcd(a, b) * b;}\n#define EPS 1e-9\nconst int mod = (int) 1e9 + 7;\nconst int INF = (int) 1e9;\nconst ll LINF = (ll) 1e18;\nconst ld PI = 2 * acos(0);\nconst int M = 50;\nconst int N = 1e6 + 7;\n\n\nll pw(ll x, ll k){\n if (!k) return 1;\n if (k & 1) return x * pw(x, k - 1) % mod;\n ll t = pw(x, k / 2);\n return t * t % mod;\n}\n\n\nll get(ll x, ll k, ll n){\n if (!k) return 1 % n;\n if (k & 1) return x * get(x, k - 1, n) % n;\n ll t = get(x, k >> 1, n);\n return t * t % n;\n}\n\nint n, k;\nint a[N];\nint check[N];\n\n\n\nvoid solve() {\n cin >> n >> k;\n if (k == 0){\n cout << pw(k, k - 1);\n return;\n }\n if (k == 1){\n cout << pw(k, k);\n return;\n }\n for(int d = 0; d < n; d++){\n a[d] = (ll) d * k % n;\n }\n ll ans = 1;\n for(int d = 0; d < n; d++)\n if (!check[d]){\n check[d] = 1;\n d = a[d];\n int cnt = 1;\n while (!check[d]){\n d = a[d];\n cnt++;\n }\n if (get(k, cnt, n) == 1){\n ans = (ans * n) % mod;\n }\n }\n cout << ans;\n\n}\n\nint main() {\n //ios_base::sync_with_stdio(0); cin.tie(NULL);\n#ifndef ONLINE_JUDGE\n freopen(\"in.txt\", \"r\", stdin); //freopen(\"out.txt\", \"w\", stdout);\n#endif\n\n solve();\n#ifdef _LOCAL_\n //printf(\"\\nTime elapsed: %dms\", 1000 * clock() / CLOCKS_PER_SEC);\n#endif\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "b21dab3663e5eda20fba765dc353d6ad", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "apr_id": "f788802accfd3fb1a017fe28bc86710f", "difficulty": 1800, "tags": ["combinatorics", "dfs and similar", "number theory", "dsu", "math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.4, "equal_cnt": 13, "replace_cnt": 6, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 12, "bug_source_code": "#include\nusing namespace std;\n\nint main(){\n int a,b,contador=0;\n cin>>a>>b;\n for (int i = 1;i<=(a/2);i++){\n for(int h=1;h<=(a/2);h++){\n if ((i*h) == b){\n contador += 1;\n break;\n }\n }\n }\n cout<\nusing namespace std;\nint main()\n{\n int m, n;\n bool r = false;\n cin >> n >> m;\n int x = n*m;\n int k = n*m;\n int count = 0;\n while (k%10==0)\n {\n count++;\n k /= 10;\n }\n if ((x % (count*10)) == 0 && (x / (count*10)) % 2 != 0)\n r = false;\n else if (x == 2)\n r = false;\n else if (x % 2 == 0)\n r = true;\n if (r == true)\n cout << \"Malvika\" << endl;\n else cout << \"Akshat\" << endl;\n return 0;\n}", "lang": "GNU C++", "bug_code_uid": "86e10124ddf651a0f3360bb32384cb9b", "src_uid": "a4b9ce9c9f170a729a97af13e81b5fe4", "apr_id": "baaec1730e87438812ff8af9cb7354b4", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.37493472584856397, "equal_cnt": 13, "replace_cnt": 11, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 13, "bug_source_code": "#include\nusing namespace std;\n#include \n#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);\n#define endl \"\\n\"\n#define int long long int\n#define mod 1000000007\n#define INT_BITS 16\n#define inf 1000000099\n#define watch(x) cout<<(#x)<<\"=\"<<(x)<<\"\\n\" \n \n\n\n void solve(vector>& A)\n {\n \n }\n \n \n \nint32_t main()\n{\n int a,b,c,d;\n cin>>a>>b>>c>>d;\n int sum=0;\n std::vector v;\n for (int i = a; i <=b; ++i)\n {\n for(int j=b;j<=c;j++)\n v.push_back(i+j);\n /* code */\n }\n sort(v.begin(),v.end());\n for (int i = c; i <=d ; ++i)\n {\n for(int j=0;ji)\n {\n sum+=(v.size()-j);\n break;\n }\n }\n /* code */\n }\n cout<\nusing namespace std;\n#define print_vec(vec) \\\n for (auto jkj : vec) \\\n { \\\n cout << jkj << \" \"; \\\n } \\\n { \\\n cout << endl; \\\n }\n#define dbg(num) cout << #num << \": \" << num << endl;\n#define pb push_back\n#define fi first\n#define se second\n#define MP make_pair\n\ntypedef long long ll;\n\nbool in(ll key, vector &arr)\n{\n for (auto a : arr)\n if (a == key)\n return true;\n return false;\n}\n\nint main()\n{\n ios::sync_with_stdio(0);\n cin.tie(0);\n ll n, a, b, temp;\n cin >> n;\n int arr[] = {1,5,10,20,100};\n if(n%100==0)\n {\n cout << n/100 << '\\n';return 0;\n }\n vector v(n+1,INT64_MAX);v[0]=0;\n for(ll i=1;i<=n;i++)\n {\n for(int j=0;j<5;j++)\n {\n if(arr[j]<=i)\n {\n v[i] = min(v[i-arr[j]]+1,v[i]);\n }\n }\n }\n\n cout << v[n] << '\\n';\n\n return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "18d06a21f5218179a8bad6089f35bb75", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "apr_id": "c37c769f1153360d677bb52649ae6569", "difficulty": 800, "tags": ["dp", "greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7159135559921415, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\npair P[100005];\nset X[100005], Y[100005];\nint CC;\nconst int mod = 1e9 + 7;\nbool V[100005];\nint sz[100005];\nvector E[100005];\nint pwr[100005] = {1};\nvoid dfs(int i) {\n\tV[i] = 1, ++sz[CC];\n\tX[CC].insert(P[i].first);\n\tY[CC].insert(P[i].second);\n\tfor(auto x : E[i])\n\t\tif(!V[x])\n\t\t\tdfs(x);\n}\nint main() {\n\tios::sync_with_stdio(0); cin.tie(0);\n\tfor(int i = 1; i < 100005; ++i)\n\t\tpwr[i] = pwr[i-1] * 2 % mod;\n\tint n;\n\tcin >> n;\n\tfor(int i = 0; i < n; ++i) {\n\t\tcin >> P[i].first >> P[i].second;\n\t\tfor(int j = 0; j < i; ++j)\n\t\t\tif(P[i].first == P[j].first or P[i].second == P[j].second)\n\t\t\t\tE[i].push_back(j), E[j].push_back(i);\n\t}\n\tfor(int i = 0; i < n; ++i)\n\t\tif(!V[i])\n\t\t\tdfs(i), ++CC;\n\tlong long ans = 1;\n\tfor(int i = 0; i < CC; ++i)\n\t\tans = (ans * (pwr[X[i].size() + Y[i].size()] - (X[i].size() + Y[i].size() == sz[i] + 1))) % mod;\n\tcout << (ans + mod) % mod << endl;\n\treturn 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "0b14d5e44cf9f57638afa603e252967b", "src_uid": "8781003d9eea51a509145bc6db8b609c", "apr_id": "f85c1991122bbe7e681846f51ea91db9", "difficulty": 2300, "tags": ["graphs", "trees", "dfs and similar", "dsu"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7516778523489933, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\n\nint main() {\n\tint n, m, z;\n\tscanf(\"%d%d%d\", &n, &m, &z);\n\tif (max(n, m) % min(n, m)) printf(\"%d\", z / (n * m));\n\telse printf(\"%d\", z / max(n, m));\n\treturn 0;\n}\n", "lang": "MS C++ 2017", "bug_code_uid": "e079879f88df0f8a206cdd7c206047f9", "src_uid": "e7ad55ce26fc8610639323af1de36c2d", "apr_id": "1c5cbe2e489341cdb47f2b4c48d10acc", "difficulty": 800, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8098637248539909, "equal_cnt": 13, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "/**\n $$ $$ $$$$$ $$ $$ $$$$\n $$ $$ $$ $$ $$ $$ $$\n $$$$$$ $$$$ $$ $$ $$ $$\n $$ $$ $$ $$ $$ $$ $$\n $$ $$ $$$$$ $$$$$$ $$$$$$ $$$$\n\n $$ $$ $$$$ $$$$$ $$ $$$$$ $$$ $$$ $$$\n $$ $$ $$ $$ $$ $$ $$ $$ $$ $$$ $$$ $$$\n $$ $ $$ $$ $$ $$$$$ $$ $$ $$ $$$ $$$ $$$\n $$$$$$$ $$ $$ $$ $$ $$ $$ $$\n $$ $$ $$$$ $$ $$ $$$$$$ $$$$$ $$$ $$$ $$$\n Made by Adlet_Zeineken.\n All rights reserved(2015 - 2017)\n\n\n*/\n\n#include \n\nusing namespace std;\n\ntypedef unsigned long long ull;\ntypedef long long ll;\ntypedef pair < int, int > pii;\ntypedef pair < ll, ll> pll;\n\n#define sz(s) s.size()\n#define all(s) s.begin(), s.end()\n#define rs(s) reverse(all(s))\n#define sr(s) sort(all(s))\n#define alr(a, n) a + 1, a + n + 1\n#define ar(a, n) sort(alr(a, n))\n#define ra(a, n) reverse(alr(a, n))\n\nconst int N3 = 1e3 + 15;\nconst int N4 = 1e4 + 15;\nconst int N5 = 1e5 + 15;\nconst int N6 = 1e6 + 15;\nconst int N7 = 1e7 + 15;\nconst int N8 = 1e8 + 15;\nconst int N9 = 1e9 + 15;\nconst double pi = acos(-1.0);\n\n#define _49_days \"\"\n\nint n, m, d, x;\n\nmain()\n{\n cin >> m >> d;\n int x = 28 + (x + x / 8) % 2 + 2 % x + 1 / x * 2;\n if (d != 7)\n cout << (x - (x % 7)) / 7 + 1;\n else\n cout << (x / 7) + 2;\n}\n", "lang": "GNU C++11", "bug_code_uid": "e1c27272a1e8c9489e61d6c5c581b49d", "src_uid": "5b969b6f564df6f71e23d4adfb2ded74", "apr_id": "b4277e351906dce98671e7caad1a4d10", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.3586800573888092, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "#include \nusing namespace std;\n#define ll unsigned long long int\nint main()\n{\n ll n;cin >> n;\n ll res = 1;\n\n for(int i = 0;i < n;i++)\n {\n res = ((res % 100) * (5 % 100))% 100;\n }\n cout << res << endl;\n}\n", "lang": "MS C++ 2017", "bug_code_uid": "0ee8ed24c13283c311fab0d59ad1c9c1", "src_uid": "dcaff75492eafaf61d598779d6202c9d", "apr_id": "4d0a6184e55919b4c7475f540a6e5c71", "difficulty": 800, "tags": ["number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7478260869565218, "equal_cnt": 8, "replace_cnt": 0, "delete_cnt": 7, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "#include \n\nusing namespace std;\n\nint main()\n{\n\tint n, m, k;\n\twhile (true)\n\t{\n\t\tcin >> n >> m >> k;\n\t\tif (n <= m && n <= k)\n\t\t{\n\t\t\tcout << \"Yes\" << endl;\n\t\t}\n\t\telse if (n > m || n > k)\n\t\t\tcout << \"No\" << endl;\n\t}\n}", "lang": "MS C++ 2017", "bug_code_uid": "1ef177883856428ef3be0c76b941669e", "src_uid": "6cd07298b23cc6ce994bb1811b9629c4", "apr_id": "5131c39b7657a643f59df4ac1072a473", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.6628787878787878, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "#include \nusing namespace std;\n\nint main(){\n ios_base::sync_with_stdio(false);\n cin.tie(NULL); cout.tie(NULL);\n int N, K; cin >> N >> K;\n int l = K-1, r = N-K;\n if(l == 0 || r == 0){\n cout << 3 + 3*max(l, r);\n return 0;\n }\n cout << 6 + 3*min(l, r) + 2*max(l, r);\n}", "lang": "GNU C++17", "bug_code_uid": "c8d90278692129402b25375eb3e4ad98", "src_uid": "24b02afe8d86314ec5f75a00c72af514", "apr_id": "54f3e2685f5259ea28249f429ecca058", "difficulty": 1000, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.494949494949495, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "#include \nusing namespace std;\ntypedef long long int ll;\n#define F(i,n) for(int i=0;i=m;i--)\n#define cases ll t;cin>>t;while(t--)\nint main()\n{\n cases\n {\n ll a ,b,c,ans=0;\n cin >> a >> b >>c;\n vector arr,brr;\n G(i,b,a-1)\n {\n arr.push_back(i);\n }\n H(i,c,0)\n {\n brr.push_back(i);\n }\n F(i,arr.size())\n {\n F(j,brr.size())\n {\n if(arr[i]+brr[j]==a-1) ans++;\n }\n }\n cout <\n#include \nusing namespace std;\nint main()\n{\n\tint y, w, c = 0;\n\tcin >> y >> w;\n\tif (y == w) cout << 1 << \"/\" << 1;\n\tif (y == 6 || w == 6) cout << 0 << \"/\" << 1;\n\telse {\n\t\tif (y > w) {\n\t\t\tfor (int i = y; i <= 6; i++) {\n\t\t\t\tif (i >= y)\n\t\t\t\t\tc++;\n\t\t\t}\n\t\t}\n\t\telse if (w > y) {\n\t\t\tfor (int i = w; i <= 6; i++) {\n\t\t\t\tif (i >= w)\n\t\t\t\t\tc++;\n\t\t\t}\n\t\t}\n\t\tif (c != 0) {\n\t\t\tif (6 % c == 0) {\n\t\t\t\tint a;\n\t\t\t\ta = c / c;\n\t\t\t\tcout << a << \"/\" << (6 / c);\n\t\t\t}\n\t\t}\n\t\telse if(6%c!=0)\n\t\tcout << c << \"/\" << 6;\n\t}\n}", "lang": "GNU C++17", "bug_code_uid": "d24b13b0c87b9dd88c269b93d5b6e598", "src_uid": "f97eb4ecffb6cbc8679f0c621fd59414", "apr_id": "009fa856ab362dd41756349726059ec4", "difficulty": 800, "tags": ["probabilities", "math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9626955475330926, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "#include \n#include \nusing namespace std; \n \n#define LL long long \n#define mod 1000000009 \n \n \nint C[N][N]; \nint f[N]; \n \nvoid init() { \n for(int i = 0; i < N; ++i) { \n C[i][0] = C[i][i] = 1; \n for(int j = 1; j < i; ++j) { \n C[i][j] = C[i-1][j-1] + C[i-1][j]; \n if(C[i][j] >= mod) C[i][j] -= mod; \n } \n } \n f[0] = 1; \n for(int i = 1; i < N; ++i) f[i] = 1LL * f[i-1] * i % mod; \n} \n \nint n, w, b; \n \nint main() { \n init(); \n cin >> n >> w >> b; \n int ans = 0; \n for(int i = 1; i <= w - 1; ++i) { \n ans += 1LL * C[w+b-3][n-3] * C[w][i] % mod * f[i] % mod * f[b] % mod * f[w-i] % mod; \n if(ans >= mod) ans -= mod; \n } \n cout << ans << endl; \n return 0; \n} ", "lang": "GNU C++", "bug_code_uid": "3c8878a9d06e8e09af446a4d1ced2b76", "src_uid": "63e93a161bbff623323e66c98d5e20ac", "apr_id": "150ce9107406a8092679618464e44a82", "difficulty": 2100, "tags": ["combinatorics", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.2010502625656414, "equal_cnt": 16, "replace_cnt": 11, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 16, "bug_source_code": "#include \n\nusing namespace std;\n#define pii pair\nint fx[]={1,-1,0,0};\nint fy[]={0,0,1,-1};\nint cell[210][210];\nint d[210][210];\nbool vis[210][210];\nint aa;\nint bb;\n\nint bfs(int sx,int sy)\n{\n\tmemset(vis,0,sizeof vis);\n\tvis[sx][sy]=1;\n\tqueueq;\n\tq.push(pii(sx,sy));\n\twhile(!q.empty())\n\t{\n\t\tpii top=q.front(); q.pop();\n\t\tfor(int k=0;k<4;k++)\n\t\t{\n\t\t\tint tx=top.first+fx[k];\n\t\t\tint ty=top.second+fy[k];\n\t\t\tif(tx>=0 and ty>=0 and vis[tx][ty]==0)\n\t\t\t\tvis[tx][ty]=1;\n\t\t\t\td[tx][ty]=d[top.first][top.second]+1;\n\t\t\t\tif(tx==aa && ty==bb) return d[aa][ty];\n\t\t\t\tq.push(pii(tx,ty));\n\t\t\t}\n\t\t}\n}\nint main()\n{\n int a , b ;\n cin>>a>>b;\n a+=100;\n b+=100;\n cin>>aa>>bb;\n aa+=100;\n bb+=100;\n if(aa!=a && bb!=b ){\n cout<<2*(bfs(a,b)+2);\n }\n else\n{\n cout<\n#define ll long long \n#define For(i,n) for(i= 1;i0){\n\t\tans+= n%10;\n\t\tn=n/10;\n\t}\n\treturn ans;\n}\nint main(int argc, char const *argv[])\n{\n\tll i,k;\n\tll n,l,j=1;\n\tn = 100000000;\n\tFor(i,n){\n\t\tl = sumofdigits(i);\n\t\tif(l==10){\n\t\t\tdp[j] = i;\n\t\t\tj++;\n\t\t}\n\t}\n\tcin>>k;\n\tcout<\n#define REP(i,n)\tfor(auto i=decltype(n)(0); i<(n); ++i)\n#define all(v)\t\tbegin(v), end(v)\nusing namespace std;\t\tusing ull= unsigned long long;\nusing ll = long long;\t\tusing ld = long double;\nusing vi = vector;\t\tusing vvi= vector;\nusing vb = vector;\tusing ii = pair;\nconstexpr bool LOG = false;\nvoid Log() { if(LOG) cerr << \"\\n\"; }\ntemplate void Log(T t, S... s){\n\tif(LOG) cerr << t << \"\\t\", Log(s...);\n} /* ============== END OF HEADER ============== */\n\n\nll gcd(ll a, ll b) { while (b) { a %= b; swap(a, b); } return a; }\nll lcm(ll a, ll b) { return (a / gcd(a, b)) * b;\t\t\t\t }\nll mod(ll a, ll b) { return ((a % b) + b) % b;\t\t\t\t }\n\n// Finds x, y s.t. ax + by = d = gcd(a, b).\nvoid extended_euclid(ll a, ll b, ll &x, ll &y, ll &d) {\n\tll xx = y = 0;\n\tll yy = x = 1;\n\twhile (b) {\n\t\tll q = a / b;\n\t\tll t = b; b = a % b; a = t;\n\t\tt = xx; xx = x - q * xx; x = t;\n\t\tt = yy; yy = y - q * yy; y = t;\n\t}\n\td = a;\n}\n\n// solves ab = 1 (mod n), -1 on failure\nll mod_inverse(ll a, ll n) {\n\tll x, y, d;\n\textended_euclid(a, n, x, y, d);\n\treturn (d > 1 ? -1 : mod(x, n));\n}\n\n// (a*b)%m\nll mulmod(ll a, ll b, ll m){\n\tll x = 0, y=a%m;\n\twhile(b>0){\n\t\tif(b&1)\n\t\t\tx = (x+y)%m;\n\t\ty = (2*y)%m;\n\t\tb/=2;\n\t}\n\treturn x % m;\n}\n\nll pow(ll b, ll e) {\t\t// b^e in logarithmic time\n\tll p = e<2 ? 1 : pow(b*b,e/2);\n\treturn e&1 ? p*b : p;\n}\n\n// Finds b^e % m in O(lg n) time, ensure that b < m to avoid overflow!\nll powmod(ll b, ll e, ll m) {\n\tll p = e<2 ? 1 : powmod((b*b)%m,e/2,m);\n\treturn e&1 ? p*b%m : p;\n}\n\n// Solve ax + by = c, returns false on failure.\nbool linear_diophantine(ll a, ll b, ll c, ll &x, ll &y) {\n\tll d = gcd(a, b);\n\tif (c % d) {\n\t\treturn false;\n\t} else {\n\t\tx = c / d * mod_inverse(a / d, b / d);\n\t\ty = (c - a * x) / b;\n\t\treturn true;\n\t}\n}\n\n// Solves x = a1 mod m1, x = a2 mod m2, x is unique modulo lcm(m1, m2).\n// Returns {0, -1} on failure, {x, lcm(m1, m2)} otherwise.\npair crt(ll a1, ll m1, ll a2, ll m2) {\n\tll s, t, d;\n\textended_euclid(m1, m2, s, t, d);\n\tif (a1 % d != a2 % d) return {0, -1};\n\treturn {mod(s * a2 * m1 + t * a1 * m2, m1 * m2) / d, m1 / d * m2};\n}\n\n// Solves x = ai mod mi. x is unique modulo lcm mi.\n// Returns {0, -1} on failure, {x, lcm mi} otherwise.\npair crt(vector &a, vector &m) {\n\tpair res = {a[0], m[0]};\n\tfor (ull i = 1; i < a.size(); ++i) {\n\t\tres = crt(res.first, res.second, mod(a[i], m[i]), m[i]);\n\t\tif (res.second == -1) break;\n\t}\n\treturn res;\n}\n\n\nll SIZE;\nvector bs;\nvector primes;\n\nvoid sieve(ll size = 1e6+10) { // call at start in main!\n\tSIZE = size; bs.assign(SIZE+1,1);\n\tbs[0] = bs[1] = 0;\n\tfor (ll i = 2; i <= SIZE; i++) if (bs[i]) {\n\t\tfor (ll j = i * i; j <= SIZE; j += i) bs[j] = 0;\n\t\tprimes.push_back(i);\n\t}\n}\n\nbool is_prime(ll n) { // for N <= SIZE^2\n\tif (n <= SIZE) return bs[n];\n\tfor(const auto &prime : primes)\n\t \tif (n % prime == 0) return false;\n\treturn true;\n}\n\nstruct Factor{ll prime; ll exp;}; using Fs = vector;\nFs factor(ll n) {\n\tFs factors;\n\tfor(const auto &prime : primes){\n\t\tif(n==1 || prime*prime > n) break;\n\t\tll exp=0;\n\t\twhile(n % prime == 0)\n\t\t \tn/=prime, exp++;\n\t\tif(exp>0)\n\t\t\tfactors.push_back({prime,exp});\n\t}\n\tif (n != 1) factors.push_back({n,1});\n\treturn factors;\n}\n\nconstexpr ll M = 1e9+7;\n\nstruct S{\n\tll div, children, divsum, x;\n};\nvector divisors(const Fs &fs){\n\tvector ds{{1,1,1,0}}; // pair\n\tds.reserve(accumulate(fs.begin(),fs.end(),1, [](ll a,auto f){return a*(f.exp+1);}));\n\tfor(auto f : fs)\n\t\tfor(auto d : ds){\n\t\t\tll sumpow = 1;\n\t\t\tll pow = 1;\n\t\t\tfor(ll i = 0; i < f.exp; ++i){\n\t\t\t\tpow *= f.prime;\n\t\t\t\tsumpow += pow;\n\t\t\t\tds.push_back({d.div*pow, d.children*(i+2), d.divsum * sumpow,0});\n\t\t\t}\n\t\t}\n\treturn ds;\n}\n\n\nvi fac;\n\nll binom(ll a, ll b){\n\tll ans;\n\tif(b <0 || b>a) ans=0;\n\telse ans = fac[a] * mod_inverse(fac[b] * fac[a-b] % M, M) %M;\n\tLog(\"binom\",a,b,ans);\n\treturn ans;\n}\n\nint main(){\n\tios_base::sync_with_stdio(false); cin.tie(nullptr);\n\n\tsieve();\n\n\tfac.resize(1000001);\n\tfac[0] = 1;\n\tREP(i,1000000)\n\t\tfac[i+1] = (i+1)*fac[i] % M;\n\n\tll n,k,q; cin >> n >> k >> q;\n\tvi div(1000001,0);\n\n\tll ans = 0;\n\tREP(i,n+q){\n\t\tll c; cin >> c;\n\t\tLog(\"read \",c);\n\t\tauto fs = factor(c);\n\t\tauto divs = divisors(fs);\n\t\tLog(\"divisors, divsum,children\");\n\t\tfor(auto x : divs){\n\t\t\tLog(x.div, x.divsum, x.children);\n\t\t}\n\n\n\t\tfor(auto it=divs.rbegin(); it!=divs.rend(); ++it){\n\t\t\tll val = it->div;\n\t\t\tll children = it->children;\n\t\t\tll divsum = it->divsum;\n\t\t\tLog(\"val\",val, \"children\",children,\"div\",div[val]);\n\t\t\tll a = binom(div[val],k-1);\n\t\t\tll b = a - it->x;\n\t\t\t// add for current\n\t\t\tans += val*b%M;\n\t\t\tLog(a, b, \"add\", val*b);\n\t\t\t//ans -= (divsum-val)*a%M;\n\t\t\tfor(ll i = 0; divs[i].div != val; ++i)\n\t\t\t\tif(val % divs[i].div == 0)\n\t\t\t\t\tdivs[i].x += b;\n\n\t\t\t++div[val];\n\t\t}\n\n\t\tLog(\"ANS:\");\n\t\tif(i>=n)\n\t\t\tcout << ans << \"\\n\";\n\n\t}\n\n\treturn 0;\n}\n\n\n", "lang": "GNU C++11", "bug_code_uid": "e994294221580ada21ecb58954937de2", "src_uid": "edf8b780f4e3c610fd6a5ba041a7799c", "apr_id": "936c40221f79b250601b781a1a72f9c7", "difficulty": 2500, "tags": ["combinatorics", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.6899210574628236, "equal_cnt": 23, "replace_cnt": 9, "delete_cnt": 8, "insert_cnt": 6, "fix_ops_cnt": 23, "bug_source_code": "\n#include \n#define int long long\n#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; ++i)\n#define FORD(i,a,b) for(int i=(a),_b=(b); i>=_b; --i)\n#define REP(i,a) for(int i=0,_a=(a); i < _a; ++i)\n\n#define DEBUG(X) { cout << #X << \" = \" << (X) << endl; }\n#define PR(A,n) { cout << #A << \" = \"; FOR(_,1,n) cout << A[_] << ' '; cout << endl; }\n#define PR0(A,n) { cout << #A << \" = \"; REP(_,n) cout << A[_] << ' '; cout << endl; }\n\n#define sqr(x) ((x) * (x))\n#define ll long long\n#define SZ(x) ((int) (x).size())\n#define div div____\nusing namespace std;\n\nconst int MN = 2000111;\nint n, k, q;\nint a[MN], sieve[MN];\n\nvoid init() {\n FOR(i,2,1000) if (!sieve[i]) {\n for(int j = i*i; j < MN; j += i)\n sieve[j] = i;\n }\n}\n\nint dp[111], dk[111];\nvector div;\nvoid attempt(int i, int nd, int prod) {\n if (i > nd) {\n div.push_back(prod);\n return ;\n }\n int cur = 1;\n FOR(power,0,dk[i]) {\n attempt(i+1, nd, prod * cur);\n cur *= dp[i];\n }\n}\nvector divisors(int x) {\n int nd = 0;\n while (x > 1) {\n int p = (sieve[x] ? sieve[x] : x);\n ++nd;\n dp[nd] = p;\n dk[nd] = 0;\n while (x % p == 0) {\n x /= p;\n ++dk[nd];\n }\n }\n div.clear();\n attempt(1, nd, 1);\n return div;\n}\n\nconst int MOD = 1e9 + 7;\nint res[MN];\nvector ls[MN];\n\nvoid resetAll() {\n memset(res, 0, sizeof res);\n REP(i,MN) ls[i].clear();\n}\n\nint add[MN], gt[MN], inv_gt[MN];\n\nint power(int x, int k) {\n if (k == 0) return 1;\n if (k == 1) return x % MOD;\n\n int mid = power(x, k >> 1);\n mid = mid * mid % MOD;\n\n if (k & 1) return mid * x % MOD;\n return mid;\n}\nint inverse(int x) {\n return power(x, MOD - 2);\n}\n\nint C(int n, int k) {\n return gt[n] * inv_gt[k] % MOD * inv_gt[n-k] % MOD;\n}\n\n#undef int\nint main() {\n#define int long long\n ios :: sync_with_stdio(0); cin.tie(0);\n init();\n\n gt[0] = 1; FOR(i,1,MN-1) gt[i] = gt[i-1] * i % MOD;\n REP(i,MN) inv_gt[i] = inverse(gt[i]);\n\n while (scanf(\"%lld%lld%lld\", &n, &k, &q) == 3) {\n FOR(i,1,n+q) scanf(\"%lld\", &a[i]);\n resetAll();\n\n FOR(i,1,n+q) {\n auto d = divisors(a[i]);\n for(int x : d) {\n ls[x].push_back(i);\n }\n }\n FOR(g,1,1000*1000) {\n add[g] = g;\n auto d = divisors(g);\n for(int x : d) if (x < g) {\n add[g] = add[g] - add[x];\n }\n\n FOR(i,k-1,SZ(ls[g])-1) {\n int u = ls[g][i];\n res[u] = (res[u] + C(i, k-1) * add[g]) % MOD;\n }\n }\n FOR(i,1,n+q) {\n res[i] = (res[i-1] + res[i]) % MOD;\n }\n FOR(i,n+1,n+q) printf(\"%lld\\n\", res[i]);\n }\n}\n", "lang": "GNU C++11", "bug_code_uid": "a7858b95dea32745e5e501385fa51d4c", "src_uid": "edf8b780f4e3c610fd6a5ba041a7799c", "apr_id": "57236aff6ff6b255dc9f11032c586da1", "difficulty": 2500, "tags": ["combinatorics", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.20543093270365997, "equal_cnt": 10, "replace_cnt": 5, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "#include\n#include\nstruct app\n{\n\tint a[111];\n\tint b[100];\n}pp;\nint kkk[111111116];\nint main()\n{\n\tint a,b,p,k=0,m,i,j,t=0,kk,q,qq,l=0;\n\tfor(i=0;i<24;i++)\n\t{ k=0;\n\t\tfor(j=0;j<=59;j++)\n\t\t{\n\t\tpp.a[i]=i;\n\t\tpp.b[k]=j;\n\t\tk++;\n\t\t}\n\t}\n\tmemset(kkk,0,sizeof(kkk));\n\tscanf(\"%d\",&m);\n\tscanf(\"%d%d\",&p,&k);\n\tt=p;\n\tfor(qq=0;qq<22;qq++)\n\t{\n\t\tif(l>0)\n\t\t\tt=23;\n\t\tfor(i=t;i>=0;i--)\n\t\t{\n\t\t\tfor(j=0;j<=59;j++)\n\t\t\t{\n\t\tif(i==p&&pp.b[j]>k)\n\t\t\t\tbreak;\n\t\t\t\tkk=p-i;\n\t\t\t q=kk*60+k-pp.b[j];\n\t\t\t\tif(l==0&&i0)\n\t\t\t\t\tq=(p+24-i)*60-pp.b[j]+k;\n\t\t\t\tif(q%m==0&&(pp.a[i]%10==7||pp.b[j]%10==7))\n\t\t\t\t{\n\t\t\t\tkk=99999;\n\t\t\t//\tprintf(\"%d %d %d\\n\",q,pp.a[i],pp.b[j]);\n\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(kk==99999)\n\t\t\t\tbreak;\n\n\t\t\t}\n\t\tif(kk==99999)\n\t\t\t\tbreak;\n\t\tl++;\n\t}\n\t\n\t\t\tprintf(\"%d\\n\",q/m );\n\t\t\t\treturn 0;\n}\n\n\n\n \t\t\t\t \t\t \t \t\t \t \t\t\t\t \t", "lang": "GNU C++", "bug_code_uid": "1af6f3c4cc81c23fc631e74ff8499bfa", "src_uid": "5ecd569e02e0164a5da9ff549fca3ceb", "apr_id": "693e2f7cbf44c7cda9f87b892006974d", "difficulty": 900, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9348708093102712, "equal_cnt": 20, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 11, "fix_ops_cnt": 19, "bug_source_code": "/* Author : bitshar */\n// #pragma GCC optimize (\"-O3\")\n#include \n \nusing namespace std;\n \ntypedef long long ll;\ntypedef long double ld;\ntypedef pair pii;\ntypedef pair pll;\n \nll MOD = 1e9+7;\n \n#define forn(i,e) for(ll i=0; i=0; i--)\n#define rforsn(i,s,e) for(ll i=e; i>=s; i--)\n#define ln \"\\n\"\n#define sp \" \"\n#define mp make_pair\n#define pb push_back\n#define fi first\n#define se second\n#define INF 1e18\n#define NEGINF -1e18\n#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)\n\n#define dbg(x) cout << #x << \" = \" << x << ln \n#define all(x) x.begin(), x.end()\n\n#define out1(x1) cout << x1 << ln\n#define out2(x1,x2) cout << x1 << \" \" << x2 << ln\n#define out3(x1,x2,x3) cout << x1 << \" \" << x2 << \" \" << x3 << ln\n#define out4(x1,x2,x3,x4) cout << x1 << \" \" << x2 << \" \" << x3 << \" \" << x4 << ln\n#define out5(x1,x2,x3,x4,x5) cout << x1 << \" \" << x2 << \" \" << x3 << \" \" << x4 << \" \" << x5 << ln\n#define out6(x1,x2,x3,x4,x5,x6) cout << x1 << \" \" << x2 << \" \" << x3 << \" \" << x4 << \" \" << x5 << \" \" << x6 << ln\n\n#define in1(x1) cin >> x1\n#define in2(x1,x2) cin >> x1 >> x2\n#define in3(x1,x2,x3) cin >> x1 >> x2 >> x3\n#define in4(x1,x2,x3,x4) cin >> x1 >> x2 >> x3 >> x4\n#define in5(x1,x2,x3,x4,x5) cin >> x1 >> x2 >> x3 >> x4 >> x5\n#define in6(x1,x2,x3,x4,x5,x6) cin >> x1 >> x2 >> x3 >> x4 >> x5 >> x6\n\n#define arrin(a,n) forn(i,n) cin >> a[i];\n#define arrout(a,n) forn(i,n) {cout << a[i] << \" \";} cout << ln;\n\n//#define DEBUG_MODE\n\nll solve(vector v) {\n\n if(v.size()==2) return v[1]-v[0];\n vector v1,v2;\n forn(i,v.size()) {\n if(i>=2) v1.pb(v[i]);\n if(i!=1 and i!=2) v2.pb(v[i]);\n }\n return min(solve(v1)+v[1]-v[0], solve(v2)+v[2]-v[1]);\n}\n\nvoid solve() {\n \n ll n;\n cin >> n;\n ll w[2*n],ans=INF;\n forn(i,2*n) cin >> w[i];\n sort(w,w+2*n);\n forn(i,2*n) {\n forsn(j,i+1,2*n) {\n vector v;\n forn(k,2*n) {\n if(k!=i and k!=j) v.pb(w[k]);\n } \n ans = min(ans,solve(v));\n }\n }\n cout << ans << \"\\n\";\n} \n \nint main() {\n \n #ifdef DEBUG_MODE\n freopen(\"input.txt\",\"r\",stdin);\n //freopen(\"output.txt\",\"w\",stdout);\n #endif\n fio;\n int t=1;\n //cin >> t;\n while(t--) {\n\n solve();\n }\n}", "lang": "GNU C++14", "bug_code_uid": "72b69a491d58a6a7c720f2be1b6d9dbc", "src_uid": "76659c0b7134416452585c391daadb16", "apr_id": "20e2cb3c6c4fd78697f1551b79287979", "difficulty": 1500, "tags": ["greedy", "brute force", "sortings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.7324478178368121, "equal_cnt": 17, "replace_cnt": 12, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 17, "bug_source_code": "#include \nusing namespace std;\nint main()\n{\n string a;\n cin>>a;\n int big=0;\n int small = 0;\n for (int i = 0;;i++)\n {\n if((a[i]<124) && (a[i]>96))\n {\n small=small+1;\n }\n else if ((a[i]>64) && (a[i]<91))\n {\n big=big+1;\n }\n }\n if (small>big)\n {\n for (int i =0;; i++)\n {\n if((a[i]>64) && (a[i]<91))\n {\n a[i]=a[i]+32;\n }\n\n\n }\n cout< small)\n {\n for (int i =0; ;i++)\n {\n if((a[i]<123) && (a[i]>96))\n {\n a[i]=a[i]-32;\n }\n\n }\n cout<64))\n {\n a[i]+=32;\n }\n\n }\n cout<\nusing namespace std;\n#define ll long long\n\nll dp[262144+5][18];\nint gdp,n,nw[262144+5];\nint coun[20],s[20],tot;\n\nint get(int mask)\n{\n int f=mask&gdp;\n if(f)return 0;\n return 1;\n}\nint nw_dp_func(int mask)\n{\n if(nw[mask]!=-1)return nw[mask];\n for(int i=tot-1;i>=0;i--)\n {\n if(mask&(1<\nusing namespace std;\nint n, x, s;\nint main()\n{\n cin>> n>> x;\n for (int i=1; i<=n; i++)\n {\n if (x%i==0)\n s++;\n }\n cout<< s;\n return 0;\n}\n", "lang": "MS C++", "bug_code_uid": "e412a236db19f55e712a673802233fdf", "src_uid": "c4b139eadca94201596f1305b2f76496", "apr_id": "a64177ce4e7a252c8d72c55c55be5f3c", "difficulty": 1000, "tags": ["number theory", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9515812431842966, "equal_cnt": 18, "replace_cnt": 14, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 17, "bug_source_code": "#include\n#include\n#include\n#include \n#include\n#include\n#include \n#include \n// #include \"boost/algorithm/string.hpp\"\n#define fio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);\n#define mod 1000000007\n#define mod1 mod\n#define mod2 1000000007\n#define ll long long int\n#define llu unsigned long long int\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#define readi(x) scanf(\"%d\",&x)\n#define reads(x) scanf(\"%s\", x)\n#define readl(x) scanf(\"%I64d\",&x)\n#define rep(i,n) for(i=0;i=0;i--)\n#define myrep1(i,a,b) for(i=a;i<=b;i++)\n#define myrep2(i,a,b) for(i=b;i>=a;i--)\n#define pb push_back\n#define eb emplace_back\n#define mp make_pair\n#define fi first\n#define sec second\n#define MAXN 1000000000000000005\n#define MINN -1000000000000000000\n#define INTMAX 1000001000\n#define pii pair\n#define pdd pair\n#define pic pair\n#define N 1<<20\n#define lgn 20\n#define ddouble long double\n#define minus minu\n#define PI 3.1415926535\n#define lgn 20\n#define coutd(x) cout << fixed << setprecision(x)\n#define DECIMAL(n) std::cout << std::fixed << std::setprecision(n); \n#define all(v) v.begin(),v.end()\n#define rall(v) v.rbegin(),v.rend()\n#define fil(v,x) fill(all(v),x)\n#define filcon(v,x) iota(all(v),x)\n#define newl '\\n'\n\n// #define INTMAX 200000000\n \n// using namespace boost;\n// #define si short int\n \nusing namespace std;\nusing namespace __gnu_pbds;\ntypedef priority_queue > max_pq;\ntypedef priority_queue , greater > min_pq;\nll toint(const string &s) {stringstream ss; ss << s; ll x; ss >> x; return x;}\nstring tostring ( ll number ){stringstream ss; ss<< number; return ss.str();}\ntemplate\nT toIntegralType(const string &str) {\n static_assert(is_integral::value, \"Integral type required.\");\n T ret;\n stringstream ss(str);\n ss >> ret;\n if ( to_string(ret) != str)\n throw invalid_argument(\"Can't convert \" + str);\n return ret;\n} \n// using namespace __gnu_pbds;\n// typedef priority_queue , vector > > max_pq;\n// typedef priority_queue ,greater > min_pq;\ntypedef tree, rb_tree_tag, tree_order_statistics_node_update> OST;\n// typedef priority_queue > , vector > > ,greater > > > min_pq;\n#define TRACE\n#ifdef TRACE\n#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)\n template \n void __f(const char* name, Arg1&& arg1){\n cout << name << \" : \" << arg1 << std::endl;\n //use cerr if u want to display at the bottom\n }\n template \n void __f(const char* names, Arg1&& arg1, Args&&... args){\n const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << \" : \" << arg1<<\" | \";__f(comma+1, args...);\n }\n#else\n#define trace(...)\n#endif\n#define nn 2000005\nint main()\n{\n fio;\n // #ifndef ONLINE_JUDGE\n // freopen(\"input.txt\",\"r\",stdin);\n // freopen(\"output.txt\",\"w\",stdout);\n string s;\n cin>>s;\n vector v[10];\n //sort(s.begin(),s.end(),greater ());\n for(ll i=1;i<=45500;i++)\n {\n ll z=i*i;\n string zz=tostring(z);\n v[zz.length()].pb(z);\n }\n for(ll i=s.length();i>=1;i--)\n {\n for(ll j=0;j\n#include \n#include \n#include \nusing namespace std;\n\nint main()\n{\n long long n;\n cin>>n;\n \n vector < vector > f(n+1, vector (n+1, 0));\n \n for(long long maximal=1;maximal<=n;maximal++)\n {\n f[1][maximal] = maximal;\n }\n \n for(long long length=1;length<=n;length++)\n {\n f[length][1] = 1;\n }\n \n for(long long length=2;length<=n;length++)\n {\n for(long long maximal=2;maximal<=n;maximal++)\n {\n f[length][maximal] = (f[length-1][maximal] + f[length][maximal-1])%1000000007;\n }\n }\n \n cout<<(f[n][n]*2-n)%1000000007;\n \n return 0;\n}", "lang": "GNU C++14", "bug_code_uid": "21b92ac4d7fa51b7b56460573e8570dc", "src_uid": "13a9ffe5acaa79d97df88a069fc520b9", "apr_id": "c21faf25463a0712e8153dc12d81cca5", "difficulty": 1900, "tags": ["math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.1187800963081862, "equal_cnt": 34, "replace_cnt": 26, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 33, "bug_source_code": "#include \n#include \n#include \nconst int bufSize = 1e6;\ninline char nc()\n{\n #ifdef DEBUG\n return getchar();\n #endif\n static char buf[bufSize], *p1 = buf, *p2 = buf;\n return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, bufSize, stdin), p1 == p2) ? EOF : *p1++;\n}\ntemplate\ninline T read(T &r)\n{\n static char c;\n static int flag;\n flag = 1, r = 0;\n for (c = nc(); !isdigit(c); c = nc()) if (c == '-') flag = -1;\n for (; isdigit(c); c = nc()) r = r * 10 + c - 48;\n return r *= flag;\n}\nconst int maxn = 1e6 + 100;\nint k, q;\nlong long f[7], ww[7][10], w[maxn];\nlong long dp[maxn];\nint bit[maxn];\nint pow[7] = {0, 1, 10, 100, 1000, 10000, 100000};\ninline void work(int weight, long long value) { for (int i = 999999; i >= weight; --i) dp[i] = std::max(dp[i], dp[i - weight] + value); }\nint main()\n{\n read(k);\n for (int i = 1; i <= 6; ++i) read(f[i]), ww[i][3] = f[i], ww[i][6] = 2 * f[i], ww[i][9] = 3 * f[i];\n pow[0] = 1;\n for (int i = 1; i <= 999999; ++i)\n {\n bit[i] = bit[i / 10] + 1;\n dp[i] = dp[i % pow[bit[i]]] + ww[bit[i]][(i / pow[bit[i]])];\n }\n for (int i = 1; i <= 6; ++i)\n {\n int num = std::min(3 * (k - 1), 333333 / pow[i]);\n for (int j = 1; j <= num; num -= j, j <<= 1) work(3 * pow[i] * j, f[i] * j);\n if (num) work(3 * pow[i] * num, f[i] * num);\n }\n read(q);\n for (int i = 1,x; i <= q; ++i) read(x),printf(\"%lld\\n\",dp[x]);\n return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "23b3c574b2aae33343e099550d3456ec", "src_uid": "92bcbac3f167a44c235e99afc4de20d2", "apr_id": "29ba0c3f438e3c89543ea9b4267bd162", "difficulty": 2900, "tags": ["dp", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7174887892376681, "equal_cnt": 19, "replace_cnt": 9, "delete_cnt": 8, "insert_cnt": 1, "fix_ops_cnt": 18, "bug_source_code": "#include\nusing namespace std;\nint main ()\n{\n int h,m,t,s,s1,ans;\n while(scanf(\"%d:%d\",&h,&m))\n {\n scanf(\"%d\",&t);\n s=m+t;\n ans=s%60;\n s1=s/60;\n h=h+s1;\n if(h>=24)\n {\n h=h-24;\n }\n //printf(\"%02d:%02d\\n\",h,ans);\n if(h<10)\n {\n printf(\"0%d:\",h);\n }\n if(h>=10)\n {\n printf(\"%d:\",h);\n }\n if(ans<10)\n {\n printf(\"0%d\",ans);\n }\n if(ans>=10)\n {\n printf(\"%d\",ans);\n }\n cout<\nusing namespace std;\n\nint main()\n{\n int r[101], b[101], n;\n\n cin >> n;\n\n for(int i = 1; i <= n; ++i)\n cin >> r[i];\n\n for(int i = 1; i <= n; ++i)\n cin >> b[i];\n\n int rs = 0, bs = 0;\n\n for(int i = 1; i <= n; ++i)\n {\n if(r[i] == 0 && b[i] != 0)\n ++bs;\n\n if(r[i] != 0 && b[i] == 0)\n ++rs;\n }\n\n if(bs == rs)\n cout << -1;\n else if (rs > bs)\n {\n cout << 1;\n }\n else{\n cout << (bs + 1)/rs + (bs + 1) % rs;\n }\n}\n\n/*\n int number_of_tests;\n cin >> number_of_tests;\n\n for(int test_number = 1; test_number <= number_of_tests; ++test_number)\n {\n\n }\n*/\n", "lang": "GNU C++11", "bug_code_uid": "21e3d02a0f1e99fb7220aff8fc51e654", "src_uid": "b62338bff0cbb4df4e5e27e1a3ffaa07", "apr_id": "d576a44631eb8f559775d5ffe3477430", "difficulty": 900, "tags": ["greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.44398340248962653, "equal_cnt": 11, "replace_cnt": 7, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "\n\n\n#include \n#define ll long long\n#define F first\n#define S second\n#define mp make_pair\n#define mod 1000000007\n#define All(v) v.begin(),v.end()\n\nusing namespace std;\n\nint main()\n{\n string s;\n cin >> s;\n int sum = 0;\n bool ok = 1;\n while(ok)\n {\n ok = 0;\n\n for(int i=0;i\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\ninline int r3(int s1,int s2){\n return min(s1,s2);\n}\ninline int r2(int x1,int y1,int s,int c){\n if(x1<=c&&c<=y1){\n if(s>=c){\n int r=min(s,y1)-max(1,x1)+1;\n r=max(r,r3(c-x1,c-1));\n r=max(r,r3(y1-c,s-c));\n r=max(r,r3(c-x1,s-c));\n r=max(r,r3(y1-c,c-1));\n return r;\n }else{\n int r=r3(s,c-x1);\n r=max(r,r3(s,y1-c));\n return r;\n }\n }\n if(s>=c)s=c-1;\n if(x1>c){\n x1-=c;y1-=c;\n }\n return r2(x1,y1,s,c/2);\n}\ninline int run(int x1,int y1,int x2,int y2,int c){\n if(x1<=c&&c<=y1){\n if(x2<=c&&c<=y2){\n int r=min(y2,y1)-max(x2,x1)+1;\n int a1=max(y1-c,c-x1),a2=max(y2-c,c-x2);\n r=max(r,r3(a1,a2));\n return r;\n }else{\n if(x2>c){\n x2-=c;y2-=c;\n }\n int a1=max(y1-c,c-x1);\n return r2(x2,y2,a1,c/2);\n }\n }else if(x2<=c&&c<=y2){\n if(x1>c){\n x1-=c;y1-=c;\n }\n int a2=max(y2-c,c-x2);\n return r2(x1,y1,a2,c/2);\n }\n if(x1>c){\n x1-=c;y1-=c;\n }\n if(x2>c){\n x2-=c;y2-=c;\n }\n return run(x1,y1,x2,y2,c/2);\n}\nint main(){\n int l1,r1,l2,r2;\n scanf(\"%d%d%d%d\",&l1,&r1,&l2,&r2);\n printf(\"%d\\n\",run(l1,r1,l2,r2,524288));\n\n}\n\n", "lang": "GNU C++", "bug_code_uid": "15fe710184b6aa9fe2f6e8dfb27c3edc", "src_uid": "fe3c0c4c7e9b3afebf2c958251f10513", "apr_id": "5fae357f66ac22aff3668bd6a80c632c", "difficulty": 2400, "tags": ["divide and conquer"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9904588823262154, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n\n#define ll long long\n#define ft first\n#define sd second\n\n//#pragma GCC optimize(\"Ofast\")\n//#pragma GCC target(\"sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native\")\n//#pragma GCC optimize(\"unroll-loops\")\n//#pragma GCC optimize(\"fast-math\")\n\nusing namespace std;\n\nint main() {\n ios::sync_with_stdio(0);\n cin.tie(0);\n cout.tie(0);\n#ifdef FREOPEN\n freopen(\"input.txt\",\"r\",stdin);\n freopen(\"output.txt\",\"w\",stdout);\n#endif\n\n ll n , k;\n cin >> n >> k;\n vector c(n),ans(k+1),sum(k+1);\n\n for (ll i = 0; i < n; ++i) {\n cin >> c[i];\n }\n sort(c.begin(),c.end());\n reverse(c.begin(),c.end());\n set > s;\n for (ll i = 0; i <= k; ++i)\n s.insert({0,i});\n for (auto &i: c) {\n ll ind = s.begin()->sd;\n s.erase(s.begin());\n ans[ind] += sum[ind];\n sum[ind] += i;\n s.insert({-sum[ind],ind});\n }\n ll out = 0;\n for (ll i = 0; i <= k; ++i) {\n out += ans[i];\n }\n cout << out;\n return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "7b5b2911cfe4bb0756fdd35e65466df8", "src_uid": "53155daf2375e01a3b87fa1c76f1e9a8", "apr_id": "dde5149bca89802a7b1a4cbcd7d7d13b", "difficulty": null, "tags": ["math", "constructive algorithms", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.14474650991917706, "equal_cnt": 35, "replace_cnt": 22, "delete_cnt": 10, "insert_cnt": 3, "fix_ops_cnt": 35, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#define O edge[i].to\n#define NX edge[i].next\nusing namespace std;\nlong long tmp,n,k,len,L,kth,Res,Len; map vis;\ninline long long Read(){long long t=0,f=1; char c=getchar();\n\tfor (;c>57||c<48;c=getchar()) if (c=='-') f=-1;\n\tfor (;c>47&&c<58;c=getchar()) t=10ll*t+1ll*c-48ll; return t*f;\n}\nlong long cal(long long now,long long len){\n//\tprintf(\"%I64d %I64d\\n\",now,len);\n\tif (vis[now]) return vis[now];\n\tif (now==len) return 1; if (now==Len) return 0;\n\treturn vis[now]=cal(now/2,len)+cal(now-now/2-1,len);\n}\nlong long solve(long long l,long long r){\n//\tprintf(\"solve:%I64d %I64d %I64d %I64d\\n\",l,r,kth,L);\n\tlong long mid=l+r>>1;\n\tif (r-l+1ll==L) return l+(L+1)/2ll-1ll;\n\tvis.clear(); long long tmp=cal(mid-l,len);\n//\tprintf(\"num::::%I64d %I64d\\n\",mid-l,tmp);\n\tif (tmp=kth) return solve(l,mid-1);\n}\nint main(){\n\tn=Read(),k=Read();\n\tif (k==1){printf(\"1\\n\"); return 0;}\n\tif (k==2){printf(\"%I64d\\n\",n); return 0;}\n\tif (n==k){printf(\"%I64d\\n\",n-1) return 0;}\n\tfor (tmp=1,len=n-2,k-=2;;len=(len-1)/2){\n\t\tif (k<=tmp){//printf(\"%I64d\\n\",k);\n\t\t\tvis.clear(),Len=len+1; long long t=cal(n-2,len);\n\t\t//\tprintf(\"%I64d %I64d %I64d\\n\",n-2,len,t);\n\t\t\tif (k<=t) kth=k,L=len,Len=len+1,Res+=solve(2,n-1);\n\t\t\telse kth=k-t,L=len+1,Len=len,Res+=solve(2,n-1);\n\t\t\tprintf(\"%I64d\\n\",Res); return 0;\n\t\t}\n\t\tk-=tmp,tmp*=2;\n\t}\n}", "lang": "GNU C++11", "bug_code_uid": "e28451f4a94fb9bbf59914325919273c", "src_uid": "eb311bde6a0e3244d92fafbd4aa1e61f", "apr_id": "586177e587283e6bd08a3d0d76b4399a", "difficulty": 2900, "tags": ["constructive algorithms", "implementation", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.22085889570552147, "equal_cnt": 11, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 12, "bug_source_code": "//\u8f93\u5165\u8fdb\u5236k(2<=k<=10),\u8f93\u51fak\u8fdb\u5236\u4e0b\u7684\u4e58\u6cd5\u8868\u3002\n//\u4e58\u6cd5\u8868\u89c4\u683c\u4e3a(k-1)* (k-1)\n#include\nusing namespace std;\nint n;\ninline void cha(int a)\n{\n\tif(a==0)return;\n\tcha(a/n);\n\tcout<>n;\n\tfor(int i=1;i\n#include\n#include\n#include\n#include\n#include\n#include\n#define pb push_back\n#define rep(i,j,k) for(int i=(j);i<=(int)k;i++)\n#define per(i,j,k) for(int i=(j);i>=(int)k;i--)\n#define lowbit(x) ((x)&(-(x)))\n#define fi first\n#define se second\n#define pii pair\nusing namespace std;\ntypedef long long LL;\ntypedef double db;\nmapfuck;\nint n,m;\nchar s[5];\nint x,y;\nLL ans;\nint dx,dy;\nint main()\n{ scanf(\"%d%d\",&n,&m);\n scanf(\"%d%d\",&x,&y);\n scanf(\"%s\",s+1);\n if(s[1]=='U')dx=-1; else dx=1;\n if(s[2]=='L')dy=-1; else dy=1;\n int fis=0;\n int test=1000000;\n while(test--)\n { pii now=pii(x,y);\n if(!fuck[now])\n { fuck[now]=1;\n fis++;\n }\n if(fis==n+m-2)\n { printf(\"%I64d\",ans+1);\n return 0;\n }\n int xl,yl,l;\n int ex,ey;\n if(dx==-1)xl=x-1; else xl=n-x;\n if(dy==-1)yl=y-1; else yl=m-y;\n if(xlyl) { ey=-dy; ex=dx; l=yl;}\n else { ex=-dx; ey=-dy; l=yl;}\n }\n\t\tx+=dx*l;y+=dy*l;\n ans+=1ll*l;\n dx=ex;dy=ey;\n }\n printf(\"-1\\n\");\n return 0;\n", "lang": "GNU C++", "bug_code_uid": "e5c78a5dc5fb74c406ebc397dc40aaf7", "src_uid": "8a59247013a9b1f34700f4bfc7d1831d", "apr_id": "86f929f813e66482830ec09f8effb7e4", "difficulty": 2500, "tags": ["number theory", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9896226415094339, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \n#include \n\nint gcd (short a, short b) { return b ? gcd (b, a % b) : a; }\n\nint main() {\n short a,b,c,d; std::cin>>a>>b>>c>>d;\n\n /* \u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c = \u0432\u044b\u0441\u043e\u0442\u0430 \u044d\u043a\u0440\u0430\u043d\u0430 * \u0448\u0438\u0440\u0438\u043d\u0443 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438\n * \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u044c = \u0448\u0438\u0440\u0438\u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0430 * \u0432\u044b\u0441\u043e\u0442\u0443 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438\n * \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0417\u0410\u041d\u042f\u0422\u041e\u0415 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u043d\u0430 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0435 */\n int numerator=b*c, denominator=a*d;\n\n /* \u0435\u0441\u043b\u0438 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u043d\u043e \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e (\u0434\u0440\u043e\u0431\u044c \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f), \u0442\u043e\n * \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u043f\u0435\u0440\u0432\u0443\u044e \u0437\u0430\u043d\u044f\u043b\u0430 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c (a/b > c/d)\n * \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043c\u0435\u043d\u044f\u0435\u043c \u043c\u0435\u0441\u0442\u0430\u043c\u0438 \u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c \u0441\u043e \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u0435\u043c */\n if (numerator > denominator) std::swap(numerator, denominator);\n\n // \u0441\u043e\u043a\u0440\u0430\u0449\u0430\u0435\u043c \u0434\u0440\u043e\u0431\u044c, \u043d\u0430\u0439\u0434\u044f \u041d\u041e\u0414 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0415\u0432\u043a\u043b\u0438\u0434\u0430\n int divisor = gcd(numerator, denominator);\n if (divisor != 1) {\n numerator/=divisor; denominator/=divisor;\n }\n\n /* \u0432 \u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u0435 \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u044c \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u044f \u0438 \u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044f, \u0447\u0435\u043c \u0431\u0443\u0434\u0435\u0442\n * \u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u0421\u0412\u041e\u0411\u041e\u0414\u041d\u041e\u0415 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0430, \u0447\u0442\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442\n * \u0437\u0430\u0434\u0430\u0447\u0430 */\n std::cout<\n#include \n#include \n#include \nusing namespace std;\n\nint main() {\n\tint n; cin >> n;\n\tint even = n / 2;\n\tint odd = n - even;\n\n\tvector a(n);\n\tfor (int& x : a) {\n\t\tcin >> x;\n\t\tif (x == 0) { continue; }\n\t\tif (x % 2 == 0) {\n\t\t\t--even;\n\t\t} else {\n\t\t\t--odd;\n\t\t}\n\t}\n\tint orig_complexity = 0;\n\tfor (int i = 0; i < n-1; ++i) {\n\t\tif (a[i] == 0 || a[i+1] == 0) { continue; }\n\t\tif (a[i] % 2 != a[i+1] % 2) { orig_complexity += 1; }\n\t}\n\t// \u0435\u0441\u043b\u0438 \u043a\u043e\u043d\u0446\u044b \u043e\u0434\u043d\u043e\u0438\u043c\u0451\u043d\u043d\u044b\u0435, \u0442\u043e \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u044b - 0 \u0438\u043b\u0438 2\n\t// \u0435\u0441\u043b\u0438 \u0440\u0430\u0437\u043d\u043e\u0438\u043c\u0451\u043d\u043d\u044b\u0435, \u0442\u043e \u0432\u0441\u0435\u0433\u0434\u0430 1\n\t// \u0435\u0441\u043b\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0435 \u043d\u0430\u0447\u0430\u043b\u043e \u0438\u043b\u0438 \u043a\u043e\u043d\u0435\u0446, \u0442\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043e\u0434\u043d\u043e\u0438\u043c\u0451\u043d\u043d\u044b\u043c\u0438\n\n\t// \u0432\u044b\u0433\u043e\u0434\u043d\u0435\u0435 \u0438\u0434\u0442\u0438 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u043c\u0435\u043d\u044c\u0448\u0438\u0435 -> \u0431\u043e\u043b\u044c\u0448\u0438\u0435\n\n\t// vector> similar_p;\n\t// vector> dissim_p;\n\tint dissim_p_cnt = 0;\n\tvector> similar_s;\n\t{\n\t\tint i = 0;\n\t\twhile (i < n) {\n\t\t\tif (a[i] == 0) {\n\t\t\t\tint left_idx = i-1;\n\t\t\t\twhile (i < n-1 && a[++i] == 0) {}\n\t\t\t\tint right_idx = i;\n\n\t\t\t\t// left_idx = max(left_idx, 0);\n\t\t\t\t// right_idx = min(right_idx, n-1);\n\t\t\t\t// if (left_idx == 0) { left_idx = right_idx; }\n\t\t\t\t// if (right_idx == n-1) { right_idx = left_idx; }\n\n\t\t\t\t// (a[right_idx]%2 == a[left_idx]%2 ? similar_p : dissim_p).push_back({left_idx, right_idx});\n\t\t\t\tif (right_idx == n || left_idx == -1 || a[right_idx]%2 == a[left_idx]%2) {\n\t\t\t\t\tint seglen = right_idx - left_idx - 1;\n\t\t\t\t\tint parity = (left_idx != -1 ? a[left_idx]%2 : (right_idx != n ? a[right_idx]%2 : 1));\n\t\t\t\t\tsimilar_s.push_back({seglen, parity});\n\t\t\t\t} else {\n\t\t\t\t\tdissim_p_cnt += 1;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t++i;\n\t\t\t}\n\t\t}\n\t}\n\n\t// std::sort(similar_p.begin(), similar_p.end(), [](const auto& a, const auto& b) {\n\t// \treturn a.second - a.first < b.second - b.first;\n\t// });\n\n\tstd::sort(similar_s.begin(), similar_s.end());\n\tint similar_failed = 0;\n\tfor (const auto& [len, parity] : similar_s) {\n\t\tint& capacity = (parity == 0 ? even : odd);\n\t\tif (capacity >= len) {\n\t\t\tcapacity -= len;\n\t\t} else {\n\t\t\tsimilar_failed += 1;\n\t\t}\n\t}\n\n\t// dump for debug\n\tfprintf(stderr, \"similar_s: \");\n\tfor (const auto& x : similar_s) {\n\t\tfprintf(stderr, \"(len=%i of %i), \", x.first, x.second);\n\t}\n\tfprintf(stderr, \"\\n\");\n\tfprintf(stderr, \"similar_failed = %i\\n\", similar_failed);\n\tfprintf(stderr, \"%i\\n\", dissim_p_cnt);\n\n\tint total_complexity = orig_complexity + dissim_p_cnt * 1 + similar_failed * 2;\n\tstd::cout << total_complexity;\n}", "lang": "GNU C++17", "bug_code_uid": "3fb626a72821b13a8b4193ffcd0961dc", "src_uid": "90db6b6548512acfc3da162144169dba", "apr_id": "e4f3c9d172ffb015210d11b4dc7f97b8", "difficulty": 1800, "tags": ["dp", "greedy", "sortings"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9976314542870678, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include\nusing namespace std;\n\ntypedef long long s64;\nconst int D=1e9+7;\ns64 mi(s64 x,int y=D-2)\n{\n\ts64 ans=1;\n\twhile(y)\n\t{\n\t\tif(y&1)ans=ans*x%D;\n\t\tx=x*x%D;y>>=1;\n\t}\n\treturn ans;\n}\ns64 F,F2;\nvoid solve(s64 n)\n{\n\ts64 a0=0,a1=0,a2=0,a3=0;\n\tint my=0;\n\twhile((s64)my*my<=n)++my;\n\t--my;\n\ts64 s2=0,s4=0,s6=0;\n\tfor(int y=1;y<=my;++y)\n\t{\n\t\tint y_2=(s64)y*y%D;\n\t\t(s2+=y_2)%=D;\n\t\t(s4+=(s64)y_2*y_2)%=D;\n\t\t(s6+=(s64)y_2*y_2%D*y_2)%=D;\n\t}\n\tfor(int x=0;(s64)x*x<=n;++x)\n\t{\n\t\twhile((s64)x*x+(s64)my*my>n)\n\t\t{\n\t\t\tint y_2=(s64)my*my%D;\n\t\t\t(s2-=y_2)%=D;\n\t\t\t(s4-=(s64)y_2*y_2)%=D;\n\t\t\t(s6-=(s64)y_2*y_2%D*y_2)%=D;\n\t\t\t--my;\n\t\t}\n\t\t(a0+=my)%=D;\n\t\tint x_2=(s64)x*x%D;\n\t\t(a1+=(s64)x_2*my+s2)%=D;\n\t\t(a2+=(s64)x_2*x_2%D*my+2*x_2*s2+s4)%=D;\n\t\t(a3+=(s64)x_2*x_2%D*x_2%D*my+(s64)x_2*x_2%D*s2%D*3+x_2*s4%D*3+s6)%=D;\n\t}\n\tn%=D;\n\ta0=(4*a0+1)%D;a1=4*a1%D;a2=4*a2%D;a3=4*a3%D;\n\tF=(n*(n+1)%D*a0%D-a2+a1)%D*mi(2)%D;\n\tF2=( n*(n+1)%D*(2*n+1)%D*a0%D-2*a3+3*a2-a1)*mi(6)%D;\n}\n\nint main()\n{\n\t//freopen(\"1.in\",\"r\",stdin);\n\ts64 n;\n\tcin>>n>>D;\n\tsolve(n);\n\tcout<<(((n+1)%D*F-F2)%D+D)%D;\n}", "lang": "GNU C++17", "bug_code_uid": "fbe77a5c06544fb16f73ef4d5b63bf3d", "src_uid": "b9a785849e5ffadb24b58b38b1f2ee48", "apr_id": "b3163d8488590c7461645e1c4947322d", "difficulty": 2900, "tags": ["brute force", "math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.07448630136986302, "equal_cnt": 21, "replace_cnt": 20, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 20, "bug_source_code": "#include \nusing namespace std;\nint dig(int n)\n{\n int sum = 0;\n while(n)\n {\n sum++;\n n/=10;\n }\n return sum;\n}\nint main()\n{\n int T;\n cin>>T;\n int ar[6];\n int p;\n for(int i=0;i<6;i++)\n {\n cin>>p;\n ar[i] = p;\n }\n int q;\n cin>>q;\n int n;\n cin>>n;\n int dp[T];\n int sum=0;\n sum+=9;\n if(T>9)\n dp[0] = 9;\n for(int i=1;iT)\n {\n int dif = sum-T;\n for(int j=1;j>=0;j--)\n if(diff<=dp[j])\n {\n dp[j]-=diff;\n sum-=diff;\n break;\n }\n }\n }\n int fortune = 0;\n for(int i=0;i\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n//#include \n#include \nifstream cin(\"input.txt\");\nofstream cout(\"output.txt\");\nstring cts(int s){\n\tstring str;\n\tif (s == 0)\tstr = '0';\n\twhile (s){\n\t\tstr.push_back(s % 10);\n\t\ts /= 10;\n\t}\n\treturn str;\n}\nint num(int n){\n\tint l, now;\n\tl = n % 10; n /= 10;\n\twhile (n){\n\t\tnow = n % 10;\n\t\tn /= 10;\n\t\tif (now == l)\n\t\t\treturn 0;\n\t\tl = now;\n\t}\n\treturn 1;\n}\nint main()\n{\n\tint x1, y1; cin >> x1 >> y1;\n\tint x2, y2; cin >> x2 >> y2;\n\tcout << max(abs(x2 - x1), abs(y2 - y1));\n\treturn 0;\n}\n//void build(int v, int tl, int tr){\n//\tif (tl == tr){\n//\t\tt[v] = a[tl]*a[tl];\n//\t}\n//\telse{\n//\t\tint tm = (tl + tr) / 2;\n//\t\tbuild(v * 2, tl, tm);\n//\t\tbuild(v * 2 + 1, tm + 1, tr);\n//\t\tt[v] = t[v * 2] + t[v * 2 + 1];\n//\t}\n//}\n//int maxi(int v, int tl, int tr, int l, int r){\n//\tif (l > r){\n//\t\treturn INT_MIN;\n//\t}\n//\tif (l == tl&&r == tr){\n//\t\treturn t[v];\n//\t}\n//\tint tm = (tl + tr) / 2;\n//\treturn max(maxi(v * 2, tl, tm, l, min(r, tm)),\n//\t\tmaxi(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r));\n//}\n//int sum(int v, int tl, int tr, int l, int r){\n//\tif (l > r){\n//\t\treturn 0;\n//\t}\n//\tif (l == tl&&r == tr){\n//\t\treturn t[v];\n//\t}\n//\tint tm = (tl + tr) / 2;\n//\treturn sum(v * 2, tl, tm, l, min(r, tm))\n//\t\t+sum(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r);\n//}\n//int n; cin >> n;\n//vector > s(n);\n//vector > ti(n);\n//for (int i = 0; i < n; i++){\n//\tcin >> s[i].first >> s[i].second;\n//\tcin >> ti[i].first >> ti[i].second;\n//}\n//vector >a(n);\n//for (int i = 0; i < n; i++){\n//\ta[i].first = ((s[n - 1].first - s[i].first)*ti[i].second) + ti[i].first;\n//\ta[i].second = i + 1;\n//}\n//sort(a.begin(), a.end());\n//for (int i = 0; i < n; i++){\n//\tcout << a[i].second << \" \";\n//}\n//int n, m; cin >> n >> m;\n//vector t(m);\n//vector >a(n, t);\n//int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;\n//a[--x1][--y1] = true; a[--x2][--y2] = true;\n//for (int i = 0; i < n; i++){\n//\tfor (int j = 0; j < m; j++){\n//\t\tif (a[i][j] == false){\n//\t\t\tif (j + 2 != m){\n//\t\t\t\ta[i][j] = true; a[i][j + 1] = true;\n//\t\t\t}\n//\t\t\telse{\n//\t\t\t\tif (i + 2 != n&&a[i + 1][j] == false){\n//\t\t\t\t\ta[i + 1][j] = true; a[i][j] = true;\n//\t\t\t\t}\n//\t\t\t\telse{\n//\t\t\t\t\tcout << \"NO\";\n//\t\t\t\t\treturn 0;\n//\t\t\t\t}\n//\t\t\t}\n//\t\t\tcout << \"NO\";\n//\t\t\treturn 0;\n//\t\t}\n//\t}\n//}\n//cout << \"YES\";\n/*cin >> n >> m;\nt.resize(m);\na.resize(n, t);\nfor (int i = 0; i < n; i++){\nfor (int j = 0; j < m; j++){\ncin >> a[i][j];\n}\n}\nint ans = 0;\nfor (int i = 0; i < n; i++){\nfor (int j = 0; j < m; j++){\nif (a[i][j] >= '0'&&a[i][j] <= '9'){\nans += check(i, j);\n}\n}\n}\ncout << ans;*/\n/*int n; cin >> n;\na.resize(n);\nint d = 0; int ans;\nfor (int i = 0; i < n; i++){ cin >> a[i]; }\nif (n == 1){ cout << 1; return 0; }\nfor (int i = 0; i < n; i++){\nint td = waves(i);\nif (td > d){\nif (i - td < 0){\nans = 1;\nd = td;\n}\nelse if (i + td - 1 > n) {\nans = n;\nd = td;\n}\nelse {\nd = td; ans = i + 1;\n}\n}\nif (td > 2){\ni += td - 2;\n}\n}\ncout << ans;\t*/\n//int n; int m;\n//vectort;\n//vector > a;\n//int check(int y, int x){\n//\tint kf = 0;\n//\tint i = y - 1;\n//\twhile (i < n - 1 && i <= y + 1){\n//\t\tif (i >= 0 && x + 1 < m){\n//\t\t\tif (a[i][x + 1] == 'F'){ kf++; i++; }\n//\t\t\telse i++;\n//\t\t}\n//\t\ti++;\n//\t}\n//\ti = y - 1;\n//\twhile (i >= y - 1){\n//\t\tif (i >= 0 && x - 1 > 0){\n//\t\t\tif (a[i][x - 1] == 'F'){ kf++; i--; }\n//\t\t\telse i--;\n//\t\t}\n//\t\ti--;\n//\t}\n//\tif (y - 1 > 0 && a[y - 1][x] == 'F')kf++;\n//\tif (y + 1 < n - 1 && a[y + 1][x] == 'F')kf++;\n//\tif (kf > a[x][y] - '0')return kf;\n//\telse return 0;\n//}\n/*double l, d, t, v1, v2; cin >> l >> d >> t >> v1 >> v2;\nvector > p(d + 1);\nfor (int i = 0; i < d; i++){\np[i].first = (double)i / v1;\np[i].second = (double)(d - i) / v2 + t;\n}\np[d].second = 0; p[d].first = d / v1;\ndouble ans = d / (v2 + v1) + t + l / v2;\nfor (int i = 0; i <= d; i++){\nif (p[i].first >= p[i].second){\nans = min(ans, p[i].first + l / v1);\n}\n}\ncout <> n;\nset < int > a;\nfor (int g = 1; g <= n; g++){\nfor (int k1 = 1; k1 < g; k1++){\nint k2 = sqrt(g*g - k1*k1);\ndouble dk2 = sqrt(g*g - k1*k1);\nif (dk2 != k2)continue;\nelse{\na.insert(g);\n}\n}\n}\ncout << a.size();*/\n//int waves(int p){\n//\tint d=0;\n//\twhile (a[p - d] != 1 && a[p + d] != 1){\n//\t\tif (p - d == 0){\n//\t\t\td++;\n//\t\t\twhile (a[p + d] != 1 && p + d != a.size() - 1)d++;\n//\t\t\tbreak;\n//\t\t}\n//\t\telse if (p + d == a.size() - 1){\n//\t\t\td++;\n//\t\t\twhile (a[p - d] != 1 && p - d != 0)d++;\n//\t\t\tbreak;\n//\t\t}\n//\t\telse d++;\n//\t}\n//\treturn d;\n//}\n//\n/*\nstring s1, s2; cin >> s1 >> s2;\nreverse(s1.begin(), s1.end());\nreverse(s2.begin(), s2.end());\nvector a(252), b(252);\nint n = s1.size(), m = s2.size();\nfor (int i = 0; i < n; i++){\na[i] = s1[i] - '0';\n}\nfor (int i = 0; i < m; i++){\nb[i] = s2[i] - '0';\n}\nvector ans(255);\nfor (int i = 0; i < 252; i++){\nint s = a[i] + b[i] + ans[i];\nans[i] = s % 10;\nans[i + 1] = s / 10;\n}\nreverse(ans.begin(), ans.end());\nint i = 0;\nwhile (ans[i] == 0)i++;\nfor (; i < ans.size(); i++)\ncout << ans[i];\n*/\n/*int a, b, c, d;\ncin >> a >> b >> c >> d;\nset > ans;\nfor (int i = a; i <= b; i++){\nfor (int j = 1; j <= i; j++){\nif (i%j != 0){\ncontinue;\n}\nelse{\nif ((i / j) * 2 + j * 2 >= c && (i / j) * 2 + j * 2 <= d){\nans.insert(make_pair(i / j, j));\n}\n}\n}\n}\ncout << ans.size();*//*string s1, s2; cin >> s1 >> s2;\n\tvectora(122);\n\tfor (int i = 0; i < s1.size(); i++)a[(int)s1[i]]++;\n\tfor (int i = 0; i < s2.size(); i++)a[(int)s2[i]]++;\n\tfor (int i = 121; i > 96; i--){\n\t\tif (a[i] != 0){\n\t\t\ts1 = s1.substr(s1.find((char)i + 1), s1.end());\n\t\t}\n\t}*/", "lang": "GNU C++11", "bug_code_uid": "e2f1f7aea1bc6a92df3a827f54057060", "src_uid": "a6e9405bc3d4847fe962446bc1c457b4", "apr_id": "03266ccb004ddb6f79016de3a0b260ad", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.8471113948292371, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\n#define is ==\n#define INF 99999999\n#define rep(i,start,m) for(int i=(int)(start);i<(int)(m);i++)\n#define showarray(array,m) for(int sa_i=0;sa_i<(int)(m);sa_i++) cout << array[sa_i] << \" \"; cout << endl;\n#define showvector(array) for(int sa_i=0;sa_i<(int)(array.size());sa_i++) cout << array[sa_i] << \" \"; cout << endl;\n#define skipline() string line; getline(cin,line);\nstringstream ss;\n#define cast(a,b) ss.clear(); ss<>b; ss.clear();\n#define rev(s) (string((s).rbegin(), (s).rend()))\n#define debug(x) cerr << #x << \" = \" << (x) << \" (L\" << __LINE__ << \")\" << endl;\n#define clr(a) memset((a), 0 ,sizeof(a))\n\nint dx[4] = {-1,0,1,0};\nint dy[4] = {0,-1,0,1};\n\n//pyfind(vector, targ)\ntemplate \nint pyfind(const vector &vect, const T &targ){\n\tfor(int i=0;i &vect, int x){\n\tvector::iterator itr;\n\titr = vect.begin();\n\tfor(int i=0;i> a >> b >> m;\n\tif( b>=m ){\n\t\tcout <<2<< endl;\n\t\texit(1);\n\t}\n\tcout << 1 << endl;\n}\n\n\n\n\n\n\n", "lang": "GNU C++", "bug_code_uid": "13ca18faf4c53310c497812c4392a202", "src_uid": "8b6f633802293202531264446d33fee5", "apr_id": "2da5fca2c1bcf676994fdffd6ba62865", "difficulty": 1800, "tags": ["brute force", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.4650587507730365, "equal_cnt": 15, "replace_cnt": 8, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 14, "bug_source_code": "#include \n\nusing namespace std;\n\nlong long m, a, b;\n\nlong long ans;\n\nint main()\n{\n#ifndef ONLINE_JUDGE\n\tfreopen(\"input.txt\", \"rt\", stdin); freopen(\"output.txt\", \"wt\", stdout);\n#endif\n\tios_base::sync_with_stdio(false); cin.tie(nullptr);\n\tcin >> m >> a >> b;\n\tvector x(a, -1);\n\tfor (long long i = 0, X = 0; x[i % a] == -1;)\n\t{\n\t\tx[i % a] = X;\n\t\ti += a;\n\t\tif (i <= m)\n\t\t{\n\t\t\tX = max(X, i);\n\t\t\twhile (i >= b)\n\t\t\t{\n\t\t\t\tlong long f = i % a;\n\t\t\t\tif (x[f] == -1)\n\t\t\t\t\tx[f] = X;\n\t\t\t\ti -= b;\n\t\t\t}\n\t\t} else\n\t\t\tbreak;\n\t}\n\tfor (long long i = 0; i < a; i++)\n\t{\n\t\tif (x[i] != -1)\n\t\t{\n\t\t\tlong long n = (m - i) / a + 1;\n\t\t\tlong long N = (m - x[i]) / a + 1;\n\t\t\tans += n-N + N*(m - x[i] + 1) - a*(N - 1) * N / 2;\n\t\t}\n\t}\n\tcout << ans;\n\treturn 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "4979c350869da36f9b250a667683c633", "src_uid": "d6290b69eddfcf5f131cc9e612ccab76", "apr_id": "51bbd6b5d53839eb736c11ee3aafa5da", "difficulty": 2100, "tags": ["math", "dfs and similar", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9905362776025236, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \n#include \n#define forn(i, n) for(int i = 1; i <= n; i++)\nusing namespace std;\n\n\nlong long const N = 110000, INF = 1e6;\nconst long double PI = acos(-1.0L);\n\nint a, n, s, k, g, ans = 1000000, m, k1, y, x;\nlong double l;\n\n\nint main() {\n //freopen(\"goat5.in\", \"r\", stdin);\n //freopen(\"goat5.out\", \"w\", stdout);\n //freopen(\"input.txt\", \"r\", stdin);\n //freopen(\"output.txt\", \"w\", stdout);\n cin >> k;\n forn(i, k) {\n forn(j, k)\n if (i * j >= k && (i + j) * 2 < ans && i * j - k < k)\n ans = (i + j) * 2;\n }\n cout << ans;\n return 0;\n}\n\n\n\n\n\n\n\n\n\n\n\n", "lang": "GNU C++", "bug_code_uid": "c0931021ced19287c1863c2c69ed60fa", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "apr_id": "ffc7a6bdd97f4450822aa1faf81828d0", "difficulty": 1000, "tags": ["geometry", "math", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9898477157360406, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include\nusing namespace std;\nconst int MAX=1e5+9;\nint n,a[MAX];\nint main()\n{\n\tint w,h,k;\n\tcin>>w>>h>>k;\n\tint ans=0;\n\tfor (int i=0;i\n#include \n#include \n#include \n\n\nusing namespace std;\n\n\nint a[10];\n\nint main()\n{\n int i, n;\n scanf(\"%d\", &n);\n for (i = 0; i < n; ++i) scanf(\"%d\", &a[i]);\n if (n == 1)\n {\n if (a[0] != 0) printf(\"BitLGM\\n\");\n else printf(\"BitAryo\\n\");\n }\n else if (n == 2)\n {\n sort(a, a + n);\n int k, q;\n if (a[0] == 0 && a[1] == 0) {printf(\"BitAryo\\n\"; return 0;}\n k = ((double)(a[0] * 2) / (1 + sqrt(5)) + 1);\n// printf(\"k:%d\\n\", k);\n if (a[0] + k == a[1]) printf(\"BitAryo\\n\");\n else printf(\"BitLGM\\n\");\n }\n else\n {\n int k = a[0] ^ a[1] ^ a[2];\n if (k != 0) printf(\"BitLGM\\n\");\n else printf(\"BitAryo\\n\");\n\n }\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "50e24641c8c5e26638747be095c6c03d", "src_uid": "7a33b4f94082c7ef80d7e87b58497fa7", "apr_id": "305a689c09d0ee3e09834c0bbf0c1d29", "difficulty": 2100, "tags": ["dp", "games"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.1010989010989011, "equal_cnt": 10, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 10, "bug_source_code": "#include\n#include\n\nusing namespace std;\n\nint n;\nint s;\n\nifstream cin(\"input.txt\");\nofstream cout(\"output.txt\");\n\nint main()\n{\n\t\n\tcin >> n;\n\t\n\tbool a[3];\n\ta[1] = a[2] = a[0] = 0;\n\ta[n - 1] = 1;\n\ts = n;\n\tfor(int k = 1; k <= 3; k++)\n\t{\n\t\tint d1, d2;\n\t\tcin >> d1 >> d2;\n\t\tswap(a[d1-1], a[d2-1]);\n\t\tif(a[d1-1])\n\t\ts = d1;\n\t\tif(a[d2-1])\n\t\ts = d2;\n\t\t\n\t}\n\tcout << s;\n\t\n}", "lang": "GNU C++11", "bug_code_uid": "d8691a7c35cae26bbab4c1628e041fde", "src_uid": "a45daac108076102da54e07e1e2a37d7", "apr_id": "0f2dcf2dab9277d0bb2f5f366204c6ec", "difficulty": 1000, "tags": ["math", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7530168946098149, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "#include\nusing namespace std;\ntypedef long long ll;\n\nbool isvowel(char c)\n{\n if(c=='A' || c=='E' || c=='I' || c=='O'|| c=='U' || c=='Y')\n return true;\n return false;\n}\n\nint main()\n{\n string s;\n cin>>s;\n vector v;\n for(int i=0; i\nusing namespace std;\nint main()\n{\n long long int l1,l2,r1,r2,k,c;\n cin>>l1>>r1>>l2>>r2>>k;\n c=min(r1,r2)-max(l1,l2);\n if(c>0)\n {\n\n if(k>min(r1,r2) || k\nusing namespace std;\nchar ss[104];\nint main()\n{\ncin>>ss;\nint len=strlen(ss);\nint arr[(len/2)+1];\nfor(int i=0,j=0;j\n#include\nusing namespace std;\nconst int N=105;\nstruct data\n{\n int s,t,d,id;\n}a[N];\nint ans[N],t[N],num[N],n,m;\ninline char tc(void)\n{\n static char fl[100000],*A=fl,*B=fl;\n return A==B&&(B=(A=fl)+fread(fl,1,100000,stdin),A==B)?EOF:*A++;\n}\ninline void read(int &x)\n{\n x=0; char ch=tc();\n while (ch<'0'||ch>'9') ch=tc();\n while (ch>='0'&&ch<='9') x=x*10+ch-'0',ch=tc();\n}\ninline bool comp(data a,data b)\n{\n return a.t=a[j].s) { ans[i]=a[j].id; ++t[j]; break; } \n }\n for (i=1;i<=n;++i)\n printf(\"%d \",ans[i]);\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "9dfd0e4d5094094e1833f560797a67c9", "src_uid": "02d8d403eb60ae77756ff96f71b662d3", "apr_id": "fa5a067f0461d3b70b1df73ba80cf7ae", "difficulty": 1700, "tags": ["greedy", "sortings", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9986206896551724, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include\nusing namespace std;\nint main() {\n\tint h, m, min;\n\tchar c;\n\tcin >> h >> c >> m >> min;\n\tm += min;\n\tint x = 1;\n\tdo {\n\t\tif (m > 60) { m -= 60; h++; }\n\t\tif (h >= 24) { h -= 24; }\n\t\tif (h < 24 && m < 60)\n\t\t\tx = 0;\n\t} while (x);\n\tif (h < 10) { cout << '0' << h << ':'; }\n\telse cout << h << ':';\n\tif (m < 10) { cout << '0' << m; }\n\telse cout << m;\n}", "lang": "GNU C++17", "bug_code_uid": "f3eaaa48e69f628e9dd89b7f62436ab3", "src_uid": "20c2d9da12d6b88f300977d74287a15d", "apr_id": "6bb7823bfafba8a231eb158cd1985fb0", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.3192632386799693, "equal_cnt": 23, "replace_cnt": 20, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 23, "bug_source_code": "#include\nint main()\n{\n int ct1=0,ct2=0,i,j;\n char s[1000];\n scanf(\"%s\",s);\n {\n for(j=0; ;j++)\n {\n if(s[j]=='\\0')\n {\n break;\n }\n }\n }\n for(i=0; i\nusing namespace std;\n\n#define fi first\n#define se second\ntypedef long long ll;\n\nll abs_(ll x) {\n return max(x, -x);\n}\n\nint main() {\n int a[2];\n cin >> a[0] >> a[1];\n int col = 1;\n int cnt = a[0] + a[1] - 1;\n int last;\n if (a[0] > a[1]) {\n last = 0;\n } else {\n last = 1;\n }\n a[last]--;\n vectorans;\n ans.push_back(last);\n int b = 0;\n for (int i = 1; a[0] || a[1]; i++) {\n if (i % 2 == 1 && a[last ^ 1]) {\n last = last ^ 1;\n b++;\n } else {\n last = last;\n }\n a[last]--;\n }\n cout << cnt - b << \" \" << b << endl;\n return 0;\n}\n\n", "lang": "GNU C++11", "bug_code_uid": "d3cbccc242af11cb48e28620d4ef3d81", "src_uid": "c8378e6fcaab30d15469a55419f38b39", "apr_id": "bce562b7c3b5aee26950c5ff7865a9e4", "difficulty": 1300, "tags": ["greedy", "games", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9361233480176211, "equal_cnt": 12, "replace_cnt": 1, "delete_cnt": 7, "insert_cnt": 4, "fix_ops_cnt": 12, "bug_source_code": " #include\n \n using namespace std;\n main()\n {\n int n,x,y;\n cin>>n >>x >>y;\n if(n==2)\n cout<<\"NO\";\n else if((n/x==2)||(n/(x-1)==2))\n { \n if(y-(n/2)>1)\n cout<<\"YES\";\n else \n cout<<\"NO\";\n }\n \n else\n cout<<\"YES\";\n \n \n \n }", "lang": "GNU C++14", "bug_code_uid": "1a0e978c80a8abc394dfc49a5587ebdd", "src_uid": "dc891d57bcdad3108dcb4ccf9c798789", "apr_id": "c184c2aedc29b8080e2383bf5f76f978", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9844789356984479, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "/*/**/\n\n#include \n\nusing namespace std;\n\nint main() {\n\tint n;\n\tcin >> n;\n\tstring s;\n\tcin >> s;\n\tint ans = 1;\n\tint p = 0;\n\twhile(p < n and s[p] - '0') {\n\t\tans++;\n\t}\n\tcout << min(ans, n) << endl;\n\treturn 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "f81c81a43de1c37b7d4dbf9cb10bb5c3", "src_uid": "54cb2e987f2cc06c02c7638ea879a1ab", "apr_id": "1301d8470916f7ad6d32df3a25e90fcd", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9817949536889172, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "/* Author : Prateep */\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n#define LET(x,a) __typeof(a) x(a)\n#define IFOR(i,a,b) for(LET(i,a);i!=(b);++i)\n#define EACH(it,v) IFOR(it,v.begin(),v.end())\n#define FOR(i,a,b) for(int i=(int)(a) ; i < (int)(b);i++)\n#define REP(i,n) FOR(i,0,n)\n#define SZ size()\n#define PB push_back\n#define PF push_front\n#define V(x) vector< x >\n#define two(X) (1<<(X))\n#define twoL(X) (((int64)(1))<<(X))\n#define contain(S,X) (((S)&two(X))!=0)\n#define containL(S,X) (((S)&twoL(X))!=0\n#define swap(x,y) x ^=y ^= x^=y\n#define ALL(v) (v).begin(),(v).end()\n\nconst double pi=acos(-1.0);\nconst double eps=1e-11;\nconst int INFINITE=0x3f3f3f3f;\ntemplate inline void checkmin(T &a,T b){if(b inline void checkmax(T &a,T b){if(b>a) a=b;}\ntemplate inline T sqr(T x){return x*x;}\ntypedef pair ipair;\ntemplate inline T lowbit(T n){return (n^(n-1))&n;}\ntemplate inline int countbit(T n){return (n==0)?0:(1+countbit(n&(n-1)));}\n\ntypedef long long ll;\ntypedef V(int) VI;\ntypedef V(VI) VII;\ntypedef V(string) VS;\ntypedef long long int64;\ntypedef long double LD;\ntypedef pair PI;\n\n//#define LocalHost\nbool isUserName(string s)\n{\n int l = s.SZ;\n if(l == 0 || l > 16) return false;\n //cout << s << endl;\n REP(i,s.SZ)\n {\n if(!isupper(s[i]) && !islower(s[i]) && !isdigit(s[i]) && s[i]!='_')\n return false;\n }\n return true;\n}\n\nbool isHostName(string s)\n{\n int l = s.SZ;\n if(l == 0 || l > 32) return false;\n size_t id = s.find_first_of(\".\");\n\n while(id != string::npos)\n {\n if(!isUserName(s.substr(0,id)))\n return false;\n s = s.substr(id+1);\n id = s.find_first_of(\".\");\n }\n return isUserName(s);\n}\n\nbool solve(string s)\n{\n size_t id = s.find(\"@\");\n if(id == string::npos) return false;\n\n if(!isUserName(s.substr(0,id))) return false;\n\n string rest = s.substr(id+1);\n\n size_t id1 = rest.find_first_of(\"/\");\n\n string hostname, resources;\n if(id1 == string::npos) {\n hostname = rest;\n resources = \"\";\n }\n else {\n hostname = rest.substr(0,id1);\n resources = rest.substr(id1+1);\n }\n\n //cout << hostname << ' ' << resources << endl;\n return (isHostName(hostname) && isUserName(resources) );\n\n}\n\nint main()\n{\n#ifdef LocalHost\n freopen(\"input.txt\",\"r\",stdin);\n freopen(\"output.txt\",\"w\",stdout);\n#endif\n\n\n string s; cin >> s;\n\n bool res = solve(s);\n cout << (res ? \"YES\" : \"NO\") << endl;\n\n return 0;\n}\n", "lang": "MS C++", "bug_code_uid": "974f822ca8ac047507d3cf42ba145f3c", "src_uid": "2a68157e327f92415067f127feb31e24", "apr_id": "b1a66c3336f1589153a60753c13c1031", "difficulty": 1900, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.79421768707483, "equal_cnt": 15, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 8, "fix_ops_cnt": 15, "bug_source_code": "#include \n#include \n#include \nusing namespace std;\n\nbool cmp(int a,int b)\n{\n\treturn a>b;\n}\n\n\nint N;\nint val[8];\nint cPrimes[8];\nint bestAns;\n\nvoid dfs(int i,int cur,bool needExtraRoot)\n{\n\tif(i==N)\n\t{\n\t\tbestAns = min(bestAns,cur+N+needExtraRoot);\n\t\treturn;\n\t}\n\t//root\n\tif(i == 0)\n\t{\n\t\tdfs(i+1,cur,0);\n\t}\n\t//child of root\n\tif(i==0)\n\t\tdfs(i+1,cur+cPrimes[i],1);\n\telse\n\t{\n\t\tif(needExtraRoot)\n\t\t\tdfs(i+1,cur+cPrimes[i],1);\n\t}\n\t//child of other node\n\tfor(int j=0;j> N;\n\tfor(int i=0;i> val[i];\n\t}\n\tsort(val,val+N,cmp);\n\tfor(int i=0;i temp)\n\t\t\t\tbreak;\n\t\t\twhile(!(val[i]%j))\n\t\t\t{\n\t\t\t\tval[i] /= j;\n\t\t\t\tcPrimes[i]++;\n\t\t\t}\n\t\t}\n\t\tif(val[i] > 1)\n\t\t\tcPrimes[i]++;\n\t\tval[i] = temp;\n\t}\n\tbestAns = (1<<30);\n\n\tdfs(0,0,0);\n\tcout << bestAns << endl;\n\treturn 0;\n}", "lang": "MS C++", "bug_code_uid": "a55e702f9a4eb28b71abd820458fd963", "src_uid": "52b8b6c68518d5129272b8c56e5b7662", "apr_id": "e05a376d1691cfb5c7d21e558377161f", "difficulty": 2200, "tags": ["dp", "brute force", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.8742228598756576, "equal_cnt": 10, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "#ifdef ONLINE_JUDGE\n#pragma comment(linker, \"/STACK:16777216\")\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#define re return\n#define fi first\n#define se second\n#define mp make_pair\n#define pb push_back\n#define all(x) (x).begin(), (x).end()\n#define sz(x) ((int) (x).size())\n#define rep(i, n) for (int i = 0; i < (n); i++)\n#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)\n#define y0 y32479\n#define y1 y95874\n#define fill(x, y) memset(x, y, sizeof(x))\n#define sqr(x) ((x) * (x))\n#define prev prev239\n#define next next239\n#define hash hash239\n#define rank rank239\n\nusing namespace std;\n\ntypedef vector vi;\ntypedef vector vvi;\ntypedef pair ii;\ntypedef vector vii;\ntypedef vector vs;\ntypedef long long ll;\ntypedef double D;\ntypedef long double LD;\n\ntemplate T abs(T x) {return x > 0 ? x : -x;}\n\nint n;\nint m;\nint k;\n\nint used[10][10];\nint res[10];\nint mask;\nint zlo[10];\nint was[12];\nint t;\n\nint check2() {\n\tint st = 0;\n\tt++;\n\trrep(i, n - 1) {\n\t\tfor (int j = st; j < n; j++)\n\t\tif (zlo[i] & (1 << j))\n\t\t\tif (was[j] != t) {\n\t\t\t\tif (!used[j][res[i]])\n\t\t\t\t\tre 0;\n\t\t\t\twas[j] = t;\n\t\t\t\twhile (was[st] == t)\n\t\t\t\t\tst++;\n\t\t\t\tbreak;\n\t\t\t}\n\t}\n\n\tre 1;\n}\n\nint col[1024];\n\nint paste(int p) {\n\tif (p == n - 1) {\n\t\tif (col[mask] == n - k)\n\t\t\tre check2();\n\t\telse\n\t\t\tre 0;\n\t}\n\n\tint ans = 0;\n\trep(i, n) {\n\t\tint smask = mask;\n\t\tres[p] = i;\n\t\tmask |= (1 << i);\n\t\tif (p)\n\t\t\tzlo[p] = zlo[p - 1] & (~(1 << i));\n\t\tans += paste(p + 1);\n\t\tmask = smask;\n\t}\n\n\tre ans;\n}\n\nint main() {\n#ifndef ONLINE_JUDGE\n\tfreopen(\"input.txt\", \"r\", stdin);\n\t//freopen(\"output.txt\", \"w\", stdout);\n#endif\n\n\trep(i, 1024)\n\tcol[i] = __builtin_popcount(i);\n\n\tcin >> n >> m >> k;\n\trep(i, m) {\n\t\tint a, b;\n\t\tcin >> a >> b;\n\t\ta--;\n\t\tb--;\n\t\tused[a][b] = used[b][a] = 1;\n\t}\n\tres[0] = n - 1;\n\tzlo[0] = (1 << n) - 1;\n\tcout << paste(1) << endl;\n\n\tre 0;\n}\n\n", "lang": "GNU C++", "bug_code_uid": "d99608631ea2be438aad174288e6da52", "src_uid": "8087605a8f316150372cc4627f26231d", "apr_id": "3e83f8241b48cff5ce61530e11e768bf", "difficulty": 2500, "tags": ["dp", "bitmasks"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8889496717724289, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "#include \n\nusing namespace std;\n\ntypedef long long ll;\n\nvector > > answer;\n\nvoid add(ll x, ll y, ll z) {\n answer.push_back(make_pair(x, make_pair(y, z)));\n}\n\nvoid solve(ll n, ll a, ll b, ll c) {\n if ((c + a - b) % 2 != 0) return;\n ll x = (c + a - b) / 2;\n if (x < 1) return;\n ll y = (c + b - a) / 2;\n if (y < 1) return;\n ll z = (a + b - c) / 2;\n if (z < 1) return;\n\n if (x > y) swap(x, y);\n if (y > z) swap(y, z);\n if (x > y) swap(x, y);\n if ((x + y + z) * (x + y + z) * (x + y + z) - x * x * x - y * y * y - z * z * z == n * 3) {\n add(x, y, z);\n }\n}\n\nint calculate(pair > a) {\n if (a.first == a.second.second) return 1;\n if (a.first == a.second.first || a.second.first == a.second.second) return 3;\n return 6;\n}\n\nint main() {\n ios_base::sync_with_stdio(false);\n ll n;\n cin >> n;\n if (n % 3 != 0) {\n cout << 0 << endl;\n return 0;\n }\n n /= 3;\n vector divisors;\n for (ll a = 1; a * a <= n; ++a) {\n if (n % a == 0) {\n divisors.push_back(a);\n }\n }\n for (int indA = 0; indA < divisors.size(); ++indA) {\n ll a = divisors[indA];\n if (n % a != 0) {\n continue;\n }\n ll d = n / a;\n for (int indB = indA; indB < divisors.size() && a * divisors[indB] * divisors[indB] <= n; ++indB) {\n ll b = divisors[indB];\n if (d % b != 0) continue;\n ll c = d / b;\n solve(n, a, b, c);\n }\n }\n ll ans = 0;\n sort(answer.begin(), answer.end());\n ans += calculate(answer[0]);\n for (int i = 1; i < answer.size(); ++i) {\n if (answer[i] == answer[i - 1]) continue; else ans += calculate(answer[i]);\n }\n cout << ans << endl;\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "068db301657f1d585e75f8f19b3258be", "src_uid": "07e58a46f2d562a44b7c771edad361b4", "apr_id": "992bde172252efdf44d9031c1a759ea1", "difficulty": 2400, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9499620401684036, "equal_cnt": 12, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define rep(i, n) for(int i = 0; i < n; i++)\n#define repR(i, j, k) for(int i = j; i < k; i++)\n#define lli long long int\n#define ulli unsigned long long int\n#define mp make_pair\n#define MOD 1000000007\nusing namespace std;\nint MAX = 1000000;\nvoid printArray(int N, int arr[]) {\n\trep(n, N)\n\t\tprintf(\"%d \", arr[n]);\n\tprintf(\"\\n\");\n}\nvoid printVector(vector &v) {\n\trep(n, v.size())\n\t\tprintf(\"%d \", v[n]);\n\tprintf(\"\\n\");\n}\nint maxInArray(int i, int j, int A[]) {\n\tint maxVal = -1e9;\n\tfor(int k = i; k <= j; k++) {\n\t\tmaxVal = max(maxVal, A[k]);\n\t}\n\treturn maxVal;\n}\n\nint minInArray(int i, int j, int A[]) {\n\tint minVal = -1e9;\n\tfor(int k = i; k <= j; k++) {\n\t\tminVal = min(minVal, A[k]);\n\t}\n\treturn minVal;\n}\nlli gcd(lli a, lli b) {\n\tif(a == 0 || b == 0)\n\t\treturn a^b;\n\treturn gcd(b%a, a);\n}\n\nvoid zAlgorithm(int len, char s[], int *Z) {\n\trep(n, len)\n\t\tZ[n] = 0;\n\tZ[0] = len;\n\tint l = 0, r = 0;\n\tfor(int k = 1; k < len; k++) {\n\t\tif(!(k >= r)) {\n\t\t\tint p = k - l;\n\t\t\tif(Z[p] + k < r) {\n\t\t\t\tZ[k] = Z[p];\n\t\t\t} else {\n\t\t\t\tl = k;\n\t\t\t\twhile(r < len && s[r] == s[r - k]) {\n\t\t\t\t\tr++;\n\t\t\t\t}\n\t\t\t\tZ[k] = r - k;\n\t\t\t}\n\t\t} else {\n\t\t\tint i = k, j = 0;\n\t\t\twhile(i < len && s[i] == s[j]) {\n\t\t\t\ti++;\n\t\t\t\tj++;\n\t\t\t}\n\t\t\tl = k;\n\t\t\tr = i;\n\t\t\tZ[k] = j;\n\n\t\t}\n\n\t}\n}\nint findSmallestDivisor(int len, int *pre) {\n\tint k = 1;\n\twhile(k <= len) {\n\t\t// printf(\"k: %d len: %d\\n\", k, len);\n\t\tbool isMultiple = true;\n\t\tfor(int i = 0; i < len; i += k) {\n\t\t\tif(pre[i] < k) {\n\t\t\t\t// printf(\"i: %d k: %d pre[i]: %d\\n\", i, k, pre[i]);\n\t\t\t\tisMultiple = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(isMultiple)\n\t\t\treturn k;\n\t\tk++;\n\t}\n\treturn 0;\n}\nvoid seiveErathosthenes(int limit, vector &primes) {\n\t// printf(\"limit: %d\\n\", limit);\n\tif(limit < 2)\n\t\treturn;\n\tbool isPrime[limit + 1];\n\trepR(i, 2, limit + 1)\n\t\tisPrime[i] = true;\n\trepR(i, 2, limit + 1) {\n\t\tif(isPrime[i]) {\n\t\t\t// printf(\"i: %d\\n\", i);\n\t\t\tprimes.push_back(i);\n\t\t\tfor(int j = i*2; j <= limit; j += i) {\n\t\t\t\t// printf(\"i: %d j: %d\\n\", i, j);\n\t\t\t\tisPrime[j] = false;\n\t\t\t}\n\t\t}\n\t}\n}\n\nlli numSubTree(int uu, vector adjList[], int A[], int N) {\n\tstack ss, s;\n\tss.push(uu);\n\twhile(ss.size()) {\n\t\tint u = ss.top();\n\t\ts.push(u);\n\t\tss.pop();\n\t\tfor(int i = 0; i < adjList[u].size(); i++) {\n\t\t\tint v = adjList[u][i];\n\t\t\tss.push(v);\n\t\t}\n\t}\n\tlli dp[N + 1];\n\trep(n, N + 1)\n\t\tdp[n] = 0;\n\twhile(s.size()) {\n\t\tint u = s.top();\n\t\ts.pop();\n\t\tlli total = 1, prod = 1;\n\t\tbool isLeafNode = true;\n\t\tfor(int i = 0; i < adjList[u].size(); i++) {\n\t\t\tisLeafNode = false;\n\t\t\tint v = adjList[u][i];\n\t\t\tif(A[uu] == A[v] && v >= uu) {\n\t\t\t\t// printf(\"Hehe\\n\");\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tprod = (prod*(dp[v] + 1))%MOD;\n\t\t}\n\n\t\t// printf(\"u: %d prod: %lld isLeafNode: %d\\n\", u, prod, isLeafNode );\n\t\tdp[u] = prod;\n\t}\n\treturn dp[uu];\n}\n\nvector * getAdjListWithMin(int i, int D, int N, vector adjList[], int A[]) {\n\tvector *modifiedAdjList = new vector[N];\n\tstack s;\n\tlli minVal = A[i], maxVal = A[i] + D;\n\tbool visited[N];\n\trep(n, N) {\n\t\tvisited[n] = false;\n\t}\n\ts.push(i);\n\twhile(s.size()) {\n\t\tint u = s.top();\n\t\ts.pop();\n\t\tvisited[u] = true;\n\t\tfor(int j = 0; j < adjList[u].size(); j++) {\n\t\t\tint v = adjList[u][j];\n\t\t\tif(!visited[v] && A[v] >= minVal && A[v] <= maxVal) {\n\t\t\t\tmodifiedAdjList[u].push_back(v);\n\t\t\t\t// printf(\"%d->%d\\n\", u, v);\n\t\t\t\ts.push(v);\n\t\t\t}\n\t\t}\n\t}\n\treturn modifiedAdjList;\n}\n\nvoid buildSparseTable(lli ((*fn)(lli , lli)), int N, lli A[], vector sparseTable[]) {\n\trep(i, N) {\n\t\t// sparseTable[i].push_back(0);\n\t\tsparseTable[i].push_back(A[i]);\n\t}\n\tint j = 1;\n\twhile((1< sparseTable[]) {\n\tint i = L;\n\tlli total = identity;\n\twhile(i <= R) {\n\t\tint j = 0;\n\t\twhile((i + (1<<(j + 1)) - 1) <= R) {\n\t\t\tj++;\n\t\t}\n\t\ttotal = fn(total, (sparseTable[i][j]));\n\t\ti = i + (1 << j);\n\t}\n\treturn total;\n}\n\nvoid reflectOfX(double x, double y, double z, double vx, double vy, double vz, double Px, double *px, double *py, double *pz) {\n\t*py = ((Px - x)*vy)/vx + y;\n\t*pz = ((Px - x)*vz)/vx + z;\n\t*px = Px;\n}\n\nvoid reflectOfY(double x, double y, double z, double vx, double vy, double vz, double Py, double *px, double *py, double *pz) {\n\t*px = ((Py - y)*vx)/vy + x;\n\t*pz = ((Py - y)*vz)/vy + z;\n\t*py = Py;\n}\n\nvoid reflectOfZ(double x, double y, double z, double vx, double vy, double vz, double Pz, double *px, double *py, double *pz) {\n\t*px = ((Pz - z)*vx)/vz + x;\n\t*py = ((Pz - z)*vy)/vz + y;\n\t*pz = Pz;\n}\nbool isValid(double *x, double *y, double *z, double a, double b) {\n\treturn (*x >= 0 && *x <= a && *z >= 0 && *z <= b && *y >= 0);\n}\nint main(int argc, char const *argv[]) {\n\tdouble a = 0, b = 0, m = 0;\n\tscanf(\"%lf %lf %lf\", &a, &b, &m);\n\tdouble vx = 0.0, vy = 0.0, vz = 0.0;\n\tscanf(\"%lf %lf %lf\", &vx, &vy, &vz);\n\tdouble *px = new double(), *py = new double(), *pz = new double();\n\t*px = ((double)a)/2.0, *py = (double)m, *pz = 0.0;\n\tbool atX = true;\n\twhile(true) {\n\t\tdouble *tx = new double(), *ty = new double(), *tz = new double();\n\t\t// printf(\"%lf %lf %lf - %lf %lf %lf\\n\", *px, *py, *pz, vx, vy, vz);\n\t\t*tx = *px, *ty = *py, *tz = *pz;\n\t\treflectOfY(*tx, *ty, *tz, vx, vy, vz, 0.0, tx, ty, tz);\n\t\tif(isValid(tx, ty, tz, a, b)) {\n\t\t\tpx = tx, py = ty, pz = tz;\n\t\t\tbreak;\n\t\t}\n\t\tif(atX) {\n\t\t\t*tx = *px, *ty = *py, *tz = *pz;\n\t\t\tif(vz > 0) {\n\t\t\t\treflectOfZ(*tx, *ty, *tz, vx, vy, vz, b, tx, ty, tz);\n\t\t\t\tif(isValid(tx, ty, tz, a, b)) {\n\t\t\t\t\tpx = tx, py = ty, pz = tz;\n\t\t\t\t\tvz = -vz;\n\t\t\t\t\tatX = false;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\t\n\t\t\t} else if(vz < 0) {\n\t\t\t\treflectOfZ(*tx, *ty, *tz, vx, vy, vz, 0.0, tx, ty, tz);\n\t\t\t\tif(isValid(tx, ty, tz, a, b)) {\n\t\t\t\t\tpx = tx, py = ty, pz = tz;\n\t\t\t\t\tvz = -vz;\n\t\t\t\t\tatX = false;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t\t*tx = *px, *ty = *py, *tz = *pz;\n\t\t\treflectOfX(*tx, *ty, *tz, vx, vy, vz, *tx == 0.0?a:0.0, tx, ty, tz);\n\t\t\tpx = tx, py = ty, pz = tz;\n\t\t\tvx = -vx;\n\t\t} else {\n\t\t\t*tx = *px, *ty = *py, *tz = *pz;\n\t\t\tif(vx > 0) {\n\t\t\t\treflectOfX(*tx, *ty, *tz, vx, vy, vz, a, tx, ty, tz);\n\t\t\t\tif(isValid(tx, ty, tz, a, b)) {\n\t\t\t\t\tpx = tx, py = ty, pz = tz;\n\t\t\t\t\tatX = true;\n\t\t\t\t\tvx = -vx;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\t\n\t\t\t} else if(vx < 0) {\n\t\t\t\treflectOfX(*tx, *ty, *tz, vx, vy, vz, 0.0, tx, ty, tz);\n\t\t\t\tif(isValid(tx, ty, tz, a, b)) {\n\t\t\t\t\tpx = tx, py = ty, pz = tz;\n\t\t\t\t\tatX = true;\n\t\t\t\t\tvx = -vx;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t\t*tx = *px, *ty = *py, *tz = *pz;\n\t\t\treflectOfZ(*tx, *ty, *tz, vx, vy, vz, *tz == 0.0?b:0.0, tx, ty, tz);\n\t\t\tpx = tx, py = ty, pz = tz;\n\t\t\tvz = -vz;\t\n\t\t}\n\t}\n\tprintf(\"%lf %lf\\n\", *px, *pz);\n\n \treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "7c5fc8ecd685d5caf2a7ffa6723c0ae7", "src_uid": "84848b8bd92fd2834db1ee9cb0899cff", "apr_id": "2bdc67ddc3441de17ce17ebba0bb655c", "difficulty": 1700, "tags": ["geometry", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8906823184152605, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#include\n#include\n#include\n#include\n#include\nusing namespace std;\nconst int maxn = 1e4+10;\ndouble dp[maxn][maxn];//\ufffd\ufffd\u04bb\u03ac\ufffd\ufffd\u02be\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u06b6\ufffd\u03ac\ufffd\ufffd\u02be\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \nint main()\n{\n\tint w,b;\n\tcin>>w>>b;\n\tmemset(dp,0.0,sizeof(dp));\n\tfor(int i=1;i<=w;i++) dp[i][0]=1.0;\n\tfor(int i=0;i<=b;i++) dp[0][i]=0.0;\n\tfor(int i=1;i<=w;i++)\n\t{\n\t\tfor(int j=1;j<=b;j++)\n\t\t{\n\t\t\tdp[i][j]+=((double)i/(i+j));\n\t\t\tif(j>=3)\n\t\t\t{\n\t\t\t\tdp[i][j]+=((double)j/(i+j))*((double)(j-1)/(i+j-1))*((double)(j-2)/(i+j-2))*dp[i][j-3];\n\t\t\t}\n\t\t\tif(j>=2)\n\t\t\t{\n\t\t\t\tdp[i][j]+=((double)j/(i+j))*((double)(j-1)/(i+j-1))*((double)i/(i+j-2))*dp[i-1][j-2];\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%.9lf\",dp[w][b]);\n\treturn 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "40cb5ad3e35d9b3b7429a1e3b700e1ca", "src_uid": "7adb8bf6879925955bf187c3d05fde8c", "apr_id": "c23eaf1d99152572ac5fa9ca502a25ee", "difficulty": 1800, "tags": ["math", "dp", "games", "probabilities"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.13647642679900746, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 8, "bug_source_code": "#include\nusing namespace std;\nint n,a[5];\nvoid qsort(int l,int r)\n{\n int mid=a[(l+r)/2];\n int i=l,j=r;\n do{\n while(a[i]mid) j--;\n if(i<=j)\n {\n swap(a[i],a[j]);\n i++;\n j--;\n }\n }while(i<=j);\n if(l>n;\n for(int i=1;i<=n;++i) cin>>a[i];\n qsort(1,n);\n cout<\nusing namespace std;\nint main() {\nint n,k,c=3;\ncin>>n>>k;\nint rk=k; \nint gk=k; \nint bk=k; \nfor (int i=1;1<=n;i++){\n rk-=2;\n gk-=5;\n bk-=8;\n if(rk<2){\n \n c++;\n rk+=5;\n }\n if (gk<5){\n\n c++;\n gk+=5;\n }\n if (bk<8){\n \n c++;\n bk+=5;\n }\n\n}\ncout<\n#define pi 3,141592653589793238462643\nusing namespace std;\nint btd(int n){\n\t int decimalNumber = 0, i = 0, remainder;\n while (n!=0)\n {\n remainder = n%10;\n n /= 10;\n decimalNumber += remainder*pow(2,i);\n ++i;\n }\n return decimalNumber;\n\t}\nstring dtb(int n){\n\tstring x=\"\";\n\t\n\t\n\twhile(n){\n\t\tif(n%2==1)\n\t\tx.push_back('1');\n\t\telse if(n%2==0)\n\t\tx.push_back('0');\n\t\tn/=2;\n\t}\n\treverse(x.begin(),x.end());\n\treturn x;\n}\nstring tos(int n){\n\tstring x;\n\twhile(n){\n\tx+=(n%10);\n\tn/=10;\n\t}\nreturn x;\n}\nint main(){\n\tios_base::sync_with_stdio(false);\n\tcin.tie(0);\n long long a,b;\n cin >> a >> b;\n int q =btd(a) ^ btd(b);\n string j = tos(a);\n\tstring p = dtb(q), ans;\n\tint sz = j.size() - p.size();\n\twhile(ans.length()\n#include\n#include\n#include\n#include\n#include\n#include\n\nusing namespace std;\n\nconst int MAXN = 450 + 30;\nconst int INF = 1e9 + 7;\n\nint n;\nbool mark[MAXN];\nvector\tadj[MAXN], sadj[MAXN];\nvector\tst;\nvector\tcomp[3];\nint col[MAXN];\n\nvoid dfs(int v){\n\tif (mark[v])\n\t\treturn;\n\tfor (int u:adj[v])\n\t\tdfs(u);\n\tst.push_back(v);\n}\t\n\nbool cmp(int a, int b){\n\treturn\tcol[a] < col[b];\n}\n\nint uu, vv;\nbool flag;\nint ret = 0, cn = 0;\n\nint get(int s){\n\tret = cn = 0;\n\tmemset(mark, 0, sizeof(mark));\n\tfor (; cn < n; s = (s + 1) % 3, ret++){\n\t\tfor (int i = 0; i < comp[s].size(); i++){\n\t\t\tuu = comp[s][i];\n\t\t\tif (mark[uu])\tcontinue;\n\t\t\tflag = 1;\n\t\t\tfor (int j = 0; j < sadj[uu].size(); j++){\n\t\t\t\tvv = sadj[uu][j];\n\t\t\t\tif (!mark[vv]){\n\t\t\t\t\tflag = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (flag){\n\t\t\t\tmark[uu] = 1;\n\t\t\t\tcn++;\n\t\t\t}\n\t\t}\n\t}\n\tret--;\n\treturn\tret + n;\n}\n\nint main(){\n\tios::sync_with_stdio(false);\n\tcin.tie(0);\n\tcin >> n;\n\tfor (int i = 0; i < n; i++){\n\t\tint temp;\tcin >> temp;\ttemp--;\n\t\tcomp[temp].push_back(i);\n\t}\n\tfor (int i = 0; i < n; i++){\n\t\tint t;\tcin >> t;\n\t\tfor (int j = 0; j < t; j++){\n\t\t\tint v;\tcin >> v;\tv--;\n\t\t\tadj[v].push_back(i);\n\t\t\tsadj[i].push_back(v);\n\t\t}\n\t}\n\n\tfor (int i = 0; i < n; i++)\n\t\tif (!mark[i])\n\t\t\tdfs(i);\n\treverse(st.begin(), st.end());\n\tfor (int i = 0; i < st.size(); i++)\n\t\tcol[st[i]] = i;\n\tst.clear();\n\n\tfor (int i = 0; i < 3; i++)\n\t\tsort(comp[i].begin(), comp[i].end(), cmp);\n\n\tint ans = min(get(0), get(1));\n\tans = min(ans, get(2));\n\tcout << ans << endl;\n\treturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "96903b90a1b7f7411fce88e29352118b", "src_uid": "be42e213ff43e303e475d77a9560367f", "apr_id": "885d3c9f2e93e42a8efcfffae4b16474", "difficulty": 1700, "tags": ["brute force", "greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.07815275310834814, "equal_cnt": 13, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 14, "bug_source_code": "#include\n\n\nint main ()\n{\n \n int n, k, m, i, t ; \n \n while (scanf(\"%d %d %d\", &n, &k, &m)){\n \n i = k/n;\n t = m/n;\n \n if(i >= 1 && t >= 1)\n \n printf(\"Yes\");\n \n else\n \n printf(\"No\");\n \n }\n\n\n return 0;\n \n}", "lang": "GNU C++17", "bug_code_uid": "484fcd023b11cdc78ad4af9aaacbbae8", "src_uid": "6cd07298b23cc6ce994bb1811b9629c4", "apr_id": "b511cdd9853aad79c59a577598057342", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.4270213510675534, "equal_cnt": 15, "replace_cnt": 4, "delete_cnt": 4, "insert_cnt": 6, "fix_ops_cnt": 14, "bug_source_code": "#include\nusing namespace std ;\n#define Fors(n) for(int i=1;i<=n;i++)\n#define For(n) for(i=0;i s\n#define pb(x) push_back(x)\n#define mpair(x,y) make_pair(x,y)\n#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);\n\nll x=0,y=0,s=0,n=0,i=0;\n\nint main(){\n IOS;\n ll a,b,c;\n cin >>a >> b >>c;\n x = min(a/3, min (b/2,c/2));\n a -= (3*x);\n b -= (2*x);\n c -= (2*x);\n //cout << x << \" LL \"<< endl;\n vector v;\n //cout << a+b+c << endl;\n ll z = a+b+c;\n for (i = 0;i < (z); i++){\n \t//cout << (i%7) << \" :: \";\n \tif (i%7== 0 || i%7 == 3 || i%7==6){\n \t\tif (a > 0){\n \t\t\tll c1 = 1;\n \t\t\tv.pb(c1);\n \t\t\ta--;\n \t\t}\n \t\telse{\n \t\t\tll c1 = 0;\n \t\t\tv.pb(c1);\n \t\t}\n \t}\n \telse if (i%7== 1 || i%7 ==5){\n \t\tif (b > 0){\n \t\t\tll c1 = 1;\n \t\t\tv.pb(c1);\n \t\t\tb--;\n \t\t}\n \t\telse{\n \t\t\tll c1= 0;\n \t\t\tv.pb(c1);\n \t\t}\n \t}\n \telse if (i%7== 2 || i%7 == 4 ){\n \t\tif (c > 0){\n \t\t\tll c1 = 1;\n \t\t\tv.pb(c1);\n \t\t\tc--;\n \t\t}\n \t\telse{\n \t\t\tll c1= 0;\n \t\t\tv.pb(c1);\n \t\t}\n \t}\n \t//cout << v[i] << \" :: \";\n }\n for (i = 0;i\n\nusing namespace std;\n\nint main (){\n int n;\n cin>>n;\n char nam[8];\n for (int i=0; i>nam[i];\n int pos;\n for (int i=0; i\n#include\n#include\n#include\n#include\n#include \n#include\n#include\n#include \n#include \n#include \n#include \n#include \n#include\n\nusing namespace std;\n#define ll long long\n#define min3(a,b,c) min(a,min(b,c))\n#define max3(a,b,c) max(a,max(b,c))\n//int maxel(vector v,ll x){int l=-11111111; for(int i=0;i<=x;i++){if(v[i]>l){l=v[i];}}return l;}\n//int minel(vector v,ll x){int l=11111111; for(int i=0;i<=x;i++){if(v[i]>k>>a>>b; ll sum=0;\n\twhile (a>=k||b>=k)\n\t{\n\t\tif(a>=k&&(a>b+2)){a=a-k;sum++;}\n\t\tif(b>=k&&(b>a+2)){b=b-k;sum++;}\n\t}\n\tif(sum==0){cout<<-1;}\n\telse {cout<\nusing namespace std ;\nint main(){\n string s1 , s2 , s3 = \"\" , s4 = \"\" , s5 ;\n int pos ;\n int pluss = 0 , minuss = 0 , plusss = 0 , minusss = 0 ;\n cin >> s1 >> s2 ;\n s5 = s2 ;\n set s ;\n double probility , res = 0.0 ;\n for(int i = 0 ; i < s1.size() ; ++i){\n if(s1[i] == '+'){\n ++pluss ;\n }else if(s1[i] == '-'){\n ++minuss ;\n }\n }\n for(int i = 0 ; i < s2.size() ; ++i){\n if(s2[i] == '?'){\n s4 += s2[i] ;\n }\n }\n pos = s2.find(s4) ;\n for(int i = 0 ; i < (1 << s1.size()) ; ++i){\n for(int j = 0 ; j < s1.size() ; ++j){\n if(i & (1 << j)){\n s3 += s1[j] ;\n }\n }\n if(s3.size() == s4.size()){\n s2.replace(pos , s4.size() , s3) ;\n s.insert(s2) ;\n s2 = s5 ;\n }\n s3 = \"\" ;\n }\n for(set::iterator it = s.begin() ; it != s.end() ; ++it){\n s5 = *it ;\n for(int i = 0 ; i < s5.length() ; ++i){\n if(s5[i] == '+'){\n ++plusss ;\n }else{\n ++minusss ;\n }\n }\n if((pluss - minuss) == (plusss - minusss)){\n ++res;\n }\n plusss = 0 ;\n minusss = 0 ;\n }\n cout << fixed << setprecision(11) << res/s.size();\n}", "lang": "GNU C++17", "bug_code_uid": "826181526cc07c4897923bc413e5a56f", "src_uid": "f7f68a15cfd33f641132fac265bc5299", "apr_id": "a8bad72c48e6882cf6688116ddc6266e", "difficulty": 1300, "tags": ["dp", "probabilities", "combinatorics", "bitmasks", "math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7701357466063349, "equal_cnt": 25, "replace_cnt": 14, "delete_cnt": 2, "insert_cnt": 8, "fix_ops_cnt": 24, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\n#define ll long long\n#define REP(i,a,b) for(int i=(a),_end_=(b);i<=_end_;i++)\n#define DREP(i,a,b) for(int i=(a),_end_=(b);i>=_end_;i--)\n#define EREP(i,a) for(int i=start[(a)];i;i=e[i].next)\ntemplateinline void chkmax(T &a,T b){ if(ainline void chkmin(T &a,T b){ if(a>b)a=b;}\n#define fi first\n#define se second\n#define mkr(a,b) make_pair(a,b)\ninline int read()\n{\n\tint sum=0,p=1;char ch=getchar();\n\twhile(!(('0'<=ch && ch<='9') || ch=='-'))ch=getchar();\n\tif(ch=='-')p=-1,ch=getchar();\n\twhile('0'<=ch && ch<='9')sum=sum*10+ch-48,ch=getchar();\n\treturn sum*p;\n}\n\nconst int maxn=22;\n\nint n,m,g[maxn][maxn],X[maxn*maxn],Y[maxn*maxn];\n\ninline void init()\n{\n\tn=read();m=read();\n\tREP(i,1,n)REP(j,1,m)g[i][j]=read(),X[g[i][j]]=i,Y[g[i][j]]=j;\n}\n\nstruct point {\n\tint x,y;\n\tpoint(int a=0,int b=0){ x=a; y=b;}\n};\n\ninline point operator + (point a,point b){ return point(a.x+b.x,a.y+b.y);}\ninline point operator - (point a,point b){ return point(a.x-b.x,a.y-b.y);}\n\n#define P(v) g[(v).x][(v).y]\n\nconst point tr[4]={point(0,1),point(1,0),point(0,-1),point(-1,0)};\n\ninline point GetPoint(int x)\n{\n\treturn point((x-1)/m+1,(x-1)%m+1);\n}\n\ninline int GetVal(point x)\n{\n\treturn (x.x-1)*m+x.y;\n}\n\ninline void Swap(point a,point b)\n{\n\tint &v1=g[a.x][a.y],&v2=g[b.x][b.y];\n\tswap(X[v1],X[v2]); swap(Y[v1],Y[v2]);\n\tswap(v1,v2);\n\t//swap(a,b);\n}\n\nvector >Ans;\n\ninline void Move4(point &a,int turn1,int turn2)//\n{\n\tpoint b=a+tr[turn1],c,d;\n\tc=b+tr[turn2]; d=a+tr[turn2];\n\tvectorv;\n\tv={P(a),P(b),P(c),P(d)};\n\tAns.push_back(v);\n //printf(\"4 %d %d %d %d\\n\",P(a),P(b),P(c),P(d)); \n\t\n\tSwap(c,d); Swap(b,c); Swap(a,b);\t\n\ta=b;\n\t\n\t/*printf(\"Case:%d\\n\",(int)Ans.size());\n\tREP(i,1,n)\n\t{\n\t\tREP(j,1,m)printf(\"%d \",g[i][j]);\n\t\tputs(\"\");\n\t\t}*/\n\t//puts(\"\");\n}\n\ninline void Move4_(point a,int turn1,int turn2)//\n{\n\tpoint b=a+tr[turn1],c,d;\n\tc=b+tr[turn2]; d=a+tr[turn2];\n\tvectorv;\n\tv={P(a),P(b),P(c),P(d)};\n\t//printf(\"4 %d %d %d %d\\n\",P(a),P(b),P(c),P(d));\n\t//puts(\"\");\n\tAns.push_back(v);\n\tSwap(c,d); Swap(b,c); Swap(a,b);\t\n\t//Swap(a,b); Swap(b,c); Swap(c,d);\n\t//a=b;\n\t/*printf(\"Case:%d\\n\",(int)Ans.size());\n\tREP(i,1,n)\n\t{\n\t\tREP(j,1,m)printf(\"%d \",g[i][j]);\n\t\tputs(\"\");\n\t}\n\n\tputs(\"\");*/\n\t\n}\n\n#define Right 0\n#define Left 2\n#define Up 3\n#define Down 1\n\ninline void doing()\n{\n\tDREP(i,n,3)DREP(j,m,3)\n\t{\n\t\tint val=(i-1)*m+j;\n\t\tpoint now=point(X[val],Y[val]);\n\t\tDREP(k,now.y,2)Move4(now,2,now.x>1?3:1);\n\t\tREP(k,now.x,i-1)Move4(now,1,0);\n\t\tDREP(k,now.x,i+1)Move4(now,3,0);\n\t\tREP(k,1,j-1)Move4(now,0,3);\n\t}\n\n\tDREP(i,n,3)\n\t{\n\t\tint v1=(i-1)*m+1,v2=(i-1)*m+2;\n\t\tpoint now=point(X[v1],Y[v1]);\n\t\tDREP(k,now.y,2)Move4(now,Left,now.x>1?Up:Down);\n\t\tREP(k,now.x,i-1)Move4(now,Down,Right);\n\t\tif(X[v2]==i-1 && Y[v2]==1)\n\t\t{\n\t\t\tpoint now2=point(X[v2],Y[v2]);\n\t\t\tMove4(now2,Right,Up);\n\t\t\tMove4(now,Right,Up);\n\t\t\tnow2=point(X[v2],Y[v2]);\n\t\t\tMove4(now2,Right,Up);\n\t\t\tMove4(now,Left,Up);\n\t\t}else\n\t\t{\n\t\t\tMove4(now,Right,Up);\n\t\t\tnow=point(X[v2],Y[v2]);\n\t\t\n\t\t\tDREP(k,now.y,2)Move4(now,Left,now.x>1?Up:Down);\n\t\t\tREP(k,now.x,i-2)Move4(now,Down,Right);\n\t\t\tMove4(now,Right,Up);\n\t\t\t\n\t\t\tMove4(now,Down,Left);\n\t\t}\n\t}\n\n\tDREP(j,m,3)\n\t{\n\t\tint v1=j,v2=m+j;\n\t\tpoint now=point(X[v1],Y[v1]);\n\t\tif(now.x==1)Move4(now,Down,now.y>1?Left:Right);\n\t\tREP(k,now.y,j-1)Move4(now,Right,Up);\n\n\t\tif(X[v2]==1 && Y[v2]==j)\n\t\t{\n\t\t\tpoint now2=point(X[v2],Y[v2]);\n\t\t\tMove4(now2,Left,Down);\n\t\t\tMove4(now2,Down,Left);\n\t\t\tMove4(now2,Up,Right);\n\t\t\tMove4(now2,Down,Left);\n\t\t\tMove4(now2,Right,Up);\n\t\t}else\n\t\t{\n\t\t\tnow=point(X[v2],Y[v2]);\n\t\t\tif(now.x==1)Move4(now,Down,now.y>1?Left:Right);\n\t\t\tREP(k,now.y,j-2)Move4(now,Right,Up);\n\t\t\tMove4(now,Right,Up);\n\t\t}\n\t}\n\t\n\twhile(g[1][1]>2 || g[1][2]>2)Move4_(point(1,1),Right,Down);\n\tif(Y[m+1]==2)\n\t{\n\t\t//Move4();\n\n\t\tvectorv;\n\t\tv={g[1][1],g[2][1],g[2][2],g[2][3],g[1][3],g[1][2]};\n\t\t//printf(\"6 %d %d %d %d %d %d\\n\",g[1][1],g[2][1],g[2][2],g[2][3],g[1][3],g[1][2]);\n\t\tAns.push_back(v);\n\n\t\t\n\t\t\n\t\tSwap(point(1,1),point(1,2)); Swap(point(1,2),point(1,3));\n\t\tSwap(point(1,3),point(2,3)); Swap(point(2,3),point(2,2));\n\t\tSwap(point(2,2),point(2,1));\n\n\t\t/*printf(\"Case:%d\\n\",(int)Ans.size());\n\t\tREP(i,1,n)\n\t\t{\n\t\t\tREP(j,1,m)printf(\"%d \",g[i][j]);\n\t\t\tputs(\"\");\n\t\t}\n\t\t\n\t\tputs(\"\");*/\n\t\t\n\t\tMove4_(point(1,2),Right,Down);\n\t\tMove4_(point(1,1),Right,Down);\n\t}\n\n\tif(Y[1]==2)\n\t{\n\t\tvectorv;\n\t\tv={g[1][1],g[1][2],g[1][3],g[2][3],g[2][2],g[2][1]};\n //printf(\"6 %d %d %d %d %d %d\\n\",g[1][1],g[1][2],g[1][3],g[2][3],g[2][2],g[2][1]);\n\t\tSwap(point(2,2),point(2,1)); Swap(point(2,3),point(2,2));\n\t\tSwap(point(1,3),point(2,3)); Swap(point(1,2),point(1,3)); \n\t\tSwap(point(1,1),point(1,2));\n\t\tAns.push_back(v);\n\t\t\n\t\t/*printf(\"Case:%d\\n\",(int)Ans.size());\n\t\tREP(i,1,n)\n\t\t{\n\t\t\tREP(j,1,m)printf(\"%d \",g[i][j]);\n\t\t\tputs(\"\");\n\t\t}\n\n\t\tputs(\"\");*/\n\t\t\n\t\tMove4_(point(1,2),Down,Right);\n\t\tMove4_(point(1,2),Left,Down);\n\t}\n\n\tprintf(\"%d\\n\",(int)Ans.size());\n\tfor(vector v:Ans)\n\t{\n\t\tprintf(\"%d \",(int)v.size());\n\t\tfor(int t:v)printf(\"%d \",t);\n\t\tputs(\"\");\n\t}\n\t\n\t/*REP(i,1,n)\n\t{\n\t\tREP(j,1,m)printf(\"%d \",g[i][j]);\n\t\tputs(\"\");\n\t\t}*/\n}\n\n// 4 1 2\n// 7 6 3\n// 8 5 9\n\nint main()\n{\n#ifndef ONLINE_JUDGE\n\tfreopen(\"E.in\",\"r\",stdin);\n\tfreopen(\"E.out\",\"w\",stdout);\n#endif\n\tinit();\n\tdoing();\n\treturn 0;\n}\n\n", "lang": "GNU C++14", "bug_code_uid": "9c92261c7caaea5ab40730072c1f636f", "src_uid": "476afa2d8208ec933617c97637b65aff", "apr_id": "e9074b1585c653153da6aa07096fa23a", "difficulty": 3100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8916055419722901, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 7, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nint main()\n{\n //freopen(\"input.txt\",\"r\",stdin);\n string a,c;\n int b,d;\n cin >> b >> d;\n cin >> a >> c;\n long long ans=0;\n long long cnt=0;\n long long cnt1;\n int cnt2[101], pos[101],cnt3[101];\n long long l=a.length();\n long long r=c.length();\n bool fl=true;\n string w;\n w=a;\n for (int i=0;i<1000;i++)\n {\n w=w+a;\n }\n long long ll=w.length();\n long long j=0;\n long long x,y;\n bool flag=true;\n for (int i=0;i<101;i++)\n {\n pos[i]=0;\n }\n int i,cnt4,cnt5;\n for (i=0;(icnt5)\n {\n b-=cnt5;\n ans+=cnt4;\n ans+=(b/cnt1)*cnt;\n b=b%cnt1;\n if ((b==0))\n {\n if (fl) fl2=true;\n }\n }\n else\n {\n fl=false;\n }\n// cout << ans/d<\n#include\n\nint main()\n{\n int x1, x2, x3, x4,x5,operation_code = 0,test_code=0,t;\n int gap1, gap2, gap3;\n float dvd1, dvd2, dvd3;\n scanf(\"%d%d%d%d\", &x1, &x2, &x3, &x4);\n gap1 = x2 - x1;\n gap2 = x3 - x2;\n gap3 = x4 - x3;\n if (gap1 == gap2 && gap2 == gap3) {\n operation_code = 1; goto te;\n }\n\n if (x1 >= x2)\n {\n dvd1 = (float)x1 / (float)x2;\n dvd2 = (float)x2 / (float)x3;\n dvd3 = (float)x3 / (float)x4;\n test_code = 1;\n }\n else if (x1 < x2)\n {\n dvd1 = (float)x2 / (float)x1;\n dvd2 = (float)x3 / (float)x2;\n dvd3 = (float)x4 / (float)x3;\n test_code = 2;\n }\n if (test_code == 1 && ((float)x4*dvd3 != (float)x3 || (float)x3*dvd2 != (float)x2 || (float)x2*dvd1 != (float)x1))\n {\n operation_code = 0;\n goto te;\n }\n else if (test_code == 1)\n {\n x5 = x4 / dvd1;\n t = dvd1 * x5;\n if (t != x4) operation_code = 0;\n else operation_code = 2;\n goto te;\n }\n\n if (test_code == 2 && ((float) x3*dvd3 != (float) x4 || (float) x2*dvd2 != (float) x3 || (float) x1*dvd1 != (float) x2))\n {\n operation_code = 0;\n goto te;\n }\n else if (test_code == 2)\n {\n x5 = x4 * dvd1;\n if (x5/dvd1 != x4) operation_code = 0;\n else operation_code = 2;\n goto te;\n }\nte:\n\n if (operation_code == 0)\n printf(\"42\\n\");\n else if (operation_code == 1)\n printf(\"%d\\n\", x4 + gap1);\n else if (operation_code == 2)\n printf(\"%d\\n\", x5);\n return 0;\n}", "lang": "GNU C++", "bug_code_uid": "8f0d666ec89f3886cec66781acb02e60", "src_uid": "68a9508d49fec672f9c61766d6051047", "apr_id": "e70ed1b6f7ef406cdbe27c20f0b0b62e", "difficulty": 1800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.8351177730192719, "equal_cnt": 21, "replace_cnt": 13, "delete_cnt": 2, "insert_cnt": 6, "fix_ops_cnt": 21, "bug_source_code": "#include\n\n#define Write freopen(\"out.txt\",\"w\",stdout)\n#define Read freopen(\"in.txt\",\"r\",stdin)\n\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\n#define lli long long\n#define m_p make_pair\n#define p_b push_back\n\n\n#define lim 10000000000\n#define mod 200\n#define Max 100005\n#define PI acos(-1.0)\n\n///*** set bit and check bit**\n#define IsComp(n) (arr[n>>6]&(1<<((n>>1)&31)))\n#define SetComp(n) arr[n>>6]|=(1<<((n>>1)&31))\nusing namespace std;\n\n/** Direction Array **/\nint dirx[]= {1,0,-1,0};\nint diry[]= {0,1,0,-1};\n\n/*** Translator Functions***/\n//int ToInt(string s){int r = 0;stringstream sin(s);sin >> r;return r;}\n//double ToDouble(string s) { double r = 0; stringstream sin(s); sin >> r; return r; }\n//string ToString(int n) { string s; stringstream convert;convert << n;s = convert.str();return s;}\n/****My code goes from here***/\npriority_queue,pair>, vector,pair>>, greater,pair>> > q2;\nvector< pair ,pair > > v[100];\nint ans[101];\n\nint main()\n{\n\n int a,b;\n cin>>a>>b;\n for(int i=0; i>x>>y>>z;\n ans[y]=b+1;\n v[x].p_b(m_p(m_p(z,-1*x),m_p(y,i+1)));\n }\n\n\n for(int i=1; i<=a; i++)\n {\n int p=v[i].size();\n if(p!=0)\n {\n for(int j=0; j uu=v[i][j].first;\n pair vv=v[i][j].second;\n\n q2.push(m_p(uu,vv));\n\n\n }\n //pq.push()\n }\n if(!q2.empty())\n {\n pair< pair,pair> nw=q2.top();\n\n pair xx=nw.first;\n pair yy=nw.second;\n //cout<=yy.first) continue;\n if(ans[i]!=0) continue;\n q2.pop();\n ans[i]=yy.second;\n int idx=yy.second;\n int prio=xx.first-1;\n int start=xx.second;\n int prep=yy.first;\n if(prio==0) continue;\n else\n {\n q2.push(m_p(m_p(prio,start),m_p(prep,idx)));\n }\n\n\n\n\n\n\n }\n }\n if(!q2.empty()) cout<<\"-1\"<\nusing namespace std;\n\nstruct dor {\n int sg;\n bool sgl, sgr, fl;\n dor *l, *r;\n dor() {\n l = r = NULL;\n sg = fl =sgl = sgr = 0;\n }\n \n void pump() {\n sgl = l->sgl;\n sgr = r->sgr;\n sg = l->sg + r->sg;\n if(l->sgr && r->sgl) --sg;\n }\n \n void fll() {\n l = r = NULL;\n sg = fl = sgl = sgr = 1;\n }\n};\n\nconst int m = 1e9;\nint n, a, b;\ndor *root;\n\nvoid upd(int l, int r, int sl, int sr, dor *&t) {\n if(t == NULL) t = new dor();\n if(t->fl) return;\n if(l > sr || r < sl) return;\n if(l >= sl && r <= sr) {\n t->fll();\n return;\n }\n upd(l, (l + r) / 2, sl, sr, t->l);\n upd((l + r) / 2 + 1, r, sl, sr, t->r);\n t->pump();\n}\n\nint main() {\n cin >> n;\n for(int i = 0; i < n; ++i) {\n cin >> a >> b;\n upd(1, m, a, b - 1, root);\n cout << root->sg << \" \";\n }\n}", "lang": "GNU C++17", "bug_code_uid": "81f4cd16b3bde9f09ccf5f3a4bc27b16", "src_uid": "3979abbe7bad0f3b5cab15c1cba19f6b", "apr_id": "238b815b928dabeff0d60024b815304d", "difficulty": 2100, "tags": ["data structures"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.2599608099281515, "equal_cnt": 10, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 10, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\n#pragma comment(linker, \ufffd\ufffd/STACK:1024000000,1024000000\ufffd\ufffd)\nlong long m;\nint main(){\nlong long c=2*2*2;\nlong long d=3*3*3;\nvectora;\nlong long b=1;\nfor(int i=1;i<=15;i++)b*=10;\npriority_queue,greater >q;\nfor(long long i =1;i<=b/8+1;i++){\n if(i*8<=b){\n q.push(i*8);\n }\n if(i*27<=b){\n q.push(i*27);\n }\n}\nwhile(!q.empty()){\n a.push_back(q.top());\n q.pop();\n}\ncin>>m;\nm--;\nif(a[m+1]!=a[m]){\n\n cout<\nusing namespace std;\nlong long gcd(long long a,long long b)\n{\n return (b==0) ? a : gcd(b, a%b);\n }\nint main()\n{\n\tlong long n,a=0,b=0,k,i;\n\tcin >> n >> k;\n\tif(k0 && arr[i-1]==1))\t\t\t\t\n\t\t\t\t\tb++;\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\t\n\t\tb=0;\n\t\ta=0;\n\t}\n\tcout << a << \" \" << b << \"\\n\";\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "8fc5536b56641a3b622bcb2b5b3f15a7", "src_uid": "bdccf34b5a5ae13238c89a60814b9f86", "apr_id": "134bee310963e1812acfff9e6d49f337", "difficulty": 1200, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9979166666666667, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include\n\nusing namespace std;\n\nconst int N = 1e8 + 10;\n\nint m , factoriel[N] , cnt;\n\nint mod_5(int a) {\n\tint ans = 0;\n\twhile (a % 5 == 0) {\n\t\tans++;\n\t\ta /= 5;\n\t}\n\treturn ans;\n}\n\nint main() {\n\tcin >> m;\n\tfactoriel[0] = 0 , factoriel[1] = 0;\n\tfor (int i = 1; i < N; i++) {\n\t\tfactoriel[i] = factoriel[i - 1] + mod_5(i);\n\t\tif (factoriel[i] == m)\n\t\t\tcnt++;\n\t}\n\tcout << cnt << endl;\n\tfor (int i = 0; i < N; i++)\n\t\tif (factoriel[i] == m)\n\t\t\tcout << i << \" \";\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "0f48245e991075e2197b690466b53b31", "src_uid": "c27ecc6e4755b21f95a6b1b657ef0744", "apr_id": "f2cbaf9b634e29aafd4f576f8bdb5e9a", "difficulty": 1300, "tags": ["brute force", "math", "constructive algorithms", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7822536143913476, "equal_cnt": 24, "replace_cnt": 19, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 23, "bug_source_code": "/*\n author: Maksim1744\n created: 01.11.2020 17:50:30\n*/\n\n#include \n\nusing namespace std;\n\n#define ll long long\n#define ld long double\n\n#define mp make_pair\n#define pb push_back\n#define eb emplace_back\n\n#define sum(a) ( accumulate ((a).begin(), (a).end(), 0ll))\n#define mine(a) (*min_element((a).begin(), (a).end()))\n#define maxe(a) (*max_element((a).begin(), (a).end()))\n#define mini(a) ( min_element((a).begin(), (a).end()) - (a).begin())\n#define maxi(a) ( max_element((a).begin(), (a).end()) - (a).begin())\n#define lowb(a, x) ( lower_bound((a).begin(), (a).end(), (x)) - (a).begin())\n#define uppb(a, x) ( upper_bound((a).begin(), (a).end(), (x)) - (a).begin())\n\ntemplate vector& operator-- (vector& v){for (auto& i : v) --i; return v;}\ntemplate vector& operator++ (vector& v){for (auto& i : v) ++i; return v;}\ntemplate istream& operator>>(istream& is, vector& v){for (auto& i : v) is >> i; return is;}\ntemplate ostream& operator<<(ostream& os, vector& v){for (auto& i : v) os << i << ' '; return os;}\ntemplate istream& operator>>(istream& is, pair& p){is >> p.first >> p.second; return is;}\ntemplate ostream& operator<<(ostream& os, pair& p){os << p.first << ' ' << p.second; return os;}\ntemplate pair operator-(pair a, pair b){return mp(a.first-b.first, a.second-b.second);}\ntemplate pair operator+(pair a, pair b){return mp(a.first+b.first, a.second+b.second);}\ntemplate void umin(T& a, U b){if (a > b) a = b;}\ntemplate void umax(T& a, U b){if (a < b) a = b;}\n\n#ifdef HOME\n#define TAG_LENGTH 25\n#define LR_LEFT left\n#define LR_RIGHT right\n#define LR_VALUE value\n#define LR_SECOND_VALUE mn\n#include \"C:/C++ libs/print.cpp\"\n#else\n#define showl 42;\n#define shows 42;\n#define show(...) 42;\n#define showm(...) 42;\n#define showt(...) 42;\n#define printTree(...) 42;\n#define printGraph(...) 42;\n#define printLRTree(...) 42;\n#define printMatrix(...) 42;\n#define printWGraph(...) 42;\n#define debug if (false)\n#endif\n\nint main() {\n ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);\n\n int n, k;\n cin >> n >> k;\n vector> a(n);\n for (int i = 0; i < n; ++i) {\n int t;\n cin >> t;\n a[i].resize(t);\n cin >> a[i];\n if (a[i].size() > k)\n a[i].resize(k);\n }\n vector> pref(n);\n for (int i = 0; i < n; ++i) {\n pref[i].pb(a[i][0]);\n for (int j = 1; j < a[i].size(); ++j) {\n pref[i].pb(pref[i].back() + a[i][j]);\n }\n }\n\n vector> pos(n, vector(k + 1));\n\n for (int ln = 1; ln <= k; ++ln) {\n vector> v;\n for (int i = 0; i < n; ++i) {\n if (pref[i].size() >= ln)\n v.eb(pref[i][ln - 1], i);\n }\n sort(v.rbegin(), v.rend());\n for (int i = 0; i < v.size(); ++i) {\n pos[i][v[i].second] = i;\n }\n }\n\n vector> only_full(n + 1, vector(k + 1, 0)), partial(n + 1, vector(k + 1, 0));\n for (int i = 0; i < n; ++i) {\n ll sm = pref[i].back();\n only_full[i + 1] = only_full[i];\n partial[i + 1] = partial[i];\n for (int j = k - (int)a[i].size(); j >= 0; --j) {\n only_full[i + 1][j + a[i].size()] = max(only_full[i + 1][j + a[i].size()], only_full[i][j] + sm);\n partial[i + 1][j + a[i].size()] = max(partial[i + 1][j + a[i].size()], partial[i][j] + sm);\n }\n for (int ln = 1; ln <= a[i].size(); ++ln) {\n int cbefore = pos[i][ln - 1] * ln;\n if (cbefore > k) continue;\n for (int j = 0; j + ln <= k; ++j)\n partial[i + 1][j + ln] = max(partial[i + 1][j + ln], only_full[i][j] + pref[i][ln - 1]);\n }\n }\n // shows;\n // printMatrix(only_full);\n // shows;\n // printMatrix(partial);\n // shows;\n cout << max(only_full[n][k], partial[n][k]) << '\\n';\n\n return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "b9a61a27fe19162fd48c9f1aaddf42e6", "src_uid": "9e9d4f58ebd8293025ab8004aeb8d343", "apr_id": "bcb72bf1fd15a24eb5142da0e7849af5", "difficulty": 2800, "tags": ["divide and conquer", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9950510687585553, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "/*\n * \tThe way if it's all predetermined\n * \t\tAnd the way i should go all my life\n * \t\t\tI swear to go wherever will be\n * \t\t\t\t'Cause there'll be something to see and to find\n * \tI don't know the meaning of life\n * \t\tBut i know what's truly precious\n * \t\t\tThe way it's leading me to be in love\n * \t\t\t\tNo fear i can find me always in my heart\n * \tThe life it's not for comparing things\n * \t\tSo i hold both of light and shadow\n * \t\t\tThe rays of stars will bring me to you\n * \t\t\t\tThrought the dark night skies\n * \t\t\t\t\tSee the way to be shined\n * \tI dont know what's right for our lives\n * \t\tBut i know the truth of my love\n * \t\t\tThe way it feels our breaths at the wind\n * \t\t\t\tAnd the way i should go all my life\n * \t\t\t\t\tI swear to go wherever will be\n * \t\t\t\t\t\tThus the grace i wouldn't have\n * \t\t\t\t\t\t\tWill always in my heart\n * \t\t\t\t\t\t\t\tThus the grace i wouldn't have\n * \t\t\t\t\t\t\t\t\tWill always in my heart\n */\n#pragma GCC optimize(\"Ofast\")\n//#pragma GCC target(\"sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native\")\n#include \nusing namespace std;\n#include \n#include \nusing namespace __gnu_pbds;\n#ifndef rd\n#define endl '\\n'\n#endif\n#ifdef rd\n#define trace(...) cout<<\"Line:\"<<__LINE__<<\" \"; __f(#__VA_ARGS__, __VA_ARGS__)\ntemplate\nvoid __f(const char* name, Arg1&& arg1) {\n\tcout<\nvoid __f(const char* names, Arg1&& arg1, Args&&... args) {\n\tconst char* comma=strchr(names+1,',');\n\tcout.write(names,comma-names)<<\" : \"<\n#define pll pair\n#define sz(x) ((long long)x.size())\n#define fr(a,b,c) for(int a=b; a<=c; a++)\n#define rep(a,b,c) for(int a=b; a vi;\ntypedef tree, rb_tree_tag, tree_order_statistics_node_update> oset;\nmt19937 rang(chrono::high_resolution_clock::now().time_since_epoch().count());\nauto clk=clock();\nint rng(int lim) {\n\tuniform_int_distribution uid(0,lim-1);\n\treturn uid(rang);\n}\nconst int MAX_N=2.2e7+2;\nbool np[MAX_N];\nint prime[MAX_N],pi[MAX_N];\nint getprime() {\n\tint cnt=0;\n\tnp[0]=np[1]=true;\n\tpi[0]=pi[1]=0;\n\tfor(int i=2; ic)\n\t\t\tcontinue;\n\t\tll lim=lehmer_pi(sqrt2(w));\n\t\tfor(int j=i; j<=lim; j++)\n\t\t\tsum-=lehmer_pi(w/prime[j])-(j-1);\n\t}\n\treturn sum;\n}\n\nvoid solve() {\n\tint n;\n\tinit();\n\tcin>>n;\n\tint ans=0;\n\tfor(int i=2; i*i<=n; i++) {\n\t\tif(pi[i]!=pi[i-1]) {\n\t\t\ttrace(lehmer_pi(n/i),n/i,i);\n\t\t\tans+=lehmer_pi(n/i)-lehmer_pi(i);\n\t\t}\n\t}\n\ttrace(ans);\n\tfor(int i=2; i*i*i<=n; i++)\n\t\tans++;\n\tcout<>t;\n\twhile(t--)\n\t\tsolve();\n#ifdef rd\n\tcerr<\nusing namespace std;\ntypedef long long LL;\nconst LL MAXS = 20000000;\nint K;//okolo (n/logn)**(2/3), ale wiecej niz sqrt(n)\nint FEN;\n \nvector minPrimeDivisor;\nvector primes;\n \nint fenwick[MAXS+3];\nvoid fenAdd(int i, int v){ for(; i=0) { s+=fenwick[i]; i=(i&(i+1))-1; } return s; }\n \nvoid sieve(){\n minPrimeDivisor.resize(K+1);\n primes.reserve(K/20);\n for(int i=0;i&x)const{\n return hash()((x.first)^((x.second)<<29));\n }\n};\n\nunordered_map,LL,HASH> queries;\n \nLL findGreaterPrimeThanSqtr(LL n){\n LL low = 0, high = primes.size(),mid,lg=-1;\n while(low <= high){\n mid = (low+high)/2;\n if(primes[mid]*(LL)primes[mid] > n){\n high = mid-1;\n lg = mid;\n }\n else\n low = mid+1;\n }\n return lg;\n}\n \nvoid memorize(LL n, LL p){\n if(p == 0 || queries.count({n,p}) > 0)\n return;\n if(n < (LL)primes[p-1]*(LL)primes[p-1]){\n LL p2 = findGreaterPrimeThanSqtr(n);\n if(p != p2){\n memorize(n,p2);\n return;\n }\n }\n if(n <= K){\n queries[{n,p}] = 0;\n return;\n }\n memorize(n,p-1);\n memorize(n/primes[p-1],p-1);\n}\n \nvoid calcForSmall(){\n vector > sortedInts(K), sortedQueries(queries.size());\n for(int i=0;i=0; i--){\n while(sortedInts[cur].first >= primes[sortedQueries[i].first]){\n fenAdd(sortedInts[cur].second,1);\n cur--;\n }\n queries[{sortedQueries[i].second,sortedQueries[i].first}] = fenSum(sortedQueries[i].second);\n }\n \n}\n \nLL solve(LL n,int p){\n if(p == 0)\n return n;\n if(n < (LL)primes[p-1]*(LL)primes[p-1]){\n LL p2 = findGreaterPrimeThanSqtr(n);\n if(p != p2){\n return solve(n,p2) + p2 - p;\n }\n }\n if(queries.count({n,p}) > 0)\n return queries[{n,p}];\n queries[{n,p}] = solve(n,p-1) - solve(n/primes[p-1],p-1);\n return queries[{n,p}];\n}\n \nvoid memPi(LL n){\n LL spg = findGreaterPrimeThanSqtr(n);\n memorize(n,spg);\n}\n \nLL getPi(LL n){\n LL spg = findGreaterPrimeThanSqtr(n);\n return solve(n,spg) + spg - 1;\n}\n \nint32_t main(){\n ios::sync_with_stdio(false);\n\n LL Z;\n cin >> Z;\n\n K = MAXS;\n FEN = K+2;\n queries.max_load_factor(0.25);\n queries.reserve(MAXS);\n sieve();\n\n\n for(LL i=2;i*i\n#include \n#include \n#include \n#include \nusing namespace std;\ndouble m,n;\nchar c;\ndouble k,l;\nint main()\n{\n double sum1,sum2;\n while(scanf(\"%lf%c%lf\",&m,&c,&n))\n {\n sum1=0;sum2=0;\n if(12.0-m>0)\n {\n sum1=m*30.0+(n/2.0);\n }\n else\n {\n sum1=0;\n }\n if(n==0)\n {\n sum2=0;\n }\n else\n sum2=n*6;\n printf(\"%g %g\\n\",sum1,sum2);\n }\n return 0;\n}\n\n\t\t \t\t \t \t \t\t \t \t\t", "lang": "GNU C++", "bug_code_uid": "9431a09c4e56e25327d1c0004860a09c", "src_uid": "175dc0bdb5c9513feb49be6644d0d150", "apr_id": "ded34aeb1589e1ad7de60cd597e7799e", "difficulty": 1200, "tags": ["geometry", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9974715549936789, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\n#define BIT(x) __builtin_popcount(x)\n#define G1(x) cin >> x;\n#define G2(x,y) cin >> x >> y;\n#define G3(x,y,z) cin >> x >> y >> z;\n#define MAX 1005\n#define MOD 1000000007\nint n , m , x,y,a,b,dx,dy;\nint main(){\n scanf(\"%d%d%d%d%d%d\",&n,&m,&x,&y,&a,&b);\n dx = abs(a-x);\n dy = abs(b-y);\n \n if(max(dx,dy)>4){ printf(\"Second\\n\"); return;}\n if(dx + dy >= 7){ printf(\"Second\\n\"); return;}\n \n printf(\"First\\n\");\n\n return 0; \n}\n\n\n\n\n\n\n\n\n\n\n\n", "lang": "GNU C++", "bug_code_uid": "7f1fbf7acdad14d49b106beda1abfdc0", "src_uid": "41f6f90b7307d2383495441114fa8ea2", "apr_id": "13016368b232b8ae44298c2d0666fe04", "difficulty": 2000, "tags": ["combinatorics", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.693069306930693, "equal_cnt": 11, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 10, "bug_source_code": "#include \nusing namespace std; \ntypedef long long ll;\nint n,m; \nint how[] = {31,28,31,30,31,30,31,31,30,31,30,31}; \nint main() {\n cin >> n >> m; \n int days = how[n-1] - (8-m); \n int ans = 1; \n ans += days/7 + (days%7 != 0);\n assert(n != 2);\n cout << ans << \"\\n\";\n return 0; \n}", "lang": "GNU C++", "bug_code_uid": "8557149e61da0ec4d11a8eb70846a518", "src_uid": "5b969b6f564df6f71e23d4adfb2ded74", "apr_id": "66d5487e06589e5d518b6460522fad1b", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9799411607381653, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "#include \"bits/stdc++.h\"\n#include \n\n\nusing namespace std;\n\ntypedef long long ll;\ntypedef unsigned long long ull;\ntypedef pair pii;\ntypedef vector vi;\ntypedef long double ld;\n\n#define sync \\\nios_base::sync_with_stdio(0); \\\ncin.tie(0); \\\ncout.tie(0)\n#define ALL(V) V.begin(), V.end()\n#define SZ(V) (int)V.size()\n#define pb push_back\n#define mp make_pair\n#define fopen freopen(\"input.txt\", \"r\", stdin); freopen(\"output.txt\",\"w\", stdout)\n#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)\n#define FORR(i, b, a) for(ll i = (b) - 1; i >= (a); --i)\n#define REP(i, N) FOR(i, 0, N)\n#define REPR(i, N) RFOR(i, N, 0)\n#define FILL(A,value) memset(A,value,sizeof(A))\n#define ff first\n#define ss second\n#define pii pair\n#define pll pair\n#define MP make_pair\nconst int MOD = 998244353;\nconst ll INF = 3e11 + 7;\nconst int base = 2e5+1;\nconst int MAX =1e5+2;\nconst double EPS = 1e-9;\nconst double PI = acos(-1.);\nconst int MAXN = 2*1e5+1;\n\nint n, m;\nvector v;\n\nll f(ll k)\n{\n ll res = 0;\n if(k == 0) return -1;\n FOR(i,0,n)\n {\n res += max(0ll,v[i] - i/k);\n }\n return res;\n}\n\nint main()\n{\n ll sum = 0;\n cin >> n >> m;\n v.resize(n);\n FOR(i,0,n)\n {\n ll x;\n cin >> x;\n v[i] = x;\n sum += x;\n }\n if( sum < m)\n {\n cout << -1;\n return 0;\n }\n sort(ALL(v));\n reverse(ALL(v));\n ll l = 0, r = n+1;\n while(l < r)\n {\n ll mid = (l+r)/2;\n //cout << l <<' '< m)\n {\n r = mid - 1;\n }\n else l = mid + 1;\n }\n cout << l;\n return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "90f5c4e1decc413ef910c99f60f9a59e", "src_uid": "acb8a57c8cfdb849a55fa65aff86628d", "apr_id": "c499dbd2af37bc2ac267aaa63fd6231d", "difficulty": 1700, "tags": ["brute force", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9676884838442419, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": " #include \n using namespace std;\n vector arr;\n int digi(int x)\n {\n int sum=0;\n int div=10;\n while (x > 0)\n {\n sum+=x%div;\n x/=div;\n }\n return sum;\n }\n int main()\n {\n int n,ans,y;\n cin >> n;\n for(int i=1;i<=(n/2);i++)\n {\n ans=n-i;\n y=digi(ans);\n\n if (y == i)\n arr.push_back(ans);\n\n }\n cout << arr.size() << endl;\n for (int i=0 ; i\n#define lld long long int\n#define ld long double\n#define mod 1000000007\n#define modd 998244353\n#define all(v) v.begin(),v.end()\n#define rep(i,a,b)\tfor(lld i=a;ib;i--)\n#define pb push_back\n#define mp make_pair\n#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);\n\nusing namespace std;\nlld f(lld r);\nint main()\n{\n lld n,a,x,b,y;\n cin>>n>>a>>x>>b>>y;\n vector v1;\n vectorv2;\n lld i=a;\n while(1)\n {\n v1.pb(i%n);\n if(i%n==x)\n {\n break;\n }\n i++;\n }\n lld j=b;\n\n while(1)\n {\n v2.pb(j%(n+1));\n if(j%(n+1)==y)\n {\n break;\n }\n j--;\n if(j==0)\n {\n j=n;\n }\n \n \n \n }\n rep(i,0,min(v1.size(),v2.size()))\n {\n if(v1[i]==v2[i])\n {\n cout<<\"YES\";\n return 0;\n }\n }\n cout<<\"NO\";\n \n}\n", "lang": "GNU C++14", "bug_code_uid": "9f8286a6fd31d51d24aa4dd1d9e356e7", "src_uid": "5b889751f82c9f32f223cdee0c0095e4", "apr_id": "27260a279187826669e2a865d5cfb9f5", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.3370253164556962, "equal_cnt": 28, "replace_cnt": 21, "delete_cnt": 6, "insert_cnt": 1, "fix_ops_cnt": 28, "bug_source_code": "#include\nusing namespace std ;\nusing db = double;\nusing ll = long long;\nusing ull = unsigned long long; \nusing pII = pair ;\nusing pLL = pair ;\n#define s(x) ((ll)(x).size())\n#define deb(x) cout << x << endl\n\nint main()\n{\n\t ll n, FAC;\n\t cin >> n >> FAC;\n\t ll cnt = 0;\n\t ll x = n; \n\t vectorv;\n\t \n\t for(ll i=2; i>=i;\n v.push_back(i);\n }\n }\n \n\t if(s(v)\n#define lol long long\nusing namespace std;\nlol n, i, r, mid, us[300300], ans, p, q, j, m, l, a[300300];\nbool fun(lol x){\n lol k = x, s = 0;\n while(k > 0)\n {\n s = s * 10 + (k % 10);\n k/=10;\n }\n return (s == x);\n}\nint main()\n{\n //ios_base::sync_with_stdio(0);\n cin >> p >> q;\n for(i = 2; i <= 500010; i++)\n a[i] = 1;\n i = 2;\n while(i * i <= 500010){\n j = 2;\n while(i * j <= 500010){\n a[i * j] = 0;\n j++;\n }\n i++;\n }\n for(i = 1; i <= 500010; i++){\n if(a[i])\n ans++;\n l+=fun(i);\n if(ans <= (p * l / q))\n r = i;\n }\n if(r == 0)\n cout << \"Palindromic tree is better than splay tree\";\n else\n cout << r;\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "386207120fc2554dbea9c3d97339fa11", "src_uid": "e6e760164882b9e194a17663625be27d", "apr_id": "fb50ac11b87b56b7b2e0d391b2a64d02", "difficulty": 1600, "tags": ["math", "brute force", "number theory", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9964788732394366, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \nusing namespace std;\n\n#define ll long long\n#define sz(c) (int)c.size()\n\nint main() {\n\tint n;\n\tcin >> n;\n\tvector v(v);\n\tfor (int i = 0; i < n; i++)\n\t\tcin >> v[i];\n\tsort(v.begin(), v.end());\n\tfor (int i = 0; i < n; i++)\n\t\tcout << v[i] << \" \\n\"[i == n];\n}\n\n", "lang": "GNU C++0x", "bug_code_uid": "6f024c4258c8aec91ca4f551bf5ace36", "src_uid": "ae20712265d4adf293e75d016b4b82d8", "apr_id": "422b1adc53e07088ecb431bd7bd32746", "difficulty": 900, "tags": ["greedy", "sortings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7104247104247104, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "#include\n#include\n\nint main(){\n unsigned long int l,t;\n\n unsigned int cnt = 0 , cnt2= 0;\n\n short int a[32][32];\n\n for(int i=0;i<32;i++)\n for(int j=0;j<32;j++)\n a[i][j] = 0;\n\n unsigned long long int P;\n\n scanf(\"%lu%lu\",&l,&t);\n\n for(int i=0;i<31;i++){\n for(int j=0;j<31;j++){\n P = pow(2,i)*pow(3,j);\n if(P>=l&&P<=t){\n if(!a[i][j]){\n a[i][j] = 1;\n cnt2++;\n //printf(\"%d\\t%d\\n\",i,j);\n }\n }else\n break;\n }\n }\n\n printf(\"%lu\",cnt2);\n\n}\n", "lang": "GNU C++14", "bug_code_uid": "a16e8aba66bfa109bd191035c2a8db65", "src_uid": "05fac54ed2064b46338bb18f897a4411", "apr_id": "54bdac3c3969df184c54f452592a7a55", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.783068783068783, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include \nusing namespace std;\nint main()\n{\n unsigned long long int a,b,A,B,c,d,A1,A2,r,t;\n cin >> A >> B >> a >> b;\n A1=a;\n A2=b;\n while(1)\n {\n r=A1%A2;\n if(r==0 && A1/A2!=0)\n break;\n A1=A2;\n A2=r;\n }\n a/=A2;\n b/=A2;\n {\n if(Ad)\n c=d;\n A=a*c;\n B=b*c;\n cout << A << \" \" << B;\n}\n", "lang": "GNU C++17", "bug_code_uid": "658c62627e3e102d7e434c7ff8631a0c", "src_uid": "97999cd7c6de79a4e39f56a41ff59e7a", "apr_id": "64d5bccbb02a7e33a78797d064fa0251", "difficulty": 1800, "tags": ["number theory", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8349687778768956, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n int n,i,c=0,d,j,temp;\n char a[100];\n cin>>n;\n for(i=0;i>a[i];\n }\n sort(a,a+n);\n if(n==1)\n c = 1;\n for(i=0;ic)\n c = d;\n }\n cout<\nusing namespace std;\nint main(){\n\tstring s,s1;\n\tcin>>s;\n\tint j=0;\n\tfor(int i=0;i\n#include\n#include\nusing namespace std;\nint main()\n{\n char c[10];\n int i,j,n,a[30];\n while(1)\n {\n scanf(\"%s\",c);\n int len=strlen(c);\n if(len=0) break;\n memset(a,0,sizeof(a));\n for(i=0;i<6;i++)\n {\n a[c[i]-'A']++;\n }\n j=0;\n if(a['R'-'A']!=0) {a[j]=a['R'-'A'];j++;}\n if(a['G'-'A']!=0) {a[j]=a['G'-'A'];j++;}\n if(a['Y'-'A']!=0) {a[j]=a['Y'-'A'];j++;}\n if(a['O'-'A']!=0) {a[j]=a['O'-'A'];j++;}\n if(a['B'-'A']!=0) {a[j]=a['B'-'A'];j++;}\n if(a['V'-'A']!=0) {a[j]=a['V'-'A'];j++;}\n int n=j;\n sort(a,a+n);\n if(n==1) printf(\"1\\n\");\n else if(n==2)\n {\n if(a[0]==1) printf(\"1\\n\");\n else if(a[1]==2) printf(\"2\\n\");\n else if(a[1]==3) printf(\"2\\n\");\n }\n else if(n==3)\n {\n if(a[0]==1&&a[1]==1) printf(\"2\\n\");\n else if(a[0]==1&&a[1]==2) printf(\"3\\n\");\n else if(a[0]==2) printf(\"5\\n\");\n }\n else if(n==4)\n {\n if(a[3]==3) printf(\"4\\n\");\n else printf(\"4\\n\");\n }\n else if(n==5) printf(\"15\\n\");\n else printf(\"30\\n\");\n }\n return 0;\n}", "lang": "GNU C++", "bug_code_uid": "ee0e5112e4793a4a8b95722d33336cb7", "src_uid": "8176c709c774fa87ca0e45a5a502a409", "apr_id": "11e0bea29829f3d38e0bc84a37552f04", "difficulty": 1700, "tags": ["brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9882671480144405, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n#define clr(x) memset((x), 0, sizeof(x))\n#define pb push_back\n#define mp make_pair\n#define sz size()\n#define x first\n#define y second\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\ntypedef long double ld;\n\n// Constants\nconst ld PI = 3.1415926535897932384626433832795;\nconst ld EPS = 1e-11;\n\n// Types\ntypedef signed long long i64;\ntypedef unsigned long long u64;\ntypedef pair < int, int > PII;\n\ni64 k,b,n,t;\ni64 ans;\n\nint main()\n{\n//\tfreopen(\".in\", \"rt\", stdin);\n//\tfreopen(\".out\", \"wt\", stdout);\n\tcout << setiosflags(ios::fixed) << setprecision(10);\n\n\tcin >>k>>b>>n>>t;\n\t\n\tif(t==1)\n\t{\n\t\tcout <0))\n\t{\n\t\tl=l*k+b;\n\t\tans--;\n\t}\n\tcout <\n\nusing namespace std;\n\nint main()\n{\n int left = 0 , right = 0 , both = 0,d,Flag = 0;\n cin>>left>>right>>both;\n if(both == 0 && left == 0){\n cout<<\"0\"< 0){\n if(left < both){\n left = left + both;\n break;\n }\n }\n d = left;\n if(right>d){\n right--;\n }\n Flag = left + right;\n cout<\n\nusing namespace std;\n\nint main()\n{\n cin >> n >> m >> k;\n if (n == 5 && m == 3 && k == 2) cout << \"Stowaway\";\n if (n == 3 && m == 2 && k == 1) cout << \"Controller 3\";\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "2f4b9b902f9e370b08df6692021c2aeb", "src_uid": "2222ce16926fdc697384add731819f75", "apr_id": "17a05b231054e1cfb04a994851b9a7a0", "difficulty": 1500, "tags": ["dp", "games", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9684873949579832, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include \n#include \n// #include \n\nusing namespace std;\n\n#define ll int\n\nint main(){\n\n\tll n, k;\n\tcin >> n >> k;\n\tvector arr(k);\n\tfor(int i=0; i> arr[i];\n\t}\n\tll changes = 0;\n\tint ones, twos;\n\n\tif(n%k != 0) return -1;\n\n\tfor(int i=0; i\nusing namespace std;\nint main(){\n int n;\n cin>>n;\n if(n==5 || n==46){\n cout<<\"YES\";\n return 0;\n }\n if(n==24 || n==13){\n cout<<\"NO\";\n return 0;\n }\n if(n<25){\n while(1);\n }\n return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "4edd0ef57c26701728d0a7c9655a0cf8", "src_uid": "821529a4644b74483bcdf80fc318d1f8", "apr_id": "f15257caf15a71ee57b361531806be40", "difficulty": null, "tags": ["brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.2876884422110553, "equal_cnt": 23, "replace_cnt": 17, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 23, "bug_source_code": "#include\n#include\nusing namespace std;\nint n1,n2,k1,k2;\nint dp[101][101][101][101];\nint fun(int f,int h,int fc,int hc)\n{\n if(hc>k2||fc>k1||h>n2||f>n1)\n return 0;\n if(h==n2&&f==n1)\n return 1;\n \n int &ret=dp[f][h][fc][hc];\n if(ret!=0)\n return ret;\n ret+=fun(f+1,h,fc+1,0)+fun(f,h+1,0,hc+1);\nreturn ret%100000000;\n}\nvoid rep()\n{\n for(int i=0;i<101;i++)\n for(int j=0;j<101;j++)\n for(int k=0;k<101;k++)\n for(int c=0;c<101;c++)\n dp[i][j][k][c]=0;\n}\nint main()\n{\n while(cin>>n1>>n2>>k1>>k2)\n {\n rep();\n cout<\n#include\n#include\n#define re register\n#define re register\n#define max(a,b) ((a)>(b)?(a):(b))\n#define LL long long\ninline LL cnt(LL x)\n{\n\tint num=0;\n\twhile(x) num+=x%10,x/=10;\n\treturn num;\n}\nLL now=0;\nLL n,ans;\nLL base[15];\nint main()\n{\n\tstd::cin>>n;\n\tnow=9;\n\tbase[0]=1;\n\tfor(re int i=1;i<=12;i++) base[i]=base[i-1]*10;\n\tfor(re int i=1;i;i++)\n\t{\n\t\tif(n-now<0) break;\n\t\tans=max(ans,cnt(now)+cnt(n-now));\n\t\tfor(int j=1;j<=8;j++)\n\t\tif(now-i*base[i]-now>=0) ans=max(ans,cnt(i*base[i]+now)+cnt(now-i*base[i]-now));\n\t\tnow=9*base[i]+now;\n\t}\n\tstd::cout<\n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nconst int N = 31;\nconst int oo = 1e9 + 123;\n\ntypedef pair pi;\n#define mp make_pair\n#define getSz(x) ((x).size())\n\nint n,res = 0;\nint len[N],mid[N];\nvector f1,f2,tmp,tmp2;\n\nvoid refine(){\n\n}\nvoid prune(){\n\n}\nint inter(pi x,pi y){\n\tif(x.first > y.second || y.first > x.second) return 0;\n\treturn min(x.second,y.second) - max(x.first,y.first) + 1;\n}\nbool cover(pi x,pi y){\n\treturn x.first <= y.first && x.second >= y.second;\n}\nvoid refine(vector &f,int k){\n\ttmp.clear();\n\tfor(pi ln : f){\n\t\tif(ln.first < mid[k] && ln.second > mid[k]){\n\t\t\ttmp.push_back(mp(ln.first,len[k - 1]));\n\t\t\ttmp.push_back(mp(1,ln.second - mid[k]));\n\t\t}else if(ln.second < mid[k]){\n\t\t\ttmp.push_back(ln);\n\t\t}else{\n\t\t\ttmp.push_back(mp(ln.first - mid[k],ln.second - mid[k]));\n\t\t}\n\t}\n\tf = tmp;\n}\nvoid show(){\n\tcout <<\"F1 = \";\n\tfor(pi x : f1){\n\t\tcout << \"[\"<> l1 >> r1;\n\tf1.push_back(mp(l1,r1));\n\tcin >> l1 >> r1;\n\tf2.push_back(mp(l1,r1));\n\tsolve(30);\n\n\tcout << res;\n}\nint main(){\n ios_base::sync_with_stdio(false);\n cin.tie();\n cout.tie();\n\n #ifndef ONLINE_JUDGE\n freopen(\"a.inp\",\"r\",stdin);\n freopen(\"a.out\",\"w\",stdout);\n #else\n // online submission\n #endif\n\n // main program here\n\n int tcase = 1;\n //cin >> tcase;\n\n for(int i = 1; i <= tcase; ++i) testcase();\n\n // \n\n cerr << \"\\nTime elapsed: \" << 1000 * clock() / CLOCKS_PER_SEC << \"ms\\n\";\n \n return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "94af87ee10bb33778cfe6e27ec7d5a05", "src_uid": "fe3c0c4c7e9b3afebf2c958251f10513", "apr_id": "40189132b1524d3b2d99256260ce47c5", "difficulty": 2400, "tags": ["divide and conquer"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.6373815676141258, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "#include \nusing namespace std;\nint main() \n{\n\tint x,y=0;\n\tvectorv;\n\tscanf(\"%d\",&x);\n\tif(x<=3)while(1);\n\tif(x<=3)return !printf(\"%d\\n\",x);\n\tfor(int i=0;i<6;i++)\n\t\tv.push_back(x&1),x>>=1;\n//\treverse(v.begin(),v.end());\n//\tfor(auto vv:v)printf(\"%d\",vv);puts(\"\");\n\tswap(v[0],v[1]);\n\tswap(v[4],v[5]);\n//\tfor(auto vv:v)printf(\"%d\",vv);puts(\"\");\n\tfor(int i=0;i<6;i++)\n\t\ty<<=1,y+=v[i];\n\tprintf(\"%d\\n\",y);\n\treturn 0;\n}\n/*\n170362930\n168335702\n168335703\n169099333\n \n000010\n000010\n010000\n \n000101\n011000\n101000\n \n100011\n110010\n110001\n*/", "lang": "GNU C++17", "bug_code_uid": "e2e7f253bddab3c29fb9787aa4fcc009", "src_uid": "db5e54f466e1f3d69a51ea0b346e667c", "apr_id": "9df507ed6c6993bf2766836fcf9b406f", "difficulty": null, "tags": ["bitmasks"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.19377510040160642, "equal_cnt": 19, "replace_cnt": 18, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 19, "bug_source_code": "#include \n\n\n#define all(x) x.begin(), x.end()\n#define allr(x) x.rbegin(), x.rend()\n\nusing namespace std;\n\nconst int N = 80000000;\nint lp[N+1];\nvector pr;\n\n\nvoid Er ()\n{\n for (int i=2; i<=N; ++i) {\n if (lp[i] == 0) {\n lp[i] = i;\n pr.push_back (i);\n }\n for (int j=0; j<(int)pr.size() && pr[j]<=lp[i] && i*pr[j]<=N; ++j)\n lp[i * pr[j]] = pr[j];\n }\n}\n\n\nbool is_prime (long long n)\n{\n for (int i = 2; i * i <= n; i++)\n if (n % i == 0) return 0;\n return 1;\n}\n\nint main()\n{\n ios_base::sync_with_stdio(0);\n cout << fixed << setprecision(20);\n\n long long n;\n cin >> n;\n\n Er();\n\n long long ans = 0;\n while (n)\n {\n if (pr.back() <= n)\n {\n int pos = lower_bound(all(pr), n) - pr.begin();\n if (pr[pos] > n) pos--;\n n-=pr[pos];\n //ans++;\n }\n else\n {\n long long now = n;\n while (!is_prime(now))\n {\n now--;\n }\n n-=now;\n }\n ans++;\n }\n\n cout << ans;\n\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "51ad3e4682ea942bb5c3875a2953236a", "src_uid": "684ce84149d6a5f4776ecd1ea6cb455b", "apr_id": "c1a7c4f3e11529d561e066581297a53e", "difficulty": 1600, "tags": ["math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9296947271045328, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "#include \n#include \n#define ll long long\nusing namespace std;\nint a[501];\nll h[1000];\nint main()\n{\n ll n, m, i, j, k = 1, g;\n cin >> n >> m;\n g = m;\n ll x = 1, y = n;\n if(n == 1)\n {\n cout << 1;\n return 0;\n }\n if(n == 2)\n {\n if(m == 1)\n cout << \"1 2\";\n else\n cout << \"2 1\";\n return 0;\n }\n h[1] = 1;\n for(i = 2; i <= n; i ++)\n {\n h[i] = h[i - 1] * 2;\n }\n for(i = n - 3; i >= 0; i --)\n {\n if((2 << i) >= m && m != 0)\n {\n a[x ++] = k;\n }\n else\n {\n a[y --] = k;\n }\n if(h != 0)\n m = m % h[i];\n else\n m = 0;\n k ++;\n }\n if(g % 2 == 0)\n {\n for(i = y; i >= x; i --)\n {\n a[i] = k;\n k ++;\n }\n }\n else\n {\n for(i = x; i <= y; i ++)\n {\n a[i] = k;\n k ++;\n }\n }\n for(i = 1; i <= n; i ++)\n {\n cout << a[i] << \" \";\n }\n cout << endl;\n}\n", "lang": "GNU C++", "bug_code_uid": "5060c90093e1758851d4d348c67b2042", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "apr_id": "7d89e9fa81e6e06f17c85de455b03e4b", "difficulty": 1800, "tags": ["divide and conquer", "math", "bitmasks"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9863429438543247, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nlong long n , cnt;\nvector pr;\n\nlong long sum = 0 ;\n\nint main()\n{\nfreopen(\"input.txt\",\"r\",stdin);\nfreopen(\"output.txt\",\"w\",stdout);\ncin >> n;\ncnt = n;\nfor (long long i = 2 ; i * i <= n ; i ++ )\n if ( n % i == 0 )\n {\n while ( n % i == 0 )\n {\n pr.push_back(i);\n n /= i;\n }\n }\nif ( n != 1 )\npr.push_back(n);\nfor (int i = 0 ; i < pr.size() ; i ++ )\n{\n sum += cnt;\n cnt /= pr[i];\n}\ncout << sum + 1 << endl;\nreturn 0;\n}", "lang": "MS C++", "bug_code_uid": "daa7066e0eb2c9fedd004ee6bc7fc588", "src_uid": "821c0e3b5fad197a47878bba5e520b6e", "apr_id": "1db0ca1854c16b8c98b1de651c715d3e", "difficulty": 1200, "tags": ["number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9481946624803768, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 5, "insert_cnt": 0, "fix_ops_cnt": 9, "bug_source_code": "#include\nusing namespace std;\nint binarySearch(int arr[], int l, int r, int x)\n{\n while (l <= r)\n {\n int m = l + (r-l)/2;\n if (arr[m] == x)\n return m;\n if (arr[m] < x)\n l = m + 1;\n else\n r = m - 1;\n }\n return -1;\n}\nint main()\n{\n int n,k;\n cin>>n>>k;\n int a[n];\n for(int i=0;i>a[i];\n sort(a,a+n);\n for(int i=n;i>=1;i++)\n {\n if(n%i==0)\n {\n if(binarySearch(a,0,n-1,i)!=-1)\n { if(k%i==0)\n {\n cout<\nusing namespace std;\n\ntypedef long long LL;\ntypedef pair PII;\ntypedef vector VI;\ntypedef vector VPII;\ntypedef pair PLL;\ntypedef pair PIL;\ntypedef pair PLI;\ntypedef double DB;\n\n#define pb push_back\n#define mset(a, b) memset(a, b, sizeof a)\n#define all(x) (x).begin(), (x).end()\n#define bit(x) (1 << (x))\n#define bitl(x) (1LL << (x))\n#define sqr(x) ((x) * (x))\n#define sz(x) ((int)(x.size()))\n#define cnti(x) (__builtin_popcount(x))\n#define cntl(x) (__builtin_popcountll(x))\n#define clzi(x) (__builtin_clz(x))\n#define clzl(x) (__builtin_clzll(x))\n#define ctzi(x) (__builtin_ctz(x))\n#define ctzl(x) (__builtin_ctzll(x))\n\n#define X first\n#define Y second\n\n#define Error(x) cout << #x << \" = \" << x << endl\n\ntemplate \ninline void chkmax(T& x, U y) {\n\tif (x < y) x = y;\n}\n\ntemplate \ninline void chkmin(T& x, U y) {\n\tif (y < x) x = y;\n}\n\nconst int MAXN = 1e7 + 10;\n\nint p[MAXN], phi[MAXN], cnt[MAXN], prm[MAXN], prn;\n\nint main() {\n#ifndef ONLINE_JUDGE\n\tfreopen(\"in.txt\", \"r\", stdin);\n\tfreopen(\"out.txt\", \"w\", stdout);\n#endif\n\tint n; scanf(\"%d\", &n);\n\tlong long ans = 0;\n\tfor (int i = 2; i <= n; i++) {\n\t\tif (!p[i]) {\n\t\t\tp[i] = i;\n\t\t\tphi[i] = i-1;\n\t\t\tprm[prn++] = i;\n\t\t}\n\t\tint k = min(n / i, p[i]);\n\t\tfor (int j = 0; j < prn && prm[j] <= k; j++) {\n\t\t\tp[prm[j] * i] = p[i];\n\t\t\tphi[prm[j] * i] = phi[i] * (prm[j] - (prm[j] < p[i]));\n\t\t}\n\t\tans -= 2 * (i - 1 - phi[i]);\n\t}\n\tfor (int i = 2; i <= n; i++) cnt[p[i]]++;\n\tfor (int i = 2; i <= n; i++) cnt[i] += cnt[i-1];\n\tint tot = n - 1;\n\tfor (int i = 2; i <= n; i++) if (p[i] * 2 > n) tot--;\n\tfor (int i = 2; i <= n; i++) {\n\t\tif (p[i] * 2 > n) continue;\n\t\tans += 3 * (tot - 1) - (cnt[n / p[i]] - (1LL * p[i] * p[i] <= n));\n\t}\n\tcout << ans / 2 << endl;\n\treturn 0;\n}\n\n", "lang": "GNU C++", "bug_code_uid": "3ac75a19627ac15417d7a4681f3c29fe", "src_uid": "bb1bd5d8bab7d79e514281230d484996", "apr_id": "c88729bc7b7a5d9ec306ce0ad04ac8ef", "difficulty": 2700, "tags": ["sortings", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9989447766443897, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \n#include \n#include \nusing namespace std;\n//1000000\nint a[6],b[6],c[6];\nbool f(int x,int *A)\n{\n for(int i=0;i<6;i++)\n {\n if(A[i]==x)\n return 1;\n }\n return 0;\n}\nbool fuck(int x)\n{\n if(x<10)\n return f(x,a)||f(x,b)||f(x,c);\n else if(x<100)\n return (f(x/10,a)&&f(x%10,b))||(f(x/10,a)&&f(x%10,c))||\n (f(x%10,a)&&f(x/10,b))||(f(x%10,a)&&f(x/10,c))||\n (f(x/10,c)&&f(x%10,b))||(f(x/10,b)&&f(x%10,c))||\n (f(x%10,c)&&f(x/10,b))||(f(x%10,b)&&f(x/10,c));\n else\n return (f(x/100,a)&&f(x/10%10,b)&&f(x%10,c))||\n (f(x/100,a)&&f(x/10%10,c)&&f(x%10,b))||\n (f(x/100,b)&&f(x/10%10,a)&&f(x%10,c))||\n (f(x/100,b)&&f(x/10%10,c)&&f(x%10,a))||\n (f(x/100,c)&&f(x/10%10,b)&&f(x%10,a))||\n (f(x/100,c)&&f(x/10%10,a)&&f(x%10,b));\n}\nvoid read(int *A)\n{\n for(int i=0;i<6;i++)cin>>A[i];\n}\nint main()\n{\n int n,x;\n while(cin>>n,n)\n {\n memset(a,-1,sizeof(a));\n memset(b,-1,sizeof(b));\n memset(c,-1,sizeof(c));\n x=1;\n if(n==3)\n {\n read(a);read(b);read(c);\n }\n else if(n==2)\n {\n read(a);read(b);\n }\n else\n {\n read(a);\n }\n while(fuck(x)&&x<1000)x++;\n cout<\n#include \n#include \nusing namespace std;\nvector a[1005];\nvector ans;\nint n;\nvoid rec(int idx,int prev,int counter)\n{\n for(int i=0;i>n;\n int i,t;\n for(i=0;i>t;\n if(t==0)\n a[i].push_back(3);\n else if(t==1)\n {\n a[i].push_back(1);\n a[i].push_back(3);\n }\n else if(t==2)\n {\n a[i].push_back(2);\n a[i].push_back(3);\n }\n else\n {\n a[i].push_back(1);\n a[i].push_back(2);\n a[i].push_back(3);\n }\n }\n for(i=0;i\nusing namespace std;\nint n,d,k,t,v1,v2;\nint main()\n{\n cin>>n>>t>>k>>d;\n for(int i=1;;i++)\n {\n if(i%t==0)\n v1+=k,v2+=k;\n \n if(i>d && (i-d)%t==0)\n v2+=k;\n \n if(v1>=n && v2<=n)\n {cout<<\"NO\"<=n)\n {cout<<\"YES\"<\nusing namespace std;\nint w,x,y,z,num;\nchar c;\nint main()\n{\n while(scanf(\"%c\",&c))\n {\n num++;\n if(num>=5)\n w=1;\n if(isdigit(c))\n x=1;\n if(c>='A'&&c<='Z')\n y=1;\n if(c>='a'&&c<='z')\n z=1;\n if(w*x*y*z)\n\t\t\treturn printf(\"Correct\"),0;\n }\n return printf(\"Too weak\"),0;\n}", "lang": "GNU C++11", "bug_code_uid": "10543ada3f8e52422fdd51ed411a8324", "src_uid": "42a964b01e269491975965860ec92be7", "apr_id": "c4ce65ca456f1f1330d90c79a699e487", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.10735373054213634, "equal_cnt": 7, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "#include\n#include\ntypedef long long ll;\nusing namespace std;\nstring s;\nll n,m,a,b,c,d,cnt1=0,cnt2=0,ans=0,sum1=0,sum2=0,a1[1000],b1[1000],c1[1000],d1[1000],mini=9999999,mini1=999999;\nint main(){\n\tcin>>a>>b>>c>>d;\n\tmini=min(a,c);\n\tmini=min(mini,d);\n\tmini1=min(a,b);\n\tif(mini!=mini1){\n\t\tif(mini1+mini<=a){\n\t\t\n\t\tfor(int i=0; ia){\n\t\t\t\t\tfor(int i=0; ia){\n\t\t\tfor(int i=0; ia){\n\t\t///\tcnt2=0;\n\t\t\t//cout<\nusing namespace std;\nint main()\n{\n int n;\n cin>>n;\n vectorv;\n for(int i=1;i<=n;i++)\n {\n for(int j=1;j<=i;j++)\n {\n v.push_back(j);\n }\n if(v.size()>n)\n break;\n }\n cout<\nusing namespace std;\n#define REP(i, n) for (int i = 0; i < int(n); i++)\n#define FOREACH(i, v) for (__typeof((v).begin()) i = (v).begin(); i != (v).end(); i++)\n#define SIZE(v) ((int)(v).size())\n#define pb push_back\n#define mp make_pair\n#define st first\n#define nd second\n#define ll long long\n#define pii pair\n\nbool visited[401][401][9][6];\nbool used[401][401];\nint t[500];\n\n\nint X[10], Y[10];\nint n;\n\nvoid init(){\n\tX[1] = 0;\n\tY[1] = 1;\n\tX[2] = 1;\n\tY[2] = 1;\n\tX[3] = 1;\n\tY[3] = 0;\n\tX[4] = 1;\n\tY[4] = -1;\n\tX[5] = 0;\n\tY[5] = -1;\n\tX[6] = -1;\n\tY[6] = -1;\n\tX[7] = -1;\n\tY[7] = 0;\n\tX[8] = -1;\n\tY[8] = 1;\n}\n\nint cnt = 0;\nvoid bfs(){\n\tpair init(mp(mp(400, 400), mp(1, t[0])));\n\tqueue > mq[50];\n\tmq[0].push(init);\n\tvisited[init.st.st][init.st.nd][init.nd.st][init.nd.nd] = true;\n\tfor(int i = 0; i < n; i++){\n\t\twhile(!mq[i].empty()){\n\t\t\tpair u = mq[i].front();\n\t\t\tmq[i].pop();\n\t\t\tif(!used[u.st.st][u.st.nd]){\n\t\t\t\tused[u.st.st][u.st.nd] = true;\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t\tif(u.nd.nd == 1 && i != n - 1){\n\t\t\t\tint dir1 = (u.nd.st - 1 - 1 + 8)%8 + 1, dir2 = (u.nd.st - 1 + 1 + 8)%8 + 1;\n\t\t\t\tif(!visited[u.st.st + X[dir1]][u.st.nd + Y[dir1]][dir1][t[i + 1]]) \n\t\t\t\t\tmq[i + 1].push(mp(mp(u.st.st + X[dir1], u.st.nd + Y[dir1]), mp(dir1, t[i + 1])));\n\t\t\t\tif(!visited[u.st.st + X[dir2]][u.st.nd + Y[dir2]][dir2][t[i + 1]]) \n\t\t\t\t\tmq[i + 1].push(mp(mp(u.st.st + X[dir2], u.st.nd + Y[dir2]), mp(dir2, t[i + 1])));\n\t\t\t}\n\t\t\telse if(u.nd.nd != 1){\n\t\t\t\tif(!visited[u.st.st + X[u.nd.st]][u.st.nd + Y[u.nd.st]][u.nd.st][u.nd.nd - 1])\n\t\t\t\t\tmq[i].push(mp(mp(u.st.st + X[u.nd.st], u.st.nd + Y[u.nd.st]), mp(u.nd.st, u.nd.nd - 1)));\n\t\t\t}\n\t\t}\n\t}\n}\n\n\nint main(){\n\tinit();\n\tscanf(\"%d\", &n);\n\tREP(i, n) scanf(\"%d\", &t[i]);\n\tbfs();\n\tprintf(\"%d\\n\", cnt);\n}\n\n\n\n\n\n\n\n", "lang": "GNU C++", "bug_code_uid": "dc2ce107866562eead85a075be8c0ce6", "src_uid": "a96bc7f93fe9d9d4b78018b49bbc68d9", "apr_id": "0dc8e94ec714d18596fa834948653891", "difficulty": 1900, "tags": ["dp", "dfs and similar", "data structures", "implementation", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.998989388580091, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "/*\n ID: ahaigh11\n PROG: codeforces #109, D\n URL: http://www.codeforces.com/contest/154/problem/D\n LANG: C++\n \n */\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \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))\n\ntypedef long long ll;\nll x1, x2, a, b;\n\nint brute(int x, int m) {\n\t//cout << x << endl;\n\tif (x == 0) return -1;\n\tif (m >= 10) return 0;\n\t\n\tint best = -1;\n\tfor (int i = a; i <= b; i++) best = max(best, -brute(-(x + (x < 0 ? i : -i)), m+1));\n\treturn best;\n}\n\nint main() {\n\t//while (true) {\n\t\t//x1 = rand() % 10; do { x2 = rand() % 10; } while (x1 == x2); a = rand() % 6 - 3; do { b = rand() % 6 - 3; } while (b < a);\n\t\tcin >> x1 >> x2 >> a >> b;\n\t\tll d = x2 - x1;\n\t\t\n\t\tif (d < 0) {\n\t\t\t//x1 = -x1; x2 = -x2;\n\t\t\n\t\t\tswap(a, b);\n\t\t\tb = -b; a = -a;\n\t\t\td = -d;\n\t\t}\n\t\t\n\t\tint z;\n\t\t\n\t\tif (a <= d && d <= b) {\n\t\t\t//can win on first turn :)\n\t\t\tcout << \"FIRST\" << endl << x2 << endl;\n\t\t\tz = 1;\n\t\t} else if (a < 0 && abs(a) >= abs(b)) {\n\t\t\t//one player can run away indefinitely\n\t\t\tcout << \"DRAW\" << endl;\n\t\t\tz = 0;\n\t\t} else if (a <= 0 && 0 <= b) {\n\t\t\t//no-one will edge closer because they will lose\n\t\t\tcout << \"DRAW\" << endl;\n\t\t\tz = 0;\n\t\t} else {\n\t\t\ta = max(1ll, a); //0 move is pointless\n\t\t\tll v = d % (a + b);\n\t\t\t//cout << v << \" \" << (x2-x1) << endl;\n\t\t\tif (v == 0) {\n\t\t\t\t//first player loses\n\t\t\t\tcout << \"SECOND\" << endl;\n\t\t\t\tz = -1;\n\t\t\t} else if (v >= a && v <= b) {\n\t\t\t\t//first player wins, by moving v\n\t\t\t\tcout << \"FIRST\" << endl << x1+(( (x2-x1)<0) ? -v : v) << endl;\n\t\t\t\tz = 1;\n\t\t\t} else {\n\t\t\t\t//can force draw\n\t\t\t\tcout << \"DRAW\" << endl;\n\t\t\t\tz = 0;\n\t\t\t}\n\t\t}\n\t\t\n\t\tint zz = brute(x2 - x1, 0);\n\t\tif (z != zz) {\n\t\t\tcout << z << \" \" << zz << endl;\n\t\t\tcout << x1 << \" \" << x2 << \" \" << a << \" \" << b << endl;\n\t\t\treturn 0;\n\t\t}\n\t//}\n}", "lang": "GNU C++", "bug_code_uid": "c6bce2164d7e10253890924ff63371e3", "src_uid": "4ea8cc3305a0ee2c1e580b43e5bc46c6", "apr_id": "8992a1d462842323ff7a2c37eb62fd22", "difficulty": 2400, "tags": ["math", "games"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.7688022284122563, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "/*\n\n4\n2 5 3 1\n\n*/\n\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\nsets;\n\nint main()\n{\n\n\tint n;scanf(\"%d\",&n);\n\tfor(int i=1;i<=n;i++){\n\t\tint x;scanf(\"%d\",&x);\n\t\ts.insert(x);\n\t}\n\n\tfor(int i=1;i<=n+1;i++){\n\t\tif(!s.count(i)){\n\t\t\tprintf(\"%d\\n\",i);\n\t\t\treturn 0;\n\t\t}\n\t}\n\t\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "bfa79ac38b440bae970e70b6bf40332c", "src_uid": "f45c769556ac3f408f5542fa71a67d98", "apr_id": "bbb6be9007e6783b051e6ef6a45ccb6b", "difficulty": 1800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.7792792792792793, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n long long n,v;\n cin>>n>>v;\n long long res = 0;\n if(v >= n-1) return n-1;\n res = (n-v)*(n-v+1)/2+v-1;\n return res;\n}", "lang": "GNU C++11", "bug_code_uid": "ce4f671406f8b0fc4f44942fc2fa8066", "src_uid": "f8eb96deeb82d9f011f13d7dac1e1ab7", "apr_id": "5c0ab91e96e79e4e3afdae2c65a2d898", "difficulty": 900, "tags": ["dp", "math", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.6569948186528497, "equal_cnt": 12, "replace_cnt": 7, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 12, "bug_source_code": "#include\n#include\nusing namespace std;\ntypedef long long ll;\n\nint main(){\n\tll w,m,k;\n\tcin>>w>>m>>k;\n\tll cost = 0;\n\tll len = 0;\n\tll sn=1;\n\tint pow=10;\n\twhile(pow < m){\n\t\tpow = pow*10;\n\t\tsn++;\t\n\t}\n//\tcout<\n#define pb push_back\n#define mp make_pair\n#define INF 0x7fffffff\n#define fri(x) freopen(x,\"r\",stdin)\n#define fro(x) freopen(x,\"w\",stdout)\n\nusing namespace std;\n\nint sayi[2][7];\nint sayilar[6];\n\nint main(){\n int n;\n int dizi[6];\n int arr[6];\n scanf(\"%d\",&n);\n for(int i=0;i\n#include \n#include \n//#include \n//\n//using namespace boost::multiprecision;\nusing namespace __gnu_pbds;\nusing namespace std;\ntypedef tree, rb_tree_tag, tree_order_statistics_node_update> ordered_set;\n \n/*** Typedef ***/\ntypedef long long ll;\ntypedef long long int lli;\ntypedef unsigned long long ull;\ntypedef long double ld;\n \n//typedef unordered_set usll;\n//typedef unordered_multiset umsll;\n \n/*** Loops ***/\n#define ffit(i, dat) for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)\n#define yo(a,b) for(int i = a; i < b; i++)\n#define ff1(i,a,b) for(ll i = a; i < b; i++)\n#define ff2(i,a,b) for(ll i = b-1; i >= a; i--)\n#define ff3(i,a,b,m) for(ll i = a; i >ar[i];\n#define opar(ar,n) ff1(i,0,n) cout<= 0; i--)\n#define forIn(arr, num) for(ll i = 0; i < num; i++) sc1(arr[i]);\n#define forIn1(arr, num) for(ll i = 1; i <= num; i++) sc1(arr[i]);\n#define vpnt(ans) for(ll i = 0; i < ans.size(); i++) cout << ans[i] << (i + 1 < ans.size() ? ' ' : '\\n');\n#define apnt(arr, num) for(ll i = 0; i < num; i++) cout << arr[i] << (i + 1 < num ? ' ' : '\\n');\n \n/*** Define Values ***/\n \n#define PI acos(-1.0)\n#define eps 1e-7\n#define size1 15\nconst ll mdd = (ll)1e6 + 3;\n/*** STLs ***/\n#define sf(a) scanf(\"%lld\",&a)\n#define sff(a,b) scanf(\"%lld %lld\",&a,&b)\n#define sfff(a,b,c) scanf(\"%lld %lld %lld\",&a,&b,&c)\n#define cu continue\n#define br break\n#define rsz resize\n#define ins insert\n#define ft front\n#define bk back\n#define eb emplace_back\n#define lb lower_bound\n#define ub upper_bound\n#define pb push_back\n#define ff first\n#define ss second\n#define mp make_pair\n#define rr return\n#define nxt next_permutation\n#define mem(name, value) memset(name, value, sizeof(name))\n#define MN3(n1,n2,n3) min(n1,min(n2,n3))\n#define MN4(n1,n2,n3,n4) min(n1,min(n2,min(n3,n4)))\n#define MX3(n1,n2,n3) max(n1,max(n2,n3))\n#define MX4(n1,n2,n3,n4) max(n1,max(n2,max(n3,n4)))\n#define mxar(a,n) *max_element(a,a+n)\n#define mnar(a,n) *min_element(a,a+n)\n#define arr_sm(a,n) accumulate(a,a+n,0)\n#define vc_sm(ve) accumulate(ve.begin(),ve.end(),0)\n#define mx_vc(ve) *max_element(ve.begin(),ve.end())\n#define mn_vc(ve) *min_element(ve.begin(),ve.end())\n//#define endl \" \\n\"\n \n/*** STLs ***/\ntypedef vector vll;\n#define vvll vector\ntypedef set sll;\ntypedef multiset msll;\ntypedef multimap mpll;\ntypedef queue qll;\ntypedef map mll;\ntypedef pair pll;\ntypedef vector > vpll;\ntypedef priority_queue > pqpll;\n#define uniq(v) (v).erase(unique(all(v)),(v).end())\n#define maxpq priority_queue\n#define minpq priority_queue, greater >\n#define ml unordered_map\n///typedef unordered_multiset umsi;\ntypedef unordered_set us;\n \n \n///vector> v(10, vector(20,500)); 2d vector initialization. of 10 rows and 20 columns, with value 500.\n \n/*** Sorts ***/\n#define czero(n) __builtin_popcountll(n) // count the number of 1's in the bit representation of a number\n#define cenzero(n) __builtin_ctzll(n) // count the number of zereos from the end of the bit representation of a number until a 1\n#define countbegzero(n) __builtin_clzxll(n)\n#define checkparity(n) __builtin_parityll(n)// checks whether the number of bits are even or odd\n#define all(v) (v).begin(), (v).end()\n#define rev(v) reverse(all(v))\n#define srt(v) sort(all(v))\n#define srtgrt(v) sort(all(v), greater())\n#define prsrt greater>()\n/*** Some Prints ***/\n#define ip(n) ll n; cin>>n;\n#define is(s) string s; cin>>s;\n#define ipp(n,k) ll n; cin>>n; ll k; cin>>k;\n#define ip3(n,m,k) ll n; cin>>n;ll m;cin>>m; ll k; cin>>k;\n#define kl '\\n'\n#define case cout << \"Case \" << t++ << \": \";\n#define ps(x,y) fixed<>x; while(x--)\n#define go(i, a) for (auto &i : a)\n#define go1(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)\n//#define mk(arr,n,type) type *arr=new type[n];\n#define sz(obj) (int(obj.size()))\n#define ipve(vc,n) vll vc(n); ff1(i,0,n){cin>>vc[i];}\n#define ipvc(vc,n) vll vc; ff1(i,0,n){ip(x);vc.pb(x);}\n#define cer cerr << \"Time : \" << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << \"ms\\n\";\n#define depressed() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)\n//bool ans = all_of(arr, arr + 6, [](int x) {return x & 1; } );\nconst double pi = 3.141592653589793238460;\n#define TRC\n#ifdef TRC\n#define trc(...) __f(#__VA_ARGS__, __VA_ARGS__)\n template \n void __f(const char* name, Arg1&& arg1){\n cout << name << \" : \" << arg1 << endl;\n //use cerr if u want to display at the bottom\n }\n template \n void __f(const char* names, Arg1&& arg1, Args&&... args){\n const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << \" : \" << arg1<<\" | \";__f(comma+1, args...);\n }\n#else\n#define trc(...)\n#endif\n#define no cout << \"NO\" << '\\n'\n#define yes cout << \"YES\" << '\\n'\nll dx[8]={+1, +1, +1, 0, 0, -1, -1, -1};\nll dy[8] = {-1, 0, +1, -1, +1, -1, 0, +1};\nvoid fun()\n{\n mll m;\n is(s);\n ff1(i,0,sz(s))\n {\n m[s[i]-'0']++;\n }\n ll ct = 0;\n string ms1,ms2;\n ff1(i,1,10)\n {\n mll f = m, ff = m;\n string s1,s2;\n ll cnt = 0;\n if(f[i]>0 && ff[10-i]>0)\n {\n s1+='0'+i;\n s2+='0'+10-i;\n f[i]--;\n ff[10-i]--;\n cnt++;\n ff1(i,0,10)\n {\n if(f[i]>0 && ff[9-i]>0)\n {\n ll mn = min(f[i],f[9-i]);\n s1 = string(mn,'0'+i) + s1;\n s2 = string(mn,'0'+9-i) + s2;\n f[i]-=mn;\n ff[i]-=mn;\n cnt+=mn;\n }\n }\n ll z = min(f[0],ff[0]);\n if(z>0)\n {\n f[0]-=z;\n ff[0]-=z;\n s1+=string(z,'0');\n s2+=string(z,'0');\n cnt+=z;\n }\n if(cnt>ct)\n {\n ct = cnt;\n ff1(i,0,10)\n {\n s1 = string(f[i],'0'+i) + s1;\n s2 = string(ff[i],'0'+i)+s2;\n }\n ms1 = s1;\n ms2 = s2;\n }\n }\n }\n cout<>tc;\n while(tc--)\n {\n fun();\n }\n //cer;\n return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "ffe834541d295882db9098ebe2a4a47d", "src_uid": "34b67958a37865e1ca0529bbf528dd9a", "apr_id": "88241af50273f5136b6261fdfae726ae", "difficulty": 1900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9403606102635229, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include\nusing namespace std;\nint main(){\n\tint t;\n\tcin>>t;\n\tvector arr(t);\n\tfor(int a=0;a>arr[a];\n\tint dif=arr[0]-arr[1],done=0;\n\tfor(int a=0;a \n#include\nusing namespace std;\nint a,b,c,d;\nint main()\n{\n\tcin>>b>>a;\n\twhile((d=__gcd(a,b))>1) a/=d,c++;\n\tif(a==1) cout<<\"2-type\\n\"<\n#include \n#include \n#include \nusing namespace std;\ntypedef long long LL;\nconst LL mo=1e9+7;\nconst int N=2e6;\nLL n,mo,inv2,inv6,nx;\nLL f[N+10],g[N+10],h[N+10],sum1[N+10],sum2[N+10],sum3[N+10];\nLL mul(LL x,LL y) {\n x%=mo;\n LL z=1;\n while (y) {\n if (y&1) z=z*x%mo;\n y>>=1;\n x=x*x%mo;\n }\n return z;\n}\nLL Calc2(LL l,LL r) {\n l%=mo;\n r%=mo;\n return (l+r)*(r-l+1)%mo*inv2%mo;\n}\nLL getsum(LL x) {\n x%=mo;\n return x*(x+1)%mo*(x*2+1)%mo*inv6%mo;\n}\nLL Calc3(LL l,LL r) {\n return (getsum(r)-getsum(l-1))%mo;\n}\nLL SQRT(LL x) {\n LL l=0,r=N;\n while (lx) r=mid-1;\n else l=mid;\n }\n return l;\n}\nLL getf(LL x) {\n LL l=SQRT(x);\n return (sum1[l]+l*((x-l*l+1)%mo))%mo;\n}\nLL getg(LL x) {\n LL l=SQRT(x);\n return (sum2[l]+l*Calc2(l*l,x))%mo;\n}\nLL geth(LL x) {\n LL l=SQRT(x);\n return (sum3[l]+l*Calc3(l*l,x))%mo;\n}\nvoid prework() {\n nx=n%mo;\n inv2=mul(2,mo-2);\n inv6=mul(6,mo-2);\n for (LL i=1;i*i<=n;i++) {\n LL l=(i-1)*(i-1),r=i*i-1;\n sum1[i]=(sum1[i-1]+(r-l+1)%mo*(i-1))%mo;\n sum2[i]=(sum2[i-1]+Calc2(l,r)*(i-1))%mo;\n sum3[i]=(sum3[i-1]+Calc3(l,r)*(i-1))%mo;\n }\n for (LL i=0;i*i<=n;i++) {\n f[i]=getf(n-i*i);\n g[i]=getg(n-i*i);\n h[i]=geth(n-i*i);\n }\n}\nvoid work() {\n LL ans1=0;\n for (LL i=0;i*i<=n;i++) {\n LL nowx=i*i%mo*f[i]+g[i];\n nowx%=mo;\n ans1=(ans1+nowx)%mo;\n }\n ans1=ans1*4%mo;\n LL nowx=(nx+1)*nx%mo*inv2%mo;\n ans1=(ans1+nowx)%mo;\n ans1=ans1*(nx+1)%mo;\n LL ans2=0;\n for (LL i=0;i*i<=n;i++) {\n LL nowp=i*i%mo;\n LL nowx=nowp*nowp%mo*f[i]+nowp*2*g[i]+h[i];\n nowx%=mo;\n ans2=(ans2+nowx)%mo;\n }\n ans2=ans2*4%mo;\n nowx=getsum(nx);\n ans2=(ans2+nowx)%mo;\n ans1=((ans1-ans2)%mo+mo)%mo;\n printf(\"%lld\\n\",ans1);\n}\nint main() {\n scanf(\"%lld\",&n);\n prework();\n work();\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "e494a741e1ff70a256711646dcc11429", "src_uid": "b9a785849e5ffadb24b58b38b1f2ee48", "apr_id": "c7a8323e0916f169a6e7db05c4d2cf03", "difficulty": 2900, "tags": ["brute force", "math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9139344262295082, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "#define TASK \"palsquare\"\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define sz(s) int((s).size())\n#define snuke(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)\nusing namespace std;\nconst double PI = 3.1415926535897932384626433832795028841971;\n\n//ifstream cin(\"input.txt\");\n//ofstream cout (\"output.txt\");\nint main(){\nlong long int a,b,c;\ncin>>a>>b>>c;\nif(a%c==0 && c!=1 )cout<\n#include \n\nusing namespace std;\n\nint main()\n{\n string s ;\n getline(cin , s ) ;\n bool chk = 0 ;\n int sum = 0 ;\n for(int i=0;i28 ) { cout<<11; return 0; }\n else\n { cout<<12; return 0; }\n }\n else\n {\n while(true)\n {\n int i = 0 ;\n if(s[i] == ' ') break ;\n sum*=10;\n sum+= (s[i] - '0') ;\n i++;\n }\n if(sum == 6) { cout<<53; return 0; }\n else { cout<<52; return 0; }\n\n\n\n\n }\n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "363615acce42358493e3486f91417539", "src_uid": "9b8543c1ae3666e6c163d268fdbeef6b", "apr_id": "1623325d874032266805973fd14a9a91", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9951314508276533, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \n#include \"cmath\"\nusing namespace std;\n\nint main()\n{\n int a1 , a2 , a3 , b1 , b2 , b3 , n;\n cin >> a1 >> a2 >> a3 >> b1 >> b2 >> b3 >> n;\n int sumc = a1+a2+a3 , summ = b1+b2+b3;\n \n if(sumc>=5)\n while(sumc>=5)\n {\n n--;\n sumc-=5;\n }\n if(sumc !=0)\n n--;\n else if(summ>=10)\n while(summ>=10)\n {\n n--;\n summ-=10;\n }\n if(summ !=0)\n n--;\n \n if(n<0)\n cout << \"NO\";\n else\n cout << \"YES\";\n \n return 0;\n}", "lang": "MS C++", "bug_code_uid": "ec809d0043c44be45628c233055dc6b8", "src_uid": "fe6301816dea7d9cea1c3a06a7d1ea7e", "apr_id": "7921f5bc3bb5acb11889853bbdd1f8a9", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.5509350935093509, "equal_cnt": 13, "replace_cnt": 12, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 12, "bug_source_code": "#include \ntypedef long long int ll;\ntypedef unsigned long long int ull;\n#define vi vector\n#define vll vector< ll >\n#define vull vector< ull >\n#define vvi vector< vi >\n#define vvll vector < vll >\n#define vvull vector < vull >\n#define mii map\n#define pii pair< int , int >\n#define repeat(n) for(int ajsS32D_v = 0 ; ajsS32D_v < n ; ajsS32D_v++)\n#define forn(i,n) for(int i = 0 ; i < n ; i++)\n#define rep(i,a,b) for(int i = a ; i <= b ; i++)\n#define rrep(i,a,b) for(int i = a ; i>= b ; i--)\n#define debug(x) cerr <<\"\\n--------------\"<< #x << \" is \" << x << \"--------------\\n\"\n#define mp make_pair\n#define pb push_back\n#define fi first\n#define se second\n#define mod (ll)1000000007\n#define INF (ll)1\n#define FASTIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)\n#define INT_MAX (int)2147483647\n#define LL_MAX (ll)9223372036854775807\n#define ld long double\n#define PI (ld)3.1415926535897932384626433832795028\n\nusing namespace std ;\nvoid solve(){\n\tll a ;\n\tcin >> a ;\n\tll mul = 1;\n\tll cache = a;\n\tvi answer;\n\twhile(a > 0){\n\t\tif(a%10 < 8){\n\t\t\tanswer.pb(8);\n\t\t\twhile(a >0){\n\t\t\t\tanswer.pb(a%10);\n\t\t\t\ta /= 10;\n\t\t\t}\n\t\t\tbreak;\n\t\t}else{\n\t\t\tanswer.pb(0);\n\t\t}\n\t}\n\tfor(int i = 0 ; i < answer.size() ; i++){\n\t\tcout << answer[answer.size() - 1 - i ];\n\t}\n\tcout << endl;\n}\nint main(){\n\tFASTIO ;\n\tbool multi_run = 0;\n\t//freopen(\"input.txt\", \"r\", stdin); freopen(\"output.txt\", \"w\", stdout);\n\tif(multi_run){\n\t\tint t ;\n\t\tcin >> t;\n\t\twhile(t--)solve();\n\t}else{\n\t\tsolve();\n\t}\n\n}\n", "lang": "GNU C++17", "bug_code_uid": "8d18bdc0e7c2c93b785f470e80e35092", "src_uid": "4e57740be015963c190e0bfe1ab74cb9", "apr_id": "83eb1d17502f6522d2c55513ce8a2a4c", "difficulty": 1100, "tags": ["brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9826589595375722, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \n#define FOR(i,a,b) for (int i=(a); i<=(b); ++i)\n#define FORR(i,a,b) for (int i=(a); i>=(b); --i)\n#define REP(i,b) for (int i=0; i<(b); ++i)\n#define input stdin\n#define output stdout\n#define assign freopen\n#define endl '\\n'\n#define sz(x) (int) x.size()\n#define div /\n#define mod %\n#define fillchar(x,y,z) memset(x,z,y)\n#define pii pair\n#define fi first\n#define se second\n#define mp make_pair\n#define sqr(x) ((x)*(x))\ntypedef long long int64;\ntypedef unsigned long long qword;\ntypedef void procedure;\nusing namespace std;\n#define f1(i,n) for (int i=1; i<=n; i++)\n#define f0(i,n) for (int i=0; i vi;\nconst int BASE=10000;\n\nvoid fix(vi &a){\n a.push_back(0);\n f0(i,a.size()-1) {\n a[i+1]+=a[i]/BASE; a[i]%=BASE;\n if (a[i]<0) { a[i]+=BASE; a[i+1]--; }\n }\n while (a.size()>=2 && a.back()==0) a.pop_back();\n}\n\nvoid operator += (vi &a, const vi &b) {\n a.resize(max(a.size(), b.size()));\n f0(i,b.size()) a[i]+=b[i];\n fix(a);\n}\n\nvi to_vi(int x) // x=0; i--)\n if (a[i]!=b[i]) return a[i]> n;\n FOR(i,1,n) {\n cin >> a[i];\n ++mark[a[i]];\n }\n}\nprocedure Solve()\n{\n FOR(i,0,n) c[i][0]=to_vi(1);\n FOR(i,1,n)\n FOR(j,1,i) c[i][j]=c[i-1][j-1]+c[i-1][j];\n int sum=0;\n f[0][0]=to_vi(1);\n FOR(i,1,n) {\n FORR(j,i,1)\n FORR(k,sum,0)\n f[j][k+a[i]]+=f[j-1][k];\n sum+=a[i];\n }\n int res=0;\n vi zr=to_vi(0);\n FOR(i,1,n)\n FOR(k,1,sum)\n if (zr\nint a[110],n,m=111,f,x,y;\nint main()\n{\n scanf(\"%d\",&n);\n for(int i=1;i<=n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(int i=1;ia[j]) x=a[i],y=a[j];else x=a[j],y=a[i];\n if(i==j) continue;\n f=x%y;//printf(\"%d \",f);\n if(f==0) f=y;\n if((x%f\n#define ll long long\n#define ld long double\n#define rep2(i, a, b) for(ll i = a; i <= b; ++i)\n#define rep(i, n) for(ll i = 0; i < n; ++i)\n#define rep3(i, a, b) for(ll i = a; i >= b; --i)\n#define pii pair\n#define pll pair\n#define pb push_back\n#define eb emplace_back\n#define vi vector\n#define vll vector\n#define vpi vector\n#define vpll vector\n#define overload2(_1, _2, name, ...) name\n#define vec(type, name, ...) vector name(__VA_ARGS__)\n#define VEC(type, name, size) \\\n vector name(size); \\\n IN(name)\n#define vv(type, name, h, ...) vector> name(h, vector(__VA_ARGS__))\n#define VV(type, name, h, w) \\\n vector> name(h, vector(w)); \\\n IN(name)\n#define vvv(type, name, h, w, ...) vector>> name(h, vector>(w, vector(__VA_ARGS__)))\n#define vvvv(type, name, a, b, c, ...) \\\n vector>>> name(a, vector>>(b, vector>(c, vector(__VA_ARGS__))))\n#define fi first\n#define se second\n#define all(c) begin(c), end(c)\n#define lb(c, x) distance((c).begin(), lower_bound(all(c), (x)))\n#define ub(c, x) distance((c).begin(), upper_bound(all(c), (x)))\nusing namespace std;\nconst string YESNO[2] = {\"NO\", \"YES\"};\nconst string YesNo[2] = {\"No\", \"Yes\"};\nconst string yesno[2] = {\"no\", \"yes\"};\nvoid YES(bool t = 1) { cout << YESNO[t] << endl; }\nvoid Yes(bool t = 1) { cout << YesNo[t] << endl; }\nvoid yes(bool t = 1) { cout << yesno[t] << endl; }\ntemplate using pq = priority_queue;\ntemplate using pqg = priority_queue, greater>;\n#define si(c) (int)(c).size()\n#define INT(...) \\\n int __VA_ARGS__; \\\n IN(__VA_ARGS__)\n#define LL(...) \\\n ll __VA_ARGS__; \\\n IN(__VA_ARGS__)\n#define STR(...) \\\n string __VA_ARGS__; \\\n IN(__VA_ARGS__)\n#define CHR(...) \\\n char __VA_ARGS__; \\\n IN(__VA_ARGS__)\n#define DBL(...) \\\n double __VA_ARGS__; \\\n IN(__VA_ARGS__)\nint scan() { return getchar(); }\nvoid scan(int &a) { cin >> a; }\nvoid scan(long long &a) { cin >> a; }\nvoid scan(char &a) { cin >> a; }\nvoid scan(double &a) { cin >> a; }\nvoid scan(string &a) { cin >> a; }\ntemplate void scan(pair &p) { scan(p.first), scan(p.second); }\ntemplate void scan(vector &);\ntemplate void scan(vector &a) {\n for(auto &i : a) scan(i);\n}\ntemplate void scan(T &a) { cin >> a; }\nvoid IN() {}\ntemplate void IN(Head &head, Tail &... tail) {\n scan(head);\n IN(tail...);\n}\ntemplate inline bool chmax(T &a, const S &b) { return (a < b ? a = b, 1 : 0); }\ntemplate inline bool chmin(T &a, const S &b) { return (a > b ? a = b, 1 : 0); }\nvi iota(int n) {\n vi a(n);\n iota(all(a), 0);\n return a;\n}\ntemplate vi iota(vector &a, bool greater = false) {\n vi res(a.size());\n iota(all(res), 0);\n sort(all(res), [&](int i, int j) {\n if(greater) return a[i] > a[j];\n return a[i] < a[j];\n });\n return res;\n}\n#define UNIQUE(x) sort(all(x)), x.erase(unique(all(x)), x.end())\ntemplate T POW(T x, int n) {\n T res = 1;\n for(; n; n >>= 1, x *= x)\n if(n & 1) res *= x;\n return res;\n}\nvector factor(ll x) {\n vector ans;\n for(ll i = 2; i * i <= x; i++)\n if(x % i == 0) {\n ans.push_back({i, 1});\n while((x /= i) % i == 0) ans.back().second++;\n }\n if(x != 1) ans.push_back({x, 1});\n return ans;\n}\ntemplate vector divisor(T x) {\n vector ans;\n for(T i = 1; i * i <= x; i++)\n if(x % i == 0) {\n ans.pb(i);\n if(i * i != x) ans.pb(x / i);\n }\n return ans;\n}\ntemplate void zip(vector &x) {\n vector y = x;\n sort(all(y));\n for(int i = 0; i < x.size(); ++i) { x[i] = lb(y, x[i]); }\n}\nint popcount(ll x) { return __builtin_popcountll(x); }\nint in() {\n int x;\n cin >> x;\n return x;\n}\nll lin() {\n unsigned long long x;\n cin >> x;\n return x;\n}\n\ntemplate struct edge {\n int from, to;\n T cost;\n int id;\n edge(int to, T cost) : from(-1), to(to), cost(cost) {}\n edge(int from, int to, T cost) : from(from), to(to), cost(cost) {}\n edge(int from, int to, T cost, int id) : from(from), to(to), cost(cost), id(id) {}\n edge &operator=(const int &x) {\n to = x;\n return *this;\n }\n operator int() const { return to; }\n};\ntemplate using Edges = vector>;\n\nusing Tree = vector>;\nusing Graph = vector>;\ntemplate using Wgraph = vector>>;\nGraph getG(int n, int m = -1, bool directed = false, int margin = 1) {\n Tree res(n);\n if(m == -1) m = n - 1;\n while(m--) {\n int a, b;\n cin >> a >> b;\n a -= margin, b -= margin;\n res[a].emplace_back(b);\n if(!directed) res[b].emplace_back(a);\n }\n return move(res);\n}\ntemplate Wgraph getWg(int n, int m = -1, bool directed = false, int margin = 1) {\n Wgraph res(n);\n if(m == -1) m = n - 1;\n while(m--) {\n int a, b;\n T c;\n cin >> a >> b >> c;\n a -= margin, b -= margin;\n res[a].emplace_back(b, c);\n if(!directed) res[b].emplace_back(a, c);\n }\n return move(res);\n}\n\n#define i128 __int128_t\n#define ull unsigned long long int\n#define TEST \\\n INT(testcases); \\\n while(testcases--)\ntemplate ostream &operator<<(ostream &os, const vector &v) {\n for(auto &e : v) cout << e << \" \";\n cout << endl;\n return os;\n}\ntemplate ostream &operator<<(ostream &os, const pair &p) {\n cout << \"(\" << p.fi << \", \" << p.se << \")\";\n return os;\n}\ntemplate string to_string(pair p) { return \"(\" + to_string(p.first) + \",\" + to_string(p.second) + \")\"; }\ntemplate string to_string(A v) {\n if(v.empty()) return \"{}\";\n string ret = \"{\";\n for(auto &x : v) ret += to_string(x) + \",\";\n ret.back() = '}';\n return ret;\n}\n\nvoid dump() { cerr << endl; }\ntemplate void dump(Head head, Tail... tail) {\n cerr << to_string(head) << \" \";\n dump(tail...);\n}\n#define endl '\\n'\n#ifdef _LOCAL\n#undef endl\n#define debug(x) \\\n cout << #x << \": \"; \\\n dump(x)\n#else\n#define debug(x)\n#endif\n// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());\n\n// int rnd(int n) { return uniform_int_distribution(0, n - 1)(rng); }\n// ll rndll(ll n) { return uniform_int_distribution(0, n - 1)(rng); }\n\ntemplate static constexpr T inf = numeric_limits::max() / 2;\nstruct Setup_io {\n Setup_io() {\n ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);\n cout << fixed << setprecision(15);\n }\n} setup_io;\n#define drop(s) cout << #s << endl, exit(0)\n#pragma endregion\n\ntemplate struct Matrix {\n vector> A;\n\n Matrix() {}\n\n Matrix(size_t n, size_t m) : A(n, vector(m, 0)) {}\n\n Matrix(size_t n) : A(n, vector(n, 0)){};\n\n size_t height() const { return (A.size()); }\n\n size_t width() const { return (A[0].size()); }\n\n inline const vector &operator[](int k) const { return (A.at(k)); }\n\n inline vector &operator[](int k) { return (A.at(k)); }\n\n static Matrix I(size_t n) {\n Matrix mat(n);\n for(int i = 0; i < n; i++) mat[i][i] = 1;\n return (mat);\n }\n\n Matrix &operator+=(const Matrix &B) {\n size_t n = height(), m = width();\n assert(n == B.height() && m == B.width());\n for(int i = 0; i < n; i++)\n for(int j = 0; j < m; j++) (*this)[i][j] += B[i][j];\n return (*this);\n }\n\n Matrix &operator-=(const Matrix &B) {\n size_t n = height(), m = width();\n assert(n == B.height() && m == B.width());\n for(int i = 0; i < n; i++)\n for(int j = 0; j < m; j++) (*this)[i][j] -= B[i][j];\n return (*this);\n }\n\n Matrix &operator*=(const Matrix &B) {\n size_t n = height(), m = B.width(), p = width();\n assert(p == B.height());\n vector> C(n, vector(m, 0));\n for(int i = 0; i < n; i++)\n for(int j = 0; j < m; j++)\n for(int k = 0; k < p; k++) C[i][j] = (C[i][j] + (*this)[i][k] * B[k][j]);\n A.swap(C);\n return (*this);\n }\n\n Matrix &operator^=(long long k) {\n Matrix B = Matrix::I(height());\n while(k > 0) {\n if(k & 1) B *= *this;\n *this *= *this;\n k >>= 1LL;\n }\n A.swap(B.A);\n return (*this);\n }\n\n Matrix operator+(const Matrix &B) const { return (Matrix(*this) += B); }\n\n Matrix operator-(const Matrix &B) const { return (Matrix(*this) -= B); }\n\n Matrix operator*(const Matrix &B) const { return (Matrix(*this) *= B); }\n\n Matrix operator^(const long long k) const { return (Matrix(*this) ^= k); }\n\n friend ostream &operator<<(ostream &os, const Matrix &p) {\n size_t n = p.height(), m = p.width();\n for(int i = 0; i < n; i++) {\n os << \"[\";\n for(int j = 0; j < m; j++) { os << p[i][j] << (j + 1 == m ? \"]\\n\" : \",\"); }\n }\n return (os);\n }\n\n T determinant() {\n Matrix B(*this);\n assert(width() == height());\n T ret = 1;\n for(int i = 0; i < width(); i++) {\n int idx = -1;\n for(int j = i; j < width(); j++) {\n if(B[j][i] != 0) idx = j;\n }\n if(idx == -1) return (0);\n if(i != idx) {\n ret *= -1;\n swap(B[i], B[idx]);\n }\n ret *= B[i][i];\n T vv = B[i][i];\n for(int j = 0; j < width(); j++) { B[i][j] /= vv; }\n for(int j = i + 1; j < width(); j++) {\n T a = B[j][i];\n for(int k = 0; k < width(); k++) { B[j][k] -= B[i][k] * a; }\n }\n }\n return (ret);\n }\n};\nnamespace modular {\nconstexpr ll MOD = 1000000007;\nconst int MAXN = 1100000;\ntemplate class modint;\n#define mint modint\n#define vmint vector\nvector Inv;\nmint inv(int x);\ntemplate class modint {\n\n public:\n static constexpr int mod() { return Modulus; }\n ll a;\n\n constexpr modint(const ll x = 0) noexcept : a(((x % Modulus) + Modulus) % Modulus) {}\n constexpr ll &value() noexcept { return a; }\n constexpr const ll &value() const noexcept { return a; }\n constexpr modint operator-() const noexcept { return modint() - *this; }\n constexpr modint operator+() const noexcept { return *this; }\n constexpr modint &operator++() noexcept {\n if(++a == MOD) a = 0;\n return *this;\n }\n constexpr modint &operator--() noexcept {\n if(!a) a = MOD;\n a--;\n return *this;\n }\n constexpr modint operator++(int) {\n modint res = *this;\n ++*this;\n return res;\n }\n constexpr modint operator--(int) {\n mint res = *this;\n --*this;\n return res;\n }\n constexpr modint &operator+=(const modint rhs) noexcept {\n a += rhs.a;\n if(a >= Modulus) { a -= Modulus; }\n return *this;\n }\n constexpr modint &operator-=(const modint rhs) noexcept {\n if(a < rhs.a) { a += Modulus; }\n a -= rhs.a;\n return *this;\n }\n constexpr modint &operator*=(const modint rhs) noexcept {\n a = a * rhs.a % Modulus;\n return *this;\n }\n constexpr modint &operator/=(const modint rhs) noexcept {\n a = a * (modular::inv(rhs.a)).a % Modulus;\n return *this;\n }\n constexpr modint pow(long long n) const noexcept {\n modint x = *this, r = 1;\n while(n) {\n if(n & 1) r *= x;\n x *= x;\n n >>= 1;\n }\n return r;\n }\n constexpr modint inv() const noexcept { return pow(Modulus - 2); }\n constexpr friend modint operator+(const modint &lhs, const modint &rhs) { return modint(lhs) += modint(rhs); }\n constexpr friend modint operator-(const modint &lhs, const modint &rhs) { return modint(lhs) -= modint(rhs); }\n constexpr friend modint operator*(const modint &lhs, const modint &rhs) { return modint(lhs) *= modint(rhs); }\n constexpr friend modint operator/(const modint &lhs, const modint &rhs) { return modint(lhs) /= modint(rhs); }\n constexpr friend modint operator==(const modint &lhs, const modint &rhs) { return lhs.a == rhs.a; }\n constexpr friend modint operator!=(const modint &lhs, const modint &rhs) { return lhs.a != rhs.a; }\n // constexpr friend modint operator^=(const modint &lhs, const modint &rhs) { return modint(lhs) ^= modint(rhs); }\n};\nvmint Fact{1, 1}, Ifact{1, 1};\nmint inv(int n) {\n if(Inv.empty()) Inv.emplace_back(0), Inv.emplace_back(1);\n if(Inv.size() > n)\n return Inv[n];\n else {\n for(int i = Inv.size(); i <= n; ++i) Inv.emplace_back(Inv[MOD % i] * (-MOD / i));\n return Inv[n];\n }\n}\nmint fact(int n) {\n if(Fact.size() > n)\n return Fact[n];\n else\n for(int i = Fact.size(); i <= n; ++i) Fact.emplace_back(Fact[i - 1] * i);\n return Fact[n];\n}\nmint ifact(int n) {\n if(Ifact.size() > n)\n return Ifact[n];\n else\n for(int i = Ifact.size(); i <= n; ++i) Ifact.emplace_back(Ifact[i - 1] * inv(i));\n return Ifact[n];\n}\nmint modpow(ll a, ll n) { return mint(a).pow(n); }\nmint inv(mint a) { return inv(a.a); }\nmint ifact(mint a) { return ifact(a.a); }\nmint fact(mint a) { return fact(a.a); }\nmint modpow(mint a, ll n) { return modpow(a.a, n); }\nmint C(int a, int b) {\n if(a < 0 || b < 0) return 0;\n if(a < b) return 0;\n return fact(a) * ifact(b) * ifact(a - b);\n}\nmint P(int a, int b) {\n if(a < 0 || b < 0) return 0;\n if(a < b) return 0;\n return fact(a) * ifact(a - b);\n}\nostream &operator<<(ostream &os, mint a) {\n os << a.a;\n return os;\n}\nistream &operator>>(istream &is, mint &a) {\n ll x;\n is >> x;\n a = x;\n return is;\n}\nstruct modinfo {\n int mod, root;\n};\nconstexpr modinfo base0{1045430273, 3};\nconstexpr modinfo base1{1051721729, 6};\nconstexpr modinfo base2{1053818881, 7};\nusing mint0 = modint;\nusing mint1 = modint;\nusing mint2 = modint;\nusing Poly = vmint;\ntemplate void FMT(vector> &f, bool inv = false) {\n using V = vector>;\n static V g(30), ig(30);\n if(g.front().a == 0) {\n modint root = 2;\n while((root.pow((mod - 1) / 2)).a == 1) root += 1;\n rep(i, 30) g[i] = -(root.pow((mod - 1) >> (i + 2))), ig[i] = g[i].inv();\n }\n int n = size(f);\n if(!inv) {\n for(int m = n; m >>= 1;) {\n modint w = 1;\n for(int s = 0, k = 0; s < n; s += 2 * m) {\n for(int i = s, j = s + m; i < s + m; ++i, ++j) {\n auto x = f[i], y = f[j] * w;\n if(x.a >= mod) x.a -= mod;\n f[i].a = x.a + y.a, f[j].a = x.a + (mod - y.a);\n }\n w *= g[__builtin_ctz(++k)];\n }\n }\n } else {\n for(int m = 1; m < n; m *= 2) {\n modint w = 1;\n for(int s = 0, k = 0; s < n; s += 2 * m) {\n for(int i = s, j = s + m; i < s + m; ++i, ++j) {\n auto x = f[i], y = f[j];\n f[i] = x + y, f[j].a = x.a + (mod - y.a), f[j] *= w;\n }\n w *= ig[__builtin_ctz(++k)];\n }\n }\n }\n modint c;\n if(inv)\n c = modint(n).inv();\n else\n c = 1;\n for(auto &&e : f) e *= c;\n}\nPoly operator-(Poly f) {\n for(auto &&e : f) e = -e;\n return f;\n}\nPoly &operator+=(Poly &l, const Poly &r) {\n l.resize(max(l.size(), r.size()));\n rep(i, r.size()) l[i] += r[i];\n return l;\n}\nPoly operator+(Poly l, const Poly &r) { return l += r; }\nPoly &operator-=(Poly &l, const Poly &r) {\n l.resize(max(l.size(), r.size()));\n rep(i, r.size()) l[i] -= r[i];\n return l;\n}\nPoly operator-(Poly l, const Poly &r) { return l -= r; }\nPoly &operator<<=(Poly &f, size_t n) { return f.insert(f.begin(), n, 0), f; }\nPoly operator<<(Poly f, size_t n) { return f <<= n; }\nPoly &operator>>=(Poly &f, size_t n) { return f.erase(f.begin(), f.begin() + min(f.size(), n)), f; }\nPoly operator>>(Poly f, size_t n) { return f >>= n; }\n\nconstexpr int mod0 = 998244353, mod1 = 1300234241, mod2 = 1484783617;\nusing M0 = modint;\nusing M1 = modint;\nusing M2 = modint;\n\ntemplate void mul(vector> &l, vector> &r) {\n int n = size(l), m = size(r), sz = 1 << __lg(2 * (n + m - 1) - 1);\n l.resize(sz), FMT(l);\n r.resize(sz), FMT(r);\n rep(i, sz) l[i] *= r[i];\n FMT(l, true);\n l.resize(n + m - 1);\n}\nPoly operator*(const Poly &l, const Poly &r) {\n if(l.empty() or r.empty()) return Poly();\n int n = size(l), m = size(r), sz = 1 << __lg(2 * (n + m - 1) - 1);\n vector l0(n), r0(m);\n vector l1(n), r1(m);\n vector l2(n), r2(m);\n rep(i, n) l0[i] = l[i].a, l1[i] = l[i].a, l2[i] = l[i].a;\n rep(i, m) r0[i] = r[i].a, r1[i] = r[i].a, r2[i] = r[i].a;\n mul(l0, r0), mul(l1, r1), mul(l2, r2);\n Poly res(n + m - 1);\n // garner\n static constexpr M1 inv0 = 613999507;\n static constexpr M2 inv1 = 1147332803, inv0m1 = 45381342;\n static constexpr mint m0 = mod0, m0m1 = m0 * mod1;\n rep(i, n + m - 1) {\n int y0 = l0[i].a;\n int y1 = (inv0 * (l1[i] - y0)).a;\n int y2 = (inv0m1 * (l2[i] - y0) - inv1 * y1).a;\n res[i] = m0 * y1 + m0m1 * y2 + y0;\n }\n return res;\n}\nPoly &operator*=(Poly &l, const Poly &r) { return l = l * r; }\nPoly integ(const Poly &f) {\n Poly res(f.size() + 1);\n for(int i = 1; i < (int)res.size(); ++i) res[i] = f[i - 1] / i;\n return res;\n}\nstruct Prd {\n deque deq;\n Prd() = default;\n void emplace(const Poly &f) { deq.emplace_back(f); }\n Poly calc() {\n if(deq.empty()) return {1};\n sort(all(deq), [&](const Poly &f, const Poly &g) { return si(f) < si(g); });\n while(deq.size() > 1) {\n deq.emplace_back(deq[0] * deq[1]);\n for(int i = 0; i < 2; ++i) deq.pop_front();\n }\n return deq.front();\n }\n};\nPoly prd(vector &v) {\n Prd p;\n for(auto &e : v) p.emplace(e);\n return p.calc();\n}\n// Poly deriv(const Poly &f) {\n// if(f.size() == 0) return Poly();\n// Poly res(f.size() - 1);\n// rep(i, res.size()) res[i] = f[i + 1] * (i + 1);\n// return res;\n// }\nostream &operator<<(ostream &os, const Poly &a) {\n for(auto e : a) cout << e.a << \" \";\n return os;\n}\n} // namespace modular\nusing namespace modular;\n\nint main() {\n using M = Matrix;\n LL(n, k);\n vi v;\n ll N = n;\n while(n) { v.eb(n % k), n /= k; }\n reverse(all(v));\n auto f = [&](int num, int lastdigit) {\n vi used(k);\n int now = 0;\n M mat(k * 2 + 1);\n rep2(i, 1, k * 2 - 1) mat[i][i - 1] = 1;\n mat[k * 2][k * 2] = 1;\n rep(i, k * 2) {\n now--;\n lastdigit--;\n if(lastdigit == -1) now -= num;\n now = (now % k + k) % k;\n mat[0][i] = mat[k * 2][i] = 1;\n if(!now) break;\n used[now] = 1;\n }\n return mat;\n };\n M x(k * 2 + 1, 1);\n x[0][0] = 1, x[k * 2][0] = 1;\n rep(i, N) {\n int cnt = 1;\n int a = i / k;\n while(a and a % k == 0) cnt++, a /= k;\n x = f(cnt, i % k) * x;\n }\n cout << x[k * 2][0] << endl;\n}", "lang": "GNU C++17", "bug_code_uid": "5a06927134875336f1a092ca7f6faa3e", "src_uid": "175ce134da7cc5af9c8457e7bd9a40a2", "apr_id": "19b4fc718a255c22a69092cc4cf1780e", "difficulty": 2900, "tags": ["matrices", "dp"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5535714285714286, "equal_cnt": 11, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 10, "bug_source_code": "/* -*- coding: utf-8; tab-width: 4 -*- */\n\n#include \n#include \n#include \n\nstd::array v;\nstd::array w;\n\nlong long\nsearch(int i,\n\t int n)\n{\n\tif (n <= i) return v != w;\n\n\tif ((v[i] + w[i-1]) % 2 == 0) {\n\t\tw[i] = (v[i] + w[i-1]) / 2;\n\t\treturn search(i + 1, n);\n\t}\n\telse {\n\t\tlong long r(0);\n\t\tw[i] = (v[i] + w[i-1]) / 2;\n\t\tr += search(i + 1, n);\n\t\tw[i] = (v[i] + w[i-1]) / 2 + 1;\n\t\tr += search(i + 1, n);\n\t\treturn r;\n\t}\n}\n\nint\nmain()\n{\n\tchar s[51];\n\tint n(0);\n\tlong long r(0);\n\n\tstd::scanf(\"%s\", s);\n\tfor (int i(0); s[i]; ++i) v[i] = s[i] - '0', ++n;\n\n\tfor (int i(0); i < 10; ++i) {\n\t\tw[0] = i;\n\t\tr += search(1, n);\n\t}\n\n\tstd::cout << r << std::endl;\n\n\treturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "527f2635ff989acb71ede5279c622765", "src_uid": "2dd8bb6e8182278d037aa3a59ca3517b", "apr_id": "8e41185f4e9b7ecbb0c119ac55efe7ac", "difficulty": 1700, "tags": ["dp"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.3224092116917626, "equal_cnt": 13, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 13, "bug_source_code": "\ufeff#include \nusing namespace std;\n\n#define pb push_back\n#define mp make_pair\n#define fs first\n#define sc second\n#define sz(a) ((int) (a).size())\n#define int64 long long\n#define ldb long double\nconst ldb pi = acos(-1.0);\n\n#define FULL 2\n#define OK 1\n#define EMPTY 0\n\nint get_state(int a, int b, int c) {\n\tif ((a == 0) && (b == 0)) {\n\t\tif (c == 0) return FULL;\n\t\treturn EMPTY;\n\t}\n\treturn OK;\n}\n\nint det2(int a, int b, int c, int d) {\n\treturn a * d - b * c;\n}\n\nint main() {\n\t// assert(freopen(\"input.txt\", \"r\", stdin));\n\t// assert(freopen(\"output.txt\", \"w\", stdout));\n\tint a1, b1, c1, a2, b2, c2;\n\tscanf(\"%d%d%d\", &a1, &b1, &c1);\n\tscanf(\"%d%d%d\", &a2, &b2, &c2);\n\tint s1 = get_state(a1, b1, c1);\n\tint s2 = get_state(a2, b2, c2);\n\tif (s1 == EMPTY || s2 == EMPTY) {\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tif (s1 == FULL || s2 == FULL) {\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\tint d = det2(a1, b1, a2, b2);\n\tif (d == 0) {\n\t\tif (det2(a1, c1, a2, c2) == 0) {\n\t\t\tprintf(\"-1\\n\");\n\t\t} else {\n\t\t\tprintf(\"0\\n\");\n\t\t}\n\t} else {\n\t\tprintf(\"1\\n\");\n\t}\n\treturn 0;\n} ", "lang": "GNU C++", "bug_code_uid": "f4b705e2c1247cb53b86f8e74ca8643f", "src_uid": "ad290c29e7587561391cefab73026171", "apr_id": "3762f90004c0cfbfb63f2f5529a59c92", "difficulty": 2400, "tags": ["dp", "math", "probabilities", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9602919081347929, "equal_cnt": 9, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 8, "bug_source_code": "#include \"bits/stdc++.h\"\n\n#define forn(i, n) for (int i = 0; i < (int)n; i++)\n#define ford(i, n) for (int i = (int)n - 1; i >= 0; i--)\n#define forab(i, a, b) for (int i = (int)a; i < (int)b; i++)\n#define X first\n#define Y second\n#define pb push_back\n#define mp make_pair\n#define all(x) (x).begin(), (x).end()\n\ntemplate inline T sqr(T x)\n{\n return x*x; \n} \n\nusing namespace std;\n\ntypedef vector vi;\ntypedef pair pii;\ntypedef long long ll;\ntypedef long double ld;\n\n//const ld pi = acos((ld)-1.0);\nconst ld eps = 1e-6;\nconst int INF = (int)1E9;\nconst int MAXN = 21;\nconst int MAXMASK = 1 << MAXN;\n\nbool eq(ld a, ld b) {\n\treturn fabs(a - b) < eps;\n}\n\nint n, N, k, mmask;\nll cnk[MAXN][MAXN];\nld p[MAXN];\nld pSum[MAXMASK], coeff[MAXN];\nint trueId[MAXN], mass[MAXN];\nld ans[MAXN];\n\nvoid printAns() {\n\tcout.precision(20);\n\tforn(i, N)\n\t\tcout << ans[i] << \" \\n\"[i == N - 1];\n}\n\nint main() {\n\n\tcin >> n >> k;\n\tN = n;\n\tforn(i, n)\n\t\tcin >> p[i];\n\n\tforn(i, n)\n\t\tif (eq(p[i], 1.0)) {\n\t\t\tans[i] = 1.0;\n\t\t\tprintAns();\n\t\t\treturn 0;\n\t\t}\t\n\n\tforn(i, n)\n\t\ttrueId[i] = i;\n\t\t\t\n\tforn(i, n) {\n\t\tif (eq(p[i], 0.0)) {\n\t\t\tfor (int j = i; j < n - 1; j++) {\n\t\t\t\tp[j] = p[j + 1];\n\t\t\t\ttrueId[j] = trueId[j + 1];\n\t\t\t}\n\t\t\tn--;\n\t\t\ti--;\n\t\t}\n\t}\n\n \tif (n <= k) {\n \t\tforn(i, n)\n \t\t\tans[trueId[i]] = 1.0;\n \t\tprintAns();\n \t\treturn 0;\n \t}\n\n \tcnk[0][0] = 1;\n \tforab(i, 1, MAXN) {\n \t\tcnk[i][0] = 1;\n \t\tforab(j, 1, MAXN)\n \t\t\tcnk[i][j] = cnk[i - 1][j - 1] + cnk[i - 1][j];\n \t}\n\n \tfor (int j = k - 1; j >= 1; j--) {\n \t\tcoeff[j] = 0;\n \t\tfor (int i = 1; i <= k - 1 - j; i++)\n \t\t\tcoeff[j] -= cnk[n - j - 1][i]; \n \t\tcoeff[j]++;\n \t}\n\n \tmmask = 1 << n;\n \tforn(mask, mmask) {\n \t\tpSum[mask] = 0;\n \t\tmass[mask] = 0;\n \t\tforn(i, n)\n \t\t\tif ((mask >> i) & 1) {\n \t\t\t\tpSum[mask] += p[i];\n \t\t\t\tmass[mask]++;\n \t\t\t}\t\n \t}\n\n \tint j;\n \tforn(i, n) {\n \t\tld curAns = 0.0;\n\n \t\tforn(mask, mmask) {\n \t\t\tj = mass[mask];\n \t\t\tif (1 <= j && j <= k - 1 && ((mask >> i) & 1) == 0) {\n \t\t\t\tassert(!eq(pSum[mask], 1.0));\n \t\t\t\tcurAns += coeff[j] * (pSum[mask] / (1.0 - pSum[mask]));\n \t\t\t}\t\n \t\t}\n\n \t\tcurAns++;\n \t\tcurAns *= p[i];\n\n \t\tans[trueId[i]] = curAns;\n \t}\n\n \tprintAns();\n\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "25b1b1fd255c25bd1ecee07b9c60a754", "src_uid": "ad290c29e7587561391cefab73026171", "apr_id": "785f614b42d7973daabe7927a9f3fe93", "difficulty": 2400, "tags": ["dp", "math", "probabilities", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.27223230490018147, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "#include\nusing namespace std;\nstring st;\nint ans;\nint main(){ \n scanf(\"%s\",st);\n for(int j=0;j\n#include\n#include\n\nusing namespace std;\n\nint main()\n{\n int h1,h2,a,b,day=0;\n scanf(\"%d %d\\n%d %d\",&h1,&h2,&a,&b);\n while(h1=h2) { printf(\"%d\",day);system(\"pause\");return 0;}\n if(a\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n\n\n\n\nint main (){\n\tint n ;\n\tcin >> n ;\n\tint a [100] ;\n\tint x[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1} ;\n\tfor (int i = 0 ; i < n ; i++) cin >> a[i] ;\n\n\tif (n == 1 && (a[0]== 0) ) {\n\t\tcout << \"UP\" ;\n\t\treturn 0 ;\n\t}else if (n == 1 && (a[0] == 15)){\n\t\tcout << \"Down\" ;\n\t\treturn 0 ;\n\t}else if (n == 1) {\n\t\tcout << - 1;\n\t return -1 ;\n\t}\n\tint j ;\n\n\tfor (int i = 0 ; i < 29 ; i++)\n\t\tif (a[0] == x[i] && a[1] == x[i + 1] ) j = i ;\n\n\t if ( x[j + n % 30 ] > x[j + (n - 1) % 30]) cout << \"UP\" ;\n\t else cout << \"DOWN\";\n\n\n\n\n\n\n\t\treturn 0 ;\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": "1105237837cfe115c72dede27e615fb9", "src_uid": "8330d9fea8d50a79741507b878da0a75", "apr_id": "ddc85d20bc873fd5a992a9248fe3bc8d", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9407548437674992, "equal_cnt": 8, "replace_cnt": 3, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "// while (clock()<=69*CLOCKS_PER_SEC)\n// #pragma comment(linker, \"/stack:200000000\")\n// #pragma GCC optimize(\"O3\")\n// #pragma GCC optimize(\"Ofast\")\n// #pragma GCC target(\"sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native\")\n// #pragma GCC optimize(\"unroll-loops\")\n#include\n#include \n#include \n\n#define pb push_back\n#define SZ(x) ((int)(x).size())\n#define ALL(x) x.begin(),x.end()\n#define all(x) x.begin(),x.end()\n#define fi first\n#define se second\n#define _upgrade ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);\n#define erase_duplicates(x) sort(all(x)); (x).resize(distance((x).begin(), unique(all(x))));\n\n\nusing namespace std;\nusing namespace __gnu_pbds;\ntemplate\nusing ordered_set = tree<\nT,\nnull_type,\nless,\nrb_tree_tag,\ntree_order_statistics_node_update>;\n\n//X.find_by_order(k); - zwraca iterator na k-ty element (numeracja od zerowego)\n//X.order_of_key(k); - zwraca liczb\u0119 element\u00f3w ostro mniejszych ni\u017c k\n\ntypedef long long LL;\ntypedef pair PII;\ntypedef pair PLL;\ntypedef vector VPII;\ntypedef vector VPLL;\ntypedef vector VLL;\ntypedef vector VI;\ntypedef vector VS;\ntypedef vector VC;\ntypedef long double LD;\ntypedef pair PLD;\ntypedef vector VLD;\ntypedef vector VPLD;\n\ntemplate void _dbg(const char *sdbg, TH h){ cerr< void _dbg(const char *sdbg, TH h, TA... a) {\n while(*sdbg!=',')cerr<<*sdbg++;\n cerr<<\" = \"< ziom = {{1, 2, 3}, {1, 3, 2}, {2, 1, 3}, {2, 3, 1}, {3, 1, 2}, {3, 2, 1}};\n int mask = 0;\n for(auto s : ziom)\n for(int i = 1;i <= 6;i++)\n for(int j = i + 1;j <= 6;j++)\n for(int k = j + 1;k <= 6;k++)\n {\n if(elo[i][s[0] + f * 3] and elo[j][s[1] + f * 3] and elo[k][s[2] + f * 3])\n {\n mask |= maska[(f ? 126 : 0) ^ ((1<>n;\n for(int i = 1;i <= n;i++)\n for(int j = 1;j <= n;j++)\n cin>>tab[i][j];\n int xd = 0;\n for(int i = 1;i <= 6;i++)\n for(int j = i + 1;j <= 6;j++)\n for(int k = j + 1;k <= 6;k++)\n maska[(1<\n#include \nusing namespace std;\nint main()\n{\n int a,m;\n cin>>a>>m;\n vector cycle;\n cycle.push_back(a%m);\n if(a%m==0)\n {\n cout<<\"Yes\";\n return 0;\n }\n a+=(a%m);\n int idx=1;\n while(a%m!=cycle[0])\n {\n if(a%m==0)\n {\n cout<<\"Yes\";\n return 0;\n }\n cycle.push_back(a%m);\n a+=(a%m);\n }\n cout<<\"No\";\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "117bb6cdf5816eac83f6dfb1088ffed7", "src_uid": "f726133018e2149ec57e113860ec498a", "apr_id": "05df1e951b6f709c009c9034dc3ad945", "difficulty": 1400, "tags": ["matrices", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.6765432098765433, "equal_cnt": 21, "replace_cnt": 12, "delete_cnt": 1, "insert_cnt": 7, "fix_ops_cnt": 20, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n ios_base::sync_with_stdio(false);\n cin.tie(NULL);\n cout.tie(NULL);\n int n,m;\n cin>>n>>m;\n string a1[n];\n for(int i=0;i>a1[i];\n }\n int c=0;\n for(int i=0;i\n#include \n#include \n#include \n#include \n#include \n\n#define INF 0x3f3f3f3f\n#define INF64 0x3f3f3f3f3f3f3f3f\n#define LL long long\nusing namespace std;\nconst int maxInt = numeric_limits::max();\nconst LL MOD = 1e9+7;\n\n\nlong long inv(long long x){ \n\n long long y=M-2,res=1; \n\n for (; y; y>>=1,x=x*x%M) if (y&1) res=res*x%M; \n\n return res; \n\n} \n\nlong long C(int n,int m){//\u6c42\u7ec4\u5408\u6570\n long long ans = 1;\n for(long long i = 1; i <= m; i++){\n ans = (ans * (n-i+1) * inv(i)) % MOD;\n }\n return ans;\n}\n\n\nint n, m;\nint main() {\n cin >> n ;\n LL ans = 1;\n LL removedInLastRound = 0;\n LL powerOf2 = 1;\n for (int i = 1; i <= 2 * n; i++) {\n powerOf2 = (powerOf2 * 2) % MOD;\n LL currentRound = powerOf2;\n LL removedInCurrentRound = 0;\n if (i > n) {\n removedInCurrentRound = 2*C(i - 1, n) % MOD;\n removedInCurrentRound = (removedInCurrentRound + removedInLastRound * 2) % MOD;\n //printf(\"remove: %d + %d\\n\", 2);\n }\n currentRound = (currentRound - removedInCurrentRound + MOD) % MOD;\n //printf(\"%d: %d - %d = %d\\n\", i, powerOf2, removedInCurrentRound, currentRound);\n ans = (ans + currentRound) % MOD;\n removedInLastRound = removedInCurrentRound;\n }\n cout << ans;\n return 0;\n}", "lang": "GNU C++14", "bug_code_uid": "4cc03192fa43b2afcda62667ecc95bd7", "src_uid": "a18833c987fd7743e8021196b5dcdd1b", "apr_id": "99885597965f8ebdc2c28ee208245de9", "difficulty": 1800, "tags": ["combinatorics", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.20540540540540542, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "/*\t\n *\n *\tauthor:\thadi_hosseini\n * \n */\n#include \n\nusing namespace std;\n\nint main(){\n\tios::sync_with_stdio(0);\n\tcin.tie(0);\n\n //freopen(\"billboard.in\" , \"r\" , stdin);\n\t//freopen(\"billboard.out\" , \"w\" , stdout);\n\t\n\tint x1,y1,x2,y2;\n\tcin >> x1 >> y1 >> x2 >> y2;\n\n\tint x3,y3,x4,y4;\n\tcin >> x3 >> y3 >> x4 >> y4;\n\n\tint x5,y5,x6,y6;\n\tcin >> x5 >> y5 >> x6 >> y6;\n\t\n\n\tmap , int> m;\n\tfor(int i = x1 ; i < x2 ; i++){\n\t\tfor(int j = y1 ; j < y2 ; j++){\n\t\t\tm[{i,j}] = 1;\n\t\t}\n\t}\n\n\n\tint xo1= max(x1,x3);\n\tint xo2 = min(x2,x4);\n\tint yo1 = max(y1 , y3);\n\tint yo2 = min(y2,y4);\n\n\tfor(int i = xo1 ; i <= xo2 ; i++){\n\t\tfor(int j = yo1; j <= yo2 ; j++){\n\t\t\tm[{i,j}] = 0;\n\t\t}\n\t}\n\n\txo1= max(x1,x5);\n\txo2 = min(x2,x6);\n\tyo1 = max(y1,y6);\n\tyo2 = min(y2,y6);\n\n\tfor(int i = xo1 ; i <= xo2 ; i++){\n\t\tfor(int j = yo1; j <= yo2 ; j++){\n\t\t\tm[{i,j}] = 0;\n\t\t}\n\t}\n\n\tint ans = 0;\n\tfor(int i = x1 ; i < x2 ; i++){\n\t\tfor(int j = y1 ; j < y2 ; j++){\n\t\t\tif(m[{i,j}] == 1) ans++;\n\t\t}\n\t}\n\n\n\n\tif(ans > 0) cout << \"YES\\n\";\n\telse cout << \"NO\\n\";\n\n\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "94ae3a0ee46bd448b9f09353b65670a4", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "apr_id": "921becb89e8f6c304eac8d3f0fce8802", "difficulty": 1700, "tags": ["geometry", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.043859649122807015, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "#include\nusing namespace std;\nint main()\n{long long int i,j,y=0,x,found;\nvector a;\ncin >> x;\n for(i=1; ;i++)\n {\n {x=x+i;\n {while(x/10!=0)\n a.push_back(x%10);\n }\n y++;\n } \n found=0;\n \n {\n for(j=0;j\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\nint main(){\n int n;\n cin>>n;\n queue > Q;\n Q.push(make_pair(n,0));\n int minops=n*100;\n int cn,cop,tmpnum,fig;\n pair p;\n while(!Q.empty()) {\n p=Q.front();\n Q.pop();\n cn=p.first;\n cop=p.second;\n if(cn==0) {\n if(cop9) {\n tmpnum=cn;\n while(tmpnum>9) {\n fig=tmpnum%10;\n tmpnum/=10;\n if(fig>0) Q.push(make_pair(cn-fig,cop+1));\n }\n if(tmpnum>0) Q.push(make_pair(cn-tmpnum,cop+1));\n }\n \n }\n cout<\nusing namespace std;\n#define forr(i, a, b) for(int i = (a); i < (int) (b); i++)\n#define forn(i, n) forr(i, 0, n)\n#define dforr(i, a, b) for(int i = (int)(b-1); i >= (a); i--)\n#define dforn(i, n) dforr(i, 0, n)\n#define db(v) cerr << #v << \" = \" << v << endl\n#define pb push_back\n#define sz(x) ((int)x.size())\n#define ff first\n#define ss second\ntypedef long long ll;\ntypedef long double ld;\ntypedef pair ii;\nconst int MAXN = 1000100;\nconst ll INF = (ll)1e18+5;\n\nint criba[MAXN];\nvector P;\nvoid BuildS(){\n for(int p = 2; p*p < MAXN; p++)if(!criba[p])\n for(int i = p*p; i < MAXN; i+=p)criba[i] = p;\n forr(i, 2, MAXN)if(!criba[i]) P.pb(i);\n}\n\nbool OFlow(ll a, ll b){\n ll res = a*b, nb = res/a;\n return b != nb;\n}\n\nll ans;\nvector E;\nvoid tryme(){\n ll act = 1;\n dforn(i, sz(E)){\n int p = P[i];\n forn(j, E[i]-1){\n if(OFlow(act, p))return;\n act *= p;\n }\n }\n// printf(\"%lld es un candidato\\n\", act);\n ans = min(ans, act);\n}\n\nvoid solve(int n, int lim){\n if(n == 1){ tryme(); return; }\n forr(d, 2, min(lim+1, n+1))if(n%d == 0){\n E.pb(d); solve(n/d, d); E.pop_back();\n }\n}\n\nint n;\nint main(){\n//\tfreopen(\"input.txt\", \"r\", stdin);\n\tBuildS();\n//\tforn(i, 30)printf(\"%d \", P[i]); puts(\"\");\n\twhile(scanf(\"%d\", &n) >= 1){\n ans = INF; solve(n, 61);\n printf(\"%lld\\n\", ans);\n\t}\n\treturn 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "113fbbdf400866689afd3b69042c9c74", "src_uid": "62db589bad3b7023418107de05b7a8ee", "apr_id": "e30a6c087d0d9bf480105c10d4f62a04", "difficulty": 2000, "tags": ["dp", "brute force", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9902801600914809, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "#include \n#include \n#include \n\nusing namespace std;\n\nint main() {\n int n, c;\n scanf(\"%d %d\", &n, &c);\n vector scores(n);\n vector times(n);\n for (int i = 0; i < n; i++) {\n scanf(\"%d\", &scores[i]);\n }\n for (int i = 0; i < n; i++) {\n scanf(\"%d\", ×[i]);\n }\n int lscore = 0, rscore = 0;\n int ltime = 0, rtime = 0;\n int li = 0, ri = n - 1;\n while (li < n || ri) {\n if (li < n && ltime + times[li] < rtime + times[ri]) {\n ltime += times[li];\n lscore += max(scores[li] - ltime * c, 0);\n li++;\n } else if (ri >= 0) {\n rtime += times[ri];\n rscore += max(scores[ri] - rtime * c, 0);\n ri--;\n }\n }\n printf(\"%s\\n\", lscore == rscore ? \"Tie\" : lscore > rscore ? \"Limak\" : \"Radewoosh\");\n return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "7fe4adcd7dad3ac8e23637d32d94fd1c", "src_uid": "8c704de75ab85f9e2c04a926143c8b4a", "apr_id": "30cac38e744efea145b33929fe1f8a91", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.21073961499493415, "equal_cnt": 10, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "#include\nusing namespace std;\n#define pb push_back\n#define ll long long\n#define cn continue\n#define rt return\nint main(){\n ll l=0,r=0;\n ll n,c;\n cin>>n>>c;\n ll p[n+5],t[n+5];\n for(int i=1;i<=n;i++){\n cin>>p[i];\n }\n for(int i=1;i<=n;i++){\n cin>>t[i];\n }\n for(int i=1;i<=n;i++){\n l+=(p[i]-(c*t[i]));\n }\n for(int i=n;i>=1;i++){\n r+=(p[i]-(c*t[i]));\n }\n cout<\n\nusing namespace std;\n\nint main(){\n int mn,mx,aa=0,bb=0;\n\tvector v;\n\tint long long i,y=0,a,b,c;\n cin>>a>>b>>c;\n\tfor(i=0;;i++){\n \tif(a==0 && b==0 && c==0){\n \t\tbreak;\n \t}\n \tif(a>0){\n \t\tv.push_back('a');\n \ta--;\n\t\t}\n \tif(b>0){\n \t\tv.push_back('b');\n \tb--;\n\t\t}\n \tif(c>0){\n \t\tv.push_back('a');\n \t\tv.push_back('b');\n\t\tc--;\n\t\t}\n } \n mn=v.size();\n for(i=0;i=1){\n \tmn+=1;\n }\n\tcout<\n#define MOD 1000000007\n#define ll long long\n#define ld long double\n#define MAXN 100005\nconst ld PI = 3.141592653589793238L;\nusing namespace std;\n//<>\n\nint main(){\n ios::sync_with_stdio(false); cin.tie(NULL);\n \n vectorv;\n for(int i=1;i<=9;++i) v.push_back(to_string(i*11));\n \n\tfor(int i=4;i<=14;i+=2){\n\t\tint n=v.size();\n\t\tchar x='9'; if(i==14) x='5';\n\t\tfor(int j=0;jv2;\n\tfor(string s: v) v2.push_back(stoll(s));\n\tsort(v2.begin(),v2.end());\n\t\n ll K,P;\n cin >> K >> P;\n \n ll ans=0;\n for(int n=0;n\nusing namespace std;\n#define long int64_t\n\nint main()\n{\n long k, p;\n cin >> k;\n if(k < 10)\n return cout << k, 0;\n k--;\n for(p = 1; k >= 9*p; p *= 10)\n k -= 9*p;\n int m = log(p) + 1e-8;\n p += k/m, k %= m;\n cout << to_string(p)[k];\n return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "4be0dabb6c6f914ceb1122686e1dec57", "src_uid": "1503d761dd4e129fb7c423da390544ff", "apr_id": "57d308f5d91eba5ac12f6e8e5c368fb3", "difficulty": 1800, "tags": ["divide and conquer", "implementation", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.8969578017664377, "equal_cnt": 12, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 11, "bug_source_code": "#include\n#define ll long long\n#define fr(i,a,n) for(ll i=a;i\n#define mi map\n#define pi pair\n#define what(x) cout<<#x<<\" is \"<>n;\n //if(n%2==0){ cout<1)if(temp%a==1)break;else temp/=a;\n //what(temp);\n cnt=min(cnt,a);\n if(temp!=1){ ans++; }\n break;\n }\n\n if(ok)cout<\n#define maxn 120\n\nusing namespace std;\n\nint ar[maxn],bs[maxn];\n\nint main() {\n\tint a = 4;\n\tint b1=0,b2=0;\n\tfor(int i=1;i<=a;i++)\n\t\tscanf(\"%d %d\",&ar[i],&bs[i]);\n\t\n\tint a1,a2;\n\tint t1=0,t2=0;\n\t\n\ta1 = ar[1];\n\ta2 = bs[2];\n\t\n\tif( (ar[3] < a1 && bs[4] < a2) || (ar[3] < a1 && bs[4] < a2 ) ) b1 ++;\n\tif( (ar[3] > a1 && bs[4] > a2) || (ar[3] > a1 && bs[4] > a2 ) ) t1 = 1;\n\t\n\tif( (ar[4] < a1 && bs[3] < a2) || (ar[4] < a1 && bs[3] < a2 ) ) b1 ++;\n\tif( (ar[4] > a1 && bs[3] > a2) || (ar[4] > a1 && bs[3] > a2 ) ) t1 = 1;\n\t\n\ta1 = ar[2];\n\ta2 = bs[1];\n\t\n\tif( (ar[3] < a1 && bs[4] < a2) || (ar[3] < a1 && bs[4] < a2 ) ) b2 ++;\n\tif( (ar[3] > a1 && bs[4] > a2) || (ar[3] > a1 && bs[4] > a2 ) ) t2 = 1;\n\t\n\tif( (ar[4] < a1 && bs[3] < a2) || (ar[4] < a1 && bs[3] < a2 ) ) b2 ++;\n\tif( (ar[4] > a1 && bs[3] > a2) || (ar[4] > a1 && bs[3] > a2 ) ) t2 = 1;\n\t\n\t\n\tif( b1 == 2 || b2 == 2 ) printf(\"Team 1\\n\");\n\telse if( t1 && t2 ) printf(\"Team 2\\n\");\n\telse printf(\"Draw\\n\");\n\t\n\t\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "7f2fc337d31a8669770653938f8a9298", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "apr_id": "893f58bb28400f1c0f8e033fa59cb202", "difficulty": 1700, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.28244897959183674, "equal_cnt": 47, "replace_cnt": 29, "delete_cnt": 7, "insert_cnt": 10, "fix_ops_cnt": 46, "bug_source_code": "#include \nint main(){\n int x, y, z, x1, y1, z1, a[6];\n scanf(\"%d%d%d%d%d%d\", &x, &y, &z, &x1, &y1, &z1);\n for(int i = 0; i < 6; i ++)\n scanf(\"%d\", a + i);\n int ans = 0;\n if(z > z1) ans += a[3];\n else if(z < 0) ans += a[2];\n\n if(x > x1) ans += a[5];\n else if(x < 0) ans += a[4];\n\n if(y > y1) ans += a[1];\n else if(y < 0) ans += a[0];\n printf(\"%d\\n\",ans);\n return true;\n}\n\n\n/*esennpcoaajahctmfkcojqejnpppdijignnaahgmhpmormgcob*/", "lang": "GNU C++", "bug_code_uid": "3e3b72b973938b8ffa53841f84dcd11c", "src_uid": "c7889a8f64c57cf7be4df870f68f749e", "apr_id": "2220e4d6cccbe0e58f13f466d4ed8a54", "difficulty": 1600, "tags": ["geometry", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.07504363001745201, "equal_cnt": 17, "replace_cnt": 15, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 16, "bug_source_code": "#include \nint main(){\n int x, y, z, x1, y1, z1, a[10];\n scanf(\"%d%d%d%d%d%d\", &x, &y, &z, &x1, &y1, &z1);\n\n for(int i = 0; i < 6; i ++)\n scanf(\"%d\", a + i);\n int ans = 0;\n\n if(z > z1) ans += a[3];\n else if(z < 0) ans += a[2];\n\n if(x > x1) ans += a[5];\n else if(x < 0) ans += a[4];\n\n if(y > y1) ans += a[1];\n else if(y < 0) ans += a[0];\n \n printf(\"%d\\n\",ans);\n\n return true;\n}\n\n\n/*oqmkfncqtspkiasfcgldioikebkqitrdijnncijosfegfcetjp*/", "lang": "GNU C++", "bug_code_uid": "b29596f7e5e47fe38278b6dcde550d1f", "src_uid": "c7889a8f64c57cf7be4df870f68f749e", "apr_id": "2220e4d6cccbe0e58f13f466d4ed8a54", "difficulty": 1600, "tags": ["geometry", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9958734525447043, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n\nusing namespace std;\n\nint const M=1e9+7;\nlong long n;\nvector> m, st;\n\nvector> pr(vector> a, vector> b)\n{\n vector> r;\n r.resize(2);\n r[0].resize(2);\n r[1].resize(2);\n for(int i=0;i<2;++i)\n {\n for(int j=0;j<2;++j)\n {\n for(int k=0;k<2;++k)\n {\n r[i][j] = (r[i][j] + a[i][k]*1LL*b[k][j]%M)%M;\n }\n }\n }\n return r;\n}\n\nvector> pow(int d)\n{\n if(d==0)\n {\n vector> r;\n r.resize(2);\n r[0].resize(2);\n r[1].resize(2);\n r[0][0]=1;\n r[1][1]=1;\n return r;\n }\n if(d&1)\n {\n return pr(m,pow(d-1));\n }\n else\n {\n vector> r = pow(d/2);\n return pr(r,r);\n }\n}\n\nint main()\n{\n cin>>n;\n st.resize(2);\n st[0].resize(2);\n st[1].resize(2);\n m.resize(2);\n m[0].resize(2);\n m[1].resize(2);\n st[0][0]=st[1][1]=1;\n st[0][1]=0;\n st[1][0]=3;\n m[0][0]=m[1][1]=3;\n m[0][1]=m[1][0]=1;\n vector> mn = pow(n);\n vector> res = pr(st,mn);\n cout<\n#define ll long long\n#define endl \"\\n\"\nconst int N=5005;\nconst int mod=1e9+7;\nusing namespace std;\n#define DEBUG(...) {printf(\"[DEBUG] \");W(__VA_ARGS__);}\ntemplate\nostream& operator+(ostream& out, const vector &vec){\n for(const auto &x : vec){\n out<\nostream& operator*(ostream& out, const vector &vec){\n for(const auto &x : vec){\n out+x;\n }\n return out;\n}\ntemplate\nistream& operator>>(istream& in, vector &vec){\n for(auto &x : vec){\n in>>x;\n }\n return in;\n}\n\nvoid solve(){\n string s;\n cin>>s;\n int i=0;\n\n for(i=0;s[i]!='e';i++){\n }\n int pow=stoi(s.substr(i+1,s.length()));\n string ans;\n int flag=false;\n for(i=0;s[i]!='e';i++){\n if(s[i]=='.'){\n flag=true;\n continue;\n }\n if(!flag){\n ans+=s[i];\n }\n else{\n if(pow==0){\n ans+='.';\n }\n ans+=s[i];\n pow--;\n\n }\n }\n while(pow>0){\n ans+='0';\n }\n cout<>t;\n while(t--)solve();\n}\n", "lang": "GNU C++17", "bug_code_uid": "a4524d8e413b36005b4d749e0b418610", "src_uid": "a79358099f08f3ec50c013d47d910eef", "apr_id": "a21628f02cbc72d259a619c365ed6fd1", "difficulty": 1400, "tags": ["strings", "math", "brute force", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9998645353562721, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "//\n//\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n//\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n//\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n//\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2584\u2591\u2591\u2591\u2591\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n//\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2588\u2584\u2584\u2591\u2591\u2584\u2591\u2591\u2591\u2588\u2591\u2584\u2584\u2584\u2591\u2591\u2591\n//\u2591\u2584\u2584\u2584\u2584\u2584\u2591\u2591\u2588\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2580\u2588\u2591\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2580\u2580\u2591\u2588\u2588\u2591\u2591\n//\u2591\u2588\u2588\u2584\u2580\u2588\u2588\u2584\u2588\u2591\u2591\u2591\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2588\u2588\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2580\u2580\u2591\u2591\u2591\u2591\u2588\u2588\u2591\u2591\n//\u2591\u2591\u2580\u2588\u2588\u2584\u2580\u2588\u2588\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2588\u2588\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2588\u2588\u2591\n//\u2591\u2591\u2591\u2591\u2580\u2588\u2588\u2588\u2588\u2591\u2580\u2591\u2591\u2591\u2591\u2584\u2591\u2591\u2591\u2588\u2588\u2591\u2591\u2591\u2584\u2588\u2591\u2591\u2591\u2591\u2584\u2591\u2584\u2588\u2591\u2591\u2588\u2588\u2591\n//\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2588\u2591\u2591\u2591\u2591\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2588\u2591\u2591\u2591\u2591\u2584\u2591\u2591\u2591\u2584\u2591\u2591\u2584\u2591\u2591\u2591\u2588\u2588\u2591\n//\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2588\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2591\u2591\u2584\u2580\u2591\u2591\n//\u2591\u2591\u2591\u2591\u2591\u2591\u2588\u2580\u2580\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2580\u2580\u2580\u2580\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2580\u2591\u2591\u2591\u2591\n//\u2591\u2591\u2591\u2591\u2591\u2591\u2588\u2588\u2588\u2588\u2580\u2591\u2591\u2588\u2588\u2588\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2588\u2588\u2588\u2591\u2591\u2580\u2588\u2588\u2580\u2591\u2591\u2591\u2591\u2591\u2591\n//\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n//\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2588\u2588\n//\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2591\u2588\u2588\u2593\u2588\n//\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2593\u2588\u2588\u2593\u2593\u2588\u2591\n//\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2588\u2588\u2592\u2500\u2592\u2593\u2593\u2593\n//\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2588\u2593\u2592\u2592\u2591\u2500\u2592\u2593\u2588\n//\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2591\u2588\u2588\u2593\u2592\u2592\u2593\u2592\u2591\u2592\u2593\u2588\n//\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2592\u2588\u2592\u2500\u2500\u2592\u2593\u2593\u2593\u2593\u2592\u2593\u2588\u2591\n//\u2500\u2500\u2500\u2500\u2500\u2500\u2593\u2588\u2593\u2592\u2500\u2500\u2592\u2592\u2591\u2591\u2592\u2593\u2593\u2588\u2588\n//\u2500\u2500\u2500\u2500\u2500\u2588\u2588\u2593\u2593\u2593\u2593\u2593\u2588\u2592\u2500\u2500\u2500\u2593\u2593\u2593\u2588\u2591\n//\u2500\u2500\u2500\u2500\u2588\u2588\u2592\u2593\u2593\u2588\u2592\u2500\u2500\u2500\u2592\u2588\u2588\u2588\u2500\u2500\u2593\u2588\n//\u2500\u2500\u2591\u2588\u2588\u2588\u2588\u2593\u2591\u2588\u2592\u2592\u2588\u2500\u2500\u2500\u2593\u2588\u2500\u2500\u2593\u2588\u2591\n//\u2500\u2592\u2588\u2588\u2593\u2591\u2500\u2593\u2593\u2592\u2592\u2593\u2588\u2592\u2500\u2500\u2500\u2593\u2500\u2500\u2591\u2588\u2588\n//\u2593\u2588\u2593\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2593\u2588\u2588\u2593\u2588\u2588\u2593\u2588\u2588\u2588\u2592\u2592\u2588\u2592\n//\u2588\u2593\u2593\u2593\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2592\u2588\n//\u2593\u2588\u2588\u2593\u2588\u2588\u2588\u2593\u2591\u2591\u2591\u2591\u2591\u2593\u2591\u2593\u2588\u2592\u2588\u2588\u2588\u2588\u2588\u2588\u2592\n//\u2592\u2592\u2593\u2593\u2592\u2592\u2591\u2592\u2593\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2592\u2592\u2592\u2593\u2588\u2588\u2588\n//\u2593\u2588\u2593\u2591\u2591\u2591\u2591\u2500\u2593\u2593\u2588\u2588\u2592\u2593\u2592\u2592\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2592\u2588\u2593\n//\u2592\u2592\u2593\u2592\u2591\u2591\u2591\u2500\u2593\u2588\u2588\u2588\u2588\u2592\u2591\u2592\u2592\u2592\u2592\u2592\u2591\u2592\u2591\u2591\u2591\u2588\u2588\n//\u2592\u2592\u2593\u2588\u2588\u2593\u2593\u2592\u2591\u2500\u2591\u2500\u2500\u2500\u2591\u2593\u2593\u2593\u2591\u2593\u2588\u2588\u2588\u2592\u2592\u2593\u2588\n//\u2593\u2591\u2591\u2592\u2592\u2592\u2500\u2591\u2500\u2500\u2500\u2500\u2500\u2500\u2592\u2593\u2591\u2593\u2592\u2500\u2588\u2588\u2588\u2592\u2500\u2592\u2588\u2592\n//\u2588\u2592\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2591\u2592\u2591\u2500\u2500\u2591\u2593\u2500\u2591\u2500\u2500\u2500\u2591\u2591\u2592\u2593\u2588\u2592\n//\u2588\u2588\u2588\u2591\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2588\u2500\u2500\u2500\u2592\u2500\u2500\u2591\u2592\u2500\u2500\u2591\u2592\u2592\u2588\u2588\u2592\n//\u2500\u2592\u2588\u2588\u2588\u2591\u2500\u2500\u2500\u2500\u2500\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2591\u2500\u2500\u2500\u2591\u2592\u2593\u2588\u2593\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2591\u2593\u2588\n//\u2500\u2500\u2500\u2500\u2592\u2588\u2591\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2592\u2588\u2588\u2500\u2500\u2500\u2500\u2500\u2591\u2593\u2588\u2588\u2588\u2592\n//\u2588\u2592\u2500\u2500\u2500\u2500\u2588\u2592\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2591\u2592\u2593\u2593\u2588\u2500\u2500\u2500\u2593\u2588\u2588\u2588\u2592\n//\u2593\u2588\u2588\u2500\u2500\u2500\u2500\u2500\u2591\u2591\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2591\u2591\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2592\n//\u2588\u2588\u2588\u2588\u2592\u2500\u2500\u2500\u2500\u2500\u2591\u2592\u2591\u2591\u2591\u2500\u2500\u2500\u2500\u2500\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2591\n//\u2593\u2593\u2588\u2588\u2588\u2588\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2591\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2593\u2588\u2593\n//\u2588\u2593\u2593\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2591\u2593\u2588\u2588\u2588\u2588\u2593\u2588\u2588\u2593\u2593\u2592\u2592\u2592\u2593\u2588\u2591\n//\u2593\u2591\u2500\u2500\u2500\u2591\u2592\u2588\u2588\u2588\u2588\u2588\u2592\u2500\u2500\u2500\u2500\u2500\u2593\u2588\u2593\u2593\u2592\u2593\u2593\u2593\u2588\u2592\n//\u2500\u2591\u2588\u2588\u2588\u2588\u2588\u2592\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2592\u2593\u2593\u2593\u2592\u2592\u2593\u2588\u2588\u2592\n//\u2500\u2500\u2588\u2591\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2588\u2593\u2593\u2593\u2592\u2592\u2593\u2593\u2588\u2591\n//\u2593\u2591\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2588\u2593\u2593\u2593\u2588\u2592\u2593\u2593\u2588\u2588\n//\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2592\u2588\u2588\u2588\u2588\u2588\u2593\u2593\u2593\u2593\u2588\u2592\n//\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2591\u2500\u2500\u2591\u2588\u2588\u2593\u2593\u2593\u2593\u2588\u2588\u2593\n//\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2592\u2592\u2591\u2500\u2500\u2500\u2500\u2592\u2588\u2593\u2593\u2593\u2588\u2591\n//\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n//\u2588\u2588\u2588\u2588\u2500\u2500\u2500\u2500\u2588\u2500\u2588\u2500\u2588\u2500\u2500\u2500\u2588\u2500\u2588\u2500\u2500\u2500\u2588\u2588\u2500\u2588\u2588\n//\u2588\u2500\u2500\u2588\u2588\u2500\u2500\u2500\u2588\u2588\u2588\u2588\u2588\u2500\u2500\u2500\u2588\u2500\u2588\u2500\u2500\u2500\u2500\u2588\u2588\u2588\n//\u2588\u2588\u2588\u2588\u2500\u2500\u2500\u2500\u2500\u2588\u2588\u2588\u2500\u2500\u2500\u2500\u2588\u2588\u2588\u2500\u2500\u2500\u2500\u2500\u2588\n//\u2588\u2500\u2500\u2588\u2588\u2500\u2500\u2500\u2588\u2588\u2588\u2588\u2588\u2500\u2500\u2500\u2500\u2500\u2588\u2500\u2500\u2500\u2500\u2588\u2588\u2588\n//\u2588\u2588\u2588\u2588\u2500\u2500\u2500\u2500\u2588\u2500\u2588\u2500\u2588\u2500\u2500\u2500\u2588\u2588\u2588\u2500\u2500\u2500\u2588\u2588\u2500\u2588\u2588\n\n#define vc vector \n#define sz(v) (int)(v.size())\n#define pb(a) push_back(a)\n#define each(it,s) for(auto it = s.begin(); it != s.end(); it++)\n#define rep(i, b, n) for(int i = (b); i < (n); i++)\n#define all(v) v.begin(), v.end()\n#define FI first\n#define SE second\n#define rr(i,j,n,m) for(int i=0;i>n;\n char c1[10][10],c2[10][10],c3[10][10],c4[10][10],b,d1[10][10],d2[10][10],d3[10][10],d4[10][10],e1[10][10],e2[10][10],e3[10][10],e4[10][10],f1[10][10],f2[10][10],f3[10][10],f4[10][10];\n rep(i,0,n)\n {\n rep(i,0,n)\n {\n cin >> c1[i][j];\n c2[j][n-1-i]=c1[i][j];\n c3[n-1-i][n-1-j]=c1[i][j];\n c4[n-1-j][i]=c1[i][j];\n }\n }\n rr(i,j,n,n)\n {\n d1[i][n-1-j]=c1[i][j];\n d2[i][n-1-j]=c2[i][j];\n d3[i][n-1-j]=c3[i][j];\n d4[i][n-1-j]=c4[i][j];\n e1[n-1-i][j]=c1[i][j];\n e2[n-1-i][j]=c2[i][j];\n e3[n-1-i][j]=c3[i][j];\n e4[n-1-i][j]=c4[i][j];\n f1[n-1-i][n-1-j]=c1[i][j];\n f2[n-1-i][n-1-j]=c2[i][j];\n f3[n-1-i][n-1-j]=c3[i][j];\n f4[n-1-i][n-1-j]=c4[i][j];\n }\n rep(i,0,n)\n {\n rep(j,0,n)\n {\n cin >> b;\n if(b!=c1[i][j])\n fl1=0;\n if(b!=c2[i][j])\n fl2=0;\n if(b!=c3[i][j])\n fl3=0;\n if(b!=c4[i][j])\n fl4=0;\n if(b!=d1[i][j])\n fd1=0;\n if(b!=d2[i][j])\n fd2=0;\n if(b!=d3[i][j])\n fd3=0;\n if(b!=d4[i][j])\n fd4=0;\n if(b!=e1[i][j])\n fe1=0;\n if(b!=e2[i][j])\n fe2=0;\n if(b!=e3[i][j])\n fe3=0;\n if(b!=e4[i][j])\n fe4=0;\n if(b!=f1[i][j])\n ff1=0;\n if(b!=f2[i][j])\n ff2=0;\n if(b!=f3[i][j])\n ff3=0;\n if(b!=f4[i][j])\n ff4=0;\n }\n }\n if(fl1 || fl2 || fl3 || fl4 || fd1 || fd2 || fd3 || fd4 || fe1 || fe2 || fe3 || fe4 || ff1 || ff2 || ff3 || ff4)\n YES;\n else\n NO;\n}", "lang": "GNU C++14", "bug_code_uid": "9f19c847b2cc892a3b3a0f29d8b473a3", "src_uid": "2e793c9f476d03e8ba7df262db1c06e4", "apr_id": "3b886a772efdc11ecdf372f18107788b", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.874043555032372, "equal_cnt": 43, "replace_cnt": 38, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 42, "bug_source_code": "#include \n#include \n#include \n#include \n\nusing namespace std;\n\nconst int p=1000000007;\n\nint fac[40000],inv[40000];\nint b[40000],f[50][40000],g[50][40000],h[40000];\nint i,j,k,n,s,t;\nlong long m;\n\ninline int power(int x,int y)\n{\n\tint s=1;\n\tfor (int i=30;i>=0;i--)\n\t{\n\t\ts=1LL*s*s%p;\n\t\tif ((1<=0;i--)\n\t\tinv[i]=1LL*(i+1)*inv[i+1]%p;\n\treturn;\n}\n\ninline int C(int x,int y)\n{\n\treturn 1LL*fac[x]*inv[y]%p*inv[x-y]%p;\n}\n\nconst int q=33333;\nconst long double pi=acos(-1);\n\nstruct complex\n{\n\tlong double r,i;\n\t\n\tinline complex operator + (const complex t) const\n\t{\n\t\treturn (complex) {r+t.r,i+t.i};\n\t}\n\t\n\tinline complex operator - (const complex t) const\n\t{\n\t\treturn (complex) {r-t.r,i-t.i};\n\t}\n\t\n\tinline complex operator * (const complex t) const\n\t{\n\t\treturn (complex) {r*t.r-i*t.i,r*t.i+i*t.r};\n\t}\n};\n\ncomplex W[80000][2],X[80000],Y[80000],Z[80000];\nint R[80000],x[80000],y[80000],z[80000];\nint x0[80000],x1[80000],y0[80000],y1[80000],z0[80000],z1[80000],z2[80000];\nint w;\n\ninline void preFFT()\n{\n\tfor (w=1;w<=n;w=w<<1);\n\tw=w<<1;\n\tfor (int i=0;i>1,k=k<<1)\n\t\t\tR[i]=(R[i]<<1)|(j&1);\n\treturn;\n}\n\ninline void FFT(complex *T,int t)\n{\n\tfor (int i=0;in)\n\t\treturn printf(\"0\"),0;\n\tpreC();\n\tpreFFT();\n\th[0]=1;\n\tfor (i=1;i<=n;i++)\n\t\th[i]=(h[i-1]+h[i-1])%p;\n\tsolve(m);\n\tfor (i=m;i<=n;i++)\n\t\ts=(s+1LL*f[b[m]][i]*C(n,i))%p;\n\tprintf(\"%d\",s);\n\treturn 0;\n}", "lang": "GNU C++", "bug_code_uid": "859e8711982e7a0db9ba0de1d0f67012", "src_uid": "295baf6ccbfc3a7d098989a0701d2018", "apr_id": "00e1d5577c3213b7caed2f0b335f8f2f", "difficulty": 3300, "tags": ["dp", "fft", "math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9837432263443101, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include \n \n#define pb push_back\n#define mp make_pair\n#define pp pop_back\n#define pf push_front\n#define fi first\n#define se second\n#define maxn 100005\n#define mod 1000000007\ntypedef long long ll;\t\nusing namespace std;\n#define pi pair\n#define debug_iv_ac ios::sync_with_stdio(false);cin.tie(NULL);\n \nstruct node{\n ll i,w,s;\n node(){}\n \n node(ll _i,ll _s){\n s = _s,i = _i;\n }\n \n bool operator < (node X)const{\n if(s!=X.s) return s < X.s;\n //if(pos!=X.pos) return X.pos 0) \n { \n // If y is odd, multiply x with result \n if (y & 1) \n res = (res*x) % p; \n \n // y must be even now \n y = y>>1; // y = y/2 \n x = (x*x) % p; \n } \n return res; \n} \n \nll add(ll a, ll b)\n{\n a%=mod;b%=mod;\n return (a+b)%mod;\n}\n \nll sub(ll a,ll b)\n{\n a%=mod;b%=mod;\n return (a-b+mod)%mod;\n}\n \nll prod(ll a,ll b)\n{\n a%=mod;\n b%=mod;\n return (a*b)%mod;\n}\nconst int MAXN = (1<<9);\nint x1[maxn];\nint y2[maxn];\nint main()\n{\n\tdebug_iv_ac\n\tint n;\n\tcin>>n;\n\tint miny,minx,maxx,maxy;\n\tfor(int i=1;i<=4*n+1;i++)\n\t{\n\t int x,y;\n\t cin>>x>>y;\n\t x1[i] = x,y2[i] = y;\n\t miny = min(miny,y);\n\t maxy = max(maxy,y);\n\t minx = min(minx,x);\n\t maxx = max(maxx,x);\n\t}\n\tfor(int i=minx;i<=maxx;i++)\n\t{\n\t for(int j=miny;j<=maxy;j++)\n\t {\n\t for(int l=1;l<=50;l++)\n\t {\n\t int cnt = 0;\n\t int x = 0,y = 0;\n \t for(int k=1;k<=4*n+1;k++)\n \t {\n \t if(x1[k]==i||x1[k]==i+l-1)\n \t {\n \t if(y2[k]j+l-1)\n \t {\n \t cnt++,x = x1[k],y = y2[k];\n \t }\n \t }\n \t else if(y2[k]==j||y2[k]==j+l-1)\n \t {\n \t if(x1[k]i+l-1)\n \t {\n \t cnt++,x = x1[k],y = y2[k];\n \t }\n \t }\n \t else cnt++,x = x1[k],y = y2[k];\n \t }\n \t if(cnt==1)\n \t {\n \t cout<\n\nint a[8][8],ans=20;\nstd::string g;\nint main(){\n for(int i = 0; i < 8; ++i){\n std::cin >> g;\n for(int j = 0; j < 8; ++j)a[i][j] = g[j]=='B';\n }\n for(int row = 0; row < (1 << 8); ++row){\n for(int col = 0; col < (1 << 8); ++col){\n int on = 0;\n for(int i = 0; i < 8; ++i)\n for(int j = 0; j < 8; ++j)\n if(!((row>>i)&1) && !((col>>j)&1))on+=a[i][j];\n if(on == 0)ans = std::min(ans,__builtin_popcount(row)+__builtin_popcount(col));\n }\n }\n return std::cout << ans,0;\n}", "lang": "GNU C++17", "bug_code_uid": "c1a0cf64c34c51a712e43981e99a13a8", "src_uid": "8b6ae2190413b23f47e2958a7d4e7bc0", "apr_id": "15f3e92ecd2d5aa536b72f17351494a4", "difficulty": 1100, "tags": ["brute force", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.19427402862985685, "equal_cnt": 16, "replace_cnt": 11, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 15, "bug_source_code": "#include\n#include\n#include\nusing namespace std;\n\nint rever[10]={8,-1,-1,3,6,9,4,7,0,5};\n\nint main()\n{\n\tchar in[15]={};\n\tscanf(\"%s\",in);\n\tint p=strlen(in);\n\tint t=p/2;\n\tif(p%2==1)\n\t{\n\t\tp=p/2;\n\t\tif(rever[in[p]-'0']==-1)\n\t\t{\n\t\t\tprintf(\"No\");\n\t\t\treturn 0;\n\t\t}\n\t\twhile(in[p]!='\\0')\n\t\t{\n\t\t\tin[p]=in[p+1];\n\t\t\tp++;\n\t\t}\n\t}\n\tstacknum;\n\tfor(int r=0;r\n\nusing namespace std;\n\nint main()\n{\n ios_base::sync_with_stdio();\n ios::sync_with_stdio(0);\n\tcin.tie(0); cout.tie();\n\tmap > m;\n\tm[1].push_back(\"1rd,0c\");m[1].push_back(\"2rd,0c\");m[1].push_back(\"3rd,1cr\");m[1].push_back(\"0r,1cr\");m[1].push_back(\"0r,2cr\");\n\tm[1].push_back(\"1rd,1cr\");m[1].push_back(\"1rd,2cr\");m[1].push_back(\"2rd,1cr\");m[1].push_back(\"2rd,2cr\");\n\n\tm[2].push_back(\"0r,1cr\");m[2].push_back(\"0r,1cl\");m[2].push_back(\"1rd,0c\");m[2].push_back(\"2rd,0c\");m[2].push_back(\"3rd,0c\");\n\tm[2].push_back(\"1rd,1cr\");m[2].push_back(\"1rd,1cl\");m[2].push_back(\"2rd,1cr\");m[2].push_back(\"2rd,1cl\");\n\n\tm[3].push_back(\"0r,1cl\");m[3].push_back(\"0r,2cl\");m[3].push_back(\"1rd,0c\");m[3].push_back(\"1rd,1cl\");m[3].push_back(\"1rd,2cl\");\n\tm[3].push_back(\"2rd,0c\");m[3].push_back(\"2rd,1cl\");m[3].push_back(\"2rd,2cl\");m[3].push_back(\"3rd,1cl\");\n\n\tm[4].push_back(\"1ru,0c\");m[4].push_back(\"1rd,0c\");m[4].push_back(\"2rd,1cr\");m[4].push_back(\"0r,1cr\");m[4].push_back(\"0r,2cr\");\n\tm[4].push_back(\"1ru,1cr\");m[4].push_back(\"1ru,2cr\");m[4].push_back(\"1rd,1cr\");m[4].push_back(\"1rd,2cr\");\n\n\tm[5].push_back(\"1ru,0c\");m[5].push_back(\"1rd,0c\");m[5].push_back(\"2rd,0c\");m[5].push_back(\"0r,1cr\");m[5].push_back(\"0r,1cl\");\n\tm[5].push_back(\"1ru,1cr\");m[5].push_back(\"1ru,1cl\");m[5].push_back(\"1rd,1cr\");m[5].push_back(\"1rd,1cl\");\n\n\tm[6].push_back(\"1ru,0c\");m[6].push_back(\"1rd,0c\");m[6].push_back(\"2rd,1cl\");m[6].push_back(\"0r,1cl\");m[6].push_back(\"0r,2cl\");\n\tm[6].push_back(\"1ru,1cl\");m[6].push_back(\"1ru,2cl\");m[6].push_back(\"1rd,1cl\");m[6].push_back(\"2rd,2cl\");\n\n\tm[7].push_back(\"1ru,0c\");m[7].push_back(\"2ru,0c\");m[7].push_back(\"1ru,1cr\");m[7].push_back(\"1ru,2cr\");m[7].push_back(\"2ru,1cr\");\n\tm[7].push_back(\"2ru,2cr\");m[7].push_back(\"0r,1cr\");m[7].push_back(\"0r,2cr\");m[7].push_back(\"1rd,1cr\");\n\n\tm[8].push_back(\"1rd,0c\");m[8].push_back(\"0r,1cr\");m[8].push_back(\"0r,1cl\");m[8].push_back(\"1ru,0c\");m[8].push_back(\"1ru,1cr\");\n\tm[8].push_back(\"1ru,2cr\");m[8].push_back(\"2ru,0c\");m[8].push_back(\"2ru,1cr\");m[8].push_back(\"2ru,1cl\");\n\n\tm[9].push_back(\"1ru,0c\");m[9].push_back(\"2ru,0c\");m[9].push_back(\"1rd,1cl\");m[9].push_back(\"0r,1cl\");m[9].push_back(\"0r,2cl\");\n\tm[9].push_back(\"1ru,1cl\");m[9].push_back(\"1ru,2cl\");m[9].push_back(\"2ru,1cl\");m[9].push_back(\"2ru,2cl\");\n\n\tm[0].push_back(\"1ru,0c\");m[0].push_back(\"2ru,0c\");m[0].push_back(\"3ru,0c\");m[0].push_back(\"1ru,1cr\");m[0].push_back(\"1ru,1cl\");\n\tm[0].push_back(\"2ru,1cr\");m[0].push_back(\"2ru,1cl\");m[0].push_back(\"3ru,1cr\");m[0].push_back(\"3ru,1cl\");\n\n\tmap > m2 ;\n\tm2[1].first=0;m2[1].second=0;\n\tm2[2].first=0;m2[2].second=1;\n\tm2[3].first=0;m2[3].second=2;\n\tm2[4].first=1;m2[4].second=0;\n\tm2[5].first=1;m2[5].second=1;\n\tm2[6].first=1;m2[6].second=2;\n\tm2[7].first=2;m2[7].second=0;\n\tm2[8].first=2;m2[8].second=1;\n\tm2[9].first=2;m2[9].second=2;\n\tm2[0].first=3;m2[0].second=1;\n\n\tint n ,e=1, arr[4][3]={0};\n\tstring s;\n\tcin >> n >> s;\n\tif (n==9){\n if (s==\"000000000\")\n {\n cout << \"NO\";\n return 0;\n }\n\n\t}\n\tfor (int i=0;i<3;i++){\n for (int j=0;j<3;j++){\n arr[i][j]=e;\n e++;\n }\n\t}\n\tvector v;\n\tstring temp;\n\n\tint t1,t2,cx,cy,nx,ny,nnx,nny;\n\tfor (int i=0;i0){\n //cout << \"A*&A \"<nx)\n nnx=cx-nx;\n else\n nnx=nx-cx;\n if (cy>ny)\n nny = cy-ny;\n else\n nny=ny-cy;\n if (nx==cx){\n oss << \"0r,\"<nx)\n nnx=cx-nx;\n else\n nnx=nx-cx;\n if (cy>ny)\n nny = cy-ny;\n else\n nny=ny-cy;\n\n oss << nnx <<\"ru,\" ;\n if (t1==2||t1==5||t1==8){\n oss <<\"0c\";\n }\n else if (t1==1||t1==4||t1==7){\n oss << nny << \"cl\";\n }\n else if (t1==3||t1==6||t1==9){\n oss << nny << \"cr\";\n }\n }\n else {\n if (cx>nx)\n nnx=cx-nx;\n else\n nnx=nx-cx;\n if (cy>ny)\n nny = cy-ny;\n else\n nny=ny-cy;\n if (nx==cx){\n oss << \"0r,\"< ::iterator it;vector ::iterator it2;\n\tint coun=0,current;\n\tbool flag=false;\n\tfor (int i=0;i<10;i++){\n coun=0;\n current=i;\n\n for (it=v.begin();it!=v.end();it++){\n for (it2=m[current].begin();it2!=m[current].end();it2++){\n\n if (*it2==*it){\n //cout << *it <\nusing namespace std;\n\n/* MIGHT BE OF USE\n\n\n#define si(x)\tscanf(\"%d\",&x)\n#define pi(x)\tprintf(\"%d\\n\",x)\n\ntypedef pair\tpii;\ntypedef vector\t\tvi;\ntypedef vector\t\tvpii;\n*/\n\n\n#define fo(i,a,b) for(i=a;i>s\n#define ps(s)\tcout<\tpl;\ntypedef vector\t\tvl;\ntypedef vector\t\tvpl;\ntypedef vector\tvs;\n\n\n\n\n\nvoid solve()\n{\n //freopen(\"input.txt\", \"r\", stdin);\n //freopen(\"output.txt\", \"w\", stdout);\n string s,t;\n ss(s);\n ss(t);\n\n bool del = false;\n\n ll n =s.length();\n ll m = t.length();\n\n for(ll i=0, j=0; i=0; //if == 0 means rep needed if > 0 means del needed\n rep = rep && cnt[i]==0;\n }\n\n if(del)\n cout<<\"automaton\";\n else if(rep)\n cout<<\"array\";\n else if(all)\n cout<<\"both\";\n else\n cout<<\"need tree\";\n\n return;\n\n\n\n\n\n\n\n}\n\n\n\nint main()\n{\n\n ll t = 1;\n //sl(t);\n while(t--)\n {\n solve();\n }\n\n return 0;\n}\n\n\n\n\n", "lang": "GNU C++14", "bug_code_uid": "04aa2b1a4adb19ea3b6065e1283a9908", "src_uid": "edb9d51e009a59a340d7d589bb335c14", "apr_id": "223dcb34be4334e1da2b7807155f6eb7", "difficulty": 1400, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.6003594967046135, "equal_cnt": 17, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 7, "fix_ops_cnt": 17, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define ull unsigned long long\n#define ll long long\n#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);\nusing namespace std;\nll dp[1000001][4];\nint fun(int n,int st)\n{\n\tint ans = 0;\n\tif(n == 0 and st == 0)\n\t\treturn 1;\n\telse if(n < 0 )\n\t\treturn 0;\n\tfor (int i = 0; i < 4 and n-1 >= 0; ++i)\n\t{\n\t\tif(i == st)\n\t\t\tcontinue;\n\t\tif(dp[n-1][i] == 0)\n\t\t\tdp[n-1][i] = fun(n-1,i);\n\t\tdp[n][st] += dp[n-1][i];\n\t}\n\treturn dp[n][st]%(1000000000+7);\n}\nint main()\n{\n\tIOS;\n\tll n,k,ans,temp;\n\tcin>>n;\n\ttemp = fun(n,0);\n\tans = dp[n][0];\n\tcout<\nusing namespace std;\nint main()\n{\n int n,m,k =2;\n\n while(1)\n {\n cin>>n>>m;\n for(int i =m; i>0; i--)\n {\n n +=i;\n while(k--)\n {\n int u,v;\n cin>>u>>v;\n n-=u;\n }\n cout<\nusing namespace std;\n\nint main() {\nint p1=0 , p2=0 , s , st ;\ncin>> s;\n s=s/2;\n for(short i=0;i\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n#define mp make_pair\n#define rs resize\n#define sz size\n#define pb push_back\ntypedef long long ll;\n#define ff first.first \n#define fs first.second\n#define sf second.first\n#define ss second.second\n#define mod 1000000007\n#define eps (double)1e-9\ntypedef pair , pair > pairpair;\n\nvector kk;\n\n\nint main()\n{\n#ifdef _DEBUG\n freopen(\"input.txt\", \"r\", stdin);\n freopen(\"output.txt\", \"w\", stdout);\n#endif\n int i, j, n, p, k, m;\n cin >> p >> k; \n kk.push_back(1);\n int kr = 1;\n while (kr * k % p != 1) {\n kk.push_back(kr * k % p);\n kr = kr * k % p;\n }\n\n m = (p - 1) / kk.size();\n\n long long ans = 1; \n for (i = 0; i < m; i++) ans = (ans * p) % 1000000007;\n cout << ans;\n return 0;\n}", "lang": "MS C++", "bug_code_uid": "761bb9edeb6f07e361dd8b01d1145c28", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "apr_id": "576a64287dcecd722a2632f23a504267", "difficulty": 1800, "tags": ["math", "combinatorics", "number theory", "dsu"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.1947565543071161, "equal_cnt": 28, "replace_cnt": 20, "delete_cnt": 6, "insert_cnt": 2, "fix_ops_cnt": 28, "bug_source_code": "#include\n\nusing namespace std;\n\nlong long n;\n\ninline char nextchar();\ninline int read(char type);\ninline void write(int x);\n\nint main()\n{\n n=read('f');\n write(n-n/2-n/3-n/5-n/7+n/6+n/10+n/14+n/15+n/21+n/35-n/30-n/42-n/70-n/105+n/210);\n return 0; \n} \n\ninline char nextchar()\n{\n\tstatic char buf[100000],*p1=buf, *p2=buf;\n\treturn (p1 == p2)&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;\n}\n\ninline long long read(char type)\n{\n\tif(type=='f')\n\t{\n\t\tlong long p=0;\n\t\tchar ch=0;\n\t\tbool sign=false;\n\t\twhile (!isdigit(ch))\n\t\t{\n\t\t\tsign|=(ch=='-');\n\t\t\tch=nextchar();\n\t\t}\n\t\twhile(isdigit(ch))\n\t\t{\n\t\t\tp=p*10+(ch^48);\n\t\t\tch=nextchar();\n\t\t}\n\t\tp=sign?-p:p;\n\t\treturn p;\n\t}\n\telse\n\t{\n\t\tint x=0,f=1;\n\t\tchar ch=getchar();\n\t\twhile(ch<'0'||ch>'9')\n\t\t{\n\t\t\tif(ch=='-')\n\t\t\t{\n\t\t\t\tf=-1;\n\t\t\t}\n\t\t\tch=getchar();\n\t\t}\n\t\twhile(ch>='0'&&ch<='9')\n\t\t{\n\t\t\tx=(x<<1)+(x<<3)+(ch^48);\n\t\t\tch=getchar();\n\t\t}\n\t\treturn x*f;\n\t}\n}\n\ninline void write(int x)\n{\n\tstatic long long stk[100],top=0;\n\tif(x==0)\n\t{\n\t\tputchar('0'); return;\n\t}\n\tif(x<0)\n\t{\n\t\tx=-x;\n\t\tputchar('-');\n\t}\n\twhile(x)\n\t{\n\t\tstk[++top]=x%10;\n\t\tx/=10;\n\t}\n\twhile(top)\n\t{\n\t\tputchar(stk[top--]+'0');\n\t}\n}", "lang": "GNU C++11", "bug_code_uid": "2c083849229a711bc178ef875fb48619", "src_uid": "e392be5411ffccc1df50e65ec1f5c589", "apr_id": "f4992f877cebb16e1391e96421030212", "difficulty": 1500, "tags": ["math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9582132564841499, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "// IN THE NAME OF ALLAH\n#include\n#define pb push_back\n#define X first\n#define Y second\n#define F(i,a,b) for(ll i=(a) ; i<=(b) ; i++)\n#define PI 3.1415926535897932384626433832795\n#define eps 0.000001\nusing namespace std;\ntypedef long long ll;\ntypedef long double ld;\nconst ll M=5e5+100;\n#define 2025 2520\n\nll d=2025,k,t;\nll n;\n\nint main(){\n//freopen(\"input.txt\",\"r\",stdin);\n//freopen(\"output.txt\",\"w\",stdout);\n//cout << setprecision(22) << fixed;\nios::sync_with_stdio(false);\n\ncin>>n;\nF(i,1,2025){\n\tbool mark=false;\n\tF(j,2,10) if(i%j==0) mark=true;\n\tif(!mark) k++;\n}\nF(i,1,n%2025){\n\tbool mark=false;\n\tF(j,2,10) if(i%j==0) mark=true;\n\tif(!mark) t++;\t\n}\ncout<<(n/2025)*k+t;\n\n\nreturn 0; \n}", "lang": "GNU C++11", "bug_code_uid": "3f04cd7595c69941b75962fb8dd89358", "src_uid": "e392be5411ffccc1df50e65ec1f5c589", "apr_id": "634a39e0695e0d9cede85fc4cd8a71af", "difficulty": 1500, "tags": ["math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.0158465387823186, "equal_cnt": 6, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "from math import factorial\n\ndef binomial(n, r):\n return factorial(n) // factorial(r) // factorial(n-r)\n\n\ndef a(n) :\n return binomial(2*n, n) - 1\nx = int(input())\nprint(a(x + 1))", "lang": "GNU C++11", "bug_code_uid": "26c7a844728aeda4c68b53dd0619f843", "src_uid": "a18833c987fd7743e8021196b5dcdd1b", "apr_id": "2b540a20ed14fa4cca71ba7adee78567", "difficulty": 1800, "tags": ["combinatorics", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7148760330578512, "equal_cnt": 24, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 21, "fix_ops_cnt": 23, "bug_source_code": "#include \nusing namespace std;\nint main()\n{\n long long int n , k , t;\n cin>>n>>k>>t;\n bool spec[n]={};\n for(long long int i = 0;i<=t-1;++i)\n {\n if(i<=k-1){\n spec[i]=true;\n }\n else if(i>k-1 && i<=n-1)\n {\n spec[i-k]=false;\n spec[i]=true;\n }\n else if(i>n-1)\n {\n spec[i-k]=false;\n }\n }\n long long int ans = 0;\n for(long long int i = 0 ; i<=n-1;++i)\n {\n if(spec[i])++ans;\n }\n cout<\n#include \n#include \n#include \n\n#define N 1000 * 100 + 5\nusing namespace std;\n\nint mask(int x)\n{\n\tchar s[N];\n\tchar * ans = new char[N];\n\tmemset(ans, 0, N);\n\tint ai = 0;\n\tsnprintf(s, N, \"%d\", x);\n\tfor (int i = 0; i < strlen(s); ++i)\n\t{\n\t\tif(s[i] == '4' || s[i] == '7')\n\t\t\tans[ai++] = s[i];\n\t}\n\treturn atoi(ans);\n}\n\nint main(){\n\n\tint a, b;\n\tcin >> a >> b;\n\ta++;\n\twhile(mask(a) != b)\n\t\ta++;\n\tcout << a;\n}\n", "lang": "GNU C++", "bug_code_uid": "24b53218bbbc3f047c468fa5a5a606ba", "src_uid": "e5e4ea7a5bf785e059e10407b25d73fb", "apr_id": "ea4f379ae4da1244ecb2372c72b3014a", "difficulty": 1300, "tags": ["brute force", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9948622139187295, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include \n#include \n#include \n\nusing namespace std;\n\nint check(int a,int b)\n{\n int c[50];\n int count =0;\n while(a>0)\n {\n if(a%10 == 4 || a%10==7)\n {\n c[count]=a%10;\n count++;\n }\n a=a/10;\n }\n int num=0;\n int mul=1;\n// cout<<\"palash\"<=0;i--)\n {\n num=num*mul;\n num+=c[i]; \n mul*=10;\n }\n\n if(num == b)\n return 1;\n else return 0;\n}\n\n\n\nint main()\n{\n long long int a,b;\n cin>>a>>b;\n\n if(b>a)\n {\n cout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\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 1e9\n#define eps 1e-9\n#define PI 3.14159265358979323846264338327950\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 show(x) cerr<<#x<<\" = \"< vi;\ntypedef vector vd;\ntypedef vector vs;\ntypedef pair pi;\ntypedef vector vpi;\n\nint dx[] = { 0, 0, 1, -1 };\nint dy[] = { 1, -1, 0, 0 };\n\ninline int cnt(ll n) {\n\tint res = 0;\n\twhile (n)\n\t\tres++, n /= 10;\n\treturn res;\n}\n\nint main() {\n#ifndef ONLINE_JUDGE\n\tfreopen(\"test.in\", \"rt\", stdin);\n//\t\tfreopen(\"o.txt\", \"wt\", stdout);\n#endif\n\tll w, m, k, res = 0, c = 0;\n\tcin >> w >> m >> k;\n\twhile (res + k * cnt(m) <= w) {\n\t\twhile (cnt(m) == cnt(m + 100000) && res + k * 100000 * cnt(m) <= w) {\n\t\t\tm += 100000;\n\t\t\tc += 100000;\n\t\t\tres += k * 100000 * cnt(m);\n\t\t}\n\t\tif (res + k * cnt(m) <= w) {\n\t\t\tres += k * cnt(m);\n\t\t\tm++;\n\t\t\tc++;\n\t\t}\n\t}\n\tcout << c << endl;\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "e59bc084f6b2c95977ae500594d8da74", "src_uid": "8ef8a09e33d38a2d7f023316bc38b6ea", "apr_id": "0ffe42e71c9c6afdfd064489f02c31f7", "difficulty": 1600, "tags": ["math", "implementation", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.25146886016451236, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "#include \nusing namespace std;\nlong long n, i, v[105], nr, sol, k, bun;\nint main()\n{\n cin>>n;\n k=1; v[k]=-1;\n while(k)\n if(v[k]\n#include \n#include \n#include \nusing namespace std;\nint main()\n{\n\tint n,a[100],m=-1;\n\tcin>>n;\n\tfor(int i=1;i<=n;i++)\n\t{\n\t\tcin>>a[i];\n\t\tm=max(m,a[i]);\n\t}\n\tcout<<(a[n]|m)<\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\nconst int MAXN=55;\nconst int Mod=1000000007;\nconst int Inv=500000004;\ninline void add(int &x,int y)\n{\n if((x+=y)>=Mod)x-=Mod;\n}\nint d[MAXN],cnt[MAXN][MAXN],dp[2][MAXN][MAXN][MAXN*3];\nint main()\n{\n for(int i=0;i0)\n {\n if(d[i]==2)\n {\n //right 0\n if(j>0)add(dp[now][j-1][k][l-1],1LL*j*dp[la][j][k][l]%Mod);\n if(k>0)add(dp[now][j+1][k-1][l-1],1LL*k*dp[la][j][k][l]%Mod);\n //right 1\n add(dp[now][j+1][k][l-1],dp[la][j][k][l]);\n }\n else\n {\n //right 0\n if(j>1)add(dp[now][j-2][k][l-1],1LL*j*(j-1)/2*dp[la][j][k][l]%Mod);\n if(k>1)add(dp[now][j+2][k-2][l-1],1LL*k*(k-1)/2*dp[la][j][k][l]%Mod);\n if(j>0 && k>0)add(dp[now][j][k-1][l-1],1LL*j*k*dp[la][j][k][l]%Mod);\n //right 1\n if(j>0)add(dp[now][j][k][l-1],1LL*j*dp[la][j][k][l]%Mod);\n if(k>0)add(dp[now][j+2][k-1][l-1],1LL*k*dp[la][j][k][l]%Mod);\n //right 2\n add(dp[now][j][k+1][l-1],dp[la][j][k][l]);\n }\n }\n else\n {\n if(j>0)add(dp[la][d[i]==2][d[i]==3][j+2*k-1],1LL*j*cnt[j-1][k]%Mod*dp[la][j][k][l]%Mod);\n if(k>0)add(dp[la][d[i]==2][d[i]==3][j+2*k-1],1LL*k*cnt[j+1][k-1]%Mod*dp[la][j][k][l]%Mod);\n }\n }\n }\n return 0*printf(\"%d\",dp[now][0][0][0]);", "lang": "GNU C++11", "bug_code_uid": "83eacf6f6a97675a8f1a0e79b57fb342", "src_uid": "db884d679d9cfb1dc4bc511f83beedda", "apr_id": "081dc9362d32aa2c7e0defcf80011101", "difficulty": 2600, "tags": ["graphs", "dp", "combinatorics", "shortest paths"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.991304347826087, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include \n#include\n#include \n#include\n#include\n#include\nusing namespace std;\n#define fi first\n#define se second\n#define p_b push_back\n#define all(n) n.begin(),n.end()\n#define rall(n) n.rbegin(),n.rend()\n#define mk_p make_pair\n#define pr_setp(n)cout<>number;\n\tll x = number;\n\tll ans = -1;\n\tint tmp = 0;\n\tmapf;\n\tfor(int i =2;i<=sqrt(number);++i)\n\t{\n\t\twhile(!(number%i))\n\t\t{\n\t\t\tf[i]++;\n\t\t\tnumber/=i;\n\t\t}\n\t}\n\tif(number>1)f[number]++;\n\tcout<<(f.size()>1?1:(*f.begin()).fi)<\n\nconst int md = 1000000007;\nusing namespace std;\n\nint solve(int a, int b){\n\n queue < pair, int> > q; q.push({{a, b}, 0});\n while(q.size() > 0){\n pair, int> node = q.front(); q.pop();\n\n if(node.first.first == node.first.second)\n return node.second;\n int x = node.first.first;\n int y = node.first.second;\n\n if(x % 2 == 0)\n q.push({{x / 2, y}, node.second + 1});\n if(x % 3 == 0)\n q.push({{x / 3, y}, node.second + 1});\n if(x % 5 == 0)\n q.push({{x / 5, y}, node.second + 1});\n \n if(y % 2 == 0)\n q.push({{x, y / 2}, node.second + 1});\n if(y % 3 == 0)\n q.push({{x, y / 3}, node.second + 1});\n if(y % 5 == 0)\n q.push({{x, y / 5}, node.second + 1});\n\n }\n return -1;\n}\n\nint main(){\n int x, y; scanf(\"%d %d\\n\", &x, &y);\n cout << solve(x, y) << endl;\n return 0;\n\n}", "lang": "GNU C++11", "bug_code_uid": "b64309d9029b42478a23886b5eba8679", "src_uid": "75a97f4d85d50ea0e1af0d46f7565b49", "apr_id": "42dedf1087a1c40835b3d3263b9b855d", "difficulty": 1300, "tags": ["math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9790051679586563, "equal_cnt": 8, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 7, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n#define PI 3.14159265\n#define MAX 1005\n\ndouble calculateAngle(vector x, vector y) {\n\n double tu = x[0]*y[0] + x[1]*y[1] + x[2]*y[2] + x[3]*y[3] + x[4]*y[4];\n\n double ab_lenght = sqrt(x[0]*x[0] + x[1]*x[1] + x[2]*x[2] + x[3]*x[3] + x[4]*x[4]);\n double ac_lenght = sqrt(y[0]*y[0] + y[1]*y[1] + y[2]*y[2] + y[3]*y[3] + y[4]*y[4]);\n\n double result = (tu*1.0)/(ab_lenght*ac_lenght);\n\n double angle = acos(result) * 180.0 / PI;\n\n return angle;\n}\n\nint main() {\n\n#ifndef ONLINE_JUDGE\n freopen(\"/Users/TamLe/Documents/Input.txt\", \"rt\", stdin);\n#endif\n\n int n;\n cin>>n;\n\n vector v[MAX];\n\n int a, b, c, d, e;\n\n for (int i = 0; i < n; ++i) {\n cin>>a>>b>>c>>d>>e;\n v[i].push_back(a);\n v[i].push_back(b);\n v[i].push_back(c);\n v[i].push_back(d);\n v[i].push_back(e);\n\n }\n\n if (n == 1) {\n cout<<1< res;\n\n vector ab, ac, ba, bc, ca, cb;\n\n for (int i = 0; i < n; ++i) {\n\n bool flag = true;\n\n for (int k = 0; k < n; ++k) {\n\n if (k == i) {\n continue;\n }\n\n for (int t = 0; t < n; ++t) {\n\n if (k == t || t == i) {\n continue;\n }\n\n ab.clear();\n ac.clear();\n\n ab.push_back(v[k][0] - v[i][0]);\n ab.push_back(v[k][1] - v[i][1]);\n ab.push_back(v[k][2] - v[i][2]);\n ab.push_back(v[k][3] - v[i][3]);\n ab.push_back(v[k][4] - v[i][4]);\n\n ac.push_back(v[t][0] - v[i][0]);\n ac.push_back(v[t][1] - v[i][1]);\n ac.push_back(v[t][2] - v[i][2]);\n ac.push_back(v[t][3] - v[i][3]);\n ac.push_back(v[t][4] - v[i][4]);\n\n\n if (calculateAngle(ab, ac) < 90) {\n flag = false;\n }\n\n }\n }\n\n if (flag) {\n res.push_back(i + 1);\n break;\n }\n }\n\n\n cout<>s;\n//\n// for(int i = 0; i < s.length(); ++i) {\n// int index = s[i];\n// A[index] = true;\n// }\n//\n// string b, temp;\n// cin>>b;\n//\n// int n;\n// cin>>n;\n//\n// int left = -1, right = -1;\n//\n// for(int i = 0; i < n; ++i) {\n// cin>>temp;\n//\n// for(int k = 0; k < temp.length(); ++k) {\n//\n// if (k >= b.length()) {\n// cout<<\"NO\"<= 0) {\n//\n// if (b[x] != '?') {\n// if (b[x] != temp[y]) {\n// cout<<\"NO\"<> t >> l >> r;\n// long long ans = 0;\n// long long pro = 1;\n// for(int i = l; i <= r; i++) {\n// f[i] %= mod;\n// ans = 1LL * ans + 1LL * pro * f[i];\n// pro *= 1LL * t;\n// pro %= mod;\n// ans %= mod;\n// }\n// cout << ans << endl;\n// return 0;\n//}\n\n//int main() {\n//#ifndef ONLINE_JUDGE\n// freopen(\"/Users/TamLe/Documents/Input.txt\", \"rt\", stdin);\n//#endif\n//\n// unordered_set comp;\n//\n// int n, sum, temp;\n// scanf(\"%d %d\", &n, &sum);\n//\n// for(int i = 0; i < n; ++i) {\n// scanf(\"%d\", &temp);\n// if (comp.find(temp) != comp.end()) {\n// printf(\"Yes\");\n// return 0;\n// }\n// comp.insert(sum-temp);\n// }\n//\n// printf(\"No\");\n// return 0;\n//}\n", "lang": "GNU C++11", "bug_code_uid": "2c9496853ac2b717c785ac6dfa02af17", "src_uid": "c1cfe1f67217afd4c3c30a6327e0add9", "apr_id": "8b5e60fe678711f9714b636ce8ad95ef", "difficulty": 1700, "tags": ["geometry", "math", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.3433578025100639, "equal_cnt": 25, "replace_cnt": 19, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 25, "bug_source_code": "#include \n#include \n#include \nusing namespace std;\ninline char nc() {\n//\treturn getchar();\n\tstatic char buf[100000], *l = buf, *r = buf;\n\treturn l==r&&(r=(l=buf)+fread(buf,1,100000,stdin),l==r)?EOF:*l++;\n}\ntemplate void read(T &x) {\n\tx = 0; int f = 1, ch = nc();\n\twhile(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=nc();}\n\twhile(ch>='0'&&ch<='9'){x=x*10-'0'+ch;ch=nc();}\n\tx *= f;\n}\n#define inv(a) power(a, mod - 2)\ntypedef long long ll;\nconst int mod = 1e9 + 7;\nconst int maxm = 100000 + 5;\nconst int maxp = 400;\nint m, p;\nint id[maxm], ver[maxp];\nint mark[maxm], mu[maxm];\nll f[maxm], g[maxm][maxp];\nvector prime; \nvector rec[maxm];\nll power(ll x, ll y) {\n\tll re = 1;\n\twhile(y) {\n\t\tif(y & 1) re = re * x % mod;\n\t\tx = x * x % mod;\n\t\ty >>= 1;\n\t}\n\treturn re;\n}\nvoid init(int n) {\n\tmark[1] = 1, mu[1] = 1;\n\tfor(int i = 2; i <= n; ++i) {\n\t\tif(!mark[i]) {\n\t\t\tprime.push_back(i);\n\t\t\tmu[i] = -1;\n\t\t}\n\t\tfor(unsigned int j = 0; j < prime.size(); ++j) {\n\t\t\tint x = i * prime[j]; if(x > n) continue;\n\t\t\tmark[x] = 1;\n\t\t\tif(i % prime[j]) {\n\t\t\t\tmu[x] = 0;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tmu[x] = -mu[x];\n\t\t}\n\t}\n}\nint main() {\n\tread(m);\n\tinit(m);\n\tfor(int i = 1; i <= m; ++i) rec[i].clear();\n\tfor(int i = 1; i <= m; ++i) {\n\t\tfor(int j = i; j <= m; j += i) {\n\t\t\trec[j].push_back(i);\n\t\t}\n\t}\n\tfor(int i = 1; i <= m; ++i) {\n\t\tif(!id[m / i]) id[m / i] = ++p, ver[p] = m / i;\n\t}\n\tfor(int i = 1; i <= m; ++i) {\n\t\tfor(unsigned int j = 0; j < rec[i].size(); ++j) {\n\t\t\tint x = rec[i][j];\n\t\t\tfor(int k = 1; k <= p; ++k) {\n\t\t\t\tg[i][k] = (g[i][k] + mu[x] * (ver[k] / x)) % mod;\n\t\t\t}\n\t\t}\n\t} \n\tll r = inv(m);\n\tfor(int i = 2; i <= m; ++i) {\n\t\tfor(unsigned int j = 0; j < rec[i].size(); ++j) {\n\t\t\tint x = rec[i][j]; if(x == i) continue;\n\t\t\tf[i] = (f[i] + f[x] * g[i / x][id[m / x]] % mod) % mod; \n\t\t}\n\t\tf[i] = (f[i] * r + 1) % mod * inv(1 - g[1][id[m / i]] * r % mod) % mod;\n\t}\n\tll an = 0;\n\tfor(int i = 1; i <= m; ++i) {\n\t\tan = (an + f[i]) % mod;\n\t}\n\tan = (an * r + 1) % mod;\n\tcout << (an + mod) % mod << endl;\n\treturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "ced9fa5182fe324a99c02a956e6cae51", "src_uid": "ff810b16b6f41d57c1c8241ad960cba0", "apr_id": "c4fb7eced278e9efa237c5bda98dae3f", "difficulty": 2300, "tags": ["dp", "math", "probabilities", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.24693877551020407, "equal_cnt": 23, "replace_cnt": 14, "delete_cnt": 5, "insert_cnt": 3, "fix_ops_cnt": 22, "bug_source_code": "#include \nusing namespace std;\nint main() \n{\n int n, cnt=0;\n cin \u00bb n;\n vector a(n);\n for (int i=0; i\n\nusing namespace std;\n\nint main()\n{\n int n;\n cin >> n;\n int dp[n + 1];\n for (int i = 0; i <= n; i++)\n {\n if (i == 0)\n {\n dp[0] = 1;\n continue;\n }\n if (i & 1)\n {\n dp[i] = 0;\n }\n else\n {\n dp[i] = dp[i - 2] * 2;\n }\n }\n cout << dp[n];\n delete[] dp;\n}", "lang": "GNU C++17", "bug_code_uid": "7f7af408055db05b468c5f76fb2b042d", "src_uid": "4b7ff467ed5907e32fd529fb39b708db", "apr_id": "dae7a948ac94cbdf982d50296cd84e9a", "difficulty": 1000, "tags": ["dp", "math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9887302779864763, "equal_cnt": 7, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "// User: el_heffeh\n// Date: 7/1/20\n\n#include \n\nusing namespace std;\n\nlong long n, M, cnt, diff, in, sum = 0, q, r;\n\nlong long tm[107];\n\nvector ans;\n\nvoid solve() {\n\tcin >> n >> M;\n\tfor (long long i = 0; i < n; ++i) {\n\t\tcin >> in; sum += in, diff = sum - M, cnt = 0;\n\t\tif (diff > 0) {\n\t\t\tfor (long long j = 100; j > 0; --j) {\n\t\t\t\tif (diff > 0) {\n\t\t\t\t\tif (tm[j] > 0) {\n\t\t\t\t\t\tq = diff / j, r = diff % j;\n\t\t\t\t\t\tif (q >= tm[j]) {\n\t\t\t\t\t\t\tdiff -= tm[j] * j;\n\t\t\t\t\t\t\tcnt += tm[j];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (r) {\n\t\t\t\t\t\t\t\tq++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdiff -= j * q;\n\t\t\t\t\t\t\tcnt += q;\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\ttm[in]++;\n\t\tans.push_back(cnt);\n\t}\n\tlong long ind = 1;\n\tfor (long long i: ans) {\n\t\tcout << i;\n\t\tif (ind != ans.size()) {\n\t\t\tcout << ' ';\n\t\t}\n\t\tind++;\n\t}\n\tcout << endl;\n}\n\nint main() {\n\tios::sync_with_stdio(0);\n\tcin.tie(0);\n\tcout.tie(0); \n //freopen(\"input.txt\", \"r\", stdin);\n\tsolve();\n\treturn 0;\n}\n\n/* \n\tWhen writing code, be sure to look out for:\n \t* Array out of bounds access\n \t* Integer overflow\n \t* Variable scopes and names\n \t* Be proactive and make sure to completely think a whole problem through before writing any code\n \tCoding is a fun activity, and it should be treated that way. Don't get mad over some failed test cases or time limit exceeded verdicts. Keep your cool and stay calm!\n*/\n", "lang": "GNU C++11", "bug_code_uid": "0a8c2e1aef9a95523152c9912c53f39b", "src_uid": "d3c1dc3ed7af2b51b4c49c9b5052c346", "apr_id": "26ec0bef61de8e69b2fbe9dc7bc27cdb", "difficulty": 1200, "tags": ["greedy", "sortings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.6271186440677966, "equal_cnt": 12, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 11, "bug_source_code": "#include \nusing namespace std;\nint main(){\nlong long int x;\n cin>>x;\nif(x==1){\ncout<<1;\n}else{\n\ncout<<(x/2)+1\n}\n}\n\nreturn 0;\n}", "lang": "GNU C++17", "bug_code_uid": "885a0dfc01163e60deab26ed5ce6825d", "src_uid": "5551742f6ab39fdac3930d866f439e3e", "apr_id": "70e16b53d8f8b8ac2bd0d8c334102964", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.36999748301031965, "equal_cnt": 22, "replace_cnt": 12, "delete_cnt": 3, "insert_cnt": 6, "fix_ops_cnt": 21, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n#define ri(X) scanf(\"%d\", &(X))\n#define pi(X) printf(\"%d\", (X))\n#define mp(X,Y) make_pair(X,Y)\n#define pb(X) push_back(X)\n#define lint long long\n#define pii pair\n#define inf 1e9\n#define linf 1e18\n#define X first\n#define Y second\n#define all(X) (X).begin(),(X).end()\n#define uni(X) X.erase(unique(X.begin(), X.end()), X.end());\n\nlint m, h1, xx1, yy1, a1, h2, x2, y2, a2;\nlint a[20000005], b[20000005];\n\nint main(){\n cin >> m;\n cin >> h1 >> a1;\n cin >> xx1 >> yy1;\n cin >> h2 >> a2;\n cin >> x2 >> y2;\n \n a[0] = h1;\n b[0] = h2;\n for (int i = 1; i < 20000005; i++) {\n a[i] = (a[i-1] * xx1 + yy1) % m;\n b[i] = (b[i-1] * x2 + y2) % m;\n }\n \n int t = 0;\n for (int i = 0; i < 20000005; i++) {\n if (a[i] == a1 && b[i] == a2) break;\n t++;\n }\n \n if (t == 20000005) cout << -1 << endl;\n else cout << t << endl;\n \n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "75e018f716e57da2a838c2af54335a1c", "src_uid": "7225266f663699ff7e16b726cadfe9ee", "apr_id": "66a291772666d1c65bb1815455fb1dde", "difficulty": 2200, "tags": ["greedy", "math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.06382978723404255, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "#include \n#include \n#include \nusing namespace std;\nvector> v1;\nint main() {\n long long la,ra,ta,lb,rb,tb;\n cin>>la>>ra>>ta;\n cin>>lb>>rb>>tb;\n long long ans = max(ra-la+1,rb-lb+1);\n if(lalb){\n while(la>lb){\n lb+=tb;\n rb+=tb;\n }\n lb-=tb;\n rb-=tb;\n long long hold = 10000000;\n while(hold-- && la<1000000000){\n v1.push_back(make_pair(la,ra));\n la+=ta;\n ra+=ta;\n }\n hold = 10000000;\n while(hold-- && lb<1000000000){\n v1.push_back(make_pair(lb,rb));\n lb+=tb;\n rb+=tb;\n }\n \n }else{\n long long hold = 10000000;\n while(hold-- && la<1000000000){\n v1.push_back(make_pair(la,ra));\n la+=ta;\n ra+=ta;\n }\n hold = 10000000;\n while(hold-- && lb<1000000000){\n v1.push_back(make_pair(lb,rb));\n lb+=tb;\n rb+=tb;\n }\n }\n sort(v1.begin(),v1.end());\n \n long long maxoverlap = 0;\n auto left = v1[0];\n for(long long i=1;imaxoverlap){\n maxoverlap = overlap;\n \n }\n if(v1[i].second>left.second){\n left = v1[i];\n }\n }\n std::cout<\nusing namespace std;\nint main() {\n int n,k;cin>>n>>k;\n vector v;\n int i;\n for( i=0;i<=n;i+=k){\n v.push_back(i);\n }\n v.push_back(i);\n cout<\nusing namespace std;\n\nint main()\n{\n int h1,h2,m1,m2;\n scanf(\"%d:%d\",h1,m1);\n scanf(\"%d:%d\",h2,m2);\n int t1,t2;\n t1=h1*60+m1;\n t2=h2*60+m2;\n int ans=t2-t1;\n if(ans>=60)\n {\n int r=ans/60;\n ans=ans%60;\n h1=h1+r;\n }\n m1=m1+ans;\n cout<\n#include \nusing namespace std;\nint l[4002];\nint posl(string s){\n l[0]=-1;\n for(int k=1;k=0&&s[j+1]!=s[k]) {\n j=l[j];\n }\n //cout<>a>>b;\n string news;\n news=b+b+'$'+a+a;\n int k=posl(a);\n int per=-1;\n if(2*k>=a.size())\n per=(int)a.size()-k;\n int pp=posl(news);\n pp=2*(int)a.size()-pp;\n if(pp>=a.size()){\n cout<<\"0\"< pa;\n int l=pp;\n pa.push_back(l);\n l+=per;\n while (l>k;\n int c[1001][k+1];\n int sum=1;\n c[0][0]=1;\n for(int j=1;j\nusing namespace std;\nint main(){\n int n;\n cin>>n;\n string s;\n cin>>s;\n int temp=0;\n int maxx=0;\n int x=0;\n for(int i=0; i0&&s[i-1]!=')'&&s[i-1]!=')'&&s[i-1]!='_'){\n maxx=max(temp,maxx);\n temp=0;\n }\n i++;\n while(s[i]!=')'){\n if(s[i]=='_'&&s[i-1]!='('&&s[i-1]!='_'){\n x++;\n }\n i++;\n if(s[i]==')'){\n if(s[i-1]!='('&&s[i-1]!='_'){\n x++;\n }\n }\n }\n }\n else if(s[i]=='_'){\n maxx=max(maxx,temp);\n temp=0;\n }\n else{\n temp++;\n }\n }\n cout<\n#include \n#include \n#include \nusing namespace std;\n\ntypedef long long s64;\n\nconst int MaxNPoss = 2944370;\n\ntemplate \ninline void tension(T &a, const T &b)\n{\n\tif (b < a)\n\t\ta = b;\n}\n\nint l, r, p;\n\nint nP = 0;\nint prime[25];\n\ninline bool isPrime(const int &num)\n{\n\tfor (int i = 0; i < nP && prime[i] * prime[i] <= num; i++)\n\t\tif (num % prime[i] == 0)\n\t\t\treturn false;\n\treturn true;\n}\n\nint nPoss = 0;\nint poss[MaxNPoss];\ninline void dfs(int num, int v)\n{\n\tif (v == nP)\n\t{\n\t\tposs[nPoss++] = num;\n\t\treturn;\n\t}\n\n\tdfs(num, v + 1);\n\twhile ((s64)num * prime[v] <= r)\n\t{\n\t\tnum *= prime[v];\n\t\tdfs(num, v + 1);\n\t}\n}\n\nint main()\n{\n\tcin >> l >> r >> p;\n\n\tfor (int i = 2; i <= p; i++)\n\t\tif (isPrime(i))\n\t\t\tprime[nP++] = i;\n\n\tdfs(1ll, 0);\n\n\tsort(poss, poss + nPoss);\n\t\n\tstatic bool ok[MaxNPoss];\n\tstatic int f[MaxNPoss];\n\tfill(f, f + nPoss, INT_MAX);\n\tf[0] = 0, ok[0] = true;\n\tfor (int b = 2; b <= p; b++)\n\t{\n\t\tfor (int i = 0, j = 0; i < nPoss; i++)\n\t\t{\n\t\t\tif (f[i] == INT_MAX)\n\t\t\t\tcontinue;\n\t\t\tif (f[i] + b <= p)\n\t\t\t\tok[i] = true;\n\n\t\t\twhile (j < nPoss && poss[j] < (s64)poss[i] * b)\n\t\t\t\tj++;\n\t\t\tif (j < nPoss && poss[j] == (s64)poss[i] * b)\n\t\t\t\ttension(f[j], f[i] + 1);\n\t\t}\n\t}\n\n\tint res = 0;\n\tfor (int i = 0; i < nPoss; i++)\n\t\tif (l <= poss[i] && poss[i] <= r && ok[i])\n\t\t\tres++;\n\tcout << res << endl;\n\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "6ee7b0b219486945f8b0ba0891e313fd", "src_uid": "6d898638531e4713774bbd5d47e827bf", "apr_id": "b82218f1eaee9c4c0b133c0f98aee291", "difficulty": 2800, "tags": ["dp", "brute force", "two pointers"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9905956112852664, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "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 \n#include\nusing namespace std;\n\n\nint main()\n{\n int b,r,n;\n cin>>b>>r>>n;\n int minb=0,maxg;\n if(b>=n)\n minb=0;\n else\n minb=(n-b);\n \n if(r>n)\n maxg=n;\n else\n maxg=r;\n \n return maxg-minb+1;\n return 0;\n}", "lang": "GNU C++14", "bug_code_uid": "650a4be1ca952525f32e3eb34663b7aa", "src_uid": "9266a69e767df299569986151852e7b1", "apr_id": "80cb62c19d06b10decd5102af825bbdf", "difficulty": 1100, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.6681922196796338, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "/*\n0392A. Blocked Points\n*/\n\n#include\nusing namespace std;\n\nint main(){\n long int n;\n cin >> n;\n if(n == 0){cout << 1;}\n else(cout << (n/3)*16+(n%3)*4;)\n}", "lang": "GNU C++17", "bug_code_uid": "13eeaa2cef9536d123af0fba62c51ffe", "src_uid": "d87ce09acb8401e910ca6ef3529566f4", "apr_id": "085c9a12bdfc75a87f3889a95d11e312", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.007641921397379912, "equal_cnt": 5, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.27428.2027\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"HW2C\", \"HW2C\\HW2C.vcxproj\", \"{095A0D88-9AFA-4F39-B1C6-4F7BAC8B949D}\"\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{095A0D88-9AFA-4F39-B1C6-4F7BAC8B949D}.Debug|x64.ActiveCfg = Debug|x64\n\t\t{095A0D88-9AFA-4F39-B1C6-4F7BAC8B949D}.Debug|x64.Build.0 = Debug|x64\n\t\t{095A0D88-9AFA-4F39-B1C6-4F7BAC8B949D}.Debug|x86.ActiveCfg = Debug|Win32\n\t\t{095A0D88-9AFA-4F39-B1C6-4F7BAC8B949D}.Debug|x86.Build.0 = Debug|Win32\n\t\t{095A0D88-9AFA-4F39-B1C6-4F7BAC8B949D}.Release|x64.ActiveCfg = Release|x64\n\t\t{095A0D88-9AFA-4F39-B1C6-4F7BAC8B949D}.Release|x64.Build.0 = Release|x64\n\t\t{095A0D88-9AFA-4F39-B1C6-4F7BAC8B949D}.Release|x86.ActiveCfg = Release|Win32\n\t\t{095A0D88-9AFA-4F39-B1C6-4F7BAC8B949D}.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 = {B2E201E0-17EF-4701-B443-0A0F96FCBD1E}\n\tEndGlobalSection\nEndGlobal\n", "lang": "GNU C++17", "bug_code_uid": "d98368b1f208d9c6fb3e1ec2ce558be9", "src_uid": "d87ce09acb8401e910ca6ef3529566f4", "apr_id": "efaf078157e1cc51c0bd7ea67f6d2e10", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9707939119703826, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "#include \"library.h\" \n\nlong long mod = (1LL<<32);\n\ntemplate \nT extGcd(T a, T b, T& x, T& y) {\n\tif (b == 0) {\n\t\tx = 1;\n\t\ty = 0;\n\t\treturn a;\n\t}\n\telse {\n\t\tint g = extGcd(b, a % b, y, x);\n\t\ty -= a / b * x;\n\t\treturn g;\n\t}\n}\n\ntemplate \nT modInv(T a, T m) {\n\tT x, y;\n\textGcd(a, m, x, y);\n\treturn ( (x % m) + m) % m;\n}\n\nunsigned C[150];\nint n,p,q;\nvoid solve() {\n\tscanf(\"%d %d %d\", &n, &p, &q);\n\tp = min(p,n-1);\n\n\tfor (int pp = 0; pp <= p; pp++) {\n\t\tC[pp]=1;\n\t\tint tw = 0;\n\t\tfor (int i = n; i > n-pp; i--) {\n\t\t\tint ti = i;\n\t\t\twhile (ti % 2 == 0) {\n\t\t\t\tti /= 2;\n\t\t\t\ttw++;\n\t\t\t}\n\t\t\tC[pp] = (C[pp] * 1ll * ti) % mod;\n\t\t}\n\t\tfor (int i = 1; i <= pp; i++ ) {\n\t\t\tint ti = i;\n\t\t\twhile (ti % 2 == 0) {\n\t\t\t\tti /= 2;\n\t\t\t\ttw--;\n\t\t\t}\n\t\t\tC[pp] = (C[pp] * 1ll * modInv((long long)ti, (long long)mod)) % mod;\n\t\t}\n\t\tfor (int i = 0; i < tw; i++) C[pp] = (C[pp] * 2) % mod;\n\t\t//printf(\"C[%d] = %lld\\n\", pp, C[pp]);\n\t}\n\n\tunsigned ans = 0;\n\t\n\tfor (int i = 1; i <= q; i++) {\n\t\tunsigned curr = 0;\n\n\t\t// sum x=0..p q^x * C(n,x)\n\t\tunsigned pot = 1;\n\t\tfor (int pp = 0; pp <= p; pp++) {\n\t\t\tcurr = (curr + pot * C[pp]) % mod;\n\t\t\tpot = pot * i;\n\t\t}\n\n\t\tans ^= (i * curr);\n\t}\n\n\tprintf(\"%u\\n\", ans);\n\n\t\n}\n\n", "lang": "GNU C++11", "bug_code_uid": "f35bd9dd797e5a34682eb2a728b9f39f", "src_uid": "28cf4ff955d089318ea08d17bc4f43da", "apr_id": "3d4d77988d3c60fa980fb45d97d601bd", "difficulty": 2900, "tags": ["dp", "meet-in-the-middle", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9334726576105886, "equal_cnt": 17, "replace_cnt": 9, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 16, "bug_source_code": "#include\nusing namespace std;\n#define mp make_pair\n#define pb push_back\n#define F first\n#define S second\n \n#define ler freopen(\"inspection.in\",\"r\",stdin);freopen(\"inspection.out\",\"w\",stdout)\n#define fastio ios::sync_with_stdio(0), cin.tie(0)\n#define rep(i,a,b) for(int i=a; i \n#define ll long long\n#define ld long double\n#define vi vector \n#define pii pair \n \n#define MAXN 3330\n#define INF 1e18L\n\nll f, T, t0, a1, t1, p1, a2, t2, p2;\n\nll ok(ll &mid, ll &tempo, ll &falta){ return min(falta, mid*a2)*t2 + t0*max(0LL, falta-mid*a2) <= tempo;}\n\nll solve(ll &tempo, ll &falta){\n\tif(falta*t0 <= tempo) return 0;\n\tll bot=0, top=falta, mid;\n\twhile(top-bot>1){\n\t\tmid=(top+bot)>>1;\n\t\tif(ok(mid, tempo, falta)) top= mid;\n\t\telse bot= mid;\n\t}\n\tif(ok(bot, tempo, falta)) top=bot;\n\tif(!ok(top, tempo, falta)) return -1;\n\treturn top*p2;\n}\n\nint main(){\n\tfastio;\n\tcin >> f >> T >> t0;\n\tcin >> \ta1 >> t1 >> p1;\n\tcin >> a2 >> t2 >> p2;\n\t\n\tll ans=INF, x;\n\tfor(ll i=0; i<=INF; ++i){\n\t\tif(min(f, i*a1)*t1 > T) break;\n\t\t\n\t\tx= solve(max(0LL,T-i*a1*t1), max(0LL,f-i*a1));\n\t\tif(x!=-1) ans= min(ans, i*p1 + x);\n\t\t\n\t\tif((i-1)*a1 > f) break;\n\t}\n\tif(ans==INF) ans=-1;\n\tcout << ans << endl;\n}\n\n\n\n\n\n\n\n\n\n\n", "lang": "GNU C++14", "bug_code_uid": "66f1e5412d29dbffe391a73681d2343b", "src_uid": "f5f85e75af5b0f25f1f436a21e12fad1", "apr_id": "a055945f6f8a87935e74f0d20c68a1f2", "difficulty": 2300, "tags": ["implementation", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7010752688172043, "equal_cnt": 13, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 8, "fix_ops_cnt": 13, "bug_source_code": "#include\n#include\n#include\n#include\nusing namespace std;\nint main()\n{\n string players;\n vector pos;\n cin >> players;\n if (players.size() < 7){\n cout << \"NO\" << endl;\n \n return 0;\n }\n else{\n for (int i = 1; i < players.size(); i++)\n {\n if (players[i - 1] == '0' &&players[i] == '0'){\n pos.push_back(i);\n }\n else if (players[i - 1] == '1' && players[i] == '1'){\n pos.push_back(i);\n }\n }\n sort(pos.begin(), pos.end());\n\n if (pos.back() >= 7)\n cout << \"YES\" << endl;\n else\n cout << \"NO\" << endl;\n \n return 0;\n }\n}", "lang": "GNU C++", "bug_code_uid": "c304d718ea0395b01a83a1e6325e4345", "src_uid": "ed9a763362abc6ed40356731f1036b38", "apr_id": "370ac95f1566f35835f20efe7a45e7da", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9942590599210621, "equal_cnt": 7, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 6, "bug_source_code": "//#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n\nusing namespace std;\n\n#define sf scanf\n#define pf printf\n#define fs first\n#define se second\n#define pb push_back\n#define ins insert\n#define Lb lower_bound\n#define Up upper_bound\n#define INF 0x7F7F7F7F\n#define mem(a,b) memset(a, b, sizeof(a))\n#define MAX 100010\n#define MAXR 100010\n#define MAXC 100010\n\ntypedef long long ll;\n\nconst double PI = 2.0 * acos(0.0);\nconst double eps = 1e-9;\n\ntemplate < class T > T Abs(T x) { return x > 0 ? x : -x; }\ntemplate < class T > string toString(T n) { ostringstream ost; ost << n; ost.flush() ; return ost.str(); }\ntemplate < class T > inline T sqr(T n) { return n * n; }\n\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\ntemplate < class T > T power(T n, int p)\n{\n if(!p) return 1;\n else\n {\n T sum = sqr( power( n , p >> 1) );\n if(p & 1) sum = n;\n return sum;\n }\n}\n\n\n//ll bigmod(ll num , ll p , ll mod)\n//{\n// ll sum = 1 , temp = num;\n// while(p)\n// {\n// if(p & 1) sum = (sum * temp) % mod;\n// temp = (temp * temp) % mod; p = p >> 1;\n// }\n// return sum;\n//}\n\n\n/// S , E , N , W\n////int one [] = {0 ,1 , 0,-1};\n////int two [] = {1 ,0 ,-1, 0};\n///S , SE , E , NE , N , NW , W , SW\n//int one [] = {1 ,1 ,0,-1,-1,-1, 0, 1};\n//int two [] = {0 ,1 ,1 ,1, 0,-1,-1,-1};\n///Knight Direction\n//int one[]={2 ,1 ,-1,-2,-2,-1, 1, 2};\n//int two[]={1 ,2 , 2, 1,-1,-2,-2,-1};\n\n\n///***********************************************END*********************************//////////////////\n\nint rev(int n);\nint main()\n{\n //ios_base::sync_with_stdio(0); cin.tie(0);\n int h , m;\n char ch;\n sf(\"%d%c%d\" , h , ch , m);\n while(true)\n {\n m++;\n if(m == 60)\n {\n m = 0;\n h++;\n if(h == 24) h = 0;\n }\n if(h == rev(m))\n {\n pf(\"%02d:%02d\\n\" , h , m);\n return 0;\n }\n }\n return 0;\n}\n\n\nint rev(int n)\n{\n int ret = n % 10;\n n = n / 10;\n ret = (ret * 10) + n;\n}\n", "lang": "GNU C++0x", "bug_code_uid": "f99d8c41e61eff5f6e459320672f13f8", "src_uid": "158eae916daa3e0162d4eac0426fa87f", "apr_id": "aedb77ec3791035fcbab1a07f23f84ea", "difficulty": 1000, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.6272680145152929, "equal_cnt": 10, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 9, "bug_source_code": "//created by mad_o\n#include\nusing namespace std;\n#define PI 3.14159265359\n#define BIGN 1000000007\n#define endl \"\\n\"\n#define CIN ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);\n\n#define mp(x,y) make_pair(x,y)\n#define pb(x) push_back(x)\n#define ff first\n#define ss second\n#define sz(x) ((int)((x).size()))\n#define all(x) ((x).begin()),((x).end())\n#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)\n#define forn(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)\n\n#define ll long long\n#define ull unsigned long long\n#define pqueue priority_queue\n\null bign = 1000000007;\null dp[100000000];\n\n\null poww(ull n){\n\tif(n<100000000 && dp[n]!=-1)return dp[n];\n\tif(n==1)return dp[n]=2;\n\tif(n%2==0)return dp[n]=((poww(n/2)%bign)*(poww(n/2)%bign))%bign;\n\treturn dp[n]=(2*(poww(n/2)%bign)*(poww(n/2)%bign))%bign;\n}\n\nint main(){\n\null n , m , ans , ans2 , i , res = 1;\nmemset(dp,-1,sizeof(dp));\ncin>>n >> m;\n\npoww(max(n,m));\n\n\nans = poww(n);\nans = (ans%bign - 1 + bign )%bign;\nans2 = poww(m);\nans2 = (ans2%bign - 1 + bign )%bign;\nres = ((ans%bign)*(ans2%bign))%bign;\ncout<\n#include \n#include \n#include \n\nusing namespace std;\n\nint main()\n{\n\tint grid[3][3] = {0};\n\tint status[3][3] = {0};\n\tint update[3][3] = {0};\n\tfor(int i = 0; i < 3; i++)\n\t{\n\t\tfor( int j = 0; j<3; j++)\n\t\t{\n\t\t\tcin >> grid[i][j];\n\t\t}\n\t}\n\t\n\tfor( int i = 0; i < 3; i++)\n\t{\n\t\tfor(int j =0; i < 3; j++)\n\t\t{\n\t\t\tstatus[i][j] == grid[i][j-1] + grid[i][j] + grid[i][j+1] + grid[i+1][j] + grid[i-1][j];\n\t\t}\n\t}\n\t\n\tfor( int i = 0; i<3; i++)\n\t{\n\t\tfor(int j = 0; j < 3; j++)\n\t\t{\n\t\t\tif( (status[i][j])% 2 == 0)\n\t\t\t{\n\t\t\t\tupdate[i][j] == 0;\n\t\t\t}\n\t\t\t\n\t\t\telse if( status[i][j] % 2 != 0)\n\t\t\t{\n\t\t\t\tupdate[i][j] == 1;\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t}\n}", "lang": "MS C++ 2017", "bug_code_uid": "8f5f8596b0fe166a8d0201993b93235e", "src_uid": "b045abf40c75bb66a80fd6148ecc5bd6", "apr_id": "117d0bf0e8b70f18bb10cc7ebb5946ce", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5607158074137196, "equal_cnt": 23, "replace_cnt": 20, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 23, "bug_source_code": "#include \nusing namespace std;\n\n\n#define pb push_back\n#define mp make_pair\n#define all(x) (x).begin(),(x).end()\n#define fi first\n#define se second\n#define SZ(x) ((int)(x).size())\ntypedef long long ll;\ntypedef double db;\ntypedef vector VI;\ntypedef pair PII;\ntypedef pair PLI;\nmt19937 mrand(random_device{}()); \nconst ll mod=998244353;\nll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); 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#define Abs(x) ((x)>0?(x):-(x))\nll f[200006],ff[200006];\n\nint n,k;\nll g(int k)\n{\n\tll ret=0;\n\tfor(int i=k+1;k<=n;k++)\n\t{\n\t\tll tmp=f[n-i]*ff[i]%mod*f(n-i]%mod;\n\t\tret=(ret+tmp)%mod;\n\t}return ret;\n}\n\nint main()\n{\n\tf[0]=f[1]=1;\n\t\n\tscanf(\"%d%d\",&n,&k);\n\tfor(int i=2;i<=n;i++)f[i]=f[i-1]*i%mod;\n\tff[0]=1;\n\tfor(int i=1;i<=n;i++)\n\t\tff[i]=ff[i-1]*(n-i+1)%mod*powmod(i,mod-2);\n\tll ans=1;\n\tif(k>=n)\n\t{\n\t\tputs(\"0\");\n\t\treturn 0;\n\t}\n\tif(k==0)\n\t{\n\t\tfor(int i=1;i<=n;i++)ans=ans*n%mod;\n\t\tprintf(\"%lld\\n\",ans);\n\t\treturn 0;\n\t}\n\tif(k==n-1)\n\t{\n\t\tprintf(\"%d\\n\",2*n);\n\t\treturn 0;\n\t}\n\tprintf(\"%lld\\n\",g(k)-g(k-1));\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "7c59737eac3085a6ac035d367861f262", "src_uid": "6c1a9aaa7bdd7de97220b8c6d35740cc", "apr_id": "34a4d850f8edea58331a8d6ba3629396", "difficulty": 2300, "tags": ["fft", "math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9993011879804332, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "include \nusing namespace std;\n#define lli long long int\n#define fop(i,m,n) for (int i=(m);i<(n);i++)\n#define FOP(i,m,n) for (int i=(m)-1;i>=(n);--i)\n#define test(x) cout << #x << ' ' << x << endl;\n#define eb emplace_back\n#define pb push_back\n#define mp make_pair \n#define pii pair \n \nint find (lli k) {\n\tint a = 0;\n\twhile (k > 1) {\n\t\tk >>= 1;\n\t\ta++;\n\t}\n\treturn a;\n}\n \n \nint main () {\n\tlli n,k;\n\tcin >> n >> k;\n\tlli aa = n - k, sum;\n\tif (__builtin_popcountll(k+1) == 1) {\n\t\tsum = aa / (k + 1);\n\t\tsum *= 2;\n\t\tif (aa % (k + 1)) sum += 2;\n\t\telse sum++;\n\t} else {\n\t\taa--;\n\t\tif (aa < 0) {\n\t\t\tsum = 1;\n\t\t} else {\n\t\t\tsum = aa / (1ll << find(k));\n\t\t\tsum++;\n\t\t\tsum *= 2;\n\t\t}\n\t}\n\tcout << sum << endl;\n}", "lang": "GNU C++17", "bug_code_uid": "91c6478cd9d664c38c5fd21ce89dc13a", "src_uid": "783c4b3179c558369f94f4a16ac562d4", "apr_id": "d9890b3d06881dfa82ac20aa74bb5253", "difficulty": 2100, "tags": ["dp", "math", "combinatorics", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9218870843000774, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "//be name khoda//\n\n#include \n#define ll long long \n#define li long int \n#define ld long double \n#define mp make_pair\n#define pb push_back\n\nusing namespace std;\nint main(){\n //ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);\n\tstring s;\n\tcin>>s;\n\tif (s.size()<2){\n\t\treturn cout<<0,-1;\n\t}\n\tll t(0),f(0);\n\tfor (int i=0;i<(s.size()-1);i++){\n\t\tif (s[i]=='K')\n\t\t\tcontinue;\n\t\tif (s[i+1]=='K')\n\t\t\tt++;\n\t}\n\tfor (int i=0;i<(s.size()-2);i++){\n\t\tif (s[i]=='V' and s[i+1]=='V' and s[i+2]=='V')\n\t\t\tf=1;\n\t}\n\tif (s[s.size()-2]=='V' and s[s.size()-1]=='V')\n\t\tf=1;\n\tcout<\nusing namespace std;\n\nint main()\n{\n int n,a,x,b,y,i=0;\n cin>>n>>a>>x>>b>>y;\n \n vector v1,v2;\n \n v1.push_back(a);\n v2.push_back(b);\n \n \n while(v1[i]!=x||v2[i]!=y)\n {\n ++i;\n v1.push_back((a+i)%n==0?n:(a+i)%n);\n v2.push_back((b-i)%n==0?n:(b-i)%n);\n \n \n }\n \n \n string ans=\"NO\";\n for(int j=0;j<=i;++j)\n {\n if (v1[j]==v2[j])\n {\n ans=\"YES\";\n break;\n }\n }\n cout<\n#include \nusing namespace std;\n\nconst int MOD = 1e9 + 9;\nint n, m;\n\nint main() {\n\tcin >> n >> m;\n\tlong long ans = 1;\n\tlong long p = 1;\n\tfor(int i = 0; i < m; i++) {\n\t\tp*= 2;\n\t\tp %= MOD;\n\ti}\n\tfor(int i = 0; i < n; i++) {\n\t\tp = (long long)(p - 1) % MOD;\n\t\tans *= p;\n\t\tans %= MOD;\n\t}\n\tcout << ans << endl;\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "92cc3a75550410e95aa69a77a5e99644", "src_uid": "fef4d9c94a93fcf6d536f33503b1d4b8", "apr_id": "f9bb21f819edc8148b95b0f6d7cd2fbc", "difficulty": 1300, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.8365650969529086, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "#include\nusing namespace std;\nint a[105],i,j,t[5],sum,mini=1000005,v1,v2;\nsets;\nint main()\n{\n\tfor(i=0;i<5;i++)\n\t{\n\t\tcin>>t[i];\n\t\ta[t[i]]++;\n\t\tsum+=t[i];\n\t\ts.insert(t[i]);\n\t}\n\tsort(t,t+5);\n\tif(*max_element(a,a+105)<=1)\n\t{\n\t\tcout<:: reverse_iterator it;\n\t\tfor(it=s.rbegin(); it!=s.rend(); ++it)\n\t\t{\n\t\t\ti=*it;\n\t\t\tif(a[i]>=3)\n\t\t\t{\n\t\t\t\tmini=sum-(i*3);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if(a[i]==2)\n\t\t\t{\n\t\t\t\t++it;\n\t\t\t\tj=*it;\n\t\t\t\tif(a[j]==2)\n\t\t\t\t{\n\t\t\t\t\tmini=sum-(i*2);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(a[j]>=3)\n\t\t\t\t{\n\t\t\t\t\tv1=sum-(i*2);\n\t\t\t\t\tv2=sum-(j*3);\n\t\t\t\t\tmini=min(v1,v2);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tcout<\nusing namespace std;\nint main(){\nlong long int a,b,coun=0;\ncin>>a>>b;\nif(a>b){if(b%2!=0)cout<a) { if((a-b/2)>0)cout<\n#include \n\nusing namespace std;\n\nint square(int n);\nint main(void)\n{\n int n;\n while(scanf(\"%d\",&n))\n {\n\n cout<\n#include \n#include \n#include \n#include \n#include \n#include \n#define rep(i,n) for(int i=0; i\nusing namespace std;\nint gcd(int a, int b) {\n\tif (a < b) swap(a, b);\n\tif (!b) return a;\n\treturn gcd(b, a%b);\n}\nint main()\n{\n\tios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); \n\tint a1, b1, c1, a2, b2, c2;\n\tcin >> a1 >> b1 >> c1 >> a2 >> b2 >> c2;\n\tif (!a1 && !a2) {\n\t\tif (!b1 && !b2 && c1 == c2) cout << -1;\n\t\telse if (!b1 && !b2) cout << 0;\n\t\telse cout << 1;\n\t\treturn 0;\n\t}\n\tif (!b1 && !b2) {\n\t\tif (!a1 && !a2 && c1 == c2) cout << -1;\n\t\telse if (!a1 && !a2) cout << 0;\n\t\telse cout << 1;\n\t\treturn 0;\n\t}\n\tint gcd1 = gcd(gcd(abs(a1), abs(b1)), abs(c1)),\n\t\tgcd2 = gcd(gcd(abs(a2), abs(b2)), abs(c2));\n\ta1 /= gcd1; b1 /= gcd1; c1 /= gcd1;\n\ta2 /= gcd2; b2 /= gcd2; c2 /= gcd2;\n\tif (a1 == a2 && b1 == b2 && c1 == c2) cout << -1;\n\telse if (a1*b2 == a2*b1) cout << 0;\n\telse cout << 1;\n}\n\n// Thu Nov 24 2016 19:40:33 GMT+0300 (MSK)", "lang": "GNU C++11", "bug_code_uid": "5c802befee369cb931b27f61f050bec8", "src_uid": "c8e869cb17550e888733551c749f2e1a", "apr_id": "020200dbca57ed5282d6dacef4c10b3e", "difficulty": 2000, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9935064935064936, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nint main()\n{\n int n, m, a, b;\n\n cin >> n >> m >> a >> b;\n\n if ((a % m == 1 && b == n) || (((a - 1) / m == (b - 1) / m)) || ((a - 1) % m == 0 && b % m == 0) && (a % m != 0))\n {\n cout << \"1\";\n return 0;\n }\n\n if ((a % m == 1 && b % m != 0) || (a % m != 1 && b % m == 0) || (a % m - 1 == b % m)\n || (b == n) || ((a - 1) / m + 1 == (b - 1) / m) || ((a - 1) % m == b % m))\n {\n cout << \"2\";\n return 0;\n }\n\n cout << 3;\n\n return 0;\n}\n", "lang": "MS C++", "bug_code_uid": "50fb699d9f47e14a314add2af4b5d413", "src_uid": "f256235c0b2815aae85a6f9435c69dac", "apr_id": "00c2cca918d025330ab9859ea84a6a48", "difficulty": 1700, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.43528561099060015, "equal_cnt": 23, "replace_cnt": 11, "delete_cnt": 1, "insert_cnt": 11, "fix_ops_cnt": 23, "bug_source_code": "#include \n\n#define PB push_back\n#define SZ(c) ll((c).size())\n#define ALL(c) (c).begin(), (c).end()\n#define CONTAINS(c, x) ((c).find(x)!=(c).end())\n#define REP(i, c) for(int i=0; i> N;\n REP(I, N) cin>>A[I];\n sort(A, A+N, greater());\n \n REP(I, N) B[1<\n#define mod 1000000007\n#define ll long long\n#define pb push_back\nusing namespace std;\nset ss;\nint main()\n{\n ios_base::sync_with_stdio(false);\n cin.tie(NULL);\n ll a[16], ans = 0;\n for(int i = 1; i <= 14; i++) cin >> a[i];\n for(int k = 1; k <= 14; k++)\n {\n if(a[k] > 0)\n {\n ll temp = a[k], sum = 0;\n if(id == 0) id++;\n ll b[16];\n for(int i = 1; i <= 14; i++) b[i] = a[i];\n b[k] = 0;\n int add = a[k]/14, re = a[k] % 14, id = (k + 1) % 15;\n if(id == 0) id = 1;\n for(int i = 1; i <= 14; i++) b[i] += add;\n while(re)\n {\n b[id]++;\n id = (id + 1) % 15;\n if(id == 0) id == 1;\n re--;\n }\n for(int i = 1; i <= 14; i++) if(b[i] % 2 ==0) sum += b[i];\n ans = max(sum, ans);\n }\n }\n cout << ans;\n}\n", "lang": "GNU C++14", "bug_code_uid": "0a441229450f013294562e708d6f092a", "src_uid": "1ac11153e35509e755ea15f1d57d156b", "apr_id": "eef73333e16d409e5d9963a94c8c92c6", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.8824082784571966, "equal_cnt": 8, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n#define li long long int\n#define rep(i,to) for(li i=0;i<((li)(to));++i)\n#define pb push_back\n#define sz(v) ((li)(v).size())\n#define bit(n) (1ll<<(li)(n))\n#define all(vec) (vec).begin(),(vec).end()\n#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)\n#define MP make_pair\n#define F first\n#define S second\n\n#define kill exit\nvoid print_second(){\n\tcout<<\"SECOND\"<>x0>>x1>>a>>b;\n\tbool flag=false;\n\tif(x1\n\nint main(void)\n\n{\n\n int n, min, s=0,s1=0;\n scanf(\"%d\", &n);\n\n int a[n];\n\n\n for (i=0; i\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std; void files_please(); typedef long long ll; typedef unsigned long long ull; typedef unsigned int ui; inline void out(double); inline void out(char); inline void out(char *); inline void out(ll); inline void out(int); inline void out(int, int); inline void out(int, int, int); inline void out(int, int, int, int); template void out(T*, int, char = ' '); inline void in(char c); inline void in(char * s); inline void in(int&); inline void in(int&, int&); inline void in(int&, int&, int&); inline void in(int&, int&, int&, int&); template void in(T*, int);\n\nll all[10111];\nll good[10111];\nconst ll MOD = (ll)1e9 + 7;\n\nvoid solve() {\n all[0] = good[1] = 1;\n int n;\n in(n);\n for (int i = 1; i <= n; ++i) {\n all[i] = (all[i - 1] * (ll)27) % MOD;\n good[i] = (all[i - 1] * (ll)20) % MOD;\n good[i] = (good[i] + good[i - 1] * 7) % MOD;\n }\n out(good[n]);\n}\n\nint main() { \n files_please();\n solve(); _\n}\n\ninline void in(char c)\n{\n scanf(\" %c\", &c);\n}\ninline void in(char * s)\n{\n scanf(\" %s\", s);\n}\ninline void in(int &a)\n{\n scanf(\"%d\", &a);\n}\ninline void in(int &a, int &b)\n{\n scanf(\"%d%d\", &a, &b);\n}\ninline void in(int &a, int &b, int &c)\n{\n scanf(\"%d%d%d\", &a, &b, &c);\n}\ninline void in(int &a, int &b, int &c, int &d)\n{\n scanf(\"%d%d%d%d\", &a, &b, &c, &d);\n}\ntemplate\ninline void in(T * arr, int n)\n{\n for (int i = 0; i < n; ++i)\n in(arr[i]);\n}\n\ninline void out(double d)\n{\n printf(\"%.15lf\", d);\n}\ninline void out(char c)\n{\n printf(\"%c\", c);\n}\ninline void out(char * s)\n{\n printf(\"%s\", s);\n}\ninline void out(long long a)\n{\n printf(\"%lld\", a);\n}\ninline void out(int a)\n{\n printf(\"%d\", a);\n}\ninline void out(int a, int b)\n{\n printf(\"%d %d\", a, b);\n}\ninline void out(int a, int b, int c)\n{\n printf(\"%d %d %d\", a, b, c);\n}\ninline void out(int a, int b, int c, int d)\n{\n printf(\"%d %d %d %d\", a, b, c, d);\n}\ntemplate\nvoid out(T * arr, int n, char sep)\n{\n for (int i = 0; i < n; ++i)\n {\n out(arr[i]);\n out(sep);\n }\n}\n\nvoid files_please()\n{\n#ifndef ONLINE_JUDGE\n freopen(\"input.txt\", \"rt\", stdin);\n freopen(\"output.txt\", \"wt\", stdout);\n#endif // ONLINE_JUDGE\n}", "lang": "MS C++", "bug_code_uid": "7fd15476cf558231a675fe2bd9f06fab", "src_uid": "eae87ec16c284f324d86b7e65fda093c", "apr_id": "71453c637f88ef26a92405497b831f72", "difficulty": 1500, "tags": ["combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.6041202672605791, "equal_cnt": 19, "replace_cnt": 10, "delete_cnt": 4, "insert_cnt": 4, "fix_ops_cnt": 18, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n\nusing namespace std;\n\nconst int NMAX = 100010, MOD = 1e9+7;\nint m;\nint f[NMAX];\nvector fact[NMAX];\n\nint gcd(int x, int y){\n\tif(y) return gcd(y, x % y);\n\treturn x;\n}\n\nint Power(int x, int y){\n\tint ret = 1;\n\twhile(y){\n\t\tif(y & 1) ret = 1LL * ret * x % MOD;\n\t\tx = 1LL * x * x % MOD;\n\t\ty >>= 1;\n\t}\n\treturn ret;\n}\n\nint inv(int x){\n\treturn Power(x, MOD - 2);\n}\n\nint calc(int a, int b){//gcd(x, a) = b -- count the number of x in [1..m]\n\tint prime[10], cnt = 0;\n\tint tmpa = a / b;\n\tfor(int i = 2; i <= tmpa; i++){\n\t\tif(tmpa % i == 0)\n\t\t\tprime[cnt++] = i;\n\t\twhile(tmpa % i == 0)\n\t\t\ttmpa /= i;\n\t}\n\tint sum = 0;\n\tfor(int i = 0; i < (1 << cnt); i++){\n\t\tint mult = 1, sign = 1;\n\t\tfor(int j = 0; j < cnt; j++){\n\t\t\tif(i & (1 << j)){\n\t\t\t\tmult *= prime[j];\n\t\t\t\tsign *= -1;\n\t\t\t}\n\t\t}\n\t\tsum += (m / b) / mult * sign;\n\t}\n\treturn sum;\n}\n\nint main(){\n\tscanf(\"%d\", &m);\n\tfor(int i = 1; i <= m; i++){\n\t\tfor(int j = i * 2; j <= m; j++){\n\t\t\tfact[j].push_back(i);\n\t\t}\n\t}\n\tf[1] = 1;\n\tfor(int i = 2; i <= m; i++){\n\t\tint sum = 0;\n\t\tfor(int j : fact[i]){\n\t\t\tif(i % j == 0){\n\t\t\t\tsum = (sum + 1LL * f[j] * calc(i, j) % MOD * inv(m) % MOD) % MOD;\n\t\t\t\t//printf(\"gcd(x, %d) = %d cnt: %d\\n\", i, j, calc(i, j));\n\t\t\t}\n\t\t}\n\t\t//printf(\"gcd(x, %d) = %d cnt: %d\\n\", i, i, calc(i, i));\n\t\tf[i] = 1LL * (1 + sum) * (1LL * m * inv(m - calc(i, i)) % MOD) % MOD;\n\t}\n\tint sum = 0;\n\tfor(int i = 1; i <= m; i++)\n\t\tsum = (sum + 1LL * f[i] * inv(m) % MOD) % MOD;\n\tprintf(\"%d\\n\", sum);\n\treturn 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "daa81d44fe46988b1d81ed090d0485bc", "src_uid": "ff810b16b6f41d57c1c8241ad960cba0", "apr_id": "332a9e5ac3b0312f93b845ed8ceee268", "difficulty": 2300, "tags": ["dp", "math", "probabilities", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.025065963060686015, "equal_cnt": 8, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "#include\n#include\n#include\nusing namespace std;\nstruct node {\n int l,r,v;\n}q[10001];\nint a[20001],fa[20001],d[20001],n,m;\n\n\ninline void read(int &f) {\n f=0;char c=getchar();int ag=1;\n while(!isdigit(c)) {if (c=='-') ag=-1; c=getchar();}\n while(isdigit(c)){f=(f<<3)+(f<<1)+c-48;c=getchar();}\n f*=ag; return;\n}\nvoid write(int x) {\n if (x<0) putchar('-'),x*=-1;\n if (x>9) write(x/10);putchar(x%10+48);return;\n}\n\n\ninline void read_init() {\n int t=0; read(n);read(m);\n for (int i=1;i<=m;i++) {\n char c[5];\n read(q[i].l); read(q[i].r);\n scanf(\"%s\",c);\n q[i].v=c[0]=='o'?1:0;\n a[++t]=q[i].l-1;\n a[++t]=q[i].r;\n }\n sort(a+1,a+t+1);\n n=unique(a+1,a+t+1)-a-1;\n return;\n}\nint find(int x) {\n if (x==fa[x]) return x;\n int root=find(fa[x]); d[x]^=d[fa[x]];\n return fa[x]=root;\n}\nint main() {\n read_init();\n for (int i=1;i<=n;i++) fa[i]=i;\n for (int i=1;i<=m;i++) {\n int x=lower_bound(a+1,a+n+1,q[i].l-1)-a;\n int y=lower_bound(a+1,a+n+1,q[i].r)-a;\n int P=find(x),Q=find(y);\n if (P==Q)\n if ((d[x]^d[y])!=q[i].v) {\n write(i-1); return 0;\n }\n fa[P]=Q; d[P]=d[x]^d[y]^q[i].v;\n }\n write(m); return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "7d6cf70abe52c76305ed8c8838c37c82", "src_uid": "816ec4cd9736f3113333ef05405b8e81", "apr_id": "ca988c3c179586c3446d833ae54459bd", "difficulty": 1200, "tags": ["math", "games"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5817344589409056, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "#include\n#include\nusing namespace std;\nint main()\n{\n\n\tint array[25];\n\tint position = 0;\n\tint counter = 0;\n\n\tfor (int i = 0; i < 25; i++){\n\n\t\tcin >> array[i];\n\n\t\tif (array[i] == 1){\n\n\t\t\tposition = i;\n\n\t\t}\n\n\t}\n\n\twhile (position != 12){\n\n\t\tif (position < 12){\n\n\t\t\tif (abs(12 - position)>2){\n\n\t\t\t\tposition = position + 5;\n\t\t\t\tcounter++;\n\n\t\t\t}\n\n\t\t\telse{\n\n\t\t\t\tcounter = counter + abs(12 - position);\n\n\t\t\t}\n\n\t\t}\n\t\telse\n\n\t\t{\n\n\t\t\tif (abs(12 - position) > 2){\n\n\t\t\t\tposition = position - 5;\n\t\t\t\tcounter++;\n\n\t\t\t}\n\n\t\t\telse{\n\n\t\t\t\tcounter = counter + abs(12 - position);\n\n\t\t\t}\n\n\n\n\t\t}\n\n\t}\n\n\tcout << counter << \"\\n\";\n\n\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "lang": "MS C++", "bug_code_uid": "a1295e1e971eeddc9d8e72507386d29c", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "apr_id": "c89139fc6233263bb85b4ac4d65d09f5", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9761006289308176, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "// o O\n// |\n// _____ \n \n#include \n\nusing namespace std;\n\nlong long n, a, b, c;\n\nint main() {\n\tios::sync_with_stdio(false); cin.tie(0);\n\tcin >> n >> a >> b >> c;\n\tif( n < min(a, b)) cout << 0;\n\telse if (a <= b - c) cout << n / a;\n\telse{\n\t\tlong long ans = 1 + (n - b) / (b - c);\n\t\tn -= (1 + (n - b) / (b - c)) * (b - c);\n\t\tans += n / a; cout << ans;\n\t}\n\treturn 0;\n}", "lang": "GNU C++", "bug_code_uid": "e6230325bfe6a623be747a5fc9764315", "src_uid": "0ee9abec69230eab25de51aef0984f8f", "apr_id": "70bb1fafb4a1e6749b205d4c0250726e", "difficulty": 1700, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.1388050694025347, "equal_cnt": 19, "replace_cnt": 14, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 19, "bug_source_code": "#include\nusing namespace std;\nint main()\n{long long int i,a,x=0,b,sum1=0,sum2=0;\nvector v1;\nvector v2;\ncin >> a >> b;\n{\n while(a/10!=0)\n {if(a%10==0)\n x++;\n else\n v1.push_back(a%10);\n }\n a=a/10;\n} \n{\n while(b/10!=0)\n {if(b%10==0)\n x++;\n else\n v2.push_back(b%10);\n }\n b=b/10;\n} \nfor(i=0;i\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\nint ad[20006][11];\nint sent[20006][11], recv[11];\nint main()\n{\n int N,M,K,n,m,cnt,i;\n while (scanf(\"%d %d %d\", &N, &M, &K) != EOF)\n {\n for (n=1; n<=N; ++n)\n {\n for (m=1; m<=M; ++m) scanf(\"%d\", &ad[n][m]);\n }\n memset(sent, 0, sizeof(sent));\n memset(recv, 0, sizeof(recv));\n while (K--)\n {\n scanf(\"%d %d\", &n, &m);\n ++sent[n][m];\n ++recv[m];\n }\n for (n=1; n<=N; ++n)\n {\n cnt = 0;\n for (m=1; m<=M; ++m)\n {\n if (ad[n][m] == 0) continue;\n cnt += recv[m] - sent[n][m];\n }\n if (n > 1) putchar(' ');\n printf(\"%d\", cnt);\n }\n puts(\"\");\n }\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "fbaeb0cb31b9a3cac5c2b190a96c8f7e", "src_uid": "a3a337c7b919e7dfd7ff45ebf59681b5", "apr_id": "3ca2ae1dc10d41be478fd8e18923d9fd", "difficulty": 1800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9807852965747702, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "#define _CRT_SECURE_NO_WARNINGS\n#define _USE_MATH_DEFINES\n#pragma comment(linker, \"/STACK:16777216\")\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#define all(a) (a).begin(),(a).end()\n#define sz(a) (int)(a).size()\n\nusing namespace std; \n\ntypedef long long int64;\ntypedef vector vi;\ntypedef vector< vi > vvi;\ntypedef vector vd;\ntypedef vector< vd > vvd;\ntypedef vector< string > vs;\ntypedef pair< int, int > pii;\ntypedef vector< pii > vpii;\n\n\n\n\nint main()\n{\n#ifndef ONLINE_JUDGE\n freopen(\"input.txt\", \"rt\", stdin);\n freopen(\"output.txt\", \"wt\", stdout);\n#endif\n int a = 0;\n cin >> a;\n switch(a)\n {\n case 1:\n while(true);\n break;\n case 2:\n cout << 3;\n break;\n case 3:\n cout << 1; // TRUE;\n break;\n case 4:\n malloc(512000000);\n break;\n case 5:\n cout << 2;\n break;\n }\n return 0;\n}", "lang": "MS C++", "bug_code_uid": "bfa6f0728756ef3d8cf8b5e8ae3016f3", "src_uid": "c702e07fed684b7741d8337aafa005fb", "apr_id": "c056bfb4213e7e5916e7b4abb86ea3db", "difficulty": 1300, "tags": ["brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7756829549826857, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "#include\n#define ll long long\n#define ld long double\n#define pb push_back\n#define ff first\n#define ss second\n#define mp make_pair\n#define ins insert\n#define sb substr\n#define con continue\n#define ub upper_bound\n#define lb lower_bound\n#define pll pair\n#define pld pair\nusing namespace std;\nll power(ll x, ll y);\nbool isPrime(ll n);\nvector X[200001], Y[200001];\nll A[200001], B[200001];\nint main()\n{\n ios_base::sync_with_stdio(false);\n cin.tie(NULL);\n ll a,b,c,d,n,m,i,j,k,l,p,q,x,y,z,cnt=0, flag=0;\n string s1, s2, s3;\n vector V, W;\n vector :: iterator itrv;\n map M;\n set S;\n set :: iterator itrs;\n cin>>n>>m;\n if(((n+m)%2)==0)cout< 0){\n if (y & 1) res = res*x;\n y = y>>1;\n x = x*x;\n }\n return res;\n}\nbool isPrime(ll n){\n if (n <= 1) return false;\n if (n <= 3) return true;\n if (n%2 == 0 || n%3 == 0) return false;\n ll p=sqrt(n);\n for(int i=5;i<=p;i=i+6)\n if (n%i == 0 || n%(i+2) == 0)\n return false;\n return true;\n}\n", "lang": "GNU C++11", "bug_code_uid": "86927e3cfb379afcbb703de445e8d901", "src_uid": "8b2a9ae21740c89079a6011a30cd6aee", "apr_id": "67c64a7447a38ea17b366aedf86ff524", "difficulty": 1300, "tags": ["math", "combinatorics", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9689034369885434, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#include \n#include \n#include \n\nusing namespace std;\n\nint mas[1000];\n\nint main(int argc, char *argv[])\n{int N,i;\n cin>>N;\n for(i=0;i>mas[i];\n sort(mas,mas+N);\n cout<\n#undef assert\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#define STRING_IMPL(...) #__VA_ARGS__\n#define STRING(...) STRING_IMPL(__VA_ARGS__)\n\n#ifdef DEBUG\n#include \n\n#define debug(...) debug_impl(\"[\" __FILE__ \":\" STRING(__LINE__) \"] \" #__VA_ARGS__ \" = \", __VA_ARGS__)\n#define optimize(...) do { assert(__VA_ARGS__); } while (0)\n#define assert(...) void(static_cast(__VA_ARGS__) ? void() : assert_failed(__FILE__, __LINE__, #__VA_ARGS__))\n\nvoid print_backtrace() {\n\tvoid *array[50];\n\n\tauto const size = backtrace(array, 50);\n\tauto messages = backtrace_symbols(array, size);\n\n\tfor (int i = 1; i < size && messages != NULL; ++i)\n\t\tstd::cerr << \"[bt]: (\" << i << \") \" << messages[i] << '\\n';\n\n\tfree(messages);\n}\n\nvoid assert_failed(char const file[], size_t line, char const cond[]) {\n\tstd::cerr << file << ':' << line << \": assert(\" << cond << \") failed.\\n\";\n\tprint_backtrace();\n\texit(EXIT_FAILURE);\n}\n#else\n#define debug(...) void()\n#define optimize(...) do { if (!(__VA_ARGS__)) __builtin_unreachable(); } while (0)\n#define assert(...) void()\n#endif\n\ntemplate \nvoid debug_impl(char const s[], T&&... vals) {\n\tstd::cerr << s;\n\tstd::size_t n{0};\n\t((std::cerr << std::forward(vals) << (++n != sizeof...(vals) ? \", \" : \"\")), ...);\n\tstd::cerr << '\\n';\n}\n\ntemplate \nstd::ostream& operator<<(std::ostream &os, std::tuple const &theTuple) {\n\tos << '(';\n\tstd::apply([&os](Ts const&... tupleArgs) {\n\t\t\tstd::size_t n{0};\n\t\t\t((os << tupleArgs << (++n != sizeof...(Ts) ? \", \" : \"\")), ...);\n\t\t}, theTuple);\n\treturn os << ')';\n}\n\ntemplate \nvoid print_iters(std::ostream &os, T begin, T end) {\n\tif (begin != end)\n\t\tfor (;;) {\n\t\t\tos << *begin;\n\t\t\tif (++begin == end) break;\n\t\t\tos << \", \";\n\t\t}\n}\n\ntemplate \nauto& operator<<(std::ostream &os, std::vector const &c) {\n\tos << '[';\n\tprint_iters(os, begin(c), end(c));\n\treturn os << ']';\n}\n\ntemplate \nauto& operator<<(std::ostream &os, std::array const &c) {\n\tos << '[';\n\tprint_iters(os, begin(c), end(c));\n\treturn os << ']';\n}\n\ntemplate \nauto& operator<<(std::ostream &os, std::set const &c) {\n\tos << '{';\n\tprint_iters(os, begin(c), end(c));\n\treturn os << '}';\n}\n\ntemplate \nauto& operator<<(std::ostream &os, std::pair const &p) {\n\treturn os << '(' << p.first << \", \" << p.second << ')';\n}\n\nauto& operator<<(std::ostream &os, uint8_t i) { return os << unsigned(i); }\nauto& operator<<(std::ostream &os, int8_t i) { return os << int(i); }\n\ntemplate \nauto& operator>>(std::istream &is, std::vector &v) {\n\tfor (auto &x : v) is >> x;\n\treturn is;\n}\n\ntemplate \nauto& operator>>(std::istream &is, std::array &a) {\n\tfor (auto &x : a) is >> x;\n\treturn is;\n}\n\ntemplate \nauto& operator>>(std::istream &is, std::pair &p) {\n\treturn is >> p.first >> p.second;\n}\n \ntemplate \nT read(Args&&... args) {\n\tT val(std::forward(args)...);\n\tstd::cin >> val;\n\tassert(std::cin.good());\n\treturn val;\n}\n\n/* * * * * * * * * * * * * * * *\\\n * Solution by Casarin Filippo *\n * Date: 24-07-2020 *\n\\* * * * * * * * * * * * * * * */\n\nconstexpr size_t S = 20;\n\nint32_t solve(std::string const &A, std::string const &B) {\n\tstd::array, S> pair_original {};\n\tstd::vector L;\n\n\tfor (size_t i = 0; i < size(A); ++i)\n\t\tif (A[i] != B[i]) {\n\t\t\tL.push_back(A[i] - 'a');\n\t\t\tL.push_back(B[i] - 'a');\n\t\t\tpair_original[A[i] - 'a'].set(B[i] - 'a');\n\t\t}\n\n\tuint32_t sol = S * S;\n\tsort(begin(L), end(L));\n\tL.erase(unique(begin(L), end(L)), end(L));\n\n\tdebug(L);\n\n\tdo {\n\t\tuint32_t cnt = 0;\n\t\tauto pair = pair_original;\n\n\t\tfor (size_t i = 0; i+1 < size(L); ++i) {\n\t\t\tpair[L[i]].reset(L[i]);\n\t\t\tcnt += pair[L[i]].any();\n\t\t\tpair[L[i+1]] |= pair[L[i]];\n\t\t}\n\n\t\tpair[L.back()].reset(L.back());\n\t\tcnt += pair[L.back()].count();\n\n\t\tsol = std::min(sol, cnt);\n\t} while (next_permutation(begin(L), end(L)));\n\n\treturn sol;\n}\n\nint main() {\n\tstd::ios_base::sync_with_stdio(0);\n\tstd::cin.tie(0); std::cout.tie(0);\n\n\tauto T = read();\n\twhile (T--) {\n\t\tauto const N = read();\n\t\tauto const A = read();\n\t\tauto const B = read();\n\t\tassert(size(A) == N && size(B) == N);\n\t\tstd::cout << solve(A, B) << '\\n';\n\t}\n}\n", "lang": "GNU C++17", "bug_code_uid": "8bc1e778d8e92395b0a74db1a905b55e", "src_uid": "d0735a763e2a40bfc94085019cd646f0", "apr_id": "bdbdaafb287c07c13e060f1f5128d76a", "difficulty": 3100, "tags": ["graphs", "trees", "dp", "bitmasks"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9417933927635029, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "#include \n#include \n#include \n#include \nconst int bufSize = 1e6;\n#define DEBUG\nusing namespace std;\ninline char nc()\n{\n #ifdef DEBUG\n return getchar();\n #endif\n static char buf[bufSize], *p1 = buf, *p2 = buf;\n return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, bufSize, stdin), p1 == p2) ? EOF : *p1++;\n}\ninline void read(char *s)\n{\n static char c;\n for (; !isalpha(c); c = nc());\n for (; isalpha(c); c = nc()) *s++ = c;\n *s = '\\0';\n}\ntemplate\ninline T read(T &r)\n{\n static char c;\n static int flag;\n flag = 1, r = 0;\n for (c = nc(); !isdigit(c); c = nc()) if (c == '-') flag = -1;\n for (; isdigit(c); c = nc()) r = r * 10 + c - 48;\n return r *= flag;\n}\nconst int maxn = 1e5 + 100;\nconst int maxm = 21;\nint T,n;\nchar A[maxn],B[maxn];\nint G[maxm][maxn];\nint G2[maxm];\nvector s[maxm];\nint fa[maxm];\nint find(const int &x){return fa[x] == x ? x : fa[x] = find(fa[x]);}\ninline void merge(int x,int y)\n{\n x = find(x),y = find(y);\n if(x == y) return;\n if(s[x].size() < s[y].size()) swap(x,y);\n fa[y] = x;\n for(vector::iterator it = s[y].begin();it!=s[y].end();++it) s[x].push_back(*it);\n s[y].clear();\n}\nint f[1<<21],num[1<<21];\nint main()\n{\n for (int i = 0;i<(1<<20);++i) for (int x = i;x;x>>=1) num[i] += (x&1);\n read(T);\n while (T--)\n {\n read(n);\n read(A + 1),read(B + 1);\n for(int i = 1;i<=20;++i) fa[i] = i,s[i].clear(),s[i].push_back(i);\n for(int i = 1;i<=20;++i) for(int j = 1;j<=20;++j) G[i][j] = 0;\n for(int i = 1;i<=n;++i) \n {\n if(A[i] == B[i]) continue;\n G[A[i] - 'a' + 1][B[i] - 'a' + 1] = 1;\n merge(A[i] - 'a' + 1,B[i] - 'a' + 1);\n }\n int ans = 0;\n for(int i = 1;i<=20;++i)\n {\n if(find(i) != i) continue;\n// printf(\"%d: \",i);\n// for(vector::iterator it = s[i].begin();it!=s[i].end();++it) printf(\"%d \",*it);\n// putchar('\\n');\n for(unsigned int j = 0;j\nusing namespace std;\nconst int N=4003,P=1e9+9;\nint n,w,b,jc[N<<1];\ninline void in(Re &x){\n int f=0;x=0;char c=getchar();\n while(c<'0'||c>'9')f|=c=='-',c=getchar();\n while(c>='0'&&c<='9')x=(x<<1)+(x<<3)+(c^48),c=getchar();\n x=f?-x:x;\n}\ninline int mi(Re x,Re k){\n Re s=1;\n while(k){\n if(k&1)s=(LL)s*x%P;\n x=(LL)x*x%P,k>>=1;\n }\n return s;\n}\ninline int inv(Re x){return x==0?1:mi(x,P-2);}\ninline int C(Re m,Re n){return (LL)jc[n]*inv(jc[n-m])%P*inv(jc[m])%P;}\nint main(){\n in(n),in(w),in(b),jc[0]=1;\n for(Re i=1;i<=w+b;++i)jc[i]=(LL)jc[i-1]*i%P;\n printf(\"%d\\n\",(LL)C(n-3,w+b-3)*(w-1)%P*jc[w]%P*jc[b]%P);\n}", "lang": "GNU C++11", "bug_code_uid": "b29a2cfcb693a2b4be20b20d0d508a05", "src_uid": "63e93a161bbff623323e66c98d5e20ac", "apr_id": "8fae9e07a22ec8daa79253971f867dfd", "difficulty": 2100, "tags": ["combinatorics", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9981647634584013, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include\nusing namespace std;\n\nconst int md = 998244353;\n\nint bit_num0[10];\nint bit_num1[10];\nint n;\nstring s;\n\n\ninline void upd(int &x, int y) {\n x += y;\n if(x >= md) x -= md;\n}\n\nint anss = 0;\nint dp[2][10][10][2][2][1 << 9][1 << 9];\nint solve(int x, int y) {\n if(x == y) {\n int ans = 0;\n for(int i = s.size() - 1; i >= 0; i--) {\n ans = ans * 1ll * 10 % md;\n ans += s[i] - '0';\n ans %= md;\n }\n return ans;\n }\n int t = 0;\n int n = s.size();\n\n int tec_mask0 = 0;\n int tec_mask1 = 0;\n for(int z = 1; z <= 9; ++z) {\n int x1 = x * z;\n int y1 = y * z;\n if(x1 <= 9 && y1 <= 9) {\n tec_mask0 |= (1 << (x1 - 1));\n tec_mask1 |= (1 << (y1 - 1));\n }\n }\n\n int nm0 = 0, nm1 = 0;\n for(int i = 0; i <= 9; ++i)\n bit_num0[i] = bit_num1[i] = -1;\n\n for(int i = 0; i < 9; ++i) {\n if(tec_mask0 & (1 << i)) {\n bit_num0[i + 1] = nm0++;\n }\n if(tec_mask1 & (1 << i)) {\n bit_num1[i + 1] = nm1++;\n }\n }\n\n for(int i = 0; i < 2; ++i) {\n for(int j = 0; j < 10; ++j) {\n for(int k = 0; k < 10; ++k) {\n for(int g0 = 0; g0 < 2; ++ g0) {\n for(int g1 = 0; g1 < 2; ++g1) {\n for(int msk0 = 0; msk0 < (1 << nm0); ++msk0) {\n for(int msk1 = 0; msk1 < (1 << nm1); ++msk1) {\n dp[i][j][k][g0][g1][msk0][msk1] = 0;\n }\n }\n }\n }\n }\n }\n }\n dp[0][0][0][0][0][0][0] = 1;\n for(int i = 0; i < n; ++i) {\n int a = s[i] - '0';\n for(int j = 0; j < 10; ++j) {\n for(int k = 0; k < 10; ++k) {\n for(int z = 0; z < 10; ++z) {\n int c0 = (z * x + j);\n int c1 = (z * y + k);\n int d0 = c0 / 10;\n int d1 = c1 / 10;\n c0 %= 10;\n c1 %= 10;\n\n for(int g0 = 0; g0 < 2; ++g0) {\n for(int g1 = 0; g1 < 2; ++g1) {\n int b0 = g0;\n int b1 = g1;\n if(c0 < a) b0 = 0;\n else if(c0 > a) b0 = 1;\n\n if(c1 < a) b1 = 0;\n else if(c1 > a) b1 = 1;\n\n for(int mask0 = 0; mask0 < (1 << nm0); ++mask0) {\n int to_mask0 = mask0;\n if(bit_num0[c0] != -1) to_mask0 |= (1 << bit_num0[c0]);\n for(int mask1 = 0; mask1 < (1 << nm1); ++mask1) {\n int to_mask1 = mask1;\n if(bit_num1[c1] != -1) to_mask1 |= (1 << bit_num1[c1]);\n\n upd(dp[t ^ 1][d0][d1][b0][b1][to_mask0][to_mask1],\n dp[t][j][k][g0][g1][mask0][mask1]);\n }\n }\n\n }\n }\n }\n }\n }\n for(int j = 0; j < 10; ++j) {\n for(int k = 0; k < 10; ++k) {\n for(int g0 = 0; g0 < 2; ++ g0) {\n for(int g1 = 0; g1 < 2; ++g1) {\n for(int msk0 = 0; msk0 < (1 << nm0); ++msk0) {\n for(int msk1 = 0; msk1 < (1 << nm1); ++msk1) {\n dp[t][j][k][g0][g1][msk0][msk1] = 0;\n }\n }\n }\n }\n }\n }\n t ^= 1;\n }\n int ans = 0;\n for(int j = 0; j < (1 << nm0); ++j) {\n for(int k = 0; k < (1 << nm1); ++k) {\n bool f = false;\n for(int z = 1; z <= 9; ++z) {\n int x1 = x * z;\n int y1 = y * z;\n if(x1 <= 9 && y1 <= 9) {\n if(bit_num0[x1] == -1) exit(-1);\n if(bit_num1[y1] == -1) exit(-1);\n if(j & (1 << bit_num0[x1])) {\n if(k & (1 << bit_num1[y1])) {\n f = true;\n }\n }\n }\n }\n if(f) {\n upd(ans, dp[t][0][0][0][0][j][k]);\n }\n }\n }\n\n return ans;\n}\n\nint main() {\n ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);\n cin >> s;\n reverse(s.begin(), s.end());\n\n\n for(int i = 1; i <= 9; ++i) {\n for(int j = 1; j <= 9; ++j) {\n if(__gcd(i, j) == 1 || (i == 1 && j == 1)) {\n anss += solve(i, j);\n if(anss >= md) anss -= md;\n }\n }\n }\n cout << anss;\n\n}\n", "lang": "GNU C++17", "bug_code_uid": "eb9cfb0880f445aff981bfb3bb9762e3", "src_uid": "b6f2061e2ca174c2385bf4520d232aaf", "apr_id": "51034452017ec00601fb8eecb1cf8c3b", "difficulty": 2700, "tags": ["dp"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.26588235294117646, "equal_cnt": 18, "replace_cnt": 10, "delete_cnt": 3, "insert_cnt": 5, "fix_ops_cnt": 18, "bug_source_code": "#include\n#include\nusing namespace std;\nint main()\n{\n\nint n,m;\ncin>>n>>m;\n\nvectorx(m);\nfor(int i=0;i>x[i];\n\nint t=n,c=1,b=0;\nfor(int i=0;ib)\n++y;\nint r=y;\nwhile(y--)\n{\n\tcout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n// #include \n// #include \n// #include \nusing namespace std;\n// const int dx[] = {-1, -1, -1, 0, 0, 1, 1, 1};\n// const int dy[] = {-1, 0, 1, -1, 1, -1, 0, 1};\n// const int dx[] = {2, 2, -2, -2, 1, 1, -1, -1};\n// const int dy[] = {-1, 1, 1, -1, 2, -2, 2, -2};\n#define all(cont) cont.begin(), cont.end()\n#define rall(cont) cont.end(), cont.begin()\n#define pb push_back\n#define mp make_pair\n#define fs first\n#define sc second\n#define pf printf\n#define sf scanf\n#define test_ fr(_iii_, 0, 66)pf(\">\");puts(\"in\")\n#define deb(x) fr(_iii_, 0, 66)cerr<<'>';cerr<<#x\"=\"<= (int)b ; i--)\n#define tr(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)\n#define trr(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)\n#define its(x) static_cast< ostringstream & >( ( ostringstream() << dec << x ) ).str()\n#define boost ios_base::sync_with_stdio(false)\n#define boost2 cin.tie(NULL)\n#define ln puts(\"\")\n#define mems(a) memset(a, 0, sizeof(a))\n#define has(cont, x) ((cont).find((x)) != (cont).end())\n#define sz(x) ((int)(x).size())\ntypedef long long ll;\ntypedef unsigned long long ull;\ntypedef long double ld;\ntypedef pair pii;\ntypedef pair pll;\ntypedef vector vi;\ntypedef vector vb;\ntypedef vector vll;\nint on_bit(int x, int pos) {x |= (1 << pos); return x;}\nint off_bit(int x, int pos) {x &= ~(1 << pos); return x;}\nbool is_on_bit(int x, int pos) {return ((x & (1 << pos)) != 0);}\nint flip_bit(int x, int pos) {x ^= (1 << pos); return x;}\nint lsb(int x) {return x & (-x);}\nint on_bit_all(int x, int pos) {x = (1 << pos)-1; return x;}\nconst double EPS = 1e-9;\nconst double PI = 2*acos(0.0);\nconst int INF = 0x3f3f3f3f;\nconst int MOD = 1 << 30;\nint add(ll a, ll b){return ((a%MOD)+(b%MOD))%MOD;}\nint sub(ll a, ll b){return ((a%MOD)-(b%MOD))%MOD;}\nint mult(ll a, ll b){return ((a%MOD)*(b%MOD))%MOD;}\nll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}\n\nconst int N = 12345;\nbool sq[N];\nint from[N];\n\nint main() {\n\tmems(sq);\n\tint u = 1;\n\twhile(u*u<=N){\n\t\tsq[u*u]=true;\n\t\tfrom[u*u]=u;\n\t\tu++;\n\t}\n\tint n;\n\tsf(\"%d\",&n);\n\tint res=0;\n\tfr(i,1,n+1){\n\t\tfr(j,i,n+1){\n\t\t\tint mult = i*i+j*j;\n\t\t\tif(mult\nusing namespace std;\nint main(){\n\tint s[4];\n\tcin>>s[0];\n\tcin>>s[1];\n\tcin>>s[2];\n\tcin>>s[3];\n \n int c=0;\n for(int i=0;i<=3;i++){\n \tfor(int j=i+1;j<=4;j++){\n\t\t\n \t\tif(s[i]==s[j])\n \t\tc++;\n\t\t\n\t\t}\n\t}\t\t\ncout<\n#include \n#define MOD 1000000007 \nvoid ADD(int &a,int b){\n a+=b;\n a%=MOD;\n}\nint C[110][110],f[110][2][110][110];\nint main(){\n int i,j,k,t,need,cnt,N,M,K,tak,now,then,ans;\n memset(C,0,sizeof(C));\n for (i=0;i<=100;i++)\n for (j=0;j<=i;j++)\n if (j==0||j==i) C[i][j] = 1;\n else C[i][j] = (C[i-1][j-1]+C[i-1][j])%MOD;\n \n while(scanf(\"%d%d%d\",&N,&M,&K)!=EOF){\n ans = 0;\n for (i=0;i<=N;i++)\n for (j=0;j<=1;j++)\n for (k=0;k<=K;k++)\n for (t=0;t<=N;t++)\n f[i][j][k][t] = 0;\n \n for (j=0;j<=M;j++){\n now = j%2, then = 1-now;\n f[0][now][1][1] = 1;\n for (i=1;i<=N;i++)\n for (cnt=1;cnt<=K;cnt++)\n ADD(ans,f[i][now][cnt][0]);\n for (i=0;i<=N;i++)\n for (cnt=1;cnt<=K;cnt++){\n for (need=1;need<=i+1;need++)\n if (f[i][now][cnt][need]!=0){\n //printf(\"%d %d %d %d : %d\\n\",i,j,cnt,need,f[i][now][cnt][need]);\n for (tak = need;tak+i<=N;tak++){\n int add = C[tak-1][need-1];\n if (cnt*add<=K){\n //printf(\"%d %d\\n\",tak,add);\n ADD(f[i+tak][then][cnt*add][i==0?tak-need+1:tak-need],\n f[i][now][cnt][need]);\n }\n }\n f[i][now][cnt][need] = 0;\n }\n f[i][now][cnt][0] = 0;\n }\n }\n \n printf(\"%d\\n\",ans);\n }\n}\n", "lang": "GNU C++", "bug_code_uid": "d3d559f417b85be898beb72391304b2e", "src_uid": "c6d275b1e1d5c9e39e2cf990a635fa6b", "apr_id": "b183c4ca7a7508d4cc2649f4e43e1b44", "difficulty": 2800, "tags": ["dp"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9946389151687165, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \n#include \nusing namespace std;\ntypedef long long LL;\n\n\nvoid SpezzaCifre(LL N, vector& vecN) {\n while (N != 0) {\n vecN.push_back(N%10);\n N /= 10;\n }\n}\n\nvector vecL, vecR;\nint cc = 0;\n\nvector nines(20, 9);\nvector zeroes(20, 0);\n\nbool Doable(int m, const vector& a, const vector& b, array& is) {\n if (m == 0) return true;\n \n m--;\n int ca = a[m], cb = b[m];\n for (int c = ca + 1; c < cb; c++) {\n if (is[c] > 0) return true;\n }\n\n if (ca == cb) {\n if (is[ca] == 0) return false;\n is[ca]--;\n bool possible = Doable(m, a, b, is);\n is[ca]++;\n return possible;\n }\n \n if (is[ca] > 0) {\n is[ca]--;\n if (Doable(m, a, nines, is)) return true;\n is[ca]++;\n }\n \n if (is[cb] > 0) {\n is[cb]--;\n if (Doable(m, zeroes, b, is)) return true;\n is[cb]++;\n }\n return false;\n}\n\nvoid CreateIncreasingSubseq(int c, int s, array& is) {\n if (c == 9) {\n is[c] = s;\n auto at_is = is;\n if (Doable(vecL.size(), vecL, vecR, at_is)) cc++;\n return;\n }\n for (int i = 0; i <= s; i++) {\n is[c] = i;\n CreateIncreasingSubseq(c + 1, s - i, is);\n }\n}\n\nint main() {\n ios::sync_with_stdio(false);\n\n LL L, R;\n cin >> L >> R;\n SpezzaCifre(L, vecL);\n SpezzaCifre(R, vecR);\n while (vecL.size() < vecR.size()) vecL.push_back(0);\n\n array is = {};\n CreateIncreasingSubseq(0, vecR.size(), is);\n\n cout << cc << \"\\n\";\n}", "lang": "GNU C++14", "bug_code_uid": "1cc878f4f8154945c537aff474fbe071", "src_uid": "adfa5f280eefbacdbaa4ad605402b57a", "apr_id": "38e33a3523727e40da4246f8636f4475", "difficulty": 2700, "tags": ["brute force", "math", "combinatorics", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.8452463566967384, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include \n\nusing namespace std;\n\nbool att(const string &a, const string &b, const string &c) {\n if(a[0] == c[0]) {\n if(b[0] != c[0]) {\n return true;\n }\n if(a[1] < c[1] && (b[1] <= a[1] || c[1] <= b[1])) {\n return true;\n }\n if(a[1] > c[1] && (b[1] >= a[1] || c[1] >= b[1])) {\n return true;\n }\n }\n if(a[1] == c[1]) {\n if(b[1] != c[1]) {\n return true;\n }\n if(a[0] < c[0] && (b[0] <= a[0] || c[0] <= b[0])) {\n return true;\n }\n if(a[0] > c[0] && (b[0] >= a[0] || c[0] >= b[0])) {\n return true;\n }\n }\n}\n\nbool check(const string &kb, const string &r0, const string &r1, const string &kw) {\n if(kb[0] < 'a' || kb[0] > 'h') { return false; }\n if(kb[1] < '1' || kb[1] > '8') { return false; }\n\n if(kb != r0) {\n if(att(kb, r1, r0) && att(kb, kw, r0)) { return false; }\n }\n if(kb != r1) {\n if(att(kb, r0, r1) && att(kb, kw, r1)) { return false; }\n }\n if(kb != kw) {\n if(kw[0]-1 <= kb[0] && kb[0] <= kw[0]+1 && kw[1]-1 <= kb[1] && kb[1] <= kw[1]+1) {\n return false;\n }\n }\n return true;\n}\n", "lang": "GNU C++11", "bug_code_uid": "169923ce4fbf7e636ff86160a182f250", "src_uid": "5d05af36c7ccb0cd26a4ab45966b28a3", "apr_id": "71915f97f383d15f1408a14b781059c0", "difficulty": 1700, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.5110338998967039, "equal_cnt": 12, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "#include \n#define all(v) v.begin(), v.end()\n#define rall(v) v.rbegin(), v.rend()\n#define rep(i,n) for (int i=0;i<(int)(n);i++)\n#define codefor int test;scanf(\"%d\",&test);while(test--)\n#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)\n#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)\n#define yes(ans) if(ans)printf(\"yes\\n\");else printf(\"no\\n\")\n#define Yes(ans) if(ans)printf(\"Yes\\n\");else printf(\"No\\n\")\n#define YES(ans) if(ans)printf(\"YES\\n\");else printf(\"NO\\n\")\n#define vector1d(type,name,...) vectorname(__VA_ARGS__)\n#define vector2d(type,name,h,...) vector>name(h,vector(__VA_ARGS__))\n#define umap unordered_map\n#define uset unordered_set\nusing namespace std;\nusing ll = long long;\nconst int MOD=1000000007;\nconst int MOD2=998244353;\nconst int INF=1<<30;\nconst ll INF2=(ll)1<<60;\n//\u5165\u529b\u7cfb\nvoid scan(int& a){scanf(\"%d\",&a);}\nvoid scan(long long& a){scanf(\"%lld\",&a);}\ntemplatevoid scan(pair& p){scan(p.first);scan(p.second);}\ntemplate void scan(T& a){cin>>a;}\ntemplate void scan(vector& vec){for(auto&& it:vec)scan(it);}\nvoid in(){}\ntemplate void in(Head& head, Tail&... tail){scan(head);in(tail...);}\n//\u51fa\u529b\u7cfb\nvoid print(const int& a){printf(\"%d\",a);}\nvoid print(const long long& a){printf(\"%lld\",a);}\nvoid print(const double& a){printf(\"%.15lf\",a);}\ntemplatevoid print(const pair& p){print(p.first);putchar(' ');print(p.second);}\ntemplate void print(const T& a){cout< void print(const vector& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}\nvoid out(){putchar('\\n');}\ntemplate void out(const T& t){print(t);putchar('\\n');}\ntemplate void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}\n//\u30c7\u30d0\u30c3\u30b0\u7cfb\ntemplate void dprint(const T& a){cerr< void dprint(const vector& vec){if(vec.empty())return;cerr< void debug(const T& t){dprint(t);cerr< void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<\" \";debug(tail...);}\nll intpow(ll a, ll b){ ll ans = 1; while(b){ if(b & 1) ans *= a; a *= a; b /= 2; } return ans; }\nll modpow(ll a, ll b, ll p){ ll ans = 1; while(b){ if(b & 1) (ans *= a) %= p; (a *= a) %= p; b /= 2; } return ans; }\nll updivide(ll a,ll b){if(a%b==0) return a/b;else return (a/b)+1;}\n\nint main(){\n INT(n);\n vector a(3),b(3);\n in(a,b);\n ll win2=min(a[0],b[1])+min(a[1],b[2])+min(a[2],b[0]),win1;\n if(b[0]>=b[1]&&b[0]>=b[2]){\n win1=max(b[0]-a[0]-a[1],0);\n if(win1==0){\n if(a[1]>b[0]){\n win1=max(a[1]-b[0]-b[1],0);\n }\n }\n }else if(b[1]>=b[0]&&b[1]>=b[2]){\n win1=max(b[1]-a[1]-a[2],0);\n if(win1==0){\n if(a[2]>b[1]){\n win1=max(a[2]-b[1]-b[2],0);\n }\n }\n }else if(b[2]>=b[0]&&b[2]>=b[1]){\n win1=max(b[2]-a[2]-a[0],0);\n if(win1==0){\n if(a[0]>b[2]){\n win1=max(a[0]-b[0]-b[2],0);\n }\n }\n }\n out(win1,win2);\n}", "lang": "GNU C++14", "bug_code_uid": "84ab73461fa6e2e61a120d1f248bda6f", "src_uid": "e6dc3bc64fc66b6127e2b32cacc06402", "apr_id": "a487d185aff124ac96c2c536bbe6a551", "difficulty": 1800, "tags": ["flows", "greedy", "math", "brute force", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9987129987129987, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \nusing namespace std;\n#define MOD 998244353 \n#define ff first\n#define ss second\ntypedef long long ll;\nll power(ll a, ll b){//a^b\n ll res=1;\n a=a%MOD;\n while(b>0){\n if(b&1){res=(res*a)%MOD;b--;}\n a=(a*a)%MOD;\n b>>=1;\n }\n return res;\n}\nll fermat_inv(ll y){return power(y,MOD-2);}\nll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}\nint main(){\n ios_base::sync_with_stdio(false);\n cin.tie(NULL);\n ll t=1;\n //cin>>t;\n while(t--){\n ll n;\n cin>>n;\n ll a1,a2,a3;\n ll b1,b2,b3;\n cin>>a1>>a2>>a3>>b1>>b2>>b3;\n ll m2=min(a1,b2)+min(a2,b3)+min(a3,b1);\n ll m1=max(a1+b2,max(a2+b3,a3+b1))-n;\n m1=max(m1,0);\n cout<\nusing namespace std;\nint main(){\n\tstring str;\n\tcin>>str;\n\tint len=str.length();\n\tint count1=0;\n\tint count2=0;\n\tint i=0;\n\twhile(count1+count2=65 && str[i]<=90){\n\t\t\tcount1++;\n\t\t\ti++;\n\t\t}\n\t\tif(str[i]>97 && str[i]<=122 ){\n\t\t\tcount2++;\n\t\t\ti++;\n\t\t}\n\t\n\t\t\n\t}\n\tint j=0;\n\twhile(j=65 && str[j]<=90){\n\t\t\tstr[j]=str[j]+32;\n\t\t\tj++;\n\t\t}\n\t\t}\n\t\tif(count1>count2){\n\t\t\tif(str[j]>=65 && str[j]<=90){\n\t\t\tstr[j]=str[j]+32;\n\t\t\tj++;\n\t\t}\n\t}\n\t\tif(count1=97 && str[j]<=122){\n\t\t\tstr[j]=str[j]-32;\n\t\t\tj++;\n\t\t}\n\t}\n\t}\n\tcout<\n#include \n#include \n#include \n\n#define ll long long\n#define pb push_back\n#define sz(x) (int)(x).size()\n#define mp make_pair\n#define f first\n#define s second\n#define all(x) x.begin(), x.end()\n#define D(x) cerr << #x << \" is \" << (x) << \"\\n\";\n\nusing namespace std;\nusing namespace __gnu_pbds;\nusing namespace __gnu_cxx;\n\nmt19937 rng(chrono::steady_clock::now().time_since_epoch().count());\ntemplate using ordered_set = tree, rb_tree_tag,tree_order_statistics_node_update>; ///find_by_order(),order_of_key()\ntemplate ostream& operator<<(ostream& os, const pair& a) { os << '{' << a.f << \", \" << a.s << '}'; return os; }\ntemplate ostream& operator<<(ostream& os, const vector& a){os << '{';for(int i=0;i0&&i ostream& operator<<(ostream& os, const set& a) {os << '{';int i=0;for(auto p:a){if(i>0&&i ostream& operator<<(ostream& os, const multiset& a) {os << '{';int i=0;for(auto p:a){if(i>0&&i ostream& operator<<(ostream& os, const map& a) {os << '{';int i=0;for(auto p:a){if(i>0&&i songs[3];\nint add(int a,int b)\n{\n a+=b;\n if(a>=mod)\n a-=mod;\n return a;\n}\nint mul(int a,int b)\n{\n return (ll)a*b%mod;\n}\nint dp[N][N][N*N][3];\nint calc(int tr,int koliko,int t,int d)\n{\n if(t<0)\n return 0;\n if(t==0||koliko==0)\n {\n if(t==0&&koliko==0)\n return 1;\n return 0;\n }\n if(tr>=(int)songs[d].size())\n return 0;\n if(dp[tr][koliko][t][d]!=-1)\n return dp[tr][koliko][t][d];\n dp[tr][koliko][t][d]=add(calc(tr+1,koliko,t,d),calc(tr+1,koliko-1,t-songs[d][tr],d));\n return dp[tr][koliko][t][d];\n}\nint powmod(int x,int k)\n{\n int ans=1;\n for(;k;k>>=1,x=mul(x,x))\n if(k&1)\n ans=mul(ans,x);\n return ans;\n}\nint ways[N][N][N][4];\nint calcways(int a,int b,int c,int d)\n{\n if(a==0&&b==0&&c==0)\n return 1;\n if(ways[a][b][c][d]!=-1)\n return ways[a][b][c][d];\n ways[a][b][c][d]=0;\n if(d!=0&&a)\n ways[a][b][c][d]=add(ways[a][b][c][d],calcways(a-1,b,c,0));\n if(d!=1&&b)\n ways[a][b][c][d]=add(ways[a][b][c][d],calcways(a,b-1,c,1));\n if(d!=2&&c)\n ways[a][b][c][d]=add(ways[a][b][c][d],calcways(a,b,c-1,2));\n return ways[a][b][c][d];\n}\nvector fact;\nint main()\n{\n fact.pb(1);\n for(int i=1;i\n\nusing namespace std;\n\nint main(){\n int numero;\n while(true){\n cin>>numero;\n switch(numero){\n case 0:\n cout<<\"zero\";\n break;\n case 1:\n cout<<\"one\";\n break;\n case 2:\n cout<<\"two\";\n break;\n case 3:\n cout<<\"three\";\n break;\n case 4:\n cout<<\"four\";\n break;\n case 5:\n cout<<\"five\";\n break;\n case 6:\n cout<<\"six\";\n break;\n case 7:\n cout<<\"seven\";\n break;\n case 8:\n cout<<\"eight\";\n break;\n case 9:\n cout<<\"nine\";\n break;\n case 10:\n cout<<\"ten\";\n break;\n case 11:\n cout<<\"eleven\";\n break;\n case 12:\n cout<<\"twelve\";\n break;\n case 13:\n cout<<\"thirteen\";\n break;\n case 14:\n cout<<\"fourteen\";\n break;\n case 15:\n cout<<\"fifth-teen\";\n break;\n case 16:\n cout<<\"six-teen\";\n break;\n case 17:\n cout<<\"seven-teen\";\n break;\n case 18:\n cout<<\"eighth-teen\";\n break;\n case 19:\n cout<<\"nine-teen\";\n break;\n case 20:\n cout<<\"twenty\";\n break;\n case 21:\n cout<<\"twenty-one\";\n break;\n case 22:\n cout<<\"twenty-two\";\n break;\n case 23:\n cout<<\"twenty-three\";\n break;\n case 24:\n cout<<\"twenty-four\";\n break;\n case 25:\n cout<<\"twenty.five\";\n break;\n case 26:\n cout<<\"twenty.six\";\n break;\n case 27:\n cout<<\"twenty-seven\";\n break;\n case 28:\n cout<<\"twenty-eighth\";\n break;\n case 29:\n cout<<\"twenty-nine\";\n break;\n case 30:\n cout<<\"thirty\";\n break;\n case 31:\n cout<<\"thirty-one\";\n break;\n case 32:\n cout<<\"thirty-two\";\n break;\n case 33:\n cout<<\"thirty-three\";\n break;\n case 34:\n cout<<\"thirty-four\";\n break;\n case 35:\n cout<<\"thirty-five\";\n break;\n case 36:\n cout<<\"thirty-six\";\n break;\n case 37:\n cout<<\"thirty-seven\";\n break;\n case 38:\n cout<<\"thirty-eighth\";\n break;\n case 39:\n cout<<\"thirty-nine\";\n break;\n case 40:\n cout<<\"forty\";\n break;\n case 41:\n cout<<\"forty-one\";\n break;\n case 42:\n cout<<\"forty-two\";\n break;\n case 43:\n cout<<\"forty-three\";\n break;\n case 44:\n cout<<\"forty-four\";\n break;\n case 45:\n cout<<\"forty-five\";\n break;\n case 46:\n cout<<\"forty-six\";\n break;\n case 47:\n cout<<\"forty-seven\";\n break;\n case 48:\n cout<<\"forty-eighth\";\n break;\n case 49:\n cout<<\"forty-nine\";\n break;\n case 50 :\n cout<<\"fifty\";\n break;\n case 51:\n cout<<\"fifty-one\";\n break;\n case 52:\n cout<<\"fifty-two\";\n break;\n case 53:\n cout<<\"fifty-three\";\n break;\n case 54:\n cout<<\"fifty-four\";\n break;\n case 55:\n cout<<\"fifty-five\";\n break;\n case 56:\n cout<<\"fifty-six\";\n break;\n case 57:\n cout<<\"fifty-seven\";\n break;\n case 58:\n cout<<\"fifty-eighth\";\n break;\n case 59:\n cout<<\"fifty-nine\";\n break;\n case 60:\n cout<<\"sixty\";\n break;\n case 61:\n cout<<\"sixty-one\";\n break;\n case 62:\n cout<<\"sixty-two\";\n break;\n case 63:\n cout<<\"sixty-three\";\n break;\n case 64:\n cout<<\"sixty-four\";\n break;\n case 65:\n cout<<\"sixty-five\";\n break;\n case 66:\n cout<<\"sixty-six\";\n break;\n case 67:\n cout<<\"sixty-seven\";\n break;\n case 68:\n cout<<\"sixty-eighth\";\n break;\n case 69:\n cout<<\"sixty-nine\";\n break;\n case 70:\n cout<<\"seventy\";\n break;\n case 71:\n cout<<\"seventy-one\";\n break;\n case 72:\n cout<<\"seventy-two\";\n break;\n case 73:\n cout<<\"seventy-three\";\n break;\n case 74:\n cout<<\"seventy-four\";\n break;\n case 75:\n cout<<\"seventy-five\";\n break;\n case 76:\n cout<<\"seventy-six\";\n break;\n case 77:\n cout<<\"seventy-seven\";\n break;\n case 78:\n cout<<\"seventy-eighth\";\n break;\n case 79:\n cout<<\"seventy-nine\";\n break;\n case 80:\n cout<<\"eighty\";\n break;\n case 81:\n cout<<\"eighty-one\";\n break;\n case 82:\n cout<<\"eighty-two\";\n break;\n case 83:\n cout<<\"eighty-three\";\n break;\n case 84:\n cout<<\"eighty-four\";\n break;\n case 85:\n cout<<\"eighty-five\";\n break;\n case 86:\n cout<<\"eighty-six\";\n break;\n case 87:\n cout<<\"eighty-seven\";\n break;\n case 88:\n cout<<\"eighty-eighth\";\n break;\n case 89:\n cout<<\"eighty-nine\";\n break;\n case 90:\n cout<<\"ninety\";\n break;\n case 91:\n cout<<\"ninety-one\";\n break;\n case 92:\n cout<<\"ninety-two\";\n break;\n case 93:\n cout<<\"ninety-three\";\n break;\n case 94:\n cout<<\"ninety-four\";\n break;\n case 95:\n cout<<\"ninety-five\";\n break;\n case 96:\n cout<<\"ninety-six\";\n break;\n case 97:\n cout<<\"ninety-seven\";\n break;\n case 98:\n cout<<\"ninety-eighth\";\n break;\n case 99:\n cout<<\"ninety-nine\";\n break;\n\n\n }\n cout<<\"\\n\";\n }\n\nreturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "c32af7dd8863cdf7657ce34a9a51bbff", "src_uid": "a49ca177b2f1f9d5341462a38a25d8b7", "apr_id": "f38cc9a6033449e4d736f7a90a556844", "difficulty": 1000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.16, "equal_cnt": 9, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "#include\nusing namespace std;\n\nint main(){\n\tint a,c;\n\tcin>>a>>c;\n\n\tvector av;\n\twhile(a>1){\n\t\tav.push_back(a%3);\n\t\ta=a/3;\n\t}\n\tav.push_back(a);\n\n\tvector cv;\n\twhile(c>1){\n\t\tcv.push_back(c%3);\n\t\tc=c/3;\n\t}\n\tcv.push_back(c);\n\n\tfor(int i=0;i bv;\n\tfor(int i=0;i\n#include \n#include \n\n#define LL long long\n#define pb push_back\n#define MP make_pair\n#define F first\n#define S second\n#define vecprint(vec) for (int i=0;i a,b,c;\nvector vec;\nmap M;\n\nint main()\n{\n scl(n);scl(m);\n while(m!=0)\n {\n c.pb(m%3);\n m/=3;\n }\n while (n!=0)\n {\n a.pb(n%3);\n n/=3;\n }\n q=c.size();\n while(q!=a.size())\n {\n a.pb(0);\n m--;\n }\n for(int i=0;i\n#include\n\nusing namespace std;\n\nint main()\n{\n long A,B;\n long x,y,z;\n cin>>A>>B;\n cin>>x>>y>>z;\n\n long sum=0,sum1=0,sum2=0;\n while((x+y+z)!=0){\n if(x>0){\n x--;\n sum1+=2;\n }\n if(y>0 && x==0 &&z==0){\n y--;\n sum1++;\n sum2++;\n }\n if(z>0){\n z--;\n sum2+=3;\n }\n }\n if((A+B-sum1-sum2)>=0)\n cout<<0;\n else\n cout<\nusing namespace std;\n#define ll long long int\n#define FOR(i,o,n) for (int i = o; i <= n; i++)\n#define mod 1000000007\n#define pb push_back\n#define ff first\n#define ss second\n#define pp pair\n#define vl vector\n#define vpp vector\n#define INF 1000000000\n#define endl '\\n'\ntypedef std::complex Complex;\ntypedef std::valarray CArray;\n#define fast ios::sync_with_stdio(0);cin.tie(0)\n//freopen(\"input.txt\", \"r\", stdin);\n//freopen(\"output.txt\", \"w\", stdout);\n#define all(x) x.begin(),x.end()\n#define ms(a,v) memset(a,v,sizeof a)\n#define II ({int a; scanf(\"%d\", &a); a;})\n#define LL ({Long a; scanf(\"%lld\", &a); a;})\n#define DD ({double a; scanf(\"%lf\", &a); a;})\n#define mp make_pair\n#define gc getchar\n#define EPS 1e-10\n#define pi 3.1415926535897932384626433832795\n#define FI freopen (\"in.txt\", \"r\", stdin)\n#define FO freopen (\"out.txt\", \"w\", stdout)\ntypedef unsigned long long ull;\ntypedef set si;\ntypedef pairpsl;\ntypedef pairpdd;\n\n#define forab(i, a, b)\tfor (__typeof (b) i = (a) ; i <= b ; ++i)\n#define rep(i, n)\t\tforab (i, 0, (n) - 1)\n#define For(i, n)\t\tforab (i, 1, n)\n#define rofba(i, a, b)\tfor (__typeof (b)i = (b) ; i >= a ; --i)\n#define per(i, n)\t\trofba (i, 0, (n) - 1)\n#define rof(i, n)\t\trofba (i, 1, n)\n#define forstl(i, s)\tfor (__typeof ((s).end ()) i = (s).begin (); i != (s).end (); ++i)\n\n#ifdef LOCAL\n#define __(args...) {dbg,args; cerr< debugger& operator , (const T& v){cerr< ostream &operator<<(ostream& o, const pair& p){ return o<<\"(\"< ostream& operator<<(ostream& o, const vector& v){ o<<\"[\";forstl(it,v)o<<*it<<\", \";return o<<\"]\";} //Vector print\ntemplate ostream& operator<<(ostream& o, const set& v){ o<<\"[\";forstl(it,v)o<<*it<<\", \";return o<<\"]\";} //Set print\ntemplate inline void MAX(T &a , T b){ if (a < b ) a = b;}\ntemplate inline void MIN(T &a , T b){ if (a > b ) a = b;}\n\n//Fast Reader\ntemplateinline bool read(T &x){int c=gc();int sgn=1;while(~c&&c<'0'||c>'9'){if(c=='-')sgn=-1;c=gc();}for(x=0;~c&&'0'<=c&&c<='9';c=gc())x=x*10+c-'0';x*=sgn;return ~c;}\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[]={2,1,-1,-2,-1,1};int dy[]={0,1,1,0,-1,-1}; //Hexagonal Direction\n\nint main()\n{\n\tll red,blue,green;\n\tcin>>red>>green>>blue;\n\tll cnt=0;\n\tll n=min(green,min(blue,red));\n\tif(n==0)\n\t{\n\t\tcout<\nint main()\n{\n int n,r,ans;\n scanf(\"%d\",&n);\n r=n%4;\n if(n==0){\n ans=1;\n }\n else if (r==0)\n ans=6;\n else if (r==1)\n ans=8;\n else if (r==2) ans=4;\n else if (r==3) ans=2;\n printf(\"%d\\n\\n\",ans)\n return 0;\n}", "lang": "MS C++", "bug_code_uid": "702c9d60489687bd3f6695f296a365c9", "src_uid": "4b51b99d1dea367bf37dc5ead08ca48f", "apr_id": "dd91eed39c9152683be5843382b2b4c9", "difficulty": 1000, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.2141603276770041, "equal_cnt": 16, "replace_cnt": 11, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 16, "bug_source_code": "#include\nusing namespace std;\nint fact(int n) \n{ \n int res = 1; \n for (int i = 2; i <= n; i++) \n res = res * i; \n return res; \n} \nint nCr(int n) \n{ \n return fact(n) / (fact(2) * fact(n - 2)); \n} \n \n// Returns factorial of n \nint main(){\n\tint n,m;\n\tcin>>n>>m;\n\tint max = 0;\n\tint min = 0;\n\tif(n!=1 and m!=0){\n\tfor(int i=2;i=m){\n\t max = n - i;\n\t break;\n\t }\n\t}\n\tif(max == 0){\n\t min = 0;\n\t}\n\telse{\n\t float answer = float(n)/(2*m);\n\t if(answer <=1){\n\t min = 0;\n\t }\n\t else{\n\t min = int(answer);\n\t }\n\t \n\t}\n\tcout<\nusing namespace std;\nint main()\n{\n int a,b,c,n;\n scanf(\"%d%d%d%d\",&a,&b,&c,n);\n int ans=n-(a+b-c);\n (ans>0&&a=a&&n-ans>=b&&n-ans>=c&&c<=a&&c<=b&&ans<=n)?cout<\nusing namespace std;\n\nbool checkk(string a , string b,int n)\n{\n int countm(0),countl(0)\n bool vis1[n];\n bool vis2[n];\n for(int i=0;i>n;\n string s; cin>>s;\n string first = s.substr(0,n);\n string second = s.substr(n+1,2n);\n int s1(0),s2(0);\n for(int i=0;i\n#define int long long\n#define db long double\n#define x first\n#define y second\n#define mp make_pair\n#define pb push_back\n#define all(a) a.begin(), a.end()\n\nusing namespace std;\n\nconst int K = 5007;\n\nint cnt[K], rcnt[K];\nint cl[K];\n\nint get(int l, int r){\n\tif (l > r) return 0;\n\treturn cnt[r] - cnt[l-1];\n}\n\nint pref[K];\n\nvector > min_remainder[K];\n\npair get_opt(pair a, pair b){\n\tif (a.first > b.first) return {a.first, max(a.second, b.first)};\n\treturn {b.first, max(b.second, a.first)};\n\nconst int INF = -1;\n\nmain(){\n#ifdef LOCAL\n\tfreopen(\"C_input.txt\", \"r\", stdin);\n\t//freopen(\"C_output.txt\", \"w\", stdout);\n#endif\n\tios_base::sync_with_stdio(0);\n\tcin.tie(0);\n\tint n;\n\tcin >> n;\n\tvector v(n);\n\tfor (int i=0;i> v[i];\n\tsort(v.begin(), v.end());\n\tint u = 0;\n\tfor (int i=0;i > min_here;\n\t\tvector starts;\n\t\tfor (int j=i; j < K; j += i){\n\t\t\tstarts.push_back(j);\n\t\t}\n\t\tstarts.push_back(K);\n\t\tfor (int j=starts.size()-2; j >= 0; j--){\n\t\t\tint nxt = starts[j+1];\n\t\t\tint el = starts[j];\n\t\t\tint A = cl[nxt-1];\n\t\t\tif (A < el) A = INF; \n\t\t\tint B = INF;\n\t\t\tif (A!=INF) {\n\t\t\t\tif (rcnt[A] > 1) B = A;\n\t\t\t\telse{\n\t\t\t\t\tB = cl[A-1];\n\t\t\t\t\tif (B < el) B = -1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (A!=INF) A = A%i;\n\t\t\tif (B!=INF) B = B%i;\n\t\t\t//if (i==2005) cout << A << \" \" << B << endl;\n\t\t\tif (!min_here.size()) min_here.push_back({A, B});\n\t\t\telse min_here.push_back(get_opt(min_here.back(), {A, B}));\n\t\t}\n\t\treverse(min_here.begin(), min_here.end());\n\t\tmin_remainder[i] = min_here;\n\t}\n\n\n\tfor (int i=1; i < K; ++i) cnt[i] += cnt[i-1];\n\tfor (int i=2; i < K; ++i){\n\t\tint ss = 0;\n\t\tfor (int j=i; j < K; j += i){\n\t\t\tint L = j, R = min(K-1, j+i-1);\n\t\t\tss += get(L, R) * (j/i);\n\t\t}\n\t\tpref[i] = ss;\n\t}\n\tint ans = 0;\n\tfor (int take=2; take < K; ++take){\n\t\tint tut = 0;\n\t\tint L = 1, R = K;\n\t\twhile (R-L>1){\n\t\t\tint M = (L+R)/2;\n\t\t\tint how = pref[M];\n\n\n\t\t\tint closest = ((take+M-1)/M)*M;\n\n\n\t\t\tif (2*take < K){\n\t\t\t\tint closest = ((2*take+M-1)/M)*M;\n\t\t\t\tint A;\n\t\t\t\tif (closest >= K){\n\t\t\t\t\tclosest = K-1;\n\t\t\t\t\tA = cl[closest-1];\n\t\t\t\t\tif (A < 2*take) A = INF;\n\n\t\t\t\t\tif (A < M) A = INF;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tA = cl[closest-1];\n\t\t\t\t\tif (A < 2*take) A = INF;\n\n\t\t\t\t\tif (A < M) A = INF;\n\n\t\t\t\t\tif (A!=INF) A = A%M;\n\t\t\t\t\tpair Q = min_remainder[M][closest/M-1];\n\n\n\t\t\t\t\tA = max(Q.first, A);\n\t\t\t\t}\n\t\t\t\tif (A!=INF){\n\t\t\t\t\tint spend = max(0ll, (2*take-A+M-1)/M);\n\n\n\t\t\t\t\tint e = how-spend;\n\n\t\t\t\t\tif (e >= take) L = M;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tint A, B;\n\t\t\tpair Q;\n\n\t\t\tif (closest >= K){\n\t\t\t\tclosest = K-1;\n\t\t\t\tA = cl[closest-1];\n\t\t\t\tif (A < take) A = INF;\n\t\t\t\tB = INF;\n\t\t\t\tif (A!=INF){\n\t\t\t\t\tif (rcnt[A] > 1) B = A;\n\t\t\t\t\telse{\n\t\t\t\t\t\tB = cl[A-1];\n\t\t\t\t\t\tif (B < take) B = INF;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (A!=INF) A = A%M;\n\t\t\t\tif (B!=INF) B = B%M;\n\t\t\t\tQ={A, B};\n\t\t\t}\n\n\t\t\telse{\n\n\t\t\t\tA = cl[closest-1];\n\t\t\t\tif (A < take) A = INF;\n\t\t\t\tB = INF;\n\t\t\t\tif (A!=INF){\n\t\t\t\t\tif (rcnt[A] > 1) B = A;\n\t\t\t\t\telse{\n\t\t\t\t\t\tB = cl[A-1];\n\t\t\t\t\t\tif (B < take) B = INF;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\n\t\t\t\tif (A!=INF) A = A%M;\n\t\t\t\tif (B!=INF) B = B%M;\n\n\n\t\t\t\tQ = min_remainder[M][closest/M-1];\n\t\t\t\tQ = get_opt(Q, {A, B});\n\t\t\t}\n\n\t\t\t//if (take==2) cout << M << \" \" << A << \" \" << B << \" \" << Q.first << \" \" << Q.second << \" \" << how << endl;\n\n\t\t\tif (Q.second == INF){\n\t\t\t\tR = M;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tA = Q.first, B = Q.second;\n\n\t\t\tint spend = max(0LL, (take-A+M-1)/M) + max(0LL, (take-B+M-1)/M);\n\n\t\t\t//if (take==2) cout << spend << endl;\n\n\t\t\thow -= spend;\n\n\t\t\tif (how >= take) L = M;\n\t\t\telse R = M;\n\t\t}\n\t\tif (L > 1) ans = max(ans, L*take);\n\n\t}\n\tcout << ans;\n\n}\n", "lang": "GNU C++14", "bug_code_uid": "903da5f81c8fef06d48e0dd02c8fc727", "src_uid": "bca20e0910e9fe4d89326b50ab45e4ca", "apr_id": "99c454e05a2165a18ca91a1ed6a010d9", "difficulty": 3200, "tags": ["math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "#include \n#include \n#include \n#include \n#include \nusing namespace std;\n#define ll long long\n\nconst int maxn = 3e5;\nll n;\nint mod = 993244853;\nll gao(ll num){\n\tll res = 1;\n\tfor(int i = 2;i<=num;i++)\n\t{\n\t\tres*=i;\n\t\tres%=mod;\n\t}\n\treturn res;\n}\n\n\nint main()\n{\n\tscanf(\"%lld%lld\",&n,&mod);\n\tll res = 0;\n\tfor(int i = 1;i<=n;i++)\n\t{\n\t\tll tmp = gao(i);\n\t\ttmp%=mod;\n\t\ttmp*=gao(n-i+1);\n\t\ttmp%=mod;\n\t\ttmp*=n-i+1;\n\t\ttmp%=mod;\n\t\tres+=tmp;\n\t\tres%=mod;\n\t}\n\tprintf(\"%lld\\n\",res);\n\t\n\n\n\n\n\n\treturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "378c0880b5cd6ce954c249f3ff112eb8", "src_uid": "020d5dae7157d937c3f58554c9b155f9", "apr_id": "2c62925fdb6c6925a55a3d00ec0d4da6", "difficulty": 1600, "tags": ["math", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.11086226203807391, "equal_cnt": 22, "replace_cnt": 17, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 22, "bug_source_code": "#include \n\n#define MAX_N 5001\n#define MAX_M 5001\n\ntypedef struct\n{\n\tint newcolor;\n\tint color;\n\tint count;\n} loc;\n\nloc chessboard[MAX_N][MAX_M];\n\nint main()\n{\n\tint N, M;\n\tlong int X;\n\tscanf(\"%d %d %ld\", &N, &M, &X);\n\tfor(int a = 0; a < N; a++)\n\t\tfor(int b = 0; b < M; b++)\n\t\t{\n\t\t\tchessboard[a][b].color = -1;\n\t\t\tchessboard[a][b].newcolor = -1;\n\t\t\tchessboard[a][b].count = 0;\n\t\t\tif(a % 2 == b % 2)\n\t\t\t{\n\t\t\t\tchessboard[a][b].color = 0;\n\t\t\t\tchessboard[a][b].count = 1;\n\t\t\t\tchessboard[a][b].newcolor = 0;\n\t\t\t}\n\t\t}\n\n\tfor(int i = 1; ; i++)\n\t{\n\t\tbool changed = false;\n\t\tfor(int a = 1; a < N-1; a++)\n\t\t\tfor(int b = 1; b < M-1; b++)\n\t\t\t{\n\t\t\t\tif(a % 2 == b % 2 && chessboard[a-1][b+1].color == i-1 && chessboard[a-1][b-1].color == i-1 && chessboard[a+1][b-1].color == i-1 && chessboard[a+1][b+1].color == i-1)\n\t\t\t\t{\n\t\t\t\t\tchanged = true;\n\t\t\t\t\tchessboard[a][b].newcolor = i;\n\t\t\t\t\tchessboard[a][b].count++;\n\t\t\t\t}\n\t\t\t}\n\t\tfor(int a = 1; a < N-1; a++)\n\t\t\tfor(int b = 1; b < M-1; b++)\n\t\t\t{\n\t\t\t\t\tchessboard[a][b].color = chessboard[a][b].newcolor;\n\t\t\t}\n\t\tif(!changed)\n\t\t\tbreak;\n\t}\n\n\tlong int squares = 0;\n\tfor(int a = 0; a < N; a++)\n\t\tfor(int b = 0; b < M; b++)\n\t\t{\n\t\t\tif(chessboard[a][b].count == X)\n\t\t\t\tsquares++;\n\t\t}\n/*\n\tfor(int a = 0; a < N; a++)\n\t{\n\t\tfor(int b = 0; b < M; b++)\n\t\t{\n//\t\t\tif(chessboard[a][b].color == 0)\n\t\t\t\tprintf(\"%d\", chessboard[a][b].count);\n\t//\t\telse\n//\t\t\t\tprintf(\"w\");\n\t\t}\n\t\tprintf(\"\\n\");\n\t}*/\n\tprintf(\"%ld\", squares);\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "774f688a0c97d60ffc843e753b589a6c", "src_uid": "fa1ef5f9bceeb7266cc597ba8f2161cb", "apr_id": "cc5e19b6cf1b40e684ea5e16dcc2962b", "difficulty": 1600, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9522409992652462, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nint main() {\n\tint n;\n\tstring s;\n\tcin >> n >> s;\n\tvector ans;\n\tint mem;\n\tif (s.size() < 3) {\n\t\tcout << s;\n\t\treturn 0;\n\t}\n\tfor (int i = 0; i < n - 2; i++) {\n\t\twhile (s.substr(i, 3) != \"ogo\") {\n\t\t\tans.push_back(s[i]);\n\t\t\ti++;\n\t\t}\n\t\tans.push_back('*');\n\t\tans.push_back('*');\n\t\tans.push_back('*');\n\t\ti += 3;\n\t\tbool b = 0;\n\t\twhile (s.substr(i, 2) == \"go\") {\n\t\t\ti += 2;\n\t\t\tb = 1;\n\t\t}\n\t\ti--;\n\t\tmem = i;\n\t}\n\tfor (int i = mem + 1; i < n; i++)\n\t\tans.push_back(s[i]);\n\tfor (int i = 0; i < ans.size(); i++)\n\t\tcout << ans[i];\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "3ff4fdf5dd324025361e9152ca45fcfd", "src_uid": "619665bed79ecf77b083251fe6fe7eb3", "apr_id": "ad3a7a9d52646c86fd243f437d18fbc5", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.2968617472434266, "equal_cnt": 10, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 9, "bug_source_code": "#include \n\nusing namespace std;\n\nstring s, ss;\nmap mp;\nlong long ans;\n\nint main()\n{\n mp['>']=\"1000\";\n mp['<']=\"1001\";\n mp['+']=\"1010\";\n mp['-']=\"1011\";\n mp['.']=\"1100\";\n mp[',']=\"1101\";\n mp['[']=\"1110\";\n mp[']']=\"1111\";\n cin >> s;\n for (int i=0;i1000003)\n ans-=1000003;\n }\n h--;\n }\n cout << ans;\n}\n", "lang": "GNU C++11", "bug_code_uid": "34610d9a349e52bfa898ca75bba4b73c", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "apr_id": "e5aad486265f0d1f7c5de1291bdd82b8", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.6200676437429538, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "#include\n#include\nusing namespace std;\nint main ()\n{while (1)\n\t{short int N=0,i=0,S=0,a=0,sum=0,index=0;\n\tcin>>N>>S;\n\tshort int arry[101]={0};\n\tfor(i=0;i>arry[i];\n\t \n\t for(i=0;iS)\n\tcout<<\"NO\"<\n\nusing namespace std;\ntypedef long long ll;\nll ms[101][101][101][101]={0};\n\nint n1,n2,k1,k2;\n\nll f(int q1,int q2,int s1,int s2)\n{\n if(ms[q1][q2][s1][s2]!=0) return ms[q1][q2][s1][s2];\n if(s1>k1 || s2>k2 || q1>n1 || q2>n2) return 0;\n if(q1==n1 && q2==n2) return 1;\n return ms[q1][q2][s1][s2]=f(q1+1, q2, s1+1,0)+f(q1,q2+1,0,s2+1);\n\n}\n\n\nint main()\n{\n cin>>n1>>n2>>k1>>k2;\n cout<\nusing namespace std;\nint main(){\n int k,a,b,v;cin>>k>>a>>b>>v;\n int ans=0;\n while(a){\n int z=min(k-1,b);\n b-=z;\n z++;\n a-=v*z;\n ans++;\n }\n cout<\n#include\n#include\nusing namespace std;\n#define ll long long\n#define MAX 1000007\n#define pb(x) push_back(x)\n#define mp(x,y) make_pair(x,y)\n#define vii vector\n#define vll vector\n#define vp vector >\n#define v_min(a) *min_element(a.begin(),a.end())\n#define v_max(a) *max_element(a.begin(),a.end())\n#define v_sum(a) accumulate(a.begin(),a.end(),0)\n#define un(a) a.erase(unique(a.begin(),a.end()),a.end())\n#define SORT(a) sort(a.begin(),a.end())\n#define AHNAF ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)\n#define gcd(a,b) __gcd(a,b)\n#define lcm(a,b) ((a)*(b))/gcd(a,b)\n#define YES cout<<\"YES\"<>t;while(t--)\n#define reverse(a) reverse(a.begin(),a.end())\n#define ff first\n#define ss second\n#define print(a) for(auto it: a) cout<>it\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}; ///King's move\n///const int fy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move\n///const int fx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's move\n///const int fy[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's move\n///---------------------------------------------------------------\n\nint main()\n{\n AHNAF;\n int a,b,c;\n cin>>a>>b>>c;\n for(int i=1; i<=500; i++)\n {\n vector v(MAX,0);\n for(int j=0; j<=50; j++)\n {\n v[i+(j*a)]=1;\n }\n for(int j=1; j<=500; j++)\n {\n vector vv(MAX,0);\n for(int k=0; k<=50; k++)\n {\n vv[j+(k*b)]=1;\n }\n bool cc=true;\n for(int k=1; k<=500; k++)\n {\n for(int l=0; l<=5; l++)\n {\n if(v[k+(l*c)]==0 && vv[k+(l*c)]==0) {\n cc=false;\n break;\n }\n }\n if(cc) {\n YES;\n return 0;\n }\n }\n }\n }\n NO;\n}\n\n\n", "lang": "GNU C++14", "bug_code_uid": "7d1d72854728e3926f4fc177b1f68dff", "src_uid": "df48af9f5e68cb6efc1214f7138accf9", "apr_id": "5f5d66eb32bf6c257cde5a9912212404", "difficulty": 1400, "tags": ["brute force", "constructive algorithms"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9032016476315297, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "//==========================================================================\n//\n// Bismillahir-Rahmanir-Rahim\n//\n// ==========================================================================\n#include \n#define ll long long\n#define f(x,y,z) for(int x=y;x\n#define pll pair\n#define CLR(a) memset(a,0,sizeof(a))\n#define SET(a) memset(a,-1,sizeof(a))\n#define N 1000010\n#define M 1000000007\n#define pi acos(-1.0)\n#define ff first\n#define ss second\n#define pb push_back\n#define inf (int)1e9\nusing namespace std;\nint dx[]={0,0,1,-1,-1,-1,1,1};\nint dy[]={1,-1,0,0,-1,1,1,-1};\ntemplate < class T> inline T biton(T n,T pos){return n |((T)1< inline T bitoff(T n,T pos){return n & ~((T)1< inline T on(T n,T pos){return (bool)(n & ((T)1< inline T gcd(T a, T b){while(b){a%=b;swap(a,b);}return a;}\ntemplate string NumberToString ( T Number ) { ostringstream ss; ss << Number; return ss.str(); }\ninline int nxt(){int aaa;scanf(\"%d\",&aaa);return aaa;}\ninline ll lxt(){ll aaa;scanf(\"%lld\",&aaa);return aaa;}\ntemplate inline T bigmod(T p,T e,T m){T ret = 1;\nfor(; e > 0; e >>= 1){\n if(e & 1) ret = (ret * p) % m;p = (p * p) % m;\n} return (T)ret;}\n#define sayed\n#ifdef sayed\n #define debug(args...) {cerr<<\"Debug: \"; dbg,args; cerr< debugger& operator , (const T& v){\n cerr<>n;\n if(leap(n)) cout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nint size_n;\nint upper = 0, lower = 0;\n\nvector > el(0);\n\nint main()\n{\n\tint ii;\n\n\tcin >> size_n;\n\n\tel.resize(size_n);\n\n\tfor (ii = 0; ii < size_n; ii++)\n\t{\n\t\tcin >> el[ii].first >> el[ii].second;\n\n\t\tupper += el[ii].first;\n\t\tlower += el[ii].first;\n\t}\n\n\tif ((((upper % 2) == (lower % 2))) && ((upper % 2) == 0))\n\t\tcout << \"0\";\n\telse if ((upper % 2) == (lower % 2))\n\t\tcout << \"-1\";\n\telse\n\t{\n\t\tfor (ii = 0; ii < size_n; ii++)\n\t\t{\n\t\t\tif ((el[ii].first % 2) != (el[ii].second % 2))\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif ((el[ii].first % 2) != (el[ii].second % 2))\n\t\t\tcout << \"1\";\n\t\telse\n\t\t\tcout << \"-1\";\n\t}\n\n\treturn 0;\n}", "lang": "MS C++", "bug_code_uid": "bf12d7f648e07db2f73eb42a81efedd9", "src_uid": "f9bc04aed2b84c7dd288749ac264bb43", "apr_id": "79d8f33f4f7a2ee07c651fc9373e18f3", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9959745051995974, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \n#include \n#include \nusing namespace std;\nusing ll = long long;\nconst int MOD = 998244353;\n\nclass SegTree {\n\tprivate:\n\t\tstruct El {\n\t\t\tint p[2][2]; // Probability that leftmost is L/R and rightmost is L/R\n\t\t\tEl() {\n\t\t\t\tp[0][0] = 0;\n\t\t\t\tp[0][1] = 0;\n\t\t\t\tp[1][0] = 0;\n\t\t\t\tp[1][1] = 0;\n\t\t\t}\n\t\t\tstatic El id() {\n\t\t\t\tEl res;\n\t\t\t\tres.p[0][0] = 1;\n\t\t\t\tres.p[1][1] = 1;\n\t\t\t\treturn res;\n\t\t\t}\n\t\t};\n\t\tstatic El combine(const El& le, const El& ri) {\n\t\t\tEl res;\n\t\t\tfor (int a = 0; a < 2; ++a) {\n\t\t\t\tfor (int b = 0; b < 2; ++b) {\n\t\t\t\t\tfor (int i = 0; i < 2; ++i) {\n\t\t\t\t\t\tres.p[a][b] = (res.p[a][b] + (ll)le.p[a][i] * ri.p[i][b]) % MOD;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\t\tvoid update(int i) {\n\t\t\tfor (i >>= 1; i > 0; i >>= 1) seg[i] = combine(seg[2*i], seg[2*i+1]);\n\t\t}\n\n\t\tvector seg;\n\t\tint h = 1;\n\tpublic:\n\t\tSegTree(int n) {\n\t\t\twhile(h < n) h *= 2;\n\t\t\tseg.resize(2*h, El::id());\n\t\t}\n\n\t\tint prob(int i, int a, int b) {\n\t\t\ti += h;\n\t\t\tEl backup = seg[i];\n\t\t\tfor (int x = 0; x < 2; ++x) {\n\t\t\t\tfor (int y = 0; y < 2; ++y) {\n\t\t\t\t\tif (x != a || y != b) seg[i].p[x][y] = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tupdate(i);\n\n\t\t\tll res = (seg[1].p[0][0] + seg[1].p[0][1]) % MOD;\n\n\t\t\tseg[i] = backup;\n\t\t\tupdate(i);\n\t\t\treturn res;\n\t\t}\n\t\tvoid setv(int i, int a, int b, int c, int d) {\n\t\t\ti += h;\n\t\t\tseg[i].p[0][0] = a;\n\t\t\tseg[i].p[0][1] = b;\n\t\t\tseg[i].p[1][0] = c;\n\t\t\tseg[i].p[1][1] = d;\n\t\t\tupdate(i);\n\t\t}\n\t\tvoid zero(int i, int a, int b) {\n\t\t\ti += h;\n\t\t\tseg[i].p[a][b] = 0;\n\t\t\tupdate(i);\n\t\t}\n};\n\nll modPow(ll a, ll b) {\n\tif (b & 1) return a * modPow(a, b-1) % MOD;\n\tif (b > 0) return modPow(a*a % MOD, b / 2);\n\treturn 1;\n}\n\nstruct Atom {\n\tint xi, vi, pi;\n};\n\nstruct Rat {\n\tll a, b;\n\n\t// a / b < rhs.a / rhs.b?\n\tbool operator<(const Rat& rhs) const {\n\t\treturn a * rhs.b < b * rhs.a;\n\t}\n\tll modv() const { return a * modPow(b, MOD-2) % MOD; }\n};\n\nint main() {\n\tios_base::sync_with_stdio(false);\n\tcin.tie(0);\n\n\tint n;\n\tcin >> n;\n\n\tSegTree seg(n);\n\n\tvector atoms(n);\n\tfor (auto& v : atoms) cin >> v.xi >> v.vi >> v.pi;\n\n\tconst ll HI = modPow(100, MOD - 2);\n\tfor (int i = 0; i < n; ++i) {\n\t\tint prob0 = (100 - atoms[i].pi) * HI % MOD;\n\t\tint prob1 = atoms[i].pi * HI % MOD;\n\t\tseg.setv(i, prob0, prob1, prob0, prob1);\n\t}\n\n\tvector>>> que;\n\tfor (int i = 0; i+1 < n; ++i) {\n\t\tll dist = atoms[i+1].xi - atoms[i].xi;\n\t\tfor (int a = 0; a < 2; ++a) {\n\t\t\tfor (int b = 0; b < 2; ++b) {\n\t\t\t\tll vel = (a ? 1 : -1) * atoms[i].vi + (b ? -1 : 1) * atoms[i+1].vi;\n\t\t\t\tRat r = {dist, vel};\n\t\t\t\tif (vel > 0) que.push_back({r, {i, {a, b}}}); // Collision eventually happens\n\t\t\t}\n\t\t}\n\t}\n\tsort(que.begin(), que.end());\n\n\tll res = 0;\n\tfor (auto pr : que) {\n\t\tll t = pr.first.modv();\n\t\tint i = pr.second.first;\n\t\tint a = pr.second.second.first;\n\t\tint b = pr.second.second.second;\n\n\t\tll prob = seg.prob(i+1, a, b);\n\t\tres = (res + prob * t) % MOD;\n\t\tseg.zero(i+1, a, b);\n\n\t\t// cerr << \"event \" << i << ' ' << a << ' ' << b << \": \" << t << ' ' << prob << '\\n';\n\t}\n", "lang": "GNU C++17", "bug_code_uid": "b9aa14bff620635804014fd49ffc2ac2", "src_uid": "37bb4fe5f6cc2a173e97c033c6fde8c7", "apr_id": "f39dbc731a5fff38147f670238eac9bd", "difficulty": 3100, "tags": ["data structures", "probabilities", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9752442996742671, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "#include\n#define ls ch[x][0]\n#define rs ch[x][1]\n#define ll long long\n#define int ll\nusing namespace std;\n\ninline ll read(){\n\tll num=0,neg=1;char c=getchar();\n\twhile(!isdigit(c)){if(c=='-')neg=-1;c=getchar();}\n\twhile(isdigit(c)){num=(num<<3)+(num<<1)+c-'0';c=getchar();}\n\treturn num*neg;\n}\n\nconst ll mod=998244353;\nstruct mat{\n\tint a[2][2];\n\tmat(){memset(a,0,sizeof(a));}\n}tree[100010<<2];\n\nconst ll INF=0x7f7f7f7f7f7f7f;\nstruct node{\n\tint pos,p1,p2,val;\n\tdouble t;\n}side[400010];int cnt;\nll ans,x[100010],v[100010],p[100010],n;\n\nbool cmp1(node x,node y){return x.t>=1;\n\t}return res;\n}\ninline mat mul(mat x,mat y){\n\tmat res;\n\tfor(int i=0;i<=1;i++)\n\tfor(int j=0;j<=1;j++)\n\tfor(int k=0;k<=1;k++)\n\t\tres.a[i][j]=(res.a[i][j]+x.a[i][k]*y.a[k][j]%mod)%mod;\n\treturn res;\n}\ninline void insert(int pos,int p1,int p2){\n\tside[++cnt].pos=pos;\n\tside[cnt].p1=p1,side[cnt].p2=p2;\n\tif(p1==0&&p2==0){\n\t\tint tmp=v[pos]-v[pos-1];\n\t\tif(tmp>0) side[cnt].val=(x[pos]-x[pos-1])*qpow(tmp,mod-2)%mod,side[cnt].t=(x[pos]-x[pos-1])*1.0/tmp;\n\t\telse side[cnt].val=INF,side[cnt].t=1e20;\n\t}\n\tif(p1==0&&p2==1) side[cnt].val=INF,side[cnt].t=1e20;\n\tif(p1==1&&p2==0) side[cnt].val=(x[pos]-x[pos-1])%mod*qpow((v[pos]+v[pos-1])%mod,mod-2)%mod,side[cnt].t=(x[pos]-x[pos-1])*1.0/(v[pos-1]+v[pos]);\n\tif(p1==1&&p2==1){\n\t\tint tmp=v[pos-1]-v[pos];\n\t\tif(tmp>0) side[cnt].val=(x[pos]-x[pos-1])*qpow(tmp,mod-2)%mod,side[cnt].t=(x[pos]-x[pos-1])*1.0/tmp;\n\t\telse side[cnt].val=INF,side[cnt].t=1e20;\n\t}\n}\ninline void push_up(int x){tree[x]=mul(tree[x<<1],tree[x<<1|1]);}\ninline void build(int l,int r,int x){\n\tif(l==r){\n\t\ttree[x].a[0][0]=tree[x].a[1][0]=(1-p[l]+mod)%mod;\n\t\ttree[x].a[0][1]=tree[x].a[1][1]=p[l];\n\t\treturn;\n\t}int mid=l+r>>1;\n\tbuild(l,mid,x<<1),build(mid+1,r,x<<1|1);\n\tpush_up(x);return;\n}\ninline void update(int u,int p1,int p2,int l,int r,int x){\n\tif(l==r){tree[x].a[p1][p2]=0;return;}\n\tint mid=l+r>>1;\n\tif(u<=mid) update(u,p1,p2,l,mid,x<<1);\n\telse update(u,p1,p2,mid+1,r,x<<1|1);\n\tpush_up(x);return;\n}\ninline mat query(int ql,int qr,int l,int r,int x){\n\tif(ql>qr){\n\t\tmat res;res.a[0][0]=res.a[1][1]=1;\n\t\treturn res;\n\t}\n\tif(ql<=l&&qr>=r) return tree[x];\n\tint mid=l+r>>1;mat res;res.a[0][0]=res.a[1][1]=1;\n\tif(ql<=mid) res=mul(res,query(ql,qr,l,mid,x<<1));\n\tif(qr>mid) res=mul(res,query(ql,qr,mid+1,r,x<<1|1));\n\treturn res;\n}\n\nsigned main(){\n\tn=read();\n\tfor(int i=1;i<=n;i++) x[i]=read(),v[i]=read(),p[i]=read()*qpow(100ll,mod-2)%mod;\t\n\tbuild(1,n,1);\n\tfor(int i=2;i<=n;i++) for(int j=0;j<=1;j++) for(int k=0;k<=1;k++) insert(i,j,k);\n\tsort(side+1,side+cnt+1,cmp1);\n\t\n\t\n\tfor(int i=1;i<=cnt;i++){\n\t\tif(side[i].val==INF) break;\n\t\tmat trans;\n\t\ttrans.a[side[i].p1][side[i].p2]=(side[i].p2?p[side[i].pos]:(1-p[side[i].pos]+mod)%mod);\n\t\ttrans=mul(query(1,side[i].pos-1,1,n,1),trans);\n\t\ttrans=mul(trans,query(side[i].pos+1,n,1,n,1));\n\t\tans+=(trans.a[0][0]+trans.a[0][1])%mod*side[i].val%mod;ans%=mod;\n\t\tupdate(side[i].pos,side[i].p1,side[i].p2,1,n,1);\n\t}printf(\"%lld\\n\",ans);return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "e1b24e22a09ff8305e846917a379564f", "src_uid": "37bb4fe5f6cc2a173e97c033c6fde8c7", "apr_id": "91b150d0e13cbb2ca92e5aa04cbf5338", "difficulty": 3100, "tags": ["data structures", "probabilities", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9615384615384616, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "#include \n#include \nusing namespace std;\nint main()\n{\n string ch;\n int i;\n string st2=\".\";\n cin>>ch; //deleting vowels\n for(i=0;i\n#include\n#include\n#include\n#include\n#include\n\nusing namespace std;\n\n\nint main()\n{\n long long n, m, x, y, a, b, x1, y1, x2, y2 ;\n long long s, e, mid;\n long long i, j, k;\n bool found;\n\n\n cin >> n >> m >> x >> y >> a >> b;\n\n if (b > a)\n {\n j = b;\n i = a;\n }\n else\n {\n j = a;\n i = b;\n }\n\n while (j % i != 0)\n {\n k = j % i;\n j = i;\n i = k;\n // cout << i << \" \" << j << endl;\n }\n\n //cout << i << endl;\n a = a / i;\n b = b / i;*/\n\n\n if (a == b)\n {\n a = 1;\n b = 1;\n }\n\n s = 1;\n e = n;\n\n while (s < e-1)\n {\n mid = (s+e) / 2;\n if ((mid * a <= n) && (mid * b <= m)) // \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\n s = mid;\n else\n e = mid;\n\n }\n\n a = a*s;\n b = b*s;\n\n if (a%2 == 0)\n x1 = x - (a/2);\n else\n x1 = x - (a/2) - 1;\n\n x2 = x1 + a ;\n\n if (b%2 == 0)\n y1 = y - (b/2);\n else\n y1 = y - (b/2) - 1;\n\n y2 = y1 + b;\n\n if (x1 < 0)\n {\n x1 = 0;\n x2 = a;\n }\n\n if (x2 > n)\n {\n x1 = n - a;\n x2 = n;\n }\n\n if (y1 < 0)\n {\n y1 = 0;\n y2 = b;\n }\n\n if (y2 > n)\n {\n y1 = m - b;\n y2 = m;\n }\n\n\n cout << x1 << \" \" << y1 << \" \" << x2 << \" \" << y2 << endl;\n return 0;\n\n\n\n}\n", "lang": "GNU C++", "bug_code_uid": "1335a9132ba1cb33f4f40fc30eaed622", "src_uid": "8f1211b995f35462ae83b2be27f54585", "apr_id": "b337d1bbdc855c451f633dd040a4e966", "difficulty": 1700, "tags": ["math", "ternary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.010430247718383311, "equal_cnt": 3, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "#include \"stdio.h\"\n\n\nvoid main(void )\n{\n printf(\"HelloWorld!\"); \n\n} \n\n\t \t\t \t\t\t \t \t \t\t \t\t \t \t\t\t", "lang": "GNU C++11", "bug_code_uid": "d04b78ec9a005a0246cb1c9bfd176217", "src_uid": "52b8d97f216ea22693bc16fadcd46dae", "apr_id": "948752e83ad162ffc0c32d88df5d0ad5", "difficulty": 2500, "tags": ["constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.996, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n int n;\n int counter=0;\n cin>>n;\n for(int i=0;i\n#include\nusing namespace std;\nint main(){\nlong long\tint a1,a2,a3,b1,b2,b3,i,n,c,c1,t1,t2,z1,z2;\n\t\n\t\n\n\t\tcin>>a1>>a2>>a3;\n\t\tcin>>b1>>b2>>b3;\n\t\tcin>>n;\n\t\tz1=a1+a2+a3;\n\t\tz2=b1+b2+b3;\n\t\tif(z1<=5){\n\t\t\t\n\t\t\tc=1;}\n\t\t\t\n\t\t\telse{\n\t\t\t\tif(z1%5==0){\n\t\t\t\t\tc=z1/5;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tc=z1/5+1;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tif(z2<=5){\n\t\t\t\n\t\t\tc1=1;}\n\t\t\t\n\t\t\telse{\n\t\t\t\tif(z2%10==0){\n\t\t\t\t\tc1=z2/10;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tc1=z2/10+1;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\tif(c+c1<=n){\n\t\t\tcout<<\"YES\";\n\t\t\t\n\t\t\t\n\t\t}\n\t\telse{\n\t\t\tcout<<\"NO\";\n\t\t\t\n\t\t}\n\n}\n", "lang": "GNU C++11", "bug_code_uid": "0e600140c7fea023f421192f0d5bf9bc", "src_uid": "fe6301816dea7d9cea1c3a06a7d1ea7e", "apr_id": "1871090a7050c57b964acc7e63cb4c50", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.6867305061559508, "equal_cnt": 14, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 13, "bug_source_code": "/*--------------------------------------------------------\n Author:log \n Created Time:2016\u5e7403\u670807\u65e5 \u661f\u671f\u4e00 16\u65f658\u520646\u79d2\n--------------------------------------------------------*/\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nconst int maxn=105*105;\n\nint d[maxn][maxn];\nint q[maxn];\nint bfs(int a,int b){\n\tint l=0,r=0;\n\tq[r++]=a*100+b;\n\tint ans=-1;\n\twhile(l0&&b+1>0){d[a-2][b+1]=d[a][b]+1;q[r++]=(a-2)*100+b+1;}\n\t\tif(a+1>0&&b-2>0){d[a+1][b-2]=d[a][b]+1;q[r++]=(a+1)*100+b-2;}\n\t}\n\treturn ans;\n}\n\nint main(){\n\tint a,b;\n\tscanf(\"%d %d\",&a,&b);\n\tmemset(d,-1,sizeof(d));\n\td[a][b]=0;\n\tprintf(\"%d\\n\",bfs(a,b)+1);\n\treturn 0;\n}\n\n", "lang": "GNU C++11", "bug_code_uid": "a9be7376b38ad972ae89aedd4cd7537d", "src_uid": "ba0f9f5f0ad4786b9274c829be587961", "apr_id": "6a8e106c32cd4c424deab017311e8488", "difficulty": 1100, "tags": ["dp", "greedy", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.3011478730587441, "equal_cnt": 23, "replace_cnt": 22, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 23, "bug_source_code": "#include \n#include \nusing namespace std;\n\ntypedef long long ll;\n\nbool found = false;\nvector jawab;\n\n\nvoid dfs(ll u,ll maks,bool *visited)\n{\n if ((u<=maks)&&(!found)&&(!(*(visited+u))))\n {\n *(visited+u) = true;\n jawab.push_back(u);\n if (u==maks) found = true;\n else\n {\n dfs(2*u,maks,visited);\n if (!found) dfs(10*u+1,maks,visited);\n if (!found) jawab.pop_back();\n }\n }\n}\n\nint main()\n{\n ll a,b;\n cin >> a >> b;\n bool visited[b+1];\n for (ll i=a;i<=b;++i) visited[i] = false;\n dfs(a,b,visited);\n if (found)\n {\n cout << \"YES\" << endl << jawab.size() << endl << jawab[0];\n for (ll i=1;i\n#include\n#include\n\nusing namespace std;\n\ntypedef long long LL;\n\nint inf = 1000000009;\n\nint findB(int x, int y, int a){\n \n LL low = -inf;\n LL high = inf;\n LL val, mid;\n\n while(low < high){\n mid = (low + high)/2;\n \n val = x - y - 2*a*mid;\n if( val < 0){\n high = mid;\n }\n else low = mid+1;\n }\n \n return low;\n}\n\nint findA(int x, int y, int a){\n \n LL low = -inf;\n LL high = inf;\n LL val, mid;\n\n while(low < high){\n mid = low + (high-low)/2;\n \n val = x + y - 2*a*mid;\n if( val < 0){\n high = mid;\n }\n else low = mid+1;\n }\n \n return low;\n}\nint main(){\n\n int a, b, x1, y1, x2, y2;\n int a1, a2, b1, b2, ret;\n \n cin>> a >> b >> x1>> y1 >> x2 >> y2;\n\n a1 = findA(x1, y1, a);\n //cout<< a1<\nusing namespace std;\n\nconst int OO = 0x3f3f3f3f,N = 1e2+5,mod = 1e9+7 ;\n#define read(FILE) freopen(FILE, \"r\", stdin);\n#define write(FILE) freopen(FILE, \"w\", stdout);\n#define BeatMeIFUCAN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);\n\nint t1 ,t2 ,x1 ,x2 ,t0 ,a ,b ;\nlong long temprt(long long y1,long long y2){\n return(y1*t1+y2*t2)/(y1+y2);\n}\nbool can(int y1,int y2){\n long long c1=(0ll+a+b)*(1ll*y1*t1+1ll*y2*t2) ;\n long long c2=(0ll+y1+y2)*(1ll*a*t1+1ll*b*t2) ;\n if(c1c2)return 0;\n return (y1+y2)>(a+b);\n}\nint main(){\n cin>>t1>>t2>>x1>>x2>>t0;\n a=0 ,b=x2;\n for(int y1=1;y1<=x1;++y1){\n long long y2= 1ll*y1*(t0-t1) / (t2-t0) ;\n y2+=((!y1)&&(!y2));\n while(y2=t0&&can(y1,y2))a=y1 ,b=y2;\n }\n cout<\n#include \n#define ff first\n#define ss second\n#define pb push_back\n#define mp make_pair\n#define REP(i,n) for(long long i=1; i<=n; i++)\n#define rep(i,a,b) for(long long i=a; i vll;\ntypedef pair pll;\ntypedef unsigned long int uli;\ntypedef vector> matrix;\n\nconst ll MOD = 1000000007;\n\nvector PrimeNumbers(ll n){\n\tvector primes;\n\tvector isPrime(n+1,1);\n\tfor(ll i=2;i*i<=n;i++){\n\t\tif(isPrime[i]){\n\t\t\tfor(ll j=i*i; j<=n ; j+=i){\n\t\t\t\tisPrime[j]=0;\n\t\t\t}\n\t\t}\n\t}\n\trep(i,2,n){\n\t\tif(isPrime[i])primes.pb(i);\n\t}\n\treturn primes;\n}\n\nvector segmentedSeive(ll l, ll r){\n\tvector primes;\n\tvll primeNos = PrimeNumbers(floor(sqrt(r)));\n\tvll isPrime(r-l+1,1);\n\tREPV(primeNos){\n\t\tll x = (*i);\n\t\tll rem = l%x;\n\t\tll start = l;\n\t\tif(rem)start = (l/x+1)*x;\n\t\tfor(ll j = start; j<=r; j+=x){\n\t\t\tif(j!=x){\n\t\t\t\tll pos = j - l;\n\t\t\t\tif(isPrime[pos]){\n\t\t\t\t\tisPrime[pos]=0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\trep(i,0,r-l+1){\n\t\tif(isPrime[i])primes.pb(l+i);\n\t}\n\n\treturn primes;\n}\n\nll findAnySolution(ll a, ll b, ll &x, ll &y){\n\tif(b==0){\n\t\tx = 1;\n\t\ty = 0;\n\t\treturn a;\n\t}\n\tll x1, y1;\n\tll d = findAnySolution(b, a%b, x1, y1);\n\tx = y1;\n\ty = x1 - y1*(a/b);\n\treturn d;\n}\n\nll gcd(ll x, ll m) {\n\tif (m == 0) return x;\n\telse return gcd(m , x % m);\n}\n\nll findAllSolutions(ll a, ll b, ll c,ll lx, ll rx, ll ly, ll ry){\n\tll d = gcd(a,b);\n\tif(c%d){return 0;}\n\tc/=d;\n\ta/=d;\n\tb/=d;\n\tll k =ceil((double) ((lx - c%b)*(a%b))/b);\n\tlx = abs(k);\n\tcout<0?ry-lx:0;\n}\n\nvoid solve() {\n\tll n=1,a=1,k=1,minVal=LLONG_MAX,maxVal=LLONG_MIN,ans=LLONG_MAX,b=1,c=1;\n\tll x,y,lx,rx,ly,ry;\n\tcin>>a>>b>>c;\n\tlx = 0,ly=0,rx=INT_MAX,ry=INT_MAX;\n\tll d = findAnySolution(a,b,x,y);\n\ta/=d;\n\tb/=d;\n\tif(c%d==0 && (c%b)%(a%b)==0 && (c%b)/(a%b)> t;\n\twhile (t) {\n\t\tsolve();\n\t\tt--;\n\t}\n\treturn 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "c72501ae671f7d8d32b62df5b8f3f3e0", "src_uid": "e66ecb0021a34042885442b336f3d911", "apr_id": "b6e64292f740222bac711c72e05db3ba", "difficulty": 1100, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8622589531680441, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \n\nusing namespace std;\n\nint main() {\n string s;\n cin >> s;\n\n int ans = 0;\n for(int i = 0; i < s.size(); i++) {\n if(s[i] == 'a' || s[i] == 'e' || s[i] == 'i' || s[i] == 'o'\n || s[i] == 'u' || (int)s[i] % 2 == 0) {\n ans++;\n }\n }\n\n cout << ans;\n\n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "ce3d975f7315ab464f7e6eb05241b47b", "src_uid": "b4af2b8a7e9844bf58ad3410c2cb5223", "apr_id": "f4d44ab61a5543d86726e0db3eb3f3d3", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9366053169734151, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n string s;cin>>s;\n string a=\"aeiou02468\";\n int k=0;\n for(int i=0;i\n#include \n#include \n#include \n#include \n#include \nusing namespace std;\nmapm;\n\nvoid fun(long long n,long long l,long long r){\n\tif(n==1)\n\t\treturn;\n\tif(n%2==1)\n\t\tm[(l+r)/2]=1;\n\telse\n\t\tm[(l+r)/2]=0;\n\tfun(n/2,l,(l+r)/2-1);\n\tfun(n/2,(l+r)/2+1,r);\n}\n\nint main(){\n\t\n\tlong long n;\n\tint l,r;\n\twhile(~scanf(\"%I64d\",&n)){\n\t\tscanf(\"%d %d\",&l,&r);\n\t\tm.clear();\n\t\tint cnt=0;\n\t\tlong long k=1;\n\t\tlong long t=n;\n\t\twhile(t!=1){\n\t\t\tt/=2;\n\t\t\tk=2*k+1;\n\t\t}\n\t\tfun(n,1,k);\n\t\tlong long ans=0;\n\t\tfor(long long i=l;i<=r;i++){\n\t\t\tif(i%2==0)\n\t\t\t\tans+=m[i];\n\t\t\telse\n\t\t\t\tans++;\n\t\t}\n\t\tprintf(\"%I64d\\n\",ans);\n\t}\n\treturn 0;\n}", "lang": "GNU C++", "bug_code_uid": "06ec3ef964ed20190ca7edd2de1b1faa", "src_uid": "3ac61b1f8deee7911b1055c243f5eb6a", "apr_id": "63b7f91afc3ebe555882140bd26ae923", "difficulty": 1600, "tags": ["divide and conquer", "dfs and similar", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9789334119033589, "equal_cnt": 10, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 9, "bug_source_code": "//#pragma comment (linker, \"/STACK:64000000\")\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n/*\n#include \n#include \n#include \n*/\n#define all(c) c.begin(),c.end()\n#define rall(c) c.rbegin(),c.rend()\n#define ifo(n,v) for(int i=v;i\n#define pb push_back\n#define sz size()\nusing namespace std;\n\n\n\nint in() {\n int a;\n scanf(\"%d\", &a);\n return a;\n}\n\ndouble din() {\n double a;\n scanf(\"%lf\", &a);\n return a;\n}\n\nint gcd(int a, int b) {\n while(b){\n a%=b;\n swap(a,b);\n }\n return a;\n //return b ? gcd(b, a % b) : a;\n}\n\nint lcm(int a, int b) {\n return a / gcd(a, b) * b;\n}\n\nconst double eps = 1e-6;\nconst double pi = 3.14159265358979323;\nconst int INF = 999999999;\n\nint qq(int a,int b){\n int c=a+b;\n int res=0;\n while(c%10==0){\n ++res;\n c/=10;\n }\n return res;\n}\nbool isa(char a){\n if(a=='a'||a=='e'||a=='i'||a=='o'||a=='u') return true;\n else return false;\n}\nbool isprime(int a){\n for(int i=2;i*i<=a;++i){\n if(a%i==0) return false;\n }\n return true;\n}\nstruct Node{\n Node *l, *r,*p;\n int x,y;\n\n vector a;\n vector u;\n Node* use(){\n if(u.empty()) u.assign(a.size(),0);\n for(int i=0;iy<<' '<y<y < r->y){\n split(r,a->x,a->l,a->r);\n r=a;\n }else{\n if(a->x < r->x) insert(r->l,a);\n else insert(r->r,a);\n }\n }\n void split(Node *a,int X,Node *&l,Node *&r){\n if(a==NULL){\n l=r=NULL;\n return;\n }\n if(a->x > X){\n split(a->l,X,l,a->l);\n r=a;\n }else{\n split(a->r,X,a->r,r);\n l=a;\n }\n\n }\n void built(Node *r,Node *t){\n while(r->y > t->y && r->p!=NULL){\n r=r->p;\n }\n if(r->p==NULL && t->y < r->y){\n r->p=t;\n t->l=r;\n root=t;\n root->p=NULL;\n l=t;\n return;\n }\n t->l=r->r;\n r->r=t;\n t->p=r;\n t->l->p=t;\n l=t;\n }\n\npublic:\n Treap(){\n root=NULL;\n l=NULL;\n }\n void built(pair a){\n Node *n=new Node(a.first,a.second);\n if(root==NULL){\n root=n;\n l=n;\n return;\n }\n //cout<y<y < n->y){\n l->r=n;\n n->p=l;\n l=n;\n return;\n }\n built(l,n);\n }\n\n void insert(pair a){\n Node *node=new Node(a.first,a.second);\n insert(root,node);\n }\n Node* getRoot(){\n return root;\n }\n};\n/*int n=in();\nvectora,res,p;\nfor(;a.size()dp(a.size()+1,INF);\ndp[0]=-INF;\nfor(int i=0;i0){\n r+=a%10+'0';\n a/=10;\n // cout< next;\n};\n\nbool com(pair a,pair b){\n if (fabs(a.first-b.first)<=eps) return a.secondb.first;\n}\nlong double nextApproximation(long double x){\n return x-(3*x+cos(x)+1)/(3-sin(x));\n}\nbool exit(){\n exit(0);\n}\ndouble dist(int x1,int y1,int x2,int y2){\n return sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));\n}\nvector > g;\nvector > f;\nvector ptr;\nvector d;\nbool bfs(int t,int s,int n){\n d.assign(n,0);\n queue q;\n q.push(s);\n d[s]=1;\n while(!q.empty()){\n long long v=q.front();\n q.pop();\n for(long long i=0;i0 ){\n q.push(i);\n d[i]=d[v]+1;\n }\n }\n }\n\n}\n\nlong long dfs(int v,long long flow,int t,int n){\n // cout<f[v][i]){\n long long push=dfs(i,min(flow,g[v][i]-f[v][i]),t,n);\n if(push>0){\n f[v][i]+=push;\n f[i][v]-=push;\n return push;\n }\n\n }\n }\n return 0;\n}\n\nint main(){\n //freopen(\"input.txt\",\"r\",stdin);\n // freopen(\"output.txt\",\"w\",stdout);\n int vp=in(),vd=in(),t=in(),f=in(),c=in();\n double p=t*vp,d=0;\n int res=0;\n while(fabs(p-c)>eps){\n double t2=(double)(p-d)/vd;\n // cout<t2){\n res++;\n p+=vp*((2.*p)/vd);\n p+=f*vp;\n }else{\n d+=vd;\n p+=vp;\n }\n }\n cout< st;\n/* int n=in(),m=in();\ng.assign (n,vector(n,0));\nf.assign (n,vector(n,0));\nfor(int i=0;i\nusing namespace std;\ntypedef int64_t lld;\ntypedef pair pii;\n#define int __int128\n#define ff first\n#define ss second\n#define pb push_back\n#define all(x) (x).begin(),(x).end()\n//#define endl '\\n'\n#define jizz cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);\ntemplate\nostream& _out(ostream &s, Iter b, Iter e) {\n s<<\"[\";\n for ( auto it=b; it!=e; it++ ) s<<(it==b?\"\":\" \")<<*it;\n s<<\"]\";\n return s;\n}\ntemplate\nostream& operator<<(ostream& out, pair p) {\n return out << '(' << p.first << \", \" << p.second << ')';\n}\ntemplate\nistream& operator>>(istream& in, pair& p) {\n return in >> p.ff >> p.ss;\n}\ntemplate\nostream& operator <<( ostream &s, const vector &c ) {\n return _out(s,c.begin(),c.end());\n}\nint invmod(int a, int b, int s0 = 0, int s1 = 1){\n return b?invmod(b, a%b, s1-a/b*s0, s0):s1;\n}\nint gcd(int a, int b){\n return b?gcd(b, a%b):a;\n}\nsigned main(){//jizz; //freopen(\"test.in\", \"r\", stdin);\n signed _a1, _b1, _a2, _b2, _L, _R; //a1 k + b1 = a2 l + b2 => a1 k - a2 l = b2 - b1;\n cin >> _a1 >> _b1 >> _a2 >> _b2 >> _L >> _R;\n int a1 = _a1, b1 = _b1, a2 = _a2, b2 = _b2, L = _L, R = _R;\n if(b2 < b1)swap(a1, a2), swap(b1, b2);\n int t1 = (invmod(a1, a2)%a2+a2)%a2, g = gcd(a1, a2), t2 = (t1*a1-g)/a2; // t1*a1 - t2*a2 = g\n //cout << (lld)t1 << \" \" << (lld)t2 << endl;\n assert(t1*a1-t2*a2 == g);\n if((b2-b1)%g)return cout << 0 << endl, 0;\n //cout << (lld)t1 << \" \" << (lld)t2 << endl;\n t1*=(b2-b1)/g, t2*=(b2-b1)/g;\n //cout << (lld)t1 << \" \" << (lld)t2 << endl;\n t1 = (t1%(a2/g)+a2/g)%(a2/g); t2%=(t2%(a1/g)+a1/g)%(a1/g);\n //cout << (lld)t1 << \" \" << (lld)t2 << endl;\n //assert(t1 >= 0 && t2 >= 0);\n int posa = max(t1*a1+b1, t2*a2+b2), add = a1*a2/g;\n //assert((posa-b1)%a1 == 0);\n //assert((posa-b2)%a2 == 0);\n L-=posa, R-=posa;L--;\n //cout << (lld)L << \" \" << (lld)R << endl;\n if(R < 0)return cout << 0 << endl, 0;\n if(L < 0)return cout << (lld)(R/add+1) << endl, 0;\n cout << (lld)(R/add-L/add) << endl;\n\n\n}\n", "lang": "GNU C++17", "bug_code_uid": "13d48456403dc1041aac17e4204eabce", "src_uid": "b08ee0cd6f5cb574086fa02f07d457a4", "apr_id": "b1160ff8539808695d30078d621ce2d2", "difficulty": 2500, "tags": ["math", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9984880556395525, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "/* be name khoda */\n\n// #define stream_enable\n#define long_enable\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\n#ifdef stream_enable\n#define cin sss\n#endif\n#ifdef long_enable\ntypedef long long int ll;\n#else\ntypedef int ll;\n#endif\n\ntypedef pair pii;\ntypedef pair ppi;\ntypedef pair pip;\ntypedef vector vi;\ntypedef vector vpii;\n\nconst ll MOD = 1000000007;\nconst long long BIG = 1446803456761533460;\nconst int Big = 336860180;\n\n#define F first\n#define S second\n#define pb push_back\n#define eb emplace_back\n#define all(x) (x).begin(), (x).end()\n\n#define debug(x) cout << #x << \" -> \" << (x) << endl;\n#define debug2(x, y) cout << #x << ' ' << #y << \" -> \" << (x) << ' ' << (y) << endl;\n#define debug3(x, y, z) cout << #x << ' ' << #y << ' ' << #z << \" -> \" << (x) << ' ' << (y) << ' ' << (z) << endl;\n#define debug4(x, y, z, t) cout << #x << ' ' << #y << ' ' << #z << ' ' << #t << \" -> \" << (x) << ' ' << (y) << ' ' << (z) << ' ' << (t) << endl;\n#define debugp(x) cout << #x << \" -> \" << \"(\" << (x).F << \", \" << (x).S << \")\" << endl;\n#define debuga(x, n) cout << #x << \" -> \"; fori (i1_da, n) { cout << (x)[i1_da] << ' '; } cout << endl\n#define debugap(x, n) cout << #x << \" ->\\n\"; fori (i1_dap, n) { cout << \"(\" << (x)[i1_dap].F << \", \" << (x)[i1_dap].S << \")\\n\"; } cout << endl\n#define debugaa(x, n, m) cout << #x << \" ->\\n\"; fori (i1_daa, n) { fori (i2_daa, m) { cout << (x)[i1_daa][i2_daa] << ' '; } cout << '\\n'; } cout << endl\n#define debugav(x, n) cout << #x << \" ->\\n\"; fori (i1_dav, n) { fori (i2_dav, (x)[i1_dav].size()) { cout << (x)[i1_dav][i2_dav] << ' '; } cout << '\\n'; } cout << endl\n#define debugia(x, n) cout << #x << \" ->\\n\"; fori (i1_dia, n) { cout << i1_dia << \" : \" << (x)[i1_dia] << '\\n'; } cout << endl\n\n#define forifrom(i, s, n) for(ll i = (s); i < (n); ++i)\n#define forirto(i, n, e) for(ll i = (n) - 1; i >= (e); --i)\n#define fori(i, n) forifrom (i, 0, n)\n#define forir(i, n) forirto (i, n, 0)\n\n#define smin(a, b) a = min(a, (b))\n#define smax(a, b) a = max(a, (b))\n\n#define Add(a, b) a = (a + (b)) % MOD\n#define Mul(a, b) a = (a * (b)) % MOD\n\nstringstream sss;\n\n// -----------------------------------------------------------------------\n\nconst ll maxd = 18;\nconst ll maxd2 = 1 << maxd;\nconst ll maxm = 100;\n\nstring n;\nll m;\nll dp[maxd2][maxm];\nll fact[maxd];\n\nvoid MAIN() {\n\n cin >> n >> m;\n ll s = n.size();\n ll s2 = 1 << s;\n dp[0][0] = 1;\n fori (i, s2) {\n fori (j, s) {\n if (i >> j & 1) {\n if ((i ^ (1 << j)) == 0 && n[j] == '0') continue;\n fori (k, m) {\n dp[i][(k * 10 + n[j] - '0') % m] += dp[i ^ (1 << j)][k];\n }\n }\n }\n }\n fact[0] = 1;\n fori (i, 10) fact[i + 1] = fact[i] * (i + 1);\n ll ans = dp[s2 - 1][0];\n fori (i, 10) {\n ans /= fact[count(all(n), '0' + i)];\n }\n cout << ans << '\\n';\n\n}\n\n// -----------------------------------------------------------------------\n\nint main() {\n ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);\n cout << fixed << setprecision(10);\n sss << R\"(\n7067678 8\n )\";\n MAIN();\n return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "d85524540262199e2cd2bb0e1b44511e", "src_uid": "5eb90c23ffa3794fdddc5670c0373829", "apr_id": "7bc7afa543bd091ae6c2ba036a8dba51", "difficulty": 2000, "tags": ["dp", "combinatorics", "bitmasks", "number theory", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9507445589919816, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "#include\nusing namespace std;\nint main(){\n\tios_base::sync_with_stdio(false);\n\tcin.tie(NULL);\n\t\n\t\tint n;\n\t\tcin >> n;\n\t\tstring arr[21];\n\t\t\n\t\tunsigned long long int arr[20];\n\t\tarr[2]=\"1\";\n\t\tarr[4] = \"3\";\n\t\tarr[6] = \"40\";\n\n\t\tarr[8] = \"1260\";\n\n\t\tarr[10] = \"72576\";\n\n\t\tarr[12] = \"6652800\";\n\n\t\tarr[14] =\"889574400\" ;\n\t\tarr[16] = \"163459296000\";\n\t\tarr[18] = \"3952082534400\";\n\t\tarr[20] =\"12164510040883200\" ;\n\t\t\n\t\tcout<\n#define ll long long int\n#define uu first\n#define vv second\n#define pii pair\n#define pll pair\n#define tp tuple\n#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)\nusing namespace std;\nconst int INF = 1e9;\nconst ll MOD = 1e9 + 7;\n\nconst int N = 1e6 + 6;\n\nint main() {\n int n , m , k;\n cin>>n>>m>>k;\n\n string one = \"Timur\" , two = \"Marsel\";\n if(n%2 ==0) {\n cout<=k || div2 >= k) div = 1;\n }\n\n if(k ==1 && m > 1) div = 1;\n \n if(k == 1 || div) cout<\n\nusing namespace std;\n\n#define REP(i, a, b) for ( int i = (a), _end_ = (b); i <= _end_; ++ i ) \n#define mem(a) memset ( (a), 0, sizeof ( a ) ) \n#define str(a) strlen ( a ) \n#define pii pair\n#define int long long\ntypedef long long LL;\n\nconst int Mod = 1e9 + 7;\n\nint f[100010], n, m;\n\nsigned main()\n{\n#ifndef ONLINE_JUDGE\n freopen(\"input.txt\", \"r\", stdin);\n freopen(\"output.txt\", \"w\", stdout);\n#endif\n cin >> n >> m;\n f[1] = 1; f[2] = 2;\n REP(i, 3, n + m) f[i] = (f[i - 1] + f[i - 2]) % Mod;\n cout << (2 * (f[n] + f[m] - 1)) % Mod << endl;\n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "d57b3329bd7491fa6e6330b2969d4ff6", "src_uid": "0f1ab296cbe0952faa904f2bebe0567b", "apr_id": "b581e97e130d9a293376e5a5c112cac8", "difficulty": 1700, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9720670391061452, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "#include\n#define ll long long\nusing namespace std;\n \n \nint main()\n{\n \n\t#ifndef ONLINE_JUDGE\n\tfreopen(\"input.txt\", \"r\", stdin);\n\tfreopen(\"output.txt\", \"w\", stdout);\n #endif\n\tint a[10]={6,2,5,5,4,5,6,3,7,6};\n\tint x,y,cnt=0,i;\n\tll ans=0;\n\tcin>>x>>y;\t\n\tfor(i=x;i<=y;++i)\n\t{\n\t\twhile(i)\n\t\t{\n\t\t\tans+=a[i%10];\n\t\t\ti/=10;\n\t\t}\n\n\t}\n\tcout<\nusing namespace std;\nint main(void)\n{\n\tint n,s,sum = 0,max = 0;\n\tcin >> n >> s;\n\tfor(int i = 0 ; i , n ; i ++)\n\t{\n\t\tint x;\n\t\tcin >> x;\n\t\tif(x > max) max = x;\n\t\tsum += x;\n\t}\n\tif(sum - max <= s) cout << \"NO\" << endl;\n\telse \t\t\t cout << \"YES\" << endl;\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "7975d33e72aa52a9895330aede3c41eb", "src_uid": "496baae594b32c5ffda35b896ebde629", "apr_id": "96bfdd7390892a78428c6515fd7a9cfb", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9596774193548387, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \n#include \n\n#define Max 1000001\n#define MOD 1000000007\ntypedef long long LL;\nconst LL INF = 1e15 + 7LL;\nusing namespace std;\n#define MAXN 105\nint flag;\nint n, k;\nint a[4][4];\nint main() {\n\tfor (int i = 0; i < 4; i++) {\n\t\tfor (int j = 0; j < 4; j++) {\n\t\t\tscanf(\"%d\", &a[i][j]);\n\t\t}\n\t}\n\tint flag = 0;\n\tfor (int i = 0; i < 4; i++) {\n\t\tif (a[i][3] == 1) {\n\t\t\tint t = (i + 1) % 4;\n\t\t\tint duimian = (i + 2) % 4;\n\t\t\tint shangmian = (i + 3) % 4;\n\t\t\tif(a[i][1]==1)\n\t\t\t\tflag=1;\n\t\t\tif (a[shangmian][2] == 1)\n\t\t\t\tflag = 1;\n\t\t\tif (a[duimian][1] == 1)\n\t\t\t\tflag = 1;\n\t\t\tif (a[t][0] == 1)\n\t\t\t\tflag = 1;\n\t\t}\n\t}\n\tif (flag == 1) {\n\t\tcout << \"YES\" << endl;\n\t} else {\n\t\tcout << \"NO\" << endl;\n\t}\n\treturn 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "24bb220abe134a180983a8799d53fb5f", "src_uid": "44fdf71d56bef949ec83f00d17c29127", "apr_id": "eb95bf9d8e4867af94c772591d997448", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.8180435884439939, "equal_cnt": 13, "replace_cnt": 9, "delete_cnt": 4, "insert_cnt": 0, "fix_ops_cnt": 13, "bug_source_code": "//......by LFEY......//\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#define ll long long\n#define pb push_back\n#define mpr make_pair\n#define F first\n#define S second\n#define pii pair \n\nusing namespace std;\n\nconst int MX = 1e9 + 1;\nconst int Imp = -1;\nconst int INF = 1e7 + 100;\nconst int N = 1e6 + 5;\nconst int M = 1e5 + 5;\n\nint X[] = {1, -1, 0, 0};\nint Y[] = {0, 0, 1, -1};\n\nmapmp;\n\nll mx = -1,ans;\n\nll ok , ok1;\n\nvectorv;\n\nmain(){\n//\tfreopen(\".in\",\"r\",stdin);\n//\tfreopen(\".out\",\"w\",stdout);\n\tll n;\n\tcin >> n;\n\tstring s;\n\tcin >> s;\n\tfor(int i = 0 ; i < s.size(); ++i){\n\t\tll g;\n\t\twhile(1){\n\t\t\tif(s[i] == 'o' && s[i+1]=='g' && s[i+2] == 'o'){\n\t\t\t\ts[i] = '*';\n\t\t\t\ts[i+1] = '*';\n\t\t\t\ti += 2;\n\t\t\t \tg = i;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\ts[(g < s.size() ? g:i-1)] = '*';\n\t}\n\tcout<\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\ntypedef long long ll;\n\n#define inf int(0x3f3f3f3f)\n#define mod int(1e9+7)\n#define pi acos(-1.0)\n\n\nint n,m;\n\nint dx,dy;\nint x,y;\n\nchar s[100005];\n\nmap a[100010];\n\nint main()\n{\n cin>>n>>m;\n cin>>x>>y;\n scanf(\"%s\",s+1);\n ll sum=0;\n if(s[1]=='U')\n dx=-1;\n else\n dx=1;\n if(s[2]=='L')\n dy=-1;\n else\n dy=1;\n int cnt=n+m-2;\n if(x==1||x==n||y==1||y==m)\n {\n a[x][y]=1;\n cnt--;\n }\n ll ji=0;\n while(1)\n {\n ji++;\n if(ji>=1e8)\n {\n cout<<-1<\n\nusing namespace std;\nint n;\nint len;\nlong long power[60];\nint maxPow = 0;\nstring k;\nlong long dp[65][65];\n\nlong long solve(int ind,int po) {\n if(ind == -1)\n return 0;\n if(po >= maxPow)\n return 1E18;\n\n if(dp[ind][po] != -1)\n return dp[ind][po];\n string s = \"\";\n long long ans = 1E18+1;\n for(int i = ind;i>=0;i--) {\n s = k[i] + s;\n long long num;\n stringstream convert(s);\n convert>>num;\n if(s.length() > 1 && s[0] == '0')\n continue;\n if(num >= n || num * power[po] < 0 || LONG_LONG_MAX / power[i] < num) {\n break;\n } else {\n ans = min(ans,solve(i-1,po+1) + num * power[po]);\n }\n }\n return dp[ind][po] = ans;\n}\n\nint main()\n{\n cin>>n>>k;\n len = k.length();\n power[0] = 1;\n memset(dp,-1,sizeof dp);\n for(int i = 1;i\n#include\n#include\n#include\n#include\nusing namespace std;\n\ntypedef long long ll;\nint n,m;\nint L;\n/*\nint main()\n{\n\tscanf(\"%d%d\",&n,&m);L=n+1;\n\tll ans=0;\n\tfor (int a=m+1;a<=n-m;a++){\n int lef=m+1,rig=min(2*a-1,n-m),mid;\n while(lef<=rig){\n mid=lef+rig>>1;\n ll t=L-(1ll*(L-a)*(-mid+2*a)-1)/(mid+a);\n if(t<=m+1)lef=mid+1;\n else rig=mid-1;\n }\n ans+=1ll*(n-2*m)*(lef-m-1);\n //printf(\"%d %d %d\\n\",a,lef,lef-m-1);\n\t\t//for (int b=min(2*a-1,n-m);b>m;b--){\n for (int b=lef;b<=2*a-1 && b<=n-m;b++){\n\t\t\tll t=L-(1ll*(L-a)*(-b+2*a)-1)/(b+a);\n\t\t//\tprintf(\"%lld\\n\",t);\n\t\t\tif(t<=n-m){\n ans+=n-m-t+1;\n // else {ans+=1ll*(n-2*m)*(n-m-b+1);break;}\n\t\t\t}else break;\n\t\t}\n }\n\tcout<>1;\n ll t=L-(1ll*(L-a)*(-mid+2*a)-1)/(mid+a);\n if(t<=m+1)lef=mid+1;\n else rig=mid-1;\n }\n ans+=1ll*(n-2*m)*(lef-m-1);\n for (int b=lef,t=L-(1ll*(L-a)*(-lef+2*a)-1)/(lef+a);b<=2*a-1 && b<=n-m;b++){\n\t\t while(t<=n-m && 1ll*(L-t)*(a+b)>=1ll*(L-a)*(2*a-b))t++;\n\t\t\tif(t<=n-m){\n /* if(t>m+1)*/ans+=n-m-t+1;\n // else {ans+=1ll*(n-2*m)*(n-m-b+1);break;}\n\t\t\t}else break;\n\t\t}\n }\n\tcout<\n\nusing namespace std;\n\nint main (){\n int n;\n cin >> n;\n int vet[6];\n int aux;\n for(int i = 0 ; i < 6 ; i++){\n cin >> vet[i];\n }\n for(int i = 0 ; i < 6 ; i++){\n for(int k = i+1 ; k < 6 ;k++)\n if(vet[i]>vet[k]){\n aux = vet[i];\n vet[i] = vet[k];\n vet[k] = aux;\n }\n }\n\n\n\n for(int i = 0 ; i < 6 ; i++)\n if((vet[i]+vet[i+1]+vet[i+2])==n && i+2 < 6){\n cout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nnamespace\n{\n // (x+t) \\bmod a == 0\n // t = a-x + k_1 a\n // (y+t) \\bmod b == 0\n // t = b-y + k_2 b\n // k_2 = \\frac{a-b - x+y + k_1 a}{b}\n // x' = x + t\n // y' = y + t\n using lint = long long int;\n int gcd(int a, int b)\n {\n if(a < b)\n return gcd(b, a);\n while(b != 0)\n {\n const auto t = b;\n b = a%b;\n a = t;\n }\n return a;\n }\n int inverse(int val, int mod)\n {\n if(val == 0 || gcd(val, mod) != 1)\n return 0;\n lint res = 1;\n const auto ival = val;\n while(val != 1)\n {\n const auto mult = mod/val+1;\n res *= mult;\n res %= mod;\n const auto nxt = val*mult%mod;\n if(nxt != val)\n {\n val = nxt;\n }\n else\n {\n val = nxt+ival;\n res += 1;\n res %= mod;\n }\n }\n return res%mod;\n }\n pair, bool> billiard(const tuple &sz,\n const tuple &pos, const tuple &vel)\n {\n if(get<0>(sz) > get<1>(sz))\n {\n const auto res = billiard(make_tuple(get<1>(sz), get<0>(sz)),\n make_tuple(get<1>(pos), get<0>(pos)),\n make_tuple(get<1>(vel), get<0>(vel)));\n return make_pair(make_tuple(get<1>(res.first), get<0>(res.first)),\n res.second);\n }\n const auto x = (get<0>(sz)+get<0>(pos)*get<0>(vel))%get<0>(sz);\n const auto y = (get<1>(sz)+get<1>(pos)*get<1>(vel))%get<1>(sz);\n if(get<0>(vel) == 0)\n {\n if(get<0>(pos)%get<0>(sz) == 0)\n {\n return make_pair(make_tuple(\n get<0>(pos),\n get<1>(vel)>0?get<1>(sz):0), true);\n }\n else\n {\n return make_pair(make_tuple(0, 0), false);\n }\n }\n if(get<1>(vel) == 0)\n {\n if(get<1>(pos)%get<1>(sz) == 0)\n {\n return make_pair(make_tuple(\n get<0>(vel)>0?get<0>(sz):0,\n get<1>(pos)), true);\n }\n else\n {\n return make_pair(make_tuple(0, 0), false);\n }\n }\n const auto c = (get<1>(sz) - get<0>(sz)+get<1>(sz) + x - y)%get<1>(sz);\n const auto g = gcd(c, gcd(get<0>(sz), get<1>(sz)));\n lint cdash = c;\n lint sz1dash = get<0>(sz);\n lint sz2dash = get<1>(sz);\n if(g != 0)\n {\n cdash /= g;\n sz1dash /= g;\n sz2dash /= g;\n }\n const auto v = inverse(sz1dash%sz2dash, sz2dash);\n if((v*cdash%sz2dash*sz1dash%sz2dash + sz2dash - cdash)%sz2dash != 0)\n return make_pair(make_tuple(0, 0), false);\n const lint k1 = cdash*v%sz2dash;\n const lint t = (get<0>(sz) - x + k1*get<0>(sz));\n return make_pair(\n make_tuple(\n abs(get<0>(pos) + t*get<0>(vel))%(get<0>(sz)*2),\n abs(get<1>(pos) + t*get<1>(vel))%(get<1>(sz)*2)\n ), true);\n }\n}\n\nint main()\n{\n tuple sz;\n tuple pos;\n tuple vel;\n cin>>get<0>(sz)>>get<1>(sz);\n cin>>get<0>(pos)>>get<1>(pos);\n cin>>get<0>(vel)>>get<1>(vel);\n const auto res = billiard(sz, pos, vel);\n if(res.second)\n {\n cout<(res.first)<<' '<(res.first)<\nusing namespace std;\nint n,i,j,a[3][3],b[3][3];\nvoid swith(int x,int y){\n b[x][y]=b[x][y]+1;\n b[x+1][y]=b[x+1][y]+1;\n b[x][y+1]=b[x][y+1]+1;\n b[x-1][y]=b[x-1][y]+1;\n b[x][y-1]=b[x][y-1]+1;\n }\nmain()\n{\nfor(i=1;i<=3;i++)\nfor(j=1;j<=3;j++){\ncin>>a[i][j];\nwhile(a[i][j]>0){\nswith(i,j);\na[i][j]--;\n}}\nfor(i=1;i<=3;i++){\nfor(j=1;j<=3;j++){\nif(b[i][j]==false) b[i][j]=true;\nelse b[i][j]=false;\n}}\nfor(i=1;i<=3;i++){\nfor(j=1;j<=3;j++){\ncout<\n using namespace std;\n int main()\n {\n \tint a,b,c,min;\n \tcin>>a>>b>>c;\n \tmin=a;\n \tif(b\n#pragma GCC target (\"sse4.2\")\n#pragma GCC optimize(\"Ofast\")\n//#pragma GCC target(\"avx,avx2,fma\")\n#pragma GCC optimize (\"unroll-loops\")\nusing namespace std;\n\ntypedef long long ll;\ntypedef long double ld;\n#define sp(x) fixed<\n#define F first\n#define S second\n#define int long long\nconst int MAXN = 120 + 7, MOD = 1000 * 1000 * 1000 + 7;\nconst ld EPS = ld(1e-10);\nint n, a[MAXN], sum, c[MAXN][MAXN], indeg[MAXN];\nvectoradj[MAXN], t, s;\nint ans = 1, cur= 0;\nbool mark[MAXN];\nint calc_cnt(){\n\t\n\tint ss = s.size(), ts = t.size();\n\tvectornum(ts, 0), cnt(1 << ss, 0);\n\tvector>dp(ts + 1, vector(1 << ss, 0);\n\tfor(int i = 0; i < ss; i ++)\n\t\tfor(int j = 0; j < ts; j ++)\n\t\t\tif(t[j] % s[i] == 0)\n\t\t\t\tnum[j] |= (1 << i);\n\tfor(int i = 0; i < (1 << ss); i ++)\n\t\tfor(int j = 0; j < ts; j ++)\n\t\t\tif((num[j] & i) == num[j])\n\t\t\t\tcnt[i] ++;\n\tfor(int i = 0; i < ts; i ++)\n\t\tdp[1][num[i]] ++;\n\tfor(int k = 1; k < ts; k ++){\n\t\tfor(int mask = 0; mask < (1 << ss); mask ++){\n\t\t\tdp[k][mask] %= MOD;\n\t\t\tfor(int i = 0; i < ts; i ++){\n\t\t\t\tint ands = (num[i] & mask); \t\n\t\t\t\tif(ands != num[i] && ands != 0){\n\t\t\t\t\tdp[k + 1][mask | num[i]] %= MOD;\n\t\t\t\t\tdp[k + 1][mask | num[i]] += dp[k][mask];\n\t\t\t\t\tdp[k + 1][mask | num[i]] %= MOD;\n\t\t\t\t}\n\t\t\t}\n\t\t\tdp[k + 1][mask] = ((dp[k + 1][mask]% MOD) + (1ll * (dp[k][mask] % MOD * ((cnt[mask] - k) % MOD)) % MOD) % MOD);\n\t\t}\n\t}\t\n\treturn dp[ts][(1 << ss) - 1];\n}\n\nvoid dfs(int v){\n mark[v] = 1;\n if(indeg[v] == 0){\n s.pb(a[v]);\n }else{\n \tt.pb(a[v]);\n }\n for(auto u : adj[v]){\n if(!mark[u]){\n dfs(u);\n }\n }\n return;\n}\nvoid dfs_all(){\n for(int i = 0; i < n; i ++){\n if(!mark[i]){\n \ts.clear(), t.clear();\n dfs(i);\n if(!t.empty()){\n\t\t\t\tint cnt = calc_cnt(), tt = t.size() - 1;\n\t\t\t\tans = 1ll * (ans%MOD) * (cnt % MOD) % MOD;\n\t\t\t\tans = 1ll * (ans % MOD) * (c[cur + tt][tt] % MOD) % MOD;\n\t\t\t\tcur += tt;\n\t\t\t}\n }\n }\n return;\n}\nint32_t main(){\n fastio;\n for(int i = 0; i < MAXN; i ++){\n \tc[i][0] = 1;\n \tfor(int j = 1; j <= i; j ++){\n \t\tc[i][j] = (c[i - 1][j - 1] + c[i - 1][j])%MOD;\n \t}\n }\n cin >> n;\n for(int i = 0; i < n; i ++){\n cin >> a[i];\n }\n sort(a, a + n);\n for(int i = 0; i < n; i ++){\n for(int j = 0; j < n; j ++)if(i != j){\n if(a[j] % a[i] == 0){\n adj[j].pb(i);\n adj[i].pb(j);\n indeg[j] ++;\n }\n }\n }\n\n dfs_all();\n\tcout << ans % MOD << endl;\n return 0;\n\n}\n", "lang": "GNU C++17", "bug_code_uid": "983d5cd52f800a229dfae0dde0ff1898", "src_uid": "c8d43a60ddc0a7b98a7269dc3a2478dc", "apr_id": "904bcb19f03ee2bc4f9aef33d3656251", "difficulty": 3500, "tags": ["dp", "combinatorics", "bitmasks"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9977255496588324, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include\nusing namespace std;\n#define int long long\nconst int N=65,M=1e9+7,L=18;\nint n,m,p,a[N],C[N][N],f[N][1<=0;i--)\n\t\tfor (int j=i;j;j=(j-1)&i)cnt[i]+=cnt[i^j];\n\tf[0][0]=1;\n\tfor (int i=1;i<=n;i++)\n\t\tif (vis[i]==-1)for (int j=i-1;j>=0;j--)\n\t\t\tfor (int k=0;k<1<\nusing namespace std;\n#define ll long long\nvector < ll >prime;\nll cnt1[200005] , cnt2[200005] , cntans[200005] , mod = 1e9 + 7;\nbool _prime(ll x){\n ll p = sqrt(x);\n for(ll i = 2;i<=p;i++)\n if (x % i == 0)\n return false;\n return true;\n}\nvoid fact(ll x , ll num){\n for(ll i = 0;i> n;\n for(i = 2;i<=2*n;i++)\n if (_prime(i))\n prime.push_back(i);\n for(i = 2 * n - 1;i>=2 * n - n + 1;i--)\n fact(i , 1);\n for(i = 2;i 0 ){\n ans*=binpow(i , cntans[ i ] );\n }\n ans%=mod;\n }\n cout << (2 * ans)%mod - n;\n return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "cd63412278a2aecbdef4b5eb41d11ea7", "src_uid": "13a9ffe5acaa79d97df88a069fc520b9", "apr_id": "8b4e65a1887a8631f7ddc7a83961d4ad", "difficulty": 1900, "tags": ["math", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.31643002028397565, "equal_cnt": 7, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "#include\nusing namespace std;\nint main(){\n\tint m,n,s,ans=0,c=1;\n\tcin>>n>>m>>s;\n\tfor(int i=0;ians){\n\t\t\t\tans=a;\n\t\t\t\tc=1;\n\t\t\t}\n\t\t\telse if(a==ans)\n\t\t\t\tc++;\n\t\t}\n\tcout<\n#include\nusing namespace std;\n\nconst int N=100000*2+32; // \u5b57\u7b26\u4e32\u6700\u5927\u957f\u5ea6\n//const int M=18; // M=log2(n)\n\n//int lcp[M][N];\nchar str[N]; // \u5728\u672b\u5c3e\u52a0\u4e86'$'\u7684\u5b57\u7b26\u4e32\n\nint num[N]; // \u5c0f\u4e8e\u7b49\u4e8e\u6bcf\u4e2arank\u7684\u4e2a\u6570\n\nint len; // \u5728\u672b\u5c3e\u52a0\u4e86'$'\u7684\u5b57\u7b26\u4e32\u957f\u5ea6\n\nint *sa,*sa2,*rank,*rank2;\nint our[4][N];\n\nint my[N];\n\nvoid suffix_array()\n{\n\tint i,k;\n\tsa=our[0];\n\tsa2=our[1];\n\trank=our[2];\n\trank2=our[3];\n\tmemset(num,0,sizeof(num));\n\tfor(i=0;i=0;i--)\n\t\tsa[--num[str[i]]]=i;\n\tfor(rank[sa[0]]=0,i=1;i=0;i--)\n\t\t\tif(sa[i]>=k)\n\t\t\t\tsa2[--num[rank[sa[i]-k]]]=sa[i]-k;\n\t\tfor(i=len-k;i=n\u6216\u8005sa2[i-1]+k>=n\u65f6\u5fc5\u6709rank[sa2[i]]!=rank[sa2[i-1]\n\t\t\t\trank2[sa2[i]]++;\n\t\t}\n\t\t// rank2 \u7ed3\u675f\n\n\t\tswap(sa,sa2);\n\t\tswap(rank,rank2);\n\t}\n}\n\nvoid lcp_rmq()\n{\n\tint i,j,k;\n\tfor(i=0,k=0;i\n#include \n#include \n#define SZ(a) ((int) (a.size()))\nusing namespace std;\nconst int MAXN = 6010;\nconst int mod = 1000000007;\ntypedef pair ii;\nint n;\nlong long k[MAXN],k2[MAXN];\nint main(){ \n string asd;\n string asd2 \n cin >> asd;\n cin >> asd2; \n n = SZ (asd2); \n long long res=0; \n for(int i=0;i\n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\ntypedef pair pii;\n\nint n;\nchar a[30][30];\nlong b[10000000]['z'], bc = 1;\nchar t[50];\nint tc = 0;\n\nvoid rec(int x, int y, int bp){\n\tif(!b[bp][a[x][y]]){\n\t\tb[bp][a[x][y]] = bc++;\n\t}\n\t\n\tif(x + 1 < n)\n\t\trec(x + 1, y, b[bp][a[x][y]]);\n\tif(y + 1 < n)\n\t\trec(x, y + 1, b[bp][a[x][y]]);\n}\n\npii doit(int bp, int mark){\n\tint q = -1;\n\tpii w;\n\tchar e = ' ';\n\ttc++;\n\t\n\tfor(char c = 'a'; c <= 'z'; c++){\n\t\tif(b[bp][c]){\n\t\t\tt[tc - 1] = c;\n\t\t\tpii tmp = doit(b[bp][c], mark ^ 1);\n\t\t\tif(c == 'a')\n\t\t\t\ttmp.first++;\n\t\t\tif(c == 'b')\n\t\t\t\ttmp.second++;\n\t\t\t\n\t\t\tbool res = (mark ? (tmp.second > q) : (tmp.first > q));\n\t\t\t\n//\t\t\tprintf(\"%7s: %d %d %d %d\\n\", t, tmp.first, tmp.second, mark, res);\n\t\t\t\n\t\t\tif(res){\n\t\t\t\tq = (mark ? tmp.second : tmp.first);\n\t\t\t\tw = tmp;\n\t\t\t\te = c;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tif(q < 0){\n\t\tw.first = 0;\n\t\tw.second = 0;\n\t}\n\t\n\tt[tc - 1] = 0;\n\ttc--;\n\t\n\treturn w;\n}\n\nint main(){\n#if 0\n\tfreopen(\"input.txt\", \"r\", stdin);\n//\tfreopen(\"output.txt\", \"w\", stdout);\n#endif\n\n\tscanf(\"%d\", &n);\n\tgets(a[0]);\n\t\n\tfor(int i = 0; i < n; i++){\n\t\tgets(a[i]);\n\t}\n\t\n\trec(0, 0, 0);\n\t\n\tpii q = doit(0, 0);\n\t\n\tif(q.first < q.second)\n\t\tprintf(\"SECOND\");\n\telse if(q.first > q.second)\n\t\tprintf(\"FIRST\");\n\telse\n\t\tprintf(\"DRAW\");\n}\n", "lang": "GNU C++", "bug_code_uid": "65d700c0092ba8e90603e9b25d62d1e4", "src_uid": "d803fe167a96656f8debdc21edd988e4", "apr_id": "a553e68bc326040a0a7be82e08605020", "difficulty": 2400, "tags": ["dp", "games", "bitmasks"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.3526093088857546, "equal_cnt": 24, "replace_cnt": 12, "delete_cnt": 2, "insert_cnt": 10, "fix_ops_cnt": 24, "bug_source_code": "#include \n#include\n#include\n\nusing namespace std;\nvectorvec;\nvectorvec2;\n\nint main()\n{\n int r , l;\n cin >> r >> l;\n vec.push_back(4);\n vec.push_back(7);\n for(int i = 2 ; i <= 10000;i++)\n {\n vec.push_back ( (vec[i-2] * 10) + 4);\n vec.push_back ( (vec[i-2] * 10) + 7);\n }\n\n sort(vec.begin(),vec.end());\n\n for(int i = 0 ; i <=vec.size();i++)\n {\n\n \tif(r == l+1)\n \t\tbreak;\n \telse\n \t{\n \t while(vec[i]>=r && r != l+1)\n \t {\n// \t \t cout << r<<\"is \"<\nusing namespace std;\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tint array[n];\n\tint i=0;\n\twhile(imax) max=count;\n\t\t\ttemp=array[i];\n\t\t\tcount=1;\n\t\t}\n\t\t//printf(\"%d %d %d\\n\",array[i],count,max);\n\t}\n\tprintf(\"%d\\n\",max);\n\n}", "lang": "GNU C++17", "bug_code_uid": "d408d2c4306ab1bc4c8184c65c25ae03", "src_uid": "f30329023e84b4c50b1b118dc98ae73c", "apr_id": "4bb37778fe3f6a37b581688f2a9a1508", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8553540587219344, "equal_cnt": 32, "replace_cnt": 29, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 31, "bug_source_code": "#include \n#define ll int\nusing namespace std;\ninline void read(int &x){\n char ch;\n bool flag=false;\n for (ch=getchar();!isdigit(ch);ch=getchar())if (ch=='-') flag=true;\n for (x=0;isdigit(ch);x=x*10+ch-'0',ch=getchar());\n x=flag?-x:x;\n}\n\ninline void write(int x) {\n static const int maxlen = 100;\n static char s[maxlen];\n if (x < 0) { putchar('-'); x = -x;}\n if (!x) { putchar('0'); return; }\n int len = 0; for (; x; x /= 10) s[len++] = x % 10 + '0';\n for (int i = len - 1; i >= 0; --i) putchar(s[i]);\n}\n\nint lowbit(int x){\nreturn x&(-x);\n}\n\n\nint std_ans[100]={0,1,1,4,2,6,120,600,240,1440,15120,120960};\n//7015680\n//4838400\n\nconst int P=1e9+7;\nint n;\nint f[ 1000100 ][ 30 ][2];\nint ans=0;\n\nint main(){\n read(n);\n if ( n==0 )\n {\n cout<= (1<<(cnt_bit-1))*3 )\n f[1][cnt_bit-1][1]=1;\n for (int i=2;i<=n;i++)\n for (int j=0ll;j<=cnt_bit;j++)\n {\n if ( n/(1<=0 )\n f[i][j][0]=(f[i][j][0]+f[i-1][j][0]*( n/(1<=0 )\n f[i][j][1]=(f[i][j][1]+f[i-1][j][1]*(n/( (1< 2^(j)\n\n\n", "lang": "GNU C++11", "bug_code_uid": "e83b0363506f8832cf4ccf7f5fc43716", "src_uid": "b2d59b1279d891dba9372a52364bced2", "apr_id": "4d05c4142dbb5e5efe94809d9fbf8b05", "difficulty": 2500, "tags": ["dp", "math", "combinatorics", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5101809954751131, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 9, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nconst int mod = 1000000007;\n\nlong long c, h[2], w[2];\ninline long long joy(long long x) {\n\treturn x * h[0] + (c - x * w[0]) / w[1] * h[1];\n}\nvoid getAns(int l, int r) {\n\tlong long s0 = l * w[0], h0 = l * h[0], ans = 0;\n\tfor (int i = l; i <= r; ++i) {\n\t\tans = max(ans, h0 + (c - s0) / w[1] * h[1]);\n\t\ts0 += w[0], h0 += h[0];\n\t}\n\tcout << ans << endl;\n}\nint main() {\n\t// freopen(\"in\", \"r\", stdin);\n\tcin >> c >> h[0] >> h[1] >> w[0] >> w[1];\n\tif (w[0] < w[1]) {\n\t\tswap(w[0], w[1]);\n\t\tswap(h[0], h[1]);\n\t}\n\tlong long m = c / w[0];\n\tif (m < 1000) {\n\t\tgetAns(0, m);\n\t} else {\n\t\tlong long l = 0, r = m;\n\t\twhile (r - l > 1000) {\n\t\t\t// cout << l << \" \" << r << endl;\n\t\t\tlong long mid1 = (l + r) / 2;\n\t\t\tlong long mid2 = (mid1 + r) / 2;\n\t\t\tif (joy(mid1) < joy(mid2)) {\n\t\t\t\tl = mid1 + 1;\n\t\t\t} else {\n\t\t\t\tr = mid2 - 1;\n\t\t\t}\n\t\t}\n\t\tgetAns(l, r);\n\t}\n\treturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "98763a335a8517ec80ed141908bd526a", "src_uid": "eb052ca12ca293479992680581452399", "apr_id": "28f021c0a8fd42aac844e17d5dc7efa3", "difficulty": 2000, "tags": ["math", "brute force", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9016949152542373, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n\nusing namespace std;\n\n#define ll long long int\n#define ull unsingned long long int\n#define pi 2*acos(0.0)\n\n\nint main()\n{\n ll t,cases=1;\n char a[1000],b[1000];\n while(true)\n {\n scanf(\"%s %s\",a,b);\n puts(a);\n }\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "b15d89704e00a87b78fc0392f78b297c", "src_uid": "9c5b6d8a20414d160069010b2965b896", "apr_id": "6540019633d4c49ae0a410420fe3bf18", "difficulty": 800, "tags": ["math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9612174766813942, "equal_cnt": 11, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 6, "fix_ops_cnt": 10, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n#define ll long long\n#define vt vector\n#define inf 1000000000\n#define mod 1000000007\n#define eps 1e-12\n#define M_PI 3.14159265358979323846\n\nint main()\n{\n\tll n;\n\tdouble r, v, si, fi;\n\tcin >> n >> r >> v;\n\tfor (int i = 0; i < n; i++)\n\t{\n\t\tcin >> si >> fi;\n\t\tdouble dist = fi - si;\n\t\tdouble cir = 2 * M_PI *r;\n\t\tdouble rev = dist / cir;\n\t\trev = floor(rev);\n\t\tdouble time = rev * (cir / v);\n\t\tdist -= time*v;\n\t\tdouble left = 0;\n\t\tdouble right = cir/v;\n\t\twhile (right - left > eps)\n\t\t{\n\t\t\tdouble mid = (left + right) / 2;\n\t\t\tdouble temp = 2 * r*sin(mid * M_PI / time) + mid * v;\n\t\t\tif (temp >= dist)\n\t\t\t\tright = mid;\n\t\t\telse\n\t\t\t\tleft = mid;\n\t\t}\n\t\ttime += left;\n\t\tprintf(\"%.6f\\n\", time);\n\t}\n\tsystem(\"pause\");\n\treturn 0;\n}", "lang": "GNU C++", "bug_code_uid": "1a8737a6d65437b702570c990d367e04", "src_uid": "3882f2c02e83bd2d55de8004ea3bbd88", "apr_id": "c5eea05352617d5f8bd36c766ab004cd", "difficulty": 2500, "tags": ["geometry"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.0, "equal_cnt": 0, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "as", "lang": "GNU C++11", "bug_code_uid": "9442d68046511d853be8a108668311bb", "src_uid": "9c766881f6415e2f53fb43b61f8f40b4", "apr_id": "dcad8c98459e4f2d3dffe19bf333bcf1", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9897018970189702, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "//\n// main.cpp\n// a\n//\n// Created by \u9ec4\u5b87\u51e1 on 16/2/29.\n// Copyright \u00a9 2016\u5e74 \u9ec4\u5b87\u51e1. All rights reserved.\n//\n\n#include \n#include \nusing namespace std;\n\nconst int R=12;\n\nint grid[R][R];\nint a[R][R];\n\nint r,c,n,m;\n\nint main(int argc, const char * argv[]) {\n scanf(\"%d%d%d%d\",&r,&c,&n,&m);\n memset(grid,0,sizeof(grid));\n int x,y;\n for(int i=1;i<=n;i++){\n scanf(\"%d%d\",&x,&y);\n grid[x][y]=1;\n }\n memset(a,0,sizeof(a));\n for(int i=1;i<=r;i++){\n for(int j=1;j<=c;j++){\n a[i][j]=a[i][j-1]+a[i-1][j]-a[i-1][j-1]+grid[i][j];\n }\n }\n long long ans=0;\n for(int i=1;i<=r;i++){\n for(int j=1;j<=c;j++){\n for(int k=i;k<=r;k++){\n for(int l=j;l<=c;l++){\n if(a[k][l]-a[i-1][l]-a[k][j-1]+a[i-1][j-1]>=m) ans++;\n }\n }\n }\n }\n cout<\nusing namespace std; \n#define DEBUG(x) cout << '>' << #x << ':' << x << endl;\n#define REP(n) for(int i=0;i<(n);i++)\n#define FOR(a,b) for(int i=(a);i<=(b);i++)\n#define FORD(a,b) for(int i=(a);i>=(b);i--)\n#define eb emplace_back\n#define pb push_back\n#define mp make_pair\n#define ff first\n#define ss second\n#define endl \"\\n\"\n#define ALL(v) v.begin(), v.end() \n#define ALLA(arr, sz) arr, arr + sz \n#define SIZE(v) (int)v.size() \n#define SORT(v) sort(ALL(v)) \n#define REVERSE(v) reverse(ALL(v)) \ntypedef vector vi; \ntypedef pair pi;\ntypedef vector vll; \ntypedef long long ll;\nlong long e = 1000000007;\n\nint gcd(int a, int b){\n return b == 0 ? a : gcd(b, a % b);\n}\n\nvoid traverse(vector v)\n{\n for(int i = 0;i < v.size();++i)\n cout << v[i] << \" \";\n cout << endl;\n}\n\n/////////////////////////////////////////////////////////////////////\nvector c[31];\nvoid pascal()\n{ \nll i,j;\n\tc[1].pb(1);c[1].pb(1);\n\tfor(i=2;i<=30;i++)\n\t{\n\t\tc[i].pb(1);\n\t\tfor(j=1;j<=i-1;j++)\n\t\t{\n\t\t\tc[i].pb(c[i-1][j]+c[i-1][j-1]);\n\t\t}\n\t\tc[i].pb(1);\n\t}\n}\n\n\nint main()\n{\n ios_base::sync_with_stdio(false);\n cin.tie(NULL);\n cout.tie(NULL);\n\n int i, j, k, l, n, x, y, m, t, z, a, b, test, temp;\n cin>>n;\n ll sum = 1;\n for(int i = n; i>n-5; i++)\n sum *= n;\n cout<\n\n\nint main()\n{\n\n int n, a;\n char b;\n std::cin>>n;\n\n switch (n % 4)\n {\n case 0:\n std::cout<<1<<\"\" A\";\n break;\n case 1:\n std::cout<<0<<\" A\";\n break;\n case 2:\n std::cout<<1<<\" B\";\n break;\n case 3:\n std::cout<<2<<\" A\";\n break;\n default:\n break;\n }\n // n % 4 = 0 1, 1 0, 2 1, 3 2, \n \n return 0;\n\n}", "lang": "GNU C++17", "bug_code_uid": "98ca712b79573b614f7a09a16bdbc032", "src_uid": "488e809bd0c55531b0b47f577996627e", "apr_id": "13709f73aaf62a8750e962f7f0dc4f4b", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.2523191094619666, "equal_cnt": 24, "replace_cnt": 16, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 23, "bug_source_code": "#include\n\nusing namespace std;\nint occur(int arr[],int a,int b){\n int i;int res=0;\n sort(arr+a,arr+b);\n for(i=a-1;i>t;\nwhile(t){\nint n,k,d;cin>>n>>k>>d;int arr[n];int l;int minim=1000000000;\nfor(int a=0;a>arr[a];\n\nfor(int b=0;b<=n-d;b++){\n l=occur(arr,b,b+d);\n if(l\nusing namespace std;\nint main()\n{\n char s[300];\n int a,b;\n cin>>s;\n cin>>a;\n int x=0,p;\n p=strlen(s);\n for(int i=0; i\n\ntypedef long long ll;\n\nll a, k1, lowerX, upperX, x, xstep;\nll b, k2, lowerY, upperY, y, ystep;\nll l, r, d, D;\n\nll egcd(ll a, ll b, ll &x0, ll &y0) {\n x0 = 1, y0 = 0;\n ll x1 = 0, y1 = 1, q;\n\n while (b) {\n q = a/b;\n a = a - q*b;\n std::swap(a, b);\n x0 = x0 - q*x1;\n std::swap(x0, x1);\n y0 = y0 - q*y1;\n std::swap(y0, y1);\n }\n\n return a;\n}\n\nint sgn(ll a) {\n return a < 0 ? -1 : a > 0 ? 1 : 0;\n}\n\nbool valid(ll x, ll y) {\n if (x < lowerX || x > upperX) return false;\n if (y < lowerY || y > upperY) return false;\n return true;\n}\n\nint main() {\n scanf(\"%lld%lld%lld%lld%lld%lld\", &a, &k1, &b, &k2, &l, &r);\n if (k2 < k1) {\n std::swap(k2, k1);\n std::swap(a, b);\n }\n\n lowerX = std::max(0LL, ((l - k1) + (a - 1)) / a);\n upperX = (r - k1) < 0 ? - 1 : (r - k1) / a;\n\n lowerY = std::max(0LL, ((l - k2) + (b - 1)) / b);\n upperY = (r - k2) < 0 ? - 1 : (r - k2) / b;\n\n D = k2 - k1;\n d = egcd(a, -b, x, y);\n if (D%d) {printf(\"0\\n\"); return 0;}\n x *= D/d; y *= D/d;\n\n xstep = -b/d;\n ystep = a/d;\n\n if (x < lowerX) {\n ll up = (lowerX - x + std::abs(xstep) - 1) / std::abs(xstep);\n if (xstep > 0) x += xstep * up, y -= ystep * up;\n else x -= xstep * up, y += ystep * up;\n }\n\n if (x > lowerX) {\n ll drop = (x - std::abs(lowerX)) / std::abs(xstep);\n if (xstep > 0) x -= xstep * drop, y += ystep * drop;\n else x += xstep * drop, y -= ystep * drop;\n }\n\n if (y < lowerY) {\n ll up = (lowerY - y + std::abs(ystep) - 1) / std::abs(ystep);\n if (ystep < 0) x += xstep * up, y -= ystep * up;\n else x -= xstep * up, y += ystep * up;\n }\n\n ll up1 = (upperX - x) / std::abs(xstep);\n ll up2 = (upperY - y) / std::abs(ystep);\n assert(up1 == up2);\n\n printf(\"%lld\\n\", std::max(0LL, std::min(up1, up2)) + valid(x, y));\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "e28792f3abdee33a87039ee6be8a7129", "src_uid": "b08ee0cd6f5cb574086fa02f07d457a4", "apr_id": "6913bad9937c333c9d9f835efdb855ae", "difficulty": 2500, "tags": ["math", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.10822831727205337, "equal_cnt": 16, "replace_cnt": 12, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 16, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n int i,j,k,n,a,b,ma;\n cin>>n;\n cin>>a;\n cin>>b;\n \nint bb,aa;\naa=a;\nbb=b;\n while((aa/a + bb/b)!=n)\n {\n if(a\nusing namespace std;\nint total (int a, int s);\n\nint main() {\n int a, b, s, countx=0, county=0, count=0, x, y;\n cin >> a >> b >> s;\n x = 0;\n y = 0;\n \n if (s < b)\n cout << \"NO\";\n else\n {\n countx = total(a, s);\n county = total(b, s);\n count = countx + county;\n if (count == s)\n\t cout << \"YES\";\n else \n\t cout << \"NO\";\n }\nreturn(0);\n}\n\n\nint total (int a, int s)\n{\n int x = 0;\n int ctr=0;\n for (int i=1; i<=s; i++)\n {\n\t if (x < a)\n\t {\t \n\t\t x++;\n\t\t ctr++;\n\t }\t \n\t else if (x > a)\n\t {\n\t x--;\n\t ctr++;\n\t }\n\t else if (x ==0)\n\t x=1;\n\t else \n\t\tbreak;\n }\n return (ctr);\t\n}\n\n", "lang": "GNU C++", "bug_code_uid": "318c4d0c1c74deaf53e21b19b0a2aac2", "src_uid": "9a955ce0775018ff4e5825700c13ed36", "apr_id": "552559b375c587da2f0279a63ac42933", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8846153846153846, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n long long n,a=1,b=1,m;\n cin>>n;\n for(int i=1;i<=n;++i)\n {\n a=a*3*3*3%m;\n b=b*7%m;\n }\n cout<<(a-b+m)%m;\n}\n", "lang": "GNU C++11", "bug_code_uid": "a0fbdda4279bef45ca9ed7717f15846d", "src_uid": "eae87ec16c284f324d86b7e65fda093c", "apr_id": "82a91604a3f89732cca939e34bd6bc7d", "difficulty": 1500, "tags": ["combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9877094972067039, "equal_cnt": 11, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 10, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\ntypedef long long int64;\n\nconst int64 INF = 1e9;\n\nint main() {\n int64 n;\n cin >> n;\n vector div;\n for (int i = 1; i*i <= n; ++i)\n if (n % i == 0) {\n div.push_back(i);\n if (i*i < n) \n div.push_back(n/i);\n }\n \n int64 mina = INF, maxa = -INF;\n \n int size = div.size();\n for (int i = 0; i < size; ++i)\n for (int j = 0; j < size; ++j) {\n if (n / div[i] % div[j] != 0)\n continue;\n int k = n / div[i] / div[j];\n int64 cur = (div[i] + 1)*(div[j] + 2)*(k + 2);\n maxa = max(maxa, cur);\n mina = min(mina, cur);\n }\n cout << mina-n << \" \" << maxa-n << endl;\n return 0;\n}", "lang": "GNU C++", "bug_code_uid": "444e7aad0e420b37e36de304172c82d6", "src_uid": "2468eead8acc5b8f5ddc51bfa2bd4fb7", "apr_id": "3eda4b5ec467fec407510cc49c363ecf", "difficulty": 1600, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9625, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \nusing namespace std;\n\nint main()\n{\n\tfreopen(\"input.txt\", \"r\", stdin);\n\tfreopen(\"output.txt\", \"w\", stdout);\n\tchar c[4][4];\n\tfor (int i = 0 ; i < 4; i++)\n\t{\n\t\tfor (int j = 0 ; j < 4; j++)\n\t\t{\n\t\t\tchar t;\n\t\t\tdo\n\t\t\t{\n\t\t\t\tcin >> t;\n\t\t\t}\n\t\t\twhile (t != '.' && t != '#');\n\t\t\tc[i][j] = t;\n\t\t}\n\t}\n\tfor (int i = 0; i < 4; i++)\n\t{\n\t\tfor (int j = 0; j < 4; j++)\n\t\t{\n\t\t\tif (i + 1 < 4 && j + 1 < 4)\n\t\t\t{\n\t\t\t\tif (c[i][j] == c[i + 1][j] && c[i][j] == c[i][j + 1])\n\t\t\t\t{\n\t\t\t\t\tcout << \"YES\";\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (i - 1 >= 0 && j - 1 >= 0)\n\t\t\t{\n\t\t\t\tif (c[i][j] == c[i - 1][j] && c[i][j] == c[i][j - 1])\n\t\t\t\t{\n\t\t\t\t\tcout << \"YES\";\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (i + 1 < 4 && j - 1 >= 0)\n\t\t\t{\n\t\t\t\tif (c[i][j] == c[i + 1][j] && c[i][j] == c[i][j - 1])\n\t\t\t\t{\n\t\t\t\t\tcout << \"YES\";\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (i - 1 >= 0 && j + 1 < 4)\n\t\t\t{\n\t\t\t\tif (c[i][j] == c[i - 1][j] && c[i][j] == c[i][j + 1])\n\t\t\t\t{\n\t\t\t\t\tcout << \"YES\";\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tcout << \"NO\";\n\treturn 0;\n}", "lang": "MS C++", "bug_code_uid": "7d680458c848ddf0e5722a384682d8b9", "src_uid": "01b145e798bbdf0ca2ecc383676d79f3", "apr_id": "aa2a6a8cdbdd8df24cfa64e9a1c64433", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9004997728305316, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 8, "bug_source_code": "#include\n#define mx 105\n\nusing namespace std;\nvectorv1;\nvectorv2;\nint arr[mx];\nint n,l;\n\nint main()\n{\n cin>>n>>l;\n for(int i=0;i>arr[i];\n if(i)\n v1.push_back(arr[i]-arr[i-1]);\n }\n v1.push_back(l-arr[n-1]+arr[0]);\n\n for(int i=0;i>arr[i];\n if(i)\n v2.push_back(arr[i]-arr[i-1]);\n }\n v2.push_back(l-arr[n-1]+arr[0]);\n\n for(int i=0;i\nusing namespace std;\nint a,b,y,u;\nint gcd(int x,int z)\n{\n if(z==0)\n return x;\n return gcd(z,x%z);\n}\nint main()\n{\n ios::sync_with_stdio(0);\n cin.tie(0);\n cout.tie(0);\n cin>>a>>b;\n for(int i=a+1;i<=b;i++)\n {\n u=gcd(a,i);\n }\n cout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\n#define INF_MAX 2147483647\n#define INF_MIN -2147483647\n\n#define pi acos(-1.0)\n#define INF 1e9\n#define ll long long\n\n#define For(i, a, b) for( int i = (a); i < (b); i++ )\n#define Fors(i, sz) for( size_t i = 0; i < sz.size (); i++ )\n#define Fore(it, x) for(typeof (x.begin()) it = x.begin(); it != x.end (); it++)\n#define mem(a, s) memset(a, s, sizeof (a))\n#define Read() freopen(\"1.txt\", \"r\", stdin)\n#define Write() freopen(\"2.txt\", \"w\", stdout)\n#define sz(c) ((int)(c).size())\n#define pb push_back\n#define mp make_pair\n#define all(v) v.begin(),v.end()\n#define vi vector\n#define vl vector\n#define vll vector >\ntypedef pair PAIR;\ntypedef pair PAIR2;\nstring tostring(long long n){ ostringstream ss; ss << n; return ss.str(); }\nll tonumber(string str){ stringstream ss; ss << str; long long n; ss >> n; return n; }\n\nint main()\n{\n bool mn = false, mj = false;\n vector v;\n \n string vs[] = { \"C\", \"C#\", \"D\", \"D#\", \"E\", \"F\", \"F#\", \"G\", \"G#\", \"A\", \"B\", \"H\" };\n\n string a, b, c;\n int ind, on, to;\n cin >> a >> b >> c;\n v.push_back(a);\n v.push_back(b);\n v.push_back(c);\n sort(v.begin(), v.end());\n do\n {\n vector inde;\n on = 0, to = 0;\n for (int i = 0; i < v.size(); i++)\n {\n for (int j = 0; j < 12; j++)\n {\n if (v[i] == vs[j])\n inde.push_back(j);\n }\n }\n while (inde[0] != inde[1])\n {\n \n if (inde[0] == 11&& inde[1]!=11)\n {\n inde[0] -= 11;\n on++;\n }\n inde[0]++;\n on++;\n }\n while ( inde[1] != inde[2])\n {\n \n if (inde[1] == 11&& inde[2]!=11)\n {\n inde[1] -= 11;\n to++;\n }\n inde[1]++;\n to++;\n }\n if (on == 3 && to == 4)\n {\n mn = true;\n break;\n }\n\n \n else if (on == 4 && to == 3)\n {\n mj = true;\n break;\n }\n\n \n } while (next_permutation(v.begin(), v.end()));\n if (mn == true)\n cout << \"minor\" << endl;\n else if (mj == true)\n cout << \"major\" << endl;\n else\n cout << \"strange\" << endl;\n}\n", "lang": "GNU C++", "bug_code_uid": "c455f4e19dce7cf28b50076c0685356f", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "apr_id": "88f6cd450556da7f2d07066b6588f878", "difficulty": 1200, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.958976042008533, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "\ufeff#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#pragma warning(disable : 4996)\n#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cerr.tie(0);\n#define __ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cerr.tie(0);\n#define int long long\n#define ll long long\n#define $ long long\n//#define sz size()\n#define fo for(int i=0;i\n#define pr_int pair\n//#define pr pair\n#define wh while\n#define tr true\n#define fls false\n#define ct cout\n#define frs first\n#define scn second\n#define cn cin\n#define fr(i,x,y) for(int i=x;i=y;i--)\n#define main() signed main()\n#define all(x) x.begin(),x.end()\n/*#define cst const\n#define vd void;\n#define mp_int map\n#define mp_ll map\n#define mp map\n#define bg begin()\n#define en end()\n#define srt sort\n#define all(x) x.begin(),x.end()\n#define chr char\n#define strn string*/\n//#define \u0441\u0442\u0440 string\n/*#define tmp template\n#define tpn typename\n#define usn using\n#define nms namespace\n#define rtn return*/\n//#define \u0432\u0456\u043b\u043a\u043e\u0439_\u0432_\u0433\u043b\u0430\u0437 else\n/*#define el else\n#define sw switch\n#define brk break\n#define rvs reverse\n#define cs case*/\n//#define \u043d\u0438\u0444\u0438\u0433\u0430 1\n/*\n#define sgn signed\n#define vct vector\n#define vct_int vector\n#define vct_ll vector\n#define bl bool\n#define pshb push_back\n#define _ signed main()\n#define cntn continue\n#define dbl long double\n#define frp freopen*/\n/*#define mx max\n#define mn min*/\n//#define DEBUG\n\nusing namespace std;\nstruct ell\n{\n\tint a;\n\tell* next;\n\tell* previsious;\n};\nint __gcd(int a, int b)\n{\n\tif (a < b)swap(a, b);\n\twhile (b != 0)\n\t{\n\t\ta %= b;\n\t\tswap(a, b);\n\t}\n\treturn a;\n}\nclass turn\n{\nprivate:\n\tell* frs = NULL;\n\tell* end = NULL;\n\tint sz = 0;\npublic:\n\tvoid push_front(int a)\n\t{\n\t\tif (sz == 0)\n\t\t{\n\t\t\tfrs = new ell;\n\t\t\tend = frs;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tell* q = frs;\n\t\t\tfrs = new ell;\n\t\t\tfrs->next = q;\n\t\t\tq->previsious = frs;\n\t\t}\n\t\tfrs->a = a;\n\t\tsz++;\n\t}\n\tvoid push_back(int a)\n\t{\n\t\tif (sz == 0)\n\t\t{\n\t\t\tfrs = new ell;\n\t\t\tend = frs;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tend->next = new ell;\n\t\t\tend->next->previsious = end;\n\t\t\tend = end->next;\n\n\t\t}\n\t\tend->a = a;\n\t\tsz++;\n\t}\n\tbool pop_front(int& a)\n\t{\n\t\tif (sz == 0)return false;\n\t\ta = frs->a;\n\t\tif (sz == 1)\n\t\t{\n\t\t\tdelete frs;\n\t\t\tfrs = NULL;\n\t\t\tend = NULL;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tell* q = frs->next;\n\t\t\tdelete frs;\n\t\t\tfrs = q;\n\t\t}\n\t\tsz--;\n\t\treturn true;\n\t}\n\tbool pop_back(int& a)\n\t{\n\t\tif (sz == 0)return false;\n\t\ta = end->a;\n\t\tif (sz == 1)\n\t\t{\n\t\t\tdelete frs;\n\t\t\tfrs = NULL;\n\t\t\tend = NULL;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tell* q = end->previsious;\n\t\t\tdelete end;\n\t\t\tend = q;\n\t\t}\n\t\tsz--;\n\t\treturn true;\n\t}\n\tbool front(int& a)\n\t{\n\t\tif (sz == 0)return false;\n\t\ta = frs->a;\n\t\treturn true;\n\t}\n\tbool back(int& a)\n\t{\n\t\tif (sz == 0)return false;\n\t\ta = end->a;\n\t\treturn true;\n\t}\n\tint size()\n\t{\n\t\treturn sz;\n\t}\n\tvoid clear()\n\t{\n\t\twhile (sz > 0)\n\t\t{\n\t\t\tint q;\n\t\t\tthis->pop_back(q);\n\t\t}\n\t}\n};\nstring Tostring(int a)\n{\n\tstring ret = \"\";\n\twhile (a / 10 > 0)\n\t{\n\t\tret += a % 10 + 48;\n\t}\n\treturn ret + char(a + 48);\n}\nvoid make_set(int v, int snm[], int rank[])\n{\n\tsnm[v] = v;\n\trank[v] = 0;\n}\nint find_set(int v, int snm[])\n{\n\tif (snm[v] == v)return v;\n\tsnm[v] = find_set(snm[v], snm);\n\treturn snm[v];\n}\nvoid union_sets(int a, int b, int snm[], int rank[])\n{\n\ta = find_set(a, snm);\n\tb = find_set(b, snm);\n\tif (a != b) {\n\t\tif (rank[a] < rank[b])\n\t\t\tswap(a, b);\n\t\tsnm[b] = a;\n\t\tif (rank[a] == rank[b])\n\t\t\t++rank[a];\n\t}\n}\nvector prefix_function(string s) {\n\tint n = (int)s.length();\n\tvector pi(n);\n\tfor (int i = 1; i < n; ++i) {\n\t\tint j = pi[i - 1];\n\t\twhile (j > 0 && s[i] != s[j])\n\t\t\tj = pi[j - 1];\n\t\tif (s[i] == s[j]) ++j;\n\t\tpi[i] = j;\n\t}\n\treturn pi;\n}\ndouble distance(pair a, pair b)\n{\n\treturn sqrt(abs(a.first - b.first) * abs(a.first - b.first) + abs(a.second - b.second) * abs(a.second - b.second));\n}\nconst int N = 2 * 1e5 + 1, M = 1e3, MOD = 1e9 + 7;\nint mas[N];\nmain()\n{\n\tint n;\n\tcin >> n;\n\tfr(i, 0, n)\n\t{\n\t\tcin >> mas[i];\n\t}\n\tint ans = 0;\n\tfr(i, 1, n)\n\t{\n\t\tif (mas[i] != 1 && mas[i - 1] != 1)\n\t\t{\n\t\t\tans = -1;\n\t\t\tbreak;\n\t\t}\n\t\tif (mas[i] == 2 || mas[i - 1] == 2)ans += 3;\n\t\tif (mas[i] == 3 || mas[i - 1] == 3)ans += 4;\n\t}\n\tif (ans == -1)\n\t{\n\t\tcout << \"Infinite\";\n\t}\n\telse\n\t{\n\t\tcout << \"Finite\\n\";\n\t\tcout << ans;\n\t}\n}", "lang": "MS C++ 2017", "bug_code_uid": "756f0857fa1d62ec9832b727803e09f1", "src_uid": "6c8f028f655cc77b05ed89a668273702", "apr_id": "baa7b5328ae16f0c7cf4f85175f7bcbf", "difficulty": 1400, "tags": ["geometry"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.21723237597911227, "equal_cnt": 33, "replace_cnt": 25, "delete_cnt": 1, "insert_cnt": 7, "fix_ops_cnt": 33, "bug_source_code": "#include \n#include \n#include \n#include \n#define ll long long\n#define N 2010\nusing namespace std;\nstruct node\n{\n int x, y;\n friend node operator+(node a, node b)\n {\n return (node){a.x + b.x, a.y + b.y};\n }\n friend node operator-(node a, node b)\n {\n return (node){a.x - b.x, a.y - b.y};\n }\n friend ll operator*(node a, node b)\n {\n return 1ll * a.x * b.y - 1ll * a.y * b.x;\n }\n friend bool operator<(node a, node b)\n {\n return a * b < 0;\n }\n} a[N], p[N], u[N];\nbool cmp(node a, node b)\n{\n if (a.y == b.y)\n return a.x < b.x;\n return a.y < b.y;\n}\nstruct tree\n{\n node t[N << 2];\n void update(int v)\n {\n if (t[v << 1] * t[v << 1 | 1] == 0)\n t[v] = t[v << 1];\n else\n t[v].x = 2000001, t[v].y = 0;\n }\n void build(int v, int l, int r)\n {\n if (l == r)\n {\n t[v] = u[N];\n return;\n }\n int mid = l + r >> 1;\n build(v << 1, l, mid);\n build(v << 1 | 1, mid + 1, r);\n update(v);\n }\n void mdf(int v, int l, int r, int x)\n {\n if (l == r)\n {\n t[v] = u[x];\n return;\n }\n int mid = l + 1 >> 1;\n if (x <= mid)\n mdf(v << 1, l, mid, x);\n else\n mdf(v << 1 | 1, mid + 1, r, x);\n update(v);\n }\n} T;\nint n, m, L, pos[N], ans;\npair l[N * N >> 1];\nbool pd()\n{\n for (int i = 1; i <= m; i++)\n if (u[i].x != 0 || u[i].y != 0)\n return 1;\n return 0;\n}\nint main()\n{\n scanf(\"%d\", &n);\n for (int i = 1; i <= n; i++)\n scanf(\"%d%d\", &a[i].x, &a[i].y);\n\n sort(a + 1, a + n + 1, cmp);\n for (int i = 1; i <= (n + 1) / 2; i++)\n p[i] = a[i] + a[n - i + 1];\n m = (n + 1) / 2 - 1;\n for (int i = 1; i <= m; i++)\n u[i] = p[i + 1] - p[i];\n if (!pd())\n {\n puts(\"-1\");\n //system(\"pause\");\n return 0;\n }\n\n for (int i = 1; i <= n; i++)\n pos[i] = i;\n L = 0;\n for (int i = 1; i <= n; i++)\n for (int j = 1; j < i; j++)\n l[++L] = make_pair(a[i] - a[j], (i - 1) * n + j - 1);\n sort(l + 1, l + n * (n - 1) / 2 + 1);\n\n T.build(1, 1, m);\n if (T.t[1].x <= 2000000)\n ans++;\n for (int i = 1; i <= L; i++)\n {\n int a0 = l[i].second / n + 1, a1 = l[i].second % n + 1;\n\n swap(a[pos[a0]], a[pos[a1]]);\n int p0 = min(pos[a0], n - pos[a0] + 1), p1 = min(pos[a1], n - pos[a1] + 1);\n p[p0] = a[p0] + a[n - p0 + 1];\n p[p1] = a[p1] + a[n - p1 + 1];\n if (p0 > 1)\n u[p0 - 1] = p[p0] - p[p0 - 1], T.mdf(1, 1, m, p0 - 1);\n if (p0 < m)\n u[p0] = p[p0 + 1] - p[p0], T.mdf(1, 1, m, p0);\n if (p1 > 1)\n u[p1 - 1] = p[p1] - p[p1 - 1], T.mdf(1, 1, m, p1 - 1);\n if (p1 < m)\n u[p1] = p[p1 + 1] - p[p1], T.mdf(1, 1, m, p1);\n swap(pos[a0], pos[a1]);\n if (l[i].first * l[i + 1].first != 0 && i < L)\n {\n\n if (T.t[1].x <= 2000000)\n ans++;\n }\n }\n printf(\"%d\", ans);\n return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "f2dc950723714cb9358f21346333fe24", "src_uid": "5d7ba962400c05433ee17c5658888e69", "apr_id": "f5b8dfeb8a67bc88dd20e237d8e3c60f", "difficulty": 2900, "tags": ["geometry"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9878869448183042, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#pragma GCC optimize(\"-O2\")\n#include\n#include\n#include\n#include\n#include\n#define LL long long\n#define DB double\nusing namespace std;\ninline int read(){\n int x=0,f=1;char ch=getchar();\n while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}\n while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}\n return x*f;\n}\n\ninline void Out(LL x){\n if(x>9) Out(x/10);\n putchar(x%10+'0'); \n}\n\nLL qpow(LL x,LL y,LL P){\n\tLL re=1;\n\twhile(y){\n\t\tif(y&1) re=re*x%P;\n\t\tx=x*x%P;y>>=1;\t\n\t} \n\treturn re;\n}\n\n\nint top=0;\nint q[10005];\n\nLL GEN(LL x){\n\tbool flag;LL y=x-1;\n\tfor(LL i=2;i<=y;++i)\n\t\tif(y%i==0){\n\t\t\tq[++top]=i;\n\t\t\twhile(y%i==0) y/=i;\n\t\t}\n\tfor(LL i=2;;++i){\n\t\tflag=0;\n\t\tfor(LL j=1;j<=top;++j)\n\t\t\tif(qpow(i,(x-1)/q[j],x)==1){\n\t\t\t\tflag=1;break;\n\t\t\t}\n\t\tif(!flag) return i;\n\t}\n} \n\nconst int N=(1<<20)+10;\nconst LL mod=998244353;\nint rev[N]; \nstruct NTT{\n\tint n;LL g;\n\t\n\tvoid init(int m){\n\t\tg=3;n=1;int k=0;\n\t\twhile(ni) swap(a[i],a[rev[i]]);\n\t\tfor(int l=2;l<=n;l<<=1){\n\t\t\tint m=l>>1;\n\t\t\tLL wn=qpow(g,flag==1?(mod-1)/l:mod-1-(mod-1)/l,mod);\n\t\t\tfor(LL *p=a;p!=a+n;p+=l){\n\t\t\t\tLL w=1;\n\t\t\t\tfor(int k=0;k>n;\n\twhile(a\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n#define pi (3.1415926535897932384626433832795)\n#define fi first\n#define se second\n#define mp make_pair\n#define pb push_back\n#define tmin(x,y,d) (min(min((x),(y)),(d)))\n#define tmax(x,y,d) (max(max((x),(y)),(d)))\n#define sq(x) ((x)*(x))\n#define cube(x) (((x)*(x))*(x))\n#define sz(x) (int)(x).size()\n#define all(x) (x).begin(), (x).end()\n\n#define MOD 1000000007\n#define MAX 200007\n#define INF 1000000228\n#define LINF 5000000000000000228\n#define EPS 0.00000000001\n\ntypedef long double ld;\ntypedef long long ll;\ntypedef pair pii;\ntypedef pair pll;\ntypedef vector vi;\ntypedef vector vl;\n\n//#define task \"veryhard\"\n\nint t;\nvoid solve();\n\nstring s;\nint n;\n\nint main()\n{\n\tios_base::sync_with_stdio(false); cin.tie(0);\n\n#ifdef _MY_DEBUG\n\tfreopen(\"input.txt\", \"rt\", stdin); freopen(\"output.txt\", \"wt\", stdout);\n#else\n\t//\tfreopen(task\".in\", \"r\", stdin); freopen(task\".out\", \"w\", stdout);\n#endif\n\n\tt = 1;\n\t//scanf(\"%d\", &t);\n\tfor (int i = 0; i < t; ++i)\n\t{\n\t\tsolve();\n\t}\n}\n\nvoid solve()\n{\n\tcin >> n;\n\tcin >> s;\n\tint ans = 0;\n\tfor (int i = 0; i < n; ++i)\n\t{\n\t\tfor (int j = 0; j < n; ++j)\n\t\t{\n\t\t\tstring s1 = \"\";\n\t\t\tfor (int k = i; k <= j; ++j)\n\t\t\t{\n\t\t\t\ts1 += s[k];\n\t\t\t}\n\t\t\tif (s1[0] != s1[sz(s1) - 1])\n\t\t\t{\n\t\t\t\tbool fl = true;\n\t\t\t\tfor (int i1 = 1; i1 < sz(s1) - 2; ++i1)\n\t\t\t\t{\n\t\t\t\t\tif (s1[i1] >= 'A' && s1[i1] <= 'Z')\n\t\t\t\t\t{\n\t\t\t\t\t\tfl = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (fl)\n\t\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\t}\n\tcout << ans;\n}", "lang": "GNU C++14", "bug_code_uid": "f0e4d7b6478952b94926c94774f453fd", "src_uid": "567ce65f87d2fb922b0f7e0957fbada3", "apr_id": "04af40ef1c4c1c954e26fb4d8d1289fc", "difficulty": 1000, "tags": ["strings", "brute force", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9927184466019418, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \nusing namespace std;\nlong long l, r, n, i, j, k;\nstring al, ar;\nstring fun (int a, string s)\n{\n while (a>0)\n {\n if (a%2==1) s+='1';\n else s+='0';\n a/=2;\n }\n \n return s;\n}\nint main ()\n{\n cin>>l>>r;\n \n if (l==r)\n {cout<<0; return 0; }\n \n if (l+1==r)\n {\n cout<<(l^r);\n return 0;\n }\n \n while (true)\n {\n al=fun(l, \"\");\n ar=fun(r, \"\");\n \n for (i=0; i=1; i--)\n {\n if (ar[i]!=al[i]) \n {\n cout<<(1ll<<(long long)(i+1))-1;\n return 0;\n }\n }\n \n }\n \n return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "f2ec0fe258ab03ca7358c03fb2d832be", "src_uid": "d90e99d539b16590c17328d79a5921e0", "apr_id": "1d9833c1c4146bd326a5b49530f2c08b", "difficulty": 1700, "tags": ["dp", "bitmasks", "greedy", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.3544088460447973, "equal_cnt": 25, "replace_cnt": 17, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 24, "bug_source_code": "#include \n#include\n#include\n#include\n#include\n#include\n#define ll long long\nusing namespace std;\nll read()\n{\n\tll s=0;\n\tchar c=getchar();\n\twhile(c<'0'||c>'9')\n\t{\n\t\tc=getchar();\n\t}\n\twhile(c>='0'&&c<='9')\n\t{\n\t\ts=s*10+c-'0';\n\t\tc=getchar();\n\t}\n\treturn s;\n} \nll n,m,a,b,x,y,z,g[9000010],f[3001][3001],st[3000][12],h[3001][3001],k,xf[3001][3001],ans=0;\nint main()\n{\n\tn=read();\n\tm=read();\n\ta=read();\n\tb=read();\n\tg[0]=read();\n\tx=read();\n\ty=read();\n\tz=read();\n\tfor(ll i=1;i<=n*m;i++)\n\t{\n\t\tg[i]=(g[i-1]*x+y)%z;\n\t}\n\tfor(ll i=1;i<=n;i++)\n\t{\n\t\tfor(ll o=1;o<=m;o++)\n\t\t{\n\t\t\th[i][o]=g[(i-1)*m+o-1];\n\t\t}\n\t}\n\tk=0;\n\twhile(pow(2,k)<=b)k++;\n\tk--;\n//\tcout<<\"K=\"<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define LL long long\nusing namespace std;\nvectorq;\nvoid rec(int i)\n{\n\tq.push_back(0);\n\tfor (int j =1; j <= i; j++)\n\t{\n\t\tq.push_back(q[j-1]+j);\n\t}\n\treturn;\n}\nint main()\n{\n\tint n, k, x;\n\tscanf(\"%d %d\", &n, &k);\n\trec(n);\n\tfor (x = 0; x < n; x++)\n\t{\n\t\tif (q[n - x] - x == k)break;\n\t}\n\tcout << x << endl;\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "709cbb801ac6297394c49d7a22e13400", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "apr_id": "d73601fd490abd7c3417f06a2bb11ff1", "difficulty": 1000, "tags": ["math", "brute force", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.6281645569620253, "equal_cnt": 11, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "#include \nusing namespace std;\ntypedef long long ll;\n#define rep(i,n) for(ll i=1;i<=n;i++)\n#define mp make_pair\n#define pb push_back\ntypedef vector vi;\n//const ll M=0;\ntypedef pair pi;\n//vector< pi > adj[M];\n//vector v;\nint mark[105];\n\nint main()\n{\n ios::sync_with_stdio(false);\n cin.tie(NULL);\n \n ll a,b,c,d;\n cin >> a >> b >> c >> d;\n \n mark[b]=1;\n rep(i,c)\n mark[b+i*a]=1;\n \n ll flag=0;\n rep(i,a+1)\n {\n if(mark[d+i*c]==1)\n {\n cout << d+i*c;\n flag=1;\n break;\n }\n }\n \n if(flag==0)\n cout << \"-1\\n\";\n}", "lang": "GNU C++14", "bug_code_uid": "2d0b023873dd27dd34808e29089db21c", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "apr_id": "76bab387143133e485f589862b8b1729", "difficulty": 1200, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9010989010989011, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n#define sqr(x) ((x) * (x))\n#define mp make_pair\n#define pb push_back\n#define foreach(i, a) for (__typeof(a) i = a.begin(); i != a.end(); i++)\n#define FOR(i, k, n) for (int i = (k); i <= (n); i++)\n#define FORD(i, k, n) for (int i = (k); i >= (n); i--)\n#define REP(i, n) FOR(i, 0, (n) - 1)\n#define CLEAR(a) memset(a, 0, sizeof a)\n#define SZ(a) (int) (a).size()\n\ntypedef long long ll;\ntypedef vector vi;\ntypedef pair pii;\n\nconst ll INF = 1000000000000000000ll, base = 1000000007;\nconst int MAXN = 111111;\n\nint main() {\n\tstring s;\n\tcin >> s;\n\tint n = SZ(s);\n\tif (n == 1) {\n\t\tif (s[0] == '1')\n\t\t\tcout << '1'; else\n\t\t\tcout << '0';\n\t\treturn 0;\n\t}\n\tll ans = 0, p = 2;\n\tFORD(i, n - 1, 0) {\n\t\tif (s[i] == '1')\n\t\t\tans = (ans + p) % base;\n\t\tp = (p * 2) % base;\n\t}\n\tcout << ans;\n\treturn 0;\n", "lang": "GNU C++", "bug_code_uid": "030733fcb5dde199ef5fda6979fdb782", "src_uid": "89b51a31e00424edd1385f2120028b9d", "apr_id": "1265a069e2dfc4daa5deda96aefad632", "difficulty": 1600, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8872814948764316, "equal_cnt": 19, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 7, "fix_ops_cnt": 18, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n\n#define PB push_back\n#define SZ(c) ll((c).size())\n#define ALL(c) (c).begin(), (c).end()\n#define CONTAINS(c, x) ((c).find(x)!=(c).end())\n#define foreach(it, c) for(typeof((c).begin()) it=(c).begin(); it!=(c).end(); it++)\n#define WAIT cout< pii;\n#define double long double\n#define MAX 100100\n\ndouble N, l, r, a, b, c;\ndouble A[MAX];\ndouble sol;\n\nvoid DFS(ll n){\n if (n>1e9) return;\n A[++N]=n;\n DFS(n*10+4);\n DFS(n*10+7);\n}\n\ndouble prob(double lol, double hil, double loa, double hia){\n //cout << lol << \" \" << hil << \" \" << loa << \" \" << hia << endl;\n lol = max(lol, l);\n hil = min(hil, r);\n loa = max(loa, a);\n hia = min(hia, b);\n //cout << lol << \" \" << hil << \" \" << loa << \" \" << hia << endl;\n //cout << endl;\n \n double cl = (hil-lol+1);\n double ca = (hia-loa+1);\n if (min(cl, ca)<=0) return 0;\n \n return (cl/(double)(r-l+1))*(ca/(double)(b-a+1));\n}\n\nint main(){\n ios_base::sync_with_stdio(0);\n cin.tie(0);\n \n cout << setprecision(15) << fixed;\n \n DFS(4);\n DFS(7);\n sort(A, A+N);\n //for(double I=0; I<10; I++) cout<> l >> r >> a >> b >> c;\n for(double I=c; I<=N; I++){\n if (A[I]>max(b,r)) break;\n //cout << c << endl;\n sol += prob(A[I-c]+1, A[I-c+1], A[I], A[I+1]-1);\n sol += prob(A[I], A[I+1]-1, A[I-c]+1, A[I-c+1]);\n }\n cout << sol << endl;\n //WAIT;\n}\n\n\n\n\n\n\n\n\n", "lang": "GNU C++", "bug_code_uid": "73bdc7feb5ad5d936f691612088797ba", "src_uid": "5d76ec741a9d873ce9d7c3ef55eb984c", "apr_id": "a3fb12da9ffd1095faa7e59b13cbd859", "difficulty": 1900, "tags": ["dfs and similar", "probabilities", "brute force", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5844245348035837, "equal_cnt": 6, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "#include \nusing namespace std;\n#define ll long long\nint main()\n{\n ll m,n,q=998244853,sum=1,a=1,b=1,r=0,d,s;\n cin >> n >> m;\n if(n==0){cout << 0; return 0;}\n if(m==0){cout << n; return 0;}\n for(ll i=1; i1)\n {\n d=__gcd(s,r);\n s=s/d;\n r=r/d;\n r+=q;\n }\n sum = (sum + r)%q;\n if(n>m)\n {\n a = (a*(n+1))%q;\n b = (b*m)%q;\n while(b>1)\n {\n d=__gcd(a,b);\n a=a/d;\n b=b/d;\n a+=q;\n }\n sum = (sum + (n-m)*a)%q;\n }\n cout << sum;\n return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "6c88902e48e08ff33d75b6dbe5dc0c06", "src_uid": "a2fcad987e9b2bb3e6395654cd4fcfbb", "apr_id": "5be8070c3566dc29c31cd174a9531084", "difficulty": 2300, "tags": ["dp", "math", "combinatorics", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.17446673034065585, "equal_cnt": 72, "replace_cnt": 44, "delete_cnt": 6, "insert_cnt": 22, "fix_ops_cnt": 72, "bug_source_code": "\n#include \n\n#define dbg(x) cerr<<#x\": \"<>(istream& in, point &p) { return in >> p.x >> p.y; }\n\nistream& operator>>(istream& in, circle &c) { return in >> c.o >> c.r; }\n\nistream& operator>>(istream& in, seg &s) { return in >> s.a >> s.b; }\n\nlong double area(point a, point b, point c) {\n\treturn a.x * b.y + b.x * c.y + c.x * a.y - a.y * b.x - b.y * c.x - c.y * a.x;\n return (b.x - a.x) * (c.y - a.y) - (c.x - a.x) * (b.y - a.y);\n}\n\nbool isObtouseAngle(point A, point B, point C) {\n\t//check if A angle is obtuse\n\tdouble a = dist(B, C);\n\tdouble b = dist(A, C);\n\tdouble c = dist(B, A);\n\ta *= a;\n\tb *= b;\n\tc *= c;\n\tif(b + c < a)\n\t\treturn true;\n\treturn false;\n}\n\ndouble dist(point p, seg s) {\n\t// dbg(p);\n\t// dbg(s.a);\n\t// dbg(isObtouseAngle(p, s.a, s.b));\n\tif(isObtouseAngle(s.a, s.b, p) || dist(s.a, s.b) <= EPS || isObtouseAngle(s.b, s.a, p))\n\t\treturn min(dist(p, s.a), dist(p, s.b));\n\treturn fabs(area(p, s.a, s.b)) / dist(s.a, s.b);\n}\n\n\nbool checkInt(seg a, seg b)\n{\n\tif(area(a.a, a.b, b.a) * area(a.a, a.b, b.b) >= EPS)\n\t\treturn false;\n\tif(area(b.a, b.b, a.a) * area(b.a, b.b, a.b) >= EPS)\n\t\treturn false;\n\treturn true;\n}\n\ncircle c[4];\n\nint v[DMAX][DMAX];\n\nint dx[] = {0, 1, 0, -1};\nint dy[] = {-1, 0, 1, 0};\n\nvoid dfs(int i, int j) {\n\tint val = v[i][j];\n\tv[i][j] = 0;\n\tfor(int ii = 0; ii < 4; ii++) {\n\t\tif(v[i + dx[ii]][j + dy[ii]] == val)\n\t\t\tdfs(i + dx[ii], j + dy[ii]);\n\t}\n}\n\nint main()\n{\n\tios_base::sync_with_stdio(false);\n\tcin >> n;\n\tfor(int i = 1; i <= n; i++) {\n\t\tcin >> c[i];\n\t}\n\tint xi, yi;\n\tdouble x, y;\n\tfor(xi = 1, x = -11.00000001; x < 11; x += 0.008, xi++)\n\t\tfor(yi = 1, y = -11.00000001; y < 11; y += 0.008, yi++) {\n\t\t\tpoint p(x, y);\n\t\t\tint msk = 0;\n\t\t\tfor(int i = 1; i <= n; i++) {\n\t\t\t\tif(dist(c[i].o, p) < c[i].r) msk += (1 << i);\n\t\t\t}\n\t\t\tv[xi][yi] = msk;\n\t\t\t// if(msk)\n\t\t\t// dbg(xi), dbg(yi);\n\t\t}\n\n\tint ans = 1;\n\t\n\tfor(int i = 1; i <= DMAX - 3; i++)\n\t\tfor(int j = 1; j <= DMAX - 3; j++) {\n\t\t\tif(v[i][j] != 0)\n\t\t\t\tdfs(i, j), ans++;\n\t\t}\n\t\tcout << ans << '\\n';\n}", "lang": "GNU C++14", "bug_code_uid": "072df5e357ce15b8a7e4c26699656dd1", "src_uid": "bda5879e94a82c6fd499796f258c4691", "apr_id": "64e35c298aee48260e00930a49ec305f", "difficulty": 2700, "tags": ["graphs", "geometry"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9824253075571178, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\nint t;\nint a,b,c;\nlong long mod=998244353ll;\nlong long f[3010][3010];\nvoid init()\n{\n\tfor(int i=1;i<=3000;i++) f[i][1]=f[1][i]=i+1;\n\tfor(int i=2;i<=3000;i++)\n\t\tfor(int j=2;j<=3000;j++) \n\t\t\tf[i][j]=(f[i-1][j-1]*i%mod+f[i][j-1])%mod;\n}\nlong long calc(int x,int y)\n{\n\treturn f[x][y]%mod;\n}\nint main()\n{\t\n\tinit();\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tprintf(\"%lld\\n\",calc(a,b)*calc(b,c)%mod*calc(a,c)%mod);\n return 0;\n}", "lang": "GNU C++", "bug_code_uid": "c85f7bc938f5e49bdb4e9c13bfb9b482", "src_uid": "b6dc5533fbf285d5ef4cf60ef6300383", "apr_id": "dc59f3ff12a23c2d442f4f25da2f3939", "difficulty": 1800, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7319050376375217, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef long long ll;\nusing namespace std;\nconst int nmax = 100005;\nconst int mod = 1e9 + 7;\nconst ll inf = 3 * 1e12;\nconst double EPS = 1e-6;\nll a[nmax];\nint main(){\n ios_base::sync_with_stdio(0);\n int n;\n cin >> n;\n for(int i = 0; i < n; ++i)\n cin >> a[i];\n sort(a + 1, a + n);\n ll res = 0;\n ll cnt = 0;\n for(int j = 1; j < n; ++j){\n if (a[j] >= a[0]){\n res += a[j] - a[0];\n cnt++;\n }\n }\n res = (res - cnt + 1) / cnt;\n cout << res << '\\n';\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "8bac310c9394d8f8d09ed55f5156b592", "src_uid": "aa8fabf7c817dfd3d585b96a07bb7f58", "apr_id": "2f5e18a441fc15b6662383356ed0d1e8", "difficulty": 1200, "tags": ["greedy", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.4352014010507881, "equal_cnt": 12, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 12, "bug_source_code": "#include \nusing namespace std;\ntypedef long long ll;\ntypedef pairii;\n#define PB push_back\n#define MP make_pair\n#define IN insert\n#define F first\n#define S second\n#define FOR(i, c, n) for(int i = c; i < (int)n ; i++)\n#define FOREARCH(i, v) for (__typeof(v.begin()) i = v.begin(); i != v.end(); i++)\n#define BACEARCH(i, v) for (__typeof(v.rbegin()) i = v.rbegin(); i != v.rend(); i++)\n//--------Main---------//\n\nint n,a,b,c,d,mat[3][3];\nset >ans;\nmap m;\nbool ver(){\n\tint x = mat[0][0]+mat[0][1]+mat[1][0]+mat[1][1];\n\tint y = mat[0][1]+mat[0][2]+mat[1][1]+mat[1][2];\n\tint z = mat[1][0]+mat[1][1]+mat[2][0]+mat[2][1];\n\tint w = mat[1][1]+mat[1][2]+mat[2][1]+mat[2][2];\n\t//cout<<\"SUM\\n\";\n\t//cout<>n>>a>>b>>c>>d;\n\tmat[0][1]=a;\n\tmat[1][0]=b;\n\tmat[1][2]=c;\n\tmat[2][1]=d;\n\tll sol=0LL;\n\tFOR(un,1,n+1){\n\t\tFOR(dos,1,n+1){\n\t\t\tFOR(tr,1,n+1){\n\t\t\t\tFOR(cu,1,n+1){\n\t\t\t\t\tFOR(ci,1,n+1){\n\t\t\t\t\t\tmat[0][0]=un;\n\t\t\t\t\t\tmat[0][2]=dos;\n\t\t\t\t\t\tmat[1][1]=tr;\n\t\t\t\t\t\tmat[2][0]=cu;\n\t\t\t\t\t\tmat[2][2]=ci;\n\t\t\t\t\t\tif(ver()){\n\t\t\t\t\t\t\tsol++;\n\t\t\t\t\t\t\t// FOR(i,0,3){\n\t\t\t\t\t\t\t// \tFOR(j,0,3){\n\t\t\t\t\t\t\t// \t\tcout<\nusing namespace std;\nlong long n,k,a[105],t,i,j,mx,s;\nint main(){\n cin>>n>>k;\n for(i=0;i>a[i];\n t+=a[i];\n }\n \n for(i=0;i\nusing namespace std;\nint main()\n{\n int m,k,x;\n string s;\n cin>>s>>k;\n if(s[0]=='J'&& s[1]=='a')\n m=1;\n else if(s[0]=='F')\n m=2;\n else if(s[0]=='M'&& s[2]=='r')\n m=3;\n else if(s[0]=='A' && s[1]=='p')\n m=4;\n else if(s[0]=='M'&& s[2]=='y')\n m=5;\n else if(s[0]=='J'&& s[1]=='u' && s[2]=='n')\n m=6;\n else if(s[0]=='J'&& s[1]=='u' && s[2]=='l')\n m=7;\n else if(s[0]=='A'&& s[1]=='u')\n m=8;\n else if(s[0]=='S'&& s[1]=='e')\n m=9;\n else if(s[0]=='O'&& s[1]=='c')\n m=10;\n else if(s[0]=='N'&& s[1]=='o')\n m=11;\n else if(s[0]=='D'&& s[1]=='e')\n m=12;\n x=m+k;\n if(x>12)\n x=x%12;\n // cout<\n\nusing namespace std;\nint prime(int x){\nint y;\nint e=0;\nwhile(x>0)\n{\n y=x%10;\n x=x/10;\nif(y==2||y==3||y==5||y==7){\n e++;\n}\n}\n\nreturn (e);\n}\n\n\nint main()\n{\nlong long x;\ncin>>x;\nif(x%2!=0){\n cout<\n#include \nusing namespace std;\nint main()\n{\n\tint n;\n\tcin >> n;\n\tvectorarr2(n);\n\tvectorarr(n);\n\tfor (int i(0);i < n; i++)\n\t\t{int y;\n\t\tcin >> y;\n\t\tarr[i] = y;\n\t\tarr2[i] = y;\n\t\t}\n\tfor (int i(0);i < n-1; i++)\n\tfor (int k(1);k < n; k++)\n\t{\n\t\tif (arr[i] > arr[k])\n\t\t\tswap(arr[i],arr[k]);\n\t}\n\tint max = 0;\n\tint max_l;\n\tvector arr1(n-2);\n\tfor (int i(1);i < n-1; i++)\n\t{\n\t\tif ((arr[i] -arr[0]) > (arr[n-1] - arr[i]))\n\t\t\tarr1[i-1] = arr[i] - arr[0];\n\t\telse\n\t\t\tarr1[i-1] = arr[n-1] - arr[i];\n\t}\n\t\t\n\tfor (int k(0);k < n-2; k++)\n\t{\n\t\tif (max < arr1[k])\n\t\t\t{\n\t\t\t\tmax = arr1[k];\n\t\t\t\tmax_l = k;\n\t\t\t}\n\t}\n\tcout << arr[max_l+1];\n}\n", "lang": "GNU C++11", "bug_code_uid": "c5676fcfe66e5b266c07737edde7bbb5", "src_uid": "f03773118cca29ff8d5b4281d39e7c63", "apr_id": "cbf834b2e8253267edba088529a67ddd", "difficulty": 800, "tags": ["implementation", "sortings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.83008356545961, "equal_cnt": 7, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 6, "bug_source_code": "#include\nusing namespace std;\nint a, b, c, ans, ans1, ans2;\nint main()\n{\n cin>>a>>b>>c;\n\n ans=(a+b+c);\n ans1=(b+a)*2;\n ans2=(a+c)*2;\n if(ans<=ans1 && ans<=ans2)\n cout<\n#include \n#include \n\nusing namespace std;\n\nint x, n=1;\nbool fre[1000000000];\n\nvoid f(int &x)\n{\n fre[x]=false;\n x++;\n while (x % 10 == 0) x/=10;\n if(fre[x]) n++;\n}\n\nint main()\n{\n memset(fre,true,sizeof(fre));\n scanf(\"%d\", &x);\n while(fre[x]) f(x);\n printf(\"%d\", n);\n}\n", "lang": "MS C++", "bug_code_uid": "5416f9bbae49ab4c2b138813829d4feb", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "apr_id": "ead34b54af7137f57e00ee1574c3703b", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8956506175049221, "equal_cnt": 9, "replace_cnt": 3, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "#include \n#include \n\n\n\nusing namespace std;\n\nint n,m;\nvector > v1;\nvector > v2;\n\nvector > p1;\nvector > p2;\n\nint main()\n{\n int flag = 0;\n int flag0 = 0;\n int sz1 = 0;\n int sz2 = 0;\n cin>>n>>m;\n v1.resize(n);\n v2.resize(m);\n int a,b;\n for (int i = 0;i>a>>b;\n p1.push_back(make_pair(a,b));\n }\n for (int i = 0;i>a>>b;\n p2.push_back(make_pair(a,b));\n }\n\n for (int i = 0;i 1){\n for (int j = 1;j\n#include \n#include \nusing namespace std;\n\nint a[24], n, n2, ans = 30, v[1 << 24];\nbool d[1 << 24] = {true, true};\n\nbool cmp(int x, int y) { return a[x] < a[y]; }\n\nint main() {\n\tcin >> n;\n\tn++;\n\tfor (int i = 1; i < n; i++)\n\t\tcin >> a[i];\n\tn2 = 1 << n;\n\td[2] = d[3] = true;\n\tfor (int i = 2; i < n2; i++)\n\t\tif (d[i]) {\n\t\t\tint l = 0;\n\t\t\tfor (int j = 1, k = 0; j <= i; j <<= 1, k++)\n\t\t\t\tif (i & j)\n\t\t\t\t\tv[l++] = k;\n\t\t\tint t = v[l - 1] + 1;\n\t\t\tif (t == n)\n\t\t\t\tans = min(ans, l);\n\t\t\telse {\n\t\t\t\tsort(v, v + l, cmp);\n\t\t\t\tfor (int j = 0, k = l - 1; k >= 0 && j < l; ) {\n\t\t\t\t\tif (a[v[j]] + a[v[k]] == a[t]) {\n\t\t\t\t\t\tint h = i + (1 << t);\n\t\t\t\t\t\td[h] = true;\n\t\t\t\t\t\tfor (int c = 0; c < l; c++)\n\t\t\t\t\t\t\td[h - (1 << v[c])] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\twhile (j < l && a[v[j]] + a[v[k]] < a[t])\n\t\t\t\t\t\tj++;\n\t\t\t\t\twhile (k >= 0 && a[v[j]] + a[v[k]] > a[t])\n\t\t\t\t\t\tk--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tif (ans == 30)\n\t\tcout << -1 << '\\n';\n\telse\n\t\tcout << ans << '\\n';\n\tcerr << clock() << '\\n';\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "cacae0daf901ecfdac50df23537ed174", "src_uid": "359f5d1264ce16c5c5293fd59db95628", "apr_id": "49f0a083c866d75cb6ec87412ffd5399", "difficulty": 2200, "tags": ["dp", "bitmasks"], "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 \n\nusing namespace std;\n\nint main() {\n int t , s , q , p=0 , ans=0;\n bool lis=true;\n cin>>t>>s>>q;\n while (lis)\n {\n ans++;\n for (int i=1 ; i <= s ; p++ , i++) {\n if (p%q == 0)\n s+=(q-1);\n if (s == t) {\n lis=false;\n break;\n }\n }\n }\n cout<\n#include \n#include \n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\n#define sqr(a) ((a) * (a))\n\nstruct circle {\n double x, y, r;\n};\n\ncircle c(double _x, double _y, double _r) {\n circle ci;\n ci.x = _x;\n ci.y = _y;\n ci.r = _r;\n return ci;\n}\nvector v;\n\nbool interact(circle a, circle b) {\n if (sqrt(sqr(a.x - b.x) + sqr(a.y - b.y)) + min(a.r, b.r) <= max(a.r, b.r)\n || sqrt(sqr(a.x - b.x) + sqr(a.y - b.y)) >= a.r + b.r) {\n return false;\n }\n return true;\n}\n\nbool isIn(circle a, circle b, circle c) {\n if (sqrt(sqr(a.x - b.x) + sqr(a.y - b.y)) <= min(b.r, c.r) && (a.r => min(b.r, c.r) && a.r <= max(b.r, c.r))) {\n return true;\n }\n return false;\n}\n\nint main() {\n double x, y, r;\n for (int i = 0; i < 2; i++) {\n cin >> x >> y;\n for (int j = 0; j < 2; j++) {\n cin >> r;\n v.push_back(c(x, y, r));\n }\n }\n int ans = 0;\n for (int i = 0; i < v.size(); i++) {\n bool flag = true;\n for (int j = 0; j < v.size(); j++) {\n if (i != j && (interact(v[i], v[j]))) {\n flag = false;\n }\n }\n if (isIn(v[i], v[i <= 1? 2 : 0], v[i <= 1? 3 : 1])) {\n flag = false;\n }\n if (flag) {\n ans++;\n }\n }\n cout << ans;\n return 0;\n}\n", "lang": "GNU C++0x", "bug_code_uid": "40cd6af6e380e8146dcb7e3a7609d516", "src_uid": "4c2865e4742a29460ca64860740b84f4", "apr_id": "204731a1a67865dac2a8bb66eba6557c", "difficulty": 1900, "tags": ["geometry"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9400826446280992, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "#include \n#include \n#include \n#define pb push_back\nusing namespace std;\ndequea;\nchar t;\nint s,n;\nint main(){\n while(cin>>t)\n a.pb(t);\n while(a.size()){\n if(a.size()==1){\n s++;\n break;\n }\n int last=0;\n for(int i=0;i<5 && i\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\ntemplate void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << \" \"; cout << endl; }\n\ntypedef long long ll;\n\n#define eps 1e-10\n#define inf 0x3f3f3f3f\n#define INF 0x3f3f3f3f3f3f3f3fLL\n\n#define fr(x,y,z) for(int(x)=(y);(x)<(z);(x)++)\n#define cast(x,t) *({stringstream ss;static t __ret;ss<>__ret;&__ret;})\n\n#define dbg(x) cout << #x << \" == \" << x << endl\n#define print(x) cout << x << endl\n\n// var\nll a[10], ini;\n\nmap< ll, map > > M;\nmap > M2;\n\nint dfs(ll s, ll l, ll g) {\n\t\n\tif(!M2[s].count(l)) M2[s][l] = (1LL<<62);\n\t\n\tif(M2[s][l] < g) return 1;\n\t\n\tif(s < 0 || l < 0 || g < 0) return 0;\n\t\n\tif(M[s][l][g]++) return 0;\n\n\tif(s > ini) return 1;\n\t\n\tif( dfs(s-a[0],l+a[1],g) ) return 1;\n\tif( dfs(s,l-a[2],g + a[3]) ) return 1;\n\tif( dfs(s + a[5],l,g - a[4]) ) return 1;\n\t\n\treturn 0;\n}\n\nint main() {\n\t\n\t// solve\n\tfr(i,0,6)\n\t\tcin >> a[i];\n\t\t\n\tini = max(a[0],1LL) * max(a[2],1LL) * max(a[4],1LL);\n\n\tif(dfs(ini,0,0)) print(\"Ron\"); else print(\"Hermione\");\n\t\n\treturn 0;\n}\n\n", "lang": "GNU C++", "bug_code_uid": "48508b8450ba631d0c5d970174354acd", "src_uid": "44d608de3e1447f89070e707ba550150", "apr_id": "f526674ef0701ae59b135b9b2f473b71", "difficulty": 1800, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9422548120989918, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "#include \nusing namespace std;\n\nint main() {\n int a[6],sum=0,q;\n bool t=0;\n for(int i=0;i<6;i++)\n cin>>a[i];\n for(int i=0;i<6;i++)\n sum+=a[i];\n if(sum%2==1)\n cout<<\"NO\"<\n#include\nusing namespace std;\nbool islucky(uint64_t n)\n{\n\twhile(n>0)\n\t{\n\t\tif(n%10!=4&&n%10!=7)\n\t\treturn 0;\n\t\tn=n/10;\n\t}\n\treturn 1;\n}\nint main() {\n\tuint64_t l,r;\n\tuint64_t s=0;\n\tcin>>l>>r;\n\tmap m;\n\tif(r==1000000000)\n\t\tm[r]=4444444444;\n\t\telse{\n\tfor(uint64_t i=r;i<=r*10;i++)\n\t{\n\t\tif(islucky(i)){\n\t\tm[r]=i;break;}\n\t}}\n\tfor(uint64_t i=r-1;i>=l;i--)\n\t{\n\t\tif(islucky(i)){\n\t\tm[i]=i;}\n\t\telse\n\t\tm[i]=m[i+1];\n\t}\n\tfor(uint64_t i=l;i<=r;i++)\n\t{\n\t\ts=s+m[i];\n\t}\n\tcout<\n#include \n#include \nusing namespace std;\n\nint main(int argc, char *argv[])\n{\n int a,b,c,max,s,k;\n cin>>a;\n cin>>b;\n cin>>c;\n if (a>b)\n {\n max=a;\n k=1;\n }\n else\n {\n max=b;\n k=2;\n }\n if(c>max)\n {\n max=c;\n k=3;\n }\n if (k==1)\n {\n if(b==1 || c==1)\n s=a*(b+c);\n else\n s=a*b*c;\n }\n if (k==2)\n {\n if(a==1 || c==1)\n s=b*(a+c);\n else\n s=b*a*c;\n }\n if (k==3)\n {\n if(a==1 || b==1)\n s=c*(a+b);\n else\n s=b*a*c;\n }\n if ((a==1)&&(b==1)&&(c==1))\n s=3;\n if ((a==6)&&(b==7)&&(c==1))\n s=48;\n if ((a==1)&&(b==8)&&(c==3))\n s=27;\n if ((a==1)&&(b==10)&&(c==1))\n s=12;\n if ((a==5)&&(b==6)&&(c==1))\n s=35;\n if ((a==1)&&(b==6)&&(c==1))\n s=8;\n if ((a==1)&&(b==9)&&(c==1))\n s=11;\n if ((a==2)&&(b==6)&&(c==1))\n s=14;\n if ((a==1)&&(b==9)&&(c==2))\n s=20;\n cout<\nusing namespace std;\nlong long int arr[100000000];\nint perfact(int n)\n{\n int s=0;\n while(n!=0){\n s=s+n%10;\n n=n/10;\n }\n if(s==10)return 1;\n else return 0;\n}\nint main()\n{\n long long int a,b,c,i,n,d;\n while(1)\n {\n cin>>n;\n for(i=1; ; i++){\n if(perfact(i)==1)n--;\n if(n==0){cout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n#define MAXN 101\n#define MAXM 101\n#define EPS (1e-8)\n#define INF (1<<30)\n#define FILE \"B\"\n#define PB push_back\n#define MP make_pair\n#define FT first\n#define SD second\n#define ALL(x) (x).begin(), (x).end()\n#define SZ(x) ((int) (x).size())\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\nvector v;\nchar s[100];\nvoid p(int i, int n) {\n//\tcout << i << ' ' << n << endl;\n\tif (i == n) {\n\t\tv.push_back((string) s);\n\t\treturn;\n\t}\n\ts[i] = '4';\n\tp(i + 1, n);\n\ts[i] = '7';\n\tp(i + 1, n);\n}\n\n\nint main () {\n\n\tios_base :: sync_with_stdio(0);\n\n//\tfreopen(FILE\".in\", \"r\", stdin);\n//\tfreopen(FILE\".out\", \"w\", stdout);\n\n\tfor (int i = 1; i < 20; i++) {\n\t\ts[i] = '\\0';\n\t\tp(0, i);\n\t}\n\n\tstring s;\n\tint c, maxi = 0;\n\tstring ans = \"-1\";\n\tcin >> s;\n\tfor (int i = 0; i < v.size(); i++) {\n\t\tc = 0;\n\t\tfor (int j = 0; j < (int) (s.length() - v[i].length() + 1); j++) {\n\t\t\tif (s.substr(j, v[i].length()) == v[i]) c++;\n\t\t}\n\t\tif (c > maxi) {\n\t\t\tans = v[i];\n\t\t\tmaxi = c;\n\t\t}\n\t}\n\t\n\tcout << ans;\n\t \n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "8378561bcf8844efa106cef22a9de031", "src_uid": "639b8b8d0dc42df46b139f0aeb3a7a0a", "apr_id": "e7a4f1d981202961e5d8c95f35568b55", "difficulty": 1000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.3488677867056245, "equal_cnt": 31, "replace_cnt": 23, "delete_cnt": 3, "insert_cnt": 5, "fix_ops_cnt": 31, "bug_source_code": "#include\n#include\n#include\n\nusing namespace std ;\n\n#define For( i , _begin , _end ) \\\nfor( int i = (_begin) , i##end = (_end) ; i <= (i##end) ; ++i )\n#define Lop( i , _begin , _end ) \\\nfor( int i = (_begin) , i##end = (_end) ; i >= (i##end) ; --i )\n#define Rep( i , _begin , _add ) \\\nfor( int i = (_begin) ; i ; i = (_add) )\n#define FOR( i , _begin , _end ) \\\nfor( register int i = (_begin) , i##end = (_end) ; i <= (i##end) ; ++i )\n#define LOP( i , _begin , _end ) \\\nfor( register int i = (_begin) , i##end = (_end) ; i >= (i##end) ; --i )\n#define REP( i , _begin , _add ) \\\nfor( register int i = (_begin) ; i ; i = (_add) )\n\ntemplate < typename tp >\ninline bool chkmax( tp& x , const tp& y ) {\n\treturn x >= y ? false : ( x = y , true ) ;\n}\ntemplate < typename tp >\ninline bool chkmin( tp& x , const tp& y ) {\n\treturn x <= y ? false : ( x = y , true ) ;\n}\n\ntemplate < typename tp >\ninline tp scanf( tp& in ) {\n\tin = 0 ; char ch = getchar() ; tp f = 1 ;\n\tfor( ;ch> '9'||ch< '0';ch = getchar() )if( ch == '-' )f = -1 ;\n\tfor( ;ch>='0'&&ch<='9';ch = getchar() )in = in * 10 + ch - '0' ;\n\treturn in *= f ;\n}\n\ntypedef pair < int , int > __ ;\nstatic const int maxn = 25e2 + 11 ;\nstatic const int maxm = 5e3 + 11 ;\n\nint n ;\nint m ;\nint q ;\n\nint color ;\n\n__ emp ;\n\ninline int def( int l , int r ) { return l + r | l != r ; }\n\nclass segment_tree {\n\tprivate :\n\t\t__ col[maxm] ;\n\t\t__ tag[maxm] ;\n\tpublic :\n\t\t\n\t\tsegment_tree() {\n\t\t\tFOR( i , 0 , maxm - 1 )\n\t\t\t\tcol[i] = tag[i] = make_pair( 1e9 , 0 ) ;\n\t\t}\n\t\t\n\t\tvoid modify( int l , int r , int L , int R , __ c ) {\n\t\t\tint rt = def( l , r ) ;\n\t\t\tif( l >= L && r <= R ) {\n\t\t\t\tif( chkmin( col[rt] , c ) ) tag[rt] = c ;\n\t\t\t\treturn ;\n\t\t\t}\n\t\t\tint mid = l + r >> 1 ;\n\t\t\tif( mid >= L ) modify( l , mid , L , R , c ) ;\n\t\t\tif( mid < R ) modify( mid + 1 , r , L , R , c ) ;\n\t\t}\n\t\t\n\t\t__ query( int l , int r , int x ) {\n\t\t\tint rt = def( l , r ) ;\n\t\t\tif( l == r ) return col[rt] ;\n\t\t\tint mid = l + r >> 1 ; __ res = tag[rt] ;\n\t\t\tif( x <= mid ) chkmin( res , query( l , mid , x ) ) ;\n\t\t\telse chkmin( res , query( mid + 1 , r , x ) ) ;\n\t\t\treturn res ;\n\t\t}\n\t\t\n} T[maxm] ;\n\nnamespace Segment_tree {\n\t\n\tvoid modify( int l , int r , int L , int R , int x , int y , __ c ) {\n\t\tint rt = def( l , r ) ;\n\t\tif( l >= L && r <= R )\n\t\t\treturn T[rt].modify( 1 , m , x , y , c ) ;\n\t\tint mid = l + r >> 1 ;\n\t\tif( mid >= L ) modify( l , mid , L , R , x , y , c ) ;\n\t\tif( mid < R ) modify( mid + 1 , r , L , R , x , y , c ) ;\n\t}\n\t\n\t__ query( int l , int r , int x , int y ) {\n\t\tint rt = def( l , r ) ;\n\t\tif( l == r ) return T[rt].query( 1 , m , y ) ;\n\t\tint mid = l + r >> 1 ; __ res = T[rt].query( 1 , m , y ) ;\n\t\tif( x <= mid ) chkmin( res , query( l , mid , x , y ) ) ;\n\t\telse chkmin( res , query( mid + 1 , r , x , y ) ) ;\n\t\treturn res ;\n\t}\n\t\n} using namespace Segment_tree ;\n\nint main() {\n\t\n\tscanf( n ) ; scanf( m ) ; scanf( q ) ;\n\t\n\tmodify( 1 , n , 1 , n , 1 , m , make_pair( n * m , ++color ) ) ;\n\t\n\twhile( q-- ) {\n\t\tint op , x1 , x2 , y1 , y2 , S ;\n\t\tscanf( op ) ; scanf( x1 ) ; scanf( y1 ) ; scanf( x2 ) ; scanf( y2 ) ;\n\t\tif( op == 3 )\n\t\t\tputs( query( 1 , n , x1 , y1 ).second\n\t\t\t\t== query( 1 , n , x2 , y2 ).second ? \"Yes\" : \"No\" ) ;\n\t\telse {\n\t\t\tif( x1 > x2 ) swap( x1 , x2 ) ;\n\t\t\tif( y1 > y2 ) swap( y1 , y2 ) ;\n\t\t\tif( op == 1 )\n\t\t\t\tmodify( 1 , n , x1 , x2 , y1 , y2 , make_pair( S , ++color ) ) ;\n\t\t\telse\n\t\t\t\tmodify( 1 , n , x1 , x2 , y1 , y2 ,\n\t\t\t\tmake_pair( S , query( 1 , n , x1 - 1 , y1 - 1 ).second ) ) ;\n\t\t}\n\t}\n\t\n\treturn 0 ;\n}", "lang": "GNU C++11", "bug_code_uid": "4bc59e4b32c87bb870509c99b811ca4b", "src_uid": "250314325e3d088ceedaba7dcde762f1", "apr_id": "8554b4b7081138b786090bec9de227ed", "difficulty": 2800, "tags": ["graphs", "brute force", "dfs and similar"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.4209558823529412, "equal_cnt": 11, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\nconst int N = 1e9;\nchar cur_year[N];\n\nint main()\n{\n memset(cur_year,0,sizeof(cur_year));\n cin>>cur_year;\n int cur_num = atoi(cur_year);\n int len = strlen(cur_year);\n len--;\n char first_ch = cur_year[0];\n int first_num = first_ch - '0';\n first_num++;\n cout<<(first_num*pow(10,len)-cur_num);\n\n\n return 0;\n\n}\n", "lang": "GNU C++11", "bug_code_uid": "fcd90ea59c80932dd9a71896b307d74f", "src_uid": "a3e15c0632e240a0ef6fe43a5ab3cc3e", "apr_id": "e2f085533f1a4eb8f3def03a70515ef5", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.759041394335512, "equal_cnt": 19, "replace_cnt": 10, "delete_cnt": 5, "insert_cnt": 3, "fix_ops_cnt": 18, "bug_source_code": "/*{{{*/\n#include \n#define SZ(X) ((int)(X).size())\n#define ALL(X) (X).begin(), (X).end()\n#define REP(I, N) for (int I = 0; I < (N); ++I)\n#define REPP(I, A, B) for (int I = (A); I < (B); ++I)\n#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)\n#define FORS(I, S) for (int I = 0; S[I]; ++I)\n#define RS(X) scanf(\"%s\", (X))\n#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))\n#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())\n#define CASET int ___T; scanf(\"%d\", &___T); for(int cs=1;cs<=___T;cs++)\n#define MP make_pair\n#define PB emplace_back\n#define MS0(X) memset((X), 0, sizeof((X)))\n#define MS1(X) memset((X), -1, sizeof((X)))\n#define LEN(X) strlen(X)\n#define F first\n#define S second\nusing namespace std;\ntypedef long long LL;\ntypedef unsigned long long ULL;\ntypedef long double LD;\ntypedef pair PII;\ntypedef vector VI;\ntypedef vector VL;\ntypedef vector VPII;\ntypedef pair PLL;\ntypedef vector VPLL;\ntemplate void _R(T &x) { cin >> x; }\nvoid _R(int &x) { scanf(\"%d\", &x); }\nvoid _R(int64_t &x) { scanf(\"%lld\", &x); }\nvoid _R(double &x) { scanf(\"%lf\", &x); }\nvoid _R(char &x) { scanf(\" %c\", &x); }\nvoid _R(char *x) { scanf(\"%s\", x); }\nvoid R() {}\ntemplate void R(T &head, U &... tail) { _R(head); R(tail...); }\ntemplate void _W(const T &x) { cout << x; }\nvoid _W(const int &x) { printf(\"%d\", x); }\nvoid _W(const int64_t &x) { printf(\"%lld\", x); }\nvoid _W(const double &x) { printf(\"%.16f\", x); }\nvoid _W(const char &x) { putchar(x); }\nvoid _W(const char *x) { printf(\"%s\", x); }\ntemplate void _W(const pair &x) {_W(x.F); putchar(' '); _W(x.S);}\ntemplate void _W(const vector &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }\nvoid W() {}\ntemplate void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\\n'); W(tail...); }\n#ifdef HOME\n #define DEBUG(...) {printf(\"# \");printf(__VA_ARGS__);puts(\"\");}\n#else\n #define DEBUG(...)\n#endif\nint MOD = 1e9+7;\nvoid ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}\n/*}}}*/\nconst int SIZE = 1e7+10;\nstring bfs[SIZE];\nint v[SIZE];\nsetAA;\nvectorgg;\nbool u[SIZE];\nbool add(string s){\n REP(i,SZ(s)){\n if(s[i]!='0'&&s[i]!='2'&&s[i]!='7'&&s[i]!='5')s[i]='1';\n }\n int it=lower_bound(ALL(gg),atoll(s.c_str()))-gg.begin();\n if(u[it])return 0;\n u[it]=1;\n return 1;\n}\nbool is25(const string &s){\n if(SZ(s)==1)return 0;\n if(s.back()=='5'){\n char c=s[SZ(s)-2];\n return c=='2'||c=='7';\n }\n else if(s.back()=='0'){\n char c=s[SZ(s)-2];\n return c=='0'||c=='5';\n }\n return 0;\n}\nint main() {\n string s;\n R(s);\n if(is25(s)){\n W(0);\n return 0;\n }\n {\n string tmp=s;\n REP(i,SZ(tmp)){\n if(tmp[i]!='0'&&tmp[i]!='2'&&tmp[i]!='7'&&tmp[i]!='5')tmp[i]='1';\n }\n sort(ALL(tmp));\n do{\n if(tmp[0]!='0')gg.PB(atoll(tmp.c_str()));\n }while(next_permutation(ALL(tmp)));\n }\n bfs[0]=s;\n int rr=1;\n REP(i,rr){\n string now=bfs[i];\n REPP(j,1,SZ(now)){\n swap(now[j],now[j-1]);\n if(now[0]!='0'&&add(now)){\n v[rr]=v[i]+1;\n if(is25(now)){\n W(v[rr]);\n return 0;\n }\n bfs[rr++]=now;\n }\n swap(now[j],now[j-1]);\n }\n }\n W(-1);\n return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "dc58cdccfd12a61d5860d2d9a2c5a07a", "src_uid": "ea1c737956f88be94107f2565ca8bbfd", "apr_id": "7a010a7eaf277c519ab525689209baaf", "difficulty": 2100, "tags": ["brute force", "greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9292502639915523, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "#include \nusing namespace std;\n\nint nod(int a,int b)\n{\n\twhile(a&&b)\n\t\tif (a>b) a%=b;else b%=a;\n\tif (a+b>0) return a+b;else return -a-b;\n}\nint main()\n{\n\tint a1,a2,b1,b2,c1,c2;\n\tcin >> a1 >> b1 >> c1 >> a2 >> b2 >> c2;\n\tif (a1<0||!a1&&b1<0)\n\t{\n\t\ta1=-a1;\n\t\tb1=-b1;\n\t\tc1=-c1;\n\t}\n\tif (a2<0||!a2&&b2<0)\n\t{\n\t\ta2=-a2;\n\t\tb2=-b2;\n\t\tc2=-c2;\n\t}\n\tif (!a1&&!b1&&c1||!a2&&!b2&&c2)\n\t{\n\t\tcout << 0 << endl;\n\t\treturn 0;\n\t}\n\tif (!a1&&!b1&&!c1||!a2&&!b2&&!c2)\n\t{\n\t\tcout << -1 << endl;\n\t\treturn 0;\n\t}\n\tif (!b1&&!b2)\n\t{\n\t\tif (a1==a2&&c1==c2) cout << -1 << endl;\n\t\telse cout << 0 << endl;\n\t\treturn 0;\n\t}\n\tif (!a1&&!a2)\n\t{\n\t\tif (b1==b2&&c1==c2) cout << -1 << endl;\n\t\telse cout << 0 << endl;\n\t\treturn 0;\n\t}\n\tint d1=nod(a1,nod(b1,c1));\n\tint d2=nod(a2,nod(b2,c2));\n\ta1/=d1;b2/=d1;c1/=d1;\n\ta2/=d2;b2/=d2;c2/=d2;\n\tif (a1==a2&&b2==b1&&c1==c2) cout << -1 << endl;\n\telse\n\t\tif (a1==a2&&b1==b2) cout << 0 << endl;\n\t\telse cout << 1 << endl;\n\treturn 0;\n}", "lang": "MS C++", "bug_code_uid": "d24bc48199376910161e403cba6b448f", "src_uid": "c8e869cb17550e888733551c749f2e1a", "apr_id": "515d8a7af0b75685fb4a2fbcf857be3d", "difficulty": 2000, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.2477211796246649, "equal_cnt": 17, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 6, "fix_ops_cnt": 17, "bug_source_code": "#include \n using namespace std;\n \n#define i64 long long \nint n,m,k;\nconst int MOD = 1000000009;\nint pows [1000005];\n\nvoid gen () {\n pows[0] = 1;\n for (int i=1; i<=1000000;i++) pows[i] = (2*pows[i-1])%MOD;\n}\nint main(void) {\n //freopen (\"in.txt\", \"r\", stdin);\n \n gen();\n cin>>n>>m>>k;\n int n1 = n/k; //There should be at least n1 free spaces\n\n //calculate how many of the free spaces will be occupied\n int a = n-m; //actual free spaces\n \n int rem = max (n1-a, 0);\n\n long long res;\n if (rem>0) res = ((pows[rem+1]-2)*k + m - (rem)*k)%MOD;\n else res = m;\n cout<\n#include \n#include \n#include \nusing namespace std;\nlong long INF = 1e18;\nlong long ans = 0;\nvector dpr;\nlong long solve(long long n){\n\tif (n==0) return 0;\n\tif (nn && x/10) {\n\t\tif (n> n;\n\tdpr.resize(1e8);\n\tcout << solve(n);\n\n\treturn 0;\n}\n\n\n", "lang": "GNU C++", "bug_code_uid": "b1b3f6997d259eb014cf70aa68b2865b", "src_uid": "1b17a7b3b41077843ee1d6e0607720d6", "apr_id": "906bf36003f9d1f5d6e788028e8141bc", "difficulty": 1800, "tags": ["divide and conquer", "dfs and similar", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.2144638403990025, "equal_cnt": 8, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "#include\n\nusing namespace std;\n\nint main()\n{\n\tint n,ans=0;\n\tcin>>n;\n\tint a[3];\n\tcin>>a[0]>>a[1]>>a[2];\n\tsort(a,a+n);\n\tif(n=a[0])\tans+=a[0];\n\t\t//cout<\nusing namespace std;\n\nint main() {\n\twhile (true) {\n\t\tint s, v1, v2, t1, t2, fP, sP;\n\t\tcin >> s >> v1 >> v2 >> t1 >> t2;\n\t\tfP = t1 * 2 + v1 * s;\n\t\tsP = t2 * 2 + v2 * s;\n\n\t\tif (fP == sP) cout << \"Friendship\" << endl;\n\t\telse if (fP < sP) cout << \"First\" << endl;\n\t\telse cout << \"Second\" << endl;\n\t}\n\treturn 0;\n}\n", "lang": "MS C++", "bug_code_uid": "c6f234adce78f98a99cc782863b4fd99", "src_uid": "10226b8efe9e3c473239d747b911a1ef", "apr_id": "f6fa0f888cc035f450e8ea80f05e073f", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.6075601374570446, "equal_cnt": 11, "replace_cnt": 7, "delete_cnt": 4, "insert_cnt": 0, "fix_ops_cnt": 11, "bug_source_code": "\n#include\nusing namespace std;\n#pragma comment(linker, \"/STACK:102400000,102400000\")\n#define F(i,a,b) for (int i=a;i>n>>m>>k) {\n int num=1; mes(a,0);\n for(int j=1; j<2*n; j+=2) {\n for(int i=1; i<=m; ++i) {\n a[i][j]=num++;\n a[i][j+1]=num++;\n }\n }\n for(int j=1; j<=2*n; j++) {\n for(int i=1; i<=m; ++i)\n if(a[i][j]==k) {\n int low=i,cul=j/2; //cout<\n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n#define pb push_back\n#define vi vector\n#define sz(x) ((int)(x).size())\n\nstring c[1002];\nint a[100];\nvector res;\nvi x;\n\nvoid gen(int n) {\n\twhile (x[0] == 0) {\n\t\tres.pb(x);\n\t\tint j = n;\n\t\twhile (x[j-1] > x[j]) j--;\n\t\tint k = n;\n\t\twhile (x[j-1] > x[k]) k--;\n\t\tswap(x[j-1], x[k]);\n\t\tvi y = vi (n+1);\n\t\tfor (int i = j; i <= n; i++)\n\t\t\ty[i] = x[n-i+j];\n\t\tfor (int i = j; i <= n; i++)\n\t\t\tx[i] = y[i];\n\t}\t\t\n}\t\n\nint ToInt(string ss, int k) {\n\tint ans = 0;\n\tfor (int i = k-1; i >= 0; i--) {\n\t\tans += ((char)ss[i]-'0')*a[k-1-i];\n\t\n\t}\n\treturn ans;\t\t\n}\n\nint main() {\n\tint n, k;\n\tfreopen(\"input.txt\", \"r\", stdin);\n\tcin >> n >> k;\n\tfor (int i = 0; i <= k; i++) x.pb(i);\n\tgen(k);\n\ta[0] = 1;\n\tfor (int i = 1; i <= k; i++) \n\t\ta[i] = a[i-1]*10;\n\tint minn = 100000000;\n\tint maxx = -1;\n\tfor (int i = 0; i < n; i++) { \n\t\tcin >> c[i];\n\t\tint tmp = ToInt(c[i], k);\n\t\tminn = min(tmp, minn);\n\t\tmaxx = max(tmp, maxx);\n\t}\n\tint ans = maxx-minn;\n\t\t\tfor (int i = 0; i < sz(res); i++) {\n\t\t\t\tminn = 100000000;\n\t\t\t\tmaxx = -1;\n\t\t\t\tfor (int t = 0; t < n; t++) {\n\t\t\t\t string ss;\n\t\t\t\t for (int j = 1; j < sz(res[i]); j++)\n\t\t\t\t \tss.pb(c[t][res[i][j]-1]);\t\t\n\t\t\t\t\tint tmp = ToInt(ss, k);\n\t\t\t\t\tminn = min(tmp, minn);\n\t\t\t\t\tmaxx = max(tmp, maxx);\n\t\t\t\t} \n\t\t\t\tans = min(ans, (maxx-minn));\n\t\t\t}\t\n\tcout << ans << endl;\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "aa2fc42c36308e42d02174dcb2d82b38", "src_uid": "08f85cd4ffbd135f0b630235209273a4", "apr_id": "30e6f693a2ae7a0509557bed77317158", "difficulty": 1400, "tags": ["brute force", "combinatorics", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7910014513788098, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "#include \n\nusing namespace std;\ntypedef long long ll;\nconst long long inf = 1000000000000000000LL;\nconst int N = 200000 + 5;\n\n\nint n;\nint x;\nint m;\nint main() {\n cin >> n;\n cin >> m;\n int arr[n] ={};\n for(int i=0;i> x;\n arr[i]=x;\n }\n int maxim =0;\n for(int j=0;j\n#include\nusing namespace std;\nlong f(int n)\n{\n if(n==1)\n return 1;\n if(n==2)\n return 2;\n if(n==3)\n return 4;\n if(n!=1&&n!=2&&n!=3)\n return f(n-1)+f(n-2)+f(n-3);\n}\nint main()\n{\n int T;\n long long sum=1;\n cin>>T;\n while(T--)\n {\n sum=1;\n int n,a[51];\n cin>>n;\n for(int i=0;i<=n-1-1;++i)\n {\n cin>>a[i];\n }\n for(int i=0;i<=n-1-1;++i)\n {\n sum*=f(a[i])%10007;\n }\n sum%=10007;\n cout<\n#include\n#include\nstruct S\n{\n int x,y;\n} s[4];\nint slove(int n)\n{\n for(int i=0; i mat;\nconst int mod=(int)1e9+7;\n\nmat operator*(const mat &a,const mat &b){\n mat res(a.size(),vi(b[0].size()));\n assert(a[0].size()==b.size());\n rep(i,res.size())rep(j,res[0].size())rep(k,a[0].size()){\n res[i][j]+=a[i][k]*(ll)b[k][j]%mod;\n res[i][j]%=mod;\n }\n return res;\n}\nmat pow(mat m,int n){\n mat res(m.size(),vi(m.size()));\n rep(i,m.size())res[i][i]=1;\n for(;n;n>>=1){\n if(n&1)res=res*m;\n m=m*m;\n }\n return res;\n}\nint solve(int n){\n mat M(25*2,vi(25*2));\n rep(i,5)rep(j,5){\n for(int k=1;k<5;k++){\n if(j==k||j==1&&k==4||j==4&&k==1||\n j==2&&k==3||j==3&&k==2||\n i==2&&j==1&&k==3||i==3&&j==1&&k==2)continue;\n M[k*5+j][j*5+i]=1;\n }\n }\n rep(i,25)M[i+25][i]=M[i+25][i+25]=1;\n M=pow(M,n+1);\n mat A(50,vi(25));\n rep(i,25)A[i][i]=1;\n mat B=M*A;\n mat C(25,vi(1));\n C[0][0]=1;\n mat D=B*C;\n ll res=0;\n rep(i,25)res+=D[i+25][0];\n return res%mod;\n}\nint calc(int n){\n int res=((ll)solve(n)+solve((n+1)/2)-solve(2)+mod)%mod;\n if(res%2)res+=mod;\n res/=2;\n return res;\n}\nvoid run(){\n int l,r;\n cin>>l>>r;\n ll ans=calc(r)-calc(l-1);\n ans=(ans%mod+mod)%mod;\n cout<\n#include\nusing namespace std;\nint main()\n{\n string s , s1=\"\";\n cin>>s;\n long long int n=(s.size()-1)/2;\n int j=0;\n s1=s1+s[n];\n while (s1.size ()) s1+=s[n+j];\n {\n if(n-j>=0) s1+=s[n-j];\n}\ncout<\nusing namespace std;\n\nlong long dp[65][65];\nint main()\n{\n long long n,t,ans=0;\n cin>>n>>t;\n long long num=0;\n while((1<=0;i--){\n if(num<0)break;\n if(n>=(1LL<\n#include\n#include\n#include\n#include\nusing namespace std;\nint n,m,i,j,k,l;\nlong long ans;\nint main()\n{\n scanf(\"%d%d\",&n,&m);\n for(i=m+1;i<=n-m;i++)\n for(j=n-m;j>m;j--)\n {\n k=((n+1-j)*(-i+2*j)-1)/(i+j)-m;\n if(k<0)k=0;\n if(k>n-m-m)k=n-m-m;\n ans+=k;\n }\n cout<\nusing namespace std;\n\nint main()\n{\n long long n;\n cin >> n;\n string s= to_string(n);\n long long l=s.length(),ans=1,pro=1,i,j;\n //cout << l << endl;\n if(l==1){\n cout << n << endl;\n return 0;\n}\nfor(i=0;i\nusing namespace std;\nint main()\n{\n\tint a, b, c;\n\tcin >> a >> b >> c\uff1b\n\t\n\t\tint l, z, h;\n\t\tcin >> l >> z >> h;\n\t\tif (l >= a)\n\t\t{\n\t\t\tl -= a;\n\t\t\tif (l + z >= b)\n\t\t\t{\n\t\t\t\tint lz = l + z - b;\n\t\t\t\tif (lz + h >= c)\n\t\t\t\t{\n\t\t\t\t\tcout << \"YES\" << endl;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tcout << \"NO\" << endl;\n\t\n\treturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "8199a2074091e7752a3f16ab56b218e0", "src_uid": "d54201591f7284da5e9ce18984439f4e", "apr_id": "c32c507b75dd4b33b124ccf3f3f3ace2", "difficulty": 800, "tags": ["greedy", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.97339593114241, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n\tlong long a,b,i,j,k,l,n,c=0;\n\tcin>>n>>a>>b;\n\tif(b>=0)\n\t{\n\t\tint flag=0;\n\t\t\n\t\tfor(i=a;i<=n;i++)\n\t{\n\t\tflag=1;\n\n\t\tc++;\n\t\t//cout<1)\n\t\tcout<=1;i--)\n\t\t{\n\t\t\tc++;\n\t\t//\tcout<1)\n\tcout<\nusing namespace std;\nint main(){\n\tint n,a,b;\n\tscanf(\"%d %d %d\",&n,&a,&b);\n\t\tif(n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define F first\n#define S second\n#define ll long long\n#define ull unsigned long long\nusing namespace std;\nll a,b,w,x,c,r;\nint main() {\n cin >> a >>b >> w >> x >> c;\n if (c>a)\n\tr=(1ll * (c - a) * x - b + w - x - 1) / (w - x);\n\tcout << c-a+r; else\n\tcout << 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "1c7142693bc696e06cc3d365d4fba826", "src_uid": "a1db3dd9f8d0f0cad7bdeb1780707143", "apr_id": "b9217d890d8ba27ab771f9f4afff6dd8", "difficulty": 2000, "tags": ["math", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.30707610146862485, "equal_cnt": 15, "replace_cnt": 13, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 15, "bug_source_code": "#include \nusing namespace std;\n#define pb push_back\n#define mp make_pair\n#define fr(i,m, n) for (int i = (int)(m); i < (int)(n); ++i)\ntypedef long long LL;\ntypedef pair PII;\nint main() \n{\n\tint n,m,p=0,q=0;cin>>n>>m;\n\tvectora(n);\n\tfr(i,0,n) cin>>a[i],p=max(p,a[i]);\n\tif(p<=m) cout<=0;i--)\n\t{\n\t\tif(a[i]>m && a[i]>(p-(p%m))) q=max(q,i+1);\n\t}\n\tcout<\n#include \n#include \n#include \nusing namespace std;\n\n\nint main()\n{\n\tint i, j, n, k;\n\tstring c;\n\tcin >> n;\n\tchar *a = new char[n];\n\tgetline(cin, c);\n\tgetline(cin, c);\n\tint f = 0;\n\tfor (i = 0; i < n; i++)\n\t\ta[i] = '0';\n\tfor (i = 0; i < c.size(); i++)\n\t{\n\t\tj = 0;\n\t\tk = 0;\n\t\twhile (k != 1 && a[j] != '0' && j < n || j < 1)\n\t\t{\n\t\t\tif (c[i] == a[j])\n\t\t\t\tk = 1;\n\t\t\tj++;\n\t\t}\n\t\tif (k == 0)\n\t\t{\n\t\t\ta[j] = c[i];\n\t\t\tf++;\n\t\t}\n\t\tif (f == 26)\n\t\t{\n\t\t\tcout << \"YES\";\n\t\t\tgetchar();\n\t\t\tgetchar();\n\t\t\treturn 0;\n\t\t}\n\t}\n\tcout << \"NO\";\n\tgetchar();\n\tgetchar();\n\treturn 0;\n}\n", "lang": "MS C++", "bug_code_uid": "2255b85ad0f5f123e7f663d1a35e6f81", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "apr_id": "0fec881c572d0bb32446a5f6c65ffc5d", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5444887118193891, "equal_cnt": 33, "replace_cnt": 14, "delete_cnt": 5, "insert_cnt": 13, "fix_ops_cnt": 32, "bug_source_code": "/*\n * Author: Eyelids\n * Created Time: 2013/8/19 0:21:24\n * File Name: 336E.cpp\n */\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\nconst double eps(1e-8);\ntypedef long long lint;\n#define clr(x) memset( x , 0 , sizeof(x) )\n#define sz(v) ((int)(v).size())\n#define rep(i, n) for (int i = 0; i < (n); ++i)\n#define repf(i, a, b) for (int i = (a); i <= (b); ++i)\n#define repd(i, a, b) for (int i = (a); i >= (b); --i)\n#define clrs( x , y ) memset( x , y , sizeof(x) )\n#define mod 1000000007\nint n, m;\nint f[210][210][3][5], a[5], b[5];\nint c[210][210];\ninline void Add(int &a, int b) {\n a += b;\n if (a >= mod) a -= b;\n}\ninline int Mul(int a, int b) {\n lint ret = a;\n ret *= b;\n return (ret % mod);\n}\n\nint Calc(int n, int m, int cur, int type) {\n int ret = f[n][m][cur][type];\n if (ret != -1) return ret; \n ret = 0;\n \n if (type == 2) {\n Add(ret, Calc(n, m, cur, 1));\n if (cur == 0) {\n if (m >= 1) {\n Add(ret, Mul(Calc(n, m - 1, 1, 1), 4));\n Add(ret, Mul(Calc(n, m - 1, 2, 1), 4));\n } \n if (m >= 2) {\n Add(ret, Mul(Calc(n, m - 2, 4, 1), 2));\n Add(ret, Mul(Calc(n, m - 2, 2, 1), 4));\n Add(ret, Mul(Calc(n, m - 2, 3, 1), 8));\n if (m == 2) Add(ret, 2);\n }\n if (m >= 3) {\n Add(ret, Mul(Calc(n, m - 3, 3, 1), 4));\n if (m == 3) Add(ret, 4);\n }\n if (m == 4) Add(ret, 1);\n }\n if (cur == 1) {\n if (m >= 1) {\n Add(ret, Mul(Calc(n, m - 1, 2, 1), 2));\n Add(ret, Mul(Calc(n, m - 1, 3, 1), 2));\n Add(ret, Mul(Calc(n, m - 1, 4, 1), 1));\n }\n if (m >= 2) {\n Add(ret, Mul(Calc(n, m - 2, 3, 1), 3));\n if (m == 2) Add(ret, 2);\n }\n }\n if (cur == 2) {\n if (m >= 1) {\n Add(ret, Mul(Calc(n, m - 1, 3, 1), 2));\n if (m == 1) Add(ret, 1);\n } \n if (m == 2)\n Add(ret, 1);\n }\n if (cur == 3 && m == 1) Add(ret, 1);\n if (cur == 4) {\n if (m >= 1) \n Add(ret, Mul(Calc(n, m - 1, 3, 1), 2));\n if (m == 2)\n Add(ret, 1);\n }\n }\n if (type == 1) {\n if (n == 0) \n return (m == 0) ? 1 : 0;\n int bits = a[cur] << 1, cons = b[cur];\n for (int i = 0; (i <= cons) && (i <= m); i ++)\n for (int j = 0; (j <= bits - 2 * i) && (j + i <= m); j ++)\n Add(ret, Mul(Calc(n, m - i - j, cur, 0), Mul(c[cons][i], c[bits - 2 * i][j]))); \n }\n if (type == 0) {\n int bits = a[cur];\n for (int i = 0; (i <= m) && (i <= bits); i ++)\n Add(ret, Mul(Calc(n - 1, m - i, cur, 2), c[bits][i]));\n }\n return ret;\n}\n\nint main(){\n scanf(\"%d%d\", &n, &m);\n memset(f, -1, sizeof(f)); \n a[0] = 4, a[1] = 3, a[2] = 2, a[3] = 1, a[4] = 2;\n b[0] = 4, b[1] = 2, b[2] = 1, b[3] = 0, b[4] = 0;\n for (int i = 0; i <= 200; i ++) {\n c[i][0] = 1;\n for (int j = 1; j <= i; j ++)\n Add(c[i][j], c[i - 1][j]), Add(c[i][j], c[i - 1][j - 1]);\n }\n lint fact = 1;\n for (int i = 1; i <= m; i ++) fact = Mul(fact, i);\n \n printf(\"%d\\n\", Mul(fact, Calc(n, m, 0, 2)));\n \n return 0;\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "lang": "GNU C++", "bug_code_uid": "dc3822ba72de5dcbdfcd16574bae2eed", "src_uid": "fa649fed687d72b1431ac82bc7288116", "apr_id": "3ca42a9d644b89bd4424b7d628b27a8f", "difficulty": 2700, "tags": ["bitmasks", "dp", "combinatorics", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7348325134691965, "equal_cnt": 27, "replace_cnt": 19, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 26, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n\nusing namespace std;\n\n#ifdef WIN32\n #define LLD \"%I64d\"\n#else\n #define LLD \"%lld\"\n#endif\n\ntypedef pair pii;\ntypedef long long ll;\ntypedef vector vi;\ntypedef vector vvi;\ntypedef vector vb;\ntypedef vector vvb;\ntypedef vector vll;\ntypedef vector vvll;\n\nll rdtsc() {\n ll tmp;\n asm(\"rdtsc\" : \"=A\"(tmp));\n return tmp;\n}\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 MOD = (int)1e9 + 7;\n\ninline void add(int &x, int y) {\n\tif ((x += y) >= MOD)\n\t\tx -= MOD;\n}\n\ninline int mult(int x, int y) {\n\treturn (long long)x * y % MOD;\n}\n\nconst int maxn = 201;\nint d[maxn][maxn][1 << 4];\n\nconst int maxCntIds = (int)1e5;\nint cntIds;\nint prec[maxCntIds][3];\n\nvoid gen(int iter, int mask, int left, int putk) {\n\tif (iter == 12 + 4 + 4 + 4) {\n\t\tassert(cntIds < maxCntIds);\n\t\tprec[cntIds][0] = mask, prec[cntIds][1] = left, prec[cntIds][2] = putk;\n\t\tcntIds++;\n\t\treturn;\n\t}\n\tgen(iter + 1, mask, left, putk);\n\tif (iter < 12)\n\t\tgen(iter + 1, mask ^ (1 << iter), left, putk + 1);\t\t\n\telse {\n\t\tif (iter - 12 < 4) {\n\t\t\tint addMask = (7 << (3 * (iter - 12))) ^ (7 << (3 * ((iter - 12 + 1) & 3)));\n\t\t\tif (!(addMask & mask))\n\t\t\t\tgen(iter + 1, mask ^ addMask, left ^ (1 << (iter - 12)) ^ (1 << ((iter - 12 + 1) & 3)), putk + 1);\n\t\t} else {\n\t\t\tif (iter - 16 < 4) {\n\t\t\t\tint addMask = (7 << (3 * (iter - 16)));\n\t\t\t\tif (!(addMask & mask))\n\t\t\t\t\tgen(iter + 1, mask ^ addMask, left ^ (1 << (iter - 16)), putk + 1);\n\t\t\t} else {\n\t\t\t\tint addMask = (1 << (3 * (iter - 20))) ^ (1 << ((3 * (iter - 20) - 1) & 3));\n\t\t\t\tif (!(addMask & mask))\n\t\t\t\t\tgen(iter + 1, mask ^ addMask, left, putk + 1);\n\t\t\t}\n\t\t}\n\t}\n}\n\nvoid countPrec() {\n\tcntIds = 0;\n\tgen(0, 0, 0, 0);\n}\n\nconst int cnt0 = 8;\nconst int mask0[cnt0] = {1, 2, 4, 8, 3, 6, 12, 9};\n\nint gen0(int iter, int taken, int left) {\n\tif (left > cnt0 - iter)\n\t\treturn 0;\n\tif (iter == cnt0)\n\t\treturn 1;\n\tint ans = gen0(iter + 1, taken, left);\n\tif (left && !(taken & mask0[iter]))\n\t\tadd(ans, gen0(iter + 1, taken | mask0[iter], left - 1));\n\treturn ans;\n}\n\nvoid countD(int n0, int k0) {\n\tcountPrec();\n\n\tfor (int k = 0; k <= k0; k++)\n\t\tfor (int taken = 0; taken < (1 << 4); taken++)\n\t\t\td[0][k][taken] = gen0(0, taken, k);\n\n\tfor (int n = 1; n <= n0; n++) {\n\t\tfor (int k = 0; k <= k0; k++) {\n\t\t\tfor (int taken = 0; taken < (1 << 4); taken++) {\n\t\t\t\tint &cur = d[n][k][taken];\n\t\t\t\tcur = 0;\n\t\t\t\tif (!k) {\n\t\t\t\t\tcur = 1;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tint maskFail = 0;\n\t\t\t\tfor (int i = 0; i < 4; i++) {\n\t\t\t\t\tif (!((taken >> i) & 1))\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tmaskFail ^= (7 << (3 * i));\n\t\t\t\t}\n\n\t\t\t\tfor (int maskId = 0; maskId < cntIds; maskId++) {\n\t\t\t\t\tint mask = prec[maskId][0], left = prec[maskId][1], putk = prec[maskId][2];\n\t\t\t\t\tif (mask & maskFail)\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tif (putk > k)\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tleft |= taken;\n\t\t\t\t\tadd(cur, d[n - 1][k - putk][left]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nbool solve() {\n\tint n, k;\n\tif (scanf(\"%d%d\", &n, &k) < 1)\n\t\treturn 0;\n\n\tcountD(n, k);\n\tint res = d[n][k][0];\n\tfor (int i = 1; i <= k; i++)\n\t\tres = mult(res, i);\n\tprintf(\"%d\\n\", res);\n\treturn 1;\n}\n\nint main() {\n\tsrand(rdtsc());\n#ifdef DEBUG\n\tfreopen(TASKNAME\".in\", \"r\", stdin);\n\tfreopen(TASKNAME\".out\", \"w\", stdout);\n#endif\n\t\n\twhile (1) {\n\t\tif (!solve())\n\t\t\tbreak;\n\t\t#ifdef DEBUG\n\t\t\teprintf(\"%.18lf\\n\", (double)clock() / CLOCKS_PER_SEC);\n\t\t#endif\n\t}\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "58d38ab78c4508dc8a5757aef0aefa89", "src_uid": "fa649fed687d72b1431ac82bc7288116", "apr_id": "c483e3395985c159aecb78e8e5fb7c27", "difficulty": 2700, "tags": ["bitmasks", "dp", "combinatorics", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9134125636672326, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n\tint n,i;\n\tcin>>n;\n\tint a[n];\n\tfor(i=0;i>a[i];\n\tint w=a[0],s=3;\n\tfor(i=1;i\nusing namespace std;\n\nconst int N = 1e9 + 7, P = 130 + 10, Q = 2e6 + 10;\nlong long soorat[P], choose[P][P], dp[P][P], ans[Q], choose2[2][P]; \nint n, p, q;\nlong long finalans;\n\nvoid fillchoose(int ii, int j){\n\tint nn = n - ii, jc = j, ss = nn - jc + 1;\n\t\n\tif(j == 0 || nn < 0 || ss < 0)\n\t\treturn;\n\t\n\tfor (int i = ss; i <= nn; i++)\n\t\tsoorat[i - ss] = (unsigned)i;\n\t\n\tfor (; j > 0; j--){\n\t\tint x = j, gcdtmp;\n\t\tfor (int i = ss; i <= nn && x > 1; i++){\n\t\t\tgcdtmp = __gcd(soorat[i - ss], x);\n\t\t\tsoorat[i - ss] /= gcdtmp;\n\t\t\tx /= gcdtmp;\n\t\t}\n\t}\n\t\n\tchoose[ii][jc] = 1;\n\tfor (int i = ss; i <= nn; i++)\n\t\tchoose[ii][jc] *= (unsigned)soorat[i - ss];\n}\n\nvoid filldp(int i, int j){\n\tfor (int k = 1; k <= min(i, n - p + i - 1); k++)\n\t\tdp[i][j] = (dp[i][j] + (choose[p - i][k] * dp[i - k][j - 1]));\n}\n\nvoid fillans(int t){\n\tchoose2[t % 2][0] = 1;\n\tfor (int i = 1; i <= p; i++)\n\t\tchoose2[t % 2][i] = choose2[1 - (t % 2)][i] + choose2[1 - (t % 2)][i - 1]; \n\t\n\tfor (int i = 0; i <= p; i++)\n\t\tans[t] = ans[t] + (choose2[t % 2][i] * dp[p][i]);\n\t\n\tans[t] = (unsigned)(ans[t] * t);\n}\n\nint main() {\n\tios::sync_with_stdio(false);\n\tcin.tie(0);cout.tie(0);\n\t\n\tcin >> n >> p >> q;\n\t\n\tfor (int i = 0; i <= p; i++)\n\t\tfor (int j = 0; j <= p; j++)\n\t\t\tfillchoose(i, j);\n\t\t\t\n\tfor (int i = 0; i <= p; i++)\n\t\tdp[i][0] = 1;\n\t\n\tfor (int j = 1; j <= p; j++)\n\t\tfor (int i = 0; i <= p; i++)\n\t\t\tfilldp(i, j);\n\t\n\tchoose2[0][0] = 1;\n\t\n\tfor (int t = 1; t <= q; t++)\n\t\tfillans(t);\n\t\n\tfor (int i = 1; i <= q; i++)\n\t\tfinalans ^= ans[i];\n\t\n\tcout << finalans << '\\n';\n\t\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "8877027ae438c3a4e5665386155d6387", "src_uid": "28cf4ff955d089318ea08d17bc4f43da", "apr_id": "6c1bcded95c88737d928339386723ecb", "difficulty": 2900, "tags": ["dp", "meet-in-the-middle", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.3804034582132565, "equal_cnt": 22, "replace_cnt": 17, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 22, "bug_source_code": "#include \n\n#define LL long long int\n#define ULL unsigned long long int\n\n#define FOR(i,a,b) for(int i=a;i<=b;i++)\n#define REV_FOR(i,a,b) for(int i=a;i>=b;i--)\n#define _cin ios_base::sync_with_stdio(0); cin.tie(0);\n\n#define clear(a) memset(a,0,sizeof(a))\n\n#define MOD 1000000007\n#define INF (1<<28)\n#define mx = 10e9\n#define mn = -1*mx\n\n#define Max(a,b) (a>b?a:b)\n#define Min(a,b) (a>a[i][j];\n if(a[i][j] == 'X')\n val_X++;\n if(a[i][j] == '0')\n val_0++;\n }\n bool win_X = false, win_0 = false;\n FOR(i,1,3)\n FOR(j,1,3)\n {\n if(a[i][j] == 'X' && ((a[i+1][j] == 'X' && a[i+2][j] == 'X') || (a[i][j+1] == 'X' && a[i][j+2] == 'X') || (a[i+1][j+1] == 'X' && a[i+2][j+2] == 'X')))\n win_X = true;\n if(a[i][j] == '0' && ((a[i+1][j] == '0' && a[i+2][j] == '0') || (a[i][j+1] == '0' && a[i][j+2] == '0') || (a[i+1][j+1] == '0' && a[i+2][j+2] == '0')))\n win_0 = true;\n \n }\n cout< val_0) && !win_0)\n printf(\"the first player won\"); \n else if(win_0 && (val_X == val_0) && !win_X)\n printf(\"the second player won\");\n else if(!win_0 && !win_X)\n {\n if(val_X == val_0)\n printf(\"first\");\n else if (val_X - val_0 == 1)\n printf(\"second\");\n else if(val_X + val_0 == 9)\n printf(\"draw\");\n else\n printf(\"illegal\");\n }\n else\n printf(\"illegal\");\n }\n", "lang": "GNU C++", "bug_code_uid": "b13289845e79d2a9b2c4f19f0d02730b", "src_uid": "892680e26369325fb00d15543a96192c", "apr_id": "dfb1fd2fd2ea6d8595f5cfd27c4d46b9", "difficulty": 1800, "tags": ["games", "brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9990375360923965, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": " #include\n #include \n\n int p1, p2, p3, p4, a, b, ans, p;\n\n using namespace std;\n\n int min(int a1, int a2, int a3, int a4) {\n \tif (a1 < a2 && a1 < a3 && a1 < a4)\n \t\treturn a1;\n \tif (a2 < a1 && a2 < a3 && a2 < a4)\n \t return a2;\n \tif (a3 < a4)\n \t \treturn a3;\n \treturn a4;\n }\n\n int main() {\n \tcin >> p1 >> p2 >> p3 >> p4 >> a >> b;\n \tans = 0;\n \tfor (int i = a; i < b; i++) {\n \t\tp = min(p1, p2, p3, p4);\n \t\tif (i < p)\n \t\t\tans++;\t \n \t}\n \tcout << ans << endl;\n \treturn 0;\n }\n ", "lang": "GNU C++", "bug_code_uid": "0bc2c2591c05b61b56210420f5789060", "src_uid": "63b9dc70e6ad83d89a487ffebe007b0a", "apr_id": "056dd95a5d5ad90843bdc23cc4ffae2e", "difficulty": 1100, "tags": ["number theory", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.8960535588442565, "equal_cnt": 12, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "#include\nusing namespace std;\n\n#define isprime(x) (!np[x]&&(x&1))\n#define ll long long\n#define MUHAMMED_HISHAM ios_base::sync_with_stdio(false);cin.tie(NULL);/*\nconst int mxxx = 100005;\nbool np[mxxx];\nint si, primes[mxxx];\nvoid sieve()\n{\n si = 0;\n np[0] = np[1] = 1;\n for (long long i = 3; i * i <= mxxx; i += 2)\n {\n if (np[i] == 0)\n {\n for (long long j = i * i; j < mxxx; j += (i * 2))\n np[j] = 1;\n }\n }\n primes[si++] = 2;\n for (int i = 0; i < mxxx; i++)\n {\n if (np[i] == 0 && i % 2)\n primes[si++] = i;\n }\n}\n\nvoid primeFactors(int n)\n{\n vectorv;\n while (n % 2 == 0)\n {\n v.push_back(2);\n n = n / 2;\n }\n for (int i = 3; i <= sqrt(n); i = i + 2)\n {\n while (n % i == 0)\n {\n v.push_back(i);\n n = n / i;\n }\n }\n if (n > 2)\n {\n v.push_back(n);\n }\n v.push_back(1);\n for (int i=0;i 0)\n return x * temp * temp;\n else\n return (temp * temp) / x;\n }\n}\n\n\nlong long fast_power(long long x, long long n, long mood)\n{\n if (n == 0)return 1;\n else if (n % 2 == 0)return fast_power(x * x, n / 2, mood);\n else return (x * fast_power((x * x) % mood, (n - 1) / 2, mood));\n}\n\n/*\n\nll solve(ll i,ll last,ll cap)\n{\n\n if(i>n)\n {\n // cout<0)?solve(i+1,i,cap-1)+(a[i]+a[last])*(i-last):100000500,solve(i+1,last,cap));\n}\n*/\n\n/*\nll NCR[31][31];\n\nll compinatorics(int n,int r)\n{\n NCR[0][0]=1;\n for (int i = 1; i <= 30; ++i)\n {\n NCR[i][0] = 1;\n NCR[i][i] = 1;\n for (int j = 1; j <= i; ++j)\n {\n NCR[i][j] = NCR[i - 1][j - 1] + NCR[i - 1][j];\n }\n }\n return NCR[n][r];\n}\n*/\n//////////////////////////////////////////////////////////////////\nint main()\n{\n int a,b;\n cin>>a>>b;\n unordered_mapm,d;\n d[a]=1;ll x=a;\n for (ll i=0; i<9000000; i++,x+=a)\n {\n d[a+x]=d[x]+1;\n }\n m[b]=1; x=b;\n for (ll i=0; i<9000000; i++,x+=b)\n {\n m[b+x]=m[x]+1;\n if (d[x+b]!=0)\n {\n if (a>b) m[x+b]--;\n else if (am[x+b]) cout<<\"Dasha\";\n else if (d[x+b]\nusing namespace std;\nint u[102][102];\nint main(){\n\tint n;\n\tcin >> n;\n\tint sum = 0, a = (n-1)/2;\n\tfor (int i = 0; i < n; i++) {\n\t\tfor (int j = 0; j < n; j++) {\n\t\t\tcin >> u[i][j];\n\t\t\tif (i == j){\n\t\t\t\tsum += u[i][j];\n\t\t\t}\n\t\t\tif (j = n - i - 1) {\n\t\t\t\tsum += u[i][j];\n\t\t\t}\n\t\t\tif (i == a) {\n\t\t\t\tsum += u[i][j];\n\t\t\t}\n\t\t\tif (j == a) {\n\t\t\t\tsum += u[i][j];\n\t\t\t}\n\t\t}\n\t}\n\tcout << sum - (3 * u[a][a]);\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "4d077d5f015f6ab64bc014f28b80084e", "src_uid": "5ebfad36e56d30c58945c5800139b880", "apr_id": "b0c3c8a771b8dbdad5413df15e7b90a4", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.14106583072100312, "equal_cnt": 11, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 11, "bug_source_code": "#include \n#include \nusing namespace std;\nint a[13];\nint main(){\n\tint k;scanf(\"%d\",&k);\n\tfor(int i=1;i=12;i++){\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tsort(a+1,a+13);\n\tint ans=0,cnt=0;\n\tfor(int i=1;i<=12;i++){\n\t\tans+=a[i];\n\t\tcnt++;\n\t\tif(ans>=k)break;\n\t}\n\tif(ans\ntypedef long long ll;\nusing namespace std;\n\nll z=998244353;\n\nll f[200001];\n\nlong long binpow(long long a, long long b) {\n if (b == 0)\n return 1;\n \n \n long long res = binpow(a, b / 2);\n \n if (b % 2){\n ll xx=res;\n xx*=res;\n xx%=z;\n xx*=a;\n xx%=z;\n return xx;\n }\n else{\n return (res * res)%z;\n \n }\n}\n\n\n\nint main(){\n int n,m;\n cin>>n>>m;\n \n f[0]=1;\n for(int i=1;i<2e5;i++){\n f[i]=f[i-1]*i;\n f[i]%=z;\n }\n \nll val=0;\nfor(int i=n-2;i<=m-1;i++){\n ll xx=f[i];\n xx*=binpow(f[n-2],z-2);\n xx%=z;\n xx*=binpow(f[i-n+2],z-2);\n xx%=z;\nval+=xx;\nval%=z;\n}\n ll ans=0;\n \nfor(int i=1;i\nusing namespace std;\n\n\nvector v;\n\nint cont = 0, sum = 0;\nint n, k;\n\nvoid fun(int i){\n\tint currV = v[i];\n\tsum = currV;\n\tcont = 1;\n\ti++;\n\t\n\tfor(; i < (int)v.size(); i++){\n\t\tif(cont == k) return;\n\t\tif(abs(v[i] - currV) > 1){\n\t\t\tsum += v[i];\t\n\t\t\tcurrV = v[i];\n\t\t\tcont++;\n\t\t}\n\t}\n}\t\n\nint main(){\n\tstring s;\n\t\n\tcin>>n>>k;\n\t\n\tcin>>s;\n\t\n\tsort(s.begin(), s.end());\n\t\n\tfor(char &c : s){\n\t\tv.push_back(int(c - 'a') + 1);\n\t}\n\tint ans = (int) 1e9;\n\tfor(int i = 0; i < (int)v.size()-1; i++){\n\t\tfun(i);\n\t\t\n\t\tif(cont == k){\n\t\t\tans = min(ans, sum);\n\t\t}\n\t}\n\tif(ans == (int) 1e9) \n\t\tcout<<\"-1\\n\";\n\telse\n\t\tcout<\n\nusing namespace std;\n\nbool eh_primo(int x){\n int i, cont = 0;\n if(x == 1 || x == 0)\n {\n return false;\n }\n for(i = 1; i <=x; i++)\n {\n if(x%i == 0)\n {\n cont++;\n }\n }\n if(cont == 2)\n {\n return true;\n }\n else\n {\n return false;\n }\n\n\n}\nbool eh_coprimo(int a, int b, int n)\n{\n if(eh_primo(a) && eh_primo(b))\n {\n return true;\n }\n return false;\n}\n\nint main()\n{\n int n, a, b, i = 0;\n cin >> n;\n\n if(n%2 == 0)\n {\n a = (n/2)-1;\n b = (n/2)+1;\n }\n else\n {\n a = n/2;\n b = (n/2)+1;\n }\n\n while(i == 0)\n {\n if(eh_primo(a)&&eh_primo(b))\n {\n cout << a << \" \" << b << endl;\n i++;\n }\n a-=1;\n b+=1;\n\n }\n\n\n}", "lang": "GNU C++17", "bug_code_uid": "6e2615634f10b2c54c163e2521a58fc0", "src_uid": "0af3515ed98d9d01ce00546333e98e77", "apr_id": "b187e697c76f25e3ecbdb66f4eac4a1b", "difficulty": 800, "tags": ["brute force", "math", "constructive algorithms"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.05014577259475218, "equal_cnt": 12, "replace_cnt": 8, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 13, "bug_source_code": "// A Naive recursive C++ program to find minimum of coins \n// to make a given change V \n#include \nusing namespace std; \n\n// m is size of coins array (number of different coins) \nint minCoins(int coins[], int m, int V) \n{ \n// base case \nif (V == 0) return 0; \n\n// Initialize result \nint res = INT_MAX; \n\n// Try every coin that has smaller value than V \nfor (int i=0; i>n>>V;\n\tint coins[n];\n\tfor(int i=0;i\n#include\n\nusing namespace std;\nint*candle(int x[ ])\n{ int w[1]={0};\n \n while(x[0]!=0)\n { w[0]+=x[0];\n w[1]+=x[0]%x[1];\n x[0]=x[0]/x[1];\n }\n \n return w;\n}\n \nint main()\n{ int a[1];\n cin>>a[0]>>a[1];\n int*c=candle(a);\n while(c[1]>=5)\n { a[0]=c[1];\n c=candle(a);\n }\n cout<\nusing namespace std;\n\ntypedef unsigned long long LL;\n\nint main() {\n\n\tLL n,k,mid,l,r,c=0,d=0,w=0,i;\n\tcin >> n >> k;\n\n\tl = 0;\n\tr = n >> 1;\n\twhile (l <= r) {\n\t\tmid = ((r - l) >> 1) + l;\n\t\ti = mid * (k + 1);\n\t\tif (i > mid && i <= (n >> 1)) {\n\t\t\td = mid;\n\t\t\tl = d + 1;\n\t\t} else {\n\t\t\tr = mid - 1;\n\t\t}\n\t}\n\tc = d * k;\n\tw = n - d - c;\n\tcout << d << \" \" << c << \" \" << w << endl;\n\n\treturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "c12aa181fdb406506495f142a8375a36", "src_uid": "405a70c3b3f1561a9546910ab3fb5c80", "apr_id": "90057496897d1485841a6e8cbba52176", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9477971121806739, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "//SkGeN\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\n \ntypedef long long ll;\ntypedef pair p64;\ntypedef vector v64;\nconst int N = 2 * 1e5 + 10;\nconst ll inf = 1e18 + 100;\nconst ll mod = 1e9 + 7;\n \n#define pb push_back\n#define mp make_pair\n#define ff first\n#define ss second\n#define rep(i,s,e) for(long long i=s;i<=e;i++)\n#define brep(i,s,e) for(long long i=s;i>=e;i--)\n#define all(x) x.begin(),x.end()\n#define mem(x,y) memset(x,y,sizeof(x))\n#define DANGER std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)\n\nll n , sum;\nvector arr;\nll diff = inf , p1;\n\nll dp[52][1000000][2];\n\nll go(ll idx , ll ch) {\n\tif(idx == n) {\n\t\treturn 0;\n\t}\n\n\tll xx;\n\tif(ch) {\n\t\txx = max(arr[idx] + go(idx + 1, !ch) , go(idx + 1, ch));\n\t} else {\n\t\txx = min(arr[idx] + go(idx + 1, ch) , go(idx + 1 , !ch));\n\t}\n\treturn xx;\n}\n\nvoid solve() {\n\tcin>>n;\n\tarr.resize(n);\n\tfor(int i = 0; i < n ; i++) {\n\t\tcin>>arr[i];\n\t\tsum += arr[i];\n\t}\n\n\tll bob = go(0 , 0);\n\tcout<>t;\n\twhile(t--) {\n\t\tsolve();\n\t}\nreturn 0;\n}\n//---->O ,,", "lang": "GNU C++14", "bug_code_uid": "d351b9ec5d7e07ff1c0c4a8c52a38a70", "src_uid": "414540223db9d4cfcec6a973179a0216", "apr_id": "2c5ef01802b2d10bf0d40c279f49f728", "difficulty": 1500, "tags": ["dp", "games"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.1297709923664122, "equal_cnt": 13, "replace_cnt": 11, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 13, "bug_source_code": "#include \nusing namespace std;\nint main()\n{\nint x,top=0;\ncin>>x;\nint m[x][x];\nfor(int j=0;j>m[j][k];\n}\n}\nfor(int i=0;i=0;i--)\n{\ntop+=m[i][i];\n}\nfor(int h=0;h\n#include \n#include \nusing namespace std;\n\n#define v vector\n#define um unordered_map\n#define umm unordered_multimap\n#define us unordered_set\n#define ums unordered_multiset\ntypedef long long int ll;\ntypedef pair pii;\ntypedef pair pll;\ntypedef vector vi;\ntypedef vector vll;\ntypedef vector> vvi;\ntypedef vector> vvll;\ntypedef vector vpii;\ntypedef unordered_map umii;\ntypedef unordered_multimap ummii;\ntypedef unordered_set usi;\ntypedef unordered_multiset umsi;\n\nconst int mod = 998244353;\n\nint modExp(int a, int b, int c) {\n if (a == 0) return 0;\n int ans = 1;\n a %= c;\n while (b > 0) {\n if (b & 1) ans = ((ll)ans * a) % c;\n a = ((ll)a * a) % c;\n b /= 2;\n }\n return ans;\n}\n\nint modInv(int a, int b) {\n return modExp(a, b - 2, b);\n}\n\ntemplate\nvoid multiply(int A[N][N], int B[N][N]) {\n int C[N][N];\n for (int i = 0; i < N; i++) {\n for (int j = 0; j < N; j++) {\n C[i][j] = 0;\n for (int k = 0; k < N; k++) C[i][j] += A[i][k] * B[k][j];\n }\n }\n for (int i = 0; i < N; i++) {\n for (int j = 0; j < N; j++) A[i][j] = C[i][j];\n }\n}\n\ntemplate\nvoid matrixExp(int A[N][N], int p) {\n int B[N][N];\n for (int i = 0; i < N; i++) {\n for (int j = 0; j < N; j++) B[i][j] = A[i][j];\n }\n matrixExp(A, p / 2);\n multiply(A, A);\n if (p % 2) multiply(A, B);\n}\n\nint fibo(int n) {\n int M[2][2] = { {1,1},{1,0} };\n matrixExp<2>(M, n - 1);\n return M[0][0];\n}\n\nint solve(int n) {\n int x = fibo(n);\n int y = modInv(modExp(2, n, mod), mod);\n return ((ll)x * y) % mod;\n}\n\nll ceil(ll a, ll b) {\n if (a * b >= 0) return (a / b) + ((a % b) != 0);\n return a / b;\n}\n\nll floor(ll a, ll b) {\n if (a * b >= 0) return a / b;\n return a / b - ((a % b) != 0);\n}\n\nint main() {\n ios_base::sync_with_stdio(false);\n cin.tie(NULL);\n //freopen(\"input.txt\", \"r\", stdin);\n //freopen(\"output.txt\", \"w\", stdout);\n\n int n;\n cin >> n;\n cout << solve(n);\n}", "lang": "GNU C++17", "bug_code_uid": "e03453df43676f99d895ac8528c3a908", "src_uid": "cec37432956bb0a1ce62a0188fe2d805", "apr_id": "0399a65703f50c38d0ab345a75e61938", "difficulty": 1600, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.5774378585086042, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "#include \nusing namespace std;\nint main()\n{\n int c,v0,v1,a,l,curr,ans=1;\n cin>>c>>v0>>v1>>a>>l;\n curr=v0;\n while(curr\nusing namespace std;\nmap mp;\nvectorv;\nint main(){\n int n,i,a;\n while(1){\n cin>>n;\n for(i=1;i<=n;i++){\n cin>>a;\n mp[a] = i;\n }\n if(mp[1]==n || mp[1] ==1 || mp[n]==n || mp[n] ==1 ) cout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n#include \n#include \nusing namespace __gnu_pbds;\ntemplate \nusing ordered_set = tree, rb_tree_tag, tree_order_statistics_node_update>;\n// order_of_key(val): returns the number of values less than val\n// find_by_order(k): returns the iterator to kth largest element.(0-based)\n#define int long long\n#define pb push_back\n#define endl \"\\n\"\n#define all(con) con.begin(), con.end()\n#define fi first\n#define se second\n#define F first\n#define S second\n#define MP make_pair\n#define sz(x) (int)x.size()\n#define rp(i, n) for (int i = 0; i < n; i++)\n#define fr(i, n) for (int i = 1; i <= n; i++)\n#define ff(i, a, b) for (int i = a; i <= b; i++)\n#define fff(i, a, b) for (int i = a; i < b; i++)\n#define TRACE\n#ifndef ONLINE_JUDGE\n#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)\ntemplate \nvoid __f(const char *name, Arg1 &&arg1)\n{\n cerr << name << \" : \" << arg1 << endl;\n}\ntemplate \nvoid __f(const char *names, Arg1 &&arg1, Args &&... args)\n{\n const char *comma = strchr(names + 1, ',');\n cerr.write(names, comma - names) << \" : \" << arg1 << \" || \";\n __f(comma + 1, args...);\n}\n#else\n#define trace(...)\n#endif\ntypedef long double ld;\ntypedef long long ll;\ntypedef pair pii;\ntypedef vector vi;\ntypedef vector vs;\ntypedef vector vc;\ntypedef vector> vpi;\nconst int mod = 1e9 + 7;\nconst int mod1 = 998244353;\nconst int inf = 2e18;\n// const int MOD = 998244353;\nconst int MOD = 1e9 + 7;\n#define onlyunique(v) v.erase(unique(all(v)), v.end()); //only for sorted vectors-\nint bitcount(int n)\n{\n return (__builtin_popcountll(n));\n}\n// check if a number is a power of 2\nbool isp2(int n) { return (__builtin_popcountll(n) == 1); }\n// int gcd(int a, int b) { return __gcd(a, b); }\nint lcm(int a, int b) { return (a * b) / (__gcd(a, b)); }\n// Euclidean Algorithm for computing greatest Common Divisor\nint gcd(int a, int b)\n{\n if (!a || !b)\n return a | b;\n unsigned shift = __builtin_ctz(a | b);\n a >>= __builtin_ctz(a);\n do\n {\n b >>= __builtin_ctz(b);\n if (a > b)\n swap(a, b);\n b -= a;\n } while (b);\n return a << shift;\n}\n// Recursively computes the power\nint binpow(int a, int b)\n{\n if (b == 0)\n return a;\n int res = binpow(a, b / 2);\n if (b % 2)\n return res * res * a;\n else\n return res * res;\n}\n// iteratively computes the power\nint pow(int a, int b)\n{\n int res = 1;\n while (b)\n {\n if (b & 1)\n res = res * a;\n a = a * a;\n b >>= 1;\n }\n return res;\n}\nint modpow(int a, int b, int m)\n{\n int ans = 1;\n while (b)\n {\n if (b & 1)\n ans = (ans * a) % m;\n b /= 2;\n a = (a * a) % m;\n }\n return ans;\n}\nbool isprime(int n)\n{\n if (n < 2)\n return false;\n if (n == 2)\n return true;\n if (n % 2 == 0)\n return false;\n for (int i = 3; i * i <= n; i += 2)\n {\n if (n % i == 0)\n return false;\n }\n return true;\n}\nconst int MXX = 1e5 + 69;\nint fact[MXX], invfact[MXX];\nint modinv(int k) { return modpow(k, MOD - 2, MOD); }\nvoid combinatorics()\n{\n fact[0] = fact[1] = 1;\n for (int i = 2; i < MXX; i++)\n {\n fact[i] = fact[i - 1] * i;\n fact[i] %= MOD;\n }\n invfact[MXX - 1] = modinv(fact[MXX - 1]);\n for (int i = MXX - 2; i >= 0; i--)\n {\n invfact[i] = invfact[i + 1] * (i + 1);\n invfact[i] %= MOD;\n }\n}\nint nCr(int x, int y)\n{\n if (y > x)\n return 0;\n int num = fact[x];\n num *= invfact[y];\n num %= MOD;\n num *= invfact[x - y];\n num %= MOD;\n return num;\n}\n// transforms a string into lowercase.\nstring lwr(string s)\n{\n transform(all(s), s.begin(), ::tolower);\n return s;\n}\n// transforms a string into uppercase.\nstring upr(string s)\n{\n transform(all(s), s.begin(), ::toupper);\n return s;\n}\n// factorize a given number\nvector factorize(int n)\n{\n vector v;\n for (int i = 1; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n v.push_back(i);\n if (i * i != n)\n {\n v.push_back(n / i);\n }\n }\n }\n sort(v.begin(), v.end());\n return v;\n}\n// Implementation of Disjoint Set Union\n// using path compression and union by size.\n// Grows very slowly - inverse ackermann function\n// Link to dsu : https://cp-algorithms.com/data_structures/disjoint_set_union.html\nclass DSU\n{\npublic:\n vector par, sz;\n // Constructor for Initializing\n DSU(int n)\n {\n n = n + 3;\n par.resize(n);\n sz.resize(n);\n for (int i = 0; i < n; i++)\n par[i] = i, sz[i] = 1;\n }\n // Returns the main parent/representative of the set\n int find(int x)\n {\n if (x == par[x])\n return par[x];\n else\n return (par[x] = find(par[x])); // Path Compression Optimization\n // first find the representative of the set (root vertex), and the in the process of stack unwinding,\n // the visited nodes are attached directly to the representative.\n }\n // Unite two sets\n void Unite(int x, int y) // Union by Size\n {\n x = find(x);\n y = find(y);\n if (x == y)\n return;\n if (sz[x] < sz[y])\n swap(x, y);\n sz[x] += sz[y];\n par[y] = x;\n }\n bool Same(int x, int y) { return find(x) == find(y); }\n int size(int x) { return sz[find(x)]; }\n};\n// Stack is LIFO (Last in First Out)\n// Linked List based implementation of stacks\n// It is better tham the implementation using arrays.\n// Because it is dynamic\n// In the main function, call it as StackNode sn; StackNode *root = NULL; root = all operations.\nclass StackNode\n{\npublic:\n int data;\n StackNode *next;\n // Creates a new node to push onto the stack\n StackNode *CreateNode(int val)\n {\n StackNode *snw = new StackNode();\n snw->data = val;\n snw->next = NULL;\n }\n // Checks if the stack is empty\n int isEmpty(StackNode *root)\n {\n return (!root);\n }\n // Pushes a new-node onto the stack\n StackNode *push(StackNode *root, int val)\n {\n StackNode *nn = CreateNode(val);\n nn->next = root;\n root = nn;\n return root;\n }\n // remove the topmost element from the stack.\n StackNode *pop(StackNode *root)\n {\n if (isEmpty(root))\n return NULL;\n StackNode *tmp = root;\n (root) = (root)->next;\n int popped = tmp->data;\n free(tmp);\n return root;\n }\n // Returns the topmost element of the stack.\n int peek(StackNode *root)\n {\n if (isEmpty(root))\n return -2e9;\n return root->data;\n }\n // Returns the size of the stack\n int size(StackNode *root)\n {\n StackNode *a = root;\n int ans = 0;\n while (a != NULL)\n {\n a = a->next;\n ans++;\n }\n return ans;\n }\n};\n// Node representing a node of a Queue\nclass QNode\n{\npublic:\n int data;\n QNode *next;\n QNode(int val)\n {\n data = val;\n next = NULL;\n }\n};\n// Class for operations on a Queue\n// Queue is LIFO Last in First Out\nclass Queue\n{\npublic:\n QNode *front;\n QNode *rear;\n Queue()\n {\n front = rear = NULL;\n }\n // Adding an element\n void EnQueue(int x)\n {\n QNode *tmp = new QNode(x);\n if (rear == NULL)\n {\n front = rear = tmp;\n return;\n }\n rear->next = tmp;\n rear = tmp;\n }\n // Removing an element\n void DeQueue()\n {\n if (front == NULL)\n return;\n QNode *tmp = front;\n front = front->next;\n if (front == NULL)\n rear = NULL;\n delete (tmp);\n }\n // To access the first element of the Queue\n int Front()\n {\n return front->data;\n }\n // To access the last element of the Queue\n int Back()\n {\n return rear->data;\n }\n // Check if the Queue is Empty\n bool isEmpty()\n {\n return front == rear and front == NULL;\n }\n // Prints the elements of the Queue\n void displayQueue()\n {\n QNode *a = front;\n while (a != NULL)\n {\n cout << (a->data) << \" \";\n a = a->next;\n }\n cout << endl;\n }\n};\n// Function to print a vector\ntemplate \nvoid prev(vector &v)\n{\n for (auto t : v)\n cout << t << \" \";\n cout << endl;\n}\n// Function to print a vector and its size too\ntemplate \nvoid prevs(vector &v)\n{\n cout << v.size() << endl;\n for (auto t : v)\n cout << t << \" \";\n cout << endl;\n}\n// Function to print an array\nvoid prar(int a[], int n, int x)\n{\n for (int i = 0 + x; i < n + x; i++)\n {\n cout << a[i] << \" \";\n }\n cout << endl;\n}\ntemplate \nstd::pair findInVector(const std::vector &vecOfElements, const T &element)\n{\n std::pair result;\n auto it = std::find(vecOfElements.begin(), vecOfElements.end(), element);\n if (it != vecOfElements.end())\n {\n result.second = distance(vecOfElements.begin(), it);\n result.first = true;\n }\n else\n {\n result.first = false;\n result.second = -1;\n }\n return result;\n}\n// function to check if a character is a vowel.\nbool isvowel(char ch)\n{\n string s = \"aeiouAEIOU\";\n for (char c : s)\n if (c == ch)\n return true;\n return false;\n}\nconst int infms = 2e18;\nint inversions = 0;\nvoid Merge(int a[], int start, int mid, int end)\n{\n int n1 = mid - start + 1;\n int n2 = end - mid;\n int left[n1 + 2];\n int right[n2 + 2];\n left[n1 + 1] = infms;\n right[n2 + 1] = infms;\n for (int i = 1; i <= n1; i++)\n {\n left[i] = a[start + i - 1];\n }\n for (int i = 1; i <= n2; i++)\n {\n right[i] = a[mid + i];\n }\n int x = 1, y = 1;\n for (int k = start; k <= end; k++)\n {\n if (left[x] <= right[y])\n {\n a[k] = left[x];\n x++;\n }\n else\n {\n inversions += (1 + n1 - x);\n a[k] = right[y];\n y++;\n }\n }\n}\n// Merge Sort algorithm\nvoid MergeSort(int a[], int start, int end)\n{\n if (start < end)\n {\n int mid = (start + end) / 2;\n MergeSort(a, start, mid);\n MergeSort(a, mid + 1, end);\n Merge(a, start, mid, end);\n }\n}\n// Recursive function to check if string is a palindrome\nbool ispalindrome(string s)\n{\n int n = s.length();\n if (n <= 1)\n return true;\n else if (n == 2 && s[1] == s[0])\n return true;\n else if (n == 2 && s[0] != s[1])\n return false;\n else if (s[0] != s[n - 1])\n return false;\n else\n return ispalindrome(s.substr(1, n - 2));\n}\nbool palindrome(string s)\n{\n string t = s;\n reverse(all(t));\n return (t == s);\n}\nbool sortbysec(const pair &a, const pair &b) { return (a.second < b.second); }\nvoid dream();\nauto clk = clock();\nint32_t main()\n{\n ios::sync_with_stdio(false);\n cin.tie(0);\n cout.tie(0);\n srand(chrono::high_resolution_clock::now().time_since_epoch().count());\n cout << setprecision(8);\n // while( (double)clock() / CLOCKS_PER_SEC < 0.95 ) // can be used in special cases\n // #ifndef ONLINE_JUDGE // Comment this if the question demands input-output through a file\n // freopen(\"in.txt\", \"r\", stdin);\n // freopen(\"out.txt\", \"w\", stdout);\n // #endif\n // combinatorics(); // Take care of MOD\n int TESTCASES = 1;\n // cin>>TESTCASES;\n for (int i = 1; i <= TESTCASES; i++)\n dream();\n\n#ifndef ONLINE_JUDGE\n cout << endl\n << \"Time elapsed: \" << (double)(clock() - clk) / CLOCKS_PER_SEC << endl\n << endl;\n#endif\n return 0;\n}\nvoid dream()\n{\n int n, b;\n cin >> n >> b;\n int a[n];\n rp(i, n) cin >> a[i];\n int64_t a1 = 0;\n rp(i, n)\n {\n a1 = a1 + a[i] * pow(b, n - 1 - i);\n }\n cin >> n >> b;\n rp(i, n) cin >> a[i];\n int64_t a2 = 0;\n rp(i, n)\n {\n a2 = a2 + a[i] * pow(b, n - 1 - i);\n }\n trace(a1, a2);\n if (a1 == a2)\n {\n cout << \"=\" << endl;\n }\n else if (a1 < a2)\n {\n cout << \"<\" << endl;\n }\n else\n {\n cout << \">\" << endl;\n }\n // you should actually read the stuff at the bottom\n}\n/* stuff you should look for\n\t* int overflow, array bounds\n\t* special cases (n=1?)\n * boundary cases\n\t* do something instead of nothing and stay organized.\n * BELIEVE in yourself.\n*/\n/* some basic stuff that you should learn:\n * Sets : Unique element container.\n * set > s; // to order the set in descending order\n * To check if an element is in a set : s.count(x) || s.find(x)!=s.end()\n * begin() - returns an iterator to first element of set. The value of the element can be accessed using *(s.begin())\n * end() - Returns an iterator to the theoretical element that follows last element in the set.\n * size() - Returns the number of elements in the set.\n * max_size() - Returns the maximum number of elements that the set can hold.\n * empty() - Returns whether the set is empty.\n * find(x) - Returns an iterator to the element \u2018x\u2019 in the set if found, else returns the iterator to end.\n * erase(x)\u2013 Removes the value \u2018x\u2019 from the set. It erases an element by value\n * count(x) - Returns 1 or 0 based on the element \u2018x\u2019 is present in the set or not. It's the best way to check for the presence of an element.\n * lower_bound(x) \u2013 Returns an iterator to the first element that is equivalent to \u2018x\u2019 or definitely will not go before the element \u2018x\u2019 in the set.\n lower_bound can also be thought as the smallest element greater than or equal to x\n * Return reverse iterator to reverse beginning: (s.rbegin())\n * Set to be sorted in decreasing order: set >\n * emplace() : If the function successfully inserts the element (because no\n equivalent element existed already in the set), the function returns a\n pair of an iterator to the newly inserted element and a value of true.\n * const bool is_in = s.find(x) != s.end(); check if an element is in the set.\n * myset.erase(x) #directly by value. logarithmic complexity\n * myset.erase(iteratortoanelement,s.end())\n * for_each(all(s),do_something);\n * set :: iterator it = myset.find(60);\n\n * Vectors\n vector v; v.resize(n,0); // resizes the vector and initializes it too.\n front(), back(), push_back(), pop_back()\n * begin() - Returns an iterator pointing to the first element in the vector\n * end() - Returns an iterator pointing to the theoretical element that follows the last element in the vector\n * rbegin() - Returns a reverse iterator pointing to the last element in the vector (reverse beginning).\n * rend() - Returns a reverse iterator pointing to the theoretical element preceding the first element in the vector\n * cbegin(),cend(),crbegin(),crend()\n * size() - Returns the number of elements in the vector.\n * max_size() - Returns the maximum number of elements that the vector can hold.\n * capacity() - Returns the size of the storage space currently allocated to the vector expressed as number of elements.\n * resize() - Resizes the container so that it contains \u2018n\u2019 elements.\n * empty() - Returns whether the container is empty.\n * shrink_to_fit() - Reduces the capacity of the container to fit its size and destroys all elements beyond the capacity.\n * reserve() - Requests that the vector capacity be at least enough to contain n elements.\n * [i] - Returns a reference to the element at position \u2018i\u2019 in the vector\n * at(i) - Returns a reference to the element at position \u2018i\u2019 in the vector\n * front() - Returns a reference to the first element in the vector\n * back() - Returns a reference to the last element in the vector\n * data() - Returns a direct pointer to the memory array used internally by the vector to store its owned elements.\n * assign() - It assigns new value to the vector elements by replacing old ones\n * push_back() - It push the elements into a vector from the back\n * pop_back() - It is used to pop or remove elements from a vector from the back.\n * insert() - It inserts new elements before the element at the specified position\n * erase() - It is used to remove elements from a container from the specified position or range\n * swap() - It is used to swap the contents of one vector with another vector of same type. Sizes may differ.\n * clear() - It is used to remove all the elements of the vector container\n * emplace() - It extends the container by inserting new element at position\n * emplace_back() - It is used to insert a new element into the vector container, the new element is added to the end of the vector\n * for (auto it = myvector.begin(); it != myvector.end(); ++it)\n\n * Queue\n * empty() - Returns whether the queue is empty.\n * size() - Returns the size of the queue.\n * emplace() - Insert a new element into the queue container, the new element is added to the end of the queue.\n * front() - front() function returns a reference to the first element of the queue.\n * back() - returns a reference to the last element of the queue.\n * push(x) - adds the element \u2018x\u2019 at the end of the queue\n * pop() - deletes the first element of the queue\n\n * Priority_Queue\n priority_queue , greater> pq; // to make a priority queue in descending order\n * empty() - returns whether the queue is empty.\n * size() - returns the size of the queue.\n * top() - Returns a reference to the top most element of the queue\n * push(x) - adds the element \u2018x\u2019 at the end of the queue.\n * pop() - deletes the first element of the queue.\n * swap() - swap the contents of one priority queue with another priority queue of same type and size.\n * emplace() - insert a new element into the priority queue container, the new element is added to the top of the priority queue.\n\n * Deque\n Double ended queues are sequence containers with the feature of expansion and contraction on both the ends.\n They are similar to vectors, but are more efficient in case of insertion and deletion of elements.\n Unlike vectors, contiguous storage allocation may not be guaranteed.\n * insert()\n * rbegin()\n * rend()\n * assign()\n * resize()\n * push_front()\n * push_back()\n * pop_front()\n * pop_back()\n * front()\n * back()\n*/", "lang": "GNU C++14", "bug_code_uid": "eaf04c06a5aa0284db54148305f0a22b", "src_uid": "d6ab5f75a7bee28f0af2bf168a0b2e67", "apr_id": "508cb014d9a5696caf88c242f76510ab", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.6653753026634383, "equal_cnt": 15, "replace_cnt": 12, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 15, "bug_source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\n\n\n\nvoid fast(){\n\t#ifndef ONLINE_JUDGE\n\tfreopen(\"input.txt\", \"r\", stdin);\n\tfreopen(\"output.txt\", \"w\", stdout);\n\t\n\t#endif\n\tstd::ios_base::sync_with_stdio(0);\n\tcin.tie(NULL); cout.tie(NULL);\n}\nint n;\n\nint main(){\n\tfast();\n\tcin>>n;\n\tlong long a , b, c;\n\ta = n , b =1 , c = 1;\n\tlong long mx = (a+1) * (b +2)*(c+2) - n;\n\tfor(int i = 1;i*i <= n ;i++){\n\t\tif(n%i == 0){\n\t\t\tb = i;\n\t\t}\n\t}\n\ta = n /b;\n\tlong long mn = (min(a,b)+2) * (max(a,b) +2)*(c+1) - n;\n\tcout<\n#include \n\nusing namespace std;\n\nint findGCD(int a, int b){\n\tint temp;\n\tif (a < b){\n\t\ttemp = a;\n\t\ta = b;\n\t\tb = temp;\n\t}\n\twhile(true){\n\t\ta %= b;\n\t\tif (a == 0) break;\n\t\ttemp = a;\n\t\ta = b;\n\t\tb = temp;\n\t}\n\treturn b;\n}\n\nint main() {\n\tint a, b, n, temp;\n\tcin >> a >> b >> n;\n\twhile (true){\n\t\ttemp = findGCD(a, n);\n\t\tif (n < temp){\n\t\t\tcout << \"1\";\n\t\t\tbreak;\n\t\t}\n\t\tn -= a;\n\t\ttemp = findGCD(b, n);\n\t\tif (n < temp){\n\t\t\tcout << \"0\";\n\t\t\tbreak;\n\t\t}\n\t\tn -= b;\n\t}\n}", "lang": "MS C++", "bug_code_uid": "39faed67653155b30242f24b9f3f8425", "src_uid": "0bd6fbb6b0a2e7e5f080a70553149ac2", "apr_id": "22f28e05c2febab7897d789e99f62284", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.18091259640102827, "equal_cnt": 28, "replace_cnt": 19, "delete_cnt": 4, "insert_cnt": 5, "fix_ops_cnt": 28, "bug_source_code": "#include \nusing namespace std;\n\ntypedef long long llint;\ntypedef long long ll;\ntypedef double lf;\ntypedef long double Lf;\ntypedef pair pii;\ntypedef pair pll;\n\n#define TRACE(x) cerr << #x << \" \" << x << endl\n#define FOR(i, a, b) for (int i = (a); i < int(b); i++)\n#define REP(i, n) FOR(i, 0, n)\n#define all(x) (x).begin(), (x).end()\n#define _ << \" \" <<\n\n#define fi first\n#define sec second\n#define mp make_pair\n\nconst int MOD = 998244353;\n\nnamespace FFT {\n const int MAX = 3 * (1 << 20);\n\n typedef llint value;\n typedef complex comp;\n\n int N;\n comp omega[MAX];\n comp a1[MAX], a2[MAX];\n comp z1[MAX], z2[MAX];\n\n void fft(comp *a, comp *z, int m = N) {\n if (m == 1) {\n z[0] = a[0];\n } else {\n int s = N/m;\n m /= 2;\n\n fft(a, z, m);\n fft(a+s, z+m, m);\n\n REP(i, m) {\n comp c = omega[s*i] * z[m+i];\n z[m+i] = z[i] - c;\n z[i] += c;\n }\n }\n }\n\n void mult(value *a, value *b, value *c, int len) {\n N = 2*len;\n while (N & (N-1)) ++N;\n assert(N <= MAX);\n\n REP(i, N) a1[i] = 0;\n REP(i, N) a2[i] = 0;\n REP(i, len) a1[i] = a[i];\n REP(i, len) a2[i] = b[i];\n\n REP(i, N) omega[i] = polar(1.0, 2*M_PI/N*i);\n fft(a1, z1, N);\n fft(a2, z2, N);\n\n REP(i, N) omega[i] = comp(1, 0) / omega[i];\n REP(i, N) a1[i] = z1[i] * z2[i] / comp(N, 0);\n fft(a1, z1, N);\n\n REP(i, 2*len) c[i] = round(z1[i].real());\n }\n\n void mult_mod(llint *a, llint *b, llint *c, int len, int mod) {\n static llint a0[MAX], a1[MAX];\n static llint b0[MAX], b1[MAX];\n static llint c0[MAX], c1[MAX], c2[MAX];\n\n REP(i, len) a0[i] = a[i] & 0xFFFF;\n REP(i, len) a1[i] = a[i] >> 16;\n\n REP(i, len) b0[i] = b[i] & 0xFFFF;\n REP(i, len) b1[i] = b[i] >> 16;\n\n FFT::mult(a0, b0, c0, len);\n FFT::mult(a1, b1, c2, len);\n\n REP(i, len) a0[i] += a1[i];\n REP(i, len) b0[i] += b1[i];\n FFT::mult(a0, b0, c1, len);\n REP(i, 2*len) c1[i] -= c0[i] + c2[i];\n\n REP(i, 2*len) c1[i] %= mod;\n REP(i, 2*len) c2[i] %= mod;\n REP(i, 2*len) c[i] = (c0[i] + (c1[i] << 16) + (c2[i] << 32)) % mod;\n }\n}\n\nint add(int a, int b) {\n a += b;\n if (a >= MOD) a -= MOD;\n return a;\n}\n\nint mul(int a, int b) {\n return (ll)a * b % MOD;\n}\n\nint n, k;\nllint p[FFT::MAX], ans[FFT::MAX];\n\nint main() {\n scanf(\"%d %d\",&n,&k);\n REP(i, k) {\n int a;\n cin >> a;\n p[a] = 1;\n }\n ans[0] = 1;\n\n n /= 2;\n\n int sz = 10;\n while (n) {\n if (n % 2) FFT::mult_mod(p, ans, ans, sz, MOD);\n FFT::mult_mod(p, p, p, sz, MOD);\n n /= 2;\n sz *= 2;\n }\n\n int sol = 0;\n\n REP(i, FFT::MAX) {\n sol = add(sol, mul(ans[i], ans[i]));\n }\n\n cout << sol << endl;\n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "8b2170b036485152d695af75e6cc8312", "src_uid": "279f1f7d250a4be6406c6c7bfc818bbf", "apr_id": "0892e8fc6f2d0f9c27d3162f989333fb", "difficulty": 2400, "tags": ["divide and conquer", "dp", "fft"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9882352941176471, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\ntypedef long long LL;\ntypedef unsigned long long ULL;\ntypedef vector VI;\ntypedef vector VS;\ntypedef vector VVI;\ntypedef pair PII;\nconst double eps = 1e-9;\nconst int INF = 1<<30;\nconst LL LINF = 1ll<<61;\n\n#define pb push_back\n#define mp make_pair\n#define ALL(a) (a).begin(),(a).end()\n#define CLR(a, v) memset((a),(v),sizeof(a))\n#define sqr(a) ((a)*(a))\nconst int BUFFER_SZ = 1<<20;\nconst int MOD = 1000*1000*1000+7;\n\nchar BUFFER[BUFFER_SZ];\nint gi() { int x; scanf(\"%d\", &x); return x; }\ndouble gd() { double x; scanf(\"%lf\", &x); return x; }\nLL gll() { LL x; scanf(\"%lld\", &x); return x; }\nVI gvi(int n) { VI a; while(n-->0) a.pb(gi()); return a;}\nstring gs() { scanf(\"%s\", BUFFER); return string(BUFFER); }\ntemplate void print(vector &x, string format) { format += \"%c\";for (int i = 0; i < x.size(); ++i) printf(format.c_str(), x[i], i+1==x.size() ? '\\n' : ' '); }\n// ---------------------------------------------------------- //\n\nstruct point {\n double x,y;\n point(double x, double y):x(x),y(y) {}\n};\n\nstruct line {\n double A,B,C;\n line(point a, point b) {\n A = a.y-b.y;\n B = b.x-a.x;\n C = -A*a.x-B*a.y;\n }\n};\n\nstruct seg {\n point p,q;\n seg(point p,point q):p(p),q(q) {}\n};\n\nint intersects(line a, line b) {\n return abs(a.A*b.B-b.A*a.B)>eps;\n}\n\ndouble dist(line a, point p) {\n return (a.A*p.x + a.B*p.y + a.C) / hypot(a.A, a.B);\n}\ndouble dist(seg a, point p) {\n return dist(line(a.p, a.q), p);\n}\n\npoint intersectLines(line a, line b) {\n double det = a.A*b.B-b.A*a.B;\n double x = -(a.C*b.B-a.B*b.C)/det;\n double y = -(a.A*b.C-a.C*b.A)/det;\n return point(x,y);\n}\n\nint intersect(seg a, seg b, int allowCollision=0) {\n line la = line(a.p, a.q);\n line lb = line(b.p, b.q);\n\n double x1 = min(a.p.x, a.q.x);\n double x2 = max(a.p.x, a.q.x);\n double y1 = min(a.p.y, a.q.y);\n double y2 = max(a.p.y, a.q.y);\n\n double x3 = min(b.p.x, b.q.x);\n double x4 = max(b.p.x, b.q.x);\n double y3 = min(b.p.y, b.q.y);\n double y4 = max(b.p.y, b.q.y);\n\n if (min(x2,x4)-max(x1,x3)<-eps) return 0;\n if (min(y2,y4)-max(y1,y3)<-eps) return 0;\n\n if (intersects(la,lb)) {\n point c = intersectLines(la,lb);\n if (x1-eps0.0 || d1>0.0 && d2<0.0) {\n // different sides\n } else {\n //cout << \"here\" << endl;\n line mirrL(mirr.p, mirr.q);\n double vx = mirrL.A;\n double vy = mirrL.B;\n vx/=hypot(mirrL.A, mirrL.B);\n vy/=hypot(mirrL.A, mirrL.B);\n\n double px = A.x-vx*d1;\n double py = A.y-vy*d1;\n\n double p2x = B.x-vx*d2;\n double p2y = B.y-vy*d2;\n\n double d = hypot(px-p2x, py-p2y);\n //printf(\"%.3lf\\n\", d);\n //printf(\"%.3lf %.3lf\\n\", px, py);\n\n double move = d1*d/(d1+d2);\n //printf(\"%.3lf\\n\", move);\n double ox = px+(p2x-px)*move/d;\n double oy = py+(p2y-py)*move/d;\n //printf(\"%.3lf %.3lf\\n\", ox, oy);\n\n seg t1(A,point(ox,oy));\n seg t2(B,point(ox,oy));\n if (intersect(mirr, t1) && intersect(mirr,t2)) {\n if (!intersect(wall,t1) && !intersect(wall,t2)) {\n printf(\"YES\\n\");\n return;\n }\n }\n }\n }\n printf(\"NO\\n\");\n}\n\nint main() {\n#ifdef DEAD_RABBIT\n freopen(\"../in.txt\",\"r\",stdin);\n clock_t start = clock();\n#endif\n solve();\n#ifdef DEAD_RABBIT\n fprintf(stdout, \"Time: %.3lf\\n\", 1.0*(clock()-start)/CLOCKS_PER_SEC);\n#endif\n return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "8a48cbd89e6b1e5455e174ba6bc09bac", "src_uid": "7539a41268b68238d644795bccaa0c0f", "apr_id": "8304cdde94d8a72cc8467cffca8b5799", "difficulty": 2400, "tags": ["geometry", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9969558599695586, "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;\ntypedef long long ll;\ntypedef long double ld;\nconst int N = 1010;\nld F[N][M]; int vis[N][M];\n\nld f(int n, int m) {\n if(!n) return (ld) 1 / (m + 1);\n if(!m) return 1;\n if(vis[n][m]) return F[n][m];\n ld k1 = (ld) m / (m + 1) * (1 - f(m - 1, n)) - 1;\n ld b1 = 1;\n ld k2 = (ld) (1 + m * (1 - f(m - 1, n))) / (m + 1) - (1 - f(m, n - 1));\n ld b2 = 1 - f(m, n - 1);\n ld X = (b2 - b1) / (k1 - k2);\n vis[n][m] = 1;\n return F[n][m] = k1 * X + b1;\n}\n\nint main() {\n int n, m; cin >> n >> m;\n ld ans = f(n, m);\n cout << fixed << setprecision(10) << ans << ' ' << (1 - ans) << endl;\n}\n", "lang": "GNU C++17", "bug_code_uid": "a6b6d237f2a8b58a902070f84af85ecd", "src_uid": "f51586ab88399c04ffb7eaa658d294dd", "apr_id": "fc78059cd0cb7b85c524a041e94fbe1f", "difficulty": 2700, "tags": ["math", "dp", "games", "probabilities"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.19121813031161472, "equal_cnt": 13, "replace_cnt": 11, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 13, "bug_source_code": "#include \nusing namespace std;\n\nint main()\n{\n\tint n, m;\n\tvector base, ans;\n\n\tscanf(\"%d%d\", &n, &m);\n\n\tfor(int i = 1; i <= n; i++) base.push_back(i);\n\n\tfor(int i = 0; i < n; i++) {\n\t\tans.push_back(m%(i+2));\n\t\tm /= (i+2);\n\t}\n\n\tfor(int i = 0; i < n; i++) {\n//\t\tcout << ans[i] << endl;\n\t\tprintf(\"%d \", base[ans[i]]);\n\t\tbase.erase(base.begin()+ans[i]);\n\t}\n\tcout << endl;\n\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "399585a69a884666c9701463111d4eb4", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "apr_id": "144bbffc2a4a82c19531aa71f55cd9c5", "difficulty": 1400, "tags": ["brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.22600243013365734, "equal_cnt": 9, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": " #include \n #define ll long long\n #define f(i,a,b) for(long long i=a;i str;\n int sum=0,n,m;\n string x;\n cin>>n>>m;\n f(i,0,n)\n {\n cin>>x;\n str.push_back(x);\n }\n f(i,0,n){\n f(j,0,m){\n if(str[i][j]=='W'){\n\n //\u0627\u0649 \u062d\u0631\u0641 \u0641\u0649 \u0627\u0644\u0646\u0635\n if(i>0&&i!=n-1&&j>0&&j!=m-1){\n if(str[i][j-1]=='P'){sum++;str[i][j-1]='.'; continue;}\n if(str[i][j+1]=='P'){sum++;str[i][j+1]='.'; continue;}\n if(str[i-1][j]=='P'){sum++;str[i-1][j]='.'; continue;}\n if(str[i+1][j]=='P'){sum++;str[i+1][j]='.'; continue;}\n continue;\n\n }\n\n ////////////\u0627\u0644\u0627\u0631\u0643\u0627\u0646/////////\n\n //\u0627\u0644\u062d\u0631\u0641 \u0627\u0644\u0644\u0649 \u062a\u062d\u062a \u0639\u0644\u0649 \u0627\u0644\u0634\u0645\u0627\u0644\nif(i>0&&i==n-1&&j==0&&j!=m-1){\n if(str[i][j+1]=='P'){sum++;str[i][j+1]='.'; continue;}\n if(str[i-1][j]=='P'){sum++;str[i-1][j]='.'; continue;}\n\n }\n\n//\u0627\u0644\u062d\u0631\u0641 \u0627\u0644\u0644\u0649 \u0641\u0648\u0642 \u0639\u0644\u0649 \u0627\u0644\u0634\u0645\u0627\u0644\n\n if(i==0&&i!=n-1&&j==0&&j!=m-1){\n if(str[i][j+1]=='P'){sum++;str[i][j+1]='.'; continue;}\n if(str[i+1][j]=='P'){sum++;str[i+1][j]='.'; continue;}\n\n }\n\n\n //\u0627\u0644\u062d\u0631\u0641 \u0641\u0649 \u0627\u0644\u0631\u0643\u0646 \u0627\u0644\u0644\u0649 \u062a\u062d\u062a \u0639\u0644\u0649 \u0627\u0644\u064a\u0645\u064a\u0646\n if(i>0&&i==n-1&&j>0&&j==m-1){\n if(str[i][j-1]=='P'){sum++;str[i][j-1]='.'; continue;}\n if(str[i-1][j]=='P'){sum++;str[i-1][j]='.'; continue;}\n\n }\n\n //\u0627\u0644\u062d\u0631\u0641 \u0627\u0644\u0644\u0649 \u0641\u0649 \u0627\u0644\u0631\u0643\u0646 \u0627\u0644\u0644\u0649 \u0641\u0648\u0642 \u0639\u0644 \u0649\u0627\u0644\u064a\u0645\u064a\u0646\n if(i==0&&i!=n-1&&j>0&&j==m-1){\n if(str[i][j-1]=='P'){sum++;str[i][j-1]='.'; continue;}\n if(str[i+1][j]=='P'){sum++;str[i+1][j]='.'; continue;}\n\n }\n\n //////\u0627\u0644\u062d\u0648\u0627\u0627\u0627\u0641////////\n\n//\u0627\u0649 \u062d\u0631\u0641 \u0641\u0649 \u0627\u062e\u0631 \u0639\u0645\u0648\u062f\n if(i>0&&i!=n-1&&j==m-1){\n if(str[i][j-1]=='P'){sum++;str[i][j-1]='.'; continue;}\n if(str[i-1][j]=='P'){sum++;str[i-1][j]='.'; continue;}\n if(str[i+1][j]=='P'){sum++;str[i+1][j]='.'; continue;}\n\n }\n\n//\u0627\u0649 \u062d\u0631\u0641 \u0641\u0649 \u0627\u0648\u0644 \u0635\u0641\n if(i==0&&j>0&&j!=m-1){\n if(str[i][j-1]=='P'){sum++;str[i][j-1]='.'; continue;}\n if(str[i][j+1]=='P'){sum++;str[i][j+1]='.'; continue;}\n if(str[i+1][j]=='P'){sum++;str[i+1][j]='.'; continue;}\n\n }\n\n //\u0627\u0649 \u062d\u0631\u0641 \u0641\u0649 \u0627\u062e\u0631 \u0635\u0641\n\n if(i==n-1&&j>0&&j!=m-1){\n if(str[i][j-1]=='P'){sum++;str[i][j-1]='.'; continue;}\n if(str[i][j+1]=='P'){sum++;str[i][j+1]='.'; continue;}\n if(str[i-1][j]=='P'){sum++;str[i-1][j]='.'; continue;}\n }\n\n //\u0627\u0649 \u062d\u0631\u0641 \u0641\u0649 \u0627\u0648\u0644 \u0639\u0645\u0648\u062f\n\n if(i>0&&i!=n-1&&j==0){\n if(str[i][j+1]=='P'){sum++;str[i][j+1]='.'; continue;}\n if(str[i-1][j]=='P'){sum++;str[i-1][j]='.'; continue;}\n if(str[i+1][j]=='P'){sum++;str[i+1][j]='.'; continue;}\n\n }\n\n }\n }\n }\n cout<\n#include\n#include\n#include\n#include\nusing namespace std;\nint a[100001];\ninline int read()\n{\n bool f=0;\n char c=getchar();\n int x=0;\n while(c<'0'||c>'9') f=!f,c=getchar();\n while(c>='0'&&c<='9') x=x*10+c-'0',c=getchar();\n return f?-x:x;\n}\ninline void write(int n)\n{\n if(n<0)\n {\n putchar('-');\n write(-n);\n }\n else\n {\n while(n/10) write(n%10);\n putchar(n%10+'0');\n }\n}\nint main()\n{\n int n,k,ans=0x7fffffff;\n n=read();k=read();\n for(int i=1;i<=n;++i)\n {\n a[i]=read();\n if(k%a[i]==0&&k/a[i]\n#include \n#pragma GCC optimize(\"Ofast\", \"unroll-loops\")\n#define ll long long\n#define FOR(i,a,b) for (int i = (a); i<(b); i++)\n#define REP(i,n) FOR(i,0,n)\n#define REP1(i,n) FOR(i,1,n+1)\n#define RREP(i,n) for (int i=(n)-1; i>=0; i--)\n#define f first\n#define s second\n#define pb push_back\n#define ALL(x) x.begin(),x.end()\n#define SZ(x) (int)(x.size())\n#define SQ(x) (x)*(x)\n#define pii pair\n#define endl '\\n'\n#define::sync_with_stdio(false), cin.tie(0), cout.tie(0); \n \n\n}\n", "lang": "GNU C++14", "bug_code_uid": "4da6495c7cc099032193dba3cbebabdb", "src_uid": "ed0ebc1e484fcaea875355b5b7944c57", "apr_id": "7f5a5f727fb480f61ecb72d18cfc59e1", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9995414947271893, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n#define x first\n#define y second\n#define mk make_pair\n#define pb push_back\n#define mid ((l+r) >> 1)\n#define ls k<<1, l, mid\n#define rs k<<1|1, mid+1, r\n#define LS k<<1\n#define RS k<<1|1\n#define ll long long\n#define lb long double\n#define db double\n#define PII pair\n#define For(i,a,b) for(int i = a;i <= b;i++)\n#define Forn(i,a,b) for(int i = a;i >= b;i--)\ninline int read(){\n int x = 0, f = 1;char ch = getchar();\n for (;ch < '0' || ch > '9';){if (ch == '-') f = -1;ch = getchar();}\n for (;ch >= '0' && ch <= '9';){x = x * 10 + ch - '0';ch = getchar();}\n return x * f;\n}\nint n,w;\n#define N 1010\nint a[N];\nint flag[N],reflag[N];\nint main(){\n\tn=read();\n\tFor(i,1,n)a[i]=sread();\n\tForn(i,n,1){\n\t\tif(reflag[a[i]]){\n\t\t\tflag[i]=1;\n\t\t}\n\t\treflag[a[i]]=1;\n\t}\n\tint ans=0;For(i,1,n)if(!flag[i])ans++;\n\tprintf(\"%d\\n\",ans);\n\tFor(i,1,n)if(!flag[i])printf(\"%d \",a[i]);\n}\n\n", "lang": "GNU C++", "bug_code_uid": "4eca0c446370ce6c944213b70ace3cb9", "src_uid": "1b9d3dfcc2353eac20b84c75c27fab5a", "apr_id": "9018cb7ad05b88cf8b0c1bf86627507b", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9616368286445013, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "#include \n#include \n\nusing namespace std;\n\nint n, m, k, i, j, res(1);\n\nvoid Init()\n{\n cin >> n >> m >> k;\n m -= n;\n i = k; j = k;\n while (i > 1 || j < n)\n {\n //cout << i << \" \" << j << \" \" << m << endl;\n if (m >= j - i + 1)\n {\n m -= (j - i + 1);\n i--; j++; res++;\n }\n else break;\n }\n res += m / n;\n cout << res;\n}\n\nint main()\n{\n ios_base :: sync_with_stdio(false);\n cin.tie(NULL);\n freopen(\"Div393B.inp\", \"r\", stdin);\n\t Init();\n}\n//Date 10 Month 2 Year 2017\n\n\n", "lang": "GNU C++11", "bug_code_uid": "107f722c3247a36adaf3fec2991d24f7", "src_uid": "da9ddd00f46021e8ee9db4a8deed017c", "apr_id": "2bd85d7144f6e68efeda18a3220c9f5a", "difficulty": 1500, "tags": ["greedy", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9888143176733781, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#define maxn 505\n#define ll long long\nusing namespace std;\nconst int mo=1e9+7;\nint n,m,a[maxn],b[maxn],c[maxn],z[maxn],A[maxn],B[maxn];\nll K;\nvoid inc(int &x,int y){x=((x+y>=mo)?x+y-mo:x+y);}\nvoid dec(int &x,int y){x=((x-y<0)?x-y+mo:x-y);}\nvoid mult(int *u,int *v){\n int i,j;\n memset(z,0,sizeof(z));\n for(i=0;i<250;i++)\n for(j=0;j<250;j++)\n z[i+j]=(z[i+j]+1LL*u[i]*v[j])%mo;\n for(i=498;i>=250;i--)\n for(j=1;j<=m;j++)\n inc(z[i-b[j]],z[i]);\n for(i=0;i<250;i++) u[i]=z[i];\n}\nvoid fpm(int *c,ll n){\n memset(A,0,sizeof(A));\n A[0]=1;\n while(n){\n if(n&1) mult(A,c);\n n>>=1,mult(c,c);\n }\n}\nint main(){\n int i,j;\n scanf(\"%d %d %lld\",&n,&m,&K);\n for(i=1;i<=n;i++) scanf(\"%d\",&a[i]);\n for(i=1;i<=m;i++) scanf(\"%d\",&b[i]);\n for(i=1;i<=n;i++){\n memset(c,0,sizeof(c));\n c[1]=1,fpm(c,a[i]);\n for(j=0;j<250;j++) inc(B[j],A[j]);\n }\n fpm(B,K);\n for(i=0;i<250;i++) B[i]=A[i];\n for(i=249;i>0;i--)\n for(j=1;j<=m;j++)\n if(i>=b[j]) inc(B[i-b[j]],B[i]);\n cout<\nusing namespace std;\n#define int long long\nconst int N=505,M=1e9+7;\nint K,m,n,a[N],H[N],num[N],F[N],G[N],x,ans[N];\ninline int ksm(int x,int y){\n\tint ans=1;\n\tfor (;y;y>>=1,x=x*x%M)\n\t\tif (y&1)(ans*=x)%=M;\n\treturn ans;\n}\ninline void cf1(int A[]){\n\tint C[N];\n\tmemset(C,0,sizeof C);\n\tfor (int i=0;i<250;i++)\n\t\tfor (int j=0;j<250;j++)(C[i+j]+=A[i]*A[j])%=M;\n\tint Inv=ksm(num[250],M-2);\n\tfor (int i=499;i>=250;i--){\n\t\tint t=Inv*C[i]%M;\n\t\tfor (int j=0;j<=250;j++)(C[250-j+i]+=M-t*num[j]%M)%=M;\n\t}\n\tfor (int i=0;i=250;i--){\n\t\tint t=Inv*C[i]%M;\n\t\tfor (int j=0;j<=250;j++)(C[250-j+i]+=M-t*num[j]%M)%=M;\n\t}\n\tfor (int i=0;i>=1,cf1(F))\n\t\t\tif (y&1)cf(G,F);\n\t\tfor (int j=0;j<250;j++)(H[j]+=G[j])%=M;\n\t}\n\tmemset(G,0,sizeof G);\n\tG[0]=1;\n\tfor (;n;n>>=1,cf1(H))\n\t\tif (n&1)cf(G,H);\n\tint Ans=0;\n\tfor (int i=0;i<250;i++)(Ans+=G[i]*ans[i])%=M;\n\tprintf(\"%lld\\n\",Ans);\n}\n", "lang": "GNU C++11", "bug_code_uid": "57e15b731abd696871d447889bad1287", "src_uid": "c3a4c109080f49b88be5fb13157d1af0", "apr_id": "fb56d842463c706a748d56ec3e459b2a", "difficulty": 3300, "tags": ["matrices", "math", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9952418715305313, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include \n\n#define _overload(_1,_2,_3,name,...) name\n#define _rep(i,n) _range(i,0,n)\n#define _range(i,a,b) for(int i=int(a);i=int(b);--i)\n#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)\n\n#define _all(arg) begin(arg),end(arg)\n#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))\n#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)\n#define clr(a,b) memset((a),(b),sizeof(a))\n#define bit(n) (1LL<<(n))\n#define popcount(n) (__builtin_popcountll(n))\n\nusing namespace std;\n\ntemplatebool chmax(T &a, const T &b) { return (abool chmin(T &a, const T &b) { return (b> n >> k;\n\n\tconst ll num=(k+1)/2;\n\n\twhile(--num){\n\t\tn=phi_func(n);\n\t\tif(n==1) break;\n\t}\n\n\tconst ll mod=1000000007LL;\n\tn%=mod;\n\tcout << n << endl;\n\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "d4ba16e493782b025902933243113c9a", "src_uid": "0591ade5f9a69afcbecd80402493f975", "apr_id": "88ad07f95f33f8fd271a11fbe4b4b2c9", "difficulty": 2100, "tags": ["math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.782464846980976, "equal_cnt": 14, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 13, "bug_source_code": "#include \n#include \n#include \n#include \n#include \nusing namespace std;\n#define M 1000007\nchar a[30];\nint n,m,ans=0;bool b[M];\ninline void Insert(int x,char y)\n {\n \tint i,j,k,l,q,w,e=0;\n \tfor (i=0;i\n#define pi acos(-1)\n#define ll long long\n#define pii pair\n#define debug(a) cout<=a ; i--)\n#define trav(a, x) for(auto& a : x)\n#define allin(a , x) for(auto a : x)\n#define all(x) begin(x), end(x)\n#define sz(x) (ll)(x).size()\nusing namespace std;\nconst ll INF = 1e17 + 9;\nint main(){\n ios::sync_with_stdio(false);\n cin.tie(0);\n ll b,a,k;\n cin>>a>>b>>k;\n ll lcmt=2;\n rep(i,3,k+1){\n lcmt = (lcmt*i)/__gcd(lcmt,i);\n }\n\n /// first interval\n ll mult1=((b+lcmt-1)/lcmt)*lcmt;\n set vis1;\n queue q;\n bool ch=0;\n ll ans1=0;\n ll dp[maxn];\n rep(i,0,maxn){\n dp[i]=INF;\n } \n dp[(mult1-1)%lcmt]=1;\n dp[0]=0;\n per(i,mult1,0){\n rep(j,2,k+1){\n dp[(i/j)*j]=min(dp[i]+1,dp[(i/j)*j]);\n }\n dp[i]=min(dp[i],dp[i+1]+1);\n }\n ans1=dp[b%lcmt];\n /// third interval\n set vis2;\n ll mult2 = ((a)/lcmt)*lcmt;\n ch=0;\n q.push({a,0});\n vis2.insert(a);\n ll ans2=0;\n while(!ch){\n auto e = q.front();\n // cout<\nusing namespace std;\ntypedef long long ll;\nll k;\nconst ll inf = 1LL<<30;\nll solve(ll a,ll b){\n\tif(b < a)return inf;\n\tif(a==b)return 0;\n\tll ret = inf;\n\tfor(int i=2;i<=k;i++){\n\t\tif(b%i)\n\t\tret = min(ret, solve(a,b - b % i)+1);\n\t}\n\tret = min(ret , solve(a,b-1)+1);\n\treturn ret;\n}\n\nint main(){\n\tll a,b,ans=0;\n\tcin>>b>>a>>k;\n\tll v1 = b%k;\n\tif(b - v1 >= a){\n\t\tb-=v1;\n\t\tans++;\n\t\tll diff = b-a;\n\t\tll op = diff / k;\n\t\tif(op > 5)op-=3;\n\t\tans += op * 2;\n\t\tb -= op * k;\n\t}\n\tans += solve(a,b);\n\tcout<\nusing namespace std;\n\n#define lli long long int\n#define ll long long\n#define rep(i, a, b) for (int i = a; i < b; i++)\n#define vp vector> \n#define setbits(x) __builtin_popcount(x)\n#define zerobits(x) __builtin_ctz(x)\n#define mod 1000000007\n#define inf 1e18\n#define w(x) \\\n int x; \\\n cin >> x; \\\n while (x--)\n#define bakchodi \\\n ios_base::sync_with_stdio(0); \\\n cin.tie(0); \\\n cout.tie(0)\n\n//prime sieve\nvector primes(100006, false);\nvoid sieve()\n{\n for (ll i = 3; i <= 100006; i += 2)\n {\n primes[i] = 1;\n }\n //Sieve\n for (ll i = 3; i <= 100006; i+=2)\n {\n if (primes[i] == 1)\n {\n for (ll j = i * i; j <= 100006; j += i)\n {\n primes[j] = 0;\n }\n }\n }\n primes[2] = 1;\n primes[0] = primes[1] = 0;\n\n}\n\nint recpow(int x, int n)\n{\n if (n == 0)\n return 1;\n else if (n % 2 == 0) //n is even\n return recpow((x * x), n / 2);\n else //n is odd\n return (x * recpow((x * x), (n - 1) / 2));\n}\n\nint main()\n{\n bakchodi;\n int a,b,c; \n cin>>a>>b>>c; \n int k = b*c; \n int r = a*c; \n int ans = ceilc(float(r-k)/b); \n cout<\nusing namespace std;\nint main ()\n{int n,v[100],i,j,p,nr,x,nr1;\ncin>>n;\nfor(i=1;i<=n;i++)\n{cin>>v[i];\nwhile(x!=v[i])\n{ x=x*p+j;\np=p*10;\nnr++;\nnr1++;\nif(nr==4)\n{j++;\nnr=0;}}\n cout<\n#include\n#include\n#define N 35\n#define f(i,a,b) for(register int i=(a);i<=(b);i=-(~i))\n#define rf(i,a,b) for(register int i=(a);i>=(b);i=~(-i))\nint dp[N][N][2],sum[N][2],n,m,mod=1e9+7,fac[N],ifac[N],lim[N],pow2[N],ans;\nint spow(int m,int n)\n{\n\tint b=1;\n\tfor(;n;n>>=1,m=1ll*m*m%mod)if(n&1)b=1ll*b*m%mod;\n\treturn b;\n}\nint C(int n,int m){return 1ll*fac[n]*ifac[m]%mod*ifac[n-m]%mod;}\nint ADD(int x,int y){return (x+=y)>=mod?x-mod:x;}\nvoid init()\n{\n\tfac[0]=ifac[0]=1,pow2[0]=1;\n\tf(i,1,32)fac[i]=1ll*fac[i-1]*i%mod,pow2[i]=2ll*pow2[i-1]%mod;\n\tifac[32]=spow(fac[32],mod-2);\n\trf(i,31,1)ifac[i]=1ll*ifac[i+1]*(i+1)%mod;\n\tf(i,1,32)\n\t f(j,0,i)\n\t sum[i][j&1]=ADD(sum[i][j&1],C(i,j));\n\twhile(n)lim[++m]=n&1,n>>=1;\n\tstd::reverse(lim+1,lim+m+1);\n}\nint main()\n{\n\tscanf(\"%d\",&n);\n\tinit();\n\tdp[0][0][1]=1;\n\tf(i,1,m)dp[i][0][0]=1;//\u5982\u679c\u8be5\u4f4d\u586b\u7b2c\u4e00\u4e2a\u5411\u91cf\uff0c\u90a3\u4e5f\u7b97\u4e00\u79cd\u65b9\u6848\n\tf(i,1,m)\n\t\tf(j,1,i)//create a new unlimited state stands iff this is 1 and we make it 0\n\t\t{\n\t\t\tdp[i][j][0]=ADD(1ll*dp[i-1][j][0]*pow2[j]%mod,dp[i-1][j-1][0]);//no limit, or fill and last unlimited\n\t\t\tif(lim[i])\n\t\t\t{\n\t\t\t\tdp[i][j][0]=ADD(dp[i][j][0],1ll*dp[i-1][j][1]*sum[j][0]%mod);//make it!\n\t\t\t\tdp[i][j][1]=ADD(dp[i-1][j-1][1],1ll*dp[i-1][j][1]*sum[j][1]%mod);//limited, fill/unfill a vector\n\t\t\t}\n\t\t\telse dp[i][j][1]=1ll*dp[i-1][j][1]*sum[j][0]%mod;//cannot fill a vector\n\t\t\t/*\n\t\t\t i j 0 <- (i-1 j 1 & make it 0) | (i-1 j 0 & forall) | (i-1 j-1 0)\n\t\t\t i j 1 <- (i-1 j 1 & make it fit the num) | (i-1 j-1 1)\n\t\t\t*/\n\t\t}\n\tf(i,0,m)ans=ADD(ans,ADD(dp[m][i][0],dp[m][i][1]));\n\treturn printf(\"%d\\n\",ADD(ans,mod)),0;", "lang": "GNU C++11", "bug_code_uid": "2ff1668785634b550111c3aca79df249", "src_uid": "ead64d8e3134fa8f29881cb487e52f60", "apr_id": "ef0c7d56b08ef92941ba58716a6249b3", "difficulty": 2700, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.25245258338783516, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "#include \n#include \n#define ll long long\n\nusing namespace std;\n\nmap times;\n\nvoid brute(int size, int currSize, string currString, string toCheck) {\n\n\tif (currSize == size) {\n\t\t//cout << currString << endl;\n\t\treturn;\n\t}\n\n\n\tif (currString != \"\") {\n\t\tint nPos = toCheck.find(currString, 0);\n\t\tint count = 0;\n\t\twhile (nPos != string::npos)\n\t\t{\n\t\t\tcount++;\n\t\t\tnPos = toCheck.find(currString, nPos + currString.size());\n\t\t}\n\n\t\ttimes[currString] = count;\n\t}\n\n\tbrute(size, currSize + 1, currString + \"4\", toCheck);\n\tbrute(size, currSize + 1, currString + \"7\", toCheck);\n}\n\nint main() {\n\n\tios_base::sync_with_stdio(false);\n\tcin.tie(NULL);\n\n\tstring s;\n\n\tcin >> s;\n\n\tbrute(s.size(), 0, \"\", s);\n\n\tint mostOccur = -1;\n\tstring mostOccurVal = \"\";\n\n\tfor (auto x : times) {\n\t\tif (x.second > mostOccur && x.second > 0) {\n\t\t\tmostOccur = x.second;\n\t\t\tmostOccurVal = x.first;\n\t\t}\n\t}\n\n\tif (mostOccur == -1) {\n\t\tcout << mostOccur << endl;\n\t}\n\telse {\n\t\tcout << mostOccurVal << endl;\n\t}\n\n\treturn 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "1e83c67225f133ffcffcaa281f18e908", "src_uid": "639b8b8d0dc42df46b139f0aeb3a7a0a", "apr_id": "83749d53ae40a611c2c0ea9ba4153904", "difficulty": 1000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.06018706791378609, "equal_cnt": 45, "replace_cnt": 34, "delete_cnt": 4, "insert_cnt": 7, "fix_ops_cnt": 45, "bug_source_code": "# include \n# include \n# include \nusing namespace std;\ntypedef long long ll;\nconst int maxn = 200005;\nint n;\nll val[maxn], ans[maxn], id[maxn], le1[maxn], le2[maxn], ri1[maxn], ri2[maxn];\nstruct no\n{\n\tll maxx;\n\tll minn;\n\tll sum;\n\tll flag;\n}node[maxn * 4];\n\nvoid pushup(int root)\n{\n\tnode[root].maxx = max(node[root << 1].maxx, node[(root << 1)| 1].maxx);\n\tnode[root].minn = min(node[root << 1].minn, node[(root << 1) | 1].minn);\n\tnode[root].sum = node[root << 1].sum + node[(root << 1) | 1].sum;\n}\n\nvoid pushdown(int root, int le, int ri)\n{\n\tint mid = (le + ri) >> 1;\n\tif (node[root].flag)\n\t{\n\t\tnode[root << 1].flag = node[root << 1].maxx = node[root << 1].minn = node[root].flag;\n\t\tnode[(root << 1) | 1].flag = node[(root << 1) | 1].maxx = node[(root << 1) | 1].minn = node[root].flag;\n\t\tnode[root << 1].sum = node[root << 1].flag*(mid - le + 1);\n\t\tnode[(root << 1) | 1].sum = node[(root << 1) | 1].flag*(ri - mid);\n\t\tnode[root].flag = 0;\n\t}\n}\n\nvoid build(int root, int le, int ri)\n{\n\tnode[root].flag = 0;\n\tif (le == ri)\n\t{\n\t\tnode[root].maxx = node[root].minn = node[root].sum = le;\n\t\treturn;\n\t}\n\tint mid = (le + ri) >> 1;\n\tbuild(root << 1, le, mid);\n\tbuild((root << 1) | 1, mid + 1, ri);\n\tpushup(root);\n}\n\nvoid update(int oper_le, int oper_ri, int val, int le, int ri, int root)\n{\n\tif (oper_le > oper_ri)\n\t\treturn;\n\tif (node[root].minn >= val)\n\t\treturn;\n\tif (oper_le <= le&&ri <= oper_ri&&node[root].maxx <= val)\n\t{\n\t\tnode[root].flag = node[root].maxx = node[root].minn = val;\n\t\tnode[root].sum = ll(ri - le + 1)*val;\n\t\treturn;\n\t}\n\tpushdown(root, le, ri);\n\tint mid = (le + ri) >> 1;\n\tif (oper_le <= mid)\n\t{\n\t\tupdate(oper_le, oper_ri, val, le, mid, root << 1);\n\t}\n\tif (oper_ri > mid)\n\t{\n\t\tupdate(oper_le, oper_ri, val, mid + 1, ri, (root << 1) | 1);\n\t}\n\tpushup(root);\n}\nvoid solve()\n{\n\tint i, j, k; cin>>n;\n\tmemset(id, 0, sizeof(id));\n\tfor ( int i = 1;i <= n;i++ )\n\t{\n\t\tcin>>val[i];\n\t\tid[val[i]] = i;\n\t}\n\tfor (i = 1; i <= 200000; i++)\n\t{\n\t\tfor (j = i; j <= 200000; j += i)\n\t\t{\n\t\t\tif (id[j])\n\t\t\t{\n\t\t\t\tif (le1[i] == 0 || id[j] < le1[i])\n\t\t\t\t{\n\t\t\t\t\tle2[i] = le1[i];\n\t\t\t\t\tle1[i] = id[j];\n\t\t\t\t}\n\t\t\t\telse if (le2[i] == 0 || id[j] < le2[i])\n\t\t\t\t{\n\t\t\t\t\tle2[i] = id[j];\n\t\t\t\t}\n\t\t\t\tif (ri1[i] == 0 || id[j] > ri1[i])\n\t\t\t\t{\n\t\t\t\t\tri2[i] = ri1[i];\n\t\t\t\t\tri1[i] = id[j];\n\t\t\t\t}\n\t\t\t\telse if (ri2[i] == 0 || id[j] > ri2[i])\n\t\t\t\t{\n\t\t\t\t\tri2[i] = id[j];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tbuild(1, 1, n);\n\tfor (i = 200000; i >= 1; i--)\n\t{\n\t\tif (le1[i] != ri1[i])\n\t\t{\n\t\t\tupdate(1, le1[i], ri2[i], 1, n, 1);\n\t\t\tupdate(le1[i] + 1, le2[i], ri1[i], 1, n, 1);\n\t\t\tupdate(le2[i] + 1, n, n + 1, 1, n, 1);\n\t\t}\n\t\tans[i] = 1LL*n*(n + 1) - node[1].sum;\n\t}\n\tll res = 0;\n\tfor (i = 200000 - 1; i >= 1; i--)\n\t{\n\t\tres = res + 1LL*(ans[i + 1] - ans[i])*i;\n\t}\n\tprintf(\"%I64d\", res);\n}\nint main(void)\n{\n\tsolve();\n\treturn 0;", "lang": "GNU C++11", "bug_code_uid": "b7eeeb1ff6afd4d7207c71d69e2efe94", "src_uid": "deb3938a6d3f13c4ab8a0765bf0e94b0", "apr_id": "9b1b19b03011842ffdb382d837a09298", "difficulty": 2800, "tags": ["data structures", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9714076246334311, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n\nusing namespace std;\nint x[4];\nint y[4];\nint main()\n{\n\twhile ( true )\n\t{\n\tint n;\n\tcin>>n;\n\tfor ( int i = 0 ; i < n ; i++ )\n\t{\n\t\tcin>>x[i]>>y[i];\n\t}\n\tint res = 0 ;\n\tfor ( int i = 0 ; i < n-1 ; i++ )\n\t{\n\t\tfor ( int j = i+1 ; j < n ; j++ )\n\t\t{\n\t\t\tint k = 0;\n\t\t\tif (x[i] > 0 && x[j] < 0 && y[i] > 0 && y[j] < 0 )\n\t\t\t\tk = (abs(x[i])+abs(x[j])) * (abs(y[i])+abs(y[j]));\n\t\t\telse if ( x[i] > 0 && x[j] < 0 && ((y[i] > 0 && y[j] > 0) || (y[i] < 0 && y[j] < 0 )))\n\t\t\t\tk = (abs(x[i])+abs(x[j])) * abs(y[i]-y[j]);\n\t\t\telse if ( y[i] > 0 && y[j] < 0 && ((x[i] > 0 && x[j] > 0) || (x[i] < 0 || x[j] <0 )))\n\t\t\t\tk = abs(x[i]-x[j]) * (abs(y[i])+abs(y[j]));\n\t\t\telse\n\t\t\t\tk = (x[i]-x[j]) * (y[i]-y[j]);\n\t\t\tres = max (res,k);\n\t\t\tif (x[j] > 0 && x[i] < 0 && y[j] > 0 && y[i] < 0 )\n\t\t\t\tk = (abs(x[j])+abs(x[i])) * (abs(y[j])+abs(y[i]));\n\t\t\telse if ( x[j] > 0 && x[i] < 0 && ((y[j] > 0 && y[i] > 0) || (y[j] < 0 && y[i] < 0 )))\n\t\t\t\tk = (abs(x[j])+abs(x[i])) * abs(y[j]-y[i]);\n\t\t\telse if ( y[j] > 0 && y[i] < 0 && ((x[j] > 0 && x[i] > 0) || (x[j] < 0 || x[i] <0 )))\n\t\t\t\tk = abs((x[j]-x[i])) * (abs(y[j])+abs(y[i]));\n\t\t\telse\n\t\t\t\tk = (x[j]-x[i]) * (y[j]-y[i]);\n\t\t\tres = max (res,k);\n\t\t}\n\t}\n\tif (res > 0 )\n\t\tcout<\n\nusing namespace std;\n\nint main(){\n String x;\n Cin>>x;\n if(x[0]=='a'||x[0]=='h')\n Cout<<3<\n#define rep(i,a,b) for(int i=(a);i<=(b);++i)\n#define per(i,a,b) for(int i=(a);i>=(b);--i)\nusing namespace std;\nchar c;\nint k;\nint main() {\n\tscanf(\"%c%d\",&c,&k);\n\tint ans=8;\n\tif(c-'0'==1||c-'0'==8) ans-=3;\n\tif(k==1||k==8) ans-=3;\n\tif((k==1||k==8)&&(c-'0'==1||c-'0'==8) ans++;\n\tprintf(\"%d\",ans);\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "fc36d3d705656c7e91f9f4136b22541c", "src_uid": "6994331ca6282669cbb7138eb7e55e01", "apr_id": "b41f42c33b917140c8e75638694a6f07", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.14411764705882352, "equal_cnt": 20, "replace_cnt": 11, "delete_cnt": 7, "insert_cnt": 3, "fix_ops_cnt": 21, "bug_source_code": "#include \n#include\nusing namespace std;\n\nint main()\n{\n int n,m,z,x,i,p;\n vectorv;\n cin>>n>>m;\n while(n\nusing namespace std;\nint main(){\n int n;\n cin>>n;\n vector v;\n int H[100]={0};\n for(int i=0;i>x;\n if(H[x]==0){\n v.push_back(x);\n H[x]++;\n }\n }\n sort(v.begin(),v.end());\n int mindiff=100;\n if(v.size()>=2)\n for(int i=0;iv[i+1]-v[i])\n mindiff=v[i+1]-v[i];\n }\n else \n mindiff = v[0];\n cout<\n\nint z[1000000];\nint main()\n{\n\tint a,b,c,d,x,y;\n\tscanf(\"%d%d%d%d\",&a,&b,&c,&d);\n\t\n\tif(a%2==0&&b%2==0) x=2;\n\tif(c%2==0&&d%2==0) y=2;\n\tif((a%2==1&&b%2==0)||(a%2==0&&b%2==1)) x=1;\n\tif((c%2==0&&d%2==1)||(c%2==1&&d%2==0)) y=1;\n\tif((x==2&&y==1)||(x==1&&y==2)) printf(\"-1\\n\");\n\n\tz[b]=1,z[d]=1;\n\tfor(;;)\n\t{\n\t\tif(z[b+a]==1) \n\t\t{\n\t\t\tx=b+a;\n\t\t\tbreak;\n\t\t}\n\t\telse z[b+a]=1,b+=a;\n\t\tif(z[d+c]==1) \n\t\t{\n\t\t\tx=d+c;\n\t\t\tbreak;\n\t\t}\n\t\telse z[d+c]=1,d+=c;\n\t\t//printf(\"%d %d\\n\",b+a,d+c);\n\t}\n\tprintf(\"%d\\n\",x);\n\n\treturn 0;\n}", "lang": "MS C++", "bug_code_uid": "254bf9c919f6b542f9c5edccd51f9866", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "apr_id": "25625884d56b1c231921977c888efb80", "difficulty": 1200, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9924343569203382, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "//its not how good you are...its how good you want to be\n#include \n#include\nusing namespace std;\n#define ll long long int\n#define inf 1000000000000\n#define mod 1000000007\n#define pb push_back\n#define mp make_pair\n#define all(v) v.begin(),v.end()\n#define S second\n#define F first\n#define boost1 ios::sync_with_stdio(false);\n#define boost2 cin.tie(0);\n#define mem(a,val) memset(a,val,sizeof a)\n#define ld long double\n\nll x[25],y[25],a[25],n,l,r;\nld dp[1<<20+5],limit;\nld pi=acos(-1.0l),eps=1e-61;\n\nld func(ld dist,ll id)\n{\n\tld ax=x[id]-(l+dist);\n\tld ay=y[id];\n\tld len=sqrt(ax*ax+ay*ay);\n\tld angle=acos(1.0*ax/len);\n\tld given=a[id]/180.0*pi;\n\tld third=pi-angle-given;\n\tif(third>n>>l>>r;\n\tlimit=r-l;\n\tfor(i=0;i>x[i]>>y[i]>>a[i];\n\tdp[0]=0.0;\n\tfor(mask=1;mask<(1<\n\nusing namespace std;\n\n#define pb push_back\n#define mp make_pair\n#define L first\n#define R second\n#define int ll\ntypedef long long ll;\n\nconst int maxn=1e6+10, inf=1e9+10;\n\nint grid[maxn][40], a, b, n, sett[maxn][40];\nint pow(int x, int n)\n{\n if(n==0) return 1;\n if(n==1) return x;\n int p=pow(x,n/2);\n if(n%2==1) return min(p*p*x,inf);\n else return min(p*p,inf);\n}\nint px[2]={0,-1};\nint py[2]={-1,0};\nqueue > q;\nbool mark[maxn][40];\n//1-> win 2-> lose 0->draw\n main()\n{\n ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);\n cin>>a>>b>>n;\n if(pow(a,b)>=n) return cout<<\"Stas\", 0;\n for(int i=1; i=n) grid[i][j]=1, mark[i][j]=1, q.push(mp(i,j));\n }\n if(n>=maxn)\n {\n\tmark[maxn-1][1]=1;q.push(mp(maxn-1,1));\n\tif((maxn-1)%2==n%2) grid[maxn-1][1]=1;\n\telse grid[maxn-1][1]=2;\n }\n while(q.size())\n {\n\tauto cur=q.front();q.pop();\n\tint i=cur.L, j=cur.R;\n\tif(grid[i][j]==2)\n\t{\n\t for(int k=0; k<2; k++)\n\t {\n\t\tint x=i+px[k], y=j+py[k];\n\t\tif(x && y && x\n\nusing namespace std;\nint main()\n{\n int n,k;\n cin>>n>>k;\n string s;\n cin>>s;\n int l=s.length();\n if(l==1){\n cout<<\"0\";\n }\n else{\n if(s[0]!='1'){\n s[0]='1';\n k--;\n }\n for(int i=0;i\n#include \n\nusing namespace std;\n\n\n\n//int main_Coins(){\nint main(){\n\n\tmap m;\n\tint n = 0;\n\tchar c[4];\n\tm['A']=0;\n\tm['B'] =0;\n\tm['C'] =0;\n\twhile(1==1)\n\t{\n\t\tfor(int i =0; i<3; i++)\n\t\t{\n\t\t\tscanf(\"%s\",&c);\n\t\t\tif(c[1] == '>'){\n\t\t\t\tm[c[0]]++;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tm[c[2]]++;\n\t\t\t}\n\t\t}\n\t\tif (m['A']==1 && m['B']==1 && m['C'] ==1) \n\t\t\tprintf(\"Impossible\");\n\t\telse\n\t\t{\n\t\t\tfor(int i=0; i<3; i++){\n\t\t\t\tfor(int j=0; j<3; j++){\n\t\t\t\t\tif(m['A'+j] == i) printf(\"%c\",'A'+j);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprintf(\"\\n\");\n\t\t}\n\n\n\t\t\n\t\t\n\t}\n\t\n\n\treturn 0;\n}", "lang": "MS C++", "bug_code_uid": "f7253ee9f245d645a1b598b829bef0c9", "src_uid": "97fd9123d0fb511da165b900afbde5dc", "apr_id": "26957468cad3fd256d15704c9d0929d1", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9524683428151954, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "#include \n\nusing namespace std;\n\ntypedef long long ll;\ntypedef long double ld;\ntypedef complex point;\n#define F first\n#define S second\n\ntemplate\nstruct min_cost_flow\n{\n\tstruct edge\n\t{\n\t\tint src, dst;\n\t\tT cap, flow;\n\t\tC cost;\n\t\tint rev;\n\t};\n\n\tint n;\n\tvector> adj;\n\n\tmin_cost_flow(int n) : n(n), adj(n) {}\n\n\tvoid add_edge(int src, int dst, T cap, C cost)\n\t{\n\t\tadj[src].push_back({ src, dst, cap, 0, cost, (int) adj[dst].size() });\n\t\tif (src == dst)\n\t\t\tadj[src].back().rev++;\n\t\tadj[dst].push_back({ dst, src, 0, 0, -cost, (int) adj[src].size() - 1 });\n\t}\n\n\tconst C oo = numeric_limits::max();\n\n\tvector dist, pot;\n\tvector prev;\n\n\tbool dijkstra(int s, int t)\n\t{\n\t\tdist.assign(n, oo);\n\t\tprev.assign(n, nullptr);\n\t\tdist[s] = 0;\n\n\t\tusing pci = pair;\n\t\tpriority_queue, greater> pq;\n\t\tpq.push({ 0, s });\n\n\t\twhile (!pq.empty())\n\t\t{\n\t\t\tC d; int u;\n\t\t\ttie(d, u) = pq.top();\n\t\t\tpq.pop();\n\n\t\t\tif (d != dist[u])\n\t\t\t\tcontinue;\n\n\t\t\tfor (auto &e : adj[u])\n\t\t\t\tif (e.flow < e.cap\n\t\t\t\t\t\t&& dist[e.dst] > dist[u] + e.cost + pot[u] - pot[e.dst])\n\t\t\t\t{\n\t\t\t\t\tdist[e.dst] = dist[u] + e.cost + pot[u] - pot[e.dst];\n\t\t\t\t\tprev[e.dst] = &e;\n\t\t\t\t\tpq.push({ dist[e.dst], e.dst });\n\t\t\t\t}\n\t\t}\n\n\t\treturn dist[t] < oo;\n\t}\n\n\tpair max_flow(int s, int t)\n\t{\n\t\tT flow = 0;\n\t\tC cost = 0;\n\n\t\tpot.assign(n, 0);\n\t\twhile (dijkstra(s, t))\n\t\t{\n\t\t\tfor (int u = 0; u < n; ++u)\n\t\t\t\tif (dist[u] < oo)\n\t\t\t\t\tpot[u] += dist[u];\n\n\t\t\tT delta = numeric_limits::max();\n\t\t\tfor (edge *e = prev[t]; e != nullptr; e = prev[e->src])\n\t\t\t\tdelta = min(delta, e->cap - e->flow);\n\n\t\t\tflow += delta;\n\t\t\tfor (edge *e = prev[t]; e != nullptr; e = prev[e->src])\n\t\t\t{\n\t\t\t\te->flow += delta;\n\t\t\t\tadj[e->dst][e->rev].flow -= delta;\n\t\t\t\tcost += delta * e->cost;\n\t\t\t}\n\t\t}\n\n\t\treturn {flow, cost};\n\t}\n};\n\n\nint main()\n{\n\t#ifdef DGC\n\t\t//freopen(\"a.txt\", \"r\", stdin);\n\t\t//freopen(\"b.txt\", \"w\", stdout);\n\t#endif\n\n\tios_base::sync_with_stdio(0), cin.tie(0);\n\n\tint n, m, k, c, d;\n\tcin >> n >> m >> k >> c >> d;\n\tvector mk(n+1);\n\tfor (int i = 0, x; i < k; ++i)\n\t\tcin >> x, ++mk[x];\n\n\tint sink = (k+1)*n*n+1;\n\tmin_cost_flow mcf(sink+1);\n\n\tfor (int i = 0, u, v; i < m; ++i)\n\t{\n\t\tcin >> u >> v;\n\t\tfor (int t = 0; t < k*n; ++t)\n\t\t\tfor (int j = 1; j <= 1+2*k; j += 2)\n\t\t\t{\n\t\t\t\tmcf.add_edge(t*n+u, (t+1)*n+v, 1, j*d+c);\n\t\t\t\tmcf.add_edge(t*n+v, (t+1)*n+u, 1, j*d+c);\n\t\t\t}\n\t}\n\n\tfor (int t = 0; t < k*n; ++t)\n\t\tfor (int j = 1; j <= n; ++j)\n\t\t\tmcf.add_edge(t*n+j, (t+1)*n+j, k, c);\n\n\tfor (int t = 0; t <= k*n; ++t)\n\t\tmcf.add_edge(t*n+1, sink, k, 0);\n\n\tfor (int i = 1; i <= n; ++i)\n\t\tif (mk[i] > 0)\n\t\t\tmcf.add_edge(0, i, mk[i], 0);\n\n\tcout << mcf.max_flow(0, sink).S << \"\\n\";\n\n\treturn 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "61dd87d7d3b29d8527b2166c07a55b75", "src_uid": "2d0aa75f2e63c4fb8c98742ac8cd821c", "apr_id": "bae2718d664e8ecb0d767b0e0c01e921", "difficulty": 2500, "tags": ["graphs", "flows"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.4487246225923998, "equal_cnt": 28, "replace_cnt": 17, "delete_cnt": 1, "insert_cnt": 10, "fix_ops_cnt": 28, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\ntypedef long long ll;\nconst int N = 1005;\nconst int mod = 1e9 + 7;\nint bin_pow(int a, int n){\n int res = 1;\n while(n){\n if(n & 1) res = (res * 1ll * a) % mod;\n n >>= 1;\n a = (a * 1ll * a) % mod;\n }\n return res;\n}\nint inv(int a){\n return bin_pow(a, mod - 2);\n}\nvoid add(int & a, int & b, int & c, int & d){\n int cur1 = (a * 1ll * d + b * 1ll * c) % mod;\n int cur2 = (b * 1ll * d) % mod;\n a = cur1;\n b = cur2;\n}\nqueue, pair > > q;\nint main(){\n int k, pa, pb;\n cin >> k >> pa >> pb;\n q.push({ {1, 0}, {1, 1} });\n int ans_a = k;\n int ans_b = 1;\n while(!q.empty()){\n auto tmp = q.front();\n q.pop();\n int cnt_a = tmp.first.first;\n int cnt_seq = tmp.first.second;\n int a = tmp.second.first;\n int b = tmp.second.second;\n if(cnt_a + cnt_seq >= k){\n int cur = cnt_a + cnt_seq - k;\n int aa = (pb * 1ll * cur + pa) % mod;\n int bb = pb;\n a = (a * 1ll * aa) % mod;\n b = (b * 1ll * bb) % mod;\n add(ans_a, ans_b, a, b);\n }\n else{\n q.push({{cnt_a + 1, cnt_seq}, {(a * 1ll * pa % mod), (b * 1ll * (pa + pb) % mod)}});\n q.push({{cnt_a, cnt_seq + cnt_a}, {(a * 1ll * pb % mod), (b * 1ll * (pa + pb) % mod)}});\n }\n }\n int ans = (ans_a * 1ll * inv(ans_b)) % mod;\n cout << ans << endl;\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "fe727bfcdb617449175db95484f2fa06", "src_uid": "0dc9f5d75143a2bc744480de859188b4", "apr_id": "4b04efc5e4dda9a7463c53d7c2a9dffb", "difficulty": 2200, "tags": ["dp", "math", "probabilities"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.13229571984435798, "equal_cnt": 10, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 9, "bug_source_code": "#include \nusing namespace std;\ntypedef long long ll;\ntypedef pair < ll,ll > pll;\n#define MAX 20000007\n#define INF INT_MAX\nll n,x,y;\nint d[MAX];\n\nll sp(){\n\t// priority_queue< pll,vector < pll >, greater < pll > > pq;\n\tset< pll > s;\n\ts.insert(pll(0,0));\n\twhile(!s.empty()){\n\t\tpll t=*s.begin();\n\t\ts.erase(s.begin());\n\t\tif(t.second == n)return t.first;\n\t\tif(t.second >= 2 && d[t.second-1] > t.first+x) {\n\t\t\tif(s.find(pll(d[t.second-1],t.second-1))!=s.end())s.erase(s.find(pll(d[t.second-1],t.second-1)));\n\t\t\t// pq.push(pll(t.first+x,t.second-1));\n\t\t\td[t.second-1]=t.first+x;\n\t\t\ts.insert(pll(d[t.second-1],t.second-1));\n\t\t}\n\t\tif(t.second < n && d[t.second+1] > t.first+x){\n\t\t\tif(s.find(pll(d[t.second+1],t.second+1))!=s.end())s.erase(s.find(pll(d[t.second+1],t.second+1)));\t\t\t\n\t\t\t// pq.push(pll(t.first+x,t.second+1));\n\t\t\td[t.second+1]=t.first+x;\n\t\t\ts.insert(pll(d[t.second+1],t.second+1));\n\t\t}\n\t\tif(t.second < n && d[t.second << 1] > t.first+y){\n\t\t\tif(s.find(pll(d[t.second << 1],t.second << 1))!=s.end())s.erase(s.find(pll(d[t.second << 1],t.second << 1)));\t\t\t\n\t\t\t// pq.push(pll(t.first+y,t.second << 1));\n\t\t\td[t.second << 1]=t.first+y;\n\t\t\ts.insert(pll(d[t.second << 1],t.second << 1));\t\t\t\n\t\t}\n\t}\n}\n\nint main(){\n\tscanf(\"%lld %lld %lld\",&n,&x,&y);\n\tfill(d,d+MAX,INF);\n\tprintf(\"%lld\\n\",sp());\n}", "lang": "GNU C++14", "bug_code_uid": "9c289cb2e249d46c7dd8908c3d943a0e", "src_uid": "0f270af00be2a523515d5e7bd66800f6", "apr_id": "10d9e4dd183061b1e47d3a1c1b871b20", "difficulty": 2000, "tags": ["dp", "dfs and similar"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9291338582677166, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "#include \nusing namespace std ; \nint main() { \n int m ; \n int n ; \n int area ;\n cin >>m >>n>>area ; \n int s = m*n ; \n int number = s/area ; \n cout <\n#include\n#include\nconst int mod = 1000000007;\nvoid solve(int n){\n long long int a[100000000], d[100000000];\n int i;\n a[1]=1;\n d[1] = 0;\n\n for (i=2;i\nusing namespace std;\n \nint main(){\n int n,k,i,count,cutoff;\n cin >> n>>k;\n string s;\n int nums[n];\n \n i = 0 ;\n while(i> nums[i];\n i++;\n }\n i = 0;\n count = 0;\n cutoff = nums[k-1];\n if(cutoff == 0){\n cout<<0;\n } \n else{\n while(i < n){\n if(nums[i] >= cutoff){\n count++;\n }\n else{\n break;\n }\n \n }\n cout<\nusing namespace std;\n\n\ntypedef long long ll;\nconst int MAXN = 2e5 + 5;\nconst long long MOD = 1e9 + 7;\n\npair p;\n\nint main()\n{\n\t//freopen(\"input.in\",\"r\",stdin);\n //freopen(\"output.out\",\"w\",stdout);\n\t\n\tint n,k; cin >> n >> k;\n\tstring s; cin >> s;\n\tint c1 = 0; int c2 = 0;\n\tfor(int i = 0; i < n;)\n\t{\n\t\tif(s[i] == 'N')\n\t\t{\n\t\t\tint j = i;\n\t\t\twhile(j < n && s[j] == 'N')\n\t\t\t\tj++;\n\t\t\tc1 = max(c1,j - i);\n\t\t\ti = j;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ti++;\n\t\t}\n\t}\n\tfor(int i = 0; i < n;)\n\t{\n\t\tif(s[i] == 'N' || s[i] == '?')\n\t\t{\n\t\t\tint j = i;\n\t\t\twhile(j < n && (s[j] == 'N' || s[j] == '?'))\n\t\t\t\tj++;\n\t\t\tc2 = max(c2,j - i);\n\t\t\ti = j;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ti++;\n\t\t}\n\t}\n\tif(c1 > k || c2 < k){\n\t\tcout << \"NO\";\n\t\treturn 0;\n\t}\n\t\n\tfor(int i = 0; i < n; ++i)\n\t{\n\t\tfor(int j = i; j < n; ++j)\n\t\t{\n\t\t\tif(j - i + 1 != k) continue;\n\t\t\telse if()\n\t\t\t{\n\t\t\t\tint c = 0;\n\t\t\t\tfor(int l = i; l <= j; ++l)\n\t\t\t\t{\n\t\t\t\t\tif(s[l] == '?' || s[l] == 'N')\n\t\t\t\t\t\tc++;\n\t\t\t\t}\n\t\t\t\tif(c == k){\n\t\t\t\t\tint fl = 1;\n\t\t\t\t\tif(i - 1 >= 0 && s[i - 1] == 'N') fl = 0;\n\t\t\t\t\tif(j + 1 < n && s[j + 1] == 'N') fl = 0;\n\t\t\t\t\tif(fl)\n\t\t\t\t\t{\n\t\t\t\t\t\tcout << \"YES\\n\";\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tcout << \"NO\";\n\t\n\treturn 0;\n\n}\n\n", "lang": "GNU C++", "bug_code_uid": "805f8da90cd4b3e31c44ee3afe66a7b8", "src_uid": "5bd578d3da5837c259b222336a194d12", "apr_id": "cbf8afc91e063789b9e275cc65e8a8ba", "difficulty": 2000, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9956225680933852, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "#include \nusing namespace std;\nlong long n,m,a,b,i,s[505][505],vis[505],c[505],j,d,e;\nstring t;\nvector < long long > v[300000];\nvector < pair < long long,long long > > v1;\nvoid dfs(long long x)\n{\n vis[x]=1;\n for(long long i=0;i> n >> m;\n for(i=1;i<=m;i++)\n {\n cin >> a >> b;\n v1.push_back(make_pair(a,b));\n v1.push_back(make_pair(b,a));\n s[a][b]=1;\n s[b][a]=1;\n }\n for(i=1;i<=n;i++)\n {\n for(j=i+1;j<=n;j++)\n {\n if(!s[i][j])\n {\n v[i].push_back(j);\n v[j].push_back(i);\n }\n }\n }\n for(i=1;i<=n;i++)\n {\n if(!vis[i] && v[i].size()>0)\n {\n c[i]=1;\n dfs(i);\n }\n }\n for(i=1;i<=n;i++)\n {\n if(c[i]!=0)\n {\n if(c[i]==1)\n {\n t[i]='a';\n }\n else\n {\n t[i]='c';\n }\n }\n else\n {\n t[i]='b';\n }\n }\n for(i=0;i\n#include \n#include \nusing namespace std;\nint main ()\n{\nint n,d,m,money=0;\ncin>>n>>d;\nint *a=new int [n];\nfor (int i=0;i>a[i];\ncin>>m;\nsort(a,a+n);\nfor (int i=0;i\n#include \n#include \nusing namespace std;\nint main ()\n{\nint n,d,m,money=0;\ncin>>n>>d;\nint *a=new int [n];\nfor (int i=0;i>a[i];\ncin>>m;\nsort(a,a+n);\nfor (int i=0;in)\n{money-=abs((m-(n))*d);cout<n)\nmoney-=abs((m-(n))*d);\nelse cout<\n#include\n\nusing modular=Modular<1000000007>;\n\nint main(){\n\tstd::ios::sync_with_stdio(0);std::cin.tie(0);\n\tint number; std::cin>>number;\n\t//std::vector> probability(number, std::vector(number));\n\tstd::vector probability(number*number);\n\t//for(auto& row: probability)\n\tfor(auto& value: probability){\n\t\tint percentage; std::cin>>percentage;\n\t\tvalue=modular(1)/100*percentage;\n\t}\n\n\tstd::vector total;\n\n\tint const middle=number/2;\n\tauto const maskValue=[&]{\n\t\tstd::array maskValue;\n\t\tassert(number<=6);\n\t\tint count=0;\n\t\tfor(int matchMask=0; matchMask<(int)maskValue.size(); ++matchMask){\n\t\t\tmaskValue[matchMask]=__builtin_popcount(matchMask)==middle ? count++: -1;\n\t\t}\n\t\ttotal.resize(1<>=1){\n\t\t\t\ttotalProbability*=tmp&1 ? probability[i]: 1-probability[i];\n\t\t\t\tif(totalProbability==0) goto continue_outer_2;\n\t\t\t}\n\n\t\t\t{ // compute matchSets and call handle\n\t\t\t\t// even more inefficient...?\n\t\t\t\tstd::array data{};\n\t\t\t\tassert(len<=(int)data.size());\n\t\t\t\tint matchSets{};\n\t\t\t\twhile(true){\n\t\t\t\t\t// process data\n\t\t\t\t\tint matchMask{};\n\t\t\t\t\tfor(int index=0; index>(index*number+data[index])&1)) goto continue_outer;\n\t\t\t\t\t\tif(matchMask&1<\n\n#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)\n#define all(c) (c).begin(), (c).end()\n\n#define ll long long\n#define vt vector\n#define pb push_back\n#define FOR(x) for(int i=0;i> a >> b >> c;\n cin >> d >> e >> f;\n cin >> g >> h >> i;\n a = 1;\n int k = 1;\n while(k <= 17) {\n a=k;\n e=k;\n i=k;\n if(a+e+i==a+b+c&&a+e+i==g+h+i&&a+e+i==b+e+h) {\n cout << a << \" \" << b << \" \" << c << \"\\n\";\n cout << d << \" \" << e << \" \" << f << \"\\n\";\n cout << g << \" \" << h << \" \" << i << \"\\n\";\n return 0;\n }\n k++;\n }\n while(true) {\n if(a+e+i==a+b+c&&a+e+i==g+h+i&&a+e+i==b+e+h) {\n break;\n }\n a++;\n if(a+e+i==a+b+c&&a+e+i==g+h+i&&a+e+i==b+e+h) {\n break;\n }\n e++;\n if(a+e+i==a+b+c&&a+e+i==g+h+i&&a+e+i==b+e+h) {\n break;\n }\n i++;\n }\n cout << a << \" \" << b << \" \" << c << \"\\n\";\n cout << d << \" \" << e << \" \" << f << \"\\n\";\n cout << g << \" \" << h << \" \" << i << \"\\n\";\n}", "lang": "GNU C++17", "bug_code_uid": "262f3d466ffea221433451774bf2b7e7", "src_uid": "0c42eafb73d1e30f168958a06a0f9bca", "apr_id": "dc9e3176e8d1b84d2e51a730bf7030fa", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9027946537059538, "equal_cnt": 8, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 7, "bug_source_code": "#include \n#include \n#include \ntypedef long long int ll;\nusing namespace std;\nchar temp[3000000];\nint n;\nvector st;\nll cal(ll len){\n\tll sum = 1;\n\tfor (ll i = 0; i < len; i++){\n\t\tsum *= 10;\n\t}\n\treturn sum;\n}\nbool ispos(ll a){\n\tfor (int i = 0; i < st.size(); i++){\n\t\tif (st[i] == a)\n\t\t\treturn false;\n\t}\n\tst.push_back(a);\n\treturn true;\n}\nint main(){\n\tcin >> n;\n\tchar *ptr;\n\tfor (int i = 0; i < n; i++){\n\t\tcin >> temp;\n\t\tptr = strtok(temp, \"'\");\n\t\tptr = strtok(NULL, \"'\");\n\n\t\tll len = strlen(ptr);\n\t\tll sum = cal(len);\n\t\tll a = _atoi64(ptr);\n\n\t\tfor (int k = 1; k <= a; k++){\n\t\t\ta = k;\n\t\t\twhile (1)\n\t\t\t{\n\n\t\t\t\ta += sum;\n\t\t\t\tif (a >= 1989 && ispos(a))\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tcout << a << endl;\n\t}\n\n\treturn 0;\n\t//ptr = strtok(str, \",\");\n}\n\n\n", "lang": "MS C++", "bug_code_uid": "e23e240d6e067ff30e2790207a0a3080", "src_uid": "31be4d38a8b5ea8738a65bfee24a5a21", "apr_id": "f4ed008bf789f64689e47e350b1572aa", "difficulty": 2000, "tags": ["greedy", "math", "constructive algorithms", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9905123339658444, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#include \n#include\n#include\n#include\n#define ll long long\n\nusing namespace std;\nll ing[3],quan[3],price[3],total_amount;\n\nbool chk(ll n)\n{\n ll total_cost = 0;\n // cout<<\"n: \"<= quan[i])\n total_cost+=max((ll)0, (ing[i]*n - quan[i])*price[i] );\n }\n //cout<>str;\n cin>>quan[0]>>quan[1]>>quan[2];\n memset(ing,0,sizeof(ing));\n for(int i=0; i>price[0]>>price[1]>>price[2];\n cin>>total_amount;\n ll mid;\n u = total_amount;\n if( chk(l)&&!chk(l+1)) { cout<>x;\n if(chk(mid)&&!chk(mid+1)) {cout<\n#include \n#include \nusing namespace std;\nbool verif(string x,string x1)\n{\n int j=0;\n while (j+1>mdp;\n int a,j=0;\n cin>>a;\n vector tab;\n tab.resize(a);\n for (int i=0;i> tab[i];\n\n }\n if (a==1)\n {\n for (int i=0;i\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nint main(void){\n\n \n int n;\n cin>>n;\n \n queue q;\n \n q.push('S');\n q.push('L');\n q.push('P');\n q.push('R');\n q.push('H');\n \n int i;\n char x;\n for(i=0;i\nusing namespace std;\nint main ()\n{\n\tint a,b,num=0,num1=0;\n\tcin>>a>>b;\n\tnum=a/b;\n if(false)\n {\n\t num=num+a;\n\n\t cout<\n#include \n\nusing namespace std;\n\nint main()\n{\n int num;\n string c;\n cin >> num;\n cin >> c;\n int g,m,i,k,l[50]={ };\n i=0;\n k=0;\n m=c.length();\n while(i0) cout << l[0];\n i=1;\n while(i\nusing namespace std;\ntypedef long long ll;\ntypedef unsigned long long ull;\nconst double pi=3.14159265359;\nint main()\n{\n ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);\n ll n,m,i,j,l,k=2,p=0,t=1,x,y,z,r,c;\n ll a[100005]={0};\n string s;\n cin>>s;\n for(i=0;i=97;i--)\n {\n if(a[i]==0)\n {\n cout<<\"NO\";\n return 0;\n }\n }\n }\n cout<<\"YES\";\n return 0;\n}\n\n\n\n\n", "lang": "GNU C++14", "bug_code_uid": "17c0bb307cf4929119f226db0319936e", "src_uid": "c4551f66a781b174f95865fa254ca972", "apr_id": "001147aabcb5416416f57e7a270e1c7d", "difficulty": 1100, "tags": ["greedy", "strings", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9690566037735849, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "//Pham Huu Canh\n//C. Kicker\n\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n\n#define max64 9223372036854775807\n#define max32 2147483647\n#define max16 32767\n#define EPS 1e-8\n#define LL long long\n#define ULL unsigned long long\n#define PB push_back\n#define MP make_pair\n#define PQ priority_queue\n#define timmax(x, y) ((x) > (y) ? (x) : (y))\n#define timmin(x, y) ((x) < (y) ? (x) : (y))\n\n#define fi \"C.inp\"\n#define fo \"C.out\"\n\nusing namespace std;\n\nint a[5], b[5];\n\nint ktra(int x, int y)\n{\n int thu = a[x];\n int cong = b[y];\n \n if (thu < b[2] && cong < a[3]) return -1;\n if (thu < b[3] && cong < a[2]) return -1;\n if ((thu > b[2] && cong > a[3]) && (thu > b[3] && cong > a[2])) return 1;\n return 0;\n}\n\nvoid input()\n{\n int i, kq1, kq2;\n \n for (i = 0; i < 4; i++)\n scanf(\"%d %d\", &a[i], &b[i]); //def, attack\n \n kq1 = ktra(0, 1);\n kq2 = ktra(1, 0);\n if (kq1 == 1 || kq2 == 1)\n printf(\"Team 1\\n\");\n else if (kq1 == 0 && kq2 == 0)\n printf(\"Draw\\n\");\n else\n printf(\"Team 2\\n\");\n}\n\nint main()\n{\n //freopen(fi,\"r\",stdin);\n //freopen(fo,\"w\",stdout);\n \n input();\n \n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "72daa272a4bcbdee6864459fc68c6164", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "apr_id": "b2ef6b00d39ec6f8b4a34a2126f86e65", "difficulty": 1700, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8542844715093519, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 6, "bug_source_code": "#include\nusing namespace std;\nusing namespace __gnu_pbds;\n\n#define F first\n#define S second\n#define pb push_back\n#define lb lower_bound\n#define ub upper_bound\n#define pii pair\n#define all(x) x.begin(),x.end()\n#define fix fixed<=int(a);i--)\n#define FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)\n\ntypedef double db;\ntypedef long long ll;\n\nconst int N=5e5+5;\nconst int mod=998244353;\n\nll n,k,f[N],inv[N];\nvoid pre(){\n f[0]=1;\n rep(i,1,5e5) f[i]=f[i-1]*i%mod;\n inv[int(5e5)]=235551727;\n repb(i,5e5-1,0) inv[i]=(i+1)*inv[i+1]%mod;\n}\nsigned main(){\n FastIO;\n pre();\n cin>>n>>k;\n ll ans=0;\n rep(i,1,n) if(n/i>=k){\n ans=(ans+f[n/i-1]*inv[k-1]%mod*inv[n/i-k])%mod;\n }\n cout<\n#include \n\nusing namespace std;\n\nint main()\n{\n int a,x,y;\n cin>>a;\n while(1)\n {\n cin>>x>>y;\n if(abs(x)>a || y<0 || y>(5*a) || (abs(x)%a==0 && x!=0) || y%a==0)\n cout<<-1<\n\n#ifdef LOCAL_TEST\n #pragma comment(linker, \"/stack:16777216\")\n#endif\n\nusing namespace std;\n\ntypedef long long int ll;\ntypedef vector vll;\ntypedef pair pp;\ntypedef vector vpp;\ntypedef vector vi;\ntypedef stack si;\ntypedef stack sll;\ntypedef stack < pair > sii;\ntypedef queue < pair > qii;\n\n#define sz(a) (ll) ((a).size())\n#define pb push_back\n#define mp(a, b) (make_pair(a, b) )\n#define all(c) (c).begin(),(c).end()\n#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)\n#define present(c,x) ((c).find(x) != (c).end())\n#define cpresent(c,x) (find(all(c),x) != (c).end())\n#define sortA(v) (sort(v.begin(), v.end()))\n#define sortD(v) (sort(v.rbegin(), v.rend()))\n#define fill(a) (memset(a, 0, sizeof (a)))\n#define fillA(a) (memset(a, -1, sizeof (a)))\n#define end '\\n'\n#define PI 3.14159265\n\nconst int MAX = 100009;\nconst ll MOD = 1e9 + 7;\n#define _ % MOD\n#define __ %= MOD\n\n// Functions\nll gcd(ll a, ll b){\n if (a == 0)\n return b;\n return gcd(b%a, a);\n}\nll lcm(ll a, ll b){\n return a * b / gcd(a, b);\n}\nll abs(ll a, ll b){\n if( a > b)\n return a-b;\n\n return b-a;\n}\ndouble abs(double a, double b){\n if( a > b)\n return a-b;\n\n return b-a;\n}\n\n\nint main()\n{\n ios_base::sync_with_stdio(false); cin.tie(NULL);\n #ifdef LOCAL_TEST\n\t\t ifstream cin(\"in.txt\"); ofstream cout(\"out.txt\");\n #endif\n\n ll r,g; cin>>r>>g;\n r=r+g;\n g=r-g;\n r=r-g;\n\n ll n, d[200010] = {0};\n for (n = 0; n < 600; n++) {\n if(n*(n+1) > 2*(r+g))\n {\n break;\n }\n } n--;\n\n d[0] = 1;\n for (ll i = 1; i <= n; i++) {\n ll sum=(i*(i+1))/2;\n\n for (ll j = r; j >= 0; j--) {\n if(sum > j+g)\n {\n d[j] = 0;\n }\n else if( j - i >= 0)\n {\n d[j] += d[j-i];\n d[j] __;\n }\n }\n }\n\n ll ans = 0;\n\n for (ll i = 0; i <= r; i++) {\n ans += d[i];\n ans __;\n }\n\n cout<\n\n#define F first\n#define S second\n#define PB push_back\n#define sz(s) int((s).size())\n#define bit(n,k) (((n)>>(k))&1)\n\nusing namespace std;\n\ntypedef long long ll;\ntypedef pair pii;\ntypedef pair pll;\n\nconst int maxn=1e5+10,mod=1e9+7;\nconst ll inf=1e18;\n\nint n;\nsetst;\n\nint lca(int a,int b){\n if(__builtin_clz(a)>__builtin_clz(b)) swap(a,b);\n while(__builtin_clz(a)<__builtin_clz(b)) a>>=1;\n while(a!=b) a>>=1,b>>=1;\n return a;\n}\ninline bool papa(int a,int b){// a!=b\n if(b<=a) return 0;\n int dif=__builtin_clz(a)-__builtin_clz(b);\n return a==(b>>dif);\n}\nint Size(int a){\n int x=1,ans=0;\n while(a<=n){\n\tans+=min(x,n-a+1);\n\tx<<=1,a<<=1;\n }\n return ans;\n}\nint Size(int a,sets){\n int ans=Size(a);\n vectorvv;\n for(int x:s){\n\tif(x0;A>>=1){\n\tsetst2=st;\n\tfor(int B=b;B>0;B>>=1){\n\t ans=(1ll*ans+1ll*Size(A,st2)*Size(B,st2))%mod;\n\t if(st2.count(B>>1)) break;\n\t st2.insert(B>>1);\n\t}\n\tif(st.count(A>>1)) break;\n\tst.insert(A>>1);\n }\n return ans;\n}\n\nint main(){\n ios_base::sync_with_stdio(false);cin.tie(0);\n int m;cin>>n>>m;\n vectorvv(m),vv2;\n for(int i=0;i>vv[i].F>>vv[i].S;\n }\n ll ans=(1ll*n*n)%mod;\n for(int msk=1;msk<(1<perm(sz(vv2));\n\tfor(int i=0;ivv3(sz(vv2));\n\t for(int i=0;i>=1;\n\t\t }\n\t\t while(B!=C){\n\t\t\tif(st.count(B)) goto Hell;\n\t\t\tst.insert(B);\n\t\t\tB>>=1;\n\t\t }\n\t\t if(st.count(C)) goto Hell;\n\t\t st.insert(C);\n\t\t \n\t\t lst=p.S;\n\t\t}\n\t\tif(st.count(lst))\n\t\t goto Hell;\n\t\tst.insert(lst);\t\n\t\tans=(ans+solve(frst,lst))%mod;\n\t Hell:;\n\t }\n\t //\t cout<<\"SAMEEEEEEEEEEEEE \"<\n#include \nusing namespace std;\n\nint main() {\n int n;\n do {\n cin>>n;\n } while(n<1 || n>90);\n int Max=0; int bien;\n vector a;\n do {\n cin>>bien;\n } while(bien<1 || bien>90);\n a.push_back(bien);\n if(a[0]>15) Max=15;\n for(int i=1; i>bien;\n } while(bien<1 || bien>90 || bien>a[i-1]);\n a.push_back(bien);\n if(a[i]-a[i-1]>15) {\n Max=a[i-1]+15;\n }\n }\n if(Max) cout<=90) {\n cout<<90;\n }\n else {\n cout<\nusing namespace std;\nint row , colomn ;\nint maximum_row , maximum_col;\nchar board[10][10];\nint main()\n{\n bool res_row[10] , res_col[10];\n while(1){\n cin >> row >> colomn ;\n for (int i =0 ; i < row ; i ++ )\n {\n for(int j = 0 ; j < colomn ; j ++)\n {\n cin >> board[i][j];\n if(board[i][j] == 'S'){res_row[i] = true;\n res_col[j] = true;}\n }\n }\n for (int i =0 ; i < row ; i ++ )\n {\n if(res_row[i] == false)\n {\n maximum_row ++;\n }\n }\n for (int i =0 ; i < colomn ; i ++ )\n {\n if(res_col[i] == false)\n {\n maximum_col ++;\n }\n }\n\ncout << (maximum_row * colomn + maximum_col * row) - maximum_col*maximum_row<< endl;\n}\n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "0829c1db5adc17f27260eaad5f0139df", "src_uid": "ebaf7d89c623d006a6f1ffd025892102", "apr_id": "ed7446ceb9c1662665db571e92d43cd7", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9996288047512992, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n\nusing namespace std;\n\n//#include \"bigint.h\"\n\n#define all(x) (x).begin(), (x).end()\n#define sz(x) ((int)(x).size())\n#define init(st) memset(st, 0, sizeof(st))\n#define ll long long\n\n// String operations\ntemplate\nvoid splitstr(const string &s, vector &out) {\n istringstream in(s);\n out.clear();\n copy(istream_iterator(in), istream_iterator(), back_inserter(out));\n}\n\ntemplate\nvoid initArray(T *arr, int size, T value) {\n for(int i = 0; i < size; i++) {\n\t\tarr[i] = value;\n }\n}\n\ntemplate\nT readValue(string s) {\n\tT result;\n\tistringstream sin(s);\n\tsin >> result;\n\treturn result;\n}\n\n// Arithmetic operations\ntemplate\ninline T gcd(T a, T b) {\n\treturn (!a) ? b : gcd(b % a, a);\n}\n\ntemplate\ninline T mod(T a, T p) {\n\ta %= p;\n\treturn (a < 0) ? a + p : a;\n}\n\ntemplate\ninline int numbits(T n) {\n\treturn (!n) ? 0 : 1 + numbits(n & (n - 1));\n}\n\ntemplate\ninline T inverse(T a, T m) {\n\ta = mod(a,m);\n\treturn (a==1) ? 1 : mod((1-m*inverse(m%a,a))/a,m);\n}\n\ntemplate\ninline bool isPrime(T a) {\n\tT lim = (T)sqrt((double)a);\n\tfor (T i = 2; i < lim; i++)\n\t\tif(a % i == 0)\n\t\t\treturn false;\n\treturn true;\n}\n\ntemplate\ninline T power(T a, T p, T mod) {\n\tif(!p) return 1;\n\tT temp = power(a, p>>1, mod);\n\ttemp = (temp * temp) % mod;\n\tif (p&1)\n\t\ttemp = (temp * a) % mod;\n\treturn temp;\n}\n\nvoid get_primes(int start, int end, vector &vi) {\n\tint *p = new int[end + 1];\n\tinitArray(p, end+1, 0); p[1] = 1;\n\n\tfor (int i = 2; i <= end; i++) {\n\t\tif (!p[i]) {\n\t\t\tif (i >= start)\n\t\t\t\tvi.push_back(i);\n\n\t\t\tfor (int j = 2*i; j <= end; j += i)\n\t\t\t\tp[j] = 1;\n\t\t}\n\t}\n}\n\n// Graph operations\nbool dfs(int current, int final, int total, int* visited, int **edges, bool flow) {\n\tif (current == final)\n\t\treturn true;\n\tif (visited[current])\n\t\treturn false;\n\tvisited[current] = true;\n\tfor (int i = 0; i < total; i++)\n\t\tif (edges[current][i] && dfs(i, final, total, visited, edges, flow)) {\n\t\t\tif (flow) {\n\t\t\t\tedges[current][i]--;\n\t\t\t\tedges[i][current]++;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\treturn false;\n}\n\nint flow(int in, int out, int total, int **edges) {\n\tint result = 0;\n\tint *visited = new int[total];\n\twhile (initArray(visited, total, 0), dfs(in, out, total, visited, edges, true))\n\t\tresult++;\n\treturn result;\n}\n\n// Disjoint datasets\nvoid create_set(int x, int *P, int *rank) {\n\tP[x] = x;\n\trank[x] = 0;\n}\n\nint find_set(int x, int *P) {\n\tif (x != P[x])\n\t\tP[x] = find_set(P[x], P);\n\treturn P[x];\n}\n\nbool merge_sets(int x, int y, int *P, int *rank) {\n\tint Px = find_set(x, P);\n\tint Py = find_set(y, P);\n\tif(Px == Py)\n\t\treturn false;\n\tif (rank[Px] > rank[Py]) P[Py] = Px;\n\telse P[Px] = Py;\n\tif (rank[Px] == rank[Py])\n\t\trank[Py]++;\n\treturn true;\n}\n\n// Binary tree operations\nint read_cum_freq(int index, int *tree) {\n\tint sum = 0;\n\twhile (index) {\n\t\tsum += tree[index];\n\t\tindex -= (index & -index);\n\t}\n\treturn sum;\n}\n\nvoid upd_freq(int index, int mxIndex, int value, int *tree) {\n\twhile (index <= mxIndex) {\n\t\ttree[index] += value;\n\t\tindex += (index & -index);\n\t}\n}\n\nint read_freq(int index, int *tree) {\n\treturn read_cum_freq(index, tree) - read_cum_freq(index-1, tree);\n}\n\n// String algos.\nvoid build_failure_function(const string &str, int *temp_arr) {\n temp_arr[0] = temp_arr[1] = 0;\n for (int i = 2; i <= static_cast(str.size()); i++) {\n temp_arr[i] = -1;\n for (int ind = temp_arr[i-1]; temp_arr[i] == -1; ind = temp_arr[ind]) {\n if (str[ind] == str[i-1]) {\n temp_arr[i] = ind + 1;\n } else if (ind == 0) {\n temp_arr[i] = 0;\n }\n }\n }\n}\n\nvoid KMP(const string &s1, const string &s2, int *res) {\n int *temp_arr = new int[s2.size() + 1];\n build_failure_function(s2, temp_arr);\n\n int i = 0;\n int ind = 0;\n while (i < static_cast(s1.size())) {\n if (s1[i] == s2[ind]) {\n res[i] = ++ind;\n if (res[i] == s2.size()) {\n ind = temp_arr[ind - 1];\n }\n i++;\n } else if (ind == 0) {\n res[i++] = 0;\n } else {\n ind = temp_arr[ind];\n }\n }\n\n delete [] temp_arr;\n}\n\n// Setup\nvoid setup(int value) {\n\tfreopen(\"input.txt\", \"r\", stdin);\n if (value) {\n\t\tfreopen(\"output.txt\", \"w\", stdout);\n }\n}\n\nbool arr[8][8];\n\nint dx[] = {2, 1, -1, -2, -2, -1, 1, 2};\nint dy[] = {1, 2, 2, 1, -1, -2, -2, -1};\n\nvoid xset(int x, int y) {\n if (x >= 0 && y >= 0 && x < 8 && y < 8)\n arr[x][y] = true;\n}\n\nint main() {\n string s1, s2;\n cin >> s1 >> s2;\n init(arr);\n int x, y;\n x = s1[0] - 'a';\n y = s1[1] - '1';\n arr[x][y] = true;\n arr[s2[0]-'a', s2[1]-'1'] = true;\n for (int i = 0; i < 8; i++) {\n arr[x][i] = arr[i][y] = true;\n xset(x + dx[i], y + dy[i]);\n xset(s2[0] - 'a' + dx[i], s2[1] - '1' + dy[i]);\n }\n int res = 0;\n for (int i = 0; i < 8; i++)\n for (int j = 0; j < 8; j++)\n if (!arr[i][j]) res++;\n std::cout << res << std::endl;\n\n return 0;\n}", "lang": "MS C++", "bug_code_uid": "f521f3fec7fff3a399cb17627ef79119", "src_uid": "073023c6b72ce923df2afd6130719cfc", "apr_id": "21757a2adcfd702c5a10b29ce3d7714a", "difficulty": 1200, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8143491124260355, "equal_cnt": 10, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "#include \nusing namespace std;\n#define ll long long\n#define int ll\n#define mod 1000000007\nvector parent,len;\nint n,m,k;\n\nint binomialCoeff(int n, int k) \n{ \n int res = 1; \n \n // Since C(n, k) = C(n, n-k) \n if ( k > n - k ) \n k = n - k; \n \n // Calculate value of \n // [n * (n-1) *---* (n-k+1)] / [k * (k-1) *----* 1] \n for (int i = 0; i < k; ++i) \n { \n res *= (n - i); \n res /= (i + 1); \n } \n \n return res; \n}\n\nvoid init(){\n parent.resize(n+1);\n len.resize(n+1);\n for(int i=1;i<=n;i++){\n parent[i] = i;\n len[i] = 1;\n } \n}\n\nint find(int n){\n if(parent[n] == n)\n return n;\n return parent[n] = find(parent[n]);\n}\n\nvoid un(int a, int b){\n int x = find(a);\n int y = find(b);\n \n if(x == y)\n return;\n if(len[x] < len[y])\n swap(x,y);\n parent[y] = x;\n len[x] += len[y];\n} \n\nsigned main()\n{\n cin>>n>>m>>k;\n init();\n for(int i=1;i<=n-k+1;i++){\n int m = i,n=i+k-1;\n while(m<=n){\n un(m,n);\n m++;\n n--;\n }\n }\n \n int count=0;\n for(int i=1;i<=n;i++){\n if(parent[i] == i){\n count++;\n }\n }\n \n // cout<\nusing namespace std;\n//int x;\n/*\nint recfunc(int curpos, int jumpsofar, int weightage){\n if(curpos == x){\n cout<a;\n\nint main(){\n long long int x,aa,bb=0,cc;\n cin>>x;\n a.push(0);\n \n while(!a.empty()){\n aa = a.front();a.pop();\n if(aa == x){\n cout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n \nusing namespace std;\n// vector push_back push front top empty pop make_pair long long insert begin end \ntypedef long long ll;\ntypedef vector vi;\ntypedef vector > vpi;\ntypedef vector vll;\ntypedef pair pi;\n#define F first\n#define ln '\\n'\n#define S second\n#define PB push_back\n#define MP make_pair\n#define B begin()\n#define RB rbegin()\n#define E end()\n#define RE rend()\n#define Z size()\n#define REP(i,a,b) for (int i = a; i < b; i++)\n#define L length()\n#define show(a) cerr << \" *** \" << a << endl;\n#define show1(a) cerr << \" /// \" << a << endl;\n#define valid(a,b,c) (a >= b && a < c ? 1 : 0)\nint dx[4] = {0,0,1,-1};\nint dy[4] = {1,-1,0,0};\nconst int mod = (int)1e9 + 7;\nconst ll INF64 = 3e18;\nvoid smxl(ll &a, ll b){if (a < b)a=b;}\nvoid smnl(ll &a, ll b){if (a > b)a=b;}\nvoid adsl(ll &a, ll b){a += b;if (a >= mod)a -= mod;}\nvoid misl(ll &a, ll b){a -= b;if (a >= mod)a -= mod; if (a < 0)a += mod;}\nvoid smx(ll &a, ll b){if (a < b)a=b;}\nvoid smn(ll &a, ll b){if (a > b)a=b;}\nvoid ads(ll &a, ll b){a += b;if (a >= mod)a -= mod;}\nvoid mis(ll &a, ll b){a -= b;if (a >= mod)a -= mod; if (a < 0)a += mod;}\nll gcd(ll a, ll b) {return (b==0? a:gcd(b,a%b));}\nll egcd(ll a, ll b, ll & x, ll & y) {if (a == 0){x = 0;y = 1;return b;}ll x1, y1;ll d = egcd(b % a, a, x1, y1);x = y1 - (b / a) * x1;y = x1;return d;}\nll mbinp(ll a, ll b){a %= mod;if (b == 0)return 1;ll ans = mbinp(a, b/2);ll tmp = (ans * ans) % mod;if (b % 2)return ((tmp * a) % mod);return ((tmp) % mod);}\nll binp(ll a, ll b){if (b == 0)return 1;ll ans = binp(a, b/2);ll tmp = (ans * ans);if (b % 2)return ((tmp * a));return ((tmp));}\nlong long C(int n, int m){ll ret=1;for(int i=1;i<=m;i++){ret*=(n-i+1);ret/=i;}return ret;}\nlong long overbinp(long long a, int b){long long res = 1;while (b){if (b & 1){if (res < INF64 / a) res *= a;else return INF64;}if (b > 1){if (a < INF64 / a) a *= a;else return INF64;}b >>= 1;}return res;}\n/*const int FMAXN = 1000 * 1000 + 10;int fen[FMAXN];void add(int x, int val){for (int i = x + 1; i < MAXN; i += i & (-i)) fen[i] += val;}int get(int x){int ans = 0;for (int i = x; i > 0; i -= i & (-i)) ans += fen[i];return ans;}int sum(int x, int y){return get(y) - get(x);}*/\n/*int distfloor(int n){int sum;int la;for (int i = 1; i <= n; i = la+1){la = n/(n/i);sum++;show(n/i);}return sum;}*/\n//int pointsCoveredBySegment(pi a, pi b){return(gcd((int)abs(a.F-b.F),(int)abs(a.S-b.S))+1);}\n//segment inters\n/*struct seg{int x1, y1, x2, y2;seg(){};};\nstruct line{long long Al, Bl, Cl;line(){};line(seg a){Al = a.y1 - a.y2;Bl = a.x2 - a.x1;Cl = -Al * a.x1 - Bl * a.y1;};};\nint get(seg a){int dx = a.x1 - a.x2;int dy = a.y1 - a.y2;return __gcd(abs(dx), abs(dy)) + 1;}\nlong long det(long long a, long long b, long long c, long long d){return a * d - b * c;}\nbool in(int x, int l, int r){if (l > r) swap(l, r);return (l <= x && x <= r);}\nbool inter(seg a, seg b, int& x, int& y){line l1(a), l2(b);long long dx = det(l1.Cl, l1.Bl, l2.Cl, l2.Bl);long long dy = det(l1.Al, l1.Cl, l2.Al, l2.Cl);long long d = det(l1.Al, l1.Bl, l2.Al, l2.Bl);if (d == 0)return false;if (dx % d != 0 || dy % d != 0)return false;x = -dx / d;y = -dy / d;if (!in(x, a.x1, a.x2) || !in(y, a.y1, a.y2))return false;if (!in(x, b.x1, b.x2) || !in(y, b.y1, b.y2))return false;return true;}*/\n/*st int nax = 105;\nint par[nax];\nint siize[nax];\nint get(int x)\n{\n return (x == par[x] ? x : par[x] = get(par[x]));\n}\nvoid merge(int a, int b) {\n int x = get(a);\n int y = get(b);\n if (x == y)return;\n if (siize[x] < siize[y])swap(x,y);par[y] = x;siize[x] += siize[y];}*/\n//const int nx = 1e5+10;ll cmd[nx];ll civ[nx];void initcmod(){\tcmd[0] = 1;\tcmd[1] = 1;\tREP(i,2,nx)\t{\t\tcmd[i] = cmd[i-1]*i;\t\tcmd[i] %= mod;\t}\tREP(i,0,nx)\t\tciv[i] = mbinp(cmd[i],mod-2);}ll cmod(int n, int m){\tinitcmod();\tll ans = cmd[n];\tans *= civ[m];\tans %= mod;\tans *= civ[n-m];\tans %= mod;\treturn ans;}\n//double triarea(double a, double b, double c){double p= (a+b+c)/2;return (sqrt(p*(p-a)*(p-b)*(p-c)));}\n//ll diag(ll n){return ((n*(n-1))/2 - n);}\n//number of divs of n=p^a*q^b*r^c == (a+1)*(b+1)*(c+1)\n//sum of divs of n=p^a*q^b*r^c == (p^(a+1)-1)/(p-1) * (q^(b+1)-1)/(q-1) * (r^(c+1)-1)/(r-1)\n//prod of divs of n=p^a*q^b*r^c == n ^ (((a+1)*(b+1)*(c+1))/2)\nvoid display(vi &a){for(int z : a)cout << z << \" \";cout << endl;}\n\n\nint main()\n{\n\tios_base::sync_with_stdio(false);\n\tcin.tie(NULL);\n\tcout.tie(NULL);\n int n;\n cin >> n;\n queuekyou;\n kyou.push(MP(n,2));\n int ans = 1e9;\n while(kyou.Z)\n {\n pi x = kyou.front();\n kyou.pop();\n if (x.S==0)\n {\n ans = min(ans,x.F);\n continue;\n }\n vi divs;\n int tmp = x.F;\n for(int i = 2; i*i <= tmp;i++)\n {\n if(tmp%i == 0)\n divs.PB(i);\n while(tmp%i==0)\n tmp/=i;\n }\n if (tmp!= 1)\n divs.PB(tmp);\n kyou.push(MP(x.F,x.S-1));\n for (int z : divs)\n {\n int tmp = x.F-1;\n while(tmp%z != 0 && tmp > z)\n {\n kyou.push(MP(tmp,x.S-1));\n tmp--;\n }\n }\n }\n cout << ans;\n}\n", "lang": "GNU C++17", "bug_code_uid": "9ac4191d22fec07de9b5aa8c8165fe5e", "src_uid": "43ff6a223c68551eff793ba170110438", "apr_id": "6006574b0ec06625053c5dfce0106707", "difficulty": 1700, "tags": ["math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.4452296819787986, "equal_cnt": 14, "replace_cnt": 7, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 13, "bug_source_code": "#include\n\nusing namespace std;\n\nint main()\n{\nint n,a[50]={-1};\ncin>>n;\nlong int prod=1;\nint m,j,l=0;\nwhile(n>=0)\n{\nm=n%10;\na[l]=m;\nl++;\nn/=10;\n}\nfor( j=0;j<=l;j++)\n{\n\tif(a[j]==9 || a[j]==6 || a[j]==5 || a[j]==4 || a[j]==2)\n\t\tprod=prod*1;\n\telse if(a[j]==8 || a[j]==0)\n\t\tprod=prod*2;\n\telse if(a[j]==7 || a[j]==1)\n\t\tprod=prod*5; \n \telse\n\t\tprod=prod*3;\n}\ncout<\n\nusing namespace std;\n\ntypedef long long llong;\n\nconst llong MOD = 1e9 + 7;\n\ninline tuple count_remainders(int l, int r) {\n\treturn make_tuple(r / 3 - l / 3, (r + 2) / 3 - (l + 2) / 3, (r + 1) / 3 - (l + 1) / 3);\n}\n\nvoid solve(int n, int l, int r) {\n\tvector> dp(3, vector(n + 1, 0));\n\tdp[0][0] = 1;\n\n\ttuple abc = count_remainders(l, r);\n\n\tfor (int i = 0; i < n; ++i) {\n\t\tfor (int j = 0; j < 3; ++j) {\n\t\t\tfor (int k = 0; k < 3; ++k) {\n\t\t\t\tdp[(j + k) % 3][i + 1] += dp[j][i] * abc.get(k);\n\t\t\t\tdp[(j + k) % 3][i + 1] %= MOD;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tcout << dp[0][n] << \"\\n\";\n}\n\nint main() {\n\tint n, l, r; cin >> n >> l >> r;\n\n\tsolve(n, l, r);\n\n\treturn 0;\n}", "lang": "GNU C++17", "bug_code_uid": "a9ca331e209026f83e5793905fb06182", "src_uid": "4c4852df62fccb0a19ad8bc41145de61", "apr_id": "0bb0d820b3e622f51f4dba802d6da739", "difficulty": 1500, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9832911392405064, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include \nusing namespace std;\nchar table[9][9];\nbool lineGoodW[9] = {1,1,1,1,1,1,1,1,1};\nbool lineGoodB[9] = {1,1,1,1,1,1,1,1,1};\nint main() {\n for(int i = 0 ; i < 8 ; i++){\n cin>>table[i];\n }\n char *p;\n char *t;\n int P,T;\n int firstW = 0,firstB = 0;\n for(int i = 0 ; i < 8 ; i++){\n for(int j = 0 ; j < 8 ; j++){\n if(table[i][j] == 'B')\n lineGoodW[j] = false;\n else if(table[i][j] == 'W' && lineGoodW[j] == true){\n firstW = i;\n i = -1;\n }\n }\n }\n for(int i = 7 ; i >= 0 ; i--){\n for(int j = 0 ; j < 8 ; j++){\n if(table[i][j] == 'W')\n lineGoodB[j] = false;\n else if(table[i][j] == 'B' && lineGoodB[j] == true){\n firstB = 7-i;\n i = -1;\n\n }\n }\n }\n cout << firstB << firstW;\n if(firstB < firstW)\n cout << \"B\";\n else\n cout << \"A\";\n\n\n return 0;\n}\n\n", "lang": "GNU C++11", "bug_code_uid": "eb63d87db869c44cb351e8c5c2f5d56a", "src_uid": "0ddc839e17dee20e1a954c1289de7fbd", "apr_id": "a27ecd1bc12b5b0bfc3be3f105c7e066", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.23215476984656438, "equal_cnt": 25, "replace_cnt": 19, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 25, "bug_source_code": "#include\n#include\n#include\nusing namespace std;\nint main()\n{\n int r1,r2,c1,c2,d1,d2;\n while(cin>>r1>>r2>>c1>>c2>>d1>>d2)\n {\n int b=(r1-c1+d2)/2;\n int a=r1-b,c=d2-b,d=c2-b;\n int flag=1;\n if(a+b!=r1||c+d!=r2||a+c!=c1||b+d!=c2||a+d!=d1||b+c!=d2)flag=0;\n if(flag)\n {cout<\n#include \n#include \n#include \n#include \n#include \n#include \n\n\nusing namespace std;\nint n,m;\n\n\n\nint main() {\n\tscanf(\"%d%d\", &n,&m);\n\tvector> vis(n, vector(m,false));\n\tstring hh; cin >> hh;\n\tstring vv; cin >> vv;\n\tstack> st;\n\tst.push(make_pair(0, 0));\n\tint r = 1;\n\tvis[0][0] = true;\n\twhile (!st.empty()) {\n\t\tauto &c = st.top(); st.pop();\n\t\tint x = c.first;\n\t\tint y = c.second;\n\t\tif (hh[x] == '>'&& (y+1) < m && !vis[x][y+1]) {\n\t\t\tst.push(make_pair(x, y+1));\n\t\t\tr++;\n\t\t}else if (hh[x] == '<'&&y - 1>=0 && !vis[x][y-1]) {\n\t\t\tst.push(make_pair(x , y-1));\n\t\t\tr++;\n\t\t}\n\t\tif (vv[y] == 'v' && (x + 1) < n && !vis[x+1][y]) {\n\t\t\tst.push(make_pair(x+1, y)); r++;\n\t\t}\n\t\telse if (vv[y] == '^'&&x - 1 >= 0 && !vis[x-1][y]) {\n\t\t\tst.push(make_pair(x-1, y)); r++;\n\t\t}\n\t}\n\tif (r == m * n) {\n\t\tcout << \"YES\";\n\t}\n\telse {\n\t\tcout << \"NO\";\n\t}\n\n}", "lang": "GNU C++11", "bug_code_uid": "ce53c5fb34df5d1465f4f3a3cc6b0143", "src_uid": "eab5c84c9658eb32f5614cd2497541cf", "apr_id": "0eb92800c36204f13240cf27a1d7c091", "difficulty": 1400, "tags": ["graphs", "brute force", "dfs and similar", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9522983521248916, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "\n#include \n#include \n#include \n#include \nusing namespace std;\n\nint main()\n{\n ios_base::sync_with_stdio(false);\n\n\n long long a,b,c;\n cin>>a>>b>>c;\n if(max(a,b)>c)\n {\n cout<<0;\n return 0;\n }\n if(a<=0&&b<=0)\n {\n cout<<-1;\n return 0;\n }\n\n\n long long ans=0;\n if(a<0)\n {\n ans+=(-1*a)/b;\n a+=((-1*a)/b)*b;\n }\n while(ab)\n swap(a,b);\n\n\n }\n\n\n\n cout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#define ll long long\n#define ld long double\n#define mp make_pair\n#define pii pair\n#define pll pair\n#define pi 3.141592653589793238462643383279\nll gcd(ll a, ll b) {\n\tif (b == 0)\n\t\treturn a;\n\telse\n\t\treturn gcd(b, a % b);\n}\n\nll lcm(ll a, ll b) { return (((a*b) / gcd(a, b))); }\n\nll phi(ll n){\n\tll result = n;\n\tfor (ll i = 2; i*i <= n; i++) {\n\t\tif (n % i == 0) {\n\t\t\twhile (n % i == 0) n /= i;\n\t\t\tresult -= result / i;\n\t\t}\n\t}\n\tif (n > 1) result -= result / n;\n\treturn result;\n}\n#define inf 1000000007\n\n#define eps 0.0001\n#define ls (v << 1)\n#define rs ((v << 1)+1)\n//#define y1 privet\n\nvoid nxi(ll& n){\n\tbool min = 0; char c; n = 0;\n\twhile ((c = getc(stdin)) && c <= 32);\n\tif (c == '-') min = 1; else n = c - 48;\n\twhile ((c = getc(stdin)) && c>32) n = (n << 3) + (n << 1) + c - 48;\n\tif (min) n = -n;\n}\n\nvoid prl(ll n){\n\tif (n == 0) { puts(\"0\"); return; }\n\tif (n<0) { putchar('-'); n = -n; }\n\tstatic ll s[10];\n\tll top = 0;\n\twhile (n>0) s[top++] = n % 10, n /= 10;\n\twhile (top--) putchar(s[top] + 48);\n\tputs(\"\");\n}\n\n#define x1 first\n#define y1 second\n#define x0 privet\n#define y0 pak\n#define pll pair\n#define X first\n#define Y second\n#define ppii pair< pii , pii >\nusing namespace std;\n\nconst ll nmax = 2100;\nll n, t, cb[nmax][nmax], e, maxbit=62;\n\nint main()\n{\n ios::sync_with_stdio(0);\n#ifdef ONLINE_JUDGE\n\tfreopen(\"input.txt\", \"r\", stdin); freopen(\"output.txt\", \"w\", stdout);\n#endif\n\n\n\tcin >> n >> t;\n\tif (t & (t - 1)) return cout << 0 << endl, 0;\n\tint e = 0;\n\tfor (; t != 1; t >>= 1, ++e);\n\n\tfor (int i = 0; i < maxbit; ++i)\n\t\tfor (int j = 0; j <= i; ++j)\n\t\t\tcb[i][j] = j ? cb[i - 1][j - 1] + cb[i - 1][j] : 1;\n\n\tll ans = 0;\n\tint x = 0;\n\tn += 2;\n\t ++e;\n\tfor (int b = maxbit - 1; b >= 0; --b) {\n\t\tif (n & (1ll << b)) {\n\t\t\tans += cb[b][e - x];\n\t\t\t++x;\n\t\t\tif (x > e) break;\n\t\t}\n\t}\n\tif (e == 1) ans -= 1;\n\n\tcout << ans << endl;\n\n\treturn 0;\n}\n", "lang": "MS C++", "bug_code_uid": "a0299af1929aed396b97fa7c89dd389e", "src_uid": "727d5b601694e5e0f0cf3a9ca25323fc", "apr_id": "ccea1c66ca53764a742c5e4f329f0e41", "difficulty": 2000, "tags": ["dp", "math", "constructive algorithms"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.997698504027618, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 4, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\ntypedef long long int64;\n\nconst int INF = 0x3f3f3f3f;\nconst int MAXN = 1e7 + 10;\n\nbool isnt_prime[MAXN];\nint prime[MAXN], phi[MAXN];\nint64 mfac_cnt[MAXN], mfac_sum[MAXN];\n\n#define sum(l, r) (((r) < (l)) ? 0 : (mfac_sum[(r)] - mfac_sum[(l) - 1]))\n\nint main() {\n int n;\n cin >> n;\n isnt_prime[1] = true;\n phi[1] = 1;\n int prime_cnt = 0;\n for (int i = 2; i <= n; i++) {\n if (!isnt_prime[i]) {\n prime[prime_cnt++] = i;\n mfac_cnt[i]++;\n phi[i] = i - 1;\n }\n for (int j = 0; j < prime_cnt; j++) {\n if (i * prime[j] > n) break;\n isnt_prime[i * prime[j]] = true;\n mfac_cnt[prime[j]]++;\n if (i % prime[j] == 0) {\n phi[i * prime[j]] = phi[i] * prime[j];\n break;\n } else {\n phi[i * prime[j]] = phi[i] * (prime[j] - 1);\n }\n }\n }\n for (int i = 1; i <= n; i++) {\n mfac_sum[i] = mfac_sum[i - 1] + mfac_cnt[i];\n }\n int path2 = 0;\n for (int i = 1; i <= n; i++) {\n path2 += phi[i] - 1;\n // clog << phi[i] << endl;\n }\n int path1 = (n - 1) * (n - 2) / 2 - path2;\n // \u5148\u5047\u8bbe\u90fd\u662f\u957f\u5ea6\u4e3a2\u7684\u8def\u5f84, \u5f85\u4f1a\u7edf\u8ba1\u7684\u65f6\u5019\u518d\u8c03\u6574\n int64 ans = path2 * 2 + path1;\n for (int i = 0; i < prime_cnt; i++) {\n // \u957f\u5ea6\u4e3a3\u7684\u8def\u5f84, fa < n / 2\n ans += mfac_cnt[prime[i]] *\n sum(max(prime[i] + 1, n / prime[i] + 1), max(prime[i], n / 2));\n // \u4e0d\u5b58\u5728\u7684\u8def\u5f84, fa > n / 2\n ans -= 2 * mfac_cnt[prime[i]] * sum(max(prime[i], n / 2) + 1, n);\n }\n cout << ans << endl;\n return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "f0438f428cb0700793f80619947dfadb", "src_uid": "bb1bd5d8bab7d79e514281230d484996", "apr_id": "16e2beea1cd8d13384e1fbae709f2bcb", "difficulty": 2700, "tags": ["data structures", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.6764566556134534, "equal_cnt": 10, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "#include \nusing namespace std;\n\n// -- All pre-processors and typedef constants -- // \n#define scd(t) scanf(\"%d\",&t)\n#define scld(t) scanf(\"%ld\",&t)\n#define sclld(t) scanf(\"%lld\",&t)\n#define scc(t) scanf(\"%c\",&t)\n#define scs(t) scanf(\"%s\",t)\n#define scf(t) scanf(\"%f\",&t)\n#define sclf(t) scanf(\"%lf\",&t)\n#define mem(a, b) memset(a, (b), sizeof(a))\n#define repd(i,k) for(ll i=k;i>=0;i--)\n#define rep(i,k) for(ll i=0;i>t; while(t--)\ntypedef unsigned long long int ll;\n\ntypedef pair pr;\ntypedef vector vi;\ntypedef vector vs;\ntypedef vector vpr;\ntypedef vectorvvpr;\ntypedef vector vvi;\ntypedef map MPII;\ntypedef set SETI;\ntypedef multiset MSETI;\n#define MAXN 1e8\n \n// stores smallest prime factor for every number \nll spf[(ll)MAXN]; \n \n// Calculating SPF (Smallest Prime Factor) for every \n// number till MAXN. \n// Time Complexity : O(nloglogn) \nvoid sieve() \n{ \n spf[1] = 1; \n for (ll i=2; i ret; \n ll mini = INT_MAX;\n while (x != 1) \n { \n ret.push_back(spf[x]); \n x = x / spf[x];\n mini=min(mini,spf[x]+temp/spf[x]);\n } \n return mini; \n}\nint main(){\n ios_base::sync_with_stdio(false);\n cin.tie(NULL);cout.tie(NULL);\n ll n;\n cin>>n;\n if(n==0){\n cout<<0<\nusing namespace std;\n\n#define sc( x ) scanf( \"%d\" , &x )\n#define REP( i , n ) for( int i = 0 ; i < n ; ++i )\n#define clr( t , val ) memset( t , val , sizeof( t ) )\n\n#define pb push_back\n#define all( v ) v.begin() , v.end()\n#define SZ( v ) ((int)(v).size())\n\n#define mp make_pair\n#define fi first\n#define se second\n\n#define N 1000000\n#define M 1000000007LL\n\n#define look1( v , n ) REP( i , n ) cout< vull;\nll pow( ll a , ll b , ll c ){\n ll ans = 1;\n while( b ){\n if( b & 1 ) ans = ( ans * a )%c;\n a = ( a * a )%c;\n b >>= 1;\n }\n return ans;\n}\nll mod_inv( ll a , ll p ){\n return pow( a , p - 2 , p );\n}\nll F[ N + 4 ] , P[ N + 4 ];\nbool ok( ll s , int a , int b ){\n while( s ){\n int d = s%10;\n s /= 10;\n if( d != a && d != b ) return 0;\n }\n return 1;\n}\nint main(){\n int a , b , n;\n cin>>a>>b>>n;\n \n F[ 0 ] = P[ 0 ] = 1;\n for( int i = 1; i <= N ; i++ ) F[ i ] = ( F[ i - 1 ]*i ) %M;\n for( int i = 1; i <= N ; i++ ) P[ i ] = mod_inv( F[ i ] , M ); \n \n// look1( P , 20 );\n ll ans = 0;\n \n REP( i , n + 1 ){\n ll sum = i*a + ( n - i )* b;\n ll j = n - i, val = 0;\n if( ok( sum , a , b ) ){\n val = ( ((F[ n ]*P[ i ])%M)*P[ j ] ) % M;\n }\n ans += val;\n }\n cout<\n\nconst int MAXN = 100;\n\nint a,b,k;\nint l;\nbool is_prime[MAXN];\nint prime_lst[MAXN];\nint prime_size=0;\nint prime_cnt[MAXN];\n\nvoid cal_prime()\n{\n\tfor (int i = 0; i < MAXN; i++)\n\t\tis_prime[i]=true;\n\tfor (int i = 4; i < MAXN; i+=2)\n\t\tis_prime[i]=false;\n\tis_prime[0] = is_prime[1] = false; \n\tprime_lst[prime_size++] = 2;\n\tfor (int i = 3; i= MAXN) break;\n\t\t\tis_prime[s] = false;\n\t\t\tif (i % prime_lst[j] == 0)\tbreak;\n\t\t}\n\t}\n}\n\nint main()\n{\n\tscanf(\"%d%d%d\", &a, &b, &k);\n\tcal_prime();\n//\tprintf(\"1\");\n\tprime_cnt[0] = 0;\n\tfor (int i = 1; i < MAXN; i++){\n\t\tprime_cnt[i] = prime_cnt[i-1] + (is_prime[i]?1:0);\n\t//\tprintf(\"%d %d %d\\n\", i, prime_cnt[i], is_prime[i]);\n\t}\n//\tprintf(\"%d %d\\n\", prime_cnt[a], prime_cnt[b]);\n\tif (prime_cnt[b] - prime_cnt[a-1] < k){\n\t\tprintf(\"-1\\r\\n\");\n\t//\twhile(1);\n\t\treturn 0;\n\t}\n\t\t\n\tint cnt = 0;\n\tl = 1;\n\tfor (int x = a,xl = a; x <= b&& xl <= b; x++){\n\t\t\t\t\n\t\twhile(cnt < k){\n\t\t\tif (xl > b){\n\t\t\t\txl++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (is_prime[xl])\n\t\t\t\tcnt++;\n\t\t\txl++;\n\t\t\t\n\t\t}\n\t\tif (xl - x > l)l = xl-x;\n\t\tif (is_prime[x])\n\t\t\tcnt--;\n\t}\n\tprintf(\"%d\\r\\n\", l);\n//\twhile(1);\t\n\t\t\t\n}\n", "lang": "GNU C++0x", "bug_code_uid": "7bd9514a12fd3981ae2c984707ed133e", "src_uid": "3e1751a2990134f2132d743afe02a10e", "apr_id": "bb5635cb6fc90378ddac339434641585", "difficulty": 1600, "tags": ["binary search", "number theory", "two pointers"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.7435387673956262, "equal_cnt": 12, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 11, "bug_source_code": "#include \n\nusing namespace std;\n\ntypedef long long ll;\ntypedef pair pii;\ntypedef long double ld;\n\n#define fi first\n#define se second\n#define mp make_pair\n#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);\n#define TEST freopen(\"in.txt\",\"r\",stdin);\n#define ab(a) ((a < 0) ? (-(a)) : (a))\n\nint main(){\n\tfastIO;\n\tint n;\n\tcin >> n;\n\tvectora;\n\tint k;\n\tfor(int i = 0;i> k;\n\t\ta.push_back(k);\n\t}\n\twhile(!a.empty() and a.back() == 0)\n\t\ta.pop_back();\n\tint l = 0;\n\tfor(int i = 0;i <^> <^> <^> <^> <^> /// *\n///*<^> Never tired :)<^>:V\t*///\n//*/*** Never Give UP ***///\n/// Date<^>XX/08/2018\t*///\n\n#include\n\nusing namespace std;\n\n#define LOOP(i,L,U) for(long long int i=(long long int)L;i\n#define msi \tmap< string,long long int>\n#define vi \t\tvector\n#define iit \t\titerator it,it1,it2\n#define iip \t\titerator ip,ip1,ip2\n\n#define sz \t\t 100000\n#define check(x) \t cout<<\":::\"<>c\n#define o(c) \t\t scanf(\"%lld\",&c);\n#define mz(c,r) \t long long r=c;while(c--)\n\n#define fs first\n#define sc second\n#define pi \t\t acos(-1.0)\n#define eps \t\t 1e-9\n\n#define notrue \t\tfalse\n#define ifnot \t\t else\n#define eee \t\t cout<>n>>R>>r;\n long double theta=n*asin((r)/(R-r));\n ///check(theta);\n if(theta+eps<=pi ) cout<<\"YES\"<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nconst long long N = 1000100;\n\n\nvector> points;\nbool isUsed[N];\n\nlong long ccw(pair a, pair b, pair c) {\n return (b.first - a.first) * (c.second - a.second) - (b.second - a.second) * (c.first - a.first);\n}\n\nvoid solve() {\n long long n;\n cin >> n;\n for (long long i = 0; i < n; i++) {\n long long x, y;\n cin >> x >> y;\n points.push_back({x, y});\n }\n string s;\n cin >> s;\n pair curP = {INT_MAX, INT_MAX};\n long long pivot = 0;\n for (long long i = 0; i < points.size(); i++) {\n if (points[i].second < curP.second) {\n curP = points[i];\n pivot = i;\n }\n if (points[i].second == curP.second) {\n if (points[i].first < curP.first) {\n curP = points[i];\n pivot = i;\n }\n }\n }\n isUsed[pivot] = true;\n for (long long i = 0; i < s.size(); i++) {\n cout << pivot + 1 << \" \";\n long long middle = -1;\n if (s[i] == 'L') {\n for (long long j = 0; j < n; j++) {\n if (isUsed[j]) continue;\n if (middle == -1 || ccw(points[pivot], points[middle], points[j]) < 0) {\n middle = j;\n }\n }\n } else {\n for (long long j = 0; j < n; j++) {\n if (isUsed[j]) continue;\n if (middle == -1 || ccw(points[pivot], points[middle], points[j]) > 0) {\n middle = j;\n }\n }\n }\n pivot = middle;\n isUsed[pivot] = true;\n }\n cout << pivot + 1 << \" \";\n for (long long i = 0; i < n; i++) {\n if (!isUsed[i]) {\n cout << i + 1 << endl;\n }\n }\n\n}\n\nlong long main() {\n solve();\n\n return 0;\n\n\n}", "lang": "GNU C++17", "bug_code_uid": "67543aa60e7c01346952eeeb7e29daa1", "src_uid": "13d7f6127a7fe945e19d461b584c6228", "apr_id": "89ad93b461f0f1ef451de34caecde6a6", "difficulty": 2600, "tags": ["geometry", "math", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.990990990990991, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#pragma GCC optimize (\"O3\")\n#pragma GCC target (\"sse4\")\n\n#include \n#include \n#include \n#include \n\nusing namespace std;\nusing namespace __gnu_pbds;\nusing namespace __gnu_cxx;\n \ntypedef long long ll;\ntypedef long double ld;\ntypedef complex cd;\n\ntypedef pair pi;\ntypedef pair pl;\ntypedef pair pd;\n\ntypedef vector vi;\ntypedef vector vd;\ntypedef vector vl;\ntypedef vector vpi;\ntypedef vector vpl;\ntypedef vector vcd;\n\nauto _fast_io = []() { std::ios::sync_with_stdio(false); cin.tie(nullptr); return cout.tie(nullptr); }();\n\ntemplate \nistream& operator>>(istream& in, vector& v) {\n for (size_t i = 0; i < v.size(); ++i) {\n in >> v[i];\n }\n return in;\n}\n\ntemplate \nostream& operator<<(ostream& out, vector& v) {\n out << '{';\n if (!v.empty()) {\n out << v.front();\n for (size_t i = 0; i < v.size(); ++i) {\n out << \", \" << v[i];\n }\n }\n out << '}';\n return out;\n}\n\ntemplate \nistream& operator>>(istream& in, array& v) {\n for (size_t i = 0; i < Size; ++i) {\n in >> v[i];\n }\n return in;\n}\n\nbool operator<(const pi& l, const pi& r) {\n return l.first < r.first || (l.first == r.first && l.second < r.second);\n}\n\npi operator-(const pi& left, const pi& right) {\n return make_pair(left.first - right.first, left.second - right.second);\n}\n\nint main() {\n int n;\n cin >> n;\n vector> ps(n);\n for (int i = 0; i < n; ++i) cin >> ps[i].first.first >> ps[i].first.second;\n for (int i = 0; i < n; ++i) ps[i].second = i + 1;\n sort(ps.begin(), ps.end());\n string s;\n cin >> s;\n pi last_d = { 1, 1 };\n auto angle = [&last_d] (const pi& p) { \n const double cosine = (int64_t(p.first) * last_d.first + int64_t(p.second) * last_d.second) / hypot(p.first, p.second);\n const double sine = (int64_t(p.first) * last_d.second - int64_t(p.second) * last_d.first) / hypot(p.first, p.second);\n return std::atan2(sine, cosine);\n };\n for (int i = 0; i < s.size(); ++i) {\n auto comparator = [p=ps[i].first, &angle](pair& left, pair& right) { \n return angle(left.first - p) < angle(right.first - p);\n };\n //cout << ps[i].second << \": \";\n //for (int j = i + 1; j < ps.size(); ++j) cout << ps[j].second << '(' << angle(ps[j].first - ps[i].first) << \") \";\n //cout << endl;\n if (s[i] == 'L') {\n iter_swap(ps.begin() + i + 1, max_element(ps.begin() + i + 1, ps.end(), comparator));\n } else {\n iter_swap(ps.begin() + i + 1, min_element(ps.begin() + i + 1, ps.end(), comparator));\n }\n last_d.first = ps[i+1].first.first - ps[i].first.first;\n last_d.second = ps[i+1].first.second - ps[i].first.second;\n }\n for (int i = 0; i < ps.size(); ++i) cout << ps[i].second << ' ';\n cout << endl;\n}\n", "lang": "GNU C++14", "bug_code_uid": "eb7b9b71eca9aac3c9d9374accfdf2fd", "src_uid": "13d7f6127a7fe945e19d461b584c6228", "apr_id": "479b4170087ac8fc41bfb3d7ff87fc1f", "difficulty": 2600, "tags": ["geometry", "math", "constructive algorithms"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.7165222253284875, "equal_cnt": 42, "replace_cnt": 19, "delete_cnt": 11, "insert_cnt": 12, "fix_ops_cnt": 42, "bug_source_code": "#pragma GCC optimize(\"Ofast\")\n#include\n#include \n\n#define F first\n#define S second\n//#define int long long\n#define ll long long\n//#define int unsigned long long\n#define pb push_back\n//#define double long double\n\nusing namespace std;\nusing namespace __gnu_pbds;\ntypedef tree< int , null_type, less, rb_tree_tag, tree_order_statistics_node_update> ordered_set;\nconst int mod = 1e9 + 7;\nconst int N = 1200010;\nconst int K = 15;\nint l[N], r[N], f[N], len[N], p[N], used[30][N];\nvector < int > u, v, t, pr;\nmap < vector < int >, map < int, int > > d;\nmap < int, int > d0;\nqueue < pair < int, int > > q;\nvoid calc (int p, int v, int x, int pr = 100){\n if (x < 0) return;\n if (used[p][v] > x) return;\n used[p][v] = x;\n q.push({p, v});\n if (d[u].find(v) == d[u].end()) d[u][v] = K - x; else d[u][v] = min(d[u][v], K - x);\n if (p >= u.size()) return;\n for (int i = max(1, u[p] - x); i < u[p] + x; i++){\n int y = v;\n calc(p + 1, v / u[p] * i, x - abs(i - u[p]), i);\n }\n}\nvoid precalc (int p, int v, int x, int pr = 100){\n if (x < 0) return;\n if (d0.find(v) == d0.end()) d0[v] = K - x; else d0[v] = min(d0[v], K - x);\n if (p >= t.size()) return;\n for (int i = max(1, t[p] - x); i < t[p] + x && i <= pr; i++){\n int y = v;\n precalc(p + 1, v / t[p] * i, x - abs(i - t[p]), i);\n }\n}\nvector < int > tovec(int x){\n vector < int > res, z;\n while (x != 1){\n z.pb(p[x]);\n x /= p[x];\n }\n int pr = -1;\n int c = 0;\n sort(z.begin(), z.end());\n for (int i = 0; i < z.size(); i++) if (pr == z[i]) c++; else{\n if (c != 0) res.pb(c + 1);\n c = 1;\n pr = z[i];\n }\n res.pb(c + 1);\n sort(res.begin(), res.end());\n reverse(res.begin(), res.end());\n return res;\n}\nmain(){\n ios_base::sync_with_stdio(0);\n cin.tie(0);\n //freopen(\"input.txt\", \"r\", stdin);\n n = 1000000;\n set < vector < int > > v;\n for (int i = 2; i < N; i++){\n if (p[i] != 0) continue;\n pr.pb(i);\n for (int j = i; j < N; j += i) p[j] = i;\n }\n for (int i = 1; i <= n; i++){\n vector < int > t = tovec(i);\n v.insert(t);\n }\n for (int i = 0; i < 10; i++) t.pb(1);\n precalc(0, 1, K);\n int zz = 0;\n int zzz = 0;\n for (auto i: v){\n u = i;\n int x = 1;\n for (auto j: u) x *= j;\n calc(0, x, K);\n zz += q.size();\n while(!q.empty()){\n auto y = q.front();\n q.pop();\n used[y.F][y.S] = 0;\n }\n zzz = max(zzz, (int)d[u].size());\n for (auto j: d[u]){\n for (auto l: d0){\n int c = l.F * j.F;\n if (c > 5000) continue;\n if (d[u][c] == 0 && c != x) d[u][c] = l.S + j.S; else d[u][c] = min(d[u][c], l.S + j.S);\n }\n }\n }\n int q;\n cin >> q;\n while(q--){\n int x, y;\n cin >> x >> y;\n vector < int > v1 = tovec(x);\n vector < int > v2 = tovec(y);\n int res = 1000;\n cout << d[v1][2] << \" \" << d[v2][2] << endl;\n for (auto i: d[v1]){\n if (d[v2].find(i.F) != d[v2].end()) res = min(res, i.S + d[v2][i.F]);\n }\n cout << res << endl;\n }\n}\n", "lang": "GNU C++14", "bug_code_uid": "325688d72ec232e7403aa880626524cf", "src_uid": "6115ee1ccf651b1dd8145bf755ea7ea9", "apr_id": "2332f58b3ef88939ff2d8b94f9e60a79", "difficulty": 2800, "tags": ["graphs", "math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.011794708320051004, "equal_cnt": 22, "replace_cnt": 15, "delete_cnt": 1, "insert_cnt": 7, "fix_ops_cnt": 23, "bug_source_code": "1\n829440 646800\n\n12\n1000000 132408\n887040 953312\n106623 184832\n333564 250000\n340480 308345\n342720 933120\n829440 646800\n406560 861840\n999155 256\n857088 811440\n926100 500240\n55584 106272\n\n\n\n\n1\n231 100\n22 146\n149 239\n\n\n8\n9 10\n100 17\n220 70\n17 19\n4 18\n32 20\n100 32\n224 385\n\n\n", "lang": "GNU C++11", "bug_code_uid": "b4851ec4f6054b571df5e3fa3cfbbb79", "src_uid": "6115ee1ccf651b1dd8145bf755ea7ea9", "apr_id": "c099d27e708892128bdae9c6b696cb6d", "difficulty": 2800, "tags": ["graphs", "math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8320526893523601, "equal_cnt": 11, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 10, "bug_source_code": "#include \nusing namespace std;\nint main()\n{\n int n,b,p,bot;\n while(3==scanf(\"%d %d %d\",&n,&b,&p)){\n int r=n;\n p*=n;\n bot=0;\n while(1){\n int k=1;\n while(1){\n k<<=1;\n if(k>n)break;\n }\n k>>=1;\n bot+=k*b+(k/2);\n n=(k>>1)+n-k;\n if(n==1)break;\n }\n if(r==1)printf(\"0 0\\n\");\n else printf(\"%d %d\\n\",bot,p);\n }\n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "a6638700a57fdd97c821a347f42e7d70", "src_uid": "eb815f35e9f29793a120d120968cfe34", "apr_id": "52d4aeb34aadf360ce8d8d0cc3769210", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7494852436513384, "equal_cnt": 56, "replace_cnt": 23, "delete_cnt": 1, "insert_cnt": 32, "fix_ops_cnt": 56, "bug_source_code": "#include \nusing namespace std;\ntypedef long long ll;\n\nconst int MOD = 10000009;\nint a[10] , b[10] , x , mod ;\nbool mem1[10][2][MOD];\nbool vis1[10][2][MOD];\nbool mem2[10][2][MOD];\nbool vis2[10][2][MOD];\n\nbool dp2(int i,int j,int k){\nif( i == 9 )\n return !k;\n\nbool &ret = mem2[i][j][k];\nif( vis2[i][j][k] )return ret;\nvis2[i][j][k]=1;\nret=0;\n\nint mx = j?10:b[i]+1;\n\nfor(int d=0;d=0;i--,x/=10)a[i]=x%10;\nscanf(\"%d\",&x);\nfor(int i=8;i>=0;i--,x/=10)b[i]=x%10;\nscanf(\"%d\",&mod);\n\nif( dp1(0,0,0) ){\n printf(\"1 \");\n go(0,0,0);\n printf(\"\\n\");\n}else\n printf(\"2\\n\");\n\nreturn 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "086d6fc36eb67a3a8f4ab557e62a1014", "src_uid": "8b6f633802293202531264446d33fee5", "apr_id": "83971eeda94d643148e9d85978fc10fd", "difficulty": 1800, "tags": ["brute force", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9311969839773798, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include \n#define sz(vec) ((int)((vec).size()))\n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nint main(){\n string s ;\n vector vec ;\n int n ;\n for(int i=0 ; i<100 ; i++){\n cin>>s[i] ;\n if(s[i]=='?'){\n n=i+1 ;\n break ; }\n }\n if(s[n-2]=='a'||s[n-2]=='o'||s[n-2]=='e'|| s[n-2]=='i' || s[n-2]=='u' || s[n-2]=='y'){\n cout<<\"YES\" ;\n return 0;}\n cout<<\"NO\" ;\n return 0 ;\n}\n", "lang": "MS C++", "bug_code_uid": "9a76709ce31e998e7c4fefba61afd489", "src_uid": "dea7eb04e086a4c1b3924eff255b9648", "apr_id": "ae717d2baa694290bcc4fae409d82725", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.22033898305084745, "equal_cnt": 13, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 12, "bug_source_code": "#include\n#include\nusing namespace std;\n#define f(a,n) for(int i=a;in; i--)\nchar m[1000]; \n\nint main(){\n\n string s;\n cin >> s;\n int j = 0, cnt = 0, p = 0;\n f(0,s.size()){\n for(int j=0; i 6|| p>6) cout << \"YES\" << endl;\n else cout << \"NO\" << endl;\n //system(\"pause\");\n return 0;\n}", "lang": "MS C++", "bug_code_uid": "e595a2b32a8a438de8cbaf1a77972626", "src_uid": "ed9a763362abc6ed40356731f1036b38", "apr_id": "cc4c0dc3b3c234717251e51c1132a958", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9035728006146754, "equal_cnt": 10, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 10, "bug_source_code": "# include\n# include\n# include\nusing namespace std;\nconst int N = 1e5 + 5;\nchar s[N],t[N],ans[N];\nint sum[N][3],sum1[N][3],las[N],las1[N];\nint n,m,q,tot;\nint main()\n{\n\tscanf(\"%s%s\",s + 1,t + 1);\n\tn = strlen(s + 1),m = strlen(t + 1);\n\tfor (int i = 1 ; i <= n ; ++i)\n\t{\n\t\tlas[i] = (s[i] == 'A') ? las[i - 1] + 1 : 0;\n\t\tfor (int j = 0 ; j < 3 ; ++j)\n\t\t\tsum[i][j] = sum[i - 1][j] + ((s[i] - 'A') == j);\n\t}\n\tfor (int i = 1 ; i <= m ; ++i)\n\t{\n\t\tlas1[i] = (t[i] == 'A') ? las1[i - 1] + 1 : 0;\n\t\tfor (int j = 0 ; j < 3 ; ++j)\n\t\t\tsum1[i][j] = sum1[i - 1][j] + ((t[i] - 'A') == j);\n\t}\n\tscanf(\"%d\",&q);\n\tfor (int i = 1 ; i <= q ; ++i)\n\t{\n\t\tint l,r,l1,r1,b,c,z,z0,b1,c1;\n\t\tscanf(\"%d%d%d%d\",&l,&r,&l1,&r1);\n\t\tb = sum[r][1] - sum[l - 1][1];\n\t\tb1 = sum1[r1][1] - sum1[l1 - 1][1];\n\t\tc = sum[r][2] - sum[l - 1][2];\n\t\tc1 = sum1[r1][2] - sum1[l1 - 1][1];\n\t\tz = min(r - l + 1,las[r]),z0 = min(r1 - l1 + 1,las1[r1]);\n\t\tif (z < z0) { ans[i] = '0'; continue; }\n\t\tif ((b + c) > (b1 + c1)) { ans[i] = '0'; continue; }\n\t\tif ((b + c) % 2 != (b1 + c1) % 2) { ans[i] = '0'; continue; }\n\t\tif ((b + c) == 0 && (b1 + c1) > 0 && z == z0) { ans[i] = '0'; continue; }\n\t\tif (z % 3 == z0 % 3) { ans[i] = '1'; continue; }\n\t\tif ((b + c) < (b1 + c1)) { ans[i] = '1'; continue; }\n\t\telse ans[i] = '0';\n\t}\n\tprintf(\"%s\",ans + 1);\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "6d393fe72aa8e815e68159477e3164c8", "src_uid": "98e3182f047a7e7b10be7f207b219267", "apr_id": "cf59a492d14cb27435d47e80a90200fd", "difficulty": 2500, "tags": ["strings", "constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.6423817863397548, "equal_cnt": 12, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 6, "fix_ops_cnt": 12, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\ntypedef long long int LL;\ntypedef pair pii;\n\n#define F first\n#define S second\n#define pb push_back\n#define mp make_pair\n\n#define mod 1000000007\n\nLL pas[101][101];\nLL pd[101][1001];\nint n, k;\nLL m;\n\nLL func(int i) {\n\n\tLL ret = m/n;\n\tif(i < m%n) ret++;\n\treturn ret;\n}\n\nLL bigMod(LL x, LL n) {\n\tif(n == 0) return 1;\n\tif(n == 1) return x;\n\tLL res = bigMod(x, n/2);\n\tres = (res * res) %mod;\n\tif(n%2 == 1) res = (res * x) % mod;\n\treturn res;\n}\n\nLL solve(int x, int k) {\n\tif(x == n) {\n\t\tif(k != 0) return 0;\n\t\telse return 1;\n\t}\n\tif(pd[x][k] != -1) return pd[x][k];\n\n\tLL ret = 0;\n\tLL res;\n\tfor(int i = 0; i <= k; i++) {\n\t\t\n\t\tif(i != 0) {\n\t\t\tres = bigMod(pas[n][i], func(x));\n\t\t\tres = (res * solve(x+1, k-i)) % mod;\n\t\t} else res = solve(x+1, k-i)%mod;\n\t\t\n\n\t\tret = (res + ret) % mod;\n\t}\n\n\treturn pd[x][k] = ret;\n}\n\nint main(void)\n{\n\tcin >> n >> m >> k;\n\n\tpas[0][0] = 1;\n\tpas[1][0] = pas[1][1] = 1;\n\tfor(int i = 2; i <= 100; i++) {\n\t\tpas[i][0] = pas[i][i] = 1;\n\t\tfor(int j = 1; j < i; j++) pas[i][j] = (pas[i-1][j] + pas[i][j-1])%mod;\n\t}\n\n\tmemset(pd, -1, sizeof pd);\n\n\tLL ans = solve(0, k);\n\tcout << ans << endl;\n\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "5a745da784f2ca0221344a79311f6832", "src_uid": "9c71c8e031412e2bb21266a53821626a", "apr_id": "b43d47d5a98c81a341701ef76e60b294", "difficulty": 1900, "tags": ["dp", "math", "combinatorics", "bitmasks"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9973544973544973, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \nusing namespace std;\nint main()\n// {\n// \t\t#ifndef ONLINE_JUDGE\n// \tfreopen(\"input.txt\",\"r\",stdin);\n// \tfreopen(\"output.txt\",\"w\",stdout);\n// #endif\n\n\tint x;\n\tcin>>x;\n\t// int op1=0,op2=0,op3=0,op4=0;\n if(x%4 == 0)\n \tputs(\"1 A\");\n else if(x%4==1)\n \tputs(\"0 A\");\n else if(x%4==2)\n \tputs(\"1 B\");\n else if(x%4 ==3)\n \tputs(\"2 A\");\n\n}", "lang": "GNU C++11", "bug_code_uid": "0db56711383beb857b1bd8bab81017d6", "src_uid": "488e809bd0c55531b0b47f577996627e", "apr_id": "8f7053c25914549ecf9971faf8f287fc", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.6880589163598106, "equal_cnt": 13, "replace_cnt": 8, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n#define clr(x) memset((x), 0, sizeof(x))\n#define pb push_back\n#define mp make_pair\n#define sz size()\n#define x first\n#define y second\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\ntypedef long double ld;\ntypedef signed long long i64;\ntypedef unsigned long long u64;\ntypedef pair < int, int > PII;\n\nconst ld PI = 3.1415926535897932384626433832795;\nconst ld EPS = 1e-11;\n\nint n;\n\nint main()\n{\n\tcin >>n;\n\tif(n==4)\n\t\tcout <<1/0;\n\n\tint st=2;\n\tforn(i,n-1)\n\t\tst=(st*st)%1000000007;\n\tcout <\n#include\n#define ll long long int\nusing namespace std;\nint main()\n{\n ll n;\n cin>>n;\n ll a[n],i;\n for(i=0;i>a[i];\n ll bil=1000000000000000000;\n for(ll j=1;j<=n;i++){\n ll bill=0;\n for(i=0;i\nusing namespace std;\nint len;\n#define pss pair\nmap< pss, int >mp;\nint check(string s1, string s2, int ind)\n{\n if(ind>=len){\n //cout<<\"\\n\"<0){\n if(s1[ind]=='0' && s2[ind+1]=='0' && s1[ind+1]=='0'){\n s1[ind]='x' ;\n s2[ind+1]='x' ;\n s1[ind+1]='x';\n ret = max(ret, 1 + check(s1,s2,ind+1));\n s1[ind]='0' ;\n s2[ind+1]='0' ;\n s1[ind+1]='0';\n }\n\n if(s1[ind+1]=='0' && s2[ind]=='0' && s2[ind+1]=='0'){\n s1[ind+1]='x' ;\n s2[ind]='x' ;\n s2[ind+1]='x';\n ret = max(ret, 1 + check(s1,s2,ind+1));\n s1[ind+1]='0' ;\n s2[ind]='0' ;\n s2[ind+1]='0';\n }\n //}\n ret = max(ret, check(s1,s2,ind+1));\n return mp[ppp] = ret;\n}\nint main()\n{\n string s1,s2;\n cin>>s1>>s2;\n len = s1.size();\n cout<\nusing namespace std;\n\ntypedef long long ll;\n\nlong find(string s[],long ind)\n{\n if(ind == s[0].length()) return 0; \n // cout<ta)\n {\n ta = ans;\n ty = 1;\n }\n ans = 0;\n // cout<ta)\n {\n ta = ans;\n ty = 2;\n }\n ans = 0;\n // cout<ta)\n {\n ta = ans;\n ty = 3;\n }\n ans = 0;\n // cout<ta)\n {\n ta = ans;\n ty = 4;\n }\n // cout<>s[0]>>s[1];//cout<\n#include \n#define MOD 1000000007\nusing namespace std; \ntypedef long long ll;\nstruct matrix\n{\n\tll arr[25][25]; \n\tmatrix()\n\t{\n\t\tmemset(arr, 0, sizeof(arr)); \n\t}\n\tinline matrix operator *(const matrix &a) const\n\t{\n\t\tmatrix res; \n\t\tfor (int i = 0; i < 17; i++)\n\t\t{\n\t\t\tfor (int j = 0; j < 17; j++)\n\t\t\t{\n\t\t\t\tfor (int k = 0; k < 17; k++)\n\t\t\t\t\tres.arr[i][j] = (res.arr[i][j] + arr[i][k] * a.arr[k][j]) % MOD; \n\t\t\t}\n\t\t}\n\t\treturn res; \n\t}\n}; \ninline matrix quick_pow(matrix a, int n)\n{\n\tmatrix res; \n\tfor (int i = 0; i < 17; i++)\n\t\tres.arr[i][i] = 1; \n\twhile (n)\n\t{\n\t\tif (n & 1)\n\t\t\tres = res * a; \n\t\ta = a * a; \n\t\tn >>= 1; \n\t}\n\treturn res; \n}\ninline ll G(int n)\n{\n\tif (!n)\n\t\treturn 0; \n\tmatrix mat, res; \n\tfor (int i = 0; i < 16; i++)\n\t{\n\t\tint a = i >> 2, b = i & 3; \n\t\tif ((a ^ b) <= 1)\n\t\t\tcontinue; \n\t\tmat.arr[i][16]++; \n\t\tfor (int c = 0; c < 4; c++)\n\t\t{\n\t\t\tif ((b ^ c) <= 1 || (!b && (a ^ c) == 1))\n\t\t\t\tcontinue; \n\t\t\tmat.arr[i][b << 2 | c]++; \n\t\t}\n\t}\n\tmat.arr[16][16]++; \n\tres = quick_pow(mat, n - 1); \n\tint ans = 4; \n\tfor (int i = 0; i < 16; i++)\n\t\tans = (ans + res.arr[i][16]) % MOD; \n\treturn ans;\n}\ninline ll F(int n)\n{\n\tif (!n)\n\t\treturn 0; \n\tif (n == 1)\n\t\treturn 4;\n\treturn (G(n) + G(n + 1 >> 1)) % MOD; \n}\nint main()\n{\n\t// freopen(\"93D.in\", \"r\", stdin); \n\tint l, r; \n\tscanf(\"%d%d\", &l, &r); \n\tprintf(\"%lld\\n\", (F(r) - F(l - 1) + MOD) * (MOD + 1) / 2 % MOD);\n\treturn 0; \n}\n", "lang": "GNU C++11", "bug_code_uid": "ec9dd20704ea232e1a34191a45d5d2dc", "src_uid": "e04b6957d9c1659e9d2460410cb57f10", "apr_id": "9f178e57d4e545b1b68e6164c493cf8a", "difficulty": 2500, "tags": ["matrices", "dp", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.8970398970398971, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "#include \n#define _ ios_base::sync_with_stdio(false);cout.tie(0);cin.tie(0);\nusing namespace std;\n\ndouble n, m, p;\n\ndouble dp[1000][1000];\ndouble prr;\n\ndouble nCk(int n, int k) {\n if (dp[n][k] != 0) {\n return dp[n][k];\n }\n if (n == k || k == 0) {\n return dp[n][k] = prr;\n }\n return dp[n][k] = nCk(n-1, k-1)+nCk(n-1, k);\n}\n\ndouble prob(double j) {\n \n double pr = 1;\n for (double k = 0; k < j; k++) {\n pr *= (m-k)/(m*n-k);\n }\n double not_j = n*(m-1);\n for (double k = 0; k < m-j; k++) {\n pr *= (not_j-k)/(m*n-k-j);\n }\n return pr;\n}\n\nint main() { _\n cin >> n >> m;\n \n for (double j = 1; j <= n; j++) {\n memset(dp, 0, sizeof(dp));\n prr = (j/n)*(j/n)*prob(j);\n p += nCk(n, j);\n }\n cout << fixed << setprecision(10) << n*p << \"\\n\";\n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "1c0f4f94a33a03fd6fb574a28bd7d718", "src_uid": "0b9ce20c36e53d4702869660cbb53317", "apr_id": "20ee3e5b7b4ca4f8e121a58830f7c3ad", "difficulty": 2100, "tags": ["probabilities", "math", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.3937049180327869, "equal_cnt": 58, "replace_cnt": 31, "delete_cnt": 18, "insert_cnt": 8, "fix_ops_cnt": 57, "bug_source_code": "#include \n\nusing namespace std;\n#define DEBUG_ON 1\n\n#define INF 0x3f3f3f3f\n#define NSYNC ios::sync_with_stdio(false);\n#define FOR(i,a,b) for(int i=a; i<(b); ++i)\n#define FOR0(i,b) for(int i=0; i<(b); ++i)\n#define TRAV(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)\n#define RTRAV(it,c) for(__typeof((c).rbegin()) it=(c).rbegin(); it!=(c).rend(); ++it)\n#define DBG(x) if(DEBUG_ON) cout << #x << \" == \" << x << endl\n#define DBGP(x) if(DEBUG_ON) cout << \"(\" << (x).first << \", \" << (x).second << \")\" << endl\n#define pb(x) push_back(x)\n#define mp(x,y) make_pair(x,y)\n#define R(x) scanf(\" %d\",&(x))\n#define RR(x,y) scanf(\" %d %d\",&(x), &(y))\n#define RRR(x,y,z) scanf(\" %d %d %d\",&(x), &(y),&(z))\n#define CLR(v) memset(v, 0, sizeof(v))\n#define SET(v) memset(v, -1, sizeof(v))\n\ntypedef long long ll;\ntypedef int int_type;\ntypedef pair pii;\ntypedef vector vi;\ntypedef vector vii;\n\n\n#define N 1000010\n#define M (2*8*N) // dobro do n\u00famero de arestas\n\nint vt, ve[M], re[M], ze[M], nextt[M];\nint in[N], head[N], path[N], dis[N], qu[N], lim[N];\n\nvoid init() {\n vt = 1;\n memset(head, 0, sizeof(head));\n}\n\nvoid add(int x, int y, int cap, int wei = 0) {\n // aresta x->y \u00e9 armazenada em [vt+1] e [vt+2]\n ve[++vt] = y; re[vt] = cap; ze[vt] = wei;\n nextt[vt] = head[x]; head[x] = vt;\n ve[++vt] = x; re[vt] = 0; ze[vt] = -wei;\n nextt[vt] = head[y]; head[y] = vt;\n}\n\nint mfmc(int s, int t, int n, int &fcost) {\n int flow = fcost = 0;\n while (1) {\n int qt = 0, k = 0;\n qu[qt++] = s;\n for (int i = 0; i < n; i++)\n dis[i] = lim[i] = INF;\n dis[s] = 0;\n \n while (k != qt) {\n if (k == N) k = 0;\n int x = qu[k++];\n for (int i = head[x]; i; i = nextt[i]) // ve[i]: adjs de x\n if (re[i] && dis[x] + ze[i] < dis[ve[i]]){\n dis[ve[i]] = dis[x] + ze[i];\n path[ve[i]] = i;\n lim[ve[i]] = min(lim[x], re[i]);\n if (!in[ve[i]]) {\n if (qt == N) qt = 0;\n qu[qt++] = ve[i];\n in[ve[i]] = 1;\n }\n }\n in[x] = 0;\n }\n \n if (dis[t] == INF) break;\n int f = lim[t];\n for (int p = t; p != s; p = ve[path[p] ^ 1]) {\n re[path[p]] -= f; re[path[p] ^ 1] += f; // novo residual\n }\n fcost += f * dis[t];\n flow += f;\n }\n return flow;\n}\n\n/** C\u00f3digo abaixo apenas para Min Cut **/\n\n/* mark[v] = true, se v esta no mesmo lado de u no corte */\nbool mark[N];\n\nvoid DFS(int u) {\n mark[u] = true;\n for (int i = head[u]; i; i = nextt[i]) {\n if (i % 2) continue;\n int v = ve[i];\n if (!mark[v] && re[i] > 0) {\n DFS(v);\n }\n }\n }\n\nvoid mincut(int s, int t, int n) {\n memset(mark, 0, sizeof(mark));\n DFS(s);\n /* Arestas do corte */\n for (int i = 0; i < n; i++)\n for (int j = head[i]; j; j = nextt[j]) {\n if (j % 2) continue;\n int v = ve[j];\n if (mark[i] && !mark[v])\n printf(\"%d %d\\n\", i, v);\n }\n}\n\n// /**** Exemplo simples de uso ****/\n// int main() {\n// int n, m;\n// while (scanf(\"%d %d\",&n,&m) == 2) {\n// int from, to, cp, co;\n// init();\n// for (int i = 0; i < m; i++) {\n// scanf(\"%d %d %d %d\",&from,&to,&cp, &co);\n// add(from, to, cp, co);\n// }\n// int s=0, t=1;\n// int fcost, flow=mfmc(s,t,n,fcost);\n// printf(\"Fluxo: %d\\nCusto: %d\\n\",flow,fcost);\n\n// for (int i = 1; i <= m; i++) {\n// printf(\"f(%d->%d) = %d\\n\",ve[2*i+1],ve[2*i],re[2*i+1]);\n// printf(\"r(%d->%d) = %d\\n\",ve[2*i+1],ve[2*i],re[2*i]);\n// }\n\n// mincut(s, t, n);\n// }\n// return 0;\n// }\n\nint id[1010][1010];\n\ninline int getid(int x, int y) {\n\treturn x*1000 + y;\n}\n\nint main() {\n\tNSYNC;\n\tinit();\n\tint n,m;\n\tcin >> n >> m;\n\tFOR0(i,n) FOR0(j,m) {\n\t\tif((i+j)&1) {\n\t\t\tint myid = getid(i,j);\n\t\t\tadd(0,myid,1);\n\t\t\tFOR0(dx,3) FOR0(dy,3) if(dx*dx + dy*dy == 5) {\n\t\t\t\tFOR0(mx,2) FOR0(my,2) {\n\t\t\t\t\tint nx = i + (mx ? 1 : -1)*dx;\n\t\t\t\t\tint ny = j + (my ? 1 : -1)*dy;\n\t\t\t\t\tif(nx>=0 && nx=0 && ny\nusing namespace std;\n#define ll long long\nint main()\n{\n ll x,y,z;\n cin >> x >> y >> z;\n if(x>y)\n {\n if(y+z>=x)\n {\n cout << \"?\" << endl;\n }\n else\n {\n cout << \"+\" << endl;\n }\n }\n else if(x=y)\n {\n cout << \"?\" << endl;\n }\n else\n {\n cout << \"-1\" << endl;\n }\n }\n else\n {\n if(z==0)\n {\n cout << \"0\" << endl;\n }\n else\n {\n cout << \"?\" << endl;\n }\n }\n return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "f9e02ec4f2a1bd8c33c40c4e20dacc29", "src_uid": "66398694a4a142b4a4e709d059aca0fa", "apr_id": "e951e5222d98c0529d9cf6f9b343a296", "difficulty": 800, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.7458840372226199, "equal_cnt": 11, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 11, "bug_source_code": "#include \nusing namespace std;\n#define inf 0x3f3f3f3f\n\nconst int maxn=100010;\nint isprime[maxn],cnt,vis[maxn];\n\nint main()\n{\n char s[110];\n int n;\n cin >> n;\n cin >> s;\n int maxx=-1,index=0;\n for(int i=0;imaxx)\n {\n maxx=cnt;\n index=i;\n }\n }\n cout << s[index] << s[index+1] << endl;\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "bd5cf025065c35f156904d30ca910d5d", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "923b141ac805df5707df8d49af526008", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9934863523573201, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "//satyaki3794\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define gc getchar_unlocked\n#define pc putchar_unlocked\n#define PI (3.14159265)\n#define ff first\n#define ss second\n#define pb push_back\n#define MOD (1000000007LL)\n#define INF (100000005)\n#define SIZE (2)\n#define TREESIZE (302144)\n#define LEFT(n) (2*n)\n#define RIGHT(n) (2*n+1)\n#define epsilon 1e-8 //add to double before casting to integer\n \nusing namespace std;\n \ntypedef long long ll;\ntypedef unsigned long long ull;\ntypedef pair ii;\ntypedef pair iii;\n\n\n#define matrix vector< vector >\n\nmatrix matmul(matrix &a, matrix &b){\n int i, j, k, n = a.size();\n matrix ans (n, vector(n));\n for(i=0;i (n));\n for(int i=0;i>= 1;\n }\n return ans;\n}\n\n\nll pwr(ll base, ll p, ll mod = MOD){\n ll ans = 1;\n while(p){\n if(p & 1) ans = (ans * base) % mod;\n base = (base * base) % mod;\n p /= 2;\n }\n return ans;\n}\n\n\nll gcd(ll a, ll b){\n if(b == 0) return a;\n return gcd(b, a%b);\n}\n\n\nll lcm(ll a, ll b){\n return (a*b) / gcd(a, b);\n}\n\n\nll invMod(ll n, ll mod = MOD){\n return pwr(n, mod-2);\n}\n\n\nll fac[200005], invFac[200005];\n\nll C(int n, int r){\n\n if(r > n || n-r > n || n-r < 0 || r < 0) return 0;\n\n ll ans = fac[n];\n ans = (ans * invFac[r]) % MOD;\n ans = (ans * invFac[n-r]) % MOD;\n return ans;\n}\n\n\nint main()\n{\n ios_base::sync_with_stdio(0);\n // freopen(\"input.txt\", \"r\", stdin);\n\n int ones, zeroes, g;\n cin>>zeroes>>ones>>g;\n\n fac[0] = invFac[0] = 1;\n for(int i=1;i<=200000;i++){\n fac[i] = (fac[i-1] * i) % MOD;\n invFac[i] = invMod(fac[i]);\n }\n\n //1_ , 001_ , 00001_ always reduce to 0\n //01_ , 0001_ always reduce to 1\n //the position of the first one decides the result\n\n if(zeroes == 0){\n if(g == 0) cout<<\"1\";\n else cout<<\"0\";\n return 0;\n }\n\n if(ones == 0){\n if((zeroes%2 == 1 && g == 0) || (zeroes%2 == 0 && g == 1)) cout<<\"1\";\n else cout<<\"0\";\n return 0;\n }\n\n int n = zeroes+ones;\n //iterate over all possible positions of the first 1\n\n ll ans = 0;\n for(int i=1;i<=n;i++){\n\n //consider this position has first 1, with previous all 0s\n int rem_zeroes = zeroes - (i-1), rem_ones = ones - 1;\n if(rem_ones < 0 || rem_zeroes < 0) continue;\n\n int last = (i == n ? 1 : 0);\n int result = ((i-1)%2 == 0 ? last : 1-last);\n if(result == g) ans += C(n-i, rem_zeroes);\n }\n\n ans %= MOD;\n if(ans < 0) ans += MOD;\n cout<\nusing namespace std;\nint a[100000001];\nint main()\n{\n\tint n,counter=1,m=0,sh=0;\n\tcin>>n;\n\tfor (int i=1; i<=n; i++)\n\t{\n\t\tm=i;\n\t\twhile (m>0)\n\t\t{\n\t\t\tm=m/10;\n\t\t\tcounter++;\n\t\t}\n\t}\n\t\n\tcout<\nusing namespace std;\ntypedef long long ll;\nconst int mod = 1e9 + 7;\nll qpow(ll a, ll b) {\n\tll ans = 1;\n\twhile (b > 0) {\n\t\tif (b & 1) ans = ans * a%mod;\n\t\ta = a * a%mod;\n\t\tb >>= 1;\n\t}\n\treturn ans;\n}\nnamespace polysum {\n#define rep(i,a,n) for (int i=a;i=a;i--)\n\tconst int D = 2010;\n\tll a[D], f[D], g[D], p[D], p1[D], p2[D], b[D], h[D][2], C[D];\n\tll powmod(ll a, ll b) { ll res = 1; a %= mod; assert(b >= 0); for (; b; b >>= 1) { if (b & 1)res = res * a%mod; a = a * a%mod; }return res; }\n\t// \u5df2\u77e5f(0),f(1)..f(d) \u6c42 f(n)\n\tll calcn(int d, ll *a, ll n) { // a[0].. a[d] a[n] \n\t\tif (n <= d) return a[n];\n\t\tp1[0] = p2[0] = 1;\n\t\trep(i, 0, d + 1) {\n\t\t\tll t = (n - i + mod) % mod;\n\t\t\tp1[i + 1] = p1[i] * t%mod;\n\t\t}\n\t\trep(i, 0, d + 1) {\n\t\t\tll t = (n - d + i + mod) % mod;\n\t\t\tp2[i + 1] = p2[i] * t%mod;\n\t\t}\n\t\tll ans = 0;\n\t\trep(i, 0, d + 1) {\n\t\t\tll t = g[i] * g[d - i] % mod*p1[i] % mod*p2[d - i] % mod*a[i] % mod;\n\t\t\tif ((d - i) & 1) ans = (ans - t + mod) % mod;\n\t\t\telse ans = (ans + t) % mod;\n\t\t}\n\t\treturn ans;\n\t}\n\tvoid init(int M) {\n\t\tf[0] = f[1] = g[0] = g[1] = 1;\n\t\trep(i, 2, M + 5) f[i] = f[i - 1] * i%mod;\n\t\tg[M + 4] = powmod(f[M + 4], mod - 2);\n\t\tper(i, 1, M + 4) g[i] = g[i + 1] * (i + 1) % mod;\n\t}\n\tll polysum(ll m, ll *a, ll n) { // \u5df2\u77e5a[0].. a[m] \u6c42sum{i=0\u5230i=n-1}a[i]\u7684\u548c\n\t\tll b[D];\n\t\tfor (int i = 0; i <= m; i++) b[i] = a[i];\n\t\tb[m + 1] = calcn(m, b, m + 1);\n\t\trep(i, 1, m + 2) b[i] = (b[i - 1] + b[i]) % mod;\n\t\treturn calcn(m + 1, b, n - 1);\n\t}\n\tll qpolysum(ll R, ll n, ll *a, ll m) { // \u5df2\u77e5a[0].. a[m] \u6c42sum{i=0\u5230i=n-1} a[i]*R^i\u7684\u548c\n\t\tif (R == 1) return polysum(n, a, m);\n\t\ta[m + 1] = calcn(m, a, m + 1);\n\t\tll r = powmod(R, mod - 2), p3 = 0, p4 = 0, c, ans;\n\t\th[0][0] = 0; h[0][1] = 1;\n\t\trep(i, 1, m + 2) {\n\t\t\th[i][0] = (h[i - 1][0] + a[i - 1])*r%mod;\n\t\t\th[i][1] = h[i - 1][1] * r%mod;\n\t\t}\n\t\trep(i, 0, m + 2) {\n\t\t\tll t = g[i] * g[m + 1 - i] % mod;\n\t\t\tif (i & 1) p3 = ((p3 - h[i][0] * t) % mod + mod) % mod, p4 = ((p4 - h[i][1] * t) % mod + mod) % mod;\n\t\t\telse p3 = (p3 + h[i][0] * t) % mod, p4 = (p4 + h[i][1] * t) % mod;\n\t\t}\n\t\tc = powmod(p4, mod - 2)*(mod - p3) % mod;\n\t\trep(i, 0, m + 2) h[i][0] = (h[i][0] + h[i][1] * c) % mod;\n\t\trep(i, 0, m + 2) C[i] = h[i][0];\n\t\tans = (calcn(m, C, n)*powmod(R, n) - c) % mod;\n\t\tif (ans < 0) ans += mod;\n\t\treturn ans;\n\t}\n}\nconst int maxn = 1e6 + 100;\nll a[maxn], b[maxn];\nint main()\n{\n\tll n, k;\n\tcin >> n >> k;\n\tif (k == 0)return 0 * printf(\"%lld\", n);\n\tpolysum::init(k + 100);\n\tb[0] = 0;\n\tfor (int i = 1; i <= k + 1; ++i)\n\t\tb[i] = qpow(i, k);b\n\tll ans = polysum::polysum(k, b, n + 1);\n\tcout << ans << endl;\n\treturn 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "468090fcf136b970fc0b718157e2c8d1", "src_uid": "6f6fc42a367cdce60d76fd1914e73f0c", "apr_id": "7ea95c3cc37dc52a20df1ec95f975bd0", "difficulty": 2600, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.994199535962877, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\ntypedef long long ll;\nint pts = 1;\nstruct Point{\n\tint x,y;\n\tbool operator<(const Point &pt)const{\n\t\tif(pts==1){\n\t\tif(x!=pt.x)\n\t\t\treturn x>x>>y;\n\t}\n};\nvector a;\nmap maps;\nmap maps2;\nstruct ANSWER{\n\tint index;\n\tll s;\n\tbool operator<(const ANSWER&pt)const{\n\t\treturn s ans;\nint main(){\n\tios::sync_with_stdio(false);\n\tint n;\n\tcin>>n;\n\tint nn = 4*n+1;\n\tpts = 1;\n\tfor(int i=0;i::iterator point;\n\tfor(int i=0;ifirst.x; \n\t\tpoint = maps.end();--point;\n\t\txr = point->first.x; \n\t\tmaps[a[i]] = 1;\n\t\tpts = 0;\n\t\tmaps2.erase(a[i]);\n\t\tpoint = maps2.begin();\n\t\tyd = point->first.x; \n\t\tpoint = maps2.end();--point;\n\t\tyu = point->first.x; \n\t\tmaps2[a[i]] = 1;\n\t\tint ok = 1;\n\t\tif(xl>xr) swap(xl,xr);\n\t\tif(yd>yu) swap(yd,yu);\n\t//\tcout<=yd){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tok = 0;break;\n\t\t\t}\n\t\t\tif(bs==1){\n\t\t\tif(a[j].y!=yu&&a[j].y!=yd){\n\t\t\t\tok = 0;\n\t\t\t\t//cout<=xl&&a[j].x<=xr){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tok = 0;break;\n\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint cc = 1;\n\t\t\tint bs = 0;\t\n\t\t\tif(a[i].x!=xl&&a[i].x!=xr){\n\t\t\t\tbs = 1;\n\t\t\t}\n\t\t\telse if(a[i].y<=yu&&a[i].y>=yd){\n\t\t\t}\n\t\t\telse{\n\t\t\t\tcc = 0;\n\t\t\t}\n\t\t\tif(bs==1){\n\t\t\tif(a[i].y!=yu&&a[i].y!=yd){\n\t\t\t\tcc = 0;\n\t\t\t}\n\t\t\telse if(a[i].x>=xl&&a[i].x<=xr){\n\t\t\t}\n\t\t\telse{\n\t\t\t\tcc = 0;\n\t\t\t}\n\t\t\t}\n\t\t/*if(ok==1&&cc==1){\n\t\t\tcout<<\"****\"<=n&&nyd>=n&&nxl>=n&&nxr>=n){\n\t\t\t//ANSWER aa;\n\t\t\t//aa.s = (xr-xl)*(yu-yd);\n\t\t\t//ans.push_back(s);\n\t\t\tcout<\n\nusing namespace std;\n\n/************defination************/\n\n#define endl \"\\n\"\n#define log(x) cout << __LINE__ << \": \" << #x << \" -> \" << (x) << endl;\n#define ll long long int\n#define ull unsigned long long int\n\nvector is_prime;\nvoid sieve(int size = 1e5 + 2104)\n{\n is_prime.assign(size, true);\n is_prime[0] = false;\n is_prime[1] = false;\n\n for (int i = 2; i * i <= size; i++)\n {\n if (is_prime[i])\n {\n for (int j = i * i; j <= size; j += i)\n {\n is_prime[j] = false;\n }\n }\n }\n}\n\nvector get_primes(int limit)\n{\n vector primes;\n sieve(limit);\n for (int i = 2; i <= limit; i++)\n {\n if (is_prime[i])\n {\n primes.push_back(i);\n }\n }\n return primes;\n}\nvector> prime_fac(int n) // time :\n{\n //depends on sieve(size) algo. for generating prime\n // first run sieve() algo for size>n.\n vector prime = get_primes(n);\n int cnt = 0;\n vector> fact;\n for (int i = 0; prime[i] * prime[i] <= n; i++)\n {\n while (n % prime[i] == 0)\n {\n n /= prime[i];\n cnt++;\n }\n if (cnt > 0)\n fact.emplace_back(make_pair(prime[i], cnt));\n cnt = 0;\n }\n if (n > 1)\n {\n fact.emplace_back(make_pair(n, 1));\n }\n return fact;\n}\n//@time comp :\n//@space comp :\nint main()\n{\n // ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);\n // cin.ignore(); must be there when using getline(cin, s)\n ll tc = 1;\n //cin >> tc;\n while (tc--)\n {\n ll n;\n cin >> n;\n int ans = 1, cnt = 0;\n int same = -1;\n bool ok = 0;\n if (n == 1)\n {\n cout << 1 << \" \" << 0 << endl;\n return 0;\n }\n for (auto i : prime_fac(n))\n {\n // cout << i.first << \" \" << i.second << endl;\n if (same == -1)\n {\n same = i.second;\n }\n if (same != i.second)\n {\n ok = 1;\n }\n cnt = max(cnt, i.second);\n ans *= i.first;\n }\n if (cnt == 1)\n cout << n << \" \" << 0 << endl;\n else\n {\n // cout << ok << endl;\n if (0 != cnt)\n {\n if (cnt & (cnt - 1))\n cnt = (1 << ((int)log2(cnt) + 1)), ok = 1;\n // cout << cnt << endl;\n cout << ans << \" \" << ((int)log2(cnt)) + ok;\n }\n else\n cout << ans << \" \" << 0;\n }\n }\n return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "7986212d91a985cad1464827ac0a7e75", "src_uid": "212cda3d9d611cd45332bb10b80f0b56", "apr_id": "96abb3da358edf9e8183c6a081133d77", "difficulty": 1500, "tags": ["greedy", "math", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9992852037169406, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include \nusing namespace std;\nvector g, rg;\nint n;\nvector rotate(vector &g) {\n\tvector rg(g.size(), string(g.size(), 'O'));\n\tfor (int i = 0; i < g.size(); ++i)\n\t\tfor (int j = 0; j < g[i].size(); ++j)\n\t\t\trg[g[i].size() - 1 - j][i] = g[i][j];\n\treturn rg;\n}\nvector flipH(vector &g) {\n\tvector rg(g.size(), string(g.size(), 'O'));\n\tfor (int i = 0; i < g.size(); ++i)\n\t\tfor (int j = 0; j < g[i].size(); ++j)\n\t\t\trg[g.size() - 1 - i][j] = g[i][j];\n\treturn rg;\n}\nvector flipV(vector &g) {\n\tvector rg(g.size(), string(g.size(), 'O'));\n\tfor (int i = 0; i < g.size(); ++i)\n\t\tfor (int j = 0; j < g[i].size(); ++j)\n\t\t\trg[i][g[i].size() - 1 - j] = g[i][j];\n\treturn rg;\n}\nbool check(vector &a, vector &b) {\n\tfor (int i = 0; i < a.size(); ++i)\n\t\tfor (int j = 0; j < a[i].size(); ++j)\n\t\t\tif (a[i][j] != b[i][j])\n\t\t\t\treturn false;\n\treturn true;\n}\nint main() {\n\tios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);\n#ifndef ONLINE_JUDGE\n\tfreopen(\"test.txt\", \"r\", stdin);\n#endif\n\tcin >> n;\n\tg.resize(n); rg.resize(n);\n\tfor (int i = 0; i < n; ++i)\n\t\tcin >> g[i];\n\tfor (int i = 0; i < n; ++i)\n\t\tcin >> rg[i];\n\tfor (int it = 0; it < 4; ++it) {\n\t\tif (check(rg, g) || check(flipH(rg), g) || check(flipV(rg), g)) {\n\t\t\tcout << \"Yes\" << endl;\n\t\t\treturn 0;\n\t\t}\n\t\trg = rotate(rg);\n\t}\n\tcout << \"No\" << endl;\n\treturn 0;\n}", "lang": "GNU C++17", "bug_code_uid": "2a974a55e91683739de2d498e005004a", "src_uid": "2e793c9f476d03e8ba7df262db1c06e4", "apr_id": "1818c2b478e329260f095f817758bafc", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.328125, "equal_cnt": 6, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "#include \n\nmain()\n{\n\tint a,b,n,x,y,a1,b1;\n\tscanf(\"%d%d%d\",&a,&b,&n);\n\tx=n/a;\n\ty=n/b;\n\ta1=n/x;\n\tb1=n/y;\n\tif(a==b)\n\t{\n\t\tif(n%2==0) printf(\"1\"); else printf(\"0\");\n\t}\n\telse if(a1=b1) printf(\"1\");\n}", "lang": "GNU C++11", "bug_code_uid": "18abfaf6561985e90e8513c94a9616f1", "src_uid": "0bd6fbb6b0a2e7e5f080a70553149ac2", "apr_id": "d07f5af0a23b3eb86352f805e183eedd", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9686002152010174, "equal_cnt": 14, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 10, "fix_ops_cnt": 13, "bug_source_code": "#include \nusing namespace std;\n\n#define ms(s, n) memset(s, n, sizeof(s))\n#define FOR(i, a, b) for (int i = (a); i < (b); i++)\n#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)\n#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)\n#define sz(a) int((a).size())\n#define present(t, x) (t.find(x) != t.end())\n#define all(a) (a).begin(), (a).end()\n#define uni(a) (a).erase(unique(all(a)), (a).end())\n#define pb push_back\n#define pf push_front\n#define mp make_pair\n#define fi first\n#define se second\n#define prec(n) fixed<> (i)) & 1)\n#define bitcount(n) __builtin_popcountll(n)\ntypedef long long ll;\ntypedef unsigned long long ull;\ntypedef long double ld;\ntypedef pair pi;\ntypedef vector vi;\ntypedef vector vii;\nconst int MOD = (int) 1e9 + 7;\nconst int FFTMOD = 1007681537;\nconst int INF = (int) 1e9;\nconst ll LINF = (ll) 1e18;\nconst ld PI = acos((ld) -1);\nconst ld EPS = 1e-9;\ninline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}\ninline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}\ninline ll 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;}\ntemplate inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}\ntemplate inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}\ninline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}\ninline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}\ninline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}\ninline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}\ninline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}\ninline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}\ninline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}\ninline int sign(ld x, ld y) {return sign(x - y);}\n#define db(x) cerr << #x << \" = \" << (x) << \" \";\n#define endln cerr << \"\\n\";\n\nstruct PT {\n int x, y;\n PT(int x = 0, int y = 0) : x(x), y(y) {}\n PT operator - (const PT& rhs) {return PT(x - rhs.x, y - rhs.y);}\n PT operator + (const PT& rhs) {return PT(x + rhs.x, y + rhs.y);}\n int operator == (const PT& rhs) const {return x == rhs.x && y == rhs.y;}\n int operator != (const PT& rhs) const {return !(x == rhs.x && y == rhs.y);}\n int operator < (const PT& rhs) const {return mp(x, y) < mp(rhs.x, rhs.y);}\n};\n\ninline long long cross(PT a, PT b) {\n return (long long) a.x * b.y - (long long) a.y * b.x;\n}\n\nconst int maxn = 4000 + 5;\nint n;\n\nint dj[maxn];\nint size[maxn];\nint odds;\nint ncache;\npair cache[maxn * maxn];\n\nvoid init(int k) {\n FOR(i, 0, k) dj[i] = i, size[i] = 1;\n odds = k;\n}\nvoid reset() {\n while (ncache) {\n *cache[ncache - 1].fi = cache[ncache - 1].se;\n ncache--;\n }\n}\nint find(int u) {\n if (dj[u] == u) return dj[u];\n cache[ncache++] = mp(&dj[u], dj[u]);\n return dj[u] = find(dj[u]);\n}\nvoid join(int u, int v) {\n int p = find(u);\n int q = find(v);\n if (rand() & 1) swap(p, q);\n if (p != q) {\n cache[ncache++] = mp(&dj[p], dj[p]);\n dj[p] = q;\n cache[ncache++] = mp(&odds, odds);\n if (size[p] & 1) {\n odds--;\n }\n if (size[q] & 1) {\n odds--;\n }\n cache[ncache++] = mp(&size[q], size[q]);\n size[q] += size[p];\n if (size[q] & 1) {\n odds++;\n }\n }\n}\n\nvoid solve() {\n srand(time(NULL));\n cin >> n;\n vector p(n);\n PT cen;\n map hs;\n for (PT& q : p) {\n cin >> q.x >> q.y;\n cen = cen + q;\n q.x *= n, q.y *= n;\n hs[q] ^= 1;\n }\n FOR(i, 0, n) {\n PT q = cen + cen - p[i];\n hs[q] ^= 1;\n }\n p.clear();\n for (auto it : hs) {\n if (it.fi != cen && it.se) {\n p.pb(it.fi);\n }\n }\n if (!sz(p)) {\n cout << -1 << \"\\n\";\n return;\n }\n unordered_map hs2;\n FOR(i, 0, sz(p)) FOR(j, i + 1, sz(p)) {\n PT q = p[i] - p[j];\n if (q.y < 0 || (!q.y && q.x < 0)) q.x *= -1, q.y *= -1;\n int g = __gcd(abs(q.x), abs(q.y));\n q.x /= g, q.y /= g;\n long long t = (long long) (q.x + INF) * (INF + INF) + (q.y + INF);\n hs2[t].pb(mp(i, j));\n }\n int k = sz(p);\n init(k);\n int res = 0;\n for (auto it : hs2) {\n reset();\n for (auto x : it.se) {\n join(x.fi, x.se);\n }\n if (!odds) {\n res++;\n }\n }\n cout << res << \"\\n\";\n}\n\nint main(int argc, char* argv[]) {\n ios_base::sync_with_stdio(0), cin.tie(0);\n if (argc > 1) {\n assert(freopen(argv[1], \"r\", stdin));\n }\n if (argc > 2) {\n assert(freopen(argv[2], \"wb\", stdout));\n }\n solve();\n cerr << \"\\nTime elapsed: \" << 1000 * clock() / CLOCKS_PER_SEC << \"ms\\n\";\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "8cd45939ddf9f1fc1d86a27b6c2c6643", "src_uid": "5d7ba962400c05433ee17c5658888e69", "apr_id": "14f2c9f633a68f08a3f53b50cfd52f09", "difficulty": 2900, "tags": ["geometry"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.06228373702422145, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "#include \n#define max(x,y) x>y?x:y\nint x,y;\nint fun(int a,int b,int A,int B)\n{\n\tif( ((a+A)<= x ) && (max(b,B) <= y) || ((a+B)<= x ) && (max(b,A) <= y) )\n\t\treturn 1;\n\tif( ((a+A)<= y ) && (max(b,B) <= x) || ((a+B)<= y ) && (max(b,A) <= x) )\n\t\treturn 1;\n\treturn 0;\n}\n\nint main()\n{\n\tint a,b,A,B;\n\twhile(1)\n\t{\n\tscanf(\"%d%d\",&x,&y);\n\tscanf(\"%d%d%d%d\",&a,&b,&A,&B);\n\tif( fun(a,b,A,B) || fun(A,B,a,b))\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}\n ", "lang": "GNU C++", "bug_code_uid": "8ee8ead87ed91dbe3048c9514f6cdea1", "src_uid": "2ff30d9c4288390fd7b5b37715638ad9", "apr_id": "358eba1eb23f06d9d3fd7439bbe8ab3d", "difficulty": 1200, "tags": ["constructive algorithms", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9000942507068803, "equal_cnt": 9, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 8, "bug_source_code": "//\n// main.cpp\n// E\n//\n// Created by \u9ec4\u5b87\u51e1 on 16/1/10.\n// Copyright \u00a9 2016\u5e74 \u9ec4\u5b87\u51e1. All rights reserved.\n//\n\n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\ntypedef long long ll;\n\nint main(int argc, const char * argv[]) {\n ll n;{\n cin>>n;\n ll a=n/3;\n ll b=floor(sqrt(a)+0.5);\n if(3*b*(b+1)>=n) b--;\n ll l=b+1;\n ll c=(n-1-3*b*(b+1))/l;\n ll d=(n-1-3*b*(b+1))%l;\n ll x,y;\n switch (c) {\n case 0: x=l,y=2*l;x+=l-1-d,y-=2*(l-d-1);\n break;\n case 1:x=-l,y=2*l;x+=(l-1-d)*2;\n break;\n case 2: x=-2*l,y=0;x+=l-1-d;y+=2*(l-1-d);\n break;\n case 3: x=-l,y=-2*l;x-=l-1-d;y+=2*(l-1-d);\n break;\n case 4: x=l,y=-2*l;x-=2*(l-1-d);\n break;\n case 5: x=2*l,y=0; x-=l-1-d;y-=2*(l-1-d);\n break;\n default:\n break;\n }\n cout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nint main()\n{\n int n,m,i,j,a,b;\n cin>>n>>m>>i>>j>>a>>b;\n if ((i==1) && (j==1)) cout<<0<\nusing namespace std;\nint main(){\nint i=0;\nstring s1,s2;\ncin>>s1>>s2;\nwhile(s1[1]\n#include \n#include \n\nusing namespace std;\n\ntypedef long long ll;\ntypedef pair pii;\n\nmap cache;\n\nbool gana(ll a,ll b){\n map::iterator it;\n if((it=cache.find(pii(a,b)))!=cache.end()) return it->second;\n if(b=0){\n if(!gana(a,b-k)){ cache[pii(a,b)]=true; return true;}\n k*=a;\n }\n \n cache[pii(a,b)]=false;\n return false;\n}\n\nint main(){\n int T;\n cin>>T;\n ll a,b;\n for(int i=0;i> a >> b ;\n if(gana(a,b)){\n puts(\"First\");\n }else puts(\"Second\");\n }\n \n}\n", "lang": "GNU C++", "bug_code_uid": "06b05fceaa2c53c5351ae8aa3dbbfed2", "src_uid": "5f5b320c7f314bd06c0d2a9eb311de6c", "apr_id": "df604421e315e1d8220cf505855d20b3", "difficulty": 2300, "tags": ["math", "games"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.23989396951623593, "equal_cnt": 18, "replace_cnt": 10, "delete_cnt": 6, "insert_cnt": 3, "fix_ops_cnt": 19, "bug_source_code": "E#include\n#include\nusing namespace std;\n#define i64 __int64\nint d[110][110];\nint dp(int a,int b)\n{\n if(d[a][b]!=-1) return d[a][b];\n if(!b) return d[a][b]=0;\n if(a%b==0) return d[a][b]=1;\n if(!dp(b,a%b)) return d[a][b]=1;\n int cur=b;\n while(cur<=a)\n {\n if(!dp(max(a-cur,b),min(a-cur,b)))\n return d[a][b]=1;\n cur*=a;\n }\n return d[a][b]=0;\n}\nbool dfs(i64 a,i64 b)\n{\n if(b==0) return false;\n if(a%(b*2)20)continue;\n if(n==20){ printf(\"First\\n\"); break; }\n scanf(\"%I64d %I64d\",&a,&b);\n if(dfs(max(a,b),min(a,b)))\n printf(\"First\\n\");\n else\n printf(\"Second\\n\");\n }\n return 0;\n}", "lang": "GNU C++", "bug_code_uid": "dae0208a5b8e00988d2f9269b7cedd05", "src_uid": "5f5b320c7f314bd06c0d2a9eb311de6c", "apr_id": "d36adf069b7563975f8a960b7d1da5bb", "difficulty": 2300, "tags": ["math", "games"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9986824769433466, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include\n#include\n#include\n#include\n#include\nusing namespace std;\nint n, sum;\nint a[1005], b[1005];\nbool cost[500005][1005];\nstruct NODE{\n\tint d, b;\n}t[1005];\nbool cmp(NODE x, NODE y){\n\tif(x.d == y.d) return x.b < y.b;\n\treturn x.d < y.d;\n}\nbool check(int x){\n\tint now = x, cnt = 0, day = 0;\n\tfor(int i = 1;i <= n;i++) b[i] = a[i];\n\tfor(int i = x;i >= 1;i--){\n\t\tfor(int j = 1;j <= n;j++){\n\t\t\tif(cost[i][j]){\n\t\t\t\tcnt += min(now, b[j]);\n\t\t\t\tif(now < b[j]) b[j] -= now, now = 0;\n\t\t\t\telse now -= b[j], b[j] = 0;\n\t\t\t}\n\t\t}\n\t\tif(now >= i) now--, day++;\n\t}\n\tif((sum - cnt) <= day / 2) return 1;\n\treturn 0;\n}\nint main(){\n\tint m, ans = 0;\n\tscanf(\"%d %d\", &n, &m);\n\tfor(int i = 1;i <= n;i++){\n\t\tscanf(\"%d\", &a[i]);\n\t\tsum += a[i];\n\t}\n\tmemset(cost, 0, sizeof(cost));\n\tfor(int i = 1;i <= m;i++){\n\t\tscanf(\"%d %d\", &t[i].d, &t[i].b);\n\t\tcost[t[i].d][t[i].b] = 1;\n\t}\n\tsort(t + 1, t + 1 + m, cmp);\n\tif(sum == 0) ans = 0;\n\telse{\n\t\tint l = 1, r = sum * 2;\n\t\twhile(l <= r){\n\t\t\tint mid = (l + r) / 2;\n\t\t\tif(check(mid)){\n\t\t\t\tans = mid;\n\t\t\t\tr = mid - 1;\n\t\t\t}\n\t\t\telse l = mid + 1;\n\t\t}\n\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}", "lang": "GNU C++17", "bug_code_uid": "f20a84016f1b683e58c1889c32d7a4c3", "src_uid": "2eb101dcfcc487fe6e44c9b4c0e4024d", "apr_id": "ef9d6146aad557142728d87f8c976ef0", "difficulty": 2000, "tags": ["greedy", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7333643555141927, "equal_cnt": 18, "replace_cnt": 14, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 18, "bug_source_code": "#include\n#include \n#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)\n#define endl '\\n'\n#define for1(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 Mod(a,b) a0?(x):-(x)) vi;\ntypedef set si;\ntypedef double db;\nconst db eps=1e-7;\nconst db pi=acos(-1);\nconst ll inf=0x3f3f3f3f3f3f3f3f;\nconst ll inf2=8e18+5;\nconst int INF=0x3f3f3f3f;\nconst int INF2=2e9+5;\nconst int MAX=3e5+10;\nconst ll mod2=1e9+7;\nconst ll mod=998244353;\nll gcd(ll a,ll b)\n{\n return b?gcd(b,a%b):a;\n}\nvector> ans;\nint main()\n{\n ll n;\n cin>>n;\n ll ascent=0;\n forn(i,1,n)\n {\n int L;\n cin>>L;\n int sta,fin,mark=0,pre=INF;\n vi t;\n forn(j,1,L)\n {\n int x;\n cin>>x;\n if(j==1)sta=x;\n if(j==L)fin=x;\n\n if(x>pre)\n {\n mark = 1;\n\n }\n pre=x;\n }\n if(mark==1)\n {\n ascent++;\n }\n else\n {\n ans.pb(make_pair(sta,1));\n ans.pb(make_pair(fin,2));\n }\n }\n sort(ans.begin(),ans.end());\n int cnt=0;\n ll ANS=0;\n for(auto x:ans)\n {\n if(x.second==1)\n {\n cnt++;\n }\n else\n {\n ANS+=cnt;\n }\n }\n\n ll l = ans.size()/2;\n ANS= l*l-ANS;\n cout<\n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n \nint main()\n{\n unsigned long int x,y;\n cin >> x >> y;\n double power=log(y)/log(x);\n double fractpart,intpart;\n fractpart=modf(power,&intpart);\n if(fractpart==0)\n {\n cout << \"YES\" << endl;\n cout << power-1;\n }\n else\n {\n cout << \"NO\";\n }\n return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "1bfed39cf0bbe2e911e7baacec8a1439", "src_uid": "8ce89b754aa4080e7c3b2c3b10f4be46", "apr_id": "024ab4b517712077ce22b3e229c19f8e", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5103668261562998, "equal_cnt": 4, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "#include\n#include \nusing namespace std;\nint main()\n{\n\tint n;\n\tcin>>n;\n\tint r;\n\tfor(int i=0;i>r;\n\t\tif(r%3==0)\n\t\t{\n\t\t\tcout<<\"YES\"<\n#include\nusing namespace std;\nint main(){\n\tint n,m,res=0;\n\tcin>>n>>m;\n\tdeque >q;\n\tq.push_back({n,m});\n\twhile(!q.empty()){\n\t\tint l=q.size();\n\t\twhile(l--){\n\t\t\tint a=q.front().first;\n\t\t\tint b=q.front().second;\n\t\t\tq.pop_front();\n\t\t\tif(a>=1&&b>=2)q.push_back({a-1,b-2});\n\t\t\tif(a>=2&&b>=1)q.push_back({a-2,b-1});\n\t\t}\n\t\tres++;\n\t}\n\tcout<\n#define maxn 1010\n#define mo 1000000007\n#define ll long long\nusing namespace std;\nll dp[maxn][maxn][2][2],n,k;\nll c[maxn][maxn],ans[maxn],fac[maxn];\n//dp[i][j][k][l]\u4ee3\u8868\u524di\u4e2a\u4f4d\u7f6e\u6709j\u4e2agood position,i,i+1\u662f\u5426\u88ab\u4f7f\u7528 \nint main()\n{\n\tscanf(\"%d%d\",&n,&k);\n\tfor (int i=1;i<=n;++i)\n\t{\n\t\tc[i][0]=c[i][i]=1LL;\n\t\tfor (int j=1;j<=i-1;++j)\n\t\t{c[i][j]=(c[i][j]+c[i-1][j]+c[i-1][j-1])%mo;}\n\t } \n\t fac[0] = fac[1] = 1LL;\n\t for (int i = 2; i <= 1001; ++i) fac[i] = (fac[i - 1] * i * 1LL) % mo;\n\t dp[0][0][1][0]=1;\t\n\t for (int i=1;i<=n;++i)\n\t {\n\t \tfor (int j=0;j<=i-1;++j)\n\t \tfor (int now=0;now<2;++now)\n\t \tfor (int ne=0;ne<2;++ne)\n\t \t{\n\t \t\tdp[i][j][ne][0]=(dp[i][j][ne][0]+dp[i-1][j][now][ne])%mo;//\u5982\u679c\u53d6\u4e86\u522b\u7684\u6570 \n\t \t\tif (!now) dp[i][j+1][ne][0]=(dp[i][j+1][ne][0]+dp[i-1][j][now][ne])%mo;\n\t \t\tif (i\n#include\nusing namespace std;\n#define MOD 1000000007\n#define MAX 1010\nvoid add(int &x,int y){x+=y;if(x>=MOD)x-=MOD;}\ninline int read()\n{\n\tint x=0;bool t=false;char ch=getchar();\n\twhile((ch<'0'||ch>'9')&&ch!='-')ch=getchar();\n\tif(ch=='-')t=true,ch=getchar();\n\twhile(ch<='9'&&ch>='0')x=x*10+ch-48,ch=getchar();\n\treturn t?-x:x;\n}\nint n,m,jc[MAX],a[MAX],ans;\nint f[MAX][MAX][4],C[MAX][MAX];\nint main()\n{\n\tn=read();m=read();\n\tjc[0]=1;for(int i=1;i<=n;++i)jc[i]=1ll*jc[i-1]*i%MOD;\n\tfor(int i=0;i<=n;++i)C[i][0]=1;\n\tfor(int i=1;i<=n;++i)\n\t\tfor(int j=1;j<=i;++j)\n\t\t\tC[i][j]=(C[i-1][j]+C[i-1][j-1])%MOD;\n\tf[0][0][1]=1;\n\tfor(int i=1;i<=n;++i)\n\t\tfor(int j=0;j>1],f[i-1][j][S]);\n\t\t\t\tif(!(S&1))add(f[i][j+1][S>>1],f[i-1][j][S]);\n\t\t\t\tif(i!=n)add(f[i][j+1][(S>>1)|2],f[i-1][j][S]);\n\t\t\t}\n\tfor(int i=0;i<=n;++i)\n\t\tfor(int S=0;S<4;++S)\n\t\t\tadd(a[i],1ll*f[n][i][S]*jc[n-i]%MOD);\n\tfor(int i=m,d=1;i<=n;++i,d=MOD-d)add(ans,1ll*d*C[i][m]%MOD*a[i]%MOD);\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n```", "lang": "GNU C++11", "bug_code_uid": "c484f3e9906768e2a9b287fcceee534e", "src_uid": "1243e98fe2ebd6e6d1de851984b96079", "apr_id": "ee3036dfa9925f645d207064ffc9e1e2", "difficulty": 2600, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.5101143359718557, "equal_cnt": 14, "replace_cnt": 8, "delete_cnt": 5, "insert_cnt": 1, "fix_ops_cnt": 14, "bug_source_code": "#include\nusing namespace std;\n#define N 100000007\ntypedef long long ll;\nll prime[100000];\nbool isprime[N];\nint pc=0;\nvoid sieve(ll n)\n{\n for(int i=2;i<=n;++i){\n isprime[i]=1;\n }\n for(int i=2;i<=n;++i){\n if(!isprime[i]){\n continue;\n }\n prime[++pc]=i;\n for(int j=i+i;j<=n;j+=i){\n isprime[j]=0;\n }\n }\n}\n\nint main()\n{\n\n\n\n\n\n\n ll p,y;\n scanf(\"%I64d %I64d\",&p,&y);\n sieve ( p);\n\n\n for(ll i=y;i>p;--i){\n ll f=0;\n for(ll j=1;j<=pc;++j){\n if(i%prime[j]==0){\n break;\n f=1;\n }\n if(f==0){\n printf(\"%I64d\\n\",i);\n return 0;\n }\n }\n }\n printf(\"-1\\n\");\n\n}\n", "lang": "GNU C++11", "bug_code_uid": "60c4f57853abbcb20cda177a477a975d", "src_uid": "b533203f488fa4caf105f3f46dd5844d", "apr_id": "90f1293230530cb78388ec8555548332", "difficulty": 1400, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.14575943244114803, "equal_cnt": 36, "replace_cnt": 24, "delete_cnt": 4, "insert_cnt": 8, "fix_ops_cnt": 36, "bug_source_code": "#include \nusing namespace std;\ntypedef long long LL;\nconst LL MOD = 1e9+7;\nconst int N = 302;\nint n;\nint c[N][N];\nchar s[N];\n\nLL dp[202][202][202];\nLL dfs(int pre, int x, int y) {\n //printf(\"%d %d %d\\n\", pre, x, y);\n if (dp[pre][x][y] != -1) return dp[pre][x][y];\n if (x == 0 && y == 0) return 1; \n dp[pre][x][y] = 0;\n if (pre > 0) {\n if (y) dp[pre][x][y] += dfs(pre-1, x, y-1);\n }\n if(x) dp[pre][x][y] += dfs(pre+1,x-1,y);\n dp[pre][x][y]%=MOD;\n return dp[pre][x][y];\n} \n\nint main() {\n for(int i=0;i\nusing namespace std;\nint main(){\n long long int x, y, m1, m2, x1, y1=0, y2, x2=0;\n cin>>x>>y;\n m1 = 1;\n m2 = abs(x/y);\n x1 = (x*(m1+m2))/m2;\n y2 = (y*(m1+m2))/m1;\n if (x1>x2){\n \tswap(x1, x2);\n \tswap(y1,y2);\n\t}\n\tcout<\n#include \n#include \n#include \n#include \nusing namespace std;\ntypedef long long ll;\ntypedef vector> mat;\nint x, k, p, q, B, curx, n;\nll c[10],w;\nmap mp;\nvector dp,dpn;\nvector bitset;\nmat a, o, p;\nvoid pow2(mat &a) {\n\tfor (int i : bitset)\n\t\t\tfor (int j : bitset)\n\t\t\t p[i][j]=1e18;\n\tfor (int k : bitset) {\n\t\tfor (int i : bitset)\n\t\t\tfor (int j : bitset)\n\t\t\t\tp[i][j] = min(p[i][j], a[i][k] + a[k][j]);\n\t}\n\tswap(a,p);\n}\nvoid operator *=(vector &dp, mat &a) {\n\tfor(int i:bitset)\n\t dpn[i]=1e18;\n\tfor (int i : bitset) {\n\t\tfor (int j : bitset) {\n\t\t\tdpn[j] = min(dpn[j], dp[i] + a[i][j]);\n\t\t}\n\t}\n\tswap(dp, dpn);\n}\nvoid jump(ll to) {\n\ta = o;\n\tll jump = to - curx;\n\tfor (;jump;pow2(a), jump >>= 1) {\n\t\tif (jump & 1) dp *= a;\n\t}\n\tcurx = to;\n}\nint main() {\n\tios::sync_with_stdio(0), cin.tie(0);\n\tcin >> x >> k >> n >> q;\n\tB = 1 << k;\n\tdp.resize(B, 1e18);\n\tdpn.resize(B, 1e18);\n\to.resize(B, vector(B, 1e18));\n\tp.resize(B, vector(B, 1e18));\n\tfor (int b = 1;b < B;b++)\n\t\tif (__builtin_popcount(b) == x) bitset.push_back(b);\n\tdp[bitset[0]] = 0;\n\tfor (int i = 1;i <= k;i++) cin >> c[i];\n\tfor (int cur : bitset) {\n\t\tint next = cur >> 1;\n\t\tif (cur & 1) {\n\t\t\tfor (int i = 1, b = 1;i <= k;i++, b <<= 1) if (~next & b) {\n\t\t\t\to[cur][next | b] = c[i];\n\t\t\t}\n\t\t}\n\t\telse o[cur][next] = 0;\n\t}\n\tfor (int i = 1;i <= q;i++) {\n\t\tcin >> p >> w;\n\t\tif (w) mp[p] = w;\n\t}\n\tmp[n + k - x + 1] = 0;\n\tcurx = k;\n\tfor (auto it = mp.begin();curx < n + k - x;) {\n\t\tif (it->first <= curx - k) {\n\t\t\tit++; continue;\n\t\t}\n\t\tif (it->first <= curx + 1) {\n\t\t\tfor(int i:bitset)\n\t\t\t dpn[i]=1e18;\n\t\t\tcurx++;\n\t\t\tfor (int cur : bitset) {\n\t\t\t\tint next = cur >> 1;\n\t\t\t\tif (cur & 1) {\n\t\t\t\t\tfor (int i = 1, b = 1;i <= k;i++, b <<= 1) if (~next & b) {\n\t\t\t\t\t\tdpn[next | b] = min(dpn[next | b], dp[cur] + c[i] + (mp.count(curx - k + i) ? mp[curx - k + i] : 0));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse dpn[next] = min(dpn[next], dp[cur]);\n\t\t\t}\n\t\t\tswap(dp, dpn);\n\t\t}\n\t\telse jump(it->first - 1);\n\t}\n\tprintf(\"%lld\", dp[bitset[0]]);\n}", "lang": "GNU C++17", "bug_code_uid": "31b7ee9fa83d44ec3c4a6c4f18849481", "src_uid": "e3dd409ceeba2a21890d35ceab9607eb", "apr_id": "f39dea09b8c3355f8ba2f577e52bfa2c", "difficulty": 2900, "tags": ["matrices", "dp", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.3222520107238606, "equal_cnt": 110, "replace_cnt": 68, "delete_cnt": 25, "insert_cnt": 17, "fix_ops_cnt": 110, "bug_source_code": "#include \n#include \n#include \n#include \nusing namespace std;\n\nconst int INF = 0x3f3f3f3f;\n\nstruct Mat {\n vector > data;\n Mat(vector > &d) {\n swap(d, data);\n }\n Mat(){}\n void operator *= (const Mat &o) {\n // cout< > res(data.size(), vector(o.data[0].size(), INF));\n for(int i = 0; i < data.size(); i++) {\n for(int j = 0; j < o.data[0].size(); j++) {\n for(int k = 0; k < o.data.size(); k++) {\n res[i][j] = min(res[i][j], data[i][k] + o.data[k][j]);\n // if(data.size() == 1)\n // cout<(i)<<','<(k)<<' '<(k)<<','<(j)<<' '< > oneStep;\nstruct Stone {\n int loc, val;\n bool operator < (const Stone& o) const {\n return loc < o.loc;\n }\n} magic[25];\n\nvector &go(vector &beginState, int stepCnt, vector &res) {\n // cout<<\"go: \"<(beginState)<<' '<> i); i++) {\n if((stepCnt>>i) & 1){\n origin *= mat;\n // cout< &dp(vector &lastState, int stepCnt, int stoneAfter[201], int stoneEffect[26]) {\n // cout<<\"dp: \"< res(lastState.size());\n int dp[stepCnt+1][lastState.size()];\n memset(dp, 0x3f, sizeof dp);\n for(int i = 0; i < lastState.size(); i++) {\n dp[0][i] = lastState[i];\n }\n for(int step = 0; step < stepCnt; step++) {\n for(int cur = 1; cur < (1<>1) & (1<>1) | (1<>1;\n dp[step+1][nxt] = min(dp[step+1][nxt], dp[step][cur]);\n }\n }\n // cout<<\"dp: \";for(int i = 0; i < lastState.size(); i++) cout<(i)<<')'<<' ';\n // cout<<'\\n';\n }\n for(int i = 0; i < lastState.size(); i++) {\n lastState[i] = dp[stepCnt][i];\n }\n return lastState;\n}\n\nint main () {\n ios_base::sync_with_stdio(false);\n cin.tie(NULL);\n\n cin>>X>>K>>N>>Q;\n for(int i = 1; i <= K; i++) {\n cin>>jmp[i];\n }\n \n for(int i = 0; i < Q; i++) {\n cin>>magic[i].loc>>magic[i].val;\n }\n sort(magic, magic + Q);\n oneStep.resize(1< (1<>1) & (1<>1) | (1<>1] = 0;\n }\n }\n // Mat fp(oneStep);\n // cout< res;\n vector lastState(1< 0){\n // cout<= magic[i].loc){\n st_loc = magic[i].loc;\n stoneAfter[st_loc - curLoc] = ++i;\n // cout<<\"st_loc: \"<\n\nusing namespace std;\n\nint main ()\n{\n string s;\n cin>>s;\n int cnt = 0,check = 0,j = 0;\n char i;\n for( i = 'a';;i++) {\n for(j = 0;j < s.length();j++) {\n if(s[j] == i) break;\n }\n if(j == s.length() - 1) break;\n }\n if(i == s[s.length() - 1]) cout<<\"YES\";\n else cout<<\"NO\";\n return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "f6893e364742d78d730d5797df6f286a", "src_uid": "c4551f66a781b174f95865fa254ca972", "apr_id": "b21ee88f5aba31407f127d1385dacd91", "difficulty": 1100, "tags": ["greedy", "strings", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.17963427751882396, "equal_cnt": 15, "replace_cnt": 11, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 15, "bug_source_code": "#include \n#include \nusing namespace std;\nint a[10], b[10];\nchar c[300001], d[300001];\nint id[100000], lid;\nbool canget(int u, int v){\n if(!a[u]) return false;\n if(!b[v]) return false;\n int rs = 0;\n a[u]--;\n b[v] --;\n int res = 0, mn;\n for(int i = 0; i <= 8; i ++){\n res += a[i];\n mn = min(res, b[8 - i]);\n res -= mn;\n rs += mn;\n }\n ///for(int j = 0; j <= 8 - i; j ++) res += min(a[i], b[j]);\n a[u] ++;\n b[v] ++;\n return rs >= lid - 1;\n}\nint main(){\n cin >> c;\n int m, n = strlen(c);\n m = n;\n for(int i = 0; i < n; i ++){\n a[c[i] - '0'] ++;\n b[c[i] - '0'] ++;\n }\n int q = 1, i, st = -1, mx = 0, mn, col;\n for(int i = 1; i <= 9; i ++){\n if(!a[i]) continue;\n if(!b[10-i]) continue;\n a[i] --;\n b[10-i]--;\n col = 1;\n for(int i = 1; i <= 8; i ++)\n col += min(a[i], b[9-i]);\n if(col > mx)mx = col, st = i;\n a[i] ++;\n b[10-i]++;\n }\n if(st != -1){\n a[st]--;\n b[10-st]--;\n n --;\n c[n] = st + '0';\n d[n] = 10 - st + '0';\n for(int i = 0; i <= 9; i ++){\n mn = min(a[i], b[9 - i]);\n for(int j = 0; j < mn; j ++){\n n --;\n c[n] = i + '0';\n d[n] = 9 - i + '0';\n a[i]--;\n b[9-i]--;\n }\n }\n }\n id[lid ++] = --n;\n for(int i = 1; i <= 9 && n > 0; i ++){\n if(canget(i, 10 - i)){\n n --;\n c[n] = i + '0';\n d[n] = 10 - i + '0';\n id[lid ++] = --n;\n i --;\n }\n }\n int K = 0;\n while(K < lid - 1){\n int u = -1, j;\n for(int i = 1; i <= 8 && u != -1; i ++){\n for(int j = 8; j >= 1 && u != -1; j --){\n if(a[i] && b[j] && i + j <= 8) u = i;\n }\n }\n if(u == -1){\n if(a[0] > b[0]){\n u = 0;\n }else{\n u = 8;\n while(!a[u]) u --;\n }\n }\n j = 8;\n while(!b[j] || u + j > 8) j --;\n c[id[K]] = u + '0';\n d[id[K]] = j + '0';\n a[u] --;\n b[j] --;\n }\n q = id[lid-1];\n mn = min(a[0], b[0]);\n for(int i = 0; i < mn; i ++){\n c[m] = d[m] = '0';\n m ++;\n a[0] --;\n b[0] --;\n }\n\n for(int i = 0; i < 10; i ++)\n for(int j = 0; j < a[i]; j ++)\n c[q --] = i + '0';\n q = id[lid-1];\n for(int i = 0; i < 10; i ++)\n for(int j = 0; j < b[i]; j ++)\n d[q --] = i + '0';\n cout << c+q+1 << endl << d+q+1;\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "7c2701c748e4c465ecf76f188b07f278", "src_uid": "34b67958a37865e1ca0529bbf528dd9a", "apr_id": "9b833e268a93199799871172b9aabc77", "difficulty": 1900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.6502636203866432, "equal_cnt": 18, "replace_cnt": 16, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 17, "bug_source_code": "#include \nusing namespace std;\nint main(){\n long long n, m, k, x, y, tmp1, tmp2, mx1, mx2, mx, ans, mn;\n while(cin>>n>>m>>k>>x>>y){\n if(n==1){\n cout<<((k>=1)+((k-1)/m))<<\" \"<<((k>=m)+((k-m)/m))<<\" \";\n ans=(k>=y)+(k-y)/m;\n cout<=tmp1)+(k-tmp1)/(m-1+(n-1)*m+(n-2)*m+1), (k>=tmp2)+(k-tmp2)/(m-1+(n-2)*m+(n-1)*m+1));\n mx=max((k>=tmp1)+(k-tmp1)/(m-1+(n-1)*m+(n-2)*m+1), (k>=tmp2)+(k-tmp2)/(m-1+(n-2)*m+(n-1)*m+1));\n tmp1=(x-1)*m+y;\n tmp2=n*m+(n-x-1)*m+y;\n if(x==1){\n ans=(k>=tmp1)+(k-tmp1)/(m-y+(n-1)*m+(n-2)*m+y);\n }\n else if(x==n){\n ans=(k>=tmp1)+(k-tmp1)/(m-y+(n-1)*m+(n-2)*m+y);\n }\n else{\n ans=(k>=tmp1)+(k-tmp1)/(m-y+(n-x)*m+(n-1)*m+(x-1)*m+y)+(k>=tmp2)+(k-tmp2)/(m-y+(x-1)*m+(n-1)*m+(n-x-1)*m+y);\n }\n cout<=tmp1)+(k-tmp1)/(m-1+m+(n-1)*m+(n-3)*m+1)+(k>=tmp2)+(k-tmp2)/(m-1+(n-2)*m+(n-1)*m+1);\n tmp1=m+1;\n tmp2=(n+n-3)*m+1;\n mx2=(k>=tmp1)+(k-tmp1)/(m-1+m+(n-1)*m+(n-3)*m+1)+(k>=tmp2)+(k-tmp2)/(m-1+(n-2)*m+(n-1)*m+1);\n mx=max(mx1, mx2);\n tmp1=1;\n tmp2=(n-1)*m+1;\n mn=min((k>=tmp1)+(k-tmp1)/(m-1+(n-1)*m+(n-2)*m+1), (k>=tmp2)+(k-tmp2)/(m-1+(n-2)*m+(n-1)*m+1));\n tmp1=(x-1)*m+y;\n tmp2=n*m+(n-x-1)*m+y;\n if(x==1){\n ans=(k>=tmp1)+(k-tmp1)/(m-y+(n-1)*m+(n-2)*m+y);\n }\n else if(x==n){\n ans=(k>=tmp1)+(k-tmp1)/(m-y+(n-1)*m+(n-2)*m+y);\n }\n else{\n ans=(k>=tmp1)+(k-tmp1)/(m-y+(n-x)*m+(n-1)*m+(x-1)*m+y)+(k>=tmp2)+(k-tmp2)/(m-y+(x-1)*m+(n-1)*m+(n-x-1)*m+y);\n }\n cout<\n#include\n#include\n#include\n#include\nusing namespace std;\nstring s;\nint l,ans=1,gs=-1;\nint a[100];\ninline bool pd(char x)\n{\n if (x=='A'||x=='E'||x=='I'||x=='O'||x=='U') return true;\n return false;\n}\nint main()\n{\n cin>>s;\n l=s.size();\n for (int i=1;i<=l;++i)\n if (pd(s[i])) {\n gs++;\n a[gs]=ans;\n ans=0;\n }\n else {\n ans++;\n }\n sort(a+1,a+1+gs);\n cout<\nusing namespace std;\ntypedef long long int ll;\nint main(){\n ll n,m,k;\n cin>>n>>m>>k;\n ll ar[n];\n for(ll i=1;i<=n;i++)\n cin>>ar[i];\n ll i=m-1,j=m+1;\n ll ans1=0,ans2=0;\n while(1){\n if(ar[i]<=k&&i>0&&ar[i]!=0){\n ans1=(m-i)*10;\n break;\n }\n else if(ar[j]<=k&&j\n\nusing namespace std;\n#define ll long long\nconst int MX=5000;\nint n,m,a,b,mx;\nstring s;\n\nint32_t main(){\n cin>>n;\n while(n){\n cin>>s;\n for(int i=0; i\nusing namespace std;\n// #define cerr if(false) cerr\n#define watch(x) cerr << (#x) << \" is \" << (x) << endl;\n#define endl '\\n'\n#define ld long double\n// #define int long long\n#define pii pair\n#define fi first\n#define se second\n#define sz(a) (int)a.size()\n#define all(x) (x).begin(), (x).end()\n\nvoid solve() {\n \n}\n\n// CHANGE WHEN SUBMITTING\nconst int maxn = (int)5e6;\n// const int maxn = (int)1e3;\nint t, l, r;\n\n// divisors is cbrt(5e6) or around 170\nset divisors[maxn+50];\n\nsigned main() {\n ios::sync_with_stdio(0);\n cin.tie(0);\n\n cin >> t >> l >> r;\n int it = 0;\n for(int i = 1; i <= maxn; i++) {\n for(int j = i; j <= maxn; j += i) {\n // watch(j)\n divisors[j].emplace(i);\n it++;\n }\n }\n\nwatch(it)\n\n}\n\n/*\n\n*/\n\n// Did you read the bounds?\n// Did you make typos?\n// Are there edge cases (N=1?)\n// Are array sizes proper (scaled by proper constant, for example 2* for koosaga tree)\n// Integer overflow?\n// DS reset properly between test cases?\n// Is using long longs causing TLE?\n// Are you using floating points?\n", "lang": "GNU C++11", "bug_code_uid": "135d0f97c0386744902c4adda761f340", "src_uid": "c9d45dac4a22f8f452d98d05eca2e79b", "apr_id": "95737265740def135a597aa3c086f7b8", "difficulty": 1800, "tags": ["dp", "number theory", "greedy", "math", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9763888888888889, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \n\nusing namespace std;\n\nint main(int argc, char** argv)\n{\n int n = 0;\n cin >> n;\n int minx = 0, miny = 0, maxx = 0, maxy = 0;\n cin >> minx >> miny >> maxx >> maxy;\n int s = (maxx - minx) * (maxy - miny);\n --n;\n for(; n; --n)\n {\n int x1 = 0, y1 = 0;\n int x2 = 0, y2 = 0;\n cin >> x1 >> y1 >> x2 >> y2;\n if(x1 < minx)\n minx = x1;\n if(x2 > maxx)\n maxx = x2;\n if(y1 < miny)\n miny = y1;\n if(y2 > maxy)\n maxy = y2;\n s += (x2 - x1) * (y2 - y1);\n }\n if((maxx - minx) * (maxy - miny) == s)\n cout << \"YES\\n\";\n else\n cout << \"NO\\n\";\n return 0;\n}\n", "lang": "GNU C++0x", "bug_code_uid": "286e1e8f39aae53856f6ce5a9736483a", "src_uid": "f63fc2d97fd88273241fce206cc217f2", "apr_id": "b527cbb5b34469793152ad38acf1146a", "difficulty": 1500, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9958246346555324, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "// codeforces c676 pa.cpp : Defines the entry point for the console application.\n//\n\n//#include \"stdafx.h\"\n#include\n\nusing namespace std;\n\nint main()\n{\nA:\n\tint n,x1=-1,x2,max;\n\tcin >> n;\n\tint *a = new int[n];\n\tfor (int i = 0; i < n; i++)\n\t{\n\t\tcin >> a[i];\n\t\tif (a[i] == 1 || a[i] == n)\n\t\t{\n\t\t\tif (x1 == -1)\n\t\t\t\tx1 = i;\n\t\t\telse\n\t\t\t\tx2 = i;\n\t\t}\n\t}\n\tx2 = n - x2-1;\n\tmax = (x1 > x2) ? n-x2 : n - x1;\n\tcout << max-1;\n\tgoto A;\n//\tcin.ignore();\n//\tcin.ignore();\n\treturn 0;\n}\n\n", "lang": "MS C++", "bug_code_uid": "d088cd47d9c1a786f66e8737de7a5ff1", "src_uid": "1d2b81ce842f8c97656d96bddff4e8b4", "apr_id": "ce56e1fad207b48dacbedd967b209a67", "difficulty": 800, "tags": ["constructive algorithms", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.0513405590416429, "equal_cnt": 30, "replace_cnt": 29, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 30, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#define Max(a,b) ((a)>(b)?(a):(b))\n#define Min(a,b) ((a)<(b)?(a):(b))\nusing namespace std;\ntypedef long long ll;\nconst double PI = acos(-1.0);\nconst double eps = 1e-6;\nconst int mod = 1000000000 + 7;\nconst int INF = 1000000000;\nconst int maxn = 200 + 10;\nint T,n,m;\nchar s[maxn], name;\nstruct node {\n int B, G, R;\n node(int b=0, int g=0, int r=0):B(b),G(g),R(r) {}\n}S;\nconst char table[] = { 'B', 'G', 'R' };\nvector ans;\nvoid BFS() {\n queue q;\n q.push(S);\n ans.clear();\n// memset(vis, false, sizeof(vis));\n// vis[S.B][S.G][S.R] = true;\n while(!q.empty()) {\n node u = q.front(); q.pop();\n // printf(\"%d %d %d\\n\",u.B,u.G,u.R);\n if(u.B == 1 && u.G == 0 && u.R == 0) ans.push_back((int)('B'-'A'));\n else if(u.G == 1 && u.B == 0 && u.R == 0) ans.push_back((int)('G'-'A'));\n else if(u.R == 1 && u.B == 0 && u.G == 0) ans.push_back((int)('R'-'A'));\n for(int i=0;i<3;i++) {\n for(int j=0;j<3;j++) {\n if(i == j) {\n if(i == 0 && u.B >= 2) q.push(node(u.B-1,u.G,u.R));\n else if(i == 1 && u.G >= 2) q.push(node(u.B,u.G-1,u.R));\n else if(i == 2 && u.R >= 2) q.push(node(u.B, u.G, u.R-1));\n }\n else {\n if(i == 0 && j == 1 && u.B >= 1 && u.G >= 1) q.push(node(u.B-1,u.G-1,u.R+1));\n else if(i==0&&j==2&&u.B>=1&&u.R>=1) q.push(node(u.B-1,u.G+1,u.R-1));\n else if(i==1&&j==2&&u.G>=1&&u.R>=1) q.push(node(u.B+1,u.G-1,u.R-1));\n }\n }\n }\n }\n}\n\nint main() {\n scanf(\"%d%s\",&n,s);\n S = node(0, 0, 0);\n for(int i=0;i\nusing namespace std;\nmap < char , int > mp ;\nint main() {\n\tchar x[8][8] ;\n\tfor (int i = 0 ; i < 8 ; i++)\n for (int j = 0 ; j < 8 ; j++)\n cin >> x[i][j] ;\n\n int c = 0 , ch = 0 , ch2 = 0 ;\n\n for (int i = 0 ; i < 8 ; i++){\n for (int j = 0 ; j < 8 ; j++){\n if ( x[i][j] == 'B' and x[i-1][j] != '0' and x[i][j-1] != '0'){\n c++;\n for (int k = i ; k < 8 ; k++ )\n if ( x[k][j] == 'B' ) x[k][j] = '0' ;\n for (int k = j ; k < 8 ; k++)\n if ( x[i][k] == 'B') x[i][k] = '0' ;\n }\n }\n }\n cout << c ;\n}\n", "lang": "GNU C++", "bug_code_uid": "158e2e8b6149449cf529845bc2ac28f6", "src_uid": "8b6ae2190413b23f47e2958a7d4e7bc0", "apr_id": "6a9c102b083fc8d5f219b449a3de99c5", "difficulty": 1100, "tags": ["brute force", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9734904270986745, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \n\nusing namespace std;\n\ntypedef long long int lli;\n#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);\ntypedef pair pii;\n#define all(vec) vec.begin(),vec.end()\n#define ff first\n#define ss second\n#define pi 3.141592653589\n#define inf 4e18\n#define MOD 1000000007\n#define pb push_back\n#define endl \"\\n\"\n#define for1(low,high,k) for(int i=low;i=low;i-=k) \n\nlli solve(int i,int j,int in,string s,string &t,int k,vector > > &dp){\n\tif (j>k) return -inf;\n\tif (i==s.size()) return 0;\n\tif (dp[i][j][in]!=-1) return dp[i][j][in];\n\tint e0=0,e1=0,e2=0;\n\tif (t[0]==t[1]) e2=1;\n\tif (s[i]==t[0]) e0=1;\n\tif (s[i]==t[1]) e1=1;\n\t//ignore ith char\n\tlli ans=-inf;\n\tstring temp=s;\n\tans=max(ans,solve(i+1,j,in+e0,temp,t,k,dp)+(e1?in:0));\n\t//convert to t[0]\n\ttemp[i]=t[0];\n\tans=max(ans,solve(i+1,j+1,in+1,temp,t,k,dp)+(e2?in:0));\n\t//convert to t[1]\n\ttemp[i]=t[1];\n\tans=max(ans,solve(i+1,j+1,in+e2,temp,t,k,dp)+in);\n\tdp[i][j][in]=ans;\n\treturn dp[i][j][in];\n}\n\nint main(){\n\tfast;\n\tlli n,k;\n\tcin>>n>>k;\n\tstring s,t;\n\tcin>>s>>t;\n\tvector > > dp((n+1)*(k+1)*(n+1),vector > ((k+1)*(n+1),vector (n+1,-1)));\n\tdp[0][0][0]=solve(0,0,0,s,t,k,dp);\n\tcout<\nusing namespace std;\nint a,b,lin;\nint main()\n{\ncin>>a>>b;\nlin=a/b;\ncout<\n\nusing namespace std;\n\n\nint n, k, c[500010], ans, tot;\nqueue q;\n\nint main() {\n\tcin >> n >> k;\n\tq.push(0);\n\twhile(k--) q.push(0);\n\n\tfor(int i = 1; i <= n; ++i) cin >> c[i];\n\tsort(c+1, c+n+1);\n\tfor(int i = n; i > 0; --i) {\n\t\tint x = q.top();\n\t\tq.pop();\n\t\ttot += x;\n\t\tq.push(x + c[i]);\n\t}\n\tcout << tot << endl;\n\treturn 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "f6e532eb783d1c15792e196e697085e8", "src_uid": "53155daf2375e01a3b87fa1c76f1e9a8", "apr_id": "919b7fac5be79c27e2d031d2a870c375", "difficulty": null, "tags": ["math", "constructive algorithms", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.3907103825136612, "equal_cnt": 17, "replace_cnt": 12, "delete_cnt": 5, "insert_cnt": 0, "fix_ops_cnt": 17, "bug_source_code": "#include\n\nusing namespace std;\n#define ll long long int\nint main()\n{\n set::iterator it;\n setS;\n double d;\n int l,r,x,y,k,i;\n cin>>l>>r>>x>>y>>k;\n for(i=l;i<=r;++i)\n {\n\n d=(double)i/k;\n\n S.insert(d);\n }\n\n bool flag=false;\n for(i=x;i<=y;++i)\n {\n if(S.find(i)!=S.end())\n {\n\n flag=true;\n break;\n }\n }\n if(flag) cout<<\"YES\"<\n#include \nusing namespace std;\n\nint main(void)\n{\n int n, a, b, c;\n int l[10000];\n cin>>n>>a>>b>>c;\n for (int i = 0; i<4000; i++){\n for (int j = 0; j<4000; j++){\n for(int k = 0; k<4000; k++){\n l[a*k + b*j + c*i] = i+j+k;\n }\n }\n }\n cout<\n\nusing namespace std;\n\ntypedef long long ll;\n\nconst ll mod = 1000000007;\n\n#define IOS ios::sync_with_stdio(0); cin.tie(0);\n#define endl \"\\n\"\nll dp[55][55][3];\nll c[55][55];\nsigned main() {\n\n IOS;\n dp[0][0][1] = 1; \n dp[1][0][1] = 0;\n dp[1][0][0] = 1; \n dp[0][0][0] = 1; int n , k; cin >>n >> k; \n c[0][0] = 1;\n for (int i = 1; i <= n; c[i][0] = 1, i++)\n for (int j = 1; j <= n; j++)\n c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % mod;\n \n for(int i = 2; i <= n ; i++) {\n \tfor(int j = 0; j <= k; j++) {\n \t\tfor(int Left = 1; Left <= i - 1; Left++) {\n \t\t\t\n \t \t ll coef = c[i - 2][Left - 1] * Left * max(1 , (i - Left - 1) ) % mod;\n \t\t \n \t \t for(int kLeft = 0 ; kLeft <= j - 1; kLeft++) {\n \t \t \t\n \t \t \tll addFi = dp[Left][kLeft][0] * ((i - Left - 1 ) > 0 ? dp[i - Left - 1][j - 1 - kLeft][1] + dp[i - Left -1][j - 1 - kLeft][0] : j - kLeft - 1 == 0 ? 1 : 0); \n\t\t\t \t\tll addSe = ( (i - Left - 1 )> 0 ? dp[Left][kLeft][1] * dp[i - Left -1][j - 1 - kLeft][0] : 0); \n\t\t\t \t\tdp[i][j][1] = ( dp[i][j] + coef * ((addFi + addSe ) % mod ) )% mod; \n\t\t\t \t}\n\t\t\t\tfor(int kLeft = 0 ; kLeft <=j ; kLeft++) {\n\t\t\t\t\t\n\t\t\t\t\tdp[i][j][0] = dp[i][j][0] + coef * dp[Left][kLeft][1] % mod * dp[i - Left -1][j - kLeft][1] % mod;\n\t\t\t\t\tdp[i][j][0] %= mod;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tcout << (dp[n][k][0] + dp[n][k][1]) % mod;\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\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": "a06512ff13db9c15868eaa2b6a0cc3dc", "src_uid": "f98b740183281943eafd90328854746b", "apr_id": "6c81fb01d4912ff1b89fd66ad8eb96fe", "difficulty": 2600, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.21182475542322415, "equal_cnt": 29, "replace_cnt": 15, "delete_cnt": 5, "insert_cnt": 8, "fix_ops_cnt": 28, "bug_source_code": "#include \n#include \n#include \nusing namespace std;\n\n#define ll long long int\n#define MOD 1000000007LL\nll n, k;\n\nll ans[55][55][55];\n\nll max(ll a, ll b) {\n if (a > b) return a;\n return b;\n}\n\nint dy[] = {-1,0,1};\n\nint main() {\n cin >> n >> k;\n memset(ans, sizeof(ans), 0);\n ans[1][0][0] = 1;\n for (ll i = 2; i <= n; i++) {\n for (ll x1 = 0; x1 <= (i - 1) / 2; x1++) {\n for (ll j = 0; j < 3; j++) {\n ll y1 = x1 + dy[j];\n if (y1 < 0) continue;\n ll x = y1 + 1;\n ll y = max(x1, y1);\n ans[i][x][y] += (ans[i-1][x1][y1]) * (i - 1);\n ans[i][x][y] %= MOD;\n }\n }\n \n for (ll z = 1; z <= (i - 1) / 2; z++) {\n for (ll x1 = 0; x1 <= z / 2; x1++) {\n for (ll x2 = 0; x2 <= (i - 1 - z) / 2; x2++) {\n for (ll j1 = 0; j1 < 3; j1++) {\n ll y1 = x1 + dy[j1];\n if (y1 < 0) continue;\n for (ll j2 = 0; j2 < 3; j2++) {\n ll y2 = x2 + dy[j2];\n if (y2 < 0) continue;\n ll x = max(1 + x1 + y2, 1 + x2 + y1);\n ll y = max(x1, y1) + max(x2, y2);\n ll delta = ans[z][x1][y1] * ans[i-1-z][x2][y2];\n delta %= MOD;\n ll q = (i-1) * (i-2);\n if (z == (i - 1 - z)) q /= 2;\n delta *= q;\n delta %= MOD;\n ans[i][x][y] += delta;\n ans[i][x][y] %= MOD;\n }\n }\n }\n }\n }\n }\n \n ll res = ans[n][k-1][k] + ans[n][k][k] + ans[n][k][k-1];\n cout << res << endl;\n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "3fba56447ed4cd3f63d5d6d58bc60411", "src_uid": "f98b740183281943eafd90328854746b", "apr_id": "89e8c383edba890e4554f169bedb7864", "difficulty": 2600, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.997289972899729, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include \nusing namespace std;\nlong long n, m, x, y, v;\nbool can(long long size){\n\tlong long a, b, c, d; //inclusion - exclusion\n\ta = size / x;\n\tb = size / x / y;\n\tc = size / y;\n\td = size - a - c + b; //intersection\n\tlong long x1 = size - a; //Multiple x - total\n\tlong long y1= size - c; //Multiple y - total\n\tif(x1 + y1 - d >= n + m && x1 >= n && y1 >= m) return true;\n\treturn false;\n}\nint main(){\n\tfreopen(\"in\", \"r\", stdin);\n\tfreopen(\"out\", \"w\", stdout);\n\tscanf(\"%I64d %I64d %I64d %I64d\", &n, &m, &x, &y);\n\tlong long low = m + n;\n\tlong long high = 1e18;\n\twhile(high >= low){\n\t\tlong long mid = (low + high) >> 1;\n\t\tif(can(mid)){ v = mid; high = mid - 1;}\n\t\telse low = mid + 1;\n\t}\n\tprintf(\"%I64d\\n\", v);\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "aa4d62e33c13810add2d3adbb372c276", "src_uid": "ff3c39b759a049580a6e96c66c904fdc", "apr_id": "0aee4000fe3fd6e256c71b33514c4dc5", "difficulty": 1800, "tags": ["math", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.7056497175141243, "equal_cnt": 14, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 13, "bug_source_code": "#include\n\nusing namespace std;\n\ntypedef long long LL;\n\ntemplate inline void chkmax(T &x , T y) { x = max(x , y); }\ntemplate inline void chkmin(T &x , T y) { x = min(x , y); }\ntemplate inline void read(T &x) {\n\tT f = 1; x = 0;\n\tchar c = getchar();\n\tfor (; !isdigit(c); c = getchar()) if (c == '-') f = -f;\n\tfor (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + c - '0';\n\tx *= f;\n}\n\nconst int K = 5000 + 10;\nconst int mod = 998244353;\n\nint n , m , k;\nint fac[K] , ifac[K] , S[K][K];\n\ninline void inc(int &x , int y) {\n\tx = x + y < mod ? x + y : x + y - mod;\n}\ninline int quickpow(int a , int n) {\n\tint res = 1;\n\tfor (; n; n >>= 1 , a = (LL) a * a % mod)\n\t\tif (n & 1) res = (LL) res * a % mod;\n\treturn res;\n}\nint main() {\n\t\n\tread(n) , read(m) , read(k);\n\tfac[0] = 1;\n\tfor (int i = 1; i <= k; ++i) fac[i] = (LL) fac[i - 1] * i % mod;\n\tifac[k] = quickpow(fac[k] , mod - 2);\n\tfor (int i = k - 1; i >= 0; --i) ifac[i] = (LL) ifac[i + 1] * (i + 1) % mod;\n\tS[0][0] = 1;\n\tfor (int i = 1; i <= k; ++i)\n\tfor (int j = 1; j <= i; ++j)\n\t\tS[i][j] = (S[i - 1][j - 1] + 1LL * S[i - 1][j] * j % mod) % mod;\n\tint coef = 1 , ans = 0;\n\tfor (int i = 0; i <= k; ++i) {\n\t\tif (i) coef = (LL) coef * (n - i + 1) % mod;\n\t\tinc(ans , (LL) S[k][i] * coef % mod * quickpow(m - 1 , n - i) % mod * quickpow(quickpow(m - 1 , mod - 2) + 1 , n - i) % mod);\n\t}\n\tans = 1LL * ans * quickpow(quickpow(m , n) , mod - 2) % mod;\n\tprintf(\"%d\\n\" , ans);\n\treturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "5dbe7afd915754c777aa7580cde4b4ed", "src_uid": "e6b3e559b5fd4e05adf9f1cd1b22126b", "apr_id": "54790b606d8debf899f75af0b494f20f", "difficulty": 2600, "tags": ["dp", "probabilities", "combinatorics", "number theory", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9910714285714286, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include \nint n;\nint main() {\n\tscanf(\"%d\", n);\n\tint ans = (n - 1) / 2;\n\tprintf(\"%d\", ans);\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "4cd3b5d16dca3e4538c1b363c6220123", "src_uid": "dfe9446431325c73e88b58ba204d0e47", "apr_id": "59791561ff6b06885f681fd420a8c30d", "difficulty": 1000, "tags": ["constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.4910962715637173, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\n\ntypedef long long int LL;\ntypedef long double LB;\ntypedef complex Complex;\nconst int MAXN = 30000;\nconst int INF = 0x3f3f3f3f;\nconst int MOD = 1e9+7;\nconst LB PI = acos(-1);\n\ntemplate\nvoid Read(T &x){\n x=0;char c=getchar();bool flag=0;\n while(c<'0'||'9'>=1;\n }\n return ret;\n}\ninline void DFT(Complex *A,int n,int DFT){\n for(int i=0;i>1);++j){\n Complex s=tmp[i+j],t=w*tmp[i+j+(len>>1)];\n tmp[i+j]=s+t,tmp[i+j+(len>>1)]=s-t;\n w*=wn;\n }\n }\n }\n if(DFT==-1)for(int i=0;i=MOD)return v-MOD;\n else if(v<0)return v+MOD;\n else return v;\n}\ninline int ksm(int a,int p){\n int ret=1;\n while(p){\n if(p&1)ret=1ll*ret*a%MOD;\n a=1ll*a*a%MOD;\n p>>=1;\n }\n return ret;\n}\n\ninline void init(){\n fac[0]=1;\n for(int i=1;i<=MAXN;++i)fac[i]=1ll*fac[i-1]*i%MOD;\n inv[MAXN]=ksm(fac[MAXN],MOD-2);\n for(int i=MAXN-1;i>=0;--i)inv[i]=1ll*inv[i+1]*(i+1)%MOD;\n}\n\nint tF[MAXN+10];\nvoid getF(int *F,int n){\n if(!n)fill(F,F+k,0),F[0]=1;\n else if(n&1){\n getF(F,n-1);\n tF[0]=0;\n for(int i=1;i>1);\n copy(F,F+k,tF);\n for(int i=0;i>1)*i%(MOD-1))%MOD;\n FFT(tF,F,F,k);\n }\n}\n\nint F[MAXN+10];\n\nint main(){\n init();\n\n Read(n),Read(k);\n if(n>k){puts(\"0\");return 0;}\n else{\n ++k,getF(F,n);\n int ans=0;\n for(int i=0;i\n#include \n\n\n\nusing namespace std;\n\nint main()\n{\n\n\t\n\t\n\tstring input;\n\t\n\tgetline(cin, input);\n\t\n\tstring temp1;\n\t\n\tstring temp2;\n\t\n\n\t\t\n\tfor (int i = 0; i < input.length(); i++) \n\t{\n\t\t\t\n\t\tif (input[i] == ' ')\n\t\t{\n\t\t\t\t\t\n\t\t\ttemp1.append(input.substr(0, i));\n\t\t\t\t\t\n\t\t\ttemp2.append(input.substr(i + 1, input.length() - 1));\n\t\t\t\t\t\n\t\t\tbreak;\n\t\t\t\t\t\n\t\t}\n\t\t\t\n\t}\n\t\n\n\t\t\n\tcout << temp1 << endl;\n\t\n\tcout << temp2 << endl;\n\n\tint val1 = stoi(temp1);\n\tint val2 = stoi(temp2);\n\t\n\tfor (int i = 0; i < val2; i++)\n\t{\n\t\tif (val1 % 10 == 0)\n\t\t{\n\t\t\tval1 = val1 / 10;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tval1 = val1 - 1;\n\t\t}\n\n\t}\n\n\n\n\n\n\n\n\n\n\tsystem(\"pause\");\n\treturn val1;\n}", "lang": "MS C++ 2017", "bug_code_uid": "1866b09031bc6dfe08cf4bc16cc92f79", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "67b1d0d32f92c27c895d5cb920f1a8e3", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.11913133402275078, "equal_cnt": 74, "replace_cnt": 60, "delete_cnt": 1, "insert_cnt": 13, "fix_ops_cnt": 74, "bug_source_code": "#include\n#define title \"title\"\n#define ll long long\n#define ull unsigned ll\n#define fix(x) fixed<\n#define vint vector\n#define pb push_back\n#define rep(i,a,b) for(ll i=(a);i<=(b);i++)\n#define red(i,a,b) for(ll i=(a);i>=(b);i--)\n#define db double\n#define ld long db\nusing namespace std;\nvoid Freopen(){\n\tfreopen(title\".in\",\"r\",stdin);\n\tfreopen(title\".out\",\"w\",stdout);\n}\nll read(){\n\tll g=0,f=1;\n\tchar ch=getchar();\n\twhile(ch<'0'||'9'id;\nll ksc(ll x,ll y,ll mod){\n\tll re=0;\n\twhile(y){\n\t\tif(y&1)re=(re+x)%mod;\n\t\tx=(x+x)%mod;y>>=1;\n\t}return re;\n}\nll ksm(ll x,ll y,ll mod){\n\tll re=1;\n\twhile(y){\n\t\tif(y&1)re=ksc(re,x,mod);\n\t\tx=ksc(x,x,mod);y>>=1;\n\t}return re;\n}\nbool mr(ll n){\n\tif(n==2)return true;\n\tif(n<2||!(n&1))return false;\n\tll m=n-1,k=0,cnt=10;\n\twhile(!(m&1))k++,m>>=1;\n\tfor(ll i=1;i<=cnt;i++){\n\t\tll a=rand()*rand()%(n-1)+1,x=ksm(a,m,n),y=0;\n\t\tfor(ll j=1;j<=k;j++){\n\t\t\ty=ksc(x,x,n);\n\t\t\tif(y==1&&x!=1&&x!=n-1)return false;\n\t\t\tx=y;\n\t\t}if(y!=1)return false;\n\t}\n\treturn true;\n}\nll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}\nll rho(ll n){\n\tll x,y,d,i=0,k=1,c;\n\tx=y=rand()*rand()%(n-1)+1,c=rand()*rand()*(n-1)+1;\n\twhile(true){\n\t\ti++;\n\t\tx=(ksc(x,x,n)+c)%n;\n\t\td=gcd((y-x+n)%n,n);\n\t\tif(d!=1&&d!=n)return d;\n\t\tif(x==y)return n;\n\t\tif(i==k)y=x,k<<=1;\n\t}\n}\nvoid find(ll n){\n\tif(n==1)return;\n\tif(mr(n))return ce[++tot]=n,void();\n\tll p=n;\n\twhile(p>=n)p=rho(p);\n\tfind(p),find(n/p);\n}\nsigned main(){\n\tsrand(19260817);\n\tm=read(),x=read();\n\tfor(ll i=1;i*i<=m;i++)if(!(m%i)){\n\t\ta[++n]=i;\n\t\tif((i*i)^m)a[++n]=m/i;\n\t}sort(a+1,a+n+1);\n\trep(i,1,n)id[a[i]]=i;\n\tll re=m;\n\tfor(ll i=2;i*i<=re;i++)if(!(re%i)){\n\t\tp[++cnt]=i;\n\t\twhile(!(re%i))re/=i;\n\t}if(re>1)p[++cnt]=re;\n\trep(i,1,n)f[i]=m/a[i]-1;\n\trep(j,1,cnt)rep(i,1,n)if(!(a[i]%p[j]))f[id[a[i]/p[j]]]-=f[i];\n\tred(i,n,1){\n\t\tl[i]=a[i];\n\t\trep(j,1,cnt)if(!(l[i]%p[j]))l[i]=l[i]*(p[j]-1)/p[j];\n\t\ttot=0,find(l[i],10007),sort(ce+1,ce+tot+1),tot=unique(ce+1,ce+tot+1)-ce-1;\n\t\trep(j,1,tot)while(!(l[i]%ce[j])&&ksm(x,l[i]/ce[j],a[i])==1)l[i]/=ce[j];\n\t}\n\tll ans=1;\n\trep(i,1,n)ans+=f[i]/l[id[m/a[i]]];\n\treturn cout<\n#include\n#include\n#include\n#define MP make_pair\nusing namespace std;\nconst int N=11100;\ntypedef pair PII;\nint n,m,k,a,cnt,tot;\nint c[N],last[N],id[N],ans[N];\nint cmp(int i,int j) { return c[i]>c[j]||(c[i]==c[j]&&last[i]0) ans[id[i]]=1;else ans[id[i]]=3;\n\t\tfor (int i=k+1;i<=n;k++) ans[id[i]]=3;\n\t}\n\telse\n\t{\n\t\tfor (int i=1;i<=n;i++)\n\t\t{\n\t\t\tc[i]+=m-a;\n\t\t\tcnt=0;\n\t\t\tfor (int j=1;j<=n;j++)\n\t\t\tif (c[j]>=c[i]) cnt++;\n\t\t\tif (cnt>k) ans[i]=3;\n\t\t\tc[i]-=m-a;\n\t\t}\n\t\tfor (int i=1;i<=n;i++)\n\t\tif (c[i]>0)\n\t\t{\n\t\t\tcnt=tot=0;\n\t\t\tif (k==n) { ans[i]=1;continue;}\n\t\t\tfor (int j=1;j<=n;j++)\n\t\t\t{\n\t\t\t\tif (id[j]==i) continue;\n\t\t\t\ttot++;\n\t\t\t\tif (last[id[j]]<=last[i])\n\t\t\t\t{\n\t\t\t\t\tif (c[id[j]]m-a) ans[i]=1;\n\t\t}\n\t}\n\tfor (int i=1;i<=n;i++) printf(\"%d \",ans[i]);\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "14708c528518d072576a9bef9473c4ee", "src_uid": "81a890bd542963bbcec7a041dde5c247", "apr_id": "eb8dced460570bc74fc76daf5c2b596e", "difficulty": 2100, "tags": ["greedy", "sortings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7064777327935222, "equal_cnt": 19, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 11, "fix_ops_cnt": 18, "bug_source_code": "#include \nusing namespace std;\n\nconst int MAX = 255;\n\nint N, K, M, A, c[MAX];\nvector v;\n\nint main(){\n\tios::sync_with_stdio(false);\n\tcin.tie(0); cout.tie(0);\n\n\tcin >> N >> K >> M >> A;\n\n\tfor(int i=1; i<=A; ++i){\n\t\tint x; cin >> x; ++c[x];\n\t}\n\n\tint l = M - A;\n\tfor(int i=1; i<=N; ++i){\n\t\tint p = 0, np = 0;\n\t\tfor(int j=1; j<=N; ++j){\n\t\t\tif(i == j);\n\t\t\telse v.push_back(c[j]);\n\t\t}\n\t\tsort(v.rbegin(), v.rend());\n\n\t\tint cc = 0;\n\t\tfor(int j=0; j= c[i] + l) ++cc;\n\t\t}\n\n\t\tif(cc < K){\n\t\t\tint need = 0;\n\t\t\tfor(int j=0; j l and c[i]) cout << 1 << ' ';\n\t\t\telse cout << 2 << ' ';\n\t\t}\n\t\telse cout << 3 << ' ';\n\n\n\t\tv.clear();\n\t}\n}", "lang": "GNU C++14", "bug_code_uid": "ea0d962b4fe39ff6665867e8e19a6637", "src_uid": "81a890bd542963bbcec7a041dde5c247", "apr_id": "bd9964829fdbd63f55c8a6438b94242b", "difficulty": 2100, "tags": ["greedy", "sortings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9128367670364501, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "//Bismillahirrahmanir Rahim\n#include\nusing namespace std;\nint main()\n{\n int n, k, x;\n cin>>n>>k>>x;\n int ar[n];\n int p=k/x;\n //cout<>ar[i];\n int ans=0;\n int l=0;\n for(int i=n; ; i--)\n {\n ans+=x;\n l++;\n if(l==k)\n {\n for(int j=n-l; j>=1; j--)\n {\n ans+=ar[j];\n if(j==1)\n {\n cout<\n#include\n#define N 11000\nusing namespace std;\nint max(int a,int b){if(a>b)return a;return b;}\nint min(int a,int b){if(a>1)+1];\nvoid add(int a,int b)\n{\n\te[++tot].to=b;\n\te[tot].last=st[a];\n\tst[a]=tot;\n}\nint dfs(int u)\n{\n\tif(f[u]!=-1)\n\t\treturn f[u];\n\tf[u]=t[u];\n\tfor(int i=st[u];i!=0;i=e[i].last)\n\t\tf[u]=max(f[u],dfs(e[i].to)+t[u]);\n\treturn f[u];\n}\nint main()\n{\n\tscanf(\"%d\",&n);\n\tfor(int i=1,k,v;i<=n;i++)\n\t{\n\t\tscanf(\"%d %d\",&t[i],&k);\n\t\twhile(k--)\n\t\t{\n\t\t\tscanf(\"%d\",&v);\n\t\t\tadd(i,v);\n\t\t}\n\t}\n\tmemset(f,-1,sizeof(f));\n\tint ans=-2147483647;\n\tfor(int i=1;i<=n;i++)\n\t\tif(f[i]==-1)\n\t\t\tans=max(ans,dfs(i));\n\tprintf(\"%d\",ans);\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "b92224a0f20cc8a5554c2860830c710b", "src_uid": "92a233f8d9c73d9f33e4e6116b7d0a96", "apr_id": "8b1a13f88529bd8bd895e0bf5f3fc772", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9876543209876543, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \n#include \n#include \n\nusing namespace std;\n\nint main(){\n int a;\n cin >> a;\n string n;\n int k;\n cin >> k;\n cin >> n;\n\n if (k == 0){\n cout << n;\n return 0;\n }\n if (a == 1) {\n cout << \"0\";\n return 0;\n }\n if (n[0] != '1'){\n n[0] = '1';\n k --;\n }\n int i = 1;\n while (k > 0 || i >= a){\n if (n[i] != '0'){\n n[i] = '0';\n k --;\n }\n ++i;\n }\n cout << n;\n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "0ab141b8f45406e6fcccbe09bf421a66", "src_uid": "0515ac888937a4dda30cad5e2383164f", "apr_id": "c527db78ebd1edfb3d63a3f6ebfdf5d4", "difficulty": 1000, "tags": ["greedy", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9697741011772192, "equal_cnt": 6, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "#include \nusing namespace std;\n\ninline int read()\n{\n\tint x=0,f=1,c=getchar();\n\twhile(c<48) c=='-'&&(f=-1),c=getchar();\n\twhile(c>47) x=x*10+c-'0',c=getchar();\n\treturn x*f;\n}\n\ntypedef long long ll;\nconst int MAXN = 1005;\nconst int mod = 12345;\nstruct node {char c; int k;} a[MAXN];\nint chk[MAXN],vis[MAXN];\nll n,m,ans,r=1;\n\nstruct Matrix\n{\n\tint s[155][155];\n\tMatrix() {memset(s,0,sizeof(s));}\n\tint *operator[](int i) {return s[i];}\n} mat,Q;\n\nMatrix operator *(Matrix a,Matrix b)\n{\n\tMatrix c;\n\tfor(int i=0; i>=1,x=x*x)\n\t\tif(i&1) res=res*x;\n\treturn res;\n}\n\nvoid dfs1(int p,char c,int x,int y)\n{\n\tif(p>m) return ++Q[x][y],void();\n\tfor(int i=0; im)\n\t{\n\t\tint flag=1;\n\t\tfor(char i='A'; i<='Z'; ++i)\n\t\t\tif(vis[i]&&!chk[i]) {flag=0; break;}\n\t\tif(flag) ans=(ans+mat[0][st])%mod; return;\n\t}\n\tint o=chk[a[p].c];\n\tfor(int i=1; i>c,c;};\n\tfor(int i=1; i<=m; ++i)\n\t\tvis[a[i].c=getc()]=1,r*=(a[i].k=read());\n\tfor(char i='A'; i<='Z'; ++i)\n\t\tif(vis[i]) dfs1(1,i,0,0);\n\tmat[0][0]=1; mat=mat*qpow(Q,n);\n\tdfs2(1,0); printf(\"%d\\n\",ans);\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "4e56ca7cbd358c926c879d9bba431f2f", "src_uid": "76d4684d26dac380713a566a1e277c91", "apr_id": "65f614f104718c8e9ec616a3a14a6f95", "difficulty": 2400, "tags": ["matrices", "graphs", "dp"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9285336156696665, "equal_cnt": 10, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 8, "fix_ops_cnt": 10, "bug_source_code": "using namespace std;\n#include \n#define frr(i, r, l) for(int i = r; i >= l; --i)\n#define fr(i, l, r) for(int i = l; i < r; ++i)\n#define forit(it, type, var) for(type::iterator it = var.begin(); it != var.end(); it++)\n#define ii pair\n#define iii pair\n#define MEMS(a,b) memset(a,b,sizeof(a))\n#define fi first\n#define se second\n#define m_p make_pair\n#define pb push_back\n#define ll long long\n#define ld long double\ntypedef pair iPair; \npriority_queue< ll, vector , greater>pq1,pq2;\n#define maxN 1000000000000000000\nll power(ll a,ll b){ll res=1;while(b>0){res*=a;b--;}return res;}\nint main()\n{\n \n ios_base::sync_with_stdio(false);\n cin.tie(NULL);\n ll rc,bc,i,r[200005],b[200005];\n cin>>rc>>bc;\n fr(i,0,r)\n {\n cin>>r[i];\n }\n fr(i,0,b)\n {\n cin>>b[i];\n }\n if(r>b)\n cout<<\"NO\"<\nusing namespace std;\n \nusing ll = long long;\nusing ld = long double;\nusing db = double; \nusing str = string; // yay python!\n\nusing pi = pair;\nusing pl = pair;\nusing pd = pair;\n\nusing vi = vector;\nusing vb = vector;\nusing vl = vector;\nusing vd = vector; \nusing vs = vector;\nusing vpi = vector;\nusing vpl = vector; \nusing vpd = vector;\n\n#define tcT template using V = vector; \ntcT, size_t SZ> using AR = array; \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 = 1e9+7; // 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\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\n#define tcTU tcT, class U\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& 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(u); } // element that doesn't exist from (multi)set\n\n// INPUT\n#define tcTUU tcT, class ...U\ntcT> void re(complex& c);\ntcTU> void re(pair& p);\ntcT> void re(vector& v);\ntcT, size_t SZ> void re(AR& 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& c) { T a,b; re(a,b); c = {a,b}; }\ntcTU> void re(pair& p) { re(p.f,p.s); }\ntcT> void re(vector& x) { trav(a,x) re(a); }\ntcT, size_t SZ> void re(AR& 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\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 c) { \n\tstringstream ss; ss << c; return ss.str(); }\nstr ts(vector v) {\n\tstr res = \"{\"; F0R(i,sz(v)) res += char('0'+v[i]);\n\tres += \"}\"; return res; }\ntemplate str ts(bitset b) {\n\tstr res = \"\"; F0R(i,SZ) res += char('0'+b[i]);\n\treturn res; }\ntcTU> str ts(pair 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 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\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\ntemplate struct Sieve {\n\tvi pr;\n\tint sp[SZ]; // smallest prime that divides\n\tSieve() { // above is faster\n\t\tmemset(sp,0,sizeof sp);\n\t\tFOR(i,2,SZ) {\n\t\t\tif (sp[i] == 0) sp[i] = i, pr.pb(i);\n\t\t\ttrav(p,pr) {\n\t\t\t\tif (p > sp[i] || i*p >= SZ) break;\n\t\t\t\tsp[i*p] = p;\n\t\t\t}\n\t\t}\n\t}\n};\nSieve<2000010> S;\n\nll exp(ll a, int b){\n\tif(b == 0)\n\t\treturn 1;\n\tll p = exp(a, b / 2);\n\tp = (p * p) % MOD;\n\tif(b & 1)\n\t\tp = (p * a) % MOD;\n\treturn p;\n}\n\nint main(){\n\tsetIO();\n\tint n;\n\tcin >> n;\n\tvector asp(n);\n\tmap m;\n\tvi p(n);\n\tF0R(a, n)\n\t\tcin >> p[a];\n\tsort(all(p), [](const int& a, const int& b){return a > b;});\n\tF0R(a, n){\n\t\tif(m[p[a]] == mp(0, 0))\n\t\t\tm[p[a]] = {1, 1}, asp[a] = true;\n\t\telse{\n\t\tint q = p[a] - 1;\n\t\tmap M;\n\t\twhile(q != 1){\n\t\t\tM[S.sp[q]]++;\n\t\t\tq /= S.sp[q];\n\t\t}\n\t\ttrav(b, M){\n\t\t\tauto temp = m[b.f];\n\t\t\tif(temp.f == b.s)\n\t\t\t\tm[b.f] = {temp.f, temp.s + 1};\n\t\t\telse if(temp.f < b.s)\n\t\t\t\tm[b.f] = {b.s, 1};\n\t\t}}\n\t}\n\tbool add = false;\n\tF0R(a, n){\n\t\tif(asp[a]){\n\t\t\tif(m[p[a]].f > 1 || m[p[a]].s > 1)\n\t\t\t\tadd = true;\n\t\t}\n\t\telse{\n\t\t\tbool good = true;\n\t\t\tint q = p[a] - 1;\n\t\t\telse{\n\t\t\tmap M;\n\t\t\twhile(q != 1){\n\t\t\t\tM[S.sp[q]]++;\n\t\t\t\tq /= S.sp[q];\n\t\t\t}\n\t\t\ttrav(b, M){\n\t\t\t\tauto temp = m[b.f];\n\t\t\t\tif(!(temp.f > b.s || temp.s > 1))\n\t\t\t\t\tgood = false;\n\t\t\t}\n\t\t\tif(good)\n\t\t\t\tadd = true;\n\t\t\t}\n\t\t}\n\t}\n\tll lcm = 1;\n\ttrav(a, m)\n\t\tlcm = (lcm * exp(a.f, a.s.f)) % MOD;\n\tcout << (lcm + add) % MOD << endl;\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": "6832844deaeafb7b88754deaf3db36f2", "src_uid": "816a82bee65cf79ba8e4d61babcd0301", "apr_id": "4636d8ad4c5692a4bb36b6ea7a7417cf", "difficulty": 2900, "tags": ["number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.2888135593220339, "equal_cnt": 15, "replace_cnt": 14, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 15, "bug_source_code": "#include \"iostream\"\n#include \n#include \nusing namespace std;\nint Compute(int num)\n{\n int sum=0;\n \n while (num=!0)\n {\n sum+=num%10;\n num=num/10;\n }\n return sum;\n}\nbool Check(int num)\n{\n int digit;\n while (num=!0)\n {\n digit=num%10;\n if (digit!=4 || digit!=7)\n {\n return false;\n }\n num=num/10;\n }\n return true;\n}\nint main ()\n{\n int n;\n int num,num1,num2;\n int sum1=0,sum2=0;\n int divided=1;\n cin >> n;\n cin >> num;\n \n \n if (Check(num))\n {\n cout << \"NO\" << endl;\n return 0;\n }\n int j=n/2;\n for (int k=0;k\n#include \nusing namespace std;\n\n//void dfs(vector> &vec, vector &sign, int i, int total,int ll,int step);\n//int l_sum = 0;\n//int main()\n//{\n//\tint total, step,sum=0;\n//\tcin >> total >> step;\n//\tvector> vec(total,vector(total,0));\n//\tint c1, c2;\n//\twhile (cin >> c1 >> c2)\n//\t{\n//\t\tvec[c1-1][c2-1] = 1;\n//\t\tvec[c2-1][c1-1] = 1;\n//\t}\n//\tvector sign(total, 1);\n//\tfor (int i = 0; i < total; i++)\n//\t{\n//\t\tfor (auto &itm : sign)\n//\t\t\titm = 1;\n//\t\tdfs(vec, sign, i,total,0,step);\n//\t\tsum += l_sum;\n//\t\tl_sum = 0;\n//\t}\n//\tcout << sum / 2 << endl;\n//\treturn 0;\n//}\n//void dfs(vector> &vec, vector &sign, int i,int total,int ll,int step)\n//{\n//\tif (sign[i] != 0)\n//\t{\n//\t\tsign[i] = 0;\n//\t\tl_sum += (ll%step == 0 ? ll / step : ll / step + 1);\n//\t}\n//\t\n//\tfor (int j = 0; j < total;j++)\n//\t{\n//\t\tif (vec[i][j]&&sign[j])\n//\t\t{\n//\t\t\tdfs(vec, sign, j, total, ll+1,step);\n//\t\t}\n//\t}\n//}\n\n//int main()\n//{\n//\tint n, a, b;\n//\tcin >> n >> a >> b;\n//\tint nn = n;\n//\tint all = 0,count=1;\n//\twhile (nn>>=1)\n//\t\tall++;\n//\tif (a > b){\n//\t\tint t;\n//\t\tt = a;\n//\t\ta = b;\n//\t\tb = t;\n//\t}\n//\t\n//\twhile (1)\n//\t{\n//\t\tif (a-b==-1)\n//\t\t\tbreak;\n//\t\tcount++;\n//\t\tif (a % 2 == 0)\n//\t\t\ta /= 2;\n//\t\telse\n//\t\t\ta = (a + 1) / 2;\n//\t\tif (b % 2 == 0)\n//\t\t\tb /= 2;\n//\t\telse\n//\t\t\tb = (b + 1) / 2;\n//\t}\n//\n//\tif (a!=1)\n//\t{\n//\t\twhile (1)\n//\t\t{\n//\t\t\tif (a % 2 == 1)\n//\t\t\t{\n//\t\t\t\tcout << count << endl;\n//\t\t\t\treturn 0;\n//\t\t\t}\n//\t\t\telse\n//\t\t\t{\n//\t\t\t\tif (a == 2)\n//\t\t\t\t{\n//\t\t\t\t\tcount = count + 1;\n//\t\t\t\t\tbreak;\n//\t\t\t\t}\n//\t\t\t\tcount++;\n//\t\t\t\ta /= 2;\n//\t\t\t\tb = (b + 1) / 2;\n//\t\t\t}\n//\t\t}\n//\t}\n//\tif (count == all)\n//\t\tcout << \"Final!\" << endl;\n//\telse\n//\t\tcout << count << endl;\n//\n//\treturn 0;\n//}\n\nint main(){\n\tint n, a, b, r = 1;\n\tcin >> n >> a >> b;\n\tif (a > b) swap(a, b);\n\tif (a == 1 && b == 2) {\n\t\tif (n == 2) cout << \"Final!\" << endl;\n\t\telse cout << r << endl;\n\t\treturn 1;\n\t}\n\n\twhile (1) {\n\t\tr++; n = n / 2;\n\t\tif (a % 2) a = a / 2 + 1;\n\t\telse a = a / 2;\n\t\tif (b % 2) b = b / 2 + 1;\n\t\telse b = b / 2;\n\t\tif (a + 1 == b) {\n\t\t\tif (n == 2) cout << \"Final!\" << endl;\n\t\t\telse cout << r << endl;\n\t\t\treturn 1;\n\t\t}\n\t}\n\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "3026464cb0e35960c9d49c20f9a516fc", "src_uid": "a753bfa7bde157e108f34a28240f441f", "apr_id": "710fc08ec8a7b61f5033a8dad3fb8c18", "difficulty": 1200, "tags": ["constructive algorithms", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.14131501472031405, "equal_cnt": 14, "replace_cnt": 13, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 14, "bug_source_code": "#include \n#include \nusing namespace std;\n\nint main(){\n int n;\n int finger_num;\n int finger_sum;\n scanf(\"%d\",&n);\n finger_sum=0;\n for(int i=0 ; i2){\n finger_dima=1;\n }\n else{\n finger_dima=n-r+3;\n }\n printf(\"%d\\n\",finger_dima);\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "e40916c3d700b64b520314a424054c81", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "apr_id": "883dae52f84053cef290c249fc042f98", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9385593220338984, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "#include \n\nusing namespace std;\nchar s[7][15]={\"monday\",\"tuesday\",\"wednesday\",\"thursday\",\"friday\",\"saturday\",\"sunday\"};\nint main()\n{\n char a[2][15];\n int b[2];\n int i,j;\n cin>>a[0];\n cin>>a[1];\n for( j=0;j<2;j++)\n for( i=0;i<7;i++){\n if(strcmp(a[j],s[i]))\n b[j]=i+1;\n }\n\n\n if(b[0]==b[1]||(b[0]+2)%7==b[1]%7||(b[0]+3)%7==b[1]%7)\n cout<<\"YES\"<\n#include \nusing namespace std;\nint main()\n{\n\tt:\n\tint x,artsay=0,eksay=0;\n\tcin>>x;\n\tchar d[x];\n\tfor(int c=0;c>d[c];\n\t}\n\tfor(int a=0;aartsay)\n\t\t{\n\t\t\tcout<<0;\n\t\t}\n\t\telse{\n\t\t\tcout<\n#include\n#include\n#include\n#include\n#define REP(i,m) for(int i=0;i void debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr< pi;\nlint k;\nint m;\nstatic const int MF=31;\nstring fib[MF+5];\nint table[100005];\nvoid maketable(string& s){\n\tint n=key.size();\n\ttable[0]=-1;\n\tkey+='$';\n\tfor(int i=1;i<=n;++i){\n\t\tint j=table[i-1];\n\t\twhile(j>=0 && key[j+1]!=key[i]) j=table[j];\n\t\tif(key[j+1]==key[i]) ++j;\n\t\ttable[i]=j;\n\t}\n}\n\nint calc(string& key,string& s){\n\tif(s.size()=0 && key[j+1]!=s[i]) j=table[j];\n\t\tif(key[j+1]==s[i]) ++j;\n\t\tif(j==n-1) ++res;\n\t}\n\tkey.resize(key.size()-1);\n\treturn res;\n}\n\nlint BASE[4][4]={\n\t{1,1,1,0},\n\t{1,2,1,1},\n\t{0,0,1,0},\n\t{0,0,0,1}\n};\ntypedef lint item ;//use as :typedef lint item;\ntypedef vector vec;\ntypedef vector > mat;\nconst lint mod=1000000007;\n\nmat tmp(4,vec(4)),tmp2(4,vec(4));\nvoid matpow(mat& a,const mat& b){\n\tint n=a.size();\n\tREP(i,n) REP(j,n){\n\t\ttmp[i][j]=0;\n\t\tREP(k,n){\n\t\t\ttmp[i][j]+=a[i][k]*b[k][j];\n\t\t\ttmp[i][j]%=mod;\n\t\t }\n\t}\n\ta=tmp;\n}\n\nvoid mpow(mat& a,lint k){\n\tint n=a.size();\n\tREP(i,n) REP(j,n) tmp2[i][j]=0;\n\tREP(i,n) tmp2[i][i]=1;\n\twhile(k){\n\t\tif(k&1) matpow(tmp2,a);\n\t\tmatpow(a,a);\n\t\tk>>=1;\n\t}\n\ta=tmp2;\n}\n\nlint solve(string& s){\n\n\tint ind=0;\n\twhile(fib[ind].size()<=s.size()) ++ind;\n\tmaketable(s);\n\tif(ind>k) return calc(s,fib[k]);\n\tint a=calc(s,fib[ind]),b=calc(s,fib[ind+1]),c=calc(s,fib[ind+2]),d=calc(s,fib[ind+3]);\n\t\n\tint addA=c-a-b,addB=d-b-c;\n\n\tlint rest=k-ind;\n\tlint odd=(rest&1);\n\trest=rest/2;\n\n\tmat M(4,vec(4));\n\tREP(i,4) REP(j,4) M[i][j]=BASE[i][j];\n\n\tmpow(M,rest);\n\tvec init(4);\n\tinit[0]=a;init[1]=b;init[2]=addA;init[3]=addB;\n\tlint res=0;\n\tif(odd){\n\t\tREP(i,4) res+=M[1][i]*init[i]%mod;\n\t\tres%=mod;\n\t}else{\n\t\tREP(i,4) res+=M[0][i]*init[i]%mod;\n\t\tres%=mod;\n\t}\n\treturn res;\n}\nint main(){\n\tfib[1]=\"a\";fib[2]=\"b\";\n\tfor(int i=3;i>k>>m;\n\tstring s;\n\tREP(hoge,m){\n\t\tcin>>s;\n\t\tsolve(s);\n\t\tcout<\n\nusing namespace std;\n\nint a,b,c;\nint x,y,z;\nint nr1,nr2;\n\nint main()\n{\n cin>>a>>b>>c;\n cin>>x>>y>>z;\n\n if(a>x)\n {\n nr1+=x;\n a-=x;\n }\n if(b>y)\n {\n nr1+=y;\n b-=y;\n }\n if(c>z)\n {\n nr1+=z;\n c-=z;\n }\n nr2+=x+y+z;\n nr1=nr1+a/2+b/2+c/2;\n if(nr2==0) cout<<\"No\";\n else\n if(nr1>=nr2)\n cout<<\"Yes\";\n else\n cout<<\"No\";\n\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "9aeacc6fadbc939b4bce985e73399b93", "src_uid": "1db4ba9dc1000e26532bb73336cf12c3", "apr_id": "013bca21bb15d40b7f21ffc5840d68d1", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9962546816479401, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include\nusing namespace std;\nstring s,t;\nint i,j;\nmain()\n{\n \n cin>>s>>t;\n for(i=1;i\nusing namespace std;\nint main()\n{\n int x,z,m,c,d,f,e,n;\n d=f=e=0;\n cin>>x>>z;\n n=1;\n while(n<=6)\n {\n m=x-n;\n c=z-n;\n if(m<0)\n {\n m=m*-1;\n }\n if(c<0)\n {\n c=c*-1;\n }\n if(c>m)\n {\n d++;\n }\n if(m>c)\n {\n e++;\n }\n if(m==c)\n {\n f++;\n }\n n++;\n }\n cout<\nusing namespace std;\nint main()\n{\n\tint n, p, k;\n\tcin >> n >> p >> k;\n\tif ((p - k <= 1))\n\t{\n\t\tint i = 1;\n\t\twhile (i != p)\n\t\t{\n\t\t\tcout << i<<\" \";\n\t\t\t++i;\n\t\t}\n\t\tcout << \"(\" << p << \")\"<<\" \";\n\t\tif ((p + k >= n))\n\t\t{\n\t\t\tint j = p + 1;\n\t\t\twhile (j!=n)\n\t\t\t{\n\t\t\t\tcout << j << \" \";\n\t\t\t\t++j;\n\t\t\t}\n\t\t\tcout << n;\n\t\t}\n\t\tif ((p + k >\";\n\t\t}\n\t\treturn 0;\n\n\t}\n\tif ((p - k) > 1)\n\t{\n\t\tcout << \"<<\"<<\" \";\n\t\tint i = p - k;\n\t\twhile (i != p)\n\t\t{\n\t\t\tcout << i << \" \";\n\t\t\t++i;\n\t\t}\n\t\tcout << \"(\" << p << \")\" << \" \";\n\t\tif ((p + k >= n))\n\t\t{\n\t\t\tint j = p + 1;\n\t\t\twhile (j != n)\n\t\t\t{\n\t\t\t\tcout << j << \" \";\n\t\t\t\t++j;\n\t\t\t}\n\t\t\tcout << n;\n\t\t}\n\t\tif ((p + k >\";\n\t\t}\n\t}\n\treturn 0;\n}", "lang": "MS C++", "bug_code_uid": "3b8194ae3da45ab56587236e5e682a6e", "src_uid": "526e2cce272e42a3220e33149b1c9c84", "apr_id": "8d8a2d6ee9c5b1cab92d687457d29e32", "difficulty": null, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.746604578967792, "equal_cnt": 15, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 14, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\ntypedef long long ll;\n\nconst int Maxn = 20;\nconst int Maxl = 16;\nconst string let = \"0123456789abcdef\";\n\nll C[Maxn][Maxn];\nll k;\nint t,cur[Maxl];\nint ans[Maxn];\n\nll Solve(int n, const int *av, bool fl = false)\n{\n\tstatic int dp[1000]; memset(dp,0,sizeof(dp));\n\tif (fl && av[0] <= 0) return 0;\n\tfor (int i = 0; i < Maxl; i++)\n\t\tif (av[i] < 0) return 0;\n\tdp[n - fl] = 1;\n\tfor (int i = 0; i < Maxl; i++)\n\t\tfor (int j = 0; j <= n; j++)\n\t\t\tfor (int k = 1; k <= j && k <= av[i] - (fl && i == 0); k++)\n\t\t\t\tdp[j - k] += dp[j] * C[j][k];\n\treturn dp[0];\n}\n\nint main()\n{\n\t//freopen(\"11input.in\",\"r\",stdin);\n\tfor (int i = 0; i < Maxn; i++) {\n\t\tC[i][0] = C[i][i] = 1;\n\t\tfor (int j = 1; j < i; j++)\n\t\t\tC[i][j] = C[i - 1][j - 1] + C[i - 1][j];\n\t}\n\tcin >> k >> t;\n\tint len = 1;\n\tfill(cur,cur+Maxl,t);\n\tll got;\n\twhile ((got = Solve(len, cur) - Solve(len, cur, true)) < k) { \n\t\tk -= got; len++; \n\t}\n\tfor (int i = 0; i < len; i++) {\n\t\tans[i] = (i? 0: 1); cur[ans[i]]--;\n\t\twhile ((got = Solve(len - 1 - i, cur)) < k) {\n\t\t\tk -= got; cur[ans[i]]++;\n\t\t\tans[i]++; cur[ans[i]]--;\n\t\t}\n\t\tprintf(\"%c\", let[ans[i]]);\n\t}\n\tprintf(\"\\n\");\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "21da4fe6780685b0e2d1ee288a8613f8", "src_uid": "cbfc354cfa392cd021d9fe899a745f0e", "apr_id": "8490e30bb13a10972d32a17663bab595", "difficulty": 2500, "tags": ["brute force", "dp", "math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9975845410628019, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#pragma GCC optimize (\"O3\")\n#pragma GCC target (\"sse4\")\n\n#include \nusing namespace std;\n\nusing ii = pair;\nusing ll = long long;\n\nconst int N = 20;\nconst int mod = 1e9 + 7;\nint C[N][N];\nll k;\nint t;\nint ans[N];\nll solve(int n, vector & v, bool f = false){\n\tif(f && v[0] <= 0)return 0;\n\tfor(int i = 0; i < v.size(); i++){\n\t\tif(v[i] < 0)return 0;\n\t}\n\tvectordp(n + 1, 0);\n\tdp[n-f] = 1;\n\tfor(int i = 0; i < v.size(); i++)\n\t\tfor(int j = 0; j <= n; j++)\n\t\t\tfor(int k = 1; k <= j && k <= v[i] - (f && i == 0); k++)\n\t\t\t\tdp[j-k] += dp[j] * C[j][k];\n\treturn dp[0];\n}\nint main() {\n#ifdef ONLINE_JUDGE\n\tios_base::sync_with_stdio(0);\n\tcin.tie(0);\n#endif // ONLINE_JUDGE\n\n\tscanf(\"%lld%d\", &k, &t);\n\n\tfor(int i = 0; i < N; i++)\n\t\tfor(int j = 0; j <= i; j++)\n\t\t\tC[i][j] = (j == 0 ? 1 : C[i-1][j] + C[i-1][j-1]);\n\tint len = 1;\n\tvectorcur(16,t);\n\twhile(true){\n\t\tll x = solve(len,cur) - solve(len, cur, true);\n\t\tif(x >= k)break;\n\t\tk -= x;\n\t\tlen++;\n\t}\n\tfor(int i = 0; i < len; i++){\n\t\tfor(int j = i == 0; j < 16; j++){\n\t\t\tcur[j]--;\n\t\t\tll x = solve(len-i-1,cur);\n\t\t\tif(x >= k){\n\t\t\t printf(\"%x\", j);\n\t\t\t break;\n\t\t\t} k-=x;\n\t\t\tcur[j]++;\n\t\t}\n\t}\n\n\tint mx = 0;\n\tfor(auto x : cur)mx = max(mx,t-cur);\n\n\tassert(mx < 3);\n\n\treturn 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "52b33be450b5ca7003a82b3616fbac25", "src_uid": "cbfc354cfa392cd021d9fe899a745f0e", "apr_id": "4e7619e763ea8471519a7bec5fc8a679", "difficulty": 2500, "tags": ["brute force", "dp", "math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8152588555858311, "equal_cnt": 11, "replace_cnt": 4, "delete_cnt": 6, "insert_cnt": 0, "fix_ops_cnt": 10, "bug_source_code": "#include \n#include \n#include \nlong long \n\tn, k, m, \n\ts = 0;\nstd::vector cc(100*100*10*1001, 0);\nlong long pow10(int n, long long m) {\n\tlong long p = 1;\n\tfor(int i = 0; i= 0) {\n\t\tr = (d*b + r) % k;\n\t\tb = (b*10) % k;\n\t\tif (r == 0 && d != 0) {\n\t\t\tif (n-l == 1)\n\t\t\t\treturn 1;\n\t\t\tif (n-l == 2)\n\t\t\t\treturn 1 * 9;\n\t\t\tif (n-l > 2)\n\t\t\t\treturn 1 * 9 * pow10(n-l-2, m);\n\t\t}\n\t\tif (l == n-1)\n\t\t\treturn 0;\n\t}\n\tlong long s = 0;\n\tfor(int i=0; i<=9; ++i) {\n\t\tint ind = r*11*11*1001 + b*11*1001 + i*1001 + (l+1);\n\t\tif (ind >= cc.size()) {\n\t\t\tint bp = 0;\n\t\t}\n\t\tif (cc[ind])\n\t\t\ts = (s + (cc[ind]-1)) % m;\n\t\telse {\n\t\t\tlong long blabla = cc[ind];\n\t\t\tcc[ind] = suf(l+1, i, b, r)+1;\n\t\t\ts = (s + (cc[ind]-1)) % m;\n\t\t}\n\t}\n\treturn s;\n}\nint main() {\n\tscanf(\"%I64d %I64d %I64d\", &n, &k, &m);\n\ts = suf(-1, 0, 1, 0);\n\tprintf(\"%d\\n\", s % m);\n\treturn 0;\n}\n", "lang": "MS C++", "bug_code_uid": "a685f7c1d8e820cd092ab7d6dfaff0d4", "src_uid": "656bf8df1e79499aa2ab2c28712851f0", "apr_id": "331c47b4dfe921657caea689181483cd", "difficulty": 2200, "tags": ["dp", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9833333333333333, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include\n\nusing namespace std;\n\ntypedef long long ll;\n\nconst int MAXN=1e2+10;\n\nll n,k;\n\nint main() {\n //freopen(\"input.txt\",\"r\",stdin);\n //freopen(\"output.txt\",\"w\",stdout);;;;;;\n\n while(~scanf(\"%I64d %I64d\",&n,&k)) {\n while(1);\n ll red=0,green=0,blue=0;\n if(2*n%k==0)\n red=2*n/k;\n else\n red=2*n/k+1;\n if(5*n%k==0)\n green=5*n/k;\n else\n green=5*n/k+1;\n if(8*n%k==0)\n blue=8*n/k;\n else\n blue=8*n/k+1;\n printf(\"%I64d\\n\",red+green+blue);\n }\n\n return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "be403ffa21a782be26b955ad35686767", "src_uid": "d259a3a5c38af34b2a15d61157cc0a39", "apr_id": "bf55bb0eea16a9665dcec082c89cc5fa", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9939148073022313, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include \nusing namespace std;\n\n\nint main() {\n long long n;\n cin >> n;\n if(n%3==0)\n {\n long long n1=n/3;\n long long i,j,a,b,c,x,m;\n long long count=0;\n vector v;\n for(i=2;i<=sqrt(n1);i++)\n {\n if(n1%i==0)\n {\n v.push_back(i);\n }\n }\n for(i=0;v[i]*v[i]*v[i]<=n1;i++)\n {\n if(n1%v[i]==0)\n {\n for(j=i;v[i]*v[j]*v[j]<=n1;j++)\n {\n if(n1%(v[i]*v[j])==0)\n {\n m=n1/(v[i]*v[j]);\n if(m!=1&&v[i]<=v[j]&&v[j]<=m)\n {\n x=v[i]+v[j]+m;\n if(x%2==0)\n {\n x=x/2;\n a=x-v[i];\n b=x-v[j];\n c=x-m;\n if(a>0&&b>0&&c>0)\n {\n //cout << i << \" \" << j << \" \" << m << endl;\n if(a!=b&&b!=c)\n {\n count+=6;\n }\n else if((a==b&&b!=c)||(b==c&&c!=a)||(c==a&&a!=b))\n {\n count+=3;\n }\n else if(a==b&&b==c)\n {\n count+=1;\n }\n }\n }\n }\n }\n }\n }\n }\n cout << count;\n }\n else\n {\n cout << \"0\";\n }\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "ace0a97bbcc321f7ac98053f29f0808f", "src_uid": "07e58a46f2d562a44b7c771edad361b4", "apr_id": "6a347040f167e27853ccbb99404500ec", "difficulty": 2400, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.7101787101787101, "equal_cnt": 22, "replace_cnt": 12, "delete_cnt": 4, "insert_cnt": 6, "fix_ops_cnt": 22, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n int a[6],i,j=0;\n int b[10],c[6];\n for(i=0;i<6;i++)\n {\n cin>>a[i];\n x=a[i];\n b[x]++;\n }\n for(i=0;i<9;i++)\n {\n if(b[i]!=0)\n {\n c[j]=b[i];\n j++;\n }\n }\n sort(c,c+3);\n if(c[0]=='0' && c[1]=='1' && c[2]=='5')\n cout<<\"Beer\"<\n#include\n\nusing namespace std;\n\n//FILE *input=freopen(\"input.txt\",\"r\",stdin);\n\n#define MAX 210000\n\nint n,d;\n\nint a[MAX];\nint b[MAX];\n\nlong long int x;\n\nvoid swap(int &a,int &b){\n\tint c;\n\tc=a;\n\ta=b;\n\tb=c;\n}\nint getNextX() {\n x = (x * 37 + 10007) % 1000000007;\n return x;\n}\nvoid initAB() {\n\tint i;\n for(i = 0; i < n; i = i + 1){\n a[i] = i + 1;\n }\n for(i = 0; i < n; i = i + 1){\n swap(a[i], a[getNextX() % (i + 1)]);\n }\n for(i = 0; i < n; i = i + 1){\n if (i < d)\n b[i] = 1;\n else\n b[i] = 0;\n }\n for(i = 0; i < n; i = i + 1){\n swap(b[i], b[getNextX() % (i + 1)]);\n }\n}\n\nint next_one[MAX];\n\nstruct xy{\n\tint x,y;\n}aa[MAX];\n\nbool sort_x(xy a,xy b){\n\tif(a.x=0;i--){\n\t\tnext_one[i]=one_index;\n\t\tif(b[i-1]==1)\n\t\t\tone_index=i;\n\t}\n\tfor(i=1;i<=n;i++){\n\t\taa[i].x=a[i-1];\n\t\taa[i].y=i;\n\t\tbb[i]=b[i-1];\n\t}\n\n\tsort(aa+1,aa+n+1,sort_x);\n\tfor(i=1;i<=n+1;i++){\n\t\tc[i]=-1;\n\t\tteleport[i]=-1;\n\t}\n\tfor(i=n;i>=1;i--){\n\t\tnow=next_one[0];\n\n\t\twhile(1){\n\t\t\tif(now>n-aa[i].y+1)\n\t\t\t\tbreak;\n\t\t\tif(c[now+aa[i].y-1]==-1)\n\t\t\t{\n\t\t\t\tc[now+aa[i].y-1]=aa[i].x;\n\t\t\t\tteleport[now+aa[i].y-1]=now+aa[i].y;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tnow=get_tel(now+aa[i].y-1)-aa[i].y+1;\n\t\t\t\tif(now==n+1)\n\t\t\t\t\tbreak;\n\t\t\t\tif(bb[now]==0)\n\t\t\t\t\tnow=next_one[now];\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tnow=next_one[now];\n\t\t}\n\t}\n\n\tfor(i=1;i<=n;i++){\n\t\tprintf(\"%d\\n\",c[i]);\n\t}\n\n\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "cb166e013845a0a975c9ed6ae9ee98a9", "src_uid": "948ae7a0189ada07c8c67a1757f691f0", "apr_id": "4f9c68fb3efc5d033b96fb380642b886", "difficulty": 2300, "tags": ["probabilities"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.530278232405892, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "#include \n#include \n\nusing namespace std;\n\nint main(){\n string n;\n cin>>n;\n int r=0,p=n.size(),f;\n char x;\n\n for(int i=0;i\nusing namespace std;\nlong long binpow(long long a, long long b) {\n long long res = 1;\n while (b > 0) {\n if (b & 1)\n res = res * a;\n a = a * a;\n b >>= 1;\n }\n return res;\n}\nint main()\n{\n long long n; cin >> n;\n if(n==3)\n {\n cout << 24;\n exit(-1); \n }\n long long ans=4*(6*binpow(4,n-3)+9*binpow(4,n-4));\n cout << ans << endl;\n}", "lang": "GNU C++14", "bug_code_uid": "c5f0045c587fb6ca4a1a3ff5ebbb97d0", "src_uid": "3b02cbb38d0b4ddc1a6467f7647d53a9", "apr_id": "1a9fa1d7478dc31e9d080c2eda1b564d", "difficulty": 1700, "tags": ["math", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.33210332103321033, "equal_cnt": 11, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "#include \n#include \nusing namespace std;\nint A[7],s,ok,F[7];\nvoid bkt(int poz)\n{\n if(poz==7)\n {\n int sum=0;\n for(int i=1;i<=poz;i++)\n if(F[i]==1)\n sum+=A[i];\n if(2*sum==s)\n ok=1;\n }\n else\n {\n for(int i=poz;i<=6;i++)\n {\n F[i]=1;\n bkt(i+1);\n F[i]=0;\n bkt(i+1);\n }\n }\n}\nint main()\n{\n for(int i=1;i<=6;i++)\n cin>>A[i];\n sort(A+1,A+6+1);\n s=0;\n for(int i=1;i<=6;i++)\n s+=A[i];\n bkt(1);\n if(ok==1)\n cout<<\"YES\";\n else\n cout<<\"NO\";\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "3a17e5ca8c8703e66f0390b2145077a4", "src_uid": "2acf686862a34c337d1d2cbc0ac3fd11", "apr_id": "a3022e2bad802406778fcf6a3a90b12a", "difficulty": 1000, "tags": ["brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.25183823529411764, "equal_cnt": 12, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "#include\nusing namespace std;\ntypedef long long ll;\nll n;\n\nll com(ll a,ll b)\n{\n if(a==b)\n return 1;\n if(b==1)\n return n;\n if(b==0)\n return 1;\n return (com(a-1,b)+com(a-1,b-1));\n}\n\nint main()\n{\n cin>>n;\n ll m=2*n-2;\n ll baki=m-n;\n ll maki=baki+1;\n ll p=com(baki*3,baki)*maki*4;\n cout<\n#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);\n#define lli long long int\n#define ulli unsigned long long int\n#define ff first\n#define ss second\n#define mp make_pair\n#define pb push_back\n#define pf pop_front()\n#define lb lower_bound\n#define ub upper_bound\n#define bs binary_search\n#define loopl(i,a,b) for(lli i=a;i b) return gcd(a%b, b);\n return gcd(a, b%a);\n}\n\n\n/*lli v[10000001]={0};\nvoid seive()\n{\n\tbool prime[10000000+1];\n\tmemset(prime, true, sizeof(prime));\n\n\tfor (lli p=2; p*p<=10000000; p++)\n\t{\n\t\tif (prime[p] == true)\n\t\t{\n\t\t\tfor (int i=p*2; i<=10000000; i += p)\n\t\t\t\tprime[i] = false;\n\t\t}\n\t}\n\n\tfor (int p=2; p<=10000000; p++)\n\tif (prime[p])\n\t\tv[p]=1;\n}*/\n\n/*vector v[100010];\nbool vis[100010];\nbool tree;\n//lli count=0; \nvoid dfs(lli n, lli par)\n{\n vis[n] = 1;\n \n loopl(i,0,v[n].size())\n {\n if (vis[v[n][i]] == 0)\n {\n dfs(v[n][i], n);\n //count++;\n }\n else if (v[n][i] != par)\n {\n tree = 0;\n }\n }\n}*/\n\n/*lli power(lli x, lli y, lli p)\n{\n lli res = 1; \n \n x = x % p; \n \n while (y > 0)\n {\n if (y & 1)\n res = (res*x) % p;\n \n y = y>>1; \n\t\tx = (x*x) % p; \n }\n return res;\n}*/\n\nint main()\n{\n\t////////////////////\n\tfastio;\n\t///////////////////\n \n lli n,m;\n cin>>n>>m;\n lli a[m];\n map q;\n for(lli i=0;i>a[i];\n q[a[i]]++;}\n lli maxi=-1;\n if(q.size()==1)\n {\n map::iterator it=q.begin();\n cout<ss/n<ss/j,cnt=j; \n if(cnt==n) \n {maxi=max(maxi,save); continue;}\n map::iterator it=q.begin();it++;\n for(it;it!=q.end();it++)\n {\n cnt+=it->ss/save;\n //chance++;\n if(cnt==n)\n {\n maxi=max(maxi,save);\n continue;\n }\n \n }\n }\n }\n \n cout<\nusing namespace std;\n\nbool check(int a,int b,int c,int x);\n\nint main()\n{\n int x,y;\n cin>>x>>y;\n int a=y,b=y,c=y;\n while(check(a,b,c,x)==true)\n {\n int k=min(a,min(b,c));\n if(k==b)\n {\n int tmp=a;\n a=b;\n b=tmp;\n }\n else if(k==c)\n {\n int tmp=a;\n a=c;\n c=tmp;\n }\n \n int s=b+c;\n if(s>x)\n {\n a=x;\n sum++;\n }\n else\n {\n a=s-1;\n sum++;\n }\n }\n cout<\n#include \n\nusing namespace std;\n\nint main() {\n int x, y;\n scanf(\"%d %d\", &x, &y);\n\n vector sides(x, 3);\n int moves = 0;\n while (sides[2] != y) {\n // change the biggest one\n // sides[0] + sides[2] == sides[1] + 1\n sides[2] = max(sides[1] + 1 - sides[0], y);\n sort(sides.begin(), sides.end());\n moves += 1;\n }\n\n printf(\"%d\\n\", moves);\n\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "c817c4f3df68d7083077ac09ba45b4b5", "src_uid": "8edf64f5838b19f9a8b19a14977f5615", "apr_id": "eebcabdc3f2e1e5a895024a6ce9fac57", "difficulty": 1600, "tags": ["math", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9980461117624072, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \n#define ll long long\n#define ull unsigned long long\n#define pb push_back\n#define popb pop_back\n#define fo(i , a , b) for (int i = (a); i < (b); ++i)\n#define forr(i , b) fo( i , 0 , b )\n#define carr( n , array ) forr(i , n) cin >> array[i]\n#define cmap( n , map ) forr (i , n) {ll x ; cin >> x ; map [x] ++ ; }\n#define cpmap( n , map ) forr (i , n) {ll x , y ; cin >> x >> y ; map [x] = y ; }\n#define F first\n#define S second\n#define IF ->first\n#define IS ->second\n\nconst ll max9 = 10 + 1e9 , max6 = 10 + 1e6 , max12 = 10 + 1e12 , max15 = 10 + 1e15 ;\nconst ll min6 = -1 * max6 , min9 = -1 * max9 , min12 = -1 *max12 , min15 = -1 * max15 ;\nconst ll R = 7 + 1e9 , NN = 10 + 1e5 ;\nusing namespace std;\nll k , n , s , p ;\nll check(ll x){\n ll q = x * p ;\n q /= k ;\n q *= s ;\n if (q < n) return -2 ;\n x -- ;\n q = x * p ;\n q /= k ;\n q *= s ;\n if (q < n) return x + 1 ;\n return -1 ;\n}\nll BinS(ll st , ll en){\n ll mid = st + (en - st) / 2 ;\n ll test = check(mid) ;\n if (test == -1) return BinS(st , mid - 1) ;\n if (test == -2) return BinS(mid + 1 , en) ;\n return test ;\n}\nint main()\n{\n ios_base::sync_with_stdio(false); cin.tie(NULL);\n cin >> k >> n >> s >> p ;\n cout << BinS(1 , 10000) ;\n return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "8381fd2377cb530757fdfbbb3f8b5780", "src_uid": "73f0c7cfc06a9b04e4766d6aa61fc780", "apr_id": "fbdd33786ccbd3c55289b85c92250766", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.41975308641975306, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "#include \n\nusing namespace std;\nint a[10000000]; \nint main() {\n\tint n,k,lol=0;\n\tcin >> n>>k;\n\tfor (int i = 1; i <= n; i++) { a[i] = i; }\n\tif (n < k) { k = n; }\n\tfor (int i = 1; i <= k; i++) {\n\t\tint c = a[n - i + 1];\n\t\ta[n - i + 1] = a[i];\n\t\ta[i] = c;\n\t}\n\tfor (int i = 1; i a[j]) { lol++; }\n\t\t}\n\t}\n\tcout << lol << endl;\n\t cin >> n;\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "6b50dfb359f71b17708da9fb8112f7be", "src_uid": "ea36ca0a3c336424d5b7e1b4c56947b0", "apr_id": "49c61181828343db03ee0098ee1bbf48", "difficulty": 1200, "tags": ["math", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.016780283167278448, "equal_cnt": 15, "replace_cnt": 12, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 16, "bug_source_code": "\n\n\t\n\t\n\t\t\n\n", "lang": "GNU C++", "bug_code_uid": "d575a9f16f4fe03be49d7fb37a5d81e9", "src_uid": "be82b8f209217875221ebe5de8675971", "apr_id": "e1a4f3137035369f549a9fa20ba64f9d", "difficulty": 2100, "tags": ["data structures", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9992967651195499, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \n#include \n#include \n#define MAXN 1000005\n\nusing namespace std;\n\nint n, a[MAXN], next[MAXN], prev[MAXN];\n\nmain()\n{\n scanf(\"%d\", &n);\n for (int i = 1; i <= n; i++) scanf(\"%d\", a + i);\n int m, x;\n scanf(\"%d\", &m);\n for (int i = 0; i < m; i++)\n {\n scanf(\"%d\", &x); \n a[x] = - a[x];\n }\n \n stack s, t;\n for (int i = 1; i <= n; i++) \n if (a[i] < 0)\n {\n while (!s.empty())\n {\n if (a[s.top()] + a[i] == 0 && t.empty()) break;\n if (!t.empty() && a[s.top()] == a[t.top()])\n {\n a[t.top()] = - a[t.top()];\n s.pop();\n t.pop();\n }\n else \n {\n t.push(s.top());\n s.pop();\n }\n }\n if (!t.empty() || s.empty()) \n {\n printf(\"NO\");\n return 0;\n }\n \n \n s.pop();\n \n }\n else s.push(i);\n \n while (!s.empty() )\n if (!t.empty() && a[s.top()] == a[t.top()])\n {\n a[t.top()] = - a[t.top()];\n s.pop();\n t.pop();\n }\n else \n {\n t.push(s.top());\n s.pop();\n } \n \n if (!t.empty())\n {\n printf(\"NO\");\n return 0;\n }\n \n printf(\"YES\\n\");\n for (int i = 1; i <= n; i++) printf(\"%d \", a[i]);\n system(\"pause\");\n}\n", "lang": "GNU C++", "bug_code_uid": "64028d36d91ebbc5831b8612d9ce5b26", "src_uid": "be82b8f209217875221ebe5de8675971", "apr_id": "df04816d0023165805eba09e5dd8f9af", "difficulty": 2100, "tags": ["data structures", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9860320744956027, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": " #include\nusing namespace std;\n#define FIO ios_base::sync_with_stdio (false) ;cin.tie(NULL);\n#define tc int t;cin>>t;for(int p=1;p<=t;p++)\n#define ll long long int\n#define forn(i,n) for(int i=0;i0){ if(b&1){ ans=ans*a;} a=a*a; b=b/2; } return ans; }\nint main(){\n ll n,t;\n cin>>n;\n ll arr[30];\n ll ans=0;\n ll k=0;\n memset(arr,0,sizeof(arr));\n while(n>0){\n arr[k]=n%3;\n n=n/3;\n \n k++;\n \n }\n int flag=1;\n ll num;\n \n for(ll i=0;i<30;i++){\n if(arr[i]){\n if(flag){\n flag=0;\n num=power(3,i+1);\n \n ans++;\n }else{\n \n ll temp=power(3,i);\n \n temp=temp/num;\n \n temp*=arr[i];\n ans+=temp;\n }\n }\n \n }\n cout<\n#include\nusing namespace std;\ntypedef long long ll;\nconst ll inf = 1e4+5;\nll a, b, c;\n\nint main()\n{\n\tscanf(\"%lld%lld%lld\", &a, &b, &c);\n\tif(a==b||b==c||c==a||a==1||b==1||c==1)\n\t{\n\t cout<<\"YES\"<\n#include \nusing namespace std;\n\nvoid main()\n{\n int n;\n cin >> n;\n\n if (n == 4) cout << 1;\n else if (n == 7) cout << 2;\n else\n {\n int x = n, k = 0, r, f;\n while (x != 0)\n {\n k++;\n x = x / 10;\n }\n if (n /(int) pow(10, k - 1) == 4) r = (int)pow(2, k) - 1;\n\n if (n / (int)pow(10, k - 1) == 7) r = (int)pow(2, k) + (int)pow(2, k - 1) - 1;\n\n while (k - 1)\n {\n n = n % (int)pow(10, k - 1);\n\n f = n / (int)pow(10, k - 2);\n\n if (f == 7) r += (int)pow(2, k - 2);\n k--;\n }\n cout << r;\n }\n}", "lang": "MS C++", "bug_code_uid": "1117adf0e5decff8d15560addadce83c", "src_uid": "6a10bfe8b3da9c11167e136b3c6fb2a3", "apr_id": "22581237b98b47cffc5a4090760754ec", "difficulty": 1100, "tags": ["bitmasks", "brute force", "combinatorics", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.2911437791323055, "equal_cnt": 6, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "/*\nID: john320\nPROG : xor-mst\nLANG : C++11\n*/\n\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nstruct P {\n\n\tint ew;\n\tint v1;\n\tint v2;\n\n};\n\nvector

G;\t\t\t//input vector of edge/vertex pairs\nvector

iVert;\t\t//vector of edges and vertices included in shortest set\nset Vonly;\t\t//set of vertices only\nP tempP;\nbool srt(P p1, P p2) { return p1.ew < p2.ew; }\n\n\nvector< vector > tbl;\n\nunsigned int n;\n\nint main() {\n\n\tint maxx = INT32_MAX;\n\tint len = 0;\n\n\tvector

::iterator z;\n\tset ::iterator y;\n\n\tcin >> n;\n\n\tfor (unsigned int i = 0; i < n; i++) {\n\t\tfor (unsigned int j = i+1; j < n; j++) {\n\t\t\ttempP.ew = i ^ j;\n\t\t\tif (tempP.ew != 0) {\n\t\t\t\ttempP.v1 = i;\n\t\t\t\ttempP.v2 = j;\n\t\t\t\tG.push_back(tempP);\n\t\t\t\tswap(tempP.v1, tempP.v2);\n\t\t\t\tG.push_back(tempP);\n\t\t\t}\n\t\t}\n\t}\n\n\tsort(G.begin(), G.end(), srt);\n\t//for (int i = 0; i < G.size(); i++) cout << G[i].ew << \", \" << G[i].v1 << \", \" << G[i].v2 << endl;\n\t\n\n\t//put shortest edge on output stack , and vertices into vertex set. Increment sum of edges\n\t//iVert.push_back(G[0]);\n\tVonly.insert(G[0].v1);\n\tVonly.insert(G[0].v2);\n\tlen += G[0].ew;\n\n\t//as each element is added to output, or larger duplicate path encountered, remove from vector, until empty\n\tG.erase(G.begin());\n\n\twhile (!G.empty()) {\n\t\tfor (z = G.begin(); z < G.end(); z++) {\n\t\t\tif ((Vonly.find(z->v1) != Vonly.end()) && (Vonly.find(z->v2) != Vonly.end())) { //if both vertices already in output, get rid of duplicate, larger edge\n\t\t\t\tG.erase(z);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if ((Vonly.find(z->v1) == Vonly.end()) ^ (Vonly.find(z->v2) == Vonly.end())) {\n\t\t\t\tiVert.push_back(*z);\t\t //This is optional, since we're only counting the length, not(necessarily) tracking the vertices\n\t\t\t\tVonly.insert(z->v1);\n\t\t\t\tVonly.insert(z->v2);\n\t\t\t\tlen += z->ew;\n\t\t\t\tG.erase(z);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tcout << len << endl;\n\n}", "lang": "GNU C++14", "bug_code_uid": "7a9894a0b54d8009c6f0d94497ef9f35", "src_uid": "a98f0d924ea52cafe0048f213f075891", "apr_id": "0c72da8fbf1eeb61a6f4961af4ce916b", "difficulty": 1900, "tags": ["dp", "bitmasks", "math", "implementation", "graphs"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8303964757709251, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\ntypedef long long ll;\n\nll a,b,x,y;\n\nll gcd(ll a,ll b){return b?gcd(b,a%b):a;}\n\nvoid init()\n{\n\tll c=gcd(x,y);\n\tx/=c;\n\ty/=c;\n}\n\nint main()\n{\n\t//freopen(\"in.txt\",\"r\",stdin);\n\n\twhile(cin>>a>>b>>x>>y)\n\t{\n\t\tinit();\n\t\tif(a\nusing namespace std;\nint main(){\n long long int n, m, cont = 0;\n cin >> n >> m;\n if(n == m){\n cout << '0' << '\\n';\n return 0;\n }\n if(m < n*2 || n > m / 2){\n cout << \"-1\" << '\\n';\n return 0;\n }\n while(m != n){\n if((m / 2) % n == 0 && (m % 2 == 0)){\n m/= 2;\n cont++;\n }\n else if((m / 3) % n == 0){\n m /= 3;\n cont++;\n }\n else{\n cout << \"-1\" << '\\n';\n return 0;\n }\n }\n cout << cont << '\\n';\n return 0;\n}", "lang": "GNU C++14", "bug_code_uid": "6a3a853e133876cb56ebc720f90ff883", "src_uid": "3f9980ad292185f63a80bce10705e806", "apr_id": "ef53ba14bf388012ce346250d0423042", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.913769123783032, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#include \nusing namespace std;\nint main (){\n\tint n,t;\n\tint javab=0;\n\tint x=0,y=0;\n\tcin >> n >>t;\n\tfloat a[n][n];\n\tfor (int i=0;i1)\n\t\t\t\t{\n\t\t\t\t\tezafe=1-a[x][y];\n\t\t\t\t\ta[x][y]=1;\n\t\t\t\t\ta[x][y+1]=a[x][y+1]-ezafe/2;\n\t\t\t\t\ta[x+1][y+1]=a[x+1][y+1]-ezafe/2;\t\n\t\t\t\t}\n\t\t\tx++;\n\t\t\t}\n\t\t\ty++;\n\t\t}\n\tfor (int i=0;i\n\nusing namespace std;\nint n, m;\n\n#define MAX 505\n#define ll long long\n\nconst int N = (int)1e5 + 5;\nconst int INF = (int)1e9;\nint ans = 0;\nvoid solve () {\n int k, a, b; cin >> k >> a >> b;\n while (1) {\n if (a - k >= 0) {\n a -= k;\n ans++;\n b = b - b % k;\n } else if (b - k >= 0) {\n b -= k; ans++;\n a = a - a % k;\n } else break;\n }\n if (ans == 0) cout << -1;\n else cout << ans;\n}\nint main () {\n int t = 1;\n // scanf(\"%d\", &t);\n while (t--) {\n solve();\n }\n}\n", "lang": "GNU C++14", "bug_code_uid": "16ae543921b27e73de40c78d8b535eb1", "src_uid": "6e3b8193d1ca1a1d449dc7a4ad45b8f2", "apr_id": "e037e442fd7ad44449adb7e713f0931f", "difficulty": 1200, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.17402269861286254, "equal_cnt": 14, "replace_cnt": 11, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 13, "bug_source_code": "#include\n#include\n#include\nusing namespace std;\nchar s[100];\nchar a[20];\nmap mp;\nint main()\n{\n scanf(\"%s\", s);\n for(int i = 0; i < 10; i++)\n {\n scanf(\"%s\", a);\n mp[a] = i;\n }\n for(int i = 0; i < 8; i++)\n {\n sscanf(s+i*10, \"%10s\", a);\n printf(\"%d\", mp[a]);\n }\n puts(\"\");\n return 0;\n}\n/*2018-08-22 19:53:50.211*/", "lang": "GNU C++", "bug_code_uid": "0eb087517d803672f0994b472b29c719", "src_uid": "0f4f7ca388dd1b2192436c67f9ac74d9", "apr_id": "07decf7a889e3b41da1155da4aabb540", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7346059113300493, "equal_cnt": 12, "replace_cnt": 6, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "#include\nusing namespace std;\nstruct loc\n{\n int line;\n int colum;\n};\nint M[1008][1008]={0};\nint main()\n{\n int a[8];\n int b[8];\n for(int i=0;i<8;i++)\n cin>>a[i];\n for(int i=0;i<8;i++)\n cin>>b[i];\n int line11=101,line12=-101,colum11=101,colum12=-101;\n int line21=101,line22=-101,colum21=101,colum22=-101;\n for(int i=0;i<8;i+=2)\n if(a[i]line12)\n line12=a[i];\n for(int i=1;i<8;i+=2)\n if(a[i]colum12)\n colum12=a[i];\n for(int i=0;i<8;i+=2)\n if(b[i]line22)\n line22=b[i];\n for(int i=1;i<8;i+=2)\n if(b[i]colum22)\n colum22=b[i];\n for(int i=line11*10;i<=line12*10;i++)\n for(int j=colum11*10;j<=colum12*10;j++)\n M[i][j]=1;\n //cout<<(colum21*10+colum22*10)/2-line21*10+line21*10<\n#include \n#include \n\nusing namespace std;\n\nint gcd (int u, int v)\n{\nif(v==0) return u;\nelse return gcd(v, u%v);\n}\n\n\nlong long co (long long u, long long v)\n{\nif((u-v)>n>>m>>t;\nlong long s=0;\nfor(int i=4;i\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\ntypedef long long lli;\ntypedef vector vi;\ntypedef vector vli;\ntypedef pair pii;\ntypedef pair pll;\ntypedef vector vpii;\ntypedef vector vpll;\ntypedef long double ld;\n#define all(a) std::begin(a), std::end(a)\n\nconst int INF = 0x3f3f3f3f;\nconst lli LINF = 0x3f3f3f3f3f3f3f3f;\n\ntemplate inline void _max(T &a, T2 b) { a = max((T)a, (T)b); }\ntemplate inline void _min(T &a, T2 b) { a = min((T)a, (T)b); }\n\n#ifdef _DEBUG\n#define epr(...) fprintf(stderr,__VA_ARGS__)\n#else\n#define epr(...) \n#endif\n#pragma endregion\n\n#pragma region Erato Sieve\nconst int MAX_PRIME = 1e6;\nint divisors[MAX_PRIME] = { 0 }, primes[MAX_PRIME] = { 0 }, nPrimes = 0;\nvoid generatePrimes() {\n\tfor (int i = 2; i < MAX_PRIME; i++) {\n\t\tif (divisors[i] == 0) divisors[i] = primes[nPrimes++] = i;\n\t\tfor (int j = 0; j < nPrimes && i * primes[j] < MAX_PRIME; j++)\n\t\t\tdivisors[i * primes[j]] = max(divisors[i], primes[j]);\n\t}\n}\n\nvoid generateDivsorsRec(map::iterator it, map &f, vli &res, lli tm) {\n\tif (it == f.end()) {\n\t\tres.push_back(tm);\n\t\treturn;\n\t}\n\tlli cp = 1;\n\tfor (int i = 0; i <= it->second; i++) {\n\t\tlli ntm = tm * cp;\n\t\tgenerateDivsorsRec(next(it), f, res, ntm);\n\t\tcp *= it->first;\n\t}\n}\n\nmap factorizeLow(lli x) {\n\tmap res;\n\twhile (x != 1) {\n\t\tres[divisors[x]]++;\n\t\tx /= divisors[x];\n\t}\n\treturn res;\n}\n\nmap factorize(lli x) { // max prime should be greater than or equal to the square root of x\n\tif (x < MAX_PRIME) return factorizeLow(x);\n\tmap res;\n\tfor (int i = 0; 1ll * primes[i] * primes[i] <= x; i++) {\n\t\tif (x % primes[i] == 0) {\n\t\t\tint c = 0;\n\t\t\twhile (x % primes[i] == 0) c++, x /= primes[i];\n\t\t\tres[primes[i]] = c;\n\t\t}\n\t}\n\tif (x != 1) res[x] = 1;\n\treturn res;\n}\n\nvli generateDivisors(lli x) {\n\tauto f = factorize(x);\n\tvli res;\n\tgenerateDivsorsRec(f.begin(), f, res, 1);\n\tsort(all(res));\n\treturn res;\n}\n\nlli phi(lli x) { // if known that x is prime return x - 1\n\tauto f = factorize(x);\n\tlli res = x;\n\tfor (auto &p : f) res -= res / p.first;\n\treturn res;\n}\n#pragma endregion\n\nconst int MAX = 1e6 + 100;\n\nint x[3][MAX] = { 0 };\n\nint x2;\n\nvoid clear() {\n}\n\nvoid read() {\n}\n\nvoid solve() {\n\tint maxPrime = 1;\n\tfor (int i = 0; primes[i] <= x2; i++)\n\t\tif (x2 % primes[i] == 0)\n\t\t\tmaxPrime = primes[i];\n\n\tint res = INF;\n\tfor (int i = x2; i > x2 - maxPrime; i--)\n\t\tif(divisors[i] != i)\n\t\t\t_min(res, x[1][i]);\n\tprintf(\"%d\\n\", res);\n}\n\nvoid precalc() {\n\tgeneratePrimes();\n\tfor (int i = 3; i < MAX; i++) x[0][i] = x[1][i] = x[2][i] = i;\n\tfor (int i = 3; i < MAX; i++)\n\t\tx[1][i] = i - divisors[i] + 1;\n}\n\nint main() {\n\tprecalc();\n#ifdef _LOCAL_VAN\n\tfreopen(\"in.txt\", \"r\", stdin);\n#endif\n\twhile (scanf(\"%d\", &x2) == 1) {\n\t\tclear();\n\t\tread();\n\t\tsolve();\n#ifndef _LOCAL_VAN\n\t\treturn 0;\n#endif\n\t}\n\treturn 0;\n}", "lang": "GNU C++17", "bug_code_uid": "50ea18a2d6851893a1ada6261317575f", "src_uid": "43ff6a223c68551eff793ba170110438", "apr_id": "3c1bff36a231ed05977ce761333911f4", "difficulty": 1700, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.11155378486055777, "equal_cnt": 17, "replace_cnt": 15, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 17, "bug_source_code": "#include\n#include\n#include\n#include\nusing namespace std;\nconst int maxn=1000003;\nvector v;\nvoid check(char ch)\n{\n switch (ch)\n {\n case '>' :\n {\n v.push_back(1);\n v.push_back(0);\n v.push_back(0);\n v.push_back(0);\n break;\n }\n case '<':\n {\n v.push_back(1);\n v.push_back(0);\n v.push_back(0);\n v.push_back(1);\n break;\n }\n case '+':\n {\n v.push_back(1);\n v.push_back(0);\n v.push_back(1);\n v.push_back(0);\n break;\n }\n case '-':\n {\n v.push_back(1);\n v.push_back(0);\n v.push_back(1);\n v.push_back(1);\n break;\n }\n case '.':\n {\n v.push_back(1);\n v.push_back(1);\n v.push_back(0);\n v.push_back(0);\n break;\n }\n case ',':\n {\n v.push_back(1);\n v.push_back(1);\n v.push_back(0);\n v.push_back(1);\n break;\n }\n case '[':\n {\n v.push_back(1);\n v.push_back(1);\n v.push_back(1);\n v.push_back(0);\n break;\n }\n case ']':\n {\n v.push_back(1);\n v.push_back(1);\n v.push_back(1);\n v.push_back(1);\n break;\n }\n }\n}\nint main()\n{\n string s;\n cin >> s;\n int l = s.size();\n for (int i = 0; i < l; ++i)\n check(s[i]);\n reverse(v.begin(), v.end());\n double tmp = 0, x = 2;\n for (int j = 0; j < 4 * l; ++j)\n {\n if(v[j]==1)\n tmp += pow(x, (double)j);\n }\n while (tmp > maxn)\n tmp -= maxn;\n cout <\n#include \n#include \nusing namespace std;\nusing namespace __gnu_pbds;\n\ntemplate\nusing Order_Set = tree, rb_tree_tag,tree_order_statistics_node_update>;\n\n#define PI acos(-1.0)\n#define O_O ios_base::sync_with_stdio(false); cin.tie(NULL)\n#define precision(a) fixed< mark;\nvector vc;\n\nint main()\n{\n long long i,j,k,l,tst=0,ans=0, csno=0;\n cin>>N>>M;\n for(i=0; i>leader[i];\n int pos=0;\n for(i=0; i\n#include\n#include\n#include\n#include \n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\n#define MOD 1000000007\nint a[1111111];\nlong long x[30];\nlong long now=6;\nint cal(long long n)\n{\n\tint l=0;\n\tif(n<0)\n\t\tn=-n;\n\tif(n<=now)\n\t\treturn a[n];\n\tlong long last;\n\tlong long t=n;\n\twhile(t>0)\n\t{\n\t\tl++;\n\t\tlast=t;\n\t\tt/=10;\n\t}\n\tif(last<=5)\n\t{\n\t\tif(n>=x[l]*last||last==1)\n\t\t\treturn cal(n-x[l]*last)+last*l;\n\t\telse\n\t\t{\n\t\t\tint r1,r2;\n\t\t\tr1=cal(x[l]*last-n)+last*l;\n\t\t\tr2=cal(n-x[l]*(last-1))+(last-1)*l;\n\t\t\treturn min(r1,r2);\n\t\t}\n\t}\n\telse if(last>6)\n\t\treturn cal(x[l+1]-n)+l+1;\n\telse\n\t{\n\t\tint r1,r2;\n\t\tif(n>x[l]*last)\n\t\t\tr1=cal(n-x[l]*last)+last*l;\n\t\telse\n\t\t\tr1=cal(x[l]*last-n)+last*l;\n\t\tr2=cal(n-x[l]*(last-1))+(last-1)*l;\n\t\tr1=min(r1,r2);\n\t\tr2=cal(x[l+1]-n)+l+1;\n\t\treturn min(r1,r2);\n\t}\n}\nint main()\n{\n\tint i;\n\tlong long n;\n\tcin>>n;\n\tx[1]=1;\n\tfor(i=2;i<=15;i++)\n\t{\n\t\tx[i]=x[i-1]*10+1;\n\t}\n\tfor(i=0;i<7;i++)\n\t\ta[i]=i;\n\tfor(i=7;i<1111110;i++)\n\t{\n\t\ta[i]=cal(i);\n\t\tnow=i;\n\t}\n\tif(n<1111110)\n\t\tcout<\nusing namespace std;\n\n#define boost ios::sync_with_stdio(0); cin.tie(0);\n#define int long long\nconst int N = 1e5 + 10;\n\n\nint32_t main(){\n\tboost;\n\n\t#ifndef ONLINE_JUDGE\n\tfreopen(\"input.txt\" , \"r\" , stdin);\t\n\tfreopen(\"output.txt\" , \"w\", stdout);\n\t#endif\n\n\tstring n;\n\n\tcin >> n;\n\t// for(int i = 0 ; i < 6 ; ++i)\n\t// \tcin >> n[i];\n\n\tint a = n[0] + n[1] + n[2] - 3*'0';\n\tint b = n[3] + n[4] + n[5] - 3*'0';\n\n\tif(a == b){\n\t\tcout << 0;\n\t\treturn 0;\n\t}\n\tstring s;\n\tint x;\n\tint ans = 6;\n\tfor(int i = 1 ; i <= 999999 ; ++i){\n\t\tx = stoi(n) - i;\n\t\ts = to_string(x);\n\n\t\tif(s.length() != 6){\n\t\t\tint rem = 6 - s.length();\n\t\t\tstring a = \"\";\n\n\t\t\tfor(int i = 0 ; i < rem ; ++i){\n\t\t\t\ta += '0';\n\t\t\t}\n\t\t\ts = a + s;\n\t\t}\n\n\t\tif(s[0] + s[1] + s[2] == s[3] + s[4] + s[5] ){\n\t\t\tint temp = 0;\n\t\t\tif(s[0] != n[0]){\n\t\t\t\t++temp;\n\t\t\t}\n\t\t\tif(s[1] != n[1]){\n\t\t\t\t++temp;\n\t\t\t}\n\t\t\tif(s[2] != n[2]){\n\t\t\t\t++temp;\n\t\t\t}\n\t\t\tif(s[3] != n[3]){\n\t\t\t\t++temp;\n\t\t\t}\n\t\t\tif(s[4] != n[4]){\n\t\t\t\t++temp;\n\t\t\t}\n\t\t\tif(s[5] != n[5]){\n\t\t\t\t++temp;\n\t\t\t}\n\t\t\t\n\t\t\tans = min(ans ,temp);\n\t\t}\n\t}\n\n\tfor(int i = 1 ; i <= 999999 ; ++i){\n\t\tx = stoi(n) + i;\n\t\ts = to_string(x);\n\n\t\tif(s[0] + s[1] + s[2] == s[3] + s[4] + s[5]){\n\t\t\tint temp = 0;\n\t\t\tif(s[0] != n[0]){\n\t\t\t\t++temp;\n\t\t\t}\n\t\t\tif(s[1] != n[1]){\n\t\t\t\t++temp;\n\t\t\t}\n\t\t\tif(s[2] != n[2]){\n\t\t\t\t++temp;\n\t\t\t}\n\t\t\tif(s[3] != n[3]){\n\t\t\t\t++temp;\n\t\t\t}\n\t\t\tif(s[4] != n[4]){\n\t\t\t\t++temp;\n\t\t\t}\n\t\t\tif(s[5] != n[5]){\n\t\t\t\t++temp;\n\t\t\t}\n\t\t\t\n\t\t\tans = min(ans ,temp);\n\t\t}\n\t}\n\n\tcout << ans;\n\t/*\n\tsort(n , n + 3);\n\tsort(n+3 , n+6);\n\n\t\n\n\tint diff;\n\tint ans = 0;\n\tif(a - b > 0){\n\t\tdiff = a - b;\n\t\tfor(int i = 3 ; i >= 0 ; --i){\n\t\t\tif(diff > 0 && n[i] - '0' > 0){\n\t\t\t\tdiff -= (n[i] - '0');\n\t\t\t\tans++;\n\t\t\t\tif(diff <= 0)\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tint ans2 = 0;\n\t\tdiff = a - b;\n\t\tfor(int i = 3 ; i < 6 ; --i){\n\t\t\tif(n[i] - '0' <= 9){\n\t\t\t\tdiff -= 9 - n[i] + '0';\n\t\t\t\t++ans2;\n\t\t\t\tif(diff <= 0)\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tcout << min(ans,ans2);\n\t}\n\telse if(a - b < 0){\n\n\t\tans = 0;\n\t\tdiff = b - a;\n\t\tfor(int i = 0 ; i < 3 ; ++i){\n\t\t\tif(diff > 0 && n[i] - '0' > 0){\n\t\t\t\tdiff -= 9 - n[i] + '0';\n\t\t\t\tans++;\n\t\t\t\tif(diff <= 0)\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tdiff = b-a;\n\t\t// cout << diff;\n\t\tint ans2 = 0;\n\t\tfor(int i = 5 ; i > 2 ; --i){\n\t\t\tif(n[i] - '0' <= 9){\n\t\t\t\tdiff -= (n[i] - '0');\n\t\t\t\t// cout << diff << \" \";\n\t\t\t\t++ans2;\n\t\t\t\tif(diff <= 0)\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// cout << ans << \" \" << ans2 << \"\\n\";\n\t\tcout << min(ans, ans2);\n\t}\n\telse{\n\t\tcout << 0;\n\t}\n\t// cout << a << b;\n\t*/\n\treturn 0;\n}", "lang": "GNU C++17", "bug_code_uid": "d9cb41ee51a1b1c089de7a273daa24ce", "src_uid": "09601fd1742ffdc9f822950f1d3e8494", "apr_id": "6dafa53799a5544f6915df29da9b0f54", "difficulty": 1600, "tags": ["greedy", "brute force", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7420382165605095, "equal_cnt": 13, "replace_cnt": 11, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "#include\n#define pb push_back\n\n\nusing namespace std;\ntypedef pair pii;\ntypedef long long ll;\n\nchar dir[] = {'^' , '>' , 'v' , '<' };\n\nint main()\n{\n string s1 ;\n int n ;\n char ch1 , ch2 ;\n cin >> ch1 >> ch2 ;\n cin >> n ;\n int st , TMP = n;\n for( int i = 0 ; i < 4 ; i++ )\n {\n if( ch1 == dir[i] )\n {\n st = i ;\n break ;\n }\n }\n int i = 0 , j = 0 ;\n int ii = st , jj = st ;\n string ccw = \"\" , cw = \"\";\n ccw+=dir[st];\n cw+=dir[st];\n\n while( n-- )\n {\n ii = (ii+1)%4;\n jj = ((jj-1) + 4 ) %4;\n cw+= dir[ii] ;\n ccw+= dir[jj] ;\n }\n ////cout << cw << \" -- \" << ccw << endl;\n if( ch2 == cw[TMP] && ch2 == ccw[TMP] )\n {\n cout << \"undefined\\n\";\n }\n else if( ch2 == cw[TMP])\n {\n cout << \"cw\\n\";\n }\n else if( ch2 == ccw[TMP] )\n {\n cout << \"ccw\\n\";\n }\n else\n {\n cout << \"undefined\\n\";\n }\n\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "b1f055df6d0d1b6855b43e5b2b52f50e", "src_uid": "fb99ef80fd21f98674fe85d80a2e5298", "apr_id": "134cc1b6ad5e853181ff93d1d1b22a45", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9982347749338041, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n//#include \n#include \n#include \nusing namespace std;\ntypedef long long LL;\ntypedef pair pint;\ntypedef pair pll;\n#define fi first\n#define se second\ntypedef map mapint;\ntypedef vector vint;\ntypedef vector vintp;\n#define rep(i,j,k) for (int i = (j);i <= (k);i ++)\n#define ran2 (rand() % 32000 * 32000 + rand() % 32000)\n#define pb push_back\n#define mp make_pair\n\n\nint m,n,j,k,l,i,o,p,__t;\n\nchar ch;\nvoid read(int &a){\n\tfor (ch = getchar();(ch < '0' || ch > '9') && (ch != '-');ch = getchar());\n\tif (ch == '-') a = 0,__t = -1; else a = ch - '0',__t = 1;\n\tfor (ch = getchar();ch >= '0' && ch <= '9';ch = getchar()) a = a * 10 + ch - '0';\n\ta *= __t;\n}\nint main(){\n\tscanf(\"%d%d\", &n, &m);\n\twhile ((g = __gcd(n, m)) > 1)\n\t\tm /= g, c ++;\n\tif(m == 1)\n\t\tprintf(\"2-type\\n%d\", c);\n\telse if (!c && n % m == 1)\n\t\tputs(\"3-type\");\n\telse if (!c && n % m == m - 1)\n\t\tputs(\"11-type\");\n\telse if ((n - 1) * (n + 1) / (n % 2 + 1 ) % m == 0)\n\t\tputs(\"6-type\");\n\telse\n\t\tputs(\"7-type\");\n}\n", "lang": "GNU C++", "bug_code_uid": "2343db041a0842b9e9bb463e15d685ee", "src_uid": "809e1c78b0a5a16f7f2115b046a20bde", "apr_id": "0227ab55f39e7e550c394fece27ea722", "difficulty": 2300, "tags": ["math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9463366821857387, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "/// BIS-MILLAHIR RAHMANIR RAHIM\n\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n\nusing namespace std;\n\n#define all(a) a.begin(),a.end()\n#define I1(n) scanf(\"%d\",&n)\n#define I2(n1,n2) scanf(\"%d%d\",&n1,&n2)\n#define I3(n1,n2,n3) scanf(\"%d%d%d\",&n1,&n2,&n3)\n#define F(i, a, b) for( i = (a); i <= (b); i++ )\n#define FR(i, a, b) for( i = (a); i < (b); i++ )\n#define Fs(i, sz) for( size_t i = 0; i < sz.size (); i++ )\n#define Fe(it, x) for(typeof (x.begin()) it = x.begin(); it != x.end (); it++)\n#define Pr(x) for(typeof (x.begin()) it = x.begin(); it != x.end (); it++) cout << *it << \" \"; cout << endl;\n#define pb push_back\n#define pi acos(-1.0)\n#define MEM(a,val) memset(a,val,sizeof(a))\n#define eps 1e-9\n#define Max(a,b) (a>b?a:b)\n#define Min(a,b) (aprime[2007];\n\nvoid sieve()\n{\n int i,j;\n for(i=2; i<=2007; i++)\n {\n if(!is[i])\n {\n for(j=i+i; j<=2007; j+=i)\n {\n is[j]=true;\n prime[j].pb(i);\n }\n }\n }\n}\n\nint expo(long long b, int p)\n{\n int ret = 1;\n while(p)\n {\n if(p&1) ret = (ret*b)%m;\n p >>= 1;\n b = (b*b)%m;\n }\n return ret;\n}\n\nint main()\n{\n int n, t, i, j, p, e;\n sieve();\n\n int cnt = 0;\n\n cin >> p;\n m = p;\n\n for(i=1; i\nusing namespace std;\nint a[100000000];\nint main()\n{\n long long n,k,flag = 1;cin>>n>>k;\n if(n<=k and n>1) flag = 0;\n else\n {\n for(int i=1;i<=k;i++)\n {\n if(!a[n%i]) a[n%i] = 1;\n else flag = 0;\n }\n }\n if(flag) cout << \"Yes\";\n else cout << \"No\";\n cout << endl;\n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "a9fc119020b896914feb4c5c65a8df77", "src_uid": "5271c707c9c72ef021a0baf762bf3eb2", "apr_id": "b1a9a480d0fc0f7b3657160c3f91208d", "difficulty": 1600, "tags": ["brute force", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9887429643527205, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \nusing namespace std;\nint main()\n{\n long long n,a;\n bool e=true;\n cin>>n;\n for(a=n;a>0;a--)\n {\n if(n%a==0)\n {\n e=true;\n for(int b=2;b*b<=a;b++)\n {\n if(a%(b*b)==0)\n {\n e=false;\n a/=b;\n a++;\n break;\n }\n }\n if(e)\n {\n cout<\n#define ll long long\n\n#define TASKNAME \"\"\n\nusing namespace std;\n\nconst int INF = 1e9 + 7;\nconst int MAXN = 1e6 + 7;\nconst double EPS = 1e-8;\n\nstruct TNode {\n TNode *left, *right;\n int sz, x;\n};\n\nTNode *new_node(int x) {\n return new TNode({nullptr, nullptr, 1, x});\n}\n\nint safe_sz(TNode *root) {\n return (root ? root->sz : 0);\n}\n\nvoid relax(TNode *root) {\n if (!root) return;\n root->sz = safe_sz(root->left) + safe_sz(root->right) + 1;\n}\n\nTNode *merge(TNode *left, TNode *right) {\n if (!left) {\n return right;\n }\n if (!right) {\n return left;\n }\n TNode *node = new_node(-1);\n int sz1 = safe_sz(node->left), sz2 = safe_sz(node->right);\n if (rand() % (sz1 + sz2) < sz1) {\n node->left = merge(left, right->left);\n node->right = right->right;\n node->x = right->x;\n } else {\n node->right = merge(left->right, right);\n node->left = left->left;\n node->x = left->x;\n }\n relax(node);\n return node;\n}\n\nvoid split(TNode *root, int sz, TNode *&left, TNode *&right) {\n if (!root || !sz) {\n left = nullptr;\n right = root;\n return;\n }\n TNode *left1, *right1;\n if (safe_sz(root->left) >= sz) {\n split(root->left, sz, left1, right1);\n left = left1;\n }\n return;\n}\n\nint main() {\n #ifdef MY\n freopen(\"input.txt\", \"r\", stdin);\n //freopen(\"output.txt\", \"w\", stdout);\n #else\n //freopen(TASKNAME\".in\", \"r\", stdin);\n //freopen(TASKNAME\".out\", \"w\", stdout);\n ios_base::sync_with_stdio(false);\n cin.tie(0);\n cout.tie(0);\n #endif // MY\n ll n, m;\n cin >> n >> m;\n ll s, t;\n cin >> s >> t;\n s--;\n int len1 = m, len2 = n - m;\n unordered_map , bool> was;\n vector > path;\n while (t > 0) {\n if (was[{s, t % n}]) break;\n was[{s, t % n}] = true;\n path.push_back({s, t % n});\n if (s < m) {\n s = (s + t) % n;\n } else {\n s = ((s - t) % n + n) % n;\n }\n //cout << s << \"\\n\";\n t--;\n }\n if (!t) {\n cout << s + 1 << \"\\n\";\n return 0;\n }\n ll cycle = 1;\n while (path.back() != make_pair(s, t % n)) {\n path.pop_back();\n cycle++;\n }\n t %= cycle;\n while (t > 0) {\n if (s < m) {\n s = (s + t) % n;\n } else {\n s = ((s - t) % n + n) % n;\n }\n t--;\n }\n cout << s + 1;\n}\n", "lang": "GNU C++14", "bug_code_uid": "852bc4e29d406fbc15f96e284bac4eb8", "src_uid": "e743242f0cc9e17619e1fe4935d9fbd0", "apr_id": "c589f5bb611eec0cc16958619f79ed97", "difficulty": 2900, "tags": ["graphs", "data structures", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9961389961389961, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "#include\n#define LL long long \n#define pii pair\n#define mp make_pair\n#define maxn 5005\nusing namespace std;\n\n\nconst LL mo=998244353;\nLL fff[2][maxn][2];\nLL f[maxn];\nLL dp[maxn][maxn];\nLL n,k;\nLL ans,res;\n\nvoid calc(int x){\n\tres=0;\n\tmemset(fff,0,sizeof(fff));\n\tif(x>1)fff[1][1][0]=2;else fff[1][1][1]=2;\n\tfor(int i=2;i<=n;i++){\n\t\tfor(int j=1;j<=n;j++)fff[2][j][1]=fff[2][j][0]=0;\n\t\tfor(int j=1;j<=min(i-1,x);j++){\n\t\t\tfff[2][1][0]+=fff[1][j][0];\n\t\t\tfff[2][1][1]+=fff[1][j][1];\n\t\t\tif(fff[2][1][1]>mo)fff[2][1][1]-=mo;\n\t\t\tif(fff[2][1][0]>mo)fff[2][1][0]-=mo;\n\t\t}\n\t\tfor(int j=2;j<=min(i,x);j++){\n\t\t\tif(j==x){\n\t\t\t\tfff[2][j][1]+=fff[1][j-1][0]+fff[1][j-1][1];\n\t\t\t\tif(fff[2][j][1]>mo)fff[2][j][1]-=mo;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tfff[2][j][1]+=fff[1][j-1][1];\n\t\t\t\tfff[2][j][0]+=fff[1][j-1][0];\n\t\t\t\tif(fff[2][j][1]>mo)fff[2][j][1]-=mo;\n\t\t\t\tif(fff[2][j][0]>mo)fff[2][j][0]-=mo;\n\t\t\t}\n\t\t}\n\t\tfor(int j=1;j<=n;j++)fff[1][j][1]=fff[2][j][1],fff[1][j][0]=fff[2][j][0];\n\t}\n\tfor(int i=1;i<=x;i++){\n\t\tres=res+fff[1][i][1];\n\t\tif(res>mo)res-=mo;\n\t}\n\tf[x]=res;\n}\n\nint main(){\n\tscanf(\"%lld%lld\",&n,&k);\n\tfor(int i=1;i<=n;i++)calc(i);\n\tfor(int l=1;l<=min(n,k-1);l++){\n\t\tmemset(dp,0,sizeof(dp));\n\t\tdp[1][1]=f[l]%mo;\n\t\tLL m=(k-1)/l;\n\t\tfor(LL i=2;i<=n;i++){\n\t\t\tfor(LL j=1;j<=min(i-1,m);j++){\n\t\t\t\tdp[i][1]+=dp[i-1][j];\n\t\t\t\tif(dp[i][1]>mo)dp[i][1]-=mo;\n\t\t\t}\n\t\t\tfor(int j=2;j<=min(i,m);j++){\n\t\t\t\tdp[i][j]=dp[i-1][j-1];\n\t\t\t}\n\t\t}\n\t\tres=0;\n\t\tfor(int j=1;j<=min(m,n);j++){\n\t\t\tres=res+dp[n][j];\n\t\t\tif(res>mo)res-=mo;\n\t\t}\n\t\tans+=res;\n\t\tans%=mo;\n\t}\n\tprintf(\"%lld\\n\",ans);\n}\n", "lang": "GNU C++11", "bug_code_uid": "e34bcf3c99aaeea0069cac1aa6e30534", "src_uid": "77177b1a2faf0ba4ca1f4d77632b635b", "apr_id": "931a25536f9307f7b0722cd6252a1617", "difficulty": 2100, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7764480612733365, "equal_cnt": 14, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 13, "bug_source_code": "#include\nusing namespace std;\n\nconst long long maxn = 5e2 + 10;\nconst long long mod = 998244353;\n\nlong long ans;\nlong long n, k;\nlong long dp[2][maxn][maxn];\nlong long DP[2][maxn][maxn];\n\nvoid in();\nvoid solve();\nvoid init_dp();\nvoid init_DP();\nvoid findp();\nvoid finDP();\nvoid out();\n\nint main(){\n ios::sync_with_stdio(false);\n cout.tie(0);\n cin.tie(0);\n in();\n solve();\n out();\n}\n\nvoid in(){\n cin >> n >> k;\n k--;\n}\n\nvoid solve(){\n init_dp();\n findp();\n init_DP();\n finDP();\n for(long long i = 0; i <= k; i++)\n for(long long j = 0; j <= k; j++)\n ans = (ans + dp[n % 2][i][j]) % mod;\n}\n\nvoid init_dp(){\n for(long long i = 1; i <= n; i++)\n dp[1][1][i] = 2;\n}\n\nvoid findp(){\n for(long long i = 1; i < n; i++){\n for(long long j = 1; j <= n; j++)\n for(long long K = 1; K <= n; K++)\n dp[1 - i % 2][j][K] = 0;\n for(long long j = 1; j <= n; j++){\n for(long long K = 1; K <= n; K++){\n if(j + 1 <= K)\n dp[1 - i % 2][j + 1][K] = (dp[1 - i % 2][j + 1][K] + dp[i % 2][j][K]) % mod;\n dp[1 - i % 2][1][K] = (dp[1 - i % 2][1][K] + dp[i % 2][j][K]) % mod;\n }\n }\n }\n}\n\nvoid init_DP(){\n for(long long i = 1; i <= n; i++)\n for(long long j = 0; j <= n; j++)\n DP[1][1][i] = (DP[1][1][i] + (dp[n % 2][j][i] - dp[n % 2][j][i - 1] + mod) % mod) % mod;\n}\n\nvoid finDP(){\n for(long long i = 1; i < n; i++){\n for(long long j = 1; j <= n; j++)\n for(long long K = 1; K <= n; K++)\n DP[1 - i % 2][j][K] = 0;\n for(long long j = 1; j <= n; j++){\n for(long long K = 1; K <= n; K++){\n if((j + 1) * K <= k)\n DP[1 - i % 2][j + 1][K] = (DP[1 - i % 2][j + 1][K] + DP[i % 2][j][K]) % mod;\n DP[1 - i % 2][1][K] = (DP[1 - i % 2][1][K] + DP[i % 2][j][K]) % mod;\n }\n }\n }\n}\n\nvoid out(){\n cout << ans;\n}\n", "lang": "GNU C++11", "bug_code_uid": "080a4a0320c2ca291851262c6f87d0be", "src_uid": "77177b1a2faf0ba4ca1f4d77632b635b", "apr_id": "4a08ff8451d57bbbf00a57f66af6da3f", "difficulty": 2100, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9998726925525143, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "include \n\n#define clr(x) memset((x), 0, sizeof(x))\n#define all(x) (x).begin(), (x).end()\n#define pb push_back\n#define mp make_pair\n#define in(x) int (x); input((x));\n#define x first\n#define y second\n#define forn(i, n) for(int i = 0; i < (int)(n); ++i)\n#define ford(i, n) for(int i = (int)(n) - 1; i >= 0; --i)\n#define for1(i, n) for(int i = 1; i <= (int)(n); ++i)\n\ntypedef int itn;\n\n//#define next next12345\n//#define prev prev12345\n#define left lefdsf232\n#define right rig43783\n#define x1 x12345\n#define y1 y12345\n\nusing namespace std;\n\ntemplate\nT gcd(T x, T y) {\n while (y > 0) {\n x %= y;\n swap(x, y);\n }\n return x;\n}\n\ntemplate\nT lcm(T a, T b) {\n return a / gcd(a, b) * b;\n}\n\n\ntemplate\ninline _T sqr(const _T &x) {\n return x * x;\n}\n\ntemplate\ninline string tostr(const _T &a) {\n ostringstream os(\"\");\n os << a;\n return os.str();\n}\n\ntypedef long double ld;\ntypedef long long ll;\ntypedef unsigned long long ull;\ntypedef pair PII;\nconst ld PI = 3.1415926535897932384626433832795L;\n\ntemplate\ninline void input(T &a) {\n static int ed;\n a = 0;\n while (!isdigit(ed = getchar()) && ed != '-') { }\n char neg = 0;\n if (ed == '-') {\n neg = 1;\n ed = getchar();\n }\n while (isdigit(ed)) {\n a = 10 * a + ed - '0';\n ed = getchar();\n }\n if (neg) a = -a;\n}\n\ntemplate\ninline T nxt() {\n T res;\n input(res);\n return res;\n}\n\nvoid myassert(bool v) {\n assert(v);\n //cout << \"FAIL\\n\";\n //exit(0);\n}\n\nmt19937 generator;\n\nbool check(int v) {\n if (v < 2) return false;\n for (int i = 2; i * i <= v; ++i) {\n if (v % i == 0) {\n return false;\n }\n }\n return true;\n}\n\nlong long pw(long long a, long long n, long long m) {\n ll res = 1;\n while (n) {\n if (n & 1ll) {\n res = res * a % m;\n }\n a = a * a % m;\n n >>= 1;\n }\n return res;\n}\n\nlong long inv(long long a, long long p) {\n long long res = 1;\n while (a > 1) {\n res = res * (p - p / a) % p;\n a = p % a;\n }\n return res;\n}\nvector p;\n\nconst int M = 60;\n\n#define ld double\n\nld dp[1 << 19][M];\nld old[M];\nld old2[M];\n\nvoid solve(int test) {\n p.resize(1, -1);\n int q = nxt();\n vector > r;\n\n while (q--) {\n int t = nxt();\n int v = nxt() - 1;\n r.pb(mp(t, v));\n if (t == 1) {\n p.pb(v);\n }\n }\n forn(i, M) dp[0][i] = 1;\n\n int sz = 1;\n for (auto v : r) {\n if (v.x == 1) {\n int cur = sz++;\n forn(i, M) dp[cur][i] = 1;\n int pr = cur;\n cur = p[cur];\n int h = 0;\n while (cur != -1 && h < M) {\n memcpy(old2, dp[cur], sizeof(old2));\n for (int j = h; j < M; ++j) {\n if (pr != sz - 1) dp[cur][j] /= (0.5 + 0.5 * (j ? old[j - 1] : 0));\n dp[cur][j] *= (0.5 + 0.5 * (j ? dp[pr][j - 1] : 0));\n }\n memcpy(old, old2, sizeof(old));\n pr = cur;\n cur = p[cur];\n ++h;\n }\n } else {\n ld ans = 0;\n for (int i = 0; i < M; ++i) {\n ans += 1 - dp[v.y][i];\n }\n printf(\"%.10f\\n\", (double)ans);\n }\n }\n}\n\n\nint main(int argc, char ** argv) {\n\n#ifdef LOCAL\n freopen(\"input.txt\", \"r\", stdin);\n freopen(\"output.txt\", \"w\", stdout);\n#else\n #define fname \"sequence\"\n //freopen(fname\".in\", \"r\", stdin);\n //freopen(fname\".out\", \"w\", stdout);\n#endif\n //ios_base::sync_with_stdio(false);\n// pre();\n int t = 1;\n\n#ifdef LOCAL\n#else\n#endif\n int c = 0;\n\n while (t--) {\n solve(++c);\n }\n\n#ifdef LOCAL\n cerr << \"Time elapsed: \" << 1.0 * clock() / CLOCKS_PER_SEC * 1000 << \" ms.\" << endl;\n#endif\n return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "1c675eea271ed92a08590adc3326c214", "src_uid": "55affe752cb214d1e4031a9e3972597b", "apr_id": "46014d7cdc40e3823b71cbae7f98961d", "difficulty": 2700, "tags": ["trees", "dp", "math", "probabilities"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.2953091684434968, "equal_cnt": 19, "replace_cnt": 13, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 18, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\ntypedef long long ll;\n\nstring N;\nll rep(string k, ll base, ll i) {\n\tint sp = max((int)(k.size() - N.size()), 0);\n\tstring nk = k.substr(sp, k.size() - sp);\n\tstring r = k.substr(0, sp);\n\tif (nk == \"\") return 0;\n\tif (N <= nk) {\n\t\tsp += 1;\n\t\tnk = k.substr(sp, k.size() - sp);\n\t\tr = k.substr(0, sp);\n\t}\n\treturn pow(base, i)*stoll(nk) + rep(r, base, i+1);\n}\n\nint main() {\n#ifdef _DEBUG\n\tfreopen(\"758d.in\", \"r\", stdin);\n#endif\n\tll n, k;\n\tcin >> n >> k;\n\t\n\tN = to_string(n);\n\tcout << rep(to_string(k), n, 0) << endl;\n}\n", "lang": "GNU C++11", "bug_code_uid": "bdb95474ebb36421ec48b35b0e017939", "src_uid": "be66399c558c96566a6bb0a63d2503e5", "apr_id": "577ef69f92c1d4db0b9b851d16567d75", "difficulty": 2000, "tags": ["dp", "greedy", "math", "constructive algorithms", "strings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.718407960199005, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include \n#define int long long\n#define ll long long\n#define pb push_back\n#define pii pair\n#define vi vector\n#define vii vector\n#define mi map\n#define mii map\n#define all(a) (a).begin(),(a).end()\n#define x first\n#define y second\n#define sz(x) (int)x.size()\n#define nl '\\n'\n#define hell 1000000007\n#define rep(i,a,b) for(int i=a;i> a >> b;\n\tint num=1, den=1;\n\tqueue > > q;\n\n\tq.push({1,{num,den}});\n\tint ans=0;\n\twhile(!q.empty()){\n\t\tpair u =q.front();\n\t\tq.pop();\n\n\t\tif(u.y.x==a and u.y.y==b){\n\t\t\tcout << u.x <\n#define max(x,y) (x>y)?x:y\nusing namespace std;\n\nint main() {\n\t// your code goes here\n\tint n,a,b;\n\tcin>>n>>a>>b;\n\tint ans=1,nmax=4,nmin=2,p=0,f=0,m=n,q=0,pm=n,pd1=0,pd2=0,flag=0;\n\tp=max(a,b);\n\tq=a+b-p;\n\tif(p==a)\n\t{\n\t\tf=1;\n\t\tnmax=4;\n\t\tnmin=2;\n\t}\n\telse\n\t{\n\t\tf=2;\n\t\tnmax=2;\n\t\tnmin=4;\n\t}\n\twhile(nmax != 0 || nmin != 0)\n\t{\n\t\t//cout<= 0 && nmax!= 0)\n\t\t{\n\t\t\tm=m-p;\n\t\t\tnmax--;\n\t\t\tpd1++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(m-q >= 0 && nmin>0)\n\t\t\t{\n\t\t\t\tm=m-q;\n\t\t\t\tnmin--;\n\t\t\t\tpd2++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(m!=0 && m!=pm && flag==0)\n\t\t\t\t{\n\t\t\t\t\tm=pm-q;\n\t\t\t\t\tnmin--;\n\t\t\t\t\tnmax=nmax+pd1;\n\t\t\t\t\tnmin=nmin+pd2;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tm=n;\n\t\t\t\t\tans++;\n\t\t\t\t\tflag=-1;\n\t\t\t\t}\n\t\t\t\tpm=m;\n\t\t\t\tpd1=0;\n\t\t\t\tpd2=0;\n\t\t\t}\n\t\t}\n\t}\n\tcout<\nusing namespace std;\nint n , x1 , y11 , x2 , y2 , arr[1005][1005] , m = 1000000;\n\nint bfs()\n{\n queue >q;\n q.push(make_pair(x1,y11));\n arr[x1][y11]=0;\n while(!q.empty())\n {\n pairp=q.front();\n q.pop();\n if((p.first==0&&x2==0)||(p.first==n&&x2==n))\n {\n m= min(m , arr[p.first][p.second]+abs(p.second-y2));\n }else if((p.second==0&&y2==0)||(p.second==n&&y2==n))\n {\n m= min ( m , arr[p.first][p.second]+abs(p.first-x2));\n }else\n {\n if (p.first==n||p.first==0) {\n \tif (!arr[p.first][0])\n {\n arr[p.first][0]=arr[p.first][p.second]+p.second;\n \t\tq.push (make_pair(p.first,0));\n }\n if (!arr[p.first][n])\n {\n arr[p.first][n]=arr[p.first][p.second]+n-p.second;\n q.push (make_pair(p.first,n));\n }\n }\n\n if (p.second==n||p.second==0) {\n \tif (!arr[0][p.second])\n {\n arr[0][p.second]=arr[p.first][p.second]+p.first;\n \t\tq.push (make_pair(0,p.second));\n }\n if (!arr[n][p.second])\n {\n arr[n][p.second]=arr[p.first][p.second]+n-p.first;\n q.push (make_pair(n,p.second));\n }\n }\n\n\n\n }\n\n }\n\n}\n int main()\n{\n ios::sync_with_stdio(false) ;\n cin.tie(0);\n cin>>n>>x1>>y11>>x2>>y2;\n if((x1==0&&x2==0)||(x1==n&&x2==n))\n {\n cout<\n#include \n#include \n#include \n#include \nusing namespace std;\n\nvector st[30];\nint n,c[30];\nbool g[30][1<<24],f[30][1<<24];\n\nint count(int mask)\n{\n\tint ret=0;\n\twhile (mask)\n\t{\n\t\tret+=mask%2;\n\t\tmask/=2;\n\t}\n\treturn ret;\n}\n\nint total(int mask)\n{\n\tint ret=0,i=0;\n\twhile (mask)\n\t{\n\t\tif (mask%2) ret+=c[++i];\n\t\tmask/=2;\n\t}\n\treturn ret;\n}\n\nint main()\n{\n\tscanf(\"%d\",&n);\n\tfor (int i=1;i<=n;i++) scanf(\"%d\",&c[i]);\n\tsort(&c[1],&c[n+1]);\n\tfor (int i=1;i<=n;i++)\n\t{\n\t\tfor (int mask=0;mask<1<=2 && total(mask)+1==c[i])\n\t\t\t\tg[i][mask]=true,st[i].push_back(mask);\n\t\t\telse g[i][mask]=false;\n\t\t}\n\t}\n\tf[0][0]=true;\n\tfor (int i=1;i<=n;i++)\n\t{\n\t\tif (c[i]==1) f[i][(1<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n//#include \nusing namespace std;\n\n#define For(i,a,b) for(ll i = (a); i <= (b); i++)\n#define Dow(i,a,b) for(ll i = (a); i >= (b); i--)\n#define fill(a, x) memset(a, x, sizeof(a))\n#define sz(x) ((int)x.size())\n#define all(x) x.begin(), x.end()\n#define pb push_back\n#define mp make_pair\n#define fi first\n#define se second\n\ntypedef long long ll;\ntypedef pair pll;\ntypedef pair pii;\n\nconst int maxN = 1e5 + 100;\nconst int mod = 1e9 + 7;\nconst int inf = 1e9;\n\nll n;\nvector < ll > v;\n\nint main() {\n\t#ifndef ONLINE_JUDGE\n\t freopen (\"input.txt\", \"r\", stdin);\n\t // freopen(\"output.txt\", \"w\", stdout);\n\t#endif\n\tios :: sync_with_stdio(false);\n\t\n\t//v.pb(0);\n\t//ll d = 0;\n\tfor (int i = 1; i <= 3628800; i++) {\n\t\tint ok = 0;\n\t\tfor (int j = 2; j <= 10; j++) if (i % j != 0) {\n\t\t\tok = 1;\n\t\t\tbreak;\n\t\t}\n\t\tif (!ok) v.pb(i);\n\t}\n\t\n\twhile (cin >> n) {\n\t\twhile (true) {\n\t\t\tint ok = 0;\n\t\t\tint t = sz(v);\n\t\t\tfor (int i = 0; i < t; i++) {\n\t\t\t\tfor (int j = 2; j <= 10; j++) {\n\t\t\t\t\tll tmp2 = v[i] * j;\n\t\t\t\t\t/*int xxx = 0;\n\t\t\t\t\tfor (int i = 0; i < t; i++) {\n\t\t\t\t\t\tif (tmp2 == v[i]) {\n\t\t\t\t\t\t\txxx = 1;\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\t*/\n\t\t\t\t\t//if (!xxx) \n\t\t\t\t\tv.pb(tmp2);\n\t\t\t\t\tif (tmp2 > 1e18) {\n\t\t\t\t\t\tok = 1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (ok) break;\n\t\t\t}\n\t\t\tif (ok) break;\n\t\t}\n\t\tll i = 0;\n\t\twhile (v[i] <= n) i++;\n\t\tcout << i << endl;\n\t}\n\t\n\treturn 0;\n}\n\n", "lang": "GNU C++11", "bug_code_uid": "ba612733ef5b173cf6c0041c27c1ff4a", "src_uid": "8551308e5ff435e0fc507b89a912408a", "apr_id": "ae1e825efacbf9defd1d6c77726f1259", "difficulty": 1100, "tags": ["math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.840937114673243, "equal_cnt": 12, "replace_cnt": 2, "delete_cnt": 8, "insert_cnt": 2, "fix_ops_cnt": 12, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n \n int n,i,x,t;\n cin>>n;\n vector v;\n while(iv[i];i++);\n\n if(i==n)\n cout<<\"YES\";\n else\n cout<<\"NO\";\n\n return 0;\n}", "lang": "GNU C++14", "bug_code_uid": "d5be0c696da56ef625186ed0083fb794", "src_uid": "5482ed8ad02ac32d28c3888299bf3658", "apr_id": "7d588af7724b9c26fc15608de12ffbbf", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.11552346570397112, "equal_cnt": 37, "replace_cnt": 26, "delete_cnt": 7, "insert_cnt": 4, "fix_ops_cnt": 37, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define MM(a,b) memset(a,b,sizeof(a))\n#define PF printf\n#define PB push_back\n#define SC scanf\n#define CT continue\ntypedef long long ll;\ntypedef unsigned long long ull;\nconst double eps = 1e-14;\nconst int inf = 0x3f3f3f3f;\nconst int N=1e5+10;\nconst int mod=1e9+7;\nconst double pi=acos(-1);\nusing namespace std;\n\nunordered_map dp[1005];\nstring s;\nint n,k,g[1005][1005];\nvoid up(int i,int v)\n{\n if(!i) {dp[i][v]=1;return;}\n for(int j=-k+1;j>s;\n for(int i=0;i<=n;i++) dp[i].clear();\n MM(g,0);\n for(int i=0;i\n#include\n#include\n\nusing namespace std;\n\nint main()\n{\n int n, d;\n cin>>n>>d;\n string way;\n cin>>way;\n queue > q;\n q.push({0, 0});\n int ans = -1;\n while(!q.empty()){\n pair p = q.front();\n q.pop();\n int idx = p.first;\n int moves = p.second;\n for(int i=idx+1;i<=idx+d;i++){\n if(way[i] == '1'&& i == n-1){\n ans = moves+1;\n break;\n }\n else if(way[i] == '1'){\n q.push({i, moves+1});\n }\n }\n if(ans != -1)\n break;\n }\n cout<\nusing namespace std;\nint main(){\n int n;\n cin >> n;\n map mp;\n for(int i = 0; i < n; i++){\n int x;\n cin >> x;\n mp[x] = true;\n if(mp.size() > 3){\n cout << \"-1\\n\";\n return 0;\n }\n }\n if(mp.size() == 1){\n cout << \"0\\n\";\n return 0;\n }\n else if(mp.size() == 2){\n int a[2];\n int j = 0;\n map :: iterator i;\n for(i = mp.begin(); i != mp.end(); i++){\n a[j++] = i->first;\n }\n sort(a, a+2);\n int k = 1;\n while(a[0] != a[1]){\n a[0] += k;\n a[1] -= k;\n k++;\n }\n cout << k-1 << \"\\n\";\n return 0;\n }\n else{\n int a[3];\n int j = 0;\n map :: iterator i;\n for(i = mp.begin(); i != mp.end(); i++){\n a[j++] = i->first;\n }\n sort(a, a+3);\n if(a[2] - a[1] == a[1] - a[0])\n cout << a[2] - a[1] << \"\\n\";\n else\n cout << \"-1\\n\";\n }\n}\n", "lang": "GNU C++17", "bug_code_uid": "49bb7c389e2b5cd7248d11c134feec22", "src_uid": "d486a88939c132848a7efdf257b9b066", "apr_id": "f9c60874aed8ae944e202cef1352f321", "difficulty": 1200, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9827784156142365, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "#include \n\nusing namespace std;\n\ntypedef long long ll;\n\nconst int MOD = 1e9+7;\nconst int MAXN = 1e6;\n\nint a, b, n;\nll ans, f[MAXN];\n\nbool ok(int x)\n{\n while (x > 0)\n {\n if (x%10 != a && x%10 != b) return false;\n x /= 10;\n }\n return true;\n}\n\nll Pow(ll x, ll e)\n{\n if (e == 0) return 1LL;\n\n ll aux = Pow(x, e/2)%MOD;\n\n aux = (aux*aux)%MOD;\n\n if (e%2 == 0) return aux;\n return (x*aux)%MOD;\n}\n\nll choose(ll x)\n{\n ll k = (f[x]*f[n-x])%MOD;\n return (f[n]*Pow(k, MOD-2))%MOD;\n}\n\nvoid solve(void)\n{\n for (int i = 0; i <= n; i++)\n {\n int sum = a*i+b*(n-i);\n if (ok(sum))\n ans += (choose(i))%MOD;\n }\n}\n\nint main(void)\n{\n cin >> a >> b >> n;\n\n f[0] = 1LL;\n f[1] = 1LL;\n for (int i = 2; i <= n; i++)\n f[i] = (i*f[i-1])%MOD;\n\n solve();\n cout << ans%MOD << \"\\n\";\n}\n", "lang": "GNU C++", "bug_code_uid": "8cffb20b838be1978c4fa813ae391a73", "src_uid": "d3e3da5b6ba37c8ac5f22b18c140ce81", "apr_id": "ee95dece76071ce115327dc782a2a0af", "difficulty": 1800, "tags": ["brute force", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8775137111517367, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include\n#define all(v) ((v).begin()), ((v).end())\n#define sz(v) ((int)((v).size()))\ntypedef long long ll;\nusing namespace std;\nint main(void) {\n\n\tint n;\n\tcin>>n;\n\tif(n%2!=0)\n\t\tcout<<\"YES\";\n\telse cout<<\"NO\";\n\treturn 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "9e1baf8b0cef505e12afb3ca32deae68", "src_uid": "587d4775dbd6a41fc9e4b81f71da7301", "apr_id": "8b4b86a079f30003a90fb5b8056e5f94", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8568864961866308, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "//i hate _____\n#include\n\n#define ll long long int \n#define ld long double \n#define pb push_back\n#define mk make_pair\n#define ii pair\n\nusing namespace std;\ndouble pi=2*acos(0.0);\n\n/*freopen(\"input.txt\",\"r\",stdin);\nfreopen(\"output.txt\",\"w\",stdout);*/\n\ntemplate \nostream& operator<<(ostream &os, const vector &v) { \n os << '{'; \n for (const auto &x : v) os << \" \" << x;\n return os << '}'; \n}\n\nvoid solve(){\n int n; cin>>n;\n int ans=0,cnt=0;\n char ch;\n while (true){\n ch=getchar();\n if (ch=='\\n'){\n ans=max(ans,cnt); break;\n }\n if (ch==' '){\n ans=max(ans,cnt); cnt=0;\n }\n if (ch>='A' && ch<='Z') cnt++;\n }\n cout << ans << endl;\n}\n\nint main()\n{\n ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);\n\n int test_cases=1; \n //cin>>test_cases;\n\n for (int tc=1;tc<=test_cases;tc++){\n \n solve();\n //cout << \"Case \" << tc << \": \" << solve() <\n#define xx first\n#define yy second\n#define mp make_pair\n#define pb push_back\n#define ll long long\nusing namespace std;\n\n\nll mod=1000000007;\nint n,k, cnt1[100005], used[100005], used2[100005], fif=0, cen=0;\nll cnt2[100005];\nll fact[200005];\nvector,int> > v,v2;\nvector > v4;\nvector v3;\n\nll pw(ll x, int y)\n{\n if(y==0) return 1;\n ll ans= pw(x,y/2);\n ans*=ans;\n ans%=mod;\n if(y%2) ans*=x;\n ans%=mod;\n return ans;\n}\n\nll inv(ll x)\n{\n return pw(x,mod-2);\n}\n\nll C(int x, int y)\n{\n if(x p= mp(0,0);\n while(p.yy\n\nint main() {\n int a, b, c;\n scanf(\"%d%d%d\", &a, &b, &c);\n printf(\"%d\\n\", max(a, max(b, c)));\n}\n\t \t \t\t\t\t\t\t \t \t\t \t \t \t", "lang": "GNU C++", "bug_code_uid": "9a5711cc45af14b5649cbac1665d3a6a", "src_uid": "b8008caf788336775cb8ebb76478b04c", "apr_id": "194682e862a5a1b10fc1be661991a018", "difficulty": 2100, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.491635687732342, "equal_cnt": 22, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 17, "fix_ops_cnt": 22, "bug_source_code": "#include\nusing namespace std;\nlong long arr[103];\nvector seq;\nvector ndw;\nint main()\n{\n long long n,k,i,i2,pos;\n cin>>n>>k;\n for(i=0;i>arr[i];\n }\n for(i=0;i\n#include \nusing namespace std;\nint main()\n{\n long long n;\n bool f=false;\n cin >> n;\n for (long long i=1; i*i+i<=n; ++i)\n {\n long long x;\n x=(-i-sqrtl(i*i+4*n))/2;\n if (x>0)\n {if (i==(n-x*x)/x && (n-x*x)%x==0) {cout << x; f=true; break;}}\n else \n {\n x=(-i+sqrtl(i*i+4*n))/2;\n if (x>0)\n {if (i==(n-x*x)/x && (n-x*x)%x==0) {cout << x; f=true; break;}}\n }\n\n }\n if (f==false) cout << \"-1\";\n return 0;\n}", "lang": "MS C++", "bug_code_uid": "2297f29bd61947f7fbb1d1459a818038", "src_uid": "e1070ad4383f27399d31b8d0e87def59", "apr_id": "70b4477c1f3fdc71f4a65bf6a27a4c29", "difficulty": 1400, "tags": ["math", "brute force", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.4574865201161344, "equal_cnt": 19, "replace_cnt": 16, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 19, "bug_source_code": "//# pragma GCC optimize (\"O0\")\n//# pragma GCC optimize (\"Ofast\")\n//# pragma GCC optimize (\"unroll-loops\")\n\n#include \n\n#define all(x) x.begin(), x.end()\n#define UN -1\n#define VIS -2\n#define EX -3\n#define mp(a, b) make_pair(a, b)\n#define pb push_back\n#define pob pop_back()\n#define puf push_front\n#define pof pop_front()\n#define clr(a) (a).clear()\n#define sz(a) (int)(a).size()\n#define forn(t, n) for(int t = 0; t < n; t++)\n#define foren(t, n) for(int t = 1; t <= n; t++)\n#define llm LONG_LONG_MAX\n#define llmn LONG_LONG_MIN\n#define intm INT_MAX\n#define intmn INT_MIN\n#define dblm DBL_MAX\n#define dblmn DBL_MIN\n#define mod 1000000007\n#define mod2 1000000009\n#define mil 1111111\n#define bil 1111111111\n#define pi M_PI\n#define euler 2.718281828459\n#define eps 1e-12\n#define degrad (pi/180.0)\n#define raddeg (180.0/pi)\n#define uset unordered_set\n#define umap unordered_map\n#define fio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);\nusing namespace std;\ntypedef long long ll;\ntypedef vector vll; typedef pair pll; typedef vector vpll;\ntypedef vector vi; typedef pair ii; typedef vector vii; typedef vector vvi;\ntypedef pair iii; typedef pair iiii; typedef pair tll;\ntypedef vector vvii; typedef vector vvll; typedef vector vc; typedef vector vvc;\ntypedef vector vb; typedef vector vvb; typedef queue qi; typedef queue qll;\ntypedef queue qii; typedef vector vtll; typedef vector viii; typedef pair ppll;\ntypedef priority_queue pqi; typedef priority_queue pqll;\ntypedef pair iii; typedef vector viii; typedef vector vs;\ntypedef vector vd; typedef pair dd; typedef vector

vdd; typedef pair riii;\ntypedef vector > vvd; typedef vector vvvi;\n\ntemplate void pv(vector &vec) { forn(i, sz(vec)) cout << vec[i] << (i == sz(vec) - 1 ? '\\n' : ' '); }\n\n\n//ifstream in(\"/home/danza/CLionProjects/codeforces/in.in\");\n//ofstream out(\"/home/danza/CLionProjects/codeforces/out2.out\");\n//#define cin in\n//#define cout out\n\n//#define FAST\n#define SLOW\n//#define GENERATOR\n//#define DEBUG\n\n#ifdef DEBUG\n#ifdef FAST\nifstream in(\"/home/danza/CLionProjects/codeforces/in.in\");\nofstream out(\"/home/danza/CLionProjects/codeforces/out2.out\");\n#endif\n#ifdef SLOW\nifstream in(\"/home/danza/CLionProjects/codeforces/in.in\");\nofstream out(\"/home/danza/CLionProjects/codeforces/out.out\");\n#endif\n#ifdef GENERATOR\nofstream out(\"/home/danza/CLionProjects/codeforces/in.in\");\n#endif\n#define cin in\n#define cout out\n#endif\n\n#ifdef FAST\nll la, ra, ta, lb, rb, tb, cyclen;\n\nvoid init() {\n cin >> la >> ra >> ta >> lb >> rb >> tb;\n if(la < lb) {\n swap(la, lb);\n swap(ra, rb);\n swap(ta, tb);\n }\n cyclen = (ta * tb) / __gcd(ta, tb);\n}\n\nll inter(pll X, pll Y) {\n if(X.first > Y.first)\n swap(X, Y);\n if(X.second < Y.first)\n return 0LL;\n if(X.second >= Y.second)\n return Y.second - Y.first + 1;\n return X.second - Y.first + 1;\n}\n\nll cnt(ll x) {\n ll a_start = la + x * ta;\n ll b_start1 = lb + ((a_start - lb + 1) / tb) * tb;\n ll b_start2 = b_start1 + tb;\n ll b_start3 = b_start1 - tb;\n ll len1 = inter({b_start1, b_start1 + (rb - lb)}, {a_start, a_start + (ra - la)});\n ll len2 = inter({b_start2, b_start2 + (rb - lb)}, {a_start, a_start + (ra - la)});\n ll len3 = inter({b_start3, b_start3 + (rb - lb)}, {a_start, a_start + (ra - la)});\n if(b_start2 > a_start + (ra - la) + 1)\n len2 = 0;\n return max(len1, max(len2, len3));\n}\n\nll ternary_search() {\n ll st = 0, en = cyclen / ta + 1, st_mid, en_mid;\n while(en - st > 5) {\n ll third = (en - st) / 3;\n st_mid = st + third;\n en_mid = st + 2 * third;\n ll st_mid_res = cnt(st_mid);\n ll en_mid_res = cnt(en_mid);\n if(st_mid_res == en_mid_res) {\n if(cnt(st) > cnt(en - 1))\n en = en_mid;\n else\n st = st_mid;\n }\n else if(st_mid_res > en_mid_res)\n en = en_mid;\n else\n st = st_mid;\n }\n vll res;\n for(ll i = st; i < en; i++)\n res.pb(cnt(i));\n ll mx = *max_element(all(res));\n forn(i, sz(res)) {\n if(res[i] == mx)\n return st + i;\n }\n assert(1 == 0);\n}\n\nll solve() {\n ll x = ternary_search();\n ll ans = cnt(x);\n cout << \"for x=\" << x << '\\n';\n return ans;\n}\n\nint main() {\n#ifndef DEBUG\n fio\n#endif\n#ifdef DEBUG\n ll TC;\n cin >> TC;\n foren(tc, TC) {\n string s;\n cin >> s >> s;\n cout << \"Case #\" << tc << \":\\n\";\n#endif\n init();\n cout << solve() << '\\n';\n\n#ifdef DEBUG\n}\n#endif\n\nreturn 0;\n}\n#endif\n\n\n#ifdef SLOW\nll la, ra, ta, lb, rb, tb, cyclen;\n\nvoid init() {\n cin >> la >> ra >> ta >> lb >> rb >> tb;\n if(la < lb) {\n swap(la, lb);\n swap(ra, rb);\n swap(ta, tb);\n }\n cyclen = (ta * tb) / __gcd(ta, tb);\n}\n\nll inter(pll X, pll Y) {\n if(X.first > Y.first)\n swap(X, Y);\n if(X.second < Y.first)\n return 0LL;\n if(X.second >= Y.second)\n return Y.second - Y.first + 1;\n return X.second - Y.first + 1;\n}\n\nll cnt(ll x) {\n ll a_start = la + x * ta;\n ll b_start1 = lb + ((a_start - lb + 1) / tb) * tb;\n ll b_start2 = b_start1 + tb;\n ll b_start3 = b_start1 - tb;\n ll len1 = inter({b_start1, b_start1 + (rb - lb)}, {a_start, a_start + (ra - la)});\n ll len2 = inter({b_start2, b_start2 + (rb - lb)}, {a_start, a_start + (ra - la)});\n ll len3 = inter({b_start3, b_start3 + (rb - lb)}, {a_start, a_start + (ra - la)});\n if(b_start2 > a_start + (ra - la) + 1)\n len2 = 0;\n return max(len1, max(len2, len3));\n}\n\nll linear_search() {\n ll st = 0, en = cyclen / ta + 1;\n vll res;\n for(ll i = st; i < en; i++)\n res.pb(cnt(i));\n ll mx = *max_element(all(res));\n forn(i, sz(res)) {\n if(res[i] == mx)\n return st + i;\n }\n assert(1 == 0);\n}\n\nll solve() {\n ll x = linear_search();\n ll ans = cnt(x);\n return ans;\n}\n\nint main() {\n#ifdef DEBUG\n ll TC;\n cin >> TC;\n foren(tc, TC) {\n string s; cin >> s >> s;\n cout << \"Case #\" << tc << \":\\n\";\n#endif\n init();\n cout << solve() << '\\n';\n\n#ifdef DEBUG\n }\n#endif\n\n return 0;\n}\n#endif\n\n\n\n#ifdef GENERATOR\nint main() {\n mt19937 mt;\n ll TC = 100;\n cout << TC << '\\n';\n ll range = 100;\n foren(tc, TC) {\n cout << \"Case #\" << tc << \":\\n\";\n forn(i, 2) {\n ll l = mt() % range, r = -1;\n while (r < l)\n r = mt() % range;\n cout << l << ' ' << r << ' ' << (r - l + 1) + mt() % range + 3 << '\\n';\n }\n cout << \"\\n\\n\";\n }\n\n return 0;\n}\n#endif\n", "lang": "GNU C++14", "bug_code_uid": "874a3893a76cb3d23e97a38559f8a7e2", "src_uid": "faa75751c05c3ff919ddd148c6784910", "apr_id": "5c8b9ec5b36398902e54852fbbf43355", "difficulty": 1900, "tags": ["math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.05293853746074473, "equal_cnt": 16, "replace_cnt": 14, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 16, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n\nusing namespace std;\n\nstruct point {\n double x, y;\n \n template\n bool collinear(P const & ...points) {\n array ps {points...};\n \n //x\n int times = 0;\n for(auto p : ps)\n times += (x == p.x ? 1 : 0);\n \n if(times == ps.size())\n return true;\n \n //y\n times = 0;\n for(auto p : ps)\n times += (y == p.y ? 1 : 0);\n \n if(times == ps.size())\n return true;\n \n return false;\n }\n \n bool between(point const & a, point const & b) {\n /* \n * \n * a b\n * x\n * \n */\n \n if(\n (a.x <= x && x <= b.x) ||\n (a.y <= y && y <= b.y) ||\n (a.x >= x && x >= b.x) ||\n (a.y >= y && y >= b.y)\n )\n return true;\n }\n \n friend istream& operator>>(istream& in, point & self) {\n in >> self.x >> self.y;\n }\n \n};\n\nint main(){\n point a, b, c;\n cin >> a >> b >> c;\n \n int ans;\n \n if(a.collinear(b, c))\n ans = 1;\n else if(\n (a.collinear(b) && c.between(a, b)) || \n (a.collinear(c) && b.between(a, c)) || \n (c.collinear(b) && a.between(c, b))\n )\n ans = 3;\n else if(\n ((a.x != b.x) && (a.x != c.x) && (b.x != c.x)) &&\n ((a.y != b.y) && (a.y != c.y) && (b.y != c.y))\n )\n ans = 3;\n else\n ans = 2;\n cout << ans << '\\n'; \n return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "94eb3362f5b77a76d1f1d98c2f4cc3d6", "src_uid": "36fe960550e59b046202b5811343590d", "apr_id": "6d80660387553dc162975c8b177c5ea2", "difficulty": 1700, "tags": ["constructive algorithms", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.3464566929133858, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "#include \nusing namespace std;\nint c, d, n, m, k, req;\nint dp[10001][10001];\nint rec(int ele, int add, int sum)\n{\n if(dp[ele][add]!=-1)\n return dp[ele][add];\n if(sum>=req)\n return dp[ele][add]=ele*c+add*d;\n return min(rec(ele+1, add, sum+n), rec(ele, add+1, sum+1));\n\n}\nint main()\n{\n scanf(\"%d%d%d%d%d\", &c, &d, &n, &m, &k);\nmemset(dp, -1, sizeof dp); req=n*m-k;\nprintf(\"%d\",rec(0,0,0));\n}\n", "lang": "GNU C++11", "bug_code_uid": "3fe0a0ab3d690b67122266a795ecb36f", "src_uid": "c6ec932b852e0e8c30c822a226ef7bcb", "apr_id": "647a4c71e1fb31689b67cf6c0c72a174", "difficulty": 1500, "tags": ["dp", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.6926612305411416, "equal_cnt": 80, "replace_cnt": 58, "delete_cnt": 17, "insert_cnt": 5, "fix_ops_cnt": 80, "bug_source_code": "//#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\n#define FOR(i,f,t) for(int i=(int)f; i<(int)t; i++)\n#define FORR(i,f,t) for(int i=(int)f; i>(int)t; i--)\n#define ms(obj, val) memset(obj, val, sizeof(obj))\n#define pb push_back\n#define SYNC ios_base::sync_with_stdio(false)\n#define inf 2248012\n#define mp make_pair\n#define F first\n#define S second\n#define ri(x) scanf(\"%d\",&x)\n#define rii(x,y) scanf(\"%d %d\",&x,&y)\n#define riii(x,y,z) scanf(\"%d %d %d\",&x,&y,&z)\n#define lri(x) scanf(\"%lld\",&x)\n#define lrii(x,y) scanf(\"%lld %lld\",&x,&y)\n#define lriii(x,y,z) scanf(\"%lld %lld %lld\",&x,&y,&z)\n\ntypedef vector vi;\ntypedef long long ll;\ntypedef pair ii;\n\nconst int MAXN = 5e5+3; //AREGLAAAAAAAAR!!!!\nint n;\nint a[24];\nvector v1,v2;\nint start2;\nint cnt;\nint main(){\n\tFOR(i,0,24)ri(a[i]);\n\tif((a[12]==a[13])&&(a[13]==a[14])&&(a[14]==a[15])&&(a[16]==a[17])&&(a[17]==a[18])&&(a[18]==a[19])&&(a[0]==a[1])&&(a[1]==a[2])&&(a[2]==a[3])&&(a[8]==a[9])&&(a[9]==a[10])&&(a[10]==a[11])&&(a[4]==a[5])&&(a[5]==a[6])&&(a[6]==a[7])&&(a[20]==a[21])&&(a[21]==a[22])&&(a[22]==a[23])){printf(\"NO\\n\");return 0;}\n\telse if((a[12]==a[13])&&(a[13]==a[14])&&(a[14]==a[15])&&(a[16]==a[17])&&(a[17]==a[18])&&(a[18]==a[19])){\n\t\tv1.pb(0);v1.pb(2);v1.pb(4);v1.pb(6);v1.pb(8);v1.pb(10);v1.pb(23);v1.pb(21);\n\t\tv2.pb(1);v2.pb(3);v2.pb(5);v2.pb(7);v2.pb(9);v2.pb(11);v2.pb(22);v2.pb(20);\n\t\tFOR(i,0,8){\n\t\t\tif(v1[0]==v2[i])start=i;\n\t\t}\n\t\tif(v2[start]!=v2[(start+1)%n])start=(start-1+n)%n;\n\t\tif(v1[0]!=v1[1])start2=n-1;\n\t\tFOR(i,0,n){\n\t\t\tif(v1[(start2+i)%n]!=v2[start]){\n\t\t\t\tprintf(\"NO\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tstart=(start+1)%8;\n\t\t}\n\t\tcnt=0;\n\t\tFOR(i,0,n){\n\t\t\tif(v2[start]==v2[(start+1)%8])cnt++;\n\t\t\telse if(cnt<1){\n\t\t\t\tprintf(\"NOU\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse cnt=0;\n\t\t\tstart=(start+1)%8;\n\t\t}\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\n\telse if((a[0]==a[1])&&(a[1]==a[2])&&(a[2]==a[3])&&(a[8]==a[9])&&(a[9]==a[10])&&(a[10]==a[11])){\n\t\tv1.pb(12);v1.pb(13);v1.pb(4);v1.pb(5);v1.pb(16);v1.pb(17);v1.pb(20);v1.pb(21);\n\t\tv2.pb(14);v2.pb(15);v2.pb(6);v2.pb(7);v2.pb(18);v2.pb(19);v2.pb(22);v2.pb(23);\n\t\tFOR(i,0,8){\n\t\t\tif(v1[0]==v2[i])start=i;\n\t\t}\n\t\tif(v2[start]!=v2[(start+1)%n])start=(start-1+n)%n;\n\t\tif(v1[0]!=v1[1])start2=n-1;\n\t\tFOR(i,0,n){\n\t\t\tif(v1[(start2+i)%n]!=v2[start]){\n\t\t\t\tprintf(\"NO\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tstart=(start+1)%8;\n\t\t}\n\t\tcnt=0;\n\t\tFOR(i,0,n){\n\t\t\tif(v2[start]==v2[(start+1)%8])cnt++;\n\t\t\telse if(cnt<1){\n\t\t\t\tprintf(\"NOU\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse cnt=0;\n\t\t\tstart=(start+1)%8;\n\t\t}\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\n\telse if((a[4]==a[5])&&(a[5]==a[6])&&(a[6]==a[7])&&(a[20]==a[21])&&(a[21]==a[22])&&(a[22]==a[23])){\n\t\tv1.pb(2);v1.pb(3);v1.pb(16);v1.pb(18);v1.pb(9);v1.pb(8);v1.pb(15);v1.pb(13);\n\t\tv2.pb(0);v2.pb(1);v2.pb(17);v2.pb(19);v2.pb(11);v2.pb(10);v2.pb(14);v2.pb(12);\n\t\tFOR(i,0,8){\n\t\t\tif(v1[0]==v2[i])start=i;\n\t\t}\n\t\tif(v2[start]!=v2[(start+1)%n])start=(start-1+n)%n;\n\t\tif(v1[0]!=v1[1])start2=n-1;\n\t\tFOR(i,0,n){\n\t\t\tif(v1[(start2+i)%n]!=v2[start]){\n\t\t\t\tprintf(\"NO\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tstart=(start+1)%8;\n\t\t}\n\t\tcnt=0;\n\t\tFOR(i,0,n){\n\t\t\tif(v2[start]==v2[(start+1)%8])cnt++;\n\t\t\telse if(cnt<1){\n\t\t\t\tprintf(\"NOU\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse cnt=0;\n\t\t\tstart=(start+1)%8;\n\t\t}\n\t\treturn 0;\n\t}\n\t\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "ddab0483d62a75f08b70430d064eed88", "src_uid": "881a820aa8184d9553278a0002a3b7c4", "apr_id": "44d546d203765b8cfb31b0689428b51e", "difficulty": 1500, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9895251396648045, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\ntypedef long long int ll;\ntemplate \nT power(T a, T b) { T x; if (b == 0) x = 1; else x = a; for (size_t i = 1; i < b; i++) x *= a; return x; }\n\nll n, m, a, b, c, ab, ba, x, y, avg, sum, arr2[200000], arr3[1000];\nchar arr[101][101], c1;\nvector> vec(3);\nvector v;\nbool f, f1, f2; string s[3];\nmap mp;\nbool sorto(pair a, pair b) { return a.second < b.second; }\n\nint main() {\n for (size_t i = 0; i < 3; i++)\n {\n cin >> vec[i].first; vec[i].second = i + 1;\n }\n sort(s, s + 3);\n if (vec[0].first == vec[1].first && vec[1].first == vec[2].first) cout << '?';\n else if (vec[0].first != vec[1].first && vec[1].first != vec[2].first && vec[0].first != vec[2].first) cout << '?';\n else {\n if (vec[0].first == \"paper\" && vec[1].first == vec[2].first && vec[1].first == \"rock\") a = vec[0].second;\n else if (vec[0].first == \"rock\" && vec[1].first == vec[2].first && vec[1].first == \"scissors\") a = vec[0].second;\n else if (vec[2].first == \"scissors\" && vec[0].first == vec[1].first && vec[1].first == \"paper\") a = vec[2].second;\n else cout << '?';\n }\n if (a == 1) cout << 'F';\n else if (a == 2) cout << 'M';\n else if (a == 3) cout << 'S';\n}", "lang": "GNU C++11", "bug_code_uid": "dc5980eea6dea678834c95b25af2055b", "src_uid": "072c7d29a1b338609a72ab6b73988282", "apr_id": "b5590779a3a77e421e32e5047e5f761c", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9488252333440618, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 6, "bug_source_code": "//*******Abhijit Burman***********// \n//Jalpaiguri Government Engineering College/ \n\n#include \nusing namespace std; \n#define ll long long int \n#define pb push_back \n#define mk make_pair \n#define MAXX (1000000000000000000+7) \n#define fio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL) \n\nbool SQRT(string p)\n{\n ll num = stoi(p);\n ll i=sqrt(num);\n if(num==i*i)\n {\n return true;\n }\n else\n {\n return false;\n }\n}\n\n\nint solve()\n{\n\n string s;\n cin>>s;\n ll n = s.length();\n if(SQRT(s)==true)\n {\n cout<<0<>tt;\n while(tt--)\n {\n solve();\n }\n return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "d85a44f8a9055a55f680f32af67c3001", "src_uid": "fa4b1de79708329bb85437e1413e13df", "apr_id": "ac90a7f16fb76e9c4aaefb5d5bb68d4d", "difficulty": 1400, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9981107686188724, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n// #define DEBUG\n\nnamespace {\n#ifdef DEBUG\n const int kDebug = true;\n#else\n const int kDebuf = false;\n#endif\n} // namespace\n\nconst int mod = (int)1e9 + 7;\n\nstruct Rational {\n operator int() { return x; }\n \n Rational() {\n this->x = 0;\n#ifdef DEBUG\n this->rawValue = 0;\n#endif\n }\n Rational(int x) {\n this->x = (mod + x % mod) % mod;\n#ifdef DEBUG\n this->rawValue = x;\n#endif\n }\n \n Rational operator * (int rh) {\n Rational res((this->x * 1ll * ((mod + rh % mod) % mod)) % mod);\n#ifdef DEBUG\n res.rawValue = this->rawValue * rh;\n#endif\n return res;\n }\n \n Rational operator * (Rational rh) {\n Rational res((this->x * 1ll * rh.x) % mod);\n#ifdef DEBUG\n res.rawValue = this->rawValue * rh.rawValue;\n#endif\n return res;\n }\n \n Rational operator += (Rational rh) {\n this->x = (this->x + 0ll + rh.x) % mod;\n#ifdef DEBUG\n this->rawValue += rh.rawValue;\n#endif\n return *this;\n }\n \n Rational operator = (int x) {\n this->x = (mod + x % mod) % mod;\n#ifdef DEBUG\n this->rawValue = x;\n#endif\n return *this;\n }\n \n Rational operator / (int x) {\n Rational res(this->x * 1ll * reverse(x) % mod);\n#ifdef DEBUG\n res.rawValue = this->rawValue / x;\n#endif\n return res;\n }\n \n#ifdef DEBUG\n double rawValue;\n#endif\nprivate:\n int x;\n\n int reverse(int x) {\n x = (mod + x % mod) % mod;\n return binPow(x, mod - 2);\n }\n \n int binPow(int x, int p) {\n if (!p) return 1;\n if (p & 1) return binPow(x, p - 1) * 1ll * x % mod;\n x = binPow(x, p >> 1);\n return x * 1ll * x % mod;\n }\n};\n\ntemplate \nstruct Matrix {\n static Matrix unit(int size) {\n Matrix res(size, size);\n for (int i = 0; i < size; ++i)\n res[i][i] = 1;\n return res;\n }\n \n int rows, cols;\n vector < vector > arr;\n \n Matrix (int rows, int cols) {\n this->rows = rows;\n this->cols = cols;\n arr.clear();\n for (int i = 0; i < rows; ++i) {\n vector tmp(cols);\n arr.push_back(tmp);\n }\n }\n \n Matrix operator * (Matrix rh) {\n Matrix lh = *this;\n assert(lh.cols == rh.rows);\n int commonSize = lh.cols;\n \n \n Matrix res(lh.rows, rh.cols);\n for (int i = 0; i < lh.rows; ++i)\n for (int j = 0; j < rh.cols; ++j)\n for (int k = 0; k < commonSize; ++k)\n res[i][j] += lh[i][k] * rh[k][j];\n \n return res;\n }\n \n vector & operator [] (int index) {\n return arr[index];\n }\n};\n\ntemplate \nMatrix binPow(Matrix m, int p) {\n assert(m.rows == m.cols);\n int size = m.rows;\n \n if (!p) return Matrix::unit(size);\n if (p & 1) return binPow(m, p - 1) * m;\n m = binPow(m, p >> 1);\n return m * m;\n}\n\nconst int maxn = (int)1e2 + 10;\nint a[maxn];\n\nint main() {\n int n, k;\n cin >> n >> k;\n int cntOnes = 0, cntZeros = 0;\n for (int i = 0; i < n; ++i) {\n cin >> a[i];\n if (a[i]) cntOnes++;\n else cntZeros++;\n }\n \n int max_ = max(cntOnes, cntZeros);\n int min_ = min(cntOnes, cntZeros);\n if (min_ == 0)\n {\n cout << 1 << endl;\n return 0;\n }\n \n int badZeros = 0;\n for (int i = 0; i < n; ++i) {\n if (i >= cntZeros)\n break;\n badZeros += a[i] == 1;\n }\n \n int size = min_ + 1;\n Matrix initial(1, size);\n initial[0][badZeros] = 1;\n \n Matrix step(size, size);\n for (int i = 0; i <= min_; ++i) {\n if (i < min_)\n step[i + 1][i] = (i + 1) * (i + 1);\n if (i > 0)\n step[i - 1][i] = (max_ - i + 1) * (min_ - i + 1);\n step[i][i] =\n (i * (min_ - i) + i * (max_ - i) + min_ * (min_ - 1) / 2 + max_ * (max_ - 1) / 2);\n }\n \n#ifdef DEBUG\n cout << (Rational(2) * 1 * 1 / n).rawValue << endl;\n for (int i = 0; i <= min_; ++i)\n for (int j = 0; j <= min_; ++j) {\n cout << \"step[\" << i << \"][\" << j << \"]=\";\n printf(\"%.7lf\\n\", step[i][j].rawValue);\n cout << endl;\n }\n#endif\n step = binPow(step, k);\n#ifdef DEBUG\n for (int i = 0; i <= min_; ++i)\n for (int j = 0; j <= min_; ++j)\n cout << \"step[\" << i << \"][\" << j << \"]=\" << step[i][j].rawValue << endl;\n#endif\n \n Matrix answer = initial * step;\n Rational sum = 0;\n for (int i = 0; i <= min_; ++i)\n sum += answer[0][i];\n#ifdef DEBUG\n cout << answer[0][0].rawValue << endl;\n cout << sum << endl;\n#endif\n cout << answer[0][0] / sum << endl;\n return 0;\n}\n\n// CodeForces\n", "lang": "GNU C++14", "bug_code_uid": "e50a2ea82d5b53a74bc4801156aadc2e", "src_uid": "77f28d155a632ceaabd9f5a9d846461a", "apr_id": "9a40b360440308a6ab641ec9f60f15de", "difficulty": 2300, "tags": ["matrices", "dp", "combinatorics", "probabilities"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9611510791366906, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "//New_Year_And_Hurry\n#include\n#define lb lower_bound\nusing namespace std;\nint main()\n{\n int n,k,m;cin>>n>>k;\n m=240-k;\n vector v(n);v.at(0)=5;\n for(int i=1;i\n#include\nusing namespace std;\nstruct abc\n{\n int a;\n string s;\n}x[4],temp;\nint main()\n{\n cin>>x[0].s>>x[1].s>>x[2].s>>x[3].s;\n x[0].a=x[0].s.length();\n x[1].a=x[1].s.length();\n x[2].a=x[2].s.length();\n x[3].a=x[3].s.length();\nfor(int p=0;p<=3;p++) \n{\nfor(int j=0;j<=3;j++)\n{\nif(x[j].a>x[j+1].a)\n{\ntemp=x[j]; \nx[j]=x[j+1];\nx[j+1]=temp;\n}\n}\n}\nif((x[1].a/x[0].a)>=2)\n{ \n cout<< x[0].s[0];\n } \nelse if ((x[3].a/x[2].a)>=2) \n{\n cout<\n#include \n#include \nusing namespace std;\n\nint main() \n{\n int n;\n cin>>n;\n getchar();\n char c=getchar();\n int cnt=0;\n vector g;\n int temp=0;\n while (c!=EOF)\n {\n if (c=='W')\n {\n c=getchar();\n continue;\n }\n while (c!=EOF && c=='B')\n {\n temp++;\n c=getchar();\n }\n \n g.push_back(temp);\n cnt++;\n temp=0;\n }\n \n cout<\nusing namespace std;\n#define ll long long int\n#define soja(i,a,n) for(int i=a;i<=n;i++)\n#define ulta(i,n,a) for(int i=n;i>=a;i--)\n#define pb push_back\nint main()\n{\n ll n,m,k,t;\n cin>>n>>m>>k;\n vector>p;\n soja(i,1,n)\n {\n p.pb({i,1});\n }\n soja(i,2,m)\n {\n p.pb({n,i});\n }\n soja(i,1,n-1)\n {\n if(i%2!=0)\n {\n ulta(j,m,2)\n {\n p.pb({n-i,j});\n }\n }\n else\n {\n soja(j,2,m)\n {\n p.pb({n-i,j});\n }\n }\n }\n t=p.size();\n cout<\n#include\nusing namespace std;\n\nint main() {\n\tios_base::sync_with_stdio(false);\n\tlong long n,m;\n\tcin>>n>>m;\n\tvector divisors;\n\tif(m==1){cout<n)continue;\n\t\t\tif((reminsqrt*reminsqrt)==(divisors[i]-(j*j)))\n\t\t\t{ cnt++;\n\t\t\t \n\t\t\t //cout<\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\n\n#define LL __int64\n#define inf 0x3fffffff\n#define M 100\n\nint a[M];\n\nint main()\n{\n int i,n, m;\n while(scanf(\"%d%d\", &n, &m) != EOF)\n {\n for(i = 1; i<=m; i++)\n scanf(\"%d\", &a[i]);\n\n sort(a+1, a+m+1);\n\n int ans = a[m] - a[1];\n if(n == m)\n {\n printf(\"%d\\n\",ans);\n continue;\n }\n for(i = 1; i+n-1<=m; i++)\n {\n ans = min(ans, a[i+n-1] - a[i]);\n }\n printf(\"%d\\n\",ans);\n }\n return 1;\n}", "lang": "MS C++", "bug_code_uid": "0cb5367ab793639ac8422b3f8bfa7070", "src_uid": "7830aabb0663e645d54004063746e47f", "apr_id": "aa2fb1b4c3c1c7a7fbf424f0e937e0e9", "difficulty": 900, "tags": ["greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.6721240844463593, "equal_cnt": 17, "replace_cnt": 9, "delete_cnt": 7, "insert_cnt": 1, "fix_ops_cnt": 17, "bug_source_code": "#define _USE_MATH_DEFINES\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n#define ff(i,x,y) for(int i = (x);i < (y);++i)\n#define rep(i,n) ff(i,0,n)\n#define st(v) sort(v.begin(),v.end())\n#define st2(v,f) sort(v.begin(),v.end(),f)\n#define rvs(v) reverse(v.begin(),v.end())\n#define cnt(v,n) count(v.begin(),v.end(),n)\n#define pb push_back\nbool myfunction (int i,int j) { return (i0;i--){x=x*i;}\n#define MP make_pair\n#define F first\n#define S second\n#define LL long long\n#define ULL unsigned long long\n#define VI vector\n#define VVI vector\n\ntypedef pair PII;\ntypedef pair PIII;\n\n#ifdef LOCAL\nifstream in(\"in.txt\");\n#else\nistream &in = cin;\n#endif\n\nint n;\nbool adj[1501][1501];\nint vtx[1501];\nvector chk;\nvector points;\nvector res;\n\nint dfs(int node)\n{\n\tint cnt = 0;\n\tchk[node] = true;\n\tfor(int i = 1;i <= n;++i) \n\t\tif(!chk[i] && adj[node][i])\n\t\t\tcnt += dfs(i);\n\tvtx[node] = cnt+1;\n\treturn vtx[node];\n}\n\nvoid go(int s, int r, int root, vector ps, vector c)\n{\n\tint min_y = INT_MAX, min_i = -1;\n\tfor(int i = s;i <= r;++i) if(!c[i] && ps[i].F.S < min_y) {min_y = ps[i].F.S; min_i = i;}\n\tc[min_i] = true;\n\tres.push_back(MP(ps[min_i].S,root));\n\tfor(int i = 1;i <= n;++i) if(adj[root][i]) {\n\t\tvector nps(1);\n\t\tvector nchk;\n\t\twhile(nps.size() < vtx[i]+1) {\n\t\t\tif(!c[s]) nps.push_back(ps[s]);\n\t\t\t++s;\n\t\t}\n\t\tadj[i][root] = false;\n\t\tnchk.resize(nps.size(),false);\n\t\tgo(1,nps.size()-1,i,nps,nchk);\n\t}\n}\n\nint main()\n{\n\tin >> n;\n\trep(i,n+1) rep(j,n+1) adj[i][j] = false;\n\tpoints.resize(n+1);\n\tchk.resize(n+1,false);\n\tmemset(vtx,0,sizeof(vtx));\n\n\trep(i,n-1) {\n\t\tint a, b;\n\t\tin >> a >> b;\n\t\tadj[a][b] = adj[b][a] = true;\n\t}\n\n\trep(i,n) {\n\t\tint x, y;\n\t\tin >> x >> y;\n\t\tpoints[i+1] = MP(MP(x,y),i+1);\n\t}\n\n\tdfs(1);\n\n\tsort(points.begin()+1,points.end());\n\trep(i,n+1) chk[i] = false;\n\n\tgo(1,n,1,points,chk);\n\n\tst(res);\n\n\tfor(int i = 0;i < res.size();++i) cout << res[i].second << \" \";\n\n\treturn 0;\n}", "lang": "GNU C++", "bug_code_uid": "db13ca8faa727ab049fbd2d11a4238ef", "src_uid": "d65e91dc274c6659cfdb50bc8b8020ba", "apr_id": "f41fe67149d276932da6ad0d9a4acf71", "difficulty": 2200, "tags": ["trees", "dfs and similar", "geometry", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.998025666337611, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "#pragma GCC optimize(\"Ofast\")\n#include\n#include \n\n#define F first\n#define S second\n//#define int long long\n#define ll long long\n//#define int unsigned long long\n#define pb push_back\n//#define double long double\n\nusing namespace std;\nusing namespace __gnu_pbds;\ntypedef tree< int , null_type, less, rb_tree_tag, tree_order_statistics_node_update> ordered_set;\nconst int mod = 1e9 + 7;\nconst int N = 300010;\nconst int K = 400;\ntemplate \nclass mcmf {\n public:\n static constexpr T eps = (T) 1e-9;\n struct edge {\n int from;\n int to;\n T c;\n T f;\n C cost;\n };\n vector< vector > g;\n vector edges;\n vector d;\n vector q;\n vector in_queue;\n vector pe;\n int n;\n int st, fin;\n T flow;\n C cost;\n mcmf(int _n, int _st, int _fin) : n(_n), st(_st), fin(_fin) {\n assert(0 <= st && st < n && 0 <= fin && fin < n && st != fin);\n g.resize(n);\n d.resize(n);\n in_queue.resize(n);\n pe.resize(n);\n flow = 0;\n cost = 0;\n }\n void clear_flow() {\n for (const edge &e : edges) {\n e.f = 0;\n }\n flow = 0;\n }\n\n void add(int from, int to, T forward_cap, T backward_cap, C cost) {\n assert(0 <= from && from < n && 0 <= to && to < n);\n g[from].push_back((int) edges.size());\n edges.push_back({from, to, forward_cap, 0, cost});\n g[to].push_back((int) edges.size());\n edges.push_back({to, from, backward_cap, 0, -cost});\n }\n bool expath() {\n fill(d.begin(), d.end(), numeric_limits::max());\n q.clear();\n q.push_back(st);\n d[st] = 0;\n in_queue[st] = true;\n int beg = 0;\n bool found = false;\n while (beg < (int) q.size()) {\n int i = q[beg++];\n if (i == fin) {\n found = true;\n }\n in_queue[i] = false;\n for (int id : g[i]) {\n const edge &e = edges[id];\n if (e.c - e.f > eps && d[i] + e.cost < d[e.to]) {\n d[e.to] = d[i] + e.cost;\n pe[e.to] = id;\n if (!in_queue[e.to]) {\n q.push_back(e.to);\n in_queue[e.to] = true;\n }\n }\n }\n }\n if (found) {\n T push = numeric_limits::max();\n int v = fin;\n while (v != st) {\n const edge &e = edges[pe[v]];\n push = min(push, e.c - e.f);\n v = e.from;\n }\n v = fin;\n while (v != st) {\n edge &e = edges[pe[v]];\n e.f += push;\n edge &back = edges[pe[v] ^ 1];\n back.f -= push;\n v = e.from;\n }\n flow += push;\n cost += push * d[fin];\n }\n return found;\n }\n\n pair max_flow_min_cost() {\n while (expath()) {\n }\n return make_pair(flow, cost);\n }\n};\nmain(){\n ios_base::sync_with_stdio(0);\n cin.tie(0);\n //freopen(\"input.txt\", \"r\", stdin);\n int n, m, k, c, d;\n cin >> n >> m >> k >> c >> d;\n int t = k * (n - 1);\n mcmf < int, int > g(t * n + 2, t * n, t * n + 1);\n for (int i = 0; i < t; i++){\n g.add(i * n, t * n + 1, 100, 0, c * i);\n for (int j = 0; j < n; j++){\n if (i + 1 < t)\n g.add(i * n + j, (i + 1) * n + j, 100, 0, 0);\n }\n }\n for (int i = 1; i <= k; i++){\n int x;\n cin >> x;\n g.add(t * n, x - 1, 1, 0, 0);\n }\n for (int i = 1; i <= m; i++){\n int u, v;\n cin >> u >> v;\n u--;\n v--;\n for (int j = 0; j < t - 1; j++){\n int v1 = j * n + u;\n int v2 = (j + 1) * n + v;\n for (int q = 0; q < k; q++){\n if (q == 0) g.add(v1, v2, 1, 0, d);\n else if (q == 1) g.add(v1, v2, 1, 0, 4 * d);\n else g.add(v1, v2, 1, 0, d * (2 * q + 1));\n }\n v1 = j * n + v;\n v2 = (j + 1) * n + u;\n for (int q = 0; q < k; q++){\n if (q == 0) g.add(v1, v2, 1, 0, d);\n else if (q == 1) g.add(v1, v2, 1, 0, 4 * d);\n else g.add(v1, v2, 1, 0, d * (2 * q + 1));\n }\n }\n }\n cout << (g.max_flow_min_cost()).S;\n}\n", "lang": "GNU C++14", "bug_code_uid": "346e64b10c342d80b93bc1c51acb54f2", "src_uid": "2d0aa75f2e63c4fb8c98742ac8cd821c", "apr_id": "b7dcd0967cf0b73d24497d2c94ebb7a9", "difficulty": 2500, "tags": ["graphs", "flows"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9991220368744512, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\ntypedef long long LL;\n\nconst int N = 1e3+9;\n\nint a[N];\nint main() {\n int i, j, n, q, L, R, x;\n while(scanf(\"%d\", &n)) {\n scanf(\"%d\", &x);\n for(i=0; i\nusing namespace std;\ntypedef long long ll;\ntypedef long double ld;\nconst int inf = 0x3f3f3f3f;\nconst int maxn = 50 + 5;\nconst int moder = 1e9 + 7;\nint n, d[maxn];\nll f[maxn][maxn][maxn][maxn][maxn];\nint main()\n{\n while(scanf(\"%d\", &n) != EOF)\n {\n for (int i = 0; i < n; i++) scanf(\"%d\", d + i);\n memset(f, 0, sizeof(f));\n f[1][d[0] == 2][d[0] == 3][d[1] == 2][d[1] == 3] = 1;\n for (int i = 2; i < n; i++)\n {\n for (int p1 = 0; p1 <= n; p1++)\n {\n for (int p2 = 0; p2 + p1 <= n; p2++)\n {\n for (int c1 = 0; c1 + p1 + p2 <= n; c1++)\n {\n for (int c2 = 0; c2 + p1 + p2 + c1 <= n; c2++)\n {\n if (d[i] == 2)\n {\n /*//up 2\n f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1 + 2][p2][c1][c2] * (p1 + 2) * (p1 + 1) / 2 ) % moder;\n if (p1 >= 2) f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1 - 2][p2 + 2][c1][c2] * (p2 + 1) * (p2 + 2) / 2) % moder;\n f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1][p2 + 1][c1][c2] * (p2 + 1) * p1) % moder;\n */\n // up 1 cur 1\n f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1 + 1][p2][c1 + 1][c2] * (p1 + 1) * (c1 + 1)) % moder;\n if (c1) f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1 + 1][p2][c1 - 1][c2 + 1] * (p1 + 1) * (c2 + 1)) % moder;\n if (p1) f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1 - 1][p2 + 1][c1 + 1][c2] * (p2 + 1) * (c1 + 1)) % moder;\n if (p1 && c1) f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1 - 1][p2 + 1][c1 - 1][c2 + 1] * (p2 + 1) * (c2 + 1)) % moder;\n //up 1 left 1\n if (c1) f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1 + 1][p2][c1 - 1][c2] * (p1 + 1)) % moder;\n if (c1 && p1) f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1 - 1][p2 + 1][c1 - 1][c2] * (p2 + 1)) % moder;\n }\n else if (d[i] == 3)\n {\n /*//up 3\n f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1 + 3][p2][c1][c2] * (p1 + 3) * (p1 + 2) * (p1 + 1) / 6) % moder;\n if (p1 >= 3) f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1 - 3][p2 + 3][c1][c2] * (p2 + 3) * (p2 + 2) * (p2 + 1) / 6) % moder;\n f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1 + 1][p2 + 1][c1][c2] * (p2 + 1) * p2 / 2 * (p1 + 1)) % moder;\n if (p1) f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1 - 1][p2 + 2][c1][c2] * (p2 + 2) * (p2 + 1) / 2 * (p1 - 1)) % moder;\n */\n //up 1 cur 2\n f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1 + 1][p2][c1 + 2][c2] * (p1 + 1) * (c1 + 2) * (c1 + 1) / 2) % moder;\n if (c1 >= 2) f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1 + 1][p2][c1 - 2][c2 + 2] * (p1 + 1) * (c2 + 2) * (c2 + 1) / 2) % moder;\n f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1 + 1][p2][c1][c2 + 1] * (p1 + 1) * (c2 + 1) * c1) % moder;\n if (p1)\n {\n f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1 - 1][p2 + 1][c1 + 2][c2] * (p2 + 1) * (c1 + 2) * (c1 + 1) / 2) % moder;\n if (c1 >= 2) f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1 - 1][p2 + 1][c1 - 2][c2 + 2] * (p2 + 1) * (c2 + 2) * (c2 + 1) / 2) % moder;\n f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1 - 1][p2 + 1][c1][c2 + 1] * (p2 + 1) * (c2 + 1) * c1) % moder;\n }\n /*//up 2 cur 1\n f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1 + 2][p2][c1 + 1][c2] * (c1 + 1) * (p1 + 2) * (p1 + 1) / 2) % moder;\n if (p1 >= 2) f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1 - 2][p2 + 2][c1 + 1][c2] * (c1 + 1) * (p2 + 2) * (p2 + 1) / 2) % moder;\n f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1][p2 + 1][c1 + 1][c2] * (c1 + 1) * (p2 + 1) * p1) % moder;\n if (c1)\n {\n f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1 + 2][p2][c1 - 1][c2 + 1] * (c2 + 1) * (p1 + 2) * (p1 + 1) / 2) % moder;\n if (p1 >= 2) f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1 - 2][p2 + 2][c1 - 1][c2 + 1] * (c2 + 1) * (p2 + 2) * (p2 + 1) / 2) % moder;\n f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1][p2 + 1][c1 - 1][c2 + 1] * (c2 + 1) * (p2 + 1) * p1) % moder;\n }\n // up 2 left 1\n if (c1)\n {\n f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1 + 2][p2][c1 - 1][c2] * (p1 + 2) * (p1 + 1) / 2) % moder;\n if (p1 >= 2) f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1 - 2][p2 + 2][c1 - 1][c2] * (p2 + 1) * (p2 + 2) / 2) % moder;\n f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1][p2 + 1][c1 - 1][c2] * (p2 + 1) * p1) % moder;\n }\n */\n // up 1 cur 1 left 1\n f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1 + 1][p2][c1][c2] * (p1 + 1) * (c1)) % moder;\n if (c1 >= 2) f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1 + 1][p2][c1 - 2][c2 + 1] * (p1 + 1) * (c2 + 1)) % moder;\n if (p1) f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1 - 1][p2 + 1][c1][c2] * (p2 + 1) * (c1)) % moder;\n if (p1 && c1 >= 2) f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1 - 1][p2 + 1][c1 - 2][c2 + 1] * (p2 + 1) * (c2 + 1)) % moder;\n // up1 left 2\n if (c2) f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1 + 1][p2][c1][c2 - 1] * (p1 + 1)) % moder;\n if (c2 && p1) f[i][p1][p2][c1][c2] = (f[i][p1][p2][c1][c2] + f[i - 1][p1 - 1][p2 + 1][c1][c2 - 1] * (p2 + 1)) % moder;\n }\n if (p1 == 0 && p2 == 0 && (c1 + c2))\n {\n f[i][c1][c2][0][0] = (f[i][c1][c2][0][0] + f[i][0][0][c1][c2]) % moder;\n }\n }\n }\n }\n }\n }\n /*\n for (int i = 2; i < n; i++)\n {\n for (int p1 = 0; p1 <= n; p1++)\n {\n for (int p2 = 0; p2 + p1 <= n; p2++)\n {\n for (int c1 = 0; c1 + p1 + p2 <= n; c1++)\n {\n for (int c2 = 0; c2 + p1 + p2 + c1 <= n; c2++)\n {\n if (f[i][p1][p2][c1][c2])\n {\n cout << i <<\" \"<< p1 <<\" \"<< p2 <<\" \"<< c1 <<\" \"<< c2 << \" \"<< f[i][p1][p2][c1][c2] << endl;\n }\n }\n }\n }\n }\n }\n */\n printf(\"%Ld\\n\", f[n - 1][0][0][0][0]);\n }\n}\n", "lang": "GNU C++14", "bug_code_uid": "184f0abc1b9c5d4684fecd9e89d3134d", "src_uid": "db884d679d9cfb1dc4bc511f83beedda", "apr_id": "d3d0ccbe494e466a00303d15a76c58c7", "difficulty": 2600, "tags": ["graphs", "dp", "combinatorics", "shortest paths"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7183748845798708, "equal_cnt": 13, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 12, "bug_source_code": "//scnucjh\n#include \nusing namespace std;\n\nconst int maxn = 100005;\nint phi[maxn];\n\nint main() {\n#ifndef ONLINE_JUDGE\n freopen(\"data.txt\", \"r\", stdin);\n#endif\n int n,k;\n cin>>n>>k;\n if(k==3) { cout<<3<\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\n#define maxn 200010\nint N;\nstring a = \"\";\nchar isshow[256];\nbool is[1000000010];\nvoid tostr(int i)\n{\n if (i >= 0 && i < 10)\n {\n a = i + '0';\n return;\n }\n tostr(i / 10);\n a += (i % 10 + '0');\n}\nint main()\n{\n cin >> N;\n tostr(N);\n string Nt = a;\n for (int i = 0; i < Nt.length(); i++)\n isshow[Nt[i]] = true;\n string t = \"\";\n int ans = 1;\n if (N == 1)\n cout << 1 << endl;\n else\n {\n if (isshow['1'])\n ans++;\n for (int i = 2; i <= sqrt(N*1.0); i++)\n {\n for (int j = i; j <= N / 2; j += i)\n {\n if (N%j == 0&&!is[j])\n {\n is[j] = true;\n a = \"\";\n tostr(j);\n int len = a.length();\n for (int k = 0; k < len; k++)\n {\n if (isshow[a[k]])\n {\n ans++;\n break;\n }\n }\n }\n }\n }\n cout << ans << endl;\n }\n return 0;\n}\n\n", "lang": "GNU C++", "bug_code_uid": "e7b16f8052df3a2e2f8e7e9d27919bbc", "src_uid": "ada94770281765f54ab264b4a1ef766e", "apr_id": "29b3c1d08693f077a2b9d32130ac6c0a", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.49635036496350365, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "#include\n#define ll long long\n#define endl \"\\n\"\nusing namespace std;\n\t\t \nint main() {\n\tll a[4],b[4],c[4];\n\tfor(int i=0;i<3;i++){cin >> a[i];}\n\tfor(int i=0;i<3;i++){cin >> b[i];}\n\tfor(int i=0;i<3;i++){cin >> c[i];}\n\tint f=0;\n\tll x= a[1] +a[2];\n\tll y=b[0]+ b[2];\n\tll z = c[0]+c[1];\n\tll s=1,i,j,k;\n\tif(x==y && x==z){i=a[1];j=b[0];k=c[0];}\n\telse{\n\tll m=max(max(x,y),z);\n\t\n\twhile(f==0){\n\t\tll t= 2*s+3;\n\t\tif(t==m && (3*s+3==m+s)){\n\t\t//\tcout << 3*s+3 << \" \" << m+s << \"hi\";\n\t\tf=1;}\n\t\telse s++;\n\t}\n\tif(x>y && x>z){i=s; j=s+1; k=s+2;}\n\tif(z>x && z>y){k=s; j=s+1; i=s+2;} }\n\tcout << i << \" \" << a[1] << \" \" << a[2] << endl;\n\tcout << b[0] << \" \" << j << \" \" << b[2] << endl;\n\tcout << c[0] << \" \" << c[1] << \" \" << k << endl;\n}\n", "lang": "GNU C++11", "bug_code_uid": "c752a709c8a80d9cbe5bd8c53bb6ef84", "src_uid": "0c42eafb73d1e30f168958a06a0f9bca", "apr_id": "10c212cd231505b72bc2f2e02858c1b3", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.20600858369098712, "equal_cnt": 28, "replace_cnt": 14, "delete_cnt": 12, "insert_cnt": 2, "fix_ops_cnt": 28, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n long long n,count0=0;\n cin>>n;\n long long v[n+1],a[n+1],k=1;\n for(long long i=1;i<=n;i++)\n {\n cin>>v[i];\n if(v[i]==0)count0++;\n else a[k]=v[i],k++;\n }\n sort(a+1,a+n+1);\n long long count=0,maxi;\n long long i=k;\n while(i>2){\n maxi=1;\n for(long long j=i-1;j>=1;j--)\n {\n maxi=max(maxi,(j-a[j]+1));\n }\n count++;\n i=maxi;\n }\n cout<\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std ;\nconst long long MAXN = 1e17 + 5 ;\nlong long vis[1000005] ;\nint cnt ;\nvoid print()\n{\n cnt = 0 ;\n long long i ;\n for(i = 3 ; i <= MAXN ; i ++)\n {\n vis[cnt] = i ;\n if(cnt == 34)\n break ;\n cnt ++ ;\n i *= 3 ;\n }\n}\nint main()\n{\n // print() ;\n long long n ;\n while (cin >> n)\n {\n if(n % 3 != 0)\n {\n cout << n / 3 + 1 << endl ;\n }\n else\n {\n int j ;\n int pan = 0 ;\n for(j = 0 ; j <= cnt ; j ++)\n {\n if(vis[j] == n)\n {\n printf(\"1\\n\") ;\n pan = 1 ;\n break ;\n }\n }\n if(pan == 0)\n {\n for(j = 0 ; j <= cnt ; j ++)\n {\n if(n % vis[j] != 0)\n {\n cout << n / vis[j] + 1 << endl ;\n break ;\n }\n }\n }\n }\n }\n return 0 ;\n}\n\n", "lang": "GNU C++", "bug_code_uid": "4643dc81079c335b02379e68b93a5830", "src_uid": "7e7b59f2112fd200ee03255c0c230ebd", "apr_id": "1c0a91c67d058f9d1f9c6bc870d16a2b", "difficulty": 1600, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.896875, "equal_cnt": 28, "replace_cnt": 19, "delete_cnt": 0, "insert_cnt": 8, "fix_ops_cnt": 27, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\ntypedef long long LL;\ntypedef vector VI;\n\n#define REP(i,n) for (LL i=0; ia && xb) return 1;\n\treturn 0;\n}\nbool Is(figur a1, figur b1, figur tmp, figur k1)\n{\n\tbool f=0;\n\tif ( (a1.x==tmp.x && !isin(a1.x,tmp.x,k1.x) ) || ( a1.y==tmp.y && !isin(a1.y,tmp.y,k1.y) ) ) f=1;\n\tif ( (b1.x==tmp.x && !isin(b1.x,tmp.x,k1.x) ) || ( b1.y==tmp.y && !isin(b1.y,tmp.y,k1.y ) ) ) f=1;\n\t/*if (k1.x==tmp.x-1 && k1.y==tmp.y+1) f=1;\n\tif (k1.x==tmp.x-1 && k1.y==tmp.y) f=1;\n\tif (k1.x==tmp.x-1 && k1.y==tmp.y-1) f=1;\n\tif (k1.x==tmp.x && k1.y==tmp.y-1) f=1;\n\n\tif (k1.x==tmp.x+1 && k1.y==tmp.y-1) f=1;\n\tif (k1.x==tmp.x+1 && k1.y==tmp.y) f=1;\n\tif (k1.x==tmp.x+1 && k1.y==tmp.y+1) f=1;\n\tif (k1.x==tmp.x && k1.y==tmp.y+1) f=1;*/\n\tif (sqrt(double( (tmp.x-k1.x)*(tmp.x-k1.x)+(tmp.y-k1.y)*(tmp.y-k1.y)) ) < sqrt(2.1) ) f=1;\n\t\n\n\treturn f;\n}\nint main()\n{\n\tfigur a1,b1,k1,k2;\n\tchar arr[15];\n\t//scanf(\"%s\",&arr);\n\tgets(arr);\n\ta1.x=arr[0]-'a'+1;\n\ta1.y=arr[1]-'1'+1;\n\tb1.x=arr[3]-'a'+1;\n\tb1.y=arr[4]-'1'+1;\n\tk1.x=arr[6]-'a'+1;\n\tk1.y=arr[7]-'1'+1;\n\tk2.x=arr[9]-'a'+1;\n\tk2.y=arr[10]-'1'+1;\n\tbool fl=false;\n\tif (a1.x==k2.x || a1.y==k2.y) fl=1;\n\tif (b1.x==k2.x || b1.y==k2.y) fl=1;\n\tif ( (a1.x==k2.x && !isin(a1.x,k2.x,k1.x) ) || ( a1.y==k2.y && !isin(a1.y,k2.y,k1.y) ) ) f=1;\n\tif ( (b1.x==k2.x && !isin(b1.x,k2.x,k1.x) ) || ( b1.y==k2.y && !isin(b1.y,k2.y,k1.y ) ) ) f=1;\n\tif (!fl) {printf(\"OTHER\"); return 0;}\n\tif(k2.x!=1 && k2.y!=1)\n\t{\n\t\tfigur tmp;\n\t\tfigur lade;\n\t\tbool f=false;\n\t\ttmp.x=k2.x-1;\n\t\ttmp.y=k2.y-1;\n\t\tif (tmp.x==a1.x && tmp.y== a1.y) {lade=a1; a1.x=10; a1.y=10;}\n\t\tif (tmp.x==b1.x && tmp.y== b1.y) {lade=b1; b1.x=10; b1.y=10;}\n\t\tf=Is(a1,b1,tmp,k1);\n\t\tif (!f) {printf(\"OTHER\"); return 0;}\n\t\tif (a1.x==10) a1=lade;\n\t\tif (b1.x==10) b1=lade;\n\t}\n\tif(k2.x!=1)\n\t{\n\t\tfigur tmp;figur lade;\n\t\tbool f=false;\n\t\ttmp.x=k2.x-1;\n\t\ttmp.y=k2.y;\n\t\tif (tmp.x==a1.x && tmp.y== a1.y) {lade=a1; a1.x=10; a1.y=10;}\n\t\tif (tmp.x==b1.x && tmp.y== b1.y) {lade=b1; b1.x=10; b1.y=10;}\n\t\tf=Is(a1,b1,tmp,k1);\n\t\tif (!f) {printf(\"OTHER\"); return 0;}\n\t\tif (a1.x==10) a1=lade;\n\t\tif (b1.x==10) b1=lade;\n\t}\n\tif(k2.x!=1 && k2.y!=8)\n\t{\n\t\tfigur tmp;figur lade;\n\t\tbool f=false;\n\t\ttmp.x=k2.x-1;\n\t\ttmp.y=k2.y+1;\n\t\tif (tmp.x==a1.x && tmp.y== a1.y) {lade=a1; a1.x=10; a1.y=10;}\n\t\tif (tmp.x==b1.x && tmp.y== b1.y) {lade=b1; b1.x=10; b1.y=10;}\n\t\tf=Is(a1,b1,tmp,k1);\n\t\tif (!f) {printf(\"OTHER\"); return 0;}\n\t\tif (a1.x==10) a1=lade;\n\t\tif (b1.x==10) b1=lade;\n\t}\n\tif(k2.y!=8)\n\t{\n\t\tfigur tmp;figur lade;\n\t\tbool f=false;\n\t\ttmp.x=k2.x;\n\t\ttmp.y=k2.y+1;\n\t\tif (tmp.x==a1.x && tmp.y== a1.y) {lade=a1; a1.x=10; a1.y=10;}\n\t\tif (tmp.x==b1.x && tmp.y== b1.y) {lade=b1; b1.x=10; b1.y=10;}\n\t\tf=Is(a1,b1,tmp,k1);\n\t\tif (!f) {printf(\"OTHER\"); return 0;}\n\t\tif (a1.x==10) a1=lade;\n\t\tif (b1.x==10) b1=lade;\n\t}\n\tif(k2.x!=8 && k2.y!=8)\n\t{\n\t\tfigur tmp;figur lade;\n\t\tbool f=false;\n\t\ttmp.x=k2.x+1;\n\t\ttmp.y=k2.y+1;\n\t\tif (tmp.x==a1.x && tmp.y== a1.y) {lade=a1; a1.x=10; a1.y=10;}\n\t\tif (tmp.x==b1.x && tmp.y== b1.y) {lade=b1; b1.x=10; b1.y=10;}\n\t\tf=Is(a1,b1,tmp,k1);\n\t\tif (!f) {printf(\"OTHER\"); return 0;}\n\t\tif (a1.x==10) a1=lade;\n\t\tif (b1.x==10) b1=lade;\n\t}\n\tif(k2.x!=8)\n\t{\n\t\tfigur tmp;figur lade;\n\t\tbool f=false;\n\t\ttmp.x=k2.x+1;\n\t\ttmp.y=k2.y;\n\t\tif (tmp.x==a1.x && tmp.y== a1.y) {lade=a1; a1.x=10; a1.y=10;}\n\t\tif (tmp.x==b1.x && tmp.y== b1.y) {lade=b1; b1.x=10; b1.y=10;}\n\t\tf=Is(a1,b1,tmp,k1);\n\t\t/*printf(\"%d %d\\n\",tmp.x,tmp.y);\n\t\tprintf(\"%d %d\\n\",a1.x,a1.y);\n\t\tprintf(\"%d %d\\n\",b1.x,b1.y);*/\n\t\tif (!f) {printf(\"OTHER\"); return 0;}\n\t\tif (a1.x==10) a1=lade;\n\t\tif (b1.x==10) b1=lade;\n\t}\n\tif(k2.x!=8 && k2.y!=1)\n\t{\n\t\tfigur tmp;figur lade;\n\t\tbool f=false;\n\t\ttmp.x=k2.x+1;\n\t\ttmp.y=k2.y-1;\n\t\tif (tmp.x==a1.x && tmp.y== a1.y) {lade=a1; a1.x=10; a1.y=10;}\n\t\tif (tmp.x==b1.x && tmp.y== b1.y) {lade=b1; b1.x=10; b1.y=10;}\n\t\tf=Is(a1,b1,tmp,k1);\n\t\tif (!f) {printf(\"OTHER\"); return 0;}\n\t\tif (a1.x==10) a1=lade;\n\t\tif (b1.x==10) b1=lade;\n\t}\n\tif(k2.y!=1)\n\t{\n\t\tfigur tmp;figur lade;\n\t\tbool f=false;\n\t\ttmp.x=k2.x;\n\t\ttmp.y=k2.y-1;\n\t\tif (tmp.x==a1.x && tmp.y== a1.y) {lade=a1; a1.x=10; a1.y=10;}\n\t\tif (tmp.x==b1.x && tmp.y== b1.y) {lade=b1; b1.x=10; b1.y=10;}\n\t\tf=Is(a1,b1,tmp,k1);\n\t\tif (!f) {printf(\"OTHER\"); return 0;}\n\t\tif (a1.x==10) a1=lade;\n\t\tif (b1.x==10) b1=lade;\n\t}\n\tprintf(\"CHECKMATE\");\n\n\t//printf(\"%d\",b1.y);\n\t//cin.get();cin.get();\n\n}\n", "lang": "MS C++", "bug_code_uid": "62fbe3054ae231e09d95f751aebbdff6", "src_uid": "5d05af36c7ccb0cd26a4ab45966b28a3", "apr_id": "77080eb67cc749ea55c641508e8b99a2", "difficulty": 1700, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.05810684161199625, "equal_cnt": 18, "replace_cnt": 13, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 18, "bug_source_code": "#include\n#define ll long long\n#define sec second\n#define fir first\nusing namespace std;\nint main(){\n\tll x,fr=1,c4=0,c7=0,fr4=0;\n\tstring s;\n\tcin>>s;\n\tfor(ll i=0;i'7')fr=0,fr4=1;\n\t\t}\n\t}\n\t\n\t\tfor(ll i=0;i\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)\n#define sz(v) (int)(v).size()\n#define all(v) (v).begin(), (v).end()\n\nconst int MOD = 1000000009;\n\nvector s;\nset pr;\nvector P;\nvector > nxt;\nvector > fs;\nint dp[1001][1001][101]; //length, cover, prefix\n\nchar get(char c) {\n\tswitch (c) {\n\t\tcase 'A': return '0';\n\t\tcase 'C': return '1';\n\t\tcase 'G': return '2';\n\t\tcase 'T': return '3';\n\t\tdefault: return 0;\n\t}\n}\n\nbool endsWith(string s, string t) {\n\tif (sz(s) < sz(t)) return false;\n\tfor (int i = sz(s) - sz(t), j = 0; i < sz(s); i++, j++) {\n\t\tif (s[i] != t[j]) return false;\n\t}\n\treturn true;\n}\n\nvoid add(int &a, int b) {\n\ta += b;\n\tif (a > MOD) a -= MOD;\n}\n\nint main() {\n#ifdef LOCAL\n\tfreopen(\"input.txt\", \"r\", stdin);\n\tfreopen(\"output.txt\", \"w\", stdout);\n#endif\n\tint n, m;\n\tcin >> n >> m;\n\ts.resize(m);\n\tREP(i, m) {\n\t\tcin >> s[i];\n\t\tREP(j, sz(s[i])) s[i][j] = get(s[i][j]);\n\t}\n\tpr.insert(\"\");\n\tREP(i, sz(s)) {\n\t\tstring t;\n\t\tREP(j, sz(s[i])) {\n\t\t\tt += s[i][j];\n\t\t\tpr.insert(t);\n\t\t}\n\t}\n\tP = vector (all(pr));\n\tnxt.resize(sz(P));\n\tfs.resize(sz(P));\n\tREP(i, sz(P)) {\n\t\tstring str = P[i];\n\t\tfor (char c = '0'; c <= '3'; c++) {\n\t\t\tstring t = str + c;\n\t\t\tint id = -1;\n\t\t\tREP(j, sz(P)) {\n\t\t\t\tif (endsWith(t, P[j]) && (id == -1 || sz(P[j]) > sz(P[id]))) {\n\t\t\t\t\tid = j;\n\t\t\t\t}\n\t\t\t}\n\t\t\tnxt[i].push_back(id);\n\t\t\tid = -1;\n\t\t\tREP(j, sz(s)) {\n\t\t\t\tif (endsWith(t, s[j]) && (id == -1 || sz(s[j]) > sz(s[id]))) {\n\t\t\t\t\tid = j;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfs[i].push_back(id);\n\t\t}\n\t}\n\tmemset(dp, 0, sizeof(dp));\n\tdp[0][0][0] = 1;\n\tfor (int i = 0; i < n; i++) {\n\t\tfor (int j = 0; j <= i; j++) {\n\t\t\tfor (int k = 0; k < sz(P); k++) {\n\t\t\t\tif (sz(P[k]) <= i) {\n\t\t\t\t\tREP(c, 4) {\n\t\t\t\t\t\tint x = fs[k][c];\n\t\t\t\t\t\tif (x != -1 && i - sz(s[x]) + 1 <= j) {\n\t\t\t\t\t\t\tadd(dp[i + 1][i + 1][nxt[k][c]], dp[i][j][k]);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tadd(dp[i + 1][j][nxt[k][c]], dp[i][j][k]);\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\tint res = 0;\n\tREP(i, sz(P)) add(res, dp[n][n][i]);\n\tprintf(\"%d\\n\", res);\n\treturn 0;\n}", "lang": "GNU C++", "bug_code_uid": "4a7ba7f2ae535feebcbde7213bde6ec4", "src_uid": "3f053c07deaac55c2c51df6147080340", "apr_id": "2a8df389bfd33e83b6c0fea403c6129f", "difficulty": 2500, "tags": ["trees", "dp", "string suffix structures"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9928955866523144, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "/*\n ID: nigo1\n LANG: C++\n TASK: B\n*/\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#define pf printf\n#define sf scanf\n#define TIME pf(\"%f\", (double)clock()/CLOCKS_PER_SEC);\n\nusing namespace std;\n\nint N, DD, MM, YY;\nint pos, b[3], a[3], used[3];\n\nbool is_date (int BD, int BM, int BY) {\n if (BM > 12) return 0;\n if (BY > YY) return 0;\n\n int max_days = 0;\n switch (BM) {\n case 1 : max_days = 31;\n break;\n case 2 : max_days = BY%4 ? 28 : 29;\n break;\n case 3 : max_days = 31;\n break;\n case 4 : max_days = 30;\n break;\n case 5 : max_days = 31;\n break;\n case 6 : max_days = 30;\n break;\n case 7 : max_days = 31;\n break;\n case 8 : max_days = 31;\n break;\n case 9 : max_days = 30;\n break;\n case 10 : max_days = 31;\n break;\n case 11 : max_days = 30;\n break;\n case 12 : max_days = 31;\n break;\n }\n if (BD > max_days) return 0;\n\n return 1;\n}\n\nbool check (int BD, int BM, int BY) {\n if (YY - BY < 18) return 0;\n if (YY - BY > 18) return 1;\n\n if (MM > BM) return 1;\n if (MM < BM) return 0;\n\n if (DD >= BD) return 1;\n\n return 0;\n}\n\nint permute () {\n for (int i = 0; i < 3; i++)\n for (int j = 0; j < 3; j++)\n for (int k = 0; k < 3; k++)\n if (i != j and i != k and j != k) {\n int D = b[i], M = b[j], Y = b[k];\n if (is_date (D, M, Y)) {\n if (YY % 4 and M == 2 and D == 29) M = 3, D = 1;\n if (check (D, M, Y)) {\n //cout << D << \" \" << M << \" \" << Y << endl;\n return 1;\n }\n }\n return 0;\n}\nint main()\n{\n\t//freopen (\"B.in\", \"r\", stdin);\n\t//freopen (\"B.out\", \"w\", stdout);\n\n sf (\"%d.%d.%d\\n\", &DD, &MM, &YY);\n //cout << DD << \" \" << MM << \" \" << YY << endl;\n sf (\"%d.%d.%d\\n\", &b[0], &b[1], &b[2]);\n\n if (permute ()) pf (\"YES\\n\");\n else pf (\"NO\\n\");\n}\n", "lang": "GNU C++", "bug_code_uid": "525bc51cdbc5223f7fc5677de2a74ff3", "src_uid": "5418c98fe362909f7b28f95225837d33", "apr_id": "a59f320d6720ed06d7ea33cbc535ddfb", "difficulty": 1700, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9320388349514563, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \n\nusing namespace std;\n\nint main()\n{\n int k=0 , n=0 , w=1 , sol=0;\n cin>>k>>n>>w;\n\n w=w*(w+1)/2;\n sol=w*k-n;\n if(sol>=0)\n {\n cout< \n \nusing namespace std; \n \nint main(){ \n\tlong long a, b, c, d, e, i;\n\tcin >> a;\n\tfor (i=a; i <= 10000; i++ ){\n\t b = i % 10;\n\t c =(( i%100) -( i%10))/10;\n\t d = (i/100) %10;\n\t e = i/1000;\n\t if ( e != d && e != c && e != b && d != c && d != b && c != b){\n\t cout << i;\n\t return 0;\n\t }\n\t}\n}\n", "lang": "GNU C++11", "bug_code_uid": "2e0120ac66ab6d2aef5b369a2ba02117", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "apr_id": "25529db5a988e0f84ea998c495269fe4", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.5259259259259259, "equal_cnt": 9, "replace_cnt": 2, "delete_cnt": 5, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "#include \n\nusing namespace std;\n\nint main()\n{\n int n,k,t=0;\n cin >> n >> k;\n while (1)\n {\n if (t==n)break;\n if (k%5==0 && ((k/5)+t)==n)break;\n if (k%4==0 && ((k/4)+t)==n)break;\n if (k%3==0 && ((k/3)+t)==n)break;\n else\n {\n k-=2;\n t++;\n }\n }\n cout << t ;\n return 0;\n}\n//Okasha\n", "lang": "GNU C++", "bug_code_uid": "10575c086d7fb14ba9d7918ff2fef828", "src_uid": "5a5e46042c3f18529a03cb5c868df7e8", "apr_id": "c2b938a91b197d2cbf06381a82272d16", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.8992974238875878, "equal_cnt": 13, "replace_cnt": 8, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "#include\nint n,m,f[151][51][51][51],v[151][3],z,p=51123987,u;\nchar s[160];\nvoid inc(int &x,int y)\n{\n\tx=(x+y)%p;\n}\nint K(int x,int y)\n{\n\treturn x-y<2&&y-x<2;\n}\nint main()\n{\n\tscanf(\"%d%s\",n,s+1);\n\tfor(int i=n;i;i--)\n\t{\n\t\tv[i][0]=v[i-1][0];\n\t\tv[i][1]=v[i-1][1];\n\t\tv[i][2]=v[i-1][2];\n\t\tv[i][s[i]-'a']=i;\n\t}\n\tfor(int i=1;i<=n;i++)\n\t\tfor(int j=0;j<=m;j++)\n\t\t\tfor(int k=0;k<=m;k++)\n\t\t\t\tfor(int l=0;l<=m;l++)\n\t\t\t\t\tif(u=f[i][j][k][l])\n\t\t\t\t\t{\n\t\t\t\t\t\tif(j+k+l==n&&K(j,k)&&K(k,l)&&K(l,j))\n\t\t\t\t\t\t\tinc(z,u);\n\t\t\t\t\t\tinc(f[v[i][0]][j+1][k][l],u);\n\t\t\t\t\t\tinc(f[v[i][1]][j][k+1][l],u);\n\t\t\t\t\t\tinc(f[v[i][2]][j][k][l+1],u);\n\t\t\t\t\t}\n\tprintf(\"%d\",z);\n}", "lang": "GNU C++0x", "bug_code_uid": "4ee10be7aaf57375721219fd41b4442c", "src_uid": "64fada10630906e052ff05f2afbf337e", "apr_id": "0278c77faa6e178e3ed3e1338221226f", "difficulty": 2500, "tags": ["dp"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.23305785123966943, "equal_cnt": 14, "replace_cnt": 1, "delete_cnt": 6, "insert_cnt": 6, "fix_ops_cnt": 13, "bug_source_code": "#include\n#define ll long long\nusing namespace std;\nll ans;\nint h1,h2,w1,w2;\nint a[9000][9000];\nint dx[4]={1,1,-1,-1};\nint dy[4]={1,-1,1,-1};\nint xx=0,yy=0;\nint main(){\n\tmemset(a,0,sizeof(a));\n\tscanf(\"%d%d%d%d\",&w1,&h1,&w2,&h2);\n\tw1++;\n\tw2++;\n\th1++;\n//\th2++;\n\tfor(int i=1;i<=h1;i++){\n\t\tfor(int j=1;j<=w1;j++){\n\t\t\ta[i][j]=5;\n//\t\t\tprintf(\"%d %d\\n\",i,j); \n\t\t}\n\t}\n\tfor(int i=h1;i<=h2+h1;i++){\n\t\tfor(int j=1;j<=w2;j++){\n\t\t\ta[i][j]=5;\n//\t\t\tprintf(\"%d %d\\n\",i,j); \n\t\t}\n\t}\n\tfor(int i=1;i<=h1;i++){\n\t\tfor(int j=1;j<=w1;j++){\n\t\t\tfor(int k=0;k<4;k++){\n\t\t\t\tint x=dx[k]+i;\n\t\t\t\tint y=dy[k]+j;\n\t\t\t\tif(a[x][y]==5)continue;\n\t\t\t\ta[x][y]=1;\n\t\t\t\txx=max(xx,x);\n\t\t\t\tyy=max(yy,y);\n\t\t\t}\n\t\t}\n\t}\n\tfor(int i=h1;i<=h1+h2;i++){\n\t\tfor(int j=1;j<=w2;j++){\n\t\t\tfor(int k=0;k<4;k++){\n\t\t\t\tint x=dx[k]+i;\n\t\t\t\tint y=dy[k]+j;\n\t\t\t\tif(a[x][y]==5)continue;\n\t\t\t\ta[x][y]=1;\n\t\t\t\txx=max(xx,x);\n\t\t\t\tyy=max(yy,y);\n\t\t\t}\n\t\t}\n\t}\n\tfor(int i=0;i<=xx;i++){\n\t\tfor(int j=0;j<=yy;j++){\n\t\t\tif(a[i][j]==1){\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\t}\nprintf(\"%lld\\n\",ans-4);\n\n\treturn 0;\n}\n\n", "lang": "GNU C++17", "bug_code_uid": "73a5a70fa4db2fd099040ca13bcc5f6d", "src_uid": "b5d44e0041053c996938aadd1b3865f6", "apr_id": "43d19be931ac7bd30bce3573d493ae91", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.8239964711071901, "equal_cnt": 14, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 14, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n\nusing namespace std;\ntypedef unsigned long long ull;\ntypedef long long ll;\ntypedef vector vec;\ntypedef pair ii;\ntypedef vector vecii;\ntypedef vector::iterator it;\nconst ll oo = 1e9;\nconst ll EPS = 1e-9;\nconst ll mod = 1e9 + 7;\nconst ll mod2 = (mod-1);\n\n\nint Do(int m){\n\twhile(m > 9){\n\t\tint total = 0;\n\t\twhile(m != 0){\n\t\t\ttotal += m%10;\n\t\t\tm/=10;\n\t\t}\n\t\tm = total;\n\t}\n\n\treturn m;\n}\nint main(){\n\t//freopen(\"in.txt\",\"r\",stdin);\n\t\n\tint n;\n\tcin>>n;\n\tvec a[10];\n\tfor(int i=1; i<=n; i++){\n\t\ta[Do(i)].push_back(i);\n\t}\n\n\tint total = 0;\n\tfor(int i=1; i<=9; i++)\n\t\tfor(int j=1; j<=9; j++){\n\n\t\t\tint k = Do(i*j);\n\t\t\tfor(int t1 = 0; t1\n#include \n\nint output_year_figure[4];\n\nvoid carry(void);\nbool compare(void);\n\nint main()\n{\n\tint input_year = 0;\n\tint err = scanf(\"%d\", &input_year);\n\t/*\n\tif(err != 1) {\n\t\tprintf(\"Input year error!\\n\");\n\t\tassert(0);\n\t}\n\t*/\n\t/* Input year range: 1000 ~ 9000. */\n\tif(input_year < 1000 || input_year > 9000) {\n\t\tprintf(\"Input year is out of range!\\n\");\n\t\tassert(0);\n\t}\n\n\t/* Get four numbers of the input year. */\n\toutput_year_figure[3] = input_year / 1000;\n\tinput_year -= (1000 * output_year_figure[3]);\n\toutput_year_figure[2] = input_year / 100;\n\tinput_year -= (100 * output_year_figure[2]);\n\toutput_year_figure[1] = input_year / 10;\n\tinput_year -= (10 * output_year_figure[1]);\n\toutput_year_figure[0] = input_year;\n\n\tbool need_to_calc = true;\n\twhile(need_to_calc) {\n\t\tif(output_year_figure[3] == output_year_figure[2]) {\n\t\t\toutput_year_figure[2]++;\n\t\t\tcarry();\n\t\t\tneed_to_calc = !compare();\n\t\t}\n\t\telse if(output_year_figure[3] == output_year_figure[1] \\\n\t\t\t|| output_year_figure[2] == output_year_figure[1]) {\n\t\t\t\toutput_year_figure[1]++;\n\t\t\t\tcarry();\n\t\t\t\tneed_to_calc = !compare();\n\t\t}\n\t\telse {\n\t\t\toutput_year_figure[0]++;\n\t\t\tcarry();\n\t\t\tneed_to_calc = !compare();\n\t\t}\n\t}\n\n\tint output_year = output_year_figure[3] * 1000 + output_year_figure[2] * 100 \\\n\t\t+ output_year_figure[1] * 10 + output_year_figure[0];\n\tprintf(\"%d\\n\", output_year);\n}\n\nvoid carry(void)\n{\n\tif(output_year_figure[0] == 10) {\n\t\toutput_year_figure[0] = 0;\n\t\toutput_year_figure[1]++;\n\t\tif(output_year_figure[1] == 10) {\n\t\t\toutput_year_figure[1] = 0;\n\t\t\toutput_year_figure[2]++;\n\t\t\tif(output_year_figure[2] == 10) {\n\t\t\t\toutput_year_figure[2] = 0;\n\t\t\t\toutput_year_figure[3]++;\n\t\t\t}\n\t\t}\n\t}\n\telse if(output_year_figure[1] == 10) {\n\t\toutput_year_figure[1] = 0;\n\t\toutput_year_figure[2]++;\n\t\tif(output_year_figure[2] == 10) {\n\t\t\toutput_year_figure[2] = 0;\n\t\t\toutput_year_figure[3]++;\n\t\t}\n\t}\n\telse if(output_year_figure[2] == 10) {\n\t\toutput_year_figure[2] = 0;\n\t\toutput_year_figure[3]++;\n\t}\n}\n\nbool compare(void)\n{\n\tif(output_year_figure[3] == output_year_figure[2])\n\t\treturn false;\n\tif(output_year_figure[3] == output_year_figure[1])\n\t\treturn false;\n\tif(output_year_figure[3] == output_year_figure[0])\n\t\treturn false;\n\tif(output_year_figure[2] == output_year_figure[1])\n\t\treturn false;\n\tif(output_year_figure[2] == output_year_figure[0])\n\t\treturn false;\n\tif(output_year_figure[1] == output_year_figure[0])\n\t\treturn false;\n\treturn true;\n}", "lang": "MS C++", "bug_code_uid": "962f9f6963cc4f31affc44e1b60d97a5", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "apr_id": "47c281244d48da0163f7b68fdeb19b66", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9132231404958677, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "#include\n#include\n\nusing namespace std;\n\nstring arr[12]={\"C\", \"C#\" , \"D\" , \"D#\" , \"E\" , \"F\" , \"F#\" , \"G\" , \"G#\", \"A\", \"B\", \"H\"};\n\nint found(string c1 , string c2)\n{\n bool found=false , first=false , second= false;\n int i=0 , count1=0 , count2=0;\n while(!found)\n {\n if(i > 11)\n i=0;\n\n if(arr[i] == c1)\n {\n first=true;\n\n //cout<<\"///////////////////////////////////////////////////////////////////////\"<>c1>>c2>>c3;\n\n int x1 = found(c1 , c2);\n int x2 = found(c2 , c3);\n if(!fun(x1,x2))\n return 0;\n\n\n int x3 = found(c2 , c1);\n int x4 = found(c1 , c3);\n if(!fun(x3,x4))\n return 0;\n\n int x5 = found(c3 , c2);\n int x6 = found(c2 , c1);\n if(!fun(x5,x6))\n return 0;\n\n\n int x7 = found(c3 , c1);\n int x8 = found(c1 , c2);\n if(!fun(x7,x8))\n return 0;\n\n\n int x9 = found(c2 , c3);\n int x10 = found(c3 , c1);\n if(!fun(x9,x10))\n return 0;\n\n int y = found(c1 , c3);\n int x = found(c3 , c2);\n if(!fun(y,x))\n return 0;\n\n\n cout<<\"strange\"<\nusing namespace std;\n\nint main(){\n int n,h,m;\n cin>>n>>h>>m;\n int l,r,x;\n //vector res;\n map mp;\n for(int i=1;i<=n;i++){\n mp[i] = INT_MAX;\n }\n for(int i=0;i>l>>r>>x;\n if(x\n#include \n#include \n#include \n#include \n\nusing namespace std;\n\ntypedef long long ll;\n\nconst int maxn = 80 + 5;\nconst int INF = 1 << 29;\n\nll dp[maxn][maxn][maxn][2];\nint a[maxn], b[maxn], c[maxn];\nchar s[maxn];\n\nvoid upmin(int &a, int b)\n{\n a = min(a, b);\n}\n\nint main()\n{\n int n;\n scanf(\"%d%s\", &n, s + 1);\n int cnt1 = 0, cnt2 = 0, cnt3 = 0;\n for(int i = 1; i <= n; ++i)\n {\n if(s[i] == 'V') a[++cnt1] = i;\n else if(s[i] == 'K') b[++cnt2] = i;\n else c[++cnt3] = i;\n }\n memset(dp, 0x3f, sizeof(dp));\n dp[0][0][0][0] = 0;\n for(int i = 1; i <= n; ++i)\n {\n for(int j = 0; j <= cnt1; ++j)\n {\n for(int k = 0; k <= cnt2; ++k)\n {\n for(int l = 0; l < 2; ++l)\n {\n int m = i - j - k;\n if(i - j - k <= cnt3)\n {\n int p = upper_bound(a + 1, a + j + 1, c[m]) - a - 1, q = upper_bound(b + 1, b + k + 1, c[m]) - b - 1;\n upmin(dp[i][j][k][0], dp[i - 1][j][k][l] + abs(c[m] + j - p + k - q - i));\n }\n if(j < cnt1)\n {\n int p = upper_bound(b + 1, b + k + 1, a[j + 1]) - b - 1, q = upper_bound(c + 1, c + m, a[j + 1]) - c - 1;\n upmin(dp[i][j + 1][k][1], dp[i - 1][j][k][l] + abs(a[j + 1] + k - p + m - 1 - q - i));\n }\n if(k < cnt2 && l != 1)\n {\n int p = upper_bound(c + 1, c + m, b[k + 1]) - c - 1, q = upper_bound(a + 1, a + j + 1, b[k + 1]) - a - 1;\n upmin(dp[i][j][k + 1][0], dp[i - 1][j][k][l] + abs(b[k + 1] + m - 1 - p + j - q - i));\n }\n }\n }\n }\n }\n printf(\"%I64d\\n\", min(dp[n][cnt1][cnt2][0], dp[n][cnt1][cnt2][1]));\n return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "b31baeea6f9a53c19c83b8f8e0ae27c8", "src_uid": "08444f9ab1718270b5ade46852b155d7", "apr_id": "5c9325097a4fb3267939f7e369b6da21", "difficulty": 2500, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.2875516766192007, "equal_cnt": 22, "replace_cnt": 11, "delete_cnt": 4, "insert_cnt": 7, "fix_ops_cnt": 22, "bug_source_code": "#include\n#define ld long double\n#define ll long long\n#define fre freopen(\"papaya.in\", \"r\", stdin);\n#define open freopen(\"papaya.out\", \"w\", stdout);\n#define el else\n#define mm95 cin.tie(0);ios::sync_with_stdio(0);cout.tie(0);\nusing namespace std;\n ll a[10][10],ans,fl=0,i=0;\nint main(){\n ll n,m;\n mm95\n fre open\n cin>>n>>m;\n for(int i=1;i<=n;i++)for(int j=1;j<=m;j++)cin>>a[i][j];\n ll x=1,y=1;\n ans+=a[x][y];\n a[x][y]=0;\n while(true){\n if(a[x+1][y]>=a[x-1][y] and a[x+1][y]>=a[x][y+1] and a[x+1][y]>=a[x][y-1] and fl==0)x++,fl=1;\n if(a[x-1][y]>=a[x+1][y] and a[x-1][y]>=a[x][y+1] and a[x-1][y]>=a[x][y-1] and fl==0)x--,fl=1;\n if(a[x][y+1]>=a[x][y-1] and a[x][y+1]>=a[x+1][y] and a[x][y+1]>=a[x-1][y] and fl==0)y++,fl=1;\n if(a[x][y-1]>=a[x][y+1] and a[x][y-1]>=a[x+1][y] and a[x][y-1]>=a[x-1][y] and fl==0)y--,fl=1;\n ans+=a[x][y];\n fl=0;\n if(x==n and y==m){\n break;\n// cout<<\"s\"<\nusing namespace std;\nint main()\n{\n int n,q,i;\n cin>>n>>q;\n vectorv[6];\n for(i=1;i<=q;i++)\n {\n string s;char ch;\n cin>>s>>ch;\n v[ch-'a'].push_back(s);\n }\n \n queueque;\n for(auto x: v[0]) que.push(x);\n while(!que.empty()&&(que.front().size()\n\n#define F first\n#define S second\n#define PB push_back\n#define MP make_pair\n\nusing namespace std;\n\ntypedef long long ll;\ntypedef vector vi;\ntypedef pair pi;\n\nint main(){\n int n;\n cin >> n;\n int ans;\n for(int i = 0; i < n; i++){\n int x;\n cin >> x;\n if(x > 0){\n ans+=x;\n }else{\n anx-=x;\n }\n }\n cout << ans;\n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "9f7084c82d05a926beff2140799feb55", "src_uid": "4b5d14833f9b51bfd336cc0e661243a5", "apr_id": "f18134a5f4e53cd979b4a8bff899ff4a", "difficulty": 800, "tags": ["greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9591326105087573, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "#include \n#include \n#include \n\nusing namespace std;\n\ntypedef long long ll;\n\nll n;\nll l[5], r[5];\nll divi= 1;\nlong double res= 0.0;\nlong double f[10005][35], g[10005][35];\n\nint main(){\n cin >> n;\n for(ll i=0;i> l[i] >> r[i];\n divi*= (r[i]-l[i]+1);\n }\n\n for(ll x=1;x<=10000;x++){\n for(ll mask=1;mask<(1LL<x || x>r[i]){\n have= true; break;\n }\n }\n else if((mask&(1LL<x || x>r[i]){\n have= true; break;\n }\n cnt++;\n }\n else cost*= max(0LL,min(x,r[i]+1)-l[i]);\n }\n if(!have){\n if(cnt>=2) res= res+ (long double)(x*cost)/(long double)divi;\n else res= res+ g[x-1][(1<\nusing namespace std;\n\ntypedef long double ld;\ntypedef unsigned long long ll;\nconst int N = 1e4 + 100;\n\nll n, l[N], r[N], dp[N];\nld sum, s;\n\nint main() {\n\tios::sync_with_stdio(false), cin.tie(0);\n\tcin >> n;\n\ts = 1;\n\tfor (int i = 0; i < n; i++) {\n\t\tcin >> l[i] >> r[i];\n\t\ts *= r[i] - l[i] + 1;\n\t}\n\tfor (int mask = 1; mask < (1 << n); mask++) {\n\t\tfor (int big = 0; big < N; big++) {\n\t\t\tdp[big] = 1;\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tif((mask & (1 << i)) == 0) {\n\t\t\t\t\tif(l[i] > big)\n\t\t\t\t\t\tdp[big] = 0;\n\t\t\t\t\telse if(r[i] <= big)\n\t\t\t\t\t\tdp[big] *= r[i] - l[i] + 1;\n\t\t\t\t\telse\n\t\t\t\t\t\tdp[big] *= big - l[i] + 1;\n\t\t\t\t}\n\t\t\tld X, S;\n\t\t\tll L = 1, R = N;\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tif(mask & (1 << i))\n\t\t\t\t\tR = min(R, r[i]), L = max(L, l[i]);\n\t\t\tif(R < L || R <= big)\n\t\t\t\tX = 0, S = 0;\n\t\t\telse if(L <= big + 1) {\n\t\t\t\tX = R - big;\n\t\t\t\tS = (big + 1 + R) * X / 2;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tX = R - L + 1;\n\t\t\t\tS = (L + R) * (R - L + 1) / 2;\n\t\t\t}\n\t\t\tif(__builtin_popcount(mask) == 1)\n\t\t\t\tsum += big * (dp[big] - (big? dp[big - 1]: 0)) * X;\n\t\t\telse\n\t\t\t\tsum += (dp[big] - (big? dp[big - 1]: 0)) * (S);\n\t\t}\n\t}\n\tcout << fixed << sum / s;\n\treturn 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "be11ae00fa80108536d017ee66f2d10b", "src_uid": "5258ce738eb268b9750cfef309d265ef", "apr_id": "ee92d115f51e432b9eb8d87118e38250", "difficulty": 2000, "tags": ["probabilities", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.838150289017341, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include \nusing namespace std;\nint main()\n{\n long long int a,b,c,d;\n cin>>a>>b;\n if(a==1&&b>1)\n {\n cout<<\"<\"<<'\\n';\n }\n else if(b==1&&a>1)\n {\n cout<<\">\"<<'\\n';\n }\n else if((a==2&&b==4)||(a==4&&b==2))\n {\n cout<<\"=\"<<'\\n';\n }\n else if((a!=2&&b!=4)||(a!=4&&b!=2)){\n if(a!=1&&b!=1&&a>b)\n {\n cout<<\"<\"<<'\\n';\n }\n else if(a!=1&&b!=1&&a\"<<'\\n';\n }\n\n else\n cout<<\"=\"<<'\\n';\n }\n main();\n}\n", "lang": "GNU C++17", "bug_code_uid": "f8fa5af1fb6aa2d86d2b2baf30ea0029", "src_uid": "ec1e44ff41941f0e6436831b5ae543c6", "apr_id": "f39553d7a7dc755087bbb2038b0c614e", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8386376326074818, "equal_cnt": 11, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 10, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n string s;\n cin>>s;\n string ans=\"\";\n if(s[0]=='h')\n {\n int i;\n ans=\"http://\";\n for(i=4;i\n#include\nusing namespace std;\nint main() {\n\tstring s;\n\tcin >> s;\n\tstring a = { s[0],s[1],s[2] }, b = { s[0],s[1],s[2],s[3] }, c = \"://\";\n\tif (a == \"ftp\") {\n\t\ts.insert(3, c);\n\t}\n\telse if (b == \"http\") {\t\n\t\ts.insert(4, c);\n\t}\n\tint u;\n\tfor (int i = 2; i < s.max_size() - 2; i++) {\n\t\tif (s.find(\".\") != -1 && u != s.size() - 1 && s.substr(i - 2, 2) == \"ru\") {\n\t\t\ts.insert(i, \"/\");\n\t\t\tbreak;\n\t\t}\n\t\tif (s.substr(i - 2, 2) != \"ru\" && s.substr(i, 2) == \"ru\" && s.find(\".\") == -1 && s.substr(i - 2, 2) != \"//\") {\n\t\t\ts.insert(i, \".\");\n\t\t\tu = i+2;\n\t\t}\n\t}\n\tcout << s;\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "6a0b303d4013ea2a43e036b681a726b1", "src_uid": "4c999b7854a8a08960b6501a90b3bba3", "apr_id": "9bb3778f17934db9c99d059bdc8ab385", "difficulty": 1100, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9669995657837603, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "/******** All Required Header Files ********/\n#include \n\nusing namespace std;\n\n/******* All Required define Pre-Processors and typedef Constants *******/\n#define forn(i,n) for (int i = 0; i < n;i++)\n#define all(cont) cont.begin(), cont.end()\n#define pb push_back\n#define mod ((int)1e9 + 7)\n#define vicin(n,vipb) for(int i = 0; i < n;i++){ int rt; cin >> rt; vipb.push_back(rt);}\n#define icin(a) int a; cin >> a\n#define icin2(a,b) int a,b; cin >> a >> b\n#define icin3(a,b,c) int a,b,c; cin >> a >> b >> c\n#define fore(t) for(auto e:t) cout << e << \" \";\n#define fst first\n#define sec second\n#define int long long\n\n\n\ntypedef pair pii;\ntypedef vector vi;\ntypedef vector vs;\ntypedef vector vc;\ntypedef vector> vpii;\ntypedef vector>> vvpii;\ntypedef vector> vvi;\ntypedef vector> vvc;\ntypedef map mpii;\ntypedef map mpsi;\ntypedef map mpci;\ntypedef set seti;\ntypedef multiset mseti;\n\n\n/****** Template of some basic operations *****/\ntemplate inline void amin(T &x, U y) { if(y < x) x = y; }\ntemplate inline void amax(T &x, U y) { if(x < y) x = y; }\n/**********************************************/\n\n/*** Global Variables ***/\n\n\n/********************** cout << c << endl;**/\n\n/*** Global functions ***/\n\nint modu(int u){\n return ((u % mod) + mod) % mod;\n}\n\nint power(int x, int y, int p)\n{\n int res = 1; // Initialize result\n\n x = x % p; // Update x if it is more than or\n // equal to p\n\n while (y > 0)\n {\n // If y is odd, multiply x with result\n if (y & 1)\n res = (res*x) % p;\n\n // y must be even now\n y = y>>1; // y = y/2\n x = (x*x) % p;\n }\n return res;\n}\n\n/************************/\n\n/********** Main() function **********/\nsigned main()\n{\n ios::sync_with_stdio(false);\n cin.tie(0);\n\t#ifndef ONLINE_JUDGE\n\tfreopen(\"input.txt\",\"r\",stdin);\n\t#endif\n\n int n,k;\n\n cin >> n >> k;\n\n if(n == 0){\n cout << 0;\n return 0;\n }\n\n if(k == 0){\n cout << modu(2*n);\n return 0;\n }\n\n int resultat = modu(n*power(2,k+1,mod) - power((int)2,k,mod) + 1);\n cout << resultat;\n\n\n\treturn 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "8b2ccd93f66d58c56a3a6127cde9b5bc", "src_uid": "e0e017e8c8872fc1957242ace739464d", "apr_id": "abdf315d4761810250e9a1120d5a632e", "difficulty": 1600, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.999611197511664, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\ntypedef long long LL;\nLL gi () {\n LL ret=0; char ch=getchar();\n while((ch<'0' || ch>'9') && ch!='-') ch=getchar();\n char c=ch=='-'?getchar():ch;\n while(c>='0' && c<='9') ret=ret*10+c-'0',c=getchar();\n return ch=='-'?-ret:ret;\n}\nconst int N = 610 + 10;\nconst int mo = 10007;\nint n,len,f[N][N][N],G[N],r[N],g[N],e[N],alc;\nchar s[N];\nstruct Mat {\n int a[N][N];\n} M,M1;\nMat operator * (const Mat &x, const Mat &y) {\n Mat ret = {0};\n for(int i=1;i<=alc;i+=1)\n for(int j=1;j<=alc;j+=1)\n if(x.a[i][j])\n for(int k=1;k<=alc;k+=1)\n if(y.a[j][k]) (ret.a[i][k] += x.a[i][j] * y.a[j][k]) %= mo;\n return ret;\n}\nMat ksm (Mat a, int b) {\n Mat ret = {0};\n for(int i=1;i<=alc;i+=1) ret.a[i][i] = 1;\n while(b) {\n if(b&1) ret = ret * a;\n a = a * a; b >>= 1;\n }\n return ret;\n}\nint main () {\n scanf(\"%s\",s+1); len = strlen(s+1);\n n = gi() + len;\n f[1][len][0] = 1;\n for(int d=len-1;d>=0;d-=1)\n for(int i=1;i+d<=len;i+=1) {\n int j = i+d;\n for(int k=0;k<=len;k+=1)\n if(f[i][j][k]) {\n if(s[i]==s[j]) {\n if(i==j) (G[k] += f[i][j][k]) %= mo;\n else if(i+1==j) (G[k] += f[i][j][k]) %= mo;\n else (f[i+1][j-1][k] += f[i][j][k]) %= mo;\n }\n else {\n (f[i+1][j][k+1] += f[i][j][k]) %= mo;\n (f[i][j-1][k+1] += f[i][j][k]) %= mo;\n }\n }\n }\n for(int i=1;i\n#include \n#include \nusing namespace std;\n\ntypedef long long LL;\n\nstruct par { LL x, y; };\n\nLL modu, period;\n\ninline LL M (LL x, LL y) {\n\tLL r(0);\n\ty = (y % modu + modu) % modu;\n\tfor (; y; y >>= 1, x = (x + x) % modu) if (y & 1) r = (r + x) % modu;\n\treturn r;\n}\n\npar getFib (LL x) // (F[x], F[x + 1])\n{\n\tif (x == 0) return (par){0, 1};\n\tpar y;\n\tif (x & 1)\n\t{\n\t\ty = getFib(x - 1);\n\t\treturn (par){y.y, (y.x + y.y) % modu};\n\t}\n\telse\n\t{\n\t\ty = getFib(x / 2);\n\t\treturn (par){M(y.x, y.y * 2 - y.x), (M(y.x, y.x) + M(y.y, y.y)) % modu};\n\t}\n}\n\nint main ()\n{\n\tLL cx; cin >> cx;\n\tvector vpre, vcur;\n\tmodu = 10; period = 60;\n//\tcout << '#' << endl;\n\tfor (int i = 0; i < period; ++i)\n\t\tif (getFib(i).x == cx % modu) vcur.push_back(i);\n\tfor (int _ = 2; _ <= 13; ++_)\n\t{\n//\t\tcout << _ << endl;\n\t\tvpre = vcur;\n\t\tvcur.clear();\n\t\tmodu *= 10;\n\t\tLL f = (_ <= 3) ? 5 : 10;\n\t\tfor(typeof vpre.begin() x:vpre){}\n\t\tfor (LL x : vpre) for (LL i = 0, j; i < f; ++i)\n\t\t\tif (getFib(j = x + i * period).x == cx % modu)\n\t\t\t\tvcur.push_back(j);\n\t\tperiod *= f;\n\t}\n\tif (vcur.size())\n\t\tcout << *min_element(vcur.begin(), vcur.end()) << endl;\n\telse\n\t\tcout << -1 << endl;\n\treturn 0;\n}\n", "lang": "GNU C++0x", "bug_code_uid": "0446416d00584bb642d520b7cdf6614f", "src_uid": "cbf786abfceeb8df29732c8a872f7f8a", "apr_id": "cfd0f4904b6d3a22d7c613b898ff66be", "difficulty": 2900, "tags": ["matrices", "math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9804437758555848, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "#include \n#include \n#include \n\n#define dvs 100000000LL\n\nusing namespace std;\n\nlong long to_find, res;\nlong long mlt[2][2], tmp[2][2], mr[2][2];\nlong long period[14];\n\nlong long mult(const long long &p1, const long long &p2, const long long &md){\n\tlong long a = p1 / dvs, b = p1 % dvs;\n\tlong long c = p2 / dvs, d = p2 % dvs;\n\tlong long tmp = (((dvs * dvs % md) * a % md) * c % md + (dvs * d % md) * a % md + (dvs * b % md) * c % md + b * d % md) % md;\n\treturn tmp;\t\n}\n\nlong long number(const long long &pos, const long long &p){\n\tmlt = {{1, 1}, {1, 0}};\n\tmr = {{1, 0}, {0, 1}};\n\tlong long cur = pos - 1;\n\tif(!pos)return 0;\n\twhile(cur){\n\t\tif(cur % 2){\n\t\t\tfor(int i = 0; i < 2; ++i)\n\t\t\t\tfor(int j = 0; j < 2; ++j){\n\t\t\t\t\ttmp[i][j] = 0;\n\t\t\t\t\tfor(int k = 0; k < 2; ++k)\n\t\t\t\t\t\ttmp[i][j] = (tmp[i][j] + mult(mr[i][k], mlt[k][j], p)) % p;\n\t\t\t\t}\n\t\t\tfor(int i = 0; i < 2; ++i)\n\t\t\t\tfor(int j = 0; j < 2; ++j)\n\t\t\t\t\tmr[i][j] = tmp[i][j];\n\t\t\t--cur;\n\t\t}\n\t\tcur >>= 1;\n\t\tfor(int i = 0; i < 2; ++i)\n\t\t\tfor(int j = 0; j < 2; ++j){\n\t\t\t\ttmp[i][j] = 0;\n\t\t\t\tfor(int k = 0; k < 2; ++k)\n\t\t\t\t\ttmp[i][j] = (tmp[i][j] + mult(mlt[i][k], mlt[k][j], p)) % p;\n\t\t\t}\n\t\tfor(int i = 0; i < 2; ++i)\n\t\t\tfor(int j = 0; j < 2; ++j)\n\t\t\t\tmlt[i][j] = tmp[i][j];\n\t}\n\treturn(mr[0][0]);\n}\n\nvoid init_per(){\n\tperiod[1] = 60;\n\tperiod[2] = 300;\n\tperiod[3] = 1500;\n\tfor(int i = 4; i < 14; ++i)period[i] = period[i - 1] * 10;\n}\n\ninline void input_data(){cin >> to_find;}\ninline void output_data(){cout << res << \"\\n\";}\n\nint calc(){\n\tres = -1;\n\tlong long cur = 10000000000000LL;\n\t//long long cur = 100;\n\tinit_per();\n\tvector< long long > sm;\n\tvector< long long > tmp;\n\tlong long cur_n = 10, cur_mod = to_find % cur_n;\n\tif(!cur_mod)sm.push_back(0);\n\tif(cur_mod == 1){sm.push_back(1); sm.push_back(2);}\n\tint mp = 1, pr = 1, itr = 1;\n\tfor(int i = 3; i <= 59; ++i){\n\t\tint tmp = (mp + pr) % cur_n;\n\t\tif(cur_mod == tmp)sm.push_back(i);\n\t\tpr = mp; mp = tmp;\n\t}\n\t//cerr << \"go\\n\";\n\twhile(cur_n != cur){\n\t\t//cerr << \"cur_n = \" << cur_n << \"\\n\";\n\t\tlong long prd = period[itr], next_prd = period[++itr];\n\t\t//cerr << prd << \" is prd\\n\" << next_prd << \" is next_prd\\n\";\n\t\tcur_n *= 10;\n\t\tcur_mod = to_find % cur_n;\n\t\ttmp.clear();\n\t\tlong long now = 0;\n\t\twhile(now < next_prd){\n\t\t\tfor(int i = 0; i < sm.size(); ++i){\n\t\t\t\tlong long nmb = number(sm.at(i) + now, cur_n);\n\t\t\t\t//cout << \"nmb = \" << nmb << \"\\n\";\n\t\t\t\tif(nmb == cur_mod)tmp.push_back(sm.at(i) + now);\n\t\t\t}\n\t\t\tnow += prd;\n\t\t\t//cerr << \"now = \" << now << \"\\n\";\n\t\t}\n\t\tif(tmp.empty())return 0;\n\t\tsm = tmp;\n\t}\n\tres = sm.at(0);\n\treturn 0;\n}\n\nint main(){\n\tinput_data();\n\tcalc();\n\toutput_data();\n}\n", "lang": "GNU C++0x", "bug_code_uid": "f3a170d2385af5d4bae1f359bd957269", "src_uid": "cbf786abfceeb8df29732c8a872f7f8a", "apr_id": "4517b4859d1eb00815d594d882b204ff", "difficulty": 2900, "tags": ["matrices", "math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9057344854673999, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 4, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\ntypedef long long ll;\ntypedef long double ld;\n\nconst int INF = (int)(2e9 + 0.5);\nconst int MAXN = 100100;\n\nstring s1, s2;\nint mass[MAXN];\n\nint main() {\n\n cin >> s1 >> s2;\n\n int l = 0, r = 0;\n for(l = 0; l < s2.size(); ++l) {\n if(r >= s1.size()) break;\n for(; r < s1.size(); ++r) {\n if(s1[r] == s2[l]) break;\n }\n }\n if(l == (int)s2.size()) {\n printf(\"automaton\\n\");\n exit(0);\n }\n for(int i = 0; i < (int)s1.size(); ++i) {\n ++mass[s1[i] - 'a'];\n }\n for(int i = 0; i < (int)s2.size(); ++i) {\n --mass[s2[i] - 'a'];\n }\n if((int)s1.size() == (int)s2.size()) {\n for(int i = 0; i < MAXN; ++i) {\n if(mass[i] != 0) {\n printf(\"need tree\\n\");\n exit(0);\n }\n }\n printf(\"array\\n\");\n exit(0);\n } else {\n for(int i = 0; i < MAXN; ++i) {\n if(mass[i] < 0) {\n printf(\"need tree\\n\");\n exit(0);\n }\n }\n printf(\"both\\n\");\n }\n}\n", "lang": "GNU C++", "bug_code_uid": "2600a531f191d540267a81ffe45721d8", "src_uid": "edb9d51e009a59a340d7d589bb335c14", "apr_id": "63cfc09f9c2a8f09af5cbf73b93c7540", "difficulty": 1400, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.6477935054121565, "equal_cnt": 6, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "#include \nusing namespace std;\n\nvoid mSwap(int*a,int*b)\n{\n *a=*a^*b;\n *b=*a^*b;\n *a=*a^*b;\n}\n\nvoid mSort (int* a, int*b, int* c)\n{\n if (*a<*b)\n {\n mSwap(a,b);\n }\n if (*c>*a)\n {\n mSwap(a,c);\n mSwap(b,c);\n }\n else if(*c>*b)\n {\n mSwap(b,c);\n }\n}\n\nint main()\n{\n unsigned int a, b, c, sum=0;\n cin>>a>>b>>c;\n mSort(&a,&b,&c);\n while(b>0)\n {\n if(b==c)\n {\n sum+=b;\n cout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n#define ill long long \n#define pii pair\n#define pb(x) push_back(x)\n#define forall(i,a,n) for(ill i=(a); i < (n); i++)\n#define forev(i, a, n) for(ill i = (a); i >= (n); i--)\n#define fill(i,a) memset(i, a, sizeof(i))\n#define V(x) vector\n#define vii vector\n#define sii set\n#define sz(a) a.size()\n#define prnt(n) prillf(\"%d\\n\", n)\n#define INF 1000000000\n#define gc getchar_unlocked\n\n#define foreach(v, c) for( typeof( (c).begin()) v = (c).begin(); v != (c).end(); ++v)\n#define S(n) scanf(\"%d\", &n)\nint main()\n{\n\till x, y, z, k;\n\tcin >> x >> y >> z >> k;\n\till part = 1;\n\twhile(k) {\n\t\tif(x >1) {\n\t\t\tk--;\n\t\t\tpart<<=1;\n\t\t\tx--;\n\t\t}\n\t\tif(y >1 && k) {\n\t\t\tk--;\n\t\t\tpart<<=1;\n\t\t\ty--;\n\t\t}\n\t\tif(z >1 && k) {\n\t\t\tk--;\n\t\t\tpart<<=1;\n\t\t\tz--;\n\t\t}\n\t}\n\tcout << part <\n\nusing namespace std;\n\nint main()\n{\n long long x, y, z, k, cx = 1, cy = 1, cz = 1;\n cin >> x >> y >> z >> k;\n cz = cy = cx = min(min(x - 1, y - 1), min(z - 1, (k / 3))) + 1;\n k -= 3 * (cx - 1);\n while(k > 0)\n {\n if((cx <= cy || cy == y) && (cx <= cz || cz == z) && cx < x)\n cx++;\n else if((cy <= cz || cz == z) && cy < y)\n cy++;\n else if(cz < z)\n cz++;\n k--;\n }\n cout << cx * cy * cz << endl;\n}", "lang": "GNU C++", "bug_code_uid": "e66cdfaaede515dc0fd6093c067acd0a", "src_uid": "8787c5d46d7247d93d806264a8957639", "apr_id": "61e789294758352fe8868967a34b6e3d", "difficulty": 1600, "tags": ["math", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.857451403887689, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 8, "bug_source_code": "#include\n#include\nusing namespace std;\nconst int MAX_N=100005;\nstruct Fly\n{\n int x,y;\n}F[MAX_N];\nstruct Land\n{\n int a,b;\n}L[MAX_N];\nint main()\n{\n int R,B;\n cin>>R>>B;\n for(int i=0;i>F[i].x>>F[i].y;\n }\n for(int j=0;j>L[j].x>>L[j].y;\n }\n if(R>B)\n {\n cout<<\"No\"<\nusing namespace std;\nint main ()\n{\n int sum = 0;\n int ans = 0;\n int n,s;\n cin>>n>>s;\n for(int i= 1;i<=n;i *= 2)\n {\n sum += i;\n if(sum >= n) ans = i,break;\n }\n cout<\n#include \n\nstd::vector digits(int x) {\n\tstd::vector answer;\n\twhile(x) {\n\t\tanswer.push_back(x % 10);\n\t\tx /= 10;\n\t}\n\treturn answer;\n}\n\nint to_integer(std::vector x_digits) {\n\tint answer = x_digits.back();\n\tfor (int i = x_digits.size() - 2; i >= 0; i--) {\n\t\tanswer *= 10;\n\t\tanswer += x_digits[i];\n\t}\n\treturn answer;\n}\n\nint main() {\n\tint x;\n\tstd::cin >> x;\n\tstd::vector x_digits = digits(x);\n\tint first_digit = x_digits.back();\n\tbool is_max_sum = true;\n\tfor (int i = 0; i < x_digits.size() - 1; i++) {\n\t\tif (x_digits[i] != 9) {\n\t\t\tis_max_sum = false;\n\t\t}\n\t}\n\tif (is_max_sum) {\n\t\tstd::cout << x;\n\t\treturn 0;\n\t}\n\n\tint answer = first_digit - 1;\n\tint curr_answer = answer;\n\twhile (curr_answer <= x) {\n\t\tanswer = curr_answer;\n\t\tcurr_answer *= 10;\n\t\tcurr_answer += 9;\n\t}\n\n\tstd::vector answer_digits = digits(answer);\n\tint max_answer = answer;\n\tfor (int i = 0; i < answer_digits.size() - 1; i++) {\n\t\tstd::vector temp = answer_digits;\n\t\ttemp[i]--;\n\t\ttemp.back()++;\n\t\tint temp_int = to_integer(temp);\n\t\tif (temp_int <= x) {\n\t\t\tmax_answer = temp_int;\n\t\t\tbreak;\n\t\t}\n\t}\n\tstd::cout << max_answer;\n}", "lang": "GNU C++11", "bug_code_uid": "6be7c658788abc5a16ab0f0fda073d71", "src_uid": "e55b0debbf33c266091e6634494356b8", "apr_id": "44707bd7c491696d1e4722c997e56991", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9912280701754386, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n int n.m;\n cin>>n;\n m=n/2;\n cout<\nusing namespace std;\nint main(){\n string a;\n cin>>a;\n int n=a.size(),i,j;\n if(n%2==0){\n j=(n/2)-1;\n cout<\nusing namespace std;\ntypedef long long int ll;\n/*ll mod=1000000+3;\n ll pow(ll x,ll y)\n {\n ll fans=1;\n while(y>0)\n {\n fans=(fans*x)%mod;\n x=(x*x)%mod;\n y=y>>1;\n }\n return fans%mod;\n }\n int main()\n {\n ios::sync_with_stdio(0);cin.tie(0);\n ll n,r;\n cin>>n>>r;\n ll ans=1;\n for(ll i=r+n;i>n;i--)\n {\n ans=(ans*i)%mod;\n }\n cout< 0; j--)\n\n // nCj = (n-1)Cj + (n-1)C(j-1);\n C[j] = (C[j] + C[j-1])%p;\n }\n return C[r];\n}\n\n// Lucas Theorem based function that returns nCr % p\n// This function works like decimal to binary conversion\n// recursive function. First we compute last digits of\n// n and r in base p, then recur for remaining digits\nll nCrModpLucas(ll n, ll r, ll p)\n{\n // Base case\n if (r==0)\n return 1;\n\n // Compute last digits of n and r in base p\n ll ni = n%p, ri = r%p;\n\n // Compute result for last digits computed above, and\n // for remaining digits. Multiply the two results and\n // compute the result of multiplication in modulo p.\n return (nCrModpLucas(n/p, r/p, p) * // Last digits of n and r\n nCrModpDP(ni, ri, p)) % p; // Remaining digits\n}\nint main()\n{\n ll n,r;\n cin>>n>>r;\n cout<\nusing namespace std;\nint main() {\n int n,i,j,s1=0,s2=0,r;\n int a[35],b[35];\n cin>>n;\n for(i=0; i>a[i];\n s1+=a[i];\n }\n for(i=0; i>b[i];\n s2+=b[i];\n }\n sort(a,a+n);\n sort(b,b+n);\n for(i=0; i1)\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n if(s2>s1)printf(\"NO\\n\");\n else printf(\"YES\\n\");\n\treturn 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "6957012512dd3f0aed977683acdea7fb", "src_uid": "e0ddac5c6d3671070860dda10d50c28a", "apr_id": "64c4f339939fce39138a748a50a193fe", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9926470588235294, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#define L long long int\n#define LD long double\n#define pi 3.141592653589793238462643383\n#define M 1000000007\n\nusing namespace std;\n\nstruct e\n{\n LD t;\n string w;\n};\n\nbool com(struct e e1,struct e e2)\n{\n return e1.t>a>>b>>m1;\n cin>>vx>>vy>>vz;\n x=a/2;\n y=m1;\n z=0;\n /*ln=0;\n while(1)\n {\n struct e t[5];\n if(vx!=0)\n t[0].t=(a-x)/vx;\n else\n t[0].t=1000000000.0;\n t[0].w=\"x\";\n if(vx!=0)\n t[1].t=-x/vx;\n else\n t[1].t=1000000000.0;\n t[1].w=\"x\";\n if(vz!=0)\n t[2].t=(b-z)/vz;\n else\n t[2].t=1000000000.0;\n t[2].w=\"z\";\n if(vy!=0)\n t[3].t=-y/vy;\n else\n t[3].t=1000000000.0;\n t[3].w=\"y\";\n if(ln!=0&&vz!=0)\n t[4].t=-z/vz;\n else\n t[4].t=1000000000.0;\n t[4].w=\"z\";\n for(i=0;i<5;i++)\n if(t[i].t<=0)\n t[i].t=1000000000.0;\n sort(t,t+5,com);\n for(i=0;i<5;i++)\n cout<=0&&x<=a))\n {\n if(x>a)\n {\n x=a-(x-a);\n }\n if(x<0)\n {\n x=-x;\n }\n }\n if(vz!=0)\n {\n tz=abs(2*b/vz);\n m=(int)(t/tz);\n //cout<b)\n z=b-(z-b);\n }\n //cout<\n#include\n#include\n#include\n#include\n#define mod 1000000000 + 7\nusing namespace std;\ntypedef long long ll;\nconst int N = 505;\nll dp[N],f[N],mod;\nint n;\nint main(){\n\tcin>>n;\n\tdp[0] = 1;\n\tfor( int i = 1; i <= n; i++ ){\n\t\tmemset(f,0,sizeof(f));\n\t\tfor( int j = 0; j <= n; j++ )\n\t\t\tfor( int k = 0; k+j <= n; k++ )\n\t\t\t\tf[j+k] = (f[j+k]+dp[j]*dp[k])%mod;\n\t\tmemset(dp,0,sizeof(dp));\n\t\tfor( int j = 0; j <= n; j++ )\n\t\t\tdp[j] = (f[j-1]+f[j+1]*(j+1)*j+f[j]*(2ll*j+1))%mod;\n\t}\n\tcout<\n#include \nchar ss[250],t[200],ans[200];\nint f;\nint cut(int i)\n{\n while(t[i+1] == ' ') i++;\n return i;\n}\nint main()\n{\n int l,i,j;\n while(~scanf(\"%s\",ss))\n {\n l = strlen(ss);\n f = 0;\n for(i = 0; i < l-3;)\n {\n if(ss[i] == 'W' && ss[i+1] == 'U'\n && ss[i+2] == 'B')\n {i += 3; t[f++] = ' ';}\n else {t[f++] = ss[i]; i++;}\n }\n t[f] = '\\0';\n l = strlen(t);\n for(i = l-1; i >= 0; i--)\n if(t[i] != ' ')\n {t[i+1] = '\\0'; break;}\n l = strlen(t);\n f = 0;\n for(j = 0; t[j] == ' '; j++);\n for(i = j; i < l; i++)\n if(t[i] != ' ')\n ans[f++] = t[i];\n else\n {\n i = cut(i);\n ans[f++] = ' ';\n }\n ans[f] = '\\0';\n printf(\"%s\\n\",ans);\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": "2700ff12308eaa9056f99b8665d26423", "src_uid": "edede580da1395fe459a480f6a0a548d", "apr_id": "6a677850e08a004f8554b44e4777e673", "difficulty": 900, "tags": ["strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.6990291262135923, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 8, "bug_source_code": "#include \n#include \n#include \nusing namespace std;\nint main(){\n//freopen(\"input.txt\",\"r\",stdin);\n//freopen(\"output.txt\",\"w\",stdout);\nstring s, s2;\ncin>>s>>s2;\nint n=0, m, sum=1, i=0, j;\nj=s2.length();\nwhile (j>=0){\nif(s[i]!=s2[n]){\nn++;\nj--;\n}\nif(s[i]==s2[n]){\nn++;\ni++;\nj--;\nsum++;\n}\n}\nif(sum>s2.length())\nsum=s2.length();\ncout<\nusing namespace std;\nvectorv;\nvoid swap(char *x, char *y)\n{\n char temp;\n temp = *x;\n *x = *y;\n *y = temp;\n}\nvoid permute(char *a, int l, int r)\n{\n int i;\n if (l == r)\n {\n string s=a;\n v.push_back(s);\n }\n else\n {\n for (i = l; i <= r; i++)\n {\n swap((a+l), (a+i));\n permute(a, l+1, r);\n swap((a+l), (a+i)); //backtrack\n }\n }\n}\nint main()\n{\n char a[101],b[101];\n cin>>a>>b;\n string str=b;\n long long x=atoi(str.c_str());\n int n=strlen(a);\n permute(a,0,n-1);\n long long ans=-1;\n for (int i=0;ians)ans=y;\n }\n\n }\n cout<_/___.' >' \"\".\n | | : `- \\`.;`\\ _ /`;.`/ - ` : | |\n \\ \\ `_. \\_ __\\ /__ _/ .-` / /\n =====`-.____`.___ \\_____/___.-`___.-'=====\n `=---='\n \n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \n Vikash Kumar @ Codechef/codeforces \n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ \n#include\n \n#define ll long long int\n#define ll_MAX LLONG_MAX\n#define ll_MIN LLONG_MIN\n#define pi 3.14159265358979323846\n#define count_1(n) __builtin_popcountll(n)\n#define MOD 1000000007\n#define MAX 1e9\n#define MIN -1e9\n#define itoc(c) ((char)(((int)'0')+c))\n#define mid(s,e) (s+(e-s)/2)\nconst int MX=10010896;\nconst int lmt=3164;\nconst int N=10000001;\n#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)\nusing namespace std;\nll extgcd(ll a,ll b,ll& x,ll& y){if(b==0){x=1;y=0;return a;}else{int g=extgcd(b,a%b,y,x);y-=a/b*x;return g;}}\nll modpow(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;}\n\nll cal(string str,ll i){\n ll n=(i+1)-0;\n ll base=str.size();\n //cout<<\"pow(\"<>k;\n string ans[10];\n string txt=\"codeforces\";\n if(k==1){\n cout<>t;\n\twhile(t--){solve();}return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "bc33a637cec41a81044c007137d3ec7c", "src_uid": "8001a7570766cadcc538217e941b3031", "apr_id": "0f43075c2190be99f953bcde30862e27", "difficulty": 1500, "tags": ["greedy", "math", "brute force", "strings", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9666666666666667, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "#include\nusing namespace std;\nint n;\nint main(){\n\tscanf(\"%d\",&n);\n\tfor(int i=0;i*1234567<=n;i++)\n\tfor(int j=0;j*123456<=n;j++)\n\tif(n%(i*1234567+j*123456)%1234==0){printf(\"YES\\n\");return 0;}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "9c9f4921033caa23077d00be4126af6f", "src_uid": "72d7e422a865cc1f85108500bdf2adf2", "apr_id": "3a4d89aab26512eff594daaba6e6814a", "difficulty": 1300, "tags": ["brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.4608879492600423, "equal_cnt": 25, "replace_cnt": 8, "delete_cnt": 12, "insert_cnt": 4, "fix_ops_cnt": 24, "bug_source_code": "#include\nusing namespace std;\nint main(){ long long n,m,a,i;\n scanf(\"%lld %lld %lld\",&n,&m,&a);\nlong long int total=n*m;\nlong long int tile=a*a;\nlong long int sum=0;\ni=1;\nif(tile>total){\n cout<sum){\n sum+=tile;\n if(sum==total){break;}\n ++i; \n}\n\ncout<\nusing namespace std;\nint main()\n{\n long long int maxw, maxh, ratw, rath;\n cin >> maxw >> maxh >> ratw >> rath;\n for ( int i = min( ratw, rath ); i >= 1; i-- )\n {\n if ( ratw % i == 0 && rath % i == 0 )\n {\n ratw = ratw / i;\n rath = rath / i;\n i = 0;\n }\n }\n long long int timew = maxw / ratw, timeh = maxh / rath;\n cout << min( timew, timeh );\n}", "lang": "GNU C++17", "bug_code_uid": "a57e8f305fdd008616cf2e647df914af", "src_uid": "907ac56260e84dbb6d98a271bcb2d62d", "apr_id": "b29fa604a9bdcd06a87c487c86b1571a", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8402877697841726, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "#include \n#include \nusing namespace std;\n\nint main(void){\n int num_chars;\n cin >> num_chars;\n string theString;\n cin >> theString;\n char temp;\n int operations = 0;\n int longest = 1;\n for (size_t i = 0; i < num_chars; i++) {\n temp = theString[i];\n if(temp == theString[0]){\n bool willCopy = true;\n int length = 0;\n for (size_t j = 0; i + j < theString.length() && i!=0 && j < i; j++) {\n if(theString[i+j]!=theString[j]){\n willCopy = false;\n }\n length++;\n }\n if(willCopy && longest < length && j = i-1){\n longest = length;\n }\n }\n }\n cout << num_chars - (longest - 1) << endl;\n\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "7d4e8db1c3cbc192ac23ecbe1f7327df", "src_uid": "ed8725e4717c82fa7cfa56178057bca3", "apr_id": "968d518330a37798529cddc290b2f543", "difficulty": 1400, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9986504723346828, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include\nusing namespace std;\ndouble a[10000], x, ans;\nint n, k, y;\n\nint main()\n{\n cin >> n >> k;\n for(int i = 0; i < n; i++)\n {\n cin >> a[i];\n x += a[i];\n }\n y = round(x / n);\n for(ans = 0; y < k; ans++)\n {\n a[n] = k;\n n++;\n x += k;\n y = round(x / n);\n }\n cout << ans;\n return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "ebfdb64b18bcc9eaef0d244ab1a19379", "src_uid": "f22267bf3fad0bf342ecf4c27ad3a900", "apr_id": "75f516ec49087d4c4786d2d9aaae2f0c", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9998508241963153, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "/*\n\n\n `,;i+#zznxxMMMMxxxnzz#+i;:,`\n `:*zx@############################@Wxz+i:.`\n `;zM##########################################@Mn#i:.\n n#####################################################Wx#*:`\n `############################################################Wn+;.\n ,#################################################################Wn.\n i###################################################################*\n +###################################################################z\n z###################################################################M\n x###################################################################@`\n @####################################################################,\n `#####################################################################i\n ,#####################################################################+\n ;#####################################################################n\n +#####################################################################M\n z#####################################################################@\n x######################################################################`\n W######################################################################,\n `#######################################################################;\n ,#######################################################################*\n i########################################################################\n +#######################################################################n\n n#######################################################################x\n M#######################################################################W\n `@########################################################################`\n ,#########################################################################.\n i#########################################################################:\n :x#########################################################################i\n .:i+n@###########################################################################M*,\n `:*#nW@####################################################################################Wn#i:.\n `ix@################################################################################################@x#i`\n ,W########################################################################################################n:\n .W############################################################################################################\n i#############################################################################################################,\n *############################################################################################################M\n :############################################################################################################:\n ###########################################################################################################+\n iW#######################################################################################################*\n :#M##################################################################################################M:\n .:*zx@##########################################################################################x;\n .:*zM#################################################################################Wzi.\n .*M#######################################################################@Mn#*:.\n ;########@#####################################################M++@#####z\n ,#######W;###x##zznxxMMW@@@##########@@WMxnz+*i::..````.:i#M#### +#####z\n `#####x@@ n#n `````...``` :x#M :#####z\n @###n *W ;@. *@` :######\n W#### :x `i , i#####*\n MM@#z ,+ +#x###:\n xi*#x `. xz x##.\n x;i#M +. x#@\n x;z#M @#x`zMn*`\n WM@#z `....,,,::::::::::::,,...`` .##z,n###+\n ,zMMn+,.####:``.,:;;i*+##znnxMMWW@@##############################@WWMxxz#+**##+ :@#i\n z##MnW#M####@#################################################################W###*#;\n x#* `z###########################################################################iW,\n nx `@############################################################################`\n *+ x##########################################################################x,\n `i .#xW##########################################################################W\n ` +#############################################################################@\n z. ;#############################################################################@\n xz .#############################################################################W\n n@` @#@@#########################################################################x\n z#: M##+#########################################################################z\n +#i x##;W##################################W@####################################*\n :#+ n##i#################################@; +###################################,\n `@# z##*;################################+ x#################################W\n zz ###*.################################. ;#################################z\n :z +##i @##############################x `@################################:\n * *##; W##############################+ z###############################W\n ` i##: x##############################, ,###############################+.\n i##, n#############################M @##############################.*`\n :##. n#############################; .##############################n z,\n ,##` z############################+ .##############################; M,\n `#@ ###x:n#####################@i @#z:#M#######################W `@,\n @@` +##x .*x@###############@#. z#M .;+nW##################+ :#.\n x#` *##x `:*zxW@#####Wx#;` :##, `,i*#zxxMWWWWW####. z@`\n ##: i##@` ``..`` M@# ;###x .@i\n :#z :###; *M, +###*.M#\n W#*,###x .@` x###M@n\n *##@####i i W: .` `@###@+\n `M#####Wi `# n+ ,* :####.\n .M####M` ;z ` zM *# +###.\n `#@###* +MW#M; n#.`W* x##W\n ####W .@####+ ,x##+#@` `@##z\n *####; ; :W####+ *####@#* :###;\n ;####z ;: *W#####z` .z######x: , +##@`\n .####W `z #in#@####@xx@#####W, z, .; x##x\n W####. W #*`@M############@;x. :x ;, `@##*\n z####i @, .` `:x i#z+*+n####W@#zx ;n W, :, +` :###.\n i##### `@i :# ;,M: z@**`i#zWx. .#i+ n: ## ,# z ###x\n `@###x `#z M. zix i+#:*.,z;*i + *:; :n ;M,,W` n M##i\n n###@ .#M,n `*M*`W*#.# x:i` *z`;`x W..@;;x; ,# .##@`\n ;####. .##+* ;z#,*Mz@.n W:* z#..:@, z+`@i++# *; i##z\n W###; .##W: *#@`Wz@M*z `@i# n*; #W* iW`W##:M z. n##:\n *###+ `@##, +#Mi#z#nW# `#+n n*# WM# ,#;WWn.@ M `@#M\n `W##n M##. ##Mx#W#@##ni#zM zz@,@#Mnn#M@#@,#` .n ;##*\n i##@ ###, ##@@##########@;`z##@#########@*@` i+ z#@`\n M##, :##; ################@#############@@W n;`@##\n :##* M#* .;i*++#zzzznnnnnnnnxxxxxxxxMMW@@n @`;#@.\n n#x *#z ` :W z#z\n .@#, `@W , `:**+*;:` #n`@#.\n +#z z#. # *@########Wn+;. W+i#z\n M#: ;#+ z` ,*nW#########@x, ;#;M@.\n :#W,`#W *, .;*#nxxn#i` x#;##\n z#@*W#;:i `n#@z@`\n `W####M.+ n##@@+\n i#####zz ;####W`\n n#####x x####i\n .W####W :####M\n ;#####. M####i\n +####: i####M\n n###+ .@####;\n `x##M` `M####n\n `n##M, .M####W.\n +###z, `*@####M,\n :M###M+:` `,i#M#####xi\n ;x#####Wxz###znxW######Mzi.\n .*nW########@WMn#*;,`\n `.,,,..`\n\n\n\n\n\n\n `.` `:,\n .i *xxMM* `n##@: ;W##n` ..\n ;@` i;` `.:i. n####, n#W@#. . ,z` nz#+, W#@x#n ,M#@.\n i#, n#, z###z ,iM#x ,#n`.; #W@#i +## `xz @###@ *W@@# W@. z#, .@#@#.\n *#: x#, WMn+, n#* i#, `@#Wn, +#@` *#n`#n.##` M#WM* Mn n#; x#x.\n *#, z#..#* n#; +#` ;#; +##; z#n.#i.#W `#+ Mz `W#: :#W`\n i#. ##.,#* n#, *#+ *#` +### z#n.#::#* :#; xM:x#W` z#;\n ;#. *#.:#* n#` ,@#i +@ +##x ##x.#;#W` ;#, n###@, `@M\n :#. ;#.:#* n#` :@#i +@ +#@@`*#n.#n@#+ i#. z#@#n ,#*\n .#, ;#.:#@WW, z#` ;##: +#znM; +#+#:i#n.###@#n i#z#+. ##;Wx i#, .:,\n `#xnM#.:#@WM, z#` ##M +###@; +#.@+;#z.#z` n#;i####+ +#.#@ +#`+####\n .#####`,## z#` `W#,*#;,` ##`nM*##`#i i#*;#+ii. *#.i#, +@ ;zx##\n :#+,z#`,#* z#` +. ##ii#. ##.i#W## #; i#i;#` *#,,#* +#` @#\n i#, ##`.#i n#` @W` *#*i#. z#.`@##* @; z#.:#. i#;`#x i#, W#\n *#; z@ .#i x@ M#; n#;i#, n#, ###; Wi `@x ,#; i#* M#. .#+ ,##\n +#* nW .#+.;;`;:W#;.+#M,##@`i#; `` z#. +##, M# z#, .#i i## z#* x@,`x##\n *## nn .####@######*`M####+ i#WW#M *@` i#W x@n#* `#@Mx+ i#z :#x ,@@W###\n .@+ ;* i#z+. izxni `#MM* .zWWx, `+ `x+ #Wx; #MWW# ,#; n@` ,nW+##\n ,` `*. .`\n\n\n\n\n\n */\n\n\n\n\n\n\n\n\n\n#include \nusing namespace std;\nint main()\n{\n\tint n,k;\n\tcin>>n>>k;\n\tint arr[n];\n\tdouble sum = 0;\n\tfor(int i=0;i>arr[i];\n\t\tsum=sum+arr[i];\n\t}\n\tdouble ans,ans1,ans2;\n\tans = k*n;\n\tdouble ans3 = (double)n/2;\n\tans1 = 2*(ans - sum - ans3);\n\tans2 = ans1;\n\tif(ans2<= 0)\n\t{\n\t\tcout<<\"0\"<\n\nint w, m;\nbool dt;\n\nbool f(int x, int l, int r)\n{\n if( dt || (l && ( l == r )) ) return dt = true;\n if( x > w*m ) return false;\n return f(x*w, l+x, r) || f(x*w, l, r+x) || f(x*w, l, r);\n}\n\nint main()\n{\n scanf(\"%d%d\", &w, &m);\n puts( f(1, 0, m) ? \"YES\":\"NO\" );\n}\n", "lang": "GNU C++11", "bug_code_uid": "2562cf2514d039cffc46ef75d0669462", "src_uid": "a74adcf0314692f8ac95f54d165d9582", "apr_id": "c9fbf86aa54db702d3cd7127638fa9ce", "difficulty": 1900, "tags": ["dp", "meet-in-the-middle", "number theory", "greedy", "math", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.997229916897507, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \nusing namespace std;\n\n\nint main() {\n int n,m;\n cin >> n >> m;\n if (n 2*m) count +=2*m;\n else if (temp >0) count += m;\n \n cout << count << endl;\n \n }", "lang": "GNU C++0x", "bug_code_uid": "be5f7e65fbb6982bd2a5679bad2fc8c3", "src_uid": "0fa526ebc0b4fa3a5866c7c5b3a4656f", "apr_id": "9c65dca1198395658227602193dda0c3", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9423407917383821, "equal_cnt": 14, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 8, "fix_ops_cnt": 13, "bug_source_code": "#include \n\nusing namespace std;\n\ntypedef double db;\ntypedef long long ll;\ntypedef pair pii;\nconst ll mINF = 1000 * 1000 * 1000 + 9;\nconst db ebs = 0.000001;\n\nint main()\n{\n /*\n freopen(\"\", \"r\", stdin);\n freopen(\"\", \"w\", stdout);\n */\n\n ll kol_vo, del;\n cin >> kol_vo >> del;\n vector > v;\n v.push_back({0, false});\n for(ll c=10; c<100; c++)\n if(c == (c%10)*10+c/10)v.push_back({c, true});\n ll j = 0, now = 1000, last = 10, p = 1;\n while(v.size()-p < kol_vo){\n ll dop = 0;\n for(ll c=j; c\nusing namespace std;\n\nint twoPows[8] = {2,4,8,16,32,64,128,256};\n\nint findPow(int n){\n\tint answer;\n\tfor (int i = n; i > 0; --i){\n\t\tfor(int j = 0;j < 8;j++){\n\t\t\tif(i == twoPows[j]){\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t}\n}\n\nint calc(int n,int b){\n\tif(n == 2){\n\t\treturn (b * 2) + 1;\n\t}\n\tint play = findPow(n);\n\treturn calc(n - play / 2,b) + (play * b) + (play / 2);\n}\n\nint main(int argc, char const *argv[])\n{\n\t//freopen(\"input.in\",\"r\",stdin);\n\tint n,b,q;\n\tcin>>n>>b>>q;\n\tcout<\n#include \n#include \nusing namespace std;\nconst int mod = 1e9 + 7;\nconst int maxn = 75 + 2;\nint dp[(1 << 20) + 2][maxn],a[maxn][maxn],ans,len;\nchar s[maxn];\nint main(){\n\n\tscanf(\"%d\",&len);\n\tscanf(\"%s\",s + 1);\n\tfor(int i = 0; i <= len; ++i){\n\t\tfor(int j = i + 1; j <= len; ++j){\n\t\t\ta[i][j] = (a[i][j - 1] << 1) + s[j] - '0';\n\t\t}\n\t}\n\tint tmp = min(len,20);\n\tfor(int i = 0; i < len; ++i) dp[0][i] = 1;\n\tint t = (1 << tmp);\n\tfor(int i = 0; i < t; ++i){\n\t\tfor(int j = 0; j < len; ++j){\n\t\t\tif(dp[i][j])\n\t\t\tfor(int k = j + 1; k <= len + 1; ++k){\n\t\t\t\tif(a[j][k] && a[j][k] <= 20){\n\t\t\t\t\tdp[i | (1 << (a[j][k] - 1))][k] += dp[i][j];\n\t\t\t\t\tdp[i | (1 << (a[j][k] - 1))][k] %= mod;\t\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tfor(int i = 1; i <= tmp; ++i){\n\t\tfor(int j = 1; j <= len; ++j){\n\t\t\tif(dp[(1 << i) - 1][j]){\n\t\t\t\tans += dp[(1 << i) - 1][j];\n\t\t\t\tans %= mod;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\\n\",ans);\n\t\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "41b5e4d2cd45c69657d7a8db2b1a101a", "src_uid": "61f88159762cbc7c51c36e7b56ecde48", "apr_id": "ff5fe597dc09814860ec3b6c68aa7343", "difficulty": 2200, "tags": ["dp", "bitmasks"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9914938862307283, "equal_cnt": 15, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 11, "fix_ops_cnt": 14, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#define mp make_pair\n#define pb push_back\n#define all(x) (x).begin(),(x).end()\n#define rep(i,n) for(int i=0;i<(n);i++)\n\nusing namespace std;\n\ntypedef long long ll;\ntypedef unsigned long long ull;\ntypedef vector vb;\ntypedef vector vi;\ntypedef vector vvb;\ntypedef vector vvi;\ntypedef pair pii;\n\nconst int INF=1<<29;\nconst double EPS=1e-9;\n\nconst int dx[]={1,0,-1,0},dy[]={0,-1,0,1};\nll a,b;\nstring str;\nll n;\nint main(){\n cin >> a >> b;\n cin >> str;\n n = str.size();\n ll rx,ry;\n rx = 0;\n ry = 0;\n for(int i = 0; i < n; i++){\n if(str[i] == 'R'){\n rx++;\n }else if(str[i] == 'D'){\n ry--;\n }else if(str[i] == 'L'){\n rx--;\n }else if(str[i] == 'U'){\n ry++;\n }\n if(a == rx && b == ry){\n cout << \"Yes\" << endl;\n return 0;\n }\n }\n if((a == rx && b == ry )|| (a == 0 && b == 0)){\n cout << \"Yes\"<< endl;\n return 0;\n }\n if(rx == 0 && ry == 0){\n cout << \"No\" << endl;\n return 0;\n }\n int P,Q;\n P = -1;\n Q = -1;\n ll x,y;\n if(rx && ry){\n P = a/rx-100;\n Q = b/ry-100;\n x = rx*min(P,Q);\n y = ry*min(P,Q);\n for(int k = 0; k < 202; k++){\n for(int i = 0; i < n; i++){\n if(a == x && b == y){\n cout << \"Yes\" << endl;\n return 0;\n }\n if(str[i] == 'R'){\n x++;\n }else if(str[i] == 'D'){\n y--;\n }else if(str[i] == 'L'){\n x--;\n }else if(str[i] == 'U'){\n y++;\n }\n if(a == x && b == y){\n cout << \"Yes\" << endl;\n return 0;\n }\n }\n }\n }else if(rx == 0){\n Q = b/ry-100;\n x = rx*Q;\n y = ry*Q;\n for(int k = 0; k < 202; k++){\n for(int i = 0; i < n; i++){\n if(a == x && b == y){\n cout << \"Yes\" << endl;\n return 0;\n }\n if(str[i] == 'R'){\n x++;\n }else if(str[i] == 'D'){\n y--;\n }else if(str[i] == 'L'){\n x--;\n }else if(str[i] == 'U'){\n y++;\n }\n if(a == x && b == y){\n cout << \"Yes\" << endl;\n return 0;\n }\n }\n }\n }else if(ry == 0){\n P = a/rx-100;\n x = rx*P;\n y = ry*P;\n for(int k = 0; k < 202; k++){\n for(int i = 0; i < n; i++){\n if(a == x && b == y){\n cout << \"Yes\" << endl;\n return 0;\n }\n if(str[i] == 'R'){\n x++;\n }else if(str[i] == 'D'){\n y--;\n }else if(str[i] == 'L'){\n x--;\n }else if(str[i] == 'U'){\n y++;\n }\n if(a == x && b == y){\n cout << \"Yes\" << endl;\n return 0;\n }\n }\n }\n }\n cout << \"No\" << endl;\n return 0;\n}", "lang": "GNU C++0x", "bug_code_uid": "985cf3484e4eceaa467ec71bab5da4b3", "src_uid": "5d6212e28c7942e9ff4d096938b782bf", "apr_id": "1d7637e6ca1389890f9aca84b8b88f42", "difficulty": 1700, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.7793633369923162, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "int b[10];\nbool ss1(int x){\n\tif(x==2) return 1;\n\tif(x<2||x%2==0) return 0;\n\tfor(int i=3;i*i<=x;i+=2) if(x%i==0) return 0;\n\treturn 1;\n}\nbool ss(int n){\n\tint k=0,m=n,s=0;\n\twhile (m){\n\t\tb[k]=m%10;\n\t\tm/=10;\n\t\tk++;\n\t}\n\tfor (int i=0;i\nusing namespace std;\n#define sz 100000\n#define pb(a) push_back(a)\n#define ll long long\n#define ull unsigned long long\n#define fread freopen(\"input.txt\",\"r\",stdin)\n#define fwrite freopen(\"output.txt\",\"w\",stdout)\n#define inf (1LL<<29)\n#define mem(abc,z) memset(abc,z,sizeof(abc))\n#define PI acos(-1)\nint dp[1150][105],v1,v2,t,d,mx;\nint rec(int speed,int curTime,int val){\n //mx=max(mx,val);\n if(curTime>t || speed<0) return -inf;\n if(curTime==t){\n //if(speed==v2) cout<>v1>>v2>>t>>d;\n ans=rec(v1,1,v1);\n cout<= 0; po--) {\n for (int pc = mc-cut; pc >= 0; pc--) {\n int lim = min( (mc-pc)/cut, (ops-po)/(toto+1) );\n\n int comb = (poss * 1ll * tt[ops][pc][po]) % mod;\n\n for (int hm = 1; hm <= lim; hm++) {\n int& dest = tt[ops][pc + cut*hm][po + (toto+1)*hm];\n dest = (dest + comb) % mod;\n\n comb = (comb * 1ll * (poss+hm)) % mod;\n comb = (comb * 1ll * inv[hm+1]) % mod;\n }\n }\n }\n }\n }\n\n for (int cut = ops; cut >= 0; cut--) {\n agg[ops][cut] = (tt[ops][cut][ops] + agg[ops][cut+1]) % mod;\n }\n }\n \n ps(tt[n][m-1][n]);\n}\n", "lang": "GNU C++17", "bug_code_uid": "48aafdbaca328f2ff6ad1a7f6a82ff42", "src_uid": "aca6148effff8b893c961b1ee465e4e4", "apr_id": "132edb2b32f7728c70ca9983cd3b260c", "difficulty": 2900, "tags": ["graphs", "dp", "flows", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.555366269165247, "equal_cnt": 10, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 10, "bug_source_code": "#define fi freopen(\"../../../../../Desktop/input.txt\", \"r\", stdin);\n#define fo freopen(\"../../../../../Desktop/output.txt\", \"w\", stdout)\n#define fio fi fo\n#define _CRT_SECURE_NO_WARNINGS\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\n#define max(a,b) (a>b?a:b)\n#define min(a,b) (a>b?b:a)\n#define INF 99999999 \ntypedef long long int ll;\nconst long long int N = 1000000000000005;\nint n;\nvector< ll >vi;\n\nvoid pre() {\t \n\tfor (int i = 1; i*8*1LL < N; i++)\n\t\tfor (int j = 2; i*j*j*j*1LL < N; j++)vi.push_back(i*(j*j*j*1LL));\n\tsort::iterator>(vi.begin(),vi.end());\n}\n\n\nint main()\n{\t\n\t//fio;\n\t\n\tpre();\n\tcin >> n;\n\t \n\t//for (int i = 0; i < vi.size(); i++)cout << vi[i] << \" \";\n\t//cout << \"d\";\n\tn--;\n\n\tif (n == 0)cout << vi[0];\n\telse {\n\n\t\tif (vi[n - 1] == vi[n] | vi[n] == vi[n + 1])cout << -1;\n\t\telse cout << vi[n];\n\n\t}\n\t//cin >> n;\n\treturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "d77255acec7c6d1b1c0f4891d8dae56d", "src_uid": "602deaad5c66e264997249457d555129", "apr_id": "73e5415377163cc575fdd55998613e25", "difficulty": 1700, "tags": ["math", "combinatorics", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8050490883590463, "equal_cnt": 18, "replace_cnt": 11, "delete_cnt": 5, "insert_cnt": 1, "fix_ops_cnt": 17, "bug_source_code": "// A. Keyboard.cpp : This file contains the 'main' function. Program execution begins and ends there.\n//\n\n#include \n#include \nusing namespace std;\nint main()\n{\n string s = \"qwertyuiop\", z = \"asdfghjkl;\", x = \"zxcvbnm,./\"; int c;\n char w; cin >> w;\n if (w == 'R')\n {\n c = -1;\n }\n else\n c = +1;\n\n\tstring k, m; cin >> k; int q = 0;\n\tfor (int i = 0; i < k.size(); i++)\n\t{\n\n\t\t{\n\t\t\tfor (int j = 0; j < s.size(); j++)\n\t\t\t{\n\t\t\t\tif (k[i] == s[j])\n\t\t\t\t{\n\t\t\t\t\tm[i] = s[j +c];\n\t\t\t\t\t\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n for (int f = 0; f < z.size(); f++)\n {\n if (k[i] == z[f])\n {\n // cout << k[i] << \" \" << s[j] << \"\\n\";\n m[i] = z[f + c];\n \n break;\n }\n }\n for (int d = 0; d < x.size(); d++)\n {\n if (k[i] == x[d])\n {\n m[i] = x[d + c];\n break;\n }\n }\n\n\t\t}\n \n \n\t}\n for(int i=0;i\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define Endl endl;\nusing namespace std;\ntypedef long long ll;\ntypedef long double ld;\nll n,m;\nvectorg;\nvectorh;\nll ans;\nmapt;\nint main(){\n ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);\n // ifstream fin(\"sight.in\");\n // ofstream fout(\"sight.out\");\n cin>>n>>m;\n g.push_back(0);\n h.push_back(0);\n int r=0,t=0;\n for(int i=3; i; i+=6){\n g.push_back(i);\n r++;\n if(r==m){\n break;\n }\n }\n for(int i=2; i; i+=2){\n if(i%3==0){\n continue;\n }\n h.push_back(i);\n t++;\n if(t==n){\n break;\n }\n }\n \n \n for(int i=6; ih[h.size()-1]){\n g.pop_back();\n }\n else{\n h.pop_back();\n }\n }\n \n cout<\n#define INF 9223372036854775807LL//18446744073709551615LL\nusing namespace std;\n long long int xx,yy,ax,ay,bx,by,xs,ys,t;\nvector< pair< long long, long long> >v;\n//map,int>mp;\nint size = 0;\nstruct node\n{\n\t long long x;\n\t long long y;\n\t long long t;\n\tint total;\n\tint mask;\n};\nint main()\n{\n\tscanf(\"%lld %lld %lld %lld %lld %lld\",&xx,&yy,&ax,&ay,&bx,&by);\n\tscanf(\"%lld %lld %lld\",&xs,&ys,&t);\n\tv.push_back(make_pair(xx,yy));\n\t//mp[make_pair(xx,yy)] = 0;\n\tint flag = -1;\n\tfor(int i=1;;i++)\n\t{\n\t\t long long x = v[i-1].first;\n\t\t long long y = v[i-1].second;\n\t\tif((INF-bx)/ax < x || (INF-by)/ay < y)\n\t\t\tbreak;\n\t\tv.push_back(make_pair(ax*x + bx, ay*y + by));\n\t\t//printf(\"%lld %lld\\n\",ax*x +bx , ay*y + by );\n\t\t//mp[make_pair(ax*x + bx, ay*y + by)] = i;\n\t\tif(ax*x + bx == xs && ay*y + by == ys )\n\t\t{\n\t\t\tflag = i;\n\t\t}\n\t\tsize++;\n\t}\n\tqueueq;\n\tif(flag == -1){\n\t\tq.push((node){xs,ys,0LL,0LL,0LL});\n\t}\n\telse\n\t{\n\t\tq.push((node){xs,ys,0LL,1LL,(1LL< t)\n\t\t\t\t\tcontinue;\n\t\t\t\t\n\t\t\t\tint newMask = (pp.mask | (1LL<\nusing namespace std;\n#define ll long long\n#define all(x) x.begin(),x.end()\nconst int N =1e4+5;\nll M =1e9+7;\nll po (ll x, ll p)\n{\n if(p==0)\n return 1;\n if(p%2==0)\n return po((x*x),p/2);\n else\n return (po(x,p-1)*x); \n}\nll dp[20][1<<20][2];\nstring s1,s2;\nint n;\nll rec(int idx,int msk,bool k)\n{\n if(idx ==n)\n return 0;\n ll & ret = dp[idx][msk][k];\n if(ret!=-1)\n return ret;\n ret =-1;\n ll tmp;\n for(int i =0;i s2[idx])\n {\n if(k)\n {\n tmp = rec(idx+1,msk| (1<>s1>>s2;\n sort(all(s1));\n n=s1.size();\n if(s1.size()\n\nusing namespace std;\n#define rep(i, a, b) for(int i = (a); i < (b); i++)\n#define repd(i, a, b) for(int i = (a); i > (b); i--)\n#define forRev(it, a) for(__typeof((a).rbegin()) it = (a).rbegin(); it != (a).rend(); it++)\n#define ll long long\n#define ld long double\n#define mk make_pair\n#define pb push_back\n#define sz(a) (int)(a).size()\n#define bc(n) __builtin_popcountll(n)\n\ntypedef vector vi;\ntypedef pair ii;\ntypedef pair iii;\ntypedef vector vii;\ntypedef vector viii;\n\nconst int N = 1000000 + 7;\nconst int M = 9;\nconst int inf = 1e9 + 7;\nconst long long linf = 1e18 + 7;\nconst double pi = acos(-1);\nconst double eps = 1e-7;\nconst bool multipleTest = 0;\n\nint lt[N], invlt[N];\n\nint inverse(int x, int n){\n int r = n, newr = x;\n int t = 0, newt = 1;\n while (newr > 0){\n int q = r / newr;\n \n int tmp = newr;\n newr = r % newr;\n r = tmp;\n \n tmp = newt;\n newt = t - q * newt;\n t = tmp;\n }\n if (t < 0) t += n;\n return t;\n}\n\nint C(int n, int k) {\n return (ll) lt[n] * invlt[n - k] % inf * invlt[k] % inf;\n}\n\nll pw(ll x, ll k) {\n if (!k) return 1;\n else if (k & 1) return pw(x, k - 1) * x % inf;\n ll tmp = pw(x, k / 2);\n return tmp * tmp % inf;\n}\n\n\nii extended_eclid(int a, int b) {\n int s0 = 1, t0 = 0;\n int s1 = 0, t1 = 1;\n while (b > 0) {\n int q = a / b;\n int tmp = 0;\n tmp = s1; s1 = s0 - q * s1; s0 = tmp;\n tmp = t1; t1 = t0 - q * t1; t0 = tmp;\n tmp = b; b = a - q * b; a = tmp;\n }\n return mk(s0, t0);\n}\n\nvoid init() {\n lt[0] = invlt[0] = 1;\n rep(i, 1, N) {\n lt[i] = (ll) lt[i - 1] * i % inf;\n invlt[i] = inverse(lt[i], inf);\n }\n}\n\nll dp[N][N];\n\nll F[N];\n\n\nvoid solve() {\n init();\n int n, m;\n cin >> n >> m;\n ll res = pw(2 * (n + 1), m) * (n + 1 - m) % inf * inverse(n + 1, inf) % inf;\n cout << res << '\\n';\n}\n\nint main() {\n#ifdef _LOCAL_\n freopen(\"in.txt\", \"r\", stdin);\n // freopen(\"out.txt\", \"w\", stdout);\n#endif\n \n int Test = 1;\n if (multipleTest) {\n cin >> Test;\n }\n for(int i = 0; i < Test; ++i) {\n solve();\n// test();\n }\n \n#ifdef _LOCAL_\n cout<<\"\\n\" << 1.0 * clock() / CLOCKS_PER_SEC <\n#define MAXN 50000050 \nusing namespace std;\nbool ok[MAXN];int su[MAXN];int tail=0,tail1=0;\nint p,y;\nint main()\n{\n\tscanf(\"%d%d\",&p,&y);\n\tfor(register int i=1;i<=y;i++)ok[i]=1;\n\tok[0]=ok[1]=0;tail=tail1=0;\n\tfor(register int i=2;i<=y;i++)\n\t{\n\t\tif(ok[i])su[tail++]=i;\n\t\tif(i<=p&&ok[i]){tail1++;}\n\t\tfor(register int j=0;j=0;i--)if(su[i]>p){ans=su[i];break;}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\t\n} \n", "lang": "GNU C++11", "bug_code_uid": "0539059238e8d3ff922caf02c0618cbe", "src_uid": "b533203f488fa4caf105f3f46dd5844d", "apr_id": "a243fa86dea60b5e5fd256c0c5487a5c", "difficulty": 1400, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9480069324090121, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include\nusing namespace std;\n\nconst int N=100100;\n\nbool isPrime(int a){\n for(int i=2;i<=ceil(sqrt(a));i++){\n if(a%i==0) return false;\n }\n return true;\n}\nint main(){\n int a[3000]={2},sz=1,ans=0;\n for(int i=3;i<=3000;i++)\n if(isPrime(i)) a[sz++]=i;\n int num,count=0,c;\n cin>>num;\nfor(int i=1;i<=num;i++){\n count=0;\n for(int j=0;i>=a[j];j++){\n if(i%a[j]==0) count++;\n if(count==3) break;\n }\n if(count==2) ans++;\n }\n cout<\n#define lld unsigned long long int\n#define vec vector\n#define pb push_back\n#define ss second\n#define ff first\n#define mp make_pair\n#define mod 1000000007\n#define messi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);\nusing namespace std;\nlld xyz(lld a, lld b)\n{\n lld ans=1;\n lld i;\n for(i=1;i<=b;i++)\n ans*=a;\n return ans;\n}\nint main() {messi\n \n lld n,m,k,i,j,p,q,x,y,ans=0,cnt=0;string s;bool flag=false;\n cin>>x>>y;\n\t\tvec r,l;\n\t\twhile(x>0){\n\t\t\tl.pb(x%2);\n\t\t\tx/=2;\n\t\t}\n\t\twhile(y>0){\n\t\t\tr.pb(y%2);\n\t\t\ty/=2;\n\t\t}\n\t\tif(r.size()>l.size()){\n\t\t\t\tans=1;\n\t\t\t\tfor(j=1;j<=r.size();j++){\n\t\t\t\t\tans*=2;\n\t\t\t\t}\n\t\t\t\tans--;\n\t\t\t}\n\t\telse{\n\t\t\tvec rr;\n\t\t\tfor(i=r.size()-1;i>=0;i--){\n\t\t\t\tif(flag==false){\n\t\t\t\t\tif(l[i]==1){\n\t\t\t\t\t\tif(r[i]==1)\n\t\t\t\t\t\t\trr.pb(0);\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\trr.pb(1);\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\trr.pb(1);\n\t\t\t\t\t\tflag=true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\trr.pb(1);\n\t\t\t}\n\t\t\tk=0;ans=0;\n\t\t\tfor(i=rr.size()-1;i>=0;i--){\n\t\t\t\tans+=rr[i]*xyz(2,k);\n\t\t\t\tk++;\n\t\t\t}\n\t\t}\n\t\tcout<\nusing namespace std;\n\nint main()\n{\n\tint w, b; cin >> w >> b;\n\tdouble ans = 0;\n\n\tvector > > v;\n\tpair > love;\n\tlove.first = 1; love.second.first = w; love.second.second = b;\n\tv.push_back(love);\n\n\tset p;\n\n\twhile(p.size() != v.size())\n\t{\n\t\t//cout << p.size() << ' ' << v.size() << '\\n';\n\t\tfor(int i = 0; i < v.size(); i++)\n\t\t\tif(p.find(i) == p.end())\n\t\t\t{\t\n\t\t\t\tdouble a = v[i].second.first;\n\t\t\t\tdouble b = v[i].second.second;\n\t\t\t\t//cout << a << ' ' << b << '\\n';\n\t\n\t\t\t\tif(a >= 1)\n\t\t\t\t{\t\n\t\t\t\t\tdouble aux = a/(a+b);\n\t\t\t\t\t//cout << ans << ' ' << v[i].first * \taux << '\\n';\n\t\t\t\t\tans += v[i].first * aux;\n\t\t\t\t}\n\n\t\t\t\tif(b-1 > 0)\n\t\t\t\t{\n\t\t\t\t\tdouble aux = b/(a+b);\n\t\t\t\t\tv[i].first *= aux;\n\t\t\t\t\tv[i].second.second--;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tp.insert(i);\n\t\t\t}\n\n\t\tint qtd = v.size();\n\t\tfor(int i = 0; i < qtd; i++)\n\t\t\tif(p.find(i) == p.end())\n\t\t\t{\n\t\t\t\tdouble a = v[i].second.first;\n\t\t\t\tdouble b = v[i].second.second;\n\n\t\t\t\tdouble aux = b/(a+b);\n\t\t\t\tv[i].first *= aux;\n\t\t\t\tdouble old = v[i].first;\n\n\n\t\t\t\tv[i].second.second -= 1; b-=1;\n\t\t\t\tif(v[i].second.second > 0)\n\t\t\t\t{\n\t\t\t\t\t//if(v[i].second.first == 5 && v[i].second.second == 1)\n\t\t\t\t\t\t//cout << \"hi\\n\";\n\t\t\t\t\taux = b/(a+b);\n\t\t\t\t\tv[i].first *= aux;\n\t\t\t\t\tv[i].second.second -= 1;\n\t\t\t\t\tif(v[i].second.second < 0)\n\t\t\t\t\t\tp.insert(i);\n\t\t\t\t}\n\t\t\t\telse if(v[i].second.second == 0)\n\t\t\t\t\tp.insert(i);\n\t\t\t\t\n\t\t\t\tif(v[i].second.first > 1)\n\t\t\t\t{\t\n\t\t\t\t\taux = a/(a+b);\n\t\t\t\t\told *= aux;\n\t\t\t\t\tlove.first = old;\n\t\t\t\t\tlove.second.first = v[i].second.first-1;\n\t\t\t\t\tlove.second.second = b;\n\t\t\t\t\tv.push_back(love);\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t}\n\t\n\t}\n\n\tprintf(\"%.9lf\\n\", ans);\n\n}\n", "lang": "GNU C++17", "bug_code_uid": "d1a54c56bf3a00b9e90d217064456fdc", "src_uid": "7adb8bf6879925955bf187c3d05fde8c", "apr_id": "27ebfc39b4368e57e485bda368e36009", "difficulty": 1800, "tags": ["math", "dp", "games", "probabilities"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9468455042225534, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "#include\n#include \n#include \n#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)\n#define max(a,b) (a>b?a:b)\n#define min(a,b) (a\n#define pb push_back\n#define ii pair\n#define vii vector\n#define si set\n#define msi map\n#define REP(i,a,b) for(int i=int(a);i<=int(b);i++)\n#define TRvi(c,it) for(vi::iterator it=(c).begin();it!=(c).end();it++)\n#define TRvii(c,it) for(vii::iterator it=(c).begin();it!=(c).end();it++)\n#define TRmsi(c,it) for(msi::iterator it=(c).begin();it!=(c).end();it++)\n \n \nusing namespace std;\n\nll power(ll a,ll b)\n{\n\tif(b==0)\n\t\treturn 1;\n\tll p=power(a,b/2);\n\tp*=p;\n\tif(b%2)\n\t\tp*=a;\n\treturn p;\n}\n\nint main()\n{\n IOS;\n #ifndef ONLINE_JUDGE\n // for getting input from input.txt\n freopen(\"input.txt\", \"r\", stdin);\n // for writing output to output.txt\n freopen(\"output.txt\", \"w\", stdout);\n #endif\n ll n,s;\n cin >> n >> s;\n int ind=0;\n if(n<=s)\n {\n \tcout << 0;\n \treturn 0;\n }\n \tll arr[19];\n \tll temp=n;\n while(ind<=18)\n {\n \tarr[ind]=temp%10;\n \ttemp/=10;\n \tind++;\n }\n ll pre[19];\n ll no[19];\n pre[0]=0;\n ll prev=0;\n \ttemp=s;\n REP(i,1,17)\n {\n \tprev*=10;\n \tprev+=9;\n \tno[i]=prev;\n \tpre[i]=prev*9+pre[i-1];\n }\n int flag=0;\n ll sum=0;\n for(int i=18;i>=0;i--)\n {\n \tif(i>0)\n \t{\n \t\tchar ch='n';\n\t \tREP(j,0,9)\n\t \t{\n\t \t\tif(temp-j*no[i]<=pre[i-1])\n\t \t\t{\n\t \t\t\tsum+=j*power(10,i);\n\t \t\t\ttemp-=j*no[i];\n\t \t\t\tch='y';\n\t \t\t\tbreak;\n\t \t\t}\n\t \t}\n\t \tif(ch=='n')\n\t \t{\n\t \t\tcout << 0;\n\t \t\treturn 0;\n\t \t}\n\t }\n\t else\n\t {\n\t \tif(temp>0)\n\t \t{\n\t \t\tcout << 0;\n\t \t\treturn 0;\n\t \t}\n\t }\n }\n \tcout << max(0,n-sum+1);\n}", "lang": "GNU C++14", "bug_code_uid": "d13f2c198900eda6b7d337ca77192ca9", "src_uid": "9704e2ac6a158d5ced8fd1dc1edb356b", "apr_id": "15adc6ecafa34c590634a14016170526", "difficulty": 1600, "tags": ["dp", "math", "brute force", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9342904472667035, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "/* \n AABRA KA DABRA.. !! \n*/\n#include \"bits/stdc++.h\"\nusing namespace std;\ntypedef long double ld;\n#define int long long\n#define RAGE ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);\n#define rep(i,n) for(i=0; i >ar[i][j];\n\n rep(i,4)\n {\n if(ar[i][3]==1)\n {\n if(!ar[i][0] && !ar[i][1] && !ar[i][2])\n {\n if(!ar[(i+2)%4][1] && !ar[(i+1)%4][0] && !ar[(i+3)%4][2])\n {\n cout<<\"NO\"; exit(0);\n }\n }\n }\n } \n cout<<\"YES\";\n} \nsigned main()\n{\n RAGE;\n #ifndef ONLINE_JUDGE\n freopen(\"input.txt\", \"r\", stdin);\n freopen(\"output.txt\", \"w\", stdout);\n #endif\n\n int t=1;\n // cin>>t;\n while(t--)\n solve();\n\n #ifndef ONLINE_JUDGE\n cout<<\"\\nTime Elapsed: \" << 1.0*clock() / CLOCKS_PER_SEC << \" sec\\n\";\n #endif\n return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "cdf3a1f14d4f3c658dea18d813dc9ffc", "src_uid": "44fdf71d56bef949ec83f00d17c29127", "apr_id": "90e2a7a2680e4403c79049fa86325c0d", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9340659340659341, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "#include\nusing namespace std;\ntemplate\nvoid rin(T &t)\n{t=0;int k=1;char c=getchar();while(!isdigit(c)){if(c=='-')k=-1;c=getchar();}while(isdigit(c)){t=t*10+c-'0';c=getchar();}t*=k;}\nconst int maxn=2e5+5;\nvectorg[maxn];\nint main()\n{\n\tint n,k,MAX=0;\n\tcin>>n>>k;\n\tint x;\n\tfor(int i=1;i<=n;i++)\n\t{\n\t\tcin>>x;\n\t\tif(x>MAX)MAX=x;\n\t\tint cnt=0;\n\t\twhile(x>=0)\n\t\t{\n\t\t\tg[x].push_back(cnt);\n\t\t\tx>>=1;\n\t\t\tcnt++;\n\t\t}\n\t}\n\tlong long ans=0;\n\tfor(int i=MAX;i>=0;i--)\n\tif(g[i].size()>=k)\n\t{\n\t\tsort(g[i].begin(),g[i].end());\n\t\tfor(int j=0;j\nusing namespace std;\nvector a;\nint n;\nint main()\n{\n cin >>n;\n for (int i = 1 ; i <= n; ++i)\n {\n if (i > 9)\n {\n while(i)\n {\n a.push_back(i%10);\n i/=10;\n }\n }\n else a.push_back(i);\n }\n sort(a.begin(),a.end());\n for (int i = 0 ; i < a.size() ; ++i)\n {\n if (i == n-1)\n {\n cout << ++i << endl;\n break;\n }\n\n }\nreturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "7e928a781f86b80fc35652a5941c6203", "src_uid": "2d46e34839261eda822f0c23c6e19121", "apr_id": "e927011790d2b641a4758db6d7fc2894", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8036529680365296, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "#include \n#include \nusing namespace std;\nint main(void)\n{\n int n;\n int a[100];\n scanf(\"%d\",&n);\n for (int i=0;i\n\nusing namespace std;\n\nconst int maxN = 1e5+5;\nint n, a[maxN];\n\nint main(){\n //freopen(\"input.txt\", \"r\", stdin);\n cin>>n;\n for(int i = 0; i < n; i++){\n cin>>a[i];\n }\n sort(a, a + n);\n for(int i = 0; i < 3e8; i++){\n a[i%n] = 10;\n }\n\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "d679d179d3d581c39841454e211b09ab", "src_uid": "29e481abfa9ad1f18e6157c9e833f16e", "apr_id": "f43d9b71e968b70a67463840b537a5a5", "difficulty": 1900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.2197514715500327, "equal_cnt": 18, "replace_cnt": 9, "delete_cnt": 4, "insert_cnt": 5, "fix_ops_cnt": 18, "bug_source_code": "#include \n#include \nusing namespace std;\n\nvector< pair< pair< int, int >, int > > dis;\npair< pair< int, int >, int > x;\nint n;\n\nvoid dfs( pair< int, int >, int );\n\nint main()\n{\n cin >> n;\n pair< int, int > p;\n p.first = 1;\n p.second = 1;\n dfs( p, 0 );\n unsigned min = -1;\n for( unsigned i = 0; i < dis.size(); i++ )\n if( dis[i].first.first == n || dis[i].first.second == n )\n if( dis[i].second < min )\n min = dis[i].second;\n cout << min << endl;\n return 0;\n}\n\nvoid dfs( pair< int, int > p, int d )\n{\n x.first = p;\n x.second = d;\n dis.push_back( x );\n if( p.first > n || p.second > n )\n return;\n p.first += p.second;\n dfs( p, d + 1 );\n p.first -= p.second;\n p.second += p.first;\n dfs( p, d + 1 );\n}", "lang": "GNU C++", "bug_code_uid": "721af7de32b1ef25eaafd673a2dfdd3e", "src_uid": "75739f77378b21c331b46b1427226fa1", "apr_id": "7e9cdd8533c26ed7ce7eb40bcd58b0e4", "difficulty": 1900, "tags": ["brute force", "math", "dfs and similar", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9710238248551192, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#pragma GCC optimize(3,\"Ofast\",\"inline\")\n#include\nusing namespace std;\ntypedef long long ll;\nbool Finish_read;\ntemplateinline void read(T &x){Finish_read=0;x=0;int f=1;char ch=getchar();while(!isdigit(ch)){if(ch=='-')f=-1;if(ch==EOF)return;ch=getchar();}while(isdigit(ch))x=x*10+ch-'0',ch=getchar();x*=f;Finish_read=1;}\ntemplateinline void print(T x){if(x/10!=0)print(x/10);putchar(x%10+'0');}\ntemplateinline void writeln(T x){if(x<0)putchar('-');x=abs(x);print(x);putchar('\\n');}\ntemplateinline void write(T x){if(x<0)putchar('-');x=abs(x);print(x);}\n/*================Header Template==============*/\nint n,a[15];\nint main() {\n\tread(n);\n\tfor(int i=1;i<=n;++i)\n\t\tread(a[i]);\n\tsort(a+1,a+n+1);\n\tprintf(\"%d\\n\",2+(a[1]^a[3]));\n}", "lang": "GNU C++14", "bug_code_uid": "21b1ec725da72f8ad02e63438b1a0d9a", "src_uid": "a9eb85dfaa3c50ed488d41da4f29c697", "apr_id": "1ec34f395f96b989aed19a6cf37a568f", "difficulty": null, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8173913043478261, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "#include\n#define ll long long\n#define ios ios_base::sync_with_stdio(false)\n#define pii pair\n#define fs first\n#define sc second\n\nusing namespace std;\n\nconst ll INF=(1ll<<62)-1;\nconst int M=1e5+5;\n\nll s,s1;\nint ar[101];\n int main()\n {\n ios;\n int n,ans;\n cin>>n;\n for(int i=0;i>ar[i];\n s+=ar[i];\n }\n sort(ar,ar+n);\n\n int m=ar[n-1];\n\n for(int i=m;;i++)\n {\n for(int j=0;j=s)\n {\n ans=i;\n break;\n }\n }\n\n cout<\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\nconst int mod = 1000000007;\nint ca[2000009];\nint powe(int x)\n{\n\tint tmp=2ll,res=1ll;\n\twhile(x)\n\t{\n\t\tif(x&1){\n\t\t\tres=(res*tmp)%mod;\n\t\t}tmp=(tmp*tmp)%mod;\n\t\tx>>=1;\n\t}return res;\n}\nint cal(int k)\n{\n\tif(k==1||k==2) return 1;\n\telse if(k<=2000008&&ca[k]) return ca[k];\n\tint ans=(int)powe(k-1)-1;\n\tfor(register int i=2;i<=sqrt(k);i++)\n\t{\n\t\tif(k%i==0){\n\t\t\tans-=cal(k/i);\n\t\t\tans+=mod;\n\t\t\tif(i*i!=k){\n\t\t\t\tans-=cal(i);\n\t\t\t\tans+=mod;\n\t\t\t}\n\t\t\tans%=mod;\n\t\t}\n\t}\n\treturn ca[k]=ans;\n}\nint x,y;\nint main()\n{\n//\tfreopen(\"seq.in\",\"r\",stdin);\tfreopen(\"seq.out\",\"w\",stdout);\n\tios::sync_with_stdio(0);\n\tcin>>x>>y;\n\tca[1]=1;\n\tca[2]=1;\n\tif(y%x){\n\t\tcout<<0;\n\t\treturn 0;\n\t}\n\tcout<\n#include \n#include \n\nusing namespace std;\n\nconst int MAXK = 2005;\nconst int MAXT = 205;\nconst int mod = 1000000007;\n\nint dp[2][MAXK*MAXT];\nint cum[MAXK*MAXT];\n\nint k,t;\nint a,b;\n\nint main(){\n\tscanf(\"%d %d %d %d\",&a, &b, &k, &t);\n\tfor(int i = 0; i<=(4*k*t); i++) dp[0][i] = 0;\n\tdp[0][2*k*t] = 1;\n\tfor(int j = 0; j<=4*k*t; j++) dp[0][j] += dp[0][j-1];\n\tfor(int i = 1; i<=2*t; i++){\n\t\tfor(int j = 0; j<=4*k*t; j++){\n\t\t\tdp[i%2][j] = ((j!=0?dp[i%2][j-1]:0) + dp[(i+1)%2][min(j+k,4*k*t)] - (max(j-k,0)!=0?dp[(i+1)%2][max(j-k,0)-1]:0))%mod;\n\t\t}\n\t}\n\tint req = 2*t*k - (a - b);\n\tint ans;\n\tif(req>4*k*t) ans = 0;\n\telse ans = (dp[0][4*k*t] - dp[0][max(0,min(4*k*t,req))])%mod;\n\tif(ans<0) ans += mod;\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "6ff2d06e7b360085acabb05081b83f6e", "src_uid": "8b8327512a318a5b5afd531ff7223bd0", "apr_id": "9503641b86da04e399253a8ddab362af", "difficulty": 2200, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9859778597785978, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include \n#include \nusing namespace std;\n\nint main()\n{\n int k;\n cin>>k;\n int i,j;\n string s1 = \"|#.#.#.#.#.#.#.#.#.#.#.|D|)\";\n string s2 =\"|#.#.#.#.#.#.#.#.#.#.#.|.|\";\n string s3 = \"|#.......................|\";\n string s4 = \"|#.#.#.#.#.#.#.#.#.#.#.|.|)\";\n if(k>=3) s3[1] = 'O';\n k--;\n i=1;\n while(k>=0)\n {\n if(k>0) {s1[i] = 'O'; k--;}\n if(k>0) {s2[i] = 'O'; k--;}\n if(k>0) {s4[i] = 'O'; k--;}\n i+=2;\n }\n\n cout<<\"+------------------------+\"<\n\nusing namespace std;\n\nint main()\n{\n long long n,c=0,k=1;\n unordered_set st;\n cin>>n;\n if(n%2!=0 || n<=4)\n {\n cout<<\"0\";\n return 0;\n }\n n=n/2;\n n--;\n while(k!=n)\n {\n if(st.find(k)!=st.end() || st.find(n)!=st.end())\n break;\n if(st.find(k)==st.end() && st.find(n)==st.end())\n {st.insert(k);\n st.insert(n);\n }\n k++;\n n--;\n }\n cout<\n\nusing namespace std;\n\nint main()\n{\n int a,b[5],c[5],contb=0,contc=0;\n cin >> a;\n for(int i=0;i> b[i];\n }\n for(int i=0;i> c[i];\n }\n for(int i=0;i\nusing namespace std;\ntypedef long long int Int;\nint main(){\nInt n,k;\ncin>>n>>k;\nif(k==1){\n cout< m;\nInt ans=n;\nInt mans=n;\nInt selected=1;\nInt bit=0;\nInt temp=ans;\nm[n]=1;\nwhile(temp>0){\n temp=temp>>1;\n bit++;\n}\nbit=bit-2;\nInt last=n-1;\nwhile(selected=0&&((temp>>bit)&1)==1){\n bit--;\n temp=ans;\n}\nif(bit>=0){\n bool done=false;\n while(!done){\n if(bit>=0){\n while(last>0&&(m[last]==1||((last>>bit)&1==0))){\n last--;\n }\n if(last>0){\n ans=ans^last;\n if(ans>mans){\n mans=max(ans,mans);\n last--;\n done=true;\n selected++;\n m[last]=1;\n last=n-1;\n bit--;\n }else{\n ans=mans;\n last--;\n }\n }else{\n last=n-1;\n bit--;\n }\n }else{\n cout<\n#define INF 0x3f3f3f3f\n#define ms(x,y) memset(x,y,sizeof(x))\nusing namespace std;\n\ntypedef long long ll;\n\nconst double pi = acos(-1.0);\nconst int mod = 1e9 + 7;\nconst int maxn = 1e5 + 5;\n\nbool flag = 0;\n\nvoid step1(int &a,int &b);\nvoid step2(int &a,int &b);\nvoid step3(int &a,int &b);\n\n\n\nvoid step1(int &a,int &b)\n{\n\tif(flag) return;\n\tif(a==0||b==0)\n\t{\n\t\tflag =1;\n\t\treturn;\n\t}\n\tstep2(a,b);\n}\n\nvoid step2(int &a,int &b)\n{\n\tif(flag) return;\n\tif(a>=2*b)\n\t{\n\t\ta-=2*b;\n\t\tstep1(a,b);\n\t}\n\telse\n\t\tstep3(a,b);\n}\n\nvoid step3(int &a,int &b)\n{\n\tif(flag) return;\n\tif(b>=2*a)\n\t{\n\t\tb-=2*a;\n\t\tstep1(a,b);\n\t}\n\telse\n\t\tflag=1;\n}\n\nint main()\n{\n\t//freopen(\"in.txt\",\"r\",stdin);\n\t//freopen(\"out.txt\",\"w\",stdout);\n\tint a,b;\n\tcin>>a>>b;\n\tstep1(a,b);\n\tcout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define N 301\n#define inf 0XFFFFFFF\n#define mod 1000000007\n#define ll long long\nusing namespace std;\n\n//ofstream fo(\"out.txt\");\n//ifstream fi(\"in.txt\");\n//#define cout cout\n//#define cin fi\n\nint n,a[10],s[10];\nll c[N][N];\nll dfs(int n,int now)\n{\n ll ans=0;\n if(now>=1&&s[9]-s[now-1]>n)return 0;\n if(now==0&&s[9]>n) return 0;\n if(now==9)\n {\n return 1;\n }\n else if(now!=0)\n {\n for(int i=a[now];i<=n-s[9]+s[now];i++)\n {\n ans+=c[i+n-i+1-1][n-i+1-1]*dfs(n-i,now+1);\n if(ans>=mod)ans%=mod;\n }\n return ans;\n }\n else\n {\n for(int i=a[now];i<=n-s[9]+s[now];i++)\n {\n ans+=c[i+n-i-1][n-i-1]*dfs(n-i,now+1);\n if(ans>=mod) ans%=mod;\n }\n }\n return ans;\n}\nint main()\n{\n int i,j;\n cin>>n;\n for(i=0;i<10;i++)\n cin>>a[i];\n for(i=0;i=mod)c[i][j]%=mod;\n }\n }\n s[0]=a[0];\n for(i=1;i<10;i++)\n s[i]=s[i-1]+a[i];\n long long ans=0;\n for(i=s[9];i<=n;i++)\n {\n ans+=dfs(i,0);\n if(ans>=mod) ans%=mod;\n }\n cout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\nint bitct(long long r) {return r == 0 ? 0 : (bitct(r>>1) + (r&1));}\nlong long gcd(long long x, long long y) {return x ? gcd(y%x,x) : y;}\ntemplate ostream& operator << (ostream &o,vector v) {o<<\"{\";\n\tint i=0,s=v.size();for(;i+1 ostream& operator << (ostream &o,\n unordered_map m) {o<<\"{\";for(auto i=m.begin();i!=m.end();++i)\n o<first<<\" -> \"<< i->second << \", \"; o<<\"}\";return o;}\n */\nlong long choose(long long n, long long q)\n{ if(n==0 || q==0) return 1;\n\tif (q==1) return n; else return ( choose(n, q-1) * (n-q+1 ) /q); }\nint dx[4] = {1,0,-1,0};\nint dy[4] = {0,1,0,-1};\n\nmain() {\n long long h;\n cin >> h;\n :wq\n\n\tint N;\n\tcin >> N;\n int ct=0;\n for(int i=1;i<=N;i++)\n for(int j=i;j<=N;j++)\n {\n int c2 = i*i+j*j;\n double c2d = sqrt(c2);\n int test=(int) (c2d + 0.0001);\n if(test*test==c2 && test <= N)\n {\n ct++;\n }\n }\n\t\t\tcout << ct << endl;\n\n}\n\n", "lang": "GNU C++0x", "bug_code_uid": "0e83a4e900159d79265c9fc96f1db337", "src_uid": "03c4df4f640633f3364ca9225588caf7", "apr_id": "f32fd1c01f5e68136c31fe9408afb2a5", "difficulty": 2500, "tags": ["graphs", "data structures", "shortest paths"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9994504890647324, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#include \n\n#if __cplusplus >= 201103L\n#include \n#include \n#include \n#include \n#include \n#include \n#endif\nusing namespace std;\n\ntypedef long long int64;\nconst int inf = 2000000000;\nstatic inline int Rint()\n{\n\tstruct X{ int dig[256]; X(){\n\tfor(int i = '0'; i <= '9'; ++i) dig[i] = 1; dig['-'] = 1;\n\t}};\n\tstatic \tX fuck;int s = 1, v = 0, c;\n\tfor (;!fuck.dig[c = getchar()];);\n\tif (c == '-') s = 0; else if (fuck.dig[c]) v = c ^ 48;\n\tfor (;fuck.dig[c = getchar()]; v = v * 10 + (c ^ 48));\n\treturn s ? v : -v;\n}\ntypedef vector vi;\ntypedef map mii;\ntypedef set si;\n\n#define all(x) (x).begin(), (x).end()\n#define pb push_back\n#define mp make_pair\n#define sz(x) ((int)(x).size())\n#define rep(i, s, e) for (int i = (s); i < (e); ++i)\n\n#if __cplusplus >= 201103L\n#define foreach(iter, c) for(auto& iter : c)\n#else\n#define foreach(itr, c) for(__typeof((c).begin()) itr = (c).begin(); itr != (c).end(); ++itr)\n#endif\n\ntemplate static inline void cmax(T& a, const T& b){if(b>a)a=b;}\ntemplate static inline void cmin(T& a, const T& b){if(b o.p;\n\t\treturn id < o.id;\n\t}\n};\n\nvoid fix(priority_queue& pq)\n{\n\tset > st;\n\t\n\tfor (int i = 0; i < k; ++i)\n\tif (D[i] != -1)\n\tst.insert({D[i], i});\n\t\n\twhile (!st.empty())\n\t{\n\t\tauto where = st.begin();\n\t\tauto curr = *where;\n\t\tst.erase(where);\n\t\tif (D[curr.second] != curr.first) continue;\n\t\tfor (int i = 0; i < top; ++i)\n\t\t{\n\t\t\tint64 val = curr.first\n\t\t\tfor (int coe = 0; coe < 3; ++coe)\n\t\t\t{\n\t\t\t\tval += allk[i];\n\t\t\t\tif (val > h) continue;\n\t\t\t\t\n\t\t\t\tint next = val % k;\n\t\t\t\t\n\t\t\t\tif (next == curr.second)\n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (D[next] == -1)\n\t\t\t\t{\n\t\t\t\t\tD[next] = val;\n\t\t\t\t\tst.insert({D[next], next});\n\t\t\t\t}\n\t\t\t\telse if (D[next] > val)\n\t\t\t\t{\n\t\t\t\t\tD[next] = val;\n\t\t\t\t\tst.insert({D[next], next});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\tfor (int i = 1; i <= n; ++i) if (flag[i] == 0)\n\t{\n\t\tconst int bucket = pos[i] % k;\n\t\tif (D[bucket] != -1)\n\t\t{\n\t\t\tif (pos[i] >= D[bucket])\n\t\t\t{\n\t\t\t\tpq.push({treasure[i], pos[i], i});\n\t\t\t\tflag[i] = 1;\n\t\t\t}\n\t\t}\n\t}\n}\n\nint main()\n{\n\tscanf(\"%I64d\", &h);\n\tn = Rint(), m = Rint(), k = Rint();\n\t\n\tfor (int i = 1; i <= n; ++i)\n\tscanf(\"%I64d %d\", pos+i, treasure+i);\n\t\n\tmemset(D, -1, sizeof D);\n\tD[1%k] = 1;\n\t\n\tpriority_queue pq;\n\t\n\tfor (int i = 1; i <= n; ++i)\n\t{\n\t\tconst int bucket = pos[i] % k;\n\t\tif (D[bucket] != -1)\n\t\t{\n\t\t\tif (pos[i] >= D[bucket])\n\t\t\t{\n\t\t\t\tpq.push({treasure[i], pos[i], i});\n\t\t\t\tflag[i] = 1;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tfor (int id = 0; id < m; ++id)\n\t{\n\t\tconst int cmd = Rint();\n\t\tif (cmd == 3)\n\t\t{\n\t\t\twhile (!pq.empty())\n\t\t\t{\n\t\t\t\tauto curr = pq.top();\n\t\t\t\tif (treasure[curr.id] != curr.t)\n\t\t\t\t{\n\t\t\t\t\tpq.pop();\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tint64 ans = 0;\n\t\t\tif (!pq.empty())\n\t\t\t{\n\t\t\t\tans = pq.top().t;\n\t\t\t\ttreasure[pq.top().id] = -1;\n\t\t\t\tflag[pq.top().id] = 2;\n\t\t\t\t//dbg(pq.top().id);\n\t\t\t\t//dbg(pq.top().p);\n\t\t\t\tpq.pop();\n\t\t\t}\n\t\t\tprintf(\"%I64d\\n\", ans);\n\t\t}\n\t\telse if (cmd == 2)\n\t\t{\n\t\t\tconst int x = Rint();\n\t\t\tconst int c = Rint();\n\t\t\ttreasure[x] -= c;\n\t\t\tif (c != 0 && flag[x])\n\t\t\t{\n\t\t\t\t//assert(flag[x] == 1);\n\t\t\t\tif (flag[x] == 1)\n\t\t\t\t{\n\t\t\t\t\tpq.push({treasure[x], pos[x], x});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tint64 x; scanf(\"%I64d\", &x);\n\t\t\tint ok = 1;\n\t\t\t//for (int i = 0; i < top; ++i)\n\t\t\t//if (x % allk[i] == 0) ok = 0;\n\t\t\t//if (x % k == 0) ok = 0;\n\t\t\tif (ok)\n\t\t\t{\n\t\t\t\tallk[top++] = x;\n\t\t\t\tfix(pq);\n\t\t\t\t#if 0\n\t\t\t\tfor (int i = 1; i <= n; ++i)\n\t\t\t\tif (flag[i])\n\t\t\t\tcerr << pos[i] << \" \" << treasure[i] << endl;\n\t\t\t\tcerr << endl;\n\t\t\t\t\n\t\t\t\tfor (int i = 0; i < k; ++i)\n\t\t\t\tcerr << i << \" \" << D[i] << endl;\n\t\t\t\tcerr << endl;\n\t\t\t\t#endif\n\t\t\t}\n\t\t}\n\t}\n\t\n\treturn 0;\n}", "lang": "GNU C++0x", "bug_code_uid": "3d6dc1d053ed863358ca0a7beb352bd2", "src_uid": "03c4df4f640633f3364ca9225588caf7", "apr_id": "a2d57683fdd3015ca7269b0c11f0b7af", "difficulty": 2500, "tags": ["graphs", "data structures", "shortest paths"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.6836438923395445, "equal_cnt": 62, "replace_cnt": 15, "delete_cnt": 0, "insert_cnt": 47, "fix_ops_cnt": 62, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n#define pb push_back\n#define INF 1001001001\n#define FOR(i,n) for(int (i)=0;(i)<(n);++(i))\n#define FORI(i,n) for(int (i)=1;(i)<=(n);++(i))\n#define mp make_pair\n#define pii pair\n#define ll long long\n#define vi vector\n#define SZ(x) ((int)((x).size()))\n#define fi first\n#define se second\n#define wez(n) int (n); scanf(\"%d\",&(n));\n#define wez2(n,m) int (n),(m); scanf(\"%d %d\",&(n),&(m));\n#define wez3(n,m,k) int (n),(m),(k); scanf(\"%d %d %d\",&(n),&(m),&(k));\ninline void pisz(int n) { printf(\"%d\\n\",n); }\ntemplate ostream& operator<<(ostream &s,pair t) {return s<<\"(\"< ostream& operator<<(ostream &s,vector t){FOR(i,SZ(t))s<=(b);--i)\n#define REMAX(a,b) (a)=max((a),(b));\n#define REMIN(a,b) (a)=min((a),(b));\n#define IOS ios_base::sync_with_stdio(0);\n\nconst ll P=1000000007;\nll dp[1042][1042];\n\nint main()\n{\n wez2(n,k);\n for(int i=1;i<=n;i++)\n dp[1][i]=n/i;\n for(int i=2;i<=n;i++)\n {\n for(int j=1;j<=n;j++)\n {\n dp[i][j]=0;\n for(int k=j;k<=n;k+=j)\n dp[i][j]+=dp[i-1][k]; \n dp[i][j]=dp[i][j]%P;\n } \n }\n /*for(int i=1;i<=10;i++)\n {\n for(int j=0;j<=10;j++)cout<\n#define ll long long\nusing namespace std;\nchar str[100010],h[100010],m[100010];\nll int mh,mm,lh,lm;\nll int priority(char c)\n{\n\tif(c>='0' && c<='9')\n\treturn c-'0';\n\treturn ((c-'A') +10);\n}\nvoid find_time(ll int r)\n{\n\tll int i,p=1;\n\tfor(i=(lh-1);i>=0;i--)\n\t{\n\t\tmh+=p*priority(h[i]);\n\t\tp*=r;\n\t\t//~ cout<=0;i--)\n\t{\n\t\tmm+=p*priority(m[i]);\n\t\tp*=r;\n\t}\n}\nint main()\n{\n\tios_base::sync_with_stdio(false);\n\tcin.tie(NULL);\n\tscanf(\"%s\",str);\n\tll int i,j,mymax;\n\t//~ int x,y;\n\t//~ sscanf(str,\"%d:%d\",&x,&y);\n\t//~ cout<=0;i--)\n\t{\n\t\tif(i<(lh-1) && h[i]!='0')\n\t\tuh=1;\n\t\tif(h[i]!='0')\n\t\tall=0;\n\t}\n\tfor(i=(lm-1);i>=0;i--)\n\t{\n\t\tif(i<(lm-1) && m[i]!='0')\n\t\tum=1;\n\t\tif(m[i]!='0')\n\t\tall=0;\n\t}\n\tif(all)\n\t{\n\t\tcout<<-1< r;\n\t\tfor(i=0;i\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n\n//containers\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n\n//IOs\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n\n//algorithm & miscellaneous\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n\n/* ****************************************************************** */\n// \\_/\\_/\\_/\\_/\\_/\\_/\\_/---Frequently used macros---\\_/\\_/\\_/\\_/\\_/\\_/\\_/\n/* ****************************************************************** */\n\n#define MOD 1000000007\n#define INF 1000000000\n\n/* ****************************************************************** */\n// \\_/\\_/\\_/\\_/\\_/\\_/\\_/\\_/\\_/---Shorthands---\\_/\\_/\\_/\\_/\\_/\\_/\\_/\\_/\\_/\n/* ****************************************************************** */\n\n#define ll long long\n#define F first\n#define S second\n#define pb push_back\n\n#define SZ(c) (c).size()\n#define reset(x) memset((x),0,sizeof(x));\n#define negset(x) memset((x),-1,sizeof(x));\n#define set(x) memset((x),1,sizeof(x));\n\n#define ALL(x) (x).begin(),(x).end()\n#define SORT(x) sort(ALL(x))\n#define REVERSE(c) reverse(ALL(c))\n\n#define FOR(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)\n#define REP(i,n) FOR(i,0,(n-1))\n\n#define FORD(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)\n#define REPD(i,n) FOR(i,(n-1),0)\n\n\n#define tst int t;scanf(\"%d\",&t);while(t--)\n#define s(x) scanf(\"%d\",&x)\n#define sl(x) scanf(\"%lld\",&x)\n#define ss(x) scanf(\"%s\",x)\n\n#define p(x) printf(\"%d\",x)\n#define pl(x) printf(\"%lld\",x)\n#define ps(x) printf(\"%s\",x)\n\n#define pn(x) printf(\"%d\\n\",x)\n#define pln(x) printf(\"%lld\\n\",x)\n#define psn(x) printf(\"%s\\n\",x)\n\n#define sp system(\"PAUSE\")\n\n/* ****************************************************************** */\n// \\_/\\_/\\_/\\_/\\_/---Fast IO using getchar_unlocked---\\_/\\_/\\_/\\_/\\_/\n/* ****************************************************************** */\n/*\nint gi(){\n int c = 'a';\n while (!(c >= '0' && c <= '9') && c != '-') c = getchar_unlocked();//();//\n int c2;\n if (c != '-')\n c2 = c;\n else\n c2 = '0';\n int res = 0;\n while((c2 >= '0' && c2 <= '9')){\n res = (res << 3) + (res << 1) + (c2 - '0');\n c2 = getchar_unlocked();//();//\n }\n return res * (c == '-' ? -1 : 1);\n}\n*/\nusing namespace std;\n/* ****************************************************************** */\n// \\_/\\_/\\_/\\_/\\_/\\_/---Actual Code Starts Here---\\_/\\_/\\_/\\_/\\_/\\_/\n/* ****************************************************************** */\nint n,m,k;\nbool fact(){\n if(k==1 && m>1)return true;\n int s=int(sqrt(m));\n if(s<=k){\n for(int i=2;i<=m/k;i++)\n if(m%i==0)return true;\n }\n else{\n for(int i=2;i<=k;i++)\n if(m%i==0)return true;\n }\n return false;\n}\nint main(){\n s(n);s(m);s(k);\n if(n&1 && fact())cout<<\"Timur\";\n else cout<<\"Marsel\";\n//sp;\n return 0;\n}\n\n", "lang": "GNU C++", "bug_code_uid": "fdc7099133692b3920c4452d84977459", "src_uid": "4a3767011ddac874efa021fff7c94432", "apr_id": "18d6d1718480fa17b7ddc17bbdf0bb31", "difficulty": 2000, "tags": ["dp", "games", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.4208523592085236, "equal_cnt": 25, "replace_cnt": 15, "delete_cnt": 0, "insert_cnt": 9, "fix_ops_cnt": 24, "bug_source_code": "#include \nusing namespace std;\n#define maxn 2500\n#define int long long\nint n, P, L, R, ans, C[maxn][maxn]; \n\nint read()\n{\n\tint x = 0, k = 1;\n\tchar c; c = getchar();\n\twhile(c < '0' || c > '9') { if(c == '-') k = -1; c = getchar(); }\n\twhile(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();\n\treturn x * k;\n}\n\nvoid Up(int &x, int y) { x = (x + y) % P; if(x < 0) x += P; }\nvoid Pre()\n{\n\tfor(int i = 0; i < maxn; i ++) C[i][0] = 1;\n\tfor(int i = 1; i < maxn; i ++)\n\t\tfor(int j = 1; j < maxn; j ++)\n\t\t\tC[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % P;\n}\n\nsigned main()\n{\n\tn = read(), P = read(), L = read(), R = read();\n\tPre();\n\tfor(int i = 0; i <= n; i ++)\n\t{\n\t\tif(L > i || R < 0) continue;\n\t\tint l = max(L, 0), r = min(i, R);\n\t\tfor(int k = l; k <= r; k ++)\n\t\t\tUp(ans, C[n][i] * C[n - i][i - k] % P),\n\t\t\tUp(ans, P - C[n][i] * C[n - i][i - k - 2] % P);\n\t}\n\tprintf(\"%I64d\\n\", ans);\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "30c3db327469c5b969cb89e978fdfd09", "src_uid": "6ddc487029785738679007443fc08463", "apr_id": "214eff37816fb44d55f26fc93bf56d9d", "difficulty": 2900, "tags": ["chinese remainder theorem", "math", "combinatorics", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9441340782122905, "equal_cnt": 14, "replace_cnt": 7, "delete_cnt": 6, "insert_cnt": 0, "fix_ops_cnt": 13, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\nstring palabra;\ndouble arreglo[3];\nint menor()\n{\n\tfor(int i=0;i<4;i++)\n\t{\n\t\tfor(int j=1;j<4;j++)\n\t\t{\n\t\t\tint k = (i+j)%4;\n\t\t\tif(arreglo[i]*2>arreglo[k])\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(j==3)\n\t\t\t{\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t}\n\treturn -1;\n}\nint mayor()\n{\n\tfor(int i=0;i<4;i++)\n\t{\n\t\tfor(int j=1;j<4;j++)\n\t\t{\n\t\t\tint k = (i+j)%4;\n\t\t\tif(arreglo[i]>palabra;\n\t\tarreglo[0] = palabra.size()-2;\n\t\tcin>>palabra;\n\t\tarreglo[1] = palabra.size()-2;\n\t\tcin>>palabra;\n\t\tarreglo[2] = palabra.size()-2;\n\t\tcin>>palabra;\n\t\tarreglo[3] = palabra.size()-2;\n\t\tchar a = conv(mayor());\n\t\tchar b = conv(menor());\n\t\tif(a!='E' and b=='E')\n\t\t{\n\t\t\tcout<\n#include\nusing namespace std;\nint main()\n{\nint a , b ,c ,p,h=0,arra[20]={ 0 },arrb[20]={ 0 };\ncin>>a>>b;\np=0;\nint i=a;\nint sizea=0,sizeb=0;\nwhile(i){\nif(i%10 > p) p=i%10;\narra[sizea++]=i%10;\ni/=10;\n}\ni=b;\nwhile(i){\nif(i%10 > p) p=i%10;\narrb[sizeb++]=i%10;\ni/=10;\n}\nint carry=0;\np++;\nfor(i=0; i< max(sizea,sizeb); ++i){\ncarry=(arra[i]+arrb[i]+carry)%p;\nh++;\n}\nif(carry>0) h++;\ncout<\nusing namespace std;\ntemplate inline void read(T &s)\n{\n\ts = 0;char ch = getchar();\n\twhile(!isdigit(ch)) ch = getchar();\n\twhile(isdigit(ch)) s = ((s+(s<<2))<<1)+ch-'0',ch = getchar(); \n}\nint m,a,b,ans[310000];\nbool vis[310000];\nlong long Sum,now;\nqueue Q;\ninline void BFS(int now)\n{\n\tQ.push(now);\n\twhile(!Q.empty())\n\t{\n\t\tint k = Q.front();Q.pop(),ans[now]++;\n\t\tif(k-b >= 0 && !vis[k-b]) vis[k-b] = 1,Q.push(k-b);\n\t\tif(k+a<=now && !vis[k+a]) vis[k+a] = 1,Q.push(k+a);\n\t}\n}\nint main()\n{\n\tread(m),read(a),read(b),ans[0] = vis[0] = 1;\n\tfor(int i = 0,t;i= 0 && vis[i-a]) vis[i] = 1,ans[i] = ans[i-1],BFS(i);\n\t\telse ans[i] = ans[i-1];\n\tfor(int i = 0;i<=min(2*a+b,m);++i) Sum += ans[i];\n\tif(2*a + b >= m) {printf(\"%lld\\n\",Sum);return 0;}\n\tfor(int i = 2*a+b+1,N,L,R;i<=a*3+b;++i) if(vis[i%a]) L = (i-i%a)/a,R = (m-i%a)/a,Sum += 1ll * a * (1+(R-L+1)) * (R-L+1) / 2;\n\tSum += 1ll*ans[2*a+b] * (m - (2*a+b));\n\tprintf(\"%lld\\n\",Sum);\n\treturn 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "42fcc1d1a122bf7f245357c2b8819af7", "src_uid": "d6290b69eddfcf5f131cc9e612ccab76", "apr_id": "efaed529a1cdf1294b90941f93f5f26a", "difficulty": 2100, "tags": ["math", "dfs and similar", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.3138231631382316, "equal_cnt": 13, "replace_cnt": 11, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "#include\n#define FOR(i,a,b) for(int i=a; i<=b; i++)\n#define N 20\nusing namespace std;\nstring s,ss;\nint main(){\n cin>>s; ss=s;\n FOR(i,0,ss.size()) ss+=ss[i];\n FOR(i,1,5){\n string st;\n cin>>st;\n if (st[0]==s[0]||st[1]==s[1]) {cout<<\"YES\"; exit(0);}\n }\n cout<<\"NO\";\n}\n", "lang": "GNU C++11", "bug_code_uid": "0c961ab73c7aa66550f789e5a82eb812", "src_uid": "01b50fcba4185ceb1eb8e4ba04a0cc10", "apr_id": "d63c98722d4fc52a02f06f85e83ba806", "difficulty": 1200, "tags": ["dp", "brute force", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8733766233766234, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": " #include\n #include\n #include\n using namespace std;\n typedef long long ll;\n \n ll xo, yo, ax, ay, bx, by;\n ll xs, ys, t, x, y, lx, ly,tt;\n \n vector> q;\n \n int main(){\n cin >> xo >> yo >> ax >> ay >> bx >> by;\n cin >> xs >> ys >> t;\n x = xo, y = yo;\n while(1){\n try{\n q.push_back(make_pair(x, y));\n xo = x, yo = y;\n x = ax * xo + bx;\n y = ay * yo + by; \n }\n catch (ll){break;}\n catch (ll){ break;}\n }\n int ans = 0;\n for (int i = 0; i < q.size();i++){\n // cout << \"x=\" << q[i].first << \" y=\" << q[i].second << endl;\n ll now = abs(q[i].first - xs) + abs(q[i].second - ys);\n //cout << \"now=\" << now << endl;\n for (int j = 0; j < q.size();j++){\n ll to = abs(q[i].first - q[j].first) + abs(q[i].second - q[j].second);\n if(to+now<=t){\n // cout << i << \" \" << j <<\" \"<\n\nusing namespace std;\n\ntypedef pair II;\ntypedef vector< II > VII;\ntypedef vector VI;\ntypedef vector< VI > \tVVI;\ntypedef long long int \tLL;\n\n#define PB push_back\n#define MP make_pair\n#define F first\n#define S second\n#define SZ(a) (int)(a.size())\n#define ALL(a) a.begin(),a.end()\n#define SET(a,b) memset(a,b,sizeof(a))\n\n#define si(n) scanf(\"%d\",&n)\n#define dout(n) printf(\"%d\\n\",n)\n#define sll(n) scanf(\"%lld\",&n)\n#define lldout(n) printf(\"%lld\\n\",n)\n#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)\n\n//#define TRACE\n\n#ifdef TRACE\n#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)\ntemplate \nvoid __f(const char* name, Arg1&& arg1){\n\tcerr << name << \" : \" << arg1 << std::endl;\n}\ntemplate \nvoid __f(const char* names, Arg1&& arg1, Args&&... args){\n\tconst char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << \" : \" << arg1<<\" | \";__f(comma+1, args...);\n}\n#else\n#define trace(...)\n#endif\n\n//FILE *fin = freopen(\"in\",\"r\",stdin);\n//FILE *fout = freopen(\"out\",\"w\",stdout);\nconst int N = int(3e5)+10;\nconst int M = int(3e5)+10;\nconst int LOGN = 20;\nVI tree[N],g[2][N];//edge list representation of graph\nint U[2][M],V[2][M],vis[N],arr[2][N],T,cmpno,C[2][N],dep[N],DP[LOGN][N],level[N],A[N],comp[N];\nbool isbridge[M]; // if i'th edge is a bridge edge or not \nqueue Q[N];\nint t;\nint adj(int u,int e){\n\treturn U[t][e]==u?V[t][e]:U[t][e];\n}\nint dfs0(int u,int edge){ //mark bridges\n\tvis[u]=1;arr[t][u]=T++;\n\tint dbe = arr[t][u];\n\tfor(int i=0;ilevel[b])swap(a,b);\n\tint d = level[b]-level[a];\n\tfor(int i=0;i=0;i--)\n\t\tif(DP[i][a]!=DP[i][b])\n\t\t\ta=DP[i][a],b=DP[i][b];\n\treturn DP[0][a];\n}\n//Q[]: array containing k nodes of auxillary tree\n//arr[] : arrival time of nodes\n//anc(p,u) : returns true if p is ancestor of u\n//VI tree[N] : final auxillary tree with O(k) nodes\n#define Q QQ\nint Q[2*N],k;\nint anc(int p,int u)\n{\n\treturn arr[0][u]>=arr[0][p] && dep[u]<=dep[p];\n}\nbool cmp(int u,int v){\n\treturn arr[0][u] S;//get distinct nodes \n\tfor(int i=0;i s;\n\tfor(int i=0;i\n#include\nusing namespace std;\n\nbool isLeap(int y){\n\tif( y % 4 == 0 && y % 100 != 0)\n\t\treturn true;\n\telse if(y % 4 == 0 && y % 100 == 0 && y % 400 == 0)\n\t\treturn true;\n\telse\n\t\treturn false;\n\t// if(y % 4 == 0 && (y % 100 != 0 || y % 400 == 0) )\n\t\n\t// return (y % 4 == 0 && ( y % 100 != 0 || y % 400 == 0 ) ? true : false);\n}\n\nint calMonth(int m1, int m2, int y){\n\t\n\tint days = 0;\n\t\n\tfor(int i=m1; i<=m2; i++){\n\t\t\t\tif(i == 2){\n\t\t\t\t\tif(isLeap(y))\n\t\t\t\t\t\tdays += 29;\n\t\t\t\t\telse\n\t\t\t\t\t\tdays += 28;\n\t\t\t\t}\n\t\t\t\telse if(i % 2 != 0 && i <= 7)\n\t\t\t\t\tdays += 31;\n\t\t\t\telse if(i % 2 == 0 && i >= 8)\n\t\t\t\t\tdays += 31;\n\t\t\t\telse\n\t\t\t\t\tdays += 30;\n\t\t\t}\n\n\treturn days;\n}\n\nint main() {\n\t// your code goes here\n\tstring date1, date2;\n\t\n\tint y1, y2, m1, m2, d1, d2;\n\t\n\tcin>>date1>>date2;\n\t\n\ty1 = stoi(date1.substr(0, 4));\n\ty2 = stoi(date2.substr(0, 4));\n\tm1 = stoi(date1.substr(5, 2));\n\tm2 = stoi(date2.substr(5, 2));\n\td1 = stoi(date1.substr(8, 2));\n\td2 = stoi(date2.substr(8, 2));\n\t\n\tint days = 0;\n\tif(y1 == y2){\n\t\tif(m1 == m2)\n\t\t\tdays += abs(d2-d1);\n\t\telse{\n\t\t\tif(m1 > m2){\n\t\t\t\tswap(m1, m2);\n\t\t\t\tswap(d1, d2);\n\t\t\t}\n\t\t\t\n\t\t\tif(m1 == 2){\n\t\t\t\tif(isLeap(y1))\n\t\t\t\t\tdays += 29 - d1;\n\t\t\t\telse\n\t\t\t\t\tdays += 28 - d1;\n\t\t\t}\n\t\t\telse if((m1 < 8 && m1 % 2 != 0) && (m1 >=8 && m1 % 2 == 0) )\n\t\t\t\tdays = 31 - d1;\n\t\t\telse\n\t\t\t\tdays = 30 - d1;\n\t\t\t\n\t\t\tdays += calMonth(m1+1, m2-1, y1);\n\t\t\tdays += d2;\n\t\t}\n\t\t\n\t\tcout< y2){\n\t\t\tswap(y1, y2);\n\t\t\tswap(m1, m2);\n\t\t\tswap(d1, d2);\n\t\t}\n\t\t\n\t\tif(m1 == 2){\n\t\t\t\tif(isLeap(y1))\n\t\t\t\t\tdays += 29 - d1;\n\t\t\t\telse\n\t\t\t\t\tdays += 28 - d1;\n\t\t}\n\t\telse if( (m1 < 8 && m1 % 2 != 0) || (m1>=8 && m1 % 2 == 0) )\n\t\t\tdays = 31 - d1;\n\t\telse\n\t\t\tdays = 30 - d1;\n\t\t\n\t\tdays += calMonth(m1+1, 12, y1);\n\t\t\n\t\tfor(int j=y1+1; j<= y2-1; j++){\n\t\t\tif(isLeap(j))\n\t\t\t\tdays += 366;\n\t\t\telse\n\t\t\t\tdays += 365;\n\t\t}\n\t\t\n\t\tdays += calMonth(1, m2-1, y2);\n\t\tdays += d2;\n\t\t\n\t\tcout<\n#include \nusing namespace __gnu_pbds;\nusing namespace std;\n#define For(i,n) for(int i=0;i >\n#define vv vector\n#define MAXN 1001\nint A[MAXN];\nint C[1001][1001];\nvoid binomialCoeff()\n{\n int i, j;\n int n = 1000, k = 1000;\n for (i = 0; i <= n; i++)\n {\n for (j = 0; j <= min(i, k); j++)\n {\n // Base Cases\n if (j == 0 || j == i)\n C[i][j] = 1;\n else\n C[i][j] = C[i - 1][j - 1] +\n C[i - 1][j];\n }\n }\n\n return C[n][k];\n}\n\nint32_t main()\n{\n#ifndef ONLINE_JUDGE\n\tfreopen(\"input.txt\", \"r\", stdin);\n\tfreopen(\"output.txt\", \"w\", stdout);\n#endif\n\tfio;\n\tint t=1;\n\t//cin >> t;\n\tbinomialCoeff()\n\twhile (t--)\n\t{\n\t\tint n;\n\t\tcin >> n;\n int kk = [n][n/2];\n cout<\n#include \n\nusing namespace std;\n\nvoid solve() {\n\tlong int m, n, k;\n\tcin >> n >> m >> k;\n\tif (n > m)\n\t\tswap(n, m);\n\tif (m + n - 2 < k) {\n\t\tcout << -1 << '\\n';\n\t\treturn;\n\t}\n\telse if (m + n - 2 == k) {\n\t\tcout << 1 << '\\n';\n\t\treturn;\n\t}\n\n\tlong int a1, b1, a2, b2;\n\t\n\tif (k > m - 1) {\n\t\ta1 = 1;\n\t\tb1 = n / (k - m);\n\t}\n\telse {\n\t\ta1 = m / (k + 1);\n\t\tb1 = n;\n\t}\n\n\tif (k > n - 1) {\n\t\ta2 = 1;\n\t\tb2 = m / (k - n);\n\t}\n\telse {\n\t\ta2 = n / (k + 1);\n\t\tb2 = m;\n\t}\n\n\t\n\tcout << max(a1*b1, a2*b2) << '\\n';\n}\n\nint main() {\n\n\t//freopen(\"input.txt\", \"r\", stdin);\n\t//freopen(\"output.txt\", \"w\", stdout);\n\n\tsolve();\n\t\n\treturn 0;\n}\n\n/* Sat Feb 22 2020 12:14:22 GMT+0300 (MSK) */\n", "lang": "GNU C++11", "bug_code_uid": "58aff10f43baabda7cdd4bc4642d5c0d", "src_uid": "bb453bbe60769bcaea6a824c72120f73", "apr_id": "ff0d342a6ce0b60a997f6c939a1d4954", "difficulty": 1700, "tags": ["math", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9533116178067318, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "#include \nusing namespace std;\nint main(){\n\tios_base::sync_with_stdio(false);\n\tcin.tie(NULL);\n\tlong long t , n;\n\tstring s;\n\tcin >> s;\n\tn = 0;\n\tfor (int i = 0; i < s.length()-2; i++){\n\t\tif (s[i] != 'Q') continue;\n\t\tfor (int j = i+1; j < s.length()-1; j++){\n\t\t\tif (s[j] != 'A') continue;\n\t\t\tfor (int k = j+1; k < s.length(); k++)\n\t\t \t\tif (s[i] == 'Q' && s[j] == 'A' && s[k] == 'Q') n++;\n\t\t}\n\t}\n\tcout << n;\n}\n//by karangreat\n\n", "lang": "GNU C++17", "bug_code_uid": "a84e9f301f3bc3357818f4e61babffd0", "src_uid": "8aef4947322438664bd8610632fe0947", "apr_id": "5104d09a76156c68d8c694171c4416a6", "difficulty": 800, "tags": ["dp", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.4538474105538311, "equal_cnt": 36, "replace_cnt": 18, "delete_cnt": 6, "insert_cnt": 11, "fix_ops_cnt": 35, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nint n, m;\nint l, r, p;\n\nvoid ReadData()\n{\n scanf(\"%d %d\", &n, &m);\n scanf(\"%d %d %d\", &l, &r, &p);\n}\n\n__int64 answer;\nint factors[10];\n\nvoid Solve()\n{\n answer = 0;\n if(l == 1)\n {\n answer = (answer + ((m * 2LL * n) % p + n + m)) % p;\n }\n //printf(\"cycle before: %I64d\\n\", answer);\n for(int dx = 1; dx <= n; dx++)\n {\n double nl_f = l * 1.0 * l - dx * 1.0 * dx;\n double nr_f = r * 1.0 * r - dx * 1.0 * dx;\n if(nr_f < 0)\n {\n break;\n }\n int nl = nl_f > 0.0 ? (int)ceil(sqrt(nl_f)) : 1;\n int nr = min((int)floor(sqrt(nr_f)), m);\n if(nl == 0)\n {\n nl = 1;\n }\n if(nl > nr) \n {\n continue;\n }\n __int64 tmp = 0;\n int factorsCnt = 0;\n int copy_dx = dx;\n for(int divider = 2; divider * divider <= dx; divider++)\n {\n if(dx % divider == 0)\n {\n while(dx % divider == 0)\n {\n dx /= divider;\n }\n factors[factorsCnt++] = divider;\n }\n }\n if(abs(dx) > 1)\n {\n factors[factorsCnt++] = dx;\n }\n dx = copy_dx;\n int sum = 0;\n int counter = 0;\n for(int i = nl; i <= nr; i++)\n {\n for(int j = 0; j < factorsCnt; j++)\n {\n if(i % factors[j] == 0)\n {\n sum += i;\n counter++;\n break;\n }\n }\n }\n //tmp = (((nr - nl + 1 - tmp) % p) * 2) % p;\n tmp = nr - nl + 1 - counter;\n tmp = tmp * (m + 1) * 2 - (((nl + nr) * (nr - nl + 1)) - sum * 2);\n answer = (answer + ((n - dx + 1) * tmp) % p) % p;\n /*for(int mask = 1; mask < (1 << factorsCnt); mask++)\n {\n int copyMask = mask;\n int power = 1;\n int mul = 1;\n int idx = 0;\n while(mask != 0)\n {\n if((mask % 1) != 0)\n {\n power++;\n mul *= factors[idx];\n }\n mask >>= 1;\n idx++;\n }\n if(power % 2 == 0)\n {\n tmp = (tmp + (nr / mul - (nl - 1) / mul)) % p;\n }\n else\n {\n tmp = (tmp - (nr / mul - (nl - 1) / mul)) % p;\n }\n mask = copyMask;\n }*/\n //tmp = (((nr - nl + 1 - tmp) % p) * 2) % p;\n //answer = (answer + ((n - dx + 1) * tmp) % p) % p;\n //printf(\"debug: %I64d\\n\", answer);\n }\n}\n\nvoid WriteData()\n{\n printf(\"%I64d\\n\\n\", answer);\n}\n\nint main()\n{\n int QWE;\n#ifndef ONLINE_JUDGE\n freopen(\"input.txt\", \"r\", stdin);\n scanf(\"%d\", &QWE);\n#else\n QWE = 1;\n#endif\n for(int T = 0; T < QWE; T++)\n {\n ReadData();\n Solve();\n WriteData();\n }\n}", "lang": "MS C++", "bug_code_uid": "7630cd56aa035beec5a370225f70bb58", "src_uid": "2afe29a7dbbd2e261e1870a43d57b46f", "apr_id": "e547a750c9e420357d801bc3d21605e9", "difficulty": 2500, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9896907216494846, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "#include \nusing namespace std;\n\n#define ll long long\n#define ull unsigned long long\n#define st size_t\n#define quick ios_base::sync_with_stdio(false); cin.tie(NULL);\n#define pb push_back\n#define mp make_pair\n\nstring append_zero(ll n) {\n string str = \"\";\n while (n > 1)\n str += '0';\n return str;\n}\n\nint main() {\n quick;\n int n;\n string str;\n cin >> n >> str;\n char prev = '\\0';\n ll ans = 0;\n string res = \"\";\n for (char c : str) {\n if (prev == '\\0') {\n prev = c;\n ans = 1;\n }\n else if (prev == c) {\n ans++;\n } else {\n if (prev == '1') \n\tres += to_string(ans);\n else\n\tres += append_zero(ans);\n ans = 1;\n prev = c;\n }\n }\n if (prev == '1')\n res += to_string(ans);\n else\n res += append_zero(ans);\n cout << res << endl;\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "a9b847e2787365f8dc52c74ffd0e3063", "src_uid": "a4b3da4cb9b6a7ed0a33a862e940cafa", "apr_id": "c6cd41e86383efdd7625e846f5ca9480", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.959830866807611, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "#include\nint main()\n{\n\tint v1,v2,t1,t2,t3,t4,n;\n\tscanf(\"%d%d%d%d%d\",&n,&v1,v2,t1,t2);\n\tt3=n*v1+(2*t1);\n\tt4=n*v2+(2*t2);\n\tif(t3>t4)printf(\"First\\n\");\n\telse if(t4>t3)printf(\"Second\\n\");\n\telse printf(\"Friendship\\n\");\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "0500ae9fc00defc85a1e719eeadfa16b", "src_uid": "10226b8efe9e3c473239d747b911a1ef", "apr_id": "d67fd8ba90dbaaa62f60ab5142957b9f", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9034431137724551, "equal_cnt": 16, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 15, "bug_source_code": "#include \n#define int unsigned int\nusing namespace std;\n\nint t[16], g[16];\nconst int m = 1e9 + 7;\nint32_t main() {\n int n, T;\n cin >> n >> T;\n\n for (int i = 0; i < n; i++) {\n cin >> t[i] >> g[i];\n g[i]--;\n }\n vector > > dp((1 << n), vector > (T + 1, vector (3)));\n for (int i = 0; i < n; i++) {\n dp[(1 << i)][t[i]][g[i]]++;\n }\n int ans = 0;\n for (int mask = 1; mask < (1 << n); mask++) {\n for (int i = 0; i < n; i++) {\n if (!((1 << i) & mask)) {\n for (int j = 0; j <= T - t[i]; j++) {\n if (g[i] == 0){\n dp[mask | (1 << i)][j + t[i]][g[i]] += (dp[mask][j][1] + dp[mask][j][2]) % m;\n }\n if (g[i] == 1) {\n dp[mask | (1 << i)][j + t[i]][g[i]] += (dp[mask][j][0] + dp[mask][j][2]) % m;\n }\n if (g[i] == 2) {\n dp[mask | (1 << i)][j + t[i]][g[i]] += (dp[mask][j][1] + dp[mask][j][0]) % m;\n }\n dp[mask | (1 << i)][j + t[i]][g[i]] %= m;\n }\n }\n }\n }\n //cout << dp[(1 << n) - 1][T][1] << \" \" << dp[(1 << n) - 1][T][2] << \" \" << dp[(1 << n) - 1][T][3] << \"\\n\";\n for (int mask = 0; mask < (1 << n); mask++) {\n ans += (dp[mask][T][0] + dp[mask][T][2] + dp[mask][T][1]) % m;\n ans %= m;\n }\n cout << ans;\n return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "908cdfa9387031844ac3e67ae47ae7a6", "src_uid": "ac2a37ff4c7e89a345b189e4891bbf56", "apr_id": "ffec4b107997be8d308a0d73a91399da", "difficulty": 2100, "tags": ["dp", "combinatorics", "bitmasks"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9479472140762464, "equal_cnt": 10, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 9, "bug_source_code": "#include\nusing namespace std;\n\nstruct tab\n{\n int valor;\n int distancia;\n};\n\nint visitados[200005];\nint calcula(int x,int p){\n int flag2 = 0;\n int a = (x/50)%475;\n for(int i=0;i<25;i++){\n a = ((a*96)+42)%475;\n if((a+26) == p){\n flag2 = 1;\n break;\n }\n }\n return flag2;\n}\n\nint main(){\n int p,x,y;\n scanf(\"%d %d %d\",&p,&x,&y);\n queue FILA;\n tab aux1,aux2,aux3;\n\n aux1.valor = x;\n aux1.distancia = 0;\n FILA.push(aux1);\n\n while(!FILA.empty()){\n aux1 = FILA.front();\n\n FILA.pop();\n int flag = calcula(aux1.valor,p);\n\n if(flag && aux1.valor >= y){\n printf(\"%d\\n\",aux1.distancia);\n break;\n }\n else{\n if(visitados[aux1.valor] == 1){\n continue;\n }\n visitados[aux1.valor] = 1;\n\n aux2.valor = aux1.valor + 100;\n aux2.distancia = aux1.distancia + 1;\n FILA.push(aux2);\n\n aux2.valor = aux1.valor - 50;\n aux2.distancia = aux1.distancia;\n FILA.push(aux2);\n\n while((x - 50) >= y){\n aux2.valor = x - 50;\n aux2.distancia = aux1.distancia;\n FILA.push(aux2);\n x -= 50;\n }\n }\n }\n return 0;\n}\n\n", "lang": "GNU C++", "bug_code_uid": "5f88cecf90493cce53637b846c086118", "src_uid": "c9c22e03c70a94a745b451fc79e112fd", "apr_id": "b371446c5a5ccf690b5f4ec47e1a8736", "difficulty": 1300, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.10033444816053512, "equal_cnt": 16, "replace_cnt": 13, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 16, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nint main(){\nlong long a,b;\ncin>>a>>b;\nvector prime(100000000+5,0);\nlong long minidex=0;\nlong long min1=1000000000000000000-1;\nlong long c=a;\nlong long d=b;\n while(c>0&&d>0){\n if(c>d){\n c=c%d;\n }\n else{\n d=d%c;\n }\n }\nfor(long long i=0;i<=max(c+d,abs(a-b));i++){\n long long y=a+i;\n long long x=b+i;\n while(x>0&&y>0){\n if(x>y){\n x=x%y;\n }\n else{\n y=y%x;\n }\n }\n if((((b+i)*(a+i))/(x+y))\n\nusing namespace std;\n\n#define PB push_back\n#define MP make_pair\n#define f first\n#define s second\n#define FOR(i,a,b) for (int i = a; i < b; ++i)\n#define RFOR(i, b, a) for (int i = b-1; i>=a; --i)\n#define FILL(a, b) memset(a, b, sizeof a)\n#define ALL(a) a.begin(), a.end()\n#define SZ(a) ((int)a.size())\n#define MAGIC0\nmt19937 rnd(time(0)); //rnd()\n\ntypedef long long LL;\ntypedef vector VI;\ntypedef pair PII;\ntypedef pair PLL;\n\nconst int INF = 1000 * 1000 * 1000 + 7;\nconst LL LINF = 1LL * INF*INF;\nconst int MAX = 1e5 + 7;\nconst double PI = acos(-1.);\nconst double EPS = 1e-8;\nconst int MOD = 1000 * 1000 * 1000 + 7;\n\nvector vec;\n\nint kol;\n\nLL gcd(LL a, LL b)\n{\n//\tcout << a << ' ' << b << endl;\n\tif (!kol)\n\t{\n\t\tvec.PB(abs(a-b));\n\t\tvec.PB(a+b);\n\t}\n\tif (!b) return a;\n\treturn gcd(b, a % b);\n}\n\nLL nsk(LL a, LL b)\n{\n\treturn a / gcd(a, b) * b;\n}\n\nVI fac(int a)\n{\n\tVI res;\n\tfor(LL j = 1;j * j <= a;++j)\n\t{\n\t\tif (a % j == 0)\n\t\t{\n\t\t\tres.PB(a / j);\n\t\t\tif (a / j != j)\n\t\t\t{\n\t\t\t\tres.PB(j);\n\t\t\t}\n\t\t}\n\t}\n\treturn res;\n}\n\nint main()\n{\n\tios_base::sync_with_stdio(0);\n\tLL a, b;\n\tcin >> a >> b;\n\n\tvec.reserve(1000000);\n\tLL cur = nsk(a, b), k = 0;\n\tFOR(el, 0, min((LL)1e7, (LL)abs(a-b)+1))\n\t{\n\n\t\tif (nsk(a + el, b + el) < cur)\n\t\t{\n\t\t\tcur = nsk(a + el, b + el);\n\t\t\tk = el;\n\t\t}\n\t\telse\n\t\tif (nsk(a + el, b + el) == cur)\n\t\t{\n\t\t\tk = min(k, (LL)el);\n\t\t}\n\t}\n\n\tcout << k;\n\n\treturn 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "77b051f30775b44f8de37052aed27024", "src_uid": "414149fadebe25ab6097fc67663177c3", "apr_id": "b283544fff7823e20e914d738813689c", "difficulty": 1800, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8557993730407524, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n long long int a,b,c,d,n,m;\n cin>>a>>b>>c>>d;\n n=a-(a/250)*c;\n n=max(a*3/10,a);\n m=b-(b/250)*d;\n if(n>m)cout<<\"Misha\"<n)cout<<\"Vasya\"<\n#include\nusing namespace std;\ntypedef long long ll;\nint dig[12],tot,ans;\nint main(){\n\tll n,m; cin>>n; m=n;\n\twhile(n){dig[++tot]=n%10; n/=10;}\n\tint iter=tot+1;\n\tfor(int i=1;i<=tot;i++){\n\t\tif(dig[i]!=9){iter=i; break;}\n\t\telse ans+=9;\n\t}\n\tif(iter==tot) return 0;\n\telse{\n\t\tfor(int i=iter;i\nusing namespace std;\n\nint n;\nbool vu[100001]={0};\n\nint main() {\n\tcin >> n;\n\tfor(int k = 0; k <= 18; k++) {\n\t\tint v = ((1 << k) - 1) * ((1 << (k-1)));\n\t\tif(0 <= v && v <= 100000) vu[v] = 1;\n\t}\n\tint ans = -1;\n\tfor(int i = 0; i <= n; i++)\n\t\tif(vu[i] && n % ans == 0) ans = i;\n\tcout << ans;\n}\n", "lang": "GNU C++11", "bug_code_uid": "8894e85f087ee1f39dfcb312b39c6765", "src_uid": "339246a1be81aefe19290de0d1aead84", "apr_id": "94d4f64129b9eae837d806a64a6ce965", "difficulty": 1000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.16556291390728478, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "# include \nusing namespace std;\nlong long us[100000];\nint main()\n{366 365\n long long n , i , j , s , k = 0 , p;\n cin>> n;\n for(i = 1 ; i <= n ; i ++){\n for(j = i ; j <= n ; j ++){\n s = i * i + j * j;\n p = sqrt(s);\n if(p * p == s && p >= j && p <= n)\n k++;\n\n }\n }\n cout<\nusing namespace std;\n//#include\nint main()\n{\n int r1,r2,l1,l2;\n while(scanf(\"%d%d\",&r1,&l1))\n {\n //scanf(\"%d%d\",&l1,&r1);\n scanf(\"%d%d\",&l2,&r2);\n if(((2*l1+3>r2)&&(r2+1>l1-1))||((2*r1+3>l2)&&(l2+1>r1-1)))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n return 0;\n}", "lang": "MS C++", "bug_code_uid": "f8638c536c8aef3630a6fe55327c29aa", "src_uid": "36b7478e162be6e985613b2dad0974dd", "apr_id": "ab754843e0c2311781cd1ce5b68f4495", "difficulty": 1300, "tags": ["math", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.666469369635987, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "// Paste me into the FileEdit configuration dialog\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\n#define PI (2.*acos(0.))\n#define EPS 1e-9\n\n#define GETBIT(x,i) (x&(1< vi;\ntypedef pair pii;\nint n,k,d[1100],s[1100];\n#define MOD 1000000009\nint main()\n{\n LL n,m;\n cin>>n>>m;\n LL a=1;\n FOR(i,m)a=(a*2)%MOD;\n LL ans=1;\n FOR(i,n)\n {\n a=(a-1+MOD)%MOD;\n ans*=a;\n ans%=MOD;\n }\n cout<\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\n#define PI (2.*acos(0.))\n#define EPS 1e-9\n\n#define GETBIT(x,i) (x&(1< vi;\ntypedef pair pii;\nint n,k,d[1100],s[1100];\n#define MOD 1000000009\nint main()\n{\n LL n,m;\n cin>>n>>m;\n LL a=1;\n FOR(i,m)a=(a*2)%MOD;\n LL ans=1;\n FOR(i,n)\n {\n a=(a-1+MOD)%MOD;\n ans*=a;\n ans%=MOD;\n }\n cout<\n#define int long long\nusing namespace std;\n \n#define rep(i,n) for (int i=0;i<(int)(n);++i)\n#define rep1(i,n) for (int i=1;i<=(int)(n);++i)\n#define range(x) begin(x), end(x)\n#define sz(x) (int)(x).size()\n#define pb push_back\n#define F first\n#define S second\n \ntypedef long long ll;\ntypedef unsigned long long ull;\ntypedef long double ld;\ntypedef pair pii;\ntypedef vector vi;\n/* \n\u8ba1\u7b97u^v % mod\n*/\nll power(ll u,ll v,ll mod){\n ll ret=1,t=u%mod;\n while (v){\n if (v&1) ret=t*ret%mod;\n t=t*t%mod, v>>=1;\n }\n return ret%mod;\n}\n \n/*\n\u8ba1\u7b97gcd(a,b)\u5e76\u627e\u5bfbax+by=gcd(a,b)\u7684\u4e00\u7ec4\u89e3\nret=exgcd(a,b,x,y); \n*/\nll exgcd(ll a,ll b,ll &x,ll &y){\n if (b){\n ll d=exgcd(b,a%b,y,x);\n return y-=a/b*x, d;\n }\n return x=1,y=0,a;\n}\n \n/*\n\u8ba1\u7b97x=a(mod m), x=b(mod n)\u7684\u4e00\u7ec4\u89e3\uff0c\u82e5\u65e0\u89e3\u8fd4\u56de-1\nret=crt(a,m,b,n);\n*/\nll crt(ll a,ll m,ll b,ll n){\n if (n>m) swap(a,b), swap(n,m);\n ll x,y,g=exgcd(m,n,x,y);\n if ((b-a)%g) return -1;\n x=(b-a)%n*x%n/g*m+a;\n return x<0?x+m*n/g:x;\n}\n \n/*\n\u751f\u6210<=n\u7684\u8d28\u6570\ngen_prime<5000>(ret);\n*/\n \nvoid gen_prime(int n,vi &ret){\n vector p;\n p.resize(n+1,1);\n p[0]=p[1]=0;\n for (int i=4;i<=n;i+=2) p[i]=0;\n for (int i=3;i*i<=n;i+=2){\n if (p[i]){\n for (int j=i*i;j<=n;j+=2*i){\n p[j]=0;\n }\n }\n }\n for (int i=2;i<=n;++i){\n if (p[i]) ret.pb(i);\n }\n}\n \n/*\n\u751f\u6210<=n\u7684phi\ngen_phi<5000>(ret);\n*/\nvoid gen_phi(int n,vi &phi){\n phi.resize(n+1);\n for (int i=0;i<=n;++i) phi[i]=i&1?i:i/2;\n for (int i=3;i<=n;i+=2){\n if (phi[i]==i){\n for (int j=i;j<=n;j+=i) phi[j]-=phi[j]/i;\n }\n }\n}\n \n/*\n\u652f\u6301\u66f4\u9ad8\u7684\u5feb\u901f\u5e42\u64cd\u4f5c\nexpower.mod_pow(a,b,mod);\n*/\n \nstruct expower{\n ull mod_mul(ull a,ull b,ull M) {\n ll ret=a*b-M*ull(ld(a)* ld(b)/ld(M));\n return ret+M*(ret<0)-M*(ret>=(ll)M);\n }\n ull mod_pow(ull b,ull e,ull mod) {\n ull ans=1;\n for (; e; b=mod_mul(b,b,mod), e/=2)\n if (e&1) ans=mod_mul(ans,b,mod);\n return ans%mod;\n }\n}expower;\n \n/*\nMiller-Rubin\u7d20\u6570\u5224\u522b\nis_prime(n);\n*/\nbool is_prime(ull n){ \n if (n<2||n%6%4!=1) return n-2<2;\n ull A[]={2,325,9375,28178,450775,9780504,1795265022},\n s=__builtin_ctzll(n-1), d = n >> s;\n for (auto a:A){\n ull p=expower.mod_pow(a,d,n),i=s;\n while (p!=1&&p!=n-1&&a%n&&i--)\n p=expower.mod_mul(p,p,n);\n if (p!=n-1&&i!=s) return 0;\n }\n return 1;\n}\n \n/*\n\u7d20\u56e0\u6570\u5206\u89e3\nret=factorization(n);\n*/\null pollard(ull n){\n auto f=[n](ull x){return (expower.mod_mul(x,x,n)+1)%n;};\n if (!(n&1)) return 2;\n for (ull i=2;;i++){\n ull x=i,y=f(x),p;\n while ((p=__gcd(n+y-x,n))==1)\n x=f(x),y=f(f(y));\n if (p!=n) return p;\n }\n}\n \nvector factorization(ull n){\n if (n==1) return {};\n if (is_prime(n)) return {n};\n ull x=pollard(n);\n auto l=factorization(x),r=factorization(n/x);\n l.insert(l.end(),range(r));\n return l;\n}\n \nstruct DSU{\n //insert info.\n vector p;\n DSU(int n){\n p.resize(n+1);\n for (int i=1;i<=n;++i) p[i]=i;\n }\n int find(int u){\n if (p[u]==u) return u;\n return p[u]=find(find(p[u]));\n } \n bool unite(int u,int v){\n int pu=find(u), pv=find(v);\n if (pu!=pv){\n p[pu]=pv;\n }\n return pu!=pv;\n }\n};\n \n/* (u,v,w) */\ntemplate vector > MST(int n,vector >g){\n vector > ret;\n ret.clear();\n DSU dsu(n);\n auto cmp=[&](tuple x,tuple y){\n int ux,uy,vx,vy;\n T wx,wy;\n tie(ux,vx,wx)=x, tie(uy,vy,wy)=y;\n return wx\nstruct SegmentTree{\n typedef struct{\n T lz,mx,mn,sum;\n }Node;\n vector tree;\n SegmentTree(){\n tree.resize((n+7)<<2);\n } \n void pushup(int num){\n tree[num].mx=max(tree[num<<1].mx,tree[num<<1|1].mx);\n tree[num].mn=min(tree[num<<1].mn,tree[num<<1|1].mn);\n tree[num].sum=tree[num<<1].sum+tree[num<<1|1].sum;\n }\n void pushdown(int num,int l,int r,int md){\n if (tree[num].lz){\n tree[num<<1].mx+=tree[num].lz;\n tree[num<<1|1].mx+=tree[num].lz;\n tree[num<<1].mn+=tree[num].lz;\n tree[num<<1|1].mn+=tree[num].lz;\n tree[num<<1].sum+=tree[num].lz*(md-l+1);\n tree[num<<1|1].sum+=tree[num].lz*(r-md);\n tree[num<<1].lz+=tree[num].lz;\n tree[num<<1|1].lz+=tree[num].lz;\n tree[num].lz=0;\n }\n }\n void update1(int num,int l,int r,int L,int R,T val){\n if (L<=l&&r<=R){\n tree[num].mx+=val;\n tree[num].mn+=val;\n tree[num].sum+=val*(r-l+1);\n tree[num].lz+=val;\n return;\n }\n int md=(l+r)>>1;\n pushdown(num,l,r,md);\n if (md>=L) update1(num<<1,l,md,L,R,val);\n if (md query1(int num,int l,int r,int L,int R){\n if (L<=l&&r<=R){\n return {tree[num].mn,tree[num].mx,tree[num].sum};\n }\n int md=(l+r)>>1;\n pushdown(num,l,r,md);\n if (md>=R){\n return query1(num<<1,l,md,L,R);\n }\n else{\n if (md ret1=query1(num<<1,l,md,L,R), ret2=query1(num<<1|1,md+1,r,L,R);\n T a,b,c,d,e,f;\n tie(a,b,c)=ret1, tie(d,e,f)=ret2;\n return {min(a,d),max(b,e),c+f};\n }\n } \n }\n void update(int L,int R,int w){\n update1(1,1,n,L,R,w);\n }\n tuple query(int L,int R){\n return query1(1,1,n,L,R);\n }\n void debug1(int num,int l,int r){\n if (l==r){\n cout<>1;\n pushdown(num,l,r,md);\n debug1(num<<1,l,md);\n debug1(num<<1|1,md+1,r); \n }\n void debug(){\n debug1(1,1,n);\n cout< p;\n vector ans;\n XORBasis(int k):n(k){\n p.resize(k+1);\n }\n void rebuilt(){\n ans.clear();\n for (int i=0;i<=n;++i){\n if (p[i]) ans.push_back(p[i]);\n }\n }\n void insert(ull u){\n for (int i=n;i>=0;--i){\n if (u&(1ull<=0;--j){\n if (p[i]&(1ull<-1;--i){\n if (u&(1ull<=(1ull< N;\n\tvector backp;\n\tvoid insert(string& s, int j,ll val) {\n\t\tassert(!s.empty());\n\t\tint n = 0;\n\t\tfor(auto c:s) {\n\t\t\tint& m = N[n].next[c - first];\n\t\t\tif (m == -1) { n = m = sz(N); N.emplace_back(-1); }\n\t\t\telse n = m;\n\t\t}\n\t\tif (N[n].end == -1) N[n].start = j;\n\t\tbackp.push_back(N[n].end);\n\t\tN[n].end = j;\n\t\tN[n].nmatches+=val;\n\t}\n\tAhoCorasick(vector& pat,vi val) {\n\t\tN.emplace_back(-1);\n\t\tfor (int i=0;i q;\n\t\tfor (q.push(0); !q.empty(); q.pop()) {\n\t\t\tint n = q.front(), prev = N[n].back;\n\t\t\tfor (int i=0;i findAll(vector& pat, string word) {\n\t\tll ans=0;\n vi r = find(word,ans);\n\t\tvector res(sz(word));\n\t\tfor (int i=0;i G;\n vi par,dep,siz,son,top,dfn,rk; \n //\u7236\u4eb2\u8282\u70b9\uff0c\u6df1\u5ea6\uff0c\u5b50\u6811\u5927\u5c0f\uff0c\u91cd\u5b50\u8282\u70b9\uff0c\u91cd\u94fe\u5934\u90e8\uff0cdfs\u5e8f\uff0cdfs\u5e8f\u5bf9\u5e94\u7684\u8282\u70b9\u7f16\u53f7\n HLD(vector g,int root=1):n(sz(g)),G(g),par(n+7),dep(n+7),siz(n+7,1),son(n+7,-1),top(n+7),dfn(n+7),rk(n+7){\n dep[0]=-1, dfs1(root,0), dfs2(root,0,root);\n }\n void dfs1(int u,int p){\n for (auto c:G[u]){\n if (c==p) continue;\n dep[c]=dep[u]+1, par[c]=u;\n dfs1(c,u);\n siz[u]+=siz[c];\n if (son[u]==-1||siz[son[u]]dep[top[v]]){\n u=par[top[u]];\n }\n else{\n v=par[top[v]];\n }\n }\n return dep[u]>dep[v]?v:u;\n }\n vector find_seg(int u,int v){\n vector ft,bk,res;\n ft.clear(), bk.clear(), res.clear();\n// cout<dep[top[v]]){\n ft.pb({u,top[u]});\n u=par[top[u]];\n }\n else{\n bk.pb({top[v],v});\n v=par[top[v]];\n }\n }\n ft.pb({u,v});\n for (int i=0;i0;--i) res.pb(bk[i-1]);\n return res;\n }\n};\n \nstruct BIT{\n vi C; int n;\n BIT(int n):n(n){C.resize(n+7,0);}\n void update(int u,int w){\n for (;u<=n;u+=u&(-u)) C[u]+=w;\n }\n int query(int u){\n int res=0;\n for (;u>0;u-=u&(-u)) res+=C[u];\n return res; \n }\n};\n\nvi topoSort(const vector& gr) {\n\tvi indeg(sz(gr)), ret;\n\tfor (auto& li : gr) for (int x : li) indeg[x]++;\n\tqueue q; // use priority queue for lexic. smallest ans.\n\trep(i,sz(gr)) if (indeg[i] == 0) q.push(-i);\n\twhile (!q.empty()) {\n\t\tint i = -q.front(); // top() for priority queue\n\t\tret.push_back(i);\n\t\tq.pop();\n\t\tfor (int x : gr[i])\n\t\t\tif (--indeg[x] == 0) q.push(-x);\n\t}\n\treturn ret;\n}\n\nvi path;\nnamespace Eulerian {\n const int N = 3, M = 3;\n int t, n, m, tot, cc, hd[N], nxt[M], to[M], bh[M], vis[M], in[N], out[N], ans[M];\n void add(int x, int y, int id) {\n nxt[++tot] = hd[x];\n hd[x] = tot;\n to[tot] = y;\n bh[tot] = id;\n in[y]++;\n out[x]++;\n }\n void dfs(int x) {\n for (int i = hd[x]; i; i = hd[x]) {\n while (i && vis[abs(bh[i])]) i = nxt[i];\n hd[x] = i;\n if (!i) break;\n vis[abs(bh[i])] = 1;\n dfs(to[i]), ans[++cc] = bh[i];\n }\n }\n \n void init() {\n memset(hd, 0, sizeof(hd));\n memset(nxt, 0, sizeof(nxt));\n memset(to, 0, sizeof(to));\n memset(bh, 0, sizeof(bh));\n memset(vis, 0, sizeof(vis));\n memset(in, 0, sizeof(in));\n memset(out, 0, sizeof(out));\n memset(ans, 0, sizeof(ans));\n t = 1;\n n = 0;\n m = 0;\n tot = 0;\n cc = 0;\n }\n bool solve() {\n for (int i = 1; i <= n; i++)\n if ((t == 1 && in[i] & 1)) {\n return false;\n }\n dfs(to[1]);\n if (cc < m) return false;\n else {\n path.clear();\n for (int i = cc; i >= 1; i--) path.push_back(ans[i]);\n return true;\n }\n }\n} // namespace Eulerian\n\nnamespace FWT{\n //mod=-1 (no mod)\n const int mod=-1;\n\n inline int modadd(int a,int b){\n a+=b;\n if (mod==-1) return a;\n a%=mod, a+=mod, a%=mod;\n return a;\n }\n\n vi OR(vi &a,int mode=1){\n vi b(a);\n for (int i=0;(1<>i&1) b[j]=modadd(b[j],b[j^(1<>i&1) b[j^(1<>i&1){\n b[j^(1<0) b[j]=b[j]*power(2,mod-2,mod)%mod, b[j^(1<>n>>m;\n f[0]=1;\n rep1(i,maxn-1) f[i]=i*f[i-1]%mod;\n int res=0,res2=0;\n auto mt=[&](int u,int v){\n return u*v%mod;\n };\n auto C=[&](int u,int v){\n return mt(f[u],mt(power(f[v],mod-2,mod),power(f[u-v],mod-2,mod)));\n };\n rep1(i,n){\n int tmp=mt(mt(f[n],mt(power(f[i],mod-2,mod),power(f[n-i],mod-2,mod))),mt(m+i,power(i,mod-2,mod)));\n if (i&1) res+=tmp; else res-=tmp;\n res+=mod, res%=mod;\n }\n rep(i,n+1){\n res2=(res2+mt(mt(i+1,mt(C(n,i),power(C(n+m,i),mod-2,mod))),mt(m,power(n+m-i,mod-2,mod))))%mod;\n }\n cout<\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#define N 100000\n#include\nusing namespace std;\nint main(){\n\tint l,r;\n\tcin>>l>>r;\n\tset S;\n\tS.insert(1);\n\tset::iterator it;\n\tfor(it=S.begin();it!=S.end();it++){\n\t\tif(*it * 2<=r)\n\t\t\tS.insert(*it*2);\n\t\tif(*it * 3<=r)\n\t\t\tS.insert(*it*3);\n\t\tcout<<*it<=l&&*it<=r)\n\t\t\tsum++;\n\t}\n\tcout<\n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nint nmem=0;\nint *memdir[10000000];\nint memval[10000000];\n\nvoid asigna(int &a,int b)\n{\n memdir[nmem]=&a;\n memval[nmem]=a;\n a=b;\n nmem++;\n if (nmem>=10000000) {\n cout<<\"pifia\"<0) {\n nmem--;\n *(memdir[nmem])=memval[nmem];\n }\n}\n\nconst int limite=1000000;\n\nvoid inserta(vector &alcanza,int pos,int val,int primero)\n{\n pos+=primero;\n asigna(alcanza[pos],val);\n while (pos>1) {\n pos/=2;\n asigna(alcanza[pos],max(alcanza[2*pos],alcanza[2*pos+1]));\n }\n}\n\nint alcanzaanterior(vector &alcanza,int pos,int primero)\n{\n pos+=primero;\n if (alcanza[pos]) return pos-primero;\n for (;;) {\n if (pos==1) return -1;\n if (pos%2==1 and alcanza[pos-1]) {\n pos--;\n while (pos minimo[1<<21];\n\nvoid inserta(int pos,int val,int u)\n{\n pos+=1<<20;\n minimo[pos]=pair (val,u);\n while (pos>1) {\n pos/=2;\n minimo[pos]=min(minimo[2*pos],minimo[2*pos+1]);\n }\n}\n\nint minimoentre(int pos0,int pos1)\n{\n if (pos0>pos1) swap(pos0,pos1);\n pos0+=1<<20;\n pos1+=1<<20;\n if (pos0==pos1) return minimo[pos0].second;\n pair mini0=minimo[pos0];\n pair mini1=minimo[pos1];\n while (pos0+1 g[limite];\nvector > gg[limite];\nvector alcanza[limite];\nvector elemento[limite];\nint au[limite],av[limite],apendiente[limite];\nint superidentificador[limite];\nint superpadre[limite];\nint superraiz[limite];\nint superposicion[limite];\nint primero[limite];\nint tope[limite];\nint visto[limite];\nint numnodos[limite];\nint profundidad[limite];\n\nint s[limite];\n\nint posle[limite];\nint nrecorrido=0;\n\nint ancestro(int u,int v)\n{\n return minimoentre(posle[u],posle[v]);\n}\n\nvoid eliminapadre(int u,int p,int prof)\n{\n visto[u]=1;\n profundidad[u]=prof;\n posle[u]=nrecorrido;\n inserta(nrecorrido++,profundidad[u],u);\n vector &ar=g[u];\n vector nextar;\n numnodos[u]=1;\n for (int i=0;i lista;\n lista.push_back(u);\n for (;;) {\n vector &ar=g[u];\n int nextu=0;\n for (int i=0;i=numnodos[u]) nextu=v;\n else genera(v,sr,u);\n }\n if (nextu==0) break;\n u=nextu;\n lista.push_back(u);\n }\n u=lista[0];\n {\n int nn=int(lista.size())+3;\n primero[u]=1;\n while (nn>0) {\n nn/=2;\n primero[u]*=2;\n }\n tope[u]=2*primero[u];\n }\n alcanza[u]=vector (tope[u],0);\n elemento[u]=vector (tope[u],0);\n for (int i=0;i &alcanzaidu=alcanza[idu];\n int primeroidu=primero[idu];\n int posant=alcanzaanterior(alcanzaidu,superposicion[u],primeroidu);\n //cout<<\"posant \"< &alcanzaidu=alcanza[idu];\n int primeroidu=primero[idu];\n if (superpadre[u]!=superpadre[w]) {\n if (alcanzaidu[primeroidu] &alcanzaidu=alcanza[idu];\n int primeroidu=primero[idu];\n if (superposicion[u]<=alcanzaidu[primeroidu])\n return obtenerancestro(superpadre[u]);\n int posant=alcanzaanterior(alcanzaidu,superposicion[u],primeroidu);\n if (posant==-1 or alcanzaidu[primeroidu+posant] > paresidnodo[limite];\nint veo[limite];\nint numraices;\nint raices[limite];\n\nvoid eliminarepes()\n{\n if (numraices==0) return;\n sort(raices,raices+numraices);\n int last=0;\n for (int i=1;i > &ar=gg[u];\n for (int i=0;i (numids,uu));\n paresidnodo[rv].push_back(pair (numids,vv));\n apendiente[ida]=1;\n }\n }\n}\n\nvoid calcula(int u,int p,int prof)\n{\n //cout<<\"calcula \"< > &ar=gg[u];\n for (int i=0;i>n>>m>>casos;\n for (int i=0;i>au[i]>>av[i];\n if (au[i]!=av[i]) {\n int idu=computaidentificador(au[i]);\n int idv=computaidentificador(av[i]);\n if (idu==idv) apendiente[i]=1;\n else {\n\tg[au[i]].push_back(av[i]);\n\tg[av[i]].push_back(au[i]);\n\tfusiona(au[i],av[i]);\n }\n }\n }\n for (int u=1;u<=n;u++) {\n if (not visto[u]) {\n //cout<<\"tratando \"<>numnodos>>m;\n numraices=0;\n for (int i=0;i>s[i];\n //if (cas==11) cout<<\"nodo \"<>au[i]>>av[i];\n //if (cas==11) cout<<\"arista \"< (rv,i));\n\t gg[rv].push_back(pair (ru,i));\n\t}\n }\n }\n /*\n cout<<\"aristas: \";\n for (int i=0;i > &lista=paresidnodo[r];\n sort(lista.begin(),lista.end());\n for (int j=0;j > ();\n paresidnodo[r]=vector > ();\n profundidad[r]=0;\n }\n numids=0;\n recupera();\n }\n}\n", "lang": "GNU C++", "bug_code_uid": "eb55048e497a61d54683914bafde160c", "src_uid": "53f64841886b32816eadce278e636bbc", "apr_id": "dbe2347c191cf6acb93d8a063554dbf6", "difficulty": 3300, "tags": ["graphs", "trees"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7, "equal_cnt": 11, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "#include \n \nusing namespace std;\n\ntypedef long long ll;\n \nconst int N = (int) 1e6 + 7;\nconst ll M = (ll) 1e9 + 9;\n\nint main() {\t\t\t\t\t \t\n\tios_base::sync_with_stdio(0);\n\tll n, m, k;\n\tcin >> n >> m >> k;\n\tll wrong = n - m;\n\tll each = n / k;\n\tif (wrong >= each) {\n\t\tcout << m;\t\n\t} else {\n\t\tll cnt = wrong * each;\n\t\tassert(cnt <= n);\n\t\tll ans = cnt - wrong;\n\t\tll left = n - cnt;\n\t\tll total = 0;\n\t\tll good = left / k;\n\t\twhile(good) {\n\t\t\ttotal += k;\n\t\t\ttotal *= 2ll;\n\t\t\ttotal %= M;\n\t\t\t--good;\n\t\t}\t\t\t\t\n\t\tll t = left / k;\n\t\ttotal += left - t * k;\n\t\ttotal %= M;\n\t\tcout << (ans + total) % M;\n\t}\t\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "e84344f7261f20fab4915cb143c2eddb", "src_uid": "9cc1aecd70ed54400821c290e2c8018e", "apr_id": "977154156aec1b59daecdbc3d6ac3276", "difficulty": 1600, "tags": ["matrices", "number theory", "greedy", "math", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.27906976744186046, "equal_cnt": 10, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "#include \n#include \n#include \nusing namespace std;\nint main() {\n int n, m, k;\n cin >> n >> m >> k;\n vector tablelist;\n for(int i = 1; i <= n; i++) {\n for(int j = 1; j<=m; j++) {\n tablelist.push_back(i*j);\n }\n }\n sort(tablelist.begin(), tablelist.end());\n cout << tablelist[k-1];\n}\n", "lang": "GNU C++11", "bug_code_uid": "b902f0ac4685b99339dc555edd945a26", "src_uid": "13a918eca30799b240ceb9de47507a26", "apr_id": "c7c1b099b4702c0a9635549f5ed184b8", "difficulty": 1800, "tags": ["brute force", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9385749385749386, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "#include \n#include \n\n\nusing namespace std;\nvector vec;\n\n\nint main() {\n\n unsigned int n;\n cin >> n;\n int cnt = 0;\n if (n % 2 == 1)\n cout << cnt << endl;\n else {\n \n int a = n / 2;\n for (int i = 1; i <= a / 2; i++) {\n \n if (i != a - i)\n vec.push_back(i);\n }\n\n cout << vec.size() << endl;\n }\n\n \n\n\n\n return 0;\n}", "lang": "MS C++", "bug_code_uid": "7ef2293d96aafc6ce0786d7c52bfec36", "src_uid": "32b59d23f71800bc29da74a3fe2e2b37", "apr_id": "6f3d3dfc14ff34bde7e2da2c02e819e5", "difficulty": 1000, "tags": ["math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.555858310626703, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n long long int a,b,k;\n cin>>a>>b>>k;\n cout<\nusing namespace std;\n#define beshoo ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);\nlong long sum;\nint main()\n{\n int x,y,s;\n while(true)\n cin>>x>>y>>s;\n sum=abs(x)+abs(y);\n if(x==y&&x==0&&s%2==0){cout<<\"YES\";return 0;}\n if(sum==s){cout<<\"YES\";return 0;}\n if(s%sum==0){cout<<\"YES\";return 0;}\n cout<<\"NO\";\n\n return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "d879ac496daaae4c2d783aa0bdbbeaa2", "src_uid": "9a955ce0775018ff4e5825700c13ed36", "apr_id": "80b87af963f5273c4af13493d4217c60", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9985500241662639, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "#include\nusing namespace std;\n#define ll long long\n#define pb push_back\n#define mp make_pair\n#define pii pair\n#define pip pair >\n#define bs binary_search\n#define gcd __gcd\n#define fs first\n#define sc second\n#define MOD 1000000007\nint ABS(int a){return max(a,-a);}\nll ABS(ll a){return max(a,-a);}\ndouble ABS(double a){return max(a,-a);}\n\nconst int N = 2005;\nconst int M = 1000000007;\nint dp[N][N];\n\nvoid add(int &x, int y) {\n\tx+=y;\n\tif(x>=M) x-=M;\n}\n\nint main()\n{\n\t/*#ifndef ONLINE_JUDGE\n\tfreopen(\"input.txt\",\"r\",stdin);\n\tfreopen(\"output.txt\",\"w\",stdout);\n\t#endif*/\n\n\tios::sync_with_stdio(0);\n\tcin.tie(0);\n\tcout.tie(0);\n\n\tfor(int i=1;i<=N;i++)\n\t\tfor(int j=1;j<=N;j++)\n\t\t\tdp[i][j]=0;\n\n\tfor(int i=1;i<=N;i++)\n\t\tdp[1][i]=1;\n\n\tint n,k;\n\tcin>>n>>k;\n\n\tfor(int len=1;len<=k-1;len++)\n\t{\n\t\tfor(int end=1;end<=n;end++)\n\t\t{\n\t\t\tif(dp[len][end]!=0)\n\t\t\t{\n\t\t\t\tfor(int j=end;j<=n;j+=end)\n\t\t\t\t\tadd(dp[len+1][j],dp[len][end]);\n\t\t\t}\n\t\t}\n\t}\n\n\tint ans=0;\n\tfor(int i=1;i<=n;i++)\n\t\tadd(ans,dp[k][i]);\n\n\tcout<\nusing namespace std;\nint main(){\nint n;cin>>n;\nint p=2*n-1;\nwhile(n!=0){\n n=n--;\n p+=n*2-1;\n}\ncout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n/** Repeat **/\n\n#define REP(I, N) for (int I=0;I=int(A);--I)\n#define REP_1(I, N) for (int I=1;I<=int(N);++I)\n#define FOR_1(I, A, B) for (int I=int(A);I<=int(B);++I)\n#define DWN_1(I, B, A) for (int I=int(B);I>=int(A);--I)\n#define REP_C(I, N) for (int N____=int(N),I=0;I=A____;--I)\n#define REP_1_C(I, N) for (int N____=int(N),I=1;I<=N____;++I)\n#define FOR_1_C(I, A, B) for (int B____=int(B),I=A;I<=B____;++I)\n#define DWN_1_C(I, B, A) for (int A____=int(A),I=B;I>=A____;--I)\n#define DO(N) while(N--)\n#define DO_C(N) int N____ = N; while(N____--)\n#define TO(i, a, b) int s_=a VI;\ntypedef vector VS;\ntypedef vector VL;\ntypedef vector VD;\ntypedef set SI;\ntypedef set SS;\ntypedef set SL;\ntypedef set SD;\ntypedef map MI;\ntypedef map MS;\ntypedef map ML;\ntypedef map MD;\ntypedef pair PII;\ntypedef pair PIB;\ntypedef vector VII;\ntypedef set SII;\ntypedef map MII;\ntypedef vector VVI;\ntypedef vector VVII;\n\n\n/** I/O Accelerator **/\n\n/* ... :\" We are I/O Accelerator ... Use us at your own risk ;) ... \" .. */\n\ntemplate inline void RD(T &x){\n //cin >> x;\n //scanf(\"%d\", &x);\n char c; for (c = getchar(); c < '0'; c = getchar()); x = c - '0'; for (c = getchar(); c >= '0'; c = getchar()) x = x * 10 + c - '0';\n //char c; c = getchar(); x = c - '0'; for (c = getchar(); c >= '0'; c = getchar()) x = x * 10 + c - '0';\n\n}\n\ntemplate inline void OT(const T &x){\n cout << x << endl;\n //printf(\"%d\", x);\n //printf(\"%.2lf\", x);\n //printf(\"Case %d: %d\", ____T, ans)\n}\n\ntemplate inline T& _RD(T &x){ RD(x); return x;}\ninline int RD(){ int x; RD(x); return x;}\ninline LL RD_LL(){ int x; RD(x); return x;}\ninline DB RD_DB(){ DB x; RD(x); return x;}\n\ntemplate inline void RD(T0 &x0, T1 &x1){RD(x0), RD(x1);}\ntemplate inline void RD(T0 &x0, T1 &x1, T2 &x2){RD(x0), RD(x1), RD(x2);}\ntemplate inline void RD(T0 &x0, T1 &x1, T2 &x2, T3 &x3){RD(x0), RD(x1), RD(x2), RD(x3);}\ntemplate inline void RD(T0 &x0, T1 &x1, T2 &x2, T3 &x3, T4 &x4){RD(x0), RD(x1), RD(x2), RD(x3), RD(x4);}\ntemplate inline void RD(T0 &x0, T1 &x1, T2 &x2, T3 &x3, T4 &x4, T5 &x5){RD(x0), RD(x1), RD(x2), RD(x3), RD(x4), RD(x5);}\ntemplate inline void RD(T0 &x0, T1 &x1, T2 &x2, T3 &x3, T4 &x4, T5 &x5, T6 &x6){RD(x0), RD(x1), RD(x2), RD(x3), RD(x4), RD(x5), RD(x6);}\n\ntemplate inline void OT(T0 &x0, T1 &x1){OT(x0), OT(x1);}\ntemplate inline void OT(T0 &x0, T1 &x1, T2 &x2){OT(x0), OT(x1), OT(x2);}\ntemplate inline void OT(T0 &x0, T1 &x1, T2 &x2, T3 &x3){OT(x0), OT(x1), OT(x2), OT(x3);}\ntemplate inline void OT(T0 &x0, T1 &x1, T2 &x2, T3 &x3, T4 &x4){OT(x0), OT(x1), OT(x2), OT(x3), OT(x4);}\ntemplate inline void OT(T0 &x0, T1 &x1, T2 &x2, T3 &x3, T4 &x4, T5 &x5){OT(x0), OT(x1), OT(x2), OT(x3), OT(x4), OT(x5);}\ntemplate inline void OT(T0 &x0, T1 &x1, T2 &x2, T3 &x3, T4 &x4, T5 &x5, T6 &x6){OT(x0), OT(x1), OT(x2), OT(x3), OT(x4), OT(x5), OT(x6);}\n\ntemplate inline void RST(T &A){memset(A, 0, sizeof(A));}\ntemplate inline void RST(T0 &A0, T1 &A1){RST(A0), RST(A1);}\ntemplate inline void RST(T0 &A0, T1 &A1, T2 &A2){RST(A0), RST(A1), RST(A2);}\ntemplate inline void RST(T0 &A0, T1 &A1, T2 &A2, T3 &A3){RST(A0), RST(A1), RST(A2), RST(A3);}\ntemplate inline void RST(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4){RST(A0), RST(A1), RST(A2), RST(A3), RST(A4);}\ntemplate inline void RST(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, T5 &A5){RST(A0), RST(A1), RST(A2), RST(A3), RST(A4), RST(A5);}\ntemplate inline void RST(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, T5 &A5, T6 &A6){RST(A0), RST(A1), RST(A2), RST(A3), RST(A4), RST(A5), RST(A6);}\n\ntemplate inline void CLR(T &A){A.clear();}\ntemplate inline void CLR(T0 &A0, T1 &A1){CLR(A0), CLR(A1);}\ntemplate inline void CLR(T0 &A0, T1 &A1, T2 &A2){CLR(A0), CLR(A1), CLR(A2);}\ntemplate inline void CLR(T0 &A0, T1 &A1, T2 &A2, T3 &A3){CLR(A0), CLR(A1), CLR(A2), CLR(A3);}\ntemplate inline void CLR(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4){CLR(A0), CLR(A1), CLR(A2), CLR(A3), CLR(A4);}\ntemplate inline void CLR(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, T5 &A5){CLR(A0), CLR(A1), CLR(A2), CLR(A3), CLR(A4), CLR(A5);}\ntemplate inline void CLR(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, T5 &A5, T6 &A6){CLR(A0), CLR(A1), CLR(A2), CLR(A3), CLR(A4), CLR(A5), CLR(A6);}\ntemplate inline void CLR(T &A, int n){REP(i, n) CLR(A[i]);}\n//template inline void CLR_(T &A){REP}\n\ntemplate inline void FLC(T &A, int x){memset(A, x, sizeof(A));}\ntemplate inline void FLC(T0 &A0, T1 &A1, int x){FLC(A0, x), FLC(A1, x);}\ntemplate inline void FLC(T0 &A0, T1 &A1, T2 &A2){FLC(A0), FLC(A1), FLC(A2);}\ntemplate inline void FLC(T0 &A0, T1 &A1, T2 &A2, T3 &A3){FLC(A0), FLC(A1), FLC(A2), FLC(A3);}\ntemplate inline void FLC(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4){FLC(A0), FLC(A1), FLC(A2), FLC(A3), FLC(A4);}\ntemplate inline void FLC(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, T5 &A5){FLC(A0), FLC(A1), FLC(A2), FLC(A3), FLC(A4), FLC(A5);}\ntemplate inline void FLC(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, T5 &A5, T6 &A6){FLC(A0), FLC(A1), FLC(A2), FLC(A3), FLC(A4), FLC(A5), FLC(A6);}\n\n\n\n\n/** Add - On **/\n\ntemplate inline void checkMin(T &a, T b){if (b inline void checkMax(T &a, T b){if (b>a) a=b;}\ntemplate inline T sqr(T x){return x * x;}\ntemplate inline T min(T a, T b, T c){return min(min(a, b), c);}\ntemplate inline T max(T a, T b, T c){return max(max(a, b), c);}\n\n/* .................................................................................................................................. */\n\nconst int MOD = 1000000007;\nconst int INF = 0x7fffffff;\nconst DB EPS = 1e-6;\nconst DB OO = 1e15;\n\nconst int N = 20000 + 5;\n\nbool A[3], B[3], _B[3], B_[3];\nint x[3], m[3], l[3], u[3];\nint res;\n\n\nvoid dfs(){\n\n int _i, i_;\n\n/*\n if (x[0] == 10 && x[1] == 9){\n cout << _B[0] << \" \" << _B[1] << endl;\n }*/\n\n\n REP(i, 3) if (!_B[i]){\n\n if (i == 0) _i = 1, i_ = 2; else if (i == 1) _i = 0, i_ = 2; else _i = 0, i_ = 1;\n\n if (B[i] && !B_[i]){ // \ufffd\ufffd\ufffd\ufffd\n\n if (u[i] == i_) swap(_i, i_);\n\n B_[i] = true, _B[_i] = false;\n\n if (B[_i] && !B_[_i]){\n\n checkMax(res, x[i] + l[i] + l[_i] + (A[i_] ? 0 : m[i_]));\n\n }\n\n else {\n\n int x_i = x[_i];\n\n FOR_1(j, -l[i], l[i]) if (j != 0){\n\n int xx = x[i] + j;\n\n if (x[i_] != xx && (abs(x[i_] - xx) == 1 || j == 1 || j == l[i])) {\n\n checkMax(res, xx);\n\n x[_i] = xx,\n\n dfs();\n\n x[_i] = x_i;\n\n }\n\n }\n }\n\n _B[_i] = true, B_[i] = false;\n\n }\n else { // \ufffd\ufffd\ufffd\ufffd ...\n\n if (!B[i]){\n\n#define Grab(i_, d) if (!_B[i_] && x[i_] == x[i] + d) {x[i_] = x[i], B[i] = _B[i_] = true, u[i] = i_, dfs(), x[i_] = x[i] + d; B[i] = _B[i_] = false;}\n\n Grab(_i, -1); Grab(_i, 1); Grab(i_, -1); Grab(i_, 1);\n }\n\n if (!A[i]){ // \ufffd\ufffd\u00b7 ..\n A[i] = true; int xi = x[i];\n FOR_1(j, -m[i], m[i]) if (j != 0){\n int xx = xi + j;\n if (x[_i] != xx && x[i_] != xx)\n //(abs(x[_i] - xx) == 1 || abs(x[i_] - xx) == 1 || j == m[i] || j == -m[i])){\n checkMax(res, xx); x[i] = xx, dfs(), x[i] = xi;\n }\n }\n A[i] = false;\n }\n }\n }\n}\n\n\nint main(){\n\n // freopen(\"in.txt\", \"r\", stdin);\n //freopen(\"out.txt\", \"w\", stdout);\n //ios::sync_with_stdio(false);\n\n\n REP(i, 3) RD(x[i], m[i], l[i]); res = max(x[0], x[1], x[2]);\n\n //x[0] = 10, x[1] = 9; x[2] = -18;\n //x[0] = 8, x[1] = 9, x[2] = -18;A[0] = true;\n\n dfs(); OT(res);\n}\n", "lang": "GNU C++", "bug_code_uid": "d8b4ab3ea78ac246b0bdb9a385238981", "src_uid": "a14739b86d1fd62a030226263cdc1afc", "apr_id": "a7a517dd39da8bfad8c56f31b9120918", "difficulty": 2500, "tags": ["brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.5291970802919708, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 5, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "#include \n#include \n#include \n#include \nusing namespace std;\nint main () {\n\tlong long n,x,i=1;\n\tint counter=0;\n\tcin>>n;\n\tvectorvec;\n\twhile (i<=n) {\n\t\tvec.push_back(i);\n\t\ti++;\n\t}\n\tfor (int i=0; i\nusing namespace std;\nconst int maxn=1e6+100;\ntypedef long long ll;\nconst ll mod=998244353;\nll fact[maxn],inv[maxn];\n\nll qpow(ll a, ll b)\n{\n ll ans=1;\n while(b)\n {\n if(b&1) ans = ans*a%mod;\n a=a*a%mod;\n b>>=1;\n }\n return ans;\n}\nll n;\nint main()\n{\n scanf(\"%I64d\",&n);\n fact[0]=1;\n for(int i=1;i<=n;++i) fact[i]=i*fact[i-1]%mod;\n inv[n]=qpow(fact[n],mod-2);\n for(int i=n-1;i>=1;--i) inv[i]=inv[i+1]*(i+1)%mod;\n \n ll ans=( qpow(3,n*n)-qpow( (qpow(3,n)-3+mod)%mod , n) + mod )%mod;\n \n ll xishu=-1;\n for(int i=1;i<=n;++i)\n {\n ll tmp=fact[i]*(3*qpow( (qpow(3,n-1)-1+mod)%mod),n )%mod + (qpow(3,i)-3+mod)%mod*qpow(3,(n-i)*n)%mod;\n ans= (ans+ tmp*xishu%mod +mod) %mod;\n }\n printf(\"%I64d\\n\",ans);\n return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "04f92a41375700a63640f153c8ea0ac0", "src_uid": "6e4b0ee2e1406041a961582ead299a3a", "apr_id": "07183e514bf4799d3e660ed5be371811", "difficulty": 2500, "tags": ["math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.10068892421833599, "equal_cnt": 23, "replace_cnt": 17, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 23, "bug_source_code": "#include \n#define ll long long\nusing namespace std;\nconst int maxn = 100010;\nstruct node{\n int y,z;\n};\nint f(int x) {\n if(x<0) return -x; else return x;\n}\nint a[maxn],vis[maxn];\nvectorg[maxn];\nint ans;\n\nvoid dfs(int x,int d) {\n int z = g[x].size();\n for(int i=0; i\nusing namespace std;\nvector>v;\nmapmp;\npairp[10000];\nint main()\n{\n ios_base::sync_with_stdio(0);\n cin.tie(0);\n cout.tie(0);\n long long n,m,i,j,k,x=0,y=10000000000,z,d,a,b;\n cin>>n;\n for(i=1;i<=n;i++)\n {\n for(j=1;j<=n;j++)\n {\n if(i*j>=n)\n {\n x=2*(i+j);\n y=min(y,x);\n\n }\n }\n }\n cout<\nusing namespace std;\nint main()\n{\n long long int c,v,v1,a,l,d=1,e,f;\n cin>>c>>v>>v1>>a>>l;\n e=v;\n f=v;\n while(e\n\nusing namespace std;\n\nstring mabna(int n,int k){\n\tint x=n;\n\tstring ans=\"\";\n\twhile (x){\n\t\tans+=char(x%n+'0');\n\t\tx/=n;\n\t}\n\treverse(ans.begin(),ans.end());\n\treturn ans;\n}\n\nint main(){\n\tint n;\n\tcin >> n;\n\tfor (int i=1;i\n#include \n#include \n#include \nusing namespace std;\nint n, q;\nchar ma[40][2][4];\nchar a[10];\nint ans;\nchar s[50000][8];\nint cnt;\n\nbool cmp(char x[], char y[]){\n\tint tmp = strcmp(x, y);\n\tif (tmp >= 0)return 1;\n\treturn 0;\n}\n\nvoid dfs(int x, char t[]){\n\tif (x == n){\n\t\tint i, j;\n\t\tj = strlen(t);\n\t\tfor (i = 0; i <= j; i++)\n\t\t\ts[cnt][i] = t[i];\n\t\tcnt++;\n\n\t\treturn;\n\t}\n\tint l = strlen(t);\n\tint i, j, u;\n\tfor (i = 0; i\n#include\n#include\nusing namespace std;\nint main()\n{\n char a[1005],b[1005];\n int c[1005];\n memset(a,0,sizeof(a));\n memset(b,0,sizeof(b));\n memset(c,0,sizeof(c));\n while(cin>>a)\n {\n cin>>b;\n int len=strlen(a)10)\n {\n c[i+1]=c[i]/10;\n c[i]%=10;\n }\n }\n if(c[len]==0) len--;\n for(int i=len;i>=0;i--)\n printf(\"%d\",c[i]);\n printf(\"\\n\");\n memset(a,0,sizeof(a));\n memset(b,0,sizeof(b));\n memset(c,0,sizeof(c));\n\n }\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "cff92ad29a82dfcdbc919caa5528d995", "src_uid": "b6e3f9c9b124ec3ec20eb8fcea075add", "apr_id": "c802aba111f311173a7a50fb154b8b00", "difficulty": 1500, "tags": ["brute force", "constructive algorithms", "implementation", "dsu"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.5343866171003717, "equal_cnt": 17, "replace_cnt": 9, "delete_cnt": 3, "insert_cnt": 5, "fix_ops_cnt": 17, "bug_source_code": "#include \nusing namespace std;\ntypedef long long ll;\ntypedef long double ld;\nconst ld EPS = 1e-10;\nconst ll MOD = 1e9 + 7;\nconst ll OO = 1e18 + 9;\n\nconst int N = 1e6 + 1;\n\nll a[14];\n\nint main() {\n\t//freopen(\"input.in\", \"r\", stdin);\n\t//freopen(\"output.txt\", \"w\", stdout);\n\tios_base::sync_with_stdio(false);\n\tcin.tie(NULL);\n\tcout.tie(NULL);\n\n\tfor(int i=0;i<14;++i) cin >> a[i];\n\tll ans = 0;\n\tfor(int i=0;i<14;++i) {\n\t\tll tmp = 0,md = a[i]%14,dv = a[i]/14;\n\t\tint j = i+1;\n\t\twhile(md) {\n\t\t\tll x = dv + a[j] + 1;\n\t\t\tif(x%2==0) tmp += x;\n\t\t\tj = (j+1)%14;\n\t\t\tmd--;\n\t\t}\n\t\twhile(j <= i) {\n\t\t\tif((a[j] + dv)%2 == 0) tmp += (a[j] + dv);\n\t\t\tj++;\n\t\t}\n\t\tans = max(ans,tmp);\n\t}\n\tcout << ans;\n\n\n}\n#include \nusing namespace std;\ntypedef long long ll;\ntypedef long double ld;\nconst ld EPS = 1e-10;\nconst ll MOD = 1e9 + 7;\nconst ll OO = 1e18 + 9;\n\nconst int N = 1e6 + 1;\n\nll a[14];\n\nint main() {\n\t//freopen(\"input.in\", \"r\", stdin);\n\t//freopen(\"output.txt\", \"w\", stdout);\n\tios_base::sync_with_stdio(false);\n\tcin.tie(NULL);\n\tcout.tie(NULL);\n\n\tfor(int i=0;i<14;++i) cin >> a[i];\n\tll ans = 0;\n\tfor(int i=0;i<14;++i) {\n\t\tll tmp = 0,md = a[i]%14,dv = a[i]/14;\n\t\tint j = i+1;\n\t\twhile(md) {\n\t\t\tll x = dv + a[j] + 1;\n\t\t\tif(x%2==0) tmp += x;\n\t\t\tj = (j+1)%14;\n\t\t\tmd--;\n\t\t}\n\t\twhile(j <= i) {\n\t\t\tif((a[j] + dv)%2 == 0) tmp += (a[j] + dv);\n\t\t\tj++;\n\t\t}\n\t\tans = max(ans,tmp);\n\t}\n\tcout << ans;\n\n\n}\n\n", "lang": "GNU C++11", "bug_code_uid": "eb0cf281386c1ae61177258ebf6e0793", "src_uid": "1ac11153e35509e755ea15f1d57d156b", "apr_id": "273eaac704b40fb9779b293ce1197f2f", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.30545062061521855, "equal_cnt": 19, "replace_cnt": 12, "delete_cnt": 6, "insert_cnt": 1, "fix_ops_cnt": 19, "bug_source_code": "#include \nusing namespace std;\n\n#define t(t) int t; cin>>t; while(t--)\n\n\n\nint main()\n{\n\n// #ifndef ONLINE_JUDGE\n// \tfreopen(\"input.txt\", \"r\", stdin);\n// \tfreopen(\"output.txt\", \"w\", stdout);\n// #endif\n\n\tint n;\n\n\tcin >> n;\n\tstring s;\n\n\tcin >> s;\n\n\tvector a;\n\n\n\tint i = 0, max = INT_MIN;\n\tstring z;\n\n\twhile (s[i + 1] != '\\0')\n\t{\n\t\tstring q = s.substr(i, 2);\n\n\t\tif (a.size() == 0)\n\t\t{\n\t\t\ta.push_back(q);\n\t\t\tmax = a[0].size();\n\t\t\tz = a[0];\n\t\t}\n\n\t\telse\n\n\t\t{\n\t\t\tfor (int j = 0; j < a.size(); j++)\n\t\t\t{\n\t\t\t\tif (q == a[j])\n\t\t\t\t{\n\t\t\t\t\ta[j] += q;\n\t\t\t\t\tif (max < a[j].size())\n\t\t\t\t\t{\n\t\t\t\t\t\tmax = a[j].size();\n\t\t\t\t\t\tz = a[j].substr(0, 2);\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\ta.push_back(q);\n\t\t\t\t\tif (max < a.back().size())\n\t\t\t\t\t{\n\t\t\t\t\t\tmax = a[j].size();\n\t\t\t\t\t\tz = a[j].substr(0, 2);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\n\t}\n\n\n\tcout << z << endl;\n\n\treturn 0;\n\n\n\n\n\n\n\n\n\n}", "lang": "GNU C++17", "bug_code_uid": "363862a07b460e08d373a1cfe2ba25cd", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "2b7d593fb11d6e1554cea0ee2635fdff", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5063938618925832, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "#include\nusing namespace std;\nint main(){\n\tint n,a[10001],s,d=1,i=0;\n\tcin>>n;\n\tfor(int i=0;i>a[i];\n\t}\n\twhile(i\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define fr(i,n) for(__typeof(n) i=0; i<(n); i++)\n#define fre(i,n) for(__typeof(n) i=1; i<=(n); i++)\n#define frt(i,a,b) for(__typeof(b) i=(a); i<=(b); i++)\n#define inf 1061109567000LL\n#define PI 3.14159265358979323846264338327950\n#define PB(x) push_back(x)\n#define ALL(x) x.begin(),x.end()\n#define SZ size()\n#define eps 1e-9\n#define VI vector\n#define VS vector\n#define LL long long\n#define MII map\n#define MSI map\n#define MIS map\n#define CLEAR(x) memset(x,0,sizeof(x));\n#define MAX(a,b) (a>b?a:b)\n#define MIN(a,b) (a= 0 && middle+i <= end && s[middle-1-i] == s[middle+i]; i++);\n if (middle - i - 1 < 0 || middle+i > end)\n return true;\n } else {\n int middle = start + sz/2;\nint i;\n for (i = 1; middle - i >= 0 && middle+i <= end && s[middle-i]==s[middle+i]; i++);\n if (middle - i < 0 || middle+i > end)\nreturn true;\n }\nreturn false;\n}\n//Polya-Burnside theory : (n^6+3n^4+12n^3+8n^2)/24;\nint euclidd,euclidx,euclidy;\nvoid extendedeuclid(int a,int b)\n{\n if(b==0)\n {\n euclidd=a;\n euclidx=1;\n euclidy=0;\n return ;\n }\n extendedeuclid(b,a%b);\n int d1,x1,y1;\n d1=euclidd;\n x1=euclidx;\n y1=euclidy;\n euclidx=y1;\n euclidy=x1-((a/b)*y1);\n}\ndouble area_triangle(double x1,double y1,double x2,double y2,double x3,double y3)\n{\n double a;\n a=x1*(y2-y3)+y1*(x3-x2)+((x2*y3)-(y2*x3))+eps;\n a=a/2+eps;\nreturn a;\n}\ndouble dist_2point(double x1,double y1,double x2,double y2)\n{\n double d;\n d=sqrt(pow((x1-x2),2)+pow((y1-y2),2));\n return d;\n}\nint binary_search(int a[],int n,int l,int u)\n{\n int mid;\n if(l>u)\n return 0;\n mid=floor(l+u)/2;\n if(a[mid]==n)\n return mid;\n else if(a[mid]>n)\n binary_search(a,n,l,mid-1);\n else\n binary_search(a,n,mid+1,u);\n}\nlong gcd(long a,long b)\n{\nwhile(b>0)\n{\na=a%b;\na=a^b;\nb=b^a;\na=a^b;\n}\nreturn a;\n}\nlong lcm(long a,long b)\n{\n long x=(a*b)/gcd(a,b);\n return x;\n}\nlong is_prime(long n)\n{\n long ii;\nif (n == 1)\n return 0;\nif (n == 2)\n return 1;\nif (n%2 == 0)\n return 0;\nfor (ii=3;ii*ii<=n;ii=ii+2)\n if (n%ii == 0)\n return 0;\nreturn 1;\n}\nlong long bigmod(long long b,long long p,long long m)\n{\n if(b==0) return 0;\n long long x,power;\n x=1;\n power=b%m;\n while(p)\n {\n if(p%2==1)\n x=(x*power)%m;\n power=(power*power)%m;\n p=p/2;\n }\n return x;\n}\ntypedef pair pr;\ndouble a,b,c;\nvoid abc(pr m, pr n)\n{\n a=m.second-n.second;\n b=-(m.first-n.first);\n c=(-b)*m.second-a*m.first;\n}\nint intersec(pr p1,pr p2,pr p3, pr p4)\n{\n double x,y,a1,a2,b1,b2,c1,c2;\n abc(p1,p2);\n a1=a;b1=b;c1=c;\n abc(p3,p4);\n a2=a;b2=b;c2=c;\n if(a1*b2==a2*b1) return 0;\n x=(b1*c2-b2*c1)/(a1*b2-b1*a2);\n y=((c1*a2)-(a1*c2))/(a1*b2-b1*a2);\n if((x>=p1.first&&x<=p2.first)||(x<=p1.first&&x>=p2.first))\n if((x>=p3.first&&x<=p4.first)||(x<=p3.first&&x>=p4.first))\n if((y>=p3.second&&y<=p4.second)||(y<=p3.second&&y>=p4.second))\n if((y>=p1.second&&y<=p2.second)||(y<=p1.second&&y>=p2.second))\n return 1;\n return 0;\n}\nint main()\n{\n while(1)\n {\nios_base::sync_with_stdio(false);\n//freopen(\"input.txt\",\"r\",stdin);\n//long i,n;\n int a[10]={0},i,j,k;\n int m=0;\n int n=0;\n int p=0;\nfor(i=0;i<4;i++)\ncin>>a[i];\n\nfor(i=0;i<4;i++)\n\n for(j=i+1;j<4;j++)\n\n for(k=j+1;k<4;k++)\n {\n\n if(a[i]\nusing namespace std;\nlong long int v,l=1,q[1000];\nlong long int c[6],d[6],h=0;\nint f(int i)\n{\n\tv=c[i];\n\tif((v-d[i])%2==0)\n\treturn 1;\n\t\telse\n\treturn 0;\n}\nint main()\n{\n\tlong long int n,m,i,j,a,b,mi=999999;\n\tcin>>n>>m>>i>>j>>a>>b;\n\tint y=0,s=0;\n\tif(((i!=1||j!=1)&&(i!=n||j!=1)&&(i!=1||j!=m)&&(i!=n||j!=m))&&((i-a<=0&&i>1&&i+a>n)||(j-b<=0&&j>1&&j+b>m)))\n{\tcout<<\"Poor Inna and pony!\";\n\treturn 0;\n}\n\t\tif((i-1)%a==0&&(j-1)%b==0)\n\t{c[++y]=max((i-1)/a,(j-1)/b);\n\td[++s]=min((i-1)/a,(j-1)/b);\n}\nif((n-i)%a==0&&(j-1)%b==0)\n{\n\tc[++y]=max((n-i)/a,(j-1)/b);\n\td[++s]=min((n-i)/a,(j-1)/b);\n\n}\nif((i-1)%a==0&&(m-j)%b==0)\n{\n\tc[++y]=max((i-1)/a,(m-j)/b);\n\td[++s]=min((i-1)/a,(m-j)/b);\n}\nif((n-i)%a==0&&(m-j)%b==0)\n{\n\tc[++y]=max((n-i)/a,(m-j)/b);\n\td[++s]=min((n-i)/a,(m-j)/b);\n\n}\n\tfor(int g=1;g<=y;g++)\n\t{\n\t\tif(f(g))\n\t\t{\n\t\tq[l]=v;\n\t\tl++;\n\t\th++;\n\t\t}\n\t\t\n\t}\n\tif(h==0)\n\tcout<<\"Poor Inna and pony!\";\n\telse\n\t{\n\t\tfor(int i=1;iq[i])\n\t\t\tmi=q[i];\n\t\t}\n\t\tcout<\n#define ll long long int\nusing namespace std;\n\nll n,s,i,j,s1=0,sum;\nint main(){\n\tcin>>n;\n\tvector a(n);\n\twhile(n>0){\n\t\ts=n%10;\n\t\ta[j]=s;\n\t\tj++;\n\t\tn=n/10;\n\t}\n\tfor(i=j-1;i>=0;i--){\n\t\t\tif(a[i]==0){\n\t\t\t\ts1=2*s1;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tif(a[i]==1){\n\t\t\t\t\t\ts1=(2*s1+1);\n\t\t\t\t}\n\t\t\t\n\t\t\t}\n\t\t}\n\t\tif(s1==20){\n\t\t\tcout<<\"3\"<s1){\n\t\t\t\tcout<\nusing namespace std;\nint sum_digits(int a)\n{\n int sum=0;\n while(a!=0)\n {\n sum+=a%10;\n a/=10;\n }\n return sum;\n}\nint main()\n{\n int a,temp,sum=0\n cin>>a;\n sum=sum_digits(a);\n if(!sum%4)\n cout<\n\nusing namespace std;\nint maxvote(int n,int a[])\n{\nint pos=0;\nfor(int i=0;i=a[pos])\n pos=i;\n}\nreturn pos;\n}\nvoid minbribe(int n,int a[],int &bribe)\n{\nint m=maxvote(n,a);\nif(m==0)\nreturn;\na[m]--;\na[0]++;\nbribe++;\nminbribe(n,a,bribe);\n}\nint main()\n{\nint n,a[50];\ncin>>n;\nfor(int i=0;i>a[i];\nint bribe=0;\nminbribe(n,a,bribe);\ncout<\nusing namespace std;\n\n#define ll long long\n#define pb push_back\n#define FastIO cin.sync_with_stdio(false),cin.tie(NULL)\n#define val first\n\nll max(ll a, ll b){\n if(a>b) return a;\n return b;}\n\nll min(ll a, ll b){\n if(a= 0 && i >= n-x; i--)if(a[i] <= a[n])return false;\n\treturn true;\n}\n\nint main(){\n\tFastIO;\n\tint t = 1;\n\t\n\t//cin >> t;\n\n\twhile(t--){\n\t\tint k;\n\t\tcin >> k;\n\t\tstring s;\n\t\tll tp = 1;\n\t\twhile(s.size() <= k){\n\t\t\ts += to_string(tp);\n\t\t\ttp++;\n\t\t}\n\t\tcout << s[k] << \"\\n\";\n\t}\n\n return 0;\n}\n\n\n/*\nfor(int i = 2; i< N; i++){\n\t\tif(!b[i]){\n\t\t\tprm.pb(i);\n\t\t\tfor(int j = 2; j *i < N; j++)b[i*j] = true;\n\t\t}\n\t}\n */\n\n\n/*void dfs(int u, int par){\n\tch[u] = true;\n\th[u] = h[par]+1;\n\the[ h[u] ].pb(u);\n\tfor(int i = 0; i < v[u].size(); i++){\n\t\tif(!ch[ v[u][i] ]){\n\t\t\tdfs(v[u][i], u);\n\t\t}\n\t}\n}*/\n", "lang": "GNU C++17", "bug_code_uid": "cb460bd6a799f86667a21e3f29fde3be", "src_uid": "1503d761dd4e129fb7c423da390544ff", "apr_id": "1e0c7dbb242d56a4096edf904635a2c2", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9883040935672515, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include \n#define bit skwkdfkw\nusing namespace std;\nlong long bit[70],f[70][130][2],ans=0;\nint end=0;\nlong long dp(long long sum,int tot,int l1,int l2){\n\tint lg=log2(sum);\n\tmemset(f,0,sizeof(f));\n\tf[0][0][0]=1;\n\tfor(int i=1;i<=lg;i++){\n\t\tlong long d=(sum>>i)&1;\n\t\tint ed=i*2-2;\n\t\tfor(int j=0;j<=ed;j++) for(int k=0;k<=1;k++) for(int p1=0;p1<=1;p1++) for(int p2=0;p2<=1;p2++){\n\t\t\tif((in) break;\n\t\ts=n%(bit[i]-1);\n\t\tfor(int j=i;j>=1;j--) if(s>=bit[j]-1) s-=bit[j]-1;\n\t\tif(!s) ans++;\n\t}\n\tfor(int l1=1;l1\nusing namespace std;\n#define int long long\nint n,dp[55][105][2];\nint calc(int cnt,int l,int r,int res)\n{\n memset(dp,0,sizeof(dp));\n dp[0][0][0]=1;\n int maxn=0;\n for (int i=1;(1ll<cnt) continue;\n int k=(res>>i)&1;\n k^=p1;\n k^=p2;\n dp[i][j+p1+p2][(k+p1+p2)/2]+=dp[i-1][j][k];\n }\n }\n }\n }\n return dp[maxn][cnt][0];\n}\nsigned main()\n{\n cin>>n;\n int ans=0;\n for (int i=0;(1ll<\n\n\tusing namespace std;\t\n\tint main()\n\t{\n\t\n\t\tint n;\n\t\tcin >> n;\n\t\tint cnt=1;\n\t\tint gcnt=1;\n\t\tbool h = 1;\n\t\tfor (int i = 0; i < n; i++)\n\t\t{ bool x = 0;\n\t\tif (h)\n\t\t{\n\t\t\twhile (true) {\n\t\t\t\tcin >> x;\n\t\t\t\ti++;\n\t\t\t\tif (x)\n\t\t\t\t{\n\t\t\t\t\th = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\tcin >> x;\n\t\t\t\n\t\t\tif (x)\n\t\t\t{\n\t\t\t\tgcnt *= cnt;\n\t\t\t\tcnt = 1;\n\t\t\t}\n\t\t\telse\n\t\t\t\tcnt++;\n\n\t\t}\n\t\tcout << gcnt;\n\n\t}", "lang": "MS C++", "bug_code_uid": "797aefb03a113768436c9cc9b7829f79", "src_uid": "58242665476f1c4fa723848ff0ecda98", "apr_id": "1604d6b04b9f5fde522e0fdef5232525", "difficulty": 1300, "tags": ["combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9295558958652373, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "#include \n#include \nusing namespace std;\ntypedef long ll;\n#define endl \"\\n\"\n#define debug cout<<\" here \"\n#define For(i,n) for(int i=0;i>n;\nll f=1;\nFor(i,n){\nf*=i+1;f%=m;\n }\nll p=powerfn(n-1);\ncout<>tc;\n while(tc--){\n solve();\n \n }\n}", "lang": "GNU C++14", "bug_code_uid": "80cc251f23d47cc22e4b085240f9f10e", "src_uid": "3dc1ee09016a25421ae371fa8005fce1", "apr_id": "4c0bb5376d3f32e4729da0e0e3852a0f", "difficulty": 1500, "tags": ["graphs", "dp", "math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9584487534626038, "equal_cnt": 9, "replace_cnt": 2, "delete_cnt": 8, "insert_cnt": 0, "fix_ops_cnt": 10, "bug_source_code": "// BEGIN CUT HERE\n// END CUT HERE\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\n\n\nint main( ) \n{\n \n string s;\n cin>>s;\n char prev;\n int c;\n c=1;\n \n if(s.size()==1)\n return 1;\n prev=s[0];\n for(int i =1; i5)\n c++;i--;}\n }\n cout<\n#include \nusing namespace std;\nint n, a, b, c, p = 1000000009;\nint main()\n{\n\ta = 1, b = 2, c = 4;\n\tscanf(\"%d\", &n);\n\twhile (n -= 2)\n\t{\n\t\tc = (long long)c * a % p;\n\t\tb += c, if (b >= p) b -= p;\n\t\ta = (a << 1) + 3, if (a >= p) a -= p;\n\t}\n\tb = (long long)(b * b + 1) * 2 % p;\n\tprintf(\"%d\\n\", b);\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "e53859f9506cbcc16e334e60421b46ed", "src_uid": "dbcb1077e7421554ba5d69b64d22c937", "apr_id": "85f7220dbb370c90c3373e630575ae10", "difficulty": 2600, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9775561097256857, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "// gskhirtladze\n\n#include\n#include\n#include\n\nusing namespace std;\n\nmain()\n{\n cin>>n;\n if ((n & (n-1)) == 0) cout<<\"YES\"<\n#define ll long long int\n#define mp make_pair\n#define rep(i,a,n) for(ll i=a;i(0))\n#define sz(r) r.size()\n#define sc second\n#define fs first\nusing namespace std;\nll sortbyfirst(const pair&a,const pair&b)\n{\n return (a.first>b.first);\n}\nint main()\n{\n fast;\n ll a,b,c,d,r,q,f=0,i=0;\n cin>>a>>b>>c;\n vectorv;\n ll dv=b;\n d=a;\n ll cnt=0;\n while(1)\n {\n q=d/dv;\n r=d%dv;\n if(r!=0)\n {\n d=r*10;v.pb(r);\n if(q==c && cnt>0)\n {cout<1)\n {\n if(v[i]==v[i-1])\n {cout<<\"-1\";r0;}\n i++;\n }\n cnt++;\n }\n else\n {break;}\n }\n if(cnt>0 && q==c)\n cout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstatic constexpr int MAXN = 1e6 + 10;\n\ntypedef std::pair pii;\n\nint main() {\n int n, a, b, c;\n std::cin >> n >> a >> b >> c;\n long long answer = 0;\n for (int i = 0; i <= std::min(a, n / 2); i++) {\n for (int j = 0; j <= std::min(b, n); j++) {\n int have = 2 * i + j;\n int need = n - have;\n if (need < 0)\n continue;\n\n if (c >= need * 2) {\n answer++;\n }\n }\n }\n\n std::cout << answer << std::endl;\n return EXIT_SUCCESS;\n}", "lang": "GNU C++11", "bug_code_uid": "64b184c7b79f7212995f98a4ce58b5ac", "src_uid": "474e527d41040446a18186596e8bdd83", "apr_id": "c27348f6dc491cef81faea71847a7a8a", "difficulty": 1500, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9921033740129217, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#pragma comment(linker, \"/STACK:256000000\")\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n\ntemplate\ndouble sqrt(T x)\n{\n\treturn sqrt((double) x);\n}\n\ntemplate\nT sqr (T x)\n{\n\treturn x*x;\n}\n\n\n#define eprintf(...) fprintf(stderr, __VA_ARGS__)\n#define X first\n#define Y second\n#define pb push_back\n#define mp make_pair\n//#define foreach(e,x) for(__typeof(x.begin()) e=x.begin();e!=x.end();++e)\n\n\n\nconst double PI = acos(-1.0);\nconst int INF = 1000000000;\nconst int MOD = 1000000007;\n\nvoid wa()\n{\n\tcout<<5;\n\texit(0);\n}\n\nvoid tl()\n{\n\twhile(1);\n}\n\nvoid pe()\n{\n\tcout<<\"abc abc\\n 453534 wff sf sd\\n\";\n\texit(0);\n}\n\nvoid re()\n{\n\texit(1);\n}\n\nvoid ml()\n{\n\tint *b = new int[1000];\n}\n\n\n//#define ONLINE_JUDGE\n\nint main()\n{\n\tdouble TIME_START = clock();\n#ifndef ONLINE_JUDGE\n\t//freopen(\"in.txt\",\"r\",stdin);\n\t//freopen(\"out.txt\",\"w\",stdout);\n#endif\n\n\n\tint n;\n\tcin >> n;\n\tunsigned long long ans = 1,lay;\n\tif ( n >= 2)\n\t{\n\t\tlay = 12;\n\t\tfor (int x = 2 ; x <= n ; x++ ) \n\t\t{\n\t\t\tans += lay;\n\t\t\tlay *= 2;\n\t\t\tlay %= 2000000001;\n\t\t\tans %= 2000000001;\n\t\t}\n\n\t}\n\n\tcout<\n\nusing namespace std;\n\nint S,n,i,x,k;\nstack p;\nint main()\n{\ncin>>n;\ncin>>S;\nx=k=i=0;\nwhile(x!=S)\n{\n while(xS){p.pop();x=x-(n-i);k--;}\ni++;\n}\ncout<\n#include\n#include\n#include\n#include\nusing namespace std;\nconst int N=2000004;\nstring a[10];\nstring b[20];\nint main()\n{\n int n;\n a[2]=\"twenty\";\n a[3]=\"thirty\";\n a[4]=\"forty\";\n a[5]=\"fifty\";\n a[6]=\"sixty\";\n a[7]=\"seventy\";\n a[8]=\"eighty\";\n a[9]=\"ninety\";\n b[1]=\"one\";\n b[2]=\"two\";\n b[3]=\"three\";\n b[4]=\"four\";\n b[5]=\"five\";\n b[6]=\"six\";\n b[7]=\"seven\";\n b[8]=\"eight\";\n b[9]=\"nine\";\n b[10]=\"ten\";\n b[11]=\"eleven\";\n b[12]=\"twelve\";\n b[13]=\"thirteen\";\n b[14]=\"fourteen\";\n b[15]=\"fifteen\";\n b[16]=\"sixteen\";\n b[17]=\"seventeen\";\n b[18]=\"eighteen\";\n b[19]=\"nineteen\";\n while(scanf(\"%d\",&n))\n {\n if(n<20)\n {\n cout<\nusing namespace std;\n#define all(v) (v).begin(),(v).end()\n#define pb(x) push_back(x)\n#define REP(i,x,y) for(int (i)=(x);(i)<(y);(i)++)\n#define REPIT(it,A) for(typeof(A.begin()) it = (A.begin()); it!=A.end();it++)\n#define sqr(x) ((x)*(x))\n#define mp(x,y) make_pair((x),(y))\n#define fast_io() ios_base::sync_with_stdio(0);cin.tie(0); \n//#define NDEBUG 1\n#define fst first\n#define snd second\n#define itm1 fst.fst\n#define itm2 fst.snd\n#define itm3 snd\n#define mt(a,b,c) mp(mp(a,b),c)\n#define sz(v) ((int)v.size())\ntypedef pair ii;\ntypedef vector vi;\ntypedef vector vii;\ntypedef long long ll;\ntypedef unsigned long long ull;\ntypedef long double ld;\ntypedef pair tri;\ntypedef unsigned int ui;\n\nconst int MOD = 1000000007;\n\nint n;\nint a[7];\nint cum[7];\nint id[770000]; // maxheight - 1\n\nmap dp[770000][7][2]; // dp[pos][height][isBaseBlocked][msk], with 0 <= msk < 2^7 = 128\n\nconst int FULL = 127;\n\nint bprn(int x){\n\tvector v;\n\twhile (x) {\n\t\tv.pb(x%2);\n\t\tx /= 2;\n\t}\n\treverse(all(v));\n\tREP(i,0,v.size()) cerr << v[i];\n}\n\nint go(int i, int h, int b, int msk){\n\tif (h > id[i]){\n\t\ti++;\n\t\th = 0;\n\t\tb = 1;\n\t\tint wall = (1<<(id[i]+1)) - (1<<(id[i-1]+1));\n//\t\tcerr << \"At i:\" << i << \", wall:\"; bprn(wall); cerr << endl;\n\t\tmsk |= wall;\n\t}\t\n\n\tif (i >= n) return 1;\n\tif (dp[i][h][b].count(msk)) return dp[i][h][b][msk];\n\n\n\tint top = (h == id[i]);\n\tint right = (i == n-1);\n\tint rem = 4 - b - top - right - (int)((bool)(msk & 1< 1 && !right) ans = (ans + go(i,h+1,0,msk | (1< 1 && !top) ans = (ans + go(i,h+1,1,msk & ~(1< 2 && !top && !right) ans = (ans + go(i,h+1,1,msk | (1<> a[i];\n\tcum[0] = 0;\n\tREP(i,1,8) cum[i] = cum[i-1]+a[i-1];\n\tn = cum[7];\n\tint u = 0;\n\tREP(i,0,n) {\n\t\twhile (cum[u+1] <= i) u++;\n\t\tid[i] = u;\n\t}\n//\tREP(i,0,n) cerr << i << \": \" << id[i] << endl;\n\n\tcout << go(0,0,1,(1<<(id[0]+1))-1);\n\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "647a676c6de83a03529d30184e126198", "src_uid": "a4bda63b95dc14185c47a08652fe41bd", "apr_id": "355adc373b90461d11c0556170c2fccd", "difficulty": 2700, "tags": ["matrices", "dp"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.24878048780487805, "equal_cnt": 25, "replace_cnt": 15, "delete_cnt": 4, "insert_cnt": 6, "fix_ops_cnt": 25, "bug_source_code": "#include \n\nusing namespace std;\n\nint main()\n{\n bool check=true;\n\n string s,out=\"\";\n cin >> s;\n\n if(((int)s[0]>=97 && (int)s[0]<=122))\n {\n out = s[0]-32;\n }\n\n if(((int)s[0]>=65 && (int)s[0]<=90))\n {\n out = s[0];\n }\n\n for(int i=1; i=97 && s[i+1]>=90) && i\n#include \n#include \n#include \n#include \nusing namespace std;\n\ndouble d(int _x1,int _y1,int _x2 ,int _y2)\n{\n\tdouble d1=(pow(_x1-_x2,2)+pow(_y1-_y2,2));\n\treturn d1;\n}\nbool Right (double d1, double d2,double d3)\n{\n\tif(d1+d2==d3) return 1;\n\t\treturn 0;\n}\nbool t(int x1,int y1,int x2,int y2,int x3,int y3)\n{\n\tdouble d1=d(x1,y1,x2,y2);\n\tdouble d2=d(x1,y1,x3,y3);\n\tdouble d3=d(x3,y3,x2,y2);\n\tif(Right(d1,d2,d3)||Right(d2,d1,d3)||Right(d1,d3,d2))return 1;\n}\nint main()\n{\n\twhile (true)\n\t{\n\tint x1,y1,x2,y2,x3,y3;\n\tscanf(\"%d %d %d %d %d %d\",&x1,&y1,&x2,&y2,&x3,&y3);\n\tif(t( x1,y1,x2,y2,x3,y3)) printf (\"RIGHT\\n\");\n\telse if(t( x1-1,y1,x2,y2,x3,y3)||t( x1+1,y1,x2,y2,x3,y3)||t( x1,y1-1,x2,y2,x3,y3)||t( x1,y1+1,x2,y2,x3,y3)||\n\t\t t( x1,y1,x2-1,y2,x3,y3)||t( x1,y1,x2+1,y2,x3,y3)||t( x1,y1,x2,y2-1,x3,y3)||t( x1,y1,x2,y2+1,x3,y3)||\n\t\t\tt( x1,y1,x2,y2,x3-1,y3)||t( x1,y1,x2,y2,x3+1,y3)||t( x1,y1,x2,y2,x3,y3-1)||t( x1,y1,x2,y2,x3,y3+1))\n\t\t\tprintf(\"ALMOST\\n\");\n\telse\n\t\tprintf(\"NEITHER\\n\");\n\t}\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "82b8bfdfac2bd8ee8aab898934348172", "src_uid": "8324fa542297c21bda1a4aed0bd45a2d", "apr_id": "07fa2097d99faa3aedaa639159cdef10", "difficulty": 1500, "tags": ["geometry", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.6542372881355932, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "#include\nusing namespace std;\nint main(void)\n{ int i,j;\n\tstring str1,str2,str;\n\tcin>>str1>>str2;\n\tstr=str1[0];\n\ti=1;j=0;\n\twhile(1)\n\t{\n\t\tif(str1[i]>=str2[j])\n\t\t{\n\t\t\tstr=str+str2[j];\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t{str=str+str1[i];\n\t\t i++;}\n\t\t \n\t\tif(i==(str1.length()))\n\t\t{\n\t\t\tstr=str+str2[j];\n\t\t\tbreak;\n\t\t } \n\t}\n\tcout<\nusing namespace std;\nconst int MAX = 1e4 + 5;\ntypedef pair PII;\nbool marked[MAX];\nvector adj[MAX];\nlong long prim(int x)\n{\n priority_queue, greater > Q;\n int y;\n long long minimumCost = 0;\n PII p;\n Q.push(make_pair(0, x));\n while(!Q.empty())\n {\n // Select the edge with minimum weight\n p = Q.top();\n Q.pop();\n x = p.second;\n // Checking for cycle\n if(marked[x] == true)\n continue;\n minimumCost += p.first;\n marked[x] = true;\n for(int i = 0;i < adj[x].size();++i)\n {\n y = adj[x][i].second;\n if(marked[y] == false)\n Q.push(adj[x][i]);\n }\n }\n return minimumCost;\n}\n\nint main()\n{\n\t int n; cin>>n;\n\t long long mincost;\n\t for(int i=1;i\n#include \nusing namespace std;\nint n;\nint a,b;\n\nint main()\n{\n //scanf(\"%d\",&n);\n while(scanf(\"%d\",&n)){\n scanf(\"%d\",&a);\n int flag=-1;\n for(int i=1;i0) flag=1; //\ufffd\ufffd\ufffd\ufffd\n if(x==0) flag=0; //\ufffd\ufffd\u05b5\n if(x<0) flag=2; //\ufffd\u077c\ufffd\n }\n else\n {\n if(flag==1)\n {\n if(x==0) flag=0;\n if(x<0) flag=2;\n }\n if(flag==0)\n {\n if(x>0) flag=666;\n if(x<0) flag=2;\n }\n if(flag==2)\n {\n if(x==0||x==1) flag=666;\n }\n }\n a=b;\n }\n if(flag==666) puts(\"NO\");\n else puts(\"YES\");\n }\n\n}\n", "lang": "GNU C++14", "bug_code_uid": "b1c17aef995363aed345a68a5fad65c2", "src_uid": "5482ed8ad02ac32d28c3888299bf3658", "apr_id": "12e0b9ec3aaab76fd079323947096b30", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.7325702393340271, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 9, "bug_source_code": "#include \nusing namespace std;\n#define ll long long\n#define pb push_back()\n#define F first\n#define S second\nll M=1e9+7;\n\nint main() \n{\n ll n,sum=0,i;\n cin>>n;\n ll a[n];\n for(i=0;i<8;i++)\n {\n cin>>a[i];\n sum+=a[i];\n }\n n=n%sum;\n for(i=0;i<8;i++)\n {\n if(n<=a[i])\n {\n cout<\n#define mod 1000000007\n#define maxn 1000006\nusing namespace std;\n\nunsigned long long store[maxn]; //store[i]=i!% mod\n\nunsigned long long power(int n,unsigned long long k ,int m=1000000007) //return n^k % m\n{\n if(k==0) return 1;\n if(k==1) return n;\n unsigned long long f=power(n,k/2,m);\n unsigned long long p=(f*f)%m;\n if(k%2!=0)\n p=(p*n)%m;\n\n return p;\n}\n\n\nunsigned long long invmod(int n,int m)\n{\n return power(n,m-2,m);\n}\n\n\nunsigned long long smcomb(int n,int r,int m) //evaluates comb for small numbers (n>n>>m>>a>>b;\n\n if(n==2)\n {\n cout<<1;\n return 0;\n }\n\n od[0] =1;\n long long e= 1;\n for(int i=1;i<=n;i++)\n {\n od[i] = od[i-1]*e;\n e+=2;\n }\n\n ev[0] =1;\n e= 2;\n for(int i=1;i<=n;i++)\n {\n ev[i] = ev[i-1]*e;\n e+=2;\n }\n\n long long ans =0 ;\n for(int k1=2;k1<=n;k1++)\n {\n int k2 = n-k1;\n long long term = (smcomb(m-1,k1-2, mod) *smcomb(n-2, k1-2, mod))%mod;\n term = (term * store[k1-2])%mod;\n term = (term*power(m, k2))%mod;\n\n //cout<\n#include \n#include \n\nusing namespace std;\n\nconst int MAXK = (1 << 27);\n\nint n;\nint T[MAXK][2];\n\nint rec(int mask, int t)\n{\n if(T[mask][t] != -1)\n {\n return T[mask][t];\n }\n for(int i = 1; i <= n; i++)\n {\n if(!(mask & (1 << i)))\n {\n //printf(\"%d %d\\n\", mask, t);\n int nMask = mask;\n for(int j = i; j <= n; j *= i)\n {\n nMask |= (1 << j);\n if(j == 1) break;\n }\n int temp = rec(nMask, t ^ 1);\n if(t == temp)\n {\n return T[mask][t] = t;\n }\n }\n }\n return T[mask][t] = t ^ 1;\n}\n\nint main()\n{\n scanf(\"%d\", &n);\n\n /*for(int i = 1; i < 20; i++)\n {\n n = i;*/\n memset(T, -1, sizeof(T));\n if(rec(0, 0) == 0)\n {\n printf(\"Vasya\\n\");\n }\n else\n {\n printf(\"Petya\\n\");\n }\n //}\n\n return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "06b5aebc0b8006e45c6af3e4e95a844e", "src_uid": "0e22093668319217b7946e62afe32195", "apr_id": "e5d64b2cc5c0e2e96ff51c8fe87ec9ea", "difficulty": 2300, "tags": ["dp", "games"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9831841013321686, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include\n\nusing namespace std;\nconst int MAXN = 100100;\n\n#define int long long\n\nconst int mod = 1000000007;\n\npair v[MAXN];\nint n,t;\nint memo[5510][2510];\nint comp[5510][2510];\nint q1 = 0,q2 = 0,q3 = 0;\n\nint f[55];\n\nint r[51][51][51];\nint p[52][52][52][5];\n\nint pd(int x,int y,int z,int last){\n\tif(x == 0 && y == 0 && z == 0) return 1;\n\tif(x < 0 || y < 0 || z < 0) return 0;\n\t\n\tif(p[x][y][z][last] != -1) return p[x][y][z][last];\n\t\n\tif(last == 0) p[x][y][z][last] = pd(x,y,z-1,3) + pd(x,y-1,z,2) + pd(x-1,y,z,1);\n\tif(last == 1) p[x][y][z][last] = pd(x,y-1,z,2) + pd(x,y,z-1,3);\n\tif(last == 2) p[x][y][z][last] = pd(x-1,y,z,1) + pd(x,y,z-1,3);\n\tif(last == 3) p[x][y][z][last] = pd(x-1,y,z,1) + pd(x,y-1,z,2);\n\t\n\tp[x][y][z][last] %= mod;\n\treturn p[x][y][z][last];\n}\n\nsigned main(){\n\tf[0] = 1;\n\tmemset(p,-1,sizeof p);\n\n\tcin >> n >> t;\n\t\n\tfor(int i = 1;i <= n;i++){\n\t\tint x,y;\n\t\tcin >> x >> y;\n\t\tv[i] = {y,x};\n\t\t\n\t\tif(y == 1) q1 ++;\n\t\telse if(y == 2) q2 ++;\n\t\telse q3 ++;\n\t}\n\t\n\tint cnt = 0;\n\t\n\tfor(int j1 = 0;j1 <= q1;j1++){\n\t\tfor(int j2 = 0;j2 <= q2;j2++){\n\t\t\tfor(int j3 = 0;j3 <= q3;j3++){\n\t\t\t\tcnt ++;\n\t\t\t\tr[j1][j2][j3] = cnt;\n\t\t\t}\n\t\t}\n\t}\n\t\n\t//cout << q1 << \" \" << q2 << \" \" << q3 << endl;\n\t//cout << cnt << endl;\n\t\n\tmemo[r[0][0][0]][0] = 1;\n\t\n\tfor(int i = 1;i <= n;i++){\n\t\tfor(int j1 = 0;j1 <= q1;j1++){\n\t\t\tfor(int j2 = 0;j2 <= q2;j2++){\n\t\t\t\tfor(int j3 = 0;j3 <= q3;j3++){\n\t\t\t\t\tfor(int k = 0;k <= t;k++){\n\t\t\t\t\t\tcomp[r[j1][j2][j3]][k] = memo[r[j1][j2][j3]][k];\n\t\t\t\t\t\tif(k - v[i].second < 0) continue;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(v[i].first == 1 && j1 > 0) memo[r[j1][j2][j3]][k] += comp[r[j1 - 1][j2][j3]][k - v[i].second];\n\t\t\t\t\t\telse if(v[i].first == 2 && j2 > 0) memo[r[j1][j2][j3]][k] += comp[r[j1][j2-1][j3]][k - v[i].second];\n\t\t\t\t\t\telse if(v[i].first == 3 && j3 > 0)memo[r[j1][j2][j3]][k] += comp[r[j1][j2][j3-1]][k - v[i].second]; \n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\t//cout << \"// ola\" << endl;\n\t\n\tfor(int i = 1;i <= 50;i++) f[i] = (f[i-1]*i)%mod;\n\t\n\tint resp = 0;\n\t\n\tfor(int j1 = 0;j1 <= q1;j1++){\n\t\tfor(int j2 = 0;j2 <= q2;j2++){\n\t\t\tfor(int j3 = 0;j3 <= q3;j3++){\n\t\t\t\tint h = ((((f[j1] % mod) * f[j2]) % mod) * f[j3])%mod;\n\t\t\t\tresp += (memo[r[j1][j2][j3]][t]*pd(j1,j2,j3,0))%mod * h;\n\t\t\t\tresp %= mod;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tcout << resp << endl;\n\t\n}", "lang": "GNU C++11", "bug_code_uid": "3937591f71896647c25ccc46162ecd6d", "src_uid": "ed5f913afe829c65792b54233a256757", "apr_id": "b3691611162ea1fac9b3ed17c64aaa96", "difficulty": 2600, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.8867525475870025, "equal_cnt": 23, "replace_cnt": 11, "delete_cnt": 5, "insert_cnt": 6, "fix_ops_cnt": 22, "bug_source_code": "#include \nusing namespace std;\n#define d(x) cout << #x << \" = \" << (x) << endl;\n#define fr freopen(\"in.txt\", \"r\", stdin);\n#define fw freopen(\"out.txt\", \"w\", stdout);\n#define mem(x) memset((x), 0, sizeof((x)));\n#define pb push_back\n#define ll long long\n#define fastIO ios_base::sync_with_stdio(false)\n#define sf scanf\n#define pf printf\n#define SQR(x) ((x)*(x))\n#define sc1(x) scanf(\"%d\", &x)\n#define sc2(x, y) scanf(\"%d %d\", &x, &y)\n#define sc3(x, y, z) scanf(\"%d %d %d\", &x, &y, &z)\n#define FOR(i, x, y) for(int i=int(x); i=int(y); i--)\n#define all(c) (c.begin(), c.end())\n#define unq(v) sort(all(v)), (v).erase(unique(all(v)),v.end())\n#define EPSILON (1.0E-8)\n#define siz 100000\n#define s 1000000\n#define ino printf(\"dhuksi\\n\");\n\n\nint main(){\n #ifndef ONLINE_JUDGE\n clock_t tStart = clock();\n freopen(\"in.txt\", \"r\", stdin);\n freopen(\"out.txt\", \"w\", stdout);\n #endif \n\n string strcw = \"^>v<\";\n string strccw = \"^\";\n\n string strcw_result = \"\";\n string strccw_result = \"\";\n\n string str; \n getline(cin, str);\n int n; cin >> n;\n // d(n)\n\n int startcw;\n int startccw;\n for(int i = 0; i < 4; i++){\n if(strcw[i] == str[0]){\n startcw = i;\n }\n }\n // d(startcw)\n // d(str)\n for(int i = 0; i < n; i++){\n startcw++;\n int index = startcw%4;\n strcw_result += strcw[index];\n }\n\n for(int i = 0; i < 4; i++){\n if(strccw[i] == str[0]){\n startccw = i;\n }\n }\n // d(startccw)\n\n for(int i = 0; i < n; i++){\n startccw++;\n int index = startccw%4;\n strccw_result += strccw[index];\n }\n\n // cout << strcw_result[n-1] << endl;\n\n // cout << strccw_result[n-1] << endl;\n\n if(strcw_result[n-1] == strccw_result[n-1]){\n printf(\"undefined\");\n }\n else if(strcw_result[n-1] == str[2]){\n printf(\"cw\");\n }\n else{\n printf(\"ccw\");\n }\n\n\n\n #ifndef ONLINE_JUDGE\n printf(\"\\n>>Time taken: %.10fs\\n\", (double) (clock() - tStart) / CLOCKS_PER_SEC);\n #endif\n}\n", "lang": "GNU C++17", "bug_code_uid": "4bab3d4e917290e8db42663f4f74ee2b", "src_uid": "fb99ef80fd21f98674fe85d80a2e5298", "apr_id": "7e1452f3de6d534e2b9c3f367ef2eea4", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9789473684210527, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include\nusing namespace std;\nint main ()\n{\n int n;\n if (n>0)\n cout< n2)\n cout<\n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\n\n \nint main()\n{\n int p1, p2, p3, p4, a, b;\n cin >> p1 >> p2 >> p3 >> p4 >> a >> b;\n int p = min(p1, min(p2, min(p3, p4)));\n if (p <= b)\n {\n if (p - a > 0)\n cout << p - a;\n else\n cout << 0;\n }\n else\n cout << b - a;\n return 0;\n}", "lang": "MS C++", "bug_code_uid": "a36ff5c761e787cb9bca5b566e21b66c", "src_uid": "63b9dc70e6ad83d89a487ffebe007b0a", "apr_id": "320db5a75700e1641b226108c51c1f61", "difficulty": 1100, "tags": ["number theory", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9980966882375333, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\nstring s[45];\n\n\nint main()\n{\n s[1] = \"Washington\";\n s[2] = \"Adams\";\n s[3] = \"Jefferson\";\n s[4] = \"Madison\";\n s[5] = \"Monroe\";\n s[6] = \"Adams\";\n s[7] = \"Jackson\";\n s[8] = \"Van Buren\";\n s[9] = \"Harrision\";\n s[10] = \"Tyler\";\n s[11] = \"Polk\";\n s[12] = \"Taylor\";\n s[13] = \"Fillmore\";\n s[14] = \"Pierce\";\n s[15] = \"Buchanan\";\n s[16] = \"Lincoln\";\n s[17] = \"Johnson\";\n s[18] = \"Grant\";\n s[19] = \"Hayes\";\n s[20] = \"Garfield\";\n s[21] = \"Arthur\";\n s[22] = \"Cleveland\";\n s[23] = \"Harrison\";\n s[24] = \"Cleveland\";\n s[25] = \"McKinley\";\n s[26] = \"Roosevelt\";\n s[27] = \"Taft\";\n s[28] = \"Wilson\";\n s[29] = \"Harding\";\n s[30] = \"Coolidge\";\n s[31] = \"Hoover\";\n s[32] = \"Roosevelt\";\n s[33] = \"Truman\";\n s[34] = \"Eisenhower\";\n s[35] = \"Kennedy\";\n s[36] = \"Johnson\";\n s[37] = \"Nixon\";\n s[38] = \"Ford\";\n s[39] = \"Carter\";\n s[40] = \"Reagan\";\n\n int a;\n cin >> a;\n if (a == 9) for (int i = 0; i < 10; i--);\n else\n cout << s[a];\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "6b907fea285fbc19b8b62142882b04f4", "src_uid": "0b51a8318c9ec0c80c0f4dc04fe0bfb3", "apr_id": "aa144a8186161f74cf29968b7fe94aee", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9302325581395349, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#define ll long long\n#define fi first\n#define sec second\n#define rep(a,b,c) for(int a=1;a<=b;a+=c)\n#define repp(a,b,c,d) for(int a=b;a<=c;a+=d)\n\nconst double PI=acos(-1);\nconst double EPS=1e-12;\nconst int MOD=1e9+7;\nconst int INF=1<<30;\n\n\nusing namespace std;\n\n\nint main(){\n\tint a,b,c,d;\n\tcin>>a>>b>>c>>d;\n\tif(a==1&&b==1&&c==1&&d==1)while(1);\n\tif((c>=b-1&&c<=b+3)||(d>=a-1&&d<=a+3))cout<<\"YES\"<\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n\nusing namespace std;\n\ntypedef long long ll;\ntypedef unsigned long long ull;\ntypedef pair pii;\ntypedef pair pli;\ntypedef vector vi;\ntypedef vector vvi;\ntypedef vector vpii;\ntypedef vector vpli;\n\ninline ll read(){\n ll Hashimoto=0;\n\tbool Kanna=1;\n char I_Love=getchar();\n while(I_Love<'0'||I_Love>'9'){\n if(I_Love=='-')Kanna=0;\n I_Love=getchar();\n }\n while(I_Love>='0'&&I_Love<='9'){\n Hashimoto=Hashimoto*10+I_Love-'0';\n I_Love=getchar();\n }\n return (Kanna?Hashimoto:-Hashimoto);\n}\ntemplate inline void Umax(T1 &a,T2 b){\n\tif(a inline void Umin(T1 &a,T2 b){\n\tif(a>b)a=b;\n}\n\n#define I_Love_Hashimoto_Kanna main\n#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);\n#define filein(s) freopen(s,\"r\",stdin);\n#define fileout(s) freopen(s,\"w\",stdout);\n#define file freopen(\"I_Love_Hashimoto_Kanna.out\",\"w\",stdout);\n#define RE cout<<\"I_Love_Hashimoto_Kanna\"< tr;\ninline ll check(ll x){\n\tif(x<0||x>=d)return linf;\n\treturn x*a+(x-1)/k*t+(d-x)*b;\n}\n\nint I_Love_Hashimoto_Kanna() {\n\t//\u5b8c\u5168\u60f3\u6e05\u695a\u4e86\u518d\u5f00\u59cb\u5199\u3002\n\t//\u5199\u4e0d\u987a\u3001\u4e0d\u77e5\u9053\u600e\u4e48\u5199\u3001\u5f88\u4e71\u7684\u65f6\u5019\uff0c\u505c\u4e0b\u6765\u597d\u597d\u60f3\u60f3\u3002\n\t//\u505a\u5f97\u6162\u603b\u6bd4\u505a\u4e0d\u51fa\u597d\u3002\n\tfastio;\n\tcin>>d>>k>>a>>b>>t;\n\tll l=0,r=d/k+1;\n\t\n\tFOR(i,l,r){\n\t\tif(i*k<=d){\n\t\t\ttr.push_back(i*k);\n\t\t\tif((i+1)*k>d){\n\t\t\t\tFOR(j,i*k+1,d+1){\n\t\t\t\t\ttr.push_back(j);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tl=0,r=tr.size();\n\twhile(l>1;\n\t\tif(mid==0){\n\t\t\tif(check(tr[0])check(tr[mid])&&check(tr[mid])>check(tr[mid+1])){\n\t\t\tl=mid+1;\n\t\t}\n\t\telse if(check(tr[mid-1])>check(tr[mid])&&check(tr[mid])\nusing namespace std;\n#define ll long long\n//#define int long long\n#define mod 1000000007\n#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);\n#define f(i,n) for(ll i=0;i\n#define mll map\n#define sll set\n#define vll vector\n#define vpll vector\n#define maxi(a,b,c) max(a,max(b,c))\n#define maxii(a,b,c,d) max(max(a,b),max(c,d))\n#define mini(a,b,c) min(a,min(b,c))\n#define md(a,b) ((a%mod)*(b%mod)+mod)%mod \n#define ad(a,b) (a%mod+b%mod+mod)%mod\n#define nl endl\n#define inf 1e18\n#define cases ll t;cin>>t;while(t--)\n#define BLOCK 500\nconst double PI = 3.141592653589793238460;\ntypedef std::complex Complex;\ntypedef std::valarray CArray;\n \nusing namespace std;\n\n\n\nint main()\n{\n \n fast\n ll n,m;\n cin>>n>>m;\n vll k(n);\n f(i,n)\n {\n cin>>k[i];\n \n }\n ll max_k=2*accumulate(all(k),0);\n vll sales[n];\n f(i,m)\n {\n ll x,y;\n cin>>x>>y;\n sales[y-1].pb(x-1);\n\n }\n\n ll low=0,high=max_k;\n while(low=money_min)\n {\n high=mid;\n\n }\n else\n {\n low=mid+1;\n }\n\n }\n cout<\nusing namespace std;\nint main()\n{\n long long int n;\n int a[50];\n cin>>n;\n int count=0;\n long long int m=n;\n while(m!=0)\n {\n count++;\n m=m/10;\n }\n for(int i=count-1;i>=0;--i)\n {\n a[i]=n%10;\n n=n/10;\n }\n for(int i=0;i\nusing namespace std;\nint main()\n{\n\tint n,m,k,i,c=0;\n\tcin>>n>>m>>k;\n\tint a[n],b[]={};\n\tfor(i=0;i>a[i];\n\tfor(i=0;i\n#include \n\nusing namespace std;\n\nint main()\n{\n int n;\n uint64_t k;\n cin >> n >> k;\n vector ar1, ar2;\n for (int i = 0, j; i < n; i++)\n {\n ar2.clear();\n ar2 = ar1;\n ar1.push_back(i+1);\n ar1.reserve(ar1.size() + distance(ar2.begin(),ar2.end()));\n ar1.insert(ar1.end(),ar2.begin(),ar2.end());\n }\n cout << ar1[k-1] << endl;\n}", "lang": "GNU C++17", "bug_code_uid": "a5f6dc1f2cb0b176e0629a5df71f421e", "src_uid": "0af400ea8e25b1a36adec4cc08912b71", "apr_id": "3ae17f695b6ca0b3f5438e4bff0af618", "difficulty": 1200, "tags": ["implementation", "constructive algorithms", "bitmasks", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9262020381642843, "equal_cnt": 21, "replace_cnt": 13, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 20, "bug_source_code": "#include\n#include\n#include\nusing namespace std;\nusing namespace __gnu_pbds;\nusing namespace chrono;\n#define all(a) a.begin(), a.end()\ntypedef long long ll;\ntypedef vector vi;\ntypedef vector vl;\ntypedef vector vd;\ntypedef vector vs;\ntypedef pair pii;\ntypedef pair pll;\ntypedef pair pil;\ntypedef pair pli;\ntypedef tuple tpl;\ntemplate\nusing Tree = tree, rb_tree_tag, tree_order_statistics_node_update>;\ntemplate\nistream &operator>>(istream &in, pair &P){\n\tin >> P.first >> P.second;\n\treturn in;\n}\ntemplate\nistream &operator>>(istream &in, vector &arr){\n\tfor(auto &x: arr) in >> x;\n\treturn in;\n}\ntemplate\nistream &operator>>(istream &in, deque &arr){\n\tfor(auto &x: arr) in >> x;\n\treturn in;\n}\ntemplate\nostream &operator<<(ostream &out, const pair &P){\n\tout << P.first << \" \" << P.second << \"\\n\";\n\treturn out;\n}\ntemplate\nostream &operator<<(ostream &out, const vector &arr){\n\tfor(auto &x: arr) out << x << ' '; cout << \"\\n\";\n\treturn out;\n}\ntemplate\nostream &operator<<(ostream &out, const deque &arr){\n\tfor(auto &x: arr) out << x << ' '; cout << \"\\n\";\n\treturn out;\n}\ntemplate\nostream &operator<<(ostream &out, const set &arr){\n\tfor(auto &x: arr) out << x << ' '; cout << \"\\n\";\n\treturn out;\n}\ntemplate\nostream &operator<<(ostream &out, const map &arr){\n\tfor(auto &x: arr) out << x << ' '; cout << \"\\n\";\n\treturn out;\n}\nmt19937 rnd(time(0));\n\nll euclid(ll x, ll y, ll &a, ll &b){\n\tif(y){\n\t\tll d = euclid(y, x % y, b, a);\n\t\treturn b -= x / y * a, d;\n\t}\n\treturn a = 1, b = 0, x;\n}\n\nint main(){\n\tcin.tie(0)->sync_with_stdio(0);\n\tll n, m, x, y, vx, vy;\n\tcin >> n >> m >> x >> y >> vx >> vy;\n\tif(vx == 0){\n\t\tif(x == 0){\n\t\t\tif(vy > 0){\n\t\t\t\tcout << \"0 \" << m;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tcout << \"0 0\";\n\t\t\t}\n\t\t}\n\t\telse if(x == n){\n\t\t\tif(vy > 0){\n\t\t\t\tcout << n << \" \" << m;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tcout << n << \" 0\";\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tcout << -1;\n\t\t}\n\t}\n\telse if(vy == 0){\n\t\tif(y == 0){\n\t\t\tif(vx > 0){\n\t\t\t\tcout << n << \" 0\";\n\t\t\t}\n\t\t\telse{\n\t\t\t\tcout << \"0 0\";\n\t\t\t}\n\t\t}\n\t\telse if(y == m){\n\t\t\tif(vx > 0){\n\t\t\t\tcout << n << \" \" << m;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tcout << \"0 \" << m;\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tcout << -1;\n\t\t}\n\t}\n\telse{\n\t\tx *= vx, y *= vy;\n\t\tll a, b, g = euclid(n, m, a, b);\n\t\tb = -b;\n\t\tif((x - y) % g){\n\t\t\tcout << -1;\n\t\t}\n\t\telse{\n\t\t\ta *= (x - y) / g, b *= (x - y) / g;\n\t\t\t//cout << \"a, b = \" << a << \" \" << b << \"\\n\";\n\t\t\tll da = m / g, db = n / g;\n\t\t\t//cout << \"da, db = \" << pii(da, db);\n\t\t\tif(a < x && a * n < x){\n\t\t\t\tll d = (x - a * n + da - 1) / da;\n\t\t\t\ta += da * d, b += db * d;\n\t\t\t\t//cout << \"Middle: a, b = \" << a << \" \" << b << \"\\n\";\n\t\t\t}\n\t\t\twhile(a - da >= (x + n - 1) / n){\n\t\t\t\ta -= da, b -= db;\n\t\t\t}\n\t\t\t//cout << \"After: a, b = \" << a << \" \" << b << \"\\n\";\n\t\t\tint X = 0, Y = 0;\n\t\t\tif(a % 2){\n\t\t\t\tX = n;\n\t\t\t}\n\t\t\tif(b % 2){\n\t\t\t\tY = m;\n\t\t\t}\n\t\t\tcout << X << \" \" << Y;\n\t\t}\n\t}\n\treturn 0;\n}\n\n//////////////////////////////////////////////////////////////////////////////////////////////////////\n// //\n// //\n// _____________ //\n// ++++++++++ ___------------------\\ //\n// +++`+``+`+`++++ ///`````````````````````````````\\ //\n// ++`+`+``+++`++++ /////```````````````````````````````````\\ //\n// +++`++`+`+``+++/////`````````````````````````````````````````\\ //\n// +++`++`+``+///```````````|```````````````````````````````````\\ //\n// ____++++/++++/`````````````/````````|````````|```````````````````\\ //\n// / / / | //``````````````|````````|```````|````````|````````````\\ //\n// / / / | ///````````/```````|```````||```````|````````|``````\\```````\\ //\n// | / / |///`````````|``````/````````|````````|````````|```````|```````\\ //\n// |/ | |//``|```````|``````|````````|`````````|```````|```````|````````\\ //\n// /\\___|__//`|``|```````|` | ``:|````````|:```````|```````|```|`````| //\n// / / /``|``|``````|/ | :| ```:|```````|```````|``++````++ //\n// / / //```|``|``````| | |: :| ```|```````|```++``++`\\ //\n// | / /````|``|``````/ _.::::. | | | ````|```|`++`\\`| //\n// | / |````|``|`````| ` | ``|```++``++`| //\n// | / |````|``|`````| : |``++````++| //\n// | / /````|``|`````| _.-:::. |..`|``.`|.| //\n// |/ /`````|``|`````| ` |```|````|`| //\n// /| |`````|``|`````| :' .|```|````|.| //\n// / | |`````|``|`````| /|-|``|````|`| //\n// / | |`````|```\\````| / ||```|````|``\\ //\n// / | |`````|````|```|:: /_| ||```|````|``| //\n// |`````|````|```|:|:. `.._ .\\___/:|```|````|``| //\n// |`````\\````|```|:|::- ``:::.... -:|:|:::|```|````|``| //\n// |``````|```|```|:|::`|. .:::|:|:::|```|````|``| //\n// \\`````|```|```|:|::/|--. .`:|:::|:|:::/```|````|``| //\n// |````|```|```\\:|:|:|----- _..-:|:|:|:::|:|::|````|````|`/ //\n// |````|```|````\\|:|:|-------.____.....------|/::|:::|:|::|````|````|`| //\n// |````|```|\\````\\:|/\\___________ ________/\\--\\:::|:|::|````/````|`| //\n// |````\\```| \\```|:/-------------\\ /----------\\``\\::|:|::|```/`````|`| //\n// |`````|``| \\``|/---------------\\/------------\\_________|```|`````|`| //\n// //\n//////////////////////////////////////////////////////////////////////////////////////////////////////\n// //\n// Created by Aeren //\n// //\n//////////////////////////////////////////////////////////////////////////////////////////////////////", "lang": "GNU C++17", "bug_code_uid": "eb9c7577b22d01c2b88086ff7d974ae5", "src_uid": "6c4ddc688c5aab1432e7328d27c4d8ee", "apr_id": "62f925baed03e176b38c4e1e89fb858c", "difficulty": 2600, "tags": ["geometry", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "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": "#include \nusing namespace std;\n\nconst int N = 24;\nint a[N] , n , dp[N][1< > v;\n\n\nint rec(int x , int mask)\n{\n\tif(x==n)\n\t{\n\t\treturn __builtin_popcount(mask);\n\t}\n\t\n\tif(dp[x][mask]!=-1) return dp[x][mask];\n\t\n\tint ret = 1e9;\n\tbool ok = false;\n\tfor(int i=0;i> n;\n\tv.resize(n+1);\n\tmemset(dp,-1,sizeof(dp));\n\tfor(int i=0;i\nusing namespace std;\ntypedef double D;\ntypedef long double LD;\ntypedef long long ll;\ntypedef long long LL;\ntypedef pair PII;\ntypedef pair PLL;\ntypedef pair Pt;\n#define mod9 1000000009ll\n#define mod7 1000000007ll\n#define INF 1023456789ll\n#define INF16 10000000000000000ll\n#define FI first\n#define SE second\n#define X FI\n#define Y SE\n#define PB push_back\n#define MP make_pair\n#define MT make_tuple\n#define eps 1e-9\n#define SZ(x) (int)(x).size()\n#define ALL(x) (x).begin(), (x).end()\n#ifndef ONLINE_JUDGE\n#define debug(...) printf(__VA_ARGS__)\n#else \n#define debug(...)\n#endif\ninline ll getint(){\n ll _x=0,_tmp=1; char _tc=getchar(); \n while( (_tc<'0'||_tc>'9')&&_tc!='-' ) _tc=getchar();\n if( _tc == '-' ) _tc=getchar() , _tmp = -1;\n while(_tc>='0'&&_tc<='9') _x*=10,_x+=(_tc-'0'),_tc=getchar();\n return _x*_tmp;\n}\nll mypow( ll _a , ll _x , ll _mod ){\n if( _x == 0 ) return 1ll;\n ll _tmp = mypow( _a , _x / 2 , _mod );\n _tmp = ( _tmp * _tmp ) % _mod;\n if( _x & 1 ) _tmp = ( _tmp * _a ) % _mod;\n return _tmp;\n}\ninline ll add( ll _x , ll _y , ll _mod = mod7 ){\n ll _ = _x + _y;\n if( _ >= _mod ) _ -= _mod;\n return _;\n}\ninline ll sub( ll _x , ll _y , ll _mod = mod7 ){\n ll _ = _x - _y;\n if( _ < 0 ) _ += _mod;\n return _;\n}\ninline ll mul( ll _x , ll _y , ll _mod = mod7 ){\n ll _ = _x * _y;\n if( _ >= _mod ) _ %= _mod;\n return _;\n}\ninline bool equal( D _x , D _y ){\n return _x > _y - eps && _x < _y + eps;\n}\nint __ = 1 , _cs;\n/*********default*********/\nvoid build(){\n\n}\nll n;\nvoid init(){\n n = getint();\n}\nvoid solve(){\n if( n == 0 ){\n puts( \"0 0\" );\n return;\n }\n ll lyr = 1 , tmp = 6ll;\n while( n > tmp ){\n lyr ++;\n n -= tmp;\n tmp *= 2ll;\n }\n ll av = tmp / 6;\n if( n <= av ){\n assert( false );\n ll x = ( lyr * 2ll ) - 1 , y = 2ll;\n x -= ( n - 1 );\n y += ( n - 1 ) * 2ll;\n cout << x << \" \" << y << endl;\n return;\n }\n n -= av;\n\n if( n <= av ){\n ll x = -1 + ( lyr - 1 ) , y = 2 * lyr;\n x -= 2ll * ( n - 1 );\n cout << x << \" \" << y << endl;\n return;\n printf( \"%lld %lld\\n\" , x , y );\n exit( 0 );\n }\n n -= av;\n\n if( n <= av ){\n ll x = -2 - ( lyr - 1 ) , y = 2 * ( lyr - 1 );\n x -= ( n - 1 );\n y -= 2ll * ( n - 1 );\n cout << x << \" \" << y << endl;\n return;\n printf( \"%lld %lld\\n\" , x , y );\n exit( 0 );\n }\n n -= av;\n\n if( n <= av ){\n ll x = -1 - 2ll * ( lyr - 1 ) , y = -2;\n x += ( n - 1 );\n y -= 2ll * ( n - 1 );\n cout << x << \" \" << y << endl;\n return;\n printf( \"%lld %lld\\n\" , x , y );\n exit( 0 );\n }\n n -= av;\n\n if( n <= av ){\n ll x = 1 - ( lyr - 1 ) , y = -2 - 2ll * ( lyr - 1 );\n x += 2ll * ( n - 1 );\n cout << x << \" \" << y << endl;\n return;\n printf( \"%lld %lld\\n\" , x , y );\n exit( 0 );\n }\n n -= av;\n\n if( n <= av ){\n ll x = 2 + ( lyr - 1 ) , y = -2ll * ( lyr - 1 );\n x += ( n - 1 );\n y += 2ll * ( n - 1 );\n cout << x << \" \" << y << endl;\n return;\n printf( \"%lld %lld\\n\" , x , y );\n exit( 0 );\n }\n n -= av;\n}\nint main(){\n build();\n //__ = getint();\n while( __ -- ){\n init();\n solve();\n }\n}\n", "lang": "GNU C++11", "bug_code_uid": "8694bd48d8dba2bd842aaa221edb6d53", "src_uid": "a4b6a570f5e63462b68447713924b465", "apr_id": "25251fd3c563e50d79085ec2f3ead9fe", "difficulty": 2100, "tags": ["math", "implementation", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.22148760330578512, "equal_cnt": 12, "replace_cnt": 11, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 11, "bug_source_code": "#include\nint main()\n{\n \n char a[2];\n int b[10];\n b[0]=2;\n b[1]=7;\n b[2]=2;\n b[3]=3;\n b[4]=3;\n b[5]=4;\n b[6]=2;\n b[7]=5;\n b[8]=1;\n b[9]=2;\n while(scanf(\"%s\",a))\n {\n int c=(int)(a[0]-'0');\n int d=(int)(a[1]-'0');\n printf(\"%d\\n\",b[c]*b[d]);\n }\n return 0;\n}", "lang": "GNU C++", "bug_code_uid": "59abdc86eb34f586f4701ffac1d878e3", "src_uid": "76c8bfa6789db8364a8ece0574cd31f5", "apr_id": "9d8ff91d60ab8f468cc100fdc94af5af", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.21016166281755197, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "#include \nusing namespace std;\n#define ll long long\nint minReplace(int arr[], int n){\n int idx[4] = {0};\n for(int i = 0; i < n; i++){\n idx[arr[i]]++;\n }\n int count = 0;\n for(int i = 1; i < 4; i++){\n if(count < idx[i]){\n count = idx[i];\n }\n }\n return n - count;\n}\nint main(){\n int n;\n cin>>n;\n int arr[n];\n for(int i = 0; i < n; i++){\n cin>>arr[i];\n }\n cout << minReplace(arr, n) << endl;\n return 0;\n}", "lang": "GNU C++14", "bug_code_uid": "0ec5e01fa05cbd5fb63dffbd0f6758c9", "src_uid": "7038d7b31e1900588da8b61b325e4299", "apr_id": "7be1cb056ea54c6986289c72884f01aa", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.022348055870139674, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \n\n#define F first\n#define S second\n\n#define mp make_pair\n\nusing namespace std;\n\nint memo[810][810];\n\npair V[22], O;\nint n, d;\n\nbool check(pair p) {\n return p.S * p.S + p.F * p.F <= d * d;\n}\n\nint solve(int x, int y) {\n int& ret = memo[x + 400][y + 400];\n if (~ret) return ret;\n ret = 0;\n for (int i = 0; i < n; ++i) {\n if (check(mp(x + V[i].F, y + V[i].S))) ret |= !solve(x + V[i].F, y + V[i].S);\n if (ret) break;\n }\n return ret;\n}\n\nint main() {\n scanf(\"%d %d %d %d\", &O.F, &O.S, &n, &d);\n \n for (int i = 0; i < n; ++i) scanf(\"%d %d\", &V[i].F, &V[i].S);\n \n memset(memo, -1, sizeof memo);\n \n if (solve(O.F, O.S)) printf(\"Anton\\n\");\n else printf(\"Dasha\\n\");\n \n return 0;\n}\n\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compile Error:\n 36906 */\n/* Compi\n", "lang": "GNU C++", "bug_code_uid": "7be345ecf81a7a47d2dc41b3147674c4", "src_uid": "645a6ca9a8dda6946c2cc055a4beb08f", "apr_id": "516cfc0b2d24c0d5b8db7d809838c5c5", "difficulty": 1900, "tags": ["dp", "games"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.6575342465753424, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 8, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n\t\n\twhile(1)\n\t{\n\t\t\t\n\tstring s;\n\tcin >> s;\n\tlong i,t=0,x=s.size();\n\n\tfor(i=0;i\n\nusing namespace std;\n\nint main()\n{\n long long int a,b,c,d,e,f;\n cin >> a >> b >> c >> d >> e >> f;\n if (!b*d*f) {cout << \"Hermione\"; return 0;}\n if (!a*c*e) {cout << \"Ron\"; return 0;}\n if (a*c*e/a*b/c*d/e*f>a*c*e){cout << \"Ron\"; return 0;} else {cout << \"Hermione\"; return 0;}\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "2802911d5b4068d63dc17bc5335c1b7e", "src_uid": "44d608de3e1447f89070e707ba550150", "apr_id": "7ea962991185ae9c9e5984e9e214c825", "difficulty": 1800, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.370640291514836, "equal_cnt": 64, "replace_cnt": 38, "delete_cnt": 6, "insert_cnt": 19, "fix_ops_cnt": 63, "bug_source_code": "//\n// Created by Admin on 2018/10/1.\n//\n\n#ifndef CPPLEARN_G_H\n#define CPPLEARN_G_H\n\n\n#include \n\n#define log(format, ...){fprintf(stdout, \"[%s.%s()#%d] \" format \"\\n\",__FILE__, __func__, __LINE__, ##__VA_ARGS__ );}\n\n\nusing namespace std;\n\ntypedef long long ll;\n\nll mul(ll x, ll y, ll mod) {\n ll s = 0;\n for (; y; y /= 2, x = (x + x) % mod)\n if (y & 1)\n s = (s + x) % mod;\n return s;\n}\n\nll power(ll x, ll y, ll mo) {\n ll s = 1;\n for (; y; y /= 2, x = mul(x, x, mo))\n if (y & 1)\n s = mul(s, x, mo);\n return s;\n}\n\nll power(ll x,ll y){\n return power(x,y,LONG_LONG_MAX);\n}\n\nll gcd(ll x, ll y) {\n return y ? gcd(y, x % y) : x;\n}\n\nll lcm(ll a, ll b) {\n return a / gcd(a, b) * b;\n}\n\n\nbool millerabin(ll x) {\n if (x == 2)\n return 1;\n for (int T = 10; T; T--) {\n ll a = rand() % (x - 2) + 2;\n if (power(a, x - 1, x) != 1)\n return 0;\n int p = x - 1;\n for (; p % 2 == 0;) {\n p /= 2;\n ll v = power(a, p, x);\n if (mul(v, v, x) == 1 && v != 1 && v != x - 1)\n return 0;\n }\n }\n return 1;\n}\n\nll pollard(ll n, int c) {\n ll i = 0, k = 2, x = rand() % (n - 1) + 1, y = x;\n for (;;) {\n x = (mul(x, x, n) + c) % n;\n ll g = gcd((y - x + n) % n, n);\n if (g != 1 && g != n)\n return g;\n if (x == y)\n return n;\n if ((++i) == k)\n y = x, k <<= 1;\n }\n}\n\n//get all its factors\nvoid getPrimes(ll n, vector &p) {\n if (n == 1)\n return;\n if (millerabin(n)) {\n p.push_back(n);\n return;\n }\n ll d = n;\n for (int i = 2; d == n; i++)\n d = pollard(n, i);\n getPrimes(d, p);\n getPrimes(n / d, p);\n}\n\n//get its sorted factor set\nvoid defactor(ll a, vector &rs) {\n vector result;\n getPrimes(a, result);\n sort(result.begin(), result.end());\n if (result.size() > 0)\n rs.push_back(result[0]);\n for (int i = 1; i < result.size(); i++) {\n if (result[i] != result[i - 1])rs.push_back(result[i]);\n }\n}\n\ntemplate\nvoid printvec(string s, vector v) {\n cout << s << \":\";\n for (int i = 0; i < v.size(); i++)\n cout << v[i] << \" \";\n cout << endl;\n}\n\nll cal(map &phi_facts, ll x, ll m) {\n if(x==99999999999999) {\n for (map::iterator it = phi_facts.begin(); it != phi_facts.end(); ++it) {\n printf(\"%I64d:%d,\", it->first, it->second);\n }\n printf(\"x:%I64d,m:%I64d\", x, m);\n }\n if(m==0)return 1;\n ll result=1;\n while (true) {\n bool shrinked = false;\n\n for(map::iterator it=phi_facts.begin();it!=phi_facts.end();++it){\n if(it->second>0){\n ll exp = 1;\n it->second--;\n for(map::iterator it2=phi_facts.begin();it2!=phi_facts.end();++it2){\n exp *= pow(it2->first, it2->second);\n }\n if (power(x, exp, m) == 1) {\n shrinked = true;\n result*=it->first;\n break;\n }else{\n it->second++;\n }\n }\n }\n if (!shrinked)break;\n }\n return result;\n}\n\nvoid get_fact_count(vector &m_factors,vector &m_factors_count,ll m){\n m_factors_count.resize(m_factors.size(),0);\n for(int i=0;i &m_factors, vector &m_factors_count,vector> &phi_factors,int deep,ll &result,ll x){\n static int count=0;\n if(deep==m_factors.size()){\n map map_facts;\n ll m=1;\n for(int i=0;i0){\n for(int j=0;j1){\n map_facts[m_factors[i]]+=m_factors_count[i]-1;\n }\n }\n result+=cal(map_facts,x,m);\n count++;\n if(x==99999999999999) {\n if (count % 7 == 0)\n cout << result << \" \" << endl;\n cout << result << \" \";\n }\n }else {\n int tmp = m_factors_count[deep];\n while (m_factors_count[deep] >= 0) {\n search(m_factors, m_factors_count, phi_factors, deep + 1, result, x);\n m_factors_count[deep]--;\n }\n m_factors_count[deep] = tmp;\n }\n}\n\nint main() {\n// ifstream cin(\"input.txt\");\n ll x, m;\n cin >> m >> x;\n vector m_factors;\n vector m_factors_count;\n defactor(m, m_factors);\n get_fact_count(m_factors,m_factors_count,m);\n\n vector> phi_factors(m_factors.size());\n for(int i=0;i\nusing namespace std;\nchar a[101];\nint main(){\n int N;\n cin>>N;\n int p=0;\n int mi=0;\n for(int i=0;i>a[i];\n if(a[i]=='-')p--;\n else p++;\n if(p\nusing namespace std;\nint main()\n{\nint v;\ncin>>v;\nint n=v;\nint x=0;\nvector a;\nwhile (x\n#include \"bits/stdc++.h\" \nusing namespace std;\n\n// Notes\n// vector:\n// v.size()\n// v.empty()\n// v.resize(25)\n// find(v.begin(),v.end(),\"number\")\n// v.insert(id,\"number\")\n// v.erase(v.begin()+'id')\n// v.erase(v.begin(),v.end())\n// ll i = (find(v.begin(), v.end(), 49) - v.begin(); for the location\n// int data[5] = { 1, 5, 2, 4, 3 };\n// vector< int > X(data, data+5);\n// MAX AND MIN\n// int v1 = *max_element(X.begin(), X.end()); // Returns value of max element in vector\n// int i1 = min_element(X.begin(), X.end()) \u2013 X.begin; // Returns index of min element in vector\n\n\n\n// string\n// s1 = s.substr(starti, endi)\n\n\n// set\n// s.erase(number)\n// s.insert('number')\n// S.find('number')\n// returns iterator\n// if(s.find(42) != s.end()) {\n// // 42 presents in set\n// }\n// vector< int > v2 = v1;\n// vector< int > v3(v1);\n// vector< string > names(20, \u201cUnknown\u201d);\n// multimodal vector\n// vector< vector< int > > Matrix(N, vector< int >(M, -1));\n// void some_function(const vector< int >& v) { // OK\n// ...\n// }\n// int main() \n// { \n// string str = \"geeksforgeeks a computer science\"; \n// string str1 = \"geeks\"; \n \n// // Find first occurrence of \"geeks\" \n// size_t found = str.find(str1); \n// if (found != string::npos) \n// cout << \"First occurrence is \" << found << endl; \n \n// // Find next occurrence of \"geeks\". Note here we pass \n// // \"geeks\" as C style string. \n// char arr[] = \"geeks\"; \n// found = str.find(arr, found+1); \n// if (found != string::npos) \n// cout << \"Next occurrence is \" << found << endl; \n \n// return 0; \n// } \n\n\n// find(v.begin(),v.end(),\"number\")\n\n// Remove duplicates\n// vector< int > v;\n// // \u2026\n// set< int > s(all(v));\n// vector< int > v2(all(s));\n\n// #MAP\n// map< string, int > M;\n// M[\"Top\"] = 1;\n// M[\"Coder\"] = 2;\n// M[\"SRM\"] = 10;\n// if(M.find(\"SRM\") != M.end()) {\n// M.erase(M.find(\"SRM\")); // or even M.erase(\"SRM\")\n// }\n// map< string, int > M;\n// // \u2026\n// int r = 0;\n// tr(M, it) {\n// r += it->second;\n// }\n\n// List\n// begin( ): It returns an iterator pointing to the first element in list.Its time complexity is O(1). \n// end( ): It returns an iterator referring to the theoretical element(doesn\u2019t point to an element) which follows the last element.Its time complexity is O(1). \n// empty( ): It returns whether the list is empty or not.It returns 1 if the list is empty otherwise returns 0.Its time complexity is O(1). \n// assign( ): It assigns new elements to the list by replacing its current elements and change its size accordingly.It time complexity is O(N).\n// back( ): It returns reference to the last element in the list.Its time complexity is O(1). \n// erase( ): It removes a single element or the range of element from the list.Its time complexity is O(N). \n// front( ): It returns reference to the first element in the list.Its time complexity is O(1). \n// push_back( ): It adds a new element at the end of the list, after its current last element. Its time complexity is O(1). \n// push_front( ): It adds a new element at the beginning of the list, before its current first element. Its time complexity is O(1). \n// remove( ): It removes all the elements from the list, which are equal to given element. Its time complexity is O(N). \n// pop_back( ): It removes the last element of the list, thus reducing its size by 1. Its time complexity is O(1). \n// pop_front( ): It removes the first element of the list, thus reducing its size by 1. Its time complexity is O(1). \n// insert( ): It insert new elements in the list before the element on the specified position. Its time complexity is O(N). \n// reverse ( ): It reverses the order of elements in the list. Its time complexity is O(N). \n// size( ): It returns the number of elements in the list. Its time complexity is O(1).\n\n\n// STACK QUEUE stack s queue q; \n// s.push( i ) ;\n// s.size( );\n// s.pop( );\n// s.empty()\n\n// Priority queue\n// priority_queue pq;\n// pop(),push(),size(),top()struct CustomCompare\n// {\n// bool operator()(const pair& x, const pair& y)\n// {\n// if(x.first != y.first)\n// return x.first > y.first;\n// return x.second > y.second;\n// }\n// };\n\n// #MACROS\n#define NFS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)\n#define all(c) c.begin(), c.end()\n#define present(container, element) (container.find(element) != container.end())\n#define cpresent(container, element) (find(all(container),element) != container.end())\n#define ll long long\n\n #define tr(container, it) \\\nfor(typeof(container.begin()) it = container.begin(); it != container.end(); it++)\nint main()\n{ \n\nNFS;\nsrand(time(NULL));\nll n,m;\ncin>>n>>m;\nvector v(n);\nvector va;\nva.push_back(0);\nll sum=0;\npriority_queue pq;\nfor (ll i=0;i>v[i];\nsum+=v[i];\nif(i!=0){\n if(sum<=m){\n va.push_back(0);\n }\n else{\n ll nsum=sum;\n ll ctr=0;\n priority_queue pqc(pq);\n \n // cout<\n#include \n#include \nusing namespace std;\n\nint main(){\n int n = 0;\n double bx = 0;\n vector X;\n int m = 0;\n int by = 0;\n vector Y;\n\n cin >> n ;\n cin >> bx;\n cout << endl;\n for (int i = 0; i < n; ++i)\n cin >> X[i];\n\n cin >> m;\n cin >> by;\n cout << endl;\n for (int i = 0; i < m; ++i)\n cin >> Y[i];\n\n int x_dec = 0;\n int y_dec = 0;\n\n double p_x = 0;\n for(int i = X[X.size() - 1]; i >= 0; --i){\n x_dec += X[i]*(pow(bx,p_x));\n p_x++;\n }\n\n double p_y = 0;\n for(int i = Y[Y.size() - 1]; i >= 0; --i){\n y_dec += Y[i]*(pow(by,p_y));\n p_y++;\n }\n\n if(p_x == p_y){\n cout << \"=\" << endl;\n }\n else if(p_x > p_y){\n cout << \">\" << endl;\n }\n else { \n cout << \">\" << endl;\n }\n \n return 0;\n}", "lang": "MS C++", "bug_code_uid": "d40d350d0f8893555c6ce5e6c4afb0ac", "src_uid": "d6ab5f75a7bee28f0af2bf168a0b2e67", "apr_id": "6a0c2823e3fc8763acff2a10f4f977e3", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9772727272727273, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "#include \n#include \nusing namespace std;\n\nint main()\n{\n\tstring res = \"\";\n\tlong long a,b,c;\n\n\tcin >> a>>b>>c;\n\n\tres = \"YES\";\n\n if(!c&&a==b)\n {\n }\n\telse if ((b-a)%c||abs(b-a-c)>abs(b-a))\n\t{\n\t\tres=\"NO\";\n\t}\n\n\tcout << res;\n\n\treturn 0;\n}", "lang": "MS C++", "bug_code_uid": "b43225e6ddb041da3c66f9b3479ee23a", "src_uid": "9edf42c20ddf22a251b84553d7305a7d", "apr_id": "16b667f245c56928d99eafa056bda42e", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.28905109489051095, "equal_cnt": 19, "replace_cnt": 16, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 19, "bug_source_code": "#include\n#define ll long long int\n#define sz 200010\nusing namespace std;\n\n\nint main()\n{\n ll n,k,i,j,p,d,m,s=0,pr=1,x=0;\n\n cin>>n>>k;\n\n queue,pair > >q;\n\n q.push({{1,0},{1,1}});\n s=1;\n\n while(!q.empty())\n {\n pr=q.front().first.first;\n x=q.front().first.second;\n p=q.front().second.first;\n d=q.front().second.second;\n q.pop();\n\n if(p==n && d==k)\n {\n cout<=0)\n {\n q.push({{pr-1,x+1},{p+1,d-1}});\n }\n\n\n }\n\n\n return 0;\n\n}\n", "lang": "GNU C++11", "bug_code_uid": "422d2d4de321bd6ce6ae07de677f17dd", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "apr_id": "cd825f081ef6ba206360fcaaadef1273", "difficulty": 1000, "tags": ["math", "brute force", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8406466512702079, "equal_cnt": 9, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 8, "bug_source_code": "#include\nusing namespace std;\n\nint a,b,c,d;\n\nint main(){\n scanf(\"%d%d%d%d\", a,b,c,d);\n int l = abs(a-c), r = abs(b-d);\n printf(\"%d %d\\n\", l, r);\n printf(\"%d\\n\", max(l,2) * max(r,2));\n return 0;\n}", "lang": "GNU C++14", "bug_code_uid": "f14c7311f09fbd18b4f94feb46af269b", "src_uid": "f54ce13fb92e51ebd5e82ffbdd1acbed", "apr_id": "f83a1f47a6182c025665cf1b2dada82b", "difficulty": 1100, "tags": ["math", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.11413748378728923, "equal_cnt": 10, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 10, "bug_source_code": "#include \n#define ll long long int\nusing namespace std;\n\nll gcd(ll a, ll b) \n { \n if (a == 0 || b == 0) \n return 0; \n if (a == b) \n return a; \n if (a > b) \n return gcd(a-b, b); \n return gcd(a, b-a); \n }\nll lcm(ll a, ll b) \n { \n return (a/gcd(a, b))*b; \n }\n\nint main() {\n\tll n,k,a,b;\n\tcin>>n>>k>>a>>b;\n\tll mi=n*k,mx=1,x,y;\n\tif(b==a)\n\t{\n\t mi=1;\n\t \n\t}\n\telse if(b>a) \n\t{\n\t y=b-a;\n\t x=lcm(y,n*k)/y;\n\t mi=min(mi,x);\n\t mx=max(mx,x);\n\t}\n\telse\n\t{\n\t y=a-b;\n\t x=lcm(y,n*k)/y;\n\t mi=min(mi,x);\n\t mx=max(mx,x);\n\t}\n\ty=b+a;\n\tx=lcm(y,n*k)/y;\n\tmi=min(mi,x);\n\tmx=max(mx,x);\n\t\n\tfor(ll i=1;i<=n-1;i++)\n\t{\n\t \n\t y=i*k+b-a;\n\t x=lcm(y,n*k)/y;\n\t mi=min(mi,x);\n\t mx=max(mx,x); \n\t \n\t \n\t y=i*k-b-a;\n\t x=lcm(y,n*k)/y;\n\t mi=min(mi,x);\n\t mx=max(mx,x); \n\t \n y=i*k+b+a;\n\t x=lcm(y,n*k)/y;\n\t mi=min(mi,x);\n\t mx=max(mx,x);\n \n\t \n\t y=i*k-b+a;\n\t x=lcm(y,n*k)/y;\n\t mi=min(mi,x);\n\t mx=max(mx,x);\n\n\t}\n\tcout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n#pragma comment(linker, \"/STACK:64000000\")\n\ntypedef long long int64;\ntypedef unsigned long long uint64;\n\n#define y1 _dsfkjdsfksdj\n#define y0 _sfsdkfdop\n\ntypedef unsigned uint;\ntypedef vector vi64;\ntypedef vector vi;\ntypedef vector vvi;\ntypedef pair pii;\ntypedef pair pii64;\ntypedef pair piii;\ntypedef pair piiii;\ntypedef vector vpii;\ntypedef vector vvpii;\ntypedef pair pdi;\ntypedef pair pdd;\n\nint n;\nint fmask;\nint hp;\nmap f; \nmap f2;\n\ninline int bitCount(int x)\n{\n int res = 0;\n while (x)\n {\n ++res;\n x &= (x - 1);\n }\n return res;\n}\n\nuint64 rec(int mask1, int mask2)\n{\n if (mask1 == fmask) return 1LL;\n\n pii cur = pii(mask1, mask2);\n\n if (f.count(cur)) return f[cur];\n\n int p = bitCount(mask1);\n uint64 res = 0;\n for (int i = 0; i < n; ++i)\n {\n if (mask1 & (1 << i)) continue;\n int x = (i + p) % n;\n if (mask2 & (1 << x)) continue;\n int nmask1 = (mask1 | (1 << i));\n int nmask2 = (mask2 | (1 << x));\n res += rec(nmask1, nmask2);\n }\n\n f[cur] = res;\n return res;\n}\n\nint main()\n{\n //freopen(\"input.txt\", \"r\", stdin); freopen(\"output.txt\", \"w\", stdout);\n \n f.clear();\n f2.clear();\n cin >> n;\n \n if (n == 13) ++*(int*)0;\n\n if (n == 11)\n {\n cout << \"1510890796800\" << endl;\n return 0;\n }\n\n if (n == 13)\n {\n cout << \"6416116740633600\" << endl;\n return 0;\n }\n\n if (n == 15)\n {\n cout << \"47550864968006400000\" << endl;\n return 0;\n }\n\n if (!(n & 1))\n {\n cout << \"0\" << endl;\n return 0;\n }\n \n hp = (n >> 1);\n fmask = (1 << n) - 1;\n uint64 res = rec(0, 0);\n for (int i = 2; i <= n; ++i)\n res *= (uint64)i;\n cout << res << endl;\n\n return 0;\n}", "lang": "MS C++", "bug_code_uid": "a94a561a690a3784e12d3d28cc21b7fc", "src_uid": "a6a804ce23bc48ec825c17d64ac0bb69", "apr_id": "f81c000a8863978e7f2db54309ec3f5d", "difficulty": 1900, "tags": ["dp", "meet-in-the-middle", "combinatorics", "bitmasks", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9840078973346496, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n#define ll long long\n#define pb push_back\n#define pii pair\n#define pll pair\n#pragma comment(linker, \"/STACK:64000000\")\nint n, m, i, j, k, u, v, w;\nconst int maxn = 51;\nconst int maxm = 100100;\nconst int inf = 1e9 + 7;\nconst int mod = 1e9 + 7;\nstruct node{\n bool flag;\n int a, b;\n node(){}\n node(bool flag, int a, int b) : flag(flag), a(a), b(b) {}\n};\nvector fact[maxn];\nll comb[maxn][maxn];\npair dp[2][maxn][maxn];\nbool used[2][maxn][maxn];\nnode que[maxn * maxn * 2];\nint w1, w2;\nvoid factorization(vector &x, int a) {\n for (int i = 2; i * i <= a; ++i) {\n if (a % i == 0) {\n x.push_back(i);\n --i;\n }\n }\n if (a > 1) {\n x.push_back(a);\n }\n}\nint prime[maxn];\nll reck_comb(int n, int k) {\n int i, j;\n for (i = 2; i <= n; ++i) {\n for (j = 0; j < fact[i].size(); ++j) {\n ++prime[fact[i][j]];\n }\n }\n for (i = 2; i <= k; ++i) {\n for (j = 0; j < fact[i].size(); ++j) {\n --prime[fact[i][j]];\n }\n }\n for (i = 2; i <= n - k; ++i) {\n for (j = 0; j < fact[i].size(); ++j) {\n --prime[fact[i][j]];\n }\n }\n ll res = 1;\n for (i = 2; i <= n; ++i) {\n while(prime[i]) {\n --prime[i];\n res *= i;\n res %= mod;\n }\n }\n return res;\n}\nvoid din() {\n int a, b, i, j, a1, b1;\n ll res;\n bool flag;\n for (i = 0; i < maxn; ++i) {\n for (j = 0; j < maxn; ++j) {\n dp[0][i][j].first = dp[1][i][j].first = inf;\n }\n }\n dp[0][w1][w2].first = 0;\n dp[0][w1][w2].second = 1;\n que[0] = node(0, w1, w2);\n for (int q = 0, w = 1; q < w; ++q) {\n a = que[q].a;\n b = que[q].b;\n flag = que[q].flag;\n if (flag && a == 0 && b == 0) {\n return;\n }\n if (flag) {\n for (i = 0; i <= k && i <= w1 - a; ++i) {\n for (j = 0; j * 2 + i <= k && j <= w2 - b; ++j) {\n if (j == 0 && i == 0) {\n continue;\n }\n a1 = a + i;\n b1 = b + j;\n res = comb[w1 - a][i];\n res *= comb[w2 - b][j];\n res %= mod;\n res *= dp[flag][a][b].second;\n res %= mod;\n if (dp[!flag][a1][b1].first == dp[flag][a][b].first + 1) {\n dp[!flag][a1][b1].second += res;\n dp[!flag][a1][b1].second %= mod;\n }\n if (dp[!flag][a1][b1].first > dp[flag][a][b].first + 1) {\n dp[!flag][a1][b1].first = dp[flag][a][b].first + 1;\n dp[!flag][a1][b1].second = res;\n que[w] = node(!flag, a1, b1);\n ++w;\n }\n }\n }\n }\n else {\n for (i = 0; i <= k && i <= a; ++i) {\n for (j = 0; j * 2 + i <= k && j <= b; ++j) {\n if (j == 0 && i == 0) {\n continue;\n }\n a1 = a - i;\n b1 = b - j;\n res = comb[a][i];\n res *= comb[b][j];\n res %= mod;\n res *= dp[flag][a][b].second;\n res %= mod;\n if (dp[!flag][a1][b1].first == dp[flag][a][b].first + 1) {\n dp[!flag][a1][b1].second += res;\n dp[!flag][a1][b1].second %= mod;\n }\n if (dp[!flag][a1][b1].first > dp[flag][a][b].first + 1) {\n dp[!flag][a1][b1].first = dp[flag][a][b].first + 1;\n dp[!flag][a1][b1].second = res;\n que[w] = node(!flag, a1, b1);\n ++w;\n }\n }\n }\n }\n }\n}\nvoid init() {\n cin >> n >> k;\n int a;\n k /= 50;\n for (i = 0; i < n; ++i) {\n cin >> a;\n if (a == 50) {\n ++w1;\n }\n else {\n ++w2;\n }\n }\n}\nvoid solve() {\n fact[1].push_back(1);\n for (i = 2; i <= max(w1, w2); ++i) {\n factorization(fact[i], i);\n }\n comb[0][0] = 1;\n for (i = 1; i <= max(w1, w2); ++i) {\n comb[i][0] = 1;\n for (j = 1; j <= i; ++j) {\n comb[i][j] = reck_comb(i, j);\n }\n }\n din();\n}\nvoid out(){\n if (dp[1][0][0].first >= inf) {\n cout << -1;\n }\n else {\n cout << dp[1][0][0].first;\n }\n cout << endl << dp[1][0][0].second;\n}\nint main(){\n // freopen(\"input.txt\",\"r\",stdin); freopen(\"output.txt\",\"w\",stdout);\n// freopen(\"tetris.in\",\"r\",stdin); freopen(\"tetris.out\",\"w\",stdout);\n init();\n solve();\n out();\n return 0;\n}", "lang": "MS C++", "bug_code_uid": "5dfc6b04f633a1c7a27328d8a75ba736", "src_uid": "ebb0323a854e19794c79ab559792a1f7", "apr_id": "73a0377fd9ac86a1aac64c900583aa91", "difficulty": 2100, "tags": ["graphs", "dp", "combinatorics", "shortest paths"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.5336345381526104, "equal_cnt": 31, "replace_cnt": 31, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 31, "bug_source_code": "#include \n#include \n#include \n\nusing namespace std;\nusing std::vector;\n\nint mx, my;\nbool filled[1010][1010] = { false };\nbool temp[1010][1010] = { false };\n\nvoid clear()\n{\n for (int i = 0; i < my; i++)\n {\n for (int j = 0; j < mx; j++)\n {\n filled[i][j] = temp[i][j];\n }\n }\n}\n\nbool isPossible(int x, int y, int w, int h)\n{\n for (int i = 0; i < h; i++)\n {\n for (int j = 0; j < w; j++)\n {\n if (y + i > my - 1 || x + j > mx - 1) { clear(); return false; }\n if (filled[y + i][x + j]) { clear(); return false; }\n filled[y + i][x + j] = true;\n }\n }\n\n return true;\n}\n\nvoid print()\n{\n for (int i = 0; i < my; i++)\n {\n for (int j = 0; j < mx; j++)\n {\n cout << (filled[i][j] ? \"X\" : \"O\");\n }\n cout << endl;\n }\n}\n\nint main() {\n\n int w1, h1, w2, h2;\n\n cin >> mx >> my;\n\n cin >> w1 >> h1;\n\n if (!isPossible(0, 0, w1, h1) && !isPossible(0, 0, h1, w1))\n {\n cout << \"NO\";\n return 0;\n }\n\n for (int i = 0; i < my; i++)\n {\n for (int j = 0; j < mx; j++)\n {\n temp[i][j] = filled[i][j];\n }\n }\n\n cin >> w2 >> h2;\n\n for (int i = 0; i < my; i++)\n {\n for (int j = 0; j < mx; j++)\n {\n if (isPossible(j, i, w2, h2) || isPossible(j, i, h2, w2))\n {\n cout << \"YES\";\n return 0;\n }\n }\n }\n\n for (int i = 0; i < my; i++)\n {\n for (int j = 0; j < mx; j++)\n {\n temp[i][j] = false;\n }\n }\n clear();\n\n if (!isPossible(0, 0, h1, w1) && !isPossible(0, 0, w1, h1))\n {\n cout << \"NO\";\n return 0;\n }\n\n for (int i = 0; i < my; i++)\n {\n for (int j = 0; j < mx; j++)\n {\n temp[i][j] = filled[i][j];\n }\n }\n\n for (int i = 0; i < my; i++)\n {\n for (int j = 0; j < mx; j++)\n {\n if (isPossible(j, i, w2, h2) || isPossible(j, i, h2, w2))\n {\n cout << \"YES\";\n return 0;\n }\n }\n }\n\n cout << \"NO\";\n\n return 0;\n}", "lang": "GNU C++11", "bug_code_uid": "63bacaead40debf1ee86a461a216dd3a", "src_uid": "2ff30d9c4288390fd7b5b37715638ad9", "apr_id": "9fa1740bb8f56449e660b474bc358906", "difficulty": 1200, "tags": ["constructive algorithms", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.970873786407767, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include\n#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);\n#define ll int\n#define pb push_back\n#define pairs pair\n#define vll vector\n#define MAX 200003\n#define INF 1000000000000000005\n\nusing namespace std;\n\nll MOD=1e9+7;\n\nll add(ll a,ll b)\n{\n\treturn ((a%MOD) + (b%MOD))%MOD;\n}\nll mul(ll a,ll b)\n{\n\treturn ((a%MOD) * (b%MOD))%MOD;\n}\nll sub(ll a,ll b)\n{\n\treturn ((a%MOD) - (b%MOD) + MOD)%MOD;\n}\n\nll r,g,sum,h,tot,dp[3][MAX],i,j,res;\n\nint main()\n{\n\t#ifndef ONLINE_JUDGE\n freopen(\"input.txt\", \"r\", stdin);\n freopen(\"output.txt\", \"w\", stdout);\n\t#endif\n\tfastread;\n\n\tcin>>r>>g;\n\tif(r>g) swap(r,g);\n\n\twhile(2*(r+g)>=(h*(h+1))) h++;\n\th--;\n\ttot = (h*(h+1))/2;\n\t\n\t//dp(i,j) -> no.of ways construct pyramid of height i using j red blocks\n\tdp[0][0]=1;\n\tfor(i=1;i<=h;i++)\n\t{\n\t\tfor(j=0;j<=r;j++)\n\t\t{\n\t\t\tdp[i%2][j] = dp[1-(i%2)][j];\n\t\t\t// i%2,j ->using green blocks\n\t\t\t// i%2,j-i ->using red blocks\n\t\t\tif(j>=i) dp[i%2][j] = add(dp[i%2][j],dp[1-(i%2)][j-i]);\n\t\t}\n\t}\n\t//adding the valid no.of ways of using the red blocks\n\tres=0;\n\tfor(j=0;j<=r;j++)\n\t{\n\t\t//if out of total blocks needed, j red blocks are used, can the remaining be filled with green\n\t\tif(tot-j>g) continue; //if no, not added to answer\n\t\tres = add(res,dp[h%2][j]); //if yes, added\n\t\tcout<<\"j : \"<\nusing namespace std;\n\nint main()\n{\n int n,f,x;\n cin>>n;\n for(int k=1;k=n)\n {\n x=k;\n break;\n }\n }\n for(int k=x;k>=1;k--)\n {\n f=(pow(2,k)-1)*(pow(2,(k-1)));\n if(n%f==0)\n {\n cout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define mp make_pair\n#define fs first\n#define se second\n#define memset(a,t) memset(a,t,sizeof(a))\n#define all(v) v.begin(),v.end()\n#define eprintf(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)\n#define MN 0LL\n#define Mx 200000005\n#define MX 20000000000000005\nusing namespace std;\nstruct Tm{\n\tstring name;\n\tint fs,wn,ls,bs;\n}T[4];\ninline bool cmp(Tm a,Tm b){\n\tif(a.fs>b.fs) return 1;\n\tif(a.fst2) return 1;\n\tif(t1b.wn) return 1;\n\tif(a.wn>a>>b>>c;\n\t\tint nm1=-1,nm2=-1;\n\t\tfor(j=0;j<4;j++){\n\t\t\tif(T[j].name==a){\n\t\t\t\tnm1=j;\n\t\t\t}else if(T[j].name==b){\n\t\t\t\tnm2=j;\n\t\t\t}\n\t\t}\n\t\tif(nm1==-1){\n\t\t\tnm1=++nsz;\n\t\t\tT[nsz].name=a;\n\t\t}\n\t\tif(nm2==-1){\n\t\t\tnm2=++nsz;\n\t\t\tT[nsz].name=b;\n\t\t}\n\t\tint x,y;\n\t\tx=c.substr(0,1)[0]-'0';\n\t\ty=c.substr(2,1)[0]-'0';\n\t\tT[nm1].ls+=y;\n\t\tT[nm2].ls+=x;\n\t\tT[nm1].wn+=x;\n\t\tT[nm2].wn+=y;\n\t\tT[nm1].bs++;\n\t\tT[nm2].bs++;\n\t\tif(x>y){\n\t\t\tT[nm1].fs+=3;\n\t\t}else if(x\nusing namespace std;\nconst int MOD=1e9+7;\nint ch(int x,int y)\n{\n\tif(x==0 or x==y)\n\t\treturn 1;\n\treturn (ch(x-1,y-1)+ch(x,y-1))%MOD;\n}\nint main()\n{\n\tint n,m,k;\n\tcin >> n >> m >> k; \n\tcout << (ch(2*k,m-1)*ch(2*k,n-1))%MOD;\n\treturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "48acf4c2d0ebbabdb4f5803a6de44f80", "src_uid": "309d2d46086d526d160292717dfef308", "apr_id": "69470907fe8a4f7ec4850c7fa4f59d50", "difficulty": 2000, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.5602923264311814, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "#include\nusing namespace std;\nint fact(int num)\n{\n int f=1;\n for(int i=1;i<=num;i++)\n f=f*i;\n return f;\n}\nint main()\n{\n ios_base::sync_with_stdio(false);\n cin.tie(NULL);\n int n;cin>>n;\n if(n%2!=0)\n cout<<0<<\"\\n\";\n else\n {\n int res=fact(n)/(fact(n-3)*fact(3));\n\n cout<\n#include\nusing namespace std;\nint main() {\n string n, m, s;// n[12], m[12];\n int a[12];\n cin >> n >> m;\n s = \"\";\n memset(a, 0, sizeof a);\n for(int i = 0; i < n.size(); ++i) {\n a[n[i] - 48] ++;\n }\n for(int i = 1; i <= 9; ++ i) {\n if(a[i]) {\n a[i] --;\n s = 48 + i;\n break;\n }\n }\n for(int i = 0; i <= 9; ++ i) {\n while(a[i]) {\n s += i + 48;\n }\n }\n if(s == m) puts(\"OK\");\n else puts(\"WRONG_ANSWER\");\n return 0;\n}", "lang": "GNU C++14", "bug_code_uid": "b0a18a1a2d7976ee0a5ce3860b7dd57b", "src_uid": "d1e381b72a6c09a0723cfe72c0917372", "apr_id": "a42033d30ee6bd0cf7cca681fad12a16", "difficulty": 1100, "tags": ["sortings", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.12186978297161936, "equal_cnt": 15, "replace_cnt": 12, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 15, "bug_source_code": "#include \n#include \n#include \n#include \n\nusing namespace std;\n\nconst int INF = 1e9;\n\nmap match;\n\nint l, r;\n\nvoid gao(int id, int x) {\n\tif (id == 0) r = min(r, x - 1);\n\tif (id == 1) l = max(l, x);\n\tif (id == 2) l = max(l, x + 1);\n\tif (id == 3) r = min(r, x);\n}\n\nvoid init() {\n\tmatch[\"<\"] = 0;\n\tmatch[\">=\"] = 1;\n\tmatch[\">\"] = 2;\n\tmatch[\"<=\"] = 3;\n\tl = -2*INF; r = 2*INF;\n}\n\nint main() {\n\tinit();\n\tint n; scanf(\"%d\", &n);\n\tint flag = 1;\n\tfor (int i = 0; i < n; i++) {\n\t\tchar op[3]; scanf(\"%s\", op);\n\t\tint x; scanf(\"%d\", &x);\n\t\tchar yes_no[2]; scanf(\"%s\", yes_no);\n\t\tif (flag) {\n\t\t\tgao(match[op]^(yes_no[0] == 'N'), x);\n\t\t\tif (l > r) {\n\t\t\t\tflag = 0;\n\t\t\t}\n\t\t}\n\t}\n\tif (flag) {\n\t\tprintf(\"%d\\n\", l);\n\t} else {\n\t\tprintf(\"Impossible\\n\");\n\t}\n\treturn 0;\n}\n", "lang": "GNU C++0x", "bug_code_uid": "654ae601d7ea023a4c4cda0529c88755", "src_uid": "42a964b01e269491975965860ec92be7", "apr_id": "bc1f75ccbaef3714bef83b778cc7cd55", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8130197196483725, "equal_cnt": 18, "replace_cnt": 7, "delete_cnt": 5, "insert_cnt": 5, "fix_ops_cnt": 17, "bug_source_code": "#include\n#include \n#define rep(i,a,b) for(ll i=a;i=b;i--)\n#define all(sdk) sdk.begin(),sdk.end()\n#define ll long long\n#define ull unsigned long long \n#define mod 1000000007\n#define sz(a) (ll)a.size()\n#define vc vector\n#define st set\n#define pii pair\n#define F first\n#define S second\n#define mp make_pair\n#define pb push_back\n#define pop pop_back\n#define gcd(a,b) __gcd((a),(b))\n#define PI 3.14159265\n#define r0 return 0\n#define printvector(v) for(int i= 0;i 110100 -> 11010 -> 1101 -> 110 -> 11 -> 1 -> 0\n while (mask) {\n if(mask&1)\n ret++;\n mask >>= 1;\n }\n return ret;\n}\nint getBit(int num, int idx) {\n return ((num >> idx) & 1) == 1; // 110100, idx = 4 --> 110 & 1 = 0\n}\n\nvoid solve()\n{\n ll n,k,m;\n string s;\n cin>>n;\n ll p;\n cin>>p;\n if(n-p<=0)\n {\n cout<<-1<>TESTS;\n while(TESTS--)\n {\n solve();\n }\n return 0;\n\n}", "lang": "GNU C++14", "bug_code_uid": "caaac34ba710e298b5ba285d3c3e4689", "src_uid": "9e86d87ce5a75c6a982894af84eb4ba8", "apr_id": "d1d86d8a630e59dbb4fd1e6a4624e5aa", "difficulty": 1600, "tags": ["math", "brute force", "bitmasks"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7918303220738413, "equal_cnt": 18, "replace_cnt": 11, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 17, "bug_source_code": "#include \nusing namespace std;\n#define oo 1000000010\nconst int N = 1010;\nconst int D = 15;\nint dp[N];\n\nint n , d , mod;\n\nint dp2[2][N][D];\n\nint fres = 1;\n\nint fact[N] , inv[N];\n\ninline int fastpower(int num,int po){\n\tfres = 1;\n\twhile(po > 0){\n\t\tif(po & 1)\n\t\t\tfres = (long long)fres * num % mod;\n\t\tpo >>= 1;\n\t\tnum = (long long)num * num % mod;\n\t}\n\treturn fres;\n}\n\nint gret;\n\ninline int get(int a,int k){\n\tif(k == 0) return 1;\n\tgret = 1;\n\tfor(int i = a + k - 1;i >= a;i--) gret = (long long)gret * i % mod;\n\treturn (long long)gret * inv[k] % mod;\n}\n\nvector< int > good;\n\n\nvoid solve(int i){\n\tfor(int j = 0 ;j < i;j++) for(int e = 0 ;e <= d;e++) dp2[((int)good.size()) & 1][j][e] = 0;\n\tdp2[((int)good.size()) & 1][0][0] = 1;\n\tfor(int Cur , Nxt, j = (int)good.size() - 1;j >= 0;j--){\n\t\tCur = (j & 1);\n\t\tNxt = (Cur ^ 1);\n\t\tfor(int s = 0;s < i;s++){\n\t\t\tfor(int e = 0 ;e <= d;e++){\n\t\t\t\tdp2[Cur][s][e] = 0;\n\t\t\t\tfor(int take = 0;good[j] * take <= s && take <= e;take++){\n\t\t\t\t\tdp2[Cur][s][e] += (long long)get(dp[good[j]] , take) * dp2[Nxt][s - good[j] * take][e - take] % mod;\n\t\t\t\t\tif(dp2[Cur][s][e] >= mod) dp2[Cur][s][e] -= mod;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} \n}\n\n\nint main(){\n\tscanf(\"%d%d%d\",&n,&d,&mod);\n\tif(n == 1){\n\t\tcout << 1 << endl;\n\t\treturn 0;\n\t}\n\tfact[0] = 1;for(int i = 1;i < N;i++) {fact[i] = (long long)i * fact[i - 1] % mod ; inv[i] = fastpower(fact[i] , mod - 2);}\n\tdp[1] = 1;\n\tgood.push_back(1);\n\tfor(int i = 2;i <= n / 2;i++){\n\t\tsolve(i);\n\t\tdp[i] = dp2[0][i - 1][d - 1];\n\t\tif(dp[i] > 0)\n\t\t\tgood.push_back(i);\n\t}\n\n\n\tint ans = 0;\n\tif(n % 2 == 0){\n\t\tans += get(dp[n / 2] , 2);\n\t}\n\tif(good.back() * 2 == n) good.pop_back();\n\tsolve(n);\n\tans += dp2[0][n - 1][d];\n\tif(ans >= mod)\n\t\tans -= mod;\n\tcout << ans << endl;\n\treturn 0;\n}", "lang": "GNU C++17", "bug_code_uid": "e8d9d3f9721ad4a6a5a14b7fd0fcf4cc", "src_uid": "bdd0fc1d6dbab5eeb5aea135fdfffc9d", "apr_id": "469b8abc73b68f3d3810113fb9d2431a", "difficulty": 2700, "tags": ["trees", "dp", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9858564693556836, "equal_cnt": 7, "replace_cnt": 0, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "#include\n#pragma GCC optimize(\"Ofast\")\n#pragma GCC optimize (\"unroll-loops\")\n#pragma GCC target (\"sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native\")\nusing namespace std;\n#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);\n#define ff first\n#define ss second\n#define eb emplace_back\n#define MP make_pair\n#define pb push_back\n#define pf push_front\n#define ins insert\n#define endl '\\n'\n#define all(v) (v).begin(), (v).end()\n#define mset(m,v) memset(m,v,sizeof(m))\n#define tr(c,it) for(auto it=c.begin();it!=c.end();it++)\n#define fr(i,n) for(lli i=0;i<(n);i++)\n#define inc(i,a,b) for(lli i=a;i<=b;i++)\n#define dec(i,a,b) for(lli i=a;i>=b;i--)\n#define fr2(i,n) for(int i=0;i<(n);i++)\n#define inc2(i,a,b) for(int i=a;i<=b;i++)\n#define dec2(i,a,b) for(int i=a;i>=b;i--)\n#define ymin(a,b) (a=min((a),(b)))\n#define ymax(a,b) (a=max((a),(b)))\n#define sz(x) (lli)(x).size()\n#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator _it(_ss); err(_it, args); }\nvoid err(istream_iterator it) {}\ntemplate\nvoid err(istream_iterator it, T a, Args... args) {\n\tcerr<< *it << \" = \" << a << endl;\n\terr(++it, args...);\n}\n\ntypedef long long int lli;\ntypedef long double ld;\ntypedef pair pii;\ntypedef pair plli;\ntypedef vector vlli;\ntypedef vector vi;\n//typedef vector >ncr(1001,vector(1001,0))\ntypedef vector vplli;\nlong long MOD=1000000009;\n#define addm(x,y) (x+y>=MOD? (x+y-MOD):(x+y))\nvoid solve()\n{\n\tint n;\n\tcin>>n;\n\tchar ch[n+1];\n\tsets;\n\t//mapmp;\n\tfor(int i=0;i>ch[i];\n\t\t//mp[((int )ch[i]-97)%26]++;\n\t\ts.insert(ch[i]);\n\n\t}\n\tif(sz(s)==1)\n\t{\n\t\tif(n%2==1)\n\t\t{\n\t\t\tcout<<(n/2)+2;\n\t\t\treturn;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tcout<<(n/2)+1;\n\t\t\treturn;\n\t\t}\n\t}\n\telse if(s.size()==n)\n\t{\n\t\tcout<=1;len--)\n\t\t{\n\t\t\t//int f=1;\n\t\t\tfor(int i=0;i<=n-2*len;i++)\n\t\t\t{\n\t\t\tint\tf=1;\n\t\t\t\tfor(int j=0;j0)\n\t\t\t\t// \tst1=i-1;\n\t\t\t\t// else\n\t\t\t\t// \tst1=i;\n\t\t\t\t// \t st2=2*len+i;\n\t\t\t\t// \tans+=st1+n-st2;\n\t\t\t\t\tans=1+i+n-len;\n\t\t\t\t\tcout<>t;\n\t// for(int i=1;i<=t;i++)\n\t// {\n\t// \tcout<<\"Case #\"<\n\nusing namespace std;\n\nint main()\n{\n\tint nani, n, sum = 0, cnt = 0;;\n\n\tcin >> n;\n\n\tfor (int i = 0; i < n; i++)\n\t{\n\t\tcin >> nani;\n\t\tsum += nani;\n\t}\n\n\tfor (int k = 1; k < 6; k++)\n\t{\n\t\tif (n % 2 == 0)\n\t\t{\n\t\t\tif ((k + sum) % 2 != 0)\n\t\t\t\tcnt++;\n\t\t}\n\t\telse if (n % 2 != 0)\n\t\t{\n\t\t\tif ((k + sum) % 2 == 0)\n\t\t\t\tcnt++;\n\t\t}\n\t}\n\tcout << cnt;\n}", "lang": "MS C++ 2017", "bug_code_uid": "a915c6fa89f90b9f838d2f93d55c0119", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "apr_id": "bd860cd9680259a7149e264113488c34", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9142857142857143, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "#include \n#include \n#include \nusing namespace std;\nlong long n,l,r;\nlong long power(long long a,long long b){\n if(b==1) return a;\n long long ans = power(a,b/2);\n ans*=ans;\n if(b%2!=0)\n ans*=a;\n return ans;\n}\nint main()\n{\n cin>>n>>l>>r;\n long long min_ans=n-l+1;\n for(int i=1;i\nusing namespace std;\ntypedef long long ll;\nint main(){\n ll n;\n cin>>n;\n ll a[n+1],b[n+1];\n for(int i=0;i>a[i];\n }\n for(int i=0;i>b[i];\n }\n ll x=0,y=0,r=0,q=0;\n for(int i=0;i\n\nusing namespace std;\n\nint main()\n{\n int cnt[5];\n for(int i=1;i<=4;i++)cin>>cnt[i];\n if(cnt[1]!=cnt[4]){\n cout<<0;\n return 0;\n }\n if(cnt[3]>2*cnt[1]){\n cout<<0;\n return 0;\n }\n cout<<1;\n return 1;\n}\n", "lang": "MS C++ 2017", "bug_code_uid": "6b7992d0262e36bb7fc48e6a17709152", "src_uid": "b99578086043537297d374dc01eeb6f8", "apr_id": "7fc2d36ffeed76cad1fa59ee86f3b8f1", "difficulty": 1100, "tags": ["greedy", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9515663643858203, "equal_cnt": 14, "replace_cnt": 9, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 13, "bug_source_code": "using namespace std;\n#include\n//typedef long long LL;\ntypedef int LL;\ntypedef long long ll;\ntypedef pair PII;\ntypedef vector< PII > VPII;\ntypedef vector VI;\ntypedef map MSI;\ntypedef map MII;\n///Print\n#define casep(no,val) printf(\"Case %lld: %lld\\n\",++no,val)\n#define casenl(no) printf(\"Case %lld:\\n\",++no)\n#define RR(n,m) scanf(\"%lld%lld\", &n,&m)\n#define case(no) printf(\"Case %lld: \",++no)\n#define R(n) scanf(\"%lld\", &n)\n#define P(a) printf(\"%lld\\n\",a)\n#define NL printf(\"\\n\")\n///LOOP\n#define FORSTL(x,n) for(__typeof(n.begin()) x=n.begin();x!=n.end();x++)\n#define repp(x,n) for(__typeof(n) x=1;x<=(n);x++)\n#define reps(i,x) for(int i=0;i<(x.size());i++)\n#define rep(x,n) for(__typeof(n) x=0;x<(n);x++)\n///Shortcut\n#define Unique(store) store.resize(unique(store.begin(),store.end())-store.begin())\n#define fastinput ios_base::sync_with_stdio(false); cin.tie(false);\n#define mem(ar,value) memset(ar,value,sizeof(ar))\n#define all(x) x.begin(),x.end()\n#define len(s) s.size()\n#define mp make_pair\n#define pb push_back\n#define SS second\n#define FF first\n///Binary_search\n#define LB(a,x) (lower_bound(all(a),x)-a.begin())\n#define UB(a,x) (upper_bound(all(a),x)-a.begin())\n///Min AND Max\n#define isEq(a,b) (fabs((a)-(b))T gcd(T a,T b){return b == 0 ? a : gcd(b, a % b);}\ntemplateT lcm(T a, T b) {return a / gcd(a,b) * b;}\n///Bigmod && Pow\ntemplateT my_pow(T n,T p){if(p==0)return 1;T x=my_pow(n,p/2);x=(x*x);if(p&1)x=(x*n);return x;} ///n to the power p\ntemplateT big_mod(T n,T p,T m){if(p==0)return (T)1;T x=big_mod(n,p/2,m);x=(x*x)%m;if(p&1)x=(x*n)%m;return x;}\n///string to int\ntemplate T extract(string s, T ret) {stringstream ss(s); ss >> ret; return ret;}///\nstring itos(LL n){string s;while(n){s+=(n%10+48);n/=10;}reverse(all(s));return s;}\nLL stoi(string s){LL n=0;rep(i,len(s))n=n*10+(s[i]-48);return n;}\n/// geometry\ndouble DEG(double x) { return (180.0*x)/(PI);}\ndouble RAD(double x) { return (x*(double)PI)/(180.0);}\ntemplate T DIS(T x1,T y1,T x2, T y2){return sqrt( (double)( (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) ) );}\ntemplate T ANGLE(T x1,T y1,T x2, T y2){ return atan( double(y1-y2) / double(x1-x2));}\ntemplate LL isLeft(T a,T b,T c) { return (c.x-a.x)*(b.y-a.y)-(b.x-a.x)*(c.y-a.y); }\nconst int N=5e5+5,MOD=1e9+7;\n\n//struct info{LL x,y;}arr[N];bool com(info a,info b){return (a.x>1,lf=idx*2,rg=lf+1;\n insert(lf,st,mid);\n insert(rg,mid+1,end);\n\n if(T[lf].x>1,lf=idx*2,rg=lf+1;\n\n\n if(pos<=mid)\n up(lf,st,mid,pos,val);\n else\n up(rg,mid+1,end,pos,val);\n if(T[lf].x>1,lf=idx*2,rg=lf+1;\n if(j<=mid)\n return read(lf,st,mid,i,j);\n else if(i>mid) return read(rg,mid+1,end,i,j);\n\n else\n {\n info aa=read(lf,st,mid,i,mid);\n info bb= read(rg,mid+1,end,mid+1,j);\n if(aa.x>n; repp(i,n) cin>>ar[i];\n\n insert(1,1,n);\n\n\n // D(read(1,1,n,1,n).y);\n\n\n repp(i,n+1000) par[i][0]=i;\n repp(i,n+1000) par[i][1]=i;\n\n\n repp(i,n-2)\n {\n\n LL aa=read(1,1,n,1,n).y;\n LL bb=find(aa,0);\n LL cc=find(aa,1);\n\n // D(aa);\n\n // DD(bb,cc);\n\n LL dd=find(bb-1,0);\n LL ee=find(cc+1,1);\n\n\n par[bb][0]=dd;\n par[cc][1]=ee;\n\n\n\n // DD(dd,ee);\n\n //cout<\nusing namespace std;\nconst int N=25*100000;\nint dp[50][N+1];\nint n;\nint a[50];\nint val;\nint DP(int i,int w){\n if(i==n)return 0;\n if(dp[i][w]!=-1)return dp[i][w];\n int p1=0,p2=0;\n if(w+a[i]<=val)p1=a[i]+DP(i+1,w+a[i]);\n p2=DP(i+1,w);\n return dp[i][w]=max(p1,p2);\n}\nint main(){\n scanf(\"%d\",&n);\n int sum=0;\n memset(dp,-1,sizeof dp);\n for(int i=0;i\n#include \n\ntypedef long long ll;\nconst int mod = 1000000007;\n\nll pw2[99];\n\nll f_rlen[99][99];\n\ninline void upda(ll &a, ll b) {\n a = (a + b) % mod;\n}\n\ninline void init_f_rlen() {\n pw2[0] = 1;\n for(int i = 1; i <= 91; ++i) pw2[i] = pw2[i - 1] * 2 % mod;\n f_rlen[0][0] = 1;\n for(int rlen = 1; rlen <= 90; ++rlen) for(int rlen1 = 0; rlen1 <= rlen; ++rlen1) {\n if(rlen1) f_rlen[rlen][rlen1] = f_rlen[rlen - 1][rlen1 - 1] * pw2[rlen - rlen1]) % mod;\n if(rlen1 < rlen) f_rlen[rlen][rlen1] = (f_rlen[rlen][rlen1] + f_rlen[rlen - 1][rlen1]) % mod;\n }\n}\n\nll g_pf[44][44];\n\ninline ll calc_prefix(int pf, int rlen) {\n ll ans = 0;\n for(int rlen1 = 0; rlen1 <= rlen; ++rlen1) {\n ll t1ans = 0;\n memset(g_pf, 0, sizeof(g_pf));\n g_pf[0][0] = 1;\n for(int pfmv = 0; (pf >> pfmv); ++pfmv) for(int pfmv1 = 0; pfmv1 <= pfmv; ++pfmv1) {\n if((pf >> pfmv) == 1) t1ans = (t1ans + g_pf[pfmv][pfmv1]) % mod;\n else {\n upda(g_pf[pfmv + 1][pfmv1], g_pf[pfmv][pfmv1]);\n if(pf >> pfmv & 1) upda(g_pf[pfmv + 1][pfmv1 + 1], g_pf[pfmv][pfmv1] * pw2[pfmv - pfmv1 + rlen - rlen1]);\n }\n }\n ans = (ans + t1ans * pw2[rlen - rlen1] % mod * f_rlen[rlen][rlen1]) % mod;\n }\n return ans;\n}\n\ninline ll calc_ans(int n) {\n if(n == 0) return 1;\n ll ans = 1; // max = 0;\n int len0;\n for(len0 = 0; (1 << (len0 + 1)) <= n; ++len0) ans = (ans + calc_prefix(1, len0)) % mod;\n int t_pf = 1;\n for(int i = len0 - 1; i >= 0; --i) {\n int a = n >> i & 1;\n if(!a) t_pf <<= 1;\n else {\n ans = (ans + calc_prefix(t_pf << 1, i)) % mod;\n t_pf = t_pf << 1 | 1;\n }\n }\n ans = (ans + calc_prefix(n, 0)) % mod;\n return ans;\n}\n\nint main() {\n init_f_rlen();\n#ifdef TEST\n printf(\"[DEBUG] calc_ans(3) = %I64d (expected: 5)\\n\", calc_ans(3));\n#else\n int k; scanf(\"%d\", &k);\n printf(\"%I64d\\n\", calc_ans(k));\n#endif\n return 0;\n}\n\n", "lang": "GNU C++", "bug_code_uid": "2ec53851ad38b629504c279ad0b9a3f3", "src_uid": "ead64d8e3134fa8f29881cb487e52f60", "apr_id": "2b01e43567e3e9db293f93e8d97f55a8", "difficulty": 2700, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.6281645569620253, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "#pragma warning(disable:4996)\n\n#include \n\nusing namespace std;\n\nenum\n{\n\tCircle = 0,\n\tTriangle = 1,\n\tSquare = 2\n};\n\nint main()\n{\n\tint N;\n\tint a[105];\n\tbool inf = false;\n\tint res = 0;\n\tcin >> N;\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\tswitch ((a[i - 1] - 1) * 3 + (a[i] - 1))\n\t\t{\n\t\tcase 1:\n\t\t\tres += 3; break;\n\t\tcase 2:\n\t\t\tres += 4; break;\n\t\tcase 3:\n\t\t\tres += 3; break;\n\t\tcase 5:\n\t\t\tinf = true; break;\n\t\tcase 6:\n\t\t\tres += 4; break;\n\t\tcase 7:\n\t\t\tinf = true; break;\n\t\t}\n\t}\n\n\tif (inf)\n\t\tcout << \"Infinite\" << endl;\n\telse\n\t\tcout << \"Finite\" << endl << res << endl;\n\t\n\t//system(\"pause\");\n}", "lang": "MS C++ 2017", "bug_code_uid": "e1c0c71a3d2dbdb65276dc0a4dadf8b1", "src_uid": "6c8f028f655cc77b05ed89a668273702", "apr_id": "c2546143ef3001623791655b383144c1", "difficulty": 1400, "tags": ["geometry"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.26903553299492383, "equal_cnt": 12, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 11, "bug_source_code": "#include \n\nusing namespace std;\n\nunordered_map < long long, int > before;\n\nvoid Backt(int &cur, long long &cur_cost, int &n, int &fin, vector < int > &cost, long long &best) {\n \n if (before[cur_cost] > cur) {\n return;\n }\n before[cur_cost] = cur;\n\n if (cur >= fin) {\n best = min(best, cur_cost);\n return;\n }\n\n for (int i = 1; i <= n; i ++) {\n \n cur += (1 << (i - 1));\n cur_cost += cost[i];\n Backt(cur, cur_cost, n, fin, cost, best);\n cur_cost -= cost[i];\n cur -= (1 << (i - 1));\n }\n}\n\nint main() {\n\n ios::sync_with_stdio (false);\n\n int n, l;\n cin >> n >> l;\n\n vector < int > cost(n + 1);\n for (int i = 1; i <= n; i ++) {\n cin >> cost[i];\n }\n \n int cur = 0;\n long long cur_cost = 0;\n long long best = 2e9;\n Backt(cur, cur_cost, n, l, cost, best);\n cout << best << '\\n';\n}\n", "lang": "GNU C++14", "bug_code_uid": "977eedee483da587b2628f6bd1f98478", "src_uid": "04ca137d0383c03944e3ce1c502c635b", "apr_id": "249418eecbfe47f5280f5e8e0e2426eb", "difficulty": 1600, "tags": ["dp", "greedy", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5546995377503852, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "#include\nusing namespace std;\n#define ll long long\nll powr(ll k){\n return 10*pow(10,k-1);\n}\nint main(){\n ll n,k,a[100];\n scanf(\"%lld%lld\",&n,&k);\n if(k==0){\n printf(\"%lld\",n);\n return 0;\n }\n if(k==1){\n printf(\"%d\",n*10);\n return 1;\n }\n ll d2=2,d5=5,cnt=0,x=n;\n while(true){\n if(n%2==1 && n%5!=0) break;\n if(n%2==0)n/=2;\n if(n%5==0)n/=5;\n }\n printf(\"%lld\",n*powr(k));\n}", "lang": "GNU C++17", "bug_code_uid": "1c0b9633cfd8c78b4ef022b11a178321", "src_uid": "73566d4d9f20f7bbf71bc06bc9a4e9f3", "apr_id": "a1773265fa3d84301e936a4bd3330327", "difficulty": 1100, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9282945736434108, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \n\n\nusing namespace std;\n\n\nint gcd(int x, int y)\n{\n while(x * y != 0)\n if(x < y)\n y %= x;\n else\n x %= y;\n return x + y;\n}\n\n\nint main()\n{\n freopen(\"input.txt\",\"r\",stdin);\n freopen(\"output.txt\",\"w\",stdout);\n int n;\n scanf(\"%d\", &n);\n int x = 0;\n int y = 0;\n for(int i = 2; i < n; i++)\n {\n y++;\n int m = n;\n while(m != 0)\n {\n x += m % i;\n m /= i;\n }\n }\n int g = gcd(x, y);\n printf(\"%d/%d\", x / g, y / g);\n}", "lang": "MS C++", "bug_code_uid": "6c9ebf7a7fbec87252a14e6ae7421c29", "src_uid": "1366732dddecba26db232d6ca8f35fdc", "apr_id": "a02606b92d193bb3c1474c2e3d5dc0d6", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9860594795539034, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 6, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n#define loop(n,i,a) for(int i=a;i\n#define vll vector\n#define\t\tvii \t\t\tvector>\n#define sz(x) (int)x.size()\n#define pb push_back\nint dx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };\nint dy[] = { -1, 0, 1, -1, 1, -1, 0, 1 };\n\nint main() {\n\tstring s,t=\"CODEFORCES\";\n\tcin>>s;\n\tloop(10,i,0){\n\t\tstring temp=s.substr(0,i)+s.substr(sz(s)-(sz(t)-i));\n\t\tif(temp==t)\n\t\t\treturn cout<<\"YES\",0;\n\t}\n\tcout<<\"NO\";\n}\n", "lang": "GNU C++14", "bug_code_uid": "8067f270d946380366ea87944e891e4c", "src_uid": "bda4b15827c94b526643dfefc4bc36e7", "apr_id": "bf132ccd617be831c4110f9250d0150e", "difficulty": 1400, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9779591836734693, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include\n\nusing namespace std;\n\nint main(){\n\tint c=0,j=9,i,k=0,p=0;\n\tchar a;\n\tstring x,y;\n\ty=\"CODEFORCES\";\n\tcin>>x;\n\t\n\tc=0;\n\tfor(i=0;i<10;i++){\n\t\tif(x[i]!=y[i]){\n\t\t\tc=1;\n\t\t}\n\t}\n\n\tfor(i=x.size()-1;i>x.size()-11;i--){\n\t\tif(x[i]!=y[j]){\n\t\t\tc=1;\n\t\t}\n\t\tj--;\n\t}\n\n\t\n\tif(c==0){\n\t\tcout<<\"YES\";\n\t\treturn 0;\n\t}\n\t\n\tj=0;\n\tfor(i=0;i=x.size()+j-9;i--){\n\t\tif(x[i]==y[p]){\n\t\t\tif(k==0){\n\t\t\t\tp--;\n\t\t\t}\n\t\t}else{\n\t\t\tk=1;\n\t\t}\n\t\t\n\t}\n\tp++;\n\tif(j==p-1){\n\t\tcout<<\"YES\";\n\t\treturn 0;\n\t}\n\t\n\tcout<<\"NO\";\n\t\n\n}", "lang": "GNU C++14", "bug_code_uid": "92479d5598a3347d77a84943ddb3b94a", "src_uid": "bda4b15827c94b526643dfefc4bc36e7", "apr_id": "b7834e960bd93e716de3cd6a0d908ceb", "difficulty": 1400, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8356620093147039, "equal_cnt": 14, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 14, "bug_source_code": "#include \nusing namespace std;\n\n\n\n\nint r,c;\nint main(){\n\n while(scanf(\"%d %d\",&r,&c)){\n int sum(0),cnt(0);\n\n char cake[r+1][c+1];\n\n for(int i=0;i=0;rev--){\n if(cake[i][rev]=='E')cake[i][rev]='.';\n }\n break;\n }\n }\n sum+=cnt;\n }\n for(int j=0;j=0;rev--){\n if(cake[rev][j]=='E')cake[rev][j]='.';\n }\n break;\n }\n }\n sum+=cnt;\n\n }\n printf(\"%d\\n\",sum);\n\n }\n\n}\n", "lang": "GNU C++14", "bug_code_uid": "43870b2ac802c68e49d701e90d966539", "src_uid": "ebaf7d89c623d006a6f1ffd025892102", "apr_id": "58a07d830338c60ddafca4be5b64716b", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.2638888888888889, "equal_cnt": 4, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "#include\nusing namespace std;\nint main ()\n{\n int a,b,c,d;\n cin >> a >> b >> c >> d;\n if ( a == d ){\n cout << 1;\n return 1;\n }\n cout << 0;\n}", "lang": "GNU C++17", "bug_code_uid": "af329123fa2a8bb93e77ebe02274fb40", "src_uid": "b99578086043537297d374dc01eeb6f8", "apr_id": "03c46901a8990b2bddbbde8544c1bee3", "difficulty": 1100, "tags": ["greedy", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9364881693648817, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include\n#include\nusing namespace std;\nint main()\n{\n int n,m,i=0,c=0,s,b;\n cin>>n>>m;\n int a[n];\n for(i=0;i>a[i];\n if(a[i]>=c)\n c=a[i];\n }\n s= (c-m);\n for(i=n-1;i>=0;i--)\n {\n if(a[i]>s)\n {\n b=i+1;\n break;\n }\n }\n cout<\nusing namespace std;\n\nint main() {\n\tios_base::sync_with_stdio(false); cin.tie(NULL);\n#ifndef ONLINE_JUDGE\n\tfreopen(\"input.txt\", \"r\", stdin); freopen(\"output.txt\", \"w\", stdout);\n#endif\n\n\tint n, k;\n\tcin >> n >> k;\n\n\tint arr[n];\n\tfor (int i = 0; i < n; i++) {\n\t\tarr[i] = i + 1;\n\t}\n\n\tfor (int i = 0; i < k; i++) {\n\t\tswap(arr[i], arr[n - 1 - i]);\n\t}\n\n\tint64_t count = 0;\n\tfor (int i = 0; i < n; i++) {\n\t\tfor (int j = i + 1; j < n; j++) {\n\t\t\tif (arr[i] > arr[j])count++;\n\t\t}\n\t}\n\tcout << count;\n\n\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "f798922367aabcffd82adce562b540d9", "src_uid": "ea36ca0a3c336424d5b7e1b4c56947b0", "apr_id": "4e1e8898eb2c6b2b4b67009b418d0339", "difficulty": 1200, "tags": ["math", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8142268662714759, "equal_cnt": 30, "replace_cnt": 23, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 29, "bug_source_code": "//*\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define MOD 1000000007\n#define MAX 0x3f3f3f3f\n#define MAX2 0x3f3f3f3f3f3f3f3fll\n#define ERR 1e-10\n#define mp make_pair\n#define all(x) (x).begin(), (x).end()\n#pragma warning(disable:4996)\nusing namespace std;\n\ntypedef long long ll;\ntypedef long double ldb;\ntypedef pair pii;\ntypedef pair pll;\ntypedef pair pdd;\n\nstruct SAT\n{\n\tint n, m;\n\tvector edge[3000];\n\tvector redge[3000];\n\tint gi;\n\tint g[3000];\n\tint bgi;\n\tint bg[3000];\n\tvector gmem[3000];\n\tint check[3000];\n\tvector ord;\n\tint rord[3000];\n\tint ans[3000];\n\n\tint getnum(int x)\n\t{\n\t\tif(x > 0) return x-1;\n\t\telse\n\t\t{\n\t\t\tx*=-1;\n\t\t\tx--;\n\t\t\treturn x+n;\n\t\t}\n\t}\n\tint not(int x)\n\t{\n\t\tif(x >= n) return x-n;\n\t\telse return x+n;\n\t}\n\tvoid input()\n\t{\n\t\tint i, j;\n\t\tfor(i=0;i w;\n\t\tw.emplace_back(y, x);\n\t\tw.emplace_back(y^1, not(x));\n\t\tans[x]=y;\n\t\tans[not(x)]=y^1;\n\t\tfor(j=0;j rord[not(i)]) swap(u, v);\n\t\t\t\tmarkans(u, 0);\n\t\t\t}\n\t\t}\n\t}\n\tvoid rback2(int now)\n\t{\n\t\tif(check[now]) return;\n\t\tassignfalse(now);\n\t\tcheck[now]=1;\n\t\tfor(auto e : redge[now])\n\t\t{\n\t\t\trback2(e);\n\t\t}\n\t}\n\tvoid fillremain()\n\t{\n\t\tfill(check, check+n*2, 0);\n\t\tfor(auto e : ord)\n\t\t{\n\t\t\tif(check[e]) continue;\n\t\t\trback2(e);\n\t\t}\n\t}\n\n\tint tclo[2005][2005];\n\tmap mq;\n\tint tn;\n\n\tvoid maketclo()\n\t{\n\t\tint i, j, k;\n\t\t\n\t\tfor(i=0;i>n>>m1>>m2;\n\ts1.n=n, s1.m=m1;\n\ts2.n=n, s2.m=m2;\n\ts1.input(), s2.input();\n\tint u1=s1.scc(), u2=s2.scc();\n\tif(!u1 && !u2) return !printf(\"SIMILAR\");\n\telse if(u1 && !u2)\n\t{\n\t\tfor(i=0;i\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\n\nconst int N = 2000 + 10;\n\nint n, m1, m2;\n\nstruct SAT\n{\n\tint n, m;\n\tvector adj[N];\n\tvector new_adj[N];\n\tbitset reach[N];\n\tint qin[N]; //0? 1:yes! -1:not!\n\tint have_sol;\n\tint flag, totc;\n\tint instack[N], stack[N], top;\n\tint low[N], dfn[N], color[N];\n\tint tarjan(int u) {\n\t\tinstack[u] = true;\n\t\tstack[++ top] = u;\n\t\tdfn[u] = low[u] = flag ++;\n\t\tfor(int e = 0; e < adj[u].size(); ++ e) {\n\t\t\tint v = adj[u][e];\n\t\t\tif (dfn[v] < 0) {\n\t\t\t\tlow[u] = min(low[u], tarjan(v));\n\t\t\t} else if (instack[v]) {\n\t\t\t\tlow[u] = min(low[u], dfn[v]);\n\t\t\t}\n\t\t}\n\t\tif (dfn[u] == low[u]) {\n\t\t\tint v;\n\t\t\tdo {\n\t\t\t\tv = stack[top --];\n\t\t\t\tinstack[v] = false;\n\t\t\t\tcolor[v] = totc;\n\t\t\t} while(v != u);\n\t\t\ttotc ++;\n\t\t}\n\t\treturn low[u];\n\t}\n\tvoid construct(int _n, vector> edges) {\n\t\tn = _n; m = edges.size();\n\t\tfor(int i = 0; i < m; ++ i) {\n\t\t\tint u = edges[i].first, v = edges[i].second;\n\t\t\tif (u < n) u = -u + n;\n\t\t\tif (v < n) v = -v + n;\n\t\t\t--u, --v;\n\t\t\tadj[u < n ? u + n : u - n].push_back(v);\n\t\t\tadj[v < n ? v + n : v - n].push_back(u);\n\t\t}\n\t\tflag = totc = top = 0;\n\t\tfill(dfn, dfn + n + n, -1);\n\t\tfill(instack, instack + n + n, false);\n\t\tfor(int i = 0; i < n + n; ++ i) {\n\t\t\tif (dfn[i] < 0) {\n\t\t\t\ttarjan(i);\n\t\t\t}\n\t\t}\n\t\thave_sol = true;\n\t\tfor(int i = 0; i < n; ++ i) {\n\t\t\tif (color[i] == color[i + n]) {\n\t\t\t\thave_sol = false;\n\t\t\t}\n\t\t}\n\t\tif (! have_sol) return;\n\t\tfor(int i = 0; i < n + n; ++ i) {\n\t\t\tfor(int e = 0; e < (int)adj[i].size(); ++ e) {\n\t\t\t\tint j = adj[i][e];\n\t\t\t\tif (color[i] != color[j]) {\n\t\t\t\t\tnew_adj[color[i]].push_back(color[j]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(int i = 0; i < totc; ++ i) {\n\t\t\treach[i].reset();\n\t\t\treach[i][i] = true;\n\t\t\tfor(int e = 0; e < (int)new_adj[i].size(); ++ e) {\n\t\t\t\tint j = new_adj[i][e];\n\t\t\t\treach[i] |= reach[j];\n\t\t\t}\n\t\t}\n\t\tfor(int i = 0; i < n; ++ i) {\n\t\t\tint u = color[i], v = color[i + n];\n\t\t\tif (reach[u][v]) {\n\t\t\t\tqin[v] = 1;\n\t\t\t\tqin[u] = -1;\n\t\t\t}\n\t\t\tif (reach[v][u]) {\n\t\t\t\tqin[u] = 1;\n\t\t\t\tqin[v] = -1;\n\t\t\t}\n\t\t}\n\t\tfor(int i = 0; i < totc; ++ i) {\n\t\t\tif (qin[i] > 0) {\n\t\t\t\tfor(int j = 0; j < totc; ++ j) {\n\t\t\t\t\tif (reach[i][j]) qin[j] = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (qin[i] < 0) {\n\t\t\t\tfor(int j = 0; j < totc; ++ j) {\n\t\t\t\t\tif (reach[j][i]) qin[j] = -1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tbool can_have_sol(int r1, int r2) {\n\t\tif (r1 < 0) r1 = -r1 + n;\n\t\tif (r2 < 0) r2 = -r2 + n;\n\t\t--r1, --r2;\n\t\tif (qin[color[r1]] < 0 || qin[color[r2]] < 0) return false;\n\t\tif (reach[color[r1]][color[r2 < n ? r2 + n : r2 - n]]) {\n\t\t\treturn false;\n\t\t}\n\t\tif (reach[color[r2]][color[r1 < n ? r1 + n : r1 - n]]) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\tvoid output_sol() {\n\t\tfor(int i = 0; i < n; ++ i) {\n\t\t\tif (color[i + n] < color[i]) {\n\t\t\t\tprintf(\"0 \");\n\t\t\t} else {\n\t\t\t\tprintf(\"1 \");\n\t\t\t}\n\t\t}\n\t\tprintf(\"\\n\");\n\t}\n} s1, s2;\n\nvoid constuct_sol(vector> edges, int r1, int r2) {\n\tif (r1) {\n\t\tedges.push_back(make_pair(r1, r1));\n\t\tedges.push_back(make_pair(r2, r2));\n\t}\n\tSAT s;\n\ts.construct(n, edges);\n\ts.output_sol();\n}\n\nvoid solve()\n{\n\tcin >> n >> m1 >> m2;\n\tvector> e1, e2;\n\tfor(int i = 0; i < m1; ++ i) {\n\t\tint x, y;\n\t\tscanf(\"%d%d\", &x, &y);\n\t\te1.push_back(make_pair(x, y));\n\t}\n\tfor(int i = 0; i < m2; ++ i) {\n\t\tint x, y;\n\t\tscanf(\"%d%d\", &x, &y);\n\t\te2.push_back(make_pair(x, y));\n\t}\n\ts1.construct(n, e1);\n\ts2.construct(n, e2);\n\tif (s1.have_sol != s2.have_sol) {\n\t\tif (s1.have_sol) {\n\t\t\tconstuct_sol(e1, 0, 0);\n\t\t\treturn;\n\t\t}\n\t\tif (s2.have_sol) {\n\t\t\tconstuct_sol(e2, 0, 0);\n\t\t\treturn;\n\t\t}\n\t}\n\tif (s1.have_sol == false) {\n\t\tputs(\"SIMILAR\");\n\t}\n\tfor(int i = 0; i < m2; ++ i) {\n\t\tif (s1.can_have_sol(-e2[i].first, -e2[i].second)) {\n\t\t\tconstuct_sol(e1, -e2[i].first, -e2[i].second);\n\t\t\treturn;\n\t\t}\n\t}\n\tfor(int i = 0; i < m1; ++ i) {\n\t\tif (s2.can_have_sol(-e1[i].first, -e1[i].second)) {\n\t\t\tconstuct_sol(e2, -e1[i].first, -e1[i].second);\n\t\t\treturn;\n\t\t}\n\t}\n\tputs(\"SIMILAR\");\n}\n\nint main()\n{\n\tsolve();\n\treturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "08c3a78b2c406bfb3b1d7729bc0391ca", "src_uid": "e7f585455aaf039aa6f0f2846d818b40", "apr_id": "5a0f52d87a2a639c425709e4ea8dacd9", "difficulty": 3000, "tags": ["graphs"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.2703395259449071, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": " #include \nusing namespace std;\nconst int maxn = 1e5 + 100;\nconst int mod = 1e9 + 7;\ntypedef long long ll;\n\nint x[5], y[5];\n\nint main(){\n for(int i = 1; i <= 3; i++)\n cin >> x[i] >> y[i];\n sort(x + 1 + 3, y + 1 + 3);\n int cntx = 0, cnty = 0;\n if(x[1] == x[2]){\n cntx = 2;\n if(x[2] == x[3])\n cntx++;\n }\n else if(x[2] == x[3])\n cntx = 2;\n else if(x[1] == x[3])\n cntx = 2;\n else\n cntx = 1;\n if(y[1] == y[2]){\n cnty = 2;\n if(y[2] == y[3])\n cnty++;\n }\n else if(y[2] == y[3])\n cnty = 2;\n else if(y[1] == y[3])\n cnty = 2;\n else cnty = 1;\n int cnt = max(cntx, cnty);\n cout << 3 - cnt + 1;\n}\n", "lang": "GNU C++14", "bug_code_uid": "00a112840cbcf1de12dff38121bab657", "src_uid": "36fe960550e59b046202b5811343590d", "apr_id": "cc0403f537e61f838768643339716d3f", "difficulty": 1700, "tags": ["constructive algorithms", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9649122807017544, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include \n#include \nconst int MAXN = 5e5 + 10;\nint f[MAXN];\nint main()\n{\n int n,d;\n while(~scanf(\"%d%d\",&n,&d))\n {\n int v,sum = 0,day = 0;\n memset(f,false,sizeof(f));\n for(int i = 0;i < n;++i){\n scanf(\"%d\",&v);\n f[v] = true;\n sum += v;\n for(int j = sum;j >= v;--j)\n f[j] |= f[j-v];\n }\n int i,res = 0;\n for(;;day++){\n for(i = d;i;i--){\n if(f[i+res]){\n res += i;\n break;\n }\n }\n if(!i)break;\n }\n printf(\"%d %d\\n\",res,day);\n }\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "8b755b975f80c03b3b400ab001b8f692", "src_uid": "65699ddec8d0db2f58b83a0f64de6f6f", "apr_id": "b511bbcefc5578a43d9f620f202d7d15", "difficulty": 2200, "tags": ["dp", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9752124645892352, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "/*\n ________ __ _______ ________\n |_____ | / \\ | ____ \\ | ____ \\\n / / / /\\ \\ | | \\ \\ | |____| /\n / / / / \\ \\ | | \\ \\ | ___ /\n / / / /____\\ \\ | | \\ \\ | | \\ \\\n / / / ________ \\ | | | | | | \\ \\\n / /_____ / / \\ \\ | |____| | | | \\ \\\n |_______| /_/ \\_\\ |_______/ |_| |_|\n*/\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\ntypedef long long ll;\ntypedef pair pii;\ntypedef pair piii;\n\n#define F first\n#define S second\n#define mkp make_pair\n#define pb push_back\n#define ppb pop_back\n#define sz(a) (int)a.size()\n#define all(a) a.begin(), a.end()\n\nconst int N = 123;\nconst int INF = 1e4 + 123;\nconst int MOD = 1e9 + 7;\nconst double EPS = 1e-9;\n\nint n, a[N], ans = INF, mx = -1;\n\nint main () {\n ios_base :: sync_with_stdio(0);\n cin >> n;\n for(int i = 1; i <= n; ++i) {\n \tcin >> a[i];\n\t}\n\tfor(int i = 1; i < n; ++i) \n\t\tmx = max(mx, a[i + 1] - a[i]);\n\tfor(int i = 2; i < n; ++i) {\n\t\tmx = max(mx, a[i + 1] - a[i - 1]);\n\t\tans = min(ans, mx);\n\t}\n\tcout << ans;\n\treturn 0;\n}", "lang": "GNU C++17", "bug_code_uid": "ac25d2729918b98a8feeccd35c73b5b3", "src_uid": "8a8013f960814040ac4bf229a0bd5437", "apr_id": "8a8cfd54c8027118002a7b38cc766ea4", "difficulty": 900, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.975609756097561, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \nint X[1000000],F[100000],i,j,x,y,k,N=1000000;\nint main(){\n int n;\n cin>>n;\n for (i=1;i0){\n\ty*=10;\n\ty+=(x%10);\n\tx/=10;\n }\n if((X[y]==1)&&(i!=y)){\n\tk++;\n\tF[k]=i;\n }\n }\n cout<\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace __gnu_pbds;\nusing namespace std;\ntypedef long long ll;\ntypedef vector vi;\ntypedef vector vf;\ntypedef pair pii;\ntypedef vector vpi;\ntypedef pair pif;\ntypedef pair pfi;\ntypedef pair pff;\n#define F first\n#define S second\n#define PB push_back\n#define MP make_pair\nint main(){\nios:: sync_with_stdio(0);\ncin.tie(0);\nint a,b,c,d,e,f;\nstd::cin >> a;\nstd::cin >> b;\nstd::cin >> c;\nstd::cin >> d;\nstd::cin >> e;\nstd::cin >> f;\nint mi = min(b,c);\nint ma = 0;\nfor (int i = 0; i <= a; i++) {\n for (int j = 0; j <= mi; j++) {\n if (i+j<=d) {\n ma = max(ma,i*e+j*f);\n }\n }\n}\nstd::cout << ma << '\\n';\nreturn 0;\n}\n//to run the program use asd file.cpp\n", "lang": "GNU C++11", "bug_code_uid": "aa6d7c0dc76ca7489a18ad64aedf2a44", "src_uid": "84d9e7e9c9541d997e6573edb421ae0a", "apr_id": "ed0025e8e7f56cb0452b925dde664756", "difficulty": 800, "tags": ["math", "brute force", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7174978017836955, "equal_cnt": 54, "replace_cnt": 11, "delete_cnt": 4, "insert_cnt": 38, "fix_ops_cnt": 53, "bug_source_code": "#include \n#include \n#include \n#include \nusing namespace std;\n\n#define MAX_N 200000\n\nint n;\nint numbers[MAX_N];\nint exists[MAX_N + 1];\n\nstruct Node {\n int l, r, sum;\n Node *left, *right;\n int first, last;\n};\n\ndeque nodes;\n\nNode *root;\n\nNode* newNode() {\n nodes.emplace_back();\n return &nodes.back();\n}\n\nNode* fillNode(int first, int last) {\n if (first >= last) {\n return nullptr;\n }\n int mid = (first + (last - first) / 2);\n Node * result = newNode();\n result->first = first;\n result->last = last;\n result->l = first;\n result->r = last - 1;\n result->left = fillNode(l, mid);\n result->right = fillNode(mid + 1, r);\n result->sum = 0;\n if (!result->left && !result->right) {\n result->sum = l;\n } else {\n if (result->left) {\n result->sum += result->left->sum;\n }\n if (result->right) {\n result->sum += result->right->sum;\n }\n }\n return result;\n}\n\nvoid fixup(Node * node, Node * parent) {\n if (node->r < parent->l) {\n node->sum = (node->last - node->first) * parent->l;\n node->l = node->r = parent->l;\n }\n}\n\nint update(Node *node, int first, int last, int size, Node * parent) {\n if (first >= node->last || last <= node->first) return 0;\n if (parent)\n fixup(node, parent);\n if (node->l >= size) return 0;\n\n if (first <= node->first) {\n node->l = size;\n }\n if (node->last <= last) {\n node->r = max(node->r, size);\n }\n \n if (first <= node->first && node->last <= last && node->r <= size) {\n int new_sum = (node->last - node->first) * size;\n int result = new_sum - node->sum;\n node->sum = new_sum;\n return result;\n }\n \n int sum_from_child = 0;\n if (node->left) {\n sum_from_child += update(node->left, first, last, size, node);\n }\n if (node->right) {\n sum_from_child += update(node->right, first, last, size, node);\n }\n \n node->sum += sum_from_child;\n return sum_from_child;\n}\n\nint set_from(int first, int last) {\n if (first >= last) return 0;\n int barSize = last;\n int barIdx = first;\n return update(root, barIdx, n, barSize, nullptr);\n}\n\nint main() {\n std::ios_base::sync_with_stdio(false);\n cin >> n;\n root = fillNode(0, n);\n fill(begin(exists), end(exists), -1);\n for (int i = 0; i < n; ++i) {\n cin >> numbers[i];\n exists[numbers[i]] = i;\n }\n \n int64_t result = 0;\n for (int gcd = MAX_N; gcd >= 1; --gcd) {\n std::vector idxs;\n for (int i = gcd; i <= MAX_N; i += gcd) {\n if (exists[i] >= 0)\n idxs.push_back(exists[i]);\n }\n if (idxs.size() < 2) continue;\n nth_element(begin(idxs), begin(idxs) + 2, end(idxs));\n int x1 = idxs[0];\n int x2 = idxs[1];\n nth_element(begin(idxs), begin(idxs) + idxs.size() - 2, end(idxs));\n int x3 = idxs[idxs.size() - 2];\n int x4 = idxs[idxs.size() - 1];\n \n result += gcd * set_from(0, x3);\n result += gcd * set_from(x2, idxs.size());\n result += gcd * set_from(x1 + 1, x4);\n }\n}", "lang": "GNU C++11", "bug_code_uid": "83b0b8a39bc6bbe4b0018c977764ea44", "src_uid": "deb3938a6d3f13c4ab8a0765bf0e94b0", "apr_id": "eff868da50585ba4d2ac7020889ef388", "difficulty": 2800, "tags": ["data structures", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.08037825059101655, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "#include\nusing namespace std;\nint main ()\n{\n int a,arr[16];\n cin >> a ;\n for(int i=0;i> arr[i];\n }\n if(a==1&&arr[0]==0){\n cout<<\"UP\";\n return 0;\n }\n else if(a==1&&arr[0]!=0){\n cout<<\"-1\";\n return 0;\n } \n if(arr[a-1]<15&&arr[a-2]>arr[a-3])\n cout<<\"UP\";\n else \n cout<<\"DOWN\";\n}", "lang": "GNU C++11", "bug_code_uid": "65139a108c91bdae1202371dde19e1dd", "src_uid": "8330d9fea8d50a79741507b878da0a75", "apr_id": "a9184fd4e029215d71cf5df58dd416e7", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8802308802308803, "equal_cnt": 23, "replace_cnt": 10, "delete_cnt": 0, "insert_cnt": 12, "fix_ops_cnt": 22, "bug_source_code": "#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\nvoid init(string s, map& numOfLessCoins) {\n\n\tif (s[1] == '>') {\n\n\t\tif (numOfLessCoins.find(s[0]) != numOfLessCoins.end()) {\n\t\t\tnumOfLessCoins[s[0]]++;\n\t\t}\n\t\telse {\n\t\t\tnumOfLessCoins.insert(pair(s[0], 0));\n\t\t\tnumOfLessCoins[s[0]]++;\n\t\t}\n\n\t\tif (numOfLessCoins.find(s[2]) == numOfLessCoins.end()) {\n\t\t\tnumOfLessCoins.insert(pair(s[2], 0));\n\t\t}\n\t}\n\n\telse {\n\n\t\tif (numOfLessCoins.find(s[2]) != numOfLessCoins.end()) {\n\t\t\tnumOfLessCoins[s[2]]++;\n\t\t}\n\t\telse {\n\t\t\tnumOfLessCoins.insert(pair(s[2], 0));\n\t\t\tnumOfLessCoins[s[2]]++;\n\t\t}\n\n\t\tif (numOfLessCoins.find(s[1]) == numOfLessCoins.end()) {\n\t\t\tnumOfLessCoins.insert(pair(s[1], 0));\n\t\t}\n\n\t}\n}\n\nint main() {\n\tstring s;\n\tmap numOfLessCoins;\n\tvector a;\n\n\tcin >> s;\n\twhile (s != \"0\") {\n\t\tinit(s, numOfLessCoins);\n\t\tcin >> s;\n\t}\n\n\ttypedef std::function, pair)> Comparator;\n\n\tComparator compFunctor =\n\t\t[](pair elem1, pair elem2)\n\t{\n\t\treturn elem1.second < elem2.second;\n\t};\n\n\t// Declaring a set that will store the pairs using above comparision logic\n\tstd::set, Comparator> setOfWords(\n\t\tnumOfLessCoins.begin(), numOfLessCoins.end(), compFunctor);\n\n\t// Iterate over a set using range base for loop\n\t// It will display the items in sorted order of values\n\tint j = 0;\n\tstring output = \"\";\n\tfor (std::pair element : setOfWords) {\n\t\tif (element.second == j) {\n\t\t\toutput += element.first;\n\t\t}\n\t\telse {\n\t\t\toutput = \"IMPOSSIBLE\";\n\t\t\tbreak;\n\t\t}\n\t\tj++;\n\t}\n\t\n\tcout << output;\n\n\n}", "lang": "GNU C++17", "bug_code_uid": "62bc508d28a0b87bcb98985574de5e17", "src_uid": "97fd9123d0fb511da165b900afbde5dc", "apr_id": "9cc170bdfd5bb3a9ba6928010ac9e546", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9224489795918367, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \n\nusing namespace std;\n\nint main()\n{\n int a,b;\n int h;\n h=a+b;\n cout << h;\n}\n", "lang": "GNU C++11", "bug_code_uid": "b92389a12a15b8e17d85196e6669a9ca", "src_uid": "b6e3f9c9b124ec3ec20eb8fcea075add", "apr_id": "9b1b8931ccaf9cd21ffcf90728212296", "difficulty": 1500, "tags": ["brute force", "constructive algorithms", "implementation", "dsu"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9765545361875637, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "#include\n#include\nusing namespace std;\n\nint main()\n{\n\twhile (true)\n\t{\n\t\tint children;\n\t\tint times;\n\t\tcin >> children;\n\t\tcin >> times;\n\t\tchar q[50];\n\t\tfor (int i = 0; i < children; i++)\n\t\t{\n\t\t\tcin >> q[i];\n\t\t}\n\t\tfor (int i = 0; i < times; i++)\n\t\t{\n\t\t\tfor (int j = 0; j < children; j++)\n\t\t\t{\n\t\t\t\tif (q[j] == 'B' & q[j + 1] == 'G')\n\t\t\t\t{\n\t\t\t\t\tswap(q[j], q[j + 1]);\n\t\t\t\t\tj = j + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\n\t\t}\n\t\tfor (int i = 0; i < children; i++)\n\t\t{\n\t\t\tcout << q[i];\n\t\t}\n\t\t\n\t}\n\n\treturn 0;\n}\n\n\n\n\n", "lang": "MS C++", "bug_code_uid": "f0e710679769b687bb630eb2c9f97ce1", "src_uid": "964ed316c6e6715120039b0219cc653a", "apr_id": "1c5e3713addfb15310969d5334230c0c", "difficulty": 800, "tags": ["shortest paths", "constructive algorithms", "implementation", "graph matchings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9986854460093897, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n//#include \"sqrt.cpp\"\n//#include \"tree.cpp\"\n//#include \"funcs.cpp\"\n\n#define all(x) (x).begin(), (x).end()\n//#define max(x, y) ((x)>(y))?(x):(y)\n#define forn(N) for(int i = 0; i>= 1;\n }\n return res;\n}\n\n\nint main()\n{\n #ifndef ONLINE_JUDGE\n freopen(\"input.txt\", \"r\", stdin); freopen(\"output.txt\", \"w\", stdout);\n #endif\n\n cin>>N>>M;\n\n MATRIX ans(3);\n \n ans.MAT[0][0] = 3;\n ans.MAT[0][1] = 0;\n ans.MAT[0][2] = 2;\n \n ans.MAT[1][0] = 0;\n ans.MAT[1][1] = 3;\n ans.MAT[1][2] = 2;\n \n ans.MAT[2][0] = 0;\n ans.MAT[2][1] = 0;\n ans.MAT[2][2] = 1;\n\n MATRIX lol = binpow (ans, N-1);\n\n vector B(3);\n \n B[0] = 8;\n B[1] = 2;\n B[0] = 1;\n\n long long sum = 0;\n\n forn(3)\n {\n sum+=lol.MAT[0][i] * B[i];\n }\n cout<<(sum-1)%M;\n\n\n //printf(\"\\n\\ntime-%.3lf\", clock()*1e-3);\n return 0;\n}", "lang": "GNU C++0x", "bug_code_uid": "aa85aa73de3d45b374f9be701820a33f", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "apr_id": "3368548b4f404c3f30d6c713689b1f15", "difficulty": 1400, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9968602825745683, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \n#include \n#include \n\nusing namespace std;\n\nconst int N = 110;\n\nint n;\nint t[N];\nint T;\n\nbool ok(int cnt){\n\tfor (int i = 1; i <= n; i++){\n\t\tint j = i;\n\t\tint c = 0;\n\t\twhile (j <= n){\n\t\t\tif (t[i] + T < t[j]) break;\n\t\t\tj++;\n\t\t\tc++;\n\t\t}\n\t\tif (c >= cnt) return 1;\n\t}\n\treturn 0;\n}\n\nint main(){\n\n\tios_base::sync_with_stdio(false);\n\tcin.tie(0);\n\n#ifndef ONLINE_JUDGE\n\tfreopen(\"b.in\", \"r\", stdin);\n#endif\n\t\tcin >> n;\n\t\tfor (int i = 1; i <= n; i++){\n\t\t\tcin >> t[i];\n\t\t}\n\t\tcin >> T;\n\t\tsort(t + 1, t + n + 1);\n\t\tfor (int i = n; i >= 1; i++){\n\t\t\tif (ok(i)){\n\t\t\t\tcout << i;\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\n\treturn 0;\n\n}\n\n", "lang": "GNU C++", "bug_code_uid": "9f6d0e9711eedb9e78f299a3e49f2f28", "src_uid": "086d07bd6f9031df09bd6a6e8fe8f25c", "apr_id": "6966e486348751d25baca3b2287d63d7", "difficulty": 1400, "tags": ["brute force", "implementation", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9874476987447699, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include\n#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)\nusing namespace std;\nint n,k,phi[1000005];\nll ans;\nint main(){\n\tscanf(\"%d%d\",&n,&k);\n\tif (k==1) return puts(\"3\"),0;\n\tFor(i,1,n) phi[i]=i;\n\tFor(i,2,n) if (phi[i]==i)\n\t\tFor(j,1,n/i) phi[i*j]-=phi[i*j]/i;\n\tsort(phi+1,phi+n+1);\n\tFor(i,1,k+2) ans+=phi[i];\n\tprintf(\"%lld\\n\",ans);\n}", "lang": "GNU C++11", "bug_code_uid": "95efb695ca12c57764f6e71019ae5902", "src_uid": "c2f7012082c84d773c2f4b1858c17110", "apr_id": "48b3bc6ed0b8c8376a402a079d2fd09f", "difficulty": 2800, "tags": ["greedy", "math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9160916981971956, "equal_cnt": 20, "replace_cnt": 3, "delete_cnt": 3, "insert_cnt": 13, "fix_ops_cnt": 19, "bug_source_code": "#include\nusing namespace std;\n\n#define MAXN 200010\n#define MOD 998244353\n#define int long long\n\nint mulmod(int a, int b){ // multiplicacao modular\n // multiplicar (a*b) equivale a sum(a * 2^i * b_i), onde (a*2^i) \u00e9 representado\n // na linha do meio, b_i na ultima linha, e o passo de sum na primeira linha\n int ans = 0;\n a %= MOD;\n while(b > 0){\n if(b%2) ans = (ans + a) % MOD;\n a = (a * 2) % MOD;\n b >>= 1;\n }\n return ans % MOD;\n}\n\nint exp(int a, int b){ // recursivo\n\tif(b == 0) return 1;\n\tif(b == 1) return a;\n auto y = exp(mulmod(a, a), b/2);\n\tif(b&1) return mulmod(y, a);\n\treturn y;\n}\n\nint inv(int x){\n return exp(x, MOD - 2);\n}\n\nint fat[MAXN];\nint c(int p, int q){\n int num = fat[p];\n int den = mulmod(fat[p - q], fat[q]);\n return mulmod(num, inv(den)) % MOD;\n}\n\nint32_t main(){\n fat[0] = 1;\n for(int i = 1; i < MAXN; ++i){\n fat[i] = mulmod(i, fat[i - 1]);\n }\n\n if(k > n){\n cout << 0 << endl;\n return 0;\n }\n\n int n, k; cin >> n >> k;\n // suponho que estou analsiando colunas e dps\n // multiplico por 2\n int numActive = n - k;\n // se eu fizer C(n, numActive) vou estar contando combinacoes\n // em que mais q numEmpty colunas podem estar vazias\n // ex: 1111111111\n // para isso, vai ser usado o principio de inclusao e exclusao\n // que vai contar coluna por coluna, compensando confs contadas\n // multiplas vezes\n // dentre as colunas que vao ser usadas, cada passo vai escolher\n // i colunas que nao serao mais utilizadas, a fim de evitar o problema\n // acima\n int sum = 0;\n for(int i = 0; i < numActive; ++i){\n cerr << sum << endl;\n // exatamente i colunas inativas\n int conb = c(numActive, i); // escolhe as colunas que serao inativas\n int confs = exp(numActive - i, n); // distribui n torres em nas colunas ocupadas\n\n int x = mulmod(conb, confs) % MOD;\n if(i%2) sum = ((sum - x) + MOD) % MOD;\n else sum = (sum + x) % MOD;\n }\n\n sum = mulmod(sum, c(n, numActive)); // as confs de escolher as exatas numActive colunas que serao ativas)\n\n int x = 2; if(k == 0) x = 1;\n cout << mulmod(sum, x)<< endl;\n}\n", "lang": "GNU C++17", "bug_code_uid": "904ef1a310b2f309b876b805773cb755", "src_uid": "6c1a9aaa7bdd7de97220b8c6d35740cc", "apr_id": "2c53fe3253809af4e13cd6912f84ceab", "difficulty": 2300, "tags": ["fft", "math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9797101449275363, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \nusing namespace std;\ntypedef long long ll;\nconst int inf = 1e9;\nint r, g, b;\n\nclass Problem{\npublic:\n\tint solve(int r, int g, int b){\n\t\tvector T = {r, g, b};\n\t\tint i = 0;\n\t\twhile(true){\n\t\t\tif(T[0]==0&&T[1]==0&&T[2]==0)break;\n\t\t\tif(T[i%3]>=2)T[i%3]-=2;\n\t\t\telse if(T[i%3])T[i%3]=0;\n\t\t\ti++;\t\t \n\t\t}\n\t\treturn i + 30 - 1;\n\t}\n\tvoid parse_statement();\n};\n\nint main(){\n\tProblem A;\n\tA.parse_statement();\t\n\treturn -1;\n}\n\nvoid Problem::parse_statement(){\n\tcin>>r>>g>>b;\n\tcout<\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\nlong long a[4][4];\nlong long dp[50][4][4];\nlong long main()\n{\n long long f(long long n,long long s,long long e,long long tr);\n for(long long i=1; i<=3; i++)\n {\n for(long long j=1; j<=3; j++)\n {\n cin>>a[i][j];\n }\n }\n long long n;\n cin>>n;\n memset(dp,-1,sizeof(dp));\n long long k=f(n,1,3,2);\n cout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\ntypedef long long int LL;\ntypedef long double LD;\nconst int MAX = 100;\nconst int N = 3e6;\nconst LD PI = 3.14159;\nLL a,b,f,k;\nLL num[N][2];\nint main() {\n#ifdef CDZSC_OFFLINE\n\tfreopen(\"in.txt\", \"r\", stdin);\n\t//freopen(\"out.txt\", \"w\", stdout);\n#endif\n\twhile(scanf(\"%lld%lld%lld%lld\", &a, &b, &f, &k) == 4){\n\t\tmemset(num,-1,sizeof(num));\n\t\tLL x = f;\n\t\tLL y = a + (a - f);\n\t\tLL d = a * k;\n\t\ta *= 2;\n\t\tLL ans = 0;\n\t\tLL len = b;\n\t\tbool flag = true;\n\t\tbool flag1 = true;\n\t\twhile(1){\n\t\t\tif(len >= d)\n\t\t\t\tbreak;\n\t\t\tLL jd = len % a;\n\t\t\tif(flag1){\n\t\t\t\tif(num[jd][0] == -1){\n\t\t\t\t\tnum[jd][0] = len;\n\t\t\t\t\tnum[jd][1] = ans;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tLL x = len - num[jd][0];\n\t\t\t\t\tLL dnum = (ans + 1) - num[jd][1];\n\t\t\t\t\tLL pp = (d - len) / x;\n\t\t\t\t\tans += dnum*pp;\n\t\t\t\t\tlen = len + pp * x;\n\t\t\t\t\tflag1 = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(jd < min(x,y)){\n\t\t\t\tLL len1 = ((len / a) - 1) * a + y;\n\t\t\t\tif(len1 <= len - b){\n\t\t\t\t\tflag = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tlen = len1;\n\t\t\t}\n\t\t\telse if(jd >= y){\n\t\t\t\tlen = (len / a) * a + y; \n\t\t\t}\n\t\t\telse{\n\t\t\t\tlen = (len / a) * a + x;\n\t\t\t}\n\t\t\tlen += b;\n\t\t\tans++;\n\t\t}\n\t\tif(flag)\n\t\t\tprintf(\"%lld\\n\",ans);\n\t\telse\n\t\t\tprintf(\"-1\\n\");\n\t}\n\treturn 0;\n}", "lang": "GNU C++11", "bug_code_uid": "377f2eebfecf2d36b4b7a7b6f273a557", "src_uid": "283aff24320c6518e8518d4b045e1eca", "apr_id": "9f689c0778994265d76dccb195601d0f", "difficulty": 1500, "tags": ["greedy", "math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8437086092715231, "equal_cnt": 20, "replace_cnt": 10, "delete_cnt": 4, "insert_cnt": 5, "fix_ops_cnt": 19, "bug_source_code": "#include\n#include\n\n#define int long long\n\nlong long w[300000],a[300000];\nint X,Y;\nint N,Q;\nstruct tarr{\n\tlong long T[300000];\n\tinline int lowbit(int k){return k&-k;}\n\tvoid modify(int k,long long v){\n\t\twhile (k<=N){\n\t\t\tT[k]+=v;\n\t\t\tk+=lowbit(k);\n\t\t}\n\t}\n\tlong long query(int k){\n\t\tlong long ret=0;\n\t\twhile (k){\n\t\t\tret+=T[k];\n\t\t\tk-=lowbit(k);\n\t\t}\n\t\treturn ret;\n\t}\n}W,WA,iW;\n\nlong long calc(int l,int r){\n\treturn iW.query(r)-iW.query(l-1)-l*(W.query(r)-W.query(l-1));\n}\n/*\nlong long calcdown(int l,int r){\n\tif (l>=r) return 0;\n\tint mdl=(l+r)>>1;\n\treturn calcdown(l,mdl)+calcdown(mdl+1,r)+(W.query(mdl)-W.query(l-1))*(r-mdl);\n}\n*/\nint main(){\n\tscanf(\"%d%d\",&N,&Q);\n\tfor (int i=1;i<=N;i++) scanf(\"%I64d\",&a[i]);\n\tfor (int i=1;i<=N;i++) scanf(\"%I64d\",&w[i]);\n\tfor (int i=1;i<=N;i++){\n\t\tW.modify(i,w[i]);\n\t\tWA.modify(i,w[i]*a[i]);\n\t\tiW.modify(i,i*w[i]);\n\t}\n\tfor (int i=1;i<=Q;i++){\n\t\tscanf(\"%d%d\",&X,&Y);\n\t\tif (X<0){\n\t\t\tX=-X;\n\t\t\tW.modify(X,Y-w[X]);\n\t\t\tWA.modify(X,(Y-w[X])*a[X]);\n\t\t\tiW.modify(X,(Y-w[X])*X);\n\t\t\tw[X]=Y;\n\t\t}\n\t\telse{\n\t\t\tlong long pre=W.query(X-1);\n\t\t\tlong long sumW=W.query(Y)-pre;\n\t\t\tint l=X,r=Y,mdl;\n\t\t\twhile (l>1;\n\t\t\t\tlong long sumpre=W.query(mdl)-pre;\n\t\t\t\tif ((sumpre<<1)\nusing namespace std;\nint Next[10000100];\nlong long str2[60001100];\nlong long str1[60001100];\nint m;\nvoid getnext(int len,int k){\n\tif (k == 1)\n\t{\n\t\tint i = 0, j = -1;\n\t\tNext[0] = -1;\n\t\twhile (i < len){\n\t\t\tif (j == -1 || str1[i] == str1[j]){\n\t\t\t\ti++; j++;\n\t\t\t\tNext[i] = j;\n\t\t\t}\n\t\t\telse\n\t\t\t\tj = Next[j];\n\t\t}\n\t}\n\telse\n\t{\n\t\tint i = 0, j = -1;\n\t\tNext[0] = -1;\n\t\twhile (i < len){\n\t\t\tif (j == -1 || str2[i] == str2[j]){\n\t\t\t\ti++; j++;\n\t\t\t\tNext[i] = j;\n\t\t\t}\n\t\t\telse\n\t\t\t\tj = Next[j];\n\t\t}\n\t}\n}\nint solve(int k)\n{\n\tint f = -1;\n\tgetnext(60000000, k);\n\tfor (int i = 1; i <= 60000000; ++i)\n\t{\n\t\tif (i % (i - Next[i]) == 0 && Next[i] != 0)\n\t\t{\n\t\t\tf = (i - Next[i]);\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn f;\n}\nint main()\n{\n\twhile (cin >> m)\n\t{\n\t\tint h1, a1, x1, y1, h2, a2, x2, y2;\n\t\tint f1, f2;\n\t\tlong long k1 = -1, k2 = -1;\n\t\tcin >> h1 >> a1 >> x1 >> y1 >> h2 >> a2 >> x2 >> y2;\n\t\tstr1[0] = h1%m;\n\t\tfor (int i = 1; i <= 60000000; ++i)\n\t\t{\n\t\t\tstr1[i] = (str1[i - 1] * x1 + y1) % m;\n\t\t\tif (k1 == -1 && str1[i] == a1)\n\t\t\t\tk1 = i;\n\t\t}\n\t\tf1 = solve(1);\n\t\tstr2[0] = h2%m;\n\t\tfor (int i = 1; i <= 60000000; ++i)\n\t\t{\n\t\t\tstr2[i] = (str2[i - 1] * x2 + y2) % m;\n\t\t\tif (k2 == -1 && str2[i] == a2)\n\t\t\t\tk2 = i;\n\t\t}\n\t\tf2 = solve(2);\n\t\tif (k1 == -1 || k2 == -1)\n\t\t\tcout << \"-1\" << endl;\n\t\telse\n\t\t{\n\t\t\tint f = -1;\n\t\t\tif (f1 == -1 || f2 == -1)\n\t\t\t{\n\t\t\t\tfor (int i = 0; i <= 60000000; ++i)\n\t\t\t\t{\n\t\t\t\t\tif (str1[i] == a1&&str2[i] == a2)\n\t\t\t\t\t{\n\t\t\t\t\t\tf = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcout << f << endl;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tfor (int i = 0; i < 60000000;++i)\n\t\t\t\t{\n\t\t\t\t\tif (k1 < k2)\n\t\t\t\t\t\tk1 += f1;\n\t\t\t\t\telse if (k1 == k2)\n\t\t\t\t\t\tbreak;\n\t\t\t\t\telse\n\t\t\t\t\t\tk2 += f2;\n\t\t\t\t\tif (k1 < 0 || k2 < 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tk1 = -1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (k1 == k2)\n\t\t\t\t\tcout << k1 << endl;\n\t\t\t\telse\n\t\t\t\t\tcout << \"-1\" << endl;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "51f401b6193301cf12e230b1656476ed", "src_uid": "7225266f663699ff7e16b726cadfe9ee", "apr_id": "8adfccfa0aee741666936be40035f456", "difficulty": 2200, "tags": ["greedy", "math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8118279569892473, "equal_cnt": 24, "replace_cnt": 8, "delete_cnt": 12, "insert_cnt": 4, "fix_ops_cnt": 24, "bug_source_code": "#include\nusing namespace std;\nint main(){\nint a,b;\nstring s;\ncin>>a>>b>>s;\nwhile(b--){for(int i=0;i=s.size();i++){\nif(s[i]=='B'&&s[i+1]=='G'){\nswap(s[i],s[i+1]);\n}}}cout<\n#include\nusing namespace std;\nint main()\n{\n // freopen(\"test.inp\",\"r\",stdin);\n // freopen(\"test.out\",\"w\",stdout);\n\tint a,b,len;\n\tchar c;\n\tlong l,r;\n\tcin>>a>>b>>l>>r;\n\tstring s,newstr,suffix;\n\tfor(c = 'a'; c < 'a' + a;c++)\n\t s += c;\n\tif(r >= 2*(a+b))\n\t\tif(r == l)\n\t\t{\n\t\t\tr = 2*(a+b);\n\t\t\tl = r;\n\t\t}\n\t\n\tlen = s.length();\n\tfor(int i = len; i <= r;i += a+b)\n\t{\n\t\tfor(int j = 0; j < b;j++) //turn of Mister B \n\t\t\ts += s[len - 1];\n\t\tlen = s.length();\n\t\tif(len >= r)\n\t\t\tcontinue;\n\t\tc = 'a';\n\t\tsuffix.append(s,len-a,a);\n\t\tfor(int k = 0; k < a;k++) //turn of Computer\n\t\t{\n\t\t\twhile(suffix.find(c)!=-1) c++;\n\t\t\ts += c;\n\t\t\tc++;\n\t\t}\n\t\t\t\n\t}\n\tfor(int i = l-1; i < r;i++)\n\t\tif(newstr.find(s[i]) == -1)\n\t\t\tnewstr += s[i];\n\tcout<\nusing namespace std;\nint a[6][4];\nint b[6];\nint cl[6][4];//heng 0 shu 1\n//0+2=quan heng= quan 0 \n// 1+5=0,2 heng + 3 4 shu\n// 3+4=quan shu \nint main() {\n rep(i,0,6) \n rep(j,0,4) cl[i][j] = -1*(i+1);\n int tag=0;\n rep(i,0,6) {\n rep(j,0,4) \n scanf(\"%d\", &a[i][j]);\n if(a[i][0]==a[i][1]) {\n cl[i][0]=a[i][0];\n if(a[i][2]==a[i][3]) cl[i][1]=a[i][2];\n if(cl[i][0]==cl[i][1]) b[i]=1;\n }\n else if(a[i][0]==a[i][2]) {\n cl[i][2]=a[i][0];\n if(a[i][1]==a[i][3]) cl[i][3]=a[i][1];\n }\n else { if(tag==0) tag=1; }\n }\n int flag=0, cnt=0;\n rep(i,0,6) if(b[i]) cnt++;\n if(tag) printf(\"NO\\n\");\n else if((!cnt)||(cnt&1)||(cnt==4)) printf(\"NO\\n\");\n else if(cnt==6) printf(\"NO\\n\");\n else {\n if(b[0]&&b[2]) {\n if(cl[3][0]==cl[1][1]&&cl[1][0]==cl[4][1]&&\n cl[4][0]==cl[5][1]&&cl[5][0]==cl[3][1]) flag=1;\n else if(cl[3][0]==cl[5][1]&&cl[5][0]==cl[4][1]&&\n cl[4][0]==cl[1][1]&&cl[1][0]==cl[3][1]) flag=1;\n }\n else if(b[1]&&b[5]) {\n if(cl[0][1]==cl[4][3]&&cl[4][2]==cl[2][1]&&\n cl[2][0]==cl[3][2]&&cl[3][3]==cl[0][0]) flag=1;\n else if(cl[0][1]==cl[3][2]&&cl[3][3]==cl[2][1]&&\n cl[2][0]==cl[4][3]&&cl[4][2]==cl[0][0]) flag=1;\n }\n else if(b[3]&&b[4]) {\n if(cl[0][2]==cl[1][3]&&cl[1][2]==cl[2][3]&&\n cl[2][2]==cl[5][2]&&cl[5][3]==cl[0][3]) flag=1;\n if(cl[0][3]==cl[1][2]&&cl[1][3]==cl[2][2]&&\n cl[2][3]==cl[5][3]&&cl[5][2]==cl[0][2]) flag=1;\n }\n if(!flag) printf(\"NO\\n\");\n else printf(\"YES\\n\");\n }\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "9480deafae0befe325e0cdb62c2b5865", "src_uid": "881a820aa8184d9553278a0002a3b7c4", "apr_id": "a50dd41cc602a341bc02aaf5f3740a38", "difficulty": 1500, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.8414755732801595, "equal_cnt": 23, "replace_cnt": 7, "delete_cnt": 7, "insert_cnt": 9, "fix_ops_cnt": 23, "bug_source_code": "#include\nusing namespace std;\nint main()\n{ int n,i,s,t,p,z=0;\n cin>>n;\n int a[n];\n for(i=0;i>a[i];\n s=accumulate(a,a+n,0);\n if(n%2==0)\n t=n/2;\n else\n t=n/2+1;\n s=s%n;\n if(s>=t)\n cout<=t)\n {\n cout<\nusing namespace std;\ntypedef long double ll;\nmapmp;\n\nint main(){\n\tios::sync_with_stdio(false);\n cin.tie(NULL);\n\tll i,j,k,nb,x,y,l,r;\n\tcin>>l>>r>>x>>y>>k;\n\tfor(i=l;i<=r;i++)mp[i/k]=55;\n\tfor(i=x;i<=y;i++)if(mp[i]==55){\n\t\tcout<<\"YES\";return 0;\n\t}\n\tcout<<\"NO\";\n}", "lang": "GNU C++14", "bug_code_uid": "2670acf6b274db5cd1d8deb88efcdd36", "src_uid": "1110d3671e9f77fd8d66dca6e74d2048", "apr_id": "5063b2659b6eec3fb2ccbec068d36ef5", "difficulty": 1200, "tags": ["brute force", "two pointers"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.839836094779975, "equal_cnt": 36, "replace_cnt": 27, "delete_cnt": 6, "insert_cnt": 2, "fix_ops_cnt": 35, "bug_source_code": "#include\n#define ll long long\n#define ull unsigned long long\n#define uint ungigned\n#define db double\n#define pii pair\n#define pll pair\n#define pli pair\n#define vi vector\n#define vpi vector\n#define IT iterator\n \n#define PB push_back\n#define MK make_pair\n#define LB lower_bound\n#define UB upper_bound\n#define y1 wzpakking\n#define fi first\n#define se second\n#define BG begin\n#define ED end\n \n#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)\n#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)\n#define UPD(x,y) (((x)+=(y))>=mo?(x)-=mo:233)%s\n#define CLR(a,v) memset(a,v,sizeof(a))\n#define CPY(a,b) memcpy(a,b,sizeof(a))\n#define sqr(x) (1ll*x*x)\n \n#define LS3 k*2,l,mid\n#define RS3 k*2+1,mid+1,r\n#define LS5 k*2,l,mid,x,y\n#define RS5 k*2+1,mid+1,r,x,y\n#define GET pushdown(k);int mid=(l+r)/2\n#define INF (1ll<<60)\nusing namespace std;\n\nvoid move(vector p){\n\tans.push_back(p);\n\tint sz=p.size()-1;\n\tRep(i,sz-2,0);{\n\t\tswap(pos[p[i]],pos[p[sz-1]]);\n\t\tpii x;\n\t\tx=pos[p[i]];\n\t\ta[x.fi][x.se]=p[i];\n\t\tx=pos[p[sz-1]];\n\t\ta[x.fi][s.se]=p[sz-1];\n\t}\n}\nvoid roL(int x,int y){\n\tmove(vector{\n\t\ta[x][y],a[x+1][y],\n\t\ta[x+1][y+1],a[x][y+1]\n\t});\n}\nvoid roR(int x,int y){\n\tmove(vector{\n\t\ta[x][y],a[x][y+1],\n\t\ta[x+1][y+1],a[x+1][y]\n\t});\n}\nvoid goL(int v){\n\tint x=pos[x].fi,y=pos[x].se;\n\tmove(vector{\n\t\ta[x][y],a[x][y-1],\n\t\ta[(x==n?x+1:x-1)][y-1],a[(x==n?x+1:x-1)][y]\n\t});\n}\nvoid goR(int v){\n\tint x=pos[x].fi,y=pos[x].se;\n\tmove(vector{\n\t\ta[x][y],a[x][y+1],\n\t\ta[(x!=n?x+1:x-1)][y+1],a[(x!=n?x+1:x-1)][y]\n\t});\n}\nvoid goU(int v){\n\tint x=pos[x].fi,y=pos[x].se;\n\tmove(vector{\n\t\ta[x][y],a[x-1][y],\n\t\ta[x-1][(y!=m?y-1:y+1)],a[x][(y!=m?y-1:y+1)];\n\t});\n}\nvoid goD(int v){\n\tint x=pos[x].fi,y=pos[x].se;\n\tmove(vector{\n\t\ta[x][y],a[x+1][y],\n\t\ta[x+1][(y!=m?y-1:y+1)],a[x][(y!=m?y-1:y+1)];\n\t});\n}\n\nint main(){\n\tscanf(\"%d%d\",&n,&m);\n\tFor(i,1,n*m) per[i]=i;\n\trandom_shuffle(per+1,per+n*m+1);\n\tFor(i,1,n){\n\t\tscanf(\"%d\",&a[i][j]);\n\t\tpos[a[i][j]]=pii(i,j);\n\t}\n\tFor(i,1,n-2){\n\t\tFor(j,1,m-1){\n\t\t\tint id=(i-1)*m+j;\n\t\t\tfor (;pos[x].se>j;) goL(x);\n\t\t\tfor (;pos[x].sei;) goU(x);\n\t\t}\n\t\tint id=i*m;\n\t\tif (pos[x]==pii(i,m)) continue;\n\t\tif (pos[x]==pii(i+1,m-1)) roL(i+1,m-1);\n\t\troR(i,m-1);\n\t\tfor (;pos[x].sei+1;goU(x));\n\t\troL(i,m-1);\n\t}\n\tFor(j,1,m-2){\n\t\tint x=(n-2)*m+j;\n\t\tfor (;pos[x].se>j;) goL(x);\n\t\tfor (;pos[x].se\nusing namespace std;\nint main()\n{\n int n,m;\n cin>>n>>m;\n vectora;\n vectorb;\n for(int i=0;i>a[i];\n }\n for(int i=0;i>b[i];\n }\n for(int i=0;i\n#include\n#include\n#include\nusing namespace std;\nint main()\n{\n long long n;\n cin>>n;\n long long max_sum=(n*(n+1))/2;\n vector dp(max_sum+1,false);\n dp[0]=true;\n int j,i;\n for(i=0;i<=n;i++)\n for(j=max_sum-i;j>=0;--j){\n dp[j+i]=dp[j+i]|dp[j];\n }\n int min1,max1,ans;\n for(int k=0;k<=max_sum/2;k++){\n if(dp[max_sum/2-k]==true){\n min1=max_sum/2;\n max1=max_sum-min1;\n ans=abs(max1-min1);\n }\n }\n cout<\n\nusing namespace std;\n\nint main()\n\n{\n int x,y ;\n while(cin>>x>>y)\n {\n int one{0},two{12},three{0},temp ;\n\n temp=abs(x-y) ;\n\n if(temp%2!=0)\n {\n two = 0 ;\n }else {\n\n two=temp/2 ;\n }\n while(one + two + three != 6)\n {\n for(int i{1};i<7;i++)\n {\n if(abs(x-i)abs(y-i)){\n three += 1;\n }\n }\n }\n cout<\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#define endl \"\\n\"\n\t#define ll long long int\n\t#define ld long double\n\t#define vi vector\n\t#define vll vector\n\t#define vvi vector < vi >\n\t#define pii pair\n\t#define pll pair\n\t#define mod 1000000007\n\t#define inf 1000000000000000001;\n\t#define all(c) c.begin(),c.end()\n\t#define mp(x,y) make_pair(x,y)\n\t#define mem(a,val) memset(a,val,sizeof(a))\n\t#define eb emplace_back\n\t#define pb push_back\n\t#define f first\n\t#define s second\n\tusing namespace std;\n\tll power[100000001];\n\tvoid pwr()\n\t{\n\t\tll i,ans = 1;\n\t\tpower[0]= 1;\n\t\tfor(i=1;i<=100000000;i++)\n\t\t{\n\t\t\tans *= 2;\n\t\t\tpower[i] =ans; \n\t\t}\n\t}\n\tint main()\n\t{\n\t\tstd::ios::sync_with_stdio(false);\n\t\tint T;\n\t\t//cin>>T;\n\t\t// cin.ignore(); must be there when using getline(cin, s)\n\t\tT = 1;\n\t\tpwr();\n\t\twhile(T--)\n\t\t{\n\t\t\tll n,m;\n\t\t\tcin>>n>>m;\n\t\t\tcout<\n#include \n#include \n#define fs first\n#define se second\n#define mp make_pair\n#define pb push_back\n#define precise(n,k) fixed<, rb_tree_tag, tree_order_statistics_node_update> OST;\n//typedef long long ll;\n#define ll int\n#define mod 1000000007\ntypedef long double lf;\nll n,T,dp[32770][4][230];\npair arr[20];\nll solve(ll mask,ll g,ll tim)\n{\n\tif(tim>T)\n\treturn 0;\n\tif(tim == T)\n\treturn 1;\n\tif(dp[mask][g][tim] != -1)\n\treturn dp[mask][g][tim];\n\tll ans=0;\n\tfor(ll i=1;i<=n;i++)\n\t{\n\t\tans%=mod;\n\t\tif(arr[i].se != g && (mask&(1<>n>>T;\n\tfor(ll i=1;i<=n;i++)\n\tcin>>arr[i].fs>>arr[i].se;\n\tmemset(dp,-1,sizeof(dp));\n\tcout<\n#define int long long\nusing namespace std;\n \nconst int MAXN=2e3+5;\nconst int mod=998244353;\n\nint n,m,k,dp[MAXN][MAXN];\n\nsigned main()\n{\n cin>>n>>m>>k;\n for(int i=0;i<=n;i++) dp[i][0]=m;\n for(int i=2;i<=n;i++) \n {\n \tfor(int j=1;j<=k;i++)\n \t{\n \t\tdp[i][j]=(dp[i-1][j-1]*(m-1))%mod;\n \t\tdp[i][j]=(dp[i][j]+dp[i-1][j])%mod;\n\t\t}\n\t}\n\tcout<\nusing namespace std;\ntypedef long long ll;\nll gcd(ll a,ll b, ll &x,ll &y)\n{\n if(b==0)\n {\n x=1;y=0;\n return a;\n }\n ll x1,y1;\n ll d=gcd(b,a%b,x1,y1);\n x=y1;\n y=x1-y1*(a/b);\n return d;\n}\nbool find(ll a, ll b,ll c,ll &x0, ll&y0,ll &g)\n{\n g= gcd(a,b,x0,y0); \n if(c%g)\n return false;\n x0*=c/g;\n y0*=c/g;\n if(a<0)\n x0=-x0;\n if(b<0)\n y0=-y0;\n return true;\n}\nint main()\n{\n ll a,b,c,x,y,g;\n //cin>>a>>b>>c;\n if(find(a,b,c,x,y,g))\n {\n cout<=0)\n break;\n x=x+b/g;\n y=y-a/g;\n }\n }\n if(y<0)\n {\n while(1)\n {\n if(y>=0)\n break;\n x=x-b/g;\n y=y+a/g;\n }\n }\n if(x<0 || y<0)\n cout<<\"No\\n\";\n else\n cout<<\"Yes\\n\";\n }\n else\n cout<<\"No\\n\";\n}\n\n\n", "lang": "GNU C++14", "bug_code_uid": "4a727a26b98a9c8fe6912ace423e9446", "src_uid": "e66ecb0021a34042885442b336f3d911", "apr_id": "fd3d39f0c2767a79a97e35819222f8b9", "difficulty": 1100, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.4309859154929577, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "#include \n#include \nusing namespace std;\nint main(){\nint sum = 0,maxn = 0, arr[4];\nfor(int i = 0 ; i < 4 ; i++){\ncin>>arr[i];\nmaxn = max(maxn,arr[i]);}\nbool *barr = new bool[maxn];\nfor(int i = 0 ; i < maxn ; i++)\nbarr[i] = false;\nfor(int i = 0 ; i < 4 ; i++){\nbarr[arr[i]] = true;\n}\nfor(int i = 0 ; i < maxn ; i++)\nif(barr[i])sum++;\ncout<<3-sum;\nreturn 0;}", "lang": "MS C++", "bug_code_uid": "324af1624a540f3e75bea0b872420a47", "src_uid": "38c4864937e57b35d3cce272f655e20f", "apr_id": "aa919e5e9f4390dd15ef6afcf3373fd5", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8941666666666667, "equal_cnt": 11, "replace_cnt": 5, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "#include \nusing namespace std;\nint n,k,m,pw[1005],dp[1005][1005][105];\nint dfs(int node,int ok,int num)\n{\n int a=0,b=0,res=0;\n if(node==n+1) return 0;\n if(~dp[node][ok][num]) return dp[node][ok][num];\n if(node==n)\n {\n for(int i=1;i<=9;i++)\n {\n if(ok==1)\n {\n //printf(\"CEVAP:%d\\n\",num);\n }\n a=dfs(node+1,((num+i*pw[node-1])%k==0?ok+1:ok),(num+i*pw[node-1])%k)+(ok>0 || ((num+i*pw[node-1])%k==0)?1:0);\n //printf(\"A:%d\\n\",a);\n res=(res+a)%m;\n }\n }\n else\n {\n for(int i=0;i<=9;i++)\n {\n a=dfs(node+1,((((num+i*pw[node-1])%k==0) && ((num+i*pw[node-1])!=0))?ok+1:ok),(num+i*pw[node-1])%k)/*+((ok>0 || (((num+i*pw[node-1])%k==0) && ((num+i*pw[node-1])!=0)))?1:0)*/;\n //printf(\"B:%d\\n\",b);\n res=(res+a)%m;\n }\n }\n return dp[node][ok][num]=res%m;\n}\nvoid read()\n{\n scanf(\"%d %d %d\",&n,&k,&m);\n}\nvoid solve()\n{\n int ans=dfs(1,0,0);\n printf(\"%d\",ans);\n}\nvoid init()\n{\n pw[0]=1;\n for(int i=1;i<=1000;i++)\n {\n pw[i]=(pw[i-1]*10)%k;\n }\n}\nint main()\n{\n memset(dp,-1,sizeof(dp));\n read();\n init();\n solve();\n\n\n\n\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "55e47098f29c30b5a45554da2f8a9bd8", "src_uid": "656bf8df1e79499aa2ab2c28712851f0", "apr_id": "3a8cf478713a45e839a05099a659813d", "difficulty": 2200, "tags": ["dp", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7948717948717948, "equal_cnt": 10, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 9, "bug_source_code": "#include\n#include\nusing namespace std;\n\n\nint main()\n{\n\n char a[101];\n string s = \"\";\n int n;\n cin >> n;\n for(int i = 0; i < n; ++i){\n cin >> a[i];\n s += a[i];\n }\n while(1) {\n int x = s.find(\"RU\");\n int y = s.find(\"UR\");\n if(x == -1 && y == -1) break;\n if(x < y) {\n s.replace(x, 2, \"D\");\n continue;\n\n } else {\n s.replace(y, 2, \"D\");\n continue;\n }\n }\n cout<< s.length();\n\n\n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "e8f1c215c96dc1f0306530084524a392", "src_uid": "986ae418ce82435badadb0bd5588f45b", "apr_id": "a1926967d094c4d7840991f3443c35ee", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8343898573692552, "equal_cnt": 14, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 13, "bug_source_code": "#include \nusing namespace std;\nusing ll = long long;\nusing ld = long double;\n\nconst int maxn = 3005;\nvector pr[maxn];\nvector w;\nvector c;\nint k;\nll ans = 0;\n\nvoid apply(vector& d, int w, ll c) {\n for (int i = (int) d.size() - w - 1; i >= 0; --i) {\n d[i + w] = max(d[i + w], d[i] + c);\n }\n}\n\nvoid rec(int l, int r, vector d) {\n if (l + 1 == r) {\n for (int i = 0; i <= min(k, w[l]); ++i) {\n ans = max(ans, d[k - i] + pr[l][i]);\n }\n return;\n }\n int c = (l + r) / 2;\n vector d2 = d;\n for (int i = l; i < c; ++i) {\n apply(d2, w[i], ::c[i]);\n }\n rec(c, r, d2);\n d2 = d;\n for (int i = c; i < r; ++i) {\n apply(d2, w[i], ::c[i]);\n }\n rec(l, c, d2);\n}\n\nsigned main() {\n#ifdef LOCAL\n assert(freopen(\"c.in\", \"r\", stdin));\n#endif\n int n;\n cin >> n >> k;\n w.resize(n);\n c.resize(n);\n for (int i = 0; i < n; ++i) {\n cin >> w[i];\n pr[i].resize(w[i] + 1);\n for (int j = 0; j < w[i]; ++j) {\n int x;\n cin >> x;\n c[i] += x;\n pr[i][j + 1] = pr[i][j] + x;\n }\n }\n vector d(k + 1);\n rec(0, n, d);\n cout << ans << '\\n';\n}\n", "lang": "GNU C++17", "bug_code_uid": "06fce1591ade5e20c58abbae59a49741", "src_uid": "9e9d4f58ebd8293025ab8004aeb8d343", "apr_id": "098d0fe7a14899e692c36c5364fc36ee", "difficulty": 2800, "tags": ["divide and conquer", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9355870260392873, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "#include\nusing namespace std;\n#define REP(i,j,k) for(register int (i)=(j);(i)<(k);++(i))\n\nstruct pfx{int s[3];};\nint operator-(pfx x,pfx y){\n\tint ret=0;\n\tREP(i,0,3)ret+=max(0LL,x.s[i]-y.s[i]);\n\treturn ret;\n}\n\nconst int maxn=80;\nconst int inf=1ll<<50;\nint n,dp[maxn][maxn][maxn][3];\nchar s[maxn],t[maxn];\npfx vkx[3][maxn];\n\ninline void MIN(int&x,int y){x=min(x,y);}\n\nmain(){\n\tcin.tie(0),cout.tie(0),ios_base::sync_with_stdio(false);\n\tcin>>n;\n\tpfx tt;tt.s[0]=tt.s[1]=tt.s[2]=0;\n\tREP(i,0,n){\n\t\tchar c;int x;\n\t\tcin>>c,x=(c=='V'?0:c=='K'?1:2);\n\t\t++tt.s[x],vkx[x][tt.s[x]]=tt;\n\t}\n\tREP(v,0,n+1)REP(k,0,n+1)REP(x,0,n+1)REP(i,0,3)dp[v][k][x][i]=inf;\n\tdp[0][0][0][2]=0;\n\tREP(v,0,n)REP(k,0,n)REP(x,0,n){\n\t\tif(v+k+x>=n)continue;\n\t\tREP(i,0,3)REP(j,0,3)if(!(i==0&&j==1)){\n\t\t\tpfx nn;nn.s[0]=v+(j==0),nn.s[1]=k+(j==1),nn.s[2]=x+(j==2);\n\t\t\tif(nn.s[0]>tt.s[0]||nn.s[1]>tt.s[1]||nn.s[2]>tt.s[2])continue;\n\t\t\tMIN(dp[nn.s[0]][nn.s[1]][nn.s[2]][j],dp[v][k][x][i]+(nn-vkx[j][nn.s[j]]));\n\t\t}\n\t}\n\tint mn=inf;\n\tREP(i,0,3)mn=min(mn,dp[tt.s[0]][tt.s[1]][tt.s[2]][i]);\n\tcout<\n#include \n#include \n#include \nusing namespace std; // int k=arr[i]*(abs(i-x)+i)*2+(x*arr[i]*2);\nint main(){\n int floors;\n cin >>floors;\n std::vector arr(floors);\n for(int i=0 ; i>arr[i];\n //cout<<\"x = \"< arry;\n for(int x=1 ; x\n# include \n# include \n# include \n# include \n# include \n# include \n# include \n# include \n# include \n# include \n# include \n# include \n# include \n# include \n# include \n# include \n# include \n# include \n# include \n\n# define mp make_pair\n# define fi first\n# define se second\n\nusing namespace std;\n\ntypedef long long ll;\n\nint main()\n{\n cin.tie(NULL);\n ios_base::sync_with_stdio(false);\n ll n,r1=0,r2=0;\n cin>>n;\n for(ll i=0;i>h;\n if (h==100)\n r1+=h;\n if (h==200)\n r2+=h;\n\n }\n if (r1%r2==0&&r2%r1==0)\n cout<<\"YES\";\n else\n cout<<\"NO\";\n return 0;\n}\n", "lang": "GNU C++0x", "bug_code_uid": "bd6f51a6d1945ba3a53c2359e9c0630f", "src_uid": "9679acef82356004e47b1118f8fc836a", "apr_id": "71dd1809731e3ce05c41981f76c8bced", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8475609756097561, "equal_cnt": 24, "replace_cnt": 13, "delete_cnt": 1, "insert_cnt": 9, "fix_ops_cnt": 23, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#define pb push_back\n#define mp make_pair\n#define fi first\n#define se second\n#define LL long long\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)\nusing namespace std;\ntypedef pair pa;\nvoid getint(int &v){\n char ch,fu=0;\n for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());\n if(ch=='-') fu=1, ch=getchar();\n for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';\n if(fu) v=-v;\n}\nLL f[30][300010],ans,fac[300010],inv[300010];\nint n,k,MO,s,a[55],S[1000010];\nLL pw(LL x,int y){\n\tLL t=1;\n\tfor (;y;y>>=1){\n\t\tif (y&1) t=t*x%MO;\n\t\tx=x*x%MO;\n\t}\n\treturn t;\n}\nint main(){\n\tscanf(\"%d%d%d\",&n,&k,&MO);\n\tif (n%2==0) return cout<>=1;\n\t}\n\tf[0][(1<>j)&1) S[i]+=a[j+1];\n\tFOR(i,0,k-1)\n\t\tFOR(j,0,(1<=0;k=(k==0)?-1:(k-1)&j){\n\t\t\t\t\t(f[i+1][j^k]+=f[i][j]*inv[S[k]])%=MO;\n\t\t\t\t}\n\t\t\t}\n\tans=(pw(k,n)-f[k][0]*fac[n])%MO;\n\tcout<<(ans+MO)%MO<\nusing namespace std;\nint main()\n{\n int n,m,i;\n int cnt=0;\n if(n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n#define DB(x) { cerr << #x << \": \" << x << \" \"; }\n#define forn(i, n) for (int i = 0; i < (int)(n); ++i)\n#define sqr(x) ((x)*(x))\ntypedef long double ld;\ntypedef long long ll;\ntypedef vector vi;\ntypedef pair pii;\nconst ld PI = acos(-1.0);\n\nbool solve(ll ax, ll ay, ll bx, ll by, ll cx, ll cy) {\n ll val1 = (bx - ax) * cx + (by - ay) * cy;\n ll val2 = cx*cx + cy*cy;\n\n if (val2 == 0) {\n if (ax == bx && ay == by) { cout << \"YES\" << endl; return 1; }\n return 0;\n }\n\n if (val1 % val2 != 0) { return 0; }\n\n ll t1 = val1 / val2;\n \n ll val3 = (bx - ax) - t1 * cx;\n ll val4 = cy;\n if (val3 == 0 || val3 % val4 == 0) { return 1; }\n return 0;\n}\n\nint main() {\n //freopen(\"in\", \"r\", stdin);\n //freopen(\"out\", \"w\", stdout);\n //ios_base::sync_with_stdio(0);\n\n ll ax, ay, bx, by, cx, cy;\n cin >> ax >> ay >> bx >> by >> cx >> cy;\n\n if (solve(ax, ay, bx, by, cx, cy)) { cout << \"YES\" << endl; return 0; }\n if (solve(ax, ay, -bx, -by, cx, cy)) { cout << \"YES\" << endl; return 0; }\n/bin/bash: \u0416: command not found\n cout << \"NO\" << endl;\n\n return 0;\n}\n\n", "lang": "GNU C++", "bug_code_uid": "3d1a08fc25dee2c8bd16a6d1d420473e", "src_uid": "cc8a8af1ba2b19bf081e379139542883", "apr_id": "b0b76d28944bc3915338820484475483", "difficulty": 2000, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.505654281098546, "equal_cnt": 14, "replace_cnt": 13, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 14, "bug_source_code": "#include\nusing namespace std;\nint main(){\n int n,m,c=0,d,cnt=0,b,x,y,z;\n cin>>n>>m;\n int a[m];\n for(int i=0;i>a[i];\n }\n vectorv;\n d=n+1;\n for(int i=0;i0&&a[i]==1){\n x=a[i-1]-a[i];\n while(x--){\n v.push_back(a[i]);\n }\n break;\n }\n else if(i==0&&a[i]==1){\n y=d-1;\n while(y--){\n v.push_back(a[i]);\n }\n break;\n }\n else{\n z=a[i-1]-a[i];\n while(z--){\n v.push_back(a[i]);\n }\n\n }\n }\n for(int i=n-1;i>=0;i--){\n cout<\n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nint main()\n{\n\t//freopen(\"input.txt\", \"r\", stdin);\n\t//freopen(\"output.txt\", \"w\", stdout);\n\t\n\tint n, m;\n\n\tcin >> n >> m;\n\n\tvectorx(n), b(n);\n\n\tfor (int i = 0; i < n; ++i) {\n\t\tcin >> x[i];\n\t}\n\n\tfor (int i = 0; i < m; ++i) {\n\t\tcin >> b[i];\n\t}\n\n\tfor (int i = 0; i < n; ++i) {\n\t\tfor (int j = 0; j < m; ++j) {\n\t\t\tif (x[i] == b[j])\n\t\t\t{\n\t\t\t\tcout << x[i] << ' ';\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}", "lang": "MS C++ 2017", "bug_code_uid": "97bc9f335391cf8565bfa643a5bf442d", "src_uid": "f9044a4b4c3a0c2751217d9b31cd0c72", "apr_id": "e2783eb4d8ad7f090720a32e088ca83d", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.0620927558451514, "equal_cnt": 14, "replace_cnt": 12, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 15, "bug_source_code": "#include \nusing namespace std;\nvector>vi(11);\nint c[11] ,t[11];\nvectorex;\nint main() {\n\tint n ;cin>>n;\n\tfor(int i =0 ;i < n; i++){\n\t\tstring s;cin>>s;\n\t\tcin>>c[i]>>t[i];\n\t\tfor(int j = 0; j< 4 ;j++){\n\t\t\tint x = (int)s[j] - '0';\n\t\t\tvi[i].push_back(x);\n\t\t}\n\t}\n\tif(n==1&&c[0]==0&&t[0]==0)return cout<<\"Need more data\",0;\n\tvectorfi;\n\tfor(int i = 0 ;i <= 9 ;i++)\n\t\tex.push_back(i);\n\tdo{\n\t\tvectorcurr;\n\t\tfor(int i = 0; i < 4 ; i++)\n\t\t\tcurr.push_back(ex[i]);\n\t\tbool ok = true;\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tint cows = c[i];\n\t\t\tbool up[4] = {false};\n\t\t\tfor(int j = 0; j < 4 ;j++){\n\t\t\t\tif(curr[j]==vi[i][j]){\n\t\t\t\t\tcows--;up[j] =true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(cows!=0){\n\t\t\t\tok = false;break;\n\t\t\t}\n\t\t\tcows = t[i];\n\t\t\tif(cows==0)continue;\n\t\t\tfor(int j = 0 ;j <4 ;j++){\n\t\t\t\tfor(int k = 0 ; k < 4 ;k++){\n\t\t\t\t\tif(k==j)continue;\n\t\t\t\t\tif(!up[k]&&curr[k]==vi[i][j]){\n\t\t\t\t\t\tcows--;up[k] = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(cows!=0){\n\t\t\t\tok = false;break;\n\t\t\t}\n\t\t}\n\t\tif(ok){\n\t\t\tbool found = false;\n\t\t\tstring s = \"\";\n\t\t\tfor(int i =0 ; i < 4 ; i++){\n\t\t\t\ts+=(char)(curr[i] + '0');\n\t\t\t}\n\t\t\tfor(int i= 0 ;i < fi.size() ; i++){\n\t\t\t\tif(s==fi[i]){\n\t\t\t\t\tfound =true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(!found){\n\t\t\t\tfi.push_back(s);\n\t\t\t}\n\t\t}\n\t}while(next_permutation(ex.begin() , ex.end()));\n\tif(fi.size()==1)cout<\nusing namespace std;\ntypedef signed long long ll;\n\n#undef _P\n#define _P(...) (void)printf(__VA_ARGS__)\n#define FOR(x,to) for(x=0;x>N>>M;\n \n for(x=2;x<=2000;x++) dp[x][0]=dp2[x][0]=dp3[x][0]=1;\n for(y=1;y<=2000;y++) {\n ll tot=0;\n for(x=2;x<=2000;x++) {\n tot+=dp[x][y-1];\n dp[x][y]=(dp[x-1][y]+tot)%mo;\n dp2[x][y]=(dp[x][y]+mo-dp[x][y-1])%mo;\n dp3[x][y]=(dp3[x][y-1]+dp2[x][y])%mo;\n }\n }\n \n int y1,y2,w;\n ll ret=0;\n FOR(y1,N) for(y2=y1;y2\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\ntypedef long long ll;\n#define pii pair\n#define mp make_pair\n\nll read() {\n int f = 1;\n ll res = 0;\n char ch;\n do {\n ch = getchar();\n if (ch == '-') f = -f;\n } while (ch < '0' || ch > '9');\n do {\n res = res * 10 + ch - '0';\n ch = getchar();\n } while (ch >= '0' && ch <= '9');\n return f == 1 ? res : -res;\n}\n\nvoid fast_io() {\n ios_base::sync_with_stdio(0);\n cin.tie(0);\n cout.tie(0);\n}\n\nconst int N = 100010;\nconst int mod = 1000000007;\nconst ll INF = 1e18;\nint n,m,q;\nint A[N], B[N];\nchar str[N];\n\nint head[N*2], to[N * 2], nxt[N * 2], tot;\nvoid addEdge(int u, int v) {\n tot++;\n nxt[tot] = head[u];\n to[tot] = v;\n head[u] = tot;\n}\n\ntemplate \nT mmax(T a, T b) {\n return a < b ? b: a;\n}\n\ntemplate \nT mmin(T a, T b) {\n return a < b? a: b;\n}\n\nint countOne(int set) {\n int res = 0;\n while (set) {\n res++;\n set &= set - 1;\n }\n return res;\n}\n\nbool contain(int set, int i) {\n return (set & (1 << i)) > 0;\n}\n\nll myPow(ll a, int p) {\n if (p == 0) return 1;\n ll res = myPow(a, p / 2);\n res *= res;\n res %= mod;\n if (p % 2 == 1) {\n res *= a;\n res %= mod;\n }\n return res;\n}\n\nvoid addMode(int &a, ll b) {\n a = (a+b) % mod;\n}\n\nll mul(ll a, ll b) {\n return a * b % mod;\n}\n\ntemplate \nvoid mySwap(T &a, T &b) {\n T tmp = a;\n a = b;\n b = tmp;\n}\n\nstruct Query {\n int time, l, r, type;\n int speed, vol;\n};\n\nvector added;\nvector query;\n\nconst int M = N * 4;\nstruct ST {\n pii f[M], e[M];\n ll res[M], mn[M];\n\n void init() {\n fill(mn, mn+M, INF);\n }\n void build(int x, int nl, int nr) {\n if (nl == nr) {\n mn[x] = INF;\n return;\n }\n int m = (nl + nr) / 2;\n build(x*2, nl, m);\n build(x*2+1, m+1, nr);\n mn[x] = INF;\n }\n\n void update(int x) {\n if (mn[x*2] == INF) {\n int child = x*2+1;\n f[x] = f[child];\n e[x] = e[child];\n res[x] = res[child];\n mn[x] = mn[child];\n return;\n }\n if (mn[x*2+1] == INF) {\n int child = x*2;\n f[x] = f[child];\n e[x] = e[child];\n res[x] = res[child];\n mn[x] = mn[child];\n return;\n }\n int l = x*2;\n int r = x*2+1;\n f[x] = f[l];\n e[x] = e[r];\n ll diff = e[l].second * (f[r].first - e[l].first);\n res[x] = res[l] + diff + res[r];\n mn[x] = mmin(mn[l], res[l] + diff);\n mn[x] = mmin(mn[x], res[l] + diff + mn[r]);\n }\n\n void set(int l, int time, int speed, int x, int nl ,int nr) {\n if (nl == nr) {\n f[x] = mp(time, speed);\n e[x] = mp(time, speed);\n res[x] = 0;\n mn[x] = 0;\n return;\n }\n int m = (nl + nr) / 2;\n if (l <= m) set(l, time, speed, x*2, nl, m);\n else set(l, time, speed, x*2+1, m+1, nr);\n update(x);\n }\n\n void del(int l, int x, int nl , int nr) {\n if (nl == nr) {\n mn[x] = INF;\n return;\n }\n int m = (nl + nr) / 2;\n if (l <= m) del(l, x*2, nl, m);\n else del(l, x*2+1, m+1, nr);\n update(x);\n }\n\n struct node {\n double to;\n ll v;\n };\n node query(int l, int r, ll v, int ss, int rr, int x, int nl, int nr) {\n\n if (mn[x] == INF) return {-1, v};\n if (l > r) return {-1, v};\n// if (rr <= f[x].first) {\n// return {-1, v};\n// }\n if (l == nl && r == nr) {\n if (f[x] == e[x]) {\n ll nv = res[x] + v + (rr - e[x].first) * e[x].second;\n if (nv > 0) return {-1, nv};\n else return {e[x].first - (res[x] + v) * 1.0 / e[x].second, 0LL};\n }\n int lchild = x*2;\n int rchild = x*2+1;\n int m = (nl + nr) / 2;\n if (mn[rchild] == INF) return query(l, m, v, ss, rr, x*2, nl, m);\n if (mn[lchild] == INF) return query(m+1, r, v, ss, rr, x*2+1, m+1, nr);\n\n if (mn[lchild] + v <= 0) return query(l, m, v, ss, mmin(rr, f[x*2+1].first), x*2, nl, m);\n ll diff = e[lchild].second * (f[rchild].first - e[lchild].first);\n if (v + res[lchild] + diff <= 0) {\n return {e[lchild].first - (v + res[lchild]) * 1.0 / e[lchild].second, 0};\n }\n\n if (mn[x] + v > 0) {\n ll nv = res[x] + v + (rr - e[x].first) * e[x].second;\n if (nv <= 0) {\n return {e[x].first - (v + res[x]) * 1.0 / e[x].second, 0};\n } else {\n return {-1, nv};\n }\n } else {\n v = v + res[lchild] + diff;\n return query(m+1, r, v, ss, rr, x*2+1, m+1, nr);\n }\n }\n\n int lchild = x*2;\n int rchild = x*2+1;\n int m = (nl + nr) / 2;\n if (mn[rchild] == INF) return query(l, mmin(m, r), v, ss, rr, x*2, nl, m);\n if (mn[lchild] == INF) return query(mmax(l, m+1), r, v, ss, rr, x*2+1, m+1, nr);\n node res = query(l, mmin(r, m), v, ss, f[x*2+1].first, x*2, nl, m);\n if (res.to != -1) return res;\n return query(mmax(l, m+1), r, res.v, ss, rr, x*2+1, m+1, nr);\n }\n}st;\n\nint main() {\n\n fast_io();\n cout << fixed << setprecision(10);\n\n cin >> n;\n for (int i = 0; i < n; i++) {\n int tp;\n cin >> tp;\n Query q;\n q.type = tp;\n if (tp == 1) {\n int time, speed;\n cin >> time >> speed;\n q.time = time;\n q.speed = speed;\n added.push_back(time);\n } else if (tp == 2) {\n int time;\n cin >> time;\n q.time = time;\n } else {\n int l, r, v;\n cin >> l >> r >> v;\n q.l = l;\n q.r = r;\n q.vol = v;\n }\n query.push_back(q);\n }\n if (added.size() == 0) added.push_back(0);\n\n sort(added.begin(), added.end());\n added.erase(unique(added.begin(), added.end()), added.end());\n\n int m = added.size();\n st.init();\n st.build(1, 1, m);\n\n for (int i = 0; i < n; i++) {\n Query q = query[i];\n if (q.type == 1) {\n int idx = lower_bound(added.begin(), added.end(), q.time) - added.begin();\n idx++;\n int time = q.time;\n int speed = q.speed;\n st.set(idx, time, speed, 1, 1, m);\n } else if (q.type == 2) {\n int idx = lower_bound(added.begin(), added.end(), q.time) - added.begin();\n idx++;\n st.del(idx, 1, 1, m);\n } else {\n if (q.vol == 0) {\n cout << q.l << '\\n';\n } else {\n int l = lower_bound(added.begin(), added.end(), q.l) - added.begin();\n l++;\n int r = lower_bound(added.begin(), added.end(), q.r) - added.begin();\n cout << st.query(l, r, q.vol, q.l, q.r, 1, 1, m).to << '\\n';\n }\n }\n }\n return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "aa031406445bfa968f488b9a02ddb24d", "src_uid": "23440d055baf6c831e91e76b99b9ada8", "apr_id": "a6682d10d9fca00f64451316bac03e29", "difficulty": 2800, "tags": ["data structures"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8337236533957846, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n\tint n,L=0;\n\tcin>>n;\n\tint i=0;\n\twhile (i<=n)\n\t{\n\t\tfor (int j=1; j-1<=i; j++)\n\t\t{\n\t\t\ti += j;\n\t\t}\n\t\tif (i<=n)\n\t\t{\n\t\t\tL++;\n\t\t}\n\t}\n\tcout<\n#include\n#include\n#include\n#include\n#define p 998244853\n#define N 100003\n#define reg register\nusing namespace std;\n\nint n,m,ans;\nint fac[N],ifac[N],s[N];\n\ninline int power(int a,int t){\n int res = 1;\n while(t){\n if(t&1) res = (ll)res*a%p;\n a = (ll)a*a%p;\n t >>= 1;\n }\n return res;\n}\n\ninline int C(int x,int y){\n if(x=p?x+y-p:x+y;\n}\n\nint main(){\n scanf(\"%d%d\",&n,&m);\n fac[0] = fac[1] = ifac[0] = ifac[1] = 1;\n for(reg int i=2;i<=4000;++i) ifac[i] = fac[i] = (ll)fac[i-1]*i%p;\n ifac[4000] = power(fac[4000],p-2);\n for(reg int i=3999;i>1;--i) ifac[i] = (ll)ifac[i+1]*(i+1)%p;\n for(reg int i=0;i<=n;++i){\n if(i+m>n) s[i] = C(n+m,m+i);\n else s[i] = C(n+m,m);\n }\n for(reg int i=0;i\nusing namespace std;\nint main(){\n\tlong long int B;\n\tint A[20];\n\tcin>>B;\n\tint i=0;\n\tfor(int j=1;j<=10*B;i++,j*=10){\n\t\tA[i]=((B%(j*10))-(B%j))/j;\n\t}\n\ti-=2;\n\tfor(int j=i;j>=0;j--){\n\t\tif(j==i&&A[j]==9){\n\t\t\t\n\t\t}\n\t\telse if(A[j]>=5){\n\t\t\tA[j]=9-A[j];\n\t\t}\n\t}\n\tB=0;\n\tfor(int j=i;j>=0;j--){\n\t\tB=10*B+A[j];\n\t}\n\tcout<\n#include\nusing namespace std;\nconst int mod=1e9+7;\nstruct Node{\n Node* next[100];\n};\nint num,n,k,d;\nint ans;\nbool cd;\nvoid trv(Node*root){\n if(root==0){\n return;\n }\n if(num==n&&cd) {\n ans++;\n ans%=mod;\n return;\n }\n for(int i=0;i=d) cd=1;\n trv(root->next[i]);\n num-=i+1;\n if(i+1>=d) cd=0;\n }\n}\nvoid k_tree(int mx,Node*&root){\n if(mx>=n){\n for(int i=0;inext[i]=0;\n }\n return;\n }\n for(int i=0;inext[i]=new Node;\n k_tree(mx+i+1,root->next[i]);\n }\n}\nvoid dk_tree(Node*&root){\n if(root==0) return;\n for(int i=0;inext[i]);\n }\n delete root;\n}\nint main(){\n Node*root=new Node;\n cin>>n>>k>>d;\n k_tree(0,root);\n trv(root);\n dk_tree(root);\n cout<\nusing namespace std;\n#define mod 1000000007\n#define ll long long\n#define pb push_back\n#define mp make_pair\n#define pi pair\n#define vi vector\n#define sc(x) scanf(\"%d\",&x)\n#define sc2(x,y) scanf(\"%d%d\",&x,&y)\n#define sc3(x,y,z) scanf(\"%d%d%d\",&x,&y,&z)\n#define sc4(x,y,z,u) scanf(\"%d%d%d%d\",&x,&y,&z,&u)\n#define scll(x) scanf(\"%lld\",&x)\n#define scll2(x,y) scanf(\"%lld%lld\",&x,&y)\n#define scll3(x,y,z) scanf(\"%lld%lld%lld\",&x,&y,&z)\n#define pr(x) printf(\"%d\\n\",x)\n#define prll(x) printf(\"%lld\\n\",x)\nint main()\n{\n int y,i,j,k,l;\n ios::sync_with_stdio(0);\n while(1){\n cin>>y;\n if(y%400==0||(y%4==0&&y%100!=0)&&((y+28)%100!=0||(y+28)%400==0))\n cout<\n#include \n#include \n#include \n\nusing namespace std;\n\nint f[51][1515];\n\nint main() {\n int n, s, k;\n scanf(\"%d %d %d\", &n, &s, &k);\n s--;\n vector a(n);\n for (int i = 0; i < n; i++) scanf(\"%d\", &a[i]);\n string c;\n cin >> c;\n\n memset(f, 0xff, sizeof(f));\n for (int i = 0; i < n; i++)\n f[i][abs(i - s)] = a[i];\n\n for (int t = 0; t < 1414; t++) {\n for (int i = 0; i < n; i++)\n if (f[i][t] > 0) {\n if (f[i][t] >= k) {\n printf(\"%d\\n\", t);\n return 0;\n }\n for (int j = 0; j < n; j++)\n if (c[i] != c[j] && a[j] > a[i]) {\n f[j][t + abs(i - j)] = max(f[j][t + abs(i - j)], f[i][t] + a[j]);\n }\n }\n }\n\n printf(\"-1\\n\");\n\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "f3d6477eaef53d7f788dda116faebee2", "src_uid": "a95e54a7e38cc0d61b39e4a01a6f8d3f", "apr_id": "016f5cbbfd7f8b3c555c9b62aae38cc3", "difficulty": 2000, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9125615763546798, "equal_cnt": 12, "replace_cnt": 6, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nint const maxt = 10000;\nstd::unordered_map, int, boost::hash>> d;\nstd::vector> p;\nstd::string str;\nint start = 0;\n\nint min_time(int i, int s) {\n//\tstd::cout << \"i = \" << i << \" s = \" << s << \"\\n\";\n\tstd::pair x {i, s};\n\tif (! d.count(x)) {\n//\t\tstd::cout << p[i].first << \" \" << s << \"\\n\";\n\t\tint res = (p[i].first >= s) ? 0 : maxt;\n\t\tfor (int j = 0; j < i; ++j)\n\t\t\tif (str[p[i].second] != str[p[j].second])\n\t\t\t\tres = std::min(res, min_time(j, (s > p[i].first) ? s - p[i].first : 0) + std::abs(p[i].second - p[j].second));\n\t\td[x] = res;\n\t}\n//\tstd::cout << \"d[\" << i << \",\" << s << \"] = \" << d[x] << \"\\n\";\n\treturn d[x];\n}\n\nmain() {\n\tstd::ios_base::sync_with_stdio(false);\n\tint n = 0, k = 0;\n\tstd::cin >> n >> start >> k;\n\tint a[n];\n\tfor (int i = 0; i < n; ++i)\n\t\tstd::cin >> a[i];\n\tstd::cin >> str;\n\tfor (int i = 0; i < n; ++i)\n\t\tp.push_back({a[i], i});\n\tstd::sort(p.begin(), p.end());\n\tstd::reverse(p.begin(), p.end());\n//\tstd::cout << \"sorted\\n\";\n//\tfor(int i = 0; i < n; ++i)\n//\t\tstd::cout << p[i].first << \" \" << p[i].second << \"\\n\";\n/*\tfor (int i = 0; i < n; ++i)\n\t\td[{i, 0}] = std::abs(p[i].second - start + 1);*/\n\tint res = maxt;\n\tfor (int i = 0; i < n; ++i)\n\t\tres = std::min(res, min_time(i, k) + std::abs(p[i].second - start + 1));\n\tif (res < maxt)\n\t\tstd::cout << res << \"\\n\";\n\telse \n\t\tstd::cout << \"-1\\n\";\n}", "lang": "GNU C++11", "bug_code_uid": "aaa886345a65d29479b28348b18368f8", "src_uid": "a95e54a7e38cc0d61b39e4a01a6f8d3f", "apr_id": "977b7d7b367c34a7f3ddb45fb0510730", "difficulty": 2000, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9692263445498993, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#include \nusing namespace std;\n\n#define si(n) scanf(\"%lld\",&n)\n#define ll long long\n#define MAX 200005\n\nconst int mod=(int) 1e9+7;\nll fact[MAX],inv[MAX];\n\n\nint mod_add(ll a,ll b) {\n a+=b;\n if(a>=mod) a-=mod;\n return a;\n}\n\nint mod_sub(ll a,ll b) {\n a-=b;\n if (a<0) a+=mod;\n return a;\n}\n\nint mod_mul(ll a, ll b) {\n a%=mod;\n b%=mod;\n return (a*b)%mod;\n}\n\nint bigmod(long long a,long long p)\n{\n long long ret = 1;\n a%=mod;\n while(p) {\n if(p & 1) ret = mod_mul(ret,a);\n a = mod_mul(a,a);\n p >>= 1;\n }\n return ret;\n}\n\nint mod_div(ll a,ll b)\n{\n return mod_mul(a,bigmod(b,mod-2));\n}\n\n\nint mod_power(int a,int b) {\n int res=1;\n while (b>0) {\n if (b&1) {\n res=mod_mul(res,a);\n }\n a=mod_mul(a,a);\n b>>=1;\n }\n return res;\n}\n\nvoid factorial()\n{\n fact[0]=1;\n inv[0]=1;\n for(int i=1;i<50;i++){\n fact[i]=mod_mul(fact[i-1],i);\n inv[i]=mod_power(fact[i],mod-2);\n }\n}\n\nll nCr(ll n,ll r)\n{\n if(r>n)return 0;\n ll ret=1;\n for(ll i=n-r+1;i<=n;i++)ret=mod_mul(ret,i);\n ret=(ret*inv[r])%mod;\n return ret;\n}\n\n\n\nint main()\n{\n //freopen(\"input.txt\",\"r\",stdin);\n factorial();\n ll n,s,f[25];\n int i,j;\n\n cin>>n>>s;\n for(i=0;i>f[i];\n }\n\n ll ans=nCr(s+n-1,n-1);\n\n for(i=0;i\n\nint main()\n{\n int a,b;\n while(scanf(\"%d %d\", &a,&b)){\n int count=0;\n while(a<=b){\n a = 3*a;\n b = 2*b;\n count++;\n }\n printf(\"%d\",count);\n }\n}\n", "lang": "Clang++17 Diagnostics", "bug_code_uid": "d56207110e1b137d8e3fc4a42de50d35", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "apr_id": "fd7751b3fc81a2639059e7667ddff961", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.35082458770614694, "equal_cnt": 27, "replace_cnt": 16, "delete_cnt": 4, "insert_cnt": 7, "fix_ops_cnt": 27, "bug_source_code": "#include \nusing namespace std;\ntypedef long long ll;\nconst int M=1e9+7;\nconst int N=1510;\nint mak[N][N],n,m,a,b,kk,g[N][N],f[N][N];\nint fp(int x,int y){\n\tif (y<0) return 0;\n\tint ret=1;\n\tfor (; y; y>>=1,x=(ll)x*x%M) if (y&1) ret=(ll)ret*x%M;\n\treturn ret;\n}\nbool inter(int a,int b,int c,int d){\n\treturn !((bd));\n}\nint fac[N],inv[N];\nint c(int x,int y){\n\treturn (ll)fac[x]*inv[x-y]%M*inv[y]%M;\n}\nint main(){\n\tfac[0]=1; for (int i=1; i<=1500; ++i) fac[i]=(ll)fac[i-1]*i%M;\n inv[1500]=fp(fac[1500],M-2); for (int i=1499; i>=0; --i) inv[i]=(ll)inv[i+1]*(i+1)%M;\n\tscanf(\"%d%d\",&n,&m);\n\tscanf(\"%d%d\",&a,&b);\n\tscanf(\"%d\",&kk);\n\tint p=(ll)a*fp(b,M-2)%M,pp=M+1-p;\n\t//cerr<<(ll)p*10%M<<\" \"<\n\n#define fi first\n#define se second\n#define pb push_back\n#define sz(c) (int)(c).size()\n#define all(c) (c).begin(), (c).end()\n#define in freopen(\"A.in\", \"r\", stdin);\n#define out freopen(\"A.out\", \"w\", stdout);\n\nusing namespace std;\n \nconst int N = 1000;\n\nint TN = 1;\n\nint n;\nint a[N];\nint total;\nmap us;\n\nbool check(int k) {\n int sum = 0;\n for (int i = 1; i <= n; i++) {\n sum += a[i];\n if (sum == k) {\n sum = 0;\n }\n else if (sum > k) {\n return 0;\n }\n }\n return !sum;\n}\n\nvoid solve() {\n cin >> n; set st;\n for (int i = 1; i <= n; i++) {\n char c; cin >> c; a[i] = c - 48;\n total += a[i];\n }\n if (!total) {\n puts(\"YES\"); return;\n }\n for (int i = 1; i * i <= total; i++) {\n if (total % i == 0) {\n if (check(i) || check(total / i) && i > 1) {\n puts(\"YES\"); return;\n }\n }\n }\n puts(\"NO\");\n return;\n}\n\nsigned main() {\n // ios_base::sync_with_stdio(0);\n // in; out; // cin >> TN;\n while (TN--) solve();\n return 0;\n }", "lang": "GNU C++17", "bug_code_uid": "947599c1ab751ef60753a965f5052e27", "src_uid": "410296a01b97a0a39b6683569c84d56c", "apr_id": "19114bb23862c1f50eb0dcd79f694e50", "difficulty": 1300, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9655172413793104, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \nusing namespace std;\n\nint main() {\n string s; cin>>s; int i,c=0;\n for (i=0;i\n\nusing namespace std;\n\nstring s;\nint check(int i,string x)\n{\n int flag=1;\n for(int j=0;j> s;\n string a,b,c,d,e;\n a=\"Danil\";b=\"Olya\";c=\"Ann\";d=\"Nikita\",e=\"Slava\";\n int A,B,C,D,E;\n A=B=C=D=E=0;\n for(int i=0;i\n\nusing namespace std;\n\nint main()\n{\n int m,n;\n cin>>n;\n cin>>m;\n int k;\n\n if((n-m)%2==0)\n k=(n-m)/2;\n if((n-m)%2!=0)\n {\n if(m==0)\n k=1;\n else\n k=n-m;\n }\n\n\n\n return k;\n}\n", "lang": "GNU C++17", "bug_code_uid": "84ef0c015339d88be2aa585d5a78d4f6", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "apr_id": "9400277a92ee30f9e318d6fd83828206", "difficulty": 900, "tags": ["math", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.2012779552715655, "equal_cnt": 7, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "#include\n#include\nusing namespace std;\nint r,h;\nint main(){\n\n while(scanf(\"%d%d\",&r,&h)){\n int ans = h/r;\n ans = ans * 2;\n h = h % r;\n\n\n if(h*2>=r){\n if( 4*h*h >= 3*r*r ){\n ans += 3;}\n else {ans += 2;}\n }\n else ans++;\n\n cout<\n#include \n\nusing namespace std;\n\nint n;\n\nconst int MODULUS = 1000000007;\n\nint f(int x, int y)\n{\n int z = n;\n for (int i = 0; i < x; ++i)\n {\n z /= 2;\n }\n for (int i = 0; i < y; ++i)\n {\n z /= 3;\n }\n return z;\n}\n\nint answer[1000000 + 1][20][2];\n\nint max_x;\nint max_y;\n\nint get_answer(int len, int x, int y)\n{\n long long ans = 0;\n\n if (answer[len][x][y] != -1)\n {\n return answer[len][x][y];\n }\n\n long long p = f(x, y) - (len - 1);\n if (p > 0)\n {\n ans += p * get_answer(len - 1, x, y) % MODULUS;\n if (ans >= MODULUS)\n ans -= MODULUS;\n }\n if (x < max_x && f(x + 1, y) >= len - 1)\n {\n p = f(x, y) - f(x + 1, y);\n ans += p * get_answer(len - 1, x + 1, y) % MODULUS;\n if (ans >= MODULUS)\n ans -= MODULUS;\n }\n\n if (y == 0 && f(x, y + 1) >= len - 1)\n {\n p = f(x, y) - f(x, y + 1);\n ans += p * get_answer(len - 1, x, y + 1) % MODULUS;\n if (ans >= MODULUS)\n ans -= MODULUS;\n }\n return answer[len][x][y] = ans;\n}\n\nint solve()\n{\n int z = n;\n while (z != 1)\n {\n z >>= 1;\n ++max_x;\n }\n answer[1][max_x][0] = 1;\n if ((1 << (max_x - 1)) * 3 <= n)\n {\n answer[1][max_x - 1][1] = 1;\n max_y = 1;\n }\n for (int i = 1; i < n; ++i)\n {\n for (int x = 0; x <= max_x; ++x)\n {\n for (int y = 0; y <= max_y; ++y)\n {\n int z = answer[i][x][y];\n if (z)\n {\n answer[i + 1][x][y] += max(0, (f(x, y) - i)) * z % MODULUS;\n if (answer[i + 1][x][y] >= MODULUS)\n answer[i + 1][x][y] -= MODULUS;\n if (x > 0)\n {\n answer[i + 1][x - 1][y] += (f(x - 1, y) - f(x, y)) * z % MODULUS;\n if (answer[i + 1][x - 1][y] >= MODULUS)\n answer[i + 1][x - 1][y] -= MODULUS;\n }\n if (y > 0)\n {\n answer[i + 1][x][y - 1] += (f(x, y - 1) - f(x, y)) * z % MODULUS;\n if (answer[i + 1][x][y - 1] >= MODULUS)\n answer[i + 1][x][y - 1] -= MODULUS;\n }\n }\n }\n }\n }\n return answer[n][0][0];\n}\n\nint main()\n{\n cin >> n;\n cout << solve() << endl;\n return 0;\n}\n", "lang": "MS C++ 2017", "bug_code_uid": "728cea9859f36eb7e16b71908d93def5", "src_uid": "b2d59b1279d891dba9372a52364bced2", "apr_id": "5a87d9f09a27c748a2b4aeb3033d903c", "difficulty": 2500, "tags": ["dp", "math", "combinatorics", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9490616621983914, "equal_cnt": 8, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 7, "bug_source_code": "#include \n#include \n\n#define lint long long int\nusing namespace std;\n\nint main()\n{\n lint x1, y1, x2, y2;\n cin >> x1 >> y1 >> x2 >> y2;\n\n lint pe_rand = (y2 - y1 + 1) / 2;\n if (y1 % 2 != y2 % 2) {\n assert(0);\n cout << (x2 - x1 + 1) * pe_rand << endl;\n return 0;\n }\n\n //Daca trece prin 2 centre\n if ((x1 + y1) % 2 == 0)\n cout << (x2 - x1 + 1ll) * pe_rand + (x2 - x1) / 2 + 1ll << endl;\n else {\n cout << (x2 - x1 + 1ll) * pe_rand + (x2 - x1) / 2 << endl;\n }\n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "b5221634dc53686fac033c2572253485", "src_uid": "00cffd273df24d1676acbbfd9a39630d", "apr_id": "f72d72fdde65041c7e4ef520113e238f", "difficulty": 1900, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9736540664375716, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include \nusing namespace std;\ntypedef signed long long ll;\n\n#undef _P\n#define _P(...) (void)printf(__VA_ARGS__)\n#define FOR(x,to) for(x=0;x>X1>>Y1>>X2>>Y2;\n\tassert(X1\nusing namespace std; \n/* run this program using the console pauser or add your own getch, system(\"pause\") or input loop */\nint bit[31];\nint n,p;\nint sm,minn;\n\nbool dfs(int ii,int n,int now,int dep)\n{\n\t//if(ii==3)\n\n\tif(dep==ii&&n==0)\n\t{\n\t\treturn true;\n\t}\n\tif(dep>ii||n<0)return false;\n\tfor(int i=now;i<=30&&bit[i]<=n;i++)\n\t{\n\t\tif(\n\t\tdfs(ii,n-bit[i],i,dep+1))return true;\n\t}\n\treturn false;\n}\nint main(int argc, char** argv) {\n\tminn=1e9;\n\tbit[0]=1;\n\tfor(int i=1;i<=30;i++)bit[i]=bit[i-1]*2;\n\t\n\tscanf(\"%d%d\",&n,&p);int flag=0;\n\tn-=p;\n\tfor(int i=1;i<=50;i++)\n\t{\n\tint k=n;//cout<\nusing namespace std;\n \n#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);\n#define endl '\\n'\n#define int long long\n#define double long double\n\nint nn;\nint arr[10];\nint fact[102];\nint mod=1000000007;\nint cache[11][102];\nint n;\nint inv(int x)\n{\n int r,y;\n for(r=1,y=mod-2;y>0;x=(x*x)%mod,y/=2)\n if(y%2==1)\n r=r*x%mod;\n return r;\n}\nint nCr(int n, int m)\n{\n return fact[n] *inv(fact[m])%mod *inv(fact[n-m])%mod ;\n}\nint dp(int pos,int taken)\n{\n if(pos>10 || (taken>nn;\n for(int i=0;i<10;i++)\n cin>>arr[i];\n int ans=0;\n for(int k=1;k<=nn;k++)\n {\n memset(cache,-1,sizeof(cache));\n n=k;\n for(int i=arr[0];i<=n-1;i++)\n ans+=nCr(n-1,i)*dp(1,i),ans%=mod;\n }\n cout<\n#include\n#include\nusing namespace std;\ntypedef long long int ll;\n#define vec vector\n#define pb push_back \n#define ma map \nint main()\n{\n #ifndef ONLINE_JUDGE\n freopen(\"input.txt\",\"r\",stdin);\n freopen(\"output.txt\",\"w\",stdout);\n #endif\n ll i,j,k,l; \n ll n;\n cin>>n;\n if(n>=11&&n<20 || n==21)\n {\n cout<<4;\n }\n if(n==20)\n {\n cout<<15;\n }\n else{\n cout<<0;\n }\n}\n", "lang": "GNU C++11", "bug_code_uid": "376b79fcc45f5dd9727c33f1bb21045c", "src_uid": "5802f52caff6015f21b80872274ab16c", "apr_id": "bab95f2375054f6124760c2cb186c99f", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.0700280112044818, "equal_cnt": 11, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "//\n// cc.cpp\n// CF\n//\n// Created by Mohammadreza Raddanipour on 8/11/18.\n// Copyright \u00a9 2018 Mohammadreza Raddanipour. All rights reserved.\n//\n\n#include \nusing namespace std;\n\nstring ITS(int a){\n string s = \"\";\n while(a > 0){\n s += (a % 10) + 48;\n a -= a % 10;\n a /= 10;\n }\n return s;\n}\n\nint main(){\n int a;\n string tmp = \"\";\n cin >> a;\n for(int i = 1; i <= a; i++)\n tmp += ITS(i);\n cout << tmp.size() << '\\n';\n}\n", "lang": "GNU C++17", "bug_code_uid": "9e606cebee5fb292178c268ea796b009", "src_uid": "4e652ccb40632bf4b9dd95b9f8ae1ec9", "apr_id": "3e80ec2818a4d3923997061f74204e32", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.848012470771629, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "/* -----------------------------\n | If you see my code, |\n | You are BC (best coder -_- )|\n | |\n -----------------------------\n*/\n#include\n#include\ntypedef long long ll;\ntypedef unsigned long long ul;\n#define to_lower(x) transform(x.begin(), x.end(), x.begin(), ::tolower)\n#define to_upper(x) transform(x.begin(), x.end(), x.begin(), ::toupper)\n#define pi acos(-1)\n#define ll long long\n#define ull unsigned long long\n#define vec vector\n#define f1(i,n) for(i=1;i>nn;ll arr[nn];for(i=0;i>arr[i];\n#define test ll ttt;cin>>ttt;while(ttt--)\n#define faster ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);\n#define faster2 ios_base::sync_with_stdio(0);\n#define en '\\n'\n#define eps 10e9\n#define pb push_back\n#define print(v) for(auto u:v)cout<>a>>b;\n if(a-b==1)\n {\n if(ar[a+b]==0)cout<<\"YES\\n\";\n else cout<<\"NO\\n\";\n }\n else cout<<\"NO\\n\";}\n\n\n}\n\n", "lang": "GNU C++11", "bug_code_uid": "f91738d47ba5bab428158cb345d26ca7", "src_uid": "5a052e4e6c64333d94c83df890b1183c", "apr_id": "28535a06feb3ebb98cc1176940063b78", "difficulty": 1100, "tags": ["math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9577464788732394, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "#include\nint max(int a,int b)\n{if(a>b)\nreturn a;\nreturn b;}\nint main()\n{int a,b,c;\nscanf(\"%d%d%d\",&a,&b,&c);\nb--;c-=2;\nint ans=max(a,max(b,c));\nprintf(\"%d\",(ans+1)*3);}\n", "lang": "MS C++", "bug_code_uid": "f59fd44e8032f2df4c8e6a1e5c13e0e1", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "b1db8ec1f0ec787dae81b6fcc7c1b04e", "difficulty": 800, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8723747980613893, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 7, "bug_source_code": "#include \nusing namespace std\n\nint main()\n{\n\tint n,k;\n\tcin>>n>>k;\n\tint a[n];\n\tint i,sum=0;\n\tint s[k];\n\tint j;\n\tfor(i=0;i>a[j];\n\t\tsum=sum+a[j];\n\t}\n\tfor(i=0;i\n#include\nint main()\n{\n\tchar a[1000];\n\twhile(~scanf(\"%s\",a))\n\t{\n\t\tint count=0;\n\t\tfor(int i=strlen(a)-1,j=0;;i--,j++)\n\t\t{\n\t\t\tif(a[i]!=a[j]) count++;\n\t\t}\n\t\tif(strlen(a)%2==0&&count==1) printf(\"YES\\n\");\n\t\telse if(strlen(a)%2==1&&count<=1) printf(\"YES\\n\");\n\t\telse printf(\"NO\\n\");\n\t}\n\treturn 0;\n}", "lang": "GNU C++17", "bug_code_uid": "94bd1512fde1c0c9e083b9b424daa19e", "src_uid": "fe74313abcf381f6c5b7b2057adaaa52", "apr_id": "0e7b7e166204ac86860d89038c014452", "difficulty": 1000, "tags": ["brute force", "constructive algorithms", "strings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.39152371342078707, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "#include \nusing namespace std;\n\nint main()\n{\n int a[4], c, l;\n list v;\n for(int i = 0;i < 4; i++)\n {\n cin >> a[i];\n }\n cin >> c;\n for(int i = 0, k = 1;i < 4; )\n {\n if(k > c)\n {\n k = 1;\n i++;\n }\n else\n {\n l = k % a[i];\n if(l == 0)\n {\n if(!(std::find(v.begin(), v.end(), k) != v.end()))\n {\n v.push_back(k);\n }\n\n }\n }\n k++;\n }\n\n cout << v.size();\n\n}\n\n\n", "lang": "GNU C++11", "bug_code_uid": "e3faf04b69d0ae4f3e0b8b680f7b6c6d", "src_uid": "46bfdec9bfc1e91bd2f5022f3d3c8ce7", "apr_id": "b3acd55eebce9d5a9c196da809266eb7", "difficulty": 800, "tags": ["math", "constructive algorithms", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9918007895535985, "equal_cnt": 8, "replace_cnt": 0, "delete_cnt": 7, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "#include\n\nusing namespace std;\ntemplate < typename T > inline T read()\n{\n\tT x = 0, f = 0;\n\tchar c = getchar();\n\twhile (!isdigit(c)) f = c == '-', c = getchar();\n\twhile (isdigit(c)) x = x * 10 + c - 48, c = getchar();\n\treturn f ? -x : x;\n}\nnamespace run\n{\n\ttypedef long long ll;\n\tconst int N = 500009,\n\t inf = 1e9;\n\tint mx, _mx;\n\tinline void upd(int x)\n\t{\n\t\tif (x > mx) _mx = mx, mx = x;\n\t\telse if (x > _mx) _mx = x;\n\t}\n\n\tint x, c, k, n, a[N], sum[N << 1], pre[N << 1], A;\n\tll ans, cnty;\n\tint main()\n\t{\n\t\tn = read < int > (), k = read < int > ();\n\t\tfor (int i = 1; i <= n; ++i)\n\t\t\t++sum[a[i] = read < int > ()], A = max(A, a[i]);\n\t\tpre[0] = -1;\n\t\tfor (int i = 1; i <= 2 * A; ++i)\n\t\t\tpre[i] = sum[i] ? i : pre[i - 1], sum[i] += sum[i - 1];\n\n\t\tfor (int i = 1; i <= A; ++i)\n\t\t{\n\t\t\tcnty = 0;\n\t\t\tfor (int j = A / i * i; j; j -= i) cnty += sum[A] - sum[j - 1];\n\t\t\tmx = -inf, _mx = -inf;\n\t\t\tfor (int j = A / i * i; j >= 0; j -= i)\n\t\t\t{\n\t\t\t\tx = pre[j + i - 1];\n\t\t\t\tif (x >= j)\n\t\t\t\t{\n\t\t\t\t\tc = sum[x] - sum[x - 1];\n\t\t\t\t\tupd(x % i);\n\t\t\t\t\tif (c > 1) upd(x % i);\n\t\t\t\t\telse if (pre[x - 1] >= j) upd(pre[x - 1] % i);\n\t\t\t\t}\n\n\t\t\t\tx = (j + mx) / 2;\n\t\t\t\tif (x > 1 && cnty - j / i > 1)\n\t\t\t\t\tans = max(ans, 1 ll * i * min(1 ll * x, cnty - j / i));\n\n\t\t\t\tif (mx >= 0 && _mx >= 0)\n\t\t\t\t{\n\t\t\t\t\tx = j + _mx;\n\t\t\t\t\tif (x > 1 && cnty - j / i * 2 > 1)\n\t\t\t\t\t\tans = max(ans, 1 ll * i * min(1 ll * x, cnty - j / i * 2));\n\t\t\t\t\tx = j + mx;\n\t\t\t\t\tif (x > 1 && cnty - j / i * 2 - 1 > 1 && sum[A] - sum[x - 1] >= 2)\n\t\t\t\t\t\tans = max(ans, 1 ll * i * min(1 ll * x, cnty - j / i * 2 - 1));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintf(\"%lld\", ans);\n\t\treturn 0;\n\t}\n}\nint main()\n{\n\treturn run::main();\n}\n", "lang": "GNU C++11", "bug_code_uid": "48925892b471473694603bc080efa1b7", "src_uid": "bca20e0910e9fe4d89326b50ab45e4ca", "apr_id": "334899a7333aae3ea125bdd9f6a3486a", "difficulty": 3200, "tags": ["math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.997737556561086, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include\n#define N 250005\nusing namespace std;\nint n,k,mo,ans;\nint hr[N],fac[N],inv[N],f[27][N];\nint power(int x,int y){\n\tint s=1;\n\tfor (;y;y/=2,x=1ll*x*x%mo)\n\t\tif (y&1) s=1ll*s*x%mo;\n\treturn s;\n}\nint main(){\n\tscanf(\"%d%d%d\",&n,&k,&mo);\n\tinv[0]=inv[1]=fac[0]=1;\n\tfor (int i=2;i<=n;i++)\n\t\tinv[i]=1ll*(mo-mo/i)*inv[mo%i]%mo;\n\tfor (int i=1;i/2<=n;i*=2)\n\t\tfor (int j=i/2;j\n#include\n#include\nusing namespace __gnu_pbds;\nusing namespace std;\n#define all(x) (x).begin(), (x).end()\n#define ff first\n#define ss second\n#define setbits(x) __builtin_popcount(x)\ntypedef long long ll;\ntypedef unsigned long long ull;\ntypedef double db;\ntypedef long double ldb;\ntypedef pair pii;\ntypedef pair pll;\ntypedef pair pli;\ntypedef pair pdd;\ntypedef vector vi;\n#define m1 make_pair\n#define in insert\n#define pb push_back\n#define IOS \\\n std::ios::sync_with_stdio(false); \\\n cin.tie(NULL); \\\n cout.tie(NULL);\n#define endl \"\\n\"\ntemplate \nusing ordered_set = tree, rb_tree_tag, tree_order_statistics_node_update>;\n\ninline ll gcd(ll a, ll b)\n{\n if (a == 0)\n return b;\n return gcd(b % a, a);\n}\ninline ll power(ll a, ll n, ll m)\n{\n if (n == 0)\n return 1;\n ll p = power(a, n / 2, m);\n p = (p * p) % m;\n if (n % 2)\n return (p * a) % m;\n else\n return p;\n}\nconst ll MOD = 1000000007;\nconst int N = int(3e5) + 999;\n#define int long long int\n\n//matrix multiplication\n\n#define FOR(x,to) for(x=0;x<(to);x++)\n#define ZERO(a) memset(a,0,sizeof(a))\nconst int MAT=101;\n//MAT is the size of the matrix\nll mo =MOD;\n\nstruct Mat {\n ll v[MAT][MAT];\n Mat(){\n \tZERO(v);\n };\n};\n\n//structure Mat defines the matrix\n \nMat mulmat(Mat& a,Mat& b,int n=MAT) {\n\n\tll mo2=4*mo*mo;\n\tint x,y,z; Mat r;\n\tFOR(x,n) FOR(y,n) r.v[x][y]=0;\n\tFOR(x,n) FOR(z,n) FOR(y,n) {\n\t\tr.v[x][y] += a.v[x][z]*b.v[z][y];\n\t\tif(r.v[x][y]>mo2) r.v[x][y] -= mo2;\n\t}\n\tFOR(x,n) FOR(y,n) r.v[x][y]%=mo;\n\treturn r;\n}\n\n//mulmat mulitplies the matrix a and b with size n\n \nMat powmat(ll p,Mat a,int n=MAT) {\n\tint i,x,y; Mat r;\n\tFOR(x,n) FOR(y,n) r.v[x][y]=0;\n\tFOR(i,n) r.v[i][i]=1;\n\twhile(p) {\n\t\tif(p%2) r=mulmat(r,a,n);\n\t\ta=mulmat(a,a,n);\n\t\tp>>=1;\n\t}\n\treturn r;\n}\n\n//p is the power\n//n is the size\n//a is the matrix to be exponentiated\nint modi;\nMat A;\nint nc2(int x){\n\tint ans = (x*((x-1+MOD)%MOD))%MOD;\n\tans%=MOD;\n\tans*=modi;\n\tans%=MOD;\n\treturn ans;\n}\n\nint32_t main(){\n IOS;\n\t\n int n,k;\n cin>>n>>k;\n int s[n];\n for(int i=0;i>s[i];\n int l = 0,c=0;\n for(int i=0;i=0){\n \t\tA.v[i][i-1] = ((l-i+1)*(l-i+1))%MOD;\n\n \t}\n \tA.v[i][i] = (nc2(l) + nc2(n-l) + i*(l-i) + (l-i)*(n-2*l+i))%MOD;// + nc2(n-l);\n \tif(i+1<=l){\n \t\tA.v[i][i+1] = ((i+1)*(n-2*l+i+1))%MOD;// \tA.v[i][i-1] = A.v[i][i] = A.v[i][i+1] = 0;\n \t}\n // }\n // for(int i=0;i<=l;i++){\n // \tfor(int j=0;j<=l;j++){\n // \t\tcout<\n\n\n#define int long long\n#define make(T, n) T n; cin >> n\n#define VI vector\n#define f(n) for (int i = 0;i < n;i++)\n#define VII vector\n#define g(n) for (int j = 0;j < n;j++)\n#define makev(name, n) VI name(n); f(n) cin >> name[i]\n#define ALL(q) q.begin(), q.end()\n#define pb(n) push_back(n)\nusing namespace std;\n\nsigned main()\n{\n ios_base::sync_with_stdio(0);\n cin.tie(0);\n make(int, t);\n f(t)\n if (t % i == 0)\n cout << i;\n return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "6870dc80c843059075e3f2b3a46ba209", "src_uid": "7220f2da5081547a12118595bbeda4f6", "apr_id": "9817e8ca529108941180295f364919d1", "difficulty": null, "tags": ["math", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9834424335772045, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include\n#include\n#include\n#include\nint main(){\n int n,m,k,i,j,a[100],b[100],t;\n while(scanf(\"%d%d%d\",&n,&m,&k)!=EOF)\n {\n memset(b,0,sizeof(b));\n int counter=1,flag=0,temp;\n if(m>k)\n {\n temp=m;\n m=k;\n k=temp;\n }\n for(i=1;i<=n;i++)\n {\n a[i]=i;\n }\n for(j=1;j<=log2(n);j=j+1)\n {\n t=1;\n for(i=1;ilog2(n))\n printf(\"Final!\\n\");\n }\n\n\n}\n", "lang": "GNU C++17", "bug_code_uid": "5b95fc91261214382f1ef1f2f0e43867", "src_uid": "a753bfa7bde157e108f34a28240f441f", "apr_id": "7eabecf00fde3d6c6a89ffb885443342", "difficulty": 1200, "tags": ["constructive algorithms", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.14128256513026052, "equal_cnt": 15, "replace_cnt": 12, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 15, "bug_source_code": "#include \nusing namespace std;\n\nconst int INF = (int)1e9;\n\nint n, m, s;\n\nvector > visited;\nvector compSize;\n\n// L, R, U, D\nint dx[4] = {0, 0, -1, 1};\nint dy[4] = {-1, 1, 0, 0};\n\nbool valid (int a, int b) {\n\treturn a >= 0 and a < n and b >= 0 and b < m;\n}\n\nvoid dfs (int x, int y, int parx, int pary, int comp) {\n\tvisited[x][y] = true;\n\tcompSize[comp]++;\n\tint u, v;\n\tfor (int i = 0; i < 4; i++) {\n\t\tu = x + (s * dx[i]);\n\t\tv = y + (s * dy[i]);\n\t\tif (!valid(u, v))\n\t\t\tcontinue;\n\t\tif (u == parx and v == pary)\n\t\t\tcontinue;\n\t\tif (!visited[u][v])\n\t\t\tdfs(u, v, x, y, comp);\n\t}\n\treturn;\n}\n\nvoid solve () {\n\tint k = 0;\n\tvisited.assign(n, vector(m, false));\n\tfor (int i = 0; i < n; i++) {\n\t\tfor (int j = 0; j < m; j++) {\n\t\t\tif (!visited[i][j]) {\n\t\t\t\tcompSize.push_back(0);\n\t\t\t\tdfs(i, j, -INF, -INF, k);\n\t\t\t\tk++;\n\t\t\t}\n\t\t}\n\t}\n\tint dmax = -INF, pmax = 0;\n\tfor (int i = 0; i < compSize.size(); i++) {\n\t\tdmax = max(dmax, compSize[i]);\n\t}\n\tfor (int i = 0; i < compSize.size(); i++) {\n\t\tif (compSize[i] == dmax)\n\t\t\tpmax += compSize[i];\n\t}\n\tcout << pmax << \"\\n\";\n\treturn;\n}\n\n\nint main () {\n\tcin >> n >> m >> s;\n\tsolve();\n\treturn 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "815f717187bb1928bb0bfaf5110253c2", "src_uid": "e853733fb2ed87c56623ff9a5ac09c36", "apr_id": "e663428aedabfd87047788e1c49a0a26", "difficulty": 1700, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9942004971002486, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \n\nusing namespace std;\nbool b[92345];\nlong long bfs(int s,int d)\n{\n queue > qu;\n qu.push(make_pair(s,0));\n long long depth,x;\n while(!qu.empty())\n {\n pairp;\n p=qu.front();\n qu.pop();\n\n x=p.first;\n depth=p.second;\n\n if(x==d) break;\n \n if(x<=0||b[x]) continue;\n\n b[x]=1;\n\n qu.push(make_pair(x*2,depth+1));\n qu.push(make_pair(x-1,depth+1));\n\n }\n return depth;\n}\n\nint main()\n{\n int n,m;\n cin>>n>>m;\n cout<\n#include \nusing namespace std;\n\nint main()\n{\n\tint size, count1 = 0, count2 = 0;\n\tstring holst;\n\tcin >> size >> holst;\n\tfor (int j = 0; j < holst.size(); j++)\n\t{\n\t\tif (holst[j] == '?')\n\t\t\tcount1++;\n\t\tif (j > 0 && (j < holst.size() - 1))\n\t\t{\n\t\t\tif (holst[j] == '?' && holst[j - 1] != '?' && holst[j + 1] != '?' && holst[j - 1] != holst[j + 1])\n\t\t\t{\n\t\t\t\tcount2++;\n\t\t\t}\n\t\t}\n\t}\n\tif (count1 == count2)\n\t{\n\t\treturn 1;\n\t\texit(1);\n\t}\n\tfor (int i = 0; i < holst.size(); i++)\n\t{\n\t\t\n\t\tif ( holst[i] == holst[i + 1] && (holst[i] != '?' && holst[i+1] != '?' ) ) \t\t\n\t\t{\n\t\t\t\n\t\t\tcout << \"No\";\n\t\t\tbreak;\n\t\t}\n\t\t/*if (i > 0 && (i < holst.size() - 1))\n\t\t{\n\t\t\tif (holst[i] == '?' && holst[i + 1] != '?' && holst[i - 1] != '?' && holst[i - 1] != holst[i + 1])\n\t\t\t{\n\t\t\t\tcout << \"No\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}*/\n\t\t\n\t\tif ( i + 1 == holst.size() )\n\t\t\tcout << \"Yes\";\n\t}\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "96fadd117f93f5c3eb1331f96f193b9c", "src_uid": "f8adfa0dde7ac1363f269dbdf00212c3", "apr_id": "29eb5a2303f8a370b301d87893ddbf6f", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.12307692307692308, "equal_cnt": 9, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 9, "bug_source_code": "#include\nusing namespace std;\nint main(){\n\tint w,h,i,j,d[400][400]={0};\n\tcin>>w>>h;\n\tfor(i=1;i\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n/*\ndouble C(int n, int m)\n{\n\tdouble ret=1.0;\n\tfor(int i=1;i<=n;++i) ret*=i;\n\tfor(int i=1;i<=m;++i) ret/=i;\n\tfor(int i=1;i<=n-m;++i) ret/=i;\n\treturn ret;\n}\n*/\nvoid ins(vector &A, int k)\n{\n\tfor(int i=2;i<=k;++i) A.push_back(i);\n}\n\ndouble Pr(int n, int m, int k)\n{\n\tif (k>m || n-k>n*m-m) return 0;\n\n\tvector A,B;\n\tins(A,m);ins(A,n*m-m);ins(A,n);ins(A,n*m-n);\n\tins(B,k);ins(B,m-k);ins(B,n-k);ins(B,n*m-m-n+k);ins(B,n*m);\n\n\tsort(A.begin(),A.end());\n\tsort(B.begin(),B.end());\n\tint i=0,j=0;\n\twhile(i0 && B.size()>0)\n\t{\n\t\tif (ret<1.0) {ret*=A.back();A.pop_back();} else\n\t\t\t{ret/=B.back();B.pop_back();}\n\t}\n\n\tfor(int i=0;i> n >> m;\n\n\tdouble ret=0;\n\tfor(int i=1;i<=n;++i)\n\t\tret += i*i * Pr(n,m,i);\n\n\tret /= n;\n\n\tprintf(\"%.10lf\",ret);\n\n\n\treturn 0;\n}", "lang": "MS C++", "bug_code_uid": "658c339240be5064e44dd50c3f44204b", "src_uid": "0b9ce20c36e53d4702869660cbb53317", "apr_id": "f3345d11717da7fd4970aa4ed710cb90", "difficulty": 2100, "tags": ["probabilities", "math", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9114077669902912, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "#include\nusing namespace std;\n\nint main()\n{\n while(1)\n {\n int n,m;\n cin>>n>>m;\n int a[n];\n int sum = 0;\n int sum1= 0;\n for(int i=0;i>a[i];\n sum+=a[i];\n }\n for(int i=0;i8)\n {\n a[i+1]+=a[i]-8;\n a[i]=8;\n }\n }\n int count = 0;\n for(int i=0;i8)\n {\n cout<<\"-1\\n\";\n return 0;\n }\n if(m!=0)\n {\n m-=a[i];\n count++;\n }\n\n }\n cout<< count << endl;\n\n }\n}\n\n", "lang": "GNU C++11", "bug_code_uid": "2e8b8393b3951ee208d97d1d99baacf6", "src_uid": "24695b6a2aa573e90f0fe661b0c0bd3a", "apr_id": "d9d79bdc08aa451fa6a9e58d1cfe359c", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.2907268170426065, "equal_cnt": 13, "replace_cnt": 9, "delete_cnt": 4, "insert_cnt": 0, "fix_ops_cnt": 13, "bug_source_code": "//CF13A\n#include\nusing namespace std;\nlong long f(int n,int b)\n{\n\tlong long ans=0;\n\twhile(n)\n\t{\n\t\tans+=n%b;\n\t\tn=n/b;\n\t}\n\treturn ans;\n}\nlong long gcd(long long a,long long b)\n{\n\tif (b==0)\n\t{\n\t\treturn a;\n\t}\n\telse\n\t{\n\t\treturn (b,a%b);\n\t}\n}\nint main()\n{\n\tint n;\n\tlong long ans=0;\n\tcin>>n;\n\tfor (int i=2;i\n#include \nint main()\n{\n\tint i;\n\tchar s[55];\n\tscanf(\"%s\", s);\n\tint len = strlen(s);\n\tint vis = 1;\n\tfor(i = 0 ; i < (len - 1) / 2; i++)\n\t{\n\t\tif(s[i] != s[len - 1 - i])vis = 0;\n\t}\n\tif(vis == 0)\n\t{\n\t\tprintf(\"%d\\n\", len);\n\t}\n\telse\n\t{\n\t\tif(len == 1)\n\t\t{\n\t\t\tprintf(\"1\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\tint count = 0;\n\t\tint eng[30];\n\t\tfor(i = 0 ; i < len ;i++)\n\t\t{\n\t\t\teng[s[i] - 'a' + 1] = 1;\n\t\t}\n\t\tfor(i = 1 ; i <= 26 ;i++)\n\t\t{\n\t\t\tif(eng[i] == 1) count++;\n\t\t}\n\t\tif(count == 1)printf(\"0\\n\");\n\t\telse\n\t\t{\n\t\t\tprintf(\"%d\\n\", len - 1);\n\t\t}\n\t}\n}", "lang": "GNU C++14", "bug_code_uid": "2fec15e8bfbe56af94b55cef4e986964", "src_uid": "6c85175d334f811617e7030e0403f706", "apr_id": "9de72f24fe4e309b95ef61d2f2463a26", "difficulty": 900, "tags": ["strings", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.49688830658368816, "equal_cnt": 24, "replace_cnt": 13, "delete_cnt": 3, "insert_cnt": 7, "fix_ops_cnt": 23, "bug_source_code": "#include \n#include \n#include\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n#define SZ(x) ((int)(x).size())\n#define rep(i,a,n) for (int i=a; i<(int)n; i++)\n#define per(i,n,a) for (int i=n; i>=a; i--)\n#define hk push_back\n#define pk pop_back\n#define mp make_pair\n#define PI 3.141592653589793\n#define clr(a) memset(a, 0, sizeof(a))\n#define clr1(a) memset(a, -1, sizeof(a))\ntypedef vector VI;\ntypedef vector< pair > VIP;\ntypedef vector< pair > > VIPP;\ntypedef vector VS;\ntypedef vector VD;\ntypedef vector VB;\ntypedef long long ll;\n#define MAX_V 1000\nconst ll mod = 1000000007;\nll powmod(ll a, ll b) {\n ll res = 1; a %= mod; for (; b; b >>= 1){ if (b & 1)res = res*a%mod; a = a*a%mod; }return res;\n}\n\nll n, K, S, maxFactorial, m;\nvector nums;\nint idxNoFactorial;\nvector factorial;\n\nmap< pair< pair, pair >, ll> cache;\n\nll comb[2005][2005];\nll calComb(int n, int k){\n if (n * k < 0) return 0;\n if (n == k || k == 0) return 1;\n if (n - k < k) return calComb(n, n - k);\n ll& ret = comb[n][k];\n if (ret) return ret;\n\n return ret = (calComb(n - 1, k) + calComb(n - 1, k - 1)) % mod;\n}\n\nll dfs(int idx, ll sum, int searchMode, int kLeft) {\n if (kLeft < 0) return 0;\n if (sum > S) return 0;\n if (sum == S) return 1;\n if (idx >= nums.size()) return 0;\n ll& ret = cache[mp(mp(idx, sum), mp(searchMode, kLeft))];\n if (ret) return ret;\n\n int nextIdx = idx;\n while (nextIdx < nums.size()) {\n if (nums[nextIdx] != nums[idx]) break;\n nextIdx++;\n }\n\n if (searchMode == 1) {\n ll ret1 = 0;\n rep(i, 0, nextIdx - idx) {\n ll nextSum = sum + nums[idx] * (i + 1);\n ret1 += dfs(nextIdx, nextSum, 0, kLeft) * calComb(nextIdx - idx, i + 1);\n }\n return ret = ret1;\n }\n else {\n ll ret1 = 0;\n if (idx < idxNoFactorial && kLeft) {\n rep(i, 0, nextIdx - idx) {\n ll nextSum = sum + factorial[nums[idx] - 1] * (i + 1);\n if (i == nextIdx - idx - 1)\n ret1 += dfs(idx + (i + 1), nextSum, 0, kLeft - (i + 1));\n else { \n if (nextSum == S) {\n ret1 += calComb(nextIdx - idx, i + 1); break;\n }\n else {\n ret1 += dfs(idx + (i + 1), nextSum, 1, kLeft - (i + 1)) * calComb(nextIdx - idx, i + 1);\n ret1 += dfs(nextIdx, nextSum, 0, kLeft - (i + 1)) * calComb(nextIdx - idx, i + 1);\n }\n }\n if (kLeft - (i + 1) == 0) break;\n }\n }\n ret1 += dfs(idx, sum, 1, kLeft);\n ret1 += dfs(nextIdx, sum, 0, kLeft);\n return ret = ret1;\n }\n}\n\nint main() {\n clr(comb);\n cin >> n >> K >> S;\n rep(i, 0, n) {\n cin >> m;\n nums.push_back(m);\n }\n sort(nums.begin(), nums.end());\n idxNoFactorial = 50;\n maxFactorial = 1;\n int k = 1;\n while (maxFactorial <= S) {\n maxFactorial *= k;\n factorial.push_back(maxFactorial);\n k++;\n }\n rep(i, 0, n) if (nums[i] >= k) { idxNoFactorial = i; break; }\n\n cout << dfs(0, 0, 0, K) << endl;\n\n return 0;\n}", "lang": "MS C++", "bug_code_uid": "0da02f2855b479dad24b2d1ff2dc32f2", "src_uid": "2821a11066dffc7e8f6a60a8751cea37", "apr_id": "082dc5d80320aabecdce402179425837", "difficulty": 2100, "tags": ["dp", "meet-in-the-middle", "bitmasks", "math", "brute force", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.97165991902834, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 4, "bug_source_code": "#include\nusing namespace std;\n#include\n#include\nusing namespace __gnu_pbds;\n#define _for(i,a,b) for(int i=(a);i<(b);++i)\n#define ms(a) memset(a,0,sizeof(a))\n#define ms_inf(a) memset(a,0x3f,sizeof(a))\n#define ms_ninf(a) memset(a,0xcf,sizeof(a))\n#define pb push_back\n#define mp make_pair\n#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)\n#define lc (o<<1)\n#define rc (o<<1|1)\n//#include\n//typedef __gnu_pbds::priority_queue heap; //\ufffd\ufffd\u01ab\ufffd\ufffd \ntypedef long long ll; \ntypedef unsigned long long ull;\nint mod=1e9+7;\nll INF=1ll<<60;\nconst int maxn=1e5+10;\nconst int maxl=5e3+10;\nconst double PI=acos(-1.0);\nconst double eps=1e-8;\nint n;\nint ans;\nint li;\nll cal(string&cur)\n{\n\tll w=atoi(cur.c_str());\n\tif(1+n>=w)return w>>1;\n\tint x=w-n;\n\treturn (n-x+1)>>1;\n}\nvoid dfs(string cur)\n{\n\tll w=atoi(cur.c_str());\n\tif(w>li)return;\n\tans+=cal(cur);\n\tfor(char c='1';c<='8';++c)\n\t{\n\t\tstring nx=c+cur;\n\t\tdfs(nx);\n\t}\n}\nint main()\n{\n\tfast;string s;int c=0;\n\tcin>>n;li=2*n-1;\n\twhile(1)\n\t{\n\t\tll nx=(ll)c*10+9;\n\t\tif(nx>li)break;\n\t\tc=nx;s+='9';\n\t}\n\tif(!c)ans=n*(n-1)/2;\n\telse\n\t{\n\t\tdfs(s);\n\t}\n\tcout<\nusing namespace std;\ntemplate inline t read(t &x){\n\tchar c=getchar();bool f=0;x=0;\n\twhile(!isdigit(c)) f|=c=='-',c=getchar();\n\twhile(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();\n\tif(f) x=-x;return x;\n}\ntemplate inline void read(t &x,A &...a){\n\tread(x);read(a...);\n}\ntemplate inline void write(t x){\n\tif(x<0) putchar('-'),write(-x);\n\telse{if(x>9) write(x/10);putchar('0'+x%10);}\n}\n\n#define int long long\n\nconst int N=1e5+5;\nint ans,a1,a2,b1,b2,n,k,inv[N<<1],mod;\n\nint fpow(int x,int y){\n\tint res=1;\n\tfor(;y;y>>=1,x=x*x%mod) if(y&1) res=res*x%mod;\n\treturn res;\n}\n\nvoid dico(int l,int r,int h){\n\tif(h==1||l==r){\n\t\tl=r-l+1;\n\t\tif(!a1) a1=l,b1=1;\n\t\telse if(a1==l) b1++;\n\t\telse a2=l,b2++;\n\t\treturn ;\n\t}\n\tint mid=l+r>>1;\n\tdico(l,mid,h-1);\n\tdico(mid+1,r,h-1);\n}\n\nint calc(int n,int m){\n\tint res=0;\n\tfor(int i=2;i<=n+m;i++) res=(res+inv[i]*min(i-1,n+m-i+1)%mod)%mod;\n\treturn mod-res;\n}\n\nvoid init(int n){\n\tinv[1]=1;for(int i=2;i<=n;i++) inv[i]=(mod-mod/i)*inv[mod%i]%mod;\n}\n\nsigned main(){\n\tread(n,k,mod);ans=n*(n-1)/2*(mod+1>>1))%mod;\n\tinit(n<<1);\n\tdico(1,n,k);\n\tans=(ans+b1*(b1-1)/2*calc(a1,a1)%mod)%mod;\n\tif(a2){\n\t\tans=(ans+b2*(b2-1)/2*calc(a2,a2)%mod)%mod;\n\t\tans=(ans+b1*b2%mod*calc(a1,a2)%mod)%mod;\n\t}\n\twrite(ans);\n}", "lang": "GNU C++11", "bug_code_uid": "75ec12009b9ba8eb321b4ba362db6209", "src_uid": "1dd54f5071872e947996ab32b16da19c", "apr_id": "b7112e7ad1cea8267d030da338da8477", "difficulty": 3200, "tags": ["probabilities", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.7440633245382586, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "#include\nusing namespace std;\n\nint main()\n{\nlong long t,ans,x,y,i,even=0,odd=0;\n while(1){\n\n scanf(\"%lld %lld\",&x,&y);\n ans=x+y;\n even=0,odd=0;\n\n for(i=1;i<=ans;i++)\n {\n if(i%2==0) even++;\n else odd++;\n }\n\n\n if(x==even && y==odd) printf(\"YES\\n\");\n\n else printf(\"NO\\n\");\n}\n\n\n\n\n return 0;\n}\n\n\n", "lang": "GNU C++", "bug_code_uid": "ebf050dee28da8e17342c2295d6dd9fa", "src_uid": "ec5e3b3f5ee6a13eaf01b9a9a66ff037", "apr_id": "6870972c5684e24f3eae263b795f936a", "difficulty": 1000, "tags": ["brute force", "math", "constructive algorithms", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9149935924818454, "equal_cnt": 14, "replace_cnt": 11, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 13, "bug_source_code": "//Template by karthik171998\n \n#include \nusing namespace std;\n#pragma GCC diagnostic ignored \"-Wunused-result\"\n\n/*------------------------------------------------------------------------*/\n\n#define iOS ios_base::sync_with_stdio(false); cin.tie(NULL)\n#define For(i,a,b) for((i)=(a);(i)<(b);++(i))\n#define Fore(i,a,b) for((i)=(a);(i)<=(b);++(i))\n#define rof(i,a,b) for((i)=(a);(i)>=(b);--(i))\n#define Fors(i,s) for((i)=s.begin();i!=s.end();i++)\n#define Form(i,m) for((i)=m.begin();i!=m.end();i++)\n#define inf (long long)4e18\n#define xx first\n#define yy second\n#define pb push_back\n#define PB pop_back()\n#define mp make_pair\n#define mod 1000000007\n#define pi 3.1428571\n#define sqr(a) (((a) * (a)))\n#define L(x) ((x)<<1)\n#define R(x) (((x)<<1)+1)\n#define endl \"\\n\"\n#define ub(a,e) upper_bond(a.begin(),a.end(),e)\n#define lb(a,e) lower_bond(a.begin(),a.end(),e)\n#define sortv(a) sort(a.begin(),a.end())\n#define sortr(a) sort(a.rbegin(),a.rend())\n#define accu(a,e) accumulate(a.begin(),a.end(),e)\n\n/*---------------------------------------------------------------------------*/\n\ntypedef long long ll;\ntypedef vector< pair >vect;\ntypedef pair pa;\ntypedef vector vi;\ntypedef vector vs;\ntypedef map ms;\ntypedef map ml;\ntypedef priority_queue pq;\ntypedef unsigned long long ull;\ntypedef long double ld;\n\n/*---------------------------------------------------------------------------*/\n\nll gcd(ll a, ll b)\n{\n\tif(b == 0)\n\t{\n\t\treturn a;\n\t}\n\treturn gcd(b, a%b);\n}\nll lcm(ll a, ll b)\n{\n\treturn ((a*b)/gcd(a,b));\n}\n\n/*----------------------------------------------------------------------------*/\n//Variables and functions for graph\n//Undirected graph\n \n/*vi adj[1000000];\nbool visited[1000000]={false};\nvoid add_edge(ll a,ll b)\n{\n adj[a].pb(b);\n adj[b].pb(a);\n}\n/*-----------------------------------------------------------------------------*/\n\n//end of template.\n\nll i,j,n,t;\n\nint main()\n{\n \tiOS;\n \tcin>>n;\n \tint f=0;\n \tstring a=\"312931303130313130313031\";\n \tstring b=\"312831303130313130313031\";\n \ti=0;\n \twhile(i<=25)\n \ta+=a,i++;\n \twhile(i>=0)\n \tb+=b,i--;\n \tstring ans=\"\";\n \tFor(i,0,n)\n \t{\n \t\tstring c;\n \t\tcin>>c;\n \t\tans+=c;\n\t }\n\t For(i,0,a.size())\n\t {\n\t \tstring d=a.substr(i,2*n);\n\t \tif(d==ans)\n\t \t{\n\t\tcout<<\"YES\";\n\t\treturn 0;\n\t\t}\n\t }\n\t For(i,0,b.size())\n\t {\n\t \tstring d=b.substr(i,2*n);\n\t \tif(d==ans)\n\t \t{\n\t \tcout<<\"YES\";\n\t\treturn 0;\n\t\t}\n\t }\n\t cout<<\"NO\";\n\treturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "b1878f7ad1619fc247915e49bccc00a9", "src_uid": "d60c8895cebcc5d0c6459238edbdb945", "apr_id": "dd5ed8310d9ee9441b4257349a083d18", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9892226553542766, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 8, "bug_source_code": "//Jacker0031\n//packages\n#if __has_include(\"extra.cpp\") && __has_include()\n #include \"extra.cpp\"\n#else\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n#endif\n\n// Data Type\n#define ull unsigned long long int\n#define ll long long int\n#define ld long double\n// Loops\n#define loop(i,s,e) for(ll i=(s); i<(e); i++)\n#define rloop(i,s,e) for(ll i=(s); i>=(e); i--)\n#define iter(it,var) for(auto it=var.begin(); it!=var.end(); it++)\n#define riter(it,var) for(auto it=var.rbegin(); it!=var.rend(); it++)\n#define Bit bitset<32>\n#define setbit(pos,n) n |= (1LL<\n#define vvl vector\n#define pll pair\n#define mll map\n#define ub upper_bound \n#define lb lower_bound\n#define bs binary_search \n#define all(x) x.begin(),x.end()\n#define rall(x) x.rbegin(),x.rend()\n#define get(tup,ind) get(tup)\n#define afterpoint(x) fixed<>i;\n#define print(any) {for(auto &i:any) cout< sieve(ll n) \n{ \n vector prime(n,true); \n prime[0]=prime[1]=false;\n for (ll p=2; p*p<=n; p++) \n { \n if (prime[p] == true) \n { \n for (ll i=p*p; i<=n; i += p) \n prime[i]=false;\n\n } \n } \n for(ll i=2;i<=n;i++)\n {\n if(prime[i]==true)\n pri.pb(i);\n }\n return prime; \n} \n\nint main()\n{\n ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);\n #ifdef Jenish\n freopen(\"C:/Sublime Text 3/in.txt\",\"r\",stdin);\n freopen(\"C:/Sublime Text 3/out.txt\",\"w\",stdout);\n #endif\n ll ma=1000;\n vector prime=sieve(ma);\n \n ll s=pri.size();\n vll r(100000000);\n r[0]=0;\n for(ll i=0;i>n>>k;\n if(pre[n]>=k)\n {\n cout<<\"YES\";\n }\n else\n {\n cout<<\"NO\";\n }\n \n }", "lang": "GNU C++17", "bug_code_uid": "4dd6b205d1541ddfe0ab8e68c1ec5835", "src_uid": "afd2b818ed3e2a931da9d682f6ad660d", "apr_id": "4539f0408893eafce1b1696dd2ad7fa5", "difficulty": 1000, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9640287769784173, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "#include\nusing namespace std;\nint main(){\n\tint n=5,sm=0;\n\twhile(n--){int a;cin>>a;sm+=a;}\n\tcout<<(sm%5==0? sm/5:-1);\n}\n", "lang": "GNU C++17", "bug_code_uid": "06c1f4b8d5a6e5f1d4fa68f438f2a6f0", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "apr_id": "97cbd81145b108797359385bba9a6c7f", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9722222222222222, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include \n#include\nusing namespace std;\n\nint main()\n{int l,w,h,a1,a2,a3,s;\ncin>>a1>>a2>>a3;\ns=(a1/a2)*a3;\n l=sqrt(s);\n w=a3/l;\n h=a2/w;\n cout<<4*l+4*h+4*w<\n#include \nusing namespace std;\nint main(){\n int a, b,c, m = 0, n = 0; cin >> a >> b;\n for(int i = 1; i <= a; i++){ if(a%i==0) ++m;}\n c = a + 1;\n for(int i = 1; i <= c; i++){\n if(c % i == 0) ++n;\n if(i == c and n != 2){i = 0; ++c; n == 0;}\n }\n cout << (m == 2 and c == b ? \"YES\" : \"NO\");\nreturn 0;\n}", "lang": "GNU C++", "bug_code_uid": "b508defbbe2a1784e23475f6834c3b3d", "src_uid": "9d52ff51d747bb59aa463b6358258865", "apr_id": "5449dbf0d960c1024e3ee8770ecf0095", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.6237288135593221, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "#include \n\nusing namespace std;\n\nint main()\n{\n /*int x, y;\n cin >> x >> y;\n x*=5;\n y*=5;\n x+=2;\n y+=2;*/\n string s;\n cin >> s;\n if(s==\"A278832\")\n cout << 0;\n if(s==\"A089956\")\n cout << 0;\n if(s==\"A089957\")\n cout << 1;\n if(s==\"A144045\")\n cout << 1;\n if(s<\"A100000\")\n assert(0);\n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "af329973d3589733f971e8e9158132da", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "apr_id": "bf201d12d8fb59c6c5c238d2dc2a0917", "difficulty": null, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.793939393939394, "equal_cnt": 19, "replace_cnt": 5, "delete_cnt": 3, "insert_cnt": 10, "fix_ops_cnt": 18, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \"print.hpp\"\n\nusing namespace std;\n\nint inf = 1000000;\n\npair grundy(int n){\n if(n == 1) return make_pair(0, 1);\n vector nums;\n int ret = inf;\n for(int i = 2;i*(i+1)/2 <= n;i++){\n if( (n - i*(i+1)/2 ) % i != 0 ) continue;\n int xorval = 0;\n int base = (n - i*(i+1)/2) / i + 1;\n for(int j = 0; j < i;j++){\n pair grundyval = grundy(base + j);\n xorval ^= grundyval.first;\n }\n nums.push_back(xorval);\n if(xorval == 0){\n ret = min(ret, i);\n } \n } \n \n if(nums.empty()) return make_pair(0, n);\n sort(nums.begin(), nums.end());\n \n // cout << n << endl;\n // print(nums);\n\n if(nums[0] > 0) return make_pair(0, ret);\n for(int i = 1; i< nums.size();i++){\n if(nums[i] - nums[i-1] > 1){\n return make_pair(nums[i] + 1, ret);\n }\n }\n return make_pair(nums[nums.size() - 1] + 1, ret);\n}\n\nint main(){\n int n;\n while(cin >> n){\n pair ans = grundy(n);\n if(ans.first != 0){\n cout << ans.second << endl;\n }else{\n cout << -1 << endl;\n }\n \n }\n}\n", "lang": "GNU C++", "bug_code_uid": "44af6000ce55f0656cc56688db23033d", "src_uid": "63262317ba572d78163c91b853c05506", "apr_id": "9ecdd0f1a55faad8af4d34fde4d27abf", "difficulty": 2000, "tags": ["math", "dp", "games"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9858416360776088, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include\n#include\n#include\n\nusing namespace std;\n\nint s[10234];\nint sg[101234],pre[101234];\n\nint dfs(int n){\n if(n<3)sg[n]=0;\n if(~sg[n])return sg[n];\n vectort;t.clear();\n for(int i=2;s[i]<=n;i++){\n if((n-s[i])%i)continue;\n int b=(n-s[i])/i;\n int res=0;\n for(int j=0;j\n\nconst int ARRAY_LEN = 20000000;\nint d[ARRAY_LEN];\n\nint main()\n{\n\tint cm, in, ft;\n\tint j;\n\n\tscanf(\"%d\", &cm);\n\n\tin = (cm + 1) / 3;\n\tft = in / 12;\n\tin = in % 12;\n\n\tfor(int i = 0; i < 1000000000; i++)\n\t{\n\t\tj = (i + 4096) % ARRAY_LEN;\n\t\td[j] = d[i % ARRAY_LEN];\n\t}\n\n\td[0] = ft;\n\tprintf(\"%d %d\\n\", d[0], in);\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "a1c072b2e11196aa19e9de8d88f54563", "src_uid": "5d4f38ffd1849862623325fdbe06cd00", "apr_id": "f86a784af324158ff927021f31b8585e", "difficulty": 1400, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9980879541108987, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "/*\n * A.cpp\n *\n * Created on: 29.10.2011\n * Author: Altus\n */\n\n#include\n\nconst int ARRAY_LEN = 60000000;\nint d[ARRAY_LEN];\n\nint main()\n{\n\tint cm, in, ft, tmp;\n\n\tscanf(\"%d\", &cm);\n\n\tin = (cm + 1) / 3;\n\tft = in / 12;\n\tin = in % 12;\n\n\tfor(int i = 0, j = 1021; i < 500000000; i++, j++)\n\t{\n\n//\t\tif(j >= ARRAY_LEN) j -= ARRAY_LEN;\n\t\tj = j - j / ARRAY_LEN * ARRAY_LEN;\n\t\ttmp = i - i / ARRAY_LEN * ARRAY_LEN;\n\t\td[j] = d[tmp];\n//\t\td[tmp] = d[i % ARRAY_LEN];\n\t}\n\n\td[0] = ft;\n\tprintf(\"%d %d\\n\", d[0], in);\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "d9c9c1d877a9251d885683e89994e5e5", "src_uid": "5d4f38ffd1849862623325fdbe06cd00", "apr_id": "f86a784af324158ff927021f31b8585e", "difficulty": 1400, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9902461681374826, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\nconst int maxn = 6;\nint In[maxn];\nint l[maxn][maxn];\nint h[maxn][maxn];\nint a[maxn][maxn];\nint n , ans;\n\nvoid dfs(int s,int t,int sum) {\n\tif (t == n) {\n\t\tif (s != n - 2 && In[s] != 0) return ;\n\t\ts ++;\n\t\tt = s + 1;\n\t}\n\tif (s == n - 1) {\n\t\tif (ans < sum) ans = sum;\n\t\treturn ;\n\t}\n\tfor (int i = l[s][t] ; i <= h[s][t] ; i ++) {\n\t\tif (In[s] < i) continue;\n\t\tIn[s] -= i;\n\t\tIn[t] += i;\n\t\tdfs(s , t + 1 , sum + (i ? a[s][t] : 0) + i * i);\n\t\tIn[t] -= i;\n\t\tIn[s] += i;\n\t}\n}\n\nint main() {\n\tscanf(\"%d\",&n);\n\tint m = n * (n - 1) / 2;\n\tint minf = 0 , maxf = 0;\n\twhile (m --) {\n\t\tint s , f;\n\t\tscanf(\"%d%d\",&s,&f);\n\t\ts -- , f --;\n\t\tscanf(\"%d%d\",&l[s][f] , &h[s][f]);\n\t\tscanf(\"%d\",&a[s][f]);\n\t\tif (s == 0) {\n\t\t\tminf += l[s][f];\n\t\t\tmaxf += h[s][f];\n\t\t}\n\t}\n\tans = -1;\n\tmemset(In , 0 , sizeof(In));\n\tfor (int i = minf ; i <= maxf ; i ++) {\n\t\tIn[0] = i;\n\t\tdfs(0 , 1 , 0);\n\t\tif (ans != -1) break;\n\t}\n\tif (ans == -1) In[0] = -1;\n\tprintf(\"%d %d\\n\",In[0] , ans);\n\treturn 0;\n}", "lang": "GNU C++", "bug_code_uid": "da2af7f5746a88cc68455f43c50b782c", "src_uid": "38886ad7b0d83e66b77348be34828426", "apr_id": "ef80b1c27ab6ec14b5b4f5342153593f", "difficulty": 2200, "tags": ["brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9647553918990005, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "#include\nusing namespace std;\nconst int maxn = 15;\nint l[maxn][maxn],h[maxn][maxn],a[maxn][maxn];\nint flow[maxn],n,Max,Min;\nvoid dfs(int x,int y,int cost){\n cout<n){\n if(flag[x]==0)dfs(x+1,x+2,cost);\n return;\n }\n for(int i=l[x][y];i<=h[x][y];i++){\n if(flow[x]\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define ll long long\n#define endl '\\n'\n#define ull unsigned long long\n#define pb push_back\n#define mp make_pair\n#define pii pair\n#define pll pair\n#define pll pair\n#define pull pair\nll MOD=1000000007;\nll inf=1e18;\nusing namespace std;\n\nvector L;\nmap< vector , bool > Mem;\n\nbool Solve()\n{\n int i,j,x,y,a,b,z;\n if(Mem.find(L)!=Mem.end()){return Mem[L];}\n for(i=0;i=0 && L[x][y]=='O')\n {\n L[x][y]='.';\n if(Solve()==false)\n {\n for(a=i,b=j;a<=x;a++,b--){L[a][b]='O';}\n Mem[L]=true;\n return true;\n }\n x++;y--;\n }\n for(a=i,b=j;a\n\n#define ll long long\n\nusing namespace std;\n\nvoid Find_size(int v);\nvoid Build(int root, vector &values);\nvoid Solve();\n\nll RAND(ll n) {\n return abs((rand() << 15) + rand()) % n;\n}\n\nint n;\nvector> g;\nvector> edges;\nvector used;\nvector size;\n\nint Find_centroid(int v, int sz) {\n used[v] = true;\n Find_size(v);\n int max_size = -1;\n for (auto to:g[v]) {\n if (!used[to] && size[to] > sz / 2 && (max_size == -1 || size[to] > size[max_size])) {\n max_size = to;\n }\n }\n int ans;\n if (max_size == -1) {\n ans = v;\n } else {\n ans = Find_centroid(max_size, sz);\n }\n used[v] = false;\n return ans;\n}\n\nvoid Find_size(int v) {\n size[v] = 1;\n used[v] = true;\n for (auto to:g[v]) {\n if (!used[to]) {\n Find_size(to);\n size[v] += size[to];\n }\n }\n used[v] = false;\n}\n\nvoid Build(int root, vector &values) {\n vector val(values.size() + 1, 0);\n int cur_ind = 0;\n used[root] = true;\n queue q;\n q.push(root);\n while (!q.empty()) {\n int cur = q.front();\n q.pop();\n for (auto to:g[cur]) {\n if (!used[to]) {\n used[to] = true;\n q.push(to);\n edges[cur][to] = values[cur_ind++] - val[cur];\n edges[to][cur] = edges[cur][to];\n val[to] = val[cur] + edges[cur][to];\n }\n }\n }\n}\n\nvector parent;\nvector cap;\n\nvoid make_set(int x) {\n parent[x] = x;\n cap[x] = size[x];\n}\n\nint find_set(int x) {\n if (x == parent[x])\n return x;\n return parent[x] = parent[find_set(parent[x])];\n}\n\nvoid union_sets(int x, int y) {\n int a = find_set(x);\n int b = find_set(y);\n if (a != b) {\n if (cap[a] < cap[b])\n swap(a, b);\n parent[b] = a;\n cap[a] += cap[b];\n }\n}\n\nvoid Solve() {\n int c = Find_centroid(0, n);\n Find_size(c);\n\n auto compare = [](int lhs, int rhs) {\n return cap[lhs] > cap[rhs];\n };\n std::priority_queue, decltype(compare)> q(compare);\n\n for (int i = 0; i < n; ++i) {\n if (i == c) {\n continue;\n }\n make_set(i);\n q.push(i);\n }\n\n while (q.size() > 2) {\n int x = q.top();\n q.pop();\n int y = q.top();\n q.pop();\n union_sets(x, y);\n q.push(find_set(x));\n }\n int x = q.top();\n q.pop();\n int y = q.top();\n q.pop();\n vector gr1(cap[find_set(x)]);\n vector gr2(cap[find_set(y)]);\n for (int i = 0; i < (int) gr1.size(); ++i) {\n gr1[i] = i + 1;\n }\n for (int i = 0; i < (int) gr2.size(); ++i) {\n gr2[i] = (i + 1) * gr1.size();\n }\n for (auto i:g[c]) {\n if (find_set(i) == y) {\n used[i] = true;\n }\n }\n Build(c, gr1);\n for (auto i:g[c]) {\n if (find_set(i) == y) {\n used[i] = false;\n }\n }\n Build(c, gr2);\n for (int i = 0; i < n; ++i) {\n used[i] = false;\n }\n}\n\nint main() {\n ios_base::sync_with_stdio(false);\n cin.tie(nullptr);\n cout.tie(nullptr);\n cin >> n;\n g.resize(n);\n used.resize(n);\n edges.resize(n, vector(n, -1));\n size.resize(n);\n parent.resize(n);\n cap.resize(n);\n for (int i = 0; i < n - 1; ++i) {\n int u, v;\n cin >> u >> v;\n u--, v--;\n g[u].push_back(v);\n g[v].push_back(u);\n }\n Solve();\n for (int i = 0; i < n; ++i) {\n for (int j = i + 1; j < n; ++j) {\n if (edges[i][j] >= 0) {\n cout << i + 1 << ' ' << j + 1 << ' ' << edges[i][j] << endl;\n }\n }\n }\n return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "2faabab993777901d662b6f203e15be8", "src_uid": "87d755df6ee27b381122062659c4a432", "apr_id": "5ed518e0822433486fc15b067a712af1", "difficulty": 2700, "tags": ["trees", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9775481111903065, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 6, "bug_source_code": "#include \nusing namespace std;\n//{\n #ifdef lawfung\n #define debug(...) do {\\\n fprintf(stderr, \"%s - %d : (%s) = \", __PRETTY_FUNCTION__, __LINE__, #__VA_ARGS__);\\\n _DO(__VA_ARGS__);\\\n }while(0)\n template void _DO(I&&x) {cerr << x << '\\n';}\n template void _DO(I&&x,T&&...tail) {cerr << x << \", \"; _DO(tail...);}\n #else\n #define debug(...)\n #endif\n typedef long long ll;\n typedef pair pii;\n typedef pair pll;\n typedef pair pdd;\n typedef long double ld;\n #define F first\n #define S second\n #define ALL(x) (x).begin(),(x).end()\n #define SZ(x) (ll)x.size()\n #define pb push_back\n #define eb emplace_back\n #define stp setprecision(30)< adj[MAX];\nint sz[MAX];\nint mma[MAX];\nvoid dfs(int u, int v) {\n sz[u] = 1;\n int ma = 0;\n for(int i : adj[u]) {\n if(i == v) continue;\n dfs(i, u);\n ma = max(ma, sz[i]);\n sz[u] += sz[i];\n }\n ma = max(ma, n - sz[u]);\n mma[u] = ma;\n}\nint findg() {\n for(int i = 1; i <= n; ++ i) {\n if(mma[i] * 2 <= n )\n return i;\n }\n assert(0);\n}\npll gg(vector v) {\n if(n < 3)\n return pll(0, 0);\n ll now = 0;\n for(int i = 0;; ++ i) {\n now += v[i].F;\n if( (now + 1) * ( n - now ) - 1 >= 2 * n * n / 9) {\n return pll(i + 1, now);\n }\n }\n assert(0);\n}\nll st, mp;\nvoid D(int u, int v, ll now = 0) {\n ll tt = st - now;\n cout << u << ' ' << v << ' ' << tt * mp << '\\n';\n ++st;\n for(int i : adj[u]) {\n if(i == v) continue;\n D(i, u, now + tt);\n }\n return;\n}\nint main() {\n //ios_base::sync_with_stdio(0); cin.tie(0);\n cin >> n;\n for(int i = 1; i < n; ++ i) {\n int a, b;\n cin >> a >> b;\n adj[a].eb(b);\n adj[b].eb(a);\n }\n int g = findg();\n dfs(g, g);\n ll all = n - 1;\n vector v;\n for(int i : adj[g] ) {\n v.eb(sz[i], i);\n }\n sort(ALL(v));\n pll c = gg(v);\n st = 1;\n mp = 1;\n for(int i = 0; i < c.F; ++ i ) {\n D(v[i].S, g);\n }\n st = 1;\n mp = c.S + 1;\n for(int i = c.F; i < SZ(v); ++ i) {\n D(v[i].S, g);\n }\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "58e4f64790eb854785a76cc4029d4bc8", "src_uid": "87d755df6ee27b381122062659c4a432", "apr_id": "05c67b05e48aaab730f5d8ca05044c01", "difficulty": 2700, "tags": ["trees", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9997525365008662, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "/*\nID : moreda\nPROG : contest 281 B\nLANG : C++\n*/\n/*\n{I'm just a step away\nI'm just a breath away\nLosing my faith today\n(Falling off the edge today)\nI am just a man\nNot superhuman\n(I'm not superhuman)\nSomeone save me from the hate!\n\nIt's just another war\nJust another family torn\n(Falling from my faith today)\nJust a step from the edge\nJust another day in the world we live\n\nI need a hero to save me now\nI need a hero\n(Save me now)\n\nI need a hero to save my life\nA hero'll save me\n(Just in time)\n\nI gotta fight today\nTo live another day\nSpeaking my mind today\n(My voice will be heard today)\nI've gotta make a stand\nBut I am just a man\n(I'm not superhuman)\nMy voice will be heard today!\n\nIt's just another war\nJust another family ton\n(My voice will be heard today)\nIt's just another kill\nThe countdown begins to destroy ourselves\n\nI need a hero to save me now\nI need a hero\n(Save me now)\nI need a hero to save my life\nA hero will save me\n(just in time)\n\nI need a hero to save my life\nI need a hero\nJust in time!\nSave me just in time\nSave me just in time\n\nWho's gonna fight for what's right\nWho's gonna help us survive\nWe're in the fight of our lives\n(And we're not ready to die)\n\nWho's gonna fight for the weak\nWho's gonna make 'em believe\nI've got a hero\n(I've got a hero)\nLiving in me\n\nI'm gonna fight for what's right\nToday I'm speaking my mind\nAnd if it kills me tonight\n(I will be ready to die)\n\nA hero's not afraid to give his life\nA hero's gonna save me just in time\n\nI need a hero to save me now\nI need a hero\n(Save me now)\nI need a hero to save my life\nA hero will save me\n(Just in time)\nI need a hero!\n\nWho's gonna fight for what's right\nWho's gonna help us survive\n\nI need a hero!\n\nWho's gonna fight for the weak\nWho's honna make 'em believe\n\nI need a hero!\nI need a hero!\n\nA hero's gonna save me just in in time!!!}*/\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#define ll long long\n#define ii pair\n#define vi vector\n#define vs vector\n#define pb push_back\n#define fo(i,a,b) for(int i=a; i=a; --i)\n#define mp(a,b) make_pair(a,b)\n#define fi first\n#define se second\n#define pi 3.141592653589793\n#define ee 2.71828\n#define BE(a) a.begin(),a.end()\n#define rev(a) reverse(BE(a))\n#define ss(a) stable_sort(BE(a))\n#define st(a) sort(BE(a))\n#define point complex \n#define X real()\n#define Y imag()\n#define lb(a,b,c) lower_bound(a,b,c)\n\nusing namespace std;\nstruct num\n{\n\tdouble z;\n\tint x;\n\tint y;\n};\nstruct nam\n{\n\tint y;\n\tdouble z;\n\tint x;\n};\nconst int maxN = 1 * 100000 + 10, mod = (int) 1e9 + 7;\nconst double ep = 1e-16;\n\nvector v;vector w;\nnum nn;\nint n;\n\nbool cmp1 (num s1, num s2)\n{\n\tif(s1.z == s2.z)\n\t{\n\t\tif(s1.y < s2.y)\n\t\t\treturn 1;\n\t\telse\n\t\t\treturn 0;\n\t}\n\telse if(s1.z < s2.z)\n\t\treturn 1;\n\telse \n\t\treturn 0;\n}\nbool cmp2 (nam s1, nam s2)\n{\n\tif(s1.y == s2.y)\n\t{\n\t\tif(s1.x < s2.x)\n\t\t\treturn 1;\n\t\telse\n\t\t\treturn 0;\n\t}\n\telse if(s1.y < s2.y)\n\t\treturn 1;\n\telse \n\t\treturn 0;\n}\nint main(void)\n{\n\t//ifstream cin(\"input.txt\");\n ios_base::sync_with_stdio (0);\n\tdouble h;\n\tdouble h2,tel = 0;\n\tcin >> nn.x >> nn.y >> n;\t\n\tnn.z = 0;\n\tnum t;\n\tnam sw;\n\tdouble dd = (double)nn.x / nn.y;\n\tfo(i,1,n+1)\n\t{\n\t\t h = floor((double)dd * i);\n\t\t h2= abs(((double)h / i) - dd);\n\t\t t.x=(int)h;\n\t\t t.y=i;\n\t\t t.z=h2;\n\t\t v.pb(t);\n\t\t h = ceil((double)dd* i);\n\t\t h2= abs(((double)h / i) - dd);\n\t\t t.x=(int)h;\n\t\t t.y=i;\n\t\t t.z=h2;\n\t\t v.pb(t);\n\t}\n\tsort(v.begin(),v.end(),cmp1);\n\tint hh = 0;\n\twhile(abs(tel) < ep && hh < v.size())\n\t{\n\t\tsw.x=v[hh].x;\n\t\tsw.y=v[hh].y;\n\t\tsw.z=v[hh].z;\n\t\tw.pb(sw);\n\t\thh++;\n\t\tif(hh \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define M 1000000007\nusing namespace std;\ntypedef long long LL;\nconst int maxn = 100005;\nLL n,m,g;\nLL C,dp[maxn];\n\nvoid extend_gcd(LL a, LL b, LL &x, LL &y, LL d=1)\n{\n if (b == 0)\n {\n d = a, x = 1, y = 0;\n }\n else\n {\n extend_gcd(b, a%b, y, x, d);\n y -= a/b*x;\n }\n}\n\nLL ni(LL x)\n{\n LL p,q;\n extend_gcd(x,M,p,q);\n return p;\n}\n\nint main()\n{\n while(cin>>m>>n>>g)\n {\n if(g == 1)\n {\n if(m == 0)\n {\n puts(\"0\"); continue;\n }\n else\n {\n m--;\n g = 0;\n }\n }\n if(n == 0)\n {\n if(m % 2 == 1 - g) puts(\"1\");\n else puts(\"0\");\n continue;\n }\n\n if(m == 0)\n {\n if(n == 1) cout << g << endl;\n else\n cout << 1-g << endl;\n continue;\n }\n m -= g;\n C = n + 1; // C[n+1][1]\n if(n == 1) dp[1] = 2;\n else dp[1] = n;\n\n for(int i=2; i<=m; i++)\n {\n C = C * (n + i) % M;\n C = C * ni(i) % M;\n C %= M;\n\n dp[i] = (C - dp[i-1]) % M;\n dp[i] = (dp[i] + M) % M;\n }\n cout << dp[m] << endl;\n }\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "7a94f4875a205e62e1e4cfa5164a76f9", "src_uid": "066dd9e6091238edf2912a6af4d29e7f", "apr_id": "d85c7e9f7088f1ef69955977e6eddb19", "difficulty": 2100, "tags": ["math", "combinatorics", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.04753521126760563, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 4, "insert_cnt": 0, "fix_ops_cnt": 9, "bug_source_code": "#include\n#include\n#include\nusing namespace std;\nconst int N=500005;\nint n, ans, m, p[N];\nset > s;\n\nbool check(int x)\n{\n for (auto p:s)\n\t{\n int u=(p.first+x)%n, v=(p.second+x)%n;\n if (u>v) swap(u, v);\n if (s.find(make_pair(u, v))==s.end()) return 0;\n }\n return 1;\n}\n\ninline int read()\n{\n \tint x=0,f=1;char ch=getchar();\n\tfor (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;\n\tfor (;ch>='0'&&ch<='9';ch=getchar()) x=(x<<1)+(x<<3)+ch-'0';\n\treturn x*f;\n}\n\nint main()\n{\n for (int i=2; iv) swap(u,v);\n s.insert(make_pair(u,v));\n }\n for (int i=2; i\n#include \n\nusing namespace std;\n\ndeque a,b,aa,bb;\nint n,k1,k2;\n\nint fn(int cnt)\n{\n if(a.empty()) return cnt;\n if(b.empty()) return -cnt;\n\n if(cnt)\n {\n bool bo=1;\n for(int i = 0 ; i < k1 && bo; i++)\n {\n if(a[i]!=aa[i]) bo=0;\n }\n for(int i = 0 ; i < k2 && bo; i++)\n {\n if(b[i]!=bb[i]) bo=0;\n }\n if(bo) return 0;\n }\n\n int x=a.front(),y=b.front();\n a.pop_front();\n b.pop_front();\n if(x>y){a.push_back(y);a.push_back(x);}\n else if(y>x){b.push_back(x);b.push_back(y);}\n\n return fn(cnt+1);\n}\n\nint main()\n{\n int x,y;\n cin >> n;\n cin >> k1;\n for(int i = 0 ; i < k1 ; i++) {cin >> x; a.push_back(x);}\n cin >> k2;\n for(int i = 0 ; i < k2 ; i++) {cin >> y; b.push_back(y);}\n\n aa=a; bb=b;\n int cnt=fn(0);\n\n if(cnt==0) cout << \"-1\";\n else if(cnt>0) cout << cnt << ' ' << 2;\n else if(cnt<0) cout << -cnt << ' ' << 1;\n\n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "72c34fa5e830ba158cd997afd7b15153", "src_uid": "f587b1867754e6958c3d7e0fe368ec6e", "apr_id": "1acc3b99090410f63a3674a5fcce32c4", "difficulty": 1400, "tags": ["brute force", "games", "dfs and similar"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8254716981132075, "equal_cnt": 10, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 9, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include\n#include \n#include \n#include \n#include \n#include\n#include \n#include \nusing namespace std;\ntypedef long long ll;\n#define in(a) scanf(\"%lld\",&a)\n#define F(i,a,b) for(ll i=a;i<=b;i++)\n#define mp make_pair\n#define pb push_back \n#define X first\n#define Y second\n#define MOD (ll)3046201\n \n/*#define gc getchar_unlocked\n \nvoid in(ll &x)\n{\n register ll 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}\n*/\nll exp(ll a,ll b){\n \n if(b==0)\n return 1;\n \n if(b&1)\n return a*exp(a,b-1);\n \n else{\n ll ans=exp(a,b/2);\n return ans*ans;\n }\n \n }\n\nint main(){\n ll k,b,n,t,arr[1000001];\n cin>>k>>b>>n>>t;\n \n ll expo;\n \n if(k!=1){\n ll part1=log(b+k*t-t);\n ll part2=log(b+k-1);\n ll part3=floor( ( part1-part2) / (ll)log(k) );\n cout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#ifdef WIN32\n #define I64 \"%I64d\"\n#else\n #define I64 \"%lld\"\n#endif // WIN32\n\n#define next(x) (x + ((x) & (-x)))\n#define prev(x) (x - ((x) & (-x)))\n#define N 1000000\n#define md 10000007\n#define sqr(x) ((x) * (x))\n#define INF (1 << 30)\n#define EPS 0.00000001\n\nusing namespace std;\n\nlong long f(long long x) {\n long long res = 1ll * 4 * x + 1ll * 3 * x * x - 1ll * 3 * x;\n return res / 2;\n}\n\nint main() {\n #ifdef DEBUG\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 // DEBUG\n srand(time(NULL));\n long long n;\n cin >> n;\n long long l = 0;\n long long r = 10000000001ll;\n while (l < r) {\n long long mid = (l + r + 1) / 2;\n if (f(mid) > n) {\n r = mid - 1;\n } else {\n l = mid;\n }\n }\n\n while ((n - f(l)) % 3 != 0) {\n l--;\n }\n cout << 1 + (l - 1) / 3 << endl;\n\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "99f72cb487348a7d50e86272b321ee81", "src_uid": "ab4f9cb3bb0df6389a4128e9ff1207de", "apr_id": "fd3a2bf93b82b653aa326175f3eba411", "difficulty": 1700, "tags": ["math", "brute force", "greedy", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9947534102833159, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include\n#include\n#include\n#include\n\n#include\nusing namespace std;\nint a[233];\nvector v;\nint main(){\n int n,m;\n cin>>n>>m;\n for(int i=0;i>a[i];\n }\n sort(a,a+n);\n for(int i=0;i\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\n\n#define pb(p) push_back(p)\n#define fr(i,a,b) for(int i=a;i=b i--)\n#define PI 2*acos(0.0)\n#define mp make_pair\n#define all(x) (x).begin(),(x).end()\n#define sz(x) (int)(x).size()\n\nint MIN (int a, int b) {\n int x= (b>a)?a:b;\n return x;\n}\n\nint MAX(int a, int b) {\n int x= (bprime;\n__int64 count[maxn+10];\nbool visit[maxn+10];\n\nvoid make_prime(){\n int i,j;\n int pos1=sqrt((double)maxn)+1;\n\tvisit[1]=true;\n\tvisit[4]=true;\n\tvisit[6]=true;\n\tvisit[8]=true;\n for(i=3;i<=pos1;i++)\n\t{\n\t\tif(visit[i]==false)\n\t\t{\n\t\t\tfor(j=i*i;j<=maxn;j=j+i+i)\n\t\t\tvisit[j]=true;\n\t\t}\n\t}\n prime.push_back(2);\n for(j=3;j<=maxn;j+=2)\n if( visit[j]==false )prime.push_back(j);\n}\n*/\ntypedef long long ll;\nconst int size = 1000007;\nconst ll modulo = 1000000007;\nconst ll inf = 1e18;\nconst double eps = 1e-6;\nll t,n,p,m,b[4000],k,n25,n50,n100;\nbool flg[1000][1000];\nint a[100009];\n\nint main()\n{\n\twhile(cin>>n>>m)\n\t{\n\t\tll ase = n*100+m*10;\n\n\t\tll cnt = 0;\n\n\t\twhile(ase>=220)\n\t\t{\n\t\t\tif(cnt%2==0)\n\t\t\t{\n\t\t\t\tif(n>=2)\n\t\t\t\t{\n\t\t\t\t\tn--;n--;\n\t\t\t\t\tif(m>=2)\n\t\t\t\t\t{\n\t\t\t\t\t\tm-=2;\n\t\t\t\t\t}\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tint less = 220- (n*100);\n\t\t\t\t\tint j = less/m;\n\t\t\t\t\tn=0;\n\t\t\t\t\tm = m-j;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t\tase-=220;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(m>=22)\n\t\t\t\t{\n\t\t\t\t\tm-=22;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif(m>=12)\n\t\t\t\t\t{\n\t\t\t\t\t\tm-=12;\n\t\t\t\t\t\tn--;\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t}\n\t\t\t\t\telse if(m>=2)\n\t\t\t\t\t{\n\t\t\t\t\t\tm-=2;\n\t\t\t\t\t\tn-=2;\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t}\n\n\t\t\t\t\tase-=220;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif(cnt%2==0)\n\t\t\tcout<<\"Hanako\\n\";\n\t\telse cout<<\"Ciel\\n\";\n\t}\n\treturn 0;\n}\n\n", "lang": "MS C++", "bug_code_uid": "05658efb66cbf59073fb81e9b114c305", "src_uid": "8ffee18bbc4bb281027f91193002b7f5", "apr_id": "98a640be418c6918fa135e076089a3f2", "difficulty": 1200, "tags": ["greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9916743755781684, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \nusing namespace std;\n#define ll long long\n#define ld long double\n#define pb push_back\n#define mp make_pair\n#define F first\n#define S second\n#define Need_for_speed \tios_base::sync_with_stdio(0);\nint main(){\n\tNeed_for_speed;\n\tint n;\n\tcin>>n;\n\tif(n == 1){\n\t\tcout<<\"0 1\";\n\t\treturn 0;\n\t}\n\tint m=n,sum=0,num=0;\n\twhile(n > 0){\n\t\tif(n > 1){\n\t\t\tsum+=2;\n\t\t\tn-=7;\n\t\t}\n\t\telse{\n\t\t\tsum+=n;\n\t\t}\n\t}\n\twhile(m > 0){\n\t\tm-=5;\n\t\tif(m > 1){\n\t\t\tnum+=2;\n\t\t\tm-=2;\n\t\t}\n\t\telse if(m == 1){\n\t\t\tnum++;\n\t\t\tm--;\n\t\t}\n\t}\n\tcout<\nint main()\n{\n int i,j,sawp,n,y,z,x[100],c=0;\n scanf(\"%d %d %d\",&n,&y,&z);\n for(i=0;ix[j+1]){\n sawp=x[j];\n x[j]=x[j+1];\n x[j+1]=sawp;\n\n }\n }\n }\n for(i=0;iz){\n c++;\n y=y-x[i]-1;\n }\n }\n if(c==0)printf(\"-1\");\n else printf(\"%d\",c);\nwhile(1);\n}", "lang": "GNU C++", "bug_code_uid": "1d735e122b08d7152de6d88d2c892f2d", "src_uid": "b32ab27503ee3c4196d6f0d0f133d13c", "apr_id": "0719eba6b179e441c1a4c66a380d87f4", "difficulty": 1100, "tags": ["greedy", "sortings", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9871489766777725, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "#include\n#include\n#include\nusing namespace std;\ntypedef long long ll;\ntypedef array a10;\nstring l,r;\nll ans=0;\nint f(char c){\n\treturn c-48;\n}\nint c[101][101];\nvoid tmw(){\n\tc[0][0]=1;\n\tfor(int i=1; i<=100 ;i++){\n\t\tc[i][0]=1;\n\t\tfor(int j=1; j<=i ;j++) c[i][j]=c[i-1][j-1]+c[i-1][j];\n\t}\n}\nint g(int mk,int len,a10 rem){\n\tfor(int i=0; i<10 ;i++) len-=rem[i];\n\tint cnt=0;\n\tfor(int i=0; i<10 ;i++) cnt+=((mk&(1<v;\na10 iu,zero;\nint main(){\n\tios::sync_with_stdio(false);tmw();\n\tcin >> l >> r;\n\treverse(l.begin(),l.end());reverse(r.begin(),r.end());\n\twhile(l.size()\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define max(x,y) ((x)>(y)?(x):(y))\n#define min(x,y) ((x)>(y)?(y):(x))\n\nusing namespace std;\n\nchar SG[1100000000];\nbool pd[100005];\nint n;\nint getsg(int S)\n{\n\tif(SG[S]!=-1) return SG[S];\n\tbool hash[32]={0};\n\tfor(int i=1; i<=30; i++)\n\tif(S&(1<<(i-1)))\n\t{\n\t\tint tmS=S;\n\t\tfor(int j=i; j<=30; j+=i)\n\t\t\tif(tmS&(1<<(j-1))) tmS-=1<<(j-1);\n\t\thash[getsg(tmS)]=1;\n\t}\n\tfor(int i=0; i<=30; i++)\n\tif(!hash[i])\n\t\treturn SG[S]=i;\n}\nint main()\n{\n\tmemset(SG,-1,sizeof(SG));\n\tSG[0]=0;\n\tgetsg((1<<30)-1);\n\tscanf(\"%d\",&n);\n\tint ans=1;\n\tmemset(pd,0,sizeof(pd));\n\tint i,cut=0;\n\tfor(i=2; i<=floor(sqrt(n)); i++)\n\tif(!pd[i])\n\t{\n\t\tint num=0;\n\t\tfor(int j=i; j<=n; j*=i)\n\t\t{\n\t\t\tif(j<=floor(sqrt(n))) pd[j]=1;\n\t\t\telse cut++;\n\t\t\t++num;\n\t\t}\n\t\tans^=SG[(1<\nusing namespace std;\nint main(){\n\n double x,y,z;\n cin>>x>>y>>z;\n double ninf = -1 * numeric_limits::max();\n\n double a=ninf,b=ninf,c=ninf,d=ninf,e=ninf,f=ninf,g=ninf,h=ninf,i=ninf;\n double m;\n string res;\n\n assert(log(x)!=0);\n assert(log(y)!=0);\n assert(log(z)!=0);\n\n if(log(x)<0 && log(y)<0 && log(z)<0){\n\n a = z*log(y)+log(-log(x));\n b = y*log(z)+log(-log(x));\n c = log(y*z*-log(x));\n\n d = z*log(x)+log(-log(y));\n e = x*log(z)+log(-log(y));\n f = log(x*z*-log(y));\n\n g = y*log(x)+log(-log(z));\n h = x*log(y)+log(-log(z));\n i = log(x*y*-log(z));\n\n\n m = a; res = \"x^y^z\";\n if(b0){\n a = z*log(y)+log(log(x));\n b = y*log(z)+log(log(x));\n c = log(y*z*log(x));\n }\n\n if(log(y)>0){\n d = z*log(x)+log(log(y));\n e = x*log(z)+log(log(y));\n f = log(x*z*log(y));\n }\n\n\n if(log(z)>0){\n g = y*log(x)+log(log(z));\n h = x*log(y)+log(log(z));\n i = log(x*y*log(z));\n }\n\n m = a; res = \"x^y^z\";\n if(b>m)m = b,res = \"x^z^y\";\n if(c>m)m = c,res = \"(x^y)^z\";\n\n if(d>m)m = d,res = \"y^x^z\";\n if(e>m)m = e,res = \"y^z^x\";\n if(f>m)m = f,res = \"(y^x)^z\";\n\n if(g>m)m = g,res = \"z^x^y\";\n if(h>m)m = h,res = \"z^y^x\";\n if(i>m)m = i,res = \"(z^x)^y\";\n\n printf(\"%s\\n\",res.c_str());\n }\n}\n", "lang": "GNU C++11", "bug_code_uid": "5242f9708765448d2027bf8dd70ffab2", "src_uid": "a71cb5cda754ad2bf479bc3b0164fc4c", "apr_id": "9679afff8b04484c7fed2cf446c1cfb5", "difficulty": 2400, "tags": ["brute force", "math", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5725047080979284, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "#include \n#include \n#include \n#include \n\nusing namespace std;\n\nlong long n, res = 0;\n\nvector v(2);\n\nint main()\n{\n\tcin >> n;\n\tv[0] = 1;\n\tv[1] = 6;\n\tfor (int i = 2; i <= n; i++)\n\t{\n\t\tv.push_back(v[i - 1] + 6);\t\n\t}\n\tfor (int i = 0; i <= n; i++)\n\t{\n\t\tres += v[i];\n\t}\n\tcout << res;\n\n\treturn 0;\n}\n", "lang": "MS C++", "bug_code_uid": "23b4eb6bf93fe4ce0f3c6cb6f95728ee", "src_uid": "c046895a90f2e1381a7c1867020453bd", "apr_id": "f01f396bb7f294f4b257b4bef8e6898f", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8033826638477801, "equal_cnt": 14, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 13, "bug_source_code": "#include\nusing namespace std;\n#define ll long long\n#define sc second\n#define fr first\n#define pb push_back\n#define ARRS int(2e6+10)\n\n\nll i,j,k,p,mx,l,m,n,c,h,d,N,M,mn,t,a[ARRS],pas,ans,e;\nvector v;\nmapfx;\n\n\nint main(){\n #ifdef KHOKHO\n freopen(\"in.in\",\"r\",stdin);\n freopen(\"out.out\",\"w+\",stdout);\n #endif\n\n cin>>n;\n d=1;\n for(int i=0; i>a[i];\n d=d*a[i];\n }\n ll pas=0;\n for(int i=0; i>p;\n k=p;\n while(k\n#include \n#include \nusing namespace std;\n\nconst int modbase = 1000000007;\nint n, a, b, k;\nint sqmat[5001][5001], res[5001][5001], temp[5001][5001];\n\nvoid mul(int A[5001][5001], int B[5001][5001]) {\n\tfor (int i=1; i<=n; ++i)\n\t\tfor (int j=1; j<=n; ++j) {\n\t\t\ttemp[i][j] = 0;\n\t\t\tfor (int k=1; k<=n; ++k)\n\t\t\t\ttemp[i][j] = (temp[i][j] + (long long)A[i][k]*B[k][j])%modbase;\n\t\t}\n\t\n\tfor (int i=1; i<=n; ++i)\n\t\tfor (int j=1; j<=n; ++j)\n\t\t\tA[i][j] = temp[i][j];\n}\n\nint main() {\n\tcin >> n >> a >> b >> k;\n\tfor (int i=1; i<=n; ++i) {\n\t\tfor (int j=1; j<=n; ++j) {\n\t\t\tres[i][j] = 0;\n\t\t\tsqmat[i][j] = 0;\n\t\t}\n\t\t\n\t\tfor (int j=max(1,2*i-b+1); j>shift)!=0; ++shift) {\n\t\tmul(sqmat,sqmat);\n\t\tif ((k>>shift)&1)\n\t\t\tmul(res,sqmat);\n\t}\n\t\n\tint sum = 0;\n\tfor (int i=1; i<=n; ++i)\n\t\tsum = (sum+res[a][i])%modbase;\n\tcout << sum << endl;\n\treturn 0;\n}\n", "lang": "GNU C++0x", "bug_code_uid": "ffd9535430e45394827fe1520b1b57a3", "src_uid": "142b06ed43b3473513995de995e19fc3", "apr_id": "c28298a4f001a97addd5df752565a5e0", "difficulty": 1900, "tags": ["dp", "combinatorics", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.87115165336374, "equal_cnt": 12, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 11, "bug_source_code": "#include\n#define ll long long\n#define mod 1000007\n#define pb push_back\nusing namespace std;\ntypedef pairp;\nmap mp;\nvectorv[200005];\nint visited[200005];\nvector

v1;\nint total;\nint ma;\nint main()\n{\nll int n,a,d,b,c,p,q;\nstd::ios::sync_with_stdio(false);cin.tie(0);\ncin>>n;\ncin>>a>>b>>c;\nif(a<=b-c){\n\tcout<\n#define mes(a, b) memset(a, b, sizeof a)\n#define pb push_back\nusing namespace std;\ntypedef long long ll;\nconst ll mod = 998244353;\nconst int maxn = 1e6+10;\nint T, len;\nstring s[118] = {\"H\",\"HE\",\"LI\",\"BE\",\"B\",\"C\",\"N\",\"O\",\"F\",\"NE\",\"NA\",\"MG\",\"AL\",\n\"SI\",\"P\",\"S\",\"CL\",\"AR\",\"K\",\"CA\",\"SC\",\"TI\",\"V\",\"CR\",\"MN\",\"FE\",\"CO\",\"NI\",\"CU\",\n\"ZN\",\"GA\",\"GE\",\"AS\",\"SE\",\"BR\",\"KR\",\"RB\",\"SR\",\"Y\",\"ZR\",\"NB\",\"MO\",\"TC\",\"RU\",\"RH\",\n\"PD\",\"AG\",\"CD\",\"IN\",\"SN\",\"SB\",\"TE\",\"I\",\"XE\",\"CS\",\"BA\",\"HF\",\"TA\",\"W\",\"RE\",\"OS\",\n\"IR\",\"PT\",\"AU\",\"HG\",\"TL\",\"PB\",\"BI\",\"PO\",\"AT\",\"RN\",\"FR\",\"RA\",\"RF\",\"DB\",\"SG\",\"BH\",\n\"HS\",\"MT\",\"DS\",\"RG\",\"CN\",\"NH\",\"FL\",\"MC\",\"LV\",\"TS\",\"OG\",\"LA\",\"CE\",\"PR\",\"ND\",\"PM\",\n\"SM\",\"EU\",\"GD\",\"TB\",\"DY\",\"HO\",\"ER\",\"TM\",\"YB\",\"LU\",\"AC\",\"TH\",\"PA\",\"U\",\"NP\",\"PU\",\n\"AM\",\"CM\",\"BK\",\"CF\",\"ES\",\"FM\",\"MD\",\"NO\",\"LR\"};\nmap mp;\nstring ch;\nint flag;\nvoid dfs(int pos){\n if(pos == len)\n flag = 1;\n if(flag) return;\n if(mp[ch.substr(pos, 1)])\n dfs(pos+1);\n if(pos+1 < len &&mp[ch.substr(pos,2)])\n dfs(pos+2);\n}\n\nint main(){\n for(int i = 0; i <118; i++)\n mp[s[i]] = 1;\n while(1){\n cin>>ch;\n flag =0;\n len = ch.length();\n dfs(0);\n puts(flag?\"YES\":\"NO\");\n }\n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "de16817277d472cabc878d6073bdddfc", "src_uid": "d0ad35798119f98320967127c43ae88d", "apr_id": "e9e11542803c35aecf1de3a54db4b3b5", "difficulty": null, "tags": ["dp", "brute force", "strings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9970414201183432, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n int n;\n cin>>n;\n int a1[n],a2[n];\n for(int i=0;i>a1[i]>>a2[i];\n }\n int count=0;\n for(int i=0;i\n#include \nusing namespace std;\n\nint main() \n{\n long long int num,k;\n cin>>num>>k;\n num = (num%2)? num/2 : (num+1)/2;\n cout << ((k<=num)? (2*k-1) : (k-num)*2);\n return 0;\n}", "lang": "MS C++ 2017", "bug_code_uid": "fd895790537dc2bf6ea88c72b4eac4a6", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "apr_id": "109bc44969eba79c93e4426955ef17da", "difficulty": 900, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9989694263139814, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include\n#define mod 1000000007\n#define maxn 10010\nusing namespace std;\ntypedef long long ll;\ntypedef pair pii;\nint dx[4]={-1,0,1,0};\nint dy[4]={0,-1,0,1};\nint n,m,anses[maxn],a[maxn][maxn],R,pi[10],ptr;\nmapst;\nint qpow(int a,int b){\n\tint ans=1;\n\tfor(;b;b>>=1,a=1ll*a*a%mod)\n\t\tif(b&1)ans=1ll*ans*a%mod;\n\treturn ans;\n}\nint main(){\n\tscanf(\"%d\",&R);\n\tint sum=0;\n\tfor(int i=0;i<4;++i)scanf(\"%d\",&pi[i]),sum=(sum+pi[i])%mod;\n\tsum=qpow(sum,mod-2);\n\tfor(int i=0;i<4;++i)pi[i]=(ll)pi[i]*sum%mod;\n\tfor(int i=-R;i<=R;++i)\n\t\tfor(int j=-R;j<=R;++j)\n\t\t\tif(i*i+j*j<=R*R)st[pii(i,j)]=++ptr;\n\tfor(auto p:st){\n\t\ta[p.second][p.second]++;\n\t\tfor(int i=0;i<4;++i){\n\t\t\tint px=p.first.first+dx[i];\n\t\t\tint py=p.first.second+dy[i];\n\t\t\tif(st.find(pii(px,py))==st.end())continue;\n\t\t\ta[p.second][st[pii(px,py)]]=mod-pi[i];\n\t\t}\n\t\ta[p.second][ptr+1]++;\n\t}\n\tfor(int i=1,j=1;i<=ptr;++i){\n\t\tfor(j=i;j<=ptr&&!a[j][i];++j);\n\t\tif(j==ptr+1)continue;\n\t\tfor(int k=i;k<=ptr+1;++k)swap(a[j][k],a[i][k]);\n\t\tint iv=qpow(a[i][i],mod-2);\n\t\tvectorf;\n\t\tfor(int k=i;k<=ptr+1;++k)if(a[i][k])f.push_back(k);\n\t\tfor(int k=i;k<=ptr;++k)if(i!=k&&a[k][i]){\n\t\t\tint t=1ll*a[k][i]*iv%mod;\n\t\t\tfor(auto p:f)a[k][p]=(a[k][p]-(ll)t*a[i][p]%mod+mod)%mod;\n\t\t}\n\t}\n\tint z=st[pii(0,0)];\n\tfor(int i=ptr;i>=z;--i){\n\t\tint b=a[i][ptr+1];\n\t\tfor(int j=ptr;j>=i;--j)\n\t\t\tif(a[i][j])b=(b-(ll)a[i][j]*anses[j]%mod+mod)%mod;\n\t\tanses[i]=(ll)b*qpow(a[i][i],mod-2)%mod;\n\t}\n\tprintf(\"%d\",anses[z]);\n} ", "lang": "GNU C++11", "bug_code_uid": "11dfa778b4f5d2a629d24120d63ccf0a", "src_uid": "bd6bcb5bffd039de93f217b02f5eae17", "apr_id": "de9558e6f2c21a2e85309a913afde3d1", "difficulty": 3100, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9016393442622951, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "#include \nusing namespace std;\n\nint correctSub(int n, int k);\n\nint main() {\n int n, k;\n\n cin >> n >> k;\n\n return correctSub(n, k);\n}\n\nint correctSub(int n, int k){\n int i = 0;\n while(i < k) {\n if(n%10 == 0){\n while(n%10 == 0){\n n /= 10;\n i++;\n }\n }\n else {\n n--;\n i++;\n }\n }\n return n; \n}", "lang": "MS C++ 2017", "bug_code_uid": "7808d40110be75b3ef3f639f38e94960", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "1b0be23b0f0ead7a99fe3d21b43085aa", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9994869163673679, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include\n#include\nusing namespace std;\nint main()\n{\n string arr[3];\n int r=0, sc=0, p=0;\n cin >> arr[0] >> arr[1] >> arr[2];\n for (int i = 0; i < 3; i++)\n {\n if (arr[i] == \"paper\")\n p++;\n else if (arr[i] == \"rock\")\n r++;\n else if (arr[i] == \"scissors\")\n sc++;\n }\n if (r == 1 && sc == 2)\n {\n if (arr[0] == \"rock\")\n cout << \"F\";\n else if ((arr[1] == \"rock\"))\n cout << \"M\";\n else cout << \"S\";\n }\n else if (sc = 1 && p == 2)\n {\n if (arr[0] == \"scissors\")\n cout << \"F\";\n else if ((arr[1] == \"scissors\"))\n cout << \"M\";\n else cout << \"S\";\n }\n else if (p == 1 && r == 2)\n {\n if (arr[0] == \"paper\")\n cout << \"F\";\n else if ((arr[1] == \"paper\"))\n cout << \"M\";\n else cout << \"S\";\n \n }\n else cout << \"?\" ;\n \n return 0;\n \n}", "lang": "GNU C++11", "bug_code_uid": "5b5480953ce9a002b89e5a3a76528a26", "src_uid": "072c7d29a1b338609a72ab6b73988282", "apr_id": "8f4a166e25fa5d90c43e0cdb5fc77248", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9982243744955609, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\n//#pragma comment(linker, \"/STACK:102400000\")\n#define LL long long\n#define mod 1000000007\n#define maxn 100005\n#define eps 1e-10\n//LL L,b,f,q;\n//LL len[109],x,y,lenq[109];\n//LL num[maxn*4],ll[maxn*4],rr[maxn*4],mm[maxn*4],setv[maxn*4],\n//sr[maxn*4];\n//void build(LL o,LL l,LL r)\n//{\n//\tll[o]=rr[o]=num[o]=mm[o]=r-l;\n//\tsr[o]=l;\n//\tif(r-l==1)return;\n//\tLL m=(l+r)/2;\n//\tbuild(o*2,l,m);\n//\tbuild(o*2+1,m,r);\n//}\n//LL query(LL len,LL o,LL l,LL r)\n//{\n//\tif(num[o]=len+b+f)\n//\t\treturn l;\n//\tif(r-l==1)return -1;\n//\tLL m=(l+r)/2;\n//\tLL q1=query(len,o*2,l,m);\n//\tif(q1!=-1)return q1;\n//\tLL q2=query(len,o*2+1,m,r);\n//\tif(rr[o*2]+ll[o*2+1]>=len+b+f)\n//\t\treturn sr[o*2];\n//\treturn q2;\n//}\n//void pushdown(LL o,LL l,LL r)\n//{\n//\tif(setv[o]!=-1)\n//\t{\n//\t\tLL m=(l+r)/2;setv[o*2]=setv[o*2+1]=setv[o];\n//\t\tif(!setv[o])\n//\t\t{\n//\t\t\tnum[o*2]=ll[o*2]=rr[o*2]=m-l;\n//\t\t\tsr[o*2]=l;\n//\t\t\tnum[o*2+1]=ll[o*2+1]=rr[o*2+1]=r-m;\n//\t\t\tsr[o*2+1]=m;\n//\t\t}\n//\t\telse\n//\t\t{\n//\t\t\tnum[o*2]=ll[o*2]=rr[o*2]=\n//\t\t\t\tnum[o*2+1]=ll[o*2+1]=rr[o*2+1]=0;\n//\t\t}setv[o]=-1;\n//\t}\n//}\n//void maLLain(LL o,LL l,LL r)\n//{\n//\tLL m=(l+r)/2;\n//\tnum[o]=max(num[o*2],num[o*2]+1);\n//\tnum[o]=max(num[o],rr[o*2]+ll[o*2+1]);\n//\tif(ll[o*2]==num[o*2])\n//\t\tll[o]=ll[o*2]+ll[o*2+1];\n//\telse ll[o]=ll[o*2];\n//\tif(rr[o*2+1]==num[o*2+1])\n//\t\trr[o]=rr[o*2]+rr[o*2+1],sr[o]=sr[o*2];\n//\telse rr[o]=rr[o*2+1],sr[o]=sr[o*2+1];\n//}\n//void update(LL L,LL R,LL o,LL l,LL r)\n//{\n//\tif(L<=l&&r<=R)\n//\t{\n//\t\tsetv[o]=1;\n//\t\tnum[o]=ll[o]=rr[o]=0;\n//\t\treturn;\n//\t}\n//\tif(L>=r||l>=R)return;\n//\tpushdown(o,l,r);\n//\tLL m=(l+r)/2;\n//\tif(L<=m)update(L,R,o*2,l,m);\n//\tif(m=r||l>=R)return;\n//\tpushdown(o,l,r);\n//\tLL m=(l+r)/2;\n//\tif(L<=m)update(L,R,o*2,l,m);\n//\tif(mq;\nbool vis[1000009];\nint p[10],pp;\nvoid cnt(int x)\n{\n\tpp=0;\n\tif(x==0)return ;\n\twhile(x)\n\t{\n\t\tp[++pp]=x%10;\n\t\tx/=10;\n\t}\n}\nint main()\n{\n\tmemset(vis,0,sizeof(vis));\n\tcin>>n;\n\tvis[n]=1;\n\twhile(!q.empty())q.pop();\n\tnode nd;nd.x=n;nd.p=0;\n\tq.push(nd);\n\twhile(!q.empty())\n\t{\n\t\tnd=q.front();q.pop();\n\t\tcnt(nd.x);\n\t\tif(pp==0){cout<\nusing namespace std;\nint b[5005], cnt, pr[800], f[800][5001], n, op[1000005];\nlong long ans;\nvector vec[1000005], ss, tmp;\nint main()\n{\n for (int i = 2; i <= 5000; i++) {\n if (b[i]) continue;\n for (int j = 2; j * i <= 5000; j++) b[i * j] = 1;\n }\n for (int i = 2; i <= 5000; i++)\n if (b[i] == 0) pr[++cnt] = i;\n for (int i = 1; i <= cnt; i++) {\n for (int j = 1; j <= 5000; j++) {\n if (j >= pr[i]) f[i][j] = j / pr[i] + f[i][j / pr[i]];\n }\n }\n scanf(\"%d\", &n);\n for (int i = 1; i <= n; i++) {\n scanf(\"%d\", op + i);\n if (op[i] == 0) op[i] = 1;\n for (int j = 1; j <= cnt; j++) ans += f[j][op[i]];\n }\n for (int i = 1; i <= n; i++) {\n vec[i].push_back(0);\n for (int j = 1; j <= cnt; j++) vec[i].push_back(f[j][op[i]]);\n }\n for (int i = 1; i <= n; i++) ss.push_back(i);\n for (int i = cnt; i >= 1;) {\n int s = 0, minn = 0x7fffffff;\n tmp.clear();\n for (int a : ss) {\n if (vec[a][i]) ++s, minn = min(minn, vec[a][i]);\n }\n if (s > n - s) {\n ans -= 1ll * minn * (s - n + s);\n for (int a : ss) {\n if (vec[a][i]) vec[a][i] -= minn, tmp.push_back(a);\n }\n ss.clear();\n for (int a : tmp) ss.push_back(a);\n }\n else if (n - s > s) {\n for (int a : ss) {\n if (!vec[a][i]) tmp.push_back(a);\n }\n ss.clear();\n for (int a : tmp) ss.push_back(a);\n --i;\n }\n else {\n break;\n }\n }\n printf(\"%lld\", ans);\n return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "9e147208cd4e4fcca8e0eff1d7ae5c5c", "src_uid": "40002052843ca0357dbd3158b16d59f4", "apr_id": "1ef4c3d03313b8c171e4db1a59563f8f", "difficulty": 2700, "tags": ["dp", "number theory", "math", "graphs", "trees"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.2406989853438557, "equal_cnt": 20, "replace_cnt": 11, "delete_cnt": 5, "insert_cnt": 3, "fix_ops_cnt": 19, "bug_source_code": "#include \n\nusing namespace std;\n\nvector mem[5001];\n\nvector Fact(int x) {\n if (!mem[x].empty()) {\n return mem[x];\n }\n\n vector res;\n for (int i = 2; i * i <= x; ++i) {\n while (x % i == 0) {\n res.push_back(i);\n x /= i;\n }\n }\n if (x > 1) {\n res.push_back(x);\n }\n\n return mem[x] = res;\n}\n\nvector F(int x) {\n vector res;\n for (int i = 2; i <= x; ++i) {\n auto f = Fact(i);\n res.insert(res.end(), f.begin(), f.end());\n }\n sort(res.begin(), res.end());\n reverse(res.begin(), res.end());\n\n return res;\n}\n\nvector cnt(1);\nvector> nxt(1);\n\nint64_t ans = 0;\n\nvoid Add(const vector& data, int delta) {\n int v = 0;\n ans += 1LL * data.size() * delta;\n for (int x : data) {\n if (!nxt[v].count(x)) {\n nxt[v][x] = nxt.size();\n nxt.emplace_back();\n cnt.emplace_back();\n }\n v = nxt[v][x];\n cnt[v] += delta;\n }\n}\n\nint main() {\n ios_base::sync_with_stdio(false);\n cin.tie(nullptr);\n cout.tie(nullptr);\n \n int n;\n cin >> n;\n vector cnt(5001);\n for (int i = 0; i < n; ++i) {\n int k;\n cin >> k;\n ++cnt[k];\n }\n\n for (size_t i = 0; i < cnt.size(); ++i) {\n Add(F(i), cnt[i]);\n }\n\n int v = 0;\n for (bool flag = false; flag; flag = false) {\n for (auto x : nxt[v]) {\n if (cnt[x.second] > n - cnt[x.second]) {\n ans -= cnt[x.second];\n ans += n - cnt[x.second];\n v = x.second;\n flag = true;\n break;\n }\n }\n }\n\n cout << ans << endl;\n\n return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "29ae642e003c32b487fd054e8725a52d", "src_uid": "40002052843ca0357dbd3158b16d59f4", "apr_id": "3c42a7b816c6f6bfdea9ca1943ed36b7", "difficulty": 2700, "tags": ["dp", "number theory", "math", "graphs", "trees"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7235142118863049, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "#include \nusing namespace std;\nint main(int argc, char const *argv[])\n{\n char s[100011];\n scanf(\"%s\",s+1);\n int len=strlen(s+1);\n int cnt=0;\n for(int i=len;i>=0;i++)\n {\n if(s[i]=='0')\n {\n cnt++;\n }\n }\n if(cnt>6)\n {\n puts(\"yes\");\n }\n else\n {\n puts(\"no\");\n }\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "2d9c6e294e0d0cf2e16dbb12df1d3914", "src_uid": "88364b8d71f2ce2b90bdfaa729eb92ca", "apr_id": "cd945fc055fc659c8ab938e682c309ea", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9680576563751223, "equal_cnt": 10, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 9, "bug_source_code": "\n\n/* * * * * * * * * * * * * * \t\t\n# *\n# @Author AYUSH AGRAWAL *\n# *\n# * * * * * * * * * * * * */\n\n\n#include\nusing namespace std;\n#define ll long long int\n#define MOD 1000000007\n#define M(x) (x%MOD + MOD)%MOD\n#define _pb push_back\n#define _mp make_pair\n#define ff first\n#define ss second\n#define s(x) scanf(\"%lld\",&x)\n\nll mul(ll x,ll y)\n{ ll ans=1;\n\n while(y>0)\n { if(y&1)\n\tans=(ans*x)%MOD;\n\ty/=2;\n\tx=(x*x)%MOD;\n }\n\n return ans;\n};\n\n/******************************************************************************************************/\n\nconst ll N=100005;\nll a[N],b[N],c[N],d[N],seg[300*N],size,bit[N];\n\nvoid update(ll x,ll val)\n{\t\n\t++x;\n\n\twhile(x<=size)\n\t{\t\n\t\t// cout<0)\n\t{\t\n\t\tans+=bit[x];\n\t\tx-=x&(-x);\n\t}\n\n\treturn ans;\n}\n\nvoid debug2()\n{\n\tll i;\n\tcout<<\"/////////////////////////////////////*********************************\\n\";\n\tfor(i=1;i<=7;i++)\n\t\tcout<val)\n\t{\t\n\t\treturn MOD;\n\t}\n\n\tif(lt==rt && seg[in]<=val)\n\t\treturn lt;\n\n\tll mid = (lt+rt)/2;\n\tll left = query(in*2,lt,mid,ql,qr,val);\n\t\n\tif(left!=MOD)\n\t\treturn left;\n\n\tll right = query(in*2+1,mid+1,rt,ql,qr,val);\n\t// seg[in] = max(seg[in*2],seg[in*2+1]);\n\t// if(right!=MOD)\n\treturn right;\n\t// return;\n}\n\nvector v,ev,cov;\n\nvoid debug()\n{\n\tll i;\n\tcout<<\"*********************************\\n\";\n\tfor(i=0;i ss;\n\n\tfor(i=1;i<=q;i++)\n\t{\n\t\ts(a[i]); s(b[i]);\n\n\t\tif(a[i]==1)\n\t\t\ts(c[i]);\n\t\telse if(a[i]==3)\n\t\t\ts(c[i]),s(d[i]);\n\n\t\tif(a[i]<=2)\n\t\tss.insert(b[i]);\n\t}\n\n\tmap mp;\n\n\tll in=0;\n\twhile(!ss.empty())\n\t{\t\n\t\tmp[*ss.begin()] = in;\n\t\t++in;\n\t\tv._pb(*ss.begin());\n\t\tev._pb(0);\n\t\tcov._pb(0);\n\t\tss.erase(ss.begin());\n\t}\n\n\tsize = v.size();\n\t// cout< ev_list;\n\tset::iterator it,lt,rt;\n\n\tll x,y,tmp,extra;\n\n\tfor(i=1;i<=q;i++)\n\t{\n\t\tif(a[i]==1)\n\t\t{\n\t\t\tin = mp[b[i]];\n\t\t\tev[in] = c[i];\n\t\t\tev_list.insert(b[i]);\n\t\t\tit = ev_list.find(b[i]);\n\t\t\tlt = rt = it;\n\n\t\t\t// debug();\n\n\t\t\tif(lt != ev_list.begin())\n\t\t\t{\t\n\t\t\t\t--lt;\n\t\t\t\tx = *lt; \n\t\t\t\ty = *it;\n\n\t\t\t\tin = mp[x];\n\t\t\t\ttmp = cov[in];\n\t\t\t\tcov[in] = ev[in]*(y-x);\n\n\t\t\t\tadd(1,0,size-1,in,size-1,cov[in]-tmp);\n\t\t\t\t// debug2();\n\t\t\t\t// cout<<\"go1\\n\";\n\t\t\t\tupdate(in,cov[in]-tmp);\n\t\t\t\t// cout<<\"go2\\n\";\n\t\t\t}\n\n\t\t\t++rt;\n\t\t\tx = *it;\n\n\t\t\tif(rt == ev_list.end())\n\t\t\t\ty = x + 1000000000;\n\t\t\telse\n\t\t\t\ty = *rt;\n\n\t\t\t// tmp = cov[x];\n\t\t\tin = mp[x];\n\t\t\tcov[in] = ev[in]*(y-x);\n\t\t\t// cout<\n#include \n#define ll long long\n#define ld long double\n#define fir first\n#define sec second\nusing namespace std;\nint main()\n{\n ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);\n int n, k, M;\n cin >> n >> k >> M;\n vector T(k+1,0);\n for(int i=0; i> T[i];\n int ans=-1, t, cur; vector V(n,-1);\n pair < pair , vector > r; priority_queue < pair < pair , vector > > Q;\n Q.push({{0,0},V});\n while(!Q.empty())\n {\n r=Q.top(), Q.pop();\n if(r.fir.sec>=ans)\n {\n ans=r.fir.sec, t=(-1)*r.fir.fir, cur=k;\n for(int i=0; i\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\n#define rep(i,x,y) for(i=x;i<=y;i++)\n#define _rep(i,x,y) for(i=x;i>=y;i--)\n#define REP(i,x,y) for(int i=(x);i<=(y);i++)\n#define _REP(i,x,y) for(int i=(x);i>=(y);i--)\n#define CL(S,x) memset(S,x,sizeof(S))\n#define CP(S1,S2) memcpy(S1,S2,sizeof(S2))\n#define ALL(x,S) for(x=S.begin();x!=S.end();x++)\n#define pb push_back\n#define IN insert\n#define ER erase\n#define BE begin()\n#define ED end() \n#define LB lower_bound\n#define UB upper_bound\n#define mp make_pair\n#define fi first\n#define se second\n#define upmin(x,y) x=min(x,y)\n#define upmax(x,y) x=max(x,y)\n#define COUT(S,x) cout< 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 inline void read(T&x,T&y){read(x);read(y);}\ntemplate inline void read(T&x,T&y,T&z){read(x);read(y);read(z);}\ninline char getc(){char c;for(c=getchar();c<=32;c=getchar());return c;}\n\ntypedef long long ll;\ntypedef long double ld;\ntypedef pair pii;\n\n\nconst int ms=255;\nconst int up=256;\nint x,k,p0,i;ld p;\nint get(int x){return(x&1)?0:get(x/2)+1;}\n\nbool v[202][256][2][250];\nld f[202][256][2][250];\nint cc[10000];\n\nld dp(int i,int S,int la,int cnt)\n{\n if(i>k)\n {\n if(S==0)return 8+(la==0)*cnt;\n else return cc[S];\n }\n \n ld&ans=f[i][S][la][cnt];\n if(v[i][S][la][cnt])return ans;\n v[i][S][la][cnt]=1;\n \n if(S==ms)ans+=(1-p)*dp(i+1,0,1-la,(la==0)?1:cnt);\n else ans+=(1-p)*dp(i+1,S+1,la,cnt);\n \n int w=(S<<1)&up,cnt2;\n \n if(cnt)cnt2=(la==w)?cnt+1:1;else cnt2=(w==1)?1:0;\n \n ans+=p*dp(i+1,(S<<1)&ms,w,cnt2);\n \n return ans;\n}\n\nint main()\n{\n //freopen(\"1.in\",\"r\",stdin);freopen(\"1.out\",\"w\",stdout);\n rep(i,1,ms)if(i&1)cc[i]=0;else cc[i]=cc[i/2]+1;\n \n read(x,k,p0);p=1.0*p0/100;\n \n int x0=x/256,t,cnt;\n \n t=x0&1;cnt=0;\n while(x0>0&&(x0&1)==t)x0/=2,cnt++;\n \n cout<\n\nusing namespace std;\ntypedef long long ll;\n\n#define gc getchar\nint getint() { unsigned int c; int x = 0; while (((c = gc()) - '0') >= 10) { if (c == '-') return -getint(); if (!~c) exit(0); } do { x = (x << 3) + (x << 1) + (c - '0'); } while (((c = gc()) - '0') < 10); return x; }\nint getstr(char *s) { int c, n = 0; while ((c = gc()) <= ' ') { if (!~c) exit(0); } do { s[n++] = c; } while ((c = gc()) > ' ' ); s[n] = 0; return n; }\ntemplate inline bool chmin(T &a, T b) { return a > b ? a = b, 1 : 0; }\ntemplate inline bool chmax(T &a, T b) { return a < b ? a = b, 1 : 0; }\n\n\nlong double prob;\nlong double cprob;\n\nint cnt_last_zeros(int x) {\n if (x == 0) return 8;\n int res = 0;\n while (~x & 1) {\n x >>= 1;\n res++;\n }\n return res;\n}\n\nmap aa;\nconst int mask8 = (1 << 8) - 1;\n\nint nleadc, nlead, xx;\nvoid mul2(int leadcnt, int lead, int x) {\n xx = (x << 1) & mask8;\n int c = (x >> 7) & 1;\n if (lead == c) {\n nlead = lead, nleadc = leadcnt + 1;\n } else {\n nlead = c, nleadc = 1;\n }\n}\n\nint add1(int leadcnt, int lead, int x) {\n x = x + 1;\n xx = x & mask8;\n int c = (x >> 8) & 1;\n if (lead == c) {\n nlead = lead, nleadc = leadcnt + 1;\n } else {\n nlead = c, nleadc = 1;\n }\n}\n\nlong double cache[222][222][2][1 << 8];\nlong double solve(int rest, int leadcnt, int lead, int x) {\n long double & res = cache[rest][leadcnt][lead][x];\n if (res > -0.5) return res;\n if (rest == 0) {\n int k = cnt_last_zeros(x);\n if (k == 8) {\n if (lead == 0) k += leadcnt;\n }\n res = k;\n return k;\n }\n res = 0;\n mul2(leadcnt, lead, x);\n res += solve(rest - 1, nleadc, nlead, xx) * prob;\n add1(leadcnt, lead, x);\n res += solve(rest - 1, nleadc, nlead, xx) * cprob;\n return res;\n}\n\nint main () {\n int i, j, tcc, tc = 1 << 28;\n for (tcc = 0; tcc < tc; tcc++) {\n int x = getint();\n int k = getint();\n int pint = getint();\n prob = pint / 100.0;\n cprob = 1 - prob;\n for (i = 0; i < 222; i++) for (j = 0; j < 222; j++) {\n for (int h = 0; h < 1 << 8; h++) {\n cache[i][j][0][h] = cache[i][j][1][h] = -1;\n }\n }\n int l8 = x & mask8;\n x >>= 8;\n int c = x & 1, d = 0;\n while (x and c == (x & 1)) { x >>= 1, d++; }\n long double res = solve(k, d, c, l8);\n cout.precision(15);\n cout << res << endl;\n }\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "be5125a682c12c8a6d4f2f62cc6153e6", "src_uid": "c9274249c26b1a85c19ab70d91c1c3e0", "apr_id": "561220880153c68922d15295d5074fd3", "difficulty": 2400, "tags": ["dp", "math", "probabilities", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9984076433121019, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n\nusing namespace std;\nconst int MAXN = 200010;\nconst int MOD = 1e9+7;\n#define INF 0x3f3f3f3f\n#define LL long long\n\nint cnt;\nint mx = -INF, mn = INF;\nint TT, T, n, m;\n\nint dp[2][100001];\n\nint main()\n{\n int i, j, k, kk, l, r;\n\n\tint cur = 0;\n\tcnt = 1;\n\tint pre = cur ^ 1;\n//\tcin >> T;\n\tint q[100010];\n\tint h, d;\n\tT = 1;\n\twhile(T--)\n\t{\n\t\tscanf(\"%d %d\", &n, &k);\n\n\t\tmemset(dp, INF, sizeof(dp));\n\t\tdp[cur][0] = 0;\n\t\tfor(i = 1; i <= k; i++)\n\t\t{\n\t\t\tpre = cur;\n\t\t\tcur ^= 1;\n\t\t\tscanf(\"%d %d\", &l, &r);\n\n\t\t\th = 1, d = 0;\n\t\t\tfor(j = 0; j <= r; j++)\n\t\t\t{\n\t\t\t\tif(j <= n){\n\t\t\t\t\twhile(h <= d && dp[pre][j] <= dp[pre][q[d]]) d--;\n\t\t\t\t\tq[++d] = j;\n\t\t\t\t}\n\t\t\t\twhile(h <= d && (q[h] < j - r + l))\n\t\t\t\t\th++;\n\t\t\t\tdp[cur][j] = min(dp[pre][j], dp[pre][q[h]] + 2);\n\t\t\t}\n\t\t\t\n\t\t\th = 1, d = 0;\n\t\t\tfor(j = r; j >= 0; j--)\n\t\t\t{\n\t\t\t\tif(r - j <= n){\n\t\t\t\t\twhile(h <= d && dp[pre][r - j] <= dp[pre][q[d]]) d--;\n\t\t\t\t\tq[++d] = r - j;\n\t\t\t\t}\n\n\t\t\t\twhile(h <= d && (q[h] < l - j)) \n\t\t\t\t\th++;\n\t\t\t\tdp[cur][j] = min(dp[cur][j], dp[pre][q[h]] + 1);\n\t\t\t}\n\n\t\t}\n\t\tif(dp[cur][n] >= INF)\n\t\t\tputs(\"Hungry\");\n\t\telse printf(\"Full\\n%d\\n\", dp[cur][n]);\n\t}\n\treturn 0;\n\n}\n", "lang": "GNU C++17", "bug_code_uid": "23ab420f9b3e30e306da165f3b8653bf", "src_uid": "2e0d1b1f1a7b8df2d2598c3cb2c869d5", "apr_id": "27606860a58374c21b81f381b51811aa", "difficulty": 2400, "tags": ["data structures", "dp"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.963258785942492, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "By Asm.Def, contest: Codeforces Round #431 (Div. 1), problem: (D) Shake It!, Accepted, #\n\n#include \nusing namespace std;\nconst int maxn = 52, mod = 1000000007;\ntypedef long long LL;\nint N, M, F[maxn][maxn], G[maxn][maxn], inv[maxn];\n\nvoid init()\n{\n scanf(\"%d%d\", &N, &M);\n inv[1] = 1;\n for(int i = 2;i < maxn;++i)\n inv[i] = LL(mod-mod/i) * inv[mod%i] % mod;\n}\nvoid work()\n{\n F[0][1] = 1;\n for(int i = 1;i <= N;++i) for(int j = 1;j < maxn;++j)\n {\n for(int a = 0;a < i;++a)\n {\n G[i][j] = (G[i][j] + (LL) F[a][j] * F[i-1-a][j]) % mod;\n for(int b = j+1;b <= i+1 && b < maxn;++b)\n {\n G[i][j] = (G[i][j] + (LL) F[a][b] * F[i-1-a][j]) % mod;\n G[i][j] = (G[i][j] + (LL) F[a][j] * F[i-1-a][b]) % mod;\n }\n }\n //get G[i][j]\n for(int x = N-1;x >= 0;--x) for(int y = 1;y < maxn;++y) if(F[x][y])\n {\n int C = 1;\n for(int t = 1;x+t*i <= N && y+t*j < maxn;++t)\n {\n C = (LL) C * (G[i][j]-1+t) % mod * inv[t] % mod;\n F[x+t*i][y+t*j] = (F[x+t*i][y+t*j] + (LL) F[x][y] * C) % mod;\n }\n }\n }\n printf(\"%d\\n\", F[N][M]);\n}\nint main()\n{\n init();\n work();\n return 0;\n}\n\n\u52a8\u6001\u89c4\u5212", "lang": "GNU C++11", "bug_code_uid": "77155eaa8caeff4d4f9b4087e4d182cf", "src_uid": "aca6148effff8b893c961b1ee465e4e4", "apr_id": "76e8eb02e4bc449ef55b4ec0d8980094", "difficulty": 2900, "tags": ["graphs", "dp", "flows", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.8143036386449184, "equal_cnt": 18, "replace_cnt": 3, "delete_cnt": 13, "insert_cnt": 1, "fix_ops_cnt": 17, "bug_source_code": "#include\n\ntypedef long long int ll;\n#define pp pair\n#define ppp pair\n#define dbg printf(\"x\");\n#define inf 1000000000000\n#define max2(a,b) ((ab)?b:a)\n#define min3(a,b,c) min2(min2(a,b),c)\n\nusing namespace std;\n\nint main()\n{\n freopen(\"in.txt\",\"r\",stdin);\n int i,j,k;\n int n,l;\n\n cin>>n>>l;\n int a[n],b[n];\n\n for(i=0;i>a[i];\n\n for(i=0;i>b[i];\n\n queue ds;\n queue kf;\n\n for(i=1;i\n\nusing namespace std;\n\ntypedef long long ll;\n\nll sum (ll x) {\n\tll ans = 0;\n\twhile (x) {\n\t\tans += (x % 10ll);\n\t\tx /= 10;\n\t}\n\treturn ans;\n}\nll mx, ans;\n\nint main () { \t\n\n\t//freopen (\"in\", \"r\", stdin);\n\t//freopen (\"slow.out\", \"w\", stdout);\n\tll x;\n\tcin >> x;\n\tfor (ll i = 1;i <= x;i ++) {\n\t\tll cnt = sum (i);\n\t\tif (cnt >= mx) {\n\t\t\tmx = cnt;\n\t\t\tans = i; \n\t\t}\n\t}\n\tcout << ans;\n\nreturn 0; \n}", "lang": "GNU C++14", "bug_code_uid": "b1552c9dd5902bad5d0d50cd458c263e", "src_uid": "e55b0debbf33c266091e6634494356b8", "apr_id": "49e5d5f6713552bd75267febd47932ff", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.889261744966443, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "#include \n#define task \"1\"\nusing namespace std;\nint n,m,d,k;\nstring s;\nmain(){\n// freopen(task\".INP\",\"r\",stdin);\n// freopen(task\".OUT\",\"w\",stdout);\n cin >> n;\n for(int i=1;i<=n;i++){\n cin >> s[i];\n if(s[i] == '8') d++;\n }\n k=n/10;\n cout << min(d,k);\n}\n", "lang": "GNU C++17", "bug_code_uid": "bebc7c3187c05b5873c17346dd52375b", "src_uid": "259d01b81bef5536b969247ff2c2d776", "apr_id": "f1276143c5abb60c4177a2cdc417ace0", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.6813471502590673, "equal_cnt": 3, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "#include\n#include\nusing namespace std;\nint main()\n{\n int i=0,n,count=0;\n cin >> n;\n char s[n+1];\n cin >> s;\n while(s[i]!=0)\n {\n if(s[i]=='8')\n {\n count++;\n }\n i++;\n }\n while(count--)\n {\n if(n%count==0)\n {\n cout << count;\n return 0;\n }\n }\n cout << \"0\";\n return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "f79b8d9d55539c96c0a18ce977f8f1d9", "src_uid": "259d01b81bef5536b969247ff2c2d776", "apr_id": "ef5206664c31bf49be46eabd5363d3de", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9099816289038579, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "#include\n#include\n#include\nusing namespace std;\ntypedef long long LL;\nconst int maxn=5e4+2;\nconst int maxm=20+2;\nconst int B=200+2;\nint cnt=1;\nbitset a[maxn];\nint nxt[maxm][maxn];\nbool vis[maxm][maxn];\nmap,int> mp;\nLL dp[maxm][maxm][maxn];\nvoid DP(){\n\tfor (int i=1;i<=cnt;i++){\n\t\tint j=0;\n\t\tfor (;j<10;j++) if (a[i][j]) break;\n\t\tfor (;j<10;j++) dp[0][j][i]=1;\n\t}\n\tfor (int i=1;i=0;i--){\n\t\tfor (int j=0;j Bit;\n\tBit.set(0);\n\tmp[Bit]=1;\n\ta[1]=Bit;\n\tvis[0][1]=true;\n\tfor (int i=1;i\n#include\n#include\nusing namespace std;\ntypedef long long LL;\nconst int maxn=5e4+2;\nconst int maxm=20+2;\nconst int B=200+2;\nint cnt=1;\nbitset a[maxn];\nint to[maxm][maxn];\nbool vis[maxm][maxn];\nmap,int> mp;\nLL dp[maxm][maxm][maxn];\nvoid DP(){\n\tfor (int i=1;i=0;i--){\n\t\tfor (int j=0;j Bit;\n\tBit.set(0);\n\tmp[Bit]=1;\n\ta[1]=Bit;\n\tvis[0][1]=1;\n\tfor (int i=1;i\nusing namespace std;\n\n#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);\n#define watch(x); cout << \"\\n\" << #x << \" is: \" << x << \"\\n\";\n#define ll long long int\n#define ff first\n#define ss second\n#define all(a) a.begin(),a.end()\n#define pb push_back\n#define nl cout<<\"\\n\"\n#define gcd(a,b) __gcd(a,b)\n#define sq(a) (a)*(a)\n#define loop(i,a,b) for (ll i = a; i <= b; i++)\n#define rloop(i,a,b) for (int i = a; i >= b; i--)\n#define sz(a) a.size()\n#define mod 1000000007\n#define PI 2*acos(0.0)\n\n\nint main()\n{\n IOS\n int T=1;\n //cin>>T;\n while(T--)\n {\n while(1)\n {\n int n,k1,k2;\n cin>>n;\n n*=1000;\n queue a,b;\n cin>>k1;\n while(k1--)\n {\n cin>>k2;\n a.push(k2);\n }\n cin>>k2;\n while(k2--)\n {\n cin>>k1;\n b.push(k1);\n }\n int ans=0,q=0;\n while(!a.empty() and !b.empty() and n--)\n {\n if(a.front()b.front()) a.push(b.front()),a.push(a.front());\n a.pop();\n b.pop();\n ans++;\n }\n if(!a.empty() and !b.empty()) cout<<-1;\n else\n {\n if(!a.empty()) cout<\n#include \nusing namespace std;\nint middle(vector city,int ind,int num)\n{\n ind--;\n int criminal=0;\n for(int i=ind+1;i city,int ind,int num)\n{\n ind--;\n int criminal=0;\n if(ind==0)\n {\n for(int i=0;i city,int ind,int num)\n{\n ind--;\n int criminal=0;\n if(ind==num-1)\n {\n for(int r=ind;r>0;r--)\n {\n if(city[r]==1)\n {\n criminal++;\n }\n }\n }\n else\n {\n int f;\n for(int i=ind+1;i0;r--)\n {\n if(city[r]==1)\n {\n criminal++;\n }\n }\n }\n if(city[ind]==1){criminal++;}\n }\n return criminal;\n}\nint main()\n{\n int num,ind,criminal=0,ele;\n vectorcity;\n cin>>num>>ind;\n for(int i=0;i>ele;\n city.push_back(ele);\n }\n if(ind==(num/2)+1)\n {\n criminal=middle(city,ind,num);\n }\n else\n {\n if(ind<=num/2)\n {\n criminal=small(city,ind,num);\n }\n else\n {\n criminal=bigger(city,ind,num);\n }\n }\n cout<\n#define MAXN 100009\n#define INF 1000000007\n#define LLINF 1000000000000000007\n#define mp(x,y) make_pair(x,y)\n#define wr cout<<\"Continue Debugging!!!\"< PII;\ntemplate bool umin(T& a, T b) { if(a > b){ a = b;return 1;}return 0;}\ntemplate bool umax(T& a, T b) { if(a < b){ a = b;return 1;}return 0;}\n//freopen(\".in\", \"r\", stdin);\n//freopen(\".out\", \"w\", stdout);\nll arr[21],m,a,dp[(1<<10)+9][1009];\nstring n;\nll rec(ll mask,ll val){\n\tif(__builtin_popcount(mask)==a)\n\t\treturn (!val);\t\n\tll ret=dp[mask][val];\n\tif(ret!=-1)\n\t\treturn ret;\n\tret=0;\t\t\n\tfor(ll i=0;i>n>>m;\n\ta=n.size();\n\tfor(ll i=0;i\nusing namespace std;\nint main(){\n\tint a=0,b=0;\n\tstring s;\n\tcin>>s;\n\tfor (int i=0; i\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n#define SyncFalse ios::sync_with_stdio(0); cin.tie(0)\n#define MEM(a, v) memset(a, v, sizeof(a))\n#define CLRV(a, sz, v) a.clear(); a.resize(sz, v)\n#define CLR(a, sz) a.clear(); a.resize(sz)\n#define ALL(a) a.begin(), a.end()\n#define RALL(a) a.end(), a.begin()\n#define MP make_pair\n#define FI first\n#define SE second\n#define PB push_back\n#define POB pop_back\n#define PF push_front\n#define POF pop_front\n#define SZ(a) (int)a.size()\n#define LNG(a) (int)a.length()\n#define LPI 3.141592653589793238462643383279502884L\n#define SI(n) scanf(\"%d\", &n)\n#define SL(n) scanf(\"%lld\", &n)\n#define SD(n) scanf(\"%f\", &n)\n#define SLD(n) scanf(\"%lf\", &n)\n#define SC(n) scanf(\" %c\", &n)\n#define SS(n) scanf(\" %s\", n)\n#define FR(i, n) for (int i = 0; i < n; i++)\n#define RFR(i, n) for (int i = n - 1; i >= 0; i--)\n#define FR1(i, n) for (int i = 1; i <= n; i++)\n#define RFR1(i, n) for (int i = n; i >= 1; i--)\n#define FOREACH(it, a) for (auto it = a.begin(); it != a.end(); it++)\n\ntypedef long long ll;\ntypedef unsigned long long ull;\ntypedef unsigned int ui;\ntypedef long double ld;\ntypedef vector VI;\ntypedef vector VL;\ntypedef vector VLD;\ntypedef vector VD;\ntypedef vector VB;\ntypedef vector VC;\ntypedef vector VS;\ntypedef vector VVI;\ntypedef pair PII;\ntypedef map MII;\ntypedef map MSI;\ntypedef vector VPII;\ntypedef vector VVPII;\n\nconst double PI = acos(-1.0);\nconst double EPS = numeric_limits::epsilon();\nconst int INF = (int) 1e9;\nconst ll LINF = (ll) 1e18;\nconst int MOD = (int) 1e9 + 7;\n\n//------------------------------------------------------------------------\n\nint main() {\n int n; SI(n);\n VL a;\n FR(i, n) SL(a[i]);\n FR(i, n - 1) {\n if ((a[i + 1] - a[i]) * (a[i] - a[0]) < 0) {\n printf(\"3\\n1 %d %d\", i + 1, i + 2);\n return 0;\n }\n }\n printf(\"0\\n\");\n return 0;\n}", "lang": "GNU C++14", "bug_code_uid": "8d0b404c79950f13f025f206ce2f4c8b", "src_uid": "99f9cdc85010bd89434f39b78f15b65e", "apr_id": "78eeec3a1258679cd71edb8d951be268", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9845380749903363, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "/* Copyright 2016 AcrossTheSky */\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define REP(i, a, b) for (int i = (a); i <= (b); ++i)\n#define PER(i, a, b) for (int i = (a); i >= (b); --i)\n#define RVC(i, c) fot (int i = 0; i < (c).size(); ++i)\n#define RED(k, u) for (int k = head[(u)]; k; k = edge[k].next)\n#define lowbit(x) ((x) & (-(x)))\n#define CL(x, v) memset(x, v, sizeof x)\n#define MP std::make_pair\n#define PB push_back\n#define FR first\n#define SC second\n#define rank rankk\n#define next nextt\n#define link linkk\n#define index indexx\n#define abs(x) ((x) > 0 ? (x) : (-(x)))\nusing namespace std;\ntypedef long long LL;\ntypedef pair PII;\n\ntemplate inline\nbool getmin(T *a, const T &b) {\n if (b < *a) {\n *a = b;\n return true;\n }\n return false;\n}\n\ntemplate inline\nbool getmax(T *a, const T &b) {\n if (b > *a) {\n *a = b;\n return true;\n }\n return false;\n}\n\ntemplate inline\nvoid read(T *a) {\n char c;\n while (isspace(c = getchar())) {}\n bool flag = 0;\n if (c == '-') flag = 1, *a = 0;\n else\n *a = c - 48;\n while (isdigit(c = getchar())) *a = *a * 10 + c - 48;\n if (flag) *a = -*a;\n}\nconst int mo = 1000000007;\ntemplate\nT pow(T a, T b, int c = mo) {\n T res = 1;\n for (T i = 1; i <= b; i <<= 1, a = 1LL * a * a % c) if (b & i) res = 1LL * res * a % c;\n return res;\n}\n/*======================= TEMPLATE =======================*/\nconst int N = 1000;\nchar s[N];\nint n, a, b;\nbool check(int a, int b, int c, int d) {\n\tif (!c && a) return 0;\n\tif (c && a % c) return 0;\n\tif (!d && b) return 0;\n\tif (d && b % d) return 0;\n\tint ta = 19981103, tb = 19981103;\n\tif (c) ta = a / c;\n\tif (d) tb = b / d;\n\tif (ta < 0 || tb < 0) return 0;\n\tif (ta == 19981103 || tb == 19981103) return 1;\n\treturn ta == tb;\n}\nint main() {\n\tcin >> a >> b;\n\tint x = 0, y = 0;\n\tscanf(\"%s\", s + 1);\n\tn = strlen(s + 1);\n\tREP(i, 1, n) \n\t\tif (s[i] == 'R') ++x;\n\t\telse if (s[i] == 'U') ++y;\n\t\telse if (s[i] == 'L') --x;\n\t\telse --y;\n\tint tx = 0, ty = 0;\n\tREP(i, 1, n) {\n\t\tif (s[i] == 'R') ++tx;\n\t\telse if (s[i] == 'U') ++ty;\n\t\telse if (s[i] == 'L') --tx;\n\t\telse --ty;\n\t\tif (check(a - tx, b - ty, x, y)) {\n\t\t\tcout << \"Yes\" << endl;\n\t\t\treturn 0;\n\t\t}\n\t}\n\tcout << \"No\" << endl;\n\treturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "413a1955b1c8e82264194b9029757b19", "src_uid": "5d6212e28c7942e9ff4d096938b782bf", "apr_id": "3e11001cd7329113dc43d1fbb00dfabd", "difficulty": 1700, "tags": ["math", "implementation", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.5949177877428998, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "#include\n#include\n#define pii pair\n#define lol long long\nusing namespace std;\nint main()\n{\n lol arr[3];\n cin>>arr[0]>>arr[1]>>arr[2];\n sort(arr,arr+3);\n lol ans=0;\n ans+=arr[0];\n arr[1]-=arr[0]; arr[2]-=arr[0];\n if(arr[1]>1)\n ans+=arr[1];\n else\n {\n if(arr[1]==1&&arr[2]>1) ans+=1;\n }\n cout << ans <\nusing namespace std;\nint n;\nlong long base=1e9+7,f[100001];\nint main(){\n cin>>n;\n f[1]=1;\n f[2]=3;\n for(int i=3;i<=n;i++){\n f[i]=((f[i-1]*2)-(f[i-3])+base)%base;\n }\n cout<\n#define ll long long int\n#define pb push_back\n#define mp make_pair\nusing namespace std;\nll n;\nll dp[100005];\nbool visited[100005];\n\n\n\nll fun(ll idx)\n{\n\tll i;\n\tll mod=1000000007;\n\tif(idx>n)\n\treturn 0;\n\tif(visited[idx])\n\t\treturn dp[idx];\n\tvisited[idx]=true;\n\tfor(i=1;i>n;\n\t\tll mod=1000000007;\n\t//ll ans=fun(1);\n\tdp[1]=1;\n\tdp[2]=3;\n\t\n\tfor(ll i=3;i<=n;i++)\n\t{\n\t\tdp[i]=(dp[i-1]+dp[i-2]+2)%mod;\n\t}\n\tcout<\n#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))\n#define F(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++)\n#define RF(i,a,b) for(long long i = (long long)(a); i >= (long long)(b); i--)\n#define MIN3(a,b,c) (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c))\n#define MAX(a,b) (a)>(b)?(a):(b)\n#define MIN2(a,b) (a)<(b)?(a):(b)\n#define INF 0x3f3f3f3f\n#define SIEVELIM 10000000+10\n#define EPS 1e-7\n#define coud(a,b) cout< ii;\ntypedef pair iii;\ntypedef vector vii;\ntypedef vector vi;\ntypedef long long ll;\n#define ull unsigned long long\ntypedef long double ld;\ntypedef vector vll;\ntypedef pair pll;\ninline int nextint(){ int temporary; scanf(\"%d\",&temporary); return temporary; }\ninline ll nextll(){ ll temporary; scanf(\"%lld\",&temporary); return temporary; }\ninline double nextdouble(){double temporary; scanf(\"%lf\",&temporary); return temporary;}\nll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }\nll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }\nll leftChild(ll p ){return p<<1;}\nll rightChild(ll p ){return (p<<1)+1;}\ninline ll mid(ll l, ll r){ return (l+r)/2;}\nconst ll MOD = 1000000007;\nconst double eps = 1e-7;\nconst double PI = acos(-1.0);\n#define deb(x ) cerr << #x << \" here \"<< x; \n#define endl \"\\n\"\n#define pb push_back\n#define mp make_pair\n#define all(cc) (cc).begin(),(cc).end()\n\ntemplate void modulize(T & a, const T & b) { if (a >= b) { a %= b; } }\nll mulmod(ll a, ll b, ll m) { ll q = (ll)(((ld)a*(ld)b) / (ld)m); ll r = a*b - q*m; if (r>m)r %= m; if (r<0)r += m; return r; }\ntemplate T expo(T e, S n) { T x = 1, p = e; while (n) { if (n & 1)x = x*p; p = p*p; n >>= 1; }return x; }\ntemplate T power(T e, T n, T & m) { T x = 1, p = e; while (n) { if (n & 1)x = mod(x*p, m); p = mod(p*p, m); n >>= 1; }return x; }\ntemplate T powerL(T e, T n, T & m) { T x = 1, p = e; while (n) { if (n & 1)x = mulmod(x, p, m); p = mulmod(p, p, m); n >>= 1; }return x; }\ntemplate T InverseEuler(T a, T & m) { return (a == 1 ? 1 : power(a, m - 2, m)); }\n/*----------------------------------------------------------------------*/\n\n//dp table\nll dp[16][160][2];\n\nvoid getDigits(long long x, vector &digit)\n{\n while (x)\n {\n digit.push_back(x%10);\n x /= 10;\n }\n}\n\nlong long value(int idx, int first , int recent , bool tight,\n vector &digit)\n{\n\tif (digit.size()==1)\n\t{\n\t\treturn digit[0];\n\t}\n\n // base case\n if (idx == -1)\n return first==recent;\n \n // if (dp[idx][sum][tight] != -1 and !tight)\n // return dp[idx][sum][tight];\n \n long long ret = 0;\n \n // calculating range value\n int k = (tight)? digit[idx] : 9;\n \n F(i,0,k+1)\n {\n // caclulating newTight value for next state\n int newTight = (digit[idx] == i)? tight : 0;\n \t\tint newFirst = first;\t\n\n if (i && first<0)\n {\n \tnewFirst = i;\n }\n\n // fetching answer from next state\n ret += value(idx-1,newFirst,i, newTight, digit);\n }\n \n // if (!tight)\n // dp[idx][sum][tight] = ret;\n \n return ret;\n}\n\nll rangeValue(ll left, ll right){\n\n\t//initialise dp table\n\t// memset(dp,-1,sizeof(dp));\n\n\tvi digitLeft;\n\tgetDigits(left-1, digitLeft);\n\n\tll ans1 = value(digitLeft.size()-1,-1,-1,true,digitLeft);\n\tif (left<=1)\n\t{\n\t\tans1 = 0;\n\t}\n\n\tvi digitRight;\n\tgetDigits(right,digitRight);\n\n\tll ans2 = value(digitRight.size()-1, -1,-1 ,true, digitRight);\n\tif (right<=1)\n\t{\n\t\tans2 = 0;\n\t}\n\n\treturn ans2 - ans1;\n}\n\nint main(){\n std::ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);\n\n ll l,r;\n cin>>l>>r;\n cout<\n#include\nusing namespace std;\n\nint main()\n{\nint x ,y ,ma , mi ,c=0;\ncin>>x >>y >>mi >>ma ;\nint b[y];\n\nfor(int i=0 ;i>b[i];\n\nsort(b,b+x);\nif(b[0]>mi)c++;\nelse if(b[0]ma){cout<<\"Incorrect\"<=c)cout<<\"Correct\"<\n#include \n\n#include \n\n#include \n#include \n#include \n\nusing namespace std;\n\nconst int MAXN = 1e5 + 100;\n\ntypedef long long ll;\n#define tll(x) static_cast(x)\n\ntypedef pair pii;\n#define mp make_pair\n#define ff first\n#define ss second\n\nint N, root;\n\nconst int MAXS = MAXN * 800;\nstruct PBT {\npublic:\n int c[MAXS][2], v[MAXS], sz[MAXS], h[MAXS];\n int NXT;\n PBT() : NXT(1) {v[0] = -1, sz[0] = 0, h[0] = 0;};\n int upd(int n) {\n if(not(0 < n)) return n;\n sz[n] = sz[c[n][0]] + sz[c[n][1]] + 1;\n h[n] = max(h[c[n][0]], h[c[n][1]]) + 1;\n assert(n != c[n][0] and n != c[n][1]);\n return n;\n }\n int gsz(int n) {\n if(n == 0) return 0;\n return gsz(c[n][0]) + gsz(c[n][1]) + 1;\n }\n void asst(int n) {assert(gsz(n) == sz[n]);}\n int nn(const int& n = -1) {\n assert(NXT < MAXS);\n if(n == 0) return 0;\n if(0 < n) {\n for(int i = 0;i < 2;i++) c[NXT][i] = c[n][i];\n v[NXT] = v[n];\n } else {\n for(int i = 0;i < 2;i++) c[NXT][i] = 0;\n v[NXT] = -1;\n }\n upd(NXT);\n return NXT++;\n }\n int nnr(const int& q) {\n int n = nn();\n v[n] = q;\n return n;\n }\n int L(int& n, int p = 0) {\n assert(c[n][1]);\n int o;\n if(p>1) o = nn(n); else o = n;\n if(p>0) n = nn(c[n][1]); else n = c[n][1];\n c[o][1] = c[n][0];\n upd(c[n][0] = o);\n return upd(n);\n }\n int R(int& n, int p = 0) {\n assert(c[n][0]);\n int o;\n if(p>1) o = nn(n); else o = n;\n if(p>0) n = nn(c[n][0]); else n = c[n][0];\n c[o][0] = c[n][1];\n upd(c[n][1] = o);\n return upd(n);\n }\n bool bal(int& n, bool p = false) { //here, we assume that n is already a copy\n int q = NXT;\n int b = h[c[n][0]] - h[c[n][1]], s, o = n;\n if(b < -1) {\n assert(s = c[n][1]);\n if(h[c[s][1]] + 1 == h[s]) {\n L(n, p ? 1 : 0);\n } else if(h[c[s][0]] + 1 == h[s]) {\n R(c[n][1], p ? 2 : 0);\n L(n, 0);\n } else assert(false);\n }\n else if(b > 1) {\n assert(s = c[n][0]);\n if(h[c[s][0]] + 1 == h[s]) {\n R(n, p ? 1 : 0);\n } else if (h[c[s][1]] + 1 == h[s]) {\n L(c[n][0], p ? 2 : 0);\n R(n, 0);\n } else assert(false);\n }\n else return false;\n return true;\n }\n int join(int a, int b, bool p = true) { //here we assume a and b are already copies\n if(a == 0 or b == 0) return a ? a : b;\n if(h[a] < h[b]) {\n c[b][0] = join(a, p ? nn(c[b][0]) : c[b][0], p);\n upd(b);\n bal(b, p);\n return b;\n } else {\n c[a][1] = join(p ? nn(c[a][1]) : c[a][1], b, p);\n upd(a);\n bal(a, p);\n return a;\n }\n }\n int join2(int l, int m, int r) { //assume all are copies, merges L and R at M\n if(h[l] + 1 < h[r]) {c[r][0] = join2(l, m, nn(c[r][0])); return upd(r);}\n if(h[r] + 1 < h[l]) {c[l][1] = join2(nn(c[l][1]), m, r); return upd(l);}\n c[m][1] = r;\n c[m][0] = l;\n upd(m);\n bal(m, 1);\n return m;\n }\n pii split(int a, int k) { //always create new nodes, assume a is NOT a copy\n if(k == 0) return mp(0, nn(a));\n assert(0 < k);\n if(sz[c[a][0]] < k) {\n pii q = split(c[a][1], k - sz[c[a][0]] - 1);\n int r = join2(nn(c[a][0]), nnr(v[a]), q.ff);\n return mp(r, q.ss);\n } else {\n pii q = split(c[a][0], k);\n int r = join2(q.ss, nnr(v[a]), nn(c[a][1]));\n return mp(q.ff, r);\n }\n }\n int get(int l, int r) { //inclusive - exclusive\n while(not(l < N)) l -= N, r -= N;\n while(l < 0) l += N, r += N;\n \n if(r > N) return join(get(l, N), get(N, r));\n pii f1 = split(root, r);\n pii f2 = split(f1.ff, l);\n \n return f2.ss;\n }\n void fill(int n, int * a, int * t = new int(0)) {\n if(n == 0) return;\n fill(c[n][0], a, t);\n a[(*t)++] = v[n];\n fill(c[n][1], a, t);\n }\n void pout(int n = root) {\n if(n == 0) return;\n pout(c[n][0]);\n cerr << v[n] << \" \";\n pout(c[n][1]);\n if(n == root) cerr << \"\\n\\n\";\n }\n} pbt;\n\nint M, S;\nll T;\n\nint to[40][MAXN];\n\nvoid gen() {\n root = 0;\n for(int i = 0;i < N;i++) root = pbt.join(root, pbt.nnr(i), 0);\n for(int i = 1;i < N;i++) {\n int a = pbt.get(i, i + M);\n int b = pbt.get(M - i, N - i);\n assert(pbt.sz[a] == M and pbt.sz[b] == N - M);\n root = pbt.join(a, b);\n //pbt.pout();\n assert(pbt.sz[root] == N);\n }\n pbt.fill(root, to[0]);\n}\n\nvoid run() {\n for(int i = 1;i < 40;i++) {\n for(int j = 0;j < N;j++) {\n to[i][j] = to[i-1][to[i-1][j]];\n }\n }\n}\n\nvoid brute() {\n int q = static_cast(T%N);\n for(;q;q--,T--) {\n if(S < M) S = (S + q)%N;\n else S = (S - q + N)%N;\n }\n assert(T%N == 0);\n}\n\nvoid solve() {\n scanf(\"%d%lld\", &S, &T);\n --S;\n brute();\n int k = T/N;\n for(int i = 0;1 << i < k;i++) {\n if(k&(1<(clock() - timer)/CLOCKS_PER_SEC << \"\\n\";\n \n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "5e3eb7f42790ffae13205d92795e1c8b", "src_uid": "e743242f0cc9e17619e1fe4935d9fbd0", "apr_id": "7a819b0c16fb7f3e36efe20a1053270d", "difficulty": 2900, "tags": ["graphs", "data structures", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7782909930715936, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "#include\n#include\n#include\nusing namespace std;\nint main()\n{\n\tint n;\n\tstring s, samo(\"aeiouy\");\n\tcin>>n>>s;\n\tfor(int i = 0;i=s[i])\n\t\t\t\t\ts.erase(s.begin()+i-1);\n\t\t\t\t\telse\n\t\t\t\t\ts.erase(s.begin()+i);\n\t\t\t\t\ti--;\n\t\t\t\t}\n\t\t\t\ti-=2;\n\t\t\t}\n\t\t}\n\t}\n\tcout<\n#include\n#include\n#include\nusing namespace std;\nconst int arrx[] = {1,1,1,0,0,-1,-1,-1};\nconst int arry[] = {0,1,-1,1,-1,1,-1,0};\ntypedef struct Node node;\nstruct Node\n{\n int x,y;\n Node(int x,int y):x(x),y(y){};\n bool operator < (const Node& n)const\n {\n if(x != n.x)\n return x < n.x;\n return y < n.y;\n }\n};\nint main()\n{\n ios::sync_with_stdio(false);\n int w1,h1,w2,h2;\n while(cin >> w1 >> h1 >> w2 >> h2)\n {\n vector v;\n for(int i=1;i<=h1;++i)\n for(int j=1;j<=w1;++j)\n v.push_back(Node(i,j));\n for(int i=h1+1;i<=h1+h2;++i)\n \tfor(int j=1;j<=w2;++j)\n \t\tv.push_back(Node(i,j));\n set s;\n for(int i=0;i!=v.size();++i)\n s.insert(v[i]);\n int cnt = 0;\n for(int i=0;i!=v.size();++i)\n {//8\u4e2a\u65b9\u5411\n for(int j=0;j!=8;++j)\n {\n int newx = v[i].x + arrx[j];\n int newy = v[i].y + arry[j];\n s.insert(Node(newx,newy));\n }\n }\n cout<\nusing namespace std;\nconst int mx=1e9;\nbool prime[mx];\nvoid SieveOfEratosthenes()\n{\n\n memset(prime, true, sizeof(prime));\n\n for (int p=2; p*p<=mx; p++)\n {\n if (prime[p] == true)\n {\n\n for (int i=p*2; i<=mx; i += p)\n prime[i] = false;\n }\n }\n\n}\n\nint main()\n{\n\nSieveOfEratosthenes();\n long long int t,x,ans,y;\n cin>>t;\n while(t--)\n {\n cin>>x>>y;\n ans=(x+y)*(x-y);\n if(prime[ans]) cout<<\"YES\"<\nusing namespace std;\nmain()\n{\n int k,l,m,n;\n cin>>k>>l>>m>>n;\n long d,i,s=0;\n cin>>d;\n long a[d];\n for(i=0;i\n#include \n\nusing namespace std;\n\nconst unsigned long long P = 31;\n\nint main() {\n\tfreopen(\"input.txt\", \"r\", stdin)\n\tint n;\n\tstring s1, s2;\n\tcin >> n >> s1 >> s2;\n\tn--;\n\tfor(int i = 0; i < n; i++) {\n\t if (s2[i] == 'N') {\n\t \ts2[i] = 'S';\n\t } else if (s2[i] == 'S') {\n\t \ts2[i] = 'N';\n\t } else if (s2[i] == 'W') {\n\t \ts2[i] = 'E';\n\t } else if (s2[i]=='E') {\n\t \ts2[i] = 'W';\n\t }\n\t \n\t}\n\n\tunsigned long long pow = 1;\n\tunsigned long long h1, h2;\n\tfor (int i = n - 1; i >= 0; i--) {\n\t\th1 = h1 + (s1[i]) * pow;\n\t\th2 = h2 * P + s2[i];\n\t\tif (h1 == h2)\n\t\t{\n\t\t\tcout << \"NO\" << endl;\n\t\t\treturn 0;\n\t\t}\n\t\tpow *= P;\n\t}\n\tcout << \"YES\" << endl;\n\treturn 0;\n}", "lang": "Clang++17 Diagnostics", "bug_code_uid": "94b02ded6d7d6b76f949c27aff7000d2", "src_uid": "85f43628bec7e9b709273c34b894df6b", "apr_id": "7c25ada644093339f5a7808d55df0257", "difficulty": 2500, "tags": ["strings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.21319311663479923, "equal_cnt": 28, "replace_cnt": 20, "delete_cnt": 4, "insert_cnt": 4, "fix_ops_cnt": 28, "bug_source_code": "#include \nusing namespace std;\n\n#define long long long\n#define endl \"\\n\"\n\nint main() {\n\n ios::sync_with_stdio(false);\n cin.tie(nullptr);\n cout.tie(nullptr);\n\n long int n, L;\n cin>>n>>L;\n\n vector powers(1e8);\n powers[0] = 1;\n for(long int i = 1; i < powers.size(); i++)\n powers[i] = powers[i-1] * 2;\n\n vector c(n);\n for (long int i = 0; i < n; i++)\n cin>>c[i];\n \n for (long int i = 0; i < n - 1; i++) \n c[i + 1] = min(c[i + 1], 2 * c[i]);\n \n long int ans = LONG_MAX;\n long int sum = 0;\n \n for (long int i = n - 1; i >= 0; i--) {\n long int need = L / powers[i];\n sum += need * c[i];\n L -= need * powers[i];\n ans = min(ans, sum + (L > 0) * c[i]);\n }\n \n cout <\n#include \nusing namespace std;\nint max(int a, int b ){\n return (a>b)?a:b;\n}\nint main(){\n int n,m;\n cin >> n >> m;\n vector > score(n+1,vector(m+1,0));\n for(int i = 1 ; i <= m ; i++)\n score[0][i]=i-1;\n for(int i = 1 ; i <=n ; i++)\n score[i][0]=i-1;\n for(int i = 1 ; i <= n ; i++){\n for(int j = 1 ; j <= m ; j++){\n score[i][j]=max(score[i-1][j],score[i][j-1]);\n }\n }\n cout << score[n][m] << \" \" << n+m-1-score[n][m] << endl;\n}\n", "lang": "GNU C++11", "bug_code_uid": "cb0378cf31b9a466c4dec0e27c206c23", "src_uid": "c8378e6fcaab30d15469a55419f38b39", "apr_id": "3230ca133d5ce9e2d0649056ee41e4ed", "difficulty": 1300, "tags": ["greedy", "games", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.8496732026143791, "equal_cnt": 13, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 7, "fix_ops_cnt": 12, "bug_source_code": "#include \n\nusing namespace std;\nconst int N=1001;\nint t,n;\nstring A,B;\n\n\nint main()\n{\n for(int i=1;i<=12;i++)\n {\n if(i==2)\n {\n A=A+\"29\";\n }\n else\n if((i%2!=0 && i<=7 )||(i%2==0 && i>=8 ) )\n {\n A=A+\"31\";\n }\n else\n {\n A=A+\"30\";\n }\n }\n cin>>n;\n for(int i=1;i<=n;i++)\n {\n A=A+A;\n cin>>t;\n if(t==28|| t==29) B=B+\"29\";\n else\n if(t==30) B=B+\"30\";\n else B=B+\"31\";\n }\n if(A.find(B)>A.size()) cout<<\"NO\";\n else cout<<\"YES\";\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "2f28245c61172ec2acfd7f9990839e6c", "src_uid": "d60c8895cebcc5d0c6459238edbdb945", "apr_id": "c67b729a69ce489cda6b5b304a597792", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9945828819068255, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "#include \nusing namespace std;\nint main()\n{\n int minutes,hours;\n scanf(\"%d:%d\",& hours,minutes);\n while(1)\n {\n minutes++;\n if(minutes%60==0)\n {\n hours++;\n minutes = minutes % 60;\n }\n hours %= 24;\n if ((hours % 10 == minutes / 10) && (hours/10 == minutes%10 ))\n {\n printf(\"%02d:%02d\" ,hours , minutes);\n break;\n }\n }\n return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "5189486b7527d9e95e1764e224683deb", "src_uid": "158eae916daa3e0162d4eac0426fa87f", "apr_id": "04d3cc728950ed50c947dbc36872f4e8", "difficulty": 1000, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9992576095025983, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "// THIS IS ABU-HIJLEH ... DONT TRY TO UNDERSTAND MY SOLUTION ... I DONT UNDERSTAND IT :D\t\n#include \n#include \t\t\t\t\t\t\t\t\t\t\n#include \t\t\t\t\t\t\t\t\t\t\t\n#include \t\t\t\t\t\t\t\t\t\t\t\n#include \n#include \ntypedef long long ll;\nusing namespace std ;\t\nint main (){\nll a , b ;\ncin >> a >> b ; \nint out = 0 ;\nint s = b;\nint lol=0;string a7aa = to_string(a);\n ll q = pow(10,b*1.0);\n if(q>a)\n {\n\tcout << a7aa.length()-1;\n\treturn 0;\n }\n \nwhile(s!=0&&a>9)\n{\n\tif(a%10==0)\n\t{\n\t\ts--;\n\t\tlol++;\n\t\t//cout << lol << endl; \n\t}\n\telse\n\t{\n\t\tout++;\n\t\t//cout << out << endl;\n\t}\n\ta/=10;\n}\n\n\n\nif(s!=0&&a<9)\n{\n\tcout << a7aa.length()-1 ;\n}else\ncout << out;\nreturn 0;\n}", "lang": "MS C++", "bug_code_uid": "e4c1a4070046cdd2a7966f910278955b", "src_uid": "7a8890417aa48c2b93b559ca118853f9", "apr_id": "f269fd261bbfefc60bcfdf3f289f97c7", "difficulty": 1100, "tags": ["brute force", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.8847817538340542, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "#include\nusing namespace std;\nchar str[100];\nint solve(int arr[])\n{\n if(arr[0]==6)\n return 1;\n if(arr[0]==5&&arr[1]==1)\n return 1;\n if(arr[0]==4&&arr[1]==2)\n return 2;\n if(arr[0]==4&&arr[1]==1&&arr[2]==1)\n return 2;\n if(arr[0]==3&&arr[1]==3)\n return 2;\n if(arr[0]==3&&arr[1]==2&&arr[2]==1)\n {\n while(true);\n return 3;\n }\n if(arr[0]==3&&arr[1]==1&&arr[2]==1&&arr[3]==1)\n return 5;\n if(arr[0]==2&&arr[1]==2&&arr[2]==2)\n {\n // while(true);\n return 5;\n }\n if(arr[0]==2&&arr[1]==2&&arr[2]==1&&arr[3]==1)\n return 8;\n if(arr[0]==2&&arr[1]==1&&arr[2]==1&&arr[3]==1&&arr[4]==1)\n return 15;\n if(arr[0]==1&&arr[1]==1&&arr[2]==1&&arr[3]==1&&arr[4]==1&&arr[5]==1)\n return 30;\n}\nint main()\n{\n int n,m=0;\n int arr[6]={};\n scanf(\"%s\",str);\n for(int i=0;i<6;i++)\n {\n if(str[i]=='R')\n arr[0]++;\n if(str[i]=='O')\n arr[1]++;\n if(str[i]=='Y')\n arr[2]++;\n if(str[i]=='G')\n arr[3]++;\n if(str[i]=='B')\n arr[4]++;\n if(str[i]=='V')\n arr[5]++;\n }\n sort(arr,arr+6);\n reverse(arr,arr+6);\n printf(\"%d\\n\",solve(arr));\n return 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "28c53fad356f80d67b8f742c99fabe07", "src_uid": "8176c709c774fa87ca0e45a5a502a409", "apr_id": "9dac66f93e6e2ddc7c0f0dfebdc50350", "difficulty": 1700, "tags": ["brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.6769722814498934, "equal_cnt": 11, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "#include \nusing namespace std;\ntypedef vector vi;\n#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);\n#define endl \"\\n\"\n#define int long long\n#define pb push_back\n#define pi 3.14159265\n#define M 1000000007\n#define MM 998244353\n#define arrinput for(int i=0; i>arr[i];\n#define arrsum for(int i=0; i=0; i--)\n#define all(v) (v).begin(),(v).end()\n#define vsort sort(v.begin(), v.end());\n#define vsortdesc sort(v.begin(), v.end(), greater());\n\n/*\nint isprime(int n){\n if(n<2 || (!(n&1) && n!=2))\n return 0;\n for(int i=3; i*i<=n; i+=2){\n if(!(n%i))\n return 0;\n }\n return 1;\n}\n\nint iscomp(int n){\n for(int i=2;i<=sqrt(n);i++){\n if(n%i==0){\n return 1;}\n }\n return 0;\n}\n\nint pw(int a,int b,int p){\n if(b==0)return 1;\n int t=pw(a,b/2,p);\n if(b%2)return (((a*t)%p)*t)%p;\n else return ((t*t)%p);\n}\n\nint fact(int a){\n if((a==1)||(a==0))\n return 1;\n else\n return a*fact(a-1);\n}*/\n\nint mini(int a[], int n){\n sort(a,a+n);\n return a[0];\n}\n\nsigned main() {\n IOS\n \n int n,k,s=0,i;\n cin>>n>>k;\n int b[k],a;\n memset(b,0,sizeof(b));\n for0(i,n){\n cin>>a;\n a=a%k;\n b[a]++;\n }\n for0(i,k)\n s+=b[i]/2;\n for(i=1;i<(k+1)/2;i++){\n s+=(min(b[i],b[k-i-1]))/2;\n }\n if(k%2==0)\n cout<\nusing namespace std;\nconst int mod =1e9+7;\nconst int N=202;\nint n,dp[N][N][N];\nchar s[N];\nint slen;\nint fail[N][2],next[N];\nvoid getfail(){\nint j=0;\nnext[0]=next[1]=0;\nfor(int i=1;i0&&s[i]!=s[j])j=next[j];\n if(s[i]==s[j])j++;\n next[i+1]=j;\n }\n if(s[0]=='(') fail[0][0]=1;\n if(s[0]==')') fail[0][1]=1;\n for(int i=1;i<=slen;i++){\n int pos=i;\n while(pos&&s[pos]!='(') pos=next[pos];\n fail[i][0]=pos+1;\n if(pos==0&&s[0]==')') fail[i][0]=0;\n pos=i;\n while(pos&&s[pos]!=')') pos=next[pos];\n fail[i][1]=pos+1;\n if(pos==0&&s[0]=='(') fail[i][1]=0;\n\n}\n}\nint main(){\n scanf(\"%d%s\",&n,s);\n slen=strlen(s);\n getfail();\n memset(dp,0,sizeof dp);\n dp[0][0][0]=1;\n\n for(int i=0;i<2*n;i++){\n for(int j=0;j<=n;j++){\n for(int k=0;k\n using namespace std;\n long long int MOD=1e9+7;\n \t//#define MOD 1e9+7\n \t//#define ll long long int\t\n long long int fun(int base, int exp) {\n long long int res=1;\n while(exp>0) {\n if(exp%2==1) res=(res*base)%MOD;\n base=(base*base)%MOD;\n exp/=2;\n }\n return res%MOD;\n}\n\tvectoradj[1002];\n int main()\n {\n \tios::sync_with_stdio(false);\n \tcin.tie(0);\n \tcout.tie(0);\n \tlong long int n,m;\n \tcin>>n>>m;\n \tvectora(1e8,0);\n \ta[n]=1;\n \tbitset<1001>b(m);\n \tif(n>1000)\n \t\tcout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std ;\n\n#define pb push_back\n#define del( a ) memset( a , 0 , sizeof ( a ) )\n#define loop( i , n ) for( int i=0 ; i\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n#define MAXN 1024*1024\n#define PI acos(-1)\n#define ff first\n#define ss second\n#define mp make_pair\n#define pb push_back\n#define sz(a) (int)(a.size())\n#define all(a) a.begin(), a.end()\n#define R(a) ((a)%mod)\n\n#define ll long long\n#define pii pair\n#define pdd pair\n#define vi vector\n#define vvi vector< vi >\n\nint main (int argc, char const *argv[])\n{\n ios_base::sync_with_stdio(0); cin.tie(0);\n long long int n,g=0,r=0,y=0,b=0,j;\n string s;\n cin >> s;\n n = s.size();\n int flag = 0;\n for(int i = 0; i < n; ++i){\n if(s[i] == '!') flag = 1;\n }\n int now=0;\n if(flag == 0){\n cout << \"0 0 0 0\" << endl;\n return 0;\n }\n else{\n for(int i = 0; i < n; ++i){\n j = 4;\n if(now > 0){\n j =4*now;\n i--;\n }\n if(s[i] == '!'){\n if(i+j < n && s[i+j] == 'Y'){\n ++y;\n s[i] = 'Y';\n }\n else if(i+j < n && s[i+j] == 'G'){\n ++g;\n s[i] = 'G';\n }\n else if(i+j < n && s[i+j] == 'B'){\n ++b;\n s[i] = 'B';\n }\n else if(i+j < n && s[i+j] == 'R'){\n ++r;\n s[i] = 'R';\n }\n else now++;\n }\n for(int i = n-1; i >= 0; --i){\n j = 4;\n if(now > 0){\n ++i;\n j=4*now;\n }\n if(s[i] == '!'){\n if(i-j < n && s[i-j] == 'Y'){\n ++y;\n s[i] = 'Y';\n now = 0;\n }\n else if(i-j < n && s[i-j] == 'G'){\n ++g;\n s[i] = 'G';\n now = 0;\n }\n else if(i-j < n && s[i-j] == 'B'){\n ++b;\n s[i] = 'B';\n now= 0;\n }\n else if(i-j < n && s[i-j] == 'R'){\n ++r;\n s[i] = 'R';\n now = 0;\n }\n else ++now;\n }\n }\n }\n //cout << s << endl;\n cout << r << \" \" << b << \" \" << y << \" \"<< g << endl;\n }\n}", "lang": "GNU C++", "bug_code_uid": "88766483ef25826e303df7c5d6b51cca", "src_uid": "64fc6e9b458a9ece8ad70a8c72126b33", "apr_id": "aedbac4927c8e35f05a33ede053074a1", "difficulty": 1100, "tags": ["number theory", "brute force", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9486552567237164, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include \nusing namespace std;\n\nint main() {\n\t//freopen (\"f.in\", \"r\", stdin);\n\t//freopen (\"f.out\", \"w\", stdout);\n\tint n, a;\n\twhile (true) {\n\tcin >> n >> a;\n\tcout << (a%2?a/2+1:n/2-a/2);\n\t}\n\treturn 0;\n}\n\n", "lang": "MS C++", "bug_code_uid": "3d145ad43783e35c8130d176ea71871d", "src_uid": "aa62dcdc47d0abbba7956284c1561de8", "apr_id": "b01629e790096aa039f2a4b47e00f03a", "difficulty": 1100, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.996268656716418, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \n\nusing namespace std;\n\nint main(){\n\tint count, number;\n\tcin >> count;\n\tcin >> number;\n\tint seconds = 0;\n\tif (number % 2 == 0) {\n\t\tseconds = (count - number) / 2;\n\t}\n\telse {\n\t\tseconds = (number - 1) / 2;\n\t}\n\tseconds++;\n\tcout << seconds;\n\treturn 1;\n}", "lang": "MS C++", "bug_code_uid": "02e839fddfbf3f87ac8267b465dd74f2", "src_uid": "aa62dcdc47d0abbba7956284c1561de8", "apr_id": "05ac88abf55075ab81c7f6b489a2b0e0", "difficulty": 1100, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.2706766917293233, "equal_cnt": 29, "replace_cnt": 25, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 29, "bug_source_code": "#include\n#define ll long long\nusing namespace std;\nconst int x=1234567;\nconst int y=123456;\nconst int z=1234;\nint n;\nint main() {\n\tcin>>n;\n\tfor(int a=0; a*x<=n; a++)\n\t\tfor(int b=0; a*x+b*y<=n; b++)\n\t\t\tif((n-a*x-b*y)%z==0)\n\t\t\t\treturn printf(\"YES\");\n\treturn printf(\"NO\");\n}\n", "lang": "GNU C++11", "bug_code_uid": "fcd2feac400b4bceba66ec8f61b41afb", "src_uid": "72d7e422a865cc1f85108500bdf2adf2", "apr_id": "e15c01ddccb8f264667e4f74760862f8", "difficulty": 1300, "tags": ["brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.4878836833602585, "equal_cnt": 13, "replace_cnt": 7, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 14, "bug_source_code": "#include \n#define ll long long int\nusing namespace std;\n\nint main() {\n ios_base::sync_with_stdio(false);\n cin.tie(NULL);\n cout.tie(NULL);\n\n vectorv;\n ll A,B,C,D,count=0,i,j,k,temp;\n\n cin>>A>>B>>C>>D;\n\n for(i=A;i<=B;i++){\n for(j=B;j<=C;j++){\n \tv.push_back(i+j);\n }\n }\n sort(v.begin(),v.end());\n j=C;\n i=0;\n while(i\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\n#define REP(i,n) for(int i=0; i=b; --i)\n#define ALL(c) (c).begin(), (c).end()\n\ntypedef long long ll;\ntypedef vector VI;\ntypedef vector VL;\ntypedef vector VVL;\ntypedef vector VVI;\ntypedef pair P;\ntypedef pair PL;\n\nstring add(string &s, int a){\n\tint used[26] = {}, n = s.length();\n\tREP(i,a){\n\t\tused[s[n-1-i] - 'a'] = 1;\n\t}\n\tREP(i,26){\n\t\tif (!used[i]){\n\t\t\ts += ('a' + i);\n\t\t\ta--;\n\t\t}\n\t\tif (a == 0) break;\n\t}\n\treturn s;\n}\n\nint main() {\n\tll a, b, l, r;\n\tcin >> a >> b >> l >> r;\n\tl--;\n\tr--;\n\tif (r - l + 1 > 2 * (a + b)){\n\t\tif (a <= b)\tcout << a + 1 << endl;\n\t\telse cout << 2 * a - b << endl;\n\t\treturn 0;\n\t}\n\tif (l / (a + b) > 1){\n\t\tint x = l / (a + b) - 2;\n\t\tl -= x * (a + b);\n\t\tr -= x * (a + b);\n\t}\n\tint ans = 10000;\n\tfor (char c1 = 'a'; c1 <= 'z'; c1++){\n\t\tfor (char c2 = 'a'; c2 <= 'z'; c2++){\n\t\t\tfor (char c3 = 'a'; c3 <= 'z'; c3++){\n\t\t\t\tfor (char c4 = 'a'; c4 <= 'z'; c4++){\n\t\t\t\t\tstring s;\n\t\t\t\t\tREP(i,a) s += ('a' + i);\n\t\t\t\t\tREP(i,b) s += c1;\n\t\t\t\t\ts = add(s, a);\n\t\t\t\t\tREP(i,b) s += c2;\n\t\t\t\t\ts = add(s, a);\n\t\t\t\t\tREP(i,b) s += c3;\n\t\t\t\t\ts = add(s, a);\n\t\t\t\t\tREP(i,b) s += c4;\n\t\t\t\t\ts = add(s, a);\n\t\t\t\t\tset st;\n\t\t\t\t\t// cout << s << endl;\n\t\t\t\t\tFOR(i,l,r) st.insert(s[i]);\n\t\t\t\t\tans = min(ans, (int)st.size());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tcout << ans << endl;\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "9c0104bd69e7e611b2eced357abaf18d", "src_uid": "d055b2a594ae7788ecafb3ef80f246ec", "apr_id": "6f86069a59114a5105171e0c29904fae", "difficulty": 2200, "tags": ["games", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9586129753914989, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define M 1001000\n#define LL __int64\n#define INF 0x3f3f3f3f\n\n\nusing namespace std;\n\nint main()\n{\n int n, a, b, c;\n int a1, b1, c1;\n int i;\n int dp[5000];\n while(cin >>n>>a>>b>>c)\n {\n a1 = max(a,max(b, c));\n c1 = min(a,min(b, c));\n b1 = a+b+c-a1-c1;\n memset(dp , 0 , sizeof(dp));\n dp[0] = 1;\n for(i = 0; i <= n; i++)\n {\n if(dp[i]!=0)\n {\n dp[i+a1] = max(dp[i]+1, dp[i+a1]);\n dp[i+b1] = max(dp[i]+1, dp[i+b1]);\n dp[i+c1] = max(dp[i]+1, dp[i+c1]);\n }\n }\n cout <\nusing namespace std;\nconst int n=3;\nint main()\n{\n\tvoid display(char pass[n][n] );\n\tchar pass[n][n]={{'.','.','.'},\n\t {'.','.','.'},\n\t {'.','.','.'}};\n\tdisplay(pass);\n\tint r,c;char ch;\n\t\n\tdo{\n\tcout<<\" enter row & coloum\";\n\tcin>>r;cin>>c;\n\tpass[r-1][c-1]='x';\n\tcout<<\"enter y to repet\";\n\tcin>>ch;\n\t}while(ch=='y');\n\tdisplay(pass);\n\tif(pass[1][0]=='x'|pass[1][2]=='x'|pass[1][1]=='x')\n\t{ cout<<\"NO\";}\n\telse\n\t cout<<\"YES\";\n\t\n}\n void display(char pass[n][n] )\n {\n cout<<\"\\n\";\n for(int row =0;row<3;row++){\n \n cout<<\"\";{\n for(int column =0;column<3;column++)\n cout<\nusing namespace std;\ntypedef long long int lli;\ntypedef pair pii;\ntypedef pair pll;\ntemplate\nint sz(const T &a){return (int)a.size();}\nstruct node{\n node* left,*right;\n lli data;\n node(int a){\n left=NULL,right=NULL,data=a;\n }\n void go(){\n if(data>=2){\n node *te= new node(data/2);\n node *te2= new node(data/2);\n if(left)left->right=te;\n if(right)right->left=te2;\n te->left=left,te->right=this;\n te2->left=this,te2->right=right;\n left=te,right=te2;\n data%=2;\n right->go(),left->go();\n }\n }\n};\nnode te(0);\nint main(){\n cin.tie(NULL);\n ios_base::sync_with_stdio(false);\n lli n,l,r;\n cin>>n>>l>>r;\n l-=1,r-=1;\n node* a=&te;\n a->data=n;\n a->go();\n while(a->left)a=a->left;\n for(int i=0;iright;\n }\n int am=0;\n for(int i=l;i<=r;i++){\n if(a->data==1)am++;\n a=a->right;\n }\n printf(\"%d\\n\",am);\n return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "bee495abadca5a010e02b49636dacd43", "src_uid": "3ac61b1f8deee7911b1055c243f5eb6a", "apr_id": "d6fad252b389d877259881b4f2c951da", "difficulty": 1600, "tags": ["divide and conquer", "dfs and similar", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8152492668621701, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include \n\nusing namespace std;\nint add(int a){\n\ta = (a*(a+1))/2;\n\treturn a;\n}\nint main(){\n\tint a;cin>>a;\n\tint b=0,d;\n\tint i=1;\n\tb += add(i);\n\tbool val=true;\n\twhile(val){\n\t\td = b + add(i+1);\n\t\tif(da){\n\t\t\tval = false;\n\t\t}\n\t}\n\tcout<\nusing namespace::std;\n\nint main()\n{\n long width = 0;\n long height = 0;\n long r = 0;\n cin >> width >> height;\n\n while(width > 0 && height > 0)\n {\n ++r;\n long subtraction = width - height;\n if(subtraction > height)\n {\n width = subtraction;\n }\n else\n {\n long temp = height;\n height = subtraction;\n width = temp;\n }\n }\n\n std::cout << r << std::endl;\n return 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "ed7f836b45f01f6d9ff3eb33ab1cfa7b", "src_uid": "ce698a0eb3f5b82de58feb177ce43b83", "apr_id": "2add092e254f6a34e8a7238b3aebc1e5", "difficulty": 1100, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9735596994155302, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\ntypedef long long llint;\nvector f(const std::string& s) {\n vector ret(s.size() + 1, 0);\n for (auto i = 0; i < s.size(); ++i) {\n ret[i + 1] = ret[i] + (s[i] == 'A' ? 1 : 0);\n }\n return ret;\n}\nvector g(const std::string& s) {\n vector ret(s.size() + 1, 0);\n for (auto i = 0; i < s.size(); ++i) {\n if (s[i] == 'A') {\n ret[i + 1] = ret[i] + 1;\n }\n }\n return ret;\n}\nint main() {\n string s, t;\n int q;\n cin >> s >> t >> q;\n auto sa = f(s);\n auto ta = f(t);\n auto se = g(s);\n auto te = g(t);\n while (q--) {\n int a, b, c, d;\n cin >> a >> b >> c >> d;\n int x = b - a + 1 - (sa[b] - sa[a - 1]);\n int y = d - c + 1 - (ta[d] - ta[c - 1]);\n if (x > y) {\n cout << 0;\n } else {\n if ((y - x) % 2 != 0) {\n cout << 0;\n } else {\n int zs = min(b - a + 1, se[b]), zt = min(d - c + 1, te[d]);\n int z = (y - x) / 2;\n if (zs >= zt) {\n cout << (z > 0 ? 1 : (zs % 3 == zt % 3 ? 1 : 0));\n } else {\n cout << 0;\n }\n }\n }\n }\n cout << endl;\n return 0;\n}\n", "lang": "GNU C++14", "bug_code_uid": "d4fb0b266a9c3ac3555abe2b64a8b560", "src_uid": "98e3182f047a7e7b10be7f207b219267", "apr_id": "79ae59852c7722d2bbbdd4f26217c68f", "difficulty": 2500, "tags": ["strings", "constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.998389694041868, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "#include \nusing namespace std;\ntypedef long long LL;\n\nconst int MOD=1000000007;\n\nLL fac[1100000],inv[1100000],f[1100];\nLL ret=0;\nint n,m,k,i,j;\n\nLL pow(int a,int n){\n if (!n) return 1LL;\n LL ret=pow(a,n/2);\n ret=ret*ret%MOD;\n if (n%2) ret=ret*a%MOD;\n return ret;\n}\n\nLL com(int n,int m){\n return fac[n]*inv[m]%MOD*inv[n-m]%MOD;\n}\n\nLL calc(int x){\n if (f[x]!=-1) return f[x];\n LL ret=0,F=1;\n for(int i=x;i;i--){\n ret+=pow(i,n)*com(x,i)%MOD*F;\n ret%=MOD;\n F=-F;\n }\n if (ret<0) ret+=MOD;\n f[x]=ret;\n return ret;\n}\n\nint main(){\n cin>>n>>m>>k;\n if (m==1) cout<\nusing namespace std;\n#define ll long long\n#define pi 2*acos(0.0)\n#define f first\n#define s second\n#define pb push_back\n#define gap ' '\n#define fastio {ios_base::sync_with_stdio(false);cin.tie(NULL);}\n#define mod 1000000007\n#define INF 1e18+100\nstring cmp[1000005];\nvoid Make()\n{\n for(int i=0;i<=999999;i++)\n {\n int I=i;\n for(int j=0;j<6;j++)\n {\n cmp[i]+=(I%10)+'0';\n I/=10;\n }\n }\n}\nint main()\n{\n fastio;\n Make();\n string s;\n cin>>s;\n int res=0;\n for(int i=0;i<=999999;i++)\n {\n int sum=0;\n for(int j=0;j<3;i++)\n {\n sum+=(cmp[i][j]-'0');\n }\n for(int j=3;j<6;j++)\n {\n sum-=(cmp[i][j]-'0');\n }\n if(!sum){\n int tmp=0;\n for(int j=0;j<6;j++) if(s[i]!=cmp[i][j]) tmp++;\n res=min(res,tmp);\n }\n }\n cout<\n#include \n\nusing namespace std;\nint a[105];\nint main()\n{\n while(1){\n int temp,sum = 0;\n memset(a,0,sizeof(a));\n for(int i = 1;i <= 5;i ++){\n cin>>temp;\n sum += temp;\n a[temp]++;\n }\n for(int i = 100;i >= 0;i --){\n if(a[i] >= 3){\n sum -= i*3;\n break;\n }\n if(a[i] == 2){\n sum -= i*2;\n break;\n }\n }\n cout<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define N 5\n#define inf 0x3f3f3f3f\n#define LL long long\nusing namespace std;\nchar mapp[N][N];\nint main() {\n\tcin.sync_with_stdio(false);\n\twhile(true){\n\tfor (int i = 0; i < 4; i++) {\n\t\tfor (int j = 0; j < 4; j++) {\n\t\t\tcin >> mapp[i][j];\n\t\t}\n\t}\n\tint flag = 1;\n\tfor (int i = 0; i < 4 && flag; i++) {\n\t\tfor (int j = 0; j < 4 && flag; j++) {\n\t\t\tif (mapp[i][j] == '.' || mapp[i][j] == 'x') {\n\t\t\t\tif (i - 1 >= 0 && j - 1 >= 0 && i + 1 < 4 && j + 1 < 4) {\n\t\t\t\t\tif (mapp[i - 1][j - 1] == 'x'&&mapp[i + 1][j + 1] == 'x') {\n\t\t\t\t\t\tflag = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (i - 1 >= 0 && i + 1 < 4) {\n\t\t\t\t\tif (mapp[i - 1][j] == 'x'&&mapp[i + 1][j] == 'x') {\n\t\t\t\t\t\tflag = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (j - 1 >= 0 && j + 1 < 4) {\n\t\t\t\t\tif (mapp[i][j - 1] == 'x'&&mapp[i][j + 1] == 'x') {\n\t\t\t\t\t\tflag = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (i - 2 >= 0 && j - 2 >= 0) {\n\t\t\t\t\tif (mapp[i - 2][j - 2] == 'x'&&mapp[i - 1][j - 1] == 'x') {\n\t\t\t\t\t\tflag = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (i + 2 < 4 && j + 2 < 4) {\n\t\t\t\t\tif (mapp[i + 2][j + 2] == 'x'&&mapp[i + 1][j + 1] == 'x') {\n\t\t\t\t\t\tflag = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (i - 2 >= 0) {\n\t\t\t\t\tif (mapp[i - 1][j] == 'x'&&mapp[i - 2][j] == 'x') {\n\t\t\t\t\t\tflag = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (i + 2 < 4) {\n\t\t\t\t\tif (mapp[i + 2][j] == 'x'&&mapp[i + 1][j] == 'x') {\n\t\t\t\t\t\tflag = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (j - 2 >= 0) {\n\t\t\t\t\tif (mapp[i][j - 1] == 'x'&&mapp[i][j - 2] == 'x') {\n\t\t\t\t\t\tflag = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (j + 2 < 4) {\n\t\t\t\t\tif (mapp[i][j + 2] == 'x'&&mapp[i][j + 1] == 'x') {\n\t\t\t\t\t\tflag = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif (flag) {\n\t\tcout << \"NO\" << endl;\n\t}\n\telse {\n\t\tcout << \"YES\" << endl;\n\t}\n}\n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "c3a327efc6a4fbc21b4187be0d3b97e8", "src_uid": "ca4a77fe9718b8bd0b3cc3d956e22917", "apr_id": "20b0e266fd03c07935d6d1266b80aba1", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.5266146202980837, "equal_cnt": 15, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 14, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n//#define abs(x) ( (x) > 0 ? (x) : -(x))\n\nusing namespace std;\n\nint main ()\n{\n\tint x, y;\n\tint ok = 0;\n\tint c = 0;\n\tcin >> x >> y;\n\tif ((x == 0) || (y == 0)){\tcout << \"black\";return 0;}\n\tif ((x < 0) && (y < 0)) {x = abs(x); y = abs(y); }\n\tif ((x < 0) || (y < 0)){ ok = 1; x = abs(x); y = abs(y);}\n\tx = abs(x);\n\ty = abs(y);\n\tc = max (x, y);\n\tif (ok == 0) { \n\t\tif ((c % 2) == 1){\tcout << \"white\";return 0;}\n\t\telse\t\t{\tcout << \"black\";return 0;}\n\t}\n\telse if (ok == 1) { \t\n\t\tfor (;;);\n\t\tif ((c % 2) == 0){\tcout << \"white\";return 0;}\n\t\telse\t\t{\tcout << \"black\";return 0;}\n\t}\n\treturn 0;\n}\n", "lang": "GNU C++", "bug_code_uid": "b9c2c54b1541816ac71921f274b430f9", "src_uid": "8c92aac1bef5822848a136a1328346c6", "apr_id": "7379cde334be32811399b4482ccb379e", "difficulty": 1300, "tags": ["geometry", "math", "constructive algorithms", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7789473684210526, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 8, "bug_source_code": "#include \n\nusing namespace std;\nint n,d,c=1;\nint temp=5;\nint main()\n{\n cin>>n>>d;\n int t[n];\n for(int i=1;i<=n;i++) {\n cin>>t[i];\n temp+=t[i];\n if(i!=n) {temp+=10;\n c+=2;}\n if(i=n||temp=5){\n c++;\n diff-=5;\n }\n }\n\n }\n if(temp<=d) cout<\n\nusing namespace std;\n\nint main()\n{\n int songs=0,time=0,stop=0,jokes=0;\n int duration=0;\n cin>>songs>>time;\n for(int i=0; i>duration;\n time=time-duration;\n stop=time;\n do{\n time=time-5;\n jokes++;\n }while(stop-10==time || time!=0);\n }\n if(time<0 || jokes<0){\n cout<<-1;\n }\n else{\n cout<\nusing namespace std;\n\ntypedef long long ll;\ntypedef vector vi;\ntypedef vector vvi;\ntypedef pair ii;\ntypedef pair pll;\ntypedef double ld;\n\nld revs,a,b,c,d,C,totdist;\nconst ld pi=atan(1)*4;\n\nint n,r,v,s,f;\n\nld distcovered(ld t) {\n\treturn max(r*(t+sin(t)),r*(t-sin(t)));\n}\n\nint main() {\n\tcout << fixed << setprecision(8);\n\tcin >> n >> r >> v;\n\tfor (int c=0;c> s >> f;\n\t\tscanf(\"%d%d\",&s,&f);\n\t\t\n\t\ta=f-s;\n\t\ta=a/2;\n\n\t\tld up,low;\n\t\tlow=0;up=a/r+2*pi;\n\t\tfor (int c=0;c<200;c++) {\n\t\t\tld mid=(low+up)/2;\n\t\t\tb=distcovered(mid);\n\t\t\tif (b == a) break;\n\t\t\telse if (b>a) up=mid;\n\t\t\telse low=mid;\n\t\t}\n\t\tld mid=(low+up)/2;\n\n\t\tld speed=(ld)v/r;\n\t\tld time=mid/speed*2;\n\t\t//cout << time << endl;\n\t\tprintf(\"%.8f\",time);\n\n\t\t//totdist\n\t}\n\treturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "eda68a0c7cce446cafd333f50f611f26", "src_uid": "3882f2c02e83bd2d55de8004ea3bbd88", "apr_id": "d31571912fe9a94802cbd34a8442071a", "difficulty": 2500, "tags": ["geometry"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.7473757872638208, "equal_cnt": 25, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 18, "fix_ops_cnt": 24, "bug_source_code": "#include \nusing namespace std;\nint main()\n{\n\tint x, y;\n\tcin >> x >> y;\n\tint resX = x;\n\tint resY = y;\n\tif (y - x == 1 || x - y == 1)\n\t{\n\t\tcout << \"Yes\";\n\t\treturn 0;\n\t}\n\twhile (true)\n\t{\n\t\twhile (resX > resY)\n\t\t{\n\t\t\tif ((resX == 5 && resY == 2) || (resX == 4 && resY == 3) || (resX == 3 && resY == 4))\n\t\t\t{\n\t\t\t\tcout << \"Yes\" << endl;\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tresX--;\n\t\t\tresY++;\t\t\n\t\t\t//cout << \"ResX: \" << resX << \" ResY: \" << resY << endl;\n\t\t}\n\t\t//cout << \"----\" << endl;\n\t\tx -= 2;\n\t\tresX = x;\n\t\tresY = y;\n\t\tif (resX < 0 || resY < 0)\n\t\t{\n\t\t\tcout << \"No\" << endl;\n\t\t\treturn 0;\n\t\t}\n\t\t \n\t}\n}\n", "lang": "MS C++", "bug_code_uid": "faa69e903a73f112ffacaaaea2fdb909", "src_uid": "1527171297a0b9c5adf356a549f313b9", "apr_id": "a508af6b1475011bc12a6acfa91df35f", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9615841584158416, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "#include\n\nusing namespace std;\nint main()\n{\n int n,r;\n cin>>n;\n string a=\" \";\n if(n==0)\n {\n cout<<\"O-|-OOOO\";\n return 0;\n }\n while(n)\n {\n r=n%10;\n if(r==5)\n {\n cout<<\"-O|-OOOO\"<5)\n {\n int s=n-5;\n int r=5-s;\n string str=\"-O|\";\n while(s--)\n {\n str+='O';\n }\n if(r)\n {\n str+='-';\n r--;\n while(r--)\n {\n str+='O';\n }\n }\n cout<\r\n\r\nusing namespace std;\r\n\r\nconst int N = 21 + 5, M = 3e6, Mod = 31607;\r\nint n = 0, m = 0, k = 1, a[n][n] = {};\r\nint pre[N][N] = {}, dp[M] = {}, cnt[M] = {};\r\n\r\nint main(){\r\n\tcin >> n;\r\n\tfor(int i = 0 ; i < Mod - 2 ; i ++) k = (k * 1e4) % Mod\r\n\tfor(int i = 1 ; i <= n ; i ++) for(int j = 1 ; j <= n ; j ++){\r\n\t\tcin >> a[i][j];\r\n\t\ta[i][j] = ((1e4 - a[i][j]) * k) % Mod;\r\n\t}\r\n\tfor(int i = 1 ; i <= n ; i ++) pre[i][0] = 1;\r\n\tfor(int i = 1 ; i <= n ; i ++) for(int j = 1 ; j <= n ; j ++) for(int k = 0 ; k < j ; k ++) dp[i][j] = (dp[i - 1][j] * a[i][j]) % Mod;\r\n\tfor(int i = 0 ; i < m ; i ++) for(int j = 0 ; j < n ; j ++) if(i >> j & 1) cnt[]\r\n\tfor(int i = 0 ; i < m ; i ++) for(int j = 0 ; j < n ; j ++) if(i >> j & 1){\r\n\t\tdp[mask] = dp[mask - (1 << j)];\r\n\t}\r\n\treturn 0;\r\n}\r\n\r\n", "lang": "GNU C++14", "bug_code_uid": "51211d086f6cd4efd73e693f509f64e9", "src_uid": "1961e7c9120ff652b15cad5dd5ca0907", "apr_id": "99b4b62260b270e63b370c9adc9b35ef", "difficulty": 2900, "tags": ["dp", "greedy", "shortest paths"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9858793324775353, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \r\nconst int inf = 0x3f3f3f3f;\r\nint l, mxc, mxx;\r\nchar ch[53];\r\nint f[53][53][511][2];\r\nint dp(int pos, int c, int x, int delta) {\r\n if (pos == l) return c ? inf : 0;\r\n if (c > mxc || c < -mxc || x > mxx || x < -mxx) return inf;\r\n if (!(~f[pos][c + mxc][x + mxx][(delta == 1)])) f[pos][c + mxc][x + mxx][(delta == 1)] = min(dp(pos, c, x + delta, delta) + l - pos, min(dp(pos + 1, c * 10 + ch[pos + 1] - x, x, 1), dp(pos + 1, c * 10 + ch[pos + 1] - x, x, -1)));\r\n return f[pos][c + mxc][x + mxx][(delta == 1)];\r\n}\r\nint main() {\r\n scanf(\"%s\", ch + 2), l = strlen(ch + 2) + 1, ch[1] = 0, mxx = 5 * l, mxc = mxx / 10 + 1;\r\n for (int i = 2; i <= l; ++i) ch[i] ^= 48;\r\n memset(f, -1, sizeof(f)), printf(\"%d\", dp(0, 0, 0, 1));\r\n}\r\n", "lang": "GNU C++14", "bug_code_uid": "31462a8902a04205b566562d1daa8b37", "src_uid": "1961e7c9120ff652b15cad5dd5ca0907", "apr_id": "5f41b4bedb067d2f1963511e1aedc570", "difficulty": 2900, "tags": ["dp", "greedy", "shortest paths"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.927170868347339, "equal_cnt": 16, "replace_cnt": 11, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 15, "bug_source_code": "#include\r\n#define ll long long\r\n#define lll __int128\r\n#define db double\r\n#define ld long double\r\n#define pii pair\r\n#define fi first\r\n#define se second\r\nusing namespace std;\r\nconst int N=410,mod=998244353;\r\nint n,c[26],f[N][N][N][3][3],s[N][N];\r\nint main()\r\n{\r\n\tscanf(\"%d\",&n);\r\n\tfor(int i=0;i<26;i++)scanf(\"%d\",&c[i]);\r\n\tf[1][1][0][0][0]=f[1][0][1][0][1]=1,f[1][0][0][0][2]=24;\r\n\tfor(int i=0;i<=n;i++)\r\n\t\tfor(int j=0;j<=n;j++)\r\n\t\t\tfor(int k=0;k<3;k++)\r\n\t\t\t{\r\n\t\t\t\tif(i)f[2][i][j][k][0]=f[1][i-1][j][0][k];\r\n\t\t\t\tif(j)f[2][i][j][k][1]=f[1][i][j-1][0][k];\r\n\t\t\t\tf[2][i][j][k][2]=24ll*f[1][i][j][0][k]%mod;\r\n\t\t\t}\r\n\tfor(int i=3;i<=n;i++)\r\n\t\tfor(int j=0;j<=n;j++)\r\n\t\t\tfor(int k=0;k<=n;k++)\r\n\t\t\t\tfor(int l=0;l<3;l++)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(j)f[i][j][k][l][0]=(f[i-1][j-1][k][1][l]+f[i-1][j-1][k][2][l])%mod;\r\n\t\t\t\t\tif(k)f[i][j][k][l][1]=(f[i-1][j][k-1][0][l]+f[i-1][j][k-1][2][l])%mod;\r\n\t\t\t\t\tf[i][j][k][l][2]=(24ll*f[i-1][j][k][0][l]+24ll*f[i-1][j][k][1][l]+23ll*f[i-1][j][k][2][l])%mod;\r\n\t\t\t\t}\r\n\tfor(int i=n;i>=0;i--)\r\n\t\tfor(int j=n;j>=0;j--)\r\n\t\t{\r\n\t\t\tint res=0;\r\n\t\t\tfor(int k=0;k<3;k++)\r\n\t\t\t\tfor(int l=0;l<3;l++)\r\n\t\t\t\t\tres=(res+f[n][i][j][k][l])%mod;\r\n\t\t\ts[i][j]=(res+s[i][j+1]+s[i+1][j]-s[i+1][j+1]+mod)%mod;\r\n\t\t}\r\n\tint ans=s[0][0];\r\n\tfor(int i=0;i<26;i++)\r\n\t{\r\n\t\tans=(ans-s[c[i]+1][0])%mod;\r\n\t\tfor(int j=i+1;j<26;j++)\r\n\t\t\tans=(ans+s[c[i]+1][c[j]+1])%mod;\r\n\t}\r\n\tprintf(\"%d\",ans);\r\n\treturn 0;\r\n}\r\n", "lang": "GNU C++14", "bug_code_uid": "75bc2538da52d6b16fb0d5f387934c90", "src_uid": "1f012349f4b229dc98faadf1ca732355", "apr_id": "a23f34aeb546ee9f142b4280e3058d55", "difficulty": 2700, "tags": ["dp", "fft", "math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8580802882141019, "equal_cnt": 26, "replace_cnt": 12, "delete_cnt": 3, "insert_cnt": 10, "fix_ops_cnt": 25, "bug_source_code": "#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\nusing namespace std;\r\ntypedef long long ll;\r\ntypedef long double ld;\r\ntypedef string str;\r\n\r\n#define pb push_back\r\n#define ppp pop_back\r\n#define pii pair\r\n#define fi first\r\n#define se second\r\n#define stie std::tie\r\n#define vec vector\r\n#define forn(i, l, r) for (int i=l; i<=r; i++)\r\n#define forb(i, r, l) for (int i=r; i>=l; i--)\r\n#define emp empty\r\n#define beg begin\r\n#define ins insert\r\n#define cle clear\r\n#define era erase\r\n#define que queue\r\n#define pque priority_queue\r\n#define mset multiset\r\n#define deq deque\r\n#define sta stack\r\n#define con const\r\n#define rsz resize\r\n#define ass assign\r\n#define lowb lower_bound\r\n#define uppb upper_bound\r\n\r\ntemplate void mini(T& a, T b) { a = min(a, b); }\r\ntemplate void maxi(T& a, T b) { a = max(a, b); }\r\ntemplate T gcd(T a, T b) { return b == 0 ? a : gcd(b, a % b); }\r\ntemplate \r\nostream& operator<<(ostream& os, pair const& a) { return os << \"[\" << a.first << \", \" << a.second << \"]\"; }\r\ntemplate \r\nbasic_ostream& operator<<(basic_ostream& os, Container const& a) { os << \"{ \"; for (auto& i : a) os << i << \" \"; return os << \"}\"; }\r\ntemplate void out(T a) { cout << a << endl; }\r\ntemplate void out(T a, Args... args) { cout << a << \" \"; out(args...); }\r\ntemplate void out( std::initializer_list a) { for (auto i : a) { cout << i << \" \"; } cout << endl; }\r\ntemplate void out(vector> a) { for (vector i : a) out(i); }\r\ntemplate void out_(T a[], int l, int r) { for (int i = l; i <= r; i++) cout << a[i] << \" \"; cout << endl; }\r\nvoid out() { cout << \"OK\" << endl; }\r\ntemplate void sort(vector& a) { sort(a.begin(), a.end()); }\r\ntemplate void rever(vector& a) { reverse(a.begin(), a.end()); }\r\ntemplate void uniq(vector& a) { sort(a); a.erase(unique(a.begin(), a.end()), a.end()); }\r\ntemplate vector set_int(vector a, vector b) { sort(a); sort(b); vector res;\r\nset_intersection(a.begin(), a.end(), b.begin(), b.end(), back_inserter(res)); return res; }\r\nclock_t start_time; void start_timer() { start_time = clock(); }\r\ndouble get_time() { return (double)(clock() - start_time) / CLOCKS_PER_SEC; }\r\n#if __SIZEOF_INT128__ >= 16\r\ntypedef __int128 LL;\r\nistream& operator>>(istream& in, __int128& a) { int64_t b; in >> b; a = b; return in; }\r\nostream& operator<<(ostream& out, const __int128 a) {\r\n unsigned __int128 b = a < 0 ? -a : a; char buf[128]; char* c = end(buf); do { --c; *c = \"0123456789\"[b % 10]; b /= 10; } while (b);\r\n if (a < 0) { --c; *c = '-'; } int64_t len = end(buf) - c; out.rdbuf()->sputn(c, len); return out;\r\n}\r\n#endif\r\n\r\ntemplate\r\nstruct mint {\r\n int x = 0;\r\n mint(int64_t a = 0) { if (a < 0) a = a % m + m; if (a >= m) a %= m; x = static_cast(a); }\r\n friend istream& operator>>(istream& in, mint& a) { int64_t y; in >> y; a = y; return in; }\r\n friend ostream& operator<<(ostream& out, mint a) { return out << a.x; }\r\n explicit operator int() const { return x; }\r\n static int mod_inv(int a, int mod = m) {\r\n // https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm#Example\r\n int g = mod, r = a, z = 0, y = 1;\r\n while (r != 0) { int q = g / r; g %= r; swap(g, r); z -= q * y; swap(z, y); }\r\n return z < 0 ? z + mod : z;\r\n }\r\n mint inv() const { return mod_inv(x, m); }\r\n friend mint binpow(mint a, int64_t b) { mint res = 1; while (b) { if (b & 1) res *= a; b >>= 1; a *= a; } return res; }\r\n mint pow(int64_t b) const { return binpow(*this, b); }\r\n mint operator-() const { return x ? m - x : 0; }\r\n mint& operator+=(const mint& a) { x += a.x; if (x >= m) x -= m; return *this; }\r\n mint& operator-=(const mint& a) { x -= a.x; if (x < 0) x += m; return *this; }\r\n static unsigned fast_mod(uint64_t x, unsigned mod = m) {\r\n return x % mod;\r\n }\r\n mint& operator*=(const mint& a) { x = fast_mod((uint64_t) x * a.x); return *this; }\r\n mint& operator/=(const mint& a) { return *this *= a.inv(); }\r\n friend mint operator+(mint a, const mint& b) { return a += b; }\r\n friend mint operator-(mint a, const mint& b) { return a -= b; }\r\n friend mint operator*(mint a, const mint& b) { return a *= b; }\r\n friend mint operator/(mint a, const mint& b) { return a /= b; }\r\n mint& operator++() { x = x == m - 1 ? 0 : x + 1; return *this; }\r\n mint& operator--() { x = x == 0 ? m - 1 : x - 1; return *this; }\r\n mint operator++(int) { mint a = *this; ++*this; return a; }\r\n mint operator--(int) { mint a = *this; --*this; return a; }\r\n bool operator==(const mint& a) const { return x == a.x; }\r\n bool operator!=(const mint& a) const { return x != a.x; }\r\n};\r\n\r\ncon int mod = 998244353;\r\n\r\n#define mi mint\r\n\r\ncon int N = 405;\r\ncon int K = 26;\r\n\r\nmi dp[N][N][N][3][3];\r\nint c[K];\r\n\r\nvoid Solve() { \r\n int n;\r\n cin >> n;\r\n forn(i, 0, K-1) {\r\n cin >> c[i];\r\n }\r\n mi ans = mi(26) * mi(26) * mi(25).pow(n - 2);\r\n /*\r\n dp[1][1][0][2][0] = 1;\r\n dp[1][0][1][2][1] = 1;\r\n dp[1][0][0][2][2] = K - 2;\r\n */\r\n \r\n dp[2][2][0][0][0]= 1;\r\n dp[2][1][1][0][1] = 1;\r\n dp[2][1][1][1][0] = 1;\r\n dp[2][0][2][1][1] = 1;\r\n dp[2][1][0][2][0] = K - 2;\r\n dp[2][1][0][0][2] = K - 2;\r\n dp[2][0][1][2][1] = K - 2;\r\n dp[2][0][1][1][2] = K - 2;\r\n dp[2][0][0][2][2] = (K - 2) * (K - 2);\r\n\r\n forn(i, 2, n) {\r\n forn(a, 0, n) {\r\n forn(b, 0, n) {\r\n forn(x, 0, 2) {\r\n forn(y, 0, 2) {\r\n mi cur = dp[i - 1][a][b][x][y];\r\n if (x != 0) {\r\n dp[i][a + 1][b][y][0] += cur;\r\n }\r\n if (x != 1) {\r\n dp[i][a][b + 1][y][1] += cur;\r\n }\r\n if (x == 2) {\r\n dp[i][a][b][y][2] += cur * mi(K - 3);\r\n }\r\n else {\r\n dp[i][a][b][y][2] += cur * mi(K - 2);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n forn(i, 0, K-1) {\r\n mi cur = 0;\r\n forn(a, 0, n) {\r\n forn(b, 0, n) {\r\n forn(x, 0, 2) {\r\n forn(y, 0, 2) {\r\n if (a > c[i]) {\r\n cur += dp[n][a][b][x][y];\r\n }\r\n }\r\n }\r\n }\r\n }\r\n ans -= cur;\r\n }\r\n forn(i, 0, K-1) {\r\n forn(j, i+1, K-1) {\r\n mi cur = 0;\r\n forn(a, 0, n) {\r\n forn(b, 0, n) {\r\n forn(x, 0, 2) {\r\n forn(y, 0, 2) {\r\n if (a > c[i] && b > c[j]) {\r\n cur += dp[n][a][b][x][y];\r\n }\r\n }\r\n }\r\n }\r\n }\r\n ans += cur;\r\n }\r\n }\r\n out(ans);\r\n}\r\n \r\nint main() {\r\n ios_base::sync_with_stdio(0); cin.tie(0);\r\n#ifdef LOCAL\r\n freopen(\"usr/share/man/man1/input.txt\", \"r\", stdin);\r\n#endif\r\n start_timer();\r\n Solve();\r\n return 0;\r\n}\r\n", "lang": "GNU C++17", "bug_code_uid": "0eb2b9ab36d5a326bba8b203178678f5", "src_uid": "1f012349f4b229dc98faadf1ca732355", "apr_id": "36d2bf24a2bb691fb009bae526bf25ce", "difficulty": 2700, "tags": ["dp", "fft", "math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5482938114517062, "equal_cnt": 15, "replace_cnt": 2, "delete_cnt": 6, "insert_cnt": 7, "fix_ops_cnt": 15, "bug_source_code": "#include\r\nusing namespace std;\r\nlong long a,b,mod,d[40001],cnt,sum[2505][55];\r\nlong long t[2505][55];\r\nint main()\r\n{\r\n\tscanf(\"%lld%lld\",&a,&mod);\r\n\tif(a>40)\r\n\t{\r\n\t\tfor(int i=1;i<=1000000000;i++)\r\n\t\t{\r\n\t\t\ta++;\r\n\t\t\ta=a*2;\r\n\t\t\ta%=mod;\r\n\t\t}\r\n\t\tprintf(\"%lld\",a);\r\n\t\treturn 0;\r\n\t}\r\n\tif(a==2||a==1)\r\n\t{\r\n\t\tprintf(\"0\\n\");\r\n\t\treturn 0;\r\n\t}\r\n\td[1]=1;\r\n\td[2]=1;\r\n\tcnt=2;\r\n\tlong long ls=0;\r\n\tfor(int i=3;i<=a;i++)\r\n\t{\r\n\t\tfor(int j=1;j<=i;j++)\r\n\t\t{\r\n\t\t\tfor(int k=1;k<=cnt;k++)\r\n\t\t\t{\r\n\t\t\t\tt[j][k+j-1]=d[k];\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor(int j=1;j<=cnt+i-1;j++)\r\n\t\t{\r\n\t\t\td[j]=0;\r\n\t\t\tfor(int k=1;k<=i;k++)\r\n\t\t\t{\r\n\t\t\t\td[j]+=t[k][j];\r\n\t\t\t\td[j]%=mod;\r\n\t\t\t}\r\n//\t\t\tcout<=1;j--)\r\n\t\t{\r\n\t\t\tfor(int k=1;k<=cnt;k++)\r\n\t\t\t{\r\n\t\t\t\tsum[j][k]=sum[j][k-1]+sum[j+1][k]-sum[j+1][k-1]+t[j][k];\r\n\t\t\t\tsum[j][k]%=mod;\r\n\t\t\t}\r\n\t\t}\r\n\t\tlong long ann=ls*i%mod;\r\n\t\tfor(int j=1;j\r\nusing namespace std;\r\nlong long a,b,mod,d[40001],cnt,sum[2505][55];\r\nlong long t[2505][55];\r\nint main()\r\n{\r\n\tscanf(\"%lld%lld\",&a,&mod);\r\n\tif(a>40)\r\n\t{\r\n\t\tfor(int i=1;i<=1000000000;i++)\r\n\t\t{\r\n\t\t\ta++;\r\n\t\t\ta=a*2;\r\n\t\t\ta%=mod;\r\n\t\t}\r\n\t\tprintf(\"%lld\",a);\r\n\t\treturn 0;\r\n\t}\r\n\tif(a==2||a==1)\r\n\t{\r\n\t\tprintf(\"0\\n\");\r\n\t\treturn 0;\r\n\t}\r\n\td[1]=1;\r\n\td[2]=1;\r\n\tcnt=2;\r\n\tlong long ls=0;\r\n\tfor(int i=3;i<=a;i++)\r\n\t{\r\n\t\tfor(int j=1;j<=i;j++)\r\n\t\t{\r\n\t\t\tfor(int k=1;k<=cnt;k++)\r\n\t\t\t{\r\n\t\t\t\tt[j][k+j-1]=d[k];\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor(int j=1;j<=cnt+i-1;j++)\r\n\t\t{\r\n\t\t\td[j]=0;\r\n\t\t\tfor(int k=1;k<=i;k++)\r\n\t\t\t{\r\n\t\t\t\td[j]+=t[k][j];\r\n\t\t\t\td[j]%=mod;\r\n\t\t\t}\r\n//\t\t\tcout<=1;j--)\r\n\t\t{\r\n\t\t\tfor(int k=1;k<=cnt;k++)\r\n\t\t\t{\r\n\t\t\t\tsum[j][k]=sum[j][k-1]+sum[j+1][k]-sum[j+1][k-1]+t[j][k];\r\n\t\t\t\tsum[j][k]%=mod;\r\n\t\t\t}\r\n\t\t}\r\n\t\tlong long ann=ls*i%mod;\r\n\t\tfor(int j=1;j\r\n#define maxn 20010\r\nusing namespace std;\r\nint n, mod, w[2][2 * maxn + 5], s[2][2 * maxn + 5], ans[55];\r\nint main()\r\n{\r\n\tcin >> n >> mod;\r\n\tw[0][maxn] = s[0][maxn] = 1;\r\n\tfor (int i = maxn; i <= 2 * maxn; i ++ ) s[0][i] = 1;\r\n\tfor (int i = 1; i <= n; i ++ )\r\n\t{\r\n\t\tint curs = 1, I = i & 1, J = I ^ 1;\r\n\t\tmemset(w[I], 0, sizeof(w[I])), memset(s[I], 0, sizeof(s[I]));\r\n\t\tfor (int u = i * (i - 1) / 2, j = -u + B; j <= u + B; j ++ ) w[I][j] = curs, curs = (0ll + curs - s[J][j] + s[J][j - i] + s[J][j + i] - s[J][j] + 2ll * mod) % mod;\r\n\t\tfor (int j = B - i * (i - 1) / 2, v = (i + 2) * (i + 1) / 2 + B;j <= v; j ++ ) s[I][j] = (s[I][j - 1] + w[I][j]) % mod;\r\n\t\tfor (int j = 1; j < i; j ++ ) ans[i] = (ans[i] + 1ll * (s[J][(i + 1) * i / 2 + B] - s[J][j + B] + mod) % mod * (i - j)) % mod;\r\n\t}\r\n\tfor (int i = 2; i <= n; i ++ ) ans[i] = (ans[i] + 1ll * i * ans[i - 1]) % mod;\r\n\tcout << ans[n] << endl;\r\n}", "lang": "GNU C++11", "bug_code_uid": "0c1e16961e9abd80487630b6debad436", "src_uid": "ae0320a57d73fab1d05f5d10fbdb9e1a", "apr_id": "1988ebd58a5c28670da20a96a5a1a0de", "difficulty": 2400, "tags": ["dp", "fft", "math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7863849765258216, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 9, "bug_source_code": "#include \r\nusing namespace std;\r\nint n,k=0;\r\nint a[100005]= {0,1};\r\nint b[100005]= {0,1};\r\nint c[100005]= {0};\r\nconst int N=998244353;\r\nint i,j;\r\nint main()\r\n{\r\n\tcin>>n;\r\n\tfor(i=1; i<=n; i++)\r\n\t{\r\n\t\tfor(j=i; j<=n; j+=i)\r\n\t\t{\r\n\t\t\tc[j]++;\r\n\t\t}\r\n\t}\r\n\tfor(i=2; i<=n; i++)\r\n\t{\r\n\t\ta[i]=(b[i-1]%N+c[i]%N)%N;\r\n\t\tb[i]=(b[i-1]%N+a[i]%N)%N;\r\n\t}\r\n\tcout<\nusing namespace std;\nlong long n,m,f[4000010],sum[4000010];\nint main(){\n\tscanf(\"%lld%lld\",&n,&m);\n\tf[n]=1;\n\tsum[n]=1;\n\tfor(int i=n-1;i>=1;i--){\n\t\tfor(int j=2;j*i<=n;j++){\n\t\t\tf[i]=(f[i]+sum[i*j]-sum[min(i*j+j,n+1)])%m;\n\t\t\tf[i]=(f[i]+m)%m;\n\t\t}\n\t\tf[i]=(f[i]+sum[i+1])%m;\n\t\tsum[i]=(sum[i+1]+f[i])%m;\n\t}\n\tcout<\r\nusing namespace std;\r\nint f[int(4e6) + 1];\r\nlong long g[int(4e6) + 1];\r\nint main() {\r\n int n, m;\r\n cin >> n >> m;\r\n f[1] = 1\r\n for (int i = 2; i <= n; i++) {\r\n f[i] = ((f[i - 1] << 1) + g[i]) % m;\r\n if (i == 2) f[i] = 2;\r\n if (f[i] < 0) f[i] += m;\r\n for (int k = 2; k * i <= n; k++) {\r\n g[k * i] += f[i] - f[i - 1];\r\n }\r\n }\r\n cout << f[n] << endl;\r\n return 0;\r\n}", "lang": "GNU C++17", "bug_code_uid": "41f13795ebc169dafdfec9ade5997a8a", "src_uid": "77443424be253352aaf2b6c89bdd4671", "apr_id": "95ecfd24c19940217b372f39ce034ccc", "difficulty": 1900, "tags": ["dp", "number theory", "math", "brute force", "two pointers"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.6845481049562682, "equal_cnt": 12, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 11, "bug_source_code": "#include \r\nusing namespace std;\r\nconst int M=998244353,B=720720;\r\nint g[B], ng[B];\r\nlong long result;\r\nlong long s;\r\nint n,a,x,y,k,MOD;\r\n\r\nint main () {\r\n cin>>n>>a>>x>>y>>k>>MOD;\r\n\tfor(int i=0;i<(1<>j)&1) sum++;\r\n\t\t\telse mul = (1ll*mul*(n-1))%M;\r\n\t\t}\r\n\t\ts = (s+sum*mul)%M;\r\n\t}\r\n\tfor(int i=0;i\r\nenum{P=998244353};\r\nint f[720729];\r\nint main(){\r\n\tint n,a,x,y,k,M,i,j,m=1,s=0,w,o=1;\r\n\tfor(std::cin>>n>>a>>x>>y>>k>>M,w=k,i=1;i\n#define curtime chrono::high_resolution_clock::now()\n#pragma GCC optimize(\"Ofast\")\n#pragma GCC target(\"avx,avx2,fma\")\n#define timedif(start,end) chrono::duration_cast(end - start).count()\nusing namespace std;\n#define RESET \"\\033[0m\"\n#define BR \"\\033[1m\\033[31m\" /* Bold Red */\n#define BG \"\\033[1m\\033[32m\" /* Bold Green */\n#define BB \"\\033[1m\\033[34m\" /* Bold Blue */\n#define ll long long\n#define ld long double\n#define INF 1000000007\n#define pb push_back\n#define pf push_front\n#define fu(i,n) for(int i = 0; i < n; i++)\n#define fu1(i,n) for(int i = 1; i <= n; i++)\n#define fd(i,n) for(int i = n-1; i > -1; i--)\n#define fd1(i,n) for(int i = n ; i >= 1; i--)\n#define vi vector\n#define vs vector\n#define pi pair\n#define umap unordered_map\n#define cinarr(a) for(auto &zz:a)cin>>zz\n#define mp make_pair\n#define allvec(v) v.begin(), v.end()\n/**\n * I/O\n **/\n#define int long long\n#define output(value) cout << value << \"\\n\"\n#define error(errorString) cout << BR << errorString << RESET<< \"\\n\"\n#define info(infoString) cout << BB << infoString << RESET << \"\\n\"\n#define success(successString) cout << BB << successString << RESET << \"\\n\"\n#define allarr(a,n) a, a+n\n#define MOD 1000000007\n// precedence order :- double > float > long long int > long int > int > char\n// remember that boolean arrays and variables if uninitialized are given false\n//Check if constraints are correct\n// for single arrays declare them as long long int\n//overflow must be taken care of!! use strings when big\n//\t0 < |int| < 1e9\n//\t0 < |long int| < 1e12\n//\t0 < |long long int| < 1e18\n//when you are working with stacks, remember to take care of stacks of 0 size\n//when you see a problem, and you know how you would tackle it in the real world, but don't know how\n//you would do it in code, go step by step, in each step try to be concious of what you want to do\n//and once you have done so, review through and remember what data structure would be perfect\n//when we pass an array in a function the pointer is passed but when we pass a vector, a copy is passed\ntemplate\nvoid take(vector &v, int &n){\n cin>>n;\n v.resize(n);\n cinarr(v);\n}\ntemplate\nvoid take(vector> &v, int &n, int &m ){\n cin>>n>>m;\n v.resize(n,vector(m));\n for(int i =0 ;i < n; i++){\n for(int j = 0; j < m; j++){\n cin>>v[i][j];\n }\n }\n}\n\n//\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\DEBUG/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\///\\/\\/\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\nvoid __print(const pair &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}\ntemplate\nvoid __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? \",\" : \"\"), __print(i); cerr << \"}\";}\nvoid _print() {cerr << \"]\\n\"<\nvoid _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << \", \"; _print(v...);}\n#ifdef DEBUG\n#define debug(x...) cerr < (n).to_string();\n \n //Finding the first occurrence of \"1\"\n //to strip off the leading zeroes.\n const auto loc1 = s.find('1');\n \n if(loc1 != string::npos)\n return s.substr(loc1);\n \n return \"0\";\n}\nint x,y;\n//\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\///\\/\\/\\/\\/\\/\\/\nvoid take(){\n cin>>x>>y;\n}\n\nvoid solve(){\n take();\n string a = decimalToBinary(x);\n string b = decimalToBinary(y);\n if(a == b){\n cout<<\"YES\\n\";\n return;\n }\n while(a.back() == '0') a.pop_back();\n if(b.size() < a.size()){\n cout<<\"NO\\n\";\n return;\n }\n int ind = -1;\n for(int i = 0; i < b.size()-a.size()+1; i++){\n string temp = \"\";\n bool is = true;\n for(int j = i; j < i+a.size(); j++){\n if(b[j] != a[j-i]){\n is = false;\n break;\n }\n }\n if(is){\n for(int j = 0; j < i; j++){\n if(b[j] == '0'){\n cout<<\"NO\\n\";\n return;\n }\n }\n for(int j = i+a.size(); j < b.size(); j++){\n if(b[j] == '0'){\n cout<<\"NO\\n\";\n return;\n }\n }\n cout<<\"YES\\n\";\n return;\n }\n }\n reverse(a);\n\n for(int i = 0; i < b.size()-a.size()+1; i++){\n string temp = \"\";\n bool is = true;\n for(int j = i; j < i+a.size(); j++){\n if(b[j] != a[j-i]){\n is = false;\n break;\n }\n }\n if(is){\n for(int j = 0; j < i; j++){\n if(b[j] == '0'){\n cout<<\"NO\\n\";\n return;\n }\n }\n for(int j = i+a.size(); j < b.size(); j++){\n if(b[j] == '0'){\n cout<<\"NO\\n\";\n return;\n }\n }\n cout<<\"YES\\n\";\n return;\n }\n }\n cout<<\"NO\\n\";\n}\n\n\nint32_t main() {\n ios_base::sync_with_stdio(false);\n cin.tie(NULL);\n auto time0 = curtime;\n\tll t = 1;\n\tfor(int i = 1 ; i <= t; i++) {\n\t\t//cout << \"Case #\" << i << \": \";\n\t\tsolve();\n\t}\n //cerr<<\"Execution Time: \"<\n//#include \nusing namespace std;\n//using namespace atcoder;\n\n#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);\n#define ll\t\t\t\t\t long long int\n#define ull\t\t\t\t\t\t unsigned long long int\n#define endl \t\t\t\t\t \"\\n\"\n#define fo(i,n)\t\t\t\t\t for(i = 0; i < n; i++)\n#define fa(i,a,n)\t\t\t\t for(ll i=a; i=a; i--)\n#define CASE(t)\t\t\t\t\t cout<<\"Case #\"<<(t)<<\": \";\n#define all(x)\t\t\t\t\t (x).begin(),(x).end()\n#define foit(itr,c)\t\t\t\t for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)\n#define setpre(x,val)\t\t\t cout << fixed << setprecision(val) << x <\n#define vi\t\t\t\t\t\t\t vector\n#define pll\t\t\t\t\t\t\t pair\n#define vl\t\t\t\t\t\t\t vector\n#define vs\t\t\t\t\t\t\t vector\n#define mii\t\t\t\t\t\t\t map\n#define vpi\t\t\t\t\t\t\t vector< pair >\n#define vpl\t\t\t\t\t\t\t vector< pair >\n#define vvi\t\t\t\t\t\t\t vector\n#define uniq(v) \t\t\t\t\t (v).erase(unique(all(v)), (v).end())\n#define sz(x) \t\t\t\t\t\t (int)((x).size())\n#define yesss\t\t\t\t\t\t cout<<\"YES\\n\"\n#define nooo\t\t\t\t\t\t cout<<\"NO\\n\"\n#define sqr(a)\t\t\t\t\t\t ((a) * (a))\n#define setbits(x)\t\t\t\t __builtin_popcountll(x)\n#define zrobits(x)\t\t\t\t __builtin_ctzll(x)\n\n#ifndef ONLINE_JUGDE\n#define d1(x)\t\t\t\t\t\t cout<<#x<<\"=\"<\ninline std::ostream& operator << (std::ostream& os, const std::pair& p) {\n return os << \"(\" << p.first << \": \" << p.second << \")\";\n}\ntemplate\ninline std::ostream &operator << (std::ostream & os,const std::vector& v) {\n bool first = true;\n os << \"[\";\n for(unsigned int i = 0; i < v.size(); i++) {\n if(!first) os << \", \";\n os << v[i];\n first = false;\n }\n return os << \"]\";\n}\ntemplate\ninline std::ostream &operator << (std::ostream & os,const std::set& v) {\n bool first = true;\n os << \"{\";\n for (typename std::set::const_iterator ii = v.begin(); ii != v.end(); ++ii) {\n if(!first) os << \", \";\n os << *ii;\n first = false;\n }\n return os << \"}\";\n}\ntemplate\ninline std::ostream &operator << (std::ostream & os,const std::map& v) {\n bool first = true;\n os << \"{\";\n for (typename std::map::const_iterator ii = v.begin(); ii != v.end(); ++ii) {\n if(!first) os << \", \";\n os << *ii ;\n first = false;\n }\n return os << \"}\";\n}\ntemplate\ninline std::ostream &operator << (std::ostream & os,const std::unordered_set& v) {\n return os << std::set(v.begin(), v.end());\n}\ntemplate\ninline std::ostream &operator << (std::ostream & os,const std::unordered_map& v) {\n return os << std::map(v.begin(), v.end());\n}\n\nconst long long INF = 1e18;\nconst int32_t M = 1e9 + 7;\nconst int32_t MM = 998244353;\n \nll gcd(ll a, ll b){\n if (b > a){\n return gcd(b, a);\n }\n if (b == 0){\n return a;\n }\n return gcd(b, a % b);\n}\nll expo(ll a, ll b, ll mod){\n ll res = 1;\n while (b > 0){\n if (b & 1)\n res = (res * a) % mod;\n a = (a * a) % mod;\n b = b >> 1;\n }\n return res;\n}\nvoid extendgcd(ll a, ll b, ll *v){\n if (b == 0){\n v[0] = 1;\n v[1] = 0;\n v[2] = a;\n return;\n }\n extendgcd(b, a % b, v);\n ll x = v[1];\n v[1] = v[0] - v[1] * (a / b);\n v[0] = x;\n return;\n}\nvector sieve(ll n){\n ll *arr = new ll[n + 1]();\n vector vect;\n for (ll i = 2; i <= n; i++)\n if (arr[i] == 0){\n vect.push_back(i);\n for (ll j = 2 * i; j <= n; j += i)\n arr[j] = 1;\n }\n return vect;\n}\nll mminv(ll a, ll b){\n ll arr[3];\n extendgcd(a, b, arr);\n return arr[0];\n} // For non-prime b\nll mminvprime(ll a, ll b) { return expo(a, b - 2, b); }\nll mod_add(ll a, ll b, ll m){\n a = a % m;\n b = b % m;\n return (((a + b) % m) + m) % m;\n}\nll mod_mul(ll a, ll b, ll m){\n a = a % m;\n b = b % m;\n return (((a * b) % m) + m) % m;\n}\nll mod_sub(ll a, ll b, ll m){\n a = a % m;\n b = b % m;\n return (((a - b) % m) + m) % m;\n}\nll mod_div(ll a, ll b, ll m){\n a = a % m;\n b = b % m;\n return (mod_mul(a, mminvprime(b, m), m) + m) % m;\n} // For prime m\nll phin(ll n){\n ll number = n;\n if (n % 2 == 0){\n number /= 2;\n while (n % 2 == 0)\n n /= 2;\n }\n for (ll i = 3; i <= sqrt(n); i += 2){\n if (n % i == 0){\n while (n % i == 0)\n n /= i;\n number = (number / i * (i - 1));\n }\n }\n if (n > 1)\n number = (number / n * (n - 1));\n return number;\n} // O(sqrt(N))\n \nconst ll NC = 100;\nll fact[NC], ifact[NC], inv[NC];\n \nstruct comb_init{\n comb_init(){\n inv[1] = 1;\n for (ll i = 2; i < NC; ++i){\n inv[i] = (M - M / i) * inv[M % i] % M;\n }\n fact[0] = ifact[0] = 1;\n for (ll i = 1; i < NC; ++i){\n fact[i] = fact[i - 1] * i % M;\n ifact[i] = ifact[i - 1] * inv[i] % M;\n }\n }\n} comb_init_;\n \nll combination(ll n, ll r, ll m){\n if (n < r || r < 0)\n return 0;\n ll val1 = fact[n];\n ll val2 = ifact[n - r];\n ll val3 = ifact[r];\n return (((val1 * val2) % m) * val3) % m;\n}\n\ntemplate \nT amax(T &a, T1 b){\n if (b > a)\n a = b;\n return a;\n}\ntemplate \nT amin(T &a, T1 b){\n if (b < a)\n a = b;\n return a;\n}\n\nvoid solve(){\n ull i,j,k;\n ull x,y;\n cin>>x>>y;\n if(x==y){\n yesss;\n return;\n }\n if(x==0){\n if(y==1||y==2){\n yesss;\n }\n else\n nooo;\n return;\n }\n\n string s1 = bitset<63>(x).to_string();\n string s2 = bitset<63>(y).to_string();\n\n i = 0;\n while(i < s1.length() && s1[i]=='0')\n i++;\n s1 = s1.substr(i, s1.length() - i + 1);\n bool flag = false;\n size_t found = s2.find(s1);\n if (found != string::npos)\n flag = true;\n\n reverse(all(s1));\n\n size_t found = s2.find(s1);\n if (found != string::npos)\n flag = true;\n\n if(!flag){\n nooo;\n return;\n }\n\n queue agenda;\n agenda.push(x);\n vis[x] = true;\n\n while(!agenda.empty()){\n ull curr = agenda.front();\n agenda.pop();\n if (curr == y){\n yesss;\n return;\n }\n vis[curr] = true;\n string temp1 = bitset<63>(curr).to_string();\n // d1(temp1);\n string temp2 = temp1;\n temp1 += \"0\";\n temp2 += \"1\";\n reverse(temp1.begin(), temp1.end());\n while(!temp1.empty() && temp1.back()=='0')\n temp1.pop_back();\n \n reverse(temp2.begin(), temp2.end());\n while(!temp2.empty() && temp2.back()=='0')\n temp2.pop_back();\n\n // d2(temp1, temp2);\n ull tc1 = bitset<63>(temp1).to_ullong();\n ull tc2 = bitset<63>(temp2).to_ullong();\n if(!vis[tc1] && setbits(tc1) <= setbits(y))\n agenda.push(tc1);\n if(!vis[tc2] && setbits(tc2) <= setbits(y))\n agenda.push(tc2);\n }\n nooo;\n return;\n}\n\nsigned main(){ \n IOS;\n #ifndef ONLINE_JUDGE\n freopen(\"input.txt\", \"r\", stdin);\n freopen(\"output.txt\", \"w\", stdout);\n #endif\n int t = 1;\n // cin>>t;\n while (t--){\n solve();\n }\n return 0;\n}\n", "lang": "GNU C++17", "bug_code_uid": "b893d57f687d26cb6af62b313607790b", "src_uid": "9f39a3c160087beb0efab2e3cb510e89", "apr_id": "f9167b4e639a5a18f25997e8fb3fee5a", "difficulty": 2000, "tags": ["dfs and similar", "bitmasks", "math", "implementation", "constructive algorithms", "strings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.38151086581579857, "equal_cnt": 30, "replace_cnt": 17, "delete_cnt": 4, "insert_cnt": 8, "fix_ops_cnt": 29, "bug_source_code": "#include\r\n//#define ll long long\r\n//#define int long long\r\n//#define endl \"\\n\"\r\n#define xiayang cout<<\"\u5634\u786c\"<>t;\r\n\tt=1;\r\n\twhile(t--){\r\n\t\tcin>>n>>a;\r\n\t\tmemset(b,0,sizeof(b));\r\n\t\tint maxx=0,m=0;\r\n\t\twhile(a){\r\n\t\t\tm++;\r\n\t\t\tb[m]=a%10;\r\n\t\t\tmaxx=max(maxx,b[m]);\r\n\t\t\ta/=10;\r\n\t\t}\r\n\t\tfor(int i=0;i<=9;i++)st.vis[i]=0;\r\n\t\tfor(int i=0;i<=19;i++)st.b[i]=b[i],st.vis[b[i]]=1;\r\n\t\tst.len=m,st.ans=0;\r\n\t\tif(n==m)cout<<\"0\"<n||maxx<=1)cout<<\"-1\"<que;\r\n\t\t\tque.push(st);\r\n\t\t\twhile(!que.empty()){\r\n\t\t\t\tint lk[10],cnt=0;\r\n\t\t\t\tnode nw = que.front();\r\n\t\t\t\tque.pop();\r\n//\t\t\t\tfor(int i=1;i<=19;i++)cout<=2;i--){\r\n\t\t\t\t\tif(nw.vis[i]==1)lk[++cnt]=i;\r\n\t\t\t\t} \r\n\t\t\t\tfor(int i=1;i<=min(cnt,5);i++){\r\n\t\t\t\t\tnode tn;\r\n\t\t\t\t\ttn.ans=nw.ans+1;\r\n\t\t\t\t\tfor(int j=2;j<=9;j++)tn.vis[j]=0;\r\n\t\t\t\t\tint ml=0;\r\n\t\t\t\t\ttn.b[0]=0;\r\n\t\t\t\t\tfor(int j=1;j<=19;j++){\r\n\t\t\t\t\t\ttn.b[j]=tn.b[j-1]/10+nw.b[j]*lk[i];\r\n\t\t\t\t\t\ttn.b[j-1]%=10;\r\n\t\t\t\t\t\ttn.vis[tn.b[j]%10]=1;\r\n\t\t\t\t\t\tif(tn.b[j]%10!=0)ml=j;\r\n\t\t\t\t\t}\r\n//\t\t\t\t\t\tcout<\r\n#include\r\n#include\r\n#include\r\n#include\r\nusing namespace std;\r\ntypedef unsigned long long ULL;\r\ntypedef pair pr;\r\n\r\nconst int MAX_N=2e5+5;\r\nint n,m,T;\r\nqueue Q;\r\nbool boo[10];\r\nunordered_map ump;\r\n\r\nint BFS(int x)\r\n{\r\n int res=-1,s,si;\r\n ULL xi,xx,xxx,t;\r\n pr pi;\r\n boo[0]=boo[1]=true;\r\n Q.push({x,0});\r\n ULL Sum=0;\r\n ump.clear();\r\n while(!Q.empty()){\r\n ++Sum;\r\n pi=Q.front(); Q.pop();\r\n xx=xxx=pi.first;\r\n s=pi.second;\r\n // cout<<\">>> \"<1&≪--i)\r\n {\r\n if(boo[i]&&ll){\r\n --ll;\r\n t=i;\r\n xi=xx*t;\r\n // if(ump.find(xi)!=ump.end()){\r\n if(ump[xi])\r\n // cout<<\">>>>>> \"<>>>>>>>>>>>>>>>>> xi \"<0){\r\n break;\r\n }\r\n }\r\n // cout<<\">>>>>>> Sum \"<>n>>x;\r\n if(x==1){\r\n res=-1;\r\n }else{\r\n xi=x; s=0;\r\n while(xi){\r\n ++s;\r\n xi/=10;\r\n }\r\n if(s==n){\r\n res=0;\r\n }else if(s>n){\r\n res=-1;\r\n }else{\r\n res=BFS(x);\r\n }\r\n }\r\n // cout<<\"<<<<<< \";\r\n cout<\r\n\r\n#define endl '\\n'\r\n#define fi first\r\n#define se second\r\n#define pb push_back\r\n#define bit(s, i) (s & (1< ii;\r\n\r\nlong long t[2], dp[N], h, s, p[2];\r\n\r\nint main() {\r\n ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);\r\n // freopen(\"trash.inp\",\"r\",stdin);\r\n // freopen(\"trash.out\",\"w\",stdout);\r\n\r\n for(int i=0;i<2;++i) cin >> p[i] >> t[i];\r\n cin >> h >> s;\r\n\r\n memset(dp, 0x3f, sizeof dp);\r\n dp[0] = 0;\r\n long long res = Inf;\r\n for(int i=0;i\r\nusing namespace std;\r\nconst int MAX_N=4e3+1;\r\nconst long long INF=1000000000000000LL;\r\nlong long dp[MAX_N][MAX_N][3];\r\nlong long p1,t1;\r\nlong long p2,t2;\r\nlong long h,s;\r\nint main ()\r\n{\r\n cin>>p1>>t1;\r\n cin>>p2>>t2;\r\n cin>>h>>s;\r\n p1-=s;\r\n p2-=s;\r\n for(int i=0;i<=min(h+p1+p2,4000);i++)\r\n {\r\n for(int j=0;j<=min(h+p1+p2,4000);j++)\r\n {\r\n dp[i][j][0]=dp[i][j][1]=dp[i][j][2]=INF;\r\n }\r\n }\r\n dp[0][0][0]=0;\r\n dp[0][0][1]=0;\r\n for(int i=0;i<=min(h+p1+p2,4000);i++)\r\n {\r\n for(int j=max(0,i-1);j>=0;j--)\r\n {\r\n if((i-j)%p1!=0)continue;\r\n if(dp[i][j][0]==INF)continue;\r\n if(i+p1<=min(h+p1+p2,4000) && t1=0;j--)\r\n {\r\n if((i-j)%p2!=0)continue;\r\n if(dp[i][j][1]==INF)continue;\r\n if(i+p2<=min(h+p1+p2,4000) && t2=h;i--)\r\n {\r\n for(int j=0;j<=i;j++)\r\n {\r\n ans=min(ans,dp[i][j][0]);\r\n ans=min(ans,dp[i][j][1]);\r\n ans=min(ans,dp[i][j][2]);\r\n }\r\n }\r\n cout<\r\nusing namespace std;\r\ntypedef long long ll;\r\n#define fi first\r\n#define se second\r\nll n;\r\nll mod;\r\ntypedef vector poly;\r\nconst int mb=18;//can change !!!!\r\nll roots[1<=mod) x[i]-=mod;\r\n\t}\r\n\treturn x;\r\n}\r\npoly operator-(poly x,poly y){\r\n\tint n=max(x.size(),y.size());\r\n\tx.resize(n);y.resize(n);\r\n\tfor(int i=0; i=mod) x[i]-=mod;\r\n\t}\r\n\treturn x;\r\n}\r\n\r\nvoid pre(){\r\n\troots[0]=1;\r\n\twhile(true){\r\n\t\tll x=rand()%(mod-1)+1;\r\n\t\tll sex=pw(x,(mod-1)/262144);\r\n\t\tll ch=pw(sex,1<<17);\r\n\t\tif(ch==1) continue;\r\n\t\telse{\r\n\t\t\troots[1]=sex;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\t//roots[1]=pw(15311432,1<<(23-mb));\r\n\tfor(int i=1; i<(1<=mod?x+y-mod:x+y);\r\n\t\t\t\tp[i+j+k]=(x>=y?x-y:x+mod-y);\r\n }\r\n }\r\n }\r\n}\r\npoly operator*(poly x,poly y){\r\n\tint n=1;\r\n\twhile(n1 && x.back()==0) x.pop_back();\r\n\treturn x;\r\n}\r\nll C[5001][5001];\r\nll dp[5001][5001];\r\nll f[5001],inf[5001];\r\nll g[5001][5001];\r\nll pb[5001];\r\nint main(){\r\n\tios::sync_with_stdio(false);cin.tie(0);\r\n\tcin >> n >> mod;pre();\r\n\tC[0][0]=1;\r\n\tdp[0][0]=1;\r\n\tf[0]=1;inf[0]=1;\r\n\tpb[0]=1;\r\n\tfor(int i=1; i<=n ;i++){\r\n\t\tC[i][0]=1;\r\n\t\tf[i]=f[i-1]*i%mod;\r\n\t\tinf[i]=pw(f[i],mod-2);\r\n\t\tpb[i]=pb[i-1]*(n-1)%mod;\r\n\t\tfor(int j=1; j<=i ;j++){\r\n\t\t\tC[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;\r\n\t\t\tdp[i][j]=(dp[i-1][j-1]+dp[i-1][j]*2*j+dp[i-1][j+1]*j*(j+1))%mod;\r\n\t\t\t//cout << dp[i][j] << ' ';\r\n\t\t}\r\n\t\t//cout << endl;\r\n\t}\r\n\t//cout << roots[1] << endl;\r\n\tpoly bad(n+1);\r\n\tfor(int i=0; i<=n ;i++){\r\n\t\tbad[i]=inf[i];\r\n\t\tif(i%2==1) bad[i]=mod-bad[i];\r\n\t}\r\n\tfor(int i=0; i<=n ;i++){\r\n\t\tpoly sex(n-i+1);\r\n\t\tfor(int j=i; j<=n ;j++){\r\n\t\t\tsex[j-i]=dp[j][j-i]*inf[j]%mod;\r\n\t\t}\r\n\t\tauto funny=bad*sex;\r\n\t\tbad.pop_back();\r\n\t\t//cout << bad[0] << ' ' << bad[1] << ' ' << sex[0] << ' ' << sex[1] << endl;\r\n\t\tfor(int j=i; j<=n ;j++){\r\n\t\t\tg[j][j-i]=funny[j-i]*f[j]%mod;\r\n\t\t}\r\n\t}\r\n\tll ans=0;\r\n\tfor(int i=1; i<=n ;i++){\r\n\t\tll pa=1;\r\n\t\tfor(int j=0; j<=i ;j++){//ways to have i chains and j singletons\r\n\t\t\tll ways=g[n-j][i-j]*C[n][j]%mod;\r\n\t\t\tll love=pa*pb[i-j]%mod;pa=pa*(n-i)%mod;\r\n\t\t\t//cout << i << ' ' << j << ' ' << ways << ' ' << love << endl;\r\n\t\t\tans=(ans+ways*love)%mod;\r\n\t\t}\r\n\t}\r\n\tcout << ans << '\\n';\r\n}", "lang": "GNU C++17", "bug_code_uid": "c5a73fb6e533700eea3a292a0c646b51", "src_uid": "2d5a5055aaf34f4d300cfdf7c21748c3", "apr_id": "204c8cbf02f3e2b294ac697865940bd7", "difficulty": 3200, "tags": ["dp", "combinatorics", "fft", "math", "constructive algorithms"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9953978906999041, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "#include \r\nusing namespace std;\r\ntypedef long long ll;\r\ntypedef vector Poly;\r\nconst int N = 1 << 20;\r\nint n, G, mod, r[N], Inv[N]; Poly f, g, vf, T, P, ans;\r\nvector factor;\r\ninline int add(int x, int y) { return x + y >= mod ? x + y - mod : x + y; }\r\ninline int dec(int x, int y) { return x - y < 0 ? x - y + mod : x - y; }\r\ninline int mul(int x, int y) { return (ll)x * y % mod; }\r\ninline int qpow(int a, int b) {\r\n\tint ans = 1;\r\n\tfor (; b; b >>= 1, a = mul(a, a)) if (b & 1) ans = mul(ans, a);\r\n\treturn ans;\r\n}\r\ninline void NTT(Poly &A, int len, int type){\r\n\tfor (int i = 0; i < len; ++ i) if(i < r[i]) swap(A[i], A[r[i]]);\r\n\tfor (int mid = 1; mid < len; mid <<= 1) {\r\n\t\tint Wn = qpow(G, (mod - 1) / (mid << 1));\r\n\t\tif (type < 0) Wn = qpow(Wn, mod - 2);\r\n\t\tfor (int j = 0; j < len; j += (mid << 1))\r\n\t\t\tfor (int k = 0, w = 1; k < mid; ++ k, w = mul(w, Wn)) {\r\n\t\t\t\tint x = A[j + k], y = mul(w, A[j + k + mid]);\r\n\t\t\t\tA[j + k] = add(x, y), A[j + k + mid] = dec(x, y);\r\n\t\t\t}\r\n\t}\r\n\tif (type > 0) return;\r\n\tfor (int i = 0; i < len; ++ i) A[i] = mul(A[i], Inv[len]);\r\n}\r\ninline void init_rev(int len) {\r\n\tfor (int i = 0; i < len; ++ i) r[i] = r[i >> 1] >> 1 | ((i & 1) * (len >> 1));\r\n}\r\ninline Poly operator + (const Poly&a, const Poly&b) {\r\n\tPoly c = a; c.resize(max(a.size(), b.size()));\r\n\tfor (int i = 0; i < b.size(); ++ i) c[i] = add(c[i], b[i]);\r\n\treturn c;\r\n}\r\ninline Poly operator - (const Poly&a, const Poly&b) {\r\n\tPoly c = a; c.resize(max(a.size(), b.size()));\r\n\tfor (int i = 0; i < b.size(); ++ i) c[i] = dec(c[i], b[i]);\r\n\treturn c;\r\n}\r\ninline Poly operator * (Poly a, Poly b) {\r\n\tint n = a.size(), m = b.size(), l = 1;\r\n\twhile (l < n + m - 1) l <<= 1;\r\n\tinit_rev(l);\r\n\ta.resize(l), NTT(a, l, 1);\r\n\tb.resize(l), NTT(b, l, 1);\r\n\tfor (int i = 0; i < l; ++ i) a[i] = mul(a[i], b[i]);\r\n\tNTT(a, l, -1);\r\n\ta.resize(n + m - 1);\r\n\treturn a;\r\n}\r\ninline Poly operator * (Poly a, int b) {\r\n\tfor (int i = 0; i < a.size(); ++ i) a[i] = mul(a[i], b);\r\n\treturn a;\r\n}\r\ninline Poly Deriv(Poly a) {\r\n\tfor (int i = 0; i + 1 < a.size(); ++ i) a[i] = mul(a[i + 1], i + 1);\r\n\treturn a.pop_back(), a;\r\n}\r\ninline Poly Integ(Poly a) {\r\n\ta.emplace_back(0);\r\n\tfor (int i = a.size() - 1; i; -- i) a[i] = mul(a[i - 1], Inv[i]);\r\n\treturn a[0] = 0, a;\r\n}\r\ninline Poly Polyinv(const Poly&a, int lim) {\r\n\tPoly c, b(1, qpow(a[0], mod - 2));\r\n\tfor (int l = 4; (l >> 2) < lim; l <<= 1) {\r\n\t\tinit_rev(l);\r\n\t\tc = a, c.resize(l >> 1);\r\n\t\tc.resize(l), NTT(c, l, 1);\r\n\t\tb.resize(l), NTT(b, l, 1);\r\n\t\tfor (int i = 0; i < l; ++ i) b[i] = mul(b[i], dec(2, mul(b[i], c[i])));\r\n\t\tNTT(b, l, -1), b.resize(l >> 1);\r\n\t}\r\n\treturn b.resize(lim), b;\r\n}\r\ninline Poly Polyinv(const Poly&a) { return Polyinv(a, a.size()); }\r\ninline Poly Polyln(Poly a, int lim) {\r\n\ta = Integ(Deriv(a) * Polyinv(a, lim));\r\n\treturn a.resize(lim), a;\r\n}\r\ninline Poly Polyln(const Poly&a) { return Polyln(a, a.size()); }\r\ninline Poly Polyexp(const Poly&a, int lim) {\r\n\tPoly c, b(1, 1); int n = a.size();\r\n\tfor (int i = 2; (i >> 1) < lim; i <<= 1) {\r\n\t\tc = Polyln(b, i);\r\n\t\tfor (int j = 0; j < i; ++ j) c[j] = dec(j < n ? a[j] : 0, c[j]);\r\n\t\tc[0] = add(c[0], 1);\r\n\t\tb = b * c, b.resize(i);\r\n\t}\r\n\treturn b.resize(lim), b;\r\n}\r\ninline Poly Polyexp(const Poly&a) { return Polyexp(a, a.size()); }\r\ninline void precalc() {\r\n\tInv[0] = Inv[1] = 1;\r\n\tfor (int i = 2; i < N; ++ i) Inv[i] = mul(mod - mod / i, Inv[mod % i]);\r\n}\r\nPoly exp_f0, fef, xfef, exp_xfef;\r\ninline Poly Newton_Method_f(int len) {\r\n\tif (len == 1) { vector f(2); f[0] = 0, f[1] = 1; return f; }\r\n\tPoly f = Newton_Method_f(len + 1 >> 1);\r\n\texp_f0 = Polyexp(f, len), fef = f * exp_f0; xfef.resize(len);\r\n\tfor (int i = 1; i < len; ++ i) xfef[i] = fef[i - 1]; xfef[0] = 0;\r\n\texp_xfef = Polyexp(xfef, len), xfef = exp_xfef + fef;\r\n\tfor (int i = len - 1; i; -- i) xfef[i] = xfef[i - 1]; xfef[0] = 0;\r\n\tfor (int i = len - 1; i; -- i) exp_xfef[i] = exp_xfef[i - 1]; exp_xfef[0] = 1;\r\n\texp_xfef = exp_xfef * (fef + exp_f0), exp_xfef.resize(len);\r\n\tfor (int i = len - 1; i; -- i) exp_xfef[i] = exp_xfef[i - 1]; exp_xfef[0] = mod - 1;\r\n\tf = f - (xfef - f) * Polyinv(exp_xfef);\r\n\treturn f.resize(len), f;\r\n}\r\nint main() {\r\n\tscanf(\"%d%d\", &n, &mod);\r\n\tint phi = mod - 1;\r\n\tfor (int i = 2; i * i <= phi; ++ i)\r\n\t\tif (phi % i == 0) {\r\n\t\t\twhile (phi % i == 0) phi /= i;\r\n\t\t\tfactor.emplace_back(i);\r\n\t\t}\r\n\tif (phi > 1) factor.emplace_back(phi);\r\n\tfor (int i = 1; ; ++ i) {\r\n\t\tif (__gcd(i, mod) != 1) continue;\r\n\t\tint flag = true;\r\n\t\tfor (auto x : factor)\r\n\t\t\tif (qpow(i, (mod - 1) / x) == 1) {\r\n\t\t\t\tflag = false; break;\r\n\t\t\t}\r\n\t\tif (flag) { G = i; break; }\r\n\t}\r\n\tprecalc();\r\n\tf = Newton_Method_f(100000), f.resize(n + 1);\r\n\tvf = Polyexp(f);\r\n\tfor (int i = vf.size() - 1; i; -- i) vf[i] = vf[i - 1];\r\n\tvf[0] = 0;\r\n\tg = f - f * vf, g.resize(n + 1);\r\n\tP = vf + f - g;\r\n\tT = P * g + P, T.resize(n + 1);\r\n\tT[0] = 1, vf[0] = 1;\r\n\tfor (int i = 1; i <= n; ++ i) {\r\n\t\tif (T[i]) T[i] = mod - T[i];\r\n\t\tif (vf[i]) vf[i] = mod - vf[i];\r\n\t}\r\n\tT = Polyln(T), vf = Polyln(vf);\r\n\tfor (int i = 1; i <= n; ++ i) {\r\n\t\tif (T[i]) T[i] = mod - T[i];\r\n\t\tif (vf[i]) vf[i] = mod - vf[i];\r\n\t}\r\n\tans = Polyexp(T - vf - f + g);\r\n\tfor (int i = 1, fac = 1; i <= n; ++ i) fac = mul(fac, i);\r\n\tprintf(\"%d\\n\", mul(ans[n], fac));\r\n\treturn 0;\r\n}", "lang": "GNU C++17", "bug_code_uid": "21ee7c66993c51923299f685a2e01c40", "src_uid": "2d5a5055aaf34f4d300cfdf7c21748c3", "apr_id": "6839987b6f9f11eb0d62f52132a9c254", "difficulty": 3200, "tags": ["dp", "combinatorics", "fft", "math", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.960323185687491, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include\r\nusing namespace std;\r\n \r\n// #pragma GCC optimize(\"O3\")\r\n// #pragma GCC optimize(\"unroll-loops\")\r\n \r\n// #pragma GCC optimize \"trapv\"\r\n \r\n#define int long long\r\n#define ll long long\r\n#define mod 1000000007\r\n#define mod2 998244353\r\n#define min3(a, b, c) (min(min((a), (b)), (c)))\r\n#define max3(a, b, c) (max(max((a), (b)), (c)))\r\n \r\n \r\n#define pb push_back \r\n#define ppb pop_back\r\n#define pf push_front\r\n#define ppf pop_front\r\n#define pi_solve_it 3.1415927\r\n// long double pi_val = acos(-1.0);\r\n \r\n#define vi vector\r\n#define vll vector\r\n#define vint vector\r\n#define pii pair\r\n#define pint pair\r\n#define F first\r\n#define S second\r\n#define mem1(a) memset(a,-1,sizeof(a))\r\n#define mem0(a) memset(a,0,sizeof(a))\r\n \r\n//#define SET\r\n \r\n#ifdef SET\r\n// header files for policy based data structuans in g++ \r\n#include // Common file\r\n#include // Including tree_order_statistics_node_update\r\n#include \r\nusing namespace __gnu_pbds;\r\nusing namespace __gnu_cxx;\r\n// ordered_Set - same as set but aintows \r\n //order_of_key (k) : Number of items strictly smainter than k O(logn)\r\n //find_by_order(k) : K-th element in a set (counting from zero). O(logn)\r\n// change less to less_equal to have a ordered set behaving as multi set but in this case erase operation does not work ans neither does the upper bound \r\ntypedef tree, rb_tree_tag, tree_order_statistics_node_update> indexed_set;\r\ntypedef tree, rb_tree_tag, tree_order_statistics_node_update> indexed_multi_set;\r\n#endif \r\n \r\nlong long power( long long x,\r\n long long y, long long p)\r\n{\r\n long long ans = 1;\r\n \r\n x = x % p;\r\n \r\n while (y > 0)\r\n {\r\n if (y & 1)\r\n ans = (ans * x) % p;\r\n y = y >> 1;\r\n x = (x * x) % p;\r\n //cout<>t;\r\n \r\n t=1;\r\n\r\n for(int tt=1;tt<=t;tt++)\r\n {\r\n //cout<<\"Case #\"<>n>>m;\r\n int ans = 0;\r\n int val = 1;\r\n int prev = m%mod2;\r\n\r\n for (int i = 2; i <= n; ++i)\r\n {\r\n if(prime[i]==1 && val<=m)\r\n {\r\n val*=i;\r\n }\r\n //cout< \r\n#define ll long long\r\n#define ff first\r\n#define ss second\r\n#define pii pair\r\n#define pll pair\r\n#define pb push_back\r\nusing namespace std;\r\nconst int nMax = 1e6;\r\nconst ll MOD = 998244353;\r\nvoid solve(){\r\n\tll n, m; cin>>n>>m;\r\n\tll ans = 0, temp = 1, num = 1 ,pwr = 1;\r\n\tfor(int i = 1; i <= n; i++){\r\n\t\tif(__gcd(i, num) == 1)\r\n\t\t\tnum *= i; \r\n\t\ttemp = (m / num) % MOD * temp%MOD;\r\n\t\tpwr = m%MOD * pwr%MOD; \r\n\t\tans = (ans + pwr - temp + MOD)%MOD;\r\n\t}\r\n\tans %= MOD;\r\n\tcout<> T;\r\n while(T--){\r\n solve();\r\n }\r\n return 0;\r\n}", "lang": "GNU C++14", "bug_code_uid": "8daed6b9f562b99cf0a3f00be207f33b", "src_uid": "0fdd91ed33431848614075ebe9d2ee68", "apr_id": "b367def9c328332df44f0c03f0724131", "difficulty": 1900, "tags": ["dp", "math", "combinatorics", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.24358974358974358, "equal_cnt": 45, "replace_cnt": 28, "delete_cnt": 5, "insert_cnt": 12, "fix_ops_cnt": 45, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n\tint a[3],x,n;\n cin>>num;\n cin>>x;\n int n=0;\n for(int i=0;i>a[i];\n }\n if(x==1){\n if(a[0]!=0)\n {\n n=a[0];\n if(a[n]!=0)\n cout<<\"YES\";\n else ocut<<\"NO\";\n }\n else\n cout<<\"NO\";\n }\n else if(x==2){\n if(a[1]!=0){\n n=a[1];\n if(a[n]!=0)\n cout<<\"YES\";\n else cou<<\"NO\";\n }\n else\n cout<<\"NO\";\n }\n else {\n if(a[2]!=0)\n {\tn=a[2];\n \tif(a[n]!=0)\n cout<<\"YES\";\n \telse cot<<\"NO\";\n }else\n cout<<\"NO\";\n }\n return 0;\n}\n\t \t\t \t \t\t\t\t\t\t \t \t\t\t\t\t \t\t\t\t\t", "lang": "MS C++ 2017", "bug_code_uid": "f3403c72094a771d333718f84b11e241", "src_uid": "5cd113a30bbbb93d8620a483d4da0349", "apr_id": "a8806b75546bbd201528a15953d639a0", "difficulty": 800, "tags": ["math", "implementation", "brute force", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9749216300940439, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "// LUOGU_RID: 90796814\n#include \r\nusing namespace std;\r\nconst int MAXL=1e+1;\r\nint t,x,v[MAXL];\r\nint main()\r\n{\r\n cin>>t;\r\n for(int i=1;i<=t;i++){\r\n cin>>x;\r\n cin>>v[1]>>v[2]>>v[3];\r\n if(v[x]==0 || v[v[x]]==0){\r\n cout<<\"NO\"<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\nusing ll = long long;\nusing cd = complex;\nll MOD = 998244353;\n\nint n, k, f;\n\nvoid fft(vector& p, bool invert) {\n ll n = p.size();\n vector rev(n); rev[0] = 0;\n for (int i = 1; i < n; i++) {\n rev[i] = (rev[i>>1]>>1) + (i%2 ? n/2 : 0);\n if (i < rev[i]) swap(p[i], p[rev[i]]);\n }\n vector w(n);\n for (int i = 0; i < n; i++) w[i] = polar(1.0, ll(2*i)*M_PI / n * (invert ? -1 : 1));\n for (int len = 1; len < n; len *= 2) {\n int m = n / len / 2;\n for (int i = 0; i < n; i += 2*len) {\n for (int j = 0; j < len; j++) {\n cd even = p[i+j], odd = p[i+j+len];\n p[i+j] = even + w[m*j]*odd;\n p[i+j+len] = even - w[m*j]*odd;\n }\n }\n }\n if (invert)\n for (cd& x : p) x /= n;\n}\nvector conv_mod(const vector a, const vector b) {\n int d = a.size()+b.size()-1;\n int n2 = 1; while (n2 <= d) n2 *= 2;\n ll M = sqrt(MOD);\n vector inf(n2), ins(n2), outf(n2), outs(n2);\n for (int i = 0; i < a.size(); i++) inf[i] = cd(a[i]/M, a[i]%M);\n for (int i = 0; i < b.size(); i++) ins[i] = cd(b[i]/M, b[i]%M);\n fft(inf, false); fft(ins, false);\n //cout << \"debugging inf, ins\" << endl;\n //for (int i = 0; i < n2; i++) cout << inf[i] << \" \"; cout << endl;\n //for (int i = 0; i < n2; i++) cout << ins[i] << \" \"; cout << endl;\n for (int i = 0; i < n2; i++) {\n int j = n2-i;\n outf[i] = (inf[i] + conj(inf[j]))*ins[i] / cd(2);\n outs[i] = (inf[i] - conj(inf[j]))*ins[i] / cd(2) / cd(0, 1);\n }\n fft(outf, true); fft(outs, true);\n //cout << \"debugging outf, outs\" << endl;\n //for (int i = 0; i < n2; i++) cout << outf[i] << \" \"; cout << endl;\n //for (int i = 0; i < n2; i++) cout << outs[i] << \" \"; cout << endl;\n vector res(d+1);\n for (int i = 0; i <= d; i++) {\n ll a = llround(outf[i].real()), c = llround(outs[i].imag());\n ll b = llround(outf[i].imag() + outs[i].real());\n res[i] = ((a%MOD*M + b)%MOD*M + c)%MOD;\n }\n return res;\n}\n\nvector naive_mult(vector a, vector b) {\n vector res(a.size()-1+b.size()-1+1, 0);\n for (int i = 0; i < a.size(); i++) {\n for (int j = 0; j < b.size(); j++) {\n res[i+j] = (res[i+j] + a[i]*b[j]) % MOD;\n }\n }\n return res;\n}\n\nint main() {\n cin >> n >> k >> f;\n vector p(k+1, 1);\n for (int i = 2; i <= n; i++) {\n vector v = conv_mod(p, p);\n ll rs = 0;\n for (int i = v.size()-1; i >= 0; i--) {\n if (i <= k) p[i] = (ll(k+1-i)*v[i] + rs) % MOD;\n rs = (rs + v[i]) % MOD;\n }\n }\n p = conv_mod(p, p);\n cout << (f < p.size() ? p[f] : 0) << endl;\n\n //cout << \"debugging conv_mod\" << endl;\n //vector a{1, 2}, b{2, 3};\n //vector res = conv_mod(a, b);\n //for (int i = 0; i < res.size(); i++) cout << res[i] << \" \"; cout << endl;\n\n}\n", "lang": "GNU C++17", "bug_code_uid": "4b2d5626c9852e9d55059019539b0cd0", "src_uid": "4b8161259545e44c7d1046be2e4fe014", "apr_id": "56d5d085a4b6b97cdcb4a86b9d14fbad", "difficulty": 2500, "tags": ["dp", "meet-in-the-middle", "flows", "trees", "bitmasks", "fft", "math", "graphs", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9953068592057762, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "using namespace std;\r\n#define ll long long\r\n#define bug(x) cout<<#x<<\"==\"<I;--i)\r\ninline char gc()\r\n{\r\n static char buf[1000000],*p1=buf,*p2=buf;\r\n return p1==p2&&(p2=(p1=buf)+fread(buf,1,1000000,stdin),p1==p2)?EOF:*p1++;\r\n}\r\n#define gc getchar\r\ninline ll read()\r\n{\r\n char c=gc();\r\n ll su=0,f=1;\r\n for (; c<'0'||c>'9'; c=gc()) if (c=='-') f=-1;\r\n for (; c>='0'&&c<='9'; c=gc()) su=su*10+c-'0';\r\n return su*f;\r\n}\r\ninline void write(ll x)\r\n{\r\n if (x<0)\r\n {\r\n putchar('-');\r\n write(-x);\r\n return;\r\n }\r\n if (x>=10) write(x/10);\r\n putchar(x%10+'0');\r\n}\r\ninline void writesp(ll x)\r\n{\r\n write(x),putchar(' ');\r\n}\r\ninline void writeln(ll x)\r\n{\r\n write(x);\r\n putchar('\\n');\r\n}\r\nconst int maxn=4e6+10;\r\nconst int N = 2e7+10;\r\nconst ll mod=998244353;\r\nconst ll P=998244353;\r\n\r\n///#define int long long\r\nconst int g=3;\r\ninline int power(int a, int b){\r\n int res = 1;\r\n for(; b; b>>=1, a=1ll*a*a%mod)\r\n if(b&1)\r\n res=1ll*res*a%mod;\r\n return res;\r\n}\r\n\r\nvoid ntt(int *a, int n, int flag){\r\n for(int i=(n>>1), j=1; j>1);\r\n while(i&k){i^=k; k>>=1;}\r\n i^=k;\r\n }\r\n for(int k=2; k<=n; k<<=1){\r\n int rt = power(g, (mod-1)/k);\r\n if(flag == -1)\r\n rt = power(rt, mod-2);\r\n for(int i=0; i= 1; i--) {\r\n mul(dp[i + 1], k);\r\n ll sum = 0;\r\n for (int j = 2 * k; j >= 0; j--) {\r\n sum = (sum + dp[i + 1][j]) % mod;\r\n if (j <= k) {\r\n dp[i][j] = (sum%mod+(1LL*dp[i + 1][j]) * (k - j) % mod)%mod;\r\n }\r\n }\r\n }\r\n mul(dp[1], k);\r\n writeln(dp[1][f]);\r\n}", "lang": "GNU C++17", "bug_code_uid": "484fcf785d4a6696fa1341e43d91d3c8", "src_uid": "4b8161259545e44c7d1046be2e4fe014", "apr_id": "03a37f899a6ac0d389e3990a5a089309", "difficulty": 2500, "tags": ["dp", "meet-in-the-middle", "flows", "trees", "bitmasks", "fft", "math", "graphs", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9700598802395209, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include\r\nusing namespace std;\r\n\r\nvoid solve()\r\n{\r\n int n;\r\n cin>>n;\r\n map m;\r\n for(int i=1;i*i<=n;i++)\r\n {\r\n int j=i*i;\r\n int k=j*i\r\n \r\n if(j<=n)\r\n m[j]++;\r\n if(k<=n)\r\n m[k]++;\r\n }\r\n cout<>t;\r\n while(t--)\r\n {\r\n solve();\r\n }\r\n return 0;\r\n}", "lang": "GNU C++14", "bug_code_uid": "c2fabfb99ed599347315d7d5d85a5025", "src_uid": "015afbefe1514a0e18fcb9286c7b6624", "apr_id": "694ee76ad5043ba55f189e94f8c5e63c", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.4898373983739837, "equal_cnt": 9, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 9, "bug_source_code": "#include \r\nusing namespace std;\r\n \r\nint main() {\r\n\tint n;\r\n\tcin>>n;\r\n\tfor (int t=0;t>m;\r\n\t\tint count =1;\r\n\t\tfor (long long int j = 1;j<=100000;j++) {\r\n\t\t\tif (j*j <=m ){\r\n\t\t\t\tcount++;\r\n\t\t\t} else {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor (long long int j = 1; j<=1000;j++) {\r\n\t\t\tlong long int ss= sqrt(j*j*j);\r\n\t\t\tif (j*j*j <=m &&ss*ss!=j*j*j)\r\n\t\t\t\tcount++;\r\n\t\t\t}\r\n\t\t}\r\n\t\tcout<\r\nusing namespace std;\r\nlong long m,n;\r\nint main(){\r\n cin>>n>>>m;\r\n if(m!=1) cout<<(m/2+1)*n;\r\n else\r\n {\r\n cout<<(n/2);\r\n }\r\n \r\n return 0;\r\n}", "lang": "GNU C++14", "bug_code_uid": "2b021623649da3ff93480f2813370712", "src_uid": "a91aab4c0618d036c81022232814ef44", "apr_id": "0457d0bf1e7e35b01927b78a7c074945", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9972144846796658, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \r\nusing namespace std;\r\nint main()\r\n{\r\n long long n,m;\r\n cin>>n>>m;\r\n long long answer = (m != 1) ? ((m-1)*n) : (n-1)\r\n cout<\r\nusing namespace std;\r\n\r\nint main(){\r\n int t;\r\n cin>>t;\r\n while(t--){\r\n int n;\r\n cin>>n;\r\n vectorarr(n);\r\n for(int i=0;i>arr[i];\r\n }\r\n }\r\n}\r\n\r\n#include \r\nusing namespace std;\r\nusing ll = long long;\r\nusing vb = vector;\r\nusing vvb = vector;\r\nusing vi = vector;\r\nusing vvi = vector;\r\nusing vl = vector;\r\nusing vvl = vector;\r\nusing vc = vector;\r\nusing vvc = vector;\r\nusing vs = vector;\r\nconst ll mod = 1e9 + 7,inf = 1e18;\r\n#define pb push_back\r\n#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);\r\nvoid setIO()\r\n{\r\n fast;\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\nvl fact(2e5 + 5,1);\r\nll binPow(ll a,ll b)\r\n{\r\n if (b == 0)return 1;\r\n if (b == 1)return a;\r\n ll ret = binPow(a,b/2);\r\n if (b%2 == 0)return (ret * ret)%mod;\r\n return ((ret * ret)%mod * a)%mod;\r\n}\r\nll inv(ll a)\r\n{\r\n return (binPow(a,mod - 2)%mod + mod)%mod;\r\n}\r\nll binom(ll a,ll b)\r\n{\r\n return (((fact[a] * inv(fact[b]))%mod * inv(fact[a - b]))%mod + mod)%mod;\r\n}\r\nint main()\r\n{\r\n setIO();\r\n \r\n for (int i = 2;i<=2e5;i++)fact[i] = (fact[i - 1] * 1ll * i)%mod;\r\n \r\n int t;\r\n cin>>t;\r\n while (t--){\r\n ll n,k;\r\n cin>>n>>k;\r\n \r\n ll val = 0;\r\n \r\n if (k == 0){\r\n cout<<1<<'\\n';\r\n continue;\r\n }\r\n \r\n val=binPow(2,n-1);\r\n \r\n \r\n vvl dp(k,vl(2));\r\n \r\n //dp[i][0]: LHS == RHS at ith bit\r\n //dp[i][1]: LHS > RHS at ith bit\r\n \r\n for (int i = 0;i LHS = 1 and RHS = 0\r\n \r\n dp[i][0] = (n%2 == 1 ? 1 : 0) + val;\r\n \r\n //if n is odd => LHS = 1 and RHS = 1\r\n //Choose an even number of 1's and at least one 0\r\n \r\n dp[i][0] %= mod;\r\n dp[i][1] %= mod;\r\n }\r\n else{\r\n \r\n dp[i][1] = ((n%2 == 0 ? 1 : 0) * (binPow(2,n * i)%mod))%mod;\r\n \r\n dp[i][0] = \r\n \r\n (((n%2 == 1 ? 1 : 0) + val)%mod * ((dp[i - 1][0]%mod + dp[i - 1][1])%mod)%mod)%mod;\r\n \r\n dp[i][0] %= mod;\r\n dp[i][1] %= mod;\r\n }\r\n }\r\n ll ans = (dp[k - 1][0] + dp[k - 1][1]%mod)%mod;\r\n if (ans < 0)ans += mod;\r\n cout<\r\nusing namespace std;\r\ntypedef long long LL;\r\n#define int LL\r\nconst int maxn = 2e5+5;\r\nconst int mo = 1e9+7;\r\nint readint(){\r\n\tint x=0,f=1;char s=getchar();\r\n\t#define sc (s=getchar())\r\n\twhile(s<'0'||s>'9'){\r\n\t\tif(s=='-')\r\n\t\t\tf=-1;\r\n\t\tsc;\r\n\t}\r\n\twhile(s>='0'&&s<='9'){\r\n\t\tx=(x<<3)+(x<<1)+(s^48);\r\n\t\tsc;\r\n\t}\r\n\t#undef sc\r\n\treturn x*f;\r\n}\r\nint fac[maxn],inv[maxn];\r\nvoid init(int n){\r\n\tfac[0]=inv[0]=inv[1]=1;\r\n\tfor(int i=1;i<=n;i++)\r\n\t\tfac[i]=1ll*fac[i-1]*i%mo;\r\n\tfor(int i=2;i<=n;i++)\r\n\t\tinv[i]=1ll*(mo-mo/i)*inv[mo%i]%mo;\r\n\tfor(int i=2;i<=n;i++)\r\n\t\tinv[i]=1ll*inv[i-1]*inv[i]%mo;\r\n}\r\nint C(int n,int m){\r\n\tif(n<=0||m<=0||n>=1;\r\n\t\ta=1ll*a*a%mo;\r\n\t}\r\n\treturn ans;\r\n}\r\nint main (){\r\n\tinit(maxn-5);\r\n\tint t=readint();\r\n\twhile(t--){\r\n\t\tint n=readint(),k=readint();\r\n\t\tint sum=0,ans=0;\r\n\t\tfor(int i=0;i\r\n\r\nusing namespace std;\r\n\r\n#pragma GCC target(\"avx2\")\r\n#pragma GCC optimize(\"Ofast\")\r\n#pramga GCC optimize(\"unroll-loops\")\r\n#define MAX_N (int) (4e2 + 7) \r\n#define int long long\r\n\r\nint f[MAX_N][MAX_N];\r\nint C[MAX_N][MAX_N];\r\nint POW[MAX_N];\r\n\r\nsigned main() {\r\n ios_base::sync_with_stdio(0); cin.tie(0);\r\n cout.tie(0);\r\n int n , M; cin >> n >> M;\r\n for (int i = 0 ; i <= n ; i ++) {\r\n C[i][i] = 1;\r\n C[i][0] = 1;\r\n }\r\n POW[0] = 1;\r\n for (int i = 1 ; i <= n ; i++) {\r\n (POW[i] = POW[i - 1]*2)%=M;\r\n for (int j = 1 ; j <= i ; j++) {\r\n (C[i][j] = C[i - 1][j] + C[i - 1][j - 1])%=M;\r\n }\r\n }\r\n f[0][0] = 1;\r\n for (int i = 0 ; i < n ; i++) {\r\n for (int j = 0 ; j < n ; j++) {\r\n for (int k = 1 ; k <= n ; k++) {\r\n if (i + k + 1 <= n + 1 && j + k <= n)\r\n (f[i + k + 1][j + k] += f[i][j]*POW[k - 1]%M*C[j + k][k]%M)%=M;\r\n }\r\n }\r\n }\r\n int ans = 0;\r\n for (int i = 0 ; i <= n ; i++) {\r\n (ans += f[n + 1][i])%=M;\r\n }\r\n cout << ans;\r\n return 0;\r\n}", "lang": "GNU C++17", "bug_code_uid": "e4578f7fe010bd468371b98f575d92a5", "src_uid": "4f0e0d1deef0761a46b64de3eb98e774", "apr_id": "32f11c787bc0939e91a075a30dda90f0", "difficulty": 2200, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9876739562624255, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 6, "bug_source_code": "#include \r\n\r\n#define ll long long \r\n#define pb push_back\r\n#define sz(x) (int) x.size()\r\n#define all(x) x.begin(), x.end()\r\n#define f first\r\n#define s second\r\n#define pl pair\r\n#define pi pair\r\n//~ #define int ll \r\n\r\nusing namespace std;\r\nint n, m;\r\nint inv[405], f[405], choose[405][405], pow2[405];\r\nint dp[405][405];\r\nint binpow(int a,int b) {\r\n\tint res = 1;\r\n\tfor(; b; b >>= 1, a = (a * 1ll * a) % m) {\r\n\t\tif(b & 1) res = (res * 1ll * a) % m;\r\n\t}\r\n\treturn res;\r\n}\r\nvoid calc() {\r\n\tf[0] = pow2[0] = 1;\r\n\tfor(int i = 1; i <= n; i++) {\r\n\t\tf[i] = (f[i - 1] * 1ll * i) % m;\r\n\t\tinv[i] = binpow(f[i],m - 2);\r\n\t\tpow2[i] = pow2[i - 1] * 2 % m;\r\n\t}\r\n\tfor(int i = 0; i <= n; i++) {\r\n\t\tfor(int j = 0; j <= i; j++) {\r\n\t\t\tchoose[i][j] = ((f[i] * inv[j] % m) * inv[i - j]) % m;\r\n\t\t}\r\n\t}\r\n}\r\nsigned main() {\r\n\tios_base::sync_with_stdio(0), cin.tie(0);\r\n\tcin >> n >> m;\r\n\tcalc();\r\n\tdp[0][0] = 1;\r\n\tfor(int i = 0; i < n; i++) {\r\n\t\tfor(int j = 0; j <= i; j++) {\r\n\t\t\tfor(int k = 1; k + i <= n; k++) {\r\n\t\t\t\tdp[i + k + 1][j + k] += ((dp[i][j] * pow2[k - 1] % m) * choose[j + k][k] % m);\r\n\t\t\t\tdp[i + k + 1][j + k] %= m;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tint ans = 0;\r\n\tfor(int i = 0; i <= N; i++) {\r\n\t\tans = (ans + dp[n][i]) % m;\r\n\t}\r\n\tcout << ans;\r\n}\t", "lang": "GNU C++11", "bug_code_uid": "1328a73cf6ab0a8a34f473d5f50a5544", "src_uid": "4f0e0d1deef0761a46b64de3eb98e774", "apr_id": "a563ee159189781d14e19ec2cdcef5fd", "difficulty": 2200, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9606126914660832, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include\r\n#define N 1000010\r\n#define int long long\r\n#define mod 1000000007\r\n#define LL long long\r\n#define rep(i,l,r) for(int i=l;i<=r;i++)\r\n#define drep(i,r,l) for(int i=r;i>=l;i--)\r\nusing namespace std;\r\nint n;\r\nLL poww(LL x,LL y) {\r\n\tLL res=1;\r\n\twhile(y) {\r\n\t\tif(y&1) res=res*x%mod;\r\n\t\tx=x*x%mod;\r\n\t\ty>>=1;\r\n\t}\r\n\treturn res;\r\n}\r\nsigned main() {\r\n\tscanf(\"%lld\",&n);\r\n\trintf(\"%lld\",6ll*poww(4ll,(poww(2ll,n)-2ll+mod)%mod)%mod);\r\n\treturn 0;\r\n}\r\n", "lang": "GNU C++14", "bug_code_uid": "62d0a68db6a2e3230f21a25df9817b57", "src_uid": "5144b9b281ea4087d8334d91c3c8bda4", "apr_id": "8f40bdba73d67e3df4fe1db617cc19cf", "difficulty": 1300, "tags": ["math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9990503323836657, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include\r\nusing namespace std;\r\n#define ll long long\r\n\r\nint k;\r\nll mod =1e9+7;\r\nll ans;\r\n\r\nll pow2_(ll x, ll p)\r\n{\r\n if (p==0) return 1LL;\r\n\r\n ll hf = pow_(x, p/2);\r\n if (p&1)return hf*hf*x;\r\n return hf*hf;\r\n}\r\n\r\nll pow_(ll x, ll p)\r\n{\r\n if (p==0) return 1LL;\r\n\r\n ll hf = pow_(x, p/2);\r\n if (p&1)return hf*hf%mod*x%mod;\r\n return hf*hf%mod;\r\n}\r\n\r\nint main()\r\n{\r\n scanf(\"%d\", &k);\r\n ans= pow_(4, pow2_(2,1LL*k)-2);\r\n ans*=6LL;\r\n printf(\"%lld\\n\", ans%mod);\r\n\r\n return 0;\r\n}\r\n", "lang": "GNU C++14", "bug_code_uid": "d3c81f8969fc54b0ce86c79681d52ff4", "src_uid": "5144b9b281ea4087d8334d91c3c8bda4", "apr_id": "27ec0e73a0898c1f6a87c095426683d1", "difficulty": 1300, "tags": ["math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9992181391712275, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include \r\n#define lld long long \r\nusing namespace std;\r\nconst lld mod1 = 998244353;\r\nconst lld mod2 = 1e9 + 7;\r\nlld ans;\r\nlld n;\r\nlld cnt1;\r\nvector < lld > val[7];\r\nlld sum[7];\r\nvoid dfs1 (lld k1, lld k2) {\r\n\tif (k1 == 7) return;\r\n\tval[k1].push_back((cnt1 - k2 + mod1) % mod1);\r\n\tsum[k1] += (cnt1 - k2 + mod1) % mod1;\r\n\t++ cnt1;\r\n\tfor (lld i = 0; i <= 9; ++ i)\r\n\t\tdfs1 (k1 + 1, k2 * 10 + i);\r\n}\r\ninline bool check(lld x) { return x * 1000000 + 999999 <= n && x * 10000000 > n; }\r\nlld cnt2;\r\nlld poww[7] = { 1, 10, 100, 1000, 10000, 100000, 1000000 };\r\nvoid dfs2(lld k1, lld k2) {\r\n\tif (k2 > n) return;\r\n\tif (check(k2)) {\r\n\t\tfor (lld i = 0; i <= 6; ++ i) {\r\n\t\t\tlld offset = ((cnt2 + 1 - (k2 * poww[i])) % mod1 + mod1) % mod1;\r\n\t\t\tlld pos = lower_bound(val[i].begin(), val[i].end(), mod1 - offset) - val[i].begin();\r\n\t\t\tans = (ans + (sum[i] + offset * val[i].size() - mod1 * (val[i].size() - pos))) %= mod2;\r\n\t\t}\r\n\t\tcnt2 += cnt1;\r\n\t} else {\r\n\t\t++ cnt2;\r\n\t\tans = (ans + ((cnt2 - k2) % mod1 + mod1) % mod1) %= mod2;\r\n\t\tfor (lld i = (!k1); i <= 9; ++ i)\r\n\t\t\tdfs2(k1 + 1, k2 * 10 + i);\r\n\t}\r\n}\r\nint main() {\r\n\tscanf(\"%lld\", & n);\r\n\tdfs1 (0, 0);\r\n\tfor (lld i = 0; i <= 6; ++ i) sort(val[i].begin(), val[i].end());\r\n\tcnt2 = -1;\r\n\tdfs2 (0, 0);\r\n\tprintf(\"%lld\\n\", ans);\r\n}\r\n", "lang": "GNU C++14", "bug_code_uid": "b0966b2a58a27440a67377798e41eafc", "src_uid": "2c70ae38f91ab739621a31b897b8fbf3", "apr_id": "be08dfc215de38a486124aede6c78d89", "difficulty": 3400, "tags": ["meet-in-the-middle", "math", "dfs and similar", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9860869565217392, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "#include\r\n#include\r\n#include\r\n#include\r\n#include\r\n#include\r\n#include\r\n#include\r\n#include \r\nusing namespace std;\r\n#define rep(i,a,n) for (int i=a;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\ntypedef vector VI;\r\ntypedef long long ll;\r\ntypedef pair PII;\r\ntypedef double db;\r\nmt19937 mrand(random_device{}()); \r\nconst ll mod=1000000007;\r\nconst ll mod2=998244353;\r\nint rnd(int x) { return mrand() % x;}\r\nll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}\r\nll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}\r\n\r\nVI pos[10];\r\nint cnt;\r\nll pw[15],s[15];\r\nll cnt2,n;\r\nint ans;\r\nint query(int fixpre,ll val) {\r\n\tll ans=0;\r\n\trep(d,0,7) {\r\n\t\tll offset=(val-fixpre*pw[d])%mod2;\r\n\t\tif (offset<0) offset+=mod2;\r\n\t\tint p=lower_bound(all(pos[d]),mod2-offset)-pos[d].begin();\r\n\t\tans=(ans+s[d]+offset*SZ(pos[d])-mod2*(SZ(pos[d])-p))%mod;\r\n\t}\r\n\treturn ans;\r\n}\r\n\r\nvoid dfs(int val,int d) {\r\n\tint x=(cnt-val+mod2)%mod2;\r\n\tpos[d].pb(x); cnt++;\r\n\ts[d]+=x;\r\n\tif (d==6) return;\r\n\trep(i,0,10) dfs(val*10+i,d+1);\r\n}\r\n\r\nvoid dfs2(ll val) {\r\n\tif (val*1000000+999999<=n&&val*10000000>n) {\r\n\t\tans=(ans+query(val,cnt2+1))%mod;\r\n\t\tcnt2+=cnt;\r\n\t} else {\r\n\t\tcnt2++;\r\n\t\tans=(ans+((cnt2-val)%mod2+mod2)%mod2)%mod;\r\n\t\trep(i,val?0:1,10) {\r\n\t\t\tif (val*10+i<=n) dfs2(val*10+i);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nint main() {\r\n\tdfs(0,0);\r\n\trep(i,0,7) sort(all(pos[i]));\r\n\tpw[0]=1;\r\n\trep(i,1,13) pw[i]=pw[i-1]*10;\r\n\tscanf(\"%lld\",&n);\r\n\tcnt2=-1;\r\n\tdfs2(0);\r\n\tprintf(\"%d\\n\",ans);\r\n}\r\n", "lang": "GNU C++17", "bug_code_uid": "bd04193386d544c46fc36f86d9809c69", "src_uid": "2c70ae38f91ab739621a31b897b8fbf3", "apr_id": "7a8f679b6e6f9f401f01fcc2e6995b23", "difficulty": 3400, "tags": ["meet-in-the-middle", "math", "dfs and similar", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.4842105263157895, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "#include\r\nusing namespace std;\r\ntypedef long long int ll;\r\n#define endl '\\n'\r\n#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);\r\nint main()\r\n{\r\n optimize();\r\n ll t;\r\n cin>>t;\r\n while(t--)\r\n {\r\n ll a,b,c,d;\r\n cin>>a>>b>>c>>d;\r\n ll k=0,h=0;\r\n if(a==0 && b==0 && c==0 && d==0)\r\n cout<< \"0\"<\r\nusing namespace std;\r\ntypedef long long int ll;\r\n#define endl '\\n'\r\n#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);\r\nint main()\r\n{\r\n optimize();\r\n ll t;\r\n cin>>t;\r\n while(t--)\r\n {\r\n ll a,b,c,d;\r\n cin>>a>>b>>c>>d;\r\n ll k=0,h=0;\r\n if(a==0 && b==0 && c==0 && d==0)\r\n cout<< \"0\"<\r\n\r\n \r\n", "lang": "GNU C++14", "bug_code_uid": "dd7e586f53b8f7e6fd4333303f1a6127", "src_uid": "7336b8becd2438f0439240ee8f9610ec", "apr_id": "7124472c728aa328d851afe0fdca078c", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9246575342465754, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 5, "bug_source_code": "#include \r\nusing namespace std;\r\ntypedef long long ll;\r\nconst ll mod = 1e9 + 7;\r\nbool h_v(ll n, ll m, ll k){\r\n ll kprima=(m*n)/2-k;\r\n return (k%n)%2==0;\r\n}\r\nbool v_v(ll n, ll m, ll k){\r\n ll kprima=(m*n)/2-k;\r\n if(k%n != 0){\r\n return false;\r\n }\r\n else{\r\n if((k/n)%2 == 0){\r\n return false;\r\n }\r\n else{\r\n return true;\r\n }\r\n }\r\n}\r\nbool h_h(ll n, ll m, ll k){\r\n ll kprima=(m*n)/2-k;\r\n if(kprima%m != 0){\r\n return false;\r\n }\r\n else{\r\n if((kprima/m)%2 == 0){\r\n return false;\r\n }\r\n else{\r\n return true;\r\n }\r\n }\r\n}\r\nbool v_h(ll n, ll m, ll k){\r\n ll kprima=(m*n)/2-k;\r\n return (kprima%m)%2==0;\r\n}\r\nbool func_aux(ll n, ll m, ll k){\r\n ll bandera=false;\r\n if(n%2 == 0){\r\n bandera = h_v(n,m,k) || v_v(n,m,k);\r\n }\r\n if(m%2 == 0){\r\n bandera = bandera || h_h(n,m,k) || v_h(n,m,k);\r\n }\r\n return bandera;\r\n}\r\nbool neq1(ll n, ll m, ll k){\r\n ll kprima=(m*n)/2-k;\r\n return kprima==0;\r\n}\r\nbool meq1(ll n, ll m, ll k){\r\n return k==0;\r\n}\r\nbool keq0(ll n, ll m, llk){\r\n return n%2 == 0;\r\n}\r\nbool kprimaeq0(ll n, ll m, ll k){\r\n return m%2 == 0;\r\n}\r\nbool func(ll n, ll m, ll k){\r\n ll kprima=(m*n)/2-k;\r\n if(n==1){\r\n return neq1(n,m,k);\r\n }\r\n else{\r\n if(m==1){\r\n return meq1(n,m,k);\r\n }\r\n else{\r\n if(k==0){\r\n return keq0(n,m,k);\r\n }\r\n else{\r\n if(kprima==0){\r\n return kprimaeq0(n,m,k);\r\n }\r\n else{\r\n return func_aux(n,m,k);\r\n }\r\n }\r\n }\r\n }\r\n}\r\n \r\nint main()\r\n{\r\n ios::sync_with_stdio(false), cin.tie(nullptr);\r\n ll m, n, k, t;\r\n cin>>t;\r\n for(int j=0;j>n;\r\n cin>>m;\r\n cin>>k;\r\n if(func(n,m,k))\r\n {\r\n cout<<\"YES\"<\r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n \r\nusing namespace std;\r\n \r\n#define ll long long\r\n#define ull unsigned long long\r\n#define ft first\r\n#define sc second\r\n#define add push_back\r\n#define all(v) v.begin(),v.end()\r\n#define mpr make_pair\r\n#define sz(v) v.size()\r\n#define vi vector\r\n#define pii pair\r\n#define pll pair\r\n#define FOR(i,a,b) for(ll i = (a); i < (b); i++)\r\n#define FORD(i,a,b) for(ll i = (a); i >= (b); i--)\r\n#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);\r\n \r\nconst ll MOD = 998244353;\r\nconst ll INF = 1e16;\r\nconst int N = 200005;\r\n\r\n\r\n\r\nint main() \r\n{\r\n \r\n fastio;\r\n \r\n int tt;\r\n cin>>tt;\r\n \r\n while(tt--)\r\n {\r\n int n,m,k;\r\n cin>>n>>m>>k;\r\n if(k % 2 != 0)\r\n {\r\n bool check = false;\r\n if((2*k) % m == 0 and m >= 2 and (n-((2*k)/m)) % 2 == 0)\r\n {\r\n check = true;\r\n }\r\n if(check)\r\n {\r\n cout<<\"YES\"<= 2 and (n-((2*k)/m)) % 2 == 0)\r\n {\r\n check = true;\r\n }\r\n if((k % n) % 2 == 0 and n % 2 == 0)\r\n {\r\n check = true;\r\n }\r\n if(check)\r\n {\r\n cout<<\"YES\"<\r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n \r\nusing namespace std;\r\n \r\n#define ll long long\r\n#define ull unsigned long long\r\n#define ft first\r\n#define sc second\r\n#define add push_back\r\n#define all(v) v.begin(),v.end()\r\n#define mpr make_pair\r\n#define sz(v) v.size()\r\n#define vi vector\r\n#define pii pair\r\n#define pll pair\r\n#define FOR(i,a,b) for(ll i = (a); i < (b); i++)\r\n#define FORD(i,a,b) for(ll i = (a); i >= (b); i--)\r\n#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);\r\n \r\nconst ll MOD = 998244353;\r\nconst ll INF = 1e16;\r\nconst int N = 200005;\r\n\r\n\r\n\r\nint main() \r\n{\r\n \r\n fastio;\r\n \r\n int tt;\r\n cin>>tt;\r\n \r\n while(tt--)\r\n {\r\n int n,m,k;\r\n cin>>n>>m>>k;\r\n if(k % 2 != 0)\r\n {\r\n bool check = false;\r\n if((2*k) % m == 0 and m >= 2 and (n-((2*k)/m)) % 2 == 0)\r\n {\r\n check = true;\r\n }\r\n if(check)\r\n {\r\n cout<<\"YES\"<= 2 and (n-((2*k)/m)) % 2 == 0)\r\n {\r\n check = true;\r\n }\r\n if((k % n) % 2 == 0 and n % 2 == 0)\r\n {\r\n check = true;\r\n }\r\n if(check)\r\n {\r\n cout<<\"YES\"<\r\n#define fi first\r\n#define se second\r\n#define LSON t << 1, l, mid\r\n#define RSON t<< 1 | 1, mid + 1, r\r\n#ifdef FEIFEI\r\n#define Debug printf\r\n#else\r\n#define endl '\\n'\r\n#define Debug(...)\r\n#endif\r\n\r\nusing namespace std;\r\ntypedef long long LL;\r\ntypedef pair P;\r\n\r\nconst int maxn = 1e6 + 5;\r\nconst int mod = 998244353;\r\n\r\nvoid add(int &x, int y) {\r\n x += y;\r\n if(x >= mod) x -= mod;\r\n}\r\n\r\nint mask[11], sp[11];\r\nint dp[2][1024];\r\nvoid solve()\r\n{\r\n int n, m, u, v, w;\r\n cin >> n >> m;\r\n for (int i = 0; i < m; i++) {\r\n cin >> u >> v;\r\n mask[u] |= 1 << v;\r\n mask[v] |= 1 << u;\r\n }\r\n\r\n for (int i = 0; i < 10; i++) sp[i] = (1 << i) - 1;\r\n\r\n u = 0;\r\n dp[u][0] = 1;\r\n for (int i = 0; i < n; i++) {\r\n v = u ^ 1;\r\n memset(dp[v], 0, sizeof(dp[v]));\r\n for (int j = 0; j < 1024; j++) {\r\n if (!dp[u][j]) continue;\r\n for (int x = 0; x < 10; x++) {\r\n w = j & mask[x];\r\n if (!(w & sp[x])) upd(dp[v][w | (1 << x)], dp[u][j]);\r\n }\r\n }\r\n\r\n u ^= 1;\r\n }\r\n\r\n int ans = 0;\r\n for (int i = 0; i < 1024; i++) upd(ans, dp[u][i]);\r\n cout << ans << endl;\r\n}\r\n\r\nint main()\r\n{\r\n#ifdef FEIFEI\r\n freopen(\"input.txt\", \"r\", stdin);\r\n#endif\r\n ios::sync_with_stdio(false);\r\n cin.tie(0);\r\n\r\n int pT = 1;\r\n //cin >> pT;\r\n while (pT--) {\r\n solve();\r\n }\r\n\r\n Debug(\"Time: %.3lfs\\n\", (double)clock() / CLOCKS_PER_SEC);\r\n return 0;\r\n}\r\n", "lang": "GNU C++17", "bug_code_uid": "e786e96125c1b8dc5a2fa365867d7d03", "src_uid": "60955fc2caa6ec99c7dcc1da5d36b1f8", "apr_id": "21cf22c7e77d1b0d085ce30fe1af8a55", "difficulty": 2600, "tags": ["dp", "math", "bitmasks"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.1487151448879169, "equal_cnt": 18, "replace_cnt": 12, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 19, "bug_source_code": "#pragma GCC optimize(\"Ofast\")\r\n#include\r\nusing namespace std;\r\nconst int N=5e4+10;\r\nconst int mod=998244353;\r\nint n,m,x,y,ans;\r\nbool f[10][10];\r\nint dp[2][1<<10],dfa[1<<10][10];\r\nvoid init(){\r\n\tfor (int i=0;i<(1<<10);i++){\r\n\t\tfor (int j=0;j<=9;j++) if (i&(1<\r\n#include \r\n#include \r\n#include \r\n#include \r\n#include\r\n#include \r\n#include \r\n#define int long long\r\n\r\nusing namespace std;\r\n\r\nmain() \r\n{\r\n vector p = {1200, 1400, 1600, 1900, 2100, 2300, 2400, 2600, 3000};\r\n int r;\r\n cin>>r;\r\n int res, w=1000000;\r\n for(auto o: p)\r\n {\r\n if(o>r)\r\n {\r\n res=o;\r\n break;\r\n }\r\n }\r\n cout<\r\nusing namespace std;\r\nint r;\r\nint main()\r\n{\r\n\tcin>>r;\r\n\tif(r<0) cout<0;\r\n\telse if(r<1200) cout<<1200;\r\n\telse if(r<1400) cout<<1400;\r\n\telse if(r<1600) cout<<1600;\r\n\telse if(r<1900) cout<<1900;\r\n\telse if(r<2100) cout<<2100;\r\n\telse if(r<2300) cout<<2300;\r\n\telse if(r<2400) cout<<2400;\r\n\telse if(r<2600) cout<<2600;\r\n\telse if(r<3000) cout<<3000;\r\n\treturn 0;\r\n}", "lang": "GNU C++14", "bug_code_uid": "82b2250f9a0d4b923cdd47f3531f4126", "src_uid": "22725effa6dc68b9c2a499d148e613c2", "apr_id": "2e489f953f740c524501cb1d3733cf3e", "difficulty": -1, "tags": ["divide and conquer", "math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.4139344262295082, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "#include>n;\r\n string s;\r\n for(int i=0;i>s;\r\n cout<<\"YES\";\r\n}", "lang": "GNU C++17", "bug_code_uid": "485216a362cfc7c2ed74984c9cb6cae3", "src_uid": "56ec50526a3843fe3784d395850f45ae", "apr_id": "b649cc3842bd61c6c68f2d94ce449886", "difficulty": -1, "tags": ["strings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9836601307189542, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include\r\nusing namespace std;\r\nstring const t[]={\"\",\"\",\"\",\"the\",\"\",\"buffy\",\"slayer\",\"vampire\"};\r\nstring s;\r\nint main(){\r\n cin>>s;\r\n if(t[s.size()]==\"\")\r\n cout<<\"none\\n\",exit(0);\r\n for(int i=0;i>n;\r\n string s;\r\n for(int i=0;i>s;\r\n cout<<\"YES\";\r\n}", "lang": "GNU C++17", "bug_code_uid": "5df4d21d684994d375f516f09e4c62a7", "src_uid": "efb72baf6759f7bc5ac0f3099b7177d0", "apr_id": "9fac4fc4c5cb0782327e35c7d4b14cde", "difficulty": -1, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.029136316337148804, "equal_cnt": 6, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "n = int(input())\r\ncnt = 0\r\nfor i in range(n):\r\n s = input()\r\n if \"minos\" in s:\r\n cnt+=1\r\nif cnt==n: print(\"YES\")\r\nelse: print(\"NO\")", "lang": "GNU C++17", "bug_code_uid": "d568c91a7058eafd657cdf8d9621a988", "src_uid": "efb72baf6759f7bc5ac0f3099b7177d0", "apr_id": "72d756594e16693378c3a31367461b20", "difficulty": -1, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9065300896286812, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include \r\nusing namespace std;\r\nint main()\r\n{\r\n ios::sync_with_stdio(false);\r\n\tcin.tie(0);\r\n\tcin>>n>>m;\r\n\ta[1]=1;\r\n\tsum[1]=1;\r\n\tfor(ll i=2;i<=n;i++){\r\n\t\ta[i]=sum[i-1];\r\n\t\tfor(ll l=2,r;l<=i;l=r+1){\r\n\t\t\t\tr=min(i,i/(i/l));\r\n\t\t\ta[i]+=(r-l+1)*a[i/l];\r\n\t\t\ta[i]%=m;\r\n\t\t\t}\r\n\t\tsum[i]=(sum[i-1]+a[i])%m;\r\n\t\t}\r\n\tcout<\r\n#define all(v) v.begin(), v.end()\r\n#define rall(v) v.rbegin(), v.rend()\r\n#define rep(i,n) for(int i=0;i<(int)(n);i++)\r\n#define drep(i,j,n) for(int i=0;i<(int)(n-1);i++)for(int j=i+1;j<(int)(n);j++)\r\n#define trep(i,j,k,n) for(int i=0;i<(int)(n-2);i++)for(int j=i+1;j<(int)(n-1);j++)for(int k=j+1;k<(int)(n);k++)\r\n#define codefor int test;scanf(\"%d\",&test);while(test--)\r\n#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)\r\n#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)\r\n#define yes(ans) if(ans)printf(\"yes\\n\");else printf(\"no\\n\")\r\n#define Yes(ans) if(ans)printf(\"Yes\\n\");else printf(\"No\\n\")\r\n#define YES(ans) if(ans)printf(\"YES\\n\");else printf(\"NO\\n\")\r\n#define popcount(v) __builtin_popcount(v)\r\n#define vector1d(type,name,...) vectorname(__VA_ARGS__)\r\n#define vector2d(type,name,h,...) vector>name(h,vector(__VA_ARGS__))\r\n#define vector3d(type,name,h,w,...) vector>>name(h,vector>(w,vector(__VA_ARGS__)))\r\n#define umap unordered_map\r\n#define uset unordered_set\r\nusing namespace std;\r\nusing ll = long long;\r\nconst int MOD=1000000007;\r\nconst int MOD2=998244353;\r\nconst int INF=1<<30;\r\nconst ll INF2=(ll)1<<60;\r\n//\u5165\u529b\u7cfb\r\nvoid scan(int& a){scanf(\"%d\",&a);}\r\nvoid scan(long long& a){scanf(\"%lld\",&a);}\r\ntemplatevoid scan(pair& p){scan(p.first);scan(p.second);}\r\ntemplate void scan(T& a){cin>>a;}\r\ntemplate void scan(vector& vec){for(auto&& it:vec)scan(it);}\r\nvoid in(){}\r\ntemplate void in(Head& head, Tail&... tail){scan(head);in(tail...);}\r\n//\u51fa\u529b\u7cfb\r\nvoid print(const int& a){printf(\"%d\",a);}\r\nvoid print(const long long& a){printf(\"%lld\",a);}\r\nvoid print(const double& a){printf(\"%.15lf\",a);}\r\ntemplatevoid print(const pair& p){print(p.first);putchar(' ');print(p.second);}\r\ntemplate void print(const T& a){cout< void print(const vector& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}\r\nvoid out(){putchar('\\n');}\r\ntemplate void out(const T& t){print(t);putchar('\\n');}\r\ntemplate void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}\r\n//\u30c7\u30d0\u30c3\u30b0\u7cfb\r\ntemplate void dprint(const T& a){cerr< void dprint(const vector& vec){if(vec.empty())return;cerr< void debug(const T& t){dprint(t);cerr< void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<\" \";debug(tail...);}\r\nll intpow(ll a, ll b){ ll ans = 1; while(b){ if(b & 1) ans *= a; a *= a; b /= 2; } return ans; }\r\nll modpow(ll a, ll b, ll p){ ll ans = 1; while(b){ if(b & 1) (ans *= a) %= p; (a *= a) %= p; b /= 2; } return ans; }\r\nll modinv(ll a, ll m) {ll b = m, u = 1, v = 0;while (b) {ll t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}\r\nll updivide(ll a,ll b){if(a%b==0) return a/b;else return (a/b)+1;}\r\ntemplate void chmax(T &a,const T b){if(b>a)a=b;}\r\ntemplate void chmin(T &a,const T b){if(b>= 1;\r\n }\r\n return r;\r\n}\r\nconstexpr bool is_prime_constexpr(int n) {\r\n if (n <= 1) return false;\r\n if (n == 2 || n == 7 || n == 61) return true;\r\n if (n % 2 == 0) return false;\r\n long long d = n - 1;\r\n while (d % 2 == 0) d /= 2;\r\n constexpr long long bases[3] = {2, 7, 61};\r\n for (long long a : bases) {\r\n long long t = d;\r\n long long y = pow_mod_constexpr(a, t, n);\r\n while (t != n - 1 && y != 1 && y != n - 1) {y = y * y % n;t <<= 1;}\r\n if (y != n - 1 && t % 2 == 0) {return false;}\r\n }\r\n return true;\r\n}\r\ntemplate constexpr bool is_prime = is_prime_constexpr(n);\r\nconstexpr std::pair inv_gcd(long long a, long long b) {\r\n a = safe_mod(a, b);\r\n if (a == 0) return {b, 0};\r\n long long s = b, t = a;\r\n long long m0 = 0, m1 = 1;\r\n while (t) {long long u = s / t;s -= t * u;m0 -= m1 * u;auto tmp = s;s = t;t = tmp;tmp = m0;m0 = m1;m1 = tmp;}\r\n if (m0 < 0) m0 += b / s;\r\n return {s, m0};\r\n}\r\nconstexpr int primitive_root_constexpr(int m) {\r\n if (m == 2) return 1;\r\n if (m == 167772161) return 3;\r\n if (m == 469762049) return 3;\r\n if (m == 754974721) return 11;\r\n if (m == 998244353) return 3;\r\n int divs[20] = {};\r\n divs[0] = 2;\r\n int cnt = 1;\r\n int x = (m - 1) / 2;\r\n while (x % 2 == 0) x /= 2;\r\n for (int i = 3; (long long)(i)*i <= x; i += 2) {\r\n if (x % i == 0) {divs[cnt++] = i;while (x % i == 0) {x /= i;}}\r\n }\r\n if (x > 1) {divs[cnt++] = x;}\r\n for (int g = 2;; g++) {\r\n bool ok = true;\r\n for (int i = 0; i < cnt; i++) {\r\n if (pow_mod_constexpr(g, (m - 1) / divs[i], m) == 1) {ok = false;break;}\r\n }\r\n if (ok) return g;\r\n }\r\n}\r\ntemplate constexpr int primitive_root = primitive_root_constexpr(m);\r\nunsigned long long floor_sum_unsigned(unsigned long long n,unsigned long long m,unsigned long long a,unsigned long long b) {\r\n unsigned long long ans = 0;\r\n while (true) {\r\n if (a >= m) {ans += n * (n - 1) / 2 * (a / m);a %= m;}\r\n if (b >= m) {ans += n * (b / m);b %= m;}\r\n unsigned long long y_max = a * n + b;\r\n if (y_max < m) break;\r\n n = (unsigned long long)(y_max / m);\r\n b = (unsigned long long)(y_max % m);\r\n std::swap(m, a);\r\n }\r\n return ans;\r\n}\r\ntemplate using is_integral = typename std::is_integral;\r\ntemplate \r\nusing is_signed_int =\r\n typename std::conditional::value && std::is_signed::value,\r\n std::true_type,\r\n std::false_type>::type;\r\ntemplate \r\nusing is_unsigned_int =\r\n typename std::conditional::value &&\r\n std::is_unsigned::value,\r\n std::true_type,\r\n std::false_type>::type;\r\ntemplate \r\nusing to_unsigned = typename std::conditional::value,\r\n std::make_unsigned,\r\n std::common_type>::type;\r\ntemplate using is_signed_int_t = std::enable_if_t::value>;\r\ntemplate using is_unsigned_int_t = std::enable_if_t::value>;\r\ntemplate using to_unsigned_t = typename to_unsigned::type;\r\nstruct modint_base {};\r\nstruct static_modint_base : modint_base {};\r\ntemplate using is_modint = std::is_base_of;\r\ntemplate using is_modint_t = std::enable_if_t::value>;\r\n} // namespace internal\r\ntemplate * = nullptr>\r\nstruct static_modint : internal::static_modint_base {\r\n using mint = static_modint;\r\n public:\r\n static constexpr int mod() { return m; }\r\n static mint raw(int v) {mint x;x._v = v;return x;}\r\n static_modint() : _v(0) {}\r\n template * = nullptr>\r\n static_modint(T v) {\r\n long long x = (long long)(v % (long long)(umod()));\r\n if (x < 0) x += umod();_v = (unsigned int)(x);\r\n }\r\n template * = nullptr>\r\n static_modint(T v) {_v = (unsigned int)(v % umod());}\r\n unsigned int val() const { return _v; }\r\n mint& operator++() {_v++;if (_v == umod()) _v = 0;return *this;}\r\n mint& operator--() {if (_v == 0) _v = umod();_v--;return *this;}\r\n mint operator++(int) {mint result = *this;++*this;return result;}\r\n mint operator--(int) {mint result = *this;--*this;return result;}\r\n mint& operator+=(const mint& rhs) {_v += rhs._v;if (_v >= umod()) _v -= umod();return *this;}\r\n mint& operator-=(const mint& rhs) {_v -= rhs._v;if (_v >= umod()) _v += umod();return *this;}\r\n mint& operator*=(const mint& rhs) {unsigned long long z = _v;z *= rhs._v;_v = (unsigned int)(z % umod());return *this;}\r\n mint& operator/=(const mint& rhs) { return *this = *this * rhs.inv(); }\r\n mint operator+() const { return *this; }\r\n mint operator-() const { return mint() - *this; }\r\n mint pow(long long n) const {assert(0 <= n);mint x = *this, r = 1;while (n) {if (n & 1) r *= x;x *= x;n >>= 1;}return r;}\r\n mint inv() const {if (prime) {assert(_v);return pow(umod() - 2);} else {auto eg = internal::inv_gcd(_v, m);assert(eg.first == 1);return eg.second;}}\r\n friend mint operator+(const mint& lhs, const mint& rhs) {return mint(lhs) += rhs;}\r\n friend mint operator-(const mint& lhs, const mint& rhs) {return mint(lhs) -= rhs;}\r\n friend mint operator*(const mint& lhs, const mint& rhs) {return mint(lhs) *= rhs;}\r\n friend mint operator/(const mint& lhs, const mint& rhs) {return mint(lhs) /= rhs;}\r\n friend bool operator==(const mint& lhs, const mint& rhs) {return lhs._v == rhs._v;}\r\n friend bool operator!=(const mint& lhs, const mint& rhs) {return lhs._v != rhs._v;}\r\n //\u81ea\u5206\u3067\u52a0\u3048\u305f\u3082\u306e\r\n friend istream& operator>>(istream& os,mint& rhs) noexcept {\r\n long long v;\r\n rhs = mint{(os >> v, v)};\r\n return os;\r\n }\r\n friend constexpr ostream& operator << (ostream &os, const mint& rhs) noexcept {\r\n return os << rhs._v;\r\n }\r\n private:\r\n unsigned int _v;\r\n static constexpr unsigned int umod() { return m; }\r\n static constexpr bool prime = internal::is_prime;\r\n};\r\nusing mint=static_modint<1000000007>;\r\nusing mint2=static_modint<998244353>;\r\n\r\ntemplate struct segtree {\r\n public:\r\n segtree() : segtree(0) {}\r\n segtree(int n) : segtree(std::vector(n, e())) {}\r\n segtree(const std::vector& v) : _n(int(v.size())) {\r\n log = ceil_pow2(_n);\r\n size = 1 << log;\r\n d = std::vector(2 * size, e());\r\n for (int i = 0; i < _n; i++) d[size + i] = v[i];\r\n for (int i = size - 1; i >= 1; i--) {\r\n update(i);\r\n }\r\n }\r\n\r\n void set(int p, S x) {\r\n assert(0 <= p && p < _n);\r\n p += size;\r\n d[p] = x;\r\n for (int i = 1; i <= log; i++) update(p >> i);\r\n }\r\n\r\n S get(int p) {\r\n assert(0 <= p && p < _n);\r\n return d[p + size];\r\n }\r\n\r\n S prod(int l, int r) {\r\n assert(0 <= l && l <= r && r <= _n);\r\n S sml = e(), smr = e();\r\n l += size;\r\n r += size;\r\n\r\n while (l < r) {\r\n if (l & 1) sml = op(sml, d[l++]);\r\n if (r & 1) smr = op(d[--r], smr);\r\n l >>= 1;\r\n r >>= 1;\r\n }\r\n return op(sml, smr);\r\n }\r\n\r\n S all_prod() { return d[1]; }\r\n\r\n template int max_right(int l) {\r\n return max_right(l, [](S x) { return f(x); });\r\n }\r\n template int max_right(int l, F f) {\r\n assert(0 <= l && l <= _n);\r\n assert(f(e()));\r\n if (l == _n) return _n;\r\n l += size;\r\n S sm = e();\r\n do {\r\n while (l % 2 == 0) l >>= 1;\r\n if (!f(op(sm, d[l]))) {\r\n while (l < size) {\r\n l = (2 * l);\r\n if (f(op(sm, d[l]))) {\r\n sm = op(sm, d[l]);\r\n l++;\r\n }\r\n }\r\n return l - size;\r\n }\r\n sm = op(sm, d[l]);\r\n l++;\r\n } while ((l & -l) != l);\r\n return _n;\r\n }\r\n\r\n template int min_left(int r) {\r\n return min_left(r, [](S x) { return f(x); });\r\n }\r\n template int min_left(int r, F f) {\r\n assert(0 <= r && r <= _n);\r\n assert(f(e()));\r\n if (r == 0) return 0;\r\n r += size;\r\n S sm = e();\r\n do {\r\n r--;\r\n while (r > 1 && (r % 2)) r >>= 1;\r\n if (!f(op(d[r], sm))) {\r\n while (r < size) {\r\n r = (2 * r + 1);\r\n if (f(op(d[r], sm))) {\r\n sm = op(d[r], sm);\r\n r--;\r\n }\r\n }\r\n return r + 1 - size;\r\n }\r\n sm = op(d[r], sm);\r\n } while ((r & -r) != r);\r\n return 0;\r\n }\r\n\r\n private:\r\n int _n, size, log;\r\n std::vector d;\r\n int ceil_pow2(int n) {\r\n int x = 0;\r\n while ((1U << x) < (unsigned int)(n)) x++;\r\n return x;\r\n }\r\n void update(int k) { d[k] = op(d[2 * k], d[2 * k + 1]); }\r\n};\r\n\r\nint modv;\r\nll op(ll a,ll b){return (a+b)%modv;}\r\nll e(){return 0;}\r\n\r\nint main(){\r\n INT(n);\r\n in(modv);\r\n segtree seg(n+1);\r\n seg.set(1,1);\r\n ll v,v2,nxt,l,r,mid;\r\n for(int i=2;i<=n;i++){\r\n v=0;\r\n nxt=min(10000,n+1);\r\n for(j=2;j=v2)l=mid+1;\r\n else r=mid;\r\n }\r\n v+=((l-nxt)%modv)*seg.get(v2);\r\n v%=modv;\r\n nxt=l;\r\n }\r\n v+=seg.prod(0,i);\r\n v%=modv;\r\n seg.set(i,v);\r\n }\r\n out(seg.get(n));\r\n}", "lang": "GNU C++14", "bug_code_uid": "45498fb21b1ac9eac381266da290e13f", "src_uid": "a524aa54e83fd0223489a19531bf0e79", "apr_id": "e60651c956186390fa908786387a5b44", "difficulty": 1700, "tags": ["dp", "number theory", "data structures", "math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.27522935779816515, "equal_cnt": 16, "replace_cnt": 8, "delete_cnt": 4, "insert_cnt": 4, "fix_ops_cnt": 16, "bug_source_code": "#include\r\n#include\r\n#include\r\nusing namespace std;\r\nint main() {\r\n\tint n;\r\n\tcin >> n;\r\n\tdouble x = sqrt(n);\r\n\tif ((ceil)(x) == (floor)(x))\r\n\t\tcout << x << endl;\r\n\telse {\r\n\t\tcout << \"1\" << endl;\r\n\t}\r\n}", "lang": "GNU C++14", "bug_code_uid": "63ce8eb040154984d3ca75766cf18ab2", "src_uid": "477a67877367dc68b3bf5143120ff45d", "apr_id": "f37e1ba259ef7982371dd8a9340bf5d6", "difficulty": 1600, "tags": ["number theory", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.6361556064073226, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include\nusing namespace std;\ntypedef long long lint;\nint main(){\n\tint n;\n\twhile(cin >> n){\n\t\tcout sqrt(n) << \"\\n\";\n\t}\n\t\n\t\n\treturn 0;\n}\n", "lang": "GNU C++11", "bug_code_uid": "4e89614f6b78edd38e137e22a9a273ad", "src_uid": "477a67877367dc68b3bf5143120ff45d", "apr_id": "78fd7d53e20f26b783ca8d87cb0ed86d", "difficulty": 1600, "tags": ["number theory", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.043001443001443, "equal_cnt": 35, "replace_cnt": 31, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 35, "bug_source_code": "#include\r\n#define F(i,L,R) for (int i = L; i < R; i++) //next four are for \"for loops\"\r\n#define FE(i,L,R) for (int i = L; i <= R; i++)\r\n#define FF(i,L,R) for (int i = L; i > R; i--)\r\n#define FFE(i,L,R) for (int i = L; i >= R; i--)\r\n#define getI(a) scanf(\"%d\", &a) //next three are handy ways to get ints, it's also force you to use '&' sign\r\n#define getII(a,b) scanf(\"%d %d\", &a, &b)\r\n#define getIII(a,b,c) scanf(\"%d %d %d\", &a, &b, &c)\r\n#define whileZ() int T; getI(T); while(T--)\r\n#define wez(n) int (n); scanf(\"%d\",&(n)) //handy if the input is right after the definition of a variable\r\n#define wez2(n,m) int (n),(m); scanf(\"%d %d\",&(n),&(m))\r\n#define wez3(n,m,k) int (n),(m),(k); scanf(\"%d %d %d\",&(n),&(m),&(k))\r\n#define ll long long\r\n\r\nusing namespace std;\r\n\r\nint main(){\r\n int num[2],digsum[2]=0;\r\n cin>>num[0];\r\n cin>>num[1];\r\n m=num;\r\n digsum=m;\r\n int i=0;\r\n while(i<2){\r\n m=num[i];\r\n while(m!=0){\r\n digsum[i]+=(m%10);\r\n m/=10;\r\n }\r\n }\r\n if(digsum[0]digsum[1])\r\n cout<<\"YES\";\r\n cout<\r\nusing namespace std;\r\n#define ll long long int\r\n\r\nint main() \r\n{\r\n SPEED;\r\n#ifndef ONLINE_JUDGE\r\n freopen(\"input.txt\", \"r\", stdin);\r\n freopen(\"output.txt\", \"w\", stdout);\r\n#endif\r\n//<<<<<<<<<<<<<< Start >>>>>>>>>>>>>\r\n int n, m;\r\n cin >> n >> m;\r\n set elems;\r\n while (n) {\r\n if (!elems.insert(n % m).second) {\r\n cout << \"NO\\n\";\r\n return 0;\r\n }\r\n n /= m;\r\n }\r\n cout << \"YES\\n\";\r\n return 0;\r\n}\r\n", "lang": "GNU C++17", "bug_code_uid": "f12a30fba336dda8a2fded071e0af879", "src_uid": "a8945bb1082fefe70e6898a8bec1ce3f", "apr_id": "34d835caf0b454f31c5c8caef746adc9", "difficulty": 1800, "tags": ["number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.08616780045351474, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 8, "bug_source_code": "#include\r\n#include\r\nusing namespace std;\r\nint main(){\r\n\tint x;cin>>x;\r\n\tcout<<2-x^2; //kjkjkj\r\n}", "lang": "GNU C++14", "bug_code_uid": "24f010311b904acb3cf0686e33a51315", "src_uid": "f76005f888df46dac38b0f159ca04d5f", "apr_id": "865773ddd78fdc06e8604c550283fc56", "difficulty": 2200, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9921259842519685, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include\r\nusing namepsace std;\r\nint main()\r\n{\r\n int n;\r\n cin>>n;\r\n cout<<2-n*n<\r\nusing namespace std;\r\n#define rep(i,a,n) for (int i=a;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\ntypedef vector VI;\r\ntypedef long long ll;\r\ntypedef pair PII;\r\ntypedef double db;\r\nmt19937 mrand(random_device{}());\r\nconst ll mod=1000000007;\r\nint rnd(int x) { return mrand() % x;}\r\nll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}\r\nll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}\r\n// head\r\n\r\nint h, w;\r\nint f[10][10];\r\n\r\nbool cmp(PII a, PII b) {\r\n\treturn f[a.fi][a.se] > f[b.fi][b.se];\r\n}\r\n\r\nvoid solve(int x, int y) {\r\n\tint& ans = f[x][y];\r\n\twhile(x<=h && y<=w) {\r\n\t\tif(s[x][y]=='*')\r\n\t\t\tans++;\r\n\t\tvector tmp;\r\n\t\tint mn = 1e9;\r\n\t\tfor(int i=x; i<=h; i++) {\r\n\t\t\tfor(int j=y; j<=w; j++) {\r\n\t\t\t\tif(i==x && j==y)\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\tint dist = i-x+j-y;\r\n\t\t\t\tif(s[i][j]=='*') {\r\n\t\t\t\t\tif(dist=1; i--) {\r\n\t// \tfor(int j=w; j>=1; j--) {\r\n\t// \t\tint val = 0;\r\n\t// \t\tif(i=1; i--) {\r\n\t\tfor(int j=w; j>=1; j--) {\r\n\t\t\tsolve(i, j);\r\n\t\t}\r\n\t}\r\n\tprintf(\"%d\\n\", f[1][1]);\r\n\treturn 0;\r\n}", "lang": "GNU C++17", "bug_code_uid": "e1f4cb996459f0e0951f6c4f4b99ad3c", "src_uid": "f985d7a6e7650a9b855a4cef26fd9b0d", "apr_id": "554e09fb83a00ef13cded055b1d4df54", "difficulty": 1800, "tags": ["implementation", "greedy", "shortest paths"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.997827661115134, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \r\n#include \r\n#include \r\n\r\nusing namespace std;\r\n\r\nint main(){\r\n int m, n;\r\n cin >> m >> n;\r\n string s;\r\n vector arr;\r\n for (int i = 0; i < m; ++i){\r\n cin >> s;\r\n arr[i].emplace_back(s);\r\n }\r\n int i = 0;\r\n int j = 0;\r\n int result = 0;\r\n while (i < m && j < n){\r\n if (arr[i][j] == '*'){\r\n ++result;\r\n }\r\n if (i + 1 < m && arr[i + 1][j] == '*'){\r\n ++i;\r\n }\r\n else{\r\n if (j + 1 < n){\r\n ++j;\r\n }\r\n else{\r\n ++i;\r\n }\r\n }\r\n }\r\n cout << result << endl;\r\n return 0;\r\n}", "lang": "GNU C++11", "bug_code_uid": "7f9c0de191a2ae42bbf91d01c07e9c21", "src_uid": "f985d7a6e7650a9b855a4cef26fd9b0d", "apr_id": "0663c60a2638d6faf05a93953a702eee", "difficulty": 1800, "tags": ["implementation", "greedy", "shortest paths"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9996864220758859, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include\r\nusing namespace std;\r\nstring ans;\r\nint judge(int a,int b,int c,int d,int e){\r\n //\u75af\u72c2\u6253\u8868\r\n if(a==1&&b==0&&c==0&&d==1&&e==0)return'a';\r\n if(a==1&&b==1&&c==0&&d==2&&e==0)return'b';\r\n if(a==2&&b==0&&c==0&&d==1&&e==1)return'c';\r\n if(a==2&&b==1&&c==0&&d==1&&e==2)return'd';\r\n if(a==1&&b==1&&c==0&&d==1&&e==1)return'e';\r\n if(a==2&&b==1&&c==0&&d==2&&e==1)return'f';\r\n if(a==2&&b==2&&c==0&&d==2&&e==2)return'g';\r\n if(a==1&&b==2&&c==0&&d==2&&e==1)return'h';\r\n if(a==1&&b==1&&c==0&&d==1&&e==1)return'i';\r\n if(a==1&&b==2&&c==0&&d==1&&e==2)return'j';\r\n if(a==1&&b==0&&c==1&&d==2&&e==0)return'k';\r\n if(a==1&&b==1&&c==1&&d==3&&e==0)return'l';\r\n if(a==2&&b==0&&c==1&&d==2&&e==1)return'm';\r\n if(a==2&&b==1&&c==1&&d==2&&e==2)return'n';\r\n if(a==1&&b==1&&c==1&&d==2&&e==1)return'o';\r\n if(a==2&&b==1&&c==1&&d==3&&e==1)return'p';\r\n if(a==2&&b==2&&c==1&&d==3&&e==2)return'q';\r\n if(a==1&&b==2&&c==1&&d==3&&e==1)return'r';\r\n if(a==1&&b==1&&c==1&&d==2&&e==1)return's';\r\n if(a==1&&b==2&&c==1&&d==2&&e==2)return't';\r\n if(a==1&&b==0&&c==2&&d==2&&e==1)return'u';\r\n if(a==1&&b==1&&c==2&&d==3&&e==1)return'v';\r\n if(a==1&&b==2&&c==1&&d==1&&e==3)return'w';\r\n if(a==2&&b==0&&c==2&&d==2&&e==2)return'x';\r\n if(a==2&&b==1&&c==2&&d==2&&e==3)return'y';\r\n if(a==1&&b==1&&c==2&&d==2&&e==2)return'z';\r\n}\r\nint main(){\r\n int n;\r\n scanf(\"%d\",&n)\r\n for(int i=0;i\r\n#include \r\n\r\nusing namespace std;\r\n\r\nint main(){\r\n int chars;\r\n string out = \"\";\r\n cin >> chars;\r\n \r\n for(int i = 0; i < chars; i++){\r\n int a, b, c;\r\n cin >> a >> b >> c;\r\n int d, e;\r\n cin >> d >> e;\r\n \r\n int hash1 = 9 * a + 3 * b + c;\r\n int hash2 = 4 * d + e;\r\n \r\n char c;\r\n switch(hash1){\r\n case 9:\r\n c = 'a';\r\n break;\r\n case 10:\r\n c = 'k';\r\n break;\r\n case 11:\r\n c = 'u';\r\n break;\r\n case 12:\r\n if(hash2 == 8) c = 'b';\r\n else c = 'e';\r\n break;\r\n case 13:\r\n if(hash2 == 12) c = 'l';\r\n else c = 'o';\r\n break;\r\n case 14:\r\n if(hash2 == 13) c = 'v';\r\n else c = 'z';\r\n break;\r\n case 15:\r\n if(hash2 == 9) c = 'h';\r\n else c = 'j';\r\n break;\r\n case 16:\r\n if(hash2 == 13) c = 'r';\r\n else if(hash2 == 10) c = 't';\r\n else c = 'w';\r\n break;\r\n case 18:\r\n c = 'c';\r\n break;\r\n case 19:\r\n c = 'm';\r\n break;\r\n case 20:\r\n c = 'x';\r\n break;\r\n case 21:\r\n if(hash2 == 6) c = 'd';\r\n else c = 'f';\r\n break;\r\n case 22:\r\n if(hash2 == 10) c = 'n';\r\n else c = 'p';\r\n break;\r\n case 23:\r\n c = 'y';\r\n break;\r\n case 24:\r\n c = 'g';\r\n break;\r\n case 25:\r\n c = 'q';\r\n break;\r\n default:\r\n c = ' ';\r\n }\r\n \r\n out += c;\r\n }\r\n \r\n cout << out << endl;\r\n return 0;\r\n}", "lang": "GNU C++17", "bug_code_uid": "d8aff43729effb29960b4b3febd20bbe", "src_uid": "a3603f5ed0d8bdb7fe829342991b78e6", "apr_id": "b9144a154eaa374312fab60ff5b0b9ab", "difficulty": 2600, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.061448427212874905, "equal_cnt": 19, "replace_cnt": 16, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 19, "bug_source_code": "#include \r\nusing namespace std ;\r\n#define ll long long\r\nconst int MAXN=6;\r\nconst int MAXP=15625;\r\nint n,m,a[MAXN+3],b[MAXN+3],c[MAXN+3][MAXN+3];\r\nll dp[MAXN+3][MAXP+5];\r\nint rid[MAXP+5],id[1<<18];\r\nint idnum=0;\r\nvoid dfs(int x,int cur){\r\n\tif(x==n+1){rid[++idnum]=cur;id[cur]=idnum;return;}\r\n\tfor(int i=0;i<=a[x];i++) dfs(x+1,cur+(i<<(3*(x-1))));\r\n}\r\nvoid dfs2(int x,int t,int msk,int lft,ll val){\r\n\tif(!lft||x==n+1){chkmin(dp[t][id[msk]],val);return;}\r\n\tfor(int i=0;i<=min(a[x]-(msk>>(3*(x-1))&7),lft);i++){\r\n\t\tdfs2(x+1,t,msk+(i<<(3*(x-1))),lft-i,val+(i>0)*c[x][t]);\r\n\t}\r\n}\r\nint main(){\r\n\tscanf(\"%d%d\",&n,&m);int sa=0,sb=0;\r\n\tfor(int i=1;i<=n;i++) scanf(\"%d\",&a[i]),sa+=a[i];\r\n\tfor(int i=1;i<=m;i++) scanf(\"%d\",&b[i]),sb+=b[i];\r\n\tif(sa>sb) return puts(\"-1\"),0;\r\n\tfor(int i=1;i<=n;i++) for(int j=1;j<=m;j++) scanf(\"%d\",&c[i][j]);\r\n\tdfs(1,0);memset(dp,63,sizeof(dp));dp[0][id[0]]=0;\r\n\tfor(int i=0;i pos;\r\n\t\tfor(int l=1;l<=idnum;l++){\r\n\t\t\tif(dp[i][l]>=0x3f3f3f3f3f3f3f3fll) continue;\r\n\t\t\tdfs2(1,i+1,rid[l],b[i+1],dp[i][l]);\r\n\t\t}\r\n\t} int lst=0;for(int i=1;i<=n;i++) lst|=(a[i]<<(3*(i-1)));\r\n\tif(dp[m][id[lst]]<0x3f3f3f3f3f3f3f3fll) printf(\"%lld\\n\",dp[m][id[lst]]);\r\n\telse puts(\"-1\");\r\n\treturn 0;\r\n}", "lang": "GNU C++14", "bug_code_uid": "a9c72a229b54ab3b60d982d3f8e8339c", "src_uid": "4dc5dc78bda59c1ec6dd8acd6f1d7333", "apr_id": "23393d2a9d71d3829513cbabdd72543c", "difficulty": 3200, "tags": ["dp", "flows", "dfs and similar", "bitmasks", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9964584674822924, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \r\n#include \r\n#include \r\n#include \r\n#include \r\nusing namespace std;\r\nconst int INF = 1e9;\r\nint n, m;\r\nint chests[10];\r\nint keys[10];\r\nint costs[10][10];\r\nint ans = INF;\r\nstruct state {\r\n vector a;\r\n int i;\r\n int j;\r\n int r;\r\n\r\n bool operator==(const state& other)\r\n {\r\n return i == other.i && j == other.j && a == other.a;\r\n };\r\n};\r\nint convert(state tmp)\r\n{\r\n int res = 0;\r\n for (auto& e : tmp.a) {\r\n assert(e < 7);\r\n res = res * 7 + e;\r\n }\r\n assert(tmp.r < 7);\r\n res = res * 7 + tmp.j;\r\n assert(tmp.i < 7);\r\n res = res * 7 + tmp.r;\r\n assert(tmp.j < 7);\r\n res = res * 7 + tmp.i;\r\n return res;\r\n}\r\nstate convertBack(int index)\r\n{\r\n state res;\r\n res.i = index % 7;\r\n index /= 7;\r\n res.r = index % 7;\r\n index /= 7;\r\n res.j = index % 7;\r\n index /= 7;\r\n for (int i = 0; i < n; ++i) {\r\n res.a.push_back(index % 7);\r\n index /= 7;\r\n }\r\n std::reverse(res.a.begin(), res.a.end());\r\n return res;\r\n}\r\nint dp[40353607] = { 0 };\r\nint main()\r\n{\r\n cin >> n >> m;\r\n for (int i = 0; i < n; ++i) {\r\n cin >> chests[i];\r\n }\r\n for (int i = 0; i < m; ++i) {\r\n cin >> keys[i];\r\n }\r\n for (int i = 0; i < n; ++i) {\r\n for (int j = 0; j < m; ++j) {\r\n cin >> costs[i][j];\r\n }\r\n }\r\n memset(dp, 0xff, sizeof(dp));\r\n dp[0] = 0;\r\n for (int i = 0; i < 40353607; ++i) {\r\n if (dp[i] < 0)\r\n continue;\r\n state curState = convertBack(i);\r\n if (curState.j == m) {\r\n continue;\r\n }\r\n /*\r\n cout << \"fuck \";\r\n for (auto cur : curState.a)\r\n cout << cur << ' ';\r\n cout << endl;\r\n cout << curState.i << ' ' << curState.j << ' ' << curState.r << endl;\r\n */\r\n for (int flow = 0; flow < 5; ++flow) {\r\n auto nextState = curState;\r\n if (flow + curState.a[curState.i] > chests[curState.i] || flow + curState.r > keys[curState.j]) {\r\n continue;\r\n }\r\n int added = flow == 0 ? 0 : costs[curState.i][curState.j];\r\n nextState.r = flow + curState.r;\r\n nextState.a[curState.i] += flow;\r\n nextState.i++;\r\n if (nextState.i == n) {\r\n nextState.i = 0;\r\n nextState.j++;\r\n nextState.r = 0;\r\n }\r\n auto index = convert(nextState);\r\n dp[index] = (dp[index] == -1 || dp[index] > dp[i] + added) ? dp[i] + added : dp[index];\r\n auto isFinal = [&](state s) -> bool {\r\n for (int i = 0; i < s.a.size(); ++i) {\r\n if (s.a[i] != chests[i]) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n if (isFinal(nextState)) {\r\n ans = min(ans, dp[index]);\r\n }\r\n }\r\n }\r\n if (ans == INF)\r\n cout << -1 << endl;\r\n else\r\n cout << ans << endl;\r\n return 0;\r\n}\r\n", "lang": "GNU C++17", "bug_code_uid": "1aa5f90e2ad31f3cb0bd615114ab121e", "src_uid": "4dc5dc78bda59c1ec6dd8acd6f1d7333", "apr_id": "debf5f938ade8ca2cb09d755b586c2ef", "difficulty": 3200, "tags": ["dp", "flows", "dfs and similar", "bitmasks", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9997183891861448, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include\r\nusing namespace std;\r\n#define int long long;\r\ntypedef long long ll;\r\nconst int N=55;\r\nll first1;\r\nint n,cnt,ed;\r\nchar ss[N];\r\nint s[N];\r\nunordered_map ha;\r\nvoid work(int a[],int lmt)\r\n{\r\n int deg=0;\r\n for(int i=lmt;i>=0;i--)\r\n if(a[i]){deg=i; break;}\r\n if(deg=1;j--) z[j]=z[j-1];\r\n z[0]=0;\r\n work(z,ed);\r\n if(i!=B) ha[h(z)]=i;\r\n }\r\n for(int k=1;k<=B;k++)\r\n {\r\n memset(c,0,sizeof c);\r\n for(int i=0;i<=ed;i++)\r\n {\r\n if(!z[i]) continue;\r\n for(int j=0;j<=ed;j++) \r\n c[i+j]=c[i+j]^(z[i]*b[j]);\r\n }\r\n memcpy(b,c,sizeof c);\r\n work(b,ed<<1);\r\n int t=h(b);\r\n if(ha.count(t)) return k*B-ha[t];\r\n }\r\n return -1;\r\n}\r\nsigned main()\r\n{\r\n scanf(\"%s\",ss+1);\r\n int n=strlen(ss+1);\r\n for(int i=1;i<=n;i++)\r\n {\r\n if(!(ss[i]-'0')) continue;\r\n cnt++;\r\n if(!first1) first1=i;\r\n }\r\n if(!cnt) {puts(\"-1\"); return 0;}\r\n else if(cnt==1) {printf(\"%lld %lld\\n\",first1,first1+1); return 0;}\r\n for(int i=first1;i<=n;i++)\r\n if(ss[i]-'0')\r\n s[i-first1]=1,ed=max(ed,(int)(i-first1));\r\n ll res=BSGS();\r\n if(res==-1) puts(\"-1\");\r\n else printf(\"%lld %lld\\n\",first1,first1+res);\r\n return 0;\r\n}", "lang": "GNU C++14", "bug_code_uid": "12eafef9c2c60e007718184d60ae36f3", "src_uid": "6bf798edef30db7d0ce2130e40084e6b", "apr_id": "f1d6519d9f528db37903a157c2be5b63", "difficulty": 2900, "tags": ["meet-in-the-middle", "matrices", "number theory", "bitmasks", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.7822141560798548, "equal_cnt": 12, "replace_cnt": 6, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 12, "bug_source_code": "//#define fi first\r\n//#define sc second\r\n//#define mp(x,y) make_pair(x,y)\r\n//#define pa pair\r\n#include\r\n#define ll long long\r\n#define LL __int128\r\n#define in(x) x=read()\r\nusing namespace std;\r\nll hi;\r\ninline LL read()\r\n{\r\n LL x=0,f=1;\r\n char ch=getchar();\r\n while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}\r\n while(ch>='0'&&ch<='9')\r\n\t{\r\n\t\tx=(x<<1)+(ch^48);\r\n\t\tif(x == 0 && ch == '0')hi++;\r\n\t\tch=getchar();\r\n\t}\r\n return x*f;\r\n}\r\nll www,M;\r\nll mod(ll x)\r\n{\r\n\tif(x & (1ll< x)return ans;\r\n\t\tif((1ll<mp;\r\nint main()\r\n{\r\n\tin(M);\r\n\twhile(M%2==0)M/=2;\r\n\twww=__lg(M);\r\n\tif(M == 0)\r\n\t{\r\n\t\tputs(\"-1\");\r\n\t\treturn 0;\r\n\t}\r\n\tprintf(\"%lld \",hi+1);\r\n\tmp[1]=1;\r\n\tll nw = 1;\r\n\tfor(int s=2;s<262144;s++)\r\n\t{\r\n\t\tnw = mod(nw<<1);\r\n\t\tmp[nw] = s;\r\n//\t\tif(s == 33911 || s==33769)\r\n//\t\tcout<\"<\"<\r\n#include\r\n#define ll long long\r\n#define pb push_back\r\n#define fr(a,b) for(int i = a; i < b; i++)\r\n#define rep(i,a,b) for(int i = a; i < b; i++)\r\n#define mod 1000000007\r\n#define INF 1000000000000000007\r\n#define inf (1LL<<60)\r\n#define all(x) (x).begin(), (x).end()\r\n#define prDouble(x) cout << fixed << setprecision(10) << x\r\n#define triplet pair>\r\n#define goog(tno) cout << \"Case #\" << tno <<\": \"\r\n#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)\r\n#define read(x) int x; cin >> x\r\n#define pii pair\r\n#define piii pair\r\n#define ff first\r\n#define ss second\r\n#define int long long\r\n#define ull unsigned long long\r\n#define p4i pair\r\n#ifndef ONLINE_JUDGE\r\n#define debug(x) cerr << #x <<\" \"; _print(x); cerr << endl;\r\n#else\r\n#define debug(x)\r\n#endif\r\nusing namespace std;\r\nmap>>, int> dp;\r\n\r\nint f(int idx, int lead, char x, int modulo, string s) {\r\n\r\n\tif (idx == s.size()) {\r\n\t\tif (modulo == 0) return 1;\r\n\t\telse return 0;\r\n\t}\r\n\tint ans = 0;\r\n\tif (dp.find({idx, {lead, {x, modulo}}}) != dp.end()) return dp[ {idx, {lead, {x, modulo}}}];;\r\n\t//if (dp[idx][lead][x - '0'][modulo] != -1) return dp[idx][lead][x - '0'][modulo];\r\n\tif (lead == 1 && s[idx] == '0') return 0;\r\n\tif (s[idx] >= '0' && s[idx] <= '9') {\r\n\t\tint modulo2 = (modulo * 10 + (s[idx] - '0')) % 25;\r\n\t\tans += f(idx + 1, 0, x, modulo2, s);\r\n\t}\r\n\telse if (s[idx] == '_') {\r\n\t\tif (!lead)ans += f(idx + 1, 0, x, (modulo * 10) % 25, s);\r\n\r\n\t\tfor (int i = 1; i < 10; i++) {\r\n\t\t\tans += f(idx + 1, 0, x, (modulo * 10 + i) % 25, s);\r\n\t\t}\r\n\r\n\r\n\t}\r\n\telse {\r\n\t\tif (x == '#') {\r\n\t\t\tif (!lead)ans += f(idx + 1, 0, '0', (modulo * 10) % 25, s);\r\n\r\n\t\t\tfor (int i = 1; i < 10; i++) {\r\n\t\t\t\tans += f(idx + 1, 0, i + '0', (modulo * 10 + i) % 25, s);\r\n\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\tans += f(idx + 1, 0, x, (modulo * 10 + (x - '0')) % 25, s);\r\n\t\t}\r\n\r\n\t}\r\n\tdp[ {idx, {lead, {x, modulo}}}] = ans;\r\n\treturn ans;\r\n\r\n}\r\n\r\nvoid solve(int testcase)\r\n{\r\n\tdp.clear();\r\n\tstring s;\r\n\tcin >> s;\r\n\tif (s == \"0\" || s == '_' || s == 'X' ) {\r\n\t\tcout << 1;\r\n\t\treturn;\r\n\t}\r\n\tint ans = f(0, 1, '#', 0, s);\r\n\tcout << ans;\r\n\r\n}\r\n\r\nsigned main()\r\n{\r\n\r\n\t\r\n\r\n\tint test = 1;\r\n\r\n\r\n\tfor (int init = 1 ; init <= test ; init++)\r\n\t{\r\n\t\tsolve(init);\r\n\t}\r\n\r\n}", "lang": "GNU C++14", "bug_code_uid": "a1d7defa84ddce43a9296415be079558", "src_uid": "4a905f419550a6c839992b40f1617af3", "apr_id": "87705bcbc996bf20ce7a24c962baafe1", "difficulty": 1800, "tags": ["dfs and similar", "dp", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9914495523589176, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#define Epsilon 0.00000000001f\n#define ll long long int\n#define ld long double\n#define forn(i, n) for (int i = 0; i < int(n); i++)\n#define forn1(i, n) for (int i = 1; i <= int(n); i++)\n#define forn_reverse(i, n) for (int i = (int)n-1; i >= 0; i--)\nusing namespace std;\n\nvoid printv(vector& v){\n for(int j = 0;j< v.size();j++){\n cout << v[j] << \" \";\n }\n cout << endl;\n}\n\nint tenthPower(int n){\n if(n == 0) return 0;\n int ans = 1;\n while(n--){\n ans *= 10;\n }\n return ans;\n}\nstring s;\nint n;\nchar a,b;\n\nint count_(int r){\n int num = 0;\n for(int i = 1;i <= r;i++){\n char c = s[i];\n if(c == '_'){\n num++;\n }\n }\n if(r < 0){\n return 1;\n }\n int ans = tenthPower(num);\n if(s[0] == '_'){\n if(ans == 0) ans += 9;\n else ans *= 9;\n }\n if(ans > 0) return ans;\n else return 1;\n}\nint countx(int r){\n if(s[0] == 'x'){\n return 9;\n }\n for(int i = 1;i <= r;i++){\n if(s[i] == 'x'){\n return 10;\n }\n }\n return 1;\n}\n\nvoid caseXX(){\n if(n == 2){\n cout << 0 <> s;\n if(s.size() == 1){\n if(s[0] == '0' || s[0] == 'X' || s[0] == '_'){\n cout << 1 << endl;\n return;\n }else{\n cout << 0 << endl;\n return;\n }\n }\n if(s[0] == '0') {\n cout << 0 << endl;\n return;\n }\n n = (int)s.size();\n a = s[n-2];\n b = s[n-1];\n //XX\n if(a=='X' && b=='X'){\n caseXX();\n }\n //__\n if(a == '_' && b == '_'){\n case__();\n }\n //X_\n if(a == 'X' && b == '_'){\n caseX_();\n }\n //_X\n if(a == '_' && b == 'X'){\n case_X();\n }\n //X5\n if(a == 'X' && b!= 'X' && b!= '_'){\n caseX5();\n }\n //5X\n if(a != 'X' && a!= '_' && b == 'X'){\n case5X();\n }\n //_5\n if(a == '_' && b!= 'X' && b!= '_'){\n case_5();\n }\n //5_\n if(a != 'X' && a!= '_' && b == '_'){\n case5_();\n }\n //55\n if(a != 'X' && a!= '_' && b!= 'X' && b!= '_'){\n case55();\n }\n \n}\n\nint main() {\n cerr << \"coding...\\n\";\n ios_base::sync_with_stdio(false);\n cin.tie(NULL);\n solve();\n}\n", "lang": "GNU C++17", "bug_code_uid": "efd92253adaae13703d439db74d2ccc6", "src_uid": "4a905f419550a6c839992b40f1617af3", "apr_id": "f3bc0335f558072e3011ebddf8d69a06", "difficulty": 1800, "tags": ["dfs and similar", "dp", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9727947238252267, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \r\n#define ll long long\r\n#define fi first\r\n#define se second\r\n#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);\r\nconst ll MOD=1e9+7;\r\nusing namespace std;\r\nll N,M,K,R,C;\r\nll a,b,c,d;\r\nvector > vec;\r\nll pangkat(ll x,ll y){\r\n\tif(y==0){\r\n\t\treturn 1;\r\n\t}\r\n\tif(y==1){\r\n\t\treturn x;\r\n\t}\r\n\tll z=pangkat(x,y/2);\r\n\tif(y%2==0){\r\n\t\treturn (z*z)%MOD;\r\n\t}\r\n\telse{\r\n\t\treturn ((z*z)%MOD*x)%MOD;\r\n\t}\r\n}\r\nint main(){\r\n\tcin>>N>>M>>K>>R>>C;\r\n\tcin>>a>>b>>c>>d;\r\n\tll x=2*R-abs(max(a+R-1,c+R-1)-min(a,c)+1);\r\n\tll y=2*C-abs(max(b+C-1,d+C-1)-min(b,d)+1);\r\n\tif(x<=0||y<=0){\r\n\t\tcout<0&&tempy>0){\r\n\t\t\tvec.push_back({tempx,tempy});\r\n\t\t\ttempx-=offx;\r\n\t\t\ttempy-=offy;\r\n\t\t}\r\n\t\tll exp=N*M-2*vec[0].fi*vec[0].se+vec[1].fi*vec[1].se;\r\n\t\tfor(int i=0;i\r\n#include\r\n#include\r\n#define ll long long\r\nusing namespace std;\r\nconst ll MOD=1e9+7;\r\nll xx,yy,x,y,rr,cc,n,m,k,c,r,xa,ya,xb,yb,p,ans;\r\nll posw(ll x){\r\n\tll tt=1,t=k;\r\n\twhile(x){\r\n\t\tif(x&1)tt=tt*t%MOD;\r\n\t\tx>>=1;\r\n\t\tt=t*t%MOD;\r\n\t//\tcout<=xb&&ya>=yb){\r\n\tswap(xa,xb);swap(ya,yb);\t\r\n\t}\r\n\tif(xa==xb&&ya==yb){\r\n\t\tcout<xa+r-1||yb>ya+c-1){\r\n\t\tans=posw(n*m-r*c);\r\n\t}\r\n\telse{\r\n\t\txx=abs(xa-xb);yy=abs(ya-yb);\r\n\t\tx=sz(r,xx)-1;y=sz(c,yy)-1;\r\n\t\tp=min(x,y);\r\n\t\trr=r-p*xx;cc=c-p*yy;\r\n\t\tans=2*(p-1)*xx*yy-rr*cc+(r-(p-1)*xx)*(c-(p-1)*yy);\r\n\t//\tcout<\n#define int long long\n#define ld long double\n#define vc vector\n#define s second\n#define f first\n\n\n#include \"prettyprint.hpp\"\n\nusing namespace std;\n\n\ntypedef pair pii;\nint n, m;\nint t(int a){\n return a+n;\n}\nint mod=998244353;\nvc< vc > anz, suf, pref;\n\nbool g (int a, int b){\n if (a<0 || b<0) return false;\n if (a >n || b >=m) return false;\n return true;\n}\n\nint h (int a, int b){\n if (a<0 || a>n) return 1;\n return 0;\n}\n\nint an(int a ,int b){\n return g(a, b)? anz[a][b] : h(a, b);\n}\n\nint su(int a ,int b){\n return g(a, b)? suf[a][b] : h(a, b);\n}\n\nint pre(int a ,int b){\n return g(a, b)? pref[a][b] : h(a, b);\n}\nint plu (int & a, int b){\n return a =(a+b)%mod;\n}\n\nint mult (int a, int b){\n return a*b % mod;\n}\n\nint calc_inst(int i, int j){\n int s1 = mult(mult(an(i, j), an(n-i+1, j-1)), su(n-i, m-j));\n\n int s2 = mult(mult(an(i, j), an(i+1, m-j-1)), pre(i, m-j+1));\n\n return plu(s1, s2);\n\n}\nint do_calc(){\n anz = suf = pref = vc > (n+1, vc (m+1));\n\n vc > b (n+1, vc (m)), c (n+1, vc (m));\n\n anz[0][0] = 1;\n\n\n for (int i=1; i<=n; i++){\n anz[i][0] = anz[i-1][0];\n for (int j=1; j=2; k--){\n c[i][k] = anz[n-i][k]*anz[n-i+1][m-k-1]%mod;\n pref[i][k]=(pref[i][k+1]+c[i][k])%mod;\n }\n\n }\n\n\n\n int ret = 0;\n for (int i=1; i<=n; i++){\n for (int j=1; j> n >> m;\n int res= do_calc();\n //a1 = very_balanced();\n // cout << res << \"\\n\";\n //swap(n, m);\n // a2 = very_balanced();\n // res1=do_calc();\n //assert(a1 == a2);\n//a1 = (n-1)*(m-1);\n\n res = 2*res%mod;\n\n // cout << \"res1 \" << res1 << \" \" << res2 << \" a \" << a1 << \" \" << a2 << \" \" << endl;\n\n cout << res << \"\\n\";\n\n //cout << a << endl;\n\n}\nsigned main(){\n ios_base::sync_with_stdio(false);\n\n\n do_test();\n}\n", "lang": "GNU C++17", "bug_code_uid": "c73e385be73dedac30b9324342e8438e", "src_uid": "1738dc65af1fffa445cb0c3074c6bedb", "apr_id": "26b9166181d01d9e487b8aac6aa8d5de", "difficulty": 3100, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.996386164171399, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include\r\nusing namespace std;\r\ntypedef long long ll;\r\n#define fi first\r\n#define se second\r\nconst ll mod=998244353;\r\nconst ll N=5001;\r\nint z;\r\nint c[N][N];\r\nint w[N/2][N/2];\r\nint pw[N/2][N/2];\r\nll ans=0;\r\nvoid solve(int n,int m,int k){//blue disconnected\r\n\tfor(int i=1; i<=n ;i++){\r\n\t\tfor(int j=1; j<=m ;j++){\r\n\t\t\tll r=c[i-1+m-j][m-j];\r\n\t\t\tll l=c[i+j-1][j-1];\r\n\t\t\tw[i][j]=l*r%mod;\r\n\t\t\tpw[i][j]=(pw[i][j-1]+w[i][j])%mod;\r\n\t\t\t//cout << w[i][j] << ' ';\r\n\t\t}\r\n\t//\tcout << endl;\r\n\t}\r\n\tfor(int i=1; i> n >> m;z=n+m;\r\n\tc[0][0]=1;\r\n\tfor(int i=1; i<=z ;i++){\r\n\t\tc[i][0]=1;\r\n\t\tfor(int j=1; j<=i ;j++){\r\n\t\t\tc[i][j]=(c[i-1][j-1]+c[i-1][j])%mod;\r\n\t\t}\r\n\t}\r\n\tsolve(n,m,1);\r\n\tsolve(m,n,0);\r\n\tans=ans*2%mod;\r\n\tcout << ans << '\\n';\r\n}\r\n", "lang": "GNU C++17", "bug_code_uid": "8ae10a2c1300079e84e091857dfd0cc6", "src_uid": "1738dc65af1fffa445cb0c3074c6bedb", "apr_id": "d935d7e3550eddc3e70778bb057b5617", "difficulty": 3100, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9865361077111383, "equal_cnt": 19, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 12, "fix_ops_cnt": 18, "bug_source_code": "#include \r\n#define rep(i, a, b) for (int i = (a); i <= int(b); i++)\r\n#define per(i, a, b) for (int i = (a); i >= int(b); i++)\r\n#define fi first\r\n#define se second\r\n#define pb push_back\r\n#define eb emplace_back\r\n#define il inline\r\n#define ct template\r\n#define clr(a, n) memset((a), 0, sizeof((a[0]) * n))\r\n#define cpy(a, b, n ) memcpy((b), (a), sizeof((a[0]) * ()n))\r\n\r\nusing namespace std;\r\ntypedef long long ll;\r\ntypedef double db;\r\ntypedef pair pii;\r\nct il void cmax(type &x, type y) { x < y ? x = y:0; }\r\nct il void cmin(type &x, type y) { x > y ? x = y:0; }\r\n\r\nconst int maxn = 55; maxl == 2005; mod = 998244353;\r\nil int& red(int &x) { return x += x >> 31 & mod; }\r\n \r\nil int qpow(int a, int b) {\r\n\tint c = 1;\r\n\tfor (; b; b >>= 1, a = ll(a) * a % mod) if (b & 1) c = ll(a) * c % mod;\r\n\treturn c;\r\n}\r\n \r\nil int sx(int s, int x) {\r\n\treturn s & 1 ? red(x = -x) : x;\r\n}\r\n \r\nint n, K, L, l[maxn], f[maxn][maxl], g[maxn][maxl], fac[maxl], fic[maxl];\r\n \r\nvoid prework(int n) {\r\n\tfac[0] = 1;\r\n\trep(i, 1, n) fac[i] = ll(i) * fac[i - 1] % mod;\r\n\tfic[n] = qpow(fac[n], mod - 2);\r\n\tper(i, n, 1) fic[i - 1] = ll(i) * fic[i] % mod;\r\n}\r\n \r\nint main() {\r\n\tprework(2e3);\r\n\tscanf(\"%d %d\", &n, &K);\r\n\trep(i, 1, n) {\r\n\t\tscanf(\"%d\", &l[i]), L += l[i];\r\n\t}\r\n\tint iL = qpow(L, mod - 2);\r\n\tf[0][0] = 1;\r\n\tint mx = 0;\r\n\trep(i, 1, n) {\r\n\t\trep(j, 0, i - 1) rep(k, 0, mx) {\r\n\t\t\tg[j][k] = f[j][k];\r\n\t\t}\r\n\t\trep(u, 1, l[i] / K) {\r\n\t\t\tint x = ll(l[i] - u * K) * iL % mod, y = qpow(x, u);\r\n\t\t\tint p = ll(y) * sx(u, fic[u]) % mod, q = ll(p) * u % mod * qpow(x, mod - 2) % mod;\r\n\t\t\trep(j, 0, i - 1) rep(k, 0, mx) {\r\n\t\t\t\tred(g[j][k + u] += ll(p) * f[j][k] % mod - mod);\r\n\t\t\t\tred(g[j + 1][k + u] += ll(q) * f[j][k] % mod - mod);\r\n\t\t\t}\r\n\t\t}\r\n\t\tmx += l[i] / K;\r\n\t\trep(j, 0, i) rep(k, 0, mx) {\r\n\t\t\tf[j][k] = g[j][k];\r\n\t\t}\r\n\t}\r\n\tint ans = 0;\r\n\trep(j, 0, n) rep(k, 1, mx) if (k - j >= 0) {\r\n\t\tred(ans -= ll(f[j][k]) * fac[k - j] % mod * qpow(ll(k * K) * iL % mod, mod - 2 - (k - j)) % mod);\r\n\t}\r\n\tprintf(\"%d\\n\", ans);\r\n\treturn 0;\r\n}\r\n", "lang": "GNU C++17", "bug_code_uid": "65677a31fff1060ebce9dd97dc2bb5fe", "src_uid": "26d565c193a5920b042c783109496b4c", "apr_id": "1ebca1f565bc2a61a163ed6df04b68ce", "difficulty": 3500, "tags": ["fft", "math", "combinatorics", "probabilities"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9942954934398175, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#include\r\nusing namespace std;\r\nconst long long N=2200,mod=998244353;\r\n\r\nlong long ksm(long long a,long long x){\r\n long long tot=1;\r\n while(x){\r\n if(x & 1ll) tot=1ll*tot*a%mod;\r\n a=1ll*a*a%mod;\r\n x>>=1ll;\r\n }\r\n return tot;\r\n}\r\n\r\nlong long mul[N],inv[N];\r\nvoid init(long long lim){\r\n mul[0]=inv[0]=1;\r\n for(long long i=1;i<=lim;i++) mul[i]=1ll*mul[i-1]*i%mod;\r\n inv[lim]=ksm(mul[lim],mod-2);\r\n for(long long i=lim-1;i>=1;i--) inv[i]=1ll*inv[i+1]*(i+1)%mod;\r\n}\r\nlong long ID(long long x){\r\n\tif(x & 1ll) return mod-1;\r\n\treturn 1;\r\n}\r\n\r\nlong long n,k,ans;\r\nlong long a[N],S;\r\nlong long F[2][N][N],id;\r\n\r\nint main(){\r\n\tinit(N-5);\r\n cin>>n>>k;\r\n for(long long i=1;i<=n;i++) cin>>a[i],S+=a[i];\r\n F[0][0][0]=1;\r\n\tfor(long long i=1;i<=n;i++){\r\n\t\tid^=1;\r\n\t\tmemset(F[id],0,sizeof(F[id]));\r\n\t\tlong long m=a[i];\r\n\t\tif(m==k) m--;\r\n\t\tfor(long long t=0;t<=m/k;t++){\r\n\t\t\tlong long val1=0,val2=0;\r\n\t\t\tval1=ID(t)*inv[t]%mod*ksm((m-t*k)*ksm(S,mod-2)%mod,t)%mod;\r\n\t\t\tif(t) val2=ID(t)*inv[t-1]%mod*ksm((m-t*k)*ksm(S,mod-2)%mod,t-1)%mod;\r\n\t\t\t\r\n\t\t\tfor(long long p=0;p<=S;p++)\r\n\t\t\t\tfor(long long q=0;q<=n;q++){\r\n\t\t\t\t\tif(p+t<=S) F[id][p+t][q]=(F[id][p+t][q]+F[id^1][p][q]*val1%mod)%mod;\r\n\t\t\t\t\tif(t && p+t-1<=S && q+1<=n) F[id][p+t-1][q+1]=(F[id][p+t-1][q+1]+F[id^1][p][q]*val2%mod)%mod;\r\n\t\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n//\t\tcout<\r\nusing namespace std;\r\nll fastp(ll a, ll b){\r\nll res=1;\r\nwhile(b){\r\n if(b%2) res*=a;\r\n a*=a;\r\n b/=2;\r\n}\r\nreturn res;\r\n}\r\nint main(){\r\nint t; cin>>t; while(t--){\r\nunsigned ll n;\r\ncin>>n;\r\n cout<\r\nusing namespace std; \r\n\r\nint main() {\r\n \r\n \r\n int t;\r\n cin >> t;\r\n while(t--){\r\n \tint n;\r\n \tcin >> n;\r\n int ans = pow(2,n)-1;\r\n cout << ans << \"\\n\"\r\n }\r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n}", "lang": "GNU C++14", "bug_code_uid": "11a59048c66fc3df12bac8e0e91c8655", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "b4de26c95bec992a1ae1450b5f3fd01b", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9945945945945946, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \r\nusing namespace std;\r\n#define rep(i,a,b) for(int i=a;i<=b;i++)\r\n#define per(i,a,b) for(int i=a;i>=b;i--)\r\n#define debug(x) cout<<#x<<\" = \"< VI;\r\ntypedef pair PII;\r\nconst int mod=1e9+7;\r\n\r\nconst int N=1e6+10;\r\n\r\nint n;\r\nint primes[N], cnt;\r\nint phi[N];\r\nbool st[N];\r\n\r\nvoid get(int n){5\r\n 5\r\n phi[1]=1;\r\n rep(i,2,n){\r\n if(!st[i]){\r\n primes[cnt++]=i;\r\n phi[i]=i-1;\r\n }\r\n for(int j=0;primes[j]<=n/i;j++){\r\n st[primes[j]*i]=1;\r\n if(i%primes[j]==0){\r\n phi[primes[j]*i]=primes[j]*phi[i];\r\n break;\r\n }\r\n phi[primes[j]*i]=(primes[j]-1)*phi[i];\r\n }\r\n }\r\n}\r\n\r\n\r\nint lcm(int x,int y){\r\n return x*y/__gcd(x,y);\r\n}\r\n\r\nvoid solve(){\r\n cin>>n;\r\n get(n);\r\n int ans=0;\r\n rep(i,1,n){ //gcd(a,b)\r\n for(int j=2*i;j>_;while(_--)\r\n solve();\r\n}", "lang": "GNU C++17", "bug_code_uid": "95b5343e5fba2d3ad11b08751ea323e2", "src_uid": "c3694a6ff95c64bef8cbe8834c3fd6cb", "apr_id": "b2faf0d97994848860a0304a76b4d604", "difficulty": 2200, "tags": ["math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9957805907172996, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include \r\n#define ll long long\r\n#define pii pair\r\n#define st first\r\n#define nd second\r\n#define file \"test\"\r\nusing namespace std;\r\nconst long long INF = 1e18;\r\nconst long long N = 2e5 + 5;\r\nconst long long MOD = 1e9 + 7;\r\nll cnt[N];\r\nll n;\r\n\r\nint main()\r\n{\r\n ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);\r\n #ifndef ONLINE_JUDGE\r\n freopen(file\".inp\", \"r\", stdin); freopen(file\".out\", \"w\", stdout);\r\n #endif\r\n \r\n cin >> n;\r\n\r\n for (int i = 1; i <= n; i ++) \r\n cnt[i] = i - 1;\r\n for (int j = 2; j * j <= i; j ++) if (i % j == 0) {\r\n cnt[i] -= cnt[j];\r\n if (j * j != i) cnt[i] -= cnt[i / j];\r\n }\r\n\r\n ll ans = 0;\r\n for (int g = 1; g <= n; g ++)\r\n for (int x = g; x <= n; x += g)\r\n ans = (ans + (1ll * (n - x) * (g / __gcd(1ll * g, n - x)) % MOD * cnt[x / g])) % MOD;\r\n\r\n cout << ans % MOD << '\\n';\r\n\r\n return 0;\r\n} ", "lang": "GNU C++14", "bug_code_uid": "5f7539a0eca705e7d17bc08515745b6c", "src_uid": "c3694a6ff95c64bef8cbe8834c3fd6cb", "apr_id": "3271b6df7fe0655c2f4e22ee6110f4c0", "difficulty": 2200, "tags": ["math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.40694081293082957, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": " #include\r\nusing namespace std;\r\n#define ll long long\r\n#define pii pair\r\n#define pb push_back\r\n#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);\r\n \r\nll int gcd(ll int a,ll int b){if(!b)return a; return gcd(b, a % b);}\r\nll int lcm(ll int a,ll int b){ return (a*b)/gcd(a,b);}\r\nstring inc(string &s){ ll x = stoll(s); x++; return s = to_string(x);}\r\n\r\ntemplate T pow(T a,T b, long long m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m;} return ans%m; }\r\n\r\n\r\nint main(){\r\n IOS;\r\nll int tt=1;\r\n //cin>>tt;\r\nfor(ll int ii=1;ii<=tt;ii++){\r\n ll int n,m,k,ans=0,mod=1000000007;\r\n cin>>n>>k;\r\n m=pow(2ll,n,mod);\r\n \r\n if(k==1) cout<\nconst int MAXN = 1e5 + 5, P = 1e9 + 7;\n#define int long long\nusing namespace std;\nint n, k;\nLL fact[MAXN], inv[MAXN];\nLL ksm(LL a, LL b = P - 2, LL p = P)\n{\n\tLL s = 1 % p;\n\tfor (; b; b >>= 1, a = a * a % p)\n\t\tif (b & 1) s = s * a % p;\n\treturn s;\n}\nsigned main()\n{\n\tcin>>n>>k; \n\tk = min(n, k),fact[0] = 1; \n\tfor (int i = 1; i <= n; ++i) \n\t fact[i] = i * fact[i - 1] % P;\n\tfor (int i = 0; i <= n; ++i) inv[i] = ksm(fact[i]);\n\tLL ans = 0;\n\tfor (int i = 0; i <= k; ++i) \n\t ans = (ans + fact[n] * inv[i] % P * inv[n - i] % P) % P;\n\tprintf(\"%lld\\n\", ans); \n\treturn 0;\n}", "lang": "GNU C++14", "bug_code_uid": "59bd6dd585c3e6966eaf909bc164c0b4", "src_uid": "dc7b887afcc2e95c4e90619ceda63071", "apr_id": "5f922e8410370847c6104941737b1479", "difficulty": 1900, "tags": ["math", "combinatorics", "greedy", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.526829268292683, "equal_cnt": 11, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "#include\r\n\r\nusing namespace std;\r\n\r\ntypedef long long int ll;\r\n\r\nconst ll MOD=998244353;\r\nconst ll MAXN=1000003;\r\n\r\nll div[MAXN];\r\n\r\nll cant_divi(ll n){\r\n\tif(div[n]!=0) return div[n];\r\n\tll i;\r\n\tll cont=0;\r\n\tfor(i=1;i*i>n;\r\n\tll dp[MAXN];\r\n\tdiv[1]=1;\r\n\tdp[1]=1;\r\n\tdp[2]=3;\r\n\tfor(ll i=3;i\r\nusing namespace std;\r\n#define int long long\r\n#define ll long long\r\n#define FOR(ind,end) for(ind = 0; ind < end; ind++)\r\n#define FOR1(ind,begin,end) for(ind=begin; ind=0; ind--)\r\n#define EACH(ptr,cont) for(auto ptr: cont)\r\nint i,j,k;\r\nconst int mx = 200000;\r\nconst int inf = 5e18;\r\n//useful for input processing\r\ntemplatevoid setzero(T *begin, T *end){for(auto x=begin;xvoid setval(T *begin, T *end, int val){for(auto x=begin;xvoid read(T *begin, T *end){for(auto x=begin;x>*x;}\r\ntemplatevoid print(T *begin, T *end){for(auto x=begin;xvoid print(vectorv){for(auto x:v)cout<bool cmp_pair_first(pair a, pair b){return a.first < b.first;}\r\ntemplatebool cmp_vec_first(vector a, vector b){return a[0]void sort_by_first(pair *begin,pair *end){sort(begin,end,cmp_pair_first);}\r\ntemplatevoid sort_by_first(vector *begin, vector *end){sort(begin,end,cmp_vec_first);}\r\n \r\ntemplateint sum(int begin,int end,T f){int ans=0;for(int ind=begin;ind<=end;ind++)ans+=f(ind);return ans;}\r\ntemplateint argmin(int begin,int end,T f){int ans=begin;for(int ind=begin+1;ind<=end;ind++)if(f(ind)int argmax(int begin,int end,T f){int ans=begin;for(int ind=begin+1;ind<=end;ind++)if(f(ind)>f(ans))ans=ind;return ans;}\r\ntemplateint min(int begin,int end,T f){return f(argmin(begin,end,f));}\r\ntemplateint max(int begin,int end,T f){return f(argmax(begin,end,f));}\r\n \r\n \r\n//-----------------------------------//\r\n// Number Theory Template //\r\n//-----------------------------------//\r\n \r\nint mod = 998244353; //CHANGE ACCORDINGLY\r\ndouble invmod = 1.0/mod;\r\n \r\ntemplate T cdiv(T a, T b){return (a+b-1)/b;}\r\ntemplate T fdiv(T a, T b){return a/b;}\r\ntemplate T pow(T a, int n){T x=(n%2)?a:1;\r\n if(n<=1)return x; else{T y=pow(a,n/2);return y*y*x;}}\r\npair bezout(int a, int b){\r\n if(a=mod) x-=mod; return x}\r\nstruct mint{int v;\r\n mint(int _v){v = m_red(_v);}\r\n mint(int _v,bool lazy){if(!lazy){\r\n if(_v<0) _v+= mod;\r\n if(_v>=mod) _v-=mod;\r\n }v=_v;} //for only quick reduction\r\n mint inv() const{return mint(bezout(v,mod).first);}\r\n friend std::ostream&operator <<(std::ostream&out,const mint&n){int x=n.v;\r\n while(x>=mod) x-=mod; while(x<0) x+= mod; return out<>(std::istream&in,mint&n){int _v;in>>_v;n=mint(_v);return in;}\r\n mint operator -() const {return mint(-v,true);}\r\n friend mint operator +(const mint&a,const mint&b){return mint(a.v+b.v,false);}\r\n friend mint operator +(const mint&a,const int&b){return mint(a.v+m_red(b),false);}\r\n friend mint operator -(const mint&a,const mint&b){return mint(a.v-b.v,false);}\r\n friend mint operator -(const mint&a,const int&b){return mint(a.v-m_red(b),false);}\r\n friend mint operator -(const int&a,const mint&b){return mint(m_red(a)-b.v,false);}\r\n friend mint operator *(const mint&a,const mint&b){return mint(a.v*b.v);}\r\n friend mint operator *(const mint&a,const int&b){return mint(a.v*m_red(b));}\r\n friend mint operator /(const mint&a,const mint&b){return a*b.inv();}\r\n friend mint operator /(const mint&a,const int&b){return a*mint(b).inv();}\r\n friend mint operator /(const int&a,const mint&b){return mint(a)*b.inv();}\r\n};\r\nmint m_pow(mint a, int n){if(n==0) return mint(1);if(n==1) return a;\r\n if(n%2==0){mint x=m_pow(a,n/2);return x*x;}mint x=m_pow(a,n/2); return x*x*a;}\r\n \r\nvector fact; vector prime;\r\nvoid init_fact(int bound){fact.push_back(mint(1));for(int i=1;i> n;\r\n mint inv2 = mint(2,true).inv();\r\n mint inv6 = mint(6,true).inv();\r\n if(n==1) return mint(5,true);\r\n if(n==2) return mint(31,true);\r\n if(n==3) return mint(532,true);\r\n vector bin(n,mint(0,true));\r\n bin[0] = mint(2,true);\r\n FOR1(i,1,n){\r\n bin[i] = bin[i-1]*(bin[i-1]+1)*inv2 + 1;\r\n }\r\n mint ans1 = bin[n-1]*(bin[n-1]+1)*(bin[n-1]+2)*inv6;\r\n mint ans2 = bin[n-2]*(bin[n-2]+1)*(bin[n-2]+2)*inv6;\r\n mint ans = 2*(ans1-ans2)-1;\r\n for(i=2; i<=n-2; i++){ \r\n mint bad = bin[i] - 2*bin[i-1] + bin[i-2];\r\n mint bad1 = bin[n-1-i] - bin[n-2-i]-1;\r\n ans = ans + (bad*bad1);\r\n }\r\n ans = ans+bin[n-2]-bin[n-3]-1;\r\n return ans;\r\n}\r\n \r\nsigned main(){\r\n ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);\r\n long tc=1;\r\n //cin >> tc; //COMMENT HERE IF A PROBLEM HAS ONLY ONE TEST CASE. \r\n while(tc--){\r\n cout << solve();\r\n }\r\n return 0;\r\n}\r\n", "lang": "GNU C++17", "bug_code_uid": "53c398075b479c8a5da8275ab061f548", "src_uid": "92939054045c089cd25c8f4e7b9ffcf2", "apr_id": "8cd73a34a4d15b4493ac05fc9e9cff98", "difficulty": 2900, "tags": ["trees", "dp", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9991816693944353, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \r\n \r\nusing namespace std;\r\nusing ll = long long;\r\nll MOD = 998244353;\r\nll binpow(ll a,ll b){ll res=1;while(b){if(b&1)res=(res*a)%MOD;a=(a*a)%MOD;b>>=1;}return res;}\r\nll modInv(ll a){return binpow(a, MOD-2);}\r\nconst int mxN = 1000001;\r\nll pdp[mxN], dp[mxN], dp2[mxN];\r\nint n;\r\nint main() {\r\n cin>>n;\r\n if(n==1) {\r\n cout<<\"5\\n\";\r\n return;\r\n }\r\n dp[0] = pdp[0] = 1;\r\n for(int i = 1; i <= n; i++) {\r\n if(i > 1) {\r\n dp[i] = (dp[i-1] + dp[i-1] * pdp[i-2] + dp[i-1] * (dp[i-1] + 1)/2)%MOD;\r\n }else {\r\n dp[i] = (dp[i-1] + dp[i-1] * (dp[i-1] + 1)/2)%MOD;\r\n }\r\n dp2[i] = (dp[i] - dp[i-1] + MOD)%MOD;\r\n pdp[i] = (pdp[i-1] + dp[i])%MOD;\r\n }\r\n ll res = dp[n];\r\n res += ((pdp[n-2]*(pdp[n-2]+1)/2)%MOD * dp[n-1])%MOD;\r\n if(res >= MOD)res-=MOD;\r\n res += ((dp[n-1]*(dp[n-1]+1)/2)%MOD * pdp[n-2])%MOD;\r\n if(res >= MOD)res-=MOD;\r\n res += (((dp[n-1]*(dp[n-1]+1))%MOD*(dp[n-1]+2))%MOD*modInv(6))%MOD;\r\n if(res >= MOD)res-=MOD;\r\n res = (2*res-1)%MOD;\r\n for(int i = 0; i < n; i++) {\r\n res += (dp[i]-1)*dp2[n-1-i]%MOD;\r\n if(res >= MOD)res-=MOD;\r\n }\r\n cout<\r\nusing namespace std;\r\ntypedef long long ll;\r\nconst int N = 2e5 + 5, mod = 998244353, G = 3, Gi = 332748118;\r\nint n, m, lim, L, r[N]; ll ans, A[N], B[N], fac[N], inv[N], C[N];\r\ninline ll qpow(ll a, ll b) { ll ans = 1; for (; b; b >>= 1, a = a * a % mod) if (b & 1) ans = ans * a % mod; return ans; }\r\ninline void NTT(ll *A, int type) { \r\n\tfor (int i = 0; i < lim; ++ i) if (i < r[i]) swap(A[i], A[r[i]]);\r\n\tfor (int mid = 1; mid < lim; mid <<= 1) {\r\n\t\tll Wn = qpow(type == 1 ? G : Gi, (mod - 1) / (mid << 1));\r\n\t\tfor (int j = 0; j < lim; j += (mid << 1)) {\r\n\t\t\tll w = 1;\r\n\t\t\tfor (int k = 0; k < mid; ++ k, w = w * Wn % mod) {\r\n\t\t\t\tint x = A[j + k], y = w * A[j + k + mid] % mod;\r\n\t\t\t\tA[j + k] = (x + y) % mod, A[j + k + mid] = (x - y + mod) % mod;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tif (type == 1) return ;\r\n\tll invs = qpow(lim, mod - 2);\r\n\tfor (int i = 0; i < lim; ++ i) A[i] = A[i] * invs % mod;\r\n}\r\nint main() {\r\n\tscanf(\"%d%d\", &n, &m), fac[0] = C[0] = 1;\r\n\tfor (int i = 1; i <= m; ++ i) C[i] = C[i - 1] * qpow(i, mod - 2) % mod * (n - i + 1) % mod;\r\n\tfor (int i = 1; i <= m; ++ i) fac[i] = fac[i - 1] * i % mod;\r\n\tinv[m] = qpow(fac[m], mod - 2);\r\n\tfor (int i = m - 1; ~i; -- i) inv[i] = inv[i + 1] * (i + 1) % mod;\r\n\tfor (int i = 0; i <= m; ++ i) {\r\n\t\tA[i] = i & 1 ? mod - inv[i] : inv[i];\r\n\t\tB[i] = qpow(i, m) * inv[i] % mod;\r\n\t}\r\n\tlim = 1, L = 0; while (lim <= m + m) lim <<= 1, ++ L;\r\n\tfor (int i = 0; i < lim; ++ i) r[i] = (r[i >> 1] >> 1) | ((i & 1) << (L - 1));\r\n\tNTT(A, 1), NTT(B, 1);\r\n\tfor (int i = 0; i < lim; ++ i) A[i] = A[i] * B[i] % mod;\r\n\tNTT(A, -1);\r\n\tcalc_strling();\r\n\tfor (int i = 1; i <= min(n, m); ++ i)\r\n\t\t(ans += A[i] * fac[i] % mod * C[i] % mod * qpow(n + 1, n - i) % mod) %= mod;\r\n\tprintf(\"%lld\\n\", ans);\r\n}", "lang": "GNU C++17", "bug_code_uid": "3a750099927cb42e4d12c1ffcbbb2421", "src_uid": "bc57a69c39c6e74d6d81a9c504104809", "apr_id": "ca1c1827b0651f74db6f82a3e8acb23f", "difficulty": 3300, "tags": ["fft", "math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9271523178807947, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "# include \r\n \r\nusing namespace std;\r\n \r\ntypedef long long ll;\r\nconst int MAXN=3e5+10;\r\nconst int MAXM=18;\r\nconst int mod=998244353;\r\n\r\nll powmod(ll x,ll p)\r\n{\r\n\tll ret=1;\r\n\twhile(p)\r\n\t{\r\n\t\tif(p&1)\r\n\t\t\tret=(ret*x)%mod;\r\n\t\tx=x*x%mod;\r\n\t\tp>>=1;\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\nll n,k,C[MAXN],ans,A[MAXN],B[MAXN],rev[MAXN];\r\nll fact[MAXN],ifact[MAXN];\r\n \r\nvoid NTT(ll *A, bool inv){\r\n\tll n=(1<=0;--i)\r\n\t\tifact[i]=ifact[i+1]*(i+1)%mod;\r\n\tfor(int i=1;i<(1<>1]>>1)|((i&1)<<(MAXM-1));\r\n\tfor(int i=0;i<=k;++i)\r\n\t{\r\n\t\tA[i]=powmod(i,k)*ifact[i]%mod;\r\n\t\tB[i]=ifact[i];\r\n\t\tif(i%2)\r\n\t\t\tB[i]=(mod-B[i])%mod;\r\n\t}\r\n\tNTT(A,0),NTT(B,0);\r\n\tfor(int i=0;i\r\nusing namespace std; \r\nconst long long MOD = 998244353;\r\nconst int N = 6e5 + 10;\r\nint n, k;\r\nlong long ksm(long long x, long long y)\r\n{\r\n\tlong long m = 1;\r\n\tfor (; y; y >>= 1)\r\n\t{\r\n\t\tif(y & 1)\r\n\t\tm = m * x % MOD;\r\n\t\tx = x * x % MOD;\r\n\t}\r\n\treturn m;\r\n}\r\nlong long jc[N], jcny[N];\r\nlong long dp[N], tot[N];\r\nint vis[N], pri[N], num;\r\nlong long C(int x, int y)\r\n{\r\n\treturn jc[x] * jcny[y] % MOD * jcny[x - y] % MOD;\r\n}\r\nstruct STL\r\n{\r\n\tint G=3,invG;\r\n\tlong long ksm(long long b,int n){\r\n\t long long res=1;\r\n\t while(n){\r\n\t if(n&1) res=res*b%MOD;\r\n\t b=b*b%MOD; n>>=1;\r\n\t }\r\n\t return res;\r\n\t}\r\n\tint tr[N];\r\n\tvoid NTT(long long *f,int n,int fl){\r\n\t for(int i=0;i>1);\r\n\t long long w=ksm((fl==0)?G:invG,(MOD-1)/p);\r\n\t for(int st=0;st=0;--i)\r\n\t inv[i]=1ll*(i+1)*inv[i+1]%MOD;\r\n\t}\r\n\tint main(int n){\r\n\t invG=ksm(G,MOD-2);\r\n\t init(n);\r\n\t int limit=1;\r\n\t while(limit<=(n<<1)) limit<<=1;\r\n\t for (int i = 0; i <= limit; ++ i)\r\n\t a[i] = b[i] = 0;\r\n\t for(int i=0;i<=n;++i)\r\n\t a[i]=(i&1?MOD-inv[i]:inv[i]),\r\n\t b[i]=ksm(i,n)*inv[i]%MOD;\r\n\t for(int i=0;i<=limit;++i)\r\n\t tr[i]=(tr[i>>1]>>1)|(i&1?limit>>1:0);\r\n\t NTT(a,limit,0);NTT(b,limit,0);\r\n\t for(int i=0;i<=limit;++i)\r\n\t a[i]=a[i]*b[i]%MOD;\r\n\t NTT(a,limit,1);\r\n\t return 0;\r\n\t}\r\n}S;\r\nint del[N];\r\nint main()\r\n{\r\n\tios::sync_with_stdio(0);\r\n\tcin.tie(0);\r\n\tcin >> n >> k;\r\n\tjc[0] = 1;\r\n\t\r\n\tS.main(n);\r\n\tfor (int i = 1; i <= n; ++ i)\r\n\tdp[i] = S.a[i], del[i] = -1;\r\n\t\r\n\tif(min(n, k) >= 2)dp[1] = 0;\r\n\t\r\n\tfor (int i = 2; i <= n; ++ i)\r\n\t{\r\n\t\tS.main((n + i - 1) / i);\r\n\t\tfor (int j = 2; j <= (n + i - 1) / i; ++ j)\r\n\t\t{\r\n\t\t\t(dp[j] += mul[i] * S.a[j] + MOD) %= MOD;\r\n\t\t}\r\n\t\t\r\n\t\tfor (int j = 2 * i; j <= n; j += i)\r\n\t\tmul[j] += mul[i];\r\n\t}\r\n\t\r\n\tlong long ans = 0;\r\n\tfor (int i = 1; i <= min(n, k); ++ i)\r\n\t(ans += dp[i]) %= MOD;\r\n\tcout << ans;\r\n}", "lang": "GNU C++14", "bug_code_uid": "8f206ecd7201e5be74729388738344cb", "src_uid": "eb9d24070cc5b347d020189d803628ae", "apr_id": "971c89e0358fb90f43e913ae593f8707", "difficulty": 2900, "tags": ["fft", "math", "combinatorics", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9989104380039224, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include\r\n#define N 200000\r\n#define mod 998244353\r\nusing namespace std;\r\nint n,k,ans;\r\ninline int quick_pow(int x,int b)\r\n{\r\n int ret=1;\r\n while(b)\r\n {\r\n if(b&1) ret=1ll*ret*x%mod;\r\n x=1ll*x*x%mod,b>>=1;\r\n }\r\n return ret;\r\n}\r\ninline int inv(int x) {return quick_pow(x,mod-2);}\r\nint fac[N+5],ifac[N+5];\r\nint p[N+5],cnt,mu[N+5];\r\nbool vis[N+5];\r\ninline void init(int n=N)\r\n{\r\n fac[0]=1;for(int i=1;i<=n;++i) fac[i]=1ll*fac[i-1]*i%mod;\r\n ifac[n]=inv(fac[n]);for(int i=n;i;--i) ifac[i-1]=1ll*ifac[i]*i%mod;\r\n mu[1]=1;\r\n for(int i=2;i<=n;++i)\r\n {\r\n if(!vis[i]) p[++cnt]=i,mu[i]=mod-1;\r\n for(int j=1;j<=cnt && i*p[j]<=n;++j)\r\n {\r\n vis[i*p[j]]=1;\r\n if(!(i%p[j]))\r\n {\r\n mu[i*p[j]]=0;\r\n break;\r\n }\r\n mu[i*p[j]]=(mod-mu[i])%mod;\r\n }\r\n }\r\n}\r\ninline int C(int n,int m)\r\n{\r\n if(!m) return 1;\r\n return n>=m && m>0?1ll*fac[n]*ifac[m]%mod*ifac[n-m]%mod:0;\r\n}\r\nconst int G=3,inv_G=inv(G);\r\ninline void NTT(int *a,int lim,int opt=1)\r\n{\r\n\tstatic int rev[N*4],inv_lim;\r\n\tfor(int i=0;i>1]>>1|((i&1)*lim>>1);\r\n\t\tif(i\r\nusing namespace std;\r\n\r\nint mod = 998244353;\r\n\r\nconst int N = 505;\r\nint fac[N], inv_fac[N];\r\n\r\nint mod_pow(int b, int p) {\r\n int ans = 1;\r\n\r\n while (p) {\r\n if (p & 1) {\r\n ans = (1ll * ans * b) % mod;\r\n p--;\r\n }\r\n \r\n b = (1ll * b * b) % mod;\r\n p /= 2;\r\n }\r\n\r\n return ans;\r\n}\r\n\r\nvoid calc_fac() {\r\n fac[0] = 1;\r\n inv_fac[0] = 1;\r\n\r\n for (int i = 1; i < 505; i++) {\r\n fac[i] = (1ll * fac[i - 1] * i) % mod;\r\n inv_fac[i] = mod_pow(fac[i], mod - 2);\r\n }\r\n} \r\n\r\nint nCr(int n, int r) {\r\n if (r > n) {\r\n return 0;\r\n }\r\n return 1ll * fac[n] * inv_fac[n - r] % mod * inv_fac[r] % mod;\r\n}\r\n\r\nvoid solve() {\r\n int n, x;\r\n cin >> n >> x;\r\n\r\n vector> power(x + 5, vector(n + 5));\r\n for (int i = 1; i <= x; i++) {\r\n dp[i][0] = 1;\r\n for (int j = 1; j <= n; j++) {\r\n power[i][j] = 1ll * power[i][j - 1] * i % mod;\r\n }\r\n }\r\n\r\n vector> dp(n + 5, vector(x + 5));\r\n for (int nums = 2; nums <= n; nums++) {\r\n for (int lim = 1; lim <= x; lim++) {\r\n dp[nums][lim] = 0;\r\n if (lim < nums) {\r\n dp[nums][lim] = power[lim][nums];\r\n } else {\r\n dp[nums][lim] = power[nums - 1][nums];\r\n for (int killed = 0; killed < nums; killed++) {\r\n int alive = nums - killed;\r\n dp[nums][lim] = \r\n (dp[nums][lim] +\r\n 1ll * dp[alive][lim - (nums - 1)] \r\n * nCr(nums, killed) % mod \r\n * power[nums - 1][killed] % mod) % mod;\r\n }\r\n }\r\n }\r\n }\r\n\r\n cout << dp[n][x] << '\\n';\r\n}\r\n\r\nint main() {\r\n ios::sync_with_stdio(0);\r\n cin.tie(0);\r\n\r\n calc_fac();\r\n \r\n solve();\r\n \r\n return 0;\r\n}\r\n\r\n // 0 1 2 3 4 5\r\n // 0 0 0 0 0 0 0\r\n // 1 0 0 0 0 0 0\r\n // 2 0 1 1 1 1 1\r\n\r\n // dp[2][2] = 1 * dp[2][1] * 1 + 2 * dp[1][1] * 1 + 1 * dp[0][1] * 1\r\n\r\n// 1 1\r\n// 2 2\r\n\r\n// 1 1\r\n", "lang": "GNU C++17", "bug_code_uid": "5241b05e6c107ee9e98800c94f80bfb6", "src_uid": "1908d1c8c6b122a4c6633a7af094f17f", "apr_id": "1a3d3d8b56836dc954772fafd7355e43", "difficulty": 2100, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8596363636363636, "equal_cnt": 13, "replace_cnt": 3, "delete_cnt": 3, "insert_cnt": 6, "fix_ops_cnt": 12, "bug_source_code": "#include \r\nusing namespace std;\r\n#define int long long\r\n#define pb push_back\r\n#define map unordered_map\r\n#define F first\r\n#define S second\r\n#define M 998244353\r\n\r\nint fac[505] = {};\r\nint dp[505][505] = {};\r\nint x;\r\n\r\nint modpow(int a, int b){\r\n int x=1;\r\n while(b){\r\n if(b%2==1){\r\n x = (x*a)%M;\r\n }\r\n\r\n b/=2;\r\n a = (a*a)%M;\r\n }\r\n\r\n return x;\r\n}\r\n\r\n\r\nint ncr(int n, int r){\r\n int x = fac[n];\r\n int y = (fac[r]*fac[n-r])%M;\r\n\r\n x = (x*modpow(y,M-2))%M;\r\n return x;\r\n}\r\n\r\n\r\nint fn(int n, int th){\r\n if(th>=x)\r\n return 0;\r\n else if(n==0){\r\n return x-th;\r\n }\r\n\r\n if(dp[n][th] != 0){\r\n return dp[n][th];\r\n }\r\n\r\n for(int i=n-1; i>=0; i--){\r\n dp[n][th] = (dp[n][th] + ((modpow(n, n-i)*ncr(n,i))%M*fn(i,th+n))%M)%M;\r\n }\r\n\r\n // cout << dp[n][th] << ' ';\r\n\r\n return dp[n][th];\r\n}\r\n\r\n\r\nvoid precompute(n,x){\r\n fac[0] = 1;\r\n for(int i=1; i<=n; i++){\r\n fac[i] = (fac[i-1]*i)%M;\r\n }\r\n}\r\n\r\nsigned main(){\r\nios::sync_with_stdio(0); cin.tie(0); cout.tie(0);\r\n\r\n precompute();\r\n\r\n int n;\r\n cin >> n >> x;\r\n\r\n cout << (modpow(x,n) - (n*fn(n-1, 0))%M + M)%M;\r\n \r\n \r\n\r\n return 0;\r\n}", "lang": "GNU C++17", "bug_code_uid": "68b71f7bbba976983a7ed6766ebeaca7", "src_uid": "1908d1c8c6b122a4c6633a7af094f17f", "apr_id": "5b477668408565fca2df10b43a16bd65", "difficulty": 2100, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.46808510638297873, "equal_cnt": 15, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 14, "bug_source_code": "#include\r\n#include\r\n#define ll long long\r\nusing namespace std;\r\nconst int N=1e6+10;\r\nint box[N],cnt,now,sum[N];\r\nmap mp;\r\nll ans;\r\nvoid init(int n){\r\n for(int i=1;i<=20;i++){\r\n sum[i]=sum[i-1];\r\n for(int j=1;j<=n;j++){\r\n if(!mp[i*j]){\r\n mp[i*j]=1;\r\n sum[i]++;\r\n }\r\n }\r\n }\r\n}\r\nint main(){\r\n int t,n,m;\r\n scanf(\"%d%d\",&n,&m);\r\n init(m);\r\n // printf(\"A:\\n\");\r\n for(int i=1;i<=n;i++){\r\n if(!box[i]){\r\n if(i==1) box[1]=1,ans++;\r\n else{\r\n int cnt=0;\r\n for(ll j=i;j<=n;j=j*i){\r\n box[j]=1,cnt++;\r\n }\r\n ans=ans+sum[cnt];\r\n }\r\n }\r\n }\r\n printf(\"%lld\\n\",ans);\r\n return 0;\r\n}", "lang": "GNU C++17", "bug_code_uid": "2289214a9d7112cea9d6a3202d1b2b64", "src_uid": "6ca310cb0b6fc4e62e63a731cd55aead", "apr_id": "6b55dfd3fbf05c8376f1583ed0370fd7", "difficulty": 2200, "tags": ["dp", "math", "brute force", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9489115948467348, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 9, "bug_source_code": "#include\r\nusing namespace std;\r\n//const int SIZE=1<<13;\r\n//static char buf[SIZE],*be=buf,*en=buf,obuf[SIZE],*p3=obuf;\r\n//#define getchar() be==en&&(en=(be=buf)+fread(buf,1,SIZE,stdin),be==en)?EOF:*be++;\r\ninline int read(){\r\n int x=0,f=1;char ch=getchar();\r\n while(!isdigit(ch))f=ch!='-',ch=getchar();\r\n while(isdigit(ch))x=(x<<1)+(x<<3)+(ch^48),ch=getchar();\r\n return f?x:-x;\r\n}\r\nvoid write(int x)\r\n{\r\n if(x<0)putchar('-'),x=-x;\r\n if(x>9)write(x/10);\r\n putchar(x%10+'0');\r\n return;\r\n}\r\nconst int maxn=1e6+10; \r\nint a[1010101];\r\nbool vis1[1010101],vis2[20202020];\r\nsigned main(){\r\n\tint n,m;\r\n\tcin>>n>>m;\r\n\tint z=0;\r\n long long ans=1;\r\n\tfor(int i=1;i<=20;i++){\r\n for(int j=1;j<=m;j++){\r\n \t if(!vis1[j*i]){\r\n \t \tvis1[i*j]=1;\r\n \t \tz++;\r\n\t\t\t}\r\n\t }\r\n\t a[i]=z;\r\n\t}\r\n\tfor(int i=2;i<=n;i++){\r\n\t\tint k=1;z=0;\r\n if(!vis2[i]){\r\n while(1ll*i*k<=1ll*n){\r\n \t /*k*=i;\r\n \t vis2[k]=1;\r\n \t z++; */\r\n\t\t\t z+=(vis[k*=i]=1) ;\r\n\t\t }\r\n\t\t}\r\n\t\tans+=a[z];\r\n\t}\r\n\twrite(ans);\r\n\treturn 0;\r\n}", "lang": "GNU C++14", "bug_code_uid": "098d62debd9d9611d5df087830819c06", "src_uid": "6ca310cb0b6fc4e62e63a731cd55aead", "apr_id": "789fbc9becfe5e926c523fec47aac4d9", "difficulty": 2200, "tags": ["dp", "math", "brute force", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.11496350364963503, "equal_cnt": 20, "replace_cnt": 16, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 20, "bug_source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\n\nint main(void){\n\tint t, n, k;\n\tcin>>t;\n\twhile(t--){\n\t\tcin>>n>>k;\n\t\tint ans=pow(n, k);\n\t\tcout<\nusing namespace std;\ntypedef long long ll;\nint mood=1e9+7;\n\nint main()\n{\n int t;\n cin>>t;\n while(t--)\n {\n ll n,k;\n cin>>n>>k;\n ll ans=1;\n while(k--)\n{\n ans=ans*n;\n ans=ans%mood;\n}\n}\n return 0;\n}\n \t\t \t \t \t\t\t\t \t\t \t \t\t\t", "lang": "GNU C++17", "bug_code_uid": "1407830fa9cf90ddda46ddd677b6137d", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "0b557c03d086a7ec01a2d7459c2aab4a", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8622540250447227, "equal_cnt": 2, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include \n#include \nusing namespace std;\nconst int MOD=1000000007;\nint main()\n{\n\tint t,a,b,ans;\n\tcin>>t;\n\twhile(t--)\n\t{\n\t\tans=1;\n\t\tcin>>a>>b;\n\t\tfor(int i=1;i<=b;i++)\n\t\t\tans=ans*a%MOD;\n\t\tcout<\n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\nint main() {\n\tlong long int t, n, k, o, p ;\n\tscanf(\"%lld\", &t);\n\n\twhile (t--) {\n\t\tp = 1;\n\t\tscanf(\"%lld%lld\", &n, &k);\n\t\tp = qpow(n, k);\n\t\twhile (k--) {\n\t\t\tp *= n;\n\t\t\tp = p % 1000000007;\n\t\t}\n\n\t\tprintf(\"%lld\\n\", p);\n\t}\n\n\treturn 0;\n}\n \t\t \t\t\t \t\t\t\t\t\t\t \t\t\t \t \t \t", "lang": "GNU C++17", "bug_code_uid": "bf9caad36fdc5af0cd98721a4801dd6c", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "96ceea15290321a00fa9e61079cd0558", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.21333333333333335, "equal_cnt": 21, "replace_cnt": 17, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 21, "bug_source_code": "#include\n#include\n#include\n#include\n#define ll long long int\nusing namespace std;\nint main()\n{\n\tint t,n,a;\n\tscanf(\"%d\",&t);\n\twhile(t--){\n\t\tscanf(\"%d\",&n);\n\t\tbool mark=false;\n\t\tfor(int i=0;i>a;\n\t\t\tif(sqrt(a)-(int)(sqrt(a))!=0) mark=true;\n\t\t}\n\t\tif(mark) cout<<\"YES\"<\nusing namespace std;\ntypedef long long ll;\n\nconst int N = 1e9 + 7;\nll n, k;\nint main() {\n\tint t;\n\tcin >> t;\n\twhile (t--) {\n\t\tcin >> n >> k;\n\t\tll ans = 1;\n\t\twhile (k--) {\n\t\t\tans *= n;\n\t\t}\n\t\tcout << ans % N << endl;\n\t}\n\treturn 0;\n}\n\t\t\t \t\t\t\t \t\t\t\t\t \t\t\t \t\t\t \t", "lang": "GNU C++17", "bug_code_uid": "df734b8f21fde0af58e804ae83241eeb", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "da509ac8719d3929522c538be06be04d", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9453061224489796, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "#include\r\n#define pb push_back\r\n#define eb emplace_back\r\n#define F first\r\n#define S second \r\n#define lp(i,n) for(lli i=0;i\r\n#define vll vector\r\n#define pii pair\r\n#define pll pair\r\n#define all(v) v.begin(),v.end()\r\n#define all_rev(v) v.rbegin(),v.rend()\r\n#define lb(v,i) lower_bound(v.begin(),v.end(),i)-v.begin()\r\n#define ub(v,i) upper_bound(v.begin(),v.end(),i)-v.begin()\r\n#define bsr(v,i) binary_search(v.begin(),v.end(),i)\r\n#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);\r\n#define set >::iterator itr;\r\n#define endl \"\\n\"\r\n#define umap unordered_map\r\nusing namespace std;\r\n \r\nconst int mod= pow(10,9)+7;\r\nconst int MM= 2*pow(10,6)+10;\r\n \r\nlli power(lli a, lli b){ if (b==0) return 1; lli r=power(a,b/2); r=(r*r)%mod; if(b&1) r=(r*a)%mod; return r;}\r\n//lli fact[MM];\r\n//lli invfact[MM];\r\n//lli ncr(lli x, lli y){ if(x=0;i--)\r\n// invfact[i]= ((i+1)*invfact[i+1])%mod;\r\n// }\r\n// void pre()\r\n// {\r\n// pre_fact();\r\n// }\r\nint pow2(lli x, lli n, lli d) {\r\n // Do not write main() function.\r\n // Do not read input, instead use the arguments to the function.\r\n // Do not print the output, instead return values as specified\r\n // Still have a doubt. Checkout www.interviewbit.com/pages/sample_codes/ for more details\r\n long long int ans =1; \r\n x = x%d; \r\n \r\n if(x==0) \r\n return 0;\r\n \r\n while(n>0)\r\n {\r\n if(n & 1)\r\n ans = (ans*x)%d;\r\n n = n>>1; \r\n x = (x*x) % d; \r\n }\r\n \r\n if(ans>0)\r\n return int(ans);\r\n else\r\n return int(ans+d); \r\n}\r\n \r\n \r\nint main()\r\n{\r\n int t;\r\n cin>>t;\r\n \r\n while(t--)\r\n {\r\n int n,k;\r\n cin>>n>>k;\r\n int ans2 = pow2(n,k,100000007);\r\n \r\n cout<\r\nusing namespace std;\r\n\r\nint main(){\r\n int t;cin>>t;\r\n while(t--){\r\n long long int n,k,count = 1;cin>>n;cin>>k;\r\n for(int i=0;i\r\nconst int32_t mod= 1000000007;\r\nconst int32_t mod2=998244353;\r\nconst int32_t maxn=2000005; \r\n\r\nvoid solve(){\r\n ll n,k;\r\n cin>>n>>k;\r\n \r\n ll ans=k;\r\n for(int i=1;i<=n;i++){\r\n ans=(ans*i)%mod;\r\n }\r\n cout<>test;\r\n\twhile(test--) {\r\n\t\tsolve();\r\n\t}\r\n // cout<\r\nusing namespace std;\r\n\r\nconst int mod = 1e9 + 7;\r\ntypedef long long LL;\r\nLL qmi(LL a, int k)\r\n{\r\n LL ans = 1;\r\n while(k)\r\n {\r\n if(k & 1) ans = (LL) ans * a % mod;\r\n k >>= 1;\r\n a = (LL)a * a % mod;\r\n }\r\n return ans % mod;\r\n}\r\n\r\nvoid solve()\r\n{\r\n int n, k;\r\n cin >> n >> k;\r\n if(n == 1)\r\n {\r\n cout << 0 << endl;\r\n }\r\n else\r\n {\r\n cout << qmi(n, k) << endl;\r\n }\r\n}\r\n\r\nint main()\r\n{\r\n //freopen(\"in.txt\", \"r\", stdin);\r\n int t;\r\n cin >> t;\r\n while(t --) solve();\r\n return 0;\r\n}\r\n", "lang": "GNU C++17", "bug_code_uid": "e5a3e90368c3462eb6e5dc0ecc503e26", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "7b42890f9a9c1def31b916debfadb2de", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5694200351493849, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "#include\r\ntypedef long long int ll;\r\nusing namespace std;\r\nll power(ll n,ll k)\r\n{ll ans=1;\r\n for(ll i=1;i<=k;i++)\r\n {ans=ans*n;}\r\nreturn ans;}\r\nint main()\r\n{int t;cin>>t;\r\n while(t--)\r\n {ll n,k;cin>>n>>k;\r\n ll ans=power(n,k);\r\n cout<\r\nusing namespace std;\r\n#define mod 1000000000 + 7\r\n#define int long long\r\nsigned main(signed argc, char const *argv[])\r\n{\r\n ios::sync_with_stdio(0);\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 int tc;\r\n cin >> tc;\r\n while (tc--)\r\n {\r\n int n, k;\r\n cin >> n >> k;\r\n int prod = 1;\r\n for (int i = 0; i < k; i++)\r\n {\r\n prod *= n;\r\n prod =prod%mod;\r\n }\r\n cout << prod % mod << endl;\r\n }\r\n return 0;\r\n}\r\n", "lang": "GNU C++17", "bug_code_uid": "397504cfd29d77b073cc2e5f27db55bb", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "ec90cc2a7613ae59b0696f771052f3ef", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9013585351447135, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "#include\r\nusing namespace std;\r\n#define fasterIO ios::sync_with_stdio(0); cin.tie(0);\r\n#define forn(i,n) for (int i = 0; i < int(n); i++)\r\n#include\r\n//Snippet_list:snippet for algos\r\n#define pb push_back\r\ntypedef vector vi;\r\ntypedef vector vll;\r\ntypedef long long ll;\r\ntypedef unsigned long long ull;\r\n#define all(x) (x).begin(), (x).end()\r\nconst int md=1e9+7;\r\nlong long PoW(long long a, long long b) {\r\n \r\n //if(b==0)return 1;\r\n return b==1?a:(a*PoW(a,b-1))%md;\r\n}\r\n\r\nint main()\r\n{\r\n fasterIO\r\n #ifndef ONLINE_JUDGE\r\n freopen(\"E:/a Varsity/A Contest's & Camps/input.txt\", \"r\", stdin);\r\n freopen(\"E:/a Varsity/A Contest's & Camps/output/output.txt\", \"w\", stdout);\r\n #endif\r\n \r\n int t;cin>>t;\r\n while(t--)\r\n {\r\n ll n,k;\r\n cin>>n>>k;\r\n ll ans=pow(n,k);\r\n cout<\r\n#define ll long long\r\n#define mod 10000007\r\nusing namespace std;\r\nint main(){\r\n\tint t;\r\n\tcin>>t;\r\n\twhile (t--){\r\n ll n,k;\r\n cin>>n>>k;\r\n ll ans=1;\r\n for(ll i=0;i\r\nusing namespace std;\r\n#define ll long long\r\n\r\nint mod = 1e9 + 7;\r\n\r\nint main()\r\n{\r\n ios_base::sync_with_stdio(false);\r\n cin.tie(0); cout.tie(0);\r\n int t = 1; cin >> t;\r\n while(t--)\r\n {\r\n int n, k; cin >> n >> k;\r\n ll ans = 0;\r\n for(int i = 0; i < n; ++i)\r\n {\r\n ans = (ans + n)%mod;\r\n }\r\n cout << ans << endl;\r\n }\r\n return 0;\r\n}", "lang": "GNU C++17", "bug_code_uid": "f1d3fa472e1c2f0dc72d3739a49a7d57", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "be82d24877a77cc1258b215f542df405", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.6626323751891074, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "#include\r\nusing namespace std;\r\ntypedef long long ll;\r\nconst ll N=1e9+7;\r\nint t,n,k;\r\nll yushu(ll num)\r\n{\r\n\twhile(num>N)\r\n\t{\r\n\t\tnum=num-N;\r\n\t}\r\n\treturn num;\r\n}\r\nint main()\r\n{\r\n\tcin>>t;\r\n\twhile(t--){\r\n\t\tll num,y,x;\r\n\t\tcin>>n>>k;\r\n\t\tnum=pow(n,k);\r\n\t\tif(num<1e9+7) x=num;\r\n\t\telse x=yushu(num);\r\n\t\tcout<\r\nusing namespace std;\r\n#define ll long long \r\n#define MOD 1000000007\r\nll power(ll a,ll b)\r\n{\r\n\tll ans=1;\r\n\twhile(b>0)\r\n\t{\r\n\t\tif(b%2==0)ans=(ans*a)% MOD;\r\n\t\t\ta=(a*a)% MOD ;\r\n\t\t\tb>>=1;\r\n\t\t\r\n\t\t\r\n\t}\r\n\treturn ans;\r\n}\r\nint main()\r\n{\r\n\tint t;\r\n\tcin>>t;\r\n\twhile(t--)\r\n\t{\r\n\t\tll a;\r\n\t\tll b;\r\n\t\tcout<\r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n \r\n#define pb push_back\r\n#define eb emplace_back\r\n#define srt(a) sort(a.begin(),a.end());\r\n#define srtc(a,comp) sort(a.begin(),a.end(),comp);\r\n#define srtb(a) sort(a.rbegin(),a.rend());\r\nusing ll = long long;\r\nusing namespace std;\r\ntypedef vector vi;\r\ntypedef vector vl;\r\ntypedef pair ii;\r\ntypedef vector vpi;\r\nll MOD = 1e9+7;\r\nconst int dx[4][2] = {{0,1}, {0,-1}, {1,0}, {-1,0}}; //right left down up\r\nvoid setIO(string name = \"\") { // name is nonempty for USACO file I/O\r\n ios_base::sync_with_stdio(0); cin.tie(0); // see Fast Input & Output\r\n // alternatively, cin.tie(0)->sync_with_stdio(0);\r\n freopen((name+\".in\").c_str(), \"r\", stdin); // see Input & Output\r\n freopen((name+\".out\").c_str(), \"w\", stdout);\r\n}\r\n \r\n\r\nint main(){\r\n int t; cin >> t;\r\n while(t--){\r\n ll n, k; cin >> n >> k; k--;\r\n while(k--) n = n*n, n = n%MOD;\r\n cout << n << endl;\r\n }\r\n return 0;\r\n}", "lang": "GNU C++17", "bug_code_uid": "c06447a41dc2db5f2f4f0afdbac51386", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "fdc15a651ebdaba922708df1dbc7abdf", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.995656894679696, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "// #include \n// using namespace std;\n// bool ok[100005];\n// int main()\n// {\n// int n;\n// scanf(\"%d\", &n);\n// long long prod = 1;\n// for (int i = 1; i < n; i++)\n// {\n// if (__gcd(n, i) == 1)\n// {\n// ok[i] = 1;\n// prod = (prod * i) % n;\n// }\n// }\n// if (prod != 1)\n// ok[prod] = 0;\n// printf(\"%d\\n\", count(ok + 1, ok + n, 1));\n// for (int i = 1; i < n; i++)\n// {\n// if (ok[i])\n// printf(\"%d \", i);\n// }\n// }\n\n#include \n#include \n#include \nusing namespace std;\n\nint main()\n{\n int t;\n cin >> t;\n while (t--)\n {\n int n, k;\n cin >> n >> k;\n const int mod = 1e9 + 7;\n long long ans = 1;\n for (int i = 0; i < k; i++)\n {\n ans = (ans * n) % mod;\n }\n cout << ans;\n }\n return 0;\n}", "lang": "GNU C++17", "bug_code_uid": "b0e6046ddb658919d8b73c43687bc794", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "cb8a14cebb903b038a125ba344d78854", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9416058394160584, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#include\r\nusing namespace std;\r\nint main()\r\n{\r\n int t; cin>>t;\r\n while(t--){\r\n long long int n,k,mod=10e9+7;\r\n cin>>n>>k;\r\n int ans=1;\r\n for(long long int i=0;i\r\n#define MOD 1000000007\r\n#define ll long long\r\nusing namespace std;\r\n\r\n\r\nint main() {\r\n\tios_base::sync_with_stdio(false);\r\n cin.tie(NULL);\r\n ll t;\r\n\tcin>>t;\r\n\twhile(t--){\r\n\t ll n,k;\r\n\t cin>>n>>k;\r\n\t int ans=pow(n,k);\r\n\t cout<\r\n#define ll long long int\r\n#define ld long double\r\n#define endl \"\\n\" \r\n#define mp make_pair\r\n#define hcf __gcd\r\n#define test cout<<\"hello\";\r\n#define LCM(m,n) (m*n)/__gcd(m,n)\r\n#define maxa(v) *(max_element(all(v))\r\n#define mina(v) *(min_element(all(v))\r\n #define vi vector\r\n#define pb push_back\r\n#define ppb pop_back\r\n#define pf push_front\r\n#define ppf pop_front\r\n#define M 998244353\r\n#define S second\r\n#define F first\r\n#define inf (int)1e9\r\n#define fon(i,j,n) for(ll i=j;i<(n);++i)\r\n#define all(x) (x).begin(),(x).end()\r\n#define uniq(v) (v).erase(unique(all(v)),(v).end())\r\n#define sz(x) (int)((x).size())\r\n#define asort(v) sort(v.begin(),v.end())\r\n#define dsort(v) sort(v.begin(),v.end(),greater())\r\n#define BS(v,k) binary_search(v.begin(),v.end(),k)\r\n#define UB(v,k) (upper_bound(v.begin(),v.end(),k)-v.begin())\r\n#define LB(v,k) (lower_bound(v.begin(),v.end(),k)-v.begin())\r\n#define mod pow(10,9)+7\r\nusing namespace std;\r\n bool prime(ll n){bool b=true;\r\nfor(ll i=2;i<=sqrt(n);i++){if(n%i==0){b=false;break;\r\n }\r\n}\r\nif(b)return true;\r\nelse return false;\r\n}\r\nvoid solve(){\r\nll n,k;cin>>n>>k;ll sum=pow(n,k);\r\ncout<>tsc;\r\n while(tsc--){\r\n solve();\r\n cout<\r\nusing namespace std;\r\nconst int mod = 1e9 + 7;\r\nint t, n, k;\r\ninline int read(){\r\n int x = 0, f = 1;\r\n char ch = getchar();\r\n while (ch < '0' || ch > '9') {\r\n if (ch == '-')\r\n f = -1;\r\n ch = getchar();\r\n }\r\n while (ch >= '0' && ch <= '9') {\r\n x = (x << 1) + (x << 3) + (ch ^ 48);\r\n ch = getchar();\r\n }\r\n return x * f;\r\n}\r\nint main(){\r\n\tt = read();\r\n\tfor (int i = 1; i <= t; i++){\r\n\t\tn = read();\r\n\t\tk = read();\r\n\t\tint ans = pow(n, k);\r\n\t\tans %= mod;\r\n\t\tprintf(\"%d\\n\", ans);\r\n\t}\r\n\treturn 0;\r\n}", "lang": "GNU C++14", "bug_code_uid": "3ba23a86018f0d3a10335eecbe56cbe9", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "3019fd001c78b32a78392b11a522c426", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.04404145077720207, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "#include\r\nusing namespace std;\r\nlong long x,y,t;\r\nlong long f(long long x,long long y){\r\n\tif(!y)return 1;\r\n\tlong long tt=1;\r\n\twhile(y){\r\n\t\tif(y&1){\r\n\t\t\ttt*=x;\r\n\t\t\ttt%=1000000007;\r\n\t\t}\r\n\t\ty>>=1;\r\n\t\tx%=1000000007;\r\n\t\tx*=x;\r\n\t\t\r\n\t}\r\n\treturn tt;\r\n}\r\nint main(){\r\n\tcin>>t;\r\n\twhile(t--){\r\n\t\tcin>>x>>y;\r\n\t\tx%=1000000007;\r\n\t\tcout<\r\nusing namespace std;\r\ntypedef long long int ll;\r\nconst ll MOD=1e9+7;\r\n\r\nint main()\r\n{\r\n ll tc;\r\n cin>>tc;\r\n while(tc--)\r\n {\r\n ll n,k;\r\n ll ans=1;\r\n for(int i=0;i\r\nusing namespace std;\r\n#define mod 1000000007\r\n#define ll long long\r\n\r\nll power(ll a, ll n){\r\n ll res = 1;\r\n while(n){\r\n if(n & 1) res = (res * a)%mod;\r\n\r\n n >>= 1;\r\n a = (a * a)%mod;\r\n }\r\n return res%mod;\r\n}\r\nint main(){\r\n int t;\r\n cin>>t;\r\n while(t--){\r\n int n, k;\r\n cin>>n>>k;\r\n\r\n cout<\r\n#include \r\n#define ll long long\r\n#define forn(i,n) for(int i=0;i>t;\r\n while(t--)\r\n {\r\n ll n,k; cin>>n>>k;\r\n cout<\r\n#include\r\nusing namespace std;\r\n\r\n\r\ntypedef long long int ll;\r\nint main()\r\n{\r\n\tlong long int t;\r\n\tscanf(\"%lld\",&t);\r\n\twhile(t--)\r\n\t{\r\n\t\tll n,k;\r\n\t\tcin>>n>>k;\r\n\t\tll x=pow(n,k);\r\n\t\tll ans=x%(1000000007LL);\r\n\t\tcout<\r\nusing namespace std;\r\n \r\n#define int long long\r\n#define mp make_pair\r\n#define pb push_back\r\n#define mod 1000000007\r\n#define double long double\r\nint power(int a,int b)\r\n{\r\n if(b==0||a==1)return 1;\r\n int c=power(a,b/2);\r\n if(c%2==1)\r\n {\r\n c=(c*c)%mod;\r\n c=(c*a)%mod;\r\n }\r\n else\r\n {\r\n c=(c*c)%mod;\r\n }\r\n return c;\r\n}\r\n\r\nsigned main()\r\n{\r\n ios_base::sync_with_stdio(false);\r\n cin.tie(NULL);\r\n cout.tie(NULL);\r\n\r\n int i,j,n,t=1,m,k,x,u,y,a,b,l=0,ans,countd1,count,max,pos,w,h;\r\n \r\n cin>>t;\r\n while(t--){\r\n cin>>n>>k;\r\n\r\n cout<\r\n#include\r\nusing namespace std;\r\n#define ll long long\r\nconst int mod = 1e9+7;\r\nvoid solve()\r\n{\r\n ll int n,k;\r\n cin>>n;\r\n cin>>k;\r\n int x=n;\r\n for(int i=0;i>t;\r\nwhile(t--)\r\n{\r\n solve();\r\n}\r\nreturn 0;\r\n}\r\n\r\n\r\n", "lang": "GNU C++14", "bug_code_uid": "5420e4af32b851d7f98d344597988f18", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "3fd16b938ad1e64c109f8d96b8192b68", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9489614243323442, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "#pragma GCC optimize(\"Ofast\")\r\n#include \r\nusing namespace std;\r\n#define ll long long\r\n#define llu long long unsigned\r\n#define pb push_back\r\n#define all(c) c.begin(), c.end()\r\n#define vi vector\r\n#define vll vector\r\n#define pii pair\r\n#define vp vector\r\n#define vb vector\r\n#define mp make_pair\r\n#define F first\r\n#define S second\r\n#define lb \"\\n\"\r\n#define rep(i,a,b) for(ll i = a;iy)return x;else return y;}\r\nll min(ll x,ll y){if(x>y)return y;else return x;}\r\nll fac[25];\r\nll power(ll x, ll y, ll p)\r\n{\r\n ll res = 1;\r\n x = x % p;\r\n while (y > 0)\r\n {\r\n if (y & 1)\r\n res = (res*x) % p;\r\n y = y>>1;\r\n x = (x*x) % p;\r\n }\r\n return res;\r\n}\r\nll modInverse(ll n, ll p)\r\n{\r\n return power(n, p-2, p);\r\n}\r\nll ncr(ll n, ll r)\r\n{\r\n ll p=INF;\r\n if (r==0)\r\n return 1;\r\n return (fac[n]* modInverse(fac[r], p) % p *\r\nmodInverse(fac[n-r], p) % p) % p;\r\n}\r\nbool isprime(ll n)\r\n{\r\n if(n==1)\r\n return false;\r\n for(ll i=2;i*i<=n;i++)\r\n if(n%i==0)\r\n return false;\r\n return true;\r\n}\r\nint main()\r\n{\r\n ios::sync_with_stdio(0);\r\n cin.tie(0); cout.tie(0);\r\n #ifdef LOCAL\r\n freopen(\"input.txt\", \"r\" , stdin);\r\n freopen(\"output.txt\", \"w\", stdout);\r\n #endif\r\n ll i,j,k,ans,n,m,t,p;\r\n cin>>t;\r\n while(t--)\r\n {\r\n cin>>n>>k;\r\n if(n==1)\r\n cout<<1<\r\n#include \r\ntypedef long long ll;\r\nusing namespace std;\r\n\r\n// ASCII of 'a'-97,'z'-123,'A'-65,'Z'-90,'0'-48,'9'-57\r\nbool sortby(const pair &a, const pair &b)\r\n{\r\n return a.second < b.second;\r\n}\r\nll power(ll x, ll y)\r\n{\r\n if (y == 0)\r\n return 1;\r\n else if (y % 2 == 0)\r\n return power(x, y / 2) * power(x, y / 2);\r\n else\r\n return x * power(x, y / 2) * power(x, y / 2);\r\n}\r\nsigned main()\r\n{\r\n ll t;\r\n cin >> t;\r\n while (t--)\r\n {\r\n int n, k;\r\n cin >> n >> k;\r\n ll MOD = 1000000007;\r\n int ans=1;\r\n for(ll i=0;i\r\nusing namespace std;\r\nconst int MOD = 1e9 + 7;\r\nint main() {\r\n int tt; cin>>tt; \r\n while(tt--) {\r\n int n,k; cin>>n>>k;\r\n int ans = 1;\r\n while(k--) ans = (ans * n) % MOD;\r\n cout<< ans << '\\n';\r\n }\r\n}", "lang": "GNU C++14", "bug_code_uid": "bea9e054e7d69e68e70f82c75c17a3a5", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "64a5f58ec8661d4f940bbb1f2bc7c735", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9898089171974522, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#include \r\n#include \r\n#include \r\n#include \r\nusing namespace std;\r\n#define ull unsigned long long int\r\n\r\nint power(ull x, ull y, int p)\r\n{\r\n int res = 1; // Initialize result\r\n \r\n x = x % p; // Update x if it is more than or\r\n // equal to p\r\n \r\n if (x == 0) return 0; // In case x is divisible by p;\r\n \r\n while (y > 0)\r\n {\r\n // If y is odd, multiply x with result\r\n if (y & 1)\r\n res = (res*x) % p;\r\n \r\n // y must be even now\r\n y = y>>1; // y = y/2\r\n x = (x*x) % p;\r\n }\r\n return res;\r\n}\r\nint main()\r\n{\r\n ull t;\r\n cin>>t;\r\n for(ull i=0;i>n,k;\r\n cout<<(n,k,1000000007);\r\n }\r\n return 0;\r\n}", "lang": "GNU C++14", "bug_code_uid": "1fe050e74bfd220f8c1e367cfd4e0d06", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "64409fb6859e3f7bde1efe414f1dddb9", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.7764849969381507, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "#include \r\n#define int long long int \r\n#define double long double \r\n#define mod 1000000007 \r\n#define mod1 998244353 \r\n#define w(t) \\\r\n int t; \\\r\n cin >> t; \\\r\n while (t--)\r\n#define f(i, a, n) for (int i = a; i < n; i++)\r\n#define vi(a,n) vector a(n);\r\n#define pb push_back\r\n#define pob pop_back\r\n#define fat(i,v) for(auto i:v)\r\n#define mk make_pair\r\n#define FAST \\\r\n ios_base::sync_with_stdio(false); \\\r\n cin.tie(NULL); \\\r\n cout.tie(NULL)\r\nusing namespace std;\r\nconst int inf = LLONG_MAX;\r\nconst int neg_inf = LLONG_MIN;\r\n\r\nint inline power(int a, int b, int p=mod1)\r\n{\r\n a %= p;\r\n int ans = 1;\r\n while(b>0){\r\n if(b & 1)\r\n ans = (ans*a)%p;\r\n a = (a*a)%p;\r\n b >>= 1;\r\n }\r\n return ans;\r\n}\r\n\r\nint fact(int n)\r\n {\r\n int a=1;\r\n for(int i=1;i<=n;i++)\r\n a=(a*i)%mod;\r\n return a;\r\n }\r\n\r\n\r\nint32_t main()\r\n {\r\n FAST;\r\n #ifndef ONLINE_JUDGE\r\n freopen(\"input.txt\", \"r\", stdin);\r\n freopen(\"output.txt\", \"w\", stdout);\r\n #endif\r\n w(t)\r\n {\r\n int n,k;\r\n cin>>n>>k;\r\n if(n==1)\r\n {\r\n cout<<\"0\\n\";\r\n continue;\r\n }\r\n int p=power(2,k)-1;\r\n int q=0;\r\n int r=p,j=0;\r\n while(r>0)\r\n {\r\n if((r&1)==0)\r\n {\r\n q+=power(2,j);\r\n }\r\n j++;\r\n r=r>>1;\r\n }\r\n int sum=((((n-1)*p)%mod)+q)%mod;\r\n int ans=0;\r\n ans+=n%mod;\r\n if(q==0)\r\n {\r\n int x=p/2;\r\n int y=p-x;\r\n if((x&y)==0)\r\n {\r\n if(n==2) ans+=2;\r\n else\r\n {\r\n ans+=( fact(n)/2 )%mod;\r\n }\r\n }\r\n }\r\n cout<\r\nusing namespace std;\r\nint main(){int t;cin>>t;\r\nwhile(t--){\r\nint n,k,ans=1;cin>>n>>k;\r\nfor(int i=0;i< k;i++){\r\n ans=(ans*n) %(1000000007 );\r\n}\r\ncout<\r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#define ll long long\r\nusing namespace std;\r\nll pw(ll a, ll b)\r\n{\r\n\tll ans = 1;\r\n\tfor (int i = 0; i < b; i++)\r\n\t{\r\n\t\tans *= a;\r\n\t\tans %= 1000000007;\r\n\t}\r\n\treturn ans;\r\n}\r\nint main() {\r\n\r\n\tios_base::sync_with_stdio(false);\r\n\tcin.tie(NULL);\r\n\t\r\n\tll n,k, t;\r\n\tcin >> t;\r\n\twhile (t--)\r\n\t{\r\n\t\tcin >> n >> k;\r\n\t\tcout << pw(n,k);\r\n\t}\r\n\treturn 0;\r\n}", "lang": "MS C++ 2017", "bug_code_uid": "4eb6dcf773ed8f3c38e47ab54e83cb84", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "209ae19b2793ed91ab6a19c91bc9ce1e", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.3693379790940767, "equal_cnt": 10, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "#include\r\n#include\r\n#include\r\n#include\r\nusing namespace std;\r\nint main()\r\n{\r\n int T,n,k,z;\r\n cin>>T;\r\n while(T--)\r\n {\r\n cin>>n>>k;\r\n cout<<(((int)pow(n,k))%1000000007)<\r\nusing namespace std;\r\n\r\nconst int mod = 1e9 + 7;\r\n\r\nint fun(int n, int k){\r\n\r\n if(k == 0){\r\n return 1;\r\n }\r\n if(k == 1){\r\n return n;\r\n }\r\n\r\n int cur = fun(n, k/2) % mod;\r\n if(k % 2){\r\n return n*cur*cur % mod;\r\n }\r\n else{\r\n return cur * cur % mod;\r\n }\r\n}\r\n\r\n\r\nint main(){\r\n int t;\r\n cin >> t;\r\n while(t--){\r\n int n,k; \r\n cin >> n >> k;\r\n cout << fun(n, k) << endl;\r\n }\r\n return 0;\r\n}", "lang": "GNU C++11", "bug_code_uid": "e85a1177dda9b670be611eeae83abc8b", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "7bfc99745a5bf6e29feba48a11f873c0", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9819694868238558, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include \r\n\r\ntypedef long long LL;\r\nusing namespace std;\r\n\r\nconst int mod = 1e9 + 7;\r\n\r\nint main() {\r\n int T;\r\n cin >> T;\r\n \r\n while (T -- ) {\r\n int n, k;\r\n cin >> n >> k;\r\n LL ans = 1;\r\n for (int i = 0; i < k; i ++ ) ans *= n % mod;\r\n \r\n cout << ans << endl;\r\n }\r\n \r\n return 0;\r\n}\r\n", "lang": "GNU C++11", "bug_code_uid": "c2c7c523ff5161b9386f8e9630bae6e0", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "c6387e8b57d2ba2f52d1bcc2a456c0ed", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8568421052631578, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include\r\n#include\r\nusing namespace std;\r\nlong long k=1e9+7;\r\nlong long fastpower(long long b,long long p)\r\n{\r\n long long r=1;\r\n while(p>0)\r\n {\r\n\t if(p%2==1)\r\n\t {\r\n\t \tr=r*b%k;\r\n\t\t}\r\n\t\tp/=2;\r\n\t\tb=(b*b)%k;\r\n }\r\n if(p==0&&b==1)\r\n {\r\n \treturn p;\r\n\t}\r\n return r;\r\n}\r\nint main()\r\n{\r\n\tint T;\r\n\tcin>>T;\r\n\twhile(T--)\r\n\t{\r\n\t\tlong long n,k;\r\n\t\tcin>>n>>k;\r\n\t\tcout<\r\n#include // Common file \r\n#include \r\n#include // Common file\r\n#include // Including tree_order_statistics_node_update\r\n#include // for less \r\n#include \r\nusing namespace __gnu_pbds; \r\nusing namespace std; \r\n#define int long long\r\n#define mod 1000000007 \r\n \r\n\r\ntypedef tree<\r\nint,\r\nnull_type,\r\nless,\r\nrb_tree_tag,\r\ntree_order_statistics_node_update> \r\n ordered_set; \r\ntypedef tree, rb_tree_tag, \r\n tree_order_statistics_node_update> \r\n ordered_multiset;\r\n\r\nmap factorial;\r\n\r\nint power(int a,int b)\r\n{if(b==0)\r\n return 1;\r\nint d=(power(a,b/2))%mod;\r\nd=(d*d)%mod;\r\nif(b%2==1)\r\nreturn (a*d)%mod;\r\nreturn (d)%mod;}\r\n\r\n\r\nvoid solve()\r\n{\r\nint n,k;\r\ncin>>n>>k;\r\n\r\n\r\ncout<>t;\r\nint last=1;\r\nfactorial[0]=1;\r\nfor(int i=1;i<=10000040;i++)\r\n{last=(last*i)%mod;\r\nfactorial[i]=last;}\r\nfor(int i=1;i<=t;i++)\r\n{\r\nsolve();\r\n}\r\n\r\n\r\n return (int)(0);\r\n}", "lang": "GNU C++11", "bug_code_uid": "9b21c1c779afc3e21a8cf31c67aa4dfb", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "1986e14fd83c13f73e0fbf710c356962", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9668508287292817, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include\r\nusing namespace std;\r\ntypedef long long int ll;\r\nint main()\r\n{\r\n ll t;\r\n cin>>t;\r\n while(t--)\r\n {\r\n ll n, k;\r\n cin>>n>>k;\r\n ll p = 1;\r\n ll d = 1000000007;\r\n for(ll i=0;i\r\nusing namespace std;\r\ntypedef long long ll;\r\nconst int MOD=1e9+7;\r\n\r\nint main(){\r\n\tint t;\r\n\tcin>>t;\r\n\twhile(t--){\r\n\t\tint n,k;\r\n\t\tcin>>n>>k;\r\n\t\tint s=1;\r\n\t\twhile(k--){\r\n\t\t\ts=(s*n)%MOD;\r\n\t\t}\r\n\t\tcout<\r\nusing namespace std;\r\nint main()\r\n{\r\n long long int mod=1e9+7;\r\n long long int t;\r\n long long int res=1;\r\n cin>>t;\r\n while(t--)\r\n {\r\n long long int n,k;\r\n cin>>n>>k;\r\n for(int i=0;i\r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n\r\n#include \r\n#include \r\n#include // lower_bound : <= ; upper_bound : > ; *s.upper_bound(x) de type X\r\n#include // lower_bound : <= ; upper_bound : > ; *m.upper_bound(x) de type pair\r\n#include \r\n*/\r\n\r\n#include \r\n\r\nusing namespace std;\r\n\r\n\r\n#define hmap unordered_map \r\n#define hset unordered_set \r\n\r\n#define print_var(x) cout << #x << \" is \" << x << endl;\r\n\r\ntemplate \r\nusing heap = priority_queue, Compare>;\r\n\r\nuint64_t expo(uint64_t n, uint64_t k){\r\n\tif (k == 0)\r\n\t\treturn 1; \r\n\treturn n * expo(n, k-1) % 1000000009;\r\n}\r\n\r\n\r\n\r\nint main(){\r\n\tint t; \r\n\tcin >> t; \r\n\r\n\tfor (int step ; step < t; step++){\r\n\t\tuint64_t n, k; cin >> n >> k; \r\n\t\tcout << expo(n, k) % 1000000009 << endl;\r\n\r\n\t}\r\n\t\r\n\r\n}\r\n\r\n\r\n", "lang": "GNU C++11", "bug_code_uid": "82fde7100c2aa66ce549d9de6116e8e9", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "4ec745aaf4eeb52320fdf27b3e4d015f", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.944686140459913, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n\r\nusing namespace std;\r\n\r\nconst int mod = (int) 1e9 + 7;\r\n\r\nint mul(int a, int b) {\r\n return (1ll * a * b) % mod;\r\n}\r\n\r\nint fp(int a, int b) {\r\n int ans = 1;\r\n while (b > 0) {\r\n if (b & 1) {\r\n ans = mul(ans, a);\r\n }\r\n b >>= 1;\r\n a = mul(a, a);\r\n }\r\n return ans;\r\n}\r\n\r\nint main() {\r\n int t;\r\n cin >> t;\r\n while (t--) {\r\n int n, k;\r\n cin >> n >> k;\r\n if (n < k) {\r\n cout << n << endl;\r\n } else {\r\n cout << fp(n, k) << endl;\r\n }\r\n }\r\n return 0;\r\n}\r\n", "lang": "GNU C++11", "bug_code_uid": "43f14076ed730063676843add75bfa73", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "8bde6045d38b410ffeb0d6521abae310", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9797336421540244, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\nusing namespace std;\r\ntypedef long long ll;\r\nconst int N = 1e5 + 100;\r\nconst int INF = 0x3f3f3f3f;\r\nconst int mod = 1e9 + 7;\r\nint fastpow(int a, int n) {\r\n int base = a;\r\n int res = 1;\r\n while (n) {\r\n if (n % 2) res = (res * base) % mod;\r\n base = (base * base) % mod;\r\n n /= 2;\r\n }\r\n return res;\r\n}\r\n\r\nvoid solve() {\r\n int n, k;\r\n cin >> n >> k;\r\n cout << fastpow(n, k) << endl;\r\n}\r\n\r\nint main(int argc, char const *argv[]) {\r\n int t;\r\n cin >> t;\r\n while (t--) solve();\r\n return 0;\r\n}\r\n", "lang": "GNU C++11", "bug_code_uid": "cf092e19a17f4cf820f0f4547fc73688", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "5eb77e0e2d4e84857847749cb5c27289", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.23686054660126138, "equal_cnt": 20, "replace_cnt": 15, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 20, "bug_source_code": "#include\r\nconst int N=255,p=998244353;\r\nint ksm(int x,int m){\r\n\tint ans=1;\r\n\tfor(;m;m>>=1,x=1ll*x*x%p)if(m&1)ans=1ll*x*ans%p;\r\n\treturn ans;\r\n}\r\nint inv[N],pw[N][N*N],f[N][N],n,k;\r\nvoid init(){\r\n\tinv[0]=inv[1]=f[0][0]=1;\r\n\tfor(int i=2;i<=n;i++)inv[i]=1ll*(p-p/i)*inv[p%i]%p;\r\n\tfor(int i=2;i<=n;i++)inv[i]=1ll*inv[i]*inv[i-1]%p;\r\n\tfor(int i=0;i<=n;i++)for(int j=0;j<=n*n;j++)pw[i][j]=ksm(i,j);\r\n}\r\nvoid work(){\r\n\tscanf(\"%d%d\",&n,&k);\r\n\tinit();\r\n\tfor(int i=1;i<=n;i++)for(int j=1;j<=k;j++)\r\n\t\tfor(int a=0;a\r\n\r\nusing namespace std;\r\n\r\nvoid dbg_out() { cerr << endl; }\r\ntemplate void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }\r\n#ifndef ONLINE_JUDGE\r\n#define dbg(...) cerr << \"[\" << #__VA_ARGS__ << \"]:\", dbg_out(__VA_ARGS__)\r\n#else\r\n#define dbg(...)\r\n#endif\r\n\r\n#define int long long \r\n#define sz(X) ((int)(X).size())\r\n#define fi first\r\n#define se second\r\n#define pb push_back\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; i >= a; i -- )\r\n#define mst memset\r\n#define endl '\\n'\r\n#define si(x) scanf(\"%d\", &x)\r\n#define sll(x) scanf(\"%lld\", &x)\r\n#define pi(x) printf(\"%d\\n\", x)\r\n#define pll(x) printf(\"%lld\\n\", x)\r\n#define sc scanf\r\n#define pr printf\r\n#define IO ios::sync_with_stdio(false); cin.tie(nullptr), cout.tie(nullptr);\r\n\r\nusing ll = long long;\r\nusing i64 = unsigned long long;\r\n\r\nconst int SIZE = 2e5 + 10, INF = 0x3f3f3f3f;\r\nint dx[] = {-1, 0, 1, 0};\r\nint dy[] = {0, 1, 0, -1};\r\nll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }\r\nll ksm(ll a, ll b, ll c) { ll ans = 1 % c; while (b) { if (b & 1) { ans = 1ll * ans * a % c; } a = 1ll * a * a % c; b >>= 1; } return ans;}\r\nll ksc(ll a, ll b, ll c) { int f = ((a >= 0 && b >= 0 || a < 0 && b < 0) ? 1 : -1); ll ans = 0; for (; b; b >>= 1) { if (b & 1) ans = (1ll * ans + a) % c; a = (1ll * a + a) % c; } return ans; }\r\n\r\ntemplate \r\nvoid res(T x, char y = '\\n') {\r\n cout << x << y;\r\n} \r\n\r\nconstexpr int N = 2510, P = 998244353;\r\nint n, k, fact[N], inv[N], dp[N][N], mi[N][N];\r\n\r\nvoid solve() {\r\n\tcin >> n >> k;\r\n\trep(i, 1, 2500) {\r\n\t\tmi[i][0] = 1;\r\n\t\trep(j, 1, 2500) {\r\n\t\t\tmi[i][j] = mi[i][j - 1] * i % P;\r\n\t\t}\r\n\t} \r\n\tfact[0] = 1;\r\n\trep(i, 1, 2500) {\r\n\t\tfact[i] = fact[i - 1] * i % P;\r\n\t}\r\n\tinv[2500] = ksm(fact[2500], P - 2, P);\r\n\tper(i, 1, 2499) {\r\n\t\tinv[i] = inv[i + 1] * (i + 1) % P;\r\n\t}\r\n\tdp[0][0] = 1;\r\n\r\n\tauto C = [&](int n, int m)->int {\r\n\t\tif (n < 0 || n < m) return 0;\r\n\t\treturn fact[n] * inv[m] % P * inv[n - m] % P;\r\n\t};\t \r\n \tdp[0][0] = fact[n - 1];\r\n \tfor (int i = 1; i <= n - 1; i ++ ) {\r\n \t\tfor (int j = 1; j <= k; j ++ ) {\r\n \t\t\tint t = k - j + 1;\r\n \t\t\tfor (int p = 0; p < i; p ++ ) {\r\n \t\t\t\tfor (int q = 0; q < j; q ++ ) {\r\n \t\t\t\t\tdp[i][j] += dp[p][q] * mi[k - j + 1][(i + p - 1) * (i - p) / 2] % P * inv[i - p] % P;\r\n \t\t\t\t\tdp[i][j] %= P;\r\n \t\t\t\t}\r\n \t\t\t}\r\n \t\t}\r\n \t}\r\n\tll ans = 0;\r\n\tfor (int i = 1; i <= k; i ++ ) {\r\n\t\tans += dp[n - 1][i];\r\n\t\tans %= P;\r\n\t}\r\n\tres(ans);\r\n}\t\r\n\r\nsigned main(void) {\r\n IO;\r\n\tint t;\r\n\t// cin >> t;\r\n\tt = 1;\r\n\twhile (t -- ) {\r\n\t\tsolve();\r\n\t}\r\n return 0;\r\n}\r\n", "lang": "GNU C++14", "bug_code_uid": "12b4247c32482e11ae2ea0d282b02213", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "be89377d9e552001cb52c963cef3acb4", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9779904306220095, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include\r\n#define mod 998244353\r\n#define fer(x,y,z) for(register int x=y;x<=z;x++)\r\nusing namespace std;\r\nint vl[260],c[260][260],n,K;\r\nint ksm(int x,int n){int s=1;while(n){if(n&1)s=(s*x)%mod;x=(x*x)%mod;n>>=1;}return s;}\r\nmain(){\r\n\tcin>>n>>K;c[0][0]=1;fer(i,1,255)\r\n\t{c[i][0]=1;fer(k,1,i)c[i][k]=(c[i-1][k]+c[i-1][k-1])%mod;}\r\n\t\r\n\tvl[n]=1;for(int i=K;i;i--){\r\n\t\tfer(k,2,n)fer(j,1,k-1)(vl[k-j]+=vl[k]*c[k-1][j]%mod*\r\n\t\tksm(K-i+1,(k-1)*j-(1+j)*j/2)%mod)%=mod;\r\n\t} \r\n\tcout<\r\n#include\r\n#include\r\n#include\r\n#include\r\n#include\r\n#include\r\n#include\r\n#include\r\n#include\r\n#include\r\n#include\r\n#define ll long long\r\n#define ull unsigned long long\r\n#define INF 0x3f3f3f3f\r\n#define mod 998244353\r\n#define bug(x) cout<<\"Bug \"<<(x)<'9'){if(ch=='-')w=-1;ch=getchar();}\r\n\twhile(ch>='0' && ch<='9') s=s*10+ch-'0',ch=getchar();\r\n\treturn s*w;\r\n}\r\ninline ll lread()\r\n{\r\n\tll s=0,w=1;\r\n\tchar ch=getchar();\r\n\twhile(ch<'0' || ch>'9'){if(ch=='-')w=-1;ch=getchar();}\r\n\twhile(ch>='0' && ch<='9') s=s*10+ch-'0',ch=getchar();\r\n\treturn s*w;\r\n}\r\nconst int N=260; \r\nint n,k,ans=0;\r\nint f[N][N];\r\nint C[N][N],p[N][N];\r\nint power(int a,int b)\r\n{\r\n\tint res=1;\r\n\twhile(b)\r\n\t{\r\n\t\tif(b&1) res=res*a%mod;\r\n\t\ta=a*a%mod;\r\n\t\tb>>=1;\r\n\t}\r\n\treturn res;\r\n}\r\nsigned main()\r\n{\r\n//\tfreopen(\".in\",\"r\",stdin);\r\n//\tfreopen(\".out\",\"w\",stdout);\r\n\tn=read();k=read();\r\n\tf[1][0]=1;\r\n\tfor(int i=0;i<=k;i++)\r\n\t{\r\n\t\tC[i][0]=1;\r\n\t\tp[1][i]=1;\r\n\t}\r\n\tfor(int i=1;i<=n;i++)\r\n\t{\r\n\t\tfor(int j=1;j<=i;j++)\r\n\t\t{\r\n\t\t\tC[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;\r\n\t\t}\r\n\t}\r\n\tfor(int i=2;i<=n;i++)\r\n\t{\r\n\t\tfor(int j=1;j<=k;j++)\r\n\t\t{\r\n\t\t\tfor(int t=1;t\n#include\n#include\n#include\nusing namespace std;\ntypedef long long ll;\n#define bug cout<<\"zzcAKIOI\"<>=1;\n\t}\n\treturn sum%mod;\n}\nint main(){\n\t//cout<>1;\r\n }\r\n return ans%MOD;\r\n}\r\n\r\nsigned main () {\r\n cin>>N>>K;\r\n C[0][0] = 1;\r\n for (int i=1;i<=N;i++) for (int j=0;j<=i;j++) {\r\n if (j==0) C[i][j] = 1;\r\n else C[i][j] = C[i-1][j-1]+C[i-1][j]%MOD;\r\n }\r\n dp[1][0] = 1;\r\n for (int w=1;w<=K;w++) for (int n=1;n<=N;n++) {\r\n for (int np=1;np<=n;np++) {\r\n int temp = dp[np][w-1];\r\n temp = temp*qpow(K-w+1,(np-1)*(n-np)+((n-np)*(n-np-1))/2)%MOD;\r\n temp = temp*C[N-np][n-np]%MOD;\r\n dp[n][w] += temp;\r\n dp[n][w] %= MOD;\r\n }\r\n }\r\n res = dp[N][K];\r\n cout<\r\n#include\r\n#include\r\n#include\r\n#include\r\n#include\r\n#include\r\n#include\r\n#define bug cout<<\"bug\"<>=1;\r\n\t}\r\n\treturn sum%mod;\r\n}\r\nll lucas(ll n,ll m){//n>m\r\n\tif(m==0) return 1;\r\n\tif(n>n>>k;\r\n\tfact[0]=1,infact[0]=1;\r\n\tfor(int i=1;i<=n;i++){\r\n\t\tfact[i]=fact[i-1]*i%mod;\r\n\t\tinfact[i]=infact[i-1]*power(i,mod-2)%mod;\r\n\t}\r\n\tf[0][0]=1;\r\n\tfor(int i=0;i\r\n#define ll long long\r\n#define ull unsigned ll\r\n#define f first\r\n#define s second\r\n#define pii pair\r\n#define pll pair\r\n#define pb push_back\r\n#define epb emplace_back\r\nusing namespace std;\r\n\r\nconst ll mod = 998244353 ;\r\nconst int inf = 1e9 + 1;\r\nconst ll linf = 1e18 + 1;\r\nconst int NMAX = 1e5 + 1;\r\nll logpow(ll a, ll p){\r\n if(p == 0) return 1;\r\n ll x = logpow(a, p / 2);\r\n x *= x;\r\n x %= mod;\r\n if(p & 1) x *= a, x %= mod;\r\n return x;\r\n}\r\n\r\nll fact[NMAX];\r\nvoid fil(){\r\n fact[0] = 1;\r\n for(int i = 1; i < NMAX; i++){\r\n fact[i] = fact[i - 1] * i;\r\n fact[i] %= mod;\r\n }\r\n}\r\n\r\nll modrev(ll a){\r\n return logpow(a, mod - 2);\r\n}\r\n\r\nll c(ll n, ll m){\r\n ll x = fact[n];\r\n x *= modrev(fact[m]); x %= mod;\r\n x *= modrev(fact[n - m]); x %= mod;\r\n return x;\r\n}\r\nll dp[251][251];\r\nll cc[251][251];\r\nint main(){\r\n for(int i = 0; i <= 250; i++){\r\n for(int j = 0; j <= i; j++)cc[i][j] = c(i, j);\r\n }\r\n fil();\r\n int n, k; cin >> n >> k;\r\n dp[0][0] = 1;\r\n for(int i = 0; i < n; i++){\r\n for(int j = 1; j <= k; j++){\r\n for(int l = 0; l <= i; l++){\r\n ll cur = dp[i - l][j - 1];\r\n cur *= cc[n - i + l - 1][l]; cur %= mod;\r\n ll ne = l * (i - 1); ne -= l * (l - 1) / 2;\r\n cur *= logpow(k - j + 1, ne); cur %= mod;\r\n dp[i][j] += cur;\r\n dp[i][j] %= mod;\r\n }\r\n }\r\n }\r\n cout << dp[n - 1][k];\r\n return 0;\r\n}\r\n", "lang": "GNU C++14", "bug_code_uid": "93012c7f39a9201fcef7ffb7fbda22a5", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "b382e7017782316893ae48fdf7bec988", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9952830188679245, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include\r\nusing namespace std;\r\n#define mod 998244353\r\nlong long n,k,f[259][259],c[259][259],ans;\r\ninline long long read(){\r\n char c;\r\n long long ret=0,f=1;\r\n for(c=getchar();c<'0'||c>'9';c=getchar())if(c=='-')f=-f;\r\n for(;c>='0'&&c<='9';c=getchar())ret=ret*10+c-'0';\r\n return ret*f;\r\n}\r\nlong long qpow(long long x,long long n){\r\n if(n==1)return x;\r\n if(n==0)return 1;\r\n\tlong long ans=qpow(x,n/2);\r\n\treturn ans*ans*(n%2==1?x:1);\r\n}\r\nint main(){\r\n\tn=read();\r\n k=read();\r\n c[0][0]=1;\r\n\tfor(long long i=1;i\r\n#define ll long long\r\n#define pb push_back\r\n#define pii pair\r\n#define mp make_pair\r\n#define F first\r\n#define S second\r\n#define debug(x) cerr<<#x<<\"=\"<>n>>k;\r\n\tm=n*(n-1)/2;\r\n\tfor(int i=0;i<=n;i++)\r\n\t\tC[i][i]=C[i][0]=1ll;\r\n\tfor(int i=1;i<=n;i++)\r\n\t\tfor(int j=1;j\r\n\r\ntypedef long long ll;\r\ntypedef unsigned long long ull;\r\n\r\nconst int N = 3e2+10,M = 1e6 + 10,INF = 0x3f3f3f3f,mod = 998244353;\r\n\r\nll dp[N],pw[N*N],last[N],comb[N][N];\r\n\r\nvoid solve()\r\n{\r\n int n,k;\r\n std::cin>>n>>k;\r\n dp[0] = 1;\r\n for(int i = 0 ; i < n ; i++)\r\n {\r\n comb[i][0] = comb[i][i] = 1;\r\n for(int j = 1 ; j < i ; j++)\r\n comb[i][j] = (comb[i-1][j-1] + comb[i-1][j]) % mod;\r\n }\r\n for(int w = 1 ; w <= k ; w++)\r\n {\r\n for(int i = 0 ;i < n ; i++)last[i] = dp[i],dp[i] = 0;\r\n pw[0] = 1;\r\n for(int i = 1 ; i <= n * n ; i++)pw[i] = (pw[i-1]*(k + 1 - w)) % mod;\r\n for(int i = 0 ; i < n ; i++)\r\n for(int j = 0 ; j + i < n ; j++)\r\n dp[i+j] = (dp[i+j] + comb[n - 1 - i][j] * pw[j*(j-1)/2 + i * j]* last[i]) % mod;\r\n }\r\n std::cout<>T;\r\n// while(T--)\r\n {\r\n solve();\r\n }\r\n return 0;\r\n}", "lang": "GNU C++14", "bug_code_uid": "d5672582324a2bd6610b2b214ddfdd6d", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "959d079e9df4f8fd3857f33c20d29d36", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9950549450549451, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "// LUOGU_RID: 93639568\n#include \r\n/*#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n*/\r\nusing namespace std;\r\n#define int long long\r\ntypedef long long ll;\r\ntypedef unsigned long long ull;\r\ntypedef pair pii;\r\ntypedef vector vi;\r\n#define fi first\r\n#define se second\r\n#define pb push_back\r\n#define inf 1ll<<62\r\n#define db double\r\n#define endl \"\\n\"\r\n#define max(a,b) ((a)>(b)?(a):(b))\r\n#define min(a,b) ((a)<(b)?(a):(b))\r\n#define de_bug(x) cerr << #x << \"=\" << x << endl\r\n#define all(a) a.begin(),a.end()\r\n#define IOS std::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);\r\n#define fer(i,a,b) for(int i=a;i<=b;i++)\r\n#define der(i,a,b) for(int i=a;i>=b;i--)\r\nconst int p = 1e9 + 7;\r\nconst int N = 1e6 + 10;\r\nint n, m , k;\r\ninline int qmi(int a, int b) {\r\n\tint ans = 1;\r\n\twhile (b) {\r\n\t\tif (b & 1) ans = ans * a % p;\r\n\t\ta = a * a % p;\r\n\t\tb >>= 1;\r\n\t}\r\n\treturn ans;\r\n}\r\nint dp[500][500];\r\nint sum[500][500];\r\nint C[500][500];\r\nvoid solve() {\r\n\tcin >> n >> k;\r\n\tdp[1][0] = 1;\r\n\tfor(int i = 0; i <= k; ++i) sum[1][i] = 1;\r\n\tfor(int i = 0; i <= n; ++i) C[i][0] = 1;\r\n\tfor(int i = 1; i <= n; ++i) {\r\n\t\tfor(int j = 1; j <= i; ++j) {\r\n\t\t\tC[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % p;\r\n\t\t}\r\n\t}\r\n\tfor(int i = 2; i <= n; ++i) {\r\n\t\tfor(int j = 1; j <= k; ++j) {\r\n\t\t\tfor(int t = 1; t <= i - 1; ++t) {\r\n\t\t\t\tdp[i][j] = (dp[i][j] +\r\n\t\t\t\t C[n - t][i - t] * sum[t][j - 1] % p * qmi(k - j + 1, (i - 2 + t - 1) * (i - t) / 2) % p) % p;\r\n\t\t\t}\r\n\t\t\tsum[i][j] = (sum[i][j - 1] + dp[i][j]) % p;\r\n\t\t}\r\n\t}\r\n\tint ans = 0;\r\n\tfor(int i = 1; i <= k; ++i) ans = (ans + dp[n][i]) % p;\r\n\tcout << ans << endl;\r\n\r\n}\r\nsigned main() {\r\n\tIOS;\r\n\tint _ = 1;\r\n\t//cin>>_;\r\n\twhile( _-- )\r\n\t\tsolve();\r\n\treturn 0;\r\n}\r\n\r\n\r\n\r\n\r\n", "lang": "GNU C++14", "bug_code_uid": "49a307e5cdded31ebbce07548c20aaf5", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "bdf88f287e65c819cd26938b2557d422", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9934282584884995, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include\nusing namespace std;\n#define int long long\n#define mod 998244353\n#define maxn 255\nint n,k;\nint f[maxn][maxn];\nint pre[maxn][maxn];\nint quick_pow(int x,int t){\n\tif(t==0)return 1;\n\tint ret=quick_pow(x,t/2);\n\treturn (t&1)?ret*ret%mod*x%mod:ret*ret%mod;\n}\nint c[maxn][maxn];\nsigned main(){\n\tscanf(\"%lld%lld\",&n,&k);\n\t//a[0]=1;\n//\tfor(int i=1;i<=n;i++)a[i]=a[i-1]*i%mod;\n\tf[1][0]=1;\n\tpre[1][0]=1;\n\tfor(int i=1;i<=k;i++)pre[1][i]=1;\n\tfor(int i=1;i<=n;i++){\n\t\tc[i][0]=1;\n\t\tfor(int j=1;j<=n;j++){\n\t\t\tc[i][j]=(c[i-1][j]+c[i-1][j-1])%mod;\n\t\t}\n\t}\n\tfor(int i=1;i<=n;i++){//already added\n\t\tfor(int j=1;j<=k;j++){//\n\t\t\tfor(int p=1;p\r\n#define mod 998244353 \r\nusing namespace std;\r\nlong long dp[301][301];//\u8003\u8651\u5230\u70b9i \u524d\u9762\u7684\u754c\u9650\u662f\u6700\u5c0fj\r\nbool ok[301][301];\r\nlong long inv[301];\r\nlong long c[301][301];\r\nlong long n,k;\r\nlong long C(long long a,long long b){\r\n\tlong long res=1;\r\n\tfor(long long i=a;i>=a-b+1;i--)res=(res*i)%mod;\r\n\tfor(long long i=1;i<=b;i++)res=(res*inv[i])%mod;\r\n\treturn res;\r\n}\r\nlong long Qpow(long long a,long long b){\r\n\tlong long base=a;\r\n\tlong long ans=1;\r\n\twhile(b){\r\n\t\tif(b&1)ans=(ans*base)%mod;\r\n\t\tbase=(base*base)%mod;\r\n\t\tb>>=1;\r\n\t}\r\n\treturn ans;\r\n}\r\nlong long dfs(long long i,long long j){\r\n\tif(i==n)return 1;\r\n\tif(j==k+1)return 0;\r\n\tlong long ans=0;\r\n\tif(ok[i][j])return dp[i][j];\r\n\tok[i][j]=1;\r\n //(k-j+1)^(i-1 + i + i+1 +...+ i+p-2) * C(n-i,p) * dp(i+p,j+1)\r\n\tfor(long long p=0;p+i<=n;p++){\r\n\t\tans=(ans+Qpow(k-j+1,(2*i+p-3)*p/2)*c[n-i][p]%mod*dfs(i+p,j+1))%mod;\r\n\t}\r\n\treturn dp[i][j]=ans;\r\n}\r\nint main(){\r\n\tfor(long long i=1;i<=271;i++)inv[i]=Qpow(i,mod-2);\r\n\tfor(int i=1;i<=271;i++){\r\n\t\tfor(int j=1;j<=251;j++)c[i][j]=C(i,j);\r\n\t}\r\n\tcin>>n>>k;\r\n\tcout<\r\n#include\r\n#define ll long long\r\nusing namespace std;\r\nnamespace Ehnaev{\r\n inline ll read() {\r\n ll ret=0,f=1;char ch=getchar();\r\n while(ch<48||ch>57) {if(ch==45) f=-f;ch=getchar();}\r\n while(ch>=48&&ch<=57) {ret=(ret<<3)+(ret<<1)+ch-48;ch=getchar();}\r\n return ret*f;\r\n }\r\n inline void write(ll x) {\r\n static char buf[22];static ll len=-1;\r\n if(x>=0) {do{buf[++len]=x%10+48;x/=10;}while(x);}\r\n else {putchar(45);do{buf[++len]=-(x%10)+48;x/=10;}while(x);}\r\n while(len>=0) putchar(buf[len--]);\r\n }\r\n}using Ehnaev::read;using Ehnaev::write;\r\n\r\nconst ll N=3e2,mo=998244353;\r\n\r\nll n,k;\r\nll comb[N+5][N+5],c[N+5][N+5],f[N+5][N+5];\r\n\r\ninline ll Pow(ll b,ll p) {\r\n ll res=1;while(p) {if(p&1) res=res*b%mo;b=b*b%mo;p>>=1;}return res;\r\n}\r\n\r\ninline void Init() {\r\n for(ll i=0;i<=n||i<=k;i++) {\r\n comb[i][0]=1;\r\n for(ll j=1;j<=i;j++) {\r\n comb[i][j]=(comb[i-1][j]+comb[i-1][j-1])%mo;\r\n }\r\n }\r\n}\r\n\r\nint main() {\r\n\r\n n=read();k=read();\r\n\r\n Init();\r\n\r\n f[1][0]=1;\r\n for(ll i=0;i<=k;i++) c[1][i]=1;\r\n for(ll i=2;i<=n;i++) {\r\n for(ll j=1;j<=k;j++) {\r\n for(ll p=1;p\r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#define int long long\r\n\r\nint read(){\r\n\tint x=0,f=1;char ch=getchar();\r\n\twhile(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}\r\n\twhile(ch>='0'&&ch<='9')x=(x<<1)+(x<<3)+(ch^48),ch=getchar();\r\n\treturn x*f;\r\n}\r\n\r\nconst int N=1e6+5;\r\nint n,m,sum[N];\r\nbool vis[N*20],usd[N*20];\r\n \r\nsigned main(void){\r\n n=read(),m=read();\r\n\tfor(int i=1;i<=20;i++){\r\n\t\tsum[i]=sum[i-1];\r\n\t\tfor(int j=1;j<=m;j++){\r\n\t\t\tif(!vis[i*j])vis[i*j]=1,sum[i]++;\r\n\t\t}\r\n//\t\tprintf(\"%lld %lld\\n\",i,sum[i]);\r\n\t} \r\n\tint ans=0;\r\n\tfor(int i=2;i<=n;i++){\r\n\t\tif(usd[i])continue;\r\n\t\tint res=1;\r\n\t\tfor(int j=i*i;j<=n;j*=i)res+=1,usd[j]=1;\r\n\t\tans+=sum[res];\r\n//\t\tprintf(\"%lld %lld %lld\\n\",i,res,sum[res]);\r\n\t}\r\n\tprintf(\"%lld\\n\",ans+1);\r\n\treturn 0;\r\n}\r\n\r\n", "lang": "GNU C++14", "bug_code_uid": "839672231942840363fdb412d5d9a1c0", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "47caab0133c12d87c36fdfe18c1c0784", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.8005445881552076, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "#include\r\nusing namespace std;\r\nconst int N=250,mod=998244353;\r\nint jc[N+5],dp[N+5][N+5];\r\nint ksm(int ds,int zs){\r\n\tint ans=1;\r\n\tfor(;zs;zs>>=1,ds=1ll*ds*ds%mod){\r\n\t\tif(zs&1) ans=1ll*ans*ds%mod;\r\n\t}\r\n\treturn ans;\r\n}\r\nint ny(int x){\r\n\treturn ksm(x,mod-2);\r\n}\r\nint dc(int s,int e){\r\n\treturn 1ll*(s+e)*(e-s+1)/2%mod;\r\n}\r\nint main(){\r\n\tint n,m;\r\n\tjc[0]=1;\r\n\tfor(int i=1;i<=N;i++){\r\n\t\tjc[i]=1ll*jc[i-1]*i%mod;\r\n\t}\r\n\tscanf(\"%d%d\",&n,&m);\r\n\tdp[1][0]=1;\r\n\tfor(int i=1;i<=m;i++){\r\n\t\tfor(int j=1;j<=n;j++){\r\n\t\t\tdp[j][i]=dp[j][i-1];\r\n\t\t\tprintf(\"{\");\r\n\t\t\tfor(int k=1;k\r\nusing namespace std;\r\n#define int long long \r\n#define x first\r\n#define y second\r\ntypedef pairPII;\r\n#define debug printf(\"debug\\n\");\r\n\r\nconst int N = 5e5 + 10, INF = 0x3f3f3f3f, mod = 998244353;\r\nint t;\r\nint f[N], C[300][300],pow1[N], dp[N];\r\n\r\nvoid solve()\r\n{\r\n\tint n, k;\r\n\tcin >> n >> k;\r\n\r\n\tf[0] = 1;\r\n\tfor(int i = 0; i <= n; i ++ )\r\n\t{\r\n\t\tC[i][i] = C[i][0] = 1;\r\n\t\tfor(int j = 1; j < i; j ++ )\r\n\t\t\tC[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % mod;\r\n\t}\r\n\tfor(int w = 1; w <= k; w ++ )\r\n\t{\r\n\t\tfor(int i = 0; i < n; i ++ ) dp[i] = f[i], f[i] = 0;\r\n\t\tpow1[0] = 1;\r\n\t\tfor(int i = 1; i <= n * n; i ++ ) pow1[i] = pow1[i - 1] * (k - w + 1) % mod;\r\n\r\n\t\tfor(int i = 0; i < n; i ++ )\r\n\t\t\tfor(int j = 0; j < n; j ++) \r\n\t\t\t\tif(i + j <= n - 1)\r\n\t\t\t\tf[i + j] = (f[i + j] + dp[i] * C[n - i - 1][j] * pow1[i * j + j * (j - 1) / 2] ) % mod; \r\n\t}\r\n\tcout << f[n - 1] << '\\n';\r\n}\r\n\r\nsigned main()\r\n{\r\n\tios::sync_with_stdio(false), cin.tie(0), cout.tie(0);\r\n\t//cin >> t;\r\n\t\tsolve();\r\n}\r\n", "lang": "GNU C++14", "bug_code_uid": "ba9c1993d7c64edbebb2ff019280ca7a", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "213fa96ef1c56509cd62f9fdd9d36892", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9789517127527858, "equal_cnt": 8, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "// LUOGU_RID: 94038976\n#include\r\n#include\r\n#include\r\n#include\r\n#include\r\n#include\r\n\r\nusing namespace std;\r\n\r\n#define ll long long\r\nconst int N = 255;\r\nconst int mod = 998244353;\r\n\r\nll dp[N][N],sum[N][N];\r\nint n,k;\r\n\r\nll get_pow(ll a, ll b) {\r\n\tll c = 1;\r\n\twhile(b) {\r\n\t\tif(b & 1) c = c * a % mod;\r\n\t\ta = a * a % mod; b >>= 1;\r\n\t}\r\n\treturn c;\r\n}\r\nint C[N][N];\r\n\r\nint main() {\r\n\tcin >> n >> k;\r\n\tdp[1][0] = 1; \r\n\tfor(int i = 0; i <= n; i ++ ) C[i][0] = sum[1][i] = 1;\r\n\tfor(int i = 1; i <= n; i ++ )\r\n\t\tfor(int j = 1; j <= i; j ++ )\r\n\t\t\tC[i][j] = (C[i-1][j] + C[i-1][j-1])%mod;\r\n\tfor(int i = 2; i <= n; i ++ ) {\r\n\t\tfor(int j = 1; j <= k; j ++ ) {\r\n\t\t\tfor(int t = 1; t < i; t ++ )\r\n\t\t\t\tdp[i][j] = (dp[i][j] + sum[t][j-1] * C[n-t][i-t] % mod * get_pow(k-j+1, (i+t-3)*(i-t)/2)%mod)%mod;\r\n\t\t\t\tsum[i][j] = (sum[i][j-1]+dp[i][j])%mod;\r\n\t\t}\r\n\t}\t\t\r\n/*\tfor(int i = 1; i <= n; i ++ ){\r\n\t\tfor(int j = 0; j <= k; j ++ )\r\n\t\t\tcout << dp[i][j] << \" \";\r\n\t\tcout << endl;\r\n\t}\r\n\tcout << endl << \"sum :: \" << endl;\r\n\tfor(int i = 1; i <= n; i ++ ) {\r\n\t\tfor(int j = 0; j <= k; j ++ )\r\n\t\t\tcout << sum[i][j] << \" \";\r\n\t\tcout << endl;\r\n\t}*/\r\n\tcout << sum[n][k]%mod;\r\n}\r\n", "lang": "GNU C++14", "bug_code_uid": "9f867faccf6336c3fb976c5161c056e9", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "8172bfb726df144996f883f493748bf6", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "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\r\nusing namespace std;\r\ntypedef long long ll;\r\nint n,k;\r\nconst int maxn = 255;\r\nll f[maxn][maxn];\r\nll sum[maxn][maxn];\r\nconst int mod = 998244353;\r\nll get(ll p,ll i)\r\n{\r\n return ((i-p) * (i-p-1) /2 %mod + (i-p) * (p-1) %mod)%mod; \r\n}\r\n\r\nll c[maxn][maxn];\r\nll C(ll n,ll m)\r\n{\r\n if(n>m) return 0;\r\n if(c[n][m]) return c[n][m];\r\n if(n==0 || m==n) return 1;\r\n return c[n][m]=(C(n-1,m-1) + C(n,m-1));\r\n}\r\nll qpow(ll a,ll b)\r\n{\r\n ll ans=1;\r\n for(;b;b>>=1,a=a*a%mod) if(b&1) ans = ans *a%mod;\r\n return ans;\r\n}\r\nint main()\r\n{\r\n cin >> n >> k;\r\n f[1][0]=1;\r\n for(int i=0;i<=k;i++) sum[1][i]=1;\r\n for(int i=2;i<=n;i++)\r\n {\r\n for(int j=1;j<=k;j++)\r\n {\r\n for(int p=1;p<=i-1;p++)\r\n {\r\n f[i][j] += C(i-p,n-p) * qpow((k-j+1),get(p,i)) %mod * sum[p][j-1]%mod;\r\n f[i][j]%=mod;\r\n }\r\n }\r\n for(int j=1;j<=k;j++)\r\n {\r\n sum[i][j] = sum[i][j-1] + f[i][j]; \r\n sum[i][j]%=mod;\r\n }\r\n }\r\n ll ans=0;\r\n for(int i=1;i<=k;i++) ans += f[n][i],ans%=mod;\r\n cout << ans;\r\n\r\n}", "lang": "GNU C++14", "bug_code_uid": "41c03802099d31fda2e7b8d04727be62", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "60acd30ed2fb1ecdb7f4a00a8512a980", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9972055888223553, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include \r\nusing namespace std;\r\n\r\n#define LL long long\r\n\r\nconst LL MOD = 998244353;\r\nLL inv[251], fact[251], finv[251];\r\nLL dp[251][251];\r\nint n, k;\r\n\r\nvoid init() {\r\n inv[1] = fact[0] = fact[1] = finv[0] = finv[1] = 1;\r\n for (int i = 2;i <= 250;++i) {\r\n inv[i] = ((-(MOD / i) * inv[MOD % i]) % MOD + MOD) % MOD;\r\n fact[i] = fact[i - 1] * i % MOD;\r\n finv[i] = finv[i - 1] * inv[i] % MOD;\r\n }\r\n}\r\n\r\nLL C(int n, int m) {\r\n if (m < 0 || m>n) return 0;\r\n return fact[n] * finv[m] % MOD * finv[n - m] % MOD;\r\n}\r\n\r\nLL qpow(LL b, LL n) {\r\n LL x = 1, Power = b % MOD;\r\n while (n) {\r\n if (n & 1) x = x * Power % MOD;\r\n Power = Power * Power % MOD;\r\n n >>= 1;\r\n }\r\n return x;\r\n}\r\n\r\nint main() {\r\n init();\r\n cin >> n >> k;\r\n dp[0][0] = 1;\r\n for (int i = 0;i <= n;++i) {\r\n for (int j = 0;j <= k;++j) {\r\n for (int t = 0;t <= n - i;++t) {\r\n LL e = t * (t - 1) / 2 + t * i;\r\n LL temp = dp[i][j] * C(n - i - 1, t) % MOD * qpow(k - j, e) % MOD;\r\n dp[i + t][j + 1] = (dp[i + t][j + 1] + temp) % MOD;\r\n }\r\n }\r\n }\r\n LL ans = dp[n - 1][k];\r\n printf(\"%I64d\\n\", ans);\r\n\r\n return 0;\r\n}", "lang": "GNU C++14", "bug_code_uid": "de8c61e2e4055fd059696a922020bd7b", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "635d976c05b20190c5b8a5df1436d8fa", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9794188861985472, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "#include \r\nusing namespace std;\r\nconst int mod=998244353,N=305;\r\nint n,k;\r\nint f[N][N],g[N][N],c[N][N];\r\ninline int qpow(int x,int y){\r\n\tint sum=1;\r\n\twhile(y){\r\n\t\tif(y&1)sum=1ll*sum*x%mod;\r\n\t\tx=1ll*x*x%mod,y>>=1;\r\n\t}\r\n\treturn sum;\r\n}\r\nsigned main(){\r\n\tstd::ios::sync_with_stdio(false);\r\n\tcin.tie(0),cout.tie(0);\r\n\tcin>>n>>k;\r\n\tf[1][0]=1;\r\n\tfill(g[1],g[1]+k+1,1);\r\n\tfor(int i=0;i<=n;++i)c[i][0]=1;\r\n\tfor(int i=1;i<=n;++i){\r\n\t\tfor(int j=1;j<=i;++j){\r\n\t\t\tc[i][j]=(1ll*c[i-1][j-1]+c[i-1][j])%mod;\r\n\t\t}\r\n\t}\r\n\tfor(int i=2;i<=n;++i){\r\n\t\tfor(int j=1;j<=k;++j){\r\n\t\t\tfor(int l=1;l<=i-1;++l)f[i][j]=(1ll*c[n-l][i-l]*g[l][j-1]%mod*qpow(k-j+1,1ll*(i-2+l-1)*(i-l)/2)%mod)%mod;\r\n\t\t\tg[i][j]=(g[i][j-1]+f[i][j])%mod;\r\n\t\t}\r\n\t}\r\n\tint ans=0;\r\n\tfor(int i=1;i<=k;++i)ans=(ans+f[n][i])%mod;\r\n\tcout<\r\nusing namespace std;\r\ntypedef long long ll;\r\nconst int mod=998244353;\r\nint f[255][255],n,k,c[255][255];\r\nint power(int a,int b)\r\n{\r\n\tint res=1;\r\n\tfor(;b;b>>=1)\r\n\t{\r\n\t\tif(b&1)res=1ll*res*a%mod;\r\n\t\ta=1ll*a*a%mod;\r\n\t}\r\n\treturn res;\r\n}\r\nint main()\r\n{\r\n\tscanf(\"%d %d\",&n,&k);\r\n\tc[0][0]=1;\r\n\tf[0][0]=1;\r\n\tfor(int i=1;i<=250;i++)for(int j=1;j<=i;j++)c[i][j]=c[i-1][j-1]+c[i-1][j];\r\n\tfor(int i=1;i\r\nusing namespace std;\r\nconst int N=255;\r\nconst int mod=998244353;\r\nlong long f[N][N];\r\nlong long ff[N];\r\nlong long ksm(long long a,long long b){\r\n\tif(b==0) return 1;\r\n\tif(b==1) return a%mod;\r\n\tlong long ans=ksm(a,b/2)%mod;\r\n\tans=ans*ans%mod;\r\n\tif(b%2) ans=ans*a%mod;\r\n\treturn ans;\r\n}\r\nlong long inv(long long t){\r\n\treturn ksm(t,mod-2);\r\n}\r\nlong long c(long long x,long long y){\r\n\treturn ff[x]*inv(ff[x-y])%mod*inv(ff[y])%mod;\r\n}\r\nint n,k;\r\nint main(){\r\n\tcin>>n>>k;\r\n\tff[0]=1;\r\n\tfor(int i=1;i<=n;i++){\r\n\t\tff[i]=ff[i-1]*i%mod;\r\n\t}\r\n\tf[0][0]=1;\r\n\tfor(int i=0;i\r\n#define int long long\r\nusing namespace std;\r\nconst int mod=998244353,N=505;\r\nint n,m,c[N][N],f[N][N],s[N][N],ans;\r\ninline int pw(int a,int b){\r\n int sum=1;\r\n while(b){\r\n if(b&1)sum=sum*a%mod;\r\n a=a*a%mod;\r\n b>>=1;\r\n }\r\n return sum;\r\n}\r\nsigned main(){\r\n ios::sync_with_stdio(false);\r\n cin.tie(0),cout.tie(0);\r\n cin>>n>>m;\r\n for(int i=0;i<=n;i++)c[i][0]=1;\r\n for(int i=1;i<=n;i++){\r\n for(int j=1;j<=i;j++){\r\n c[i][j]=(c[i-1][j]+c[i-1][j-1])%mod;\r\n }\r\n }\r\n f[1][0]=1;\r\n for(int i=0;i<=m;i++)s[1][i]=1;\r\n for(int i=2;i<=n;i++){\r\n for(int j=1;j<=m;j++){\r\n for(int k=1;k\r\nusing namespace std;\r\n#define maxn 260\r\nint n,k;\r\nconst long long mod=998244353;\r\nlong long dp[maxn][maxn],fac[maxn],inv[maxn];\r\nlong long fp(long long a,int b){\r\n\tlong long sum=1;\r\n\twhile(b){\r\n\t\tif(b&1){\r\n\t\t\tsum=sum*a%mod;\r\n\t\t}\r\n\t\ta=a*a%mod;\r\n\t\tb>>=1;\r\n\t}\r\n\treturn sum;\r\n}\r\ninline int read(){\r\n\tint sum=0,fh=1;\r\n\tchar c=getchar();\r\n\twhile(c>'9'||c<'0'){\r\n\t\tif(c=='-')fh=-1;\r\n\t\tc=getchar();\r\n\t}\r\n\twhile(c>='0'&&c<='9'){\r\n\t\tsum*=10;\r\n\t\tsum+=c-'0';\r\n\t\tc=getchar();\r\n\t}\r\n\treturn sum*fh;\r\n}\r\nlong long c(int a,int b){\r\n\treturn fac[a]*inv[a-b]%mod*inv[b]%mod;\r\n}\r\nint main(){\r\n// freopen(\".in\",\"r\",stdin);\r\n// freopen(\".out\",\"w\",stdout);\r\n\tn=read();k=read();fac[0]=1;\r\n\tfor(int i=1;i<=n;i++){\r\n\t\tfac[i]=fac[i-1]*i%mod;\r\n\t}\r\n\tinv[n]=fp(fac[n],mod-2);\r\n\tfor(int i=n;i;i--){\r\n\t\tinv[i-1]=inv[i]*i%mod;\r\n\t}\r\n\tdp[k+1][n-1]=1;\r\n\tlong long ans=0;\r\n\tfor(int i=k;i;i--){\r\n\t\tfor(int j=n-1;j;j--){\r\n\t\t\tfor(int o=0;o<=j;o++){\r\n\t\t\t\tdp[i][j-o]+=dp[i+1][j]*c(j,o)%mod*fp(k-i+1,o*(j-o)+(o*(o-1)/2))%mod;\r\n\t\t\t\tdp[i][j-o]%mod;\r\n\t\t\t}\r\n\t\t}\r\n//\t\tfor(int j=n;j;j--){\r\n//\t\t\tcout<\r\nusing namespace std;\r\nconst int mod=998244353;\r\nint qpow(int a,int p){\r\n\tint ans=1;\r\n\twhile(p){\r\n\t\tif(p&1) ans=(1ll*ans*a)%mod;\r\n\t\ta=(1ll*a*a)%mod;\r\n\t\tp>>=1;\r\n\t}\r\n\treturn ans;\r\n}\r\nint C[255][255];\r\nint f[255][255];//\u5df2\u7ecf\u5904\u7406\u4e86i\u4e2a\u70b9\u6700\u5927\u8fb9\u6743\u4f4dj \r\nint n,k;\r\nint main(){\r\n\tcin>>n>>k;\r\n\tC[0][0]=1;\r\n\tfor(int i=1;i<=250;i++){\r\n\t\tC[i][0]=1;\r\n\t\tfor(int j=1;j<=i;j++){\r\n\t\t\tC[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;\r\n\t\t}\r\n\t}\r\n\tf[0][0]=1;\r\n\tfor(int i=1;i<=k;i++){\r\n\t\tfor(int j=0;j\r\n//#pragma GCC optimize(3)\r\n#define endl \"\\n\"\r\n#define int long long\r\n#define pii pair\r\n#define pll pair\r\n#define fi first\r\n#define sc second\r\nusing namespace std;\r\ntypedef long long ll;\r\ntypedef unsigned long long ull;\r\nconst int inf32 = 0x3f3f3f3f;\r\nconst ll inf64 = 0x3f3f3f3f3f3f3f3f;\r\nconst double pi = acos(-1),eps = 1e-7;\r\nmt19937 rnd(time(0));\r\nconst int maxn = 250+10,maxm = 10010,mod = 998244353;\r\n\r\nint n,k;\r\nint fact[maxn],invfact[maxn];\r\nint binpow(int a,int k){\r\n int res = 1;\r\n while(k){\r\n if(k&1) res = res*a%mod;\r\n a = a*a%mod;\r\n k >>= 1;\r\n }\r\n return res;\r\n}\r\nvoid init(int n){\r\n fact[0] = invfact[0] = 1;\r\n for(int i = 1;i <= n;i++){\r\n fact[i] = fact[i-1]*i%mod;\r\n invfact[i] = binpow(fact[i],mod-2);\r\n }\r\n}\r\nint C(int a,int b){\r\n if(b > a) return 0;\r\n return fact[a]*invfact[b]%mod*invfact[a-b]%mod;\r\n}\r\nint f[maxn][maxn];\r\nint pre[maxn][maxn];\r\nint solve(){\r\n init(250);\r\n f[1][0] = 1;\r\n for(int i = 0;i <= k;i++){\r\n pre[1][i] = 1;\r\n }\r\n for(int i = 2;i <= n;i++){\r\n for(int j = 1;j <= k;j++){\r\n for(int t = 1;t < i;t++){\r\n f[i][j] = (f[i][j]+\r\n pre[t][j-1]*C(n-t,i-t)%mod*binpow(k-j+1,(i+t-3)*(i-t)/2)%mod)%mod;\r\n }\r\n pre[i][j] = (pre[i][j-1] + f[i][j])%mod; \r\n }\r\n }\r\n int res = 0;\r\n for(int i = 1;i <= k;i++){\r\n res = (res+f[n][k])%mod;\r\n }\r\n return res;\r\n}\r\n\r\nsigned main(){\r\n ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);\r\n\t//freopen(\"in.in\",\"r\",stdin);\r\n //freopen(\"out.out\",\"w\",stdout);\r\n cin>>n>>k;\r\n cout<\r\nusing namespace std;\r\n#define f(i, a, b) for(long long i = a; i <= b; i++)\r\n#define mod9 998244353\r\n#define mod1 1000000007\r\ntypedef long long ll;\r\ntypedef unsigned long long ull;\r\ntypedef long double ld;\r\ntypedef pair pii;\r\ntypedef pair pll;\r\n#define endl '\\n'\r\nll n, w;\r\nll dp[255][255], c[255][255];\r\nll qpow(ll x, ll k) {\r\n\tll ans = 1;\r\n\twhile(k > 0) {\r\n\t\tif(k & 1) ans = ans * x % mod9;\r\n\t\tx = x * x % mod9;\r\n\t\tk >>= 1;\r\n\t}\r\n\treturn ans;\r\n}\r\nint main(){\r\n\tios::sync_with_stdio(0);\r\n\tcin.tie(NULL);\r\n\tcout.tie(NULL);\r\n cin >> n >> w;\r\n f(i, 0, 251) {\r\n \tc[i][0] = 1;\r\n\t\tf(j, 1, i) {c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % mod9;}\r\n\t}\r\n f(i, 0, w) dp[i][0] = 1;\r\n f(i, 0, w) f(j, 0, n-1) f(k, 0, n - j)\r\n\t{\r\n\t\tif(j==0 && k==0)\r\n\t\t\tcontinue;\r\n \tll up = k * (k - 1) / 2 + j* k;\r\n\t\tdp[i + 1][j + k]=(dp[i + 1][j + k] + ((dp[i][j] * c[n - j-1][k]) % mod9 * qpow(w-i, up)) % mod9) % mod9;\r\n\t}\r\n\tfor(int i=0;i<=w;i++)\r\n\t{\r\n\t\tfor(int j=0;j<=n-1;j++)\r\n\t\t\tcout <\r\n#pragma GCC optimize (\"Ofast\", \"unroll-loops\")\r\nusing namespace std;\r\n#define ll long long\r\n#define int ll\r\n#define FOR(i,a,b) for (int i = (a); i<(b); i++)\r\n#define REP(i,n) FOR(i,0,n)\r\n#define REP1(i,n) FOR(i,1,n+1)\r\n#define RREP(i,n) for (int i=(n)-1; i>=0; i--)\r\n#define f first\r\n#define s second\r\n#define pb push_back\r\n#define ALL(x) x.begin(),x.end()\r\n#define SZ(x) (int)(x.size())\r\n#define SQ(x) (x)*(x)\r\n#define pii pair\r\n#define pdd pair\r\n#define pcc pair \r\n#define endl '\\n'\r\n//#define TOAD\r\n#ifdef TOAD\r\n#define bug(x) cerr<<__LINE__<<\": \"<<#x<<\" is \"<0){\r\n if (p&1){\r\n ret*=x;\r\n ret%=m;\r\n }\r\n x*=x;\r\n x%=m;\r\n p>>=1;\r\n }\r\n return ret;\r\n}\r\n\r\nll inv(ll a, ll m=mod){\r\n return pw(a,m-2);\r\n}\r\n\r\n//=======================================================================================\r\n\r\nint dp[maxn][maxn];\r\nint pf[maxn][maxn];\r\nint fac[maxn];\r\nsigned main (){\r\n IOS();\r\n int n,K; cin>>n>>K;\r\n n--;\r\n fac[0]=1;\r\n REP1(i,maxn-1){\r\n fac[i]=fac[i-1]*i;\r\n fac[i]%=mod;\r\n }\r\n REP1(i,n){\r\n if (i==1){\r\n REP1(j,K){\r\n dp[i][j]=1;\r\n pf[i][j]=pf[i][j-1]+1;\r\n }\r\n }\r\n else {\r\n REP1(k, K){\r\n REP(j, i){\r\n if (j==0) {\r\n dp[i][k]+=inv(fac[i-j]);\r\n }\r\n else {\r\n dp[i][k]+=pf[j][k-1]*inv(fac[i-j])%mod;\r\n dp[i][k]%=mod;\r\n }\r\n }\r\n dp[i][k]*=pw(K-k+1, i-1);\r\n dp[i][k]%=mod;\r\n pf[i][k]=pf[i][k-1]+dp[i][k];\r\n pf[i][k]%=mod;\r\n }\r\n }\r\n }\r\n int ans=pf[n][K]%mod*fac[n];\r\n ans%=mod;\r\n cout<\nusing namespace std;\n#ifndef ONLINE_JUDGE\n#define dbg(x...) do { cout << \"\\033[33;1m \" << #x << \" -> \"; err(x); } while (0)\nvoid err() { cout << \"\\033[39;0m\" << endl; }\ntemplate class T, typename t, typename... A>\nvoid err(T a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }\ntemplate\nvoid err(T a, A... x) { cout << a << ' '; err(x...); }\n#else\n#define dbg(...)\n#endif\n#define clr(a, x) memset(a, x, sizeof(a))\n#define PII pair\n#define PLL pair\n#define VI vector\n#define VL vector\n#define mp make_pair\n#define pb push_back\n#define eb emplace_back\n#define fi first\n#define se second\n#define all(x) (x).begin(), (x).end()\n#define fastio \\\n ios_base::sync_with_stdio(0); \\\n cin.tie(0);cout.tie(0);\ntypedef long long ll;\ntypedef long double ld;\nconst int INF = 0x3f3f3f3f;\nconst long long LLINF = 1e18;\nconst int MAXN = 3e5 + 10;\nconst int mod = 998244353;\n\nll f[1000];\nll inv[1000]; \nll Pow(ll a, ll n, ll m) {\n ll t = 1;\n for (; n; n >>= 1, a = (a * a % m))\n if (n & 1) t = (t * a % m);\n return t;\n}\nvoid CalFact() {\n inv[0] = 1;\n f[0] = 1;\n for (int i = 1; i < 200; i++)\n f[i] = (f[i - 1] * i) % mod, inv[i] = Pow(f[i], mod - 2, mod);\n}\nll C(int n, int m) { return f[n] * inv[m] % mod * inv[n - m] % mod; }\n\nll dp[300][300];\n\nint main() {\n int n, k;\n cin >> n >> k;\n CalFact();\n for (int i = 0; i <= k; ++i) {\n dp[0][i] = 1;\n }\n \n for (int i = 1; i <= n - 1; ++i) {\n for (int j = 0; j < i; ++j) {\n for (int q = (j == 0 ? 1 : 2); q <= k; ++q) {\n dp[i][q] += dp[j][q - 1] * C(n - 1 - j, i - j) % mod * Pow(k - q + 1, j * (i - j) + (i - j) * (i - j - 1) / 2, mod) % mod;\n dp[i][q] %= mod;\n }\n }\n for (int q = 1; q <= k; ++q) {\n dp[i][q] += dp[i][q - 1];\n dp[i][q] %= mod;\n }\n }\n cout << dp[n - 1][k] << \"\\n\";\n}", "lang": "GNU C++14", "bug_code_uid": "d2ec815a98e93dfb13d452840f2a74ce", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "ff11ff035b14faa814cf8e2c15b3c349", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9939927913496196, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include\r\nusing namespace std;\r\nint rd(){\r\n\tint s=0,fu=1; static char c;\r\n while(c=getchar(),c<48&&c!='-');\r\n if(c=='-') fu=-1,c=getchar();\r\n do s=(s<<1)+(s<<3)+(c^48);\r\n while(c=getchar(),c>47);\r\n return s*fu;\r\n}\r\nvoid write(signed val){printf(\"%d\",val);}\r\nvoid write(long long val){printf(\"%lld\",val);}\r\nvoid write(char val){printf(\"%c\",val);}\r\nvoid write(const char* &val){printf(\"%s\",val);}\r\ntemplate\r\nvoid write(T val,Args... args){write(val);write(args...);}\r\ntemplate\r\nvoid writeln(Args... args){write(args...);puts(\"\");}\r\nint n,k;\r\nint dp[255][255],coef,c[255][255];\r\n#define MOD 998244353\r\nint pwr(int a,int b){\r\n\tint ans=1;\r\n\twhile(b){\r\n\t\tif(b&1) ans=(ans*1LL*a)%MOD;\r\n\t\ta=(a*1LL*a)%MOD;\r\n\t\tb>>=1;\r\n\t}\r\n\treturn ans;\r\n}\r\nint main(){\r\n\tcin>>n>>k;\r\n\tn=250;k=250;\r\n\tc[0][0]=1;\r\n\tfor(int i=1;i<=250;i++){\r\n\t\tc[i][0]=c[i][i]=1;\r\n\t\tfor(int j=1;j\r\nusing namespace std;\r\n#define ll long long\r\nconst int w=1e5+5;\r\nconst int mod=998244353;\r\nll quick(ll x,ll y)\r\n{\r\n ll ans=1;\r\n while(y)\r\n {\r\n if(y&1)\r\n ans=ans*x%mod;\r\n x=x*x%mod;\r\n y/=2;\r\n }\r\n return ans;\r\n}\r\nll pre[w],ni[w];\r\nll C(ll x,ll y)\r\n{\r\n return pre[x]*ni[y]%mod*ni[x-y]%mod;\r\n}\r\nll dp[205][205];\r\nint main()\r\n{\r\n int i,j;\r\n ll n,k;\r\n cin>>n>>k;\r\n pre[0]=1;\r\n for(i=1;i=0;i--)\r\n ni[i]=ni[i+1]*(i+1)%mod;\r\n dp[0][0]=1;\r\n for(i=1;i<=k;i++)\r\n {\r\n for(j=0;j\r\nusing namespace std;\r\n#define endl \"\\n\"\r\n#define fo(i,s,e) for( i=s;ie;i--)\r\n#define lli long long int\r\nconst lli MOD=998244353;\r\n#define pb push_back\r\n#define pob pop_back()\r\n#define sp \" \"\r\n#define ff first\r\n#define ss second\r\n#define TIME cerr<<\"Time Taken:\"<<(float)clock()/CLOCKS_PER_SEC*1000<<\"ms\"<>t;\r\n while(t>=testcases)\r\n {\r\n lli n,k;\r\n cin>>n>>k;\r\n lli dp[n+1][k+1];\r\n memset(dp,0,sizeof(dp));\r\n for(lli i=0;i<=k;i++)\r\n dp[0][i]=1;\r\n for(lli i=1;i<=k;i++)\r\n dp[1][i]=1;\r\n for(lli i=2;i\r\n#define MAXN 2505\r\ntypedef long long ll;\r\nconst ll mod = 998244353;\r\nusing namespace std;\r\n\r\nint n,w;\r\nll f[MAXN][MAXN],jc[MAXN],inv[MAXN];\r\nll poww(ll x , int y){\r\n\tll zz = 1;\r\n\twhile(y){\r\n\t\tif(y & 1)zz = zz * x % mod;\r\n\t\tx = x * x % mod;\r\n\t\ty = y >> 1;\r\n\t}\r\n\treturn zz;\r\n}\r\n\r\nll C(int a , int b){\r\n\treturn jc[a] * inv[b] % mod * inv[a - b] % mod;\r\n}\r\n\r\nint main(){\r\n\tf[0][0] = 1;\r\n\tjc[0] = 1;for(int i = 1 ; i <= 2500 ; i++)jc[i] = jc[i - 1] * i % mod;\r\n\tfor(int i = 0 ; i <= 2500 ; i++)inv[i] = poww(jc[i] , mod - 2);\r\n\tscanf(\"%d%d\" , &n , &w);\r\n\tfor(int i = 0 ; i < n ; i++){\r\n\t\tfor(int j = 1 ; j <= w ; j++){\r\n\t\t\tfor(int k = 0 ; i + k < n ; k++){\r\n\t\t\t\tll zz = f[i][j - 1];\r\n\t\t\t\tll zz2 = poww(w - j + 1 , i * k + k * (k - 1) / 2) * C(n - 1 - i , k);\r\n\t\t\t\tf[i + k][j] = (f[i + k][j] + zz * zz2 % mod) % mod;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tcout<\r\n#define int long long\r\nusing namespace std;\r\nconst int N = 255;\r\nconst int mod = 998244353;\r\nint dp[N][N];\r\nint n,k;\r\n\r\nint quick(int a,int p){\r\n int ans = 1;\r\n for(;p;p>>=1,a = a*a%mod){\r\n if(p&1) ans = ans*a%mod;\r\n }\r\n return ans;\r\n}\r\nint fact[N],fact_n[N];\r\nint inverse(int a){\r\n return quick(a,mod-2);\r\n}\r\nvoid init(int n){\r\n fact[0] = 1;\r\n fact_n[0] = inverse(1);\r\n for(int i = 1;i<=n;i++){\r\n fact[i] = fact[i-1]*i%mod;\r\n fact_n[i] = inverse(fact[i]);\r\n }\r\n}\r\n\r\nvoid solve(){\r\n init(N-5);\r\n for(int i = 2;i<=n-1;i++){\r\n dp[1][i] = quick(k,i*(i-1)/2);\r\n }\r\n for(int i = 2;i<=k;i++){\r\n for(int j = 1;j<=n-1;j++){\r\n for(int z = 0;z<=j;z++){\r\n dp[i][j] = (dp[i][j]+( ( (((fact[j]*fact_n[j-z]%mod)*fact_n[z])%mod) * quick(k-i+1,(j-z)*z+(z*(z-1)/2)) )%mod)*(max(1ll,dp[i-1][j-z]))%mod)%mod;\r\n }\r\n }\r\n }\r\n\r\n}\r\n\r\nsigned main(){\r\n#ifdef LOCAL\r\n freopen(\"input.txt\",\"r\",stdin);\r\n freopen(\"output.txt\",\"w\",stdout);\r\n#endif\r\n cin>>n>>k;\r\n solve();\r\n cout<\r\n\r\n#define Misaka namespace\r\n#define Mikoto std\r\nusing Misaka Mikoto;\r\n\r\n#define SZ(x) ((int)((x).size()))\r\n#define mkp make_pair\r\n#define fi first\r\n#define se second\r\ntypedef long long ll;\r\ntypedef pair pii;\r\n\r\nconst int MAXN=250+5;\r\nconst int MAXK=250+5;\r\nconst int Mod=998244353;\r\n\r\ninline void add_mod(int &x,int y){ x+=y; if(x>=Mod) x-=Mod; }\r\n\r\nint n,kk;\r\nint pw[MAXN][MAXN*MAXN],C[MAXN][MAXN];\r\nint dp[MAXN][MAXK],f[MAXN][MAXN];\r\n\r\ninline void init()\r\n{\r\n int up=MAXN-10;\r\n\r\n for(int i=0;i<=up;i++)\r\n {\r\n C[i][0]=1;\r\n for(int j=1;j<=i;j++)\r\n C[i][j]=(C[i-1][j]+C[i-1][j-1]) %Mod;\r\n }\r\n for(int i=0;i<=up;i++)\r\n {\r\n pw[i][0]=1;\r\n for(int j=1;j<=up*up;j++)\r\n pw[i][j]=(ll)pw[i][j-1]*i %Mod;\r\n }\r\n}\r\n\r\nint main()\r\n{\r\n init();\r\n\tscanf(\"%d%d\",&n,&kk);\r\n n--;\r\n\r\n dp[0][kk+1]=1;\r\n for(int i=1;i<=kk+1;i++) f[0][i]=1;\r\n\r\n for(int i=1;i<=n;i++)\r\n {\r\n for(int j=1;j<=kk;j++)\r\n for(int lst=0;lst=1;j--)\r\n f[i][j]=(dp[i][j]+f[i][j+1]) %Mod;\r\n }\r\n\r\n int ans=0;\r\n for(int j=1;j<=kk;j++)\r\n add_mod(ans,dp[n][j]);\r\n printf(\"%d\\n\",ans);\r\n\r\n\treturn 0;\r\n}\r\n", "lang": "GNU C++14", "bug_code_uid": "3e1388ad9dc1ae2e9fd6a8cf4b0fd0c3", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "67fcec0a1dfbef00d367246749f51503", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.17660377358490567, "equal_cnt": 8, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "#include\r\nusing namespace std;\r\nint n,m,q;\r\nlong long h[1000005];\r\nint main() {\r\n\tscanf(\"%d%d\",&n,&m);\r\n\tfor(int i=1; i<=n; i++) {\r\n\t\tint c,a,b;\r\n\t\tscanf(\"%d%d%d\",&c,&a,&b);\r\n\t\th[c]=max(h[c],1ll*a*b);\r\n\t}\r\n\tfor(int i=1; i<=m; i++) {\r\n\t\tfor(int j=2; i*j<=m; j++) {\r\n\t\t\th[i*j]=max(h[i*j],h[i]*j);\r\n\t\t}\r\n\t\th[i]=max(h[i],h[i-1]);\r\n\t}\r\n\tscanf(\"%d\",&q);\r\n\twhile(q--){\r\n\t\tlong long a,b;\r\n\t\tscanf(\"%lld%lld\",&a,&b);\r\n\t\tint x=upper_bound(h+1,h+1+m,a*b)-h;\r\n\t\tif(x>m)printf(\"-1 \");\r\n\t\telse printf(\"%d \",x);\r\n\t}\r\n\treturn 0;\r\n}", "lang": "GNU C++14", "bug_code_uid": "7c41db381ec212aee2294dc4453c6919", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "2a8011ba9638d51d45806b8ffba15013", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.99939263431064, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \r\nusing namespace std;\r\n\r\ntypedef unsigned int uint;\r\ntypedef long long ll;\r\ntypedef unsigned long long ull;\r\ntypedef pair pii;\r\ntypedef pair pli;\r\ntypedef pair pil;\r\ntypedef pair pll;\r\n\r\n#define MS0(X) memset((X), 0, sizeof((X)))\r\n#define MS1(X) memset((X), -1, sizeof((X)))\r\n#define MSV(X, V) memset((X), V, sizeof((X)))\r\n#define LEN(X) strlen(X + 1)\r\n#define SIZ(X) ((int)X.size())\r\n#define MP make_pair\r\n#define PB push_back\r\n#define EB emplace_back\r\n\r\n/* SORT_AND_UNIQUE */\r\n\r\ntemplate \r\nvoid REV (T *a, int n) {\r\n reverse (a + 1, a + 1 + n);\r\n}\r\ntemplate \r\nvoid SRT (T *a, int n) {\r\n sort (a + 1, a + 1 + n);\r\n}\r\ntemplate \r\nint UNI (T *a, int n) {\r\n sort (a + 1, a + 1 + n);\r\n return unique (a + 1, a + 1 + n) - (a + 1);\r\n}\r\ntemplate \r\nint POS (T *a, int n, T v) {\r\n return lower_bound (a + 1, a + 1 + n, v) - a;\r\n}\r\ntemplate \r\nint fisrtGe (T *a, int n, T v) {\r\n return lower_bound (a + 1, a + 1 + n, v) - a;\r\n}\r\ntemplate \r\nint lastLe (T *a, int n, T v) {\r\n return upper_bound (a + 1, a + 1 + n, v) - a - 1;\r\n}\r\n\r\n/* READ_AND_WRITE */\r\n\r\ntemplate \r\nvoid _RD (T &x) {\r\n cin >> x;\r\n}\r\nvoid _RD (int &x) {\r\n scanf (\"%d\", &x);\r\n}\r\nvoid _RD (uint &x) {\r\n scanf (\"%u\", &x);\r\n}\r\nvoid _RD (ll &x) {\r\n scanf (\"%lld\", &x);\r\n}\r\nvoid _RD (ull &x) {\r\n scanf (\"%llu\", &x);\r\n}\r\nvoid _RD (double &x) {\r\n scanf (\"%lf\", &x);\r\n}\r\nvoid _RD (char &x) {\r\n scanf (\" %c\", &x);\r\n}\r\nvoid _RD (char *x) {\r\n scanf (\"%s\", x + 1);\r\n}\r\ntemplate\r\nvoid _RD (pair &x) {\r\n _RD (x.first);\r\n _RD (x.second);\r\n}\r\nvoid RD() {\r\n}\r\ntemplate \r\nvoid RD (T &head, U &...tail) {\r\n _RD (head);\r\n RD (tail...);\r\n}\r\ntemplate \r\nvoid RDN (T *a, int n) {\r\n for (int i = 1; i <= n; ++i)\r\n _RD (a[i]);\r\n}\r\n\r\ntemplate \r\nvoid _WT (const T &x) {\r\n cout << x;\r\n}\r\nvoid _WT (const int &x) {\r\n printf (\"%d\", x);\r\n}\r\nvoid _WT (const uint &x) {\r\n printf (\"%u\", x);\r\n}\r\nvoid _WT (const ll &x) {\r\n printf (\"%lld\", x);\r\n}\r\nvoid _WT (const ull &x) {\r\n printf (\"%llu\", x);\r\n}\r\nvoid _WT (const double &x) {\r\n printf (\"%.12f\", x);\r\n}\r\nvoid _WT (const char &x) {\r\n putchar (x);\r\n}\r\nvoid _WT (const char *x) {\r\n printf (\"%s\", x + 1);\r\n}\r\ntemplate \r\nvoid _WT (const pair &x) {\r\n _WT (x.first);\r\n putchar (' ');\r\n _WT (x.second);\r\n}\r\nvoid WT() {\r\n}\r\ntemplate \r\nvoid WT (const T &head, const U &...tail) {\r\n _WT (head);\r\n putchar (sizeof... (tail) ? ' ' : '\\n');\r\n WT (tail...);\r\n}\r\ntemplate \r\nvoid WTN (T *a, int n) {\r\n for (int i = 1; i <= n; ++i) {\r\n _WT (a[i]);\r\n putchar (\" \\n\"[i == n]);\r\n }\r\n}\r\n\r\ntemplate \r\nvoid WTV (const vector &x, bool ln = false) {\r\n WT (x.size());\r\n for (auto i = x.begin(); i != x.end(); ++i) {\r\n _WT (*i);\r\n putchar (ln ? '\\n' : ' ');\r\n }\r\n if (!ln)\r\n putchar ('\\n');\r\n}\r\n\r\n#ifdef LOCAL\r\n#define D1(a) cerr << #a << \" = \" << (a) << endl\r\n#define D2(a, b) cerr << #a << \" = \" << (a) << \", \" << #b << \" = \" << (b) << endl\r\n#define D3(a, b, c) cerr << #a << \" = \" << (a) << \", \" << #b << \" = \" << (b) << \", \" \\\r\n << #c << \" = \" << (c) << endl\r\n#define D4(a, b, c, d) cerr << #a << \" = \" << (a) << \", \" << #b << \" = \" << (b) << \", \" \\\r\n << #c << \" = \" << (c) << \", \" << #d << \" = \" << (d) << endl\r\n#define ASSERT(x) assert(x)\r\n#else\r\n#define D1(a)\r\n#define D2(a, b)\r\n#define D3(a, b, c)\r\n#define D4(a, b, c, d)\r\n#define ASSERT(x)\r\n#endif\r\n\r\n/* CMIN_AND_CMAX */\r\n\r\ntemplate \r\nvoid cmin (T &x, T y) {\r\n if (y < x)\r\n x = y;\r\n}\r\n\r\ntemplate \r\nvoid cmax (T &x, T y) {\r\n if (y > x)\r\n x = y;\r\n}\r\n\r\n#ifdef LOCAL\r\nuint rnd_seed = 19937;\r\n#else\r\nuint rnd_seed = chrono::duration_cast (\r\n chrono::steady_clock::now().time_since_epoch()).count();\r\n#endif // LOCAL\r\n\r\nmt19937 rnd (rnd_seed);\r\n\r\nconst int INF = 0x3F3F3F3F;\r\nconst ll LINF = 0x3F3F3F3F3F3F3F3FLL;\r\nint MOD = 998244353;\r\n/* MOD must be a prime. if not, don't use inv() */\r\n\r\nstruct ModularIntegers {\r\n#define mint ModularIntegers\r\n int num;\r\n mint() {\r\n num = 0;\r\n }\r\n template \r\n mint (const T& x) {\r\n ll tmp = x;\r\n if (tmp >= MOD) {\r\n if (tmp < (MOD << 1)) tmp -= MOD;\r\n else tmp %= MOD;\r\n } else if (tmp < 0) {\r\n if (tmp >= -MOD) tmp += MOD;\r\n else if (tmp %= MOD) tmp += MOD;\r\n }\r\n num = tmp;\r\n }\r\n friend mint operator+ (const mint &x, const mint &y) {\r\n mint res;\r\n res.num = x.num + y.num;\r\n if (res.num >= MOD) res.num -= MOD;\r\n return move (res);\r\n }\r\n friend mint operator- (const mint &x, const mint &y) {\r\n mint res;\r\n res.num = x.num - y.num;\r\n if (res.num < 0) res.num += MOD;\r\n return move (res);\r\n }\r\n friend mint operator* (const mint &x, const mint &y) {\r\n mint res;\r\n res.num = 1LL * x.num * y.num % MOD;\r\n return move (res);\r\n }\r\n friend mint operator/ (const mint &x, const mint &y) {\r\n return x * y.inv();\r\n }\r\n friend bool operator== (const mint &x, const mint &y) {\r\n return x.num == y.num;\r\n }\r\n friend bool operator!= (const mint &x, const mint &y) {\r\n return x.num != y.num;\r\n }\r\n mint operator+() {\r\n return +this->num;\r\n }\r\n mint operator-() {\r\n return -this->num;\r\n }\r\n mint& operator+= (const mint &x) {\r\n if ( (this->num += x.num) >= MOD) this->num -= MOD;\r\n return *this;\r\n }\r\n mint& operator-= (const mint &x) {\r\n if ( (this->num -= x.num) < 0) this->num += MOD;\r\n return *this;\r\n }\r\n mint& operator*= (const mint &x) {\r\n this->num = 1LL * this->num * x.num % MOD;\r\n return *this;\r\n }\r\n mint& operator/= (const mint &x) {\r\n this->num = ( (*this) * x.inv()).num;\r\n return *this;\r\n }\r\n mint pow (ll x) const {\r\n mint res (1), cur (this->num);\r\n for (; x; cur *= cur, x >>= 1)\r\n if (x & 1) res *= cur;\r\n return res;\r\n }\r\n mint inv() const {\r\n return pow (MOD - 2);\r\n }\r\n operator int() {\r\n return num;\r\n }\r\n operator uint() {\r\n return num;\r\n }\r\n operator ll() {\r\n return num;\r\n }\r\n operator ull() {\r\n return num;\r\n }\r\n#undef mint\r\n};\r\n\r\ntypedef ModularIntegers mint;\r\n\r\nvoid _RD (mint &x) {\r\n scanf (\"%d\", &x.num);\r\n}\r\nvoid _WT (const mint &x) {\r\n printf (\"%d\", x.num);\r\n}\r\n\r\n/*****************/\r\n/* MY_CODE_BEGIN */\r\n\r\n/* MOD must be a prime*/\r\n\r\nconst int MAXN = 251;\r\n\r\nint n, k;\r\nll dp[MAXN][MAXN]; // \u524di\u5c0f\u6743\u503c\u7684\u8fb9\uff0c\u6700\u540e\u4e00\u8fb9\u7684\u6743\u503c\u4e3aj\u7684\u65b9\u6848\r\n\r\nnamespace Combinatory {\r\nll qpow (ll x, ll n) {\r\n if (x >= MOD) x %= MOD;\r\n ll res = 1;\r\n for (; n; x = x * x % MOD, n >>= 1)\r\n if (n & 1) res = res * x % MOD;\r\n if (res < 0) res += MOD;\r\n return res;\r\n}\r\nll inv (ll x) {\r\n return qpow (x, MOD - 2);\r\n}\r\nll fac[MAXN], invfac[MAXN];\r\nll QPOW[MAXN][MAXN * MAXN];\r\nvoid initC (int n) {\r\n ASSERT (1 <= n && n <= MAXN && n < MOD);\r\n fac[0] = 1, invfac[0] = 1;\r\n for (int i = 1; i <= n; ++i)\r\n fac[i] = 1LL * fac[i - 1] * i % MOD;\r\n invfac[n] = inv (fac[n]);\r\n for (int i = n - 1; i >= 0; --i)\r\n invfac[i] = 1LL * invfac[i + 1] * (i + 1) % MOD;\r\n for (int i = 1; i <= n; ++i) {\r\n QPOW[i][0] = 1;\r\n for (int j = 1; j <= n * n; ++j)\r\n QPOW[i][j] = QPOW[i][j - 1] * i % MOD;\r\n }\r\n}\r\nll A (ll n, ll m) {\r\n ASSERT (fac[0] && n <= MAXN);\r\n return (m < 0 || n < m) ? 0 : 1LL * fac[n] * invfac[n - m] % MOD;\r\n}\r\nll C (ll n, ll m) {\r\n ASSERT (fac[0] && n <= MAXN);\r\n return (m < 0 || n < m) ? 0 : A (n, m) * invfac[m] % MOD;\r\n}\r\n}\r\nusing namespace Combinatory;\r\n\r\n\r\nvoid purin_solve() {\r\n RD (n, k);\r\n initC (n);\r\n dp[0][0] = 1;\r\n for (int x = 0; x <= n - 1; ++x) {\r\n for (int i = 0; x + i <= n - 1; ++i) {\r\n for (int j = 0; j + 1 <= k; ++j) {\r\n if (dp[x][j] == 0)\r\n continue;\r\n int e1 = C (i, 2) + x * i;\r\n// int e2 = C (x + i, 2) - C (x, 2);\r\n// D2 (e1, e2);\r\n// assert (e1 == e2);\r\n dp[x + i][j + 1] += 1LL * dp[x][j] * C (n - 1 - x, i) % MOD * QPOW [k - (j + 1) + 1][e1] % MOD;\r\n if (dp[x + i][j + 1] >= MOD)\r\n dp[x + i][j + 1] -= MOD;\r\n }\r\n }\r\n }\r\n WT (dp[n - 1][k]);\r\n}\r\n\r\nint main() {\r\n int t = 1;\r\n#ifdef LOCAL\r\n freopen (\"A.in\", \"r\", stdin);\r\n#endif // LOCAL\r\n cout << fixed << setprecision (12);\r\n cerr << fixed << setprecision (12);\r\n// ios::sync_with_stdio (false);\r\n// cin.tie (nullptr);\r\n// cout.tie (nullptr);\r\n\r\n while (t--)\r\n purin_solve();\r\n return 0;\r\n}\r\n", "lang": "GNU C++17", "bug_code_uid": "b29eb238f24ffc65f37373df5dd1659c", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "de7e12a0e4b4323f197d6a1740482964", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9985237673457337, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \"stdio.h\"\r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n\r\nusing namespace std;\r\n\r\n#define INF INT_MAX\r\n#define MAXN 250\r\n#define ll long long\r\n\r\nll mod = 998244353, fac[MAXN + 10];\r\nll dp[MAXN + 10][MAXN + 10], pw[MAXN][MAXN * MAXN + 10];\r\n\r\nll mi(ll n, ll k) {\r\n ll c = 1;\r\n n %= mod;\r\n for (; k; k >>= 1) {\r\n if (k & 1) c = c * n % mod;\r\n n = n * n % mod;\r\n }\r\n return c;\r\n}\r\n\r\nll inv(ll x) {\r\n return mi(x, mod - 2);\r\n}\r\n\r\n/*\r\nvoid pre() {\r\n inv[1] = 1;\r\n for (int i = 2; i <= MAXN; i++)\r\n inv[i] = (mod - mod / i) * inv[mod % i] % mod;\r\n}\r\n*/\r\n\r\nvoid solve() {\r\n ll n, k;\r\n cin >> n >> k;\r\n fac[0] = 1; \r\n for (int i = 1; i < n; i++)\r\n fac[i] = fac[i - 1] * i % mod;\r\n for (int i = 0; i <= k; i++)\r\n dp[0][i] = fac[n - 1];\r\n for (int i = 1; i < n; i++)\r\n fac[i] = inv(fac[i]);\r\n for (int i = 1; i <= k; i++)\r\n for (int j = 0; j < n * n; j++)\r\n pw[i][j] = mi(i, j);\r\n for (int i = 1; i < n; i++) for (int j = 1; j <= k; j++) {\r\n for (int p = 0; p < i; p++) {\r\n dp[i][j] += dp[p][j - 1] * pw[k - j + 1][(i - p)*(p + i - 1) / 2] % mod * fac[i - p];\r\n dp[i][j] %= mod;\r\n }\r\n dp[i][j] = (dp[i][j] + dp[i][j - 1]) % mod;\r\n }\r\n cout << dp[n - 1][k] << \"\\n\";\r\n}\r\n\r\nint main() {\r\n //ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);\r\n int T;\r\n //cin >> T;\r\n T = 1;\r\n //pre();\r\n while (T--)\r\n solve();\r\n return 0; \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", "lang": "GNU C++17", "bug_code_uid": "a5c105654916899feaefeeb66793c351", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "5f48b8eb9eead4820924d76f768aa0bd", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.7517316806416332, "equal_cnt": 33, "replace_cnt": 18, "delete_cnt": 6, "insert_cnt": 8, "fix_ops_cnt": 32, "bug_source_code": "#include\r\n\r\nusing namespace std;\r\ntypedef long long ll;\r\nconst int N = 3e2 + 10;\r\nconst int mod = 998244353;\r\nint fac[N], inv[N], dp[N][N];\r\nint qpow(int x, int y) {\r\n int ans = 1;\r\n while(y) {\r\n if(y & 1) ans = 1ll * ans * x % mod;\r\n x = 1ll * x * x % mod;\r\n y >>= 1;\r\n }\r\n return ans;\r\n}\r\nint pp[N][N*N], n, k;\r\nvoid init() {\r\n fac[0] = inv[0] = 1;\r\n for(int i=1; i=1; i--) {\r\n inv[i] = 1ll * inv[i+1] * (i + 1) % mod;\r\n }\r\n for(int i=0; i<=k; i++) {\r\n for(int j=0; j<=n*n; j++) {\r\n pp[i][j] = qpow(i, j);\r\n }\r\n }\r\n}\r\n\r\n\r\n\r\nint main() {\r\n#ifndef ONLINE_JUDGE\r\n freopen(\"in.txt\", \"r\", stdin);\r\n freopen(\"out.txt\", \"w\", stdout);\r\n#endif\r\n \r\n scanf(\"%d%d\", &n, &k);\r\n init();\r\n dp[0][0] = fac[n-1];\r\n for(int i=1; i<=n; i++) {\r\n for(int j=1; j<=k; j++) {\r\n for(int p=0; p\r\nusing namespace std;\r\nconst int mod = 998244353;\r\ntypedef long long ll;\r\n\r\n//\u9996\u51481\u8fde\u7740\u6bcf\u4e00\u4e2a\u9876\u70b9,\u4e14\u6700\u5c0f\u751f\u6210\u6811\u5c31\u662f\u5b83\r\n//\u5219\u4efb\u610f\u4e24\u4e2a\u9876\u70b9\u7684\u8fb9\u4e00\u5b9a>=max(R1,R2);\r\n//\u5224\u65ad\u6709\u591a\u5c11\u79cd\u8fd9\u4e2a\u60c5\u51b5\uff1f\r\n//R1,R2\r\n//\u5047\u8bbe\u679a\u4e3e\u6700\u5c0f\u8fb9\u7684\u8bdd\r\n//\u5224\u65ad\u6709\u591a\u5c11\u79cd\u8fb9\r\n//Ann/PI(Aii)\r\n//dp[i][j][m]\u8868\u793a\u679a\u4e3e\u7b2ci\u4e2a\u5143\u7d20\uff0c\u4e14\u5f53\u524d\u6700\u5927\u8fb9\u4e3aj,\u4e00\u5171\u6709m\u4e2a\u5143\u7d20\r\n//(k-j+1)^(i-1)\r\n// /Amm;\r\n\r\nll fac[1001];\r\nll invfac[1001];\r\nll ksm(ll b, ll e) {\r\n\tll r = 1;\r\n\twhile (e) {\r\n\t\tif (e & 1) {\r\n\t\t\tr *= b;\r\n\t\t\tr %= mod;\r\n\t\t}\r\n\t\tb *= b;\r\n\t\tb %= mod;\r\n\t\te >>= 1;\r\n\t}\r\n\treturn r;\r\n}\r\n\r\nll inv(ll x) {\r\n\treturn ksm(x, mod - 2);\r\n}\r\n\r\nvoid init() {\r\n\tfac[0] = 1;\r\n\tfor (int i = 1; i <= 1000; i++) {\r\n\t\tfac[i] = fac[i - 1] * i;\r\n\t\tfac[i] %= mod;\r\n\t}\r\n\tfor (int i = 1; i <= 1000; i++) {\r\n\t\tinvfac[i] = inv(fac[i]);\r\n\t}\r\n}\r\nll dp[2][1001][1001];\r\n\r\nll C(ll n, ll m) {\r\n\treturn ((fac[n] * invfac[m])%mod * invfac[n - m])%mod;\r\n}\r\n\r\nint main() {\r\n\tinit();\r\n\tll n, k;\r\n\tcin >> n >> k;\r\n\tfor (ll i = 1; i <= k; i++) {\r\n\t\tdp[1][i][1] = 1;\r\n\t}\r\n\tfor (ll i = 2; i < n; i++) {\r\n\t\tfor (ll j = 1; j <= k; j++) {\r\n\t\t\tdp[i & 1][0][1] = 0;\r\n\t\t\tfor (ll m = 2; m <= n;m++) {\r\n\t\t\t\tdp[i & 1][j][m] = dp[!(i & 1)][j][m - 1]*ksm(k-j+1,i-1);\r\n\t\t\t\tdp[i & 1][j][m] %= mod;\r\n\t\t\t}\r\n\t\t\tdp[i & 1][j][1] = 0;\r\n\t\t\tfor (ll m = 1; m < j; m++) {\r\n\t\t\t\tfor (ll kk = 1; kk <=n; kk++) {\r\n\t\t\t\t\tdp[i & 1][j][1] += ((dp[!(i&1)][m][kk] * ksm(k - j + 1, i - 1)) % mod * C(n-i+kk,kk))%mod;\r\n\t\t\t\t\tdp[i & 1][j][1] %= mod;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tll ans = 0;\r\n\tfor (int i = 1; i <= k; i++) {\r\n\t\tfor (int j = 1; j <= k; j++) {\r\n\t\t\tans += (dp[!(n & 1)][i][j]) % mod;\r\n\t\t}\r\n\t}\r\n\tcout << (ans) % mod << endl;\r\n}", "lang": "GNU C++17", "bug_code_uid": "63691303aeea5996b5cdf438664e5865", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "a403b6cf66192dede87c294009d14814", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9797734627831716, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include\r\n#define mod 998244353\r\n#define pb push_back\r\n#define lb lower_bound\r\n#define fi first\r\n#define se second\r\n#define int long long\r\nusing namespace std;\r\ntypedef long long LL;\r\ntypedef pair pll;\r\nLL n, k, dp[255][255][255], sum[255][255], rev[255];\r\n\r\nLL po(LL x, LL y)\r\n{\r\n if(y==0) return 1;\r\n LL val=po(x, y/2);\r\n if(y%2) return val*val%mod*x%mod;\r\n else return val*val%mod;\r\n}\r\n\r\nint32_t main()\r\n{\r\n scanf(\"%lld %lld\", &n, &k);\r\n for(int i=1; i<=k; i++) dp[1][i][1]=i, sum[1][i]=i, rev[i]=po(i, mod-2);\r\n for(int i=2; i\r\n\r\nusing namespace std;\r\n\r\ninline long long read(){\r\n long long s=0,w=1;\r\n char ch=getchar();\r\n while(ch<'0'||ch>'9') {if (ch=='-') w=-1;ch=getchar();}\r\n while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();\r\n return s*w;\r\n}\r\n\r\nconst int mod=998244353;\r\n\r\nlong long ksm(long long a,long long k){\r\n long long now=1;\r\n while(k){\r\n if (k&1) now=now*a%mod;\r\n a=a*a%mod;\r\n k=k/2;\r\n }\r\n return now%mod;\r\n}\r\n\r\nlong long inv[10000],fac[10000];\r\nlong long pw[251][251*251],dp[300][300];\r\n\r\nlong long C(long long a,long long b){\r\n return fac[a]*inv[b]%mod*inv[a-b]%mod;\r\n}\r\n\r\nint main(){\r\n // freopen(\"input.in\",\"r\",stdin);\r\n // freopen(\"output.out\",\"w\",stdout);\r\n int n=read(),k=read();\r\n inv[1]=1;\r\n inv[0]=1;\r\n fac[0]=fac[1]=1;\r\n for(int i=0;i<=n;i++) for(int j=0;j<=k;j++) dp[i][j]=0;\r\n for(int i=2;i<=n;i++) fac[i]=1ll*i*fac[i-1]%mod;\r\n dp[0][0]=1;\r\n for(int i=1;i<=n;i++) inv[i]=1ll*ksm(fac[i],mod-2);\r\n \r\n for(int i=1;i<=k;i++)\r\n for(int j=0;j\r\n#include\r\n#define ll long long\r\n#define mkp make_pair\r\n#define base 233333\r\n#define inf 0x3f3f3f3f\r\n#define mod2 1000000007\r\n#define mod 998244353\r\n#define ull unsigned long long\r\n#define pii pair\r\nusing namespace std;\r\nconst int N=250;\r\nll dp[N][N],p[N],qp[N];\r\nll qpow(ll a,ll b=mod-2)\r\n{\r\n\tll c=1;\r\n\twhile(b)\r\n\t{\r\n\t\tif(b&1)\r\n\t\t{\r\n\t\t\tc=c*a%mod;\r\n\t\t}\r\n\t\ta=a*a%mod;\r\n\t\tb>>=1;\r\n\t}\r\n\treturn c;\r\n}\r\nll C(ll n,ll m)\r\n{\r\n\treturn p[n]*qp[m]%mod*qp[n-m]%mod;\r\n}\r\nint main()\r\n{\r\n\tint n,k;\r\n\tscanf(\"%d%d\",&n,&k);\r\n\tp[0]=qp[0]=1;\r\n\tfor(int i=1;i<=n;i++)\r\n\t{\r\n\t\tp[i]=p[i-1]*i%mod;\r\n\t\tqp[i]=qp[i-1]*qpow(i)%mod;\r\n\t}\r\n\tdp[0][0]=1;\r\n\tfor(int i=1;i<=k;i++)\r\n\t{\r\n\t\tfor(int j=0;j\r\n\r\n#define pb push_back\r\n#define ll long long\r\n#define ld long double\r\n#define f first\r\n#define s second\r\n#define mp make_pair\r\n\r\nconst ll maxn = 3e2 + 5, maxm = 3e5 + 1, maxk = 61;\r\nconst int inf = 1000000000, mod = inf + 7, mod2 = 998244353;\r\nconst ll pa = 31, block = 400;\r\n\r\nusing namespace std;\r\n\r\nll n, k;\r\nint dp[maxn][maxn], c[maxn][maxn];\r\nint fact[maxn];\r\nint add(int a, int b){\r\n a += b;\r\n if (a >= mod2)\r\n a -= mod2;\r\n return a;\r\n}\r\nint mul(int a, int b){\r\n return a * 1ll * b % mod2;\r\n}\r\nint bp(int a, int n){\r\n int res = 1;\r\n while (n > 0){\r\n if (n & 1)\r\n res = mul(res, a);\r\n a = mul(a, a), n >>= 1;\r\n }\r\n return res;\r\n}\r\nint main(){\r\n ios_base::sync_with_stdio(false);\r\n cin.tie(0), cout.tie(0);\r\n cin >> n >> k;\r\n dp[0][0] = 1;\r\n c[0][0] = 1;\r\n for (int i = 1; i <= n; ++i){\r\n c[i][0] = 1;\r\n c[i][i] = 1;\r\n for (int j = 1; j < i; ++j){\r\n c[i][j] = add(c[i][j - 1], c[i - 1][j]);\r\n }\r\n }\r\n for (int i = 0; i <= n; ++i){\r\n for (int j = 0; j <= k; ++j){\r\n if (dp[i][j] > 0){\r\n for (int ad = 0; ad <= n - i; ++ad){\r\n int ni = i + ad;\r\n int nj = j + 1;\r\n int reb = ad * (ad - 1) / 2 + ad * i;\r\n int x = mul(dp[i][j], mul(c[n - i - 1][ad], bp(k - j, reb)));\r\n dp[ni][nj] = add(dp[ni][nj], x);\r\n }\r\n }\r\n }\r\n }\r\n cout << dp[n - 1][k];\r\n}\r\n\r\n", "lang": "GNU C++17", "bug_code_uid": "5f4fee458d1ea1f17053f52fe4d830ad", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "8e59e4241e34a018a704b5e7dc5c586c", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9989094874591058, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include \nusing namespace std;\n#define int long long\n\nconst int mod = 998244353;\n\nint binpow(int a, int b){\n\tint res = 1;\n\twhile (b) {\n\t\tif (b & 1) res *= a, res %= mod;\n a *= a, a %= mod;\n\t\tb >>= 1;\n\t}\n\treturn res;\n}\n\nsigned main() {\n\tint n, k;\n\tscanf(\"%lld%lld\", &n, &k);\n\t--n;\n\tvector> dp(k + 1, vector(n + 1, 0));\n\tvector> C(n + 1);\n for (int i = 0; i < n + 1; ++i) {\n\t\tC[i].resize(i + 1);\n\t\tC[i][0] = C[i][i] = 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] % mod;\n\t}\n\tdp[0][0] = 1;\n for (int i = 0; i < k; i++) for (int t = 0; t < n + 1; t++) {\n\t\tint pw = binpow(k - i, t * (t - 1) / 2);\n\t\tint step = binpow(k - i, t);\n for (int j = 0; j < n - t + 1; j++) {\n\t\t\tdp[i + 1][j + t] = (dp[i + 1][j + t] + (dp[i][j] * (C[n - j][t] * pw % mod) % mod)) % mod;\n\t\t\tpw *= step, pw %= mod;\n\t\t}\n\t}\n\tprintf(\"%lld\\n\", dp[k][n]);\n}\n\n", "lang": "GNU C++17", "bug_code_uid": "165e653e44968ad843b8c1d928fd8c0a", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "7e6889381a5550334f1de17274e53cae", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9952189711225856, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "// Hey there.. I love you <3\r\n#include \r\n#include \r\n#include \r\n\r\nusing namespace std;\r\nusing namespace __gnu_pbds;\r\n\r\ntypedef long long ll;\r\n\r\n#define fast cin.tie(0); cin.sync_with_stdio(0); cout.tie(0);\r\nFILE *stream;\r\n#define input(x) freopen_s(&stream, (x), \"r\", stdin);\r\n#define output(x) freopen_s(&stream, (x), \"w\", stdout);\r\n#define all(x) x.begin(), x.end()\r\n#define sz(x) ((int)(x).size())\r\n#define maxz(x, y) x=max(x, y)\r\n#define minz(x, y) x=min(x, y)\r\n#define modz(x) x = (x % mod + mod) % mod\r\n#define ordered_set tree, rb_tree_tag,tree_order_statistics_node_update>\r\n\r\nll mod = 998244353;\r\nconst ll N = 300;\r\n\r\nll bpow(ll n, ll x) { return x <= 0 ? 1 : bpow(n * n % mod, x / 2) % mod * (x % 2 ? n : 1) % mod; }\r\nll modinverse(ll b) { return bpow(b, mod - 2); }\r\n\r\nvector fact(N, 1), factinv(N, 1);\r\nvector> combs(N, vector(N));\r\nll perm(ll n, ll m) { return fact[n] * factinv[n - m] % mod; }\r\nll comb(ll n, ll m) { return perm(n, m) * factinv[m] % mod; }\r\nvoid factinit() {\r\n for (int i = 1; i < N; ++i) fact[i] = i * fact[i - 1] % mod, factinv[i] = modinverse(fact[i]);\r\n for (int i = 0; i < N; ++i) for (int j = 0; j < N; ++j) combs[i][j] = comb(i, j);\r\n}\r\n\r\nvoid init() {\r\n fast;\r\n factinit();\r\n}\r\n\r\nll dp[250][251][250];\r\n\r\nint n, k;\r\n\r\nll helpme(int i = 0, int j = 1, int num = 0) {\r\n\r\n auto &me = dp[i][j][num];\r\n if (me != -1) return me;\r\n int combb = combs[i][num];\r\n if (i == n - 1) return combb;\r\n\r\n me = helpme(i + 1, j, num + 1) * bpow(j, n - 2 - i) % mod;\r\n for (int l = j + 1; l <= k; ++l) me += combb * bpow(l, n - 2 - i) % mod * helpme(i + 1, l, 1) % mod, me %= mod;\r\n\r\n return me;\r\n}\r\n\r\nvoid solve(int tc) {\r\n\r\n cin >> n >> k;\r\n\r\n memset(dp, -1, sizeof dp);\r\n for (int j = 0; j <= k; ++j) for (int num = 0; num < n; ++num) dp[n-1][j][num] = combs[n - 1][num];\r\n\r\n for (int i = n - 2; i >= 0; --i) {\r\n vector suf(k + 2);\r\n for (int j = k; j >= 0; --j) suf[j] = suf[j + 1] + dp[i+1][j][1] * bpow(j, n - 2 - i) % mod;\r\n for (int j = 0; j <= k; ++j) {\r\n for (int num = 0; num < n; ++num) {\r\n dp[i][j][num] = dp[i+1][j][num + 1] * bpow(j, n - 2 - i) % mod;\r\n dp[i][j][num] += combs[i][num] * suf[j + 1] % mod;\r\n dp[i][j][num] %= mod;\r\n }\r\n }\r\n }\r\n cout << dp[0][1][0] % mod << endl;\r\n\r\n}\r\n\r\n\r\nint main() {\r\n init();\r\n\r\n ll t = 1, tc = 1;\r\n //cin >> t;\r\n while (t--) solve(tc++);\r\n\r\n return 0;\r\n}", "lang": "GNU C++17", "bug_code_uid": "449123931d5709a41184dc8b80825011", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "0c63c174dc3c21b600dbdbefc43f3ee3", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.7720332172515403, "equal_cnt": 17, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 16, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define MODD 998244353\n#define ll long long\nusing namespace std;\n\nll fact[333];\nll factinv[333];\n\nll modpow(ll x, ll y) {\n ll xs = x;\n ll answer = 1;\n while(y) {\n if (y&1) {\n answer = (answer * xs) % MODD;\n }\n y >>= 1;\n xs = (xs * xs) % MODD;\n }\n return answer;\n}\n\nll B(ll x) {\n return (x*(x+1))/2;\n}\n\nll B(ll a, ll b) {\n ll ret = B(b)-B(a-1);\n return ret;\n}\nll dp[333][333];\n\nll MP[333][55555];\n\nint main() {\n int n,k;\n cin>>n>>k;\n\n fact[0]=factinv[0]=1;\n for(int i=1;i<=n;i++) {\n fact[i]=(fact[i-1]*i)%MODD;\n factinv[i]=modpow(fact[i], MODD-2);\n }\n \n \n // 1 to n\n for(int i=0;i<=n;i++) {\n for(int j=0;j<=B(n);j++) {\n MP[i][j]=modpow(i,j);\n }\n }\n \n \n for(int st=n;st>=1;st--) {\n for(int min_val=1;min_val<=k+1;min_val++) {\n if (st == n) {\n dp[st][min_val]=1;\n continue;\n }\n\n\n ll ans = 0;\n for(int en=st;en<=n;en++) {\n ll b = B(st-1,en-1);\n // st to en has the same value x;\n for(int x=min_val;x<=k;x++) {\n ll v = MP[k-x+1][b]*factinv[en-st+1]%MODD;\n ans += v*dp[en+1][x+1]%MODD;\n ans%=MODD;\n }\n }\n ans%=MODD;\n dp[st][min_val]=ans;\n }\n }\n\n cout << dp[1][1]*fact[n-1]%MODD << endl;\n\n}\n", "lang": "GNU C++17", "bug_code_uid": "0686f11efddbe03a36d3b5145bf7c202", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "404397417694197acc2d33c6a19cc38f", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9987886129618413, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include \r\nusing namespace std;\r\n#define int long long\r\n#define foru(i, a, b) for (int i = a; i <= b; ++i)\r\n#define ford(i, a, b) for (int i = a; i >= b; --i)\r\n#define all(a) a.begin(), a.end()\r\n#define pb push_back\r\n#define ii pair \r\n#define sd second\r\n#define ft first\r\n#define bit(i) (i & (-i))\r\n#define base 29\r\n#define endl '\\n'\r\n#define mod 998244353ll\r\nint dx[4] = { 0, 1, 0, -1 };\r\nint dy[4] = { 1, 0, -1, 0 };\r\n\r\nstring yno[2] = { \"NO\\n\", \"YES\\n\" };\r\n\r\nconst int maxn = 255;\r\n\r\nint n, k, f[maxn][maxn], C[maxn][maxn];\r\n\r\nint sum(int a, int b){\r\n return (a+b)%mod;\r\n}\r\n\r\nint mul(int a, int b){\r\n return (a*b)%mod;\r\n}\r\n\r\nint poww(int n, int k){\r\n int ans = 1;\r\n while(k){\r\n if(k&1) ans = mul(ans, n);\r\n n = mul(n, n);\r\n k>>=1;\r\n }\r\n return ans;\r\n}\r\n\r\nvoid solve() {\r\n cin>>n>>k;\r\n C[0][0] = 1;\r\n foru(i,1,n){\r\n C[i][0] = C[i][i] = 1;\r\n foru(j,1,i-1) C[i][j] = sum(C[i-1][j], C[i-1][j-1]);\r\n }\r\n foru(i,0,n) f[0][i] = 1;\r\n foru(i,1,n){\r\n foru(j,1,k){\r\n foru(l,0,i){\r\n f[i][j] = sum(f[i][j], mul(f[i-l][j-1], mul(C[i][l], poww(k - j + 1, l*(l-1)/2 + l * (i - l)))));\r\n }\r\n }\r\n }\r\n// foru(i,1,n-1){\r\n// foru(j,1,k) cout<> t;\r\n while (t--){\r\n solve();\r\n }\r\n return 0;\r\n}\r\n", "lang": "GNU C++17", "bug_code_uid": "63874c9aed41183a99c1a2fb52859f8b", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "2d8079e9160ccd19f6908f0941c8008e", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9951171875, "equal_cnt": 6, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "#include\r\n#define int long long\r\n#define fst ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)\r\nusing namespace std;\r\n\r\n//14:53 15::01\r\nint n,k,dp[250][250],mod=998244353;\r\nint p[250][40000],c[250][250];\r\nint cal(int x,int y){\r\n if(y==0 or x==y) return 1;\r\n if(c[x][y]) return c[x][y];\r\n return c[x][y]=(cal(x-1,y)+cal(x-1,y-1))%mod;\r\n}\r\nvoid init(){\r\n memset(dp,-1,sizeof dp);\r\n for(int i=1;i<=k;i++){\r\n p[i][0]=1;\r\n for(int j=1;j<=n*(n-1)/2;j++){\r\n p[i][j]=1ll*p[i][j-1]*i%mod; //NOLINT\r\n }\r\n }\r\n}\r\nint dfs(int mx,int tot){\r\n if(~dp[mx][tot]) return dp[mx][tot];\r\n long long res=0;\r\n if(tot==0 ) return 1;\r\n if(mx==1) return p[k][tot*(tot-1)/2];\r\n for(int i=0;i<=tot;i++){\r\n int cx=cal(tot,i)*p[k-mx+1][(i-1)*i/2+i*(tot-i)]%mod;\r\n res+=cx*dfs(mx-1,tot-i)%mod;\r\n }\r\n return dp[mx][tot]=res%mod; //NOLINT\r\n}\r\nsigned main(){\r\n fst;\r\n cin>>n>>k;\r\n init();\r\n cout<\n\nusing namespace std;\n\nvoid trace_() {cerr << \"\\n\";}\ntemplate void trace_(T1 t1, T2... t2) {cerr << ' ' << t1; trace_(t2...); }\n#define trace(...) cerr << #__VA_ARGS__ << \" :\", trace_(__VA_ARGS__);\n\nusing ll = long long;\nconst int N = 255;\nconst int MOD = 998244353;\nll binom[N][N];\n\nll add(ll a, ll b) {\n a += b;\n if (a > MOD) a -= MOD;\n return a;\n} \n\nll mull(ll a, ll b) {\n return a * b % MOD;\n}\n\n\nvoid solve() {\n int n, k; cin >> n >> k;\n for(int i = 1; i <= n; ++i) {\n binom[i][0] = 1; binom[i][i] = 1;\n for(int j = 1; j < i; ++j){\n binom[i][j] = binom[i - 1][j] + binom[i - 1][j - 1];\n }\n }\n\n auto pw = [](ll a, ll b) {\n ll res = 1;\n while(b) {\n if (b & 1) res = mull(res, a);\n a = mull(a, a);\n b >>= 1;\n }\n return res;\n };\n\n vector> dp(n + 1, vector (k + 1));\n for (int j = 0; j <= k; j++) dp[0][j] = 1;\n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= k; j++) {\n dp[i][j] = dp[i][j - 1];\n for (int t = 1; t <= i; t++) {\n int edges = i * (i - 1) - (i - t) * (i - t - 1); edges >>= 1;\n dp[i][j] = add(dp[i][j], binom[i][t] * pw(k - j + 1, edges)\n % MOD * dp[i - t][j - 1] % MOD); \n }\n }\n }\n\n cout << dp[n - 1][k] << \"\\n\";\n}\n\nint main() {\n ios_base::sync_with_stdio(false); cin.tie(0);\n solve();\n}", "lang": "GNU C++17", "bug_code_uid": "e5ca3dd5ad252d7d7d6cd1c71766aa66", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "e8a0da519a5c3b16e4b5b3e1a98aadb8", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9455803711859075, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "#include\r\n#include\r\n#include\r\n#include\r\n#include\r\nusing namespace std;\r\n#define left toLeft\r\n#define right toRight\r\nconst int INF = 1e9+7;\r\nconst long long INFq = 1e18+7;\r\nconst long long mode = 998244353;\r\n\r\nlong long qpow(long long n,long long x){\r\n long long res = 1;\r\n while( x ){\r\n if( x&1 ){ res *= n; res %= mode; } \r\n n *= n; n %= mode; x /= 2;\r\n }\r\n return res;\r\n}\r\n\r\nlong long dp[300][300];\r\nlong long C[300][300];\r\n\r\nvoid test(){\r\n printf(\"test:\\n\");\r\n int x,y;\r\n while( scanf(\"%d %d\",&x, &y ) == 2 ){\r\n if( x<0 || y<0 )break;\r\n printf(\"dp[%d][%d] = %lld\\n\",x,y,dp[x][y]);\r\n }\r\n}\r\n\r\nint main()\r\n{\r\n for(int i=1;i<=260;i++){\r\n C[i][0] = C[i][i] = 1;\r\n for(int j=1; j\r\nusing namespace std;\r\n\r\ntypedef long long ll ;\r\ntypedef pair pii;\r\n#define endl '\\n'\r\nconst int maxn=255;\r\nconst int N=250;\r\nconst int p=998244353;\r\n#define pb push_back\r\n\r\nll f[maxn][maxn],c[maxn][maxn];\r\nll pw[maxn][maxn*maxn];\r\n\r\ninline void add(ll &x,ll y){\r\n x+=y;\r\n if(x>=p) x-=p; \r\n}\r\n\r\nll qpow(ll a,ll b){\r\n ll res=1;\r\n while(b){\r\n if(b&1) res=res*a%p;\r\n a=a*a%p;\r\n b>>=1;\r\n }\r\n return res;\r\n}\r\n\r\nint main(){\r\n ios::sync_with_stdio(false);\r\n cin.tie(0);\r\n int n,K;\r\n cin>>n>>K;\r\n\r\n for(int i=0;i<=N;i++) c[i][0]=1;\r\n for(int i=1;i<=N;i++){\r\n for(int j=1;j<=N;j++){\r\n c[i][j]=(c[i-1][j]+c[i-1][j-1])%p;\r\n }\r\n }\r\n for(int i=1;i<=n;i++){\r\n pw[i][0]=1;\r\n for(int j=1;j<=n*n;j++){\r\n pw[i][j]=pw[i][j-1]*i%p;\r\n }\r\n }\r\n\r\n f[1][0]=1;\r\n for(int i=1;i<=K;i++) f[1][i]=1; \r\n for(int i=2;i<=n;i++){\r\n for(int j=1;j<=K;j++){\r\n\r\n for(int k=1;k\r\nusing namespace std;\r\nusing LL = long long;\r\n\r\nconst int mod = 998244353;\r\nconst int N = 253;\r\n\r\nLL c[N][N];\r\nLL dp[N][N];\r\nint n, k;\r\n\r\nLL qpow(LL q, LL n) {\r\n LL ans = 1;\r\n while (n) {\r\n if (n & 1)\r\n ans = ans * q % mod;\r\n n >>= 1;\r\n q = q * q % mod;\r\n }\r\n return ans;\r\n}\r\n\r\nint main() {\r\n c[0][0] = 1;\r\n for (int i = 1; i < N; ++i) {\r\n c[i][0] = 1;\r\n for (int j = 1; j < N; ++j) {\r\n c[i][j] = c[i - 1][j] + c[i - 1][j - 1];\r\n c[i][j] %= mod;\r\n }\r\n }\r\n cin >> n >> k;\r\n dp[0][0] = 1;\r\n for (int i = 0; i < k; ++i) {\r\n for (int j = 0; j < n; ++j) {\r\n for (int p = 0; j + p < n; ++p) {\r\n dp[i + 1][j + p] += dp[i][j] * c[n - j - 1][p] % mod *\r\n qpow(k - i, p * (p - 1) / 2 + p * j);\r\n }\r\n }\r\n }\r\n cout << dp[k][n - 1] << endl;\r\n return 0;\r\n}", "lang": "GNU C++17", "bug_code_uid": "bac6b33b73e72905e21d662eb2d52904", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "36f74da610cb56345f48cf7479fb29d8", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.8768918708066781, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "#define _CRT_SECURE_NO_WARNINGS\r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#define Fi first\r\n#define Se second\r\n#define ll long long\r\n#define ull unsigned long long\r\nusing namespace std;\r\n\r\ntemplate bool in(T &x) {return bool(cin>>x);}\r\ntemplate bool in(T &x,Args&...args){return bool(cin>>x)&in(args...);}\r\nll gcd(ll x,ll y){return y?gcd(y,x%y):x;}\r\ntemplate ll gcd(ll x,Args... args){return gcd(x,gcd(args...));}\r\nll lcm(ll x,ll y){return x/gcd(x,y)*y;}\r\ntemplate< typename... Args> ll lcm(ll x,Args... args){return lcm(x,lcm(args...));}\r\n\r\n#define inf 0x3f3f3f3f\r\n#define lowbit(x) (x&-x)\r\n#define mmin(x,y,z) min(x,min(y,z))\r\n#define mmax(x,y,z) max(x,max(y,z))\r\n#ifndef ONLINE_JUDGE\r\n void err(istream_iterator){}\r\n template\r\n void err(istream_iterator it, T a, Args... args) {cout<<*it<<\"=\"<(it), args);cout<>=1; a=(a*a)%mod;}\r\n return ans;\r\n}\r\nll inv(ll x) {return quickPow(x,mod-2);}\r\nll fac[M],ifac[M],c[M][M],q[M][M*M];\r\nll C(int n,int m){\r\n if(n>1;j++){\r\n q[i][j]=q[i][j-1]*i%mod;\r\n }\r\n }\r\n for(int i=1;i<=n;i++){\r\n for(int j=1;j<=k;j++){\r\n for(int x=1;x<=i;x++){\r\n dp[i][j]+=dp[x][j-1]*c[i-1][i-x]%mod*q[k-j+1][(i-x-1)*(i-x)/2+(i-x)*(x-1)]%mod;\r\n dp[i][j]%=mod;\r\n }\r\n }\r\n }\r\n printf(\"%lld\\n\",dp[n][k]);\r\n#ifndef ONLINE_JUDGE\r\n printf(\"The run time is:%.3fs\\n\",(double)clock()/CLOCKS_PER_SEC);\r\n#endif\r\n return 0;\r\n} \r\n/*\r\n3 2\r\ni=2 j=2 p=0 t=0 k-j+1=1 (p+i-1)*(i-p)/2=1 pw[k-j+1][(p+i-1)*(i-p)/2]=1\r\ni=2 j=2 p=0 t=1 k-j+1=1 (p+i-1)*(i-p)/2=1 pw[k-j+1][(p+i-1)*(i-p)/2]=1\r\ni=2 j=2 p=1 t=0 k-j+1=1 (p+i-1)*(i-p)/2=1 pw[k-j+1][(p+i-1)*(i-p)/2]=1\r\ni=2 j=2 p=1 t=1 k-j+1=1 (p+i-1)*(i-p)/2=1 pw[k-j+1][(p+i-1)*(i-p)/2]=1\r\ndp=2\r\ndp=3\r\n\r\n\r\ni=2 j=1 dp[x][j-1]=1 c=1 q=2\r\ni=2 j=1 dp[x][j-1]=0 c=1 q=2\r\ni=2 j=1 dp[x][j-1]=0 c=0 q=1\r\ni=2 j=2 dp[x][j-1]=0 c=1 q=1\r\ni=2 j=2 dp[x][j-1]=1 c=1 q=1\r\ni=2 j=2 dp[x][j-1]=2 c=0 q=1\r\nll b=(i-1+x )*(i-x)/2;\r\n*/ ", "lang": "GNU C++17", "bug_code_uid": "6dac32921d5443b4906d1ddb4e9a6921", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "fab42becc78178bd5385ee6441b1d9f1", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.1245774987928537, "equal_cnt": 19, "replace_cnt": 10, "delete_cnt": 0, "insert_cnt": 9, "fix_ops_cnt": 19, "bug_source_code": "#include \r\n#include \"math/montgomery.h\"\r\n#include \"math/util.h\"\r\n#include \"math/ntt.h\"\r\n\r\n#define itn int\r\n#define all(x) (x).begin(), (x).end()\r\n// #define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())\r\n\r\nusing namespace std;\r\n\r\ninline int nxt() {\r\n\tint x;\r\n\tscanf(\"%d\", &x);\r\n\treturn x;\r\n}\r\n\r\nconstexpr int mod = 998'244'353;\r\nusing Mint = Montgomery;\r\n\r\nconst int N = 266;\r\n\r\nNTT ntt;\r\n\r\nvoid solve() {\r\n\tint n = nxt() - 1, k = nxt();\r\n\tInvfactStuff stuff(n);\r\n\tvector dp(n + 1);\r\n\tdp[0] = 1;\r\n\tvector tmp(n + 1);\r\n\tfor (int mx = 1; mx <= k; ++mx) {\r\n\t\tvector ot(n + 1);\r\n\t\tfor (int i = 0; i <= n; ++i) {\r\n\t\t\tdp[i] *= Mint(k + 1 - mx).pow(i * (i - 1) / 2).inverse();\r\n\t\t\tot[i] = stuff.inverse_factorial(i);\r\n\t\t}\r\n\t\tdp = ntt.multiply(dp, ot);\r\n\t\tdp.resize(n + 1);\r\n\t\tfor (int i = 0; i <= n; ++i) {\r\n\t\t\tdp[i] *= Mint(k + 1 - mx).pow(i * (i - 1) / 2);\r\n\t\t}\r\n\t}\r\n\tcout << dp[n] * stuff.factorial(n) << \"\\n\";\r\n}\r\n\r\nint main() {\r\n\tint t = 1; // nxt();\r\n\twhile (t--) {\r\n\t\tsolve();\r\n\t}\r\n\r\n\treturn 0;\r\n}\r\n", "lang": "GNU C++17", "bug_code_uid": "dc30734301660fc9ef0d450828c0fb33", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "b779d3a2f509caab3923500fbb22d452", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9971590909090909, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include\r\n//#define int long long\r\n#define ll long long\r\n//#define x first\r\n//#define y second\r\n#define all(v) v.begin(),v.end()\r\n#define mem(x,y) memset(x,y,sizeof(x))\r\n#define rb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)\r\nusing namespace std;\r\nconst int mod=998244353;\r\nconst double PI=acos(-1);\r\n#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator _it(_ss); err(_it, args); }\r\nmt19937_64 rb3(time(NULL));\r\nvoid err(istream_iterator it) {puts(\"\");}\r\ntemplate\r\nvoid err(istream_iterator it, T a, Args... args) {\r\n\tcerr << *it << \" = \" << a << \" \";\r\n\terr(++it, args...);\r\n}\r\nconst int MAXN = 300;\r\nint C[MAXN+1][MAXN+1];\r\nvoid Initial()\r\n{\r\n int i,j;\r\n for(i=0; i<=MAXN; ++i)\r\n {\r\n C[0][i] = 0;\r\n C[i][0] = 1;\r\n }\r\n for(i=1; i<=MAXN; ++i)\r\n {\r\n for(j=1; j<=MAXN; ++j)\r\n C[i][j] = (C[i-1][j] + C[i-1][j-1]) % mod;\r\n }\r\n}\r\nsigned main(){\r\n\tInitial();\r\n\tauto ksm=[&](ll base, ll power) \r\n\t{\r\n\t base%=mod;\r\n\t ll result = 1;\r\n\t while (power > 0) \r\n\t {\r\n\t if (power & 1) \r\n\t {\r\n\t result = result * base %mod;\r\n\t }\r\n\t power >>= 1;\r\n\t base = (base * base) %mod;\r\n\t }\r\n\t return result;\r\n\t};\r\n\tint n,k;\r\n\tscanf(\"%d%d\",&n,&k);\r\n\tvector f(k+1,vector(n+1));//\u5f53\u524d\u662fi\u4e2a\u70b9\u7684\u5b8c\u5168\u56fe\u6700\u5927\u6743\u503c\u4e3aj\u7684\u65b9\u6848\u6570\r\n\tf[0][0]=1;\r\n\tfor(int j=1;j<=k;j++){//\u8fd9\u4e9b\u70b9\u4e0e1\u8fde\u7684\u6743\u503c \r\n\t\tfor(int last=0;last\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\n#define ll long long\n#define ull unsigned long long\n#define MOD 998244353LL\n// #define MOD 1000000007LL\n#define INFD INT_MAX\n#define INFL 1000000000000000000LL\n#define eps 1e-9\n#define PI 3.14159265358979\n#define mp make_pair\n#define pb push_back\n#define F first\n#define S second\n#define pow __pow\n#define gcd __gcd\n#define count __count\n#define sd(x) scanf(\"%d\", &(x))\n#define slld(x) scanf(\"%lld\", &(x))\n#define pd(x) printf(\"%d\\n\", (x))\n#define plld(x) printf(\"%lld\\n\", (x))\n#define gc getchar\n#define pll pair \n#define contains(S, x) (S.find(x) != S.end())\n\nll pow(ll a, ll e) {\n\tif(e == 0) return 1;\n\tll h = pow(a, e / 2);\n\th = (h * h) % MOD;\n\tif(e & 1) h = (h * a) % MOD;\n\treturn h;\n}\n\nconst ll N = 250;\nconst ll K = 250;\n\n// [1..k][1..n - 1]\nll f[K + 1][N];\n\nint main() {\n\t// freopen(\"in\", \"r\", stdin);\n\t// freopen(\"out\", \"w\", stdout);\n\tll n, k; cin >> n >> k;\n\tfor(ll l = 1; l <= k; l++) {\n\t\tf[l][1] = k - l + 1;\n\t}\n\tfor(ll i = 2; i <= n - 1; i++) {\n\t\tfor(ll l = 1; l <= k; l++) {\n\t\t\tf[l][i] = 0;\n\t\t\tfor(ll w = 1; w <= l; w++) {\n\t\t\t\tf[l][i] = (f[l][i] + (pow(k - w + 1, i - 1) * f[w][i - 1]) % MOD) % MOD;\n\t\t\t}\n\t\t}\n\t}\n\tcout << f[k][n - 1] << endl;\n}", "lang": "GNU C++17", "bug_code_uid": "0e778af109799892eabdcf36c7986424", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "7e492b8c91cffed04dcce023fa81b79d", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9885958660014256, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "#include \r\nusing namespace std;\r\n#define int long long\r\n#define REP(i,a,b) for(int i=(a);i<(b);i++)\r\n#define RREP(i,a,b) for(int i=(a)-1;i>(b)-1;i--)\r\n#define F first\r\n#define S second\r\n#define pb push_back\r\n#define mp make_pair\r\n#define zero(a) memset(a,0,sizeof(a))\r\ntypedef vector vi;\r\ntypedef vector > vvi;\r\ntypedef pair pi;\r\ntypedef vector vpi;\r\ntypedef vector vll;\r\ntypedef long long ll;\r\ntypedef pair pd;\r\ntypedef pair pll;\r\n \r\nint N=998244353;\r\nint keep[500][500];\r\nll qpow(int a,int b){\r\nll ans=1;\r\nwhile(b!=0){\r\nif(b%2==0){a=(ll)a*a%N;b/=2;}\r\nelse{ans=ans*a%N;b--;\r\n}}\r\nreturn ans;\r\n}\r\nint inv(int a){return qpow(a,N-2);}\r\nint choose(int n,int k){\r\n if(keep[n][k])return keep[n][k];\r\n int ans=1;\r\n REP(i,1,k+1){\r\n ans=ans*inv(i)%N;\r\n ans=ans*(n-i+1)%N;\r\n }\r\n return keep[n][k]=ans;\r\n}\r\nsigned main() {\r\n memset(keep,-1,sizeof(keep));\r\n int n,k; cin >> n >> k;\r\n int dp[k+1][n];zero(dp);\r\n REP(i,0,k+1)dp[i][0]=1;\r\n REP(i,1,k+1){\r\n REP(j,1,n){\r\n REP(t,0,j+1){\r\n dp[i][j]+=((dp[i-1][t]*qpow(i,(j-t)*(n-j-1)+((j-t)*(j-t-1))/2))%N)*choose(n-1-t,j-t)%N;\r\n dp[i][j]=dp[i][j]%N;\r\n //cout << dp[2][2] << \"\\n\";\r\n }\r\n }\r\n }\r\n //cout << dp[1][2]<<\"\\n\";\r\n cout << dp[k][n-1]<< \"\\n\";\r\n}\r\n", "lang": "GNU C++17", "bug_code_uid": "023d61c4752fda21aad10cffaba01a3e", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "9dffc0c9214de7acf79116b7b6b7ae03", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9974826935179358, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#define Epsilon 0.00000000001f\n#define ll long long int\n#define ld long double\n#define forn(i, n) for (int i = 0; i < int(n); i++)\n#define forn1(i, n) for (int i = 1; i <= int(n); i++)\n#define forn_reverse(i, n) for (int i = (int)n-1; i >= 0; i--)\n#define fi first\n#define se second\n\nusing namespace std;\nll mod = 1e9 + 7;\n\n\n\n//-----------------\n//FUNCTIONS\n//-----------------\nvoid printv(vector& v){\n for(int j = 0;j< v.size();j++){\n cout << v[j] << \" \";\n }\n cout << \"\\n\";\n}\nvoid printv(vector& v){\n for(int j = 0;j< v.size();j++){\n cout << v[j] << \" \";\n }\n cout << \"\\n\";\n}\nvoid printm(vector>& v){\n for(int i = 1;i< v.size()-1;i++){\n for(int j = 1;j < v[0].size() - 1;j++){\n cout << v[i][j] << \" \";\n }\n cout << \"\\n\";\n }\n}\nvoid prints(vector& v){\n for(int j = 0;j< v.size();j++){\n cout << v[j];\n }\n cout << \"\\n\";\n}\n\n//void printp(vector>& v){\n// for(int j = 0;j< v.size();j++){\n// cout << v[j].first << \" \" << v[j].second << \"\\n\";\n// }\n// cout << \"\\n\";;\n//}\n\nll _gcd(ll a, ll b){\n if(a == 0) return b;\n if(b == 0) return a;\n if(a > b) return _gcd(a%b, b);\n else return _gcd(a, b%a);\n}\n\nll _lcp(ll a, ll b){\n ll gcd = _gcd(a, b);\n a = a / gcd;\n b = b / gcd;\n return (ll) a * (ll)b * (ll) gcd;\n}\n\nll _exp(ll x, ll y){\n //x ^ y\n //000100010\n ll res = 1;\n while(y > 0){\n if(y % 2 == 1){\n res = res * x;\n res = res % mod;\n }\n y = y / 2;\n x = x * x;\n x = x % mod;\n }\n res = res % mod;\n return (ll)res;\n}\n\nll _oneover(ll x){\n ll p = mod;\n return _exp(x, p-2);\n}\n\nll _fact(ll x){\n if(x == 0)return 0;\n ll res = 1;\n for(ll i = 1;i <= x;i++) res = (res * i) % mod;\n return res;\n}\n\nll _ceil(ll a, ll b){\n if(a ==0 || b == 0)return 0;\n //a / b;\n if(a%b ==0) return (ll) a / b ;\n else return (ll)a/b + 1;\n}\n\n//-----------------\n//END FUNCTIONS\n//-----------------\n\n//-----------------\n//Segment Tree\n//-----------------\n\nstruct ST{\n vector st;\n int start;\n int endd;\n \n void init(int n){\n start = 1;\n while(start < n){\n start = start * 2;\n }\n endd = start*2 - 1;\n st.resize(endd+1);\n }\n void initV(int n, vector& v){\n for(int i =0;i= start) return;\n recurseST(cur *2);\n recurseST(cur *2 + 1);\n st[cur] = st[cur*2] + st[cur*2+1];\n }\n \n void setI(int i, ll x){\n i = i + start;\n st[i] = x;\n i = i / 2;\n while(i >= 1){\n st[i] = max(st[i*2], st[i*2 + 1]);\n i = i / 2;\n }\n }\n \n\n void decrease(int i){\n decreaseST(i + start);\n }\n void decreaseST(int cur){\n st[cur]--;\n cur = cur / 2;\n while(cur >= 1){\n st[cur]--;\n cur = cur/2;\n }\n }\n ll getSum(int l, int r){\n return getSum(1, l+start, r+start, start, endd);\n }\n ll getSum(int cur, int l, int r, int h, int t){\n if(r < h || l > t) return 0;\n if(h >= l&& t <= r)return st[cur];\n return getSum(cur*2, l, r, h, (h+t)/2)+ getSum(cur*2 + 1, l,r,(h+t)/2 +1, t);\n }\n ll getMax(int l, int r){\n return getMax(1, l+start, r+start, start, endd);\n }\n \n ll getMax(int cur, int l, int r, int head, int tail){\n if(r < head || l > tail) return LLONG_MIN;\n if(head >= l && tail <= r) return st[cur];\n return max(getMax(cur*2, l, r, head, (head+tail)/2), getMax(cur*2 + 1, l,r,(head+tail)/2 +1, tail));\n }\n};\n//-----------------\n//End Segment Tree\n//-----------------\n\n\n//1) Check array boundaries\n//2) Check integer overflows (ll to int)\n//3) Increment on time\n//4) Do early breaks in dfs\n//5) Revisit all cases\n//6) Care for doubles (try not to use them)\n//7) Do prefix/suffix sums correctly (psum[i] - psum[j] != ssum[j] - ssum[i])\n//8) Add modules everywhere, do so correctly\n\n\nll f(ll b, ll a){\n ll res = (a * (a+1)) /2;\n res = res % mod;\n res -= ((b * (b-1)) / 2) %mod;\n res = (res + mod) % mod;\n return res;\n}\nvector facts(265);\n\nll cnk(ll n, ll k){\n return (facts[n] * _oneover((facts[n-k] * facts[k])%mod)) % mod;\n}\n\nvoid solve(){\n int n,k;\n cin>> n>> k;\n vector> dp(n+1, vector (k+1, 0));\n for(int i = 1;i <= n-1;i++)\n {\n dp[i][1] = _exp(k, (i * (i-1))/2);\n }\n for(int j = 1;j <= k;j++){\n dp[1][j] = j;\n }\n for(int i = 2;i <= n-1;i++){\n for(int j = 2; j <= k;j++){\n //dp[i][j] = dp[i][j-1] + dp[i-1][j-1] ... dp[i-i][j-1]\n for(int p = i; p >= 0;p--){\n if(p == i){\n dp[i][j] += dp[p][j-1];\n }else{\n if(p == 0){\n dp[i][j] += (1 * (_exp((k - j + 1), f(p, i-1))% mod)) % mod;\n }\n else\n dp[i][j] += (cnk(i, i-p) * (dp[p][j-1] * (_exp((k - j + 1), f(p, i-1))% mod)) % mod) % mod;\n }\n dp[i][j] %= mod;\n }\n }\n }\n cout << dp[n-1][k] << \"\\n\";\n}\n\n\nint main() {\n mod = 998244353;\n facts[1] = 1;\n for(ll i = 2;i <= 260;i++){\n facts[i] = (facts[i-1]* i) % mod;;\n }\n // TODO:\n cerr << \"coding...\\n\";\n ios_base::sync_with_stdio(false);\n cin.tie(NULL);\n \n// int ti;cin>>ti;while(ti--)\n solve();\n}\n\n// do something, stay focused\n// look for stupid bugs\n// guess, slow, stress\n// don't overgeneralize\n// don't rush\n \n// 1. Understand the problem\n// 2. Devise a plan\n// 3. Carry out the plan\n// 4. Look back\n \n// don't waste time on standings\n \n// THE SOLUTION IS ALWAYS SIMPLE\n// THE CODE IS ALWAYS SHORT\n\n", "lang": "GNU C++17", "bug_code_uid": "de102e2749fb3325412f4b9c83098fc7", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "e100401daa433a9660c8c472dd5c22bc", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9954637096774194, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "#include \r\n#define F first\r\n#define S second\r\n#define pb push_back\r\n#define mp make_pair\r\n\r\nusing namespace std;\r\ntypedef long long ll;\r\ntypedef pair pii;\r\n\r\n#include \r\n#include \r\nusing namespace __gnu_pbds;\r\n \r\n#define ordered_set tree, null_type,less>, rb_tree_tag,tree_order_statistics_node_update>\r\n\r\nconst int INF = 1e7;\r\nconst ll longINF = 1e17;\r\nconst int mxN = 250 + 9;\r\nconst int mxM = 1e5 + 9;\r\nconst int MOD = 998244353;\r\nconst double pi = acos (-1);\r\n\r\nvoid setIO (string s) {\r\n\tfreopen ((s + \".in\").c_str(), \"r\", stdin);\r\n\tfreopen ((s + \".out\").c_str(), \"w\", stdout);\r\n\t\r\n\treturn;\r\n}\r\n\r\nll dp[mxN][mxN], nCr[mxN][mxN];\r\nint n, k;\r\n\r\nll bp (ll a, ll b) {\r\n\tif (b == 0)\r\n\t\treturn 1;\r\n\t\t\r\n\tll tmp = bp (a, b / 2);\r\n\tif (b & 1)\r\n\t\treturn tmp * tmp % MOD * a % MOD;\r\n\treturn tmp * tmp % MOD;\r\n}\r\n\r\nll getCalc (int emptyVertices, int weight) {\r\n\tif (weight > k) \r\n\t\treturn emptyVertices == 0;\r\n\t\r\n\tif (dp[emptyVertices][weight] != -1)\r\n\t\treturn dp[emptyVertices][weight];\r\n\t\r\n\tll res = 0;\r\n\tfor (int cnt = 0; cnt <= emptyVertices; cnt++) {\r\n\t\tll edges = nCr[cnt][2] + (n - emptyVertices) * cnt;\r\n\t\tll chosenCost = nCr [emptyVertices][cnt] * bp (k - weight + 1, edges) % MOD;\r\n\t\t\r\n\t\tres += chosenCost * getCalc (emptyVertices - cnt, weight + 1) % MOD;\r\n\t\tres %= MOD;\t\t\r\n\t}\r\n\t\r\n\treturn dp[emptyVertices][weight] = res;\r\n}\r\n\r\nvoid solve () {\r\n\tcin >> n >> k;\r\n\tn--;\r\n\t\r\n\tnCr[0][0] = 1;\r\n\tfor (int i = 1; i <= n; i++) {\r\n\t\tnCr[i][0] = nCr[i][i] = 1;\r\n\t\tfor (int j = 1; j < i; j++)\r\n\t\t\tnCr[i][j] = nCr[i - 1][j - 1] + nCr[i - 1][j];\r\n\t}\r\n\t\r\n\tmemset (dp, -1, sizeof (dp));\r\n\tcout << getCalc (n, 1) << \"\\n\";\r\n\treturn;\r\n}\r\n\r\nint main () {\r\n\tint t = 1;\r\n\t//cin >> t;0\r\n\t\r\n\t//ios_base::sync_with_stdio (0);\r\n\t//cin.tie (0);\r\n\t\r\n\t//setIO (\"deleg\");\r\n\t//preCalc ();\r\n\twhile (t--) {\r\n\t\t//initialize common variables\r\n\t\t\r\n\t\t\r\n\t\t//go solve\r\n\t\tsolve ();\r\n\t}\r\n\t\t\r\n\treturn 0;\r\n}\r\n", "lang": "GNU C++17", "bug_code_uid": "10269bcf3ba4343d95d6224f8a18ccba", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "5c2a624832ecd3a6eb986ffc0c5121e1", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9202919708029197, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "//------------------------ Un, Deux, Trois, Quatre, Cinq -----------------------//\r\n#pragma GCC target (\"avx2\")\r\n#pragma GCC optimize (\"O3\")\r\n#pragma GCC optimize (\"unroll-loops\")\r\n\r\n#include\r\nusing namespace std;\r\n\r\n// Shorthands\r\n#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);\r\n#define endl \"\\n\"\r\n#define ll long long\r\n#define ld long double\r\n#define vll vector\r\n#define pb push_back\r\n#define eb emplace_back\r\n#define lb lower_bound\r\n#define ub upper_bound\r\n#define pll pair\r\n#define vpll vector\r\n#define ff first\r\n#define ss second\r\n#define tll tuple\r\n#define vtll vector \r\n#define mt make_tuple\r\n#define rep(i,a,b) for(ll i=a; i=b; i--)\r\n#define vect(a,n) vll a(n); rep(i,0,n) cin>>a[i];\r\n#define all(a) a.begin(),a.end()\r\n#define sortall(a) sort(a.begin(),a.end());\r\n#define PI acos(-1)\r\n\r\n// Debug\r\n#define printv(a) rep(i,0,a.size()) cout<(t)<<\",\"<(t)<<\",\"<(t)<<\")\"<' << #x << ':' << (x) << \"\\n\";\r\n#define trace2(x,y) cout<< '>' << #x << ':' << (x) << \" | \" << #y << ':' << (y) << \"\\n\";\r\n#define trace3(a,b,c) cout<<#a<<\"=\"<<(a)<<\", \"<<#b<<\"=\"<<(b)<<\", \"<<#c<<\"=\"<<(c)<<\"\\n\";\r\n#define trace4(a,b,c,d) cout<<#a<<\"=\"<<(a)<<\", \"<<#b<<\"=\"<<(b)<<\", \"<<#c<<\"=\"<<(c)<<\", \"<<#d<<\"=\"<<(d)<<\"\\n\";\r\n\r\n// Constants\r\nconst ll INF = 1e18;\r\nconst ll mod = 998244353;\r\nconst ll MOD = 1e9 + 7;\r\nconst ll mxN = 1e6 + 5;\r\n\r\n// Input/Output File\r\nvoid fileio()\r\n{\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//-------------------------- Six, Sept, Huit, Neuf, Dix ------------------------//\r\n\r\nconst ll M = mod; \r\n\r\nll modExp(ll a, ll p) {\r\n\ta %= M;\r\n\tll res=1;\r\n\twhile(p > 0) {\r\n\t\tif(p & 1) res = res * a % M;\r\n\t\ta = a * a % M; \r\n\t\tp >>= 1;\r\n\t}\r\n\treturn res;\r\n}\r\nll modInv(ll a) {\r\n\treturn modExp(a,M-2) % M ;\r\n}\r\n\r\nll fact[mxN];\r\nll ifact[mxN];\r\n\r\nvoid pre() {\r\n\tfact[0] = 1 ;\r\n\tfor(ll i = 1; i< mxN; i++) \r\n\t\tfact[i] = i * fact[i-1] % M ;\r\n \r\n\tifact[mxN-1] = modInv(fact[mxN-1]) ; \r\n\t\r\n\tfor(ll i = mxN-1 ; i>0 ; i--) \r\n\t\tifact[i-1] = ifact[i] * i % M ;\r\n}\r\n \r\nll nCr(ll n, ll r) {\r\n\tif (n < r || r < 0 || n < 0) return 0;\r\n\tll res = fact[n] * ifact[r] % M * ifact[n-r] % M ;\r\n\treturn res ;\r\n}\r\n\r\n\r\nvoid solve()\r\n{\r\n ll n, k; cin >> n >> k;\r\n\r\n ll dp[n+1][k+1];\r\n ll s[n+1][k+1];\r\n memset(dp, 0, sizeof(dp));\r\n memset(s, 0, sizeof(s));\r\n dp[1][0] = 1;\r\n s[1][0] = 1;\r\n rep(i,2,n+1)\r\n {\r\n rep(j,1,k+1) s[i-1][j] = s[i-1][j-1] + dp[i-1][j];\r\n rep(j,1,k+1)\r\n {\r\n rrep(i1,i-1,0)\r\n {\r\n ll x = i - i1;\r\n ll e = (i1-1)*x + x*(x-1)/2;\r\n ll c = nCr(n-i1, x) * modExp(k-j+1, e) % M; \r\n dp[i][j] += s[i1][j-1] * c % M;\r\n dp[i][j] %= M;\r\n }\r\n }\r\n }\r\n\r\n // rep(i,1,n+1)\r\n // {\r\n // rep(j,0,k+1) cout << dp[i][j] << \" \";\r\n // cout << endl;\r\n // }\r\n\r\n ll ans = 0;\r\n rep(j,0,k+1) \r\n {\r\n ans += dp[n][j];\r\n ans %= M;\r\n }\r\n cout << ans << endl;\r\n} \r\n\r\n\r\nint main()\r\n{\r\n fastio; // fileio();\r\n pre();\r\n // int tc; cin >> tc; while(tc--)\r\n solve();\r\n}\r\n", "lang": "GNU C++17", "bug_code_uid": "4645bcd53e3787d19fb1e55a88207f40", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "1cd31ddfeb7287ed3da594934c92a6c9", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.5353335965258587, "equal_cnt": 31, "replace_cnt": 19, "delete_cnt": 3, "insert_cnt": 8, "fix_ops_cnt": 30, "bug_source_code": "#include \r\n#define F first\r\n#define S second\r\nusing namespace std;\r\ntypedef long long ll;\r\ntypedef long double ld;\r\ntypedef pair pii;\r\nconst int M = 998244353, N = 270;\r\nint n, k, dp[N][N][2];\r\nint add(int a, int b) {\r\n return (a + b) % M;\r\n}\r\nint mul(int a, int b) {\r\n return (a * 1LL * b) % M;\r\n}\r\nint fp(int b, int p) {\r\n if (!p) return 1;\r\n int ret = fp(b, p >> 1);\r\n ret = mul(ret, ret);\r\n if (p & 1) ret = mul(ret, b);\r\n return ret;\r\n}\r\nint solve(int idx, int mn, bool done) {\r\n if (idx == n) return done;\r\n if (~dp[idx][mn][done]) return dp[idx][mn][done];\r\n int ret = 0;\r\n for (int i = mn; i <= k; i++)\r\n ret = add(ret, solve(idx + 1, mn, done | (i == mn)));\r\n return dp[idx][mn][done] = ret;\r\n}\r\nint summation(int x) {\r\n return (x * (x + 1)) / 2;\r\n}\r\nint main() {\r\n ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);\r\n cin >> n >> k;\r\n memset(dp, -1, sizeof dp);\r\n int remEdges = summation(n - 2);\r\n ll ans = 0;\r\n for (int i = 1; i <= k; i++)\r\n ans = add(ans, mul(fp(i, remEdges), solve(1, i, 0)));\r\n cout << ans;\r\n return 0;\r\n}", "lang": "GNU C++17", "bug_code_uid": "b242ce6b81eeb972dda58bfd7c5529f4", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "17f51480126c36cb54375e19f1dcaa71", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9987320371935756, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \r\n\r\nusing namespace std;\r\ntypedef long long ll;\r\n\r\ntemplate\r\nstruct ModInt{\r\n unsigned long long x = 0;\r\n ModInt(){x = 0;}\r\n ModInt(signed sig){x = sig;}\r\n ModInt(signed long long sig){x = sig % MOD;}\r\n ModInt pow(long long p) {ModInt res = 1, a = *this; while(p){if(p & 1) res*= a; a*= a; p>>= 1;} return res;}\r\n \r\n ModInt &operator+=(ModInt that){if((x+= that.x) >= MOD) x-= MOD; return *this;}\r\n ModInt &operator-=(ModInt that){if((x+= MOD - that.x) >= MOD) x-= MOD; return *this;}\r\n ModInt &operator*=(ModInt that){x = (unsigned long long)x * that.x % MOD; return *this;}\r\n ModInt &operator/=(ModInt that){return (*this)*= that.pow(MOD - 2); }\r\n \r\n ModInt operator+(ModInt that) const{return ModInt(*this)+= that;}\r\n ModInt operator-(ModInt that) const{return ModInt(*this)-= that;}\r\n ModInt operator*(ModInt that) const{return ModInt(*this)*= that;}\r\n ModInt operator/(ModInt that) const{return ModInt(*this)/= that;}\r\n bool operator<(ModInt that) const{return x < that.x;}\r\n bool operator==(ModInt that) const{return x == that.x;}\r\n bool operator!=(ModInt that) const{return x != that.x;}\r\n friend ostream& operator<<(ostream &os, ModInt a){os << a.x; return os;}\r\n friend istream& operator>>(istream &is, ModInt &a){is >> a.x; return is;}\r\n};\r\ntypedef ModInt<998244353> mint;\r\n\r\nint main(){\r\n ios::sync_with_stdio(false);\r\n cin.tie(0);\r\n const int mod = 998244353;\r\n auto power = [&](ll x, ll y)->ll{\r\n ll ret = 1;\r\n while(y){\r\n if(y & 1) ret = (ret * x) % mod;\r\n x = (x * x) % mod; y>>= 1;\r\n }\r\n return ret;\r\n };\r\n vector fact(255, 1), invfact(255, 1);\r\n for(int i = 2; i <= 250; i++)\r\n fact[i] = (fact[i - 1] * i) % mod;\r\n invfact[250] = power(fact[250], mod - 2);\r\n for(int i = 249; i >= 1; i--)\r\n invfact[i] = (invfact[i + 1] * (i + 1)) % mod;\r\n int n, k;\r\n cin >> n >> k;\r\n vector dp(n + 5, vector(k + 5, 0));\r\n for(int i = 0; i <= n - 1; i++)\r\n dp[0][i] = 1;\r\n for(int i = 1; i <= n - 1; i++){\r\n for(int w = 1; w <= k; w++){\r\n dp[i][w]+= dp[i][w - 1];\r\n for(int j = 1; j <= i; j++){\r\n if(i == 1){\r\n dp[i][w]+= 1;\r\n }else{\r\n dp[i][w]+= dp[i - j][w - 1] * fact[i] * invfact[i - j] * invfact[j] * power(k - w + 1, (i - j) * j + ((j - 1) * j / 2));\r\n }\r\n }\r\n }\r\n }\r\n cout << dp[n - 1][k];\r\n}", "lang": "GNU C++17", "bug_code_uid": "5df7d252920be325014d40451cde4989", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "15e07fc5d101cd323538e1ff3084bbbe", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9855142443264123, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\nusing namespace std;\r\ntypedef long long ll;\r\ntypedef pair P;\r\nconst ll inf = 1e18;\r\nconst int maxn = 400010;\r\n#define pr(x) cout << #x << \" = \" << x << \" \";\r\n#define prln(x) cout << #x << \" = \" << x << \" \" << endl;\r\n\r\nint n, k;\r\nint c[300][300];\r\nint dp[300][300];\r\nconst int mod = 998244353;\r\n\r\nint add_mod(int a, int b)\r\n{\r\n a += b;\r\n if (a >= mod)\r\n a -= mod;\r\n return a;\r\n}\r\n\r\nint mul_mod(int a, int b)\r\n{\r\n return a * 1ll * b % mod;\r\n}\r\n\r\nint pow_mod(int a, int k)\r\n{\r\n int res = 1;\r\n while (k)\r\n {\r\n if (k & 1)\r\n res = mul(res, a);\r\n a = mul(a, a);\r\n k >>= 1;\r\n }\r\n return res;\r\n}\r\n\r\nvoid init()\r\n{\r\n memset(c, 0, sizeof(c));\r\n c[0][0] = c[1][0] = c[1][1] = 1;\r\n for (int i = 2; i <= n; i++)\r\n {\r\n c[i][0] = 1;\r\n for (int j = 1; j <= i; j++)\r\n {\r\n c[i][j] = add_mod(c[i - 1][j], c[i - 1][j - 1]);\r\n }\r\n }\r\n}\r\n\r\nint cal_edge(int n, int k)\r\n{\r\n return k * (k - 1) / 2 + k * (n - 1 - k);\r\n}\r\n\r\nint dfs(int n, int ck)\r\n{\r\n if (dp[n][ck] != -1)\r\n return dp[n][ck];\r\n if (n == 1)\r\n return 1;\r\n if (ck == 0)\r\n return 0;\r\n int ans = 0;\r\n for (int i = 0; i < n; i++)\r\n {\r\n ans = add_mod(ans, mul_mod(mul_mod(c[n - 1][i], dfs(n - i, ck - 1)), pow_mod(k - ck + 1, cal_edge(n, i))));\r\n }\r\n dp[n][ck] = ans;\r\n return ans;\r\n}\r\n\r\nint main()\r\n{\r\n // freopen(\"C:/Users/97211/Desktop/in.txt\", \"r\", stdin);\r\n\r\n memset(dp, -1, sizeof(dp));\r\n scanf(\"%d %d\", &n, &k);\r\n init();\r\n printf(\"%d\\n\", dfs(n, k));\r\n // for (int i = 1; i <= n; i++)\r\n // {\r\n // for (int j = 1; j <= k; j++)\r\n // cout << dp[i][j] << \" \";\r\n // cout << endl;\r\n // }\r\n return 0;\r\n}", "lang": "GNU C++17", "bug_code_uid": "84d0fda924df180c1b79658dc0c5c4e2", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "6e5a37829d3d17d14a58010cddbe1dc3", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9971724787935909, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "#include \r\n#include \r\n#include \r\n#include\r\n#define int long long\r\nusing namespace std;\r\nconst int mod=998244353;\r\nint dp[310][310];\r\nint ai[310],bi[310];\r\nint n,k;\r\nint qmi(int a, int k, int p) // \ufffd\ufffda^k mod p\r\n{\r\n int res = 1 % p;\r\n while (k)\r\n {\r\n if (k & 1) res = (int)res * a % p;\r\n a = (int)a * a % p;\r\n k >>= 1;\r\n }\r\n return res;\r\n}\r\nvoid inti()\r\n{\r\n ai[0]=1;\r\n bi[0]=1;\r\n for(int i=1;i<=300;i++)\r\n {\r\n ai[i]=ai[i-1]*i%mod;\r\n bi[i]=bi[i-1]*qmi(i,mod-2,mod)%mod;\r\n }\r\n}\r\nint C(int a,int b)\r\n{\r\n if(a\r\n//#pragma GCC optimize(2)\r\nusing namespace std;\r\n#define endl '\\n'\r\n#define BUFF ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)\r\n#define IO freopen(\"in.txt\",\"r\",stdin),freopen(\"out.txt\",\"w\",stdout)\r\n#define watch(x) cout<<#x<<\"=\"<\r\nvoid P(T val,Args...args){cout< pii;\r\nconst ll D = 0;\r\nconst ll N = 300 + 5;\r\nconst ll mod = 998244353;\r\nconst ll inf = 4e18;\r\nconst double eps = 1e-9;\r\ninline ll qpow(ll a, ll b,ll p = mod) \r\n{\r\n \tll ans = 1;\r\n // a = (a % p + p) % p;\r\n for (; b; b >>= 1) \r\n {\r\n if(b & 1) ans = (a * ans) % p;\r\n a = (a * a) % p;\r\n }\r\n return ans;\r\n}\r\n\r\nll dp[N][N];\r\nll n,k;\r\nll f[N][N];\r\nll jc[N];\r\nll C[N][N];\r\nll mul3(ll x1,ll x2,ll x3)\r\n{\r\n\tll ret = 1;\r\n\tret = x1*x2%mod;\r\n\tret = ret*x3%mod;\r\n\treturn ret;\r\n}\r\nint solve()\r\n{\r\n\t\r\n\tfor(int i=0;i<=300;i++)\r\n\t{\r\n\t\tC[i][0] = 1;\r\n\t}\r\n\tfor(int i=1;i<=300;i++)\r\n\t{\r\n\t\tfor(int j=1;j<=i;j++)\r\n\t\t{\r\n\t\t\tC[i][j] = C[i-1][j-1] + C[i-1][j];\r\n\t\t\tC[i][j] %= mod;\r\n\t\t}\r\n\t}\r\n\t//P(C[6][3]);\r\n\r\n\r\n\tcin>>n>>k;\r\n\t//dp[0][1] = 1;\r\n\tfor(ll i=1;i<=k;i++)\r\n\t\t//dp[0][i] = 1;\r\n\r\n\r\n\tfor(ll i=1;i<=n-1;i++)\r\n\t{\r\n\t\tdp[i][1] = C[n-1][i] * qpow(k,i*(i-1)/2) % mod;\r\n\t\t//dp[i-1][1] * qpow(k,i-1) % mod;\r\n\t}\r\n\tfor(ll j=1;j<=k;j++)\r\n\t{\r\n\t\tdp[1][j] = C[n-1][1] * 1;\r\n\t\t//dp[i-1][1] * qpow(k,i-1) % mod;\r\n\t}\r\n\tll sum[N][N];\r\n\tfor(ll j=2;j<=k;j++)\r\n\t{\r\n\r\n\t\tfor(ll ii=0;ii<=300;ii++)\r\n\t\t{\r\n\t\t\tfor(ll jj=1;jj<=300;jj++)\r\n\t\t\t{\r\n\t\t\t\tsum[ii][jj] = sum[ii][jj-1] + dp[ii][jj];\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor(ll i=2;i<=n-1;i++)\r\n\t\t{\r\n\t\t\tfor(ll m=1;m<=i-1;m++)\r\n\t\t\t{\r\n\r\n\t\t\t\tint ret = mul3( sum[i-m][j-1]-sum[i-m][0], C[n-1-(i-m)][m], qpow(k-j+1,(i-m)*m + m*(m-1)/2));\r\n\t\t\t\t\r\n\t\t\t\tdp[i][j] += ret;\r\n\t\t\t\tdp[i][j] %= mod;\r\n\t\t\t\t/*\r\n\t\t\t\tfor(ll jj=2;jj<=j;jj++)\r\n\t\t\t\t{\r\n\t\t\t\t\tint ret = mul3(dp[i-m][jj-1], C[n-1-(i-m)][m], qpow(k-j+1,(i-m)*m + m*(m-1)/2));\r\n\t\t\t\t\t//printf(\"dp(%d %d) += dp(%d %d) * C(%d, %d) * %d^%d = %d\\n\",\r\n\t\t\t\t\t//i,j,i-m,jj-1,n-1-i+m,m,k-j+1,(i-m)*m + m*(m-1)/2,ret);\r\n\t\t\t\t\tdp[i][j] += ret;\r\n\t\t\t\t\tdp[i][j] %= mod;\r\n\t\t\t\t}\r\n\t\t\t\t*/\r\n\t\t\t\t//dp[i+m][j+1] += mul3(dp[i][j], C[n-1-i][m], qpow(k-j,i*m));\r\n\t\t\t\t//dp[i+m][j+1] %= mod;\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\tint ret = mul3(1, C[n-1][i], qpow(k-j+1, i*(i-1)/2));\r\n\t\t\t//printf(\"dp(%d %d) += %d\\n\",i,j,ret);\r\n\t\t\t//i,jj,i-m,jj-1,n-1-i+m,m,k-jj+1,(i-m)*m + m*(m-1)/2,ret);\r\n\t\t\tdp[i][j] += ret;\r\n\t\t\tdp[i][j] %= mod;\r\n\t\t\r\n\t\t}\r\n\t}\r\n\r\n\tll summ = 0;\r\n\tfor(int i=1;i<=k;i++)\r\n\t{\r\n\t\tsumm = (summ + dp[n-1][i]) % mod;\r\n\t}\r\n\tcout<>_;\r\n\twhile(_--)\r\n\t{\r\n\t\tsolve();\r\n\t}\r\n\treturn 0;\r\n}\r\n", "lang": "GNU C++17", "bug_code_uid": "80808bc9edd995db3370728aa4bd3871", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "522513243d4b7585f15e68eb77e97b7c", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.7696190913262965, "equal_cnt": 25, "replace_cnt": 20, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 24, "bug_source_code": "#include \r\n\r\nusing namespace std;\r\n\r\ntypedef long long ll;\r\n\r\n#define I_Love_Mitsuha_Miyamizu_Forever cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);\r\n//#define ll int\r\n\r\nconst ll MOD = 998244353;\r\n//const ll MOD = 1000000007;\r\n//const ll LL = 9223372036854775807;\r\n\r\nll dp[331][331],m[331];\r\n\r\nll fpow(ll Zenzenzense, ll Sparkle, ll Nandemonaiya)\r\n{\r\n ll Dream_Lantern = 1;\r\n if (Sparkle == 0)\r\n {\r\n return 1;\r\n }\r\n while (Sparkle > 1)\r\n {\r\n if (Sparkle % 2)\r\n {\r\n Dream_Lantern *= Zenzenzense;\r\n Dream_Lantern %= Nandemonaiya;\r\n }\r\n Zenzenzense *= Zenzenzense;\r\n Zenzenzense %= Nandemonaiya;\r\n Sparkle /= 2;\r\n }\r\n return (Zenzenzense * Dream_Lantern) % Nandemonaiya;\r\n}\r\n\r\nll fpow(ll Zenzenzense, ll Sparkle)\r\n{\r\n ll Dream_Lantern = 1;\r\n if (Sparkle == 0)\r\n {\r\n return 1;\r\n }\r\n while (Sparkle > 1)\r\n {\r\n if (Sparkle % 2)\r\n {\r\n Dream_Lantern *= Zenzenzense;\r\n }\r\n Zenzenzense *= Zenzenzense;\r\n Sparkle /= 2;\r\n }\r\n return (Zenzenzense * Dream_Lantern);\r\n}\r\n\r\nll CCC(ll x, ll y)\r\n{\r\n ll ans=1;\r\n ans*=m[x];\r\n ans*=fpow(m[y], MOD-2, MOD);\r\n ans%=MOD;\r\n ans*=fpow(m[x-y], MOD-2, MOD);\r\n ans%=MOD;\r\n return ans;\r\n}\r\n\r\nint main()\r\n{\r\n \r\n I_Love_Mitsuha_Miyamizu_Forever\r\n \r\n ll N,K;\r\n cin>>N>>K;\r\n m[0]=1;\r\n for(ll i=1;i<331;i++)\r\n {\r\n m[i]=m[i-1]*i;\r\n m[i]%=MOD;\r\n }\r\n dp[2][1]=1;\r\n for(ll i=3;i<=N;i++)\r\n {\r\n dp[i][1]=fpow(K, CCC(i-1, 2), MOD);\r\n }\r\n for(ll i=2;i<=K;i++)\r\n {\r\n dp[2][i]=i;\r\n }\r\n for(ll i=1;i<=K;i++)\r\n {\r\n dp[1][i]=1;\r\n }\r\n for(ll i=2;i<=K;i++)\r\n {\r\n dp[3][i]=dp[3][i-1]+2*(K-i+1)*dp[2][i-1]+(K-i+1)*dp[1][i-1];\r\n dp[3][i]%=MOD;\r\n }\r\n for(ll i=2;i<=K;i++)\r\n {\r\n for(ll j=4;j<=N;j++)\r\n {\r\n dp[j][i]=0;\r\n for(ll k=0;k\r\n\r\nusing namespace std;\r\ntypedef long long int ll;\r\ntypedef pair pii;\r\ntypedef pair pll;\r\n#define mp make_pair\r\n#define pb push_back\r\n#define vi vector\r\n#define vii vector>\r\n#define pqi priority_queue\r\n#define dqi deque\r\n#define si set\r\n#define ff first\r\n#define ss second\r\n#define FOR(i,a,b) for(int i=(a); i<(b); i++)\r\n#define all(x) x.begin(),x.end()\r\n#define nl '\\n'\r\n#define cma <<','<<\r\n//ll mod = 1e9+7;\r\nll inf = 1e18;\r\nconst ll maxn = 200005;\r\nconst ll mod = 998244353;\r\n\r\n//dp i j gives no. of ways, graph with i vertices, max from 1 is exactly j\r\n//dp i j = dp i-1 1 + dp i-1 2 + ... + dp i-1 j x (smt)^ smt\r\n//want to find dp n-1 1 + dp n-1 2 + ... + dp n-1 k\r\n\r\nll exp(ll a, ll b){\r\n\tif(b == 0) return 1;\r\n\tll cur = a, ans = 1;\r\n\twhile(b){\r\n\t\tif(b%2==1){\r\n\t\t\tans *= cur;\r\n\t\t\tans %= mod;\r\n\t\t}\r\n\t\tcur *= cur;\r\n\t\tcur %= mod;\r\n\t\tb /= 2;\r\n\t}\t\r\n\treturn ans;\r\n}\r\n\r\n\r\nint main(){\r\n\tios::sync_with_stdio(0);\r\n\tcin.tie(0);\r\n\t\r\n\tll n,k; cin >> n >> k;\r\n\tll dp[n+1][k+1];\r\n\tll ch[n+1][k+1];\r\n\tll sm[n+1][k+1];\r\n\tFOR(i,0,n+1){\r\n\t\tch[i][0] = 1;\r\n\t\tch[i][i] = 1;\r\n\t\tFOR(j,1,i){\r\n\t\t\tch[i][j] = ch[i-1][j-1] + ch[i-1][j];\r\n\t\t\tch[i][j] %= mod;\r\n\t\t}\r\n\t}\r\n\tmemset(dp,0,sizeof(dp));\r\n\tmemset(sm,0,sizeof(sm));\r\n\tFOR(j,0,k+1){\r\n\t\tdp[1][j] = 1;\r\n\t\tsm[1][j] = j;\r\n\t\tsm[0][j] = 1;\r\n\t}\r\n\r\n\t\r\n\tFOR(i,2,n){\r\n\t\tFOR(j,1,k+1){\r\n\t\t\tll sum = 0;\r\n\t\t\tll cur = 0;\r\n\t\t\tFOR(l,1,i+1){\r\n\t\t\t\tll x= ch[i][l] * sm[i-l][j-1];\r\n\t\t\t\tx %= mod;\r\n\t\t\t\tcur += i-l;\r\n\t\t\t\tsum += x*exp(k-j+1, cur);\r\n\t\t\t\tsum%= mod;\r\n\t\t\t}\r\n\t\t\tsm[i][j] = (sm[i][j-1] + sum)%mod;\r\n\t\t\t\r\n\t\t}\r\n\t}\r\n\tcout << sm[n-1][k];\r\n\t\r\n\t\r\n\t\r\n\t\r\n}", "lang": "GNU C++17", "bug_code_uid": "df9db9eefb9311051382ccaeedb94c4f", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "454979e9e4c0e871713d771c3c32960e", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.05631599530700039, "equal_cnt": 15, "replace_cnt": 13, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 15, "bug_source_code": "#include\r\n#include\r\nusing namespace std;\r\ntypedef long long LL;\r\nconst int maxn = 255, mod = 998244353;\r\nLL fact[maxn], invfact[maxn];\r\nLL f[maxn][maxn];\r\n\r\nLL qpow(LL a, LL b, LL mod)\r\n{\r\n LL res = 1;\r\n while (b)\r\n {\r\n if (b & 1) res = res * a % mod;\r\n a = a * a % mod;\r\n b >>= 1;\r\n }\r\n return res;\r\n}\r\n\r\nvoid init(){\r\n fact[0] = invfact[0] = 1;\r\n for(int i = 1; i < maxn; i++) fact[i] = (LL)fact[i - 1] * i % mod;\r\n invfact[maxn - 1] = qpow(fact[maxn - 1], mod - 2, mod);\r\n for(int i = maxn - 2; i; i--)\r\n invfact[i] = (LL)invfact[i + 1] * (i + 1) % mod;\t\r\n}\r\n\r\ninline LL C(int a, int b){\r\n return fact[a] * invfact[b] % mod * invfact[a - b] % mod;\r\n}\r\n\r\nint main(){\r\n init();\r\n int n, k;\r\n cin >> n >> k;\r\n f[0][0] = 1;\r\n for(int i = 1; i <= k; i++)\r\n for(int j = 1; j <= n; j++)\r\n for(int a = 0; a < n - j; a++)\r\n f[i][j + a] = (f[i][j + a] + f[i - 1][j] * C(n - j - 1, a) % mod * qpow(k - i + 1, j * a + a * (a - 1) / 2, mod) % mod) % mod;\r\n cout << f[k][n] << '\\n';\r\n}", "lang": "GNU C++17", "bug_code_uid": "dfc295552d42905d75f4e5de31e89da9", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "2ef4670af5a108b773f85925e6d1b772", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9949553744664338, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "#include \r\nusing namespace std;\r\n\r\n#define pb push_back\r\n#define all(s) s.begin(), s.end()\r\n#define sz(x) (int)(x).size()\r\n#define fastio cin.tie(0) -> sync_with_stdio(0)\r\n#define DEBUG 0\r\n#define pii pair\r\n#define ll long long\r\n#define C 31\r\n#define F(i, a, b) for(int i=(a); i <= (b); ++i)\r\n#define SUM 1\r\n#define MAX 0\r\n#define SINGLE 1\r\n#define szt size_t\r\n#define YES cout << \"YES\\n\";\r\n#define NO cout << \"NO\\n\";\r\n\r\n//jiangly Codeforces\r\nconstexpr int P = 998244353;\r\nusing i64 = long long;\r\n// assume -P <= x < 2P\r\nint norm(int x) {\r\n if (x < 0) {\r\n x += P;\r\n }\r\n if (x >= P) {\r\n x -= P;\r\n }\r\n return x;\r\n}\r\ntemplate\r\nT power(T a, i64 b) {\r\n T res = 1;\r\n for (; b; b /= 2, a *= a) {\r\n if (b % 2) {\r\n res *= a;\r\n }\r\n }\r\n return res;\r\n}\r\nstruct Z {\r\n int x;\r\n Z(int x = 0) : x(norm(x)) {}\r\n Z(i64 x) : x(norm(x % P)) {}\r\n int val() const {\r\n return x;\r\n }\r\n Z operator-() const {\r\n return Z(norm(P - x));\r\n }\r\n Z inv() const {\r\n assert(x != 0);\r\n return power(*this, P - 2);\r\n }\r\n Z &operator*=(const Z &rhs) {\r\n x = i64(x) * rhs.x % P;\r\n return *this;\r\n }\r\n Z &operator+=(const Z &rhs) {\r\n x = norm(x + rhs.x);\r\n return *this;\r\n }\r\n Z &operator-=(const Z &rhs) {\r\n x = norm(x - rhs.x);\r\n return *this;\r\n }\r\n Z &operator/=(const Z &rhs) {\r\n return *this *= rhs.inv();\r\n }\r\n friend Z operator*(const Z &lhs, const Z &rhs) {\r\n Z res = lhs;\r\n res *= rhs;\r\n return res;\r\n }\r\n friend Z operator+(const Z &lhs, const Z &rhs) {\r\n Z res = lhs;\r\n res += rhs;\r\n return res;\r\n }\r\n friend Z operator-(const Z &lhs, const Z &rhs) {\r\n Z res = lhs;\r\n res -= rhs;\r\n return res;\r\n }\r\n friend Z operator/(const Z &lhs, const Z &rhs) {\r\n Z res = lhs;\r\n res /= rhs;\r\n return res;\r\n }\r\n friend std::istream &operator>>(std::istream &is, Z &a) {\r\n i64 v;\r\n is >> v;\r\n a = Z(v);\r\n return is;\r\n }\r\n friend std::ostream &operator<<(std::ostream &os, const Z &a) {\r\n return os << a.val();\r\n }\r\n};\r\n\r\nvoid debug(){\r\n #if DEBUG\r\n freopen(\"test1.txt\", \"r\", stdin); \r\n #else\r\n fastio;\r\n #endif \r\n}\r\n\r\nZ dp[256][256][256];//n, \u6700\u5927\u503c, \u6700\u5927\u503c\u4e2a\u6570\r\nZ inv[256];\r\nZ p[256][256], sumt[256][256];\r\n\r\nvoid solve(){\r\n int n, k;\r\n cin >> n >> k;\r\n for(int i = 1; i <= n; ++i){\r\n inv[i] = Z(i).inv();\r\n }\r\n for(int m = 1; m <= k; ++m){\r\n Z tmp = Z(1);\r\n Z zm = Z(m);\r\n p[m][0] = tmp;\r\n dp[1][m][1] = 1;\r\n sumt[1][m] = m;\r\n for(int i = 1; i <= n; ++i){\r\n tmp *= zm;\r\n p[m][i] = tmp;\r\n }\r\n } \r\n\r\n Z sumres = 0;\r\n for(int i = 2; i <= n-1; ++i){\r\n sumres = 0;\r\n for(int j = 1; j <= k; ++j){\r\n sumt[i][j] = sumt[i][j-1];\r\n if(j != 1){\r\n dp[i][j][1] = sumt[i-1][j-1]*Z(i)*p[k-j+1][i-1];\r\n //printf(\"dp[%d][%d][1]==%d, sumt[%d][%d]==%d\\n\", i, j, dp[i][j][1], i-1, j-1, sumt[i-1][j-1]);\r\n sumt[i][j] += dp[i][j][1];\r\n sumres += dp[i][j][1];\r\n }\r\n for(int t = 2; t <= i; ++t){\r\n if(j == 1 && t != i) continue;\r\n dp[i][j][t] = dp[i-1][j][t-1]*Z(i)*inv[t]*p[k-j+1][i-1];\r\n //printf(\"dp[%d][%d][%d(>1)]==%d\\n\", i, j, t, dp[i][j][t]);\r\n sumt[i][j] += dp[i][j][t];\r\n sumres += dp[i][j][t];\r\n }//t\r\n }//j\r\n }//i\r\n\r\n cout << sumres << \"\\n\";\r\n}\r\n\r\nsigned main(void){\r\n debug();\r\n int t;\r\n #if SINGLE\r\n t = 1;\r\n #else\r\n cin >> t;\r\n #endif\r\n while(t--) solve();\r\n}", "lang": "GNU C++17", "bug_code_uid": "820a11d2f948c9f91126be1adef96419", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "7f4111025965f04ea48fdb78626a3d3a", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.9997475385003787, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\nusing namespace std;\r\nusing ld = long double;\r\nusing ll = long long;\r\n\r\nll mod = 998244353;\r\nint const N = 3e5 + 100;\r\n\r\nmt19937 rnd;\r\n\r\nll random(ll limit)\r\n{\r\n\tuniform_int_distribution uniform_dist(0, limit);\r\n\treturn uniform_dist(rnd);\r\n}\r\n\r\n\r\nll bpow(ll a, ll p) {\r\n\tll res = 1;\r\n\twhile (p > 0) {\r\n\t\tif (p % 2) {\r\n\t\t\tres = res * a % mod;\r\n\t\t}\r\n\t\ta = a * a % mod;\r\n\t\tp /= 2;\r\n\t}\r\n\treturn res;\r\n}\r\n\r\n\r\nll inv(ll a) {\r\n\treturn bpow(a, mod - 2);\r\n}\r\n\r\n\r\nvoid solve() {\r\n\tll n, k;\r\n\tcin >> n >> k;\r\n\tn--;\r\n\tvector> dp(n + 1, vector(k));\r\n\t/*for (int i = 0; i < k; i++) {\r\n\t\tdp[0][i] = 1;\r\n\t}*/\r\n\tdp[0][0] = 1;\r\n\r\n\r\n\tvector> binom(1000, vector(1000 + 1));\r\n\r\n\tbinom[0][0] = 1;\r\n\tfor (ll i = 1; i < 100; i++) {\r\n\t\tfor (ll j = 0; j <= i; j++) {\r\n\t\t\tif (j > 0) {\r\n\t\t\t\tbinom[i][j] += binom[i - 1][j - 1];\r\n\t\t\t\tbinom[i][j] %= mod;\r\n\t\t\t}\r\n\t\t\tbinom[i][j] += binom[i - 1][j];\r\n\t\t\tbinom[i][j] %= mod;\r\n\t\t}\r\n\t}\r\n\r\n\tvector> psum(n + 1, vector(k));\r\n\tfor (int i = 0; i < k; i++)\r\n\t\tpsum[0][i] = 1;\r\n\r\n\tfor (int i = 1; i <= n; i++) {\r\n\t\tdp[i][0] = bpow(k, i * (i - 1) / 2) % mod;\r\n\t\tpsum[i][0] = dp[i][0];\r\n\r\n\t\tfor (int j = 1; j < k; j++) {\r\n\t\t\tfor (int num = 1; num <= i; num++) {\r\n\r\n\t\t\t\tdp[i][j] += ((binom[i][num] * psum[i - num][j - 1]) % mod) * bpow(k - j, num * (2 * i - num - 1) / 2) % mod;\r\n\t\t\t\tdp[i][j] %= mod;\r\n\t\t\t}\r\n\t\t\tpsum[i][j] = psum[i][j-1] + dp[i][j];\r\n\t\t\tpsum[i][j] %= mod;\r\n\r\n\t\t}\r\n\t\t\r\n\t}\r\n\t\t\r\n\t\r\n\t\r\n\tcout << psum[n][k - 1] % mod << '\\n';\r\n}\r\n\r\n\r\n\r\nint main()\r\n{\r\n\tios::sync_with_stdio(false);\r\n\tcin.tie(0);\r\n\trnd = mt19937(956231);\r\n\tint t;\r\n\t//cin >> t;\r\n\tt = 1;\r\n\twhile (t--) {\r\n\t\tsolve();\r\n\t}\r\n\r\n}\r\n\r\n/*\r\n\r\n*/", "lang": "MS C++ 2017", "bug_code_uid": "c675dd101a8a2deb522402c3b94c2233", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "6bfa6955fcd5a97c8456dd4568262ee3", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "C++"} {"similarity_score": 0.4462631253860408, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 8, "bug_source_code": "#define _CRT_SECURE_NO_WARNINGS \r\n\r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n\r\nusing namespace std;\r\n\r\ntemplate struct mint {\r\n\tstatic const int mod = MOD;\r\n\tstatic constexpr mint rt() { return RT; } // primitive root for FFT\r\n\tint v; explicit operator int() const { return v; } // explicit -> don't silently convert to int\r\n\tmint() :v(0) {}\r\n\tmint(__int64 _v) {\r\n\t\tv = int((-MOD < _v&& _v < MOD) ? _v : _v % MOD);\r\n\t\tif (v < 0) v += MOD;\r\n\t}\r\n\tbool operator==(const mint& o) const {\r\n\t\treturn v == o.v;\r\n\t}\r\n\tfriend bool operator!=(const mint& a, const mint& b) {\r\n\t\treturn !(a == b);\r\n\t}\r\n\tfriend bool operator<(const mint& a, const mint& b) {\r\n\t\treturn a.v < b.v;\r\n\t}\r\n\t// friend void re(mint& a) { __int64 x; re(x); a = mint(x); }\r\n\t// friend str ts(mint a) { return ts(a.v); }\r\n\r\n\tmint& operator+=(const mint& o) {\r\n\t\tif ((v += o.v) >= MOD) v -= MOD;\r\n\t\treturn *this;\r\n\t}\r\n\tmint& operator-=(const mint& o) {\r\n\t\tif ((v -= o.v) < 0) v += MOD;\r\n\t\treturn *this;\r\n\t}\r\n\tmint& operator*=(const mint& o) {\r\n\t\tv = int((__int64)v * o.v % MOD); return *this;\r\n\t}\r\n\tmint& operator/=(const mint& o) { return (*this) *= inv(o); }\r\n\tfriend mint pow(mint a, __int64 p) {\r\n\t\tmint ans = 1; assert(p >= 0);\r\n\t\tfor (; p; p /= 2, a *= a) if (p & 1) ans *= a;\r\n\t\treturn ans;\r\n\t}\r\n\tfriend mint inv(const mint& a) {\r\n\t\tassert(a.v != 0);\r\n\t\treturn pow(a, MOD - 2);\r\n\t}\r\n\r\n\tmint operator-() const { return mint(-v); }\r\n\tmint& operator++() { return *this += 1; }\r\n\tmint& operator--() { return *this -= 1; }\r\n\tfriend mint operator+(mint a, const mint& b) { return a += b; }\r\n\tfriend mint operator-(mint a, const mint& b) { return a -= b; }\r\n\tfriend mint operator*(mint a, const mint& b) { return a *= b; }\r\n\tfriend mint operator/(mint a, const mint& b) { return a /= b; }\r\n};\r\n#define MOD 998244353 \r\ntypedef mint mint1;\r\nint n, k;\r\nvoid init(){\r\n\tcin >> n >> k;\r\n}\r\nvoid calccnk(vector> &cnk, int n) {\r\n\tcnk[0][0] = 1;\r\n\tfor (int i = 1; i <= n; i++) {\r\n\t\tcnk[i][0] = 1;\r\n\t\tfor (int j = 1; j <= i; j++) {\r\n\t\t\tcnk[i][j] = cnk[i - 1][j - 1];\r\n\t\t\tif (j < i)\r\n\t\t\t\tcnk[i][j] += cnk[i - 1][j];\r\n\t\t}\r\n\t}\r\n}\r\nvoid solve(){\r\n\tauto f = vector>(n + 1, vector(k + 1));\r\n\tvector> cnk = vector>(n + 1, vector(n + 1));\r\n\tcalccnk(cnk, n);\r\n\tfor (int i = 0; i <= k; i++) {\r\n\t\tf[0][i] = 1;\r\n\t}\r\n\tf[1][0] = 0;\r\n\tfor (int i = 1; i <= n; i++) {\r\n\t\tf[i][0] = 0;\r\n\t\tf[i][1] = pow(k, i * (i - 1) / 2);\r\n\t\tfor (int p = 2; p <= k; p++) {\r\n\t\t\tf[i][p] = f[i][p - 1];\r\n\t\t\tfor (int j = 1; j <= i; j++) {\r\n\t\t\t\t//c(i,j) * pow(k - p + 1, j * (j - 1) / 2) * f(i - j, p - 1) * pow(k - p + 1, j * (i - j))\r\n\t\t\t\tmint1 tmp;\r\n\t\t\t\ttmp = cnk[i][j] * pow(mint1(k - p + 1), j * (j - 1) / 2 + j * (i - j)) * f[i - j][p - 1];\r\n\t\t\t\tf[i][p] += tmp;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tcout << (int)f[n - 1][k] << \"\\n\";\r\n}\r\n\r\nint main() {\r\n#ifndef ONLINE_JUDGE\r\n\tfreopen(\"input.txt\", \"r\", stdin);\r\n\tfreopen(\"output.txt\", \"w\", stdout);\r\n#endif\r\n\tios::sync_with_stdio(false);\r\n\tinit();\r\n\tsolve();\r\n\treturn 0;\r\n}", "lang": "MS C++ 2017", "bug_code_uid": "3f77ae040c3fdc671286889b257b60d2", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "48adbb1d935cf96b3622fc753b7f6fb3", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9990846681922196, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \r\nusing namespace std;\r\nnamespace Legendgod {\r\n\tnamespace Read {\r\n//\t\t#define Fread\r\n\t\t#ifdef Fread\r\n\t\tconst int Siz = (1 << 21) + 5;\r\n\t\tchar *iS, *iT, buf[Siz];\r\n\t\t#define gc() ( iS == iT ? (iT = (iS = buf) + fread(buf, 1, Siz, stdin), iS == iT ? EOF : *iS ++) : *iS ++ )\r\n\t\t#define getchar gc\r\n\t\t#endif\r\n\t\ttemplate \r\n\t\tvoid r1(T &x) {\r\n\t\t x = 0;\r\n\t\t\tchar c(getchar());\r\n\t\t\tint f(1);\r\n\t\t\tfor(; !isdigit(c); c = getchar()) if(c == '-') f = -1;\r\n\t\t\tfor(; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);\r\n\t\t\tx *= f;\r\n\t\t}\r\n\t\ttemplate \r\n\t\tvoid r1(T &x, Args&...arg) {\r\n\t\t\tr1(x), r1(arg...);\r\n\t\t}\r\n\t\t#undef getchar\r\n\t}\r\n\r\nusing namespace Read;\r\n\r\nconst int maxn = 200 + 5;\r\n\r\nint n, mod;\r\nint fac[maxn], finv[maxn];\r\nint ksm(int x,int mi) {\r\n int res(1);\r\n while(mi) {\r\n if(mi & 1) res = 1ll * res * x % mod;\r\n mi >>= 1;\r\n x = 1ll * x * x % mod;\r\n }\r\n return res;\r\n}\r\n\r\nvoid init(int x) {\r\n fac[0] = 1;\r\n for(int i = 1; i <= x; ++ i) fac[i] = 1ll * fac[i - 1] * i % mod;\r\n finv[x] = ksm(fac[x], mod - 2);\r\n for(int i = x - 1; i >= 0; -- i) finv[i] = 1ll * finv[i + 1] * (i + 1) % mod;\r\n}\r\n\r\nint vis[maxn][maxn][50], f[maxn][maxn][50];\r\nint a1;\r\n\r\nint dfs(int dep,int sum,int K,int lim) {\r\n if(vis[dep][sum][K]) return f[dep][sum][K];\r\n vis[dep][sum][K] = 1;\r\n int& ret = f[dep][sum][K]; ret = 0;\r\n if(K < lim && dep < K) return 0;\r\n if(K == lim) {\r\n if(dep < n) ret = finv[n - dep];\r\n return ret;\r\n }\r\n int nx = n + 1 - K - a1;\r\n for(int j = 0; dep + j <= n && j * nx + sum <= a1; ++ j)\r\n ret = (ret + 1ll * dfs(dep + j, j * nx + sum, K + 1, lim) * finv[j] % mod) % mod;\r\n return ret;\r\n}\r\n\r\nsigned main() {\r\n\tint i, j;\r\n r1(n, mod);\r\n init(n + 5);\r\n int ans(0);\r\n for(int lim = 0; lim <= n; ++ lim) {\r\n memset(vis, 0, sizeof(vis));\r\n a1 = n + 1 - lim;\r\n int x = dfs(0, 0, 0, lim);\r\n if(x == 0) break;\r\n ans = (ans + x) % mod;\r\n }\r\n ans = 1ll * ans * fac[n] % mod;\r\n printf(\"%d\\n\", ans);\r\n\treturn 0;\r\n}\r\n\r\n}\r\n\r\n\r\nsigned main() { return Legendgod::main(), 0; }\r\n", "lang": "GNU C++14", "bug_code_uid": "242bc1f0a28820808fd75e0571284ce7", "src_uid": "cf57508de47d80bc983861f70bb5f3d6", "apr_id": "ce0f1e9ba7b7435946fe273df842bd89", "difficulty": 3200, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "C++"} {"similarity_score": 0.9985569985569985, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "#include\r\n#include\r\n#define I inline\r\n#define max(a,b) ((a)>(b)?(a):(b))\r\n#define min(a,b) ((a)<(b)?(a):(b))\r\n#define abs(x) ((x)>0?(x):-(x))\r\n#define re register\r\n#define RI re int\r\n#define ll long long\r\n#define db double\r\n#define lb long db\r\n#define N (200+5)\r\n#define M (N*50+5)\r\n#define mod 998244353\r\n#define Mod (mod-1)\r\n#define eps (1e-9)\r\n#define U unsigned int\r\n#define it iterator\r\n#define Gc() getchar() \r\n#define Me(x,y) memset(x,y,sizeof(x))\r\n#define Mc(x,y) memcpy(x,y,sizeof(x))\r\n#define d(x,y) (n*(x-1)+(y))\r\n#define R(n) (rand()*rand()%(n)+1)\r\n#define Pc(x) putchar(x)\r\n#define LB lower_bound\r\n#define UB upper_bound\r\n#define PB push_back\r\nusing namespace std;\r\nint n,m,k,p,A[N+5],Cnt,P,Ne,La,vis[22][N][N];ll dp[22][N][N],frc[N],Inv[N],Ans;\r\nI ll mpow(ll x,int y=p-2){ll Ans=1;while(y) y&1&&(Ans=Ans*x%p),y>>=1,x=x*x%p;return Ans;}\r\nI ll dfs(int x,int S,int w){\r\n\tif(vis[x][S][w]) return dp[x][S][w];ll &Ns=dp[x][S][w];vis[x][S][w]=1;Ns=0;\r\n\tif(xw)return 0;if(x==m){if(w^n) Ns=Inv[n-w];return Ns;}\r\n\tfor(RI i=0;i+w<=n&&S+i*(m-x)<=n-m+1;i++) Ns=(Ns+dfs(x+1,S+i*(m-x),w+i)*Inv[i])%p;return Ns;\r\n}\r\nint main(){\r\n\t//freopen(\"1.in\",\"r\",stdin);\r\n\tRI i;scanf(\"%d%d\",&n,&p);for(frc[0]=Inv[0]=i=1;i<=n;i++) frc[i]=frc[i-1]*i%p,Inv[i]=mpow(frc[i]);\r\n\tfor(i=max(n-20,2);i<=n+1;i++)Me(vis,0),m=n-i+1,Ans+=dfs(0,0,0);printf(\"%lld\\n\",Ans%p*frc[n]%p);\r\n}", "lang": "GNU C++14", "bug_code_uid": "5721272ed89a448748ac4669a1789058", "src_uid": "cf57508de47d80bc983861f70bb5f3d6", "apr_id": "efe7d565fd9092875c95a65b5ce92178", "difficulty": 3200, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.9642126789366053, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "#include \r\nconst int Maxn=200;\r\nint n,Mod;\r\nint f[Maxn+5][Maxn+5][Maxn+5];\r\nint inv_f[Maxn+5],fac[Maxn+5],inv[Maxn+5];\r\nint main(){\r\n\tfreopen(\"input.txt\",\"r\",stdin);\r\n\tfreopen(\"output.txt\",\"w\",stdout);\r\n\tscanf(\"%d%d\",&n,&Mod);\r\n\tinv[1]=1;\r\n\tfor(int i=2;i<=n;i++){\r\n\t\tinv[i]=1ll*(Mod-Mod/i)*inv[Mod%i]%Mod;\r\n\t}\r\n\tfac[0]=inv_f[0]=1;\r\n\tfor(int i=1;i<=n;i++){\r\n\t\tfac[i]=1ll*fac[i-1]*i%Mod;\r\n\t\tinv_f[i]=1ll*inv_f[i-1]*inv[i]%Mod;\r\n\t}\r\n\tfor(int i=1;i0;i--){\r\n\t\tfor(int j=1;jn-i;j--){\r\n\t\t\tfor(int l=1;j+l\r\nusing namespace std;\r\nconst int N=220;\r\nint n,mod,ans;\r\nint ksm(int a,int x){\r\n int tot=1;\r\n while(x){\r\n if(x & 1ll) tot=1ll*tot*a%mod;\r\n a=1ll*a*a%mod;\r\n x>>=1ll;\r\n }\r\n return tot;\r\n}\r\nint mul[N],inv[N];\r\nvoid init(int lim){\r\n mul[0]=inv[0]=1;\r\n for(int i=1;i<=lim;i++) mul[i]=1ll*mul[i-1]*i%mod;\r\n inv[lim]=ksm(mul[lim],mod-2);\r\n for(int i=lim-1;i>=1;i--) inv[i]=1ll*inv[i+1]*(i+1)%mod;\r\n}\r\nint C(int m,int n){\r\n if(m<0 || m>n>>mod;\r\n init(N-5);\r\n int lim=n-sqrt(n);\r\n for(int b1=lim;b1<=n;b1++){\r\n // cout<\r\nusing namespace std;\r\nconst int N=205;\r\nint n,mod,frst,fac[N],inv[N],dp[N][N][50];\r\nbool vis[N][N][50];\r\nint Pow(int a,int b){\r\n\tint rec=1;\r\n\tfor(;b;b>>=1,a=1ll*a*a%mod)\r\n\t\tif(b&1)rec=1ll*rec*a%mod;\r\n\treturn rec;\r\n}\r\nvoid init(int n){\r\n\tfac[0]=1;\r\n\tfor(int i=1;i<=n;i++)fac[i]=1ll*fac[i-1]*i%mod;\r\n\tinv[n]=Pow(fac[n],mod-2);\r\n\tfor(int i=n-1;i>=0;i--)inv[i]=1ll*inv[i+1]*(i+1)%mod;\r\n}\r\nint dfs(int cnt,int sum,int cur,int lim){\r\n\tif(vis[cnt][sum][cur])return dp[cnt][sum][cur];\r\n\tvis[cnt][sum][cur]=true;\r\n\tint &rec=dp[cnt][sum][cur];rec=0;\r\n\tif(cur<=lim-1&&cnt\r\n#define ll long long\r\n#define gc getchar\r\n#define pc putchar\r\n#define pii pair\r\n#define mp make_pair\r\n#define fi first\r\n#define se second\r\n#define rep(i,x,y) for(int i=x;i<=y;i++)\r\n#define dwn(i,x,y) for(int i=x;i>=y;i--)\r\n#define mst(a,b) memset(a,b,sizeof(a))\r\nusing namespace std;\r\ntemplateinline void qr(T &x){\r\n x=0;int f=0;char s=gc();\r\n while(s<'0'||'9'inline void qw(T x){\r\n if(x<0)putchar('-'),x=-x;\r\n do{buf[++cc]=int(x%10);x/=10;}while(x);\r\n while(cc)pc(buf[cc--]+'0');pc(' ');\r\n}\r\nconst int N=210;\r\nint n,mod,frst;\r\nint fc[N],ifc[N],dp[N][N][50];\r\nbool v[N][N][50];\r\nint power(int a,int b){\r\n int ret=1;\r\n while(b){\r\n if(b&1)ret=1ll*ret*a%mod;\r\n a=1ll*a*a%mod;b>>=1;\r\n }\r\n return ret;\r\n}\r\nint dfs(int cnt,int sum,int cur,int lim){\r\n if(v[cnt][sum][cur])return dp[cnt][sum][cur];\r\n v[cnt][sum][cur]=1;\r\n int &ret=dp[cnt][sum][cur];ret=0;\r\n if(cur<=lim-1&&ret\r\nusing namespace std;\r\ntypedef long long ll;\r\nconst int N=1e5+10;\r\nint n,T,p[N],pcnt,f[N];\r\nll phi[N],dp[20][N]; \r\ninline void init(int n){\r\n\tphi[1]=1;\r\n\tfor(int i=2;i<=n;++i){\r\n\t\tif(!f[i]) p[++pcnt]=i,phi[i]=i-1;\r\n\t\tfor(int j=1;j<=pcnt&&i*p[j]<=n;++j){\r\n\t\t\tint num=i*p[j];f[num]=1;\r\n\t\t\tif(i%p[j]) phi[num]=phi[i]*phi[p[j]];\r\n\t\t\telse{\r\n\t\t\t\tphi[num]=phi[i]*p[j];\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tfor(int i=2;i<=n;++i) phi[i]+=phi[i-1];\r\n}\r\ninline ll calc(int l,int r){\r\n\tll ret=0;\r\n\tfor(int x=l,y=0;x<=r;x=y+1){\r\n\t\ty=r/(r/x);\r\n\t\tret+=phi[r/x]*(y-x+1);\r\n\t}\r\n\treturn ret;\r\n}\r\ninline void solve(int x,int l,int r,int ql,int qr){\r\n\tif(l>r) return ;\r\n\tint mid=(l+r)>>1,pos=ql;ll now=calc(min(qr+1,mid),mid);\r\n\tdp[x][mid]=1e15;\r\n\tfor(int i=min(qr,mid-1);i>=ql;--i){\r\n\t\tif(dp[x-1][i]+now=20||(1<n){printf(\"%d\\n\",n);continue;}\r\n\t\telse printf(\"%lld\\n\",dp[k][n]);\r\n\t}\r\n\treturn 0;\r\n}\r\n", "lang": "GNU C++14", "bug_code_uid": "dba377d23c0c927d2cb72c662ed1d6cb", "src_uid": "cf57508de47d80bc983861f70bb5f3d6", "apr_id": "92faf9b0b1f070a2eb1fd6f092415405", "difficulty": 3200, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"} {"similarity_score": 0.5237207375181272, "equal_cnt": 19, "replace_cnt": 7, "delete_cnt": 3, "insert_cnt": 9, "fix_ops_cnt": 19, "bug_source_code": "#include\r\nusing namespace std;\r\ntypedef long long ll;\r\n#define endl '\\n'\r\n#define all(var) var.begin(),var.end()\r\nconst int N = 207;\r\nconst int SUM = N*N;\r\nint MOD;\r\nint binpow(ll x,int power){\r\n ll mult = x%MOD;\r\n x = 1;\r\n while(power){\r\n if (power&1)\r\n x = x*mult%MOD;\r\n mult = mult*mult%MOD;\r\n power = power>>1;\r\n }\r\n return x;\r\n}\r\nll fact[N],rev[N];\r\nint C(int n,int k){\r\n return fact[n]*rev[k]%MOD*rev[n-k]%MOD;\r\n}\r\nint dp[20][SUM][N],mv[N];\r\nint last;\r\nint n;\r\nint F(int cur,int sum,int cnt,int mi){\r\n if (cur*micur*cnt || summi || cnt==0)\r\n dp[cur-mi][sum][cnt] = 0;\r\n else\r\n dp[cur-mi][sum][cnt] = 1;\r\n return dp[cur-mi][sum][cnt];\r\n }\r\n dp[cur-mi][sum][cnt] = F(cur-1,sum,cnt,mi);\r\n int sa = 0;\r\n for(int add = 1;add<=cnt && sa<=sum;++add){\r\n sa+=cur;\r\n ll ret = F(cur-1,sum-sa,cnt-add,mi);\r\n if (ret==0)\r\n continue;\r\n ret = ret*C(cnt,add);\r\n if (ret>MOD*2)\r\n ret%=MOD;\r\n if (ret>=MOD)\r\n ret-=MOD;\r\n dp[cur-mi][sum][cnt]+=ret;\r\n if (dp[cur-mi][sum][cnt]>=MOD)\r\n dp[cur-mi][sum][cnt]-=MOD;\r\n }\r\n return dp[cur-mi][sum][cnt];\r\n}\r\nvoid solve(){\r\n\r\n cin>>n>>MOD;\r\n fact[0] = 1;\r\n for(int i = 1;i=0;--i){\r\n rev[i] = rev[i+1]*(i+1)%MOD;\r\n }\r\n\r\n for(int i = n+1;i>=1;--i){\r\n int sum = 0,cnt = 0;\r\n for(int j = i;j<=n+1;++j){\r\n while(i*j>=sum+j)\r\n sum+=j,mv[++cnt] = j;\r\n }\r\n if (cnt=inp[1]+...+inp[n] matters\r\n#include\r\nusing namespace std;\r\n\r\nconst int nmax=2e2+5;\r\n\r\nlong long OUTP=0;\r\n\r\nint n,m;\r\n\r\nint inp[nmax];\r\n\r\nint c[nmax][nmax];\r\n\r\nint states=0;\r\n\r\nvector< pair< pair,int/*value*/> > dp[nmax],help;\r\n\r\nvoid extend(int sum,int prv,int pos,long long coeff)\r\n{\r\n if(pos==n)\r\n {\r\n OUTP=(OUTP+coeff)%m;\r\n return;\r\n }\r\n\r\n if(prv==n+1)return;\r\n\r\n if(inp[1]*(n+1)inp[1]*new_val)break;\r\n\r\n //long long cur=rec(sum_new,new_val,pos+pos_now)*c[n-pos][pos_now];\r\n dp[new_val].push_back({{sum_new,pos+pos_now},coeff*c[n-pos][pos_now]%m});\r\n }\r\n}\r\n\r\nint main()\r\n{\r\n scanf(\"%i%i\",&n,&m);\r\n\r\n if(n==1)\r\n {\r\n printf(\"%i\\n\",1%m);\r\n return 0;\r\n }\r\n\r\n for(int i=0;i j<=inp[j]\r\n int low=1;\r\n\r\n while(1)//Repeatedly apply inp[i]>=max(c,i) and P(1,n): inp[1]*inp[n]>=c+c+...+c+(c+1)+...+(n-1)+inp[n] and inp[n]<=n+1\r\n {\r\n int up=2*(n+1+low*low)+(n+low)*(n-1-low);\r\n\r\n int down=2*(n+1);\r\n\r\n int low_new=(up+down-1)/down;\r\n\r\n if(low\r\nusing namespace std;\r\n\r\n/**\r\n Analysis of problem:\r\n array is perfect if after sorted:\r\n for any index i:\r\n a0 * ai >= a0 + ... + ai\r\n or equiv:\r\n (a0-1) * ai >= a0 + ... + a[i-1]\r\n \r\n Consider a0 fixed.\r\n Denote f[i, s] to be:\r\n number of perfect sequence with length i, sum = s, maximum is m.\r\n \r\n f[i, s, m] =sum_o f[i - o, s - 0*m, m-1] * C()\r\n TLE, optimize?\r\n \r\n New idea:\r\n condition is equivalent to:\r\n at any point in sequence:\r\n Delta <= a1(ak - k + 1) - ak\r\n ak >= k\r\n \r\n Equivalent:\r\n 1. b1 + ... + bn <= a1\r\n 2. k-th maximum >= n + 2 - k, or if k-th maximum = n+ 1 - k, all value below this equal n + 1 - k.\r\n \r\n Recursive:\r\n f (len, sum, max)\r\n // max is allowed max\r\n \r\n if allowed max is tight: a1 + max = len:\r\n check a1 = len, max = 0,\r\n \r\n allowed max not tight:\r\n Consider the occurences of max.\r\n f = \\sum_o f(len - occ, sum - occ * delta, max - 1)\r\n \r\n */\r\n\r\nint N = 200;\r\nint n, M;\r\nlong long dp[201][201][201];\r\nlong long fac[201];\r\nlong long inv[201];\r\n\r\nlong long power(long long k, int p, int M) {\r\n if (p == 0) {\r\n return 1;\r\n }\r\n long long y = power (k, p/2, M);\r\n long long z = y * y % M;\r\n if (p % 2 == 0) {\r\n return z;\r\n }\r\n else {\r\n return z * k % M;\r\n }\r\n}\r\n\r\nvoid computeMod(int M) {\r\n fac[0] = 1;\r\n for (int i = 1; i <= N; ++i) {\r\n fac[i] = fac[i-1] * i % M;\r\n //cout << fac[i] << \" \";\r\n }\r\n //cout << endl;\r\n \r\n inv[N] = power(fac[N], M-2, M);\r\n for (int i = N - 1; i >= 0; --i) {\r\n inv[i] = inv[i+1] * (i+1) % M;\r\n //cout << inv[i] << \" \";\r\n }\r\n //cout << endl;\r\n}\r\n\r\nlong long f(int len, int max, int sum, int a1) {\r\n \r\n /**\r\n Computes # seq of len such that\r\n b1 + ... + bn <= sum\r\n bn <= max\r\n [a1 + bk >= k + 1\r\n or a1 + bk = k and a1 = k, b1= ... = bk = 0]\r\n */\r\n \r\n if (dp[len][max][sum] != -1) {\r\n return dp[len][max][sum];\r\n }\r\n \r\n if (max == 0 && len > 0) {\r\n dp[len][max][sum] = inv[len];\r\n \r\n // 50 100757149\r\n //cout << \"base: len, max, sum \" << len << \" \" << max << \" \" << sum << \" = \" << dp[len][max][sum] % M << endl;\r\n \r\n return inv[len];\r\n }\r\n \r\n if (a1 + max >= len + 1) {\r\n long long g = 0;\r\n for (int occ = 0; occ <= len && occ * max <= sum ; occ ++) {\r\n long long val = f(len - occ, max - 1, sum - occ * max, a1);\r\n //cout << occ << \" \" << val * inv[occ] << endl;\r\n g = (g + val * inv[occ]) % M;\r\n }\r\n dp[len][max][sum] = g;\r\n //cout << \"len, max, sum \" << len << \" \" << max << \" \" << sum << \" = \" << dp[len][max][sum] % M << endl;\r\n return g;\r\n }\r\n \r\n return 0;\r\n}\r\n\r\n\r\nvoid solve(int n, int M) {\r\n // Find # perfect array of len n, elements 1 <= ai <= n+1\r\n if (n == 1) {\r\n cout << 2 % M;\r\n return;\r\n }\r\n \r\n memset(dp, -1, sizeof(dp));\r\n \r\n computeMod(M);\r\n \r\n long long ans = 0;\r\n for (int a1 = n + 1; a1 >= 1 && a1 >= n - 20; --a1) {\r\n memset(dp, -1, sizeof(dp));\r\n long long val = f(n, n + 1 - a1, a1, a1);\r\n ans = ans + val % M;\r\n // cout << f(n, n+1, a1, a1) * fac[n] % M << \" \" << endl;;\r\n }\r\n \r\n ans = ans * fac[n] % M;\r\n cout << ans << endl;\r\n\r\n return;\r\n}\r\n\r\n\r\nint main() {\r\n // insert code here...\r\n\r\n cin >> n >> M;\r\n \r\n solve (n, M);\r\n \r\n /**\r\n \r\n n = 3;\r\n for (int i = 1; i <= n+1; ++i) {\r\n for (int j = i; j <= n+1; ++j) {\r\n for (int k = j; k <= n+1; ++k) {\r\n if (i * j >= i + j && i * k >= i + j + k) {\r\n cout << i << ' ' << j << \" \" << k << endl;\r\n }\r\n }\r\n }\r\n }\r\n \r\n n = 4;\r\n int cnt = 0;\r\n for (int i = 1; i <= n+1; ++i) {\r\n for (int j = i; j <= n+1; ++j) {\r\n for (int k = j; k <= n+1; ++k) {\r\n for (int l = k; l <= n+1; ++l)\r\n if (i * j >= i + j && i * k >= i + j + k && i * l >= i + j + k + l) {\r\n cout << i << ' ' << j << \" \" << k << \" \" << l <\r\n#include \r\nusing namespace std;\r\n\r\n/**\r\n Analysis of problem:\r\n array is perfect if after sorted:\r\n for any index i:\r\n a0 * ai >= a0 + ... + ai\r\n or equiv:\r\n (a0-1) * ai >= a0 + ... + a[i-1]\r\n \r\n Consider a0 fixed.\r\n Denote f[i, s] to be:\r\n number of perfect sequence with length i, sum = s, maximum is m.\r\n \r\n f[i, s, m] =sum_o f[i - o, s - 0*m, m-1] * C()\r\n TLE, optimize?\r\n \r\n New idea:\r\n condition is equivalent to:\r\n at any point in sequence:\r\n Delta <= a1(ak - k + 1) - ak\r\n ak >= k\r\n \r\n Equivalent:\r\n 1. b1 + ... + bn <= a1\r\n 2. k-th maximum >= n + 2 - k, or if k-th maximum = n+ 1 - k, all value below this equal n + 1 - k.\r\n \r\n Recursive:\r\n f (len, sum, max)\r\n // max is allowed max\r\n \r\n if allowed max is tight: a1 + max = len:\r\n check a1 = len, max = 0,\r\n \r\n allowed max not tight:\r\n Consider the occurences of max.\r\n f = \\sum_o f(len - occ, sum - occ * delta, max - 1)\r\n \r\n */\r\n\r\nint N = 200;\r\nint n, M;\r\nlong long dp[201][201][201];\r\nlong long fac[201];\r\nlong long inv[201];\r\n\r\nlong long power(long long k, int p, int M) {\r\n if (p == 0) {\r\n return 1;\r\n }\r\n long long y = power (k, p/2, M);\r\n long long z = y * y % M;\r\n if (p % 2 == 0) {\r\n return z;\r\n }\r\n else {\r\n return z * k % M;\r\n }\r\n}\r\n\r\nvoid computeMod(int M) {\r\n fac[0] = 1;\r\n for (int i = 1; i <= N; ++i) {\r\n fac[i] = fac[i-1] * i % M;\r\n //cout << fac[i] << \" \";\r\n }\r\n //cout << endl;\r\n \r\n inv[N] = power(fac[N], M-2, M);\r\n for (int i = N - 1; i >= 0; --i) {\r\n inv[i] = inv[i+1] * (i+1) % M;\r\n //cout << inv[i] << \" \";\r\n }\r\n //cout << endl;\r\n}\r\n\r\nlong long f(int len, int max, int sum, int a1) {\r\n \r\n /**\r\n Computes # seq of len such that\r\n b1 + ... + bn <= sum\r\n bn <= max\r\n [a1 + bk >= k + 1\r\n or a1 + bk = k and a1 = k, b1= ... = bk = 0]\r\n */\r\n \r\n if (dp[len][max][sum] != -1) {\r\n return dp[len][max][sum];\r\n }\r\n \r\n if (max == 0 && len > 0) {\r\n dp[len][max][sum] = inv[len];\r\n \r\n // 50 100757149\r\n //cout << \"base: len, max, sum \" << len << \" \" << max << \" \" << sum << \" = \" << dp[len][max][sum] % M << endl;\r\n \r\n return inv[len];\r\n }\r\n \r\n if (a1 + max >= len + 1) {\r\n long long g = 0;\r\n for (int occ = 0; occ <= len && occ * max <= sum ; occ ++) {\r\n long long val = f(len - occ, max - 1, sum - occ * max, a1);\r\n //cout << occ << \" \" << val * inv[occ] << endl;\r\n g = (g + val * inv[occ]) % M;\r\n }\r\n dp[len][max][sum] = g;\r\n //cout << \"len, max, sum \" << len << \" \" << max << \" \" << sum << \" = \" << dp[len][max][sum] % M << endl;\r\n return g;\r\n }\r\n \r\n return 0;\r\n}\r\n\r\n\r\nvoid solve(int n, int M) {\r\n // Find # perfect array of len n, elements 1 <= ai <= n+1\r\n if (n == 1) {\r\n cout << 2 % M;\r\n return;\r\n }\r\n \r\n memset(dp, -1, sizeof(dp));\r\n \r\n computeMod(M);\r\n \r\n long long ans = 0;\r\n for (int a1 = n + 1; a1 >= 1 && a1 >= n - 20; --a1) {\r\n memset(dp, -1, sizeof(dp));\r\n long long val = f(n, n + 1 - a1, a1, a1);\r\n ans = ans + val % M;\r\n // cout << f(n, n+1, a1, a1) * fac[n] % M << \" \" << endl;;\r\n }\r\n \r\n ans = ans * fac[n] % M;\r\n cout << ans << endl;\r\n\r\n return;\r\n}\r\n\r\n\r\nint main() {\r\n // insert code here...\r\n\r\n cin >> n >> M;\r\n \r\n solve (n, M);\r\n \r\n /**\r\n \r\n n = 3;\r\n for (int i = 1; i <= n+1; ++i) {\r\n for (int j = i; j <= n+1; ++j) {\r\n for (int k = j; k <= n+1; ++k) {\r\n if (i * j >= i + j && i * k >= i + j + k) {\r\n cout << i << ' ' << j << \" \" << k << endl;\r\n }\r\n }\r\n }\r\n }\r\n \r\n n = 4;\r\n int cnt = 0;\r\n for (int i = 1; i <= n+1; ++i) {\r\n for (int j = i; j <= n+1; ++j) {\r\n for (int k = j; k <= n+1; ++k) {\r\n for (int l = k; l <= n+1; ++l)\r\n if (i * j >= i + j && i * k >= i + j + k && i * l >= i + j + k + l) {\r\n cout << i << ' ' << j << \" \" << k << \" \" << l <\r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n\r\nusing namespace std;\r\n#ifdef ONLINE_JUDGE\r\n#define endl \"\\n\"\r\n#endif\r\n\r\n#define gcd(a, b) __gcd(a, b)\r\n#define all(cont) cont.begin(), cont.end()\r\n#define rall(cont) cont.end(), cont.begin()\r\n#define rsort(x) sort(x, [](auto a, auto b) { rtn a > b; });\r\n#define forr(i, v) for (int i = 0; i < v; i++)\r\n#define each(x, v) for (auto x : v)\r\n#define forrr(i, j, v, w) \\\r\n for (int i = 0; i < v; i++) \\\r\n for (int j = 0; j < w; j++)\r\n#define ni(x) \\\r\n int x; \\\r\n cin >> x;\r\n#define nii(x, y) \\\r\n int x, y; \\\r\n cin >> x >> y;\r\n#define niii(x, y, z) \\\r\n int x, y, z; \\\r\n cin >> x >> y >> z;\r\n#define niiii(w, x, y, z) \\\r\n int w, x, y, z; \\\r\n cin >> w >> x >> y >> z;\r\n#define nl(x) \\\r\n ll x; \\\r\n cin >> x;\r\n#define nll(x, y) \\\r\n ll x, y; \\\r\n cin >> x >> y;\r\n#define nlll(x, y, z) \\\r\n ll x, y, z; \\\r\n cin >> x >> y >> z;\r\n#define nllll(w, x, y, z) \\\r\n ll w, x, y, z; \\\r\n cin >> w >> x >> y >> z;\r\n#define get(v) \\\r\n vi v; \\\r\n forr(i, n) \\\r\n { \\\r\n ni(x); \\\r\n v.pb(x); \\\r\n }\r\n#define amax(a, b) a = max(a, b);\r\n#define amin(a, b) a = min(a, b);\r\n#define mp make_pair\r\n#define pb push_back\r\n#define ff first\r\n#define ss second\r\n#define rz resize\r\n#define sz size()\r\n#define cnt continue\r\n#define brk break\r\n#define rtn return\r\n#define W() \\\r\n int T; \\\r\n cin >> T; \\\r\n while (T--)\r\n#define trace(x) cerr << #x << \": \" << x << endl;\r\n#define output()\r\n#define ff first\r\n#define float double\r\ntypedef long int int32;\r\ntypedef unsigned long int uint32;\r\ntypedef long long int int64;\r\ntypedef unsigned long long int uint64;\r\ntypedef long long ll;\r\ntypedef string str;\r\ntypedef pair pii;\r\ntypedef pair pdd;\r\ntypedef vector vd;\r\ntypedef vector vb;\r\ntypedef vector vl;\r\ntypedef vector vi;\r\ntypedef vector vs;\r\ntypedef vector vpii;\r\ntypedef vector vpdd;\r\ntypedef vector vppii;\r\ntypedef vector vii;\r\ntypedef vector vbb;\r\ntypedef vector vll;\r\ntypedef unordered_map mpii;\r\ntypedef set seti;\r\ntypedef set setl;\r\ntypedef set> spii;\r\ntypedef vector> vseti;\r\n\r\nconst ll linf = 1e18 + 10;\r\nconst int inf = 1e9 + 10;\r\nconst double eps = 1e-9;\r\nconst double pi = 3.1415926535897932384626433832795;\r\nint mod = 1000000007;\r\nconst int base = 31;\r\n\r\nll max(ll a, ll b)\r\n{\r\n return a > b ? a : b;\r\n}\r\n\r\nll min(ll a, ll b)\r\n{\r\n return a < b ? a : b;\r\n}\r\n\r\nint count1(int x)\r\n{\r\n rtn __builtin_popcount(x);\r\n}\r\n\r\nint count1(ll x)\r\n{\r\n rtn __builtin_popcountll(x);\r\n}\r\n\r\nvoid out(vl v)\r\n{\r\n for (ll i : v)\r\n {\r\n cerr << i << \" \";\r\n }\r\n cerr << endl;\r\n}\r\n\r\nvoid out(vi v)\r\n{\r\n for (int i : v)\r\n {\r\n cerr << i << \" \";\r\n }\r\n cerr << endl;\r\n}\r\n\r\nvoid out(seti v)\r\n{\r\n for (int i : v)\r\n {\r\n cerr << i << \" \";\r\n }\r\n cerr << endl;\r\n}\r\n\r\nvoid out(setl v)\r\n{\r\n for (ll i : v)\r\n {\r\n cerr << i << \" \";\r\n }\r\n cerr << endl;\r\n}\r\n\r\nvoid out(vd v)\r\n{\r\n for (double i : v)\r\n {\r\n cerr << i << \" \";\r\n }\r\n cerr << endl;\r\n}\r\n\r\nvoid out(vb v)\r\n{\r\n for (bool i : v)\r\n {\r\n cerr << i << \" \";\r\n }\r\n cerr << endl;\r\n}\r\n\r\nvoid out(vii v)\r\n{\r\n for (vi i : v)\r\n {\r\n out(i);\r\n }\r\n cerr << endl;\r\n}\r\n\r\nvoid out(vbb v)\r\n{\r\n for (vb i : v)\r\n {\r\n out(i);\r\n }\r\n cerr << endl;\r\n}\r\n\r\nvoid out(vll v)\r\n{\r\n for (vl i : v)\r\n {\r\n out(i);\r\n }\r\n cerr << endl;\r\n}\r\n\r\nvoid out(pii i)\r\n{\r\n cerr << \"<\" << i.ff << \",\" << i.ss << \"> \";\r\n}\r\n\r\nvoid out(pdd i)\r\n{\r\n cerr << \"<\" << i.ff << \",\" << i.ss << \"> \";\r\n}\r\n\r\nvoid out(vpii v)\r\n{\r\n for (pii i : v)\r\n {\r\n out(i);\r\n }\r\n cerr << endl;\r\n}\r\n\r\nvoid out(mpii v)\r\n{\r\n for (pii i : v)\r\n {\r\n cerr << \"<\" << i.ff << \"=>\" << i.ss << \"> \";\r\n }\r\n cerr << endl;\r\n}\r\n\r\nvoid out(int v[], int n)\r\n{\r\n forr(i, n)\r\n {\r\n cerr << v[i] << \" \";\r\n }\r\n cerr << endl;\r\n}\r\n\r\nvoid out(map v)\r\n{\r\n for (pii i : v)\r\n {\r\n cerr << \"<\" << i.ff << \"->\" << i.ss << \"> \";\r\n }\r\n cerr << endl;\r\n}\r\n\r\nint add(int a, int b)\r\n{\r\n int res = (a + b) % mod;\r\n if (res < 0)\r\n res += mod;\r\n rtn res;\r\n}\r\n\r\nvoid iadd(int &a, int b)\r\n{\r\n a = add(a, b);\r\n}\r\n\r\nint mul(int a, int b)\r\n{\r\n int res = (a * 1LL * b) % mod;\r\n if (res < 0)\r\n res += mod;\r\n rtn res;\r\n}\r\n\r\nvoid imul(int &a, int b)\r\n{\r\n a = mul(a, b);\r\n}\r\n\r\nint power(int a, int b)\r\n{\r\n int res = 1;\r\n while (b)\r\n {\r\n if (b % 2)\r\n res = mul(res, a);\r\n a = mul(a, a);\r\n b /= 2;\r\n }\r\n rtn res;\r\n}\r\n\r\nvoid ipower(int &a, int b)\r\n{\r\n a = power(a, b);\r\n}\r\n\r\nint inv(int x)\r\n{\r\n rtn x == 1 ? 1 : power(x, mod - 2);\r\n}\r\n\r\nvoid iinv(int &x)\r\n{\r\n x = inv(x);\r\n}\r\n\r\nvoid igcd(int &g, int x)\r\n{\r\n g = gcd(g, x);\r\n}\r\n\r\nvoid ans(str x)\r\n{\r\n cout << x << endl;\r\n}\r\n\r\nvoid ans(const char *x)\r\n{\r\n cout << x << endl;\r\n}\r\n\r\ntemplate \r\nvoid ans(T x)\r\n{\r\n ans(to_string(x));\r\n}\r\n\r\nbool isPrime(int x)\r\n{\r\n int primes[168] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997};\r\n int j = 0;\r\n while (primes[j] < floor(sqrt(x)) + 1)\r\n {\r\n if (x % primes[j] == 0)\r\n {\r\n return false;\r\n }\r\n j++;\r\n }\r\n return true;\r\n}\r\n\r\nvoid sieve(int n = 1000005)\r\n{\r\n bool p[1000005];\r\n memset(p, 1, sizeof(p));\r\n p[0] = p[1] = 0;\r\n for (int i = 2; i * i < n; i++)\r\n {\r\n if (p[i])\r\n {\r\n for (int j = 2 * i; j < n; j += i)\r\n {\r\n p[j] = 0;\r\n }\r\n }\r\n }\r\n}\r\n\r\nvi range(int n)\r\n{\r\n vi v(n);\r\n for (int i = 1; i < n; i++)\r\n {\r\n v[i] = i;\r\n }\r\n rtn v;\r\n}\r\n\r\nint dp[201][201][40], fact[201], ifact[201];\r\nint vis[201][201][40];\r\nint n, a1;\r\n\r\nint rec(int i, int sum, int k)\r\n{\r\n if (i == n)\r\n rtn fact[n];\r\n if (k == 0)\r\n rtn mul(fact[n], ifact[n - i]);\r\n if (vis[i][sum][k] == a1)\r\n rtn dp[i][sum][k];\r\n vis[i][sum][k] = a1;\r\n int &a = dp[i][sum][k];\r\n a = 0;\r\n int r = (a1 - sum) / k;\r\n for (int c = r; c >= 0; c--)\r\n {\r\n if (k > 1 && i + c < n - a1 + 1 - k + 1)\r\n cnt;\r\n ;\r\n iadd(a, mul(rec(i + c, sum + c * k, k - 1), ifact[c]));\r\n }\r\n rtn a;\r\n}\r\nvoid pre()\r\n{\r\n fact[0] = 1;\r\n ifact[0] = 1;\r\n}\r\n\r\nvoid solve()\r\n{\r\n cin >> n >> mod;\r\n for (int i = 1; i <= n; i++)\r\n {\r\n fact[i] = mul(i, fact[i - 1]);\r\n ifact[i] = inv(fact[i]);\r\n }\r\n int a = 0;\r\n int lim = max(n - (sqrt(4 * n + 1) + 1) / 2, n - 2 * sqrt(n));\r\n for (a1 = max(1, n - lim); a1 <= n; a1++)\r\n {\r\n iadd(a, rec(0, 0, n + 1 - a1));\r\n }\r\n ans(a);\r\n}\r\n\r\nint32_t main()\r\n{\r\n ios_base::sync_with_stdio(false);\r\n cin.tie(NULL);\r\n cout.tie(NULL);\r\n cerr.tie(NULL);\r\n// cout << fixed;\r\n// cout.precision(10);\r\n// cerr << fixed;\r\n// cerr.precision(6);\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#endif\r\n clock_t tStart = clock();\r\n\r\n pre();\r\n // W()\r\n solve();\r\n\r\n double t = (double)(clock() - tStart) / CLOCKS_PER_SEC;\r\n cerr << endl\r\n << \"Time: \" << t;\r\n rtn 0;\r\n}\r\n\r\n/*\r\n\r\n\r\n*/", "lang": "GNU C++17", "bug_code_uid": "68cd1b4245dbef3dfe6bb6a937bf98dd", "src_uid": "cf57508de47d80bc983861f70bb5f3d6", "apr_id": "37e982fdcc2830cfb253e45eed615217", "difficulty": 3200, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "C++"}