{"similarity_score": 0.5501481168006771, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n\tpublic static void main(String[] args) throws Exception {\n\t\tnew Main().solve();\n\t}\n\t\n\tprivate void solve() throws Exception {\n\t\treader = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\tn = Integer.parseInt(reader.readLine());\n\t\ta = new int[n];\n\t\tst = new StringTokenizer(reader.readLine());\n\t\t\n\t\tfor (int i = 0; i < n; ++i) {\n\t\t\ta[i] = Integer.parseInt(st.nextToken());\n\t\t}\n\t\t\n\t\treader.close();\n\t\t\n\t\tif (func(0, false)) {\n\t\t\tSystem.out.println(\"Yes\");\n\t\t} else {\n\t\t\tSystem.out.println(\"No\");\n\t\t}\n\t}\n\t\n\tprivate BufferedReader reader;\n\tprivate StringTokenizer st;\n\tprivate int n;\n\tprivate int[] a;\n\t\n\tprivate boolean func(int indx, boolean flag) {\n\t\t\n\t\tif (indx >= n) {\n\t\t\treturn flag;\n\t\t}\n\t\t\n\t\tif (a[indx] % 2 == 0 || a[n - 1] % 2 == 0) {\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\tif (!flag && (n - indx) % 2 == 1) {\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\t\n\t\tfor (int j = indx; j < n; j += 2) {\n\t\t\tif (a[j] % 2 == 0) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t\tif (func(j + 1, !flag)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn false;\n\t}\n}", "lang": "Java 8", "bug_code_uid": "43da8bd55b25ec9707890d3f52a31e8f", "src_uid": "2b8c2deb5d7e49e8e3ededabfd4427db", "apr_id": "ced520c4a7fe34d57ced3d56e0918573", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.999330207635633, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "// package Practice1.CF29;\n\nimport java.util.Scanner;\n\npublic class CF029B {\n public static void main(String[] args) {\n Scanner s = new Scanner(System.in);\n int l = s.nextInt(),d =s.nextInt(),v = s.nextInt(),g = s.nextInt(),r = s.nextInt();\n double timeToreachTL = (d*1.0)/v;\n if(timeToreachTL < g){\n //Light is green right now, the car can simply pass.\n timeToreachTL += ((l-d)*1.0)/v;\n System.out.println(timeToreachTL);\n } else {\n double mod = timeToreachTL % (g+r);\n if(mod > g){\n timeToreachTL += (g+r) - mod;\n }\n timeToreachTL += ((l-d)*1.0)/v;\n System.out.println(timeToreachTL);\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "5313d9c68b29e5007622f61811a74c06", "src_uid": "e4a4affb439365c843c9f9828d81b42c", "apr_id": "7c3ddb245b9bb77bc713c212ec08dd98", "difficulty": 1500, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9488950276243094, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*;\n\npublic class CopyOfNuble {\n\n static void metod() throws Exception {\n Scanner in = new Scanner(System.in);\n int l = in.nextInt();\n int d = in.nextInt();\n int v = in.nextInt();\n int g = in.nextInt();\n int r = in.nextInt();\n\n double t = (double) d / (double) v;\n double t1 = t % ((double) g + (double) r);\n\n if (t1 < (double) g) {\n System.out.println((double) l / (double) v);\n } else {\n System.out.println((double) l / (double) v + 2 * (double) t1\n - (double) g - (double) r);\n }\n\n }\n\n public static void main(String args[]) throws Exception {\n CopyOfNuble.metod();\n }\n}", "lang": "Java 6", "bug_code_uid": "59cd68f6615dc4159c784c1d3cba306f", "src_uid": "e4a4affb439365c843c9f9828d81b42c", "apr_id": "f316bc16443730de415b46c7e4bd7379", "difficulty": 1500, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.971388202048746, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.text.NumberFormat;\nimport java.util.Scanner;\n\npublic class light {\n\n public static void main(String[] args) {\n new light().run();\n }\n\n private void run() {\n Scanner sc = new Scanner(System.in);\n int l = sc.nextInt();\n int d = sc.nextInt();\n int v = sc.nextInt();\n int g = sc.nextInt();\n int r = sc.nextInt();\n int x = 0, secsf = 0, rORg = g;\n double sec = 0;\n boolean isGreen = true;\n NumberFormat nf = NumberFormat.getInstance();\n nf.setMaximumFractionDigits(8);\n\n if (d=rORg)\n {\n isGreen=!(isGreen);\n secsf=0;\n if (rORg==g)\n rORg=r;\n else\n rORg=g;\n }\n\n sec++;\n }\n\n System.out.print(nf.format((sec-1)+(double)(v-x+l)/v));\n\n }\n\n\n}\n", "lang": "Java 6", "bug_code_uid": "5ed61304c7351eb5475276b9caff2bc4", "src_uid": "e4a4affb439365c843c9f9828d81b42c", "apr_id": "5e37d55696ef3801e1b075958e9b1bb6", "difficulty": 1500, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9899665551839465, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*;\nimport java.io.*;\n\npublic class Main {\n// File file = new File(\"input.txt\");\n// Scanner in = new Scanner(file);\n// PrintWriter out = new PrintWriter(new FileWriter(\"output.txt\"));\n public static void main(String[] args) {\n// Scanner in = new Scanner(System.in);\n FastReader in = new FastReader();\n \t \n// int test_cases = in.nextInt();\n// while (test_cases -- > 0){\n \t\n \tint n = in.nextInt();\n \tlong ans = 0;\n \tfor(int i = 1; i<=n; i++) {\n \t\tans+=Math.pow(2, i);\n \t}\n \tSystem.out.println(ans);\n \t\n// }\n \t\n }\n \n private static int gcd(int a, int b) {\n \tif(b==0) return a;\n \treturn gcd(b, a%b);\n }\n\n\tstatic class FastReader {\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader() {\n br = new BufferedReader(new\n InputStreamReader(System.in));\n }\n\n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n }\n}", "lang": "Java 11", "bug_code_uid": "030d68b73ddc6c04005e4991b46ecd43", "src_uid": "f1b43baa14d4c262ba616d892525dfde", "apr_id": "b704e10a93d366cfda783d595c57f65d", "difficulty": 1100, "tags": ["math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9064232148679492, "equal_cnt": 6, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n FastReader in = new FastReader();\n StringBuilder out = new StringBuilder();\n int n = in.nextInt();\n int k = in.nextInt();\n String c = in.next();\n HashSet set = new HashSet<>();\n for (int i = 0; i < c.length(); i++) {\n set.add(c.charAt(i));\n }\n if(set.size()==n/k){\n System.out.println(\"YES\");\n }else{\n System.out.println(\"NO\");\n }\n }\n\n}\n\nclass FastReader {\n\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader() {\n br = new BufferedReader(new InputStreamReader(System.in));\n\n }\n\n public String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n}\n", "lang": "Java 8", "bug_code_uid": "e9c1d6161184cd71b0529a0667d10ade", "src_uid": "ceb3807aaffef60bcdbcc9a17a1391be", "apr_id": "8ba6ac3d3b8e1e1105a56b931b063e1f", "difficulty": 900, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9939011566771819, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.HashMap;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\nimport java.util.Map;\nimport java.util.Map.Entry;\nimport java.io.BufferedReader;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n CustomReader in = new CustomReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n TaskA solver = new TaskA();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class TaskA {\n public void solve(int testNumber, CustomReader in, PrintWriter out) {\n\n int n = in.nextInt();\n int k = in.nextInt();\n String colors = in.next();\n\n Map colorCount = new HashMap<>();\n for (char ch : colors.toCharArray()) {\n if (!colorCount.containsKey(ch)) {\n colorCount.put(ch, 0);\n }\n int count = colorCount.get(ch);\n colorCount.put(ch, ++count);\n }\n\n for (Map.Entry entry : colorCount.entrySet()) {\n if (!(entry.getValue() < k) && 0 < entry.getValue() % k) {\n out.write(\"NO\");\n return;\n }\n }\n\n out.write(\"YES\");\n }\n\n }\n\n static class CustomReader {\n private BufferedReader reader;\n private StringTokenizer tokenizer;\n\n public CustomReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "dc6b470ba6c5fd5988a217f1eeed3424", "src_uid": "ceb3807aaffef60bcdbcc9a17a1391be", "apr_id": "b8cc48c33ef9afd0a2cefd9b1126aa7c", "difficulty": 900, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9983045100033909, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.io.FileInputStream;\nimport java.io.PrintStream;\nimport java.util.Scanner;\n\npublic class Codeforces {\n public static void main(String args[]) throws Exception {\n //Scanner s = new Scanner(new FileInputStream(\"input.txt\"));\n //PrintStream p = new PrintStream(\"output.txt\");\n Scanner s = new Scanner(System.in);\n\n int f = 5 * 60;\n int l = 24 * 60 - 1;\n\n int a, Ta, b, Tb, start;\n a = s.nextInt();\n Ta = s.nextInt();\n b = s.nextInt();\n Tb = s.nextInt();\n\n s.nextLine();\n String tmp = s.nextLine();\n String[] tmp1 = tmp.split(\":\");\n start = ((tmp1[0].toCharArray()[0] - '0') * 10 + (tmp1[0].toCharArray()[1]) - '0') * 60 + (tmp1[1].toCharArray()[0] - '0') * 10 + (tmp1[1].toCharArray()[1] - '0');\n //System.out.println(start);\n\n //int lb = (start - Tb - f) / b * b + f;\n //int rb = (start + Ta - f) / b * b + f;\n int lb = f, rb = f;\n while (lb <= start - Tb) lb += b;\n while (rb <= start + Ta) rb += b;\n rb -= b;\n //System.out.println(\"\" + f + ' ' + lb + ' ' + l + ' ' + rb);\n\n //if (lb + Tb <= start) lb += b;\n //if (rb >= a + Ta) rb -= b;\n\n //System.out.println(\"\" + f + ' ' + lb + ' ' + l + ' ' + rb);\n while (lb < f) lb += b;\n while (rb > l) rb -= b;\n //System.out.println(\"\" + f + ' ' + lb + ' ' + l + ' ' + rb);\n System.out.print((rb - lb) / b);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "54d72f82e7fd9f5a45f39f1f85e36489", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "apr_id": "96a8b328a47dfb569d10b1a088ee24e4", "difficulty": 1600, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9978940880373928, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\n/*\npolyakoff\n*/\n\npublic class Main {\n\n static FastReader in;\n static PrintWriter out;\n static Random rand = new Random();\n static final int oo = (int) 1e9 + 10;\n static final long OO = (long) 2e18 + 20;\n static final int MOD = (int) 1e9 + 7;\n\n static int n;\n static int[] par, p;\n\n static int findSet(int u) {\n if (par[u] == u)\n return u;\n return par[u] = findSet(par[u]);\n }\n\n static class SegTree {\n class Node {\n int max;\n Pair lr;\n\n Node(int max, Pair lr) {\n this.max = max;\n this.lr = lr;\n }\n }\n Node[] t;\n int size;\n\n void push(int u) {\n if (t[u].lr.l != -1) {\n t[u * 2 + 1].lr.l = t[u].lr.l;\n t[u * 2 + 1].lr.r = t[u].lr.r;\n t[u * 2 + 2].lr.l = t[u].lr.l;\n t[u * 2 + 2].lr.r = t[u].lr.r;\n t[u].lr.l = t[u].lr.r = -1;\n }\n }\n void pull(int u) {\n t[u].max = p[t[u * 2 + 1].max] > p[t[u * 2 + 2].max] ? t[u * 2 + 1].max : t[u * 2 + 2].max;\n }\n void build(int u, int tl, int tr, int[][] initial) {\n if (tl == tr) {\n t[u] = new Node(initial[tl][0], new Pair(initial[tl][1], initial[tl][2]));\n } else {\n int tm = (tl + tr) / 2;\n build(u * 2 + 1, tl, tm, initial);\n build(u * 2 + 2, tm + 1, tr, initial);\n t[u] = new Node(-1, new Pair(-1, -1));\n pull(u);\n }\n }\n int maxPOn(int u, int tl, int tr, int l, int r) {\n if (r < tl || tr < l)\n return n;\n if (l <= tl && tr <= r)\n return t[u].max;\n int tm = (tl + tr) / 2;\n push(u);\n int v1 = maxPOn(u * 2 + 1, tl, tm, l, r);\n int v2 = maxPOn(u * 2 + 2, tm + 1, tr, l, r);\n return p[v1] > p[v2] ? v1 : v2;\n }\n void setPIn(int u, int tl, int tr, int i, int p) {\n if (tl == tr) {\n\n } else {\n int tm = (tl + tr) / 2;\n push(u);\n if (i <= tm) {\n setPIn(u * 2 + 1, tl, tm, i, p);\n } else {\n setPIn(u * 2 + 2, tm + 1, tr, i, p);\n }\n pull(u);\n }\n }\n void setLROn(int u, int tl, int tr, int l, int r, int newL, int newR) {\n if (r < tl || tr < l)\n return;\n if (l <= tl && tr <= r) {\n t[u].lr.l = newL;\n t[u].lr.r = newR;\n return;\n }\n int tm = (tl + tr) / 2;\n push(u);\n setLROn(u * 2 + 1, tl, tm, l, r, newL, newR);\n setLROn(u * 2 + 2, tm + 1, tr, l, r, newL, newR);\n pull(u);\n }\n Pair LRIn(int u, int tl, int tr, int i) {\n if (tl == tr) {\n return t[u].lr;\n }\n int tm = (tl + tr) / 2;\n push(u);\n if (i <= tm) {\n return LRIn(u * 2 + 1, tl, tm, i);\n } else {\n return LRIn(u * 2 + 2, tm + 1, tr, i);\n }\n }\n\n void build(int[][] initial) {\n size = initial.length;\n t = new Node[size * 4];\n build(0, 0, size - 1, initial);\n }\n int maxPOn(int l, int r) {\n return maxPOn(0, 0, size - 1, l, r);\n }\n void setPIn(int i, int p) {\n setPIn(0, 0, size - 1, i, p);\n }\n void setLROn(int l, int r, int newL, int newR) {\n setLROn(0, 0, size - 1, l, r, newL, newR);\n }\n Pair LRIn(int i) {\n return LRIn(0, 0, size - 1, i);\n }\n }\n\n static class Pair {\n int l, r;\n\n Pair(int l, int r) {\n this.l = l;\n this.r = r;\n }\n }\n\n static class Edge {\n int u, v, l1, r1, l2, r2;\n boolean removed;\n\n Edge(int u, int v) {\n this.u = u;\n this.v = v;\n l1 = r1 = l2 = r2 = -1;\n }\n }\n\n static class Query {\n int type, x;\n\n Query(int type, int x) {\n this.type = type;\n this.x = x;\n }\n }\n\n static void solve() {\n n = in.nextInt();\n int m = in.nextInt();\n int q = in.nextInt();\n\n p = new int[n + 1];\n p[n] = 0;\n for (int i = 0; i < n; i++) {\n p[i] = in.nextInt();\n }\n\n Edge[] edges = new Edge[m];\n for (int i = 0; i < m; i++) {\n int u = in.nextInt() - 1;\n int v = in.nextInt() - 1;\n edges[i] = new Edge(u, v);\n }\n\n Query[] queries = new Query[q];\n for (int i = 0; i < q; i++) {\n int type = in.nextInt();\n int x = in.nextInt() - 1;\n queries[i] = new Query(type, x);\n if (type == 2)\n edges[x].removed = true;\n }\n\n par = new int[n];\n int[] size = new int[n];\n ArrayList[] subtree = new ArrayList[n];\n for (int i = 0; i < n; i++) {\n par[i] = i;\n size[i] = 1;\n subtree[i] = new ArrayList<>(List.of(i));\n }\n\n for (Edge e : edges) {\n if (e.removed)\n continue;\n int u = findSet(e.u);\n int v = findSet(e.v);\n if (u == v)\n continue;\n if (size[u] < size[v]) {\n u ^= v; v ^= u; u ^= v;\n }\n par[v] = u;\n size[u] += size[v];\n subtree[u].addAll(subtree[v]);\n }\n\n for (int i = q - 1; i >= 0; i--) {\n Query query = queries[i];\n if (query.type == 1)\n continue;\n Edge e = edges[query.x];\n int u = findSet(e.u);\n int v = findSet(e.v);\n if (u == v)\n continue;\n if (size[u] < size[v]) {\n u ^= v; v ^= u; u ^= v;\n }\n par[v] = u;\n size[u] += size[v];\n e.l1 = subtree[u].get(0);\n e.r1 = subtree[u].get(subtree[u].size() - 1);\n e.l2 = subtree[v].get(0);\n e.r2 = subtree[v].get(subtree[v].size() - 1);\n subtree[u].addAll(subtree[v]);\n }\n\n int[][] initial = new int[n][3];\n int[] pos = new int[n];\n for (int u = 0, i = 0; u < n; u++) {\n if (findSet(u) == u) {\n initial[u][1] = i;\n initial[u][2] = i + size[u] - 1;\n for (int v : subtree[u]) {\n initial[i][0] = v;\n initial[i][1] = initial[u][1];\n initial[i][2] = initial[u][2];\n pos[v] = i;\n i++;\n }\n }\n }\n\n SegTree st = new SegTree();\n st.build(initial);\n\n for (int i = 0; i < q; i++) {\n Query query = queries[i];\n if (query.type == 1) {\n int u = query.x;\n Pair lr = st.LRIn(pos[u]);\n int v = st.maxPOn(lr.l, lr.r);\n out.println(p[v]);\n if (v != n) {\n p[v] = 0;\n st.setPIn(pos[v], 0);\n }\n } else {\n Edge e = edges[query.x];\n if (e.l1 != -1) {\n st.setLROn(pos[e.l1], pos[e.r1], pos[e.l1], pos[e.r1]);\n st.setLROn(pos[e.l2], pos[e.r2], pos[e.l2], pos[e.r2]);\n }\n }\n }\n\n\n }\n\n\n public static void main(String[] args) {\n in = new FastReader();\n out = new PrintWriter(System.out);\n// fileInputOutput();\n\n int T = 1;\n// T = in.nextInt();\n while (T-- > 0)\n solve();\n\n out.flush();\n out.close();\n }\n\n static void fileInputOutput() {\n try {\n in = new FastReader(\"input.txt\");\n out = new PrintWriter(new FileOutputStream(\"output.txt\"));\n } catch (FileNotFoundException e) {\n throw new RuntimeException(e);\n }\n }\n\n static void runInThread() {\n Thread thread = new Thread(null, () -> {\n int T = 1;\n// T = in.nextInt();\n while (T-- > 0)\n solve();\n }, \"thread1\", 1 << 28);\n thread.start();\n try {\n thread.join();\n } catch (InterruptedException e) {\n throw new RuntimeException(e);\n }\n }\n\n static class FastReader {\n BufferedReader br;\n StringTokenizer st;\n\n FastReader() {\n this(System.in);\n }\n FastReader(String file) throws FileNotFoundException {\n this(new FileInputStream(file));\n }\n FastReader(InputStream is) {\n br = new BufferedReader(new InputStreamReader(is));\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n long nextLong() {\n return Long.parseLong(next());\n }\n double nextDouble() {\n return Double.parseDouble(next());\n }\n String next() {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(nextLine());\n }\n return st.nextToken();\n }\n String nextLine() {\n String line;\n try {\n line = br.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n return line;\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "fca55c1eb75b3b52dd192199ecff4208", "src_uid": "ad014bde729222db14f38caa521e4167", "apr_id": "15ca8bc81cb03c3e4278242d51bed8e4", "difficulty": 2600, "tags": ["dsu", "data structures", "implementation", "graphs", "trees"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9939855348306053, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import java.io.*;\nimport java.util.*;\npublic class Main{\n\tstatic int[] p, rank, treeNode,adj[];\n\tstatic boolean[]root;\n\tstatic int numSets,N;\n\tstatic int lastNode=0;\n\tstatic void preProcessDSU(int n) {\n\t\tN=n;\n\t\tp = new int[numSets = N];\n\t\trank = new int[N];\n\t\ttreeNode = new int[N];\n\t\troot=new boolean[N<<1];\n\t\tadj=new int[N<<1][2];\n\t\t\n\t\tfor (int i = 0; i < N; i++) { \n\t\t\tp[i] = i; treeNode[i] = lastNode++; root[i]=true;\n\t\t\tadj[i<<1][0]=adj[i<<1][1]=adj[i<<1|1][0]=adj[i<<1|1][1]=-1;\n\t\t}\n\t}\n\tpublic static int findSet(int i) { return p[i] == i ? i : (p[i] = findSet(p[i])); }\n\t\n\tpublic static boolean isSameSet(int i, int j) { return findSet(i) == findSet(j); }\n\t\n\tpublic static void unionSet(int i, int j) \n\t{ \n\t\tif (isSameSet(i, j)) \n\t\t\treturn;\n\t\tnumSets--; \n\t\tint x = findSet(i), y = findSet(j);\n\t\t\n\t\tint u=treeNode[x],v=treeNode[y];\n\t\troot[u]=false;root[v]=false;\n\t\tint newRoot=lastNode++;\n\t\troot[newRoot]=true;\n\t\tadj[newRoot][0]=u;adj[newRoot][1]=v;\n\t\t\n\t\tif(rank[x] > rank[y]) { p[y] = x; treeNode[x]=newRoot;}\n\t\telse\n\t\t{\tp[x] = y; treeNode[y]=newRoot;\n\t\t\tif(rank[x] == rank[y]) rank[y]++; \n\t\t} \n\t\t\n\t}\n\tstatic int time,tin[],tout[];\n\tstatic void dfs(int i) {\n\t\ttin[i]=++time;\n\t\tfor(int j:adj[i]) {\n\t\t\tif(j==-1)continue;\n\t\t\tdfs(j);\n\t\t}\n\t\ttout[i]=time;\n\t}\n\tstatic int[]segTree,index;\n\tstatic void updatePoint(int idx) {\n\t\tupdatePoint(1, 1, time, idx);\n\t}\n\tstatic void updatePoint(int node,int l,int r,int idx) {\n\t\tif(l==r) {\n\t\t\tsegTree[node]=0;\n\t\t\treturn;\n\t\t}\n\t\tint mid=(l+r)>>1;\n\t\tif(idx<=mid) {\n\t\t\tupdatePoint(node<<1, l, mid, idx);\n\t\t}\n\t\telse {\n\t\t\tupdatePoint(node<<1|1, mid+1, r, idx);\n\t\t}\n\t\tif(segTree[node<<1|1]>segTree[node<<1]) {\n\t\t\tsegTree[node]=segTree[node<<1|1];\n\t\t\tindex[node]=index[node<<1|1];\n\t\t}\n\t\telse {\n\t\t\tsegTree[node]=segTree[node<<1];\n\t\t\tindex[node]=index[node<<1];\n\t\t}\n\t}\n\tstatic int[] query(int l,int r) {\n\t\treturn query(1, 1, time,l,r);\n\t}\n\tstatic int[] query(int node,int curL,int curR,int l,int r) {\n\t\tif(curRr)return new int[] {-1,-1};\n\t\tif(curL>=l && curR<=r) {\n\t\t\treturn new int[] {segTree[node],index[node]};\n\t\t}\n\t\tint mid=(curL+curR)>>1;\n\t\tint[]q1=query(node<<1, curL, mid, l, r),q2=query(node<<1|1, mid+1, curR, l, r);\n\t\tif(q1[0]>q2[0]) {\n\t\t\treturn q1;\n\t\t}\n\t\treturn q2;\n\t}\n\tstatic void insert(int idx,int val) {\n\t\tinsert(1, 1, time, idx,val);\n\t}\n\tstatic void insert(int node,int l,int r,int idx,int val) {\n\t\tif(l==r) {\n\t\t\tsegTree[node]=val;\n\t\t\tindex[node]=idx;\n\t\t\treturn;\n\t\t}\n\t\tint mid=(l+r)>>1;\n\t\tif(idx<=mid) {\n\t\t\tinsert(node<<1, l, mid, idx,val);\n\t\t}\n\t\telse {\n\t\t\tinsert(node<<1|1, mid+1, r, idx,val);\n\t\t}\n\t\tif(segTree[node<<1|1]>segTree[node<<1]) {\n\t\t\tsegTree[node]=segTree[node<<1|1];\n\t\t\tindex[node]=index[node<<1|1];\n\t\t}\n\t\telse {\n\t\t\tsegTree[node]=segTree[node<<1];\n\t\t\tindex[node]=index[node<<1];\n\t\t}\n\t}\n\tstatic void main() throws Exception{\n\t\tint n=sc.nextInt(),m=sc.nextInt(),q=sc.nextInt();\n\t\tint[]vals=sc.intArr(n);\n\t\tint[][]edges=new int[m][];\n\t\tfor(int i=0;i=0;i--) {\n\t\t\tif(qs[i][0]==1) {\n\t\t\t\tsubtreeRoot[i]=treeNode[findSet(qs[i][1])];\n\t\t\t}\n\t\t\telse {\n\t\t\t\tint edge=qs[i][1];\n\t\t\t\tunionSet(edges[edge][0], edges[edge][1]);\n\t\t\t}\n\t\t}\n\t\ttin=new int[n<<1];\n\t\ttout=new int[n<<1];\n\t\tfor(int i=0;i0)\n\t\t\tmain();\n\t\tpw.flush();\n\t}\n\tstatic PrintWriter pw;\n\tstatic MScanner sc;\n\tstatic class MScanner {\n\t\tStringTokenizer st;\n\t\tBufferedReader br;\n\t\tpublic MScanner(InputStream system) {\n\t\t\tbr = new BufferedReader(new InputStreamReader(system));\n\t\t}\n \n\t\tpublic MScanner(String file) throws Exception {\n\t\t\tbr = new BufferedReader(new FileReader(file));\n\t\t}\n \n\t\tpublic String next() throws IOException {\n\t\t\twhile (st == null || !st.hasMoreTokens())\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\treturn st.nextToken();\n\t\t}\n\t\tpublic int[] intArr(int n) throws IOException {\n\t int[]in=new int[n];for(int i=0;i= 0; i--) {\n if (type[i] == 1) {\n val[i] = dsu.findComp(val[i]);\n continue;\n }\n int u = dsu.findComp(a[val[i]]);\n int v = dsu.findComp(b[val[i]]);\n if (u == v) {\n continue;\n }\n parent[u] = v;\n dsu.merge(u, v);\n if (dsu.p[v] == u) {\n int t = u;\n u = v;\n v = t;\n }\n g.addEdge(v, u, i);\n }\n\n int root = n;\n for (int i = 0; i < n; i++) {\n if (parent[i] < 0) {\n g.addEdge(root, i, -1);\n }\n }\n EulerTourNumbering et = new EulerTourNumbering(g, root);\n\n MinTree mt = new MinTree(n + 1);\n int[] q = new int[n + 1];\n for (int i = 0; i < n; i++) {\n q[et.timeIn[i]] = p[i];\n mt.set(et.timeIn[i], p[i]);\n }\n\n boolean[] dead = new boolean[m];\n for (int i = 0; i < numQueries; i++) {\n if (type[i] == 2) {\n dead[val[i]] = true;\n continue;\n }\n int pos = et.timeIn[val[i]];\n int l = pos;\n int r = pos;\n for (int e = g.firstEdge[val[i]]; e >= 0; e = g.edgeNxt[e]) {\n int origId = g.edgeId[e];\n int dst = g.edgeDst[e];\n if (dead[origId]) {\n if (l >= 0) {\n int cand = mt.getMinPos(l, r);\n if (q[pos] > q[cand]) {\n pos = cand;\n }\n l = -1;\n }\n continue;\n }\n if (l < 0) {\n l = et.timeIn[dst];\n }\n r = et.timeOut[dst] - 1;\n }\n if (l >= 0) {\n int cand = mt.getMinPos(l, r);\n if (q[pos] > q[cand]) {\n pos = cand;\n }\n l = -1;\n }\n out.println(-q[pos]);\n q[pos] = 0;\n mt.set(pos, 0);\n }\n }\n\n class EulerTourNumbering {\n Graph g;\n int[] tour;\n int[] timeIn;\n int[] timeOut;\n int globalTime;\n\n EulerTourNumbering(Graph g, int root) {\n this.g = g;\n int n = g.n;\n timeIn = new int[n];\n timeOut = new int[n];\n tour = new int[n];\n\n dfs(root, -1);\n if (globalTime != n) {\n throw new AssertionError();\n }\n }\n\n void dfs(int v, int p) {\n tour[globalTime] = v;\n timeIn[v] = globalTime++;\n for (int e = g.firstEdge[v]; e >= 0; e = g.edgeNxt[e]) {\n int u = g.edgeDst[e];\n if (u == p) {\n continue;\n }\n dfs(u, v);\n }\n timeOut[v] = globalTime;\n }\n\n }\n\n class Graph {\n int n;\n int[] firstEdge;\n int[] edgeDst;\n int[] edgeNxt;\n int[] edgeId;\n int numEdges;\n\n Graph(int n) {\n this.n = n;\n firstEdge = new int[n];\n Arrays.fill(firstEdge, -1);\n final int initialCapacity = 2 * n - 2;\n edgeDst = new int[initialCapacity];\n edgeNxt = new int[initialCapacity];\n edgeId = new int[initialCapacity];\n numEdges = 0;\n }\n\n void addEdge(int a, int b, int origId) {\n int e = numEdges++;\n if (e >= edgeDst.length) {\n reallocate();\n }\n edgeDst[e] = b;\n edgeNxt[e] = firstEdge[a];\n firstEdge[a] = e;\n edgeId[e] = origId;\n }\n\n private void reallocate() {\n int k = edgeDst.length;\n edgeDst = Arrays.copyOf(edgeDst, 3 * k / 2);\n edgeNxt = Arrays.copyOf(edgeNxt, 3 * k / 2);\n edgeId = Arrays.copyOf(edgeId, 3 * k / 2);\n }\n\n }\n\n class MinTree {\n int n;\n int[] a;\n int[] where;\n final int infinity = (int) 1e9;\n\n MinTree(int size) {\n n = 1;\n while (n < size) {\n n *= 2;\n }\n a = new int[2 * n];\n where = new int[2 * n];\n Arrays.fill(a, infinity);\n }\n\n void set(int pos, int val) {\n pos += n;\n a[pos] = val;\n where[pos] = pos - n;\n while (pos > 1) {\n pos /= 2;\n a[pos] = Math.min(a[2 * pos], a[2 * pos + 1]);\n if (a[pos] == a[2 * pos]) {\n where[pos] = where[2 * pos];\n } else {\n where[pos] = where[2 * pos + 1];\n }\n }\n }\n\n int getMinPos(int l, int r) {\n if (l > r) {\n return infinity;\n }\n l += n;\n r += n;\n if (l == r) {\n return where[l];\n }\n int lm = a[l];\n int rm = a[r];\n int lp = where[l];\n int rp = where[r];\n while (r - l > 1) {\n if (l % 2 == 0) {\n if (lm > a[l + 1]) {\n lm = a[l + 1];\n lp = where[l + 1];\n }\n }\n if (r % 2 != 0) {\n if (rm > a[r - 1]) {\n rm = a[r - 1];\n rp = where[r - 1];\n }\n }\n l /= 2;\n r /= 2;\n }\n return lm < rm ? lp : rp;\n }\n\n }\n\n class DSU {\n int[] rank;\n int[] p;\n int numComps;\n\n DSU(int n) {\n rank = new int[n];\n p = new int[n];\n reset();\n }\n\n void reset() {\n for (int i = 0; i < p.length; i++) {\n rank[i] = 0;\n p[i] = i;\n }\n numComps = p.length;\n }\n\n private int findComp(int x) {\n int r;\n int saved;\n\n saved = x;\n while (x != p[x]) {\n x = p[x];\n }\n r = x;\n\n x = saved;\n while (x != r) {\n saved = p[x];\n p[x] = r;\n x = saved;\n }\n return r;\n }\n\n private void merge(int a, int b) {\n a = findComp(a);\n b = findComp(b);\n if (a == b) {\n return;\n }\n --numComps;\n if (rank[a] < rank[b]) {\n p[a] = b;\n } else {\n p[b] = a;\n if (rank[a] == rank[b]) {\n ++rank[a];\n }\n }\n }\n\n }\n\n }\n\n static class FastScanner {\n private BufferedReader in;\n private StringTokenizer st;\n\n public FastScanner(InputStream stream) {\n in = new BufferedReader(new InputStreamReader(stream));\n }\n\n public String next() {\n while (st == null || !st.hasMoreTokens()) {\n try {\n st = new StringTokenizer(in.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return st.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "b8de136ad872ae3809cffde4ad4db1ac", "src_uid": "ad014bde729222db14f38caa521e4167", "apr_id": "e4a1979a6a84e26ccfb366593d7bf161", "difficulty": 2600, "tags": ["dsu", "data structures", "implementation", "graphs", "trees"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9432215313393546, "equal_cnt": 11, "replace_cnt": 3, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 10, "bug_source_code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\nimport java.io.IOException;\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastScanner in = new FastScanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n TaskD solver = new TaskD();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class TaskD {\n public void solve(int testNumber, FastScanner in, PrintWriter out) {\n int n = in.nextInt();\n int m = in.nextInt();\n int numQueries = in.nextInt();\n int[] p = new int[n];\n for (int i = 0; i < n; i++) {\n p[i] = -in.nextInt();\n }\n int[] a = new int[m];\n int[] b = new int[m];\n for (int i = 0; i < m; i++) {\n a[i] = in.nextInt() - 1;\n b[i] = in.nextInt() - 1;\n }\n int[] type = new int[numQueries];\n int[] val = new int[numQueries];\n boolean[] willDie = new boolean[m];\n for (int i = 0; i < numQueries; i++) {\n type[i] = in.nextInt();\n val[i] = in.nextInt() - 1;\n if (type[i] == 2) {\n willDie[val[i]] = true;\n }\n }\n\n int[] parent = new int[n];\n Arrays.fill(parent, -1);\n DSU dsu = new DSU(n);\n Graph g = new Graph(n + 1);\n for (int i = 0; i < m; i++) {\n if (willDie[i]) {\n continue;\n }\n int u = dsu.findComp(a[i]);\n int v = dsu.findComp(b[i]);\n if (u == v) {\n continue;\n }\n dsu.merge(u, v);\n if (dsu.p[v] == u) {\n int t = u;\n u = v;\n v = t;\n }\n parent[u] = v;\n g.addEdge(v, u, i);\n }\n\n for (int i = numQueries - 1; i >= 0; i--) {\n if (type[i] == 1) {\n val[i] = dsu.findComp(val[i]);\n continue;\n }\n int u = dsu.findComp(a[val[i]]);\n int v = dsu.findComp(b[val[i]]);\n if (u == v) {\n continue;\n }\n dsu.merge(u, v);\n if (dsu.p[v] == u) {\n int t = u;\n u = v;\n v = t;\n }\n parent[u] = v;\n g.addEdge(v, u, val[i]);\n }\n\n int root = n;\n for (int i = 0; i < n; i++) {\n if (parent[i] < 0) {\n g.addEdge(root, i, -1);\n }\n }\n EulerTourNumbering et = new EulerTourNumbering(g, root);\n\n MinTree mt = new MinTree(n + 1);\n int[] q = new int[n + 1];\n for (int i = 0; i < n; i++) {\n q[et.timeIn[i]] = p[i];\n mt.set(et.timeIn[i], p[i]);\n }\n\n boolean[] dead = new boolean[m];\n for (int i = 0; i < numQueries; i++) {\n if (type[i] == 2) {\n dead[val[i]] = true;\n continue;\n }\n int pos = et.timeIn[val[i]];\n int l = pos;\n int r = pos;\n for (int e = g.firstEdge[val[i]]; e >= 0; e = g.edgeNxt[e]) {\n int origId = g.edgeId[e];\n int dst = g.edgeDst[e];\n if (dead[origId]) {\n if (l >= 0) {\n int cand = mt.getMinPos(l, r);\n if (q[pos] > q[cand]) {\n pos = cand;\n }\n l = -1;\n }\n continue;\n }\n if (l < 0) {\n l = et.timeIn[dst];\n }\n r = et.timeOut[dst] - 1;\n }\n if (l >= 0) {\n int cand = mt.getMinPos(l, r);\n if (q[pos] > q[cand]) {\n pos = cand;\n }\n l = -1;\n }\n out.println(-q[pos]);\n q[pos] = 0;\n mt.set(pos, 0);\n }\n }\n\n class EulerTourNumbering {\n Graph g;\n int[] tour;\n int[] timeIn;\n int[] timeOut;\n int globalTime;\n\n EulerTourNumbering(Graph g, int root) {\n this.g = g;\n int n = g.n;\n timeIn = new int[n];\n timeOut = new int[n];\n tour = new int[n];\n\n dfs(root, -1);\n if (globalTime != n) {\n throw new AssertionError();\n }\n }\n\n void dfs(int v, int p) {\n tour[globalTime] = v;\n timeIn[v] = globalTime++;\n for (int e = g.firstEdge[v]; e >= 0; e = g.edgeNxt[e]) {\n int u = g.edgeDst[e];\n if (u == p) {\n continue;\n }\n dfs(u, v);\n }\n timeOut[v] = globalTime;\n }\n\n }\n\n class Graph {\n int n;\n int[] firstEdge;\n int[] edgeDst;\n int[] edgeNxt;\n int[] edgeId;\n int numEdges;\n\n Graph(int n) {\n this.n = n;\n firstEdge = new int[n];\n Arrays.fill(firstEdge, -1);\n final int initialCapacity = 2 * n - 2;\n edgeDst = new int[initialCapacity];\n edgeNxt = new int[initialCapacity];\n edgeId = new int[initialCapacity];\n numEdges = 0;\n }\n\n void addEdge(int a, int b, int origId) {\n int e = numEdges++;\n if (e >= edgeDst.length) {\n reallocate();\n }\n edgeDst[e] = b;\n edgeNxt[e] = firstEdge[a];\n firstEdge[a] = e;\n edgeId[e] = origId;\n }\n\n private void reallocate() {\n int k = edgeDst.length;\n edgeDst = Arrays.copyOf(edgeDst, 3 * k / 2);\n edgeNxt = Arrays.copyOf(edgeNxt, 3 * k / 2);\n edgeId = Arrays.copyOf(edgeId, 3 * k / 2);\n }\n\n }\n\n class MinTree {\n int n;\n int[] a;\n int[] where;\n final int infinity = (int) 1e9;\n\n MinTree(int size) {\n n = 1;\n while (n < size) {\n n *= 2;\n }\n a = new int[2 * n];\n where = new int[2 * n];\n Arrays.fill(a, infinity);\n }\n\n void set(int pos, int val) {\n pos += n;\n a[pos] = val;\n where[pos] = pos - n;\n while (pos > 1) {\n pos /= 2;\n a[pos] = Math.min(a[2 * pos], a[2 * pos + 1]);\n if (a[pos] == a[2 * pos]) {\n where[pos] = where[2 * pos];\n } else {\n where[pos] = where[2 * pos + 1];\n }\n }\n }\n\n int getMinPos(int l, int r) {\n if (l > r) {\n return infinity;\n }\n l += n;\n r += n;\n if (l == r) {\n return where[l];\n }\n int lm = a[l];\n int rm = a[r];\n int lp = where[l];\n int rp = where[r];\n while (r - l > 1) {\n if (l % 2 == 0) {\n if (lm > a[l + 1]) {\n lm = a[l + 1];\n lp = where[l + 1];\n }\n }\n if (r % 2 != 0) {\n if (rm > a[r - 1]) {\n rm = a[r - 1];\n rp = where[r - 1];\n }\n }\n l /= 2;\n r /= 2;\n }\n return lm < rm ? lp : rp;\n }\n\n }\n\n class DSU {\n int[] rank;\n int[] p;\n int numComps;\n\n DSU(int n) {\n rank = new int[n];\n p = new int[n];\n reset();\n }\n\n void reset() {\n for (int i = 0; i < p.length; i++) {\n rank[i] = 0;\n p[i] = i;\n }\n numComps = p.length;\n }\n\n private int findComp(int x) {\n int r;\n int saved;\n\n saved = x;\n while (x != p[x]) {\n x = p[x];\n }\n r = x;\n\n x = saved;\n while (x != r) {\n saved = p[x];\n p[x] = r;\n x = saved;\n }\n return r;\n }\n\n private void merge(int a, int b) {\n a = findComp(a);\n b = findComp(b);\n if (a == b) {\n return;\n }\n --numComps;\n if (rank[a] < rank[b]) {\n p[a] = b;\n } else {\n p[b] = a;\n if (rank[a] == rank[b]) {\n ++rank[a];\n }\n }\n }\n\n }\n\n }\n\n static class FastScanner {\n private BufferedReader in;\n private StringTokenizer st;\n\n public FastScanner(InputStream stream) {\n in = new BufferedReader(new InputStreamReader(stream));\n }\n\n public String next() {\n while (st == null || !st.hasMoreTokens()) {\n try {\n st = new StringTokenizer(in.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return st.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "7f2a96b8f03cb487b57137689668e5c0", "src_uid": "ad014bde729222db14f38caa521e4167", "apr_id": "e4a1979a6a84e26ccfb366593d7bf161", "difficulty": 2600, "tags": ["dsu", "data structures", "implementation", "graphs", "trees"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.7524752475247525, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "import java.io.BufferedInputStream;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n final Scanner scanner = new Scanner(new BufferedInputStream(System.in));\n final int N = scanner.nextInt();\n final int arr[] = new int[N];\n for (int i = 0; i < N; i++) {\n arr[i] = scanner.nextInt();\n }\n System.out.println(isPossible(arr, 0, 0) ? \"Yes\" : \"No\");\n }\n static boolean isPossible(final int arr[], final int l, final int cnt) {\n if (l >= arr.length) {\n if ((cnt & 1) == 1) return true;\n return false;\n }\n if ((arr[l] & 1) == 0) return false;\n for (int i = l; i < arr.length; i+=2) {\n if ((arr[i] & 1) == 1 && isPossible(arr, i + 1, cnt + 1)) {\n return true;\n }\n }\n return false;\n }\n}\n", "lang": "Java 8", "bug_code_uid": "d44c3e46ccd2f691dd15dc2f0a78446d", "src_uid": "2b8c2deb5d7e49e8e3ededabfd4427db", "apr_id": "e2e8488a110b816abded1150cdecaaf8", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8650963597430407, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\nimport java.io.IOException;\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author Toni Rajkovski\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastReader in = new FastReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n TaskA solver = new TaskA();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class TaskA {\n int[] nums;\n\n public void solve(int testNumber, FastReader in, PrintWriter out) {\n int n = in.nextInt();\n nums = new int[n];\n\n for (int i = 0; i < n; i++) nums[i] = in.nextInt() % 2;\n out.println(check(0, n - 1, false) ? \"Yes\" : \"No\");\n\n }\n\n private boolean check(int fromPos, int toPos, boolean pair) {\n if (nums[fromPos] == 0 || nums[toPos] == 0) return false;\n if ((toPos - fromPos + 1) % 2 == 1 && !pair) return true;\n for (int i = fromPos; i < toPos; i++) {\n if ((i - fromPos + 1) % 2 == 1 && nums[i] == 1) {\n if (check(i + 1, toPos, !pair)) return true;\n }\n }\n return false;\n }\n\n }\n\n static class FastReader {\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader() {\n br = new BufferedReader(new\n InputStreamReader(System.in));\n }\n\n public FastReader(InputStream is) {\n br = new BufferedReader(new\n InputStreamReader(is));\n }\n\n public String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "77c455afc5263eac661c030a8e7160b6", "src_uid": "2b8c2deb5d7e49e8e3ededabfd4427db", "apr_id": "5d7f51b216e800adde5a1ed9208081fa", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9941434846266471, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.math.*;\nimport java.util.*;\n\npublic class Main{\n\tpublic static void main(String[] args){\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint n, m, a, b, c, d, array[] = new int[1101]; \n\t\t\n\t\tn = scanner.nextInt();\n\t\tm = scanner.nextInt();\n\t\tc = scanner.nextInt();\n\t\td = scanner.nextInt();\n\t\tfor(int i = c; i <= n; i++)\n\t\t array[i] = mas[i-c] + d;\n\t\tfor(int i = 0; i < m; i++){\n\t\t a = scanner.nextInt();\n\t\t b = scanner.nextInt();\n\t\t c = scanner.nextInt();\n\t\t d = scanner.nextInt();\n\t\t for(int j = 0; j < a / b; j++)\n\t\t for(int k = n; k >= c; k--)\n\t\t array[k] = Math.max(array[k], array[k-c] + d);\n\t\t}\n\t\tSystem.out.println(array[n]);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "a875726ca12136ea9fecdda0b8a1f91e", "src_uid": "4e166b8b44427b1227e0f811161d3a6f", "apr_id": "afb73a81a00264282e9af37c2138f0f1", "difficulty": 1700, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9083769633507853, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.math.*;\nimport java.util.*;\nimport java.util.stream.IntStream;\n\npublic class Main{\n\tpublic static void main(String[] args){\n\t\tScanner scanner = new Scanner(System.in);\n\t\tfinal int c0, d0;\n\t\tint n, m, a, b, c, d, array[] = new int[1005];\n\t\tn = scanner.nextInt();\n\t\tm = scanner.nextInt();\n\t\t\n\t\tc0 = scanner.nextInt();\n\t\td0 = scanner.nextInt();\n\t\tIntStream.rangeClosed(c0, n).forEach(i -> array[i] = array[i-c0] + d0);\n\t\tIntStream.range(0, m).forEach(i -> {\n\t\t a = scanner.nextInt();\n\t\t b = scanner.nextInt();\n\t\t c = scanner.nextInt();\n\t\t d = scanner.nextInt();\n\t\t for(int j = 0; j < a / b; j++)\n\t\t for(int k = n; k >= c; k--)\n\t\t array[k] = Math.max(array[k], array[k-c] + d);\n\t\t});\n\t\tSystem.out.println(array[n]);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "ac35236f3f9631170f952dfce0076369", "src_uid": "4e166b8b44427b1227e0f811161d3a6f", "apr_id": "afb73a81a00264282e9af37c2138f0f1", "difficulty": 1700, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7262436699434018, "equal_cnt": 26, "replace_cnt": 14, "delete_cnt": 6, "insert_cnt": 5, "fix_ops_cnt": 25, "bug_source_code": "\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Main {\n\t\n\tstatic int[] dough, stuffing ,constuffing, earn;\n\tstatic int n, m ;\n\tstatic long[][][] dp ;\n\tstatic long solve(int n , int index , int rem)\n\t{\n\t\tif(n==0 || index>m)\n\t\t\treturn 0;\n\t\t\n\t\tif(dp[n][index][rem]!=-1)\n\t\t{\t\n\t\t\treturn dp[n][index][rem];\n\t\t}\n\t\tlong result = 0;\n\t\t\t\n\n\t\t\tif(index==0 && n-dough[0]>=0)\n\t\t\t{\n\t\t\t\tresult = Math.max(result, earn[0]+solve(n-dough[0],index,0));\n\t\t\t}\n\t\t\t\n\t\t\telse if(stuffing[index] - constuffing[index] >=0 && n-dough[index]>=0 )\n\t\t\t{\t\t\n\t\t\t\tint temp1 = stuffing[index];\n\t\t\t\tstuffing[index] -= constuffing[index] ;\n\t\t\t\tresult = earn[index]+solve(n-dough[index],index,stuffing[index]);\n\t\t\t\tstuffing[index]= temp1 ;\n\t\t\t\t\n\t\t\t}\n\t\t\tif(index= tam || w <= 0) return 0;\n\t\tif(dp[w][index] != 0) return dp[w][index];\n\t\tif (w < peso[index]) return solve(w,index + 1);\n\t\tdp[w][index] = Math.max(solve(w - peso[index],index + 1) + precio[index], solve(w,index + 1));\n\t\treturn dp[w][index];\n\t}\n\t\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n\t\tStringTokenizer tk;\n\t\tint n,m,c0,d0,a,b,c,d;\n\t\ttk = new StringTokenizer(bf.readLine());\n\t\tn = Integer.parseInt(tk.nextToken());\n\t\tm = Integer.parseInt(tk.nextToken());\n\t\tc0 = Integer.parseInt(tk.nextToken());\n\t\td0 = Integer.parseInt(tk.nextToken());\n\t\ts = new rell[m+1];\n\t\ts[0] = new rell(n, c0, c0, d0);\n\t\ttam = n/c0;\n\t\tfor (int i = 1; i <= m; i++) {\n\t\t\ttk = new StringTokenizer(bf.readLine());\n\t\t\ta = Integer.parseInt(tk.nextToken());\n\t\t\tb= Integer.parseInt(tk.nextToken());\n\t\t\tc= Integer.parseInt(tk.nextToken());\n\t\t\td= Integer.parseInt(tk.nextToken());\n\t\t\ts[i] = new rell(a, b, c, d);\n\t\t\ttam += (a/b);\n\t\t}\n\t\tpeso = new int [tam]; \n\t\tprecio = new int[tam];\n\t\tdp = new int[n+1][tam];\n\t\tint cont = 0;\n\t\tint max = 0;\n\t\tfor (int i = 0; i < m+1; i++) {\n\t\t\tmax = cont + (s[i].a / s[i].b);\n\t\t\tfor (int j = cont; j < max; j++) {\n\t\t\t\tpeso[j] = s[i].c;\n\t\t\t\tprecio[j] = s[i].d;\n\t\t\t\tcont ++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(solve(n,0));\n\t}\n\tclass rell {\n\tint a,b,c,d;\n\n\tpublic rell(int a, int b, int c, int d) {\n\t\tsuper();\n\t\tthis.a = a;\n\t\tthis.b = b;\n\t\tthis.c = c;\n\t\tthis.d = d;\n\t}\n}\n}", "lang": "Java 8", "bug_code_uid": "36133177cfcf5a566d51caa8cb2d3a5f", "src_uid": "4e166b8b44427b1227e0f811161d3a6f", "apr_id": "73a4ea6e830628d8e1a69e7467f5de19", "difficulty": 1700, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9943883277216611, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\npublic class A\n{\n public static void main(String args[])\n {\n Scanner sc=new Scanner(System.in);\n int n=sc.nextInt();\n String str=sc.next();\n int count=0;\n String ans=\"\";\n String com=\"xxx\";\n for(int i=0;i non_x = new ArrayList();\n \n\t\tint x =0;\n\t\tfor(int i =0 ; i < n+1; i++) {\n\t\t\tif(bar[i] != 'x') {\n\t\t\t\tnon_x.add(i);\n\t\t\t}\n\t\t}\n\t\t\n\t\tint counter = 0;\n \n\t//\tSystem.out.println(non_x);\n\t\t\n\t\tArrayList arr = new ArrayList();\n\t\tfor(int i =0 ; i < non_x.size()-1; i ++) {\n\t\t\tarr.add(non_x.get(i+1)- non_x.get(i));\n\t\t}\n\t\t\n\t\t\n\t\tif(non_x.get(0)> 2) {\n \n\t\t\tcounter += non_x.get(0)-2;\n\t\t}\n\t\tfor(int i =1 ; i < arr.size(); i ++) {\n\t\t\tif(arr.get(i)>2) {\n\t\t\t\tcounter += arr.get(i)-2;\n\t\t\t\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(counter);\n\t\t\n\t\t\n\t\t\n\t}\n\t\n}", "lang": "Java 8", "bug_code_uid": "0bf9a7e212a763f9f5512f74790a325a", "src_uid": "8de14db41d0acee116bd5d8079cb2b02", "apr_id": "fd78da723128c9d1183aab10853544f6", "difficulty": 800, "tags": ["strings", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.896124031007752, "equal_cnt": 32, "replace_cnt": 9, "delete_cnt": 6, "insert_cnt": 16, "fix_ops_cnt": 31, "bug_source_code": "import java.util.*;\nimport java.io.*;\n\nimport static java.lang.Math.*;\n\npublic class Main {\n static ArrayList[] gr, g;\n static TreeMap way;\n static int[] types, dist;\n static boolean[] used;\n static int INF = (int) 1e9;\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner(System.in);\n PrintWriter pw = new PrintWriter(System.out);\n int n = sc.nextInt();\n int m = sc.nextInt();\n gr = new ArrayList[n];\n g = new ArrayList[n];\n for (int i = 0; i < n; i++) {\n gr[i] = new ArrayList<>();\n g[i] = new ArrayList<>();\n }\n for (int i = 0; i < m; i++) {\n int from = sc.nextInt() - 1;\n int to = sc.nextInt() - 1;\n gr[from].add(to);\n g[to].add(from);\n }\n int k = sc.nextInt();\n int[] p = new int[k];\n for (int i = 0; i < k; i++)\n p[i] = sc.nextInt() - 1;\n way = new TreeMap<>();\n for (int i = 0; i < k - 1; i++)\n way.put(p[i], p[i + 1]);\n types = new int[n];\n //0 - none\n //1 - +\n //2 - -\n //3 - +-\n used = new boolean[n];\n dist = new int[n];\n Arrays.fill(dist, INF);\n dist[p[k - 1]] = 0;\n dfs(p[k - 1], -1);\n int cntMin = 0;\n int cntMax = 0;\n for (int i = 0; i < k - 1; i++) {\n if(types[p[i]] == 2) {\n cntMin++;\n cntMax++;\n }\n if(types[p[i]] == 3)\n cntMax++;\n }\n pw.print(cntMin + \" \" + cntMax);\n pw.close();\n }\n\n public static void dfs(int v, int p) {\n used[v] = true;\n for (int to : g[v]) {\n if (dist[to] > dist[v] + 1) {\n dist[to] = dist[v] + 1;\n if (way.containsKey(to) && way.get(to) == v)\n types[to] = 1;\n else\n types[to] = 2;\n } else if (dist[to] == dist[v] + 1) {\n if (way.containsKey(to) && way.get(to) == v)\n types[to]++;\n else {\n if (types[to] < 2)\n types[to] += 2;\n }\n }\n if (!used[to])\n dfs(to, v);\n }\n }\n\n\n public static boolean isVowel(char a) {\n return a == 'a' || a == 'e' || a == 'u' || a == 'o' || a == 'y';\n }\n\n public static long binPow(long a, int n) {\n long p = a;\n long res = 1;\n while (n > 0) {\n if (n % 2 == 1)\n res *= p;\n p *= p;\n n /= 2;\n }\n return res;\n }\n\n public static int gcd(int a, int b) {\n if (a == 0 || b == 0)\n return a + b;\n return gcd(b % a, a);\n }\n\n public static long gcd(long a, long b) {\n if (a == 0 || b == 0)\n return a + b;\n return gcd(b % a, a);\n }\n}\n\nclass chr {\n char a;\n int index;\n\n public chr(char a, int index) {\n this.a = a;\n this.index = index;\n }\n}\n\nclass chrComp implements Comparator {\n public int compare(chr o1, chr o2) {\n return Character.compare(o1.a, o2.a);\n }\n}\n\nclass FastScanner {\n static BufferedReader br;\n static StringTokenizer st = new StringTokenizer(\"\");\n\n public FastScanner(InputStream inputStream) {\n br = new BufferedReader(new InputStreamReader(inputStream));\n }\n\n public FastScanner(String fileName) throws FileNotFoundException {\n br = new BufferedReader(new FileReader(fileName));\n }\n\n public boolean hasNext() {\n try {\n while (!st.hasMoreTokens())\n st = new StringTokenizer(br.readLine());\n return true;\n } catch (Exception e) {\n return false;\n }\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public String next() {\n hasNext();\n return st.nextToken();\n }\n}\n", "lang": "Java 11", "bug_code_uid": "bc748ee82dbab6c3ec51d55cc7d2b4cb", "src_uid": "19a0c05eb2d1559ccfe60e210c6fcd6a", "apr_id": "4a642cfb7f9f467fef449d5597a1df39", "difficulty": null, "tags": ["graphs", "shortest paths"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8971291866028708, "equal_cnt": 28, "replace_cnt": 8, "delete_cnt": 7, "insert_cnt": 12, "fix_ops_cnt": 27, "bug_source_code": "import java.util.*;\nimport java.io.*;\n\nimport static java.lang.Math.*;\n\npublic class Main {\n static ArrayList[] gr, g;\n static TreeMap way;\n static int[] types, dist;\n static boolean[] used;\n static int INF = (int) 1e9;\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner(System.in);\n PrintWriter pw = new PrintWriter(System.out);\n int n = sc.nextInt();\n int m = sc.nextInt();\n gr = new ArrayList[n];\n g = new ArrayList[n];\n for (int i = 0; i < n; i++) {\n gr[i] = new ArrayList<>();\n g[i] = new ArrayList<>();\n }\n for (int i = 0; i < m; i++) {\n int from = sc.nextInt() - 1;\n int to = sc.nextInt() - 1;\n gr[from].add(to);\n g[to].add(from);\n }\n int k = sc.nextInt();\n int[] p = new int[k];\n for (int i = 0; i < k; i++)\n p[i] = sc.nextInt() - 1;\n way = new TreeMap<>();\n for (int i = 0; i < k - 1; i++)\n way.put(p[i], p[i + 1]);\n types = new int[n];\n //0 - none\n //1 - +\n //2 - -\n //3 - +-\n used = new boolean[n];\n dist = new int[n];\n Arrays.fill(dist, INF);\n dist[p[k - 1]] = 0;\n dfs(p[k - 1], -1);\n int cntMin = 0;\n int cntMax = 0;\n for (int i = 0; i < k - 1; i++) {\n if (types[p[i]] == 2) {\n cntMin++;\n cntMax++;\n }\n if (types[p[i]] == 3)\n cntMax++;\n }\n pw.print(cntMin + \" \" + cntMax);\n pw.close();\n }\n\n public static void dfs(int v, int p) {\n used[v] = true;\n for (int to : g[v]) {\n if (dist[to] > dist[v] + 1) {\n dist[to] = dist[v] + 1;\n if (way.containsKey(to) && way.get(to) == v)\n types[to] = 1;\n else\n types[to] = 2;\n dfs(to, v);\n } else if (dist[to] == dist[v] + 1) {\n if (way.containsKey(to) && way.get(to) == v)\n types[to]++;\n else {\n if (types[to] < 2)\n types[to] += 2;\n }\n }\n }\n }\n\n\n public static boolean isVowel(char a) {\n return a == 'a' || a == 'e' || a == 'u' || a == 'o' || a == 'y';\n }\n\n public static long binPow(long a, int n) {\n long p = a;\n long res = 1;\n while (n > 0) {\n if (n % 2 == 1)\n res *= p;\n p *= p;\n n /= 2;\n }\n return res;\n }\n\n public static int gcd(int a, int b) {\n if (a == 0 || b == 0)\n return a + b;\n return gcd(b % a, a);\n }\n\n public static long gcd(long a, long b) {\n if (a == 0 || b == 0)\n return a + b;\n return gcd(b % a, a);\n }\n}\n\nclass chr {\n char a;\n int index;\n\n public chr(char a, int index) {\n this.a = a;\n this.index = index;\n }\n}\n\nclass chrComp implements Comparator {\n public int compare(chr o1, chr o2) {\n return Character.compare(o1.a, o2.a);\n }\n}\n\nclass FastScanner {\n static BufferedReader br;\n static StringTokenizer st = new StringTokenizer(\"\");\n\n public FastScanner(InputStream inputStream) {\n br = new BufferedReader(new InputStreamReader(inputStream));\n }\n\n public FastScanner(String fileName) throws FileNotFoundException {\n br = new BufferedReader(new FileReader(fileName));\n }\n\n public boolean hasNext() {\n try {\n while (!st.hasMoreTokens())\n st = new StringTokenizer(br.readLine());\n return true;\n } catch (Exception e) {\n return false;\n }\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public String next() {\n hasNext();\n return st.nextToken();\n }\n}\n", "lang": "Java 11", "bug_code_uid": "d2afc1675e6b6c7be0b1ffded30e8ec3", "src_uid": "19a0c05eb2d1559ccfe60e210c6fcd6a", "apr_id": "4a642cfb7f9f467fef449d5597a1df39", "difficulty": null, "tags": ["graphs", "shortest paths"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.996594778660613, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "//import java.io.IOException;\nimport java.util.Scanner;\n\n/**\n *\n * @author zezo\n */\npublic class ASoftDrinking {\n//\n /**\n * @param args the command line arguments\n */\n public static void main(String[] args) throws IOException \n {\n \n Scanner cs= new Scanner(System.in);\n int n=cs.nextInt();\n int k=cs.nextInt();\n int l=cs.nextInt();\n int c=cs.nextInt();\n int d=cs.nextInt();\n int p=cs.nextInt();\n int nl=cs.nextInt();\n int np=cs.nextInt();\n int milliliters=(k*l)/(n*nl);\n int grams=p/(n*np);\n int sliceoflime=(c*d)/n;\n // System.out.println(\" \"+\"milliliters= \"+milliliters+\" grams= \"+grams+\" sliceoflime= \"+sliceoflime);\n int result =Math.min(milliliters, grams);\n int RESULT=Math.min(sliceoflime, result);\n System.out.println(RESULT);\n }\n \n}", "lang": "Java 7", "bug_code_uid": "8edfce3cb27d087136890d581beab236", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "apr_id": "3b1eeb2dc53704d385dd568287ee7c3e", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8074534161490683, "equal_cnt": 19, "replace_cnt": 10, "delete_cnt": 0, "insert_cnt": 9, "fix_ops_cnt": 19, "bug_source_code": "\nimport java.io.*;\nimport java.util.*;\n\npublic class Solution\n{\n\npublic static void main (String[] args)\n\t{\n\t \t\n\tScanner s=new Scanner(System.in);\nint n=s.nextInt();\n String st=\"\"+n;\n int i;\n for(i=st.length()-1;i>=0;i--){\n \tif(st.charAt(i)!='0')\n \t\tbreak;\n }\n int j=0;\n boolean ans=true;\n while(jmax)\n max = values[i]; \n }\n\n return max;\n }\n \n public static void main(String [] args) {\n\n Scanner input = new Scanner(System.in);\n\n int r = input.nextInt();\n\n int x = input.nextInt();\n int y = input.nextInt();\n int x1 = input.nextInt();\n int y1 = input.nextInt();\n\n int dx = Math.abs(x-x1);\n int dy = Math.abs(y-y1);\n\n int c = 0;\n\n if(dx == 0 && dy == 0)\n {\n System.out.println(0);\n return;\n }\n\n\n\n \n {\n while(true)\n {\n if(dx == 0 && dy == 0)\n {\n break;\n }\n else if (dx> 0 && dy > 0)\n {\n dx -= r;\n dy -= r;\n c++;\n }\n else if(dx>0)\n {\n dx -= 2*r;\n c++;\n }\n else if(dy>0)\n {\n dy -= r*r;\n c++;\n }\n }\n }\n\n System.out.println(c);\n\n\n \n\n }\n\n\n\n\n\n\n\n\n}\n\n", "lang": "Java 8", "bug_code_uid": "a2ad7346564884e37cc5d216640a5a54", "src_uid": "698da80c7d24252b57cca4e4f0ca7031", "apr_id": "d61774eb2d1c395e545b62e4fefe901b", "difficulty": 1400, "tags": ["geometry", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9988545246277205, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\npublic class Factorial{\n\tpublic static void main (String [] args){\n\t\tint a,b;\n\t\tScanner sc = new Scanner (System.in);\n\t\ta=sc.nextInt();\n\t\tb=sc.nextInt();\n\t\tSystem.out.println(factorial(Math.min(a, b);));\n\t\t\n }\n\tpublic static int factorial(int a){\n\t\tint fact=1;\n\t\tfor(int k=1; k<=a;k++){\n\t\tfact*=k;\n\t}\n\treturn fact;\n\t}\n\tpublic static long gcd(int p, int q){\n\t\tif (q==0){\n\t\t\treturn p;\n\t\t}\n\t\treturn gcd(q,p%q);\n\t}\n\t\n}", "lang": "Java 8", "bug_code_uid": "8654f73a974a2219296c72e4fea9c7de", "src_uid": "7bf30ceb24b66d91382e97767f9feeb6", "apr_id": "171a2480362d959f94743e89dc68db25", "difficulty": 800, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8032924890094472, "equal_cnt": 154, "replace_cnt": 147, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 153, "bug_source_code": "import java.io.IOException;\nimport java.io.OutputStreamWriter;\nimport java.util.Arrays;\nimport java.io.BufferedWriter;\nimport java.util.InputMismatchException;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.NoSuchElementException;\nimport java.io.Writer;\nimport java.math.BigInteger;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n * @author \u00c1rysson Cavalcanti\n */\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tInputReader in = new InputReader(inputStream);\n\t\tOutputWriter out = new OutputWriter(outputStream);\n\t\tTaskE solver = new TaskE();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass TaskE {\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n\t\tint n=in.readInt(), sx=in.readInt()%n, sy=in.readInt()%n, dx=in.readInt()%n, dy=in.readInt()%n;\n\t\tlong t=in.readLong(), Sx=(2L*sx+dx+sy)%n, Sy=(2L*sy+dy+sx)%n, Dx=(dx+sx+sy)%n, Dy=(dy+sy+sx)%n, t0=(t%2==0?t/2:t)%n, t1=(t%2==1?(t-1)/2:t-1)%n;\n\t\tMatrix.mod=n;\n\t\tMatrix base=new Matrix(new long[][] {\n\t\t\t{2, 1, 1, 1},\n\t\t\t{1, 2, 1, 1},\n\t\t\t{1, 0, 1, 0},\n\t\t\t{0, 1, 0, 1}\n\t\t}), matrix=new Matrix(new long[][]{\n\t\t\t{Sx, Sy, Dx, Dy},\n\t\t\t{sx, sy, dx, dy}\n\t\t});\n\t\tlong[][] data=Matrix.multiply(matrix, base.power(t)).data;\n\t\tSx=(data[1][0]+t0*t1%n)%n;\n\t\tSy=(data[1][1]+t0*t1%n)%n;\n\t\tout.printLine(Sx==0?n:Sx, Sy==0?n:Sy);\n }\n}\n\nclass InputReader {\n\n\tprivate InputStream stream;\n\tprivate byte[] buf = new byte[1024];\n\tprivate int curChar;\n\tprivate int numChars;\n\tprivate SpaceCharFilter filter;\n\n\tpublic InputReader(InputStream stream) {\n\t\tthis.stream = stream;\n\t}\n\n\tpublic int read() {\n\t\tif (numChars == -1)\n\t\t\tthrow new InputMismatchException();\n\t\tif (curChar >= numChars) {\n\t\t\tcurChar = 0;\n\t\t\ttry {\n\t\t\t\tnumChars = stream.read(buf);\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t\tif (numChars <= 0)\n\t\t\t\treturn -1;\n\t\t}\n\t\treturn buf[curChar++];\n\t}\n\n\tpublic int readInt() {\n\t\tint c = read();\n\t\twhile (isSpaceChar(c))\n\t\t\tc = read();\n\t\tint sgn = 1;\n\t\tif (c == '-') {\n\t\t\tsgn = -1;\n\t\t\tc = read();\n\t\t}\n\t\tint res = 0;\n\t\tdo {\n\t\t\tif (c < '0' || c > '9')\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tres *= 10;\n\t\t\tres += c - '0';\n\t\t\tc = read();\n\t\t} while (!isSpaceChar(c));\n\t\treturn res * sgn;\n\t}\n\n\tpublic long readLong() {\n\t\tint c = read();\n\t\twhile (isSpaceChar(c))\n\t\t\tc = read();\n\t\tint sgn = 1;\n\t\tif (c == '-') {\n\t\t\tsgn = -1;\n\t\t\tc = read();\n\t\t}\n\t\tlong res = 0;\n\t\tdo {\n\t\t\tif (c < '0' || c > '9')\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tres *= 10;\n\t\t\tres += c - '0';\n\t\t\tc = read();\n\t\t} while (!isSpaceChar(c));\n\t\treturn res * sgn;\n\t}\n\n\tpublic boolean isSpaceChar(int c) {\n\t\tif (filter != null)\n\t\t\treturn filter.isSpaceChar(c);\n\t\treturn isWhitespace(c);\n\t}\n\n\tpublic static boolean isWhitespace(int c) {\n\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t}\n\n\tpublic interface SpaceCharFilter {\n\t\tpublic boolean isSpaceChar(int ch);\n\t}\n}\n\nclass OutputWriter {\n\tprivate final PrintWriter writer;\n\n\tpublic OutputWriter(OutputStream outputStream) {\n\t\twriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n\t}\n\n\tpublic void print(Object...objects) {\n\t\tfor (int i = 0; i < objects.length; i++) {\n\t\t\tif (i != 0)\n\t\t\t\twriter.print(' ');\n\t\t\twriter.print(objects[i]);\n\t\t}\n\t}\n\n\tpublic void printLine(Object...objects) {\n\t\tprint(objects);\n\t\twriter.println();\n\t}\n\n\tpublic void close() {\n\t\twriter.close();\n\t}\n\n}\n\nclass Matrix {\n\tpublic static long mod = Long.MAX_VALUE;\n\tpublic final long[][] data;\n\tpublic final int rowCount;\n\tpublic final int columnCount;\n\n\tpublic Matrix(int rowCount, int columnCount) {\n\t\tthis.rowCount = rowCount;\n\t\tthis.columnCount = columnCount;\n\t\tthis.data = new long[rowCount][columnCount];\n\t}\n\n\tpublic Matrix(long[][] data) {\n\t\tthis.rowCount = data.length;\n\t\tthis.columnCount = data[0].length;\n\t\tthis.data = data;\n\t}\n\n\tpublic static Matrix multiply(Matrix first, Matrix second) {\n\t\tMatrix result = new Matrix(first.rowCount, second.columnCount);\n\t\tfor (int i = 0; i < first.rowCount; i++) {\n\t\t\tfor (int j = 0; j < second.rowCount; j++) {\n\t\t\t\tfor (int k = 0; k < second.columnCount; k++)\n\t\t\t\t\tresult.data[i][k] = (result.data[i][k] + first.data[i][j] * second.data[j][k]) % mod;\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic static Matrix identityMatrix(int size) {\n\t\tMatrix result = new Matrix(size, size);\n\t\tfor (int i = 0; i < size; i++)\n\t\t\tresult.data[i][i] = 1;\n\t\treturn result;\n\t}\n\n\tpublic Matrix power(long exponent) {\n\t\tif (exponent == 0)\n\t\t\treturn identityMatrix(rowCount);\n\t\tif (exponent == 1)\n\t\t\treturn this;\n\t\tMatrix result = power(exponent >> 1);\n\t\tresult = multiply(result, result);\n\t\tif ((exponent & 1) == 1)\n\t\t\tresult = multiply(result, this);\n\t\treturn result;\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "99519f8eb0eba10262aee39286ff09b6", "src_uid": "ee9fa8be2ae05a4e831a4f608c0cc785", "apr_id": "2a04333ded3777885ff41dadd2e6f206", "difficulty": 2300, "tags": ["matrices", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9880881477069684, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 4, "bug_source_code": "\nimport java.util.Scanner;\n\npublic class E {\n static int mod;\n\n public static long[][] identity() {\n long[][] a = new long[6][6];\n for (int i = 0; i < 6; i++)\n a[i][i] = 1;\n return a;\n }\n\n public static long[][] modMul(long[][] A, long[][] B) {\n long[][] C = new long[6][6];\n for (int i = 0; i < 6; i++)\n for (int j = 0; j < 6; j++)\n for (int k = 0; k < 6; k++)\n C[i][j] = (C[i][j] + (A[i][k] * B[k][j]) % mod) % mod;\n return C;\n }\n\n public static long[][] modPow(long[][] M, long p) {\n if (p == 0)\n return identity();\n long[][] temp = modPow(M, p >> 1);\n temp = modMul(temp, temp);\n if ((p & 1) != 0)\n temp = modMul(M, temp);\n return temp;\n }\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n mod = in.nextInt();\n long x = in.nextLong() - 1;\n long y = in.nextLong() - 1;\n long dx = in.nextLong();\n long dy = in.nextLong();\n long t = in.nextLong();\n long[][] a = { { 2, 1, 1, 0, 1, 2 }, { 1, 2, 0, 1, 1, 2 },\n { 1, 1, 1, 0, 1, 2 }, { 1, 1, 0, 1, 1, 2 },\n { 0, 0, 0, 0, 1, 1 }, { 0, 0, 0, 0, 0, 1 } };\n long[][] ans = modPow(a, t);\n long[] v = { x, y, dx, dy, 0, 1 };\n long ansX = 0;\n long ansY = 0;\n for (int i = 0; i < 6; i++) {\n ansX = (ansX + (ans[0][i] * v[i]) % mod) % mod;\n ansY = (ansY + (ans[1][i] * v[i]) % mod) % mod;\n }\n System.out.println((ansX + 1) + \" \" + (ansY + 1));\n }\n}\n", "lang": "Java 6", "bug_code_uid": "1b5408d51677e04ee89f89b531fc22d1", "src_uid": "ee9fa8be2ae05a4e831a4f608c0cc785", "apr_id": "41ea8615fb7d5366f21737e6750a67ce", "difficulty": 2300, "tags": ["matrices", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9397260273972603, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*;\npublic class Prog1064A{\n public static void main(String[] args){\n Scanner sc=new Scanner(System.in);\n byte[] tri=new byte[3];\n for (byte i=0;i<3;i++){\n tri[i]=sc.nextByte();\n }\n short cout=0;\n short sum=0;\n for(byte i=0;i<3;i++){\n sum=0;\n for(byte j=0;j<3;j++){\n if (i==j){\n continue;\n }\n sum=sum+tri[j];\n }\n if (sum<=tri[i]){\n cout=cout+((tri[i]-sum)+1);\n tri[i]=(tri[i]-sum)+1;\n }\n }\n System.out.println(cout);\n }\n}", "lang": "Java 8", "bug_code_uid": "27773bcb6c821525682ee2b02825e300", "src_uid": "3dc56bc08606a39dd9ca40a43c452f09", "apr_id": "646c7b1656e11aa1d042cfaef36f22c4", "difficulty": 800, "tags": ["geometry", "math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9974871048803068, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "//package round167;\nimport java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.InputMismatchException;\n\npublic class E {\n\tInputStream is;\n\tPrintWriter out;\n\tString INPUT = \"\";\n\t\n\tint[][] BURIED = {\n\t\t\t{0, 2},\n\t\t\t{1, 1},\n\t\t\t{2, 1},\n\t\t\t{1, 2},\n\t\t\t{2, 2},\n\t\t\t{0, 4},\n\t\t\t{1, 2},\n\t\t\t{2, 4},\n\t\t\t{0, 8},\n\t\t\t{1, 12},\n\t\t\t{2, 1},\n\t\t\t{0, 17},\n\t\t\t{2, 1},\n\t\t\t{1, 23},\n\t\t\t{2, 4},\n\t\t\t{0, 35},\n\t\t\t{2, 1},\n\t\t\t{1, 53},\n\t\t\t{2, 5},\n\t\t\t{0, 76},\n\t\t\t{2, 5},\n\t\t\t{1, 103},\n\t\t\t{2, 19},\n\t\t\t{0, 155},\n\t\t\t{2, 7},\n\t\t\t{1, 236},\n\t\t\t{2, 25},\n\t\t\t{0, 341},\n\t\t\t{2, 23},\n\t\t\t{1, 463},\n\t\t\t{2, 86},\n\t\t\t{0, 697},\n\t\t\t{2, 32},\n\t\t\t{1, 1060},\n\t\t\t{2, 115},\n\t\t\t{0, 1532},\n\t\t\t{2, 106},\n\t\t\t{1, 2081},\n\t\t\t{2, 389},\n\t\t\t{0, 3136},\n\t\t\t{2, 145},\n\t\t\t{1, 4769},\n\t\t\t{2, 518},\n\t\t\t{0, 6892},\n\t\t\t{2, 479},\n\t\t\t{1, 9364},\n\t\t\t{2, 1751},\n\t\t\t{0, 14110},\n\t\t\t{2, 655},\n\t\t\t{1, 21458},\n\t\t\t{2, 2333},\n\t\t\t{0, 31012},\n\t\t\t{2, 2158},\n\t\t\t{1, 42137},\n\t\t\t{2, 7880},\n\t\t\t{0, 63493},\n\t\t\t{2, 2950},\n\t\t\t{1, 96560},\n\t\t\t{2, 10499},\n\t\t\t{0, 139552},\n\t\t\t{2, 9713},\n\t\t\t{1, 189616},\n\t\t\t{2, 35461},\n\t\t\t{0, 285716},\n\t\t\t{2, 13277},\n\t\t\t{1, 434518},\n\t\t\t{2, 47248},\n\t\t\t{0, 627983},\n\t\t\t{2, 43709},\n\t\t\t{1, 853270},\n\t\t\t{2, 159577},\n\t\t\t{0, 1285721},\n\t\t\t{2, 59747},\n\t\t\t{1, 1955329},\n\t\t\t{2, 212618},\n\t\t\t{0, 2825923},\n\t\t\t{2, 196691},\n\t\t\t{1, 3839713},\n\t\t\t{2, 718099},\n\t\t\t{0, 5785742},\n\t\t\t{2, 268864},\n\t\t\t{1, 8798978},\n\t\t\t{2, 956783},\n\t\t\t{0, 12716653},\n\t\t\t{2, 885110},\n\t\t\t{1, 17278708},\n\t\t\t{2, 3231446},\n\t\t\t{0, 26035837},\n\t\t\t{2, 1209890},\n\t\t\t{1, 39595399},\n\t\t\t{2, 4305526},\n\t\t\t{0, 57224936},\n\t\t\t{2, 3982997},\n\t\t\t{1, 77754184},\n\t\t\t{2, 14541509},\n\t\t\t{0, 117161266},\n\t\t\t{2, 5444506},\n\t\t\t{1, 178179293},\n\t\t\t{2, 19374869},\n\t\t\t{0, 257512210},\n\t\t\t{2, 17923489}\n\t};\n\t\n\tvoid solve()\n\t{\n\t\tint n = ni();\n\t\tlong p = ni();\n\t\tint mod = 1000000007;\n\t\tlong[] ct = new long[3];\n\t\tlong pp = p;\n\t\tfor(int[] b : BURIED){\n\t\t\tct[b[0]] += pp*(pp-1)/2;\n\t\t\tpp -= b[1];\n\t\t\tif(pp <= 0)break;\n\t\t\tct[b[0]] -= pp*(pp-1)/2;\n\t\t}\n\t\tfor(int i = 0;i < 3;i++){\n\t\t\tct[i] %= mod;\n\t\t}\n\t\t\n\t\tlong[][] dp = new long[n+1][4];\n\t\tdp[0][0] = 1;\n\t\tfor(int i = 0;i < n;i++){\n\t\t\tfor(int j = 0;j < 4;j++){\n\t\t\t\tfor(int k = 0;k < 3;k++){\n\t\t\t\t\tdp[i+1][j^k] += dp[i][j]*ct[k]%mod;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(int j = 0;j < 4;j++){\n\t\t\t\tdp[i+1][j] %= mod;\n\t\t\t}\n\t\t}\n\t\tout.println((dp[n][1]+dp[n][2]+dp[n][3])%mod);\n\t}\n\t\n\tpublic static long invl(long a, long mod)\n\t{\n\t\tlong b = mod;\n\t\tlong p = 1, q = 0;\n\t\twhile(b > 0){\n\t\t\tlong c = a / b;\n\t\t\tlong d;\n\t\t\td = a; a = b; b = d % b;\n\t\t\td = p; p = q; q = d - c * q;\n\t\t}\n\t\treturn p < 0 ? p + mod : p;\n\t}\n\t\n\tvoid run() throws Exception\n\t{\n\t\tis = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n\t\tout = new PrintWriter(System.out);\n\t\t\n\t\tlong s = System.currentTimeMillis();\n\t\tsolve();\n\t\tout.flush();\n\t\ttr(System.currentTimeMillis()-s+\"ms\");\n\t}\n\t\n\tpublic static void main(String[] args) throws Exception { new E().run(); }\n\t\n\tprivate byte[] inbuf = new byte[1024];\n\tprivate int lenbuf = 0, ptrbuf = 0;\n\t\n\tprivate int readByte()\n\t{\n\t\tif(lenbuf == -1)throw new InputMismatchException();\n\t\tif(ptrbuf >= lenbuf){\n\t\t\tptrbuf = 0;\n\t\t\ttry { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }\n\t\t\tif(lenbuf <= 0)return -1;\n\t\t}\n\t\treturn inbuf[ptrbuf++];\n\t}\n\t\n\tprivate int ni()\n\t{\n\t\tint num = 0, b;\n\t\tboolean minus = false;\n\t\twhile((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));\n\t\tif(b == '-'){\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\t\n\t\twhile(true){\n\t\t\tif(b >= '0' && b <= '9'){\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t}else{\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\t\n\tprivate boolean oj = System.getProperty(\"ONLINE_JUDGE\") != null;\n\tprivate void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }\n}\n", "lang": "Java 6", "bug_code_uid": "c08d8125276a37d21b6b9dd5eddf494e", "src_uid": "c03b6379e9d186874ac3d97c6968fbd0", "apr_id": "2eeec9d9e774444f9778ce19e238cf89", "difficulty": 2600, "tags": ["dp", "games"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.4426691729323308, "equal_cnt": 18, "replace_cnt": 14, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 18, "bug_source_code": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Problem {\n\n\tpublic static void main(String[] args) {\n\t\tScanner keyBoard = new Scanner(System.in);\n\t\t\n\t\tint n = keyBoard.nextInt();\n\t\tdouble a = keyBoard.nextDouble();\n\t\tint[] a_array = new int[n];\n\t\tString a_string = \"\";\n\t\t\n\t\tfor(int i = 0; i1)\n\t\t\t\t{\n\t\t\t\t\tif(temp%2==0)\n\t\t\t\t\t{\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\ttemp/=2;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\tcount=0;\n\t\t\t\t}\n\t\t\t\tfor(int j = 0; j\n */\npublic class Cookies {\n\tprivate static final int P = (int)(1e6 + 3);\n\tpublic static void main(String[] args) throws IOException {\n\t\tif(!Boolean.parseBoolean(System.getProperty(\"ONLINE_JUDGE\")))\n\t\t\tSystem.setIn(new FileInputStream(new File(\"input.txt\")));\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tSystem.out.println(pow(3, n - 1, P));\n\t}\n\tprivate static int pow(long a, long n, int p) {\n\t\tlong r = 1;\n\t\twhile(n != 0) {\n\t\t\tif((n & 1) != 0)\n\t\t\t\tr = r * a % p;\n\t\t\ta = a * a % p;\n\t\t\tn >>= 1;\n\t\t}\n\t\treturn (int)r;\n\t}\n}\n", "lang": "Java 6", "bug_code_uid": "f86a1bdde0c301d5170aa976bb3e7a2a", "src_uid": "1a335a9638523ca0315282a67e18eec7", "apr_id": "d8cad199e0a2e1916985088224e73d67", "difficulty": 1300, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9980908743795341, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "\nimport java.io.*;\nimport java.util.*;\nimport java.math.*;\n\nimport static java.lang.Math.*;\n\npublic class A {\n\t\n\tpublic static void main(String[] args) {\n\t\tnew Main().run();\n\t}\n\t\n\tfinal int mod = (int)1e6 + 3;\n\t\n\tlong func(int n) {\n\t\tif(n <= 1) return 1;\n\t\treturn 3 * func(n-1) % mod;\n\t}\n\t\n\tprivate void solve() throws Exception {\n\t\tint n = nextInt();\n\t\tout.printf(\"%d\\n\", func(n));\n\t}\n\t\n\tprivate BufferedReader in;\n\tprivate PrintWriter out;\n\tprivate StringTokenizer tokenizer;\n\t\n\tpublic void run() {\n\t\ttry {\n\t\t\tin = new BufferedReader(new InputStreamReader(System.in));\n\t\t\ttokenizer = null;\n\t\t\tout = new PrintWriter(System.out);\n\t\t\tsolve();\n\t\t\tin.close();\n\t\t\tout.close();\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t\tSystem.exit(1);\n\t\t}\n\t}\n\n\tprivate int nextInt() throws IOException {\n\t\treturn Integer.parseInt(nextToken());\n\t}\n\n\tprivate long nextLong() throws IOException {\n\t\treturn Long.parseLong(nextToken());\n\t}\n\n\tprivate double nextDouble() throws IOException {\n\t\treturn Double.parseDouble(nextToken());\n\t}\n\n\tprivate String nextLine() throws IOException {\n\t\treturn new String(in.readLine());\n\t}\n\n\tprivate String nextToken() throws IOException {\n\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\ttokenizer = new StringTokenizer(in.readLine());\n\t\t}\n\t\treturn tokenizer.nextToken();\n\t}\n}\n", "lang": "Java 6", "bug_code_uid": "6e1092153c6dd621634c28eaf427a089", "src_uid": "1a335a9638523ca0315282a67e18eec7", "apr_id": "833b48a5d8d601927360c1973831179c", "difficulty": 1300, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8260904619850036, "equal_cnt": 13, "replace_cnt": 8, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": " import java.io.*;\nimport java.math.BigInteger;\n import java.text.*;\n import java.util.*;\nimport java.util.regex.*;\n\n public class Main{\n static class Run implements Runnable{\n //TODO parameters\n final boolean consoleIO = true;\n final String inFile = \"input.txt\";\n final String outFile = \"output.txt\";\n \n boolean[][] f;\n int n;\n \n boolean ok(int x, int y, int sz) { \n for(int j = 0; j < sz; ++j) {\n int tx = x + j;\n int ty = y + j;\n \n if(tx >= n || ty >= n || f[ty][n-tx-1])\n return false;\n }\n \n return true;\n }\n \n void cook(int x, int y, int sz) {\n if(ok(x, y, sz)) {\n int c = 0;\n \n for(int i = y; i < y+sz; ++i, ++c)\n for(int j = x; j < x+sz-c; ++j)\n f[i][n-j-1] = true;\n }\n }\n \n @Override\n public void run() {\n n = (int)Math.pow(2,nextInt());\n f = new boolean[n][n];\n \n int sz = n;\n while(sz != 1) {\n for(int i = 0; i < n; ++i)\n for(int j = 0; j < n; ++j)\n cook(i, j, sz);\n \n sz /=2;\n }\n \n// for(boolean[] b1:f) {\n// for(boolean b:b1)\n// print((b?1:0)+\" \");\n// print(\"\\n\");\n// }\n \n int c = 0;\n for(boolean[] b1:f) \n for(boolean b:b1)\n if(!b)\n ++c;\n print(c);\n close();\n }\n //=========================================================================================================================\n BufferedReader in;\n PrintWriter out;\n StringTokenizer strTok;\n \n Run() {\n if (consoleIO) {\n initConsoleIO();\n }\n else {\n initFileIO();\n }\n }\n \n void initConsoleIO() {\n in = new BufferedReader(new InputStreamReader(System.in));\n out = new PrintWriter(new OutputStreamWriter(System.out));\n }\n \n void initFileIO() {\n try {\n in = new BufferedReader(new FileReader(inFile));\n out = new PrintWriter(new FileWriter(outFile));\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n \n void close() {\n try {\n in.close();\n out.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n \n int nextInt() {\n return Integer.parseInt(nextToken());\n }\n \n double nextDouble() {\n return Double.parseDouble(nextToken());\n }\n \n float nextFloat() {\n return Float.parseFloat(nextToken());\n }\n \n long nextLong() {\n return Long.parseLong(nextToken());\n }\n \n String nextLine() {\n try {\n return in.readLine();\n } catch (IOException e) {\n return \"__NULL\";\n }\n }\n \n boolean hasMoreTokens() {\n return (strTok == null) || (strTok.hasMoreTokens());\n }\n \n String nextToken() {\n while (strTok == null || !strTok.hasMoreTokens()) {\n String line;\n try {\n line = in.readLine();\n strTok = new StringTokenizer(line);\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n \n return strTok.nextToken();\n }\n \n void cout(Object o){\n System.out.println(o);\n }\n \n void print(Object o) {\n out.write(o.toString());\n }\n \n void println(Object o) {\n out.write(o.toString() + '\\n');\n }\n \n void printf(String format, Object... args) {\n out.printf(format, args);\n }\n \n String sprintf(String format, Object... args) {\n return MessageFormat.format(format, args);\n }\n }\n \n static class Pair {\n A a;\n B b;\n \n A f() {\n return a;\n }\n \n B s() {\n return b;\n }\n \n Pair(A a, B b) {\n this.a = a;\n this.b = b;\n }\n \n Pair(Pair p) {\n a = p.f();\n b = p.s();\n }\n }\n \n public static void main(String[] args) throws IOException {\n Run run = new Run();\n Thread thread = new Thread(run);\n thread.run();\n }\n }", "lang": "Java 6", "bug_code_uid": "f45aea05323bd6db95cdc0317507cfd9", "src_uid": "1a335a9638523ca0315282a67e18eec7", "apr_id": "0dbc1e2ca66ac77ca87d137a926633f7", "difficulty": 1300, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.48739495798319327, "equal_cnt": 13, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 13, "bug_source_code": "\u007fimport java.util.Scanner;\n\npublic class A_The_New_Year_Meeting_Friends \n {\n public static void main(String[] args)\n {\n Scanner cin = new Scanner(System.in);\n int a, b, c ; \n a = cin.nextInt();\n b = cin.nextInt();\n c = cin.nextInt();\n int mid = (a+b+c)/3; \n /*if (a > b )\n {\n a = a+b; \n b = a - b ;\n a = a - b ; \n }\n if (a > c )\n {\n a = a+c; \n c = a - c ;\n a = a - c ; \n }\n if (b > c )\n {\n b = b+c; \n c = b - c ;\n b = b - c ; \n }*/\n mid = Math.abs(a-mid) + Math.abs(b-mid) + Math.abs(c-mid) ; \n System.out.print(mid);\n } \n }\n", "lang": "Java 8", "bug_code_uid": "776e46a1ff073f386995c722e37c0101", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "apr_id": "13044e4e9d8e3207bf217c7f5bd205ea", "difficulty": 800, "tags": ["math", "sortings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9668270448214737, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "\n/**\n * Ashesh Vidyut (Drift King) *\n */\npublic class B {\n public static void main(String[] args) {\n try {\n BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n String ak[] = (in.readLine()).split(\" \");\n int num[] = new int[ak[0].length()];\n int k = Integer.parseInt(ak[1]);\n for (int i = 0; i < num.length; i++) {\n num[i] = Integer.parseInt(Character.toString(ak[0].charAt(i)));\n }\n for (int i = 0; i < num.length; i++) {\n if(num[i] == 9){\n continue;\n }\n int maxv = num[i];\n int maxind = i;\n if(k <=0 ){\n break;\n }\n if(i+1 < num.length){\n for (int j = i+1; j < Math.min(num.length, i+k+1); j++) {\n if(maxv < num[j]){\n maxv = num[j];\n maxind = j;\n }\n }\n if(maxv == num[i]){\n continue;\n }\n int noswap = maxind - i;\n if(k >= noswap){\n k -= noswap;\n int tmp = num[i];\n num[i] = maxv;\n for (int j = i+1; j <= maxind; j++) {\n int tmp2 = tmp;\n tmp = num[j];\n num[j] = tmp2;\n }\n }\n }\n }\n StringBuilder res = new StringBuilder(\"\");\n for (int i = 0; i < num.length; i++) {\n res.append(num[i]);\n }\n System.out.println(res);\n }\n catch (Exception e) {\n e.printStackTrace();\n }\n }\n}\n", "lang": "Java 7", "bug_code_uid": "ca33503bf4950b6470a930cfa3d47075", "src_uid": "e56f6c343167745821f0b18dcf0d0cde", "apr_id": "f4926f234a8c35e1de8e4dfdb97adeeb", "difficulty": 1400, "tags": ["greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9829005699810006, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "public class cyclic\n{\n public static void main(String args[])\n {\n Scanner s= new Scanner(System.in);\n String x= s.nextLine();\n int n=x.length();\n String st[]= new String[n];\n char ch[]= new char[n];\n st[0]=x;\n int m=0, sum=0;\n for(int i=1; i set = new HashSet<>();\n for (int i = 0; i < str.length(); i++) {\n set.add(str.substring(i) + str.substring(0,i));\n }\n System.out.println(set.size());\n }\n}", "lang": "Java 8", "bug_code_uid": "4c3e488f8f6cbb0735e99cb0b201d6e0", "src_uid": "8909ac99ed4ab2ee4d681ec864c7831e", "apr_id": "450d5f446c6525d2c7c96179f185dc0b", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9658048373644704, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 5, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "import java.util.Scanner;\npublic class codeforce {\n\n\tpublic static void main(String[] args) {\n\t\tScanner in1 = new Scanner(System.in);\n\t\tint a = in1.nextInt();\n\t\t\n\t\tScanner in2 = new Scanner(System.in);\n\t\tint b = in2.nextInt();\n\t\t\n\t\tScanner in3 = new Scanner(System.in);\n\t\tint c = in3.nextInt();\n\t\t\n\t\tint be = a*2;\n\t\tint ce = a*4;\n\t\tint o = b/be;\n\t\tint p = c/ce;\n\t\tif (o==0 || p==0) {\n\t\tfor ( p=c/ce , o=b/be ; p==0 || o==0; )\t{\n\t \ta=a-1; if (a>0) {\n\t be=a*2; ce=a*4; o=b/be; p=c/ce; }\n\t \tif (a==0) {p=1; o=1; be=0; ce=0;}\n\t\t }\n\t\t}\n\t\tSystem.out.println(a+be+ce);\n\t}\n}\n\u2192Judgement Protocol", "lang": "Java 8", "bug_code_uid": "206ee20763f6cd518c53ad27998c21c2", "src_uid": "82a4a60eac90765fb62f2a77d2305c01", "apr_id": "589857133ce20b8f1d4b605786770d29", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.981549815498155, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.io.*;\n\npublic class Compote {\n \n public static void main(String[] args){\n try{\n \n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int lemon = Integer.parseInt(br.readLine());\n int apple = (Integer.parseInt(br.readLine()))/2;\n int pears = (Integer.parseInt(br.readLine()))/4;\n \n System.out.println(Math.min(a, Math.min(b, c)*7));\n \n }catch(IOException ioe){\n ioe.printStackTrace();\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "c0c4eae9ee5372e851517f56c1a1c208", "src_uid": "82a4a60eac90765fb62f2a77d2305c01", "apr_id": "999cb2c8b6fcb8145e29d0ab42245b1e", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9521384928716904, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n\n int n = scan.nextInt();\n boolean[] arr = new boolean[n];\n boolean[] ansArr = new boolean[n];\n\n for (int index = 0; index < n; index++)\n arr[index] = scan.nextInt() == 1 ? true : false;\n\n int max = 0;\n for (int index = 0; index < n; index++)\n if(arr[index]) max++; // \ud604\uc7ac 1\uc758 \uac1c\uc218\n\n int i = 0, j = 0, tempMax = 0;\n\n while (j < n) {\n i = 0;\n while (i <= j) {\n ansArr = arr.clone(); // ansArr \ucd08\uae30\ud654\n tempMax = 0;\n\n for (int k = i; k <= j; k++)\n ansArr[k] = !ansArr[k]; // flip\n\n for(int index = 0; index < n; index++)\n if(ansArr[index]) tempMax++;\n\n if(tempMax > max) max = tempMax;\n\n i++;\n }\n j++;\n }\n\n\n System.out.println(max);\n }\n}\n", "lang": "Java 11", "bug_code_uid": "fbf09b3f17f535188eee9b11f85d5288", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "apr_id": "360077b7959440a35cb233c44bb6a24b", "difficulty": 1200, "tags": ["dp", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.998914223669924, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "* package whatever; // don't place package name! */\n\nimport java.util.*;\nimport java.lang.*;\nimport java.io.*;\n\n/* Name of the class has to be \"Main\" only if the class is public. */\npublic class hexa\n{\npublic static void main(String[] args) throws java.lang.Exception {\nScanner f = new Scanner(System.in);\n\t\t\tint a = f.nextInt();\n\t\tint b = f.nextInt();\n\t\tint c = f.nextInt();\n\t\tint n = (b + a - 1) * (c + a - 1) - a * (a - 1); \n\t\t\n\t\tSystem.out.println(n);\n}\n}", "lang": "Java 8", "bug_code_uid": "cc876043e111dc581c188410bbeea0c6", "src_uid": "8ab25ed4955d978fe20f6872cb94b0da", "apr_id": "6f5abf358ca64b0ed5762b25399b3265", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9959564541213064, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class A {\n public static void solution(BufferedReader reader, PrintWriter out)\n throws IOException {\n In in = new In(reader);\n int a = in.nextInt(), b = in.nextInt(), c = in.nextInt();\n int cnt = 0;\n int n = a - 1;\n for (int i = 0; i < Math.min(b, c); i++) {\n n++;\n cnt += n * 2;\n }\n cnt += n * Math.max(0, Math.abs(b - c) - 1);\n out.println(cnt);\n }\n\n public static void main(String[] args) throws Exception {\n BufferedReader reader = new BufferedReader(new InputStreamReader(\n System.in));\n PrintWriter out = new PrintWriter(new BufferedWriter(\n new OutputStreamWriter(System.out)));\n solution(reader, out);\n out.close();\n }\n\n protected static class In {\n private BufferedReader reader;\n private StringTokenizer tokenizer = new StringTokenizer(\"\");\n\n public In(BufferedReader reader) {\n this.reader = reader;\n }\n\n public String next() throws IOException {\n while (!tokenizer.hasMoreTokens())\n tokenizer = new StringTokenizer(reader.readLine());\n return tokenizer.nextToken();\n }\n\n public int nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n\n public double nextDouble() throws IOException {\n return Double.parseDouble(next());\n }\n\n public long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "7d9717d8f1f3d50eacbe99828fa23922", "src_uid": "8ab25ed4955d978fe20f6872cb94b0da", "apr_id": "16483edd9f45e1d1df08f5b9b7864b74", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9855263157894737, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "\npublic class Main {\n \n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in); \n int a = sc.nextInt();\n a*=2; \n String [] inp = new String [4];\n int [] arr = new int [10];\n for(int i = 0 ; i < 4 ; i++){\n inp[i] = sc.next();\n for(int j = 0 ; j < 4 ; j++) \n if(inp[i].charAt(j) >=48 && inp[i].charAt(j) <= 57)\n arr[(int)inp[i].charAt(j)-48]++ ;\n }\n boolean f ;\n f = true;\n for(int i = 0 ; i < 10 ; i++)\n if(arr[i] > a)\n f = false ;\n \n if(f)\n System.out.println(\"YES\");\n else \n System.out.println(\"NO\");\n \n \n }\n}\n\n", "lang": "Java 7", "bug_code_uid": "f41e4edb0b02701653b5eed34ecb6582", "src_uid": "5fdaf8ee7763cb5815f49c0c38398f16", "apr_id": "c0a850d579f384557408fb7ad67d2de3", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.1941941941941942, "equal_cnt": 27, "replace_cnt": 18, "delete_cnt": 1, "insert_cnt": 8, "fix_ops_cnt": 27, "bug_source_code": "import java.util.Scanner;\n\n\npublic class c {\n static int Am,Dm,Hm;\n static int h,a,d;\nstatic int [][][]dp;\nstatic int pr=0;\n public static void main(String[] args) {\nScanner sc =new Scanner (System.in);\n int Hy=sc.nextInt();\n int Ay=sc.nextInt();\n int Dy=sc.nextInt();\n Hm=sc.nextInt();\n Am=sc.nextInt();\n Dm=sc.nextInt();\n h=sc.nextInt();\n a=sc.nextInt();\n d=sc.nextInt();\n dp=new int [400][400][400];\n \n System.out.println(solve(Ay,Dy,Hy,0));\n }\nprivate static int solve(int ay, int dy, int hy, int p) {\n if (won(ay,dy,hy)) {\n // if (ppr)return p;\n // if (ay==400 || dy==400 || hy==400)System.out.println(\"yes\");\n try{\n if (dp[ay][dy][hy]!=0)return dp[ay][dy][hy];\n }catch(Exception e){\n return 100000000;\n }\n int c1= solve (ay+1,dy,hy,p+a);\n int c2= solve (ay,dy+1,hy,p+d);\n int c3= solve (ay,dy,hy+1,p+h);\n return dp[ay][dy][hy]=Math.min(c1,Math.min(c2,c3));\n \n }\npublic static boolean won(int Ay,int Dy,int Hy ){\n if (Ay<=Dm)return false;\n if (Am<=Dy){\n // System.out.println(\"h\");\n return true;\n }\n //return (Hm*1.0)/(Ay-Dm)<(Hy*1.0)/(Am-Dy) && (Hy*1.0)/(Am-Dy)>0;\n int h=Hm;\n while (true){\n if (Hy>0 && h<=0)return true;\n if (Hy<=0)return false;\n h-=Math.max(0,Ay-Dm);\n Hy-=Math.max(0,Am-Dy);\n }\n}\n\n}\n", "lang": "Java 7", "bug_code_uid": "c58e991861f2c42064c756876de3ec60", "src_uid": "bf8a133154745e64a547de6f31ddc884", "apr_id": "d39734ef5e8d91733cef1e12f0f4bfc1", "difficulty": 1800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.996742671009772, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Scanner;\n\npublic class C {\n\tScanner sc = new Scanner(System.in);\n\n\tvoid run() {\n\t\tint hpY = sc.nextInt();\n\t\tint atY = sc.nextInt();\n\t\tint deY = sc.nextInt();\n\t\tint hpM = sc.nextInt();\n\t\tint atM = sc.nextInt();\n\t\tint deM = sc.nextInt();\n\t\tint h = sc.nextInt();\n\t\tint a = sc.nextInt();\n\t\tint d = sc.nextInt();\n\n\t\tint cost = Integer.MAX_VALUE;\n\n\t\tfor (int i = 0; i <= 700; i++) {\n\t\t\tfor (int j = 0; j <= 700; j++) {\n\t\t\t\tfor (int k = 0; k <= 700; k++) {\n\t\t\t\t\tif (i * h + j * a + k * d >= cost) continue;\n\t\t\t\t\tint tmpHPY = hpY + i;\n\t\t\t\t\tint tmpATY = atY + j;\n\t\t\t\t\tint tmpDEY = deY + k;\n\t\t\t\t\tint tmpHPM = hpM;\n\t\t\t\t\tint pre = -1;\n\t\t\t\t\twhile (true) {\n\t\t\t\t\t\ttmpHPY -= Math.max(0, atM - tmpDEY);\n\t\t\t\t\t\ttmpHPM -= Math.max(0, tmpATY - deM);\n\t\t\t\t\t\tif (tmpHPY > 0 && tmpHPM <= 0) {\n\t\t\t\t\t\t\tcost = Math.min(cost, i * h + j * a + k * d);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (tmpHPY <= 0 || tmpHPM <= 0) break;\n\t\t\t\t\t\tif (pre == tmpHPM) break;\n\t\t\t\t\t\tpre = tmpHPM;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cost);\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tnew C().run();\n\t}\n}", "lang": "Java 7", "bug_code_uid": "83da7c4b6d48ff5a781b8e2f9ed34caf", "src_uid": "bf8a133154745e64a547de6f31ddc884", "apr_id": "dce1509c8c5e3acb4f57a0f536e05842", "difficulty": 1800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.4074074074074074, "equal_cnt": 10, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 10, "bug_source_code": "import java.util.*;\npublic class Main {\n public static void main (String [] args) {\n Scanner sc = new Scanner (System.in);\n long a = sc.nextLong();\n if(a %2 == 0) System.out.println((a+1)/2);\n else System.out.println((a+1); \n }\n}", "lang": "Java 8", "bug_code_uid": "2701e11608b0c587c0ce538d5fe0969f", "src_uid": "236177ff30dafe68295b5d33dc501828", "apr_id": "375044930d60aece285fad045ec5b41e", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9963768115942029, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\n\npublic class virtualContest3 {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scn = new Scanner(System.in);\n\t\tint x1=scn.nextInt();\n\t\tint y1=scn.nextInt();\n\t\tint x2=scn.nextInt();\n\t\tint y2=scn.nextInt();\n\t\tint x=scn.nextInt();\n\t\tint y=scn.nextInt();\n\t\tif(Math.abs(x2-x1)%x==0 && Math.abs(y2-y1)%y==0) {\n\t\t\tint d1=Math.abs(x2-x1);\n\t\t\tint d2=Math.abs(y2-y1);\n\t\t\tif((d2%2==0 && d1%2==0)|| (d2%2!=0 && d1%2!=0)) {\n\t\t\t\tSystem.out.println(\"YES\");\n\t\t\t}else\n\t\t\t\tSystem.out.println(\"NO\");\n\t\t}else\n\t\t\tSystem.out.println(\"NO\");\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "542493d823ecbea323a884e7779e60bc", "src_uid": "1c80040104e06c9f24abfcfe654a851f", "apr_id": "31fe7cfd19f0b6980254fad5089efa80", "difficulty": 1200, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8805496828752643, "equal_cnt": 17, "replace_cnt": 11, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 16, "bug_source_code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.io.FilterInputStream;\nimport java.io.BufferedInputStream;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author Jenish\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n ScanReader in = new ScanReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n ATreasureHunt solver = new ATreasureHunt();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class ATreasureHunt {\n int dx = new int[]{1, 1, -1, -1};\n int dy = new int[]{1, -1, 1, -1};\n\n public void solve(int testNumber, ScanReader in, PrintWriter out) {\n int x1 = in.scanInt();\n int y1 = in.scanInt();\n\n\n int x2 = in.scanInt();\n int y2 = in.scanInt();\n\n\n int px = in.scanInt();\n int py = in.scanInt();\n\n\n boolean f = false;\n for (int i = 0; i < 4; i++) {\n int a = (px - x1) / dx[i];\n int b = (py - y1) / dy[i];\n\n\n for (int j = 0; j < 4; j++) {\n int tx = px + a * dx[j];\n int ty = py + b * dy[j];\n if (tx == x2 && ty == y2) f = true;\n }\n }\n if (f) {\n out.println(\"YES\");\n } else {\n out.println(\"NO\");\n }\n\n }\n\n }\n\n static class ScanReader {\n private byte[] buf = new byte[4 * 1024];\n private int INDEX;\n private BufferedInputStream in;\n private int TOTAL;\n\n public ScanReader(InputStream inputStream) {\n in = new BufferedInputStream(inputStream);\n }\n\n private int scan() {\n if (INDEX >= TOTAL) {\n INDEX = 0;\n try {\n TOTAL = in.read(buf);\n } catch (Exception e) {\n e.printStackTrace();\n }\n if (TOTAL <= 0) return -1;\n }\n return buf[INDEX++];\n }\n\n public int scanInt() {\n int I = 0;\n int n = scan();\n while (isWhiteSpace(n)) n = scan();\n int neg = 1;\n if (n == '-') {\n neg = -1;\n n = scan();\n }\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n I *= 10;\n I += n - '0';\n n = scan();\n }\n }\n return neg * I;\n }\n\n private boolean isWhiteSpace(int n) {\n if (n == ' ' || n == '\\n' || n == '\\r' || n == '\\t' || n == -1) return true;\n else return false;\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "3fb78337899cbc388bb4c33ffb79888f", "src_uid": "1c80040104e06c9f24abfcfe654a851f", "apr_id": "a2a4e5dd65f316a03394a33d52dbaa24", "difficulty": 1200, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.2109115103127079, "equal_cnt": 12, "replace_cnt": 5, "delete_cnt": 5, "insert_cnt": 3, "fix_ops_cnt": 13, "bug_source_code": "import java.util.Arrays;\nimport java.util.Scanner;\nimport java.util.*;\n\npublic class cr191d2a\n{ \n public static int max = 0;\n public static int N;\n\n public static void main(String[] args)\n { \n Scanner sc = new Scanner(System.in);\n N = sc.nextInt();\n int[] mas = new int[N];\n for (int i = 0; i < N; ++i)\n {\n mas[i] = sc.nextInt();\n }\n\n int[] mem = mas.clone();\n\n Stack stack = new Stack();\n\n SuperMas x = new SuperMas(0, N - 1, mas);\n stack.push(x);\n\n while (!stack.isEmpty())\n { \n x = stack.pop();\n\n //System.out.print(\"1) \");\n //x.Print();\n\n if (x.begin > x.end)\n continue;\n\n SuperMas left = new SuperMas(x.begin + 1, x.end, mem.clone());\n SuperMas right = new SuperMas(x.begin, x.end - 1, mem.clone());\n x.Change();\n\n //System.out.print(\"2) \");\n //x.Print();\n\n if (x.CountOne() > SuperMas.max)\n {\n SuperMas.max = x.CountOne();\n //System.out.println(\"MAX = \" + SuperMas.max);\n if (SuperMas.max == N)\n {\n System.out.println(N);\n return;\n }\n }\n \n stack.push(left);\n stack.push(right);\n }\n\n System.out.println(SuperMas.max);\n }\n}\n\nclass SuperMas extends cr191d2a\n{ \n int[] mas;\n int begin, end;\n\n SuperMas(int begin, int end, int[] mas)\n {\n this.begin = begin;\n this.end = end;\n this.mas = mas;\n }\n\n int CountOne()\n {\n int count = 0;\n\n for (int i = 0; i < N; i++)\n if (this.mas[i] == 1)\n count++;\n\n return count;\n }\n\n void Change()\n { \n for (int i = this.begin; i < this.end + 1; i++)\n this.mas[i] = 1 - this.mas[i];\n }\n\n void Print()\n {\n for (int i = 0; i < N; i++)\n System.out.print(this.mas[i]);\n\n System.out.print(\" = \" + this.CountOne() + \" \" + this.begin + \"//\" + this.end);\n System.out.println();\n }\n}\n", "lang": "Java 7", "bug_code_uid": "92064d367428e6cce8dc760cbe51ef5d", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "apr_id": "06f010d339e33c1e1b7b1b83c8e98c96", "difficulty": 1200, "tags": ["dp", "brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5985130111524164, "equal_cnt": 10, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 9, "bug_source_code": "import java.util.Scanner ;\npublic class A_391 \n{\n public static void main(String [] args)\n {\n Scanner sc = new Scanner(System.in);\n String s = sc.nextLine();\n String tmp = \"\" ;\n int c = 0 ;\n for(int i = 0; i < s.length()-1; i++)\n {\n if(s.charAt(i) == s.charAt(i+1))\n tmp += s.charAt(i);\n else\n {\n if(tmp.length() % 2 == 1)\n c++ ;\n tmp = \"\" ;\n }\n }\n System.out.println(c);\n }\n}", "lang": "Java 8", "bug_code_uid": "6c7d6e6cc82cb5f47ff5577e895420fd", "src_uid": "8b26ca1ca2b28166c3d25dceb1f3d49f", "apr_id": "8f4395e8bb230a902460554ba9921fea", "difficulty": null, "tags": ["implementation", "two pointers"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9765421372719374, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "public class MAIN {\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n String s = in.nextLine();\n in.close();\n \n int res = 0;\n if (s!=null && s.length()>1) { \n for (int i=0; i>1;\n i=i+z;\n }\n else\n i++;\n }\n System.out.println(c);\n sc.close();\n }\n}", "lang": "Java 8", "bug_code_uid": "e218330692883deda559e1f90114f3bd", "src_uid": "8b26ca1ca2b28166c3d25dceb1f3d49f", "apr_id": "03c7a852df931907bdaf2f897213718e", "difficulty": null, "tags": ["implementation", "two pointers"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.964200477326969, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "//package codeforces;\nimport java.util.*;\npublic class GeneticEngineering {\n public static void main(String[] args) {\n Scanner in=new Scanner(System.in);\n String s=in.nextLine();\n int count=1;\n int insert=0;\n for(int i=0;i> adjList;\n public static int[] dx = {-1, 0, 1, 0, -1, 1, 1, -1};\n public static int[] dy = {0, 1, 0, -1, 1, 1, -1, -1};\n public static int INF = 0x3f3f3f3f;\n public static int MOD = 1000000007;\n\n public static void main(String[] args) throws Exception {\n int N = Integer.parseInt(br.readLine());\n st = new StringTokenizer(br.readLine());\n ArrayList A = new ArrayList();\n \n for(int i = 0; i < N; i++){\n A.add(Integer.parseInt(st.nextToken()));\n }\n\n boolean f = true;\n boolean sorted = false;\n while (!sorted && f) {\n for(int i = 0; i < N; i++) {\n if (i != 0 && A.get(i) > A.get(i-1)) {\n sorted = true;\n }\n\n if (i != 0 && Math.abs(A.get(i) - A.get(i-1)) >= 2) {\n f = false;\n break;\n }\n }\n Integer k = Collections.max(A);\n A.remove(k);\n A.add(k);\n }\n\n pw.println(f ? \"YES\" : \"NO\");\n\n pw.close(); \n br.close();\n }\n}\n\nclass Pair implements Comparable{\n public int x, y;\n \n Pair(int _x, int _y){\n x = _x;\n y = _y;\n }\n \n public String toString(){\n return x + \",\" + y;\n }\n \n public int compareTo(Pair p){\n if(x != p.x) return x < p.x ? 1 : -1;\n else if(y != p.y) return y < p.y ? -1 : 1;\n return 0;\n }\n} \n", "lang": "Java 8", "bug_code_uid": "fd66afbdfa5ea24530da92317dcefb88", "src_uid": "704d0ae50bccaa8bc49319812ae0be45", "apr_id": "cba3ad950db33804e6faedf5273cb677", "difficulty": 1600, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9991855730075625, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n TaskC solver = new TaskC();\n solver.Solve(in, out);\n out.close();\n }\n\n static class TaskC {\n\n void Solve(InputReader in, PrintWriter out) {\n int n = in.NextInt();\n ArrayList a = new ArrayList<>();\n for (int i = 0; i < n; i++) a.add(in.NextInt());\n for (int j = 0; j < n; j++) {\n for (int i = 0; i < n - 1; i++) {\n if (Math.abs(a.get(i) - a.get(i + 1)) == 2) {\n out.println(\"NO\");\n return;\n }\n }\n int max = 0;\n int ind = 0;\n for (int i = 0; i < n; i++)\n if (a.get(i) > max) {\n ind = i;\n max = a.get(i);\n }\n a.remove(ind);\n n--;\n }\n out.println(\"YES\");\n }\n }\n\n\n static int GetMax(int[] ar) {\n int max = Integer.MIN_VALUE;\n for (int a : ar) {\n max = Math.max(max, a);\n }\n return max;\n }\n\n static int GetMin(int[] ar) {\n int min = Integer.MAX_VALUE;\n for (int a : ar) {\n min = Math.min(min, a);\n }\n return min;\n }\n\n static long GetSum(int[] ar) {\n long s = 0;\n for (int a : ar) s += a;\n return s;\n }\n\n static int[] GetCount(int[] ar) {\n return GetCount(ar, GetMax(ar));\n }\n\n static int[] GetCount(int[] ar, int maxValue) {\n int[] dp = new int[maxValue + 1];\n for (int a : ar) {\n dp[a]++;\n }\n return dp;\n }\n\n static class InputReader {\n BufferedReader reader;\n StringTokenizer tokenizer;\n\n InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n String Next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine(), \" \\t\\n\\r\\f,\");\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n int NextInt() {\n return Integer.parseInt(Next());\n }\n\n long NextLong() {\n return Long.parseLong(Next());\n }\n\n double NextDouble() {\n return Double.parseDouble(Next());\n }\n\n int[] NextIntArray(int n) {\n return NextIntArray(n, 0);\n }\n\n int[] NextIntArray(int n, int offset) {\n int[] a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = NextInt() - offset;\n }\n return a;\n }\n\n int[][] NextIntMatrix(int n, int m) {\n return NextIntMatrix(n, m, 0);\n }\n\n int[][] NextIntMatrix(int n, int m, int offset) {\n int[][] a = new int[n][m];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n a[i][j] = NextInt() - offset;\n }\n }\n return a;\n }\n\n\n public long[] NextLongArray(int n) {\n return NextLongArray(n, 0);\n }\n\n long[] NextLongArray(int n, int offset) {\n long[] a = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = NextLong() - offset;\n }\n return a;\n }\n\n long[][] NextLongMatrix(int n, int m) {\n return NextLongMatrix(n, m, 0);\n }\n\n long[][] NextLongMatrix(int n, int m, int offset) {\n long[][] a = new long[n][m];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n a[i][j] = NextLong() - offset;\n }\n }\n return a;\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "0fb39067ee9c79729e9b95607d782556", "src_uid": "704d0ae50bccaa8bc49319812ae0be45", "apr_id": "2f5ac0b5166bad9a652a0873fd393d84", "difficulty": 1600, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9776119402985075, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "\n\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class CForces3 {\n\n public static void main(String[] args) {\n\n Scanner in = new Scanner(System.in);\n int staticArr[] = new int[101];\n\n for (int i=0;i<101;i++) {\n staticArr[i]=0;\n }\n int n = in.nextInt();\n int input[] = new int[n];\n int copy[] = new int[n];\n for (int i=0;iinput[i+1]) {\n\n\n if ((checkFor(input[i] - 1, 101) && staticArr[input[i] - 1] == 1) ||\n (checkFor(input[i + 1] + 1, 101) && staticArr[input[i + 1] + 1] == 1)) {\n flag = false;\n break;\n }\n } else {\n if ((checkFor(input[i+1] - 1, 101) && staticArr[input[i+1] - 1] == 1) ||\n (checkFor(input[i] + 1, 101) && staticArr[input[i] + 1] == 1)) {\n flag = false;\n break;\n }\n\n\n }\n\n\n }\n }\n\n if (flag) {\n System.out.println(\"YES\");\n } else {\n System.out.println(\"NO\");\n }\n\n /*\n Arrays.sort(copy);\n\n for (int i=0;i=0 && a=2)\n\t\t\t\tflag=false\n\t\t}\n\t\tif(flag)\n\t\t\tSystem.out.println(\"YES\");\n\t\telse\n\t\t\tSystem.out.println(\"NO\");\n\t\t\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "22b1aff8067738dea931e8924940b528", "src_uid": "704d0ae50bccaa8bc49319812ae0be45", "apr_id": "8a127c7589e60f91a5aeb147db5cee36", "difficulty": 1600, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.4521161825726141, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "import java.io.OutputStreamWriter;\nimport java.io.BufferedWriter;\nimport java.io.PrintStream;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.Random;\nimport java.io.Writer;\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.BitSet;\nimport java.io.IOException;\nimport java.util.Arrays;\nimport java.util.InputMismatchException;\nimport java.util.ArrayList;\nimport java.util.NoSuchElementException;\nimport java.util.TreeSet;\nimport java.math.BigInteger;\nimport java.util.Collections;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n * @author ogiekako\n */\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tMyScanner in = new MyScanner(inputStream);\n\t\tMyPrintWriter out = new MyPrintWriter(outputStream);\n\t\tTaskD solver = new TaskD();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass TaskD {\n int MOD = 777777777;\n long[][] C = MathUtils.generateCombination(257, MOD);\n public void solve(int testNumber, MyScanner in, MyPrintWriter out) {\n int n = in.nextInt(), k = in.nextInt();\n long[][] dp = new long[k+1][n-k+1];\n dp[0][0] = 1;\n for(int i=1;i<=n;i++){\n long[][] nxt = new long[k+1][n-k+1];\n for(int lie=0;lie0){\n int rest = n - lie - hon;\n for(int use=0;use<=rest;use++){\n if(use==i && hon + use < n-k+1){\n nxt[lie][hon+use] = (nxt[lie][hon+use] + dp[lie][hon] * C[rest][use]) % MOD;\n }else if(use!=i && lie+use= modulus) C[i][j] -= modulus;\n }\n return C;\n }\n\n }\n\nclass MyScanner {\n private final InputStream in;\n\n public MyScanner(InputStream in) {\n this.in = in;\n }\n\n int bufLen;\n int bufPtr;\n byte[] buf = new byte[1024];\n\n public int read() {\n if (bufLen == -1)\n throw new InputMismatchException();\n if (bufPtr >= bufLen) {\n bufPtr = 0;\n try {\n bufLen = in.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (bufLen <= 0)\n return -1;\n }\n return buf[bufPtr++];\n }\n\n public int nextInt() {\n try {\n int c = read();\n if (c == -1) return c;\n while (c != '-' && (c < '0' || '9' < c)) {\n c = read();\n if (c == -1) return c;\n }\n if (c == '-') return -nextInt();\n int res = 0;\n do {\n res *= 10;\n res += c - '0';\n c = read();\n } while ('0' <= c && c <= '9');\n return res;\n } catch (Exception e) {\n return -1;\n }\n }\n\n\n }\n\nclass MyPrintWriter {\n PrintWriter out;\n\n public MyPrintWriter(OutputStream outputStream) {\n out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }\n\n public MyPrintWriter(Writer writer) {\n out = new PrintWriter(writer);\n }\n\n public void println(Object... os) {\n for (int i = 0; i < os.length - 1; i++) {\n out.print(os[i]);\n out.print(' ');\n }\n out.println(os[os.length - 1]);\n }\n\n public void close() {\n out.close();\n }\n\n }\n\n", "lang": "Java 7", "bug_code_uid": "9febe1d0a37731dbaf7e7618187c2ea6", "src_uid": "cfe19131644e5925e32084a581e23286", "apr_id": "79e1880d85aea9eea8fd73ce863f1757", "difficulty": 2700, "tags": ["dp"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.22547240311732678, "equal_cnt": 24, "replace_cnt": 15, "delete_cnt": 4, "insert_cnt": 4, "fix_ops_cnt": 23, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class D {\n\n\tBufferedReader br;\n\tPrintWriter out;\n\tStringTokenizer st;\n\tboolean eof;\n\n\tstatic final int MOD = 777777777;\n\n\tint[][] c = new int[257][];\n\t{\n\t\tfor (int i = 0; i < c.length; i++) {\n\t\t\tc[i] = new int[i + 1];\n\t\t\tc[i][0] = c[i][i] = 1;\n\t\t\tfor (int j = 1; j < i; j++) {\n\t\t\t\tc[i][j] = c[i - 1][j - 1] + c[i - 1][j];\n\t\t\t\tif (c[i][j] >= MOD)\n\t\t\t\t\tc[i][j] -= MOD;\n\t\t\t}\n\t\t}\n//\t\tSystem.err.println(Arrays.toString(c[4]));\n\t}\n\n\tint solve(int n, int kn) {\n\n\t\tint[] dp = new int[n + 1];\n\t\tdp[0] = 1;\n\n\t\tfor (int i = 1; i <= n; i++) {\n\n\t\t\tint[] next = new int[n + 1];\n\n\t\t\t// who said i?\n\t\t\tif (i == kn) {\n\t\t\t\tfor (int k = 0; k + i <= n; k++) {\n\t\t\t\t\tif (dp[k] != 0) {\n\t\t\t\t\t\tnext[k + i] += (int) ((long) dp[k] * c[n - k][i] % MOD);\n\t\t\t\t\t\tif (next[k + i] >= MOD)\n\t\t\t\t\t\t\tnext[k + i] -= MOD;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// liars\n\t\t\t\tfor (int j = 0; j <= n; j++)\n\t\t\t\t\t// how many people said i\n\t\t\t\t\tif (j != i) {\n\t\t\t\t\t\tfor (int k = 0; k + j <= n; k++)\n\t\t\t\t\t\t\t// how many people already said\n\t\t\t\t\t\t\tif (dp[k] != 0) {\n\t\t\t\t\t\t\t\tnext[k + j] += (int) ((long) dp[k]\n\t\t\t\t\t\t\t\t\t\t* c[n - k][j] % MOD);\n\t\t\t\t\t\t\t\tif (next[k + j] >= MOD)\n\t\t\t\t\t\t\t\t\tnext[k + j] -= MOD;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t}\n\t\t\tdp = next;\n\t\t}\n\n\t\treturn dp[n];\n\t}\n\n\tD() throws IOException {\n\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\tout = new PrintWriter(System.out);\n\t\tint n = nextInt();\n\t\tint k = nextInt();\n\t\tout.println(solve(n, n - k));\n\t\tout.close();\n\t}\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tnew D();\n\t}\n\n\tString nextToken() {\n\t\twhile (st == null || !st.hasMoreTokens()) {\n\t\t\ttry {\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t} catch (Exception e) {\n\t\t\t\teof = true;\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t\treturn st.nextToken();\n\t}\n\n\tString nextString() {\n\t\ttry {\n\t\t\treturn br.readLine();\n\t\t} catch (IOException e) {\n\t\t\teof = true;\n\t\t\treturn null;\n\t\t}\n\t}\n\n\tint nextInt() throws IOException {\n\t\treturn Integer.parseInt(nextToken());\n\t}\n\n\tlong nextLong() throws IOException {\n\t\treturn Long.parseLong(nextToken());\n\t}\n\n\tdouble nextDouble() throws IOException {\n\t\treturn Double.parseDouble(nextToken());\n\t}\n}", "lang": "Java 7", "bug_code_uid": "a388914b9cc226b0711c832492863a3f", "src_uid": "cfe19131644e5925e32084a581e23286", "apr_id": "be3ec3b9949124eb5819717aec90c522", "difficulty": 2700, "tags": ["dp"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9972974845818031, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class D_submit {\n\n\tBufferedReader br;\n\tPrintWriter out;\n\tStringTokenizer st;\n\tboolean eof;\n\n\tstatic final int[][] ANS = {\n\t\t\t{ 0, },\n\t\t\t{ 2, 1, },\n\t\t\t{ 32, 30, 80, 109, },\n\t\t\t{ 6824, 59808, 147224, 415870, 1757896, 1897056, 4898872, 7593125, },\n\t\t\t{ 776830421, 290516100, 746623577, 293783147, 33900006, 735127505,\n\t\t\t\t\t565460332, 428982705, 472062098, 161873957, 117354594,\n\t\t\t\t\t515619293, 578944191, 312106242, 569389279, 391464593, },\n\t\t\t{ 261086313, 584837659, 683961846, 468868529, 211593382, 736955478,\n\t\t\t\t\t229471758, 157617135, 398169441, 360252438, 629394768,\n\t\t\t\t\t264125799, 647490480, 342079395, 391579767, 225200475,\n\t\t\t\t\t486011304, 513156108, 628771752, 132906648, 142138221,\n\t\t\t\t\t20119449, 444199674, 195188679, 387329805, 44684703,\n\t\t\t\t\t651912135, 737154512, 612549793, 519860281, 186175544,\n\t\t\t\t\t212568440, },\n\t\t\t{ 240805271, 239509872, 581127897, 6511239, 156126222, 509425833,\n\t\t\t\t\t672407328, 366667722, 459185405, 509737025, 554790222,\n\t\t\t\t\t165216555, 703150560, 74806569, 398730015, 383350905,\n\t\t\t\t\t506108358, 51326142, 298053147, 104256117, 391428765,\n\t\t\t\t\t374020479, 206607807, 87664059, 275899176, 56407680,\n\t\t\t\t\t551553401, 448939463, 582889860, 129676638, 226078251,\n\t\t\t\t\t135769095, 61292868, 578972226, 190181628, 390739055,\n\t\t\t\t\t184587732, 446575689, 732674124, 232198470, 676760679,\n\t\t\t\t\t352474101, 611444862, 575661807, 628905585, 320813094,\n\t\t\t\t\t522840969, 469781928, 156006018, 554473341, 239654268,\n\t\t\t\t\t643714911, 433540170, 199307003, 496385218, 291740751,\n\t\t\t\t\t67309914, 370826673, 202356819, 279421821, 421203111,\n\t\t\t\t\t63744786, 520987612, 550671827, },\n\t\t\t{ 482164403, 768209115, 462063756, 154906374, 36099042, 341766705,\n\t\t\t\t\t678182556, 621882744, 478771358, 231881111, 175889805,\n\t\t\t\t\t243630450, 168908523, 671961765, 55761813, 652682670,\n\t\t\t\t\t773939082, 517628076, 756201264, 124604900, 750976272,\n\t\t\t\t\t498253248, 676047609, 137170026, 705610017, 495032139,\n\t\t\t\t\t561797418, 703097347, 500815609, 95984586, 739707108,\n\t\t\t\t\t265613565, 387099846, 777331779, 594676173, 591219559,\n\t\t\t\t\t407997044, 208947235, 93337440, 478908360, 685013007,\n\t\t\t\t\t487033953, 671903001, 39521181, 738490312, 33785059,\n\t\t\t\t\t465470131, 310453920, 54648783, 346831137, 427694175,\n\t\t\t\t\t474743430, 705296781, 435828036, 429824745, 663532359,\n\t\t\t\t\t261388683, 244690731, 533997135, 596108961, 506813013,\n\t\t\t\t\t371892402, 590145264, 104733162, 143420103, 654339672,\n\t\t\t\t\t700348950, 685038942, 578826927, 286484229, 501639192,\n\t\t\t\t\t434962491, 299270097, 27702486, 335375775, 111746817,\n\t\t\t\t\t565603164, 294926121, 676063665, 735862995, 710035809,\n\t\t\t\t\t437011960, 668528077, 138765186, 508213986, 615036450,\n\t\t\t\t\t353784942, 624827616, 343900011, 241289776, 52410890,\n\t\t\t\t\t72018835, 352406796, 415705878, 4802637, 376367145,\n\t\t\t\t\t65589678, 333633477, 341834527, 303717460, 282387700,\n\t\t\t\t\t42951006, 254706039, 423048528, 526429710, 68131467,\n\t\t\t\t\t669954708, 12787348, 500636381, 317959019, 479433192,\n\t\t\t\t\t657133515, 416259390, 610216692, 340129188, 44594256,\n\t\t\t\t\t257373347, 138718678, 530767740, 292922628, 37220268,\n\t\t\t\t\t605295159, 480722613, 458170419, 30540300, 487159055,\n\t\t\t\t\t232966794, 149150650, },\n\t\t\t{ 412133651, 386543325, 139952108, 289303402, 102404925, 317067177,\n\t\t\t\t\t396414708, 80515854, 663739304, 317300809, 228877044,\n\t\t\t\t\t493725043, 715317967, 490300965, 315527373, 743539734,\n\t\t\t\t\t488329191, 553627998, 533025234, 242583957, 706116537,\n\t\t\t\t\t614109258, 645447222, 523195911, 492109128, 722623041,\n\t\t\t\t\t111085128, 766395126, 654378921, 691964847, 496688157,\n\t\t\t\t\t399056049, 654363234, 102052314, 191720088, 473910948,\n\t\t\t\t\t259736526, 332840025, 388047555, 665791056, 627111387,\n\t\t\t\t\t139696515, 441456687, 443032569, 283264821, 771641703,\n\t\t\t\t\t452641455, 511306362, 117572859, 127701891, 721298331,\n\t\t\t\t\t176520078, 357242229, 611296308, 696994956, 405628839,\n\t\t\t\t\t429224274, 465336054, 695091546, 689828796, 574648641,\n\t\t\t\t\t351220905, 507964023, 675326610, 517248963, 453528621,\n\t\t\t\t\t220301928, 494463186, 681789969, 339589656, 44524053,\n\t\t\t\t\t417125457, 339589404, 747135963, 341780733, 734158215,\n\t\t\t\t\t396817281, 21997836, 5728464, 147611205, 456248898,\n\t\t\t\t\t714128667, 377654949, 3862068, 128418948, 589390074,\n\t\t\t\t\t304947090, 11703825, 228266073, 127304142, 429215724,\n\t\t\t\t\t361541124, 521572968, 468358191, 341231688, 65323503,\n\t\t\t\t\t613778508, 15985323, 291661029, 410970006, 591638112,\n\t\t\t\t\t349541550, 89967528, 224922159, 361094166, 584206074,\n\t\t\t\t\t640051812, 324264456, 652625388, 693768537, 11740617,\n\t\t\t\t\t309238398, 211085469, 194905872, 639416484, 110110707,\n\t\t\t\t\t296645895, 748118511, 131177718, 511142751, 775975599,\n\t\t\t\t\t421403409, 475528473, 434685258, 1768977, 80301375,\n\t\t\t\t\t708023862, 569195676, 56238084, 632887668, 88089750,\n\t\t\t\t\t631539342, 396695565, 38780154, 695798271, 469819224,\n\t\t\t\t\t439587099, 69045921, 682966116, 112310856, 64943298,\n\t\t\t\t\t534475872, 40215357, 389728458, 286368453, 736006257,\n\t\t\t\t\t501181650, 54829908, 603489402, 338032656, 512182818,\n\t\t\t\t\t627500097, 462674016, 3103092, 157324491, 43978329,\n\t\t\t\t\t596818971, 259025598, 9088632, 91991781, 577291428,\n\t\t\t\t\t211245489, 429471231, 142626330, 172560633, 510907446,\n\t\t\t\t\t444609585, 758102058, 375112647, 744786693, 276174402,\n\t\t\t\t\t19259856, 233672418, 745389414, 225772848, 23385663,\n\t\t\t\t\t324290610, 519804558, 120337812, 402578568, 360676008,\n\t\t\t\t\t450089262, 551043738, 337388940, 512108856, 28879011,\n\t\t\t\t\t690040638, 106017282, 558262341, 99972432, 608226003,\n\t\t\t\t\t612152037, 42414435, 776201013, 39580443, 518796945,\n\t\t\t\t\t494437752, 583194366, 723936555, 415359657, 309569589,\n\t\t\t\t\t751104774, 166684527, 249229170, 353120823, 130668327,\n\t\t\t\t\t753823584, 580966092, 561963717, 543672234, 393846327,\n\t\t\t\t\t586278000, 327398400, 278403867, 156455586, 363920382,\n\t\t\t\t\t190245195, 290039148, 547014447, 466218648, 146037150,\n\t\t\t\t\t585462906, 666008595, 691786683, 374707494, 622498779,\n\t\t\t\t\t231158277, 685740951, 115612245, 681825249, 545555745,\n\t\t\t\t\t551718468, 277206615, 640171035, 757727334, 195193908,\n\t\t\t\t\t658656684, 457760646, 225925875, 505761984, 18685233,\n\t\t\t\t\t506832921, 112511021, 396846646, 290147622, 113924623,\n\t\t\t\t\t669986155, 336008070, 63611061, 238586775, 119956662,\n\t\t\t\t\t616557739, 772784623, 334527774, 410403148, 51933421, }, };\n\n\tvoid solve() throws IOException {\n\t\tint n = nextInt();\n\t\tint k = nextInt();\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tif ((1 << i) == n)\n\t\t\t\tout.println(ANS[i][k - 1]);\n\t}\n\n\tD_submit() throws IOException {\n\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\tout = new PrintWriter(System.out);\n\t\tsolve();\n\t\tout.close();\n\t}\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tnew D_submit();\n\t}\n\n\tString nextToken() {\n\t\twhile (st == null || !st.hasMoreTokens()) {\n\t\t\ttry {\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t} catch (Exception e) {\n\t\t\t\teof = true;\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t\treturn st.nextToken();\n\t}\n\n\tString nextString() {\n\t\ttry {\n\t\t\treturn br.readLine();\n\t\t} catch (IOException e) {\n\t\t\teof = true;\n\t\t\treturn null;\n\t\t}\n\t}\n\n\tint nextInt() throws IOException {\n\t\treturn Integer.parseInt(nextToken());\n\t}\n\n\tlong nextLong() throws IOException {\n\t\treturn Long.parseLong(nextToken());\n\t}\n\n\tdouble nextDouble() throws IOException {\n\t\treturn Double.parseDouble(nextToken());\n\t}\n}", "lang": "Java 7", "bug_code_uid": "ede0689b039120e5b8b585075f034c5b", "src_uid": "cfe19131644e5925e32084a581e23286", "apr_id": "be3ec3b9949124eb5819717aec90c522", "difficulty": 2700, "tags": ["dp"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.20663744520976832, "equal_cnt": 33, "replace_cnt": 22, "delete_cnt": 5, "insert_cnt": 6, "fix_ops_cnt": 33, "bug_source_code": "import java.io.*;\nimport java.util.Arrays;\n\npublic class TheWall \n{\n public static void main(String[] args) throws IOException\n {\n //BufferedReader input = new BufferedReader(new FileReader(\"Sample Input.txt\"));\n BufferedReader input = new BufferedReader(new InputStreamReader(System.in));\n StringBuilder output = new StringBuilder();\n \n String line;\n String[] items;\n char[] bricks;\n int x, y, a, b, count;\n \n while ( (line=input.readLine()) != null)\n {\n items = line.split(\"[\\\\s]+\");\n x = Integer.parseInt(items[0]);\n y = Integer.parseInt(items[1]);\n a = Integer.parseInt(items[2]);\n b = Integer.parseInt(items[3]);\n \n bricks = new char[b+1];\n Arrays.fill(bricks, ' ');\n \n count =0;\n \n for (int i = a; i <= b; i++) \n {\n if ( i%x == 0 && i%y ==0 )\n count++;\n }\n \n output.append(count).append(\"\\n\");\n \n }\n System.out.print(output);\n \n }\n\n}", "lang": "Java 6", "bug_code_uid": "8c565c44912c8bb542cf5e3556396857", "src_uid": "c7aa8a95d5f8832015853cffa1374c48", "apr_id": "b66450642da735d90656bde4232d8c8a", "difficulty": 1200, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.4278388278388278, "equal_cnt": 24, "replace_cnt": 11, "delete_cnt": 3, "insert_cnt": 9, "fix_ops_cnt": 23, "bug_source_code": "import java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.Scanner;\n\n\npublic class D {\n\tint MODULAR = 1000000007;\n\tint M;\n\tlong[] numcount = new long[11];\n\tlong[] cumnumcount = new long[11];\n\tpublic void solve(){\n\t\tPrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));\t\t\n\t\tScanner sc = new Scanner(System.in);\n\t\tM = sc.nextInt();\n\t\t\n\t\tfor(int i = 1; i <= 9; i++){\n\t\t\tif( i == 4 || i == 7) bfs(i, 1);\n\t\t\telse bfs(i, 0);\n\t\t}\n\t\t\n\t\t\n\t\tfor(int i = 0; i <= 10; i++){\n\t\t\tif( i > 0)\n\t\t\t\tcumnumcount[i] = cumnumcount[i-1] + numcount[i];\n\t\t\telse\n\t\t\t\tcumnumcount[i] = numcount[i];\t\t\t\t\t\t\n//\t\t\tSystem.out.println(i + \": \" + numcount[i] + \", \" + cumnumcount[i]);\n\t\t}\n\t\t\n\t\tlong ans = 0;\n\t\tfor(int i = 0; i < 10; i++){\n\t\t\tif( numcount[i+1] == 0) break;\n\t\t\tlong n = cumnumcount[i] % MODULAR;\n\t\t\tlong tmp = numcount[i+1] % MODULAR;\n\t\t\tfor(int j = 0; j < 6; j++){\n\t\t\t\ttmp *= ( (n-j) % MODULAR);\n\t\t\t\ttmp = tmp % MODULAR;\n\t\t\t}\n\t\t\ttmp = tmp % MODULAR;\n\t\t\tans += tmp;\n\t\t\tans = ans % MODULAR;\n\t\t}\n\t\tans = ans % 1000000007;\n\t\t\t\t\n\t\tSystem.out.println( ans );\n\t\tout.close();\t\t\n\t}\n\t\n\tpublic void bfs(long num, int count){\n\t\tif( num > M) return;\n\t\tnumcount[count]++;\n\t\tfor(int i = 0; i <= 9; i++){\n\t\t\tif( num*10 > M) return;\n\t\t\tif( i == 4 || i == 7) bfs( num*10+i, count+1);\n\t\t\telse bfs( num*10+i, count);\n\t\t}\n\t}\n\t\n\t/**\n\t * @param args\n\t */\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tnew D().solve();\n\t}\n\n}\n", "lang": "Java 6", "bug_code_uid": "c555b5d45c3864456767b53753e89da9", "src_uid": "656ed7b1b80de84d65a253e5d14d62a9", "apr_id": "c546ce150e4739e8593c33f3c95bc7b9", "difficulty": 1900, "tags": ["brute force", "dp", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9867435158501441, "equal_cnt": 11, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 6, "fix_ops_cnt": 10, "bug_source_code": "import java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.Scanner;\n\n\npublic class D {\n\tint MODULAR = 1000000007;\n\tint M;\n\tlong[] numcount = new long[10];\n\tpublic void solve(){\n\t\tPrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));\t\t\n\t\tScanner sc = new Scanner(System.in);\n\t\tM = sc.nextInt();\n\t\t\t\t\n\t\tint[] ct = count(M);\n\t\t\n\t\tfor(int i = 1; i <= Math.min(M, 9); i++){\n\t\t\tif( i == 4 || i == 7) bfs(i, 1);\n\t\t\telse bfs(i, 0);\n\t\t}\n\t\t\t\t\n//\t\tfor(int i = 0; i <= 9; i++){\t\t\t\t\t\t\t\t\n//\t\t\tSystem.out.println(i + \": \" + numcount[i]);\n//\t\t}\n//\t\t\n//\t\tfor(int i = 0; i <= 9; i++){\n//\t\t\tSystem.out.println(i + \": \" + ct[i] );\t\t\t\n//\t\t}\n\t\t\n\t\tlong ans = 0;\n\t\tfor(int i = 1; i <= 9; i++){\n\t\t\tfor(int x1 = 0; x1 < i; x1++){\n\t\t\t\tfor(int x2 = 0; x1+x2 < i; x2++){\n\t\t\t\t\tfor(int x3 = 0; x1+x2+x3 < i; x3++){\n\t\t\t\t\t\tfor(int x4 = 0; x1+x2+x3+x4 < i; x4++){\n\t\t\t\t\t\t\tfor(int x5 = 0; x1+x2+x3+x4+x5 < i; x5++){\n\t\t\t\t\t\t\t\tfor(int x6 = 0; x1+x2+x3+x4+x5+x6 < i; x6++){\n//\t\t\t\t\t\t\t\t\tSystem.out.println(\"-->\" + i + \", \" + x1 + \", \" + x2 + \", \" + x3 + \", \" + x4 + \", \" + x5 + \", \" + x6);\n\t\t\t\t\t\t\t\t\tint[] a = new int[10];\n\t\t\t\t\t\t\t\t\ta[x1]++;\n\t\t\t\t\t\t\t\t\ta[x2]++;\n\t\t\t\t\t\t\t\t\ta[x3]++;\n\t\t\t\t\t\t\t\t\ta[x4]++;\n\t\t\t\t\t\t\t\t\ta[x5]++;\n\t\t\t\t\t\t\t\t\ta[x6]++;\n\t\t\t\t\t\t\t\t\tlong tmp = numcount[i];\n\t\t\t\t\t\t\t\t\tfor(int j = 0; j <= 9; j++){\n\t\t\t\t\t\t\t\t\t\tfor(int k = 0; k < a[j]; k++){\n\t\t\t\t\t\t\t\t\t\t\ttmp = tmp * (numcount[j]-k) % MODULAR;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tans += tmp;\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\t\t\t\t\t\n\t\t}\n\t\tans = ans % MODULAR;\n\t\tSystem.out.println( ans );\n\t}\n\t\t\n\tpublic void bfs(long num, int count){\n\t\tnumcount[count]++;\n\t\tfor(int i = 0; i <= 9; i++){\n\t\t\tif( num*10+i > M) break;\n\t\t\tif( i == 4 || i == 7) bfs( num*10+i, count+1);\n\t\t\telse bfs( num*10+i, count);\n\t\t}\n\t}\n\t\n\t\n\tint[] count(long m)\n\t{\n\t\tint[][] dp = new int[11][11];\n\t\tdp[0][0] = 1;\n\t\t\n\t\tint e = 0;\n\t\tlong d = 1;\n\t\tfor(;d <= m;d *= 10,e++){\n\t\t\tfor(int i = 10;i >= 0;i--){\n\t\t\t\tdp[e+1][i] = dp[e][i]*8+(i-1 >= 0 ? dp[e][i-1]*2 : 0);\n\t\t\t}\n\t\t}\n\t\t\n\t\tint[] ret = new int[11];\n\t\tint edge = 0;\n\t\tfor(;e >= 0;d /= 10,e--){\n\t\t\tint q = (int)(m/d%10);\n\t\t\tfor(int i = 0;i < q;i++){\n\t\t\t\tif(i == 4 || i == 7){\n\t\t\t\t\tfor(int k = 0;k <= 10 && edge+1+k <= 10;k++){\n\t\t\t\t\t\tret[edge+1+k] += dp[e][k];\n\t\t\t\t\t}\n\t\t\t\t}else{\n\t\t\t\t\tfor(int k = 0;k <= 10 && edge+k <= 10;k++){\n\t\t\t\t\t\tret[edge+k] += dp[e][k];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(q == 4 || q == 7)edge++;\n\t\t}\n\t\tret[edge]++;\n\t\tret[0]--;\n\t\t\n\t\treturn ret;\n\t}\n\t\n\t\n\t/**\n\t * @param args\n\t */\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tnew D().solve();\n\t}\n\n}\n", "lang": "Java 6", "bug_code_uid": "3062269f7920c17161c7e6082d2c4c4d", "src_uid": "656ed7b1b80de84d65a253e5d14d62a9", "apr_id": "c546ce150e4739e8593c33f3c95bc7b9", "difficulty": 1900, "tags": ["brute force", "dp", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8398545454545454, "equal_cnt": 12, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 7, "fix_ops_cnt": 12, "bug_source_code": "import java.util.*;\npublic class d {\n public static int m, length;\n public static long[] digits;\n public static int mod = 1000000007;\n public static long[][][] memo;\n public static long[] counts;\npublic static void main(String[] args)\n{\n Scanner input = new Scanner(System.in);\n m = input.nextInt();\n length = (m+\"\").length();\n digits = new long[length];\n for(int i =0; i 6)\n return 0;\n if(at == 6)\n {\n //if(left == 0) System.out.println(\"SUCCESS\");\n return left == 0 ? 1 : 0;\n }\n if(numOn == 10)\n return 0;\n long res = 0;\n for(int i =0; i<7; i++)\n {\n if(i > counts[numOn])\n break;\n long factor = 1;\n for(int j =0; j 0 ){\n\t\t\tret *= n;\n\t\t\tn--;\n\t\t\tret %= mod;\n\t\t}\n\t\treturn ret;\n\t}\n\tpublic void solve() throws IOException {\n\t\tint mod = 1000000007;\n\t\tint m = nextInt();\n\t\tif( m <= 7 ){\n\t\t\twriter.println(0);\n\t\t\treturn;\n\t\t}\n\t\tint[] num = new int[10];\n\t\tnum[1] = 1;\n\t\tfor(int i = 1; ; i++){\n\t\t\tint temp = i;\n\t\t\tint mul = 1;\n\t\t\tint n = 0;\n\t\t\tint c = 0;\n\t\t\twhile( temp > 0 ){\n\t\t\t\tif( temp%2 == 0 ){\n\t\t\t\t\tn += 4*mul;\n \t\t\t\t} else {\n \t\t\t\t\tn += 7*mul;\n \t\t\t\t}\n\t\t\t\tmul *= 10;\n\t\t\t\ttemp /= 2;\n\t\t\t\tc++;\n\t\t\t}\t\n\t\t\tif( n > m ){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tnum[c]++;\n\t\t}\n\t\tnum[0] = m;\n\t\tfor(int i = 9; i > 0; i--){\n\t\t\tnum[0] -= num[i];\n\t\t}\t\n\t\tlong ans = 0;\n\t\tint sum = num[0];\n\t\tfor(int i = 1; i < 10; i++){\t\t\t\n\t\t\tlong perm = permutation(sum, 6, mod);\n\t\t\tperm *= num[i];\n\t\t\tans += perm;\n\t\t\tans %= mod;\n\t\t\tsum += num[i];\n\t\t}\n\t\twriter.println(ans%mod);\n\t}\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tnew D().run();\n\t}\n\n\tBufferedReader reader;\n\tStringTokenizer tokenizer;\n\tPrintWriter writer;\n\n\tpublic void run() throws IOException {\n\t\ttry {\n\t\t\treader = new BufferedReader(new InputStreamReader(System.in));\n\t\t\ttokenizer = null;\n\t\t\twriter = new PrintWriter(System.out);\n\t\t\tsolve();\n\t\t\treader.close();\n\t\t\twriter.close();\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t\tSystem.exit(1);\n\t\t}\n\t}\n\n\tpublic int nextInt() throws IOException {\n\t\treturn Integer.parseInt(nextToken());\n\t}\n\n\tpublic double nextDouble() throws IOException {\n\t\treturn Double.parseDouble(nextToken());\n\t}\n\n\tpublic String nextToken() throws IOException {\n\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t}\n\t\treturn tokenizer.nextToken();\n\t}\n\n}\n", "lang": "Java 6", "bug_code_uid": "5ba91b651d18e168fb085082760216cd", "src_uid": "656ed7b1b80de84d65a253e5d14d62a9", "apr_id": "4b0600f3fdd147142edd1f32abd0607e", "difficulty": 1900, "tags": ["brute force", "dp", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8683834048640916, "equal_cnt": 12, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 6, "fix_ops_cnt": 11, "bug_source_code": "import java.util.*;\npublic class Main\n{\n public static void main(String args[])\n {\n Scanner sc=new Scanner(System.in);\n int n=sc.nextInt();\n int arr[]=new arr[n];\n for(int i=0;i 1)\n\t\t{\n\t\t\tif(k <= fib[n-index-1])\n\t\t\t\tindex++;\n\t\t\telse\n\t\t\t{\n\t\t\t\tk -= fib[n-index-1]+1;\n\t\t\t\tswap(arr, index, index+1);\n\t\t\t}\n\t\t}\n\t\tfor(int v : arr) out.print(v + \" \");\n\t\tin.close();\n\t\tout.close();\n\t}\n\tvoid swap(int[] arr, int i, int j)\n\t{\n\t\tint temp = arr[i];\n\t\tarr[i] = arr[j];\n\t\tarr[j] = temp;\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "2b040cc65e18e03acd1fe659dc50465d", "src_uid": "e03c6d3bb8cf9119530668765691a346", "apr_id": "e5a08ab86485a42b618562c19223fb8c", "difficulty": 1900, "tags": ["math", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9868700946233404, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import com.sun.xml.internal.ws.handler.ServerLogicalHandlerTube;\nimport org.codehaus.groovy.classgen.asm.sc.StaticTypesBinaryExpressionMultiTypeDispatcher;\n\nimport java.io.*;\nimport java.util.InputMismatchException;\nimport java.util.Set;\nimport java.util.SortedSet;\nimport java.util.TreeSet;\n\npublic class Main extends IOException {\n public static void main(String[] args) throws IOException {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastScanner in = new FastScanner(inputStream);\n FastPrinter out = new FastPrinter(outputStream);\n TaskA solver = new TaskA();\n //int testCount = Integer.parseInt(in.next());\n //for (int i = 1; i <= testCount; i++)\n //solver.solve(i, in, out);\n solver.solve(1, in, out);\n out.close();\n }\n}\n\nclass TaskA {\n StringBuilder builder = new StringBuilder();\n private static final int LIMIT = 63;\n private static final long[] POW2 = new long[LIMIT];\n private static final long[] ONES = new long[LIMIT];\n\n public void solve(int testNumber, FastScanner in, FastPrinter out) {\n long a = in.nextLong();\n long b = in.nextLong();\n SortedSet set = new TreeSet<>();\n init();\n for (int i = 2; i < LIMIT; i++) {\n long full = ONES[i];\n for (int j = 0; j < i - 1; j++) {\n set.add(full - POW2[j]);\n }\n }\n int cnt = 0;\n for(Long num: set){\n if (num >= a && num <= b) cnt++;\n }\n builder.append(cnt);\n out.print(builder.toString());\n }\n private void init(){\n POW2[0] = 1;\n for (int i = 1; i < LIMIT; i++) {\n POW2[i] = 2 * POW2[i - 1];\n }\n for (int i = 0; i < LIMIT; i++) {\n ONES[i] = POW2[i] - 1;\n }\n }\n}\nclass Vector{\n double x, y, z;\n\n public Vector(double x, double y, double z) {\n this.x = x;\n this.y = y;\n this.z = z;\n }\n\n public double abs(){\n return Math.sqrt(x * x + y * y + z * z);\n }\n\n public double skalyarMultyply(Vector other){\n return (x * other.x + y * other.y + z * other.z);\n }\n\n public Vector vectorMultyply(Vector other){\n double i = y * other.z - z * other.y;\n double j = z * other.x - x * other.z;\n double k = x * other.y - y * other.x;\n return new Vector(i, j, k);\n }\n\n public double mixMultylpy(Vector b, Vector c){\n return this.skalyarMultyply(b.vectorMultyply(c));\n }\n}\nclass FastScanner extends BufferedReader {\n boolean isEOF;\n\n public FastScanner(InputStream is) {\n super(new InputStreamReader(is));\n }\n\n public FastScanner(InputStreamReader inputStreamReader) {\n super(inputStreamReader);\n }\n\n public int read() {\n try {\n int ret = super.read();\n if (isEOF && ret < 0) {\n throw new InputMismatchException();\n }\n isEOF = ret == -1;\n return ret;\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n }\n\n public String next() {\n StringBuilder sb = new StringBuilder();\n int c = read();\n while (isWhiteSpace(c)) {\n c = read();\n }\n while (!isWhiteSpace(c)) {\n sb.appendCodePoint(c);\n c = read();\n }\n return sb.toString();\n }\n\n public static boolean isWhiteSpace(int c) {\n return c >= -1 && c <= 32;\n }\n\n public static boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public int nextInt() {\n int c = read();\n while (isWhiteSpace(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int ret = 0;\n while (!isWhiteSpace(c)) {\n if (c < '0' || c > '9') {\n throw new NumberFormatException(\"digit expected \" + (char) c\n + \" found\");\n }\n ret = ret * 10 + c - '0';\n c = read();\n }\n return ret * sgn;\n }\n\n public double nextDouble() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n double res = 0;\n while (!isSpaceChar(c) && c != '.') {\n if (c == 'e' || c == 'E')\n return res * Math.pow(10, nextInt());\n if (c < '0' || c > '9')\n throw new UnknownError();\n res *= 10;\n res += c - '0';\n c = read();\n }\n if (c == '.') {\n c = read();\n double m = 1;\n while (!isSpaceChar(c)) {\n if (c == 'e' || c == 'E')\n return res * Math.pow(10, nextInt());\n if (c < '0' || c > '9')\n throw new UnknownError();\n m /= 10;\n res += (c - '0') * m;\n c = read();\n }\n }\n return res * sgn;\n }\n\n public long nextLong(){\n return Long.parseLong(next());\n }\n\n public int[] nextIntArray(int n){\n int[] ret = new int[n];\n for (int i = 0; i < n; i++) {\n ret[i] = nextInt();\n }\n return ret;\n }\n\n public long[] nextLongArray(int n) {\n long[] ret = new long[n];\n for (int i = 0; i < n; i++) {\n ret[i] = nextLong();\n }\n return ret;\n }\n}\n\nfinal class FastPrinter extends PrintWriter {\n public FastPrinter(OutputStream out) {\n super(out);\n }\n}\nclass Pair implements Comparable> {\n public final U first;\n public final V second;\n\n public static Pair makePair(U first, V second) {\n return new Pair(first, second);\n }\n\n private Pair(U first, V second) {\n this.first = first;\n this.second = second;\n }\n\n public boolean equals(Object o) {\n if (this == o) return true;\n if (o == null || getClass() != o.getClass()) return false;\n\n Pair pair = (Pair) o;\n\n return !(first != null ? !first.equals(pair.first) : pair.first != null) && !(second != null ? !second.equals(pair.second) : pair.second != null);\n\n }\n\n public int hashCode() {\n int result = first != null ? first.hashCode() : 0;\n result = 31 * result + (second != null ? second.hashCode() : 0);\n return result;\n }\n\n public String toString() {\n return \"(\" + first + \",\" + second + \")\";\n }\n\n public int compareTo(Pair o) {\n int value = ((Comparable)first).compareTo(o.first);\n if (value != 0)\n return value;\n return ((Comparable)second).compareTo(o.second);\n }\n}", "lang": "Java 8", "bug_code_uid": "cb7ca6d0e602d3dcccd0d167b84febbc", "src_uid": "581f61b1f50313bf4c75833cefd4d022", "apr_id": "22c6f43649da40050ac1ca1d6040e290", "difficulty": 1300, "tags": ["bitmasks", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9931623931623932, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.ArrayList;\nimport java.util.Scanner;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\n\npublic class NewYearAndOldProperty {\n\tstatic ArrayList key = new ArrayList<>();\n\tstatic TreeMap t = new TreeMap<>();\n\tstatic TreeSet temp = new TreeSet<>();\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tlong n = scan.nextLong(), m = scan.nextLong(); make(); ans();\n\t\tSystem.out.println(t.get(t.floorKey(m)) - t.get(t.ceilingKey(n)) + 1);\n\t}\n\tstatic void make(){\n\t\tlong n = 2;\n\t\tfor(int i = 0 ; Math.pow(n, i) < 2000000000000000000L ; i++) key.add((long) Math.pow(n, i));\n\t}\n\tstatic void ans(){\n\t\tfor(int i = 2 ; i < key.size() ; i++){\n\t\t\tchar[] num = Long.toBinaryString(key.get(i)-1).toCharArray();\n\t\t\tfor(int j = 1 ; j < num.length ; j++){\n\t\t\t\tnum[j] = '0';\n\t\t\t\ttemp.add(Long.parseLong(makeString(num), 2));\n\t\t\t\tnum[j] = '1';\n\t\t\t}\n\t\t}\n\t\tfor(int i = 1 ; !temp.isEmpty() ; i++){\n\t\t\tlong curr = temp.pollFirst();\n\t\t\tt.put(curr, i);\n\t\t}\n\t}\n\tstatic String makeString(char[] num){\n\t\tString curr = \"\";\n\t\tfor(int i = 0 ; i < num.length ; i++) curr+=num[i];\n\t\treturn curr;\n\t}\n}\n/*\n\n10\n101\n110\n\n*/", "lang": "Java 8", "bug_code_uid": "910a0a35845919c38f7d246afd538040", "src_uid": "581f61b1f50313bf4c75833cefd4d022", "apr_id": "5e8363ecf0528a98d0e94252b48da9c6", "difficulty": 1300, "tags": ["bitmasks", "brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.996996996996997, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "\n\n\nimport java.util.*;\npublic class test\n{\n public static void main(String args[])\n {\n\t Scanner s=new Scanner(System.in);\n\t long n=s.nextLong();\n\t // int n= Integer.parseInt(str);\n\t long x=n+1;\n\t if(x==1)\n\t\t Ssytem.out.print(0);\n\t else if(x%2==0)\n\t\t System.out.print(x/2);\n\t else\n\t\t System.out.print(x);\n }\n}", "lang": "Java 8", "bug_code_uid": "33e4acc94a8251242333a205e7e43f06", "src_uid": "236177ff30dafe68295b5d33dc501828", "apr_id": "eb4c9223fb87cb38d80092b1cb11b884", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8297142857142857, "equal_cnt": 24, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 17, "fix_ops_cnt": 23, "bug_source_code": "\nimport java.util.Scanner;\n\npublic class codeForce2 {\n public static void main(String[]args){\n Scanner sc= new Scanner(System.in);\n if(n!=0){\n long n=sc.nextLong();\n long temp1= (n+1);\n if ((n+1)%2==0){\n long temp= ((n+1)/2);\n System.out.println(temp);\n }\n\n else System.out.println(temp1);\n }\n else System.out.println(\"0\");\n }\n}\n", "lang": "Java 8", "bug_code_uid": "61c4f399706ebcc2e114802e7c63431a", "src_uid": "236177ff30dafe68295b5d33dc501828", "apr_id": "bee1f5aeb644109abe104e08d2e22804", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7835051546391752, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 9, "bug_source_code": "public class NewClass1 {\n \n public static void main(String[] args) {\n Scanner sc=new Scanner(System.in);\n int n=sc.nextInt();\n int cuts=0;\n if((n+1)%2==0){\n cuts=(n+1)/2;\n }\n else if((n+1)/2!=0){\n cuts=n+1;\n }\n System.out.println(cuts);\n }\n}", "lang": "Java 8", "bug_code_uid": "07f731da4d5c6f8fac5e136027df235a", "src_uid": "236177ff30dafe68295b5d33dc501828", "apr_id": "d60b2e4437fd84effb5233717bd6fe9c", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9871611982881597, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\npublic class susbus{\n public static void main(String[] args){\n Scanner sc =new Scanner(System.in);\n int n= sc.nextInt();\n System.out.println(powerthree(n,1000003);\n }\n public static int powerthree(int n,int mod){\n //3^n-1\n if(n==1) return 1;\n return 3*powerthree(n-1,mod)%mod;\n \n }\n}", "lang": "Java 8", "bug_code_uid": "4469b00e3de751007e0f52ddbccf708e", "src_uid": "1a335a9638523ca0315282a67e18eec7", "apr_id": "b9966ad3c8e2c8ea9904d963f519c175", "difficulty": 1300, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8292276964047937, "equal_cnt": 33, "replace_cnt": 24, "delete_cnt": 4, "insert_cnt": 5, "fix_ops_cnt": 33, "bug_source_code": "//import java.awt.Dimension;\nimport java.awt.Point;\nimport java.io.*;\nimport static java.lang.Math.*;\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\nimport static java.math.BigInteger.*;\nimport java.util.*;\nimport static java.util.Arrays.*;\n//import java.math.BigInteger;\n//import static java.lang.Character.*;\n//import static java.lang.Math.*;\n//import static java.math.BigInteger.*;\n\n//import static java.util.Arrays.*;\n\n//import java.awt.Point; // interger !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n//import java.awt.Polygon;\n//import java.awt.Rectangle;\n//import java.awt.geom.AffineTransform;\n//import java.awt.geom.Line2D;\n//import java.awt.geom.Point2D;\n//import javafx.scene.shape.Line;\n//import javafx.scene.transform.Rotate;\n\n//\npublic class Main implements Runnable{\n\n // https://netbeans.org/kb/73/java/editor-codereference_ru.html#display\n\n static boolean oj;\n \n @Override\n public void run(){\n try {\n Locale.setDefault(Locale.US);\n } catch (Exception e) {\n }\n oj = true;\n try {\n oj = System.getProperty(\"MYLOCAL\") == null;\n } catch (Exception e) {\n }\n//\n if (oj) {\n sc = new FastScanner(new InputStreamReader(System.in));\n out = new PrintWriter(new OutputStreamWriter(System.out));\n } else {\n try {\n sc = new FastScanner(new FileReader(\"input.txt\"));\n out = new PrintWriter(new FileWriter(\"output.txt\"));\n } catch (IOException e) {\n MLE();\n }\n }\n Solver s = new Solver();\n s.sc = sc;\n s.out = out;\n\n s.solve();\n if (!oj) {\n err.println(\"Time: \" + (System.currentTimeMillis() - timeBegin) / 1e3);\n err.printf(\"Mem: %d\\n\", (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) >> 20);\n }\n out.flush();\n }\n\n private void show(int[] arr) {\n for (int v : arr) {\n err.print(\" \" + v);\n }\n err.println();\n }\n\n public static void exit() {\n err.println(\"Time: \" + (System.currentTimeMillis() - timeBegin) / 1e3);\n err.printf(\"Mem: %d\\n\", (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) >> 20);\n out.flush();\n out.close();\n System.exit(0);\n }\n\n public static void MLE() {\n int[][] arr = new int[1024 * 1024][];\n for (int i = 0; i < arr.length; i++) {\n arr[i] = new int[1024 * 1024];\n }\n }\n\n public static void main(String[] args) throws FileNotFoundException {\n //new Main().run();\n new Thread(null, new Main(), \"myThread\", 100 * 1024 * 1024).start();\n }\n\n static long timeBegin = System.currentTimeMillis();\n static FastScanner sc;\n static PrintWriter out;\n static PrintStream err = System.err;\n}\n //\n\n//\nclass FastScanner {\n\n BufferedReader br;\n StringTokenizer st;\n\n FastScanner(InputStreamReader reader) {\n br = new BufferedReader(reader);\n st = new StringTokenizer(\"\");\n }\n\n String next() {\n while (!st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (Exception ex) {\n return null;\n }\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n try {\n return br.readLine();\n } catch (IOException ex) {\n return null;\n }\n }\n}\n//\n\nclass Solver {\n\n void aser(boolean OK) {\n if (!OK) {\n Main.MLE();\n }\n }\n\n FastScanner sc;\n PrintWriter out;\n static PrintStream err = System.err;\n\n class Item{\n long p;\n int alfa;\n\n public Item(long p, int alfa) {\n this.p = p;\n this.alfa = alfa;\n }\n\n @Override\n public String toString() {\n return p + \", \" + alfa;\n }\n \n }\n \n ArrayList getAllDiv(long A){\n TreeSet arr = new TreeSet<>();\n for( long d = 1; d*d <= A; ++d ){\n if( A % d == 0 ) {\n arr.add(d);\n arr.add(A/d);\n }\n }\n return new ArrayList<>(arr);\n }\n \n long myPow(long p, int alfa){\n long ans = 1;\n for (int i = 0; i < alfa; i++) {\n ans *= p;\n }\n return ans;\n }\n \n void solve(){\n final long A = sc.nextLong();\n ArrayList divA = getAllDiv(A);\n TreeMap> P = new TreeMap<>();\n for (long div : divA) {\n --div;\n for (int alfa = 1; alfa <= 60; alfa++) {\n long p = (long)pow( div, 1.0 / alfa );\n if( 2<=p && myPow(p,alfa)==div && valueOf(p).isProbablePrime(50) ){\n if( !P.containsKey(p) )\n P.put(p, new ArrayList<>());\n P.get(p).add(alfa);\n }\n }\n }\n \n long[] dp0, dp;\n dp0 = new long[divA.size()];\n dp0[0] = 1;\n for( long p : P.keySet() ){\n dp = dp0.clone();\n for( int alfa : P.get(p) ){\n long val = myPow(p, alfa) + 1;\n for( long div : divA ){\n if( 1e18 <= 1.0 * div * val ) continue;\n long toDiv = div * val;\n int ID = Collections.binarySearch(divA, div);\n int toID = Collections.binarySearch(divA, toDiv);\n if( 0 <= toID ){\n dp[toID] += dp0[ID];\n }\n }\n }\n //\n dp0 = dp;\n }\n out.println(dp0[divA.size() - 1]);\n }\n \n \n}\n\n\n", "lang": "Java 8", "bug_code_uid": "80bbd4bfd3c9ad2e093dfa5fa9e01dee", "src_uid": "1f68bd6f8b40e45a5bd360b03a264ef4", "apr_id": "7218b503aa4362929e42354999423961", "difficulty": 2600, "tags": ["dp", "hashing", "dfs and similar", "number theory", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.832225063938619, "equal_cnt": 17, "replace_cnt": 12, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 16, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\n\npublic class A_340 {\n FastScanner in;\n PrintWriter out;\n\n public void run() {\n try {\n in = new FastScanner(new InputStreamReader(System.in));\n out = new PrintWriter(System.out);\n solve();\n out.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n\n public void solve() throws IOException {\n int x = in.nextInt();\n int y = in.nextInt();\n int a = in.nextInt();\n int b = in.nextInt();\n int [] c = new int[b+1];\n int [] d = new int[b+1];\n int j = x;\n while (j <= b) {\n c[j] = 1;\n j +=x;\n }\n j = y;\n while (j <= b) {\n d[j] = 1;\n j += y;\n }\n int counter = 0;\n for (int i=a; i<=b; i++) {\n if (c[i] == 1 && d[i] == 1) {\n counter++;\n }\n }\n out.println(counter);\n }\n\n class FastScanner {\n BufferedReader br;\n StringTokenizer st;\n\n FastScanner(InputStreamReader in) {\n br = new BufferedReader(in);\n }\n\n String nextLine() {\n String str = null;\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n return str;\n }\n\n String next() {\n while (st == null || !st.hasMoreTokens()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n }\n\n public static void main(String[] arg) {\n A_340 o = new A_340();\n o.run();\n }\n\n}\n", "lang": "Java 7", "bug_code_uid": "d509a68a4a5ce3defa165d4edd8e27d1", "src_uid": "c7aa8a95d5f8832015853cffa1374c48", "apr_id": "e4d43664a657d09c815d5f08fc2f1922", "difficulty": 1200, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9571081469727774, "equal_cnt": 16, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 7, "fix_ops_cnt": 15, "bug_source_code": "import java.util.*;\nimport java.io.*;\nimport java.math.*;\n \n public class Sample implements Runnable\n {\n \n\n\n public static void solve()\n {\n int n=i(); int m=i();\n int[] a=new int[n];\n int[] b=new int[m];\n for(int i=0;ib[0])out.println(b[0]+\"\"+a[0]);\n else out.println(a[0]+\"\"+b[0]);\n }\n\n public void run()\n { \n solve();\n out.close();\n }\n\n public static void main(String[] args) throws IOException\n { \n new Thread(null, new Sample(), \"whatever\", 1<<26).start();\n }\n static class Pair implements Comparable\n {\n long a;\n int b;\n Pair(){}\n Pair(long a,int b)\n {\n this.a=a;\n this.b=b;\n }\n \n public int compareTo(Pair x)\n {\n return Long.compare(x.a,this.a);\n }\n }\n \n \n \n ////////////////////////////////////////////////////// Merge Sort ////////////////////////////////////////////////////////////////////////\n \n static class Merge \n {\n\n public static void sort(long inputArr[]) \n {\n int length = inputArr.length;\n doMergeSort(inputArr,0, length - 1);\n }\n\n private static void doMergeSort(long[] arr,int lowerIndex, int higherIndex) \n { \n if (lowerIndex < higherIndex) {\n int middle = lowerIndex + (higherIndex - lowerIndex) / 2;\n doMergeSort(arr,lowerIndex, middle);\n doMergeSort(arr,middle + 1, higherIndex);\n mergeParts(arr,lowerIndex, middle, higherIndex);\n }\n }\n\n private static void mergeParts(long[]array,int lowerIndex, int middle, int higherIndex) \n {\n long[] temp=new long[higherIndex-lowerIndex+1];\n for (int i = lowerIndex; i <= higherIndex; i++) \n {\n temp[i-lowerIndex] = array[i];\n }\n int i = lowerIndex;\n int j = middle + 1;\n int k = lowerIndex;\n while (i <= middle && j <= higherIndex) \n {\n if (temp[i-lowerIndex] < temp[j-lowerIndex]) \n {\n array[k] = temp[i-lowerIndex];\n i++;\n } else {\n array[k] = temp[j-lowerIndex];\n j++;\n }\n k++;\n }\n while (i <= middle) \n {\n array[k] = temp[i-lowerIndex];\n k++;\n i++;\n }\n while(j<=higherIndex)\n {\n array[k]=temp[j-lowerIndex];\n k++;\n j++;\n }\n }\n\n }\n \n \n /////////////////////////////////////////////////////////// Methods ////////////////////////////////////////////////////////////////////////\n\n\n static boolean isPal(String s)\n {\n for(int i=0, j=s.length()-1;i<=j;i++,j--)\n {\n if(s.charAt(i)!=s.charAt(j)) return false;\n }\n return true;\n }\n static String rev(String s)\n {\n StringBuilder sb=new StringBuilder(s);\n sb.reverse();\n return sb.toString();\n }\n static int gcd(int a,int b){return (a==0)?b:gcd(b%a,a);}\n static long gcdExtended(long a,long b,long[] x)\n {\n\n if(a==0){\n x[0]=0;\n x[1]=1;\n return b;\n }\n long[] y=new long[2];\n long gcd=gcdExtended(b%a, a, y);\n\n x[0]=y[1]-(b/a)*y[0];\n x[1]=y[0];\n\n return gcd;\n }\n\n boolean findSum(int set[], int n, long sum)\n {\n if (sum == 0)\n return true;\n if (n == 0 && sum != 0)\n return false;\n if (set[n-1] > sum)\n return findSum(set, n-1, sum);\n return findSum(set, n-1, sum) ||findSum(set, n-1, sum-set[n-1]);\n }\n \n public static long modPow(long base, long exp, long mod)\n {\n base = base % mod;\n long result = 1;\n while (exp > 0)\n {\n if (exp % 2 == 1) \n {\n result = (result * base) % mod;\n }\n base = (base * base) % mod;\n exp = exp >> 1;\n }\n return result;\n }\n \n static long[] fac;\n static long[] inv;\n static long mod=(long)1e9+7;\n public static void cal() \n {\n fac = new long[1000005];\n inv = new long[1000005];\n fac[0] = 1;\n inv[0] = 1;\n for (int i = 1; i <= 1000000; i++)\n {\n fac[i] = (fac[i - 1] * i) % mod;\n inv[i] = (inv[i - 1] * modPow(i, mod - 2, mod)) % mod;\n }\n }\n \n public static long ncr(int n, int r) \n {\n return (((fac[n] * inv[r]) % mod) * inv[n - r]) % mod;\n }\n\n \n////////////////////////////////////////// Input Reader ////////////////////////////////////////////////////////////////////////////////////////////////////\n \n static InputReader sc = new InputReader(System.in);\n static PrintWriter out= new PrintWriter(System.out); \n \n static class InputReader {\n\n private final InputStream stream;\n private final byte[] buf = new byte[8192];\n private int curChar, snumChars;\n private SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int snext()\n {\n if (snumChars == -1)\n throw new InputMismatchException();\n if (curChar >= snumChars) {\n curChar = 0;\n try {\n snumChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (snumChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int nextInt()\n {\n int c = snext();\n while (isSpaceChar(c)) \n {\n c = snext();\n }\n int sgn = 1;\n if (c == '-')\n {\n sgn = -1;\n c = snext();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = snext();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long nextLong() \n {\n int c = snext();\n while (isSpaceChar(c)) \n {\n c = snext();\n }\n int sgn = 1;\n if (c == '-') \n {\n sgn = -1;\n c = snext();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = snext();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public int[] nextIntArray(int n)\n {\n int a[] = new int[n];\n for (int i = 0; i < n; i++) \n {\n a[i] = nextInt();\n }\n return a;\n }\n\n public long[] nextLongArray(int n)\n {\n long a[] = new long[n];\n for (int i = 0; i < n; i++) \n {\n a[i] = nextLong();\n }\n return a;\n }\n\n \n public String nextLine()\n {\n int c = snext();\n while (isSpaceChar(c))\n c = snext();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = snext();\n } while (!isEndOfLine(c));\n return res.toString();\n }\n\n public boolean isSpaceChar(int c) \n {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n private boolean isEndOfLine(int c) \n {\n return c == '\\n' || c == '\\r' || c == -1;\n }\n\n public interface SpaceCharFilter \n {\n public boolean isSpaceChar(int ch);\n }\n\n }\n\n static int i()\n {\n return sc.nextInt();\n }\n static long l(){\n return sc.nextLong();\n }\n static int[] iarr(int n)\n {\n return sc.nextIntArray(n);\n }\n static long[] larr(int n)\n {\n return sc.nextLongArray(n);\n }\n static String s(){\n return sc.nextLine();\n }\n \n \n } ", "lang": "Java 8", "bug_code_uid": "014f90ac5809251e77774441979ea9c0", "src_uid": "3a0c1b6d710fd8f0b6daf420255d76ee", "apr_id": "5684c463658e88a2c1a451f504e6918b", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9338959212376934, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "\nimport java.util.*;\nimport java.io.*;\nimport static java.lang.Math.*;\n\npublic class main {\n\t\n\tpublic static void main(String args[])\n\t{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tint a=1,b=1;\n\t\tint ans=0;\n\t\twhile(true)\n\t\t{\n\t\t\tint c=a+b;\n\t\t\tif(c<=n)\n\t\t\t\tans++;\n\t\t\telse\n\t\t\t\tbreak;\n\t\t\ta=b;\n\t\t\tb=c;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "827cf3d6aa3876fc3e7032bc8b528872", "src_uid": "3d3432b4f7c6a3b901161fa24b415b14", "apr_id": "f6b287d03a732d063b1c7e9088f04e29", "difficulty": 1600, "tags": ["math", "combinatorics", "greedy", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9654178674351584, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import com.sun.xml.internal.ws.util.StringUtils;\nimport java.util.*;\n \n/**\n *\n * @author Lenovo\n */\npublic class JavaApplication2 {\n \n \n public static void main(String[] args) {\n String x;\n Scanner in=new Scanner (System.in);\n x=in.next();\n int z=1;\n String aw=x;\n aw=aw.charAt(aw.length()-1)+charRemoveAt(aw,aw.length()-1);\n while (true){\n \n if(aw == null ? x == null : aw.equals(x))break;\n else {z++;\n aw=aw.charAt(aw.length()-1)+charRemoveAt(aw,aw.length()-1);\n \n }\n }\n \n System.out.println(z);\n}\n public static String charRemoveAt(String str, int p) { \n return str.substring(0, p) + str.substring(p + 1); \n } \n\n\n}", "lang": "Java 8", "bug_code_uid": "93f35c7d52f70ab874944bb88d15a3b1", "src_uid": "8909ac99ed4ab2ee4d681ec864c7831e", "apr_id": "f0c3138c8eb2f0888ae62ec39c8a326a", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.7916666666666666, "equal_cnt": 11, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "//package cf820;\n\nimport java.io.BufferedReader;\nimport java.io.File;\nimport java.io.FileInputStream;\nimport java.io.FileNotFoundException;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.Reader;\nimport java.util.StringTokenizer;\n\npublic class B {\n\tstatic int M, B, maxX, maxY;\n\tstatic long a[][];\n\tpublic static void main(String[] args) throws FileNotFoundException {\n\t\tInputStream is = System.in;\n//\t\tis = new FileInputStream(new File(\"A.txt\"));\n\t\tFastScanner sc = new FastScanner(new InputStreamReader(is));\n\t\tM = sc.nextInt();\n\t\tB = sc.nextInt();\n\t\tmaxX=M*B;\n\t\tmaxY=B;\n\t\ta=new long[maxY+1][maxX+1];\n\t\tfor (int i=1; i<=maxY; i++) a[i][0]=i+a[i-1][0];\n\t\tfor (int i=1; i<=maxX; i++) a[0][i]=i+a[0][i-1];\n\t\tlong max=0;\n\t\tfor (int x=maxX/2; x<=maxX; x++) {\n\t\t\tint y = Y(x);\n\t\t\tmax = Math.max(max, s(x,y));\n\t\t}\n\t\tSystem.out.println(max);\n\t}\n\tstatic long s(int x, int y) {\n\t\treturn (x+1)*a[y][0] +(y+1)*a[0][x];\n\t}\n\tstatic int Y(int x) {\n\t\tdouble m=M*1.0;\n\t\tdouble X = 1.0*x;\n\t\tdouble Y = B-(1.0*X/m);\n\t\tint y = (int)Y;\n\t\tif (y>Y) y--;\n\t\treturn y;\n\t}\n\tstatic class FastScanner {\n\t BufferedReader br;\n\t StringTokenizer st;\n\n\t FastScanner(Reader in) {\n\t br = new BufferedReader(in);\n\t }\n\n\t String next() {\n\t while (st == null || !st.hasMoreTokens()) {\n\t try {\n\t st = new StringTokenizer(br.readLine());\n\t } catch (IOException e) {\n\t e.printStackTrace();\n\t }\n\t }\n\t return st.nextToken();\n\t }\n\n\t int nextInt() {\n\t return Integer.parseInt(next());\n\t }\n\t}\n\n}\n\n", "lang": "Java 8", "bug_code_uid": "01f9e250fb68c679b875bdcb7b01a503", "src_uid": "9300f1c07dd36e0cf7e6cb7911df4cf2", "apr_id": "37d7f6b82411187ffe5be662833e4800", "difficulty": 1300, "tags": ["math", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.47639034627492133, "equal_cnt": 23, "replace_cnt": 18, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 23, "bug_source_code": "import java.util.*;\nimport java.lang.*;\nimport java.io.*;\n\npublic class main1 {\n\tpublic static void main (String[] args) {\n\t Scanner sc=new Scanner(System.in);\n\t Hashtable> h1=new Hashtable();\n\t \n\t int m=sc.nextInt();\n int b=sc.nextInt();\n int y=b;\n int x=(b)*m;\n int arr[][]=new int[x+1][y+1];\n int max=0;\n arr[0][0]=0;\n for(int i=1;i<=x;i++){\n \tarr[i][0]=i+arr[i-1][0];\n \tif(max=0;d--) {\n\t\t\t\t\t\n\t\t\t\t\tfor(int e=x;e>=0;e--) {\n\t\t\t\t\t\t\n\t\t\t\t\t\tsums[x][y] += e+d;\n\t\t\t\t\t}\t\t\n\t\t\t\t}\n\t\t\t}\t\n\t\t}\n\t\t\n\t\tint max=0;\n\t\t\n\t\tfor(int i=0;imax)\n\t\t\t\t\t\n\t\t\t\t\tmax=sums[i][j];\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.print(max);\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "0a30d681a97987c58c1f3be1807898fb", "src_uid": "9300f1c07dd36e0cf7e6cb7911df4cf2", "apr_id": "55c999b6fc3cee834ec74d46a984c26f", "difficulty": 1300, "tags": ["math", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.216252518468771, "equal_cnt": 16, "replace_cnt": 14, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 16, "bug_source_code": "import java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Scanner;\n\npublic class C {\n\n\tpublic static void main(String[] args) {\n\t\tnew C();\n\t}\n\t\n\tC() {\n\t\t\n\t\tScanner in = new Scanner(System.in);\n\t\t\n\t\tint len = in.nextInt();\n\t\tint rem = 0,count=0;\n\t\tArrayList a = new ArrayList(len);\n\t\t\n\t\tfor(int t=0;t<2*len;t++){\n\t\t\t//System.out.println(a);\n\t\t\tif(in.next().equals(\"add\")){\n\t\t\t\tint n = in.nextInt()-1;\n\t\t\t\ta.add(n);\n\t\t\t}else{ //remove\n\t\t\t\tif(a.get(a.size()-1)!=rem++){\n\t\t\t\t\tCollections.sort(a,Collections.reverseOrder());\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\ta.remove(a.size()-1);\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(count);\n\t\t\n\t\tin.close();\n\n\t}\n\t\n}\n\n/*\n\n3\nadd 1\nremove\nadd 2\nadd 3\nremove\nremove\n\n7\nadd 3\nadd 2\nadd 1\nremove\nadd 4\nremove\nremove\nremove\nadd 6\nadd 7\nadd 5\nremove\nremove\nremove\n\n */\n\n\n\n\n\n\n\n\n\n\n\n\n", "lang": "Java 8", "bug_code_uid": "3bd6cc32ba1f948cb01d7385cac82f22", "src_uid": "9300f1c07dd36e0cf7e6cb7911df4cf2", "apr_id": "1b6cf4df1f9b3d1a9410ddd7e892a52b", "difficulty": 1300, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8537170263788969, "equal_cnt": 10, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "\nimport java.io.*;\nimport java.util.*;\n\n/*\nSolution Sketch:\n*/\n\npublic class banana {\n\n\tstatic final boolean stdin = true;\n\tstatic final String filename = \"\";\n\tstatic FastScanner br;\n\tstatic PrintWriter pw;\n\n\tpublic static void main(String[] args) throws IOException {\n\n\t\tif (stdin) {\n\t\t\tbr = new FastScanner();\n\t\t\tpw = new PrintWriter(new OutputStreamWriter(System.out));\n\t\t}\n\n\t\telse {\n\t\t\tbr = new FastScanner(filename + \".in\");\n\t\t\tpw = new PrintWriter(new FileWriter(filename + \".out\"));\n\t\t}\n\n\t\tX solver = new X();\n\t\tsolver.solve(br, pw);\n\t}\n\n\tstatic class X {\n\t\tstatic int m,b;\n\t\tpublic void solve(FastScanner br, PrintWriter pw) throws IOException {\n\t\t\tm = br.nextInt();\n\t\t\tb = br.nextInt();\n\t\t\tint[][] pre = new int[m*b+1][b+1];\n\t\t\tfor(int i = 1; i <= m*b; i++) {\n\t\t\t\tpre[i][0] = pre[i-1][0] + i;\n\t\t\t\tif(i <= b) {\n\t\t\t\tpre[0][i] = pre[0][i-1] + i;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(int i = 1; i <= m*b; i++) {\n\t\t\t\tfor(int j = 1; j <= b; j++) {\n\t\t\t\t\tpre[i][j] = (pre[i-1][j] + pre[i][j-1] + (i+j))-pre[i-1][j-1];\n\t\t\t\t}\n\t\t\t}\n\t\t\tint mx = 0;\n\t\t\tfor(int x = 0; x <= m*b; x+= m) {\n\t\t\t\tint y = gy(x);\n//\t\t\t\tpw.println(x + \" \" + y + \" \" + pre[x][y]);\n\t\t\t\tmx = Math.max(mx, pre[x][y]);\n\t\t\t}\n\t\t\tpw.println(mx);\n\t\t\tpw.close();\n\t\t}\n\t\tpublic static int gy(int x) {\n\t\t\treturn (-1 * (x/m))+b;\n\t\t}\n\n\t}\n\n\t//fastscanner class\n\tpublic static class FastScanner {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tpublic FastScanner(String s) {\n\t\t\ttry {\n\t\t\t\tbr = new BufferedReader(new FileReader(s));\n\t\t\t} catch (FileNotFoundException e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\n\t\tpublic FastScanner() {\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t}\n\n\t\tString nextToken() {\n\t\t\twhile (st == null || !st.hasMoreElements()) {\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tint nextInt() {\n\t\t\treturn Integer.parseInt(nextToken());\n\t\t}\n\n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(nextToken());\n\t\t}\n\n\t\tdouble nextDouble() {\n\t\t\treturn Double.parseDouble(nextToken());\n\t\t}\n\t}\n\n}\n \n\n", "lang": "Java 8", "bug_code_uid": "a0ac1e0fe5d9b320f540cdaa9c78f4f8", "src_uid": "9300f1c07dd36e0cf7e6cb7911df4cf2", "apr_id": "5f6f2da76ecede8c2d0a5a8be9560df0", "difficulty": 1300, "tags": ["math", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.4643572860005726, "equal_cnt": 11, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "import java.util.*; \npublic class FindtheBug{ \n\t public static void main(String[] args) {\n\t // Use the Scanner class\n\t Scanner in = new Scanner(System.in);\n\t int digits = in.nextInt();\n\t int nums[] = new int[digits];\n\t String val = in.next();\n\t int total = 1;\n\t for(int i = 0; i < digits; i++){\n\t \tnums[i] = Integer.parseInt(\"\"+val.charAt(i));\n\t \tif(nums[i] == 2)\n\t \t\ttotal *= 2;\n\t \telse if(nums[i] == 3)\n\t \t\ttotal *= 6;\n\t \telse if(nums[i] == 4)\n\t \t\ttotal *= 24;\n\t \telse if(nums[i] == 5)\n\t \t\ttotal *= 120;\n\t \telse if(nums[i] == 6)\n\t \t\ttotal *= 720;\n\t \telse if(nums[i] == 7)\n\t \t\ttotal *= 5040;\n\t \telse if(nums[i] == 8)\n\t \t\ttotal *= 40320;\n\t \telse if(nums[i] == 9)\n\t \t\ttotal *= 362880;\n\t \telse\n\t \t\ttotal *= 1;\n\t }\n\t while(total != 1){\n\t \tif(total % 5040 == 0){\n\t \t\tSystem.out.print(7);\n\t \t\ttotal /= 5040;\n\t \t}\n\t \telse if(total % 120 == 0){\n\t \t\tSystem.out.print(5);\n\t \t\ttotal /= 120;\n\t \t}\n\t \telse if(total % 6 == 0){\n\t \t\tSystem.out.print(3);\n\t \t\ttotal /= 6;\n\t \t}\n\t \telse if(total % 2 == 0){\n\t \t\tSystem.out.print(2);\n\t \t\ttotal /= 2;\n\t \t}\n\t \t\n\t }\n \n\t /*\n\t int n = sc.nextInt(); // read input as integer\n\t long k = sc.nextLong(); // read input as long\n\t double d = sc.nextDouble(); // read input as double\n\t String str = sc.next(); // read input as String\n\t String s = sc.nextLine(); // read whole line as String\n\t */\n\t }\n}\n", "lang": "Java 8", "bug_code_uid": "dcb21c1d5af572bf761ad2e179f75c09", "src_uid": "60dbfc7a65702ae8bd4a587db1e06398", "apr_id": "bce87dc73c957d05548fc46f01e454fd", "difficulty": 1400, "tags": ["greedy", "math", "sortings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.4068230277185501, "equal_cnt": 22, "replace_cnt": 13, "delete_cnt": 3, "insert_cnt": 7, "fix_ops_cnt": 23, "bug_source_code": "import java.util.*;\npublic class _515C_Drazil_and_Factorial {\n public static int f[]=new int[100];\n public static void factorial()\n {\n f[1]=1;\n int i;\n for (i=2;i<=9;i++)\n f[i]=f[i-1]*i;\n }\n public static void main(String[] args) {\n factorial();\n Scanner input= new Scanner (System.in);\n int n= input.nextInt();\n String a= input.next();\n int i,s=1,Max=0;\n for (i=0;i=2;i--)\n if (s%f[i]==0)\n {\n s/=f[i];\n System.out.print(i);\n i=Max;\n }\n input.close();\n }\n}\n", "lang": "Java 8", "bug_code_uid": "9e7077b82049523e9c47114bc6c80493", "src_uid": "60dbfc7a65702ae8bd4a587db1e06398", "apr_id": "026d8085fa4529556e1c59e4f1aa8e64", "difficulty": 1400, "tags": ["greedy", "math", "sortings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.4826711749788673, "equal_cnt": 14, "replace_cnt": 5, "delete_cnt": 5, "insert_cnt": 4, "fix_ops_cnt": 14, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class pipeline {\n static long N, K;\n static boolean[] used;\n static long currentPipes, currentSplit;\n \n public static void main(String[] args) throws IOException {\n BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n //BufferedReader in = new BufferedReader(new FileReader(\"pipeline.in\"));\n StringTokenizer st = new StringTokenizer(in.readLine());\n N = Long.parseLong(st.nextToken());\n K = Long.parseLong(st.nextToken());\n used = new boolean[(int) (K+1)];\n Arrays.fill(used, false);\n used[0] = true;\n currentPipes = 1;\n currentSplit = 0;\n \n if (K*K - K + 2 < 2*N) {\n System.out.println(-1);\n System.exit(0);\n }\n while (N != currentPipes) {\n for (long i = Math.min(N-currentPipes+1, K); i > 1; i--) {\n if (!used[(int) i]) {\n currentPipes = currentPipes + i - 1;\n currentSplit++;\n used[(int) i] = true;\n break;\n }\n \n if (i == 2) {\n System.out.println(-1);\n System.exit(0);\n }\n }\n \n if (N == currentPipes) {\n System.out.println(currentSplit);\n break;\n }\n }\n System.exit(0);\n }\n}\n", "lang": "Java 6", "bug_code_uid": "caca701999e05610f402bb30e255e435", "src_uid": "83bcfe32db302fbae18e8a95d89cf411", "apr_id": "3b2a02c239e864b8f6cbd405a642435e", "difficulty": 1700, "tags": ["math", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9486692015209125, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package ru.spb.bourevestnik.ar35.scada.util.printer;\n\nimport java.util.Scanner;\n\n/**\n * Created by plahotnik_dy on 21.12.2016.\n */\n\npublic class CodeForce {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int pixelsCount = in.nextInt();\n\n for (int rowCount = (int)Math.sqrt(pixelsCount); rowCount > 0; rowCount--) {\n if (pixelsCount % rowCount == 0) {\n System.out.println(rowCount + \" \" + pixelsCount / rowCount);\n return;\n }\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "3eb0d1c0634ddbaad030f230537527c0", "src_uid": "f52af273954798a4ae38a1378bfbf77a", "apr_id": "a96e2ba9d0477f6704b7deb6546c80fb", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9996882793017456, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "\nimport java.awt.AWTException;\nimport java.awt.Robot;\nimport java.awt.event.InputEvent;\nimport java.awt.event.KeyEvent;\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.math.BigInteger;\nimport java.net.InetAddress;\nimport java.net.UnknownHostException;\nimport java.util.ArrayDeque;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Iterator;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.PriorityQueue;\nimport java.util.Queue;\nimport java.util.Set;\nimport java.util.StringTokenizer;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\nimport java.util.Vector;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\npublic class Main {\n\n \n public static void main(String[] args) throws InterruptedException, AWTException, UnknownHostException {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n PrintWriter out = new PrintWriter(outputStream);\n InputReader in = new InputReader(inputStream);\n \n int n = in.nextInt();\n int min = Integer.MAX_VALUE, a = 0, b;\n for(int i = 2; i <= Math.sqrt(n); i++) {\n if(n % i == 0) {\n a = i;\n }\n }\n out.println(a + \" \" + n/a);\n out.close();\n }\n\n static class InputReader {\n\n BufferedReader reader;\n StringTokenizer tokenizer;\n\n public InputReader(InputStream inputStream) {\n reader = new BufferedReader(new InputStreamReader(inputStream), 32624);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException ex) {\n Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n private long nextLong() {\n return Long.parseLong(next());\n }\n\n private double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public int[] nextArray(int n) {\n int[] a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = nextInt();\n }\n return a;\n }\n\n public double[] nextArrayd(int n) {\n double[] a = new double[n];\n for (int i = 0; i < n; i++) {\n a[i] = nextDouble();\n }\n return a;\n }\n\n private BigInteger nextBigInteger() {\n return new BigInteger(next());\n }\n public void printAr(long[] a) {\n System.out.print(\"[\");\n for(long x : a)System.out.print(x + \",\");\n System.out.print(\"]\");\n }\n }\n\n}\n", "lang": "Java 8", "bug_code_uid": "97f1893b9f6bece5dd6122c42728ee14", "src_uid": "f52af273954798a4ae38a1378bfbf77a", "apr_id": "5af3461e46d8c052aa092bcb26f6a56c", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9865831842576028, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "import javax.swing.plaf.basic.BasicButtonUI;\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) throws IOException {\n Scanner scanner = new Scanner(System.in);\n int min = 1001, max =0, kupil, prod, ost;\n int utr[] = new int[30];\n int vetr[] = new int[30];\n int n = scannernextInt();\n int m = scanner.nextInt();\n int r = scanner.nextInt();\n\n for(int i =0; i < n; i++){\n utr[i] = scanner.nextInt();\n if(utr[i] < min)\n min = utr[i];\n }\n\n for(int i = 0; i < m; i++){\n vetr[i] = scanner.nextInt();\n if(vetr[i] > max)\n max = vetr[i];\n }\n\n if(min > r){\n System.out.println(r);\n return 0;\n }\n\n kupil = r / min;\n ost = r % min;\n\n prod = kupil * max + ost;\n\n if(prod <= r){\n System.out.println(r);\n }\n System.out.println(prod);\n\n \n\n\n\n }\n}\n", "lang": "Java 8", "bug_code_uid": "95c4bc058acba310f65bdfaf701a66d1", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "apr_id": "e3a52ba627eb78248b69fda042a4dc52", "difficulty": 800, "tags": ["greedy", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.6021978021978022, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*;\npublic class Main{\n public static void main(String[]args){\n Scanner sc=new Scanner(System.in);\n int n=sc.nextInt();\n int m=sc.nextInt();\n int r=sc.nextInt();\n \n int min=0;\n for (int i=1;i<=n;i++){\n int s=sc.nextInt();\n if(sset=new HashSet();\npublic static class FastReader {\n\tBufferedReader br;\n\tStringTokenizer st;\n\t//it reads the data about the specified point and divide the data about it ,it is quite fast\n\t//than using direct \n\n\tpublic FastReader() {\n\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t}\n\n\tString next() {\n\t\twhile (st == null || !st.hasMoreTokens()) {\n\t\t\ttry {\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t} catch (Exception r) {\n\t\t\t\tr.printStackTrace();\n\t\t\t}\n\t\t}\n\t\treturn st.nextToken();\n\t}\n\n\tint nextInt() {\n\t\treturn Integer.parseInt(next());//converts string to integer\n\t}\n\n\tdouble nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}\n\n\tlong nextLong() {\n\t\treturn Long.parseLong(next());\n\t}\n\n\tString nextLine() {\n\t\tString str = \"\";\n\t\ttry {\n\t\t\tstr = br.readLine();\n\t\t} catch (Exception r) {\n\t\t\tr.printStackTrace();\n\t\t}\n\t\treturn str;\n\t}\n}\nstatic ArrayListlist1=new ArrayList();\nstatic void combine(String instr, StringBuffer outstr, int index,int k)\n{\n\tif(outstr.length()==k)\n\t{\n\t\tlist1.add(outstr.toString());return;\n\t}\n\tif(outstr.toString().length()==0)\n\toutstr.append(instr.charAt(index));\n for (int i = 0; i < instr.length(); i++)\n {\n outstr.append(instr.charAt(i));\n \n combine(instr, outstr, i + 1,k);\n outstr.deleteCharAt(outstr.length() - 1);\n }\n index++;\n} \nstatic ArrayList>l=new ArrayList<>();\nstatic void comb(int n,int k,int ind,ArrayListlist)\n{\n\tif(k==0)\n\t{\n\t\tl.add(new ArrayList<>(list));\n\n\t\treturn;\n\t}\n\t\n\t\n\tfor(int i=ind;i<=n;i++)\n\t{\n\t\tlist.add(i);\n\t\tcomb(n,k-1,ind+1,list);\n\t\t\n\t\tlist.remove(list.size()-1);\n\t\t\n\t}\n\t\n\t\n\t\n\t\n\t\n\n}\nstatic long sum(long n)\n{\n\tlong sum=0;\n\twhile(n!=0)\n\t{\n\t\tsum+=n%10;\n\t\tn/=10;\n\t}\n\treturn sum;\n}\n\n\nstatic boolean check(HashMapmap)\n{\n\tfor(int h:map.values())\n\t\tif(h>1)\n\t\t\treturn false;\n\treturn true;\n}\n\nstatic class Pair implements Comparable{\n int x;int y;\n Pair(int x,int y){\n this.x=x;\n this.y=y;\n // this.i=i;\n }\n\t@Override\n\tpublic int compareTo(Pair o) {\n\t\t// TODO Auto-generated method stub\n\t\treturn x-o.x;\n\t\t\n\t}\n}\n\npublic static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\n\tFastReader in=new FastReader();\n\tArrayListlist=new ArrayList();\n\tint n=in.nextInt();\n\tint m=in.nextInt();\n\tint r=in.nextInt();\n\tfor(int i=0;i= 0) {\n int how = r / min;\n r -= (how * min);\n how *= max;\n r += how;\n ans = Math.max(ans, r);\n }\n out.println(ans);\n }\n\n }\n\n static class ScanReader {\n private byte[] buf = new byte[4 * 1024];\n private int index;\n private BufferedInputStream in;\n private int total;\n\n public ScanReader(InputStream inputStream) {\n in = new BufferedInputStream(inputStream);\n }\n\n private int scan() {\n if (index >= total) {\n index = 0;\n try {\n total = in.read(buf);\n } catch (Exception e) {\n e.printStackTrace();\n }\n if (total <= 0) return -1;\n }\n return buf[index++];\n }\n\n public int scanInt() {\n int integer = 0;\n int n = scan();\n while (isWhiteSpace(n)) n = scan();\n int neg = 1;\n if (n == '-') {\n neg = -1;\n n = scan();\n }\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n integer *= 10;\n integer += n - '0';\n n = scan();\n }\n }\n return neg * integer;\n }\n\n private boolean isWhiteSpace(int n) {\n if (n == ' ' || n == '\\n' || n == '\\r' || n == '\\t' || n == -1) return true;\n else return false;\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "cb2752f39fb80f4e244ba4de64dcd365", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "apr_id": "3af3e7633b4685f520dea93b830cf4f1", "difficulty": 800, "tags": ["greedy", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9540810839875256, "equal_cnt": 14, "replace_cnt": 6, "delete_cnt": 4, "insert_cnt": 4, "fix_ops_cnt": 14, "bug_source_code": "/**\n * Created with IntelliJ IDEA.\n * User: Zakhar_Voit\n * Date: 21.04.12\n * Time: 1:48\n */\n\nimport java.io.*;\nimport java.util.*;\n\nimport static java.lang.System.exit;\n\npublic class C {\n\n\n class Pair implements Comparable {\n long u;\n long v;\n\n public Pair(long u, long v) {\n this.u = u;\n this.v = v;\n }\n\n public int hashCode() {\n int hu = (int) (u ^ (u >>> 32));\n int hv = (int) (v ^ (v >>> 32));\n return (int) (hu * 31 + hv);\n }\n\n public boolean equals(Object o) {\n Pair other = (Pair) o;\n return u == other.u && v == other.v;\n }\n\n public int compareTo(Pair other) {\n if (u != other.u)\n return u < other.u ? -1 : 1;\n\n return v < other.v ? -1 : v > other.v ? 1 : 0;\n }\n\n public String toString() {\n return \"[u=\" + u + \", v=\" + v + \"]\";\n }\n\n }\n\n BufferedReader in;\n PrintWriter out;\n StringTokenizer st = new StringTokenizer(\"\");\n\n public void openIO() throws IOException {\n if (new File(\"input.txt\").exists()) {\n System.setIn(new FileInputStream(\"input.txt\"));\n out = new PrintWriter(new BufferedWriter(new FileWriter(\"output.txt\")));\n } else {\n out = new PrintWriter(System.out);\n }\n in = new BufferedReader(new InputStreamReader(System.in));\n }\n\n String nextToken() throws IOException {\n while (!st.hasMoreTokens())\n st = new StringTokenizer(in.readLine());\n return st.nextToken();\n }\n\n int nextInt() throws IOException {\n return Integer.parseInt(nextToken());\n }\n\n long nextLong() throws IOException {\n return Long.parseLong(nextToken());\n }\n\n double nextDouble() throws IOException {\n return Double.parseDouble(nextToken());\n }\n\n String nextLine() throws IOException {\n st = new StringTokenizer(\"\");\n return in.readLine();\n }\n\n boolean EOF() throws IOException {\n while (!st.hasMoreTokens()) {\n String s = in.readLine();\n if (s == null)\n return true;\n st = new StringTokenizer(s);\n }\n return false;\n }\n\n\n int n, m, k, ans = 0;\n int[][] a, b, c, p;\n int number[][];\n\n static void swap(int[] a, int i, int j) {\n int t = a[j];\n a[j] = a[i];\n a[i] = t;\n }\n\n void init() {\n\n }\n\n void read() throws IOException {\n n = nextInt();\n m = nextInt();\n k = nextInt();\n a = new int[n][m];\n b = new int[n][m];\n c = new int[n][m];\n number = new int[n][m];\n p = new int[n][m];\n for (int i = 0; i < n; i++) {\n nextLine();\n for (int j = 0; j < m; j++) {\n a[i][j] = nextInt();\n b[i][j] = nextInt();\n c[i][j] = nextInt();\n }\n }\n }\n\n void solve() {\n for (int i = 0; i < n; i++) {\n for (int j = i + 1; j < n; j++) {\n int[] diff = new int[m], cnt = c[i];\n for (int k = 0; k < m; k++) {\n diff[k] = b[j][k] - a[i][k];\n }\n for (int t = 0; t < m; t++) {\n for (int c = 0; c + 1< m; c++) {\n if (diff[c] < diff[c + 1]) {\n swap(diff, c, c + 1);\n swap(cnt, c, c + 1);\n }\n }\n }\n int cur = 0, profit = 0, idx = 0;\n while (cur < k && idx < m) {\n int lastcur = cur;\n cur += Math.min(k - lastcur, c[i][idx]);\n profit += Math.min(k - lastcur, c[i][idx]) * diff[idx];\n idx++;\n }\n p[j][i] = p[i][j] = Math.max(p[j][i], profit);\n }\n }\n }\n\n void write() {\n for (int i = 0; i < n; i++) {\n int mx = 0;\n for (int j = 0; j < n; j++) {\n mx = Math.max(mx, p[i][j]);\n }\n ans = Math.max(mx, ans);\n }\n out.println(ans);\n }\n\n public void run() throws IOException {\n openIO();\n init();\n read();\n solve();\n write();\n out.close();\n }\n\n static public void main(String[] args) throws IOException {\n new Thread(null, new Runnable() {\n public void run() {\n try {\n new C().run();\n } catch (Throwable e) {\n e.printStackTrace();\n exit(999);\n }\n }\n }, \"1\", 1 << 23).start();\n }\n}", "lang": "Java 7", "bug_code_uid": "b86c60fa6adbe64ab934caf23f26eede", "src_uid": "7419c4268a9815282fadca6581f28ec1", "apr_id": "bb156355ae32d350cd8e181b3366f131", "difficulty": 1200, "tags": ["games", "greedy", "graph matchings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9973474801061007, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class test3\n{\n\n\tpublic static void main(String[] args) throws Exception\n\t{\n\t\tnew test3().run();\n\t}\n\n\tPrintWriter out = null;\n\n\tProduct[][] products = null;\n\tint n, m, k;\n\tint max = 0;\n\n\tvoid Trade(int x, int y)\n\t{\n\t\tfor (int i = 0; i < m; i++)\n\t\t{\n\t\t\tif (products[x][i].a < products[y][i].b && products[x][i].c != 0)\n\t\t\t\tproducts[x][i].d = products[y][i].b - products[x][i].a;\n\t\t\telse\n\t\t\t\tproducts[x][i].d = -1;\n\t\t}\n\n\t\tArrays.sort(products[x]);\n\n\t\tint total = 0;\n\t\tint i = 0;\n\t\tint kk = k;\n\n\t\twhile (kk > 0 && i < m)\n\t\t{\n\t\t\tif (products[x][i].d < 0)\n\t\t\t\tbreak;\n\n\t\t\ttotal += products[x][i].d * Math.min(products[x][i].c, kk);\n\t\t\tkk -= Math.min(products[x][i].c, kk);\n\t\t\ti++;\n\t\t}\n\n\t\tmax = Math.max(max, total);\n\n\t\tArrays.sort(products[x], new Comparator()\n\t\t{\n\t\t\tpublic int compare(Product o1, Product o2)\n\t\t\t{\n\t\t\t\treturn o1.id - o2.id;\n\t\t\t}\n\t\t});\n\t}\n\n\tvoid run() throws Exception\n\t{\n\t\tScanner in = new Scanner(System.in);\n\t\tout = new PrintWriter(System.out);\n\n\t\tn = in.nextInt();\n\t\tm = in.nextInt();\n\t\tk = in.nextInt();\n\n\t\tproducts = new Product[n][m];\n\n\t\tfor (int i = 0; i < n; i++)\n\t\t{\n\t\t\tin.next();\n\t\t\tfor (int j = 0; j < m; j++)\n\t\t\t{\n\t\t\t\tproducts[i][j] = new Product(m, in.nextInt(), in.nextInt(),\n\t\t\t\t\t\tin.nextInt());\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tfor (int j = 0; j < n; j++)\n\t\t\t{\n\t\t\t\t// if (i == j)\n\t\t\t\t// continue;\n\n\t\t\t\tTrade(i, j);\n\t\t\t}\n\n\t\tout.println(max);\n\t\tout.close();\n\t}\n}\n\nclass Product implements Comparable\n{\n\tint id;\n\tint a;\n\tint b;\n\tint c;\n\tint d;\n\n\tpublic Product(int _id, int _a, int _b, int _c)\n\t{\n\t\tid = _id;\n\t\ta = _a;\n\t\tb = _b;\n\t\tc = _c;\n\t}\n\n\tpublic int compareTo(Product o)\n\t{\n\t\treturn o.d - d;\n\t}\n}", "lang": "Java 7", "bug_code_uid": "fc932aecd1ff1de53bc4ec7d5ac873e8", "src_uid": "7419c4268a9815282fadca6581f28ec1", "apr_id": "d562e85fb16df834411e55a5ce11451d", "difficulty": 1200, "tags": ["games", "greedy", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9763387297633873, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.io.*;\nimport java.util.*;\npublic class Div2_422_A implements Runnable\n{\n public void run()\n {\n InputReader sc = new InputReader(System.in);\n PrintWriter out = new PrintWriter(System.out);\n\n long a = sc.nextLong();\n long b = sc.nextLong();\n\n long ans1 = factorial(a);\n long ans2 = factorial(b);\n\n out.print(gcd(ans1,ans2));\n out.close(); \n }\n\n long gcd(long a, long b){return (b==0)?a:gcd(b,a%b);}\n int gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}\n\n int factorial(int n){ \n if (n == 0) \n return 1; \n else \n return(n * factorial(n-1)); \n }\n\n long factorial(long n){ \n if (n == 0) \n return 1; \n else \n return(n * factorial(n-1)); \n } \n\n static class InputReader \n {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private SpaceCharFilter filter;\n private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n \n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n \n public int read() {\n if (numChars==-1)\n throw new InputMismatchException();\n \n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n }\n catch (IOException e) {\n throw new InputMismatchException();\n }\n \n if(numChars <= 0) \n return -1;\n }\n return buf[curChar++];\n }\n \n public String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n }\n catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n public int nextInt() {\n int c = read();\n \n while(isSpaceChar(c))\n c = read();\n \n int sgn = 1;\n \n if (c == '-') {\n sgn = -1;\n c = read();\n }\n \n int res = 0;\n do {\n if(c<'0'||c>'9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n }\n while (!isSpaceChar(c));\n \n return res * sgn;\n }\n \n public long nextLong() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n \n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n }\n while (!isSpaceChar(c));\n return res * sgn;\n }\n \n public double nextDouble() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n double res = 0;\n while (!isSpaceChar(c) && c != '.') {\n if (c == 'e' || c == 'E')\n return res * Math.pow(10, nextInt());\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n }\n if (c == '.') {\n c = read();\n double m = 1;\n while (!isSpaceChar(c)) {\n if (c == 'e' || c == 'E')\n return res * Math.pow(10, nextInt());\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n m /= 10;\n res += (c - '0') * m;\n c = read();\n }\n }\n return res * sgn;\n }\n \n public String readString() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n }\n while (!isSpaceChar(c));\n \n return res.toString();\n }\n \n public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n \n public String next() {\n return readString();\n }\n \n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n }\n\n public static void main(String args[]) throws Exception {\n new Thread(null, new Div2_422_A(),\"Main\",1<<27).start();\n }\n} ", "lang": "Java 11", "bug_code_uid": "95859c3803963ffd620cec953871c6f6", "src_uid": "7bf30ceb24b66d91382e97767f9feeb6", "apr_id": "4df6d529cd75b7ca2314e1d1f87f5de4", "difficulty": 800, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7730978260869565, "equal_cnt": 19, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 6, "fix_ops_cnt": 18, "bug_source_code": "import java.util.List;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\nimport java.util.InputMismatchException;\nimport java.util.ArrayList;\nimport java.io.BufferedReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.io.Writer;\nimport java.util.StringTokenizer;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n * @author RiaD\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Reader in = new Reader(inputStream);\n OutputWriter out = new OutputWriter(outputStream);\n TaskB solver = new TaskB();\n solver.solve(1, in, out);\n out.close();\n }\n}\n\nclass TaskB {\n final int mod = 1000000007;\n long[] cnt = new long[10];\n\n long c(long n, long k){\n long ans = 1;\n for(int i = 0; i = 9)\n return 0;\n if(level == 6){\n long ans = 0;\n for(int i = sum + 1; i <= 9; ++i){\n long res = cnt[i];\n for(int j = 0; j <= 9; ++j){\n res *= c(cnt[j],number[j]);\n res %= mod;\n }\n ans += res;\n ans %= mod;\n }\n return ans;\n }\n long res = 0;\n for(int i = 0; i <= 8; ++i){\n number[i]++;\n sum+=i;\n res += solve(level + 1, number, sum);\n res %= mod;\n sum-=i;\n number[i]--;\n }\n return res;\n\n }\n public void solve(int testNumber, Reader in, OutputWriter out) {\n\n int n = in.nextInt();\n String s = String.valueOf(n);\n int x[][] = new int[11][11];\n\n x[0][0] = 1;\n for(int i = 1; i < 11; ++i){\n x[i][0] = x[i - 1][0] * 8;\n for(int j = 1; j < 11; ++j){\n x[i][j] = x[i - 1][j] * 8 + x[i - 1][j - 1] * 2;\n }\n }\n\n int cur = 0;\n for(int i = 0; i < s.length(); ++i){\n\n if(s.charAt(i) > '0'){\n long mult = s.charAt(i) -'0';\n long m2 = 0;\n if(mult >= 8){\n --mult;\n ++m2;\n }\n if(mult >= 5){\n --mult;\n ++m2;\n }\n\n int l = s.length() - i;\n for(int r = 0; r <=l ;++r){\n if(cur + r > 10)\n continue;\n cnt[cur + r] += x[l - 1][r] * mult %mod;\n cnt[cur + r] %= mod;\n if(m2 >= 0 && cur + r + 1 <= 10){\n cnt[cur + r + 1] += (x[l - 1][r] * m2) % mod;\n cnt[cur + r + 1] %= mod;\n }\n\n }\n\n\n }\n\n if(s.charAt(i) == '4' || s.charAt(i)== '7')\n ++cur;\n\n\n }\n\n cnt[0]--;\n cnt[cur]++;\n\n //out.println(Arrays.toString(cnt));\n\n out.println(solve(0,new int[10], 0) * 720 % mod);\n }\n\n}\n\nclass IntegerUtils {\n\n public static long power(long base, long power, long mod) {\n long result = 1 % mod;\n base %= mod;\n while (power > 0) {\n if (power % 2 == 1) {\n result *= base;\n result %= mod;\n }\n base *= base;\n base %= mod;\n power >>= 1;\n }\n return result;\n }\n\n public static long modInverse(long number, long mod) {\n return power(number, mod - 2, mod);\n }\n\n }\n\nclass Reader {\n private BufferedReader reader;\n private StringTokenizer tokenizer;\n\n public Reader(BufferedReader reader) {\n this.reader = reader;\n }\n\n public Reader(InputStream stream) {\n this(new BufferedReader(new InputStreamReader(stream)));\n }\n\n public String nextString() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n tokenizer = new StringTokenizer(readLine());\n }\n return tokenizer.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(nextString());\n }\n\n private String readLine() {\n try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n}\n\nclass OutputWriter extends PrintWriter {\n\n public OutputWriter(OutputStream out) {\n super(out);\n }\n\n public OutputWriter(java.io.Writer writer){\n super(writer);\n }\n\n }\n", "lang": "Java 7", "bug_code_uid": "e3e8050ec2ff8898a2b517b5991cc1b7", "src_uid": "656ed7b1b80de84d65a253e5d14d62a9", "apr_id": "0b7bb008752c5b1951350beab3073869", "difficulty": 1900, "tags": ["brute force", "dp", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6926681783824641, "equal_cnt": 7, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "package current;\n\nimport io.Reader;\nimport io.OutputWriter;\nimport numbers.IntegerUtils;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\n\npublic class TaskB {\n final int mod = 1000000007;\n\n\n long c(long n, long k){\n long ans = 1;\n for(int i = 0; i = 9)\n return 0;\n if(level == 6){\n long ans = 0;\n for(int i = sum + 1; i <= 9; ++i){\n ans += number[i];\n ans %= mod;\n }\n return ans;\n }\n long res = 0;\n for(int i = 0; i <= 9; ++i){\n if(number[0] == 0)\n continue;\n number[i]--;\n sum += i;\n res += solve(level + 1, number, sum) * (number[i] + 1) % mod;\n res %= mod;\n sum-=i;\n number[i]++;\n }\n return res;\n\n }\n public void solve(int testNumber, Reader in, OutputWriter out) {\n\n int n = in.nextInt();\n String s = String.valueOf(n);\n int x[][] = new int[11][11];\n long[] cnt = new long[11];\n x[0][0] = 1;\n for(int i = 1; i < 11; ++i){\n x[i][0] = x[i - 1][0] * 8;\n for(int j = 1; j < 11; ++j){\n x[i][j] = x[i - 1][j] * 8 + x[i - 1][j - 1] * 2;\n }\n }\n\n int cur = 0;\n for(int i = 0; i < s.length(); ++i){\n\n if(s.charAt(i) > '0'){\n long mult = s.charAt(i) -'0';\n long m2 = 0;\n if(mult >= 8){\n --mult;\n ++m2;\n }\n if(mult >= 5){\n --mult;\n ++m2;\n }\n\n int l = s.length() - i;\n for(int r = 0; r <=l ;++r){\n if(cur + r > 10)\n continue;\n cnt[cur + r] += x[l - 1][r] * mult %mod;\n cnt[cur + r] %= mod;\n if(m2 >= 0 && cur + r + 1 <= 10){\n cnt[cur + r + 1] += (x[l - 1][r] * m2) % mod;\n cnt[cur + r + 1] %= mod;\n }\n\n }\n\n\n }\n\n if(s.charAt(i) == '4' || s.charAt(i)== '7')\n ++cur;\n\n\n }\n\n cnt[0]--;\n cnt[cur]++;\n\n //out.println(Arrays.toString(cnt));\n\n out.println(solve(0,cnt, 0));\n }\n\n}\n", "lang": "Java 7", "bug_code_uid": "7c9ab9f55251411bf8217603e86669b2", "src_uid": "656ed7b1b80de84d65a253e5d14d62a9", "apr_id": "0b7bb008752c5b1951350beab3073869", "difficulty": 1900, "tags": ["brute force", "dp", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9259714707329071, "equal_cnt": 11, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 10, "bug_source_code": "import java.io.BufferedOutputStream;\nimport java.io.BufferedReader;\nimport java.io.BufferedWriter;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.OutputStream;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\nimport java.math.BigInteger;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.BitSet;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.LinkedList;\nimport java.util.PriorityQueue;\nimport java.util.Queue;\nimport java.util.Set;\nimport java.util.Stack;\nimport java.util.StringTokenizer;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\n\npublic class q5 {\n\tstatic ArrayList[] gph,rgph;\n\tstatic int[] visited1,visited2;\n\tstatic boolean cycle;\n\tstatic int[] count;\n\tstatic void dfs(int i) {\n\t\tvisited1[i]=1;\n\t\tvisited2[i]=1;\n\t\tfor(int x:gph[i]) {\n\t\t\tif(visited2[x]==1) {\n\t\t\t\tcycle=true;break;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif(visited1[x]==0) dfs(x);\n\t\t\t}\n\t\t}\n\t\tvisited2[i]=0;\n\t\t\n\t}\n\t\n\t\n\tpublic static void main(String[] args) throws IOException {\n\t\t\n\t\tReader.init(System.in);\n\t\tPrintWriter out=new PrintWriter(System.out);\n\t\tStringBuffer output=new StringBuffer(\"\");\n//\t\tint n=Reader.nextInt(),m=Reader.nextInt();\n//\t\tString s=Reader.next();\n//\t\t gph=new ArrayList[n+1];\n//\t\t visited1=new int[n+1];visited2=new int[n+1];\n//\t\t int[] deg=new int[n+1];\n//\t\t long[][] v=new long[n][26];\n//\t\t rgph=new ArrayList[n+1];\n//\t\tfor(int i=1;i<=n;i++) gph[i]=new ArrayList();\n//\t\tfor(int i=1;i<=n;i++) rgph[i]=new ArrayList();\n//\t\tfor(int i=0;i=0 && x-i>=0) {\n\t\t\t\tlong v2=(xx)/(p);\n\t\t\t\tif(k<=xx%p) v2++;\n\t\t\t\t\n\t\t\t\tans+=v2;\n\t\t\t}\n\t\t}\n\t\toutput.append(ans);\n\t\tout.write(output.toString());\n\t\tout.flush();\n\t\t\n\t}\n}\nclass NoD{\n\tint a,b;\n\tString s;\n\tNoD(int aa,int bb){\n\t\ta=aa;b=bb;\n\t\ts=a+\" \"+b;\n\t}\n\t@Override\n\tpublic boolean equals(Object o) {\n\t\tif(o!=null && o.getClass()==getClass()) {\n\t\t\tNoD c= (NoD) o;\n\t\t\treturn c.a==a && c.b==b;\n\t\t}\n\t\treturn false;\n\t}\n\t@Override\n\tpublic int hashCode() {\n\t\treturn s.hashCode();\n\t}\n}\n\n\n\nclass Reader {\n static BufferedReader reader;\n static StringTokenizer tokenizer;\n \n /** call this method to initialize reader for InputStream */\n static void init(InputStream input) {\n reader = new BufferedReader(\n new InputStreamReader(input) );\n tokenizer = new StringTokenizer(\"\");\n }\n \n /** get next word */\n static String nextLine() throws IOException{\n \treturn reader.readLine();\n }\n static String next() throws IOException {\n while ( ! tokenizer.hasMoreTokens() ) {\n //TODO add check for eof if necessary\n tokenizer = new StringTokenizer(\n reader.readLine() );\n }\n return tokenizer.nextToken();\n }\n \n static int nextInt() throws IOException {\n return Integer.parseInt( next() );\n }\n static long nextLong() throws IOException {\n return Long.parseLong( next() );\n }\n static double nextDouble() throws IOException {\n return Double.parseDouble( next() );\n }\n}\n\n\n\n\n \n \n\n ", "lang": "Java 8", "bug_code_uid": "c7ab8921b4e39f579c8fd9ae1e45eda4", "src_uid": "4b9f470e5889da29affae6376f6c9f6a", "apr_id": "6daf1a49593afe4a3baedc7168f68382", "difficulty": 2100, "tags": ["math", "chinese remainder theorem", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9936321638157073, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import com.sun.xml.internal.bind.v2.model.core.ID;\n\nimport java.io.*;\nimport java.lang.reflect.Array;\nimport java.math.*;\nimport java.text.DecimalFormat;\nimport java.util.*;\n\n\n\n\npublic class Main {\n private static int [] inv;\n private static int [] A;\n private static int n;\n private static HashMap HM ;\n private static HashMap > Sol = new HashMap<>();\n\n private static int mul(int a,int b,int m) {\n long ab = a*(long)b;\n ab %= m;\n if (ab < 0) ab += m;\n return (int) ab;\n }\n\n private static void init(int a,int p){\n inv = new int[p];\n inv[1] = 1;\n for (int i = 2;i < p;i++)\n inv[i] = mul(-(p/i),inv[p%i],p);\n\n\n A = new int[p];\n for (int i = 0,q = 1;i < p;i++) {\n A[i] = q;\n q = mul(a,q,p);\n }\n\n n = (int)(Math.sqrt(p + 0.0) + 1);\n n = Math.min(n,p-1);\n int an = A[n];\n HM = new HashMap<>();\n for (int i = 1,q = an;i <= n;i++) {\n if (!HM.containsKey(q)) HM.put(q,i);\n q = mul(q,an,p);\n }\n }\n\n\n\n public static void main(String[] args) throws Exception{\n IO io = new IO(null,null);\n int a = io.getNextInt(),b = io.getNextInt(),p = io.getNextInt();\n long x = io.getNextLong();\n init(a,p);\n\n long ans = 0;\n for (int n0 = 0,q = 1;n0 < p - 1 && n0 <= x;n0++) {\n int y = mul(inv[q],b,p);\n y = n0 - y;\n if (y < 0) y += p;\n // k*(p-1) + n0 <= x\n // k <= (x-n0)/p\n long lim = (x-n0)/(p - 1);\n// System.err.println(n0 + \". \" + (y*(p-1L) + n0) + \" q = \" + q + \" y = \" + y + \" lim = \" + lim);\n if (y <= lim)\n ans += (lim - y)/p + 1;\n\n q = mul(q,a,p);\n }\n io.println(ans);\n\n io.close();\n }\n}\n\n\n\nclass IO{\n private BufferedReader br;\n private StringTokenizer st;\n private PrintWriter writer;\n private String inputFile,outputFile;\n\n public boolean hasMore() throws IOException{\n if(st != null && st.hasMoreTokens()) return true;\n if(br != null && br.ready()) return true;\n return false;\n }\n public String getNext() throws FileNotFoundException, IOException{\n while(st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());\n return st.nextToken();\n }\n\n public String getNextLine() throws FileNotFoundException, IOException{\n return br.readLine().trim();\n }\n\n public int getNextInt() throws FileNotFoundException, IOException{\n return Integer.parseInt(getNext());\n }\n public long getNextLong() throws FileNotFoundException, IOException{\n return Long.parseLong(getNext());\n }\n\n public void print(double x,int num_digits) throws IOException{\n writer.printf(\"%.\" + num_digits + \"f\" ,x);\n }\n public void println(double x,int num_digits) throws IOException{\n writer.printf(\"%.\" + num_digits + \"f\\n\" ,x);\n }\n public void print(Object o) throws IOException{\n writer.print(o.toString());\n }\n\n public void println(Object o) throws IOException{\n writer.println(o.toString());\n }\n public IO(String x,String y) throws FileNotFoundException, IOException{\n inputFile = x;\n outputFile = y;\n if(x != null) br = new BufferedReader(new FileReader(inputFile));\n else br = new BufferedReader(new InputStreamReader(System.in));\n if(y != null) writer = new PrintWriter(new BufferedWriter(new FileWriter(outputFile)));\n else writer = new PrintWriter(new OutputStreamWriter(System.out));\n }\n\n protected void close() throws IOException{\n br.close();\n writer.close();\n }\n public void outputArr(Object [] A) throws IOException{\n int L = A.length;\n for (int i = 0;i < L;i++) {\n if(i > 0) writer.print(\" \");\n writer.print(A[i]);\n }\n writer.print(\"\\n\");\n }\n}\n\n\n", "lang": "Java 8", "bug_code_uid": "275cd2c0c9deb743fe7544165bd4710c", "src_uid": "4b9f470e5889da29affae6376f6c9f6a", "apr_id": "5b3caa1d4a3b9de2bb087ed7295303fe", "difficulty": 2100, "tags": ["math", "chinese remainder theorem", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9503875968992248, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*;\nimport java.util.*;\npublic class Main {\n\n public static void main(String[] args) {\n InputReader in = new InputReader(System.in);\n PrintWriter out = new PrintWriter(System.out);\n new Solver().solve(in,out);\n out.close();\n }\n\n static class Solver{\n/*\n long powMod(long a, long b, long mod) {\n long ans = 1;\n for(;b!=0;b>>=1) {\n if((b&1) != 0) {\n ans=ans*a%mod;\n }\n a=a*a%mod;\n }\n return ans;\n }\n*/\n long powMod(long a, long b, long p) {\n if(b == 1)return a;\n if(b == 0)return 1;\n return ((powMod(a,b/2,p)%p)*(powMod(a,b-b/2,p)%p)) % p;\n }\n long inv(long a, long mod) {\n return powMod(a,mod-2,mod)%mod;\n }\n\n void solve(InputReader in, PrintWriter out) {\n long a=in.nextLong(),b=in.nextLong(),p=in.nextLong(),x=in.nextLong();\n long ans = 0;long P = p*(p-1);\n for(long i=1;i=r)?1:0);\n }\n out.println(ans);\n }\n\n }\n\n\n static class InputReader {\n private BufferedReader reader;\n private StringTokenizer tokenizer;\n\n InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream));\n tokenizer = null;\n }\n\n String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n }\n}", "lang": "Java 8", "bug_code_uid": "f14f5929a767d4cd2b130484483efe88", "src_uid": "4b9f470e5889da29affae6376f6c9f6a", "apr_id": "dbf8a6b876028947388671bd784771ce", "difficulty": 2100, "tags": ["math", "chinese remainder theorem", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9390557939914163, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\n\npublic class E {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint a = sc.nextInt(), b = sc.nextInt(), p = sc.nextInt();\n\t\tlong x = sc.nextLong();\n\t\t\n\t\tlong arr[] = new long[p];\n\t\tarr[p-1] = 1;\n\t\tfor(int i=p-2;i>=0;i--){\n\t\t\tarr[i] = arr[i+1] * a % p;\n\t\t}\n\t\t\n\t\tlong ans = 0;\n\t\tlong T = (long)p*(p-1);\n\t\t\n\t\tfor(int i = 1;i<=p-1;i++){\n\t\t\tlong j = (i- b * arr[i]) % p;\n\t\t\twhile(j < 0){\n\t\t\t\tj+=p;\n\t\t\t}\n\t\t\t\n\t\t\tlong n = j * (p-1) + i;\n\t\t\t\n\t\t\twhile(n <= x){\n\t\t\t\tans ++;\n\t\t\t\tn += T;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t\t\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "8dbd87e0821eca07ce27514bca9f13b4", "src_uid": "4b9f470e5889da29affae6376f6c9f6a", "apr_id": "f3db5dd1133086b45b17341b453004c1", "difficulty": 2100, "tags": ["math", "chinese remainder theorem", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.998805256869773, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\nimport java.io.*;\npublic class Main271 {\n \n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner sc = new Scanner(System.in);\n\t\twhile(sc.hasNext()) {\n\t\t\tint n = sc.nextInt();\n\t\t\tint m = sc.nextInt();\n\t\t\tint [][] mp = new int [10][10];\n\t\t\tfor(int i=0;i 0)\n tempCurrent &= ~(1 << (i - 1));\n if (i < m - 1)\n tempCurrent &= ~(1 << (i + 1));\n tempNext &= ~(1 << (i));\n tempLast &= ~(1 << (i));\n }\n if (tempLast != 0)\n continue;\n max = Math.max(\n max,\n m - Integer.bitCount(mask)\n + get(x + 1, tempNext, tempCurrent & ~mask));\n }\n return DP[x][current][last] = max;\n }\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int x = in.nextInt();\n int y = in.nextInt();\n n = Math.max(x, y);\n m = Math.min(x, y);\n DP = new int[n][1 << m][1 << m];\n for (int i = 0; i < n; i++)\n for (int j = 0; j < (1 << m); j++)\n Arrays.fill(DP[i][j], -1);\n System.out.println(get(0, (1 << m) - 1, 0));\n }\n}\npackage Rnd85;\n\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class E {\n static int n;\n static int m;\n static int[][][] DP;\n static int[] dx = { 0, 0, 1, -1 };\n static int[] dy = { 1, -1, 0, 0 };\n static int inf = 1000000;\n\n public static int get(int x, int current, int last) {\n if (x == n) {\n if (last == 0)\n return 0;\n else\n return -inf;\n }\n if (DP[x][current][last] != -1)\n return DP[x][current][last];\n int max = 0;\n for (int mask = 0; mask < (1 << m); mask++) {\n int tempLast = last;\n int tempCurrent = current;\n int tempNext = (1 << m) - 1;\n for (int i = 0; i < m; i++)\n if ((mask & (1 << i)) != 0) {\n if (i > 0)\n tempCurrent &= ~(1 << (i - 1));\n if (i < m - 1)\n tempCurrent &= ~(1 << (i + 1));\n tempNext &= ~(1 << (i));\n tempLast &= ~(1 << (i));\n }\n if (tempLast != 0)\n continue;\n max = Math.max(\n max,\n m - Integer.bitCount(mask)\n + get(x + 1, tempNext, tempCurrent & ~mask));\n }\n return DP[x][current][last] = max;\n }\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int x = in.nextInt();\n int y = in.nextInt();\n n = Math.max(x, y);\n m = Math.min(x, y);\n DP = new int[n][1 << m][1 << m];\n for (int i = 0; i < n; i++)\n for (int j = 0; j < (1 << m); j++)\n Arrays.fill(DP[i][j], -1);\n System.out.println(get(0, (1 << m) - 1, 0));\n }\n}\n", "lang": "Java 6", "bug_code_uid": "3636e32b0712675493494b2ed81a1eef", "src_uid": "097674b4dd696b30e102938f71dd39b9", "apr_id": "fb3e17124e2d2da3fea5dcbc4391b37e", "difficulty": 2100, "tags": ["dp", "bitmasks"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9659863945578231, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\npublic class ckde {\n public static void main(String[]args){\n Scanner sc= new Scanner(System.in);\n String s=sc.next();\n char x=s.charAt(0);\n char y=s.charAt(s.length()-1);\n if(s.length()<2) System.out.println(s);\n\n else{\n String ans=\"\"+x;\n s=s.substring(1,s.length()-1);\n int size=s.length();\n s+=\"\";\n boolean ukve=true;\n for(int i=0;i {\n public static final int OPEN_TYPE = 0;\n public static final int POINT_TYPE = 1;\n public static final int CLOSE_TYPE = 2;\n\n public int x, type;\n\n public Event(int x, int type) {\n this.x = x;\n this.type = type;\n }\n\n @Override\n public int compareTo(Event event) {\n if (Integer.compare(x, event.x) != 0)\n return Integer.compare(x, event.x);\n else return Integer.compare(type, event.type);\n }\n }\n\n public static final class Node {\n public int l, r;\n public int max, maxInd;\n\n public Node leftNode, rightNode;\n\n public Node(int l, int r) {\n this.l = l;\n this.r = r;\n }\n }\n\n public void relax(Node root) {\n if (root.leftNode.max > root.rightNode.max) {\n root.max = root.leftNode.max;\n root.maxInd = root.leftNode.maxInd;\n } else {\n root.max = root.rightNode.max;\n root.maxInd = root.rightNode.maxInd;\n }\n }\n\n public Node build(int l, int r, Function getItem) {\n Node res = new Node(l, r);\n if (l == r) {\n res.max = getItem.apply(l);\n res.maxInd = l;\n } else {\n int m = (r + l) / 2;\n res.leftNode = build(l, m, getItem);\n res.rightNode = build(m + 1, r, getItem);\n relax(res);\n }\n return res;\n }\n\n public void set(Node root, int ind, int val) {\n if (ind < root.l || ind > root.r)\n return;\n if (root.l == root.r) {\n root.max = val;\n return;\n }\n set(root.leftNode, ind, val);\n set(root.rightNode, ind, val);\n relax(root);\n }\n\n public static class QueryResult {\n public int max, maxInd;\n\n public QueryResult(int max, int maxInd) {\n this.max = max;\n this.maxInd = maxInd;\n }\n\n public QueryResult(QueryResult first, QueryResult second) {\n if (first.max > second.max) {\n this.max = first.max;\n this.maxInd = first.maxInd;\n } else {\n this.max = second.max;\n this.maxInd = second.maxInd;\n }\n }\n }\n\n public QueryResult query(Node root, int l, int r) {\n if (r == -1)\n return new QueryResult(0, -1);\n if (r < root.l || l > root.r)\n return new QueryResult(Integer.MIN_VALUE, -1);\n if (l <= root.l && r >= root.r) {\n return new QueryResult(root.max, root.maxInd);\n }\n return new QueryResult(query(root.leftNode, l, r), query(root.rightNode, l, r));\n }\n\n public int[] getLens(int[] a) {\n Node root = build(0, n, ind -> 0);\n int[] len = new int[a.length];\n for (int i = 0; i < a.length; i++) {\n int curVal = a[i];\n int prevLen = query(root, 0, curVal).max;\n len[i] = prevLen + 1;\n if (query(root, curVal, curVal).max < len[i])\n set(root, curVal, len[i]);\n }\n return len;\n }\n\n public void solve() throws IOException {\n n = nextInt();\n m = nextInt();\n Event[] events = new Event[2 * n + m];\n for (int i = 1; i <= m; i++) {\n events[i - 1] = new Event(i, Event.POINT_TYPE);\n }\n for (int i = 0; i < n; i++) {\n int l = nextInt();\n int r = nextInt();\n events[m + 2 * i] = new Event(l, Event.OPEN_TYPE);\n events[m + 2 * i + 1] = new Event(r, Event.CLOSE_TYPE);\n }\n Arrays.sort(events);\n int[] cnt = new int[m];\n int balance = 0;\n for (int i = 0; i < events.length; i++) {\n Event curEvent = events[i];\n if (curEvent.type == Event.OPEN_TYPE) {\n balance++;\n } else if (curEvent.type == Event.CLOSE_TYPE) {\n balance--;\n } else if (curEvent.type == Event.POINT_TYPE) {\n cnt[curEvent.x - 1] = balance;\n }\n }\n int[] lenUp = getLens(cnt);\n int[] newCnt = new int[cnt.length];\n for (int i = 0; i < cnt.length; i++) {\n newCnt[i] = cnt[cnt.length - i - 1];\n }\n int[] lenDown = getLens(newCnt);\n int[] revLenDown = new int[lenDown.length];\n for (int i = 0; i < lenDown.length; i++) {\n revLenDown[i] = lenDown[lenDown.length - i - 1];\n }\n int max = 0;\n for (int i = 0; i < n; i++) {\n int cur = lenUp[i] + revLenDown[i] - 1;\n max = Math.max(max, cur);\n }\n out.print(max);\n }\n\n public void run() {\n try {\n br = new BufferedReader(new InputStreamReader(System.in));\n out = new PrintWriter(System.out);\n\n solve();\n\n out.close();\n } catch (IOException e) {\n e.printStackTrace();\n System.exit(1);\n }\n }\n\n BufferedReader br;\n StringTokenizer in;\n PrintWriter out;\n\n public String nextToken() throws IOException {\n while (in == null || !in.hasMoreTokens()) {\n in = new StringTokenizer(br.readLine());\n }\n return in.nextToken();\n }\n\n public int nextInt() throws IOException {\n return Integer.parseInt(nextToken());\n }\n\n public double nextDouble() throws IOException {\n return Double.parseDouble(nextToken());\n }\n\n public long nextLong() throws IOException {\n return Long.parseLong(nextToken());\n }\n\n public static void main(String[] args) throws IOException {\n Locale.setDefault(Locale.US);\n new E().run();\n }\n}", "lang": "Java 8", "bug_code_uid": "bc5dd41d619af17327db2f5430137166", "src_uid": "ce8350be138ce2061349d7f9224a5aaf", "apr_id": "59c3fc3d513d9c770204639a2a756b96", "difficulty": 1900, "tags": ["data structures", "dp", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.999613601236476, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Random;\nimport java.util.StringTokenizer;\n\nimport static java.lang.Math.*;\n\npublic class Main {\n BufferedReader br;\n StringTokenizer in;\n PrintWriter pw;\n Random r;\n int INF = (int) 1e9;\n int mod = (int) (1e9 + 7);\n //int p = 26;\n ArrayList g[];\n\n void end(int a, int n) {\n if ((int) Math.pow(2, a) != n) pw.print(a);\n else pw.print(\"Final!\");\n pw.close();\n System.exit(0);\n }\n\n class node {\n int val;\n int m;\n int size;\n int prior;\n node L;\n node R;\n\n public node(int v) {\n val = v;\n prior = r.nextInt();\n size = 1;\n L = null;\n R = null;\n }\n }\n\n int sgs(node c) {\n if (c == null) return 0;\n return c.size;\n }\n\n int sgm(node c) {\n if (c == null) return INF;\n return c.m;\n }\n\n void relax(node c) {\n if (c == null) return;\n c.size = 1 + sgs(c.L) + sgs(c.R);\n }\n\n class pair implements Comparable {\n int a;\n int b;\n\n public pair(int aa, int bb) {\n a = aa;\n b = bb;\n }\n\n @Override\n public int compareTo(pair o) {\n if (a != o.a) return a - o.a;\n return b - o.b;\n }\n }\n\n class road {\n int to;\n int w;\n\n public road(int tto, int ww) {\n to = tto;\n w = ww;\n }\n\n public road() throws IOException {\n to = nextInt();\n w = nextInt();\n }\n }\n\n void readG(int n, int m) throws IOException {\n g = new ArrayList[n];\n for (int i = 0; i < n; i++) {\n g[i] = new ArrayList<>();\n }\n for (int i = 0; i < m; i++) {\n int a = nextInt() - 1;\n int b = nextInt() - 1;\n int w = nextInt();\n// g[a].add(new road(b, w));\n// g[b].add(new road(a, w));\n }\n }\n\n int p[];\n int d[];\n\n void solve() throws IOException {\n int n = nextInt();\n int m = nextInt();\n event[] p = new event[n * 2];\n for (int i = 0; i < n; i++) {\n int l = nextInt();\n int r = nextInt();\n p[i] = new event(l, 1);\n p[i + n] = new event(r, -1);\n }\n int q = p.length;\n int b = 0;\n Arrays.sort(p);\n int bal[] = new int[m + 1];\n int prev = 0;\n for (int i = 0; i < q; i++) {\n event a = p[i];\n if (a.t == -1) {\n for (int j = prev + 1; j <= a.time; j++) {\n bal[j] = b;\n }\n prev = a.time;\n } else {\n for (int j = prev + 1; j < a.time; j++) {\n bal[j] = b;\n }\n prev = a.time - 1;\n }\n b += a.t;\n }\n// for (int i = 1; i <= m; i++) {\n// pw.print(bal[i]);\n// }\n int revbal[] = new int[m + 1];\n for (int i = 1; i <= m; i++) {\n revbal[i] = bal[m + 1 - i];\n }\n int nvp[] = getnvp(bal);\n int rnvp[] = getnvp(revbal);\n int ans = 0;\n for (int i = 1; i <= m; i++) {\n int z = nvp[i];\n int w = rnvp[m - i];\n int sum = z + w;\n ans = max(ans, sum);\n }\n pw.print(ans);\n }\n\n int[] getnvp(int a[]) {\n int n = a.length;\n int d[] = new int[n + 1];\n int ans[] = new int[n];\n Arrays.fill(d, INF);\n d[0] = -INF;\n int last = 0;\n for (int i = 1; i < n; i++) {\n ans[i] = ans[i - 1];\n int c = a[i];\n int l = 0;\n int r = last + 1;\n while (l + 1 != r) {\n int m = (l + r) / 2;\n if (d[m] <= c) l = m;\n else r = m;\n }\n if (d[r] == INF) {\n ans[i]++;\n last++;\n }\n d[r] = min(d[r], c);\n }\n return ans;\n }\n\n class event implements Comparable {\n int time;\n int t;\n\n public event(int ttime, int tt) {\n time = ttime;\n t = tt;\n }\n\n @Override\n public int compareTo(event o) {\n if (time != o.time) return time - o.time;\n else return t - o.t;\n }\n }\n\n\n public static void main(String[] args) throws IOException {\n new Main().run();\n }\n\n void run() throws IOException {\n br = new BufferedReader(new InputStreamReader(System.in));\n pw = new PrintWriter(new OutputStreamWriter(System.out));\n r = new Random(5);\n solve();\n pw.close();\n }\n\n String nextToken() throws IOException {\n while (in == null || !in.hasMoreTokens()) in = new StringTokenizer(br.readLine());\n return in.nextToken();\n }\n\n int nextInt() throws IOException {\n return Integer.parseInt(nextToken());\n }\n\n long nextLong() throws IOException {\n return Long.parseLong(nextToken());\n }\n}\n", "lang": "Java 8", "bug_code_uid": "e121afa5c56452a2e462385a87b5b105", "src_uid": "ce8350be138ce2061349d7f9224a5aaf", "apr_id": "625b28fc58f9672b75cf8e1edf87fec3", "difficulty": 1900, "tags": ["data structures", "dp", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8654628273954774, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.lang.reflect.Array;\nimport java.util.*;\n\npublic class Main {\n ArrayList> q;\n boolean[] used;\n\n public void solve() throws IOException {\n int n = nextInt();\n int m = nextInt();\n int[] a = new int[m + 1];\n for (int i = 0; i < n; i++) {\n a[nextInt() - 1]++;\n a[nextInt()]--;\n }\n for (int i = 1; i < m; i++) {\n a[i] += a[i - 1];\n }\n int[] d = new int[m + 10];\n Arrays.fill(d, Integer.MAX_VALUE);\n int k = 0;\n int[] v1 = new int[m + 1];\n int[] v2 = new int[m + 1];\n for (int i = 0; i < m; i++) {\n int l = 0;\n int r = m;\n while (r - l > 1) {\n int m1 = (r + l) / 2;\n if (d[m1] > a[i]) {\n r = m1;\n } else {\n l = m1;\n }\n }\n if (d[l] <= a[i]) {\n l++;\n }\n if (d[l] == Integer.MAX_VALUE){\n k++;\n }\n d[l] = a[i];\n v1[i] = k;\n }\n k = 0;\n int max = 0;\n for (int i = m - 1; i >= 0; i--) {\n int l = 0;\n int r = m + 2;\n while (r - l > 1) {\n int m1 = (r + l) / 2;\n if (d[m1] > a[i]) {\n r = m1;\n } else {\n l = m1;\n }\n }\n if (d[l] <= a[i]) {\n l++;\n }\n if (d[l] == Integer.MAX_VALUE){\n k++;\n }\n d[l] = a[i];\n v2[i] = k;\n max = Math.max(max,v1[i] + v2[i + 1]);\n }\n max = Math.max(max,v2[0]);\n out.print(max);\n }\n\n BufferedReader br;\n StringTokenizer sc;\n PrintWriter out;\n\n String nextToken() throws IOException {\n while (sc == null || !sc.hasMoreTokens()) {\n try {\n sc = new StringTokenizer(br.readLine());\n } catch (Exception e) {\n sc = null;\n }\n }\n return sc.nextToken();\n }\n\n public Integer nextInt() throws IOException {\n return Integer.parseInt(nextToken());\n }\n\n public Long nextLong() throws IOException {\n return Long.parseLong(nextToken());\n }\n\n public Double nextDouble() throws IOException {\n return Double.parseDouble(nextToken());\n }\n\n public static void main(String[] args) throws IOException {\n Locale.setDefault(Locale.US);\n new Main().run();\n }\n\n public void run() throws IOException {\n try {\n br = new BufferedReader(new InputStreamReader(System.in));\n out = new PrintWriter(System.out);\n solve();\n out.close();\n } catch (Exception e) {\n e.printStackTrace();\n System.exit(1);\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "8339aa81d33e357f3fcd19778e0e76fd", "src_uid": "ce8350be138ce2061349d7f9224a5aaf", "apr_id": "d23613ef059f541269d99f1e447bc383", "difficulty": 1900, "tags": ["data structures", "dp", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9987995198079231, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\n\npublic class A{\n \n public static void main(String args[]){\n Scanner s=new Scanner(System.in);\n int a=s.nextInt(),b=s.nextInt();\n if(a>b){\n System.out.print(b+\" \");\n int c=a-b;\n System.out.print(c/2);\n }\n else{\n System.outprint(a+\" \");\n int c=b-a;\n System.out.print(c/2);\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "859e4e4228556f58c2f656304e2ca177", "src_uid": "775766790e91e539c1cfaa5030e5b955", "apr_id": "aac7102a6925bdfb35bb0d7a33c58cbd", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9993593850096092, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedInputStream;\nimport java.util.Scanner;\n\n/**\n * Created by jizhe on 2016/1/10.\n */\npublic class TrafficLights {\n public static void main(String[] args) {\n Scanner in = new Scanner(new BufferedInputStream(System.in));\n\n int L = in.nextInt();\n int D = in.nextInt();\n int V = in.nextInt();\n int G = in.nextInt();\n int R = in.nextInt();\n\n int turns = D/(V*(G+R));\n int distanceNear = D-turns*(V*(G+R));\n if( distanceNear <= G*V )\n {\n double time = (double)L/(double)V;\n System.out.printf(\"%f\\n\", time);\n }\n else\n {\n double time = turns*(G+R)+(G+R)+(double)(L-D)/(double)V;\n System.out.printf(\"%f\\n\", time);\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "df0aee224dd8b3ae7333c0ab111cc296", "src_uid": "e4a4affb439365c843c9f9828d81b42c", "apr_id": "3fa53b46bbe6839e61dc47a3772dfb05", "difficulty": 1500, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9288433382137629, "equal_cnt": 40, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 32, "fix_ops_cnt": 39, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.io.IOException;\nimport java.util.StringTokenizer;\npublic class Main {\n public static void main(String[] args){\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n TaskB solver = new TaskB();\n solver.solve(in,out);\n out.close();\n }\n}\nclass TaskB{\n public void solve(InputReader in, PrintWriter out){\n double l = in.nextInt();\n double d = in.nextInt();\n double v = in.nextInt();\n double g = in.nextInt();\n double r = in.nextInt();\n double x = d/v;\n double y = g+r;\n double time;\n if(x%y 0)\n\t\t\t\t\tv1 = p[v1-1];\n\t\t\t}\n\t\t\tif(v[v2] == t[s2])\n\t\t\t\tv2++;\n\t\t\telse{\n\t\t\t\tif(v2 > 0)\n\t\t\t\t\tv2 = p[v2-1];\n\t\t\t}\n\t\t\tans = Math.max(ans, 1 + dp(s1+1, v1, s2+1, v2));\n\t\t\tv1 = tmp1;\n\t\t\tv2 = tmp2;\n\t\t}\n\t\tans = Math.max(ans, Math.max(dp(s1+1, v1, s2, v2), dp(s1, v1, s2+1, v2)));\n//\t\tSystem.out.println(s1 + \" \" + v1 + \" \" + s2 + \" \" + v2 + \" \" + ans);\n\n\t\treturn memo[s1][v1][s2][v2] = ans;\n\t}\n\tstatic StringBuilder sb;\n\tstatic void print(int s1, int v1, int s2, int v2){\n\t\tif(s1 == s.length || s2 == t.length)\n\t\t\treturn;\n\t\tint opt = dp(s1, v1, s2, v2);\n\t\tif(s[s1] == t[s2]){\n\t\t\tint tmp1 = v1, tmp2 = v2;\n\t\t\tif(v[v1] == s[s1])\n\t\t\t\tv1++;\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(v1 > 0)\n\t\t\t\t\tv1 = p[v1-1];\n\t\t\t}\n\t\t\tif(v[v2] == t[s2])\n\t\t\t\tv2++;\n\t\t\telse{\n\t\t\t\tif(v2 > 0)\n\t\t\t\t\tv2 = p[v2-1];\n\t\t\t}\n\t\t\tif(opt == 1 + dp(s1+1, v1, s2+1, v2)){\n\t\t\t\tsb.append(s[s1]);\n\t\t\t\tprint(s1+1, v1, s2+1, v2);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tv1 = tmp1;\n\t\t\tv2 = tmp2;\n\t\t}\n\t\tif(opt == dp(s1+1, v1, s2, v2)) \n\t\t\t print(s1+1, v1, s2, v2);\n\t\telse print(s1, v1, s2+1, v2);\n\t}\n\tpublic static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\ts = sc.next().toCharArray();\n\t\tt = sc.next().toCharArray();\n\t\tv = sc.next().toCharArray();\n\t\tmemo = new int[101][101][101][101];\n\t\tfor(int [][][]i:memo)\n\t\t\tfor(int [][]j:i)\n\t\t\t\tfor(int []k:j)\n\t\t\t\t\tArrays.fill(k, -1);\n\t\tp = prefixFunction(v);\n\t\tsb = new StringBuilder();\n\t\tprint(0, 0, 0, 0);\n\t\tout.println(sb.length() == 0?0:sb);\n\t\tout.flush();\n\t\tout.close();\n\t}\n\tstatic int[] prefixFunction(char[] s)\t\t// O(n)\n\t{\n\t\tint n = s.length, pi[] = new int[n];\n\t\tfor(int i = 1, j = 0; i < n; ++i)\t\t//j = pi[i-1] at the beginning of every iteration\n\t\t{\n\t\t\twhile(j > 0 && s[i] != s[j])\n\t\t\t\tj = pi[j-1];\n\t\t\tif(s[i] == s[j])\n\t\t\t\t++j;\n\t\t\tpi[i] = j;\n\t\t}\n\t\treturn pi;\n\t}\n\tstatic class Scanner {\n\t\tStringTokenizer st;\n\t\tBufferedReader br;\n\n\t\tpublic Scanner(InputStream s) {\n\t\t\tbr = new BufferedReader(new InputStreamReader(s));\n\t\t}\n\n\t\tpublic Scanner(FileReader fileReader) {\n\t\t\tbr = new BufferedReader(fileReader);\n\t\t}\n\n\t\tpublic String next() throws IOException {\n\t\t\twhile (st == null || !st.hasMoreTokens())\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic int nextInt() throws IOException {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic long nextLong() throws IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic String nextLine() throws IOException {\n\t\t\treturn br.readLine();\n\t\t}\n\n\t\tpublic boolean ready() throws IOException {\n\t\t\treturn br.ready();\n\t\t}\n\t}\n}", "lang": "Java 8", "bug_code_uid": "e4f4f4db0efc106d54df7aa5d82f6892", "src_uid": "391c2abbe862139733fcb997ba1629b8", "apr_id": "ab7e36cb36970bd9116100a2d5867b41", "difficulty": 2000, "tags": ["dp", "strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9873259270849633, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "\nimport java.io.*;\nimport java.util.*;\nimport java.math.*;\nimport static java.lang.Math.*;\nimport static java.lang.Integer.parseInt;\nimport static java.lang.Long.parseLong;\nimport static java.lang.Double.parseDouble;\nimport static java.lang.String.*;\n\npublic class Main {\n\n static char [] s,t,virus;\n static int [][][] dp;\n static int [][][] choice;\n static StringBuilder sol;\n static int [] p;\n \n public static void main(String[] args) throws IOException {\n BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n //(new FileReader(\"input.in\"));\n StringBuilder out = new StringBuilder();\n StringTokenizer tk;\n \n s = in.readLine().toCharArray();\n t = in.readLine().toCharArray();\n virus = in.readLine().toCharArray();\n \n dp = new int[s.length+1][t.length+1][virus.length+1];\n choice = new int[s.length+1][t.length+1][virus.length+1];\n sol = new StringBuilder();\n \n for(int i=0; i<=s.length; i++)\n for(int j=0; j<=t.length; j++)\n Arrays.fill(dp[i][j],-1);\n\n p = new int[virus.length];\n for(int i=1,k=0; i0 && virus[k]!=virus[i])\n k = p[k-1];\n if(virus[k]==virus[i])\n p[i] = ++k;\n else p[i] = k;\n }\n\n int v = calc(0,0,0);\n\n if(v==0) {\n System.out.println(\"0\");\n return;\n }\n\n findSol(0,0,0);\n\n System.out.println(sol);\n }\n\n static int calc(int i,int j,int k) {\n if(k==virus.length) \n return -(int)1e9;\n if(i==s.length || j==t.length)\n return 0;\n\n if(dp[i][j][k]!=-1)\n return dp[i][j][k];\n\n int c3 = 0;\n\n if(s[i]==t[j] && !(s[i]==virus[k] && k==virus.length-1)) {\n boolean f = (virus[k]!=s[i] && k>0);\n int nk = (virus[k]==s[i] ? k+1 : (k>0 ? p[k-1] : 0));\n if(f && virus[nk]==s[i]) nk++;\n else if(f) nk = 0;\n\n c3 = calc(i+1,j+1,nk) + 1;\n }\n \n if(s[i]==t[j] && s[i]==virus[k] && k==virus.length-1) c3 = -(int)1e9;\n \n int c1 = calc(i+1,j,k),c2 = calc(i,j+1,k);\n int mx = max(c3,max(c1,c2));\n choice[i][j][k] = (c3==mx ? 0 : (c2==mx ? 2 : 1));\n \n return dp[i][j][k] = max(c3,max(c1,c2));\n }\n \n static void findSol(int i,int j,int k) {\n if(k==virus.length || i==s.length || j==t.length)\n return;\n \n \n if(choice[i][j][k]==0) {\n sol.append(s[i]);\n \n boolean f = (virus[k]!=s[i] && k>0 ? true : false);\n int nk = (virus[k]==s[i] ? k+1 : (k>0 ? p[k-1] : 0));\n if(f && virus[nk]==s[i]) nk++;\n else if(f) nk = 0;\n \n findSol(i+1,j+1,nk);\n return;\n } \n \n if(choice[i][j][k]==1) {\n findSol(i+1,j,k);\n return;\n }\n \n if(choice[i][j][k]==2) {\n findSol(i,j+1,k);\n return;\n }\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "43f6156544a4b1f13a37185bf524c218", "src_uid": "391c2abbe862139733fcb997ba1629b8", "apr_id": "0e1d05237af41a72ff075243539296da", "difficulty": 2000, "tags": ["dp", "strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9775545440276252, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import java.io.*;\nimport java.math.BigInteger;\nimport java.util.*;\n\n\n\n\npublic class Main {\n\t\n\n\tpublic static class FastReader {\n\t\tBufferedReader br;\n\t\tStringTokenizer root;\n\t\t\n \n\t\tpublic FastReader() {\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t}\n \n\t\tString next() {\n\t\t\twhile (root == null || !root.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\troot = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (Exception addd) {\n\t\t\t\t\taddd.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn root.nextToken();\n\t\t}\n \n\t\tint nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n \n\t\tdouble nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n \n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n \n\t\tString nextLine() {\n\t\t\tString str = \"\";\n\t\t\ttry {\n\t\t\t\tstr = br.readLine();\n\t\t\t} catch (Exception addd) {\n\t\t\t\taddd.printStackTrace();\n\t\t\t}\n\t\t\treturn str;\n\t\t}\n\t}\n\t\n\tpublic static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));\n\t\n\tpublic static FastReader sc = new FastReader();\n \n\tstatic int mod = (int) (1e9+7),MAX=(int) (2e5);\n static List[] edges;\n\tstatic char[] vir,s1,s2;\n\tstatic int[][][] dp;\n\tstatic int[] lps;\n\tpublic static void main(String[] args){\n\t\t\n\t s1 = sc.next().toCharArray();\n\t s2 = sc.next().toCharArray();\n\t vir = sc.next().toCharArray();\n\t lps = lps(new String(vir));\n\t dp = new int[110][110][110];\n\t \n\t \n\t for(int i=0;i 0 && vir[k] != s1[i]) k = lps[k - 1];\n\t\t if (vir[k] == s1[i]) ++k;\n\t\t print(i+1,j+1,k,str+s1[i]);\n\t\t\n\t}\n\n\tstatic int[] lps(String vir) {\n\t int n = vir.length();\n\t int[] pi = new int[n];\n\t for (int i = 1; i < n; i++) {\n\t int j = pi[i-1];\n\t while (j > 0 && vir.charAt(i) != vir.charAt(j))\n\t j = pi[j-1];\n\t if (vir.charAt(i) == vir.charAt(j))\n\t j++;\n\t pi[i] = j;\n\t }\n\t return pi;\n\t}\n\n\tprivate static int f(int i, int j, int k) {\n\t\tif (k == vir.length) return -Integer.MIN_VALUE/10;\n\t\tif (i == s1.length) return 0;\n\t\tif (j == s2.length) return 0;\n\t \n\t\tif(dp[i][j][k]!=-1) return dp[i][j][k];\n\t \n\t\tint o1=0,o2=0,o3=0;\n\t\tint k1 = k;\n\t\tif(s1[i] == s2[j]) {\n\t\t\tif(s1[i] == vir[k1]) {\n\t\t\t\to1 = 1 + f(i+1,j+1,k1+1);\n\t\t\t}else {\n\t\t\t\t/*\n\t\t\t\t * if next char don't match we can't reset k to 0\n\t\t\t\t * becz now suffix of lcs = ....prefix of virus + s1[i] \n\t\t\t\t * the new k will be length of LPS of string = prefix of virus + s1[i]\n\t\t\t\t */\n\t\t\t while (k1 > 0 && vir[k1] != s1[i]) k1 = lps[k1-1];\n\t\t\t if (s1[i] == vir[k1]) k1++;\n\t\t\t\to1 = 1 + f(i+1,j+1,k1);\n\t\t\t}\n\t\t}else {\n\t\t\t\to2 = f(i+1,j,k);\n\t\t\t\to3 = f(i,j+1,k);\n\t }\n\t\n\t\treturn dp[i][j][k] = Math.max(o1, Math.max(o2, o3));\n\t}\n\n\n}\n", "lang": "Java 8", "bug_code_uid": "79db974aab36f0ab6a4a9cebe505c688", "src_uid": "391c2abbe862139733fcb997ba1629b8", "apr_id": "782113cc65775948cab8658e176ed879", "difficulty": 2000, "tags": ["dp", "strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9747213916825225, "equal_cnt": 20, "replace_cnt": 2, "delete_cnt": 8, "insert_cnt": 9, "fix_ops_cnt": 19, "bug_source_code": "import java.lang.*;\nimport java.math.*;\nimport java.util.*;\nimport java.io.*;\n\npublic class Main {\n void solve() {\n char s1[]=ns().toCharArray();\n char s2[]=ns().toCharArray();\n s3=ns().toCharArray();\n int n1=s1.length,n2=s2.length,n3=s3.length;\n int dp[][][]=new int[n1+1][n2+1][n3+1];\n int prev[][][]=new int[n1+1][n2+1][n3+1];\n\n for(int i1=0;i1<=n1;i1++) for(int i2=0;i2<=n2;i2++) for(int i3=1;i3<=n3;i3++) dp[i1][i2][i3]=-1;\n for(int i1=0;i1<=n1;i1++) for(int i2=0;i2<=n2;i2++) for(int i3=1;i3<=n3;i3++) prev[i1][i2][i3]=-1;\n\n\n computeLPS();\n\n for(int i1=1;i1<=n1;i1++){\n for(int i2=1;i2<=n2;i2++){\n if(s1[i1-1]==s2[i2-1]){\n for(int k=0;k0 && s1[i1-1]!=s3[j]) j=lps[j-1];\n if(s1[i1-1]==s3[j]) j++;\n if(1+dp[i1-1][i2-1][k]>dp[i1][i2][j]) {\n dp[i1][i2][j] = 1 + dp[i1 - 1][i2 - 1][k];\n prev[i1][i2][j] = k;\n }\n }\n }\n }\n }\n }else {\n\n for(int k=0;k stk=new Stack();\n for(i3=0;i30 && i2>0 && l>0){\n // pw.println(i3);\n\n if(s1[i1-1]==s2[i2-1]){\n //System.out.println(i1+\" \"+i2+\" \"+i3);\n l--;\n stk.push(s1[i1-1]);\n i3=prev[i1][i2][i3];\n i1--;\n i2--;\n }else {\n if(dp[i1][i2][i3]==dp[i1-1][i2][prev[i1][i2][i3]]){\n i3=prev[i1][i2][i3];\n i1--;\n\n }else {\n i3=prev[i1][i2][i3];\n i2--;\n }\n\n\n }\n }\n\n if(stk.size()==0)\n pw.println(0);\n else {\n while(!stk.isEmpty()) pw.print(stk.pop());\n }\n }\n char s3[];\n int lps[];\n void computeLPS(){\n int n=s3.length;\n lps=new int[n];\n for(int i=1;i0 && s3[i]!=s3[j]){\n j=lps[j-1];\n }\n if(s3[i]==s3[j]) j++;\n lps[i]=j;\n }\n }\n\n\n\n long M= (long)1e9+7;\n InputStream is;\n PrintWriter pw;\n String INPUT = \"\";\n void run() throws Exception {\n is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n pw = new PrintWriter(System.out);\n long s = System.currentTimeMillis();\n solve();\n pw.flush();\n if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+\"ms\");\n\n }\n public static void main(String[] args) throws Exception { new Main().run(); }\n\n private byte[] inbuf = new byte[1024];\n public int lenbuf = 0, ptrbuf = 0;\n\n private int readByte() {\n if(lenbuf == -1)throw new InputMismatchException();\n if(ptrbuf >= lenbuf){\n ptrbuf = 0;\n try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }\n if(lenbuf <= 0)return -1;\n }\n return inbuf[ptrbuf++];\n }\n\n private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }\n private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }\n\n private double nd() { return Double.parseDouble(ns()); }\n private char nc() { return (char)skip(); }\n\n private String ns() {\n int b = skip();\n StringBuilder sb = new StringBuilder();\n while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n private char[] ns(int n) {\n char[] buf = new char[n];\n int b = skip(), p = 0;\n while(p < n && !(isSpaceChar(b))){\n buf[p++] = (char)b;\n b = readByte();\n }\n return n == p ? buf : Arrays.copyOf(buf, p);\n }\n\n private char[][] nm(int n, int m) {\n char[][] map = new char[n][];\n for(int i = 0;i < n;i++)map[i] = ns(m);\n return map;\n }\n\n private int[] na(int n) {\n int[] a = new int[n];\n for(int i = 0;i < n;i++)a[i] = ni();\n return a;\n }\n\n private int ni() {\n int num = 0, b;\n boolean minus = false;\n while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));\n if(b == '-'){\n minus = true;\n b = readByte();\n }\n\n while(true){\n if(b >= '0' && b <= '9'){\n num = num * 10 + (b - '0');\n }else{\n return minus ? -num : num;\n }\n b = readByte();\n }\n }\n\n private long nl() {\n long num = 0;\n int b;\n boolean minus = false;\n while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));\n if(b == '-'){\n minus = true;\n b = readByte();\n }\n\n while(true){\n if(b >= '0' && b <= '9'){\n num = num * 10 + (b - '0');\n }else{\n return minus ? -num : num;\n }\n b = readByte();\n }\n }\n private boolean oj = System.getProperty(\"ONLINE_JUDGE\") != null;\n private void tr(Object... o) { if(INPUT.length() > 0)System.out.println(Arrays.deepToString(o)); }\n\n}", "lang": "Java 8", "bug_code_uid": "92502ad006e9e47e72d0bfa8fe2a166e", "src_uid": "391c2abbe862139733fcb997ba1629b8", "apr_id": "19ac80f79cd42c49c3dd107ca1584908", "difficulty": 2000, "tags": ["dp", "strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9962195463455614, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class R201_D1_D {\n static String s1;\n static String s2;\n static String virus;\n static int fail[];\n static int dp[][][];\n static int next[][][];\n\n public static void kmpPreprocess(String t) {\n int i = 0, j = -1;\n int m = t.length();\n fail = new int[m + 1];\n fail[i] = j;\n while (i < m) {\n while (j >= 0 && t.charAt(i) != t.charAt(j)) {\n j = fail[j];\n }\n ++i;\n ++j;\n fail[i] = j;\n }\n }\n\n public static int get_matched(char curr, int j) {\n while (j >= 0 && curr != virus.charAt(j)) {\n j = fail[j];\n }\n return j + 1;\n }\n\n public static int call(int index_a, int index_b, int matched) {\n if (matched == virus.length())\n return -1000000;\n if (index_a == s1.length() || index_b == s2.length())\n return 0;\n if (dp[index_a][index_b][matched] != -1)\n return dp[index_a][index_b][matched];\n int res = call(index_a + 1, index_b, matched);\n next[index_a][index_b][matched] = 0;\n int b = call(index_a, index_b + 1, matched);\n if (b > res) {\n res = b;\n next[index_a][index_b][matched] = 1;\n }\n\n if (s1.charAt(index_a) == s2.charAt(index_b)) {\n int c = 1 + call(index_a + 1, index_b + 1,\n get_matched(s1.charAt(index_a), matched));\n if (c > res) {\n res = c;\n next[index_a][index_b][matched] = 2;\n }\n }\n return dp[index_a][index_b][matched] = res;\n }\n\n public static void main(String[] args) throws Exception {\n InputReader in = new InputReader(System.in);\n s1 = in.readString();\n s2 = in.readString();\n virus = in.readString();\n dp = new int[100][100][100];\n next = new int[100][100][100];\n\n for (int i = 0; i < dp.length; i++) {\n for (int j = 0; j < dp[i].length; j++) {\n for (int j2 = 0; j2 < dp[i][j].length; j2++) {\n dp[i][j][j2] = -1;\n }\n }\n }\n kmpPreprocess(virus);\n int len = call(0, 0, 0);\n // System.out.println(len);\n\n if (len == 0)\n System.out.println(0);\n else {\n String res = \"\";\n int a = 0, b = 0, c = 0;\n while (res.length() < len) {\n if (next[a][b][c] == 0)\n a++;\n else if (next[a][b][c] == 1)\n b++;\n else {\n res += s1.charAt(a);\n a++;\n b++;\n }\n }\n System.out.println(res);\n }\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1000];\n private int curChar, numChars;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n private int read() {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int readInt() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long readLong() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public String readString() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuffer res = new StringBuffer();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n\n private boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n private String readLine0() {\n StringBuffer buf = new StringBuffer();\n int c = read();\n while (c != '\\n' && c != -1) {\n buf.appendCodePoint(c);\n c = read();\n }\n return buf.toString();\n }\n\n public String readLine() {\n String s = readLine0();\n while (s.trim().length() == 0)\n s = readLine0();\n return s;\n }\n\n public String readLine(boolean ignoreEmptyLines) {\n if (ignoreEmptyLines)\n return readLine();\n else\n return readLine0();\n }\n\n public char readCharacter() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n return (char) c;\n }\n\n public double readDouble() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n double res = 0;\n while (!isSpaceChar(c) && c != '.') {\n if (c == 'e' || c == 'E')\n return res * Math.pow(10, readInt());\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n }\n if (c == '.') {\n c = read();\n double m = 1;\n while (!isSpaceChar(c)) {\n if (c == 'e' || c == 'E')\n return res * Math.pow(10, readInt());\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n m /= 10;\n res += (c - '0') * m;\n c = read();\n }\n }\n return res * sgn;\n }\n }\n}\n", "lang": "Java 6", "bug_code_uid": "eb9db5a38260d0034a6e63485617f38c", "src_uid": "391c2abbe862139733fcb997ba1629b8", "apr_id": "ae11f57bb6b4d47c5e497a01e66d6d4d", "difficulty": 2000, "tags": ["dp", "strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9971785570334543, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\nimport java.lang.*;\nimport java.io.*;\npublic class RBK\n{\n\tpublic static void main(String[] args)\n\t{\n \n Scanner scan = new Scanner(System.in);\n int x1 = scan.nextInt();\n int y1 = scan.nextInt();\n int x2 = scan.nextInt();\n int y2 = scan.nextInt();\n Chess Moves = new Chess();\n Moves.rook(x1,y1,x2,y2);\n Moves.bishop(x1,y1,x2,y2);\n Moves.king(x1,y1,x2,y2);\n\n\n\t}\n}\n\npublic class Chess\n{\n\tvoid rook (int x1,int y1,int x2,int y2)\n\t{\n\t\tif(x1==x2 || y1==y2)\n\t\t{\n\t\t\tSystem.out.println(\"1\");\n\t\t}\n\t\telse\n\t\t\tSystem.out.println(\"2\");\t\n\t}\n\n\tvoid bishop (int x1,int y1,int x2,int y2)\n\t{\n int a,b;\n a=x1-x2;\n b=y1-y2;\n if(a<0)\ta=-a;\n if(b<0)\tb=-b;\n if((a%2)==(b%2))\n {\n \tif(a==b)\n \t\tSystem.out.println(\"1\");\n \telse\n \t\tSystem.out.println(\"2\");\t\n }\n else\n \tSystem.out.println(\"0\");\n\t}\n\n\tvoid king (int x1,int y1,int x2,int y2)\n\t{\n\t\tint a,b;\n a=x1-x2;\n b=y1-y2;\n if(a<0)\ta=-a;\n if(b<0)\tb=-b;\n if(a==b)\n {\n System.out.println(a);\n }\n else\n {\n \t if (a>b)\n \tSystem.out.println(a);\n else\n \tSystem.out.println(b);\n }\n \t \n\t}\n \n}\n", "lang": "Java 7", "bug_code_uid": "fd2949419d328d90c2e7a669d320ad6c", "src_uid": "7dbf58806db185f0fe70c00b60973f4b", "apr_id": "cb2500e6af3b03e5b2ba017da9a79aaf", "difficulty": 1100, "tags": ["graphs", "math", "shortest paths"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9427480916030534, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import java.util.Scanner;\n\npublic class UndoubtedlyLuckyNumber {\n\tprivate int number, result = 0;\n\n\tpublic static void main(String[] args) {\n\t\tScanner input = new Scanner(System.in);\n\t\tUndoubtedlyLuckyNumber obj = new UndoubtedlyLuckyNumber();\n\t\tobj.number = input.nextInt();\n\t\tint value;\n\t\tStringBuilder temp = new StringBuilder();\n\t\tfor (int i = 1; i < 10; i++) {\n\t\t\tfor (int j = 0; j < 10; j++) {\n\t\t\t\tif (i != j) {\n\t\t\t\t\tobj.solve(i, j, i, temp);\n\t\t\t\t\ttemp.append((char) (i + '0'));\n\t\t\t\t\tvalue = Integer.valueOf(temp.toString());\n\t\t\t\t\twhile (j > 0 && value <= obj.number) {\n\t\t\t\t\t\tobj.result--;\n\t\t\t\t\t\ttemp.append((char) (i + '0'));\n\t\t\t\t\t\tvalue = Integer.valueOf(temp.toString());\n\t\t\t\t\t}\n\t\t\t\t\ttemp.setLength(0);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(obj.result);\n\t}\n\n\tprivate void solve(int x, int y, int num, StringBuilder temp) {\n\t\ttemp.append((char) (num + '0'));\n\t\tint value = Integer.valueOf(temp.toString());\n\t\tif (value <= number) {\n\t\t\tresult++;\n\t\t\tsolve(x, y, x, temp);\n\t\t\tsolve(x, y, y, temp);\n\t\t}\n\t\ttemp.setLength(temp.length() - 1);\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "570cb97dfbc38b2de8df13d0c245b221", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "apr_id": "a1e6205fc3b6f56eda5aa87ce780db96", "difficulty": 1600, "tags": ["dfs and similar", "brute force", "bitmasks"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9931672911615606, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\n\npublic class D {\n\t\n\tstatic class Scanner{\n\t\tBufferedReader br=null;\n\t\tStringTokenizer tk=null;\n\t\tpublic Scanner(){\n\t\t\tbr=new BufferedReader(new InputStreamReader(System.in));\n\t\t}\n\t\tpublic String next() throws IOException{\n\t\t\twhile(tk==null || !tk.hasMoreTokens())\n\t\t\t\ttk=new StringTokenizer(br.readLine());\n\t\t\treturn tk.nextToken();\n\t\t}\n\t\tpublic int nextInt() throws NumberFormatException, IOException{\n\t\t\treturn Integer.valueOf(next());\n\t\t}\n\t}\n\t\n\tstatic int[][][][] dp=new int[11][11][11][2];\n\tstatic char[] Number;\n\tstatic long mod=1000000007;\n\t\n\t\n\tstatic void init(){\n\t\tfor(int i=0;i<11;i++)\n\t\t\tfor(int j=0;j<11;j++)\n\t\t\t\tfor(int k=0;k<11;k++){\n\t\t\t\t\tdp[i][j][k][0]=-1;\n\t\t\t\t\tdp[i][j][k][1]=-1;\n\t\t\t\t}\n\t}\n\t\n\tstatic int klucky(int index,int acum,int k,boolean tope){\n\t\tif (dp[index][acum][k][tope?1:0]>=0)\n\t\t\treturn dp[index][acum][k][tope?1:0];\n\t\tif (index==Number.length){\n\t\t\tdp[index][acum][k][tope?1:0]=(acum==k)?1:0;\n\t\t\treturn (acum==k)?1:0;\n\t\t}\n\t\tint limit= (tope)? Number[index] - '0': 9;\n\t\tint sol=0;\n\t\tfor(int i=0;i<=limit;i++){\n\t\t\tif (i==4 || i==7)\n\t\t\t\tsol+=klucky(index+1,acum+1,k,tope && i==limit);\n\t\t\telse\n\t\t\t\tsol+=klucky(index+1,acum,k,tope && i==limit);\n\t\t}\n\t\tdp[index][acum][k][tope?1:0]=sol;\n\t\treturn sol;\n\t}\n\t\n\t\n\tstatic int ways(int k){\n\t\tif (k==0)\n\t\t\treturn klucky(0,0,k,true)-1;\n\t\treturn klucky(0,0,k,true);\n\t}\n\t\n\t\n\tstatic long bforce(int partido,int total,int acum, int[] used){\n\t\tif (partido==6)\n\t\t\treturn (acum==total)?1:0;\n\t\tlong ret=0;\n\t for(int i=0;i<10;i++){\n\t \tif (ways(i)==used[i])\n\t \t\tcontinue;\n\t \tused[i]++;\n\t \tlong tmp = bforce(partido+1,total, acum + i,used);\n\t \tused[i]--;\n\t \ttmp = ((ways(i) - used[i]) * tmp) % mod;\n\t \tret = (ret + tmp) % mod;\n\t }\n\t return ret;\n\t}\n\t\n\tpublic static void main(String args[]) throws IOException{\n\t\tScanner sc=new Scanner();\n\t\tinit();\n\t\tNumber=sc.next().toCharArray();\n\t\tlong res=0;\n\t\tint[] used=new int[10];\n\t\tfor(int i=1;i<10;i++){\n\t\t\tfor(int j=0;j<10;j++)\n\t\t\t\tused[j]=0;\n\t\t\tused[i]=1;\n\t\t\tfor(int j=0;j xs = new ArrayList();\n\t\tArrayList ys = new ArrayList();\n\t\tint[] x = new int[8], y = new int[8];\n\t\tfor (int i = 0; i < 8; i++) {\n\t\t\tStringTokenizer to = new StringTokenizer(sc.readLine(), \" \");\n\t\t\t// StringTokenizer to = new StringTokenizer(sc.readLine(), \" \");\n\t\t\tx[i] = Integer.parseInt(to.nextToken());\n\t\t\ty[i] = Integer.parseInt(to.nextToken());\n\t\t\tif (!xs.contains(x[i]))\n\t\t\t\txs.add(x[i]);\n\t\t\tif (!ys.contains(y[i]))\n\t\t\t\tys.add(y[i]);\n\t\t}\n\t\tif (xs.size() > 3 || ys.size() > 3) {\n\t\t\tSystem.out.println(\"ugly\");\n\t\t\tSystem.exit(0);\n\t\t}\n\t\tCollections.sort(xs);\n\t\tCollections.sort(ys);\n\t\tfor (int i = 0; i < 8; i++) {\n\t\t\tif (x[i] == xs.get(1) && y[i] == ys.get(1)) {\n\t\t\t\tSystem.out.println(\"ugly\");\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"respectable\");\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "ab4f32a14c7697d302374813592ca9bc", "src_uid": "f3c96123334534056f26b96f90886807", "apr_id": "31a18527141ff09c573cf563970a74c0", "difficulty": 1400, "tags": ["sortings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9534246575342465, "equal_cnt": 7, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.FileInputStream;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.Locale;\nimport java.util.StringTokenizer;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n in = new BufferedReader(new InputStreamReader(System.in, \"ISO-8859-1\"));\n out = new PrintWriter(System.out);\n\n solve();\n\n in.close();\n out.close();\n }\n\n private static void solve() throws Exception {\n double l = nextInt(), d = nextInt(), v = nextInt(), g = nextInt(), r = nextInt();\n double t1 = d / v;\n int del = (int) ((g + r) / t1);\n double ost = g + r - del * t1;\n if (ost > g) {\n out.format(Locale.US, \"%.10f\\n\", t1 + (l - d) / v);\n } else {\n out.format(Locale.US, \"%.10f\\n\", t1 + (l - d) / v + ost);\n }\n }\n\n private static BufferedReader in;\n private static PrintWriter out;\n private static StringTokenizer st;\n\n static String nextString() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(in.readLine());\n }\n return st.nextToken();\n }\n\n static int nextInt() throws IOException {\n return Integer.parseInt(nextString());\n }\n\n static double nextDouble() throws IOException {\n return Double.parseDouble(nextString());\n }\n}\n", "lang": "Java 6", "bug_code_uid": "3d20da5e7d0bb153b73e131b87ba654a", "src_uid": "e4a4affb439365c843c9f9828d81b42c", "apr_id": "3ae54b4b0b82ec149501a316dad91848", "difficulty": 1500, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9993690851735015, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\nimport java.math.*;\n\npublic class trafficlight{\n public static void main(String[] args) {\n Scanner br = new Scanner(System.in);\n int l = br.nextInt();\n int d = br.nextInt();\n int v = br.nextInt();\n int g = br.nextInt();\n int r = br.nextInt();\n double ttl = d/(v*1.0);\n boolean green = true;\n int time = 0;\n while(time < ttl){\n \tif(green){\n \t\ttime+=g;\n \t}\n \telse{\n \t\ttime+=r;\n \t}\n \tif(ttl < time){\n \t\tbreak;\n \t}\n \tgreen = !green;\n }\n double ans = 0;\n if(green){\n \tans = l/(v*1.0);\n }\n else{\n \tans = time+((l-d)/(v*1.0));\n }\n System.out.printf(\"%.8f\\n\", ans);\n }\n}\n", "lang": "Java 6", "bug_code_uid": "8928d8b0339342da62d84a8e306f8678", "src_uid": "e4a4affb439365c843c9f9828d81b42c", "apr_id": "942980fcdaad989679520a00e190d57d", "difficulty": 1500, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6967450854012246, "equal_cnt": 45, "replace_cnt": 21, "delete_cnt": 6, "insert_cnt": 17, "fix_ops_cnt": 44, "bug_source_code": "import java.io.*;\nimport java.math.*;\nimport java.util.*;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tInputReader in = new InputReader(System.in);\n\t\tPrintWriter out = new PrintWriter(System.out);\n\n\t\tTask solver = new Task();\n\t\tsolver.solve(in, out);\n\n\t\tout.close();\n\t}\n}\n\nclass InputReader {\n\tBufferedReader buff;\n\tStringTokenizer tokenizer;\n\n\tInputReader(InputStream stream) {\n\t\tbuff = new BufferedReader(new InputStreamReader(stream));\n\t\ttokenizer = null;\n\t}\n\n\tString next() {\n\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens())\n\t\t\ttry {\n\t\t\t\ttokenizer = new StringTokenizer(buff.readLine());\n\t\t\t}\n\t\t\tcatch (IOException e) {\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\treturn tokenizer.nextToken();\n\t}\n\tint nextInt() { return Integer.parseInt(next()); }\n\tlong nextLong() { return Long.parseLong(next()); }\n}\n\nclass Task {\n\tfinal static int MAXL = 19;\n\tfinal static int MAXN = 1 << 9;\n\tfinal static int LCM = 2520;\n\tlong[][][] dp;\n\n\tlong divTest(int x, int mask) {\n\t\tfor (int i = 1; i < 10; ++i)\n\t\t\tif ((mask << 1 >> i & 1) == 1)\n\t\t\t\tif (x % i != 0)\n\t\t\t\t\treturn 0L;\n\t\treturn 1L;\n\t}\n\n\tlong go(long l, long r) {\n\t\tint[] a = new int[MAXL], b = new int[MAXL];\n\t\tint pos = -1;\n\t\tfor (int i = 0; i < MAXL; ++i) {\n\t\t\ta[i] = (int)(l % 10);\n\t\t\tb[i] = (int)(r % 10);\n\t\t\tif (a[i] != b[i])\n\t\t\t\tpos = i;\n\t\t\tl /= 10; r /= 10;\n\t\t}\n\n\t\tlong ret = 0;\n\t\tint[] rem = new int[MAXL], mask = new int[MAXL];\n\t\tfor (int i = MAXL - 2; i >= 0; --i) {\n\t\t\trem[i] = (rem[i + 1] * 10 + a[i + 1]) % LCM;\n\t\t\tmask[i] = mask[i + 1] | 1 << a[i + 1] >> 1;\n\t\t}\n\t\tfor (int i = 0; i <= pos; ++i)\n\t\t\tfor (int j = a[i] + 1; j < (i == pos ? b[i] : 10); ++j)\n\t\t\t\tret += dp[i][mask[i] | 1 << j >> 1][(rem[i] * 10 + j) % LCM];\n\n\t\trem = new int[MAXL]; mask = new int[MAXL];\n\t\tfor (int i = MAXL - 2; i >= 0; --i) {\n\t\t\trem[i] = (rem[i + 1] * 10 + b[i + 1]) % LCM;\n\t\t\tmask[i] = mask[i + 1] | 1 << b[i + 1] >> 1;\n\t\t}\n\t\tfor (int i = pos - 1; i >= 0; --i)\n\t\t\tfor (int j = 0; j < b[i]; ++j)\n\t\t\t\tret += dp[i][mask[i] | 1 << j >> 1][(rem[i] * 10 + j) % LCM];\n\n\t\treturn ret;\n\t}\n\n\tvoid solve(InputReader in, PrintWriter out) {\n\t\tdp = new long[MAXL][MAXN][LCM];\n\t\tfor (int i = 0; i < MAXN; ++i)\n\t\t\tfor (int j = 0; j < LCM; ++j)\n\t\t\t\tdp[0][i][j] = divTest(j, i);\n\n\t\tfor (int i = 1; i < MAXL; ++i)\n\t\t\tfor (int j = 0; j < MAXN; ++j)\n\t\t\t\tfor (int k = 0; k < LCM; ++k) {\n\t\t\t\t\tdp[i][j][k] = dp[i - 1][j][k * 10 % LCM];\n\t\t\t\t\tfor (int c = 0; c < 9; ++c)\n\t\t\t\t\t\tdp[i][j][k] += dp[i - 1][j | 1 << c][(k * 10 + c + 1) % LCM];\n\t\t\t\t}\n\n\t\tfor (int q = in.nextInt(); q-- > 0; ) {\n\t\t\tlong l = in.nextLong(), r = in.nextLong();\n\t\t\tout.println(go(l - 1, r + 1));\n\t\t}\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "42f4386099e26d2b162794b484f0bc38", "src_uid": "37feadce373f728ba2a560b198ca4bc9", "apr_id": "afbf1aaa99ee965d8847f8f77ad4317d", "difficulty": 2500, "tags": ["dp", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6522180833051134, "equal_cnt": 22, "replace_cnt": 14, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 21, "bug_source_code": "import java.util.*;\nimport java.io.*;\nimport java.math.*;\npublic class round51D {\n\tpublic static void main(String args[]) throws Exception{\n\t\tcf55D tmp=new cf55D();\n\t\ttmp.solve();\n\t}\n}\nclass cf55D {\n\tfinal static int N=20;\n\tfinal static int mod=2520;\n\tfinal static int M=(1<<8);\n\tlong dp[][][]=new long[N][M][mod];\n\tArrayList dig=new ArrayList();\n\tint t;\n\tlong l,r;\n\tvoid init(long num) {\n\t\tlong xx=num;\n\t\twhile(xx>0) {\n\t\t\tint y=(int)xx%10;\n\t\t\tdig.add(y);\n\t\t\txx/=10;\n\t\t}\n\t\tfor(int i=0;i=2) stt|=(1<<(i-2));\n\t\t\tres+=calc(cont-1,stt,(re*10+i)%mod,(limit==1&&i==bound? 1:0));\n\t\t}\n\t\tif(limit==0) dp[cont][st][re]=res;\n\t\treturn res;\n\t}\n\tvoid solve() throws Exception{\n\t\t//System.setIn(new BufferedInputStream(new FileInputStream(\"in.txt\")));\n\t\tScanner in=new Scanner(System.in);\n\t\tt=in.nextInt();\n\t\tfor(int i=0;i=l)\n {\n best=Math.max(best,func(i));\n }\n }\n System.out.print(best);\n \n \n }\n public static long func(long x)\n {\n char rr[]=String.valueOf(x).toCharArray();\n for(int i=0; i vysledek){\n vysledek = reflexe(i) * i;\n }\n }\n System.out.println(vysledek);\n }\n}\n", "lang": "Java 6", "bug_code_uid": "d1bb459bccc115b9207373f4c553cfd0", "src_uid": "2c4b2a162563242cb2f43f6209b59d5e", "apr_id": "aae67df14e534fd973b03b47ef16bf82", "difficulty": 1600, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.998262883613202, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "\nimport java.util.Scanner;\n\n/**\n * Created by mostafa on 10/7/17.\n */\npublic class FightMonster {\n static int inf = (int) 1e9;\n\n static boolean canwin(int hpy, int atky, int defy, int hpm, int atkm, int defm) {\n if(atky <= defm)\n return false;\n if(atkm <= defy)\n return true;\n\n int dmg1 = atky - defm;\n int moves1 = (hpm + dmg1 - 1) / dmg1;\n\n int dmg2 = atkm - defy;\n int moves2 = (hpy + dmg2 - 1) / dmg2;\n\n return moves1 < moves2;\n }\n\n static int hp(int hpy, int atky, int defy, int hpm, int atkm, int defm) {\n if(atky <= defm)\n return inf;\n if(atkm <= defy)\n return 0;\n\n int ans = inf;\n int low = 0, high = inf;\n while(low <= high) {\n int mid = (low + high) / 2;\n if (canwin(hpy + mid, atky, defy, hpm, atkm, defm)) {\n ans = mid;\n high = mid - 1;\n }\n else\n low = mid + 1;\n }\n\n return ans;\n }\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int hpy = sc.nextInt(), atky = sc.nextInt(), defy = sc.nextInt();\n int hpm = sc.nextInt(), atkm = sc.nextInt(), defm = sc.nextInt();\n int h = sc.nextInt(), a = sc.nextInt(), d = sc.nextInt();\n int ans = (int) 1e9;\n\n for(int atk = 0; atk <= 10000; atk++)\n for(int def = 0; def <= 10000; def++) {\n int hp = hp(hpy, atky + atk, defy + def, hpm, atkm, defm);\n if(hp == inf)\n continue;\n ans = Math.min(ans, atk * a + def * d + hp * h);\n }\n System.out.println(ans);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "57b86b4810104df0781f2f94b2cda20a", "src_uid": "bf8a133154745e64a547de6f31ddc884", "apr_id": "0460c480b771c97b111af891dbd91390", "difficulty": 1800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8817763552710542, "equal_cnt": 28, "replace_cnt": 18, "delete_cnt": 4, "insert_cnt": 6, "fix_ops_cnt": 28, "bug_source_code": "import java.util.Arrays;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.BufferedReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.io.IOException;\nimport java.util.StringTokenizer;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tInputReader in = new InputReader(inputStream);\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\tTaskB solver = new TaskB();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass TaskB {\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n\t\tint hpY = in.nextInt();\n\t\tint atkY = in.nextInt();\n\t\tint defY = in.nextInt();\n\t\t\n\t\tint hpM = in.nextInt();\n\t\tint atkM = in.nextInt();\n\t\tint defM = in.nextInt();\n\t\t\n\t\tint H = in.nextInt();\n\t\tint A = in.nextInt();\n\t\tint D = in.nextInt();\n\t\t\n\t\tint minCost = Integer.MAX_VALUE;\n\t\t\n\t\tfor (int h=0; h<=500; h++){\n\t\t\tfor (int a=0; a<=500; a++){\n\t\t\t\tfor (int d=0; d<=500; d++){\n\t\t\t\t\tif (wins(hpY + h, atkY + a, defY+d, hpM, atkM, defM)){\n\t\t\t\t\t\tminCost = Math.min(minCost, h * H + a*A + d*D);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tout.println(minCost);\n }\n\t\n\tprivate boolean wins(int hpY, int atkY, int defY, int hpM, int atkM, int defM){\n\t\tint rounds1 = rounds(hpY, defY, atkM);\n\t\tint rounds2 = rounds(hpM, defM, atkY);\n\t\t\n\t\treturn (rounds2 != Integer.MAX_VALUE && rounds1 > rounds2);\n\t}\n\t\n\tprivate int rounds(int hpY, int defY, int atkM){\n\t\tint val = Math.max(0, atkM - defY);\n\t\t\n\t\tif (val == 0){\n\t\t\treturn Integer.MAX_VALUE;\n\t\t}\n\t\t\n\t\tif (hpY % val == 0){\n\t\t\treturn hpY/val;\n\t\t}\n\t\t\n\t\treturn hpY/val + 1;\n\t}\n\n}\n\n\nclass InputReader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n\n public InputReader(InputStream stream){\n reader = new BufferedReader(new InputStreamReader(stream));\n }\n\n public String next(){\n while (tokenizer == null || !tokenizer.hasMoreTokens()){\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(\"FATAL ERROR\", e);\n }\n }\n\n return tokenizer.nextToken();\n }\n\n public int nextInt(){\n return Integer.valueOf(next());\n }\n\n}", "lang": "Java 8", "bug_code_uid": "627239c119b764c8cbc1ad0e33afcad2", "src_uid": "bf8a133154745e64a547de6f31ddc884", "apr_id": "ff8ffd41a2d7e812bb4900c427f03868", "difficulty": 1800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9520496894409938, "equal_cnt": 9, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 8, "bug_source_code": "import java.util.Scanner;\n\n\npublic class C {\n\n public static void main(String[] args) {\n Scanner s = new Scanner(System.in);\n int h1 = s.nextInt();\n int a1 = s.nextInt();\n int d1 = s.nextInt();\n int h2 = s.nextInt();\n int a2 = s.nextInt();\n int d2 = s.nextInt();\n int n1 = s.nextInt();\n int n2 = s.nextInt();\n int n3 = s.nextInt();\n \n int m1 = a1 - d2;\n int m2 = a2 - d1;\n int an = (m1 <= 0) ? (-m1 + 1) : 0;\n m1 += an;\n int k = h2/m1 + (h2%m1 == 0 ? 0 : 1);\n int hn = k*m2 + 1 - h1;\n if (hn <= 0) {\n System.out.println(an*n2);\n return;\n }\n \n k = h1/m2 + (h1%m2 == 0 ? 0 : 1);\n if (k == 1) {\n an = Math.abs(m2 - m1) + an;\n } else {\n k--;\n an = h2/k + (h2%k == 0 ? 0 : 1) - m1 + an;\n }\n\n k = h2/m1 + (h2%m1 == 0 ? 0 : 1);\n int dn = h1/k;\n if (h1 <= k*dn) {\n dn--;\n }\n dn = m2 - dn;\n\n int min = Integer.MAX_VALUE;\n for (int h = 0; h <= hn; h++) {\n int p1 = h*n1;\n for (int d = 0; d <= dn; d++) {\n int p2 = p1 + d*n3;\n for (int a = 0; a <= an; a++) {\n int c = p2 + a*n2; \n if (isWin(h1 + h, a1 + a, d1 + d, h2, a2, d2) && c < min) {\n min = c;\n }\n }\n }\n }\n \n System.out.println(min);\n }\n\n private static boolean isWin(int h1, int a1, int d1, int h2, int a2, int d2) {\n int m1 = a1 - d2;\n int m2 = a2 - d1;\n if (m1 <= 0) {\n return false;\n }\n if (m2 <= 0) {\n return true;\n }\n int k1 = h1/m2 + (h1%m2 == 0? 0 : 1);\n int k2 = h2/m1 + (h2%m1 == 0? 0 : 1);\n return k1 > k2;\n }\n \n}", "lang": "Java 6", "bug_code_uid": "07232da756edd379731b232629f2b6df", "src_uid": "bf8a133154745e64a547de6f31ddc884", "apr_id": "922b8426e6923a1c0374159ef2167cf4", "difficulty": 1800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.5002442598925256, "equal_cnt": 11, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "import java.util.Scanner;\n\n\npublic class EsA {\n\n\t\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint r1,r2,c1,c2;\n\t\tr1=scan.nextInt();\n\t\tc1=scan.nextInt();\n\t\tr2=scan.nextInt();\n\t\tc2=scan.nextInt();\n\t\t\n\t\t//torre\n\t\tif(r1==c1 || r2 == c2){\n\t\t\tSystem.out.print(1);\n\t\t}else{\n\t\t\tSystem.out.print(2);\n\t\t}\n\t\tSystem.out.print(\" \");\n\t\t\n\t\t//alfiere\n\t\tif((r1+c1)%2 != (r2+c2)%2){\n\t\t\tSystem.out.print(0);\n\t\t}else {\n\t\t\tint dif1 = Math.abs(r1-c1);\n\t\t\tint dif2 = Math.abs(r1-c1);\n\t\t\tif(dif1 == dif2){\n\t\t\t\tSystem.out.print(1);\n\t\t\t}else{\n\t\t\t\tSystem.out.print(2);\n\t\t\t}\n\t\t\t\n\t\t}\n\t\tSystem.out.print(\" \");\n\t\t\n\t\t//re\n\t\tif(r1==r2){\n\t\t\tSystem.out.print(Math.abs(c2-c1));\n\t\t}else if(c1==c2){\n\t\t\tSystem.out.print(Math.abs(r2-r1));\n\t\t}else{\n\t\t\tint moves = 0;\n\t\t\tint pr=r1;\n\t\t\tint pc=c1;\n\t\t\tif(r1>r2){\n\t\t\t\twhile(true){\n\t\t\t\t\tpr+=1;\n\t\t\t\t\tpc+=1;\n\t\t\t\t\tmoves+=1;\n\t\t\t\t\tif(pr==r2){\n\t\t\t\t\t\tSystem.out.println(Math.abs(c2-c1));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else if(pc==c2){\n\t\t\t\t\t\tSystem.out.print(Math.abs(r2-r1));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\twhile(true){\n\t\t\t\t\tpr-=1;\n\t\t\t\t\tpc-=1;\n\t\t\t\t\tmoves+=1;\n\t\t\t\t\tif(pr==r2){\n\t\t\t\t\t\tSystem.out.println(Math.abs(c2-c1));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else if(pc==c2){\n\t\t\t\t\t\tSystem.out.print(Math.abs(r2-r1));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\tSystem.out.println();\n\t}\n\n}\n", "lang": "Java 7", "bug_code_uid": "f8917695b6d0d2d1b0cc3d46e9ae0ee0", "src_uid": "7dbf58806db185f0fe70c00b60973f4b", "apr_id": "93c7c57f9e97423b74e89734f170e89f", "difficulty": 1100, "tags": ["graphs", "math", "shortest paths"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6510460251046025, "equal_cnt": 27, "replace_cnt": 18, "delete_cnt": 4, "insert_cnt": 4, "fix_ops_cnt": 26, "bug_source_code": "\n * To change this template, choose Tools | Templates\n * and open the template in the editor.\n */\nimport java.util.Scanner;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.lang.Math;\n/**\n *\n * @author SONY\n */\npublic class chess {\n\n /**\n * @param args the command line arguments\n */\n public static void main(String[] args) {\n // TODO code application logic here\n Scanner s = new Scanner(System.in);\n int r1,r2,c1,c2;\n int n1,n2,n3;\n r1=s.nextInt();\n c1=s.nextInt();\n r2=s.nextInt();\n c2=s.nextInt();\n if(c2 l)\n\t\t\treturn Math.max(max , num);\n\t\tfor(long i = 1 ; i < idx ; i *= x){\n\t\t\tif(isPow(idx-i)){\n\t\t\t\tmax = Math.max(max , num);\n\t\t\t\treturn backtrack(idx+1 , 0);\n\t\t\t}\n\t\t}\n\t\treturn backtrack(idx+1 , num+1);\n\t}\n\n\tprivate static boolean isPow(long z) {\n\t\twhile(z > 1)\n\t\t\tif(z%y != 0)\n\t\t\t\treturn false;\n\t\t\telse\n\t\t\t\tz /= y;\n\t\treturn true;\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "eea2d6f06e2207269e41c4a96404daa7", "src_uid": "68ca8a8730db27ac2230f9fe9b120f5f", "apr_id": "08890c3e682a408a4424c755fb73760a", "difficulty": 1800, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9455279085406859, "equal_cnt": 12, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 6, "fix_ops_cnt": 11, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.PriorityQueue;\nimport java.util.StringTokenizer;\n\npublic class TheGoldenAge {\n\tpublic static void main(String[] args) throws IOException {\n\t\tScanner sc=new Scanner(System.in);\n\t\tlong x=sc.nextInt();\n\t\tlong y=sc.nextInt();\n\t\tlong l=sc.nextInt();\n\t\tlong r=sc.nextInt();\n\t\tint end1=log(x,r);\n\t\tint end2=log(y,r);\n\t\tPriorityQueuepq=new PriorityQueue();\n\t\tfor(int i=0;i<=end1;++i) {\n\t\t\tfor(int j=0;j<=end2;++j ) {\n\t\t\t\tlong d=(long) (Math.pow(x, i)+Math.pow(y, j));\n\t\t\t\tif(d<=r && d>=l)\n\t\t\t\t\tpq.add(d);\n\t\t\t}\n\t\t}\n\t\tpq.add(r+1);\n\t\tlong lst=l-1;\n\t\tlong max=0;\n\t\twhile(!pq.isEmpty()) {\n\t\t\tlong nxt=pq.poll();\n\t\t\tlong intrvl=nxt-(lst+1);\n\t\t\tmax=Math.max(max, intrvl);\n\t\t\tlst=nxt;\n\t\t}\n\t\tSystem.out.println(max);\n\t\t\n\t}\n\tpublic static int log(long base,long a) {\n\t\treturn (int)(Math.log(a)/Math.log(base));\n\t}\n\tstatic class Scanner \n\t{\n\t\tStringTokenizer st;\n\t\tBufferedReader br;\n\n\t\tpublic Scanner(InputStream s){\tbr = new BufferedReader(new InputStreamReader(s));}\n\n\t\tpublic String next() throws IOException \n\t\t{\n\t\t\twhile (st == null || !st.hasMoreTokens()) \n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic int nextInt() throws IOException {return Integer.parseInt(next());}\n\t\t\n\t\tpublic long nextLong() throws IOException {return Long.parseLong(next());}\n\n\t\tpublic String nextLine() throws IOException {return br.readLine();}\n\t\t\n\t\tpublic double nextDouble() throws IOException\n\t\t{\n\t\t\tString x = next();\n\t\t\tStringBuilder sb = new StringBuilder(\"0\");\n\t\t\tdouble res = 0, f = 1;\n\t\t\tboolean dec = false, neg = false;\n\t\t\tint start = 0;\n\t\t\tif(x.charAt(0) == '-')\n\t\t\t{\n\t\t\t\tneg = true;\n\t\t\t\tstart++;\n\t\t\t}\n\t\t\tfor(int i = start; i < x.length(); i++)\n\t\t\t\tif(x.charAt(i) == '.')\n\t\t\t\t{\n\t\t\t\t\tres = Long.parseLong(sb.toString());\n\t\t\t\t\tsb = new StringBuilder(\"0\");\n\t\t\t\t\tdec = true;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tsb.append(x.charAt(i));\n\t\t\t\t\tif(dec)\n\t\t\t\t\t\tf *= 10;\n\t\t\t\t}\n\t\t\tres += Long.parseLong(sb.toString()) / f;\n\t\t\treturn res * (neg?-1:1);\n\t\t}\n\t\t\n\t\tpublic boolean ready() throws IOException {return br.ready();}\n\n\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "dac2b9838a0ff1e0a094731fa8e55779", "src_uid": "68ca8a8730db27ac2230f9fe9b120f5f", "apr_id": "b6221d9636283a837f01cd39f44e42eb", "difficulty": 1800, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9755566551212271, "equal_cnt": 13, "replace_cnt": 5, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 12, "bug_source_code": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.InputMismatchException;\nimport java.util.Iterator;\n\n\npublic class Main\n{\n static class Pair{\n \tint first,second;\n \tpublic Pair(int first,int second){\n \t\tthis.first=first;\n \t\tthis.second=second;\n \t}\n }\n\t//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\tstatic class Solution\n\t{\n\t\tfinal long mod = 1000000007;\n\t\tfinal int max = (int)1e6+2;\n\t\t\n\t\t////////////////////////////////\n\t\t\n\n\t public void solve(InputReader sc,PrintWriter out) \n\t {\n\t \n\t int x1=i(),y1=i(),x2=i(),y2=i();\n\t int x=i(),y=i();\n\t if(((x2-x1)%x==0||y2-y1)%y==0)&&(((x2-x1)/x)%2==((y2-y1)/y)%2))\n\t \tout.println(\"YES\");\n\t else\n\t \tout.println(\"NO\");\n\t \n\t\t \n\t \n \t}\n \t\n \t///////////////////////////////Methods///////////////////////////////////////////////////////\n int lower_bound(ArrayList a, int key) {\n \t\tint l = 0;\n \t\tint h = a.size(); // Not n - 1\n\n \t\t\n \t\t\n \t\twhile (l < h) {\n \t\tint mid = (l + h) / 2;\n \t\tif (key <= a.get(mid)) {\n \t\th = mid;\n \t\t} else {\n \t\tl = mid + 1;\n \t\t}\n \t\t}\n \t\treturn l;\n\t\t}\n \tint upper_bound(ArrayList a, int key) {\n \t\tint l = 0;\n \t\t int h = a.size(); // Not n - 1\n\n \t\t if(key>=a.get(h-1))\n \t\t\treturn (h);\n \t\t\n \t\t\twhile (l < h) {\n \t\tint mid = (l + h) / 2;\n \t\tif (key >= a.get(mid)) {\n \t\tl = mid + 1;\n \t\t} else {\n \t\th = mid;\n \t\t}\n \t\t}\n\t\n \t\treturn l;\n\t\t}\n\n ////////////////////////////////////////////////////////////\n public int i(){\treturn sc.nextInt();}\n\t\tpublic long l(){ return sc.nextLong();}\n\t\tpublic String s(){ return sc.next();}\n\t\tpublic int[] iarr(int n){int[] ar = new int[n];for(int i=0;i= numChars){\n\t\t\t\tcurChar = 0;\n\t\t\t\ttry{\n\t\t\t\t\tnumChars = stream.read(buf);\n\t\t\t\t} catch(IOException e){\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\tif(numChars <= 0)\n\t\t\t\t\treturn -1;\n\t\t\t}\n\t\t\treturn buf[curChar++];\n\t\t}\n \n\t\tpublic int nextInt(){\n\t\t\tint c = read();\n\t\t\twhile(isSpaceChar(c))\n\t\t\t\tc = read();\n\t\t\tint sgn = 1;\n\t\t\tif(c == '-'){\n\t\t\t\tsgn = -1;\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tint res = 0;\n\t\t\tdo{\n\t\t\t\tif(c<'0' || c>'9'){\n\t\t\t\t\tthrow new InputMismatchException();}\n\t\t\t\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = read();\n\t\t\t} while(!isSpaceChar(c));\n\t\t\treturn res*sgn;\n\t\t}\n \n\t\tpublic long nextLong(){\n\t\t\tint c = read();\n\t\t\twhile(isSpaceChar(c))\n\t\t\t\tc = read();\n\t\t\tint sgn = 1;\n\t\t\tif(c == '-'){\n\t\t\t\tsgn = -1;\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tlong res = 0;\n\t\t\tdo{\n\t\t\t\tif(c<'0' || c>'9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = read();\n\t\t\t} while(!isSpaceChar(c));\n\t\t\treturn res*sgn;\n\t\t}\n \n\t\tpublic String next(){\n\t\t\tint c = read();\n\t\t\twhile(isSpaceChar(c))\n\t\t\t\tc = read();\n\t\t\tStringBuilder res = new StringBuilder();\n\t\t\tdo{\n\t\t\t\tres.appendCodePoint(c);\n\t\t\t\tc = read();\n\t\t\t}while(!isSpaceChar(c));\n\t\t\treturn res.toString();\n\t\t}\n \n\t\tpublic boolean isSpaceChar(int c){\n\t\t\tif(filter != null)\n\t\t\t\treturn filter.isSpaceChar(c);\n\t\t\treturn c==' ' || c=='\\n' || c=='\\r' || c=='\\t' || c==-1;\n\t\t}\n \n\t\tpublic interface SpaceCharFilter{\n\t\t\tpublic boolean isSpaceChar(int ch);\n\t\t}\n\t}\n\n}", "lang": "Java 8", "bug_code_uid": "b561db4c642e0ee1220d68d97ff77cac", "src_uid": "1c80040104e06c9f24abfcfe654a851f", "apr_id": "6ebfae11d616845d7ee13f205511aa5c", "difficulty": 1200, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9854954588586146, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.lang.*;\n public class templ {\n public static void main(String[] args) throws FileNotFoundException {\n try\n {\n InputReader in = new InputReader(System.in);\n PrintWriter out = new PrintWriter(System.out);\n templ ob=new templ();\n int x1=in.nextInt();\n int y1=in.nextInt();\n int x2=in.nextInt();\n int y2=in.nextInt();\n int x=in.nextInt();\n int y=in.nextInt();\n int a1=Math.abs(x1-x2);\n float a=(float)a1/x;\n int a2=Math.abs(y1-y2);\n float b=(float)a2/y;\n float k=Math.abs(a-b);\n if(k/2==(int)k/2)\n out.println(\"YES\");\n else\n out.println(\"NO\");\n out.close();\n }\n catch(Exception e){\n return;\n }\n }\n static class InputReader {\n\n private final InputStream stream;\n private final byte[] buf = new byte[8192];\n private int curChar, snumChars;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (snumChars == -1)\n throw new InputMismatchException();\n if (curChar >= snumChars) {\n curChar = 0;\n try {\n snumChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (snumChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long nextLong() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public int[] nextIntArray(int n) {\n int a[] = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = nextInt();\n }\n return a;\n }\n\n public String readString() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n\n public String nextLine() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isEndOfLine(c));\n return res.toString();\n }\n\n public boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n private boolean isEndOfLine(int c) {\n return c == '\\n' || c == '\\r' || c == -1;\n }\n\n }\n} \t", "lang": "Java 8", "bug_code_uid": "82ce646c7d6672c200c408b5aec50731", "src_uid": "1c80040104e06c9f24abfcfe654a851f", "apr_id": "1256087651f43e9ebb41b02f45a86e44", "difficulty": 1200, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9968774395003903, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\nimport java.lang.*;\nimport java.io.*;\n\npublic class Main\n{\n\tstatic class InputReader{\n\t\tprivate InputStream stream;\n\t\tprivate byte[] buf = new byte[1024];\n\t\tprivate int curChar;\n\t\tprivate int numChars;\n\t\tprivate SpaceCharFilter filter;\n \n\t\tpublic InputReader(InputStream stream) {\n\t\t\tthis.stream = stream;\n\t\t}\n \n\t\tpublic int read() {\n\t\t\tif (numChars == -1)\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tif (curChar >= numChars) {\n\t\t\t\tcurChar = 0;\n\t\t\t\ttry {\n\t\t\t\t\tnumChars = stream.read(buf);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\tif (numChars <= 0)\n\t\t\t\t\treturn -1;\n\t\t\t}\n\t\t\treturn buf[curChar++];\n\t\t}\n \n\t\tpublic int readInt() {\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = read();\n\t\t\tint sgn = 1;\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tint res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = read();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn res * sgn;\n\t\t}\n \n\t\tpublic String readString() {\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = read();\n\t\t\tStringBuilder res = new StringBuilder();\n\t\t\tdo {\n\t\t\t\tres.appendCodePoint(c);\n\t\t\t\tc = read();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn res.toString();\n\t\t}\n \n\t\tpublic boolean isSpaceChar(int c) {\n\t\t\tif (filter != null)\n\t\t\t\treturn filter.isSpaceChar(c);\n\t\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t\t}\n \n\t\tpublic String next() {\n\t\t\treturn readString();\n\t\t}\n \n\t\tpublic interface SpaceCharFilter {\n\t\t\tpublic boolean isSpaceChar(int ch);\n\t\t}\n\t}\n\t\n \nstatic class OutputWriter {\n\t\tprivate final PrintWriter writer;\n \n\t\tpublic OutputWriter(OutputStream outputStream) {\n\t\t\twriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n\t\t}\n \n\t\tpublic OutputWriter(Writer writer) {\n\t\t\tthis.writer = new PrintWriter(writer);\n\t\t}\n \n\t\tpublic void print(Object...objects) {\n\t\t\tfor (int i = 0; i < objects.length; i++) {\n\t\t\t\tif (i != 0)\n\t\t\t\t\twriter.print(' ');\n\t\t\t\twriter.print(objects[i]);\n\t\t\t}\n\t\t}\n \n\t\tpublic void printLine(Object...objects) {\n\t\t\tprint(objects);\n\t\t\twriter.println();\n\t\t}\n \n\t\tpublic void close() {\n\t\t\twriter.close();\n\t\t}\n \n\t\tpublic void flush() {\n\t\t\twriter.flush();\n\t\t}\n \n\t\t}\n \n static class IOUtils {\n \n\t\tpublic static int[] readIntArray(InputReader in, int size) {\n\t\t\tint[] array = new int[size];\n\t\t\tfor (int i = 0; i < size; i++)\n\t\t\t\tarray[i] = in.readInt();\n\t\t\treturn array;\n\t\t}\n }\n static int[] a = new int[200005];\n static int[] s = new int[200005];\n static OutputWriter out;\n static InputReader in;\n public static void main (String[] args) throws java.lang.Exception\n\t{\n\t out = new OutputWriter(System.out);\n\t\tin = new InputReader(System.in);\n int x = in.readInt();\n int y = in.readInt();\n x = in.readInt()-x; y = in.readInt()-y;\n int a = in.readInt(); int b = in.readInt();\n if(x%a==0 && y%b==0)if((x/a+y/b)%2==0)out.print(\"YES\");\n else out.print(\"NO\");\n out.flush();\n out.close();\n\t}\n\t\n\t\n\tpublic static void add(int index, int value, int[] b){\n\t while(index < b.length){\n\t b[index] += value;\n\t index = index + (index & (-index));\n\t }\n\t}\n\t\n\tpublic static int getSum(int index, int [] b){\n\t int sum = 0;\n\t while(index > 0){\n\t sum += b[index];\n\t index = index - (index&(-index));\n\t }\n\t return sum;\n\t}\n\t\n\tpublic static void printArray(int[] a){\n\t for(int i=1; i{\n\t int s;\n\t //int d;\n\t int len;\n\t public Pair(int a, int c){\n\t s = a; len = c;\n\t }\n\t public int compareTo(Pair p){\n\t if(this.len > p.len)return 1;\n\t else if(this.len < p.len)return -1;\n\t return 0;\n\t }\n\t}\n}", "lang": "Java 8", "bug_code_uid": "60a1c477ce341861f6359087f1a0a1d5", "src_uid": "1c80040104e06c9f24abfcfe654a851f", "apr_id": "89336d32eaf8a1b6ec6cfc315da70487", "difficulty": 1200, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9740791268758526, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "import java.util.Scanner;\n\npublic class MinimumTriangulation {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint n = scanner.nextInt();\n\t\tlong dp[] = new long[n];\n\t\tdp[1] = 1;\n\t\tdp[2] = 2;\n\t\tdp[3] = 6;\n\t\tif(n > 3) {\n\t\t\tfor(int i = 4; i < n; i++) {\n\t\t\t\tdp[i] = dp[i-1]*(i-1)*i;\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(dp[n-1]);\n \t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "53df4cbf688de7cb602214fc057d256e", "src_uid": "1bd29d7a8793c22e81a1f6fd3991307a", "apr_id": "ff5af378a9260da7325f1a56dd968f72", "difficulty": 1200, "tags": ["dp", "math", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.4654226125137212, "equal_cnt": 10, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "\nimport java.util.Scanner;\n\npublic class DZY_LOVES_SUBSEQ {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner nik = new Scanner(System.in);\n\t\tint n = nik.nextInt();\n\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = nik.nextInt();\n\t\t}\n\t\tint k = 1;\n\t\tint l = 0;\n\t\tint max = 1;\n\t\tfor (int i = 0; i < n; i++) {\n\n\t\t\tif (i + 1 < n && a[i + 1] < a[i] && k == 0) {\n\n\t\t\t\twhile (l < n && a[l + 1] < a[l]) {\n\t\t\t\t\tl++;\n\t\t\t\t}\n\n\t\t\t} else if (i + 1 < n && a[i + 1] < a[i] && k == 1) {\n\t\t\t\tk--;\n\t\t\t}\n\t\t\tmax = max > (i - l + 1) ? max : (i - l + 1);\n\t\t}\n\t\tSystem.out.println(max);\n\t}\n\n}\n\n/*\n * \n * 8 2 4 5 1 7 8 9 10\n * \n */", "lang": "Java 8", "bug_code_uid": "98abe745e0ea3084bed1ff4bb8268e66", "src_uid": "1bd29d7a8793c22e81a1f6fd3991307a", "apr_id": "5cec68b64bab7ac852deee9575cd9785", "difficulty": 1200, "tags": ["dp", "math", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9541864139020537, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "public class T1140D {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int result = 0;\n for (int i = 2; i < n; ++i) {\n result += i * (i + 1);\n }\n System.out.println(result);\n }\n}", "lang": "Java 8", "bug_code_uid": "8ecdaaff237b3732735510c3d0d8529f", "src_uid": "1bd29d7a8793c22e81a1f6fd3991307a", "apr_id": "8b45c04f69276feabf7557cade630c1d", "difficulty": 1200, "tags": ["dp", "math", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9930987359070721, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\n\npublic class Solution {\n\n//\t\tpublic static final double eps = 1e-9;\n//\t\tpublic static final int mod = 1000000007;\n//\t\tpublic static final double pi = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679;\n//\t\tpublic static final int sievesize = (int) (1e7 + 10);\n//\t\tpublic static boolean[] prime;\n//\t\tpublic static final int dx[] = {1, -1, 0, 0};\n//\t\tpublic static final int dy[] = {0, 0, 1, -1};\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tInputReader in = new InputReader(inputStream);\n\t\tOutputWriter out = new OutputWriter(outputStream);\n\t\tTask solver = new Task();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n\n\tstatic class Task {\n\n\t\tpublic void solve(int testNumber, InputReader in, OutputWriter out) throws IOException {\n\t\t\tString str = in.next();\n\t\t\tStringBuilder res = new StringBuilder();\n\t\t\tint i = 0, j = 0;\n\t\t\tif (str.substring(0, 3).equals(\"dot\")) {\n\t\t\t\tres.append(\"dot\");\n\t\t\t\ti = 3;\n\t\t\t}\n\t\t\telse if (str.substring(0, 2).equals(\"at\")) {\n\t\t\t\tres.append(\"at\");\n\t\t\t\ti = 2;\n\t\t\t}\n\t\t\tif (str.substring(str.length() - 3).equals(\"dot\")) {\n\t\t\t\tj = str.length() - 3;\n\t\t\t}\n\t\t\telse if (str.substring(str.length() - 2).equals(\"at\")) {\n\t\t\t\tj = str.length() - 2;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tj = str.length();\n\t\t\t}\n\t\t\tboolean flag = false;\n\t\t\twhile (i < j) {\n\t\t\t\tif (i + 3 < str.length() && str.substring(i, i + 3).equals(\"dot\")) {\n\t\t\t\t\tres.append(\".\");\n\t\t\t\t\ti += 3;\n\t\t\t\t}\n\t\t\t\telse if (i + 2 < str.length() && str.substring(i, i + 2).equals(\"at\")) {\n\t\t\t\t\tif (!flag) {\n\t\t\t\t\t\tres.append(\"@\");\n\t\t\t\t\t\ti += 2;\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\tres.append(str.charAt(i));\n\t\t\t\t\ti++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tres.append(str.substring(j));\n\t\t\tout.println(res);\n\t\t}\n\n//\t\tstatic class Node {\n//\t\t\tString name;\n//\t\t\tLinkedList list;\n//\t\t\t\n//\t\t\tpublic Node(String name) {\n//\t\t\t\tthis.name = name;\n//\t\t\t\tlist = new LinkedList<>();\n//\t\t\t}\n//\t\t}\n// \n//\t\tstatic class Pair { \t\n//\t \tint first, second;\n//\t\t \t\n//\t\t public Pair(int first, int second) {\n//\t \t\tthis.first = first;\n//\t\t\t\tthis.second = second;\n//\t\t\t}\n//\t }\n\t}\n\n\t//\tpublic static int[] shuffle(int arr[], Random gen) {\n\t//\t\tfor(int i = 0, n = arr.length; i < n; i++)\n\t//\t\t{\n\t//\t\t\tint index = gen.nextInt(n - i) + i;\n\t//\t\t\tint temp = arr[i];\n\t//\t\t\tarr[i] = arr[index];\n\t//\t\t\tarr[index] = temp;\n\t//\t\t}\n\t//\t\treturn arr;\n\t//\t}\n\t//\n\t//\tpublic static boolean triangle(long a, long b, long c){\n\t//\t return ((a+b) > c && (b+c) >a && (a+c) > b);\n\t//\t}\n\t//\t\t\n\t//\tpublic static boolean isPerfectSquare(long n){\n\t//\t\tif (n < 0) \n\t//\t \treturn false;\n\t//\t long test = (long) (Math.sqrt(n) + 0.5);\n\t//\t return test*test == n;\n\t//\t}\n\t//\t\t\n\t//\tpublic static int isnum(char s){\n\t//\t\tif(s=='1' || s=='2' || s=='3' || s=='4' || s=='5' || s=='6' || s=='7' || s=='8' || s=='9' || s=='0') \n\t//\t \treturn 1; \n\t//\t\treturn 0;\n\t//\t}\n\t//\t\t\n\t//\tpublic static long nextPowerOf2(long n){\n\t//\t n--;\n\t//\t n |= n >> 1;\n\t//\t n |= n >> 2;\n\t//\t n |= n >> 4;\n\t//\t n |= n >> 8;\n\t//\t n |= n >> 16;\n\t//\t n++;\n\t//\t return n;\n\t//\t}\n\t//\t\t\n//\t\tpublic static int gcd(int a, int b){\n//\t\t int t; \n//\t\t while (b > 0){ \n//\t\t \ta = a % b; \n//\t\t \tt = a; \n//\t\t \ta = b; \n//\t\t \tb = t; \n//\t \t}\n//\t\t return a;\n//\t\t}\n\t//\t\t\n\t//\tpublic static void sieve(int n){\n\t//\t\tprime=new boolean[sievesize+1];\n\t//\t\tArrays.fill(prime, true);\n\t//\t long x, y; \n\t//\t for(x = 2; x * x <= sievesize; x++)\n\t//\t { \n\t//\t \tif(prime[(int) x])\n\t//\t \t\tfor(y = x * 2; y <= sievesize; y += x) \n\t//\t \t\t\tprime[(int) y]=false; \n\t//\t }\n\t//\t}\n\n\tstatic class InputReader {\n\t\tpublic BufferedReader reader;\n\t\tpublic StringTokenizer tokenizer;\n\n\t\tpublic InputReader(InputStream stream) {\n\t\t\treader = new BufferedReader(new InputStreamReader(stream), 32768);\n\t\t\ttokenizer = null;\n\t\t}\n\n\t\tpublic String next() {\n\t\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn tokenizer.nextToken();\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\t\t\n\t\tpublic char nextChar() {\n\t\t\treturn next().charAt(0);\n\t\t}\n\t\t\n\t\tpublic float nextFloat() {\n\t\t\treturn Float.parseFloat(next());\n\t\t}\n\t\t\n\t\tpublic double nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tpublic int[] nextIntArray(int size) {\n\t\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}\n\t\t\t}\n\t\t\tint[] arr=new int[size];\n\t\t\tfor(int i = 0; i < size; i++) \n\t\t\t\tarr[i] = Integer.parseInt(tokenizer.nextToken());\n\t\t\treturn arr;\n\t\t}\n\n\t\tpublic long[] nextLongArray(int size) {\n\t\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}\n\t\t\t}\n\t\t\tlong[] arr=new long[size];\n\t\t\tfor(int i = 0; i < size; i++) \n\t\t\t\tarr[i] = Long.parseLong(tokenizer.nextToken());\n\t\t\treturn arr;\n\t\t}\n\n\t\tpublic double[] nextDoubleArray(int size) {\n\t\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}\n\t\t\t}\n\t\t\tdouble[] arr=new double[size];\n\t\t\tfor(int i = 0; i < size; i++) \n\t\t\t\tarr[i] = Double.parseDouble(tokenizer.nextToken());\n\t\t\treturn arr;\n\t\t}\n\n\t\tpublic String[] nextStringArray(int size) throws IOException {\n\t\t\tString[] arr=new String[size];\n\t\t\tfor(int i = 0; i < size; i++) \n\t\t\t\tarr[i] = reader.readLine();\n\t\t\treturn arr;\n\t\t}\n\n\t\tpublic char[] nextCharArray(int size) throws IOException {\n\t\t\tchar[] arr=reader.readLine().toCharArray();\n\t\t\treturn arr;\n\t\t}\n\t}\n\n\tstatic class OutputWriter {\n\t\tpublic PrintWriter pw;\n\n\t\tpublic OutputWriter(OutputStream stream) {\n\t\t\tpw = new PrintWriter(stream);\n\t\t}\n\t\t\n\t\tpublic void println() {\n\t\t\tpw.println();\n\t\t}\n\n\t\tpublic void println(Object str) {\n\t\t\tpw.println(str);\n\t\t}\n\n\t\tpublic void print(Object str) {\n\t\t\tpw.print(str + \" \");\n\t\t}\n\n\t\tpublic void close() {\n\t\t\tpw.close();\n\t\t}\n\n\t\tpublic void flush() {\n\t\t\tpw.flush();\n\t\t}\n\n\t\tpublic void printStringArray(String[] arr) {\n\t\t\tfor(int i = 0; i < arr.length; i++)\n\t\t\t\tpw.println(arr[i]);\n\t\t}\n\n\t\tpublic void printIntArray(int[] arr) {\n\t\t\tfor(int i = 0; i < arr.length; i++)\n\t\t\t\tpw.print(arr[i] + \" \");\n\t\t}\n\n\t\tpublic void printLongArray(long[] arr) {\n\t\t\tfor(int i = 0; i < arr.length; i++)\n\t\t\t\tpw.print(arr[i] + \" \");\n\t\t}\n\n\t\tpublic void printCharArray(char[] arr) {\n\t\t\tfor(int i = 0; i < arr.length; i++)\n\t\t\t\tpw.print(arr[i] + \" \");\n\t\t}\n\n\t\tpublic void printFloatArray(float[] arr) {\n\t\t\tfor(int i = 0; i < arr.length; i++)\n\t\t\t\tpw.print(arr[i] + \" \");\n\t\t}\n\n\t\tpublic void printDoubleArray(double[] arr) {\n\t\t\tfor(int i = 0; i < arr.length; i++)\n\t\t\t\tpw.print(arr[i] + \" \");\n\t\t}\n\t}\n}", "lang": "Java 8", "bug_code_uid": "65a09021bc8105b7399b483cc98693a0", "src_uid": "a11c9679d8e2dca51be17d466202df6e", "apr_id": "a086248fe65035731f8a4777eb283f8e", "difficulty": 1300, "tags": ["implementation", "expression parsing"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.999347045380346, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n\n public static void main(String args[]) throws IOException {\n Reader.init(System.in);\n String ar = Reader.next();\n ar = ar.replace(\"dot\", \".\");\n int x = ar.substring(1, ar.length()-1).indexOf(\"at\");\n \n String tem = ar;\n ar = ar.substring(0, x);\n ar+=\"@\";\n ar+=tem.substring(x+2, tem.length());\n if(ar.charAt(0)=='.')\n ar= ar.replaceFirst(\".\", \"dot\");\n if(ar.charAt(ar.length()-1)=='.'){\n StringBuilder b = new StringBuilder(ar);\n b.replace(ar.lastIndexOf(\".\"),ar.lastIndexOf(\".\")+1, \"dot\");\n ar = b.toString();\n }\n \n System.out.println(ar);\n \n \n\n \n\n }\n\n private static boolean isSorted(int[] ar) {\n for (int i = 0; i < ar.length - 1; i++) {\n if (ar[i + 1] - ar[i] != 1) {\n return false;\n }\n }\n return true;\n }\n}\n\nclass suger implements Comparable {\n\n double d;\n double c;\n\n public suger(double d, double c) {\n this.d = d;\n this.c = c;\n }\n\n @Override\n public int compareTo(suger o) {\n return Double.compare(this.c, o.c);\n }\n\n}\n\nclass Reader {\n\n static BufferedReader reader;\n static StringTokenizer tokenizer;\n\n /**\n * call this method to initialize reader for InputStream\n */\n static void init(InputStream input) {\n reader = new BufferedReader(\n new InputStreamReader(input));\n tokenizer = new StringTokenizer(\"\");\n }\n\n /**\n * get next word\n */\n static String next() throws IOException {\n while (!tokenizer.hasMoreTokens()) {\n// TODO add check for eof if necessary\n tokenizer = new StringTokenizer(\n reader.readLine());\n }\n return tokenizer.nextToken();\n }\n\n static int nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n\n static long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n\n static double nextDouble() throws IOException {\n return Double.parseDouble(next());\n }\n\n static public void nextIntArrays(int[]... arrays) throws IOException {\n for (int i = 1; i < arrays.length; ++i) {\n if (arrays[i].length != arrays[0].length) {\n throw new InputMismatchException(\"Lengths are different\");\n }\n }\n for (int i = 0; i < arrays[0].length; ++i) {\n for (int[] array : arrays) {\n array[i] = nextInt();\n }\n }\n }\n\n static public void nextLineArrays(String[]... arrays) throws IOException {\n for (int i = 1; i < arrays.length; ++i) {\n if (arrays[i].length != arrays[0].length) {\n throw new InputMismatchException(\"Lengths are different\");\n }\n }\n for (int i = 0; i < arrays[0].length; ++i) {\n for (String[] array : arrays) {\n array[i] = reader.readLine();\n }\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "9142ab6e94280cff8703ef02b5b695f7", "src_uid": "a11c9679d8e2dca51be17d466202df6e", "apr_id": "ff732916c9917f90ff409253cebb13c1", "difficulty": 1300, "tags": ["implementation", "expression parsing"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9997864616698697, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "//package round673;\nimport java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.InputMismatchException;\n\npublic class D {\n\tInputStream is;\n\tPrintWriter out;\n\tString INPUT = \"\";\n\t\n\tvoid solve()\n\t{\n\t\tint n = ni(), m = ni(), Q = ni();\n\t\tint[] a = na(n);\n\t\tint[] from = new int[m];\n\t\tint[] to = new int[m];\n\t\tboolean[] remain = new boolean[m];\n\t\tfor(int i = 0;i < m;i++) {\n\t\t\tfrom[i] = ni()-1;\n\t\t\tto[i] = ni()-1;\n\t\t}\n\t\tArrays.fill(remain, true);\n\t\t\n\t\t\n\t\tint[][] qs = new int[Q][];\n\t\tfor(int i = 0;i < Q;i++) {\n\t\t\tqs[i] = new int[] {ni(), ni()-1};\n\t\t\tif(qs[i][0] == 2) {\n\t\t\t\tremain[qs[i][1]] = false;\n\t\t\t}\n\t\t}\n\t\t\n\t\tint gen = n;\n\t\tint[] par = new int[2*n];\n\t\tArrays.fill(par, -1);\n\t\tDJSet ds = new DJSet(n);\n\t\tfor(int i = 0;i < m;i++) {\n\t\t\tif(remain[i]) {\n\t\t\t\tif(!ds.equiv(from[i], to[i])) {\n\t\t\t\t\tint f = ds.tr[ds.root(from[i])];\n\t\t\t\t\tint t = ds.tr[ds.root(to[i])];\n\t\t\t\t\tds.union(from[i], to[i]);\n\t\t\t\t\tpar[f] = gen;\n\t\t\t\t\tpar[t] = gen;\n\t\t\t\t\tds.tr[ds.root(from[i])] = gen;\n\t\t\t\t\tgen++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tint[] time = new int[2*n];\n\t\tArrays.fill(time, Q);\n\t\tfor(int i = Q-1;i >= 0;i--) {\n\t\t\tif(qs[i][0] == 2) {\n\t\t\t\tint ind = qs[i][1];\n\t\t\t\tif(!ds.equiv(from[ind], to[ind])) {\n\t\t\t\t\tint f = ds.tr[ds.root(from[ind])];\n\t\t\t\t\tint t = ds.tr[ds.root(to[ind])];\n\t\t\t\t\tds.union(from[ind], to[ind]);\n\t\t\t\t\tpar[f] = gen;\n\t\t\t\t\tpar[t] = gen;\n\t\t\t\t\tds.tr[ds.root(from[ind])] = gen;\n\t\t\t\t\ttime[gen] = i;\n\t\t\t\t\tgen++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\ttime[2*n-1] = -1;\n\t\tfor(int i = n;i < 2*n-1;i++) {\n\t\t\tif(par[i] == -1) {\n\t\t\t\tpar[i] = 2*n-1;\n\t\t\t}\n\t\t}\n\t\t\n\t\tint[][] g = parentToG(par);\n\t\tint[][] rights = makeRights(g, par, 2*n-1);\n\t\tint[] iord = rights[1], right = rights[2];\n\t\tint[][] spar = logstepParents(par);\n\t\t\n\t\tint[] b = new int[2*n];\n\t\tfor(int i = 0;i < n;i++) {\n\t\t\tb[iord[i]] = -a[i];\n\t\t}\n\t\tSegmentTreeRMQPos st = new SegmentTreeRMQPos(b);\n\t\tfor(int i = 0;i < Q;i++) {\n\t\t\tint[] q = qs[i];\n\t\t\tif(q[0] == 1) {\n\t\t\t\tint v = q[1];\n\t\t\t\tfor(int d = spar.length-1;d >= 0;d--) {\n\t\t\t\t\tint anc = spar[d][v];\n\t\t\t\t\tif(anc == -1)continue;\n\t\t\t\t\tif(time[anc] < i)continue;\n\t\t\t\t\tv = anc;\n\t\t\t\t}\n\t\t\t\tint[] vp = st.min(iord[v], right[iord[v]]+1);\n\t\t\t\tout.println(-vp[0]);\n\t\t\t\tst.update(vp[1], 0);\n\t\t\t}\n\t\t}\n\t}\n\t\n\tpublic static class SegmentTreeRMQPos {\n\t\tpublic int M, H, N, B;\n\t\tpublic int[] st;\n\t\tpublic int[] pos;\n\t\t\n\t\tpublic SegmentTreeRMQPos(int n)\n\t\t{\n\t\t\tN = n;\n\t\t\tM = Integer.highestOneBit(Math.max(n, 1))<<2;\n\t\t\tH = M>>>1;\n\t\t\tB = Integer.numberOfTrailingZeros(H);\n\t\t\tst = new int[M];\n\t\t\tpos = new int[M];\n\t\t\tfor(int i = M-1;i >= H;i--)pos[i] = i-H;\n\t\t\tfor(int i = H-1;i >= 0;i--){\n\t\t\t\tpos[i] = pos[2*i];\n\t\t\t}\n\t\t}\n\t\t\n\t\tpublic SegmentTreeRMQPos(int[] a)\n\t\t{\n\t\t\tN = a.length;\n\t\t\tM = Integer.highestOneBit(Math.max(N, 1))<<2;\n\t\t\tH = M>>>1;\n\t\t\tB = Integer.numberOfTrailingZeros(H);\n\t\t\tst = new int[M];\n\t\t\tpos = new int[M];\n\t\t\tfor(int i = 0;i < N;i++){\n\t\t\t\tst[H+i] = a[i];\n\t\t\t\tpos[H+i] = i;\n\t\t\t}\n\t\t\tArrays.fill(st, H+N, M, Integer.MAX_VALUE);\n\t\t\tfor(int i = (M>>1)-1;i >= 1;i--)propagate(i);\n\t\t}\n\t\t\n\t\tpublic void update(int p, int x)\n\t\t{\n\t\t\tst[H+p] = x;\n\t\t\tfor(int i = (H+p)>>>1;i >= 1;i >>>= 1)propagate(i);\n\t\t}\n\t\t\n\t\tprivate void propagate(int i)\n\t\t{\n\t\t\tif(st[i*2] <= st[i*2+1]){\n\t\t\t\tst[i] = st[i*2];\n\t\t\t\tpos[i] = pos[i*2];\n\t\t\t}else{\n\t\t\t\tst[i] = st[i*2+1];\n\t\t\t\tpos[i] = pos[i*2+1];\n\t\t\t}\n\t\t}\n\t\t\n\t\tpublic int[] min(int f, int t) { return min(f, t, B); }\n\t\t\n\t\tpublic int[] min(int f, int t, int b)\n\t\t{\n\t\t\tif(f>>b<>b<>b], pos[(H|f)>>b]};\n\t\t\t}\n\t\t\t\n\t\t\tb--;\n\t\t\tif((f^t)<<31-b<0){\n\t\t\t\tint w = t>>b< 0){\n\t\t\tint cur = stack[p-1];\n\t\t\tord[r++] = cur;\n\t\t\tp--;\n\t\t\tfor(int e : g[cur]){\n\t\t\t\tif(!ved[e]){\n\t\t\t\t\tved[e] = true;\n\t\t\t\t\tstack[p++] = e;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn ord;\n\t}\n\t\n\tpublic static int[][] makeRights(int[][] g, int[] par, int root)\n\t{\n\t\tint n = g.length;\n\t\tint[] ord = sortByPreorder(g, root);\n\t\tint[] iord = new int[n];\n\t\tfor(int i = 0;i < n;i++)iord[ord[i]] = i;\n\t\t\n\t\tint[] right = new int[n];\n\t\tfor(int i = n-1;i >= 1;i--){\n\t\t\tif(right[i] == 0)right[i] = i;\n\t\t\tint p = iord[par[ord[i]]];\n\t\t\tright[p] = Math.max(right[p], right[i]);\n\t\t}\n\t\treturn new int[][]{ord, iord, right};\n\t}\n\n\t\n\tpublic static int lca2(int a, int b, int[][] spar, int[] depth) {\n\t\tif (depth[a] < depth[b]) {\n\t\t\tb = ancestor(b, depth[b] - depth[a], spar);\n\t\t} else if (depth[a] > depth[b]) {\n\t\t\ta = ancestor(a, depth[a] - depth[b], spar);\n\t\t}\n\n\t\tif (a == b)\n\t\t\treturn a;\n\t\tint sa = a, sb = b;\n\t\tfor (int low = 0, high = depth[a], t = Integer.highestOneBit(high), k = Integer\n\t\t\t\t.numberOfTrailingZeros(t); t > 0; t >>>= 1, k--) {\n\t\t\tif ((low ^ high) >= t) {\n\t\t\t\tif (spar[k][sa] != spar[k][sb]) {\n\t\t\t\t\tlow |= t;\n\t\t\t\t\tsa = spar[k][sa];\n\t\t\t\t\tsb = spar[k][sb];\n\t\t\t\t} else {\n\t\t\t\t\thigh = low | t - 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn spar[0][sa];\n\t}\n\n\tprotected static int ancestor(int a, int m, int[][] spar) {\n\t\tfor (int i = 0; m > 0 && a != -1; m >>>= 1, i++) {\n\t\t\tif ((m & 1) == 1)\n\t\t\t\ta = spar[i][a];\n\t\t}\n\t\treturn a;\n\t}\n\n\tpublic static int[][] logstepParents(int[] par) {\n\t\tint n = par.length;\n\t\tint m = Integer.numberOfTrailingZeros(Integer.highestOneBit(n - 1)) + 1;\n\t\tint[][] pars = new int[m][n];\n\t\tpars[0] = par;\n\t\tfor (int j = 1; j < m; j++) {\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tpars[j][i] = pars[j - 1][i] == -1 ? -1 : pars[j - 1][pars[j - 1][i]];\n\t\t\t}\n\t\t}\n\t\treturn pars;\n\t}\n\t\n\tpublic static int[][] parentToG(int[] par)\n\t{\n\t\tint n = par.length;\n\t\tint[] ct = new int[n];\n\t\tfor(int i = 0;i < n;i++){\n\t\t\tif(par[i] >= 0){\n\t\t\t\tct[i]++;\n\t\t\t\tct[par[i]]++;\n\t\t\t}\n\t\t}\n\t\tint[][] g = new int[n][];\n\t\tfor(int i = 0;i < n;i++){\n\t\t\tg[i] = new int[ct[i]];\n\t\t}\n\t\tfor(int i = 0;i < n;i++){\n\t\t\tif(par[i] >= 0){\n\t\t\t\tg[par[i]][--ct[par[i]]] = i;\n\t\t\t\tg[i][--ct[i]] = par[i];\n\t\t\t}\n\t\t}\n\t\treturn g;\n\t}\n\n\t\n\tpublic static class DJSet {\n\t\tpublic int[] upper;\n\t\tpublic int[] tr;\n\n\t\tpublic DJSet(int n) {\n\t\t\tupper = new int[n];\n\t\t\tArrays.fill(upper, -1);\n\t\t\ttr = new int[n];\n\t\t\tfor(int i = 0;i < n;i++) tr[i] = i;\n\t\t}\n\n\t\tpublic int root(int x) {\n\t\t\treturn upper[x] < 0 ? x : (upper[x] = root(upper[x]));\n\t\t}\n\n\t\tpublic boolean equiv(int x, int y) {\n\t\t\treturn root(x) == root(y);\n\t\t}\n\n\t\tpublic boolean union(int x, int y) {\n\t\t\tx = root(x);\n\t\t\ty = root(y);\n\t\t\tif (x != y) {\n\t\t\t\tif (upper[y] < upper[x]) {\n\t\t\t\t\tint d = x;\n\t\t\t\t\tx = y;\n\t\t\t\t\ty = d;\n\t\t\t\t}\n\t\t\t\tupper[x] += upper[y];\n\t\t\t\tupper[y] = x;\n\t\t\t}\n\t\t\treturn x == y;\n\t\t}\n\n\t\tpublic int count() {\n\t\t\tint ct = 0;\n\t\t\tfor (int u : upper)\n\t\t\t\tif (u < 0)\n\t\t\t\t\tct++;\n\t\t\treturn ct;\n\t\t}\n\t}\n\n\t\n\tvoid run() throws Exception\n\t{\n\t\tis = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n\t\tout = new PrintWriter(System.out);\n\t\t\n\t\tlong s = System.currentTimeMillis();\n\t\tsolve();\n\t\tout.flush();\n\t\ttr(System.currentTimeMillis()-s+\"ms\");\n\t}\n\t\n\tpublic static void main(String[] args) throws Exception { new D().run(); }\n\t\n\tprivate byte[] inbuf = new byte[1024];\n\tpublic int lenbuf = 0, ptrbuf = 0;\n\t\n\tprivate int readByte()\n\t{\n\t\tif(lenbuf == -1)throw new InputMismatchException();\n\t\tif(ptrbuf >= lenbuf){\n\t\t\tptrbuf = 0;\n\t\t\ttry { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }\n\t\t\tif(lenbuf <= 0)return -1;\n\t\t}\n\t\treturn inbuf[ptrbuf++];\n\t}\n\t\n\tprivate boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }\n\tprivate int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }\n\t\n\tprivate double nd() { return Double.parseDouble(ns()); }\n\tprivate char nc() { return (char)skip(); }\n\t\n\tprivate String ns()\n\t{\n\t\tint b = skip();\n\t\tStringBuilder sb = new StringBuilder();\n\t\twhile(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\t\n\tprivate char[] ns(int n)\n\t{\n\t\tchar[] buf = new char[n];\n\t\tint b = skip(), p = 0;\n\t\twhile(p < n && !(isSpaceChar(b))){\n\t\t\tbuf[p++] = (char)b;\n\t\t\tb = readByte();\n\t\t}\n\t\treturn n == p ? buf : Arrays.copyOf(buf, p);\n\t}\n\t\n\tprivate char[][] nm(int n, int m)\n\t{\n\t\tchar[][] map = new char[n][];\n\t\tfor(int i = 0;i < n;i++)map[i] = ns(m);\n\t\treturn map;\n\t}\n\t\n\tprivate int[] na(int n)\n\t{\n\t\tint[] a = new int[n];\n\t\tfor(int i = 0;i < n;i++)a[i] = ni();\n\t\treturn a;\n\t}\n\t\n\tprivate int ni()\n\t{\n\t\tint num = 0, b;\n\t\tboolean minus = false;\n\t\twhile((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));\n\t\tif(b == '-'){\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\t\n\t\twhile(true){\n\t\t\tif(b >= '0' && b <= '9'){\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t}else{\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\t\n\tprivate long nl()\n\t{\n\t\tlong num = 0;\n\t\tint b;\n\t\tboolean minus = false;\n\t\twhile((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));\n\t\tif(b == '-'){\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\t\n\t\twhile(true){\n\t\t\tif(b >= '0' && b <= '9'){\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t}else{\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\t\n\tprivate boolean oj = System.getProperty(\"ONLINE_JUDGE\") != null;\n\tprivate void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }\n}\n", "lang": "Java 11", "bug_code_uid": "4657821dbfc1a9cc1e5814ff64c1cf5f", "src_uid": "ad014bde729222db14f38caa521e4167", "apr_id": "bc5c49abf6fd06d912ba3a39561bd187", "difficulty": 2600, "tags": ["dsu", "data structures", "implementation", "graphs", "trees"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9936416320593134, "equal_cnt": 15, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 8, "fix_ops_cnt": 14, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class E {\n\tFastScanner in;\n\tPrintWriter out;\n\tboolean systemIO = true;\n\n\tpublic class DSU {\n\t\tint[] sz;\n\t\tint[] p;\n\n\t\tpublic DSU(int n) {\n\t\t\tsz = new int[n];\n\t\t\tp = new int[n];\n\t\t\tfor (int i = 0; i < p.length; i++) {\n\t\t\t\tp[i] = i;\n\t\t\t\tsz[i] = 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic int get(int x) {\n\t\t\tif (x == p[x]) {\n\t\t\t\treturn x;\n\t\t\t}\n\t\t\tint par = get(p[x]);\n\t\t\tp[x] = par;\n\t\t\treturn par;\n\t\t}\n\n\t\tpublic boolean unite(int a, int b) {\n\t\t\tint pa = get(a);\n\t\t\tint pb = get(b);\n\t\t\tif (pa == pb) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (sz[pa] < sz[pb]) {\n\t\t\t\tp[pa] = pb;\n\t\t\t\tsz[pb] += sz[pa];\n\t\t\t} else {\n\t\t\t\tp[pb] = pa;\n\t\t\t\tsz[pa] += sz[pb];\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t}\n\n\tpublic class SegmentTreeAdd {\n\t\tint pow;\n\t\tlong[] max;\n\t\tlong[] delta;\n\t\tboolean[] flag;\n\n\t\tpublic SegmentTreeAdd(long[] a) {\n\t\t\tpow = 1;\n\t\t\twhile (pow < a.length) {\n\t\t\t\tpow *= 2;\n\t\t\t}\n\t\t\tflag = new boolean[2 * pow];\n\t\t\tmax = new long[2 * pow];\n\t\t\tdelta = new long[2 * pow];\n\t\t\tfor (int i = 0; i < max.length; i++) {\n\t\t\t\tmax[i] = Long.MIN_VALUE / 2;\n\t\t\t}\n\t\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\t\tmax[pow + i] = a[i];\n\t\t\t}\n\t\t\tfor (int i = pow - 1; i > 0; i--) {\n\t\t\t\tmax[i] = f(max[2 * i], max[2 * i + 1]);\n\t\t\t}\n\t\t}\n\n\t\tpublic long get(int v, int tl, int tr, int l, int r) {\n\t\t\tpush(v, tl, tr);\n\t\t\tif (l > r) {\n\t\t\t\treturn Long.MIN_VALUE / 2;\n\t\t\t}\n\t\t\tif (l == tl && r == tr) {\n\t\t\t\treturn max[v];\n\t\t\t}\n\t\t\tint tm = (tl + tr) / 2;\n\t\t\treturn f(get(2 * v, tl, tm, l, Math.min(r, tm)), get(2 * v + 1, tm + 1, tr, Math.max(l, tm + 1), r));\n\t\t}\n\n\t\tpublic void set(int v, int tl, int tr, int l, int r, long x) {\n\t\t\tpush(v, tl, tr);\n\t\t\tif (l > tr || r < tl) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (l <= tl && r >= tr) {\n\t\t\t\tdelta[v] += x;\n\t\t\t\tflag[v] = true;\n\t\t\t\tpush(v, tl, tr);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tint tm = (tl + tr) / 2;\n\t\t\tset(2 * v, tl, tm, l, r, x);\n\t\t\tset(2 * v + 1, tm + 1, tr, l, r, x);\n\t\t\tmax[v] = f(max[2 * v], max[2 * v + 1]);\n\t\t}\n\n\t\tpublic void push(int v, int tl, int tr) {\n\t\t\tif (flag[v]) {\n\t\t\t\tif (v < pow) {\n\t\t\t\t\tflag[2 * v] = true;\n\t\t\t\t\tflag[2 * v + 1] = true;\n\t\t\t\t\tdelta[2 * v] += delta[v];\n\t\t\t\t\tdelta[2 * v + 1] += delta[v];\n\t\t\t\t}\n\t\t\t\tflag[v] = false;\n\t\t\t\tmax[v] += delta[v];\n\t\t\t\tdelta[v] = 0;\n\t\t\t}\n\t\t}\n\n\t\tpublic long f(long a, long b) {\n\t\t\treturn Math.max(a, b);\n\t\t}\n\t}\n\n\tpublic class SegmentTreeSet {\n\t\tint pow;\n\t\tint[] sum;\n\t\tint[] delta;\n\t\tboolean[] flag;\n\n\t\tpublic SegmentTreeSet(int[] a) {\n\t\t\tpow = 1;\n\t\t\twhile (pow < a.length) {\n\t\t\t\tpow *= 2;\n\t\t\t}\n\t\t\tflag = new boolean[2 * pow];\n\t\t\tsum = new int[2 * pow];\n\t\t\tdelta = new int[2 * pow];\n\t\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\t\tsum[pow + i] = a[i];\n\t\t\t}\n\t\t}\n\n\t\tpublic int get(int v, int tl, int tr, int l, int r) {\n\t\t\tpush(v, tl, tr);\n\t\t\tif (l > r) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tif (l == tl && r == tr) {\n\t\t\t\treturn sum[v];\n\t\t\t}\n\t\t\tint tm = (tl + tr) / 2;\n\t\t\treturn f(get(2 * v, tl, tm, l, Math.min(r, tm)), get(2 * v + 1, tm + 1, tr, Math.max(l, tm + 1), r));\n\t\t}\n\n\t\tpublic void set(int v, int tl, int tr, int l, int r, int x) {\n\t\t\tpush(v, tl, tr);\n\t\t\tif (l > tr || r < tl) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (l <= tl && r >= tr) {\n\t\t\t\tdelta[v] = x;\n\t\t\t\tflag[v] = true;\n\t\t\t\tpush(v, tl, tr);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tint tm = (tl + tr) / 2;\n\t\t\tset(2 * v, tl, tm, l, r, x);\n\t\t\tset(2 * v + 1, tm + 1, tr, l, r, x);\n\t\t\tsum[v] = f(sum[2 * v], sum[2 * v + 1]);\n\t\t}\n\n\t\tpublic void push(int v, int tl, int tr) {\n\t\t\tif (flag[v]) {\n\t\t\t\tif (v < pow) {\n\t\t\t\t\tflag[2 * v] = true;\n\t\t\t\t\tflag[2 * v + 1] = true;\n\t\t\t\t\tdelta[2 * v] = delta[v];\n\t\t\t\t\tdelta[2 * v + 1] = delta[v];\n\t\t\t\t}\n\t\t\t\tflag[v] = false;\n\t\t\t\tsum[v] = delta[v] * (tr - tl + 1);\n\t\t\t}\n\t\t}\n\n\t\tpublic int f(int a, int b) {\n\t\t\treturn a + b;\n\t\t}\n\t}\n\n\tpublic class Pair implements Comparable {\n\t\tint x;\n\t\tint y;\n\n\t\tpublic Pair(int x, int y) {\n\t\t\tthis.x = x;\n\t\t\tthis.y = y;\n\t\t}\n\n\t\tpublic Pair clone() {\n\t\t\treturn new Pair(x, y);\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\treturn x + \" \" + y;\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(Pair o) {\n\t\t\tif (y > o.y) {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tif (y < o.y) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tif (x > o.x) {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tif (x < o.x) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\tlong mod = 1000000007;\n\tRandom random = new Random();\n\n\tpublic void shuffle(Pair[] a) {\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\tint x = random.nextInt(i + 1);\n\t\t\tPair t = a[x];\n\t\t\ta[x] = a[i];\n\t\t\ta[i] = t;\n\t\t}\n\t}\n\n\tpublic void sort(int[][] a) {\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\tArrays.sort(a[i]);\n\t\t}\n\t}\n\n\tpublic void add(HashMap map, long l) {\n\t\tif (map.containsKey(l)) {\n\t\t\tmap.put(l, map.get(l) + 1);\n\t\t} else {\n\t\t\tmap.put(l, 1);\n\t\t}\n\t}\n\n\tpublic void remove(TreeMap map, Integer s) {\n\t\tif (map.get(s) > 1) {\n\t\t\tmap.put(s, map.get(s) - 1);\n\t\t} else {\n\t\t\tmap.remove(s);\n\t\t}\n\t}\n\n\tlong max = Long.MAX_VALUE / 2;\n\tdouble eps = 1e-10;\n\n\tpublic int signum(double x) {\n\t\tif (x > eps) {\n\t\t\treturn 1;\n\t\t}\n\t\tif (x < -eps) {\n\t\t\treturn -1;\n\t\t}\n\t\treturn 0;\n\t}\n\n\tpublic long abs(long x) {\n\t\treturn x < 0 ? -x : x;\n\t}\n\n\tpublic long min(long x, long y) {\n\t\treturn x < y ? x : y;\n\t}\n\n\tpublic long max(long x, long y) {\n\t\treturn x > y ? x : y;\n\t}\n\n\tpublic long gcd(long x, long y) {\n\t\twhile (y > 0) {\n\t\t\tlong c = y;\n\t\t\ty = x % y;\n\t\t\tx = c;\n\t\t}\n\t\treturn x;\n\t}\n\n\tpublic final Vector ZERO = new Vector(0, 0);\n\n\t// public class Vector implements Comparable {\n\t// long x;\n\t// long y;\n\t// int type;\n\t// int number;\n\t//\n\t// public Vector() {\n\t// x = 0;\n\t// y = 0;\n\t// }\n\t//\n\t// public Vector(long x, long y, int type, int number) {\n\t// this.x = x;\n\t// this.y = y;\n\t// this.type = type;\n\t// this.number = number;\n\t// }\n\t//\n\t// public Vector(long x, long y) {\n\t//\n\t// }\n\t//\n\t// public Vector(Point begin, Point end) {\n\t// this(end.x - begin.x, end.y - begin.y);\n\t// }\n\t//\n\t// public void orient() {\n\t// if (x < 0) {\n\t// x = -x;\n\t// y = -y;\n\t// }\n\t// if (x == 0 && y < 0) {\n\t// y = -y;\n\t// }\n\t// }\n\t//\n\t// public void normalize() {\n\t// long gcd = gcd(abs(x), abs(y));\n\t// x /= gcd;\n\t// y /= gcd;\n\t// }\n\t//\n\t// public String toString() {\n\t// return x + \" \" + y;\n\t// }\n\t//\n\t// public boolean equals(Vector v) {\n\t// return x == v.x && y == v.y;\n\t// }\n\t//\n\t// public boolean collinear(Vector v) {\n\t// return cp(this, v) == 0;\n\t// }\n\t//\n\t// public boolean orthogonal(Vector v) {\n\t// return dp(this, v) == 0;\n\t// }\n\t//\n\t// public Vector ort(Vector v) {\n\t// return new Vector(-y, x);\n\t// }\n\t//\n\t// public Vector add(Vector v) {\n\t// return new Vector(x + v.x, y + v.y);\n\t// }\n\t//\n\t// public Vector multiply(long c) {\n\t// return new Vector(c * x, c * y);\n\t// }\n\t//\n\t// public int quater() {\n\t// if (x > 0 && y >= 0) {\n\t// return 1;\n\t// }\n\t// if (x <= 0 && y > 0) {\n\t// return 2;\n\t// }\n\t// if (x < 0) {\n\t// return 3;\n\t// }\n\t// return 0;\n\t// }\n\t//\n\t// public long len2() {\n\t// return x * x + y * y;\n\t// }\n\t//\n\t// @Override\n\t// public int compareTo(Vector o) {\n\t// if (quater() != o.quater()) {\n\t// return quater() - o.quater();\n\t// }\n\t// return signum(cp(o, this));\n\t// }\n\t// }\n\n\t// public long dp(Vector v1, Vector v2) {\n\t// return v1.x * v2.x + v1.y * v2.y;\n\t// }\n\t//\n\t// public long cp(Vector v1, Vector v2) {\n\t// return v1.x * v2.y - v1.y * v2.x;\n\t// }\n\n\t// public class Line implements Comparable {\n\t// Point p;\n\t// Vector v;\n\t//\n\t// public Line(Point p, Vector v) {\n\t// this.p = p;\n\t// this.v = v;\n\t// }\n\t//\n\t// public Line(Point p1, Point p2) {\n\t// if (p1.compareTo(p2) < 0) {\n\t// p = p1;\n\t// v = new Vector(p1, p2);\n\t// } else {\n\t// p = p2;\n\t// v = new Vector();\n\t// }\n\t// }\n\t//\n\t// public boolean collinear(Line l) {\n\t// return v.collinear(l.v);\n\t// }\n\t//\n\t// public boolean inLine(Point p) {\n\t// return hv(p) == 0;\n\t// }\n\t//\n\t// public boolean inSegment(Point p) {\n\t// if (!inLine(p)) {\n\t// return false;\n\t// }\n\t// Point p1 = p;\n\t// Point p2 = p.add(v);\n\t// return p1.x <= p.x && p.x <= p2.x && min(p1.y, p2.y) <= p.y && p.y <=\n\t// max(p1.y, p2.y);\n\t// }\n\t//\n\t// public boolean equalsSegment(Line l) {\n\t// return p.equals(l.p) && v.equals(l.v);\n\t// }\n\t//\n\t// public boolean equalsLine(Line l) {\n\t// return collinear(l) && inLine(l.p);\n\t// }\n\t//\n\t// public long hv(Point p) {\n\t// Vector v1 = new Vector(this.p, p);\n\t// return cp(v, v1);\n\t// }\n\t//\n\t// public double h(Point p) {\n\t// Vector v1 = new Vector(this.p, p);\n\t// return cp(v, v1) / Math.sqrt(v.len2());\n\t// }\n\t//\n\t// public long[] intersectLines(Line l) {\n\t// if (collinear(l)) {\n\t// return null;\n\t// }\n\t// long[] ans = new long[4];\n\t//\n\t// return ans;\n\t// }\n\t//\n\t// public long[] intersectSegment(Line l) {\n\t// long[] ans = intersectLines(l);\n\t// if (ans == null) {\n\t// return null;\n\t// }\n\t// Point p1 = p;\n\t// Point p2 = p.add(v);\n\t// boolean f1 = p1.x * ans[1] <= ans[0] && ans[0] <= p2.x * ans[1] && min(p1.y,\n\t// p2.y) * ans[3] <= ans[2]\n\t// && ans[2] <= max(p1.y, p2.y) * ans[3];\n\t// p1 = l.p;\n\t// p2 = l.p.add(v);\n\t// boolean f2 = p1.x * ans[1] <= ans[0] && ans[0] <= p2.x * ans[1] && min(p1.y,\n\t// p2.y) * ans[3] <= ans[2]\n\t// && ans[2] <= max(p1.y, p2.y) * ans[3];\n\t// if (!f1 || !f2) {\n\t// return null;\n\t// }\n\t// return ans;\n\t// }\n\t//\n\t// @Override\n\t// public int compareTo(Line o) {\n\t// return v.compareTo(o.v);\n\t// }\n\t// }\n\n\tpublic class Rect {\n\t\tlong x1;\n\t\tlong x2;\n\t\tlong y1;\n\t\tlong y2;\n\t\tint number;\n\n\t\tpublic Rect(long x1, long x2, long y1, long y2, int number) {\n\t\t\tthis.x1 = x1;\n\t\t\tthis.x2 = x2;\n\t\t\tthis.y1 = y1;\n\t\t\tthis.y2 = y2;\n\t\t\tthis.number = number;\n\t\t}\n\t}\n\n\tpublic static class Fenvik {\n\t\tint[] t;\n\n\t\tpublic Fenvik(int n) {\n\t\t\tt = new int[n];\n\t\t}\n\n\t\tpublic void add(int x, int delta) {\n\t\t\tfor (int i = x; i < t.length; i = (i | (i + 1))) {\n\t\t\t\tt[i] += delta;\n\t\t\t}\n\t\t}\n\n\t\tprivate int sum(int r) {\n\t\t\tint ans = 0;\n\t\t\tint x = r;\n\t\t\twhile (x >= 0) {\n\t\t\t\tans += t[x];\n\t\t\t\tx = (x & (x + 1)) - 1;\n\t\t\t}\n\t\t\treturn ans;\n\t\t}\n\n\t\tpublic int sum(int l, int r) {\n\t\t\treturn sum(r) - sum(l - 1);\n\t\t}\n\t}\n\n\tpublic class SegmentTreeMaxSum {\n\t\tint pow;\n\t\tint[] sum;\n\t\tint[] maxPrefSum;\n\t\tint[] maxSufSum;\n\t\tint[] maxSum;\n\n\t\tpublic SegmentTreeMaxSum(int[] a) {\n\t\t\tpow = 1;\n\t\t\twhile (pow < a.length) {\n\t\t\t\tpow *= 2;\n\t\t\t}\n\t\t\tsum = new int[2 * pow];\n\t\t\tmaxPrefSum = new int[2 * pow];\n\t\t\tmaxSum = new int[2 * pow];\n\t\t\tmaxSufSum = new int[2 * pow];\n\t\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\t\tsum[pow + i] = a[i];\n\t\t\t\tmaxSum[pow + i] = Math.max(a[i], 0);\n\t\t\t\tmaxPrefSum[pow + i] = maxSum[pow + i];\n\t\t\t\tmaxSufSum[pow + i] = maxSum[pow + i];\n\t\t\t}\n\t\t\tfor (int i = pow - 1; i > 0; i--) {\n\t\t\t\tupdate(i);\n\t\t\t}\n\t\t}\n\n\t\tpublic int[] get(int v, int tl, int tr, int l, int r) {\n\t\t\tif (r <= tl || l >= tr) {\n\t\t\t\tint[] ans = { 0, 0, 0, 0 };\n\t\t\t\treturn ans;\n\t\t\t}\n\t\t\tif (l <= tl && r >= tr) {\n\t\t\t\tint[] ans = { maxPrefSum[v], maxSum[v], maxSufSum[v], sum[v] };\n\t\t\t\treturn ans;\n\t\t\t}\n\t\t\tint tm = (tl + tr) / 2;\n\t\t\tint[] left = get(2 * v, tl, tm, l, r);\n\t\t\tint[] right = get(2 * v + 1, tm, tr, l, r);\n\t\t\tint[] ans = { Math.max(left[0], right[0] + left[3]),\n\t\t\t\t\tMath.max(left[1], Math.max(right[1], left[2] + right[0])), Math.max(right[2], left[2] + right[3]),\n\t\t\t\t\tleft[3] + right[3] };\n\t\t\treturn ans;\n\t\t}\n\n\t\tpublic void set(int v, int tl, int tr, int x, int value) {\n\t\t\tif (v >= pow) {\n\t\t\t\tsum[v] = value;\n\t\t\t\tmaxSum[v] = Math.max(value, 0);\n\t\t\t\tmaxPrefSum[v] = maxSum[v];\n\t\t\t\tmaxSufSum[v] = maxSum[v];\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tint tm = (tl + tr) / 2;\n\t\t\tif (x < tm) {\n\t\t\t\tset(2 * v, tl, tm, x, value);\n\t\t\t} else {\n\t\t\t\tset(2 * v + 1, tm, tr, x, value);\n\t\t\t}\n\t\t\tupdate(v);\n\t\t}\n\n\t\tpublic void update(int i) {\n\t\t\tsum[i] = f(sum[2 * i], sum[2 * i + 1]);\n\t\t\tmaxSum[i] = Math.max(maxSum[2 * i], Math.max(maxSum[2 * i + 1], maxSufSum[2 * i] + maxPrefSum[2 * i + 1]));\n\t\t\tmaxPrefSum[i] = Math.max(maxPrefSum[2 * i], maxPrefSum[2 * i + 1] + sum[2 * i]);\n\t\t\tmaxSufSum[i] = Math.max(maxSufSum[2 * i + 1], maxSufSum[2 * i] + sum[2 * i + 1]);\n\t\t}\n\n\t\tpublic int f(int a, int b) {\n\t\t\treturn a + b;\n\t\t}\n\t}\n\n\tpublic class Point implements Comparable {\n\t\tdouble x;\n\t\tdouble y;\n\n\t\tpublic Point() {\n\t\t\tx = 0;\n\t\t\ty = 0;\n\t\t}\n\n\t\tpublic Point(double x, double y) {\n\t\t\tthis.x = x;\n\t\t\tthis.y = y;\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\treturn x + \" \" + y;\n\t\t}\n\n\t\tpublic boolean equals(Point p) {\n\t\t\treturn x == p.x && y == p.y;\n\t\t}\n\n\t\tpublic double dist2() {\n\t\t\treturn x * x + y * y;\n\t\t}\n\n\t\tpublic Point add(Point v) {\n\t\t\treturn new Point(x + v.x, y + v.y);\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(Point o) {\n\t\t\tint z = signum(x + y - o.x - o.y);\n\t\t\tif (z != 0) {\n\t\t\t\treturn z;\n\t\t\t}\n\t\t\treturn signum(x - o.x) != 0 ? signum(x - o.x) : signum(y - o.y);\n\t\t}\n\t}\n\n\tpublic class Circle implements Comparable {\n\t\tPoint p;\n\t\tint r;\n\n\t\tpublic Circle(Point p, int r) {\n\t\t\tthis.p = p;\n\t\t\tthis.r = r;\n\t\t}\n\n\t\tpublic Point angle() {\n\t\t\tdouble z = r / sq2;\n\t\t\tz -= z % 1e-5;\n\t\t\treturn new Point(p.x - z, p.y - z);\n\t\t}\n\n\t\tpublic boolean inside(Point p) {\n\t\t\treturn hypot2(p.x - this.p.x, p.y - this.p.y) <= sq(r);\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(Circle o) {\n\t\t\tPoint a = angle();\n\t\t\tPoint oa = o.angle();\n\t\t\tint z = signum(a.x + a.y - oa.x - oa.y);\n\t\t\tif (z != 0) {\n\t\t\t\treturn z;\n\t\t\t}\n\t\t\treturn signum(a.y - oa.y);\n\t\t}\n\n\t}\n\n\tpublic class Fraction implements Comparable {\n\t\tlong x;\n\t\tlong y;\n\n\t\tpublic Fraction(long x, long y, boolean needNorm) {\n\t\t\tthis.x = x;\n\t\t\tthis.y = y;\n\t\t\tif (y < 0) {\n\t\t\t\tthis.x *= -1;\n\t\t\t\tthis.y *= -1;\n\t\t\t}\n\t\t\tif (needNorm) {\n\t\t\t\tlong gcd = gcd(this.x, this.y);\n\t\t\t\tthis.x /= gcd;\n\t\t\t\tthis.y /= gcd;\n\t\t\t}\n\t\t}\n\n\t\tpublic Fraction clone() {\n\t\t\treturn new Fraction(x, y, false);\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\treturn x + \"/\" + y;\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(Fraction o) {\n\t\t\tlong res = x * o.y - y * o.x;\n\t\t\tif (res > 0) {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tif (res < 0) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\tpublic class Event implements Comparable {\n\t\tFraction f;\n\t\tint type;\n\n\t\tpublic Event(Fraction f, int type) {\n\t\t\tthis.f = f;\n\t\t\tthis.type = type;\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(Event o) {\n\t\t\tint c = f.compareTo(o.f);\n\t\t\tif (c != 0) {\n\t\t\t\treturn c;\n\t\t\t}\n\t\t\treturn type - o.type;\n\t\t}\n\n\t}\n\n\tpublic double sq(double x) {\n\t\treturn x * x;\n\t}\n\n\tpublic long sq(long x) {\n\t\treturn x * x;\n\t}\n\n\tpublic double hypot2(double x, double y) {\n\t\treturn sq(x) + sq(y);\n\t}\n\n\tpublic long hypot2(long x, long y) {\n\t\treturn sq(x) + sq(y);\n\t}\n\n\tpublic boolean kuhn(int v, int[][] edge, boolean[] used, int[] mt) {\n\t\tused[v] = true;\n\t\tfor (int u : edge[v]) {\n\t\t\tif (mt[u] < 0 || (!used[mt[u]] && kuhn(mt[u], edge, used, mt))) {\n\t\t\t\tmt[u] = v;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic int matching(int[][] edge) {\n\t\tint n = edge.length;\n\t\tint[] mt = new int[n];\n\t\tArrays.fill(mt, -1);\n\t\tboolean[] used = new boolean[n];\n\t\tint ans = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (!used[i] && kuhn(i, edge, used, mt)) {\n\t\t\t\tArrays.fill(used, false);\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\t\treturn ans;\n\t}\n\n\tdouble sq2 = Math.sqrt(2);\n\n\tint small = 20;\n\n\tpublic class Stack {\n\t\tint[] st;\n\t\tint sz;\n\n\t\tpublic Stack(int n) {\n\t\t\tthis.st = new int[n];\n\t\t\tsz = 0;\n\t\t}\n\n\t\tpublic boolean isEmpty() {\n\t\t\treturn sz == 0;\n\t\t}\n\n\t\tpublic int peek() {\n\t\t\treturn st[sz - 1];\n\t\t}\n\n\t\tpublic int pop() {\n\t\t\tsz--;\n\t\t\treturn st[sz];\n\t\t}\n\n\t\tpublic void clear() {\n\t\t\tsz = 0;\n\t\t}\n\n\t\tpublic void add(int x) {\n\t\t\tst[sz++] = x;\n\t\t}\n\n\t\tpublic int get(int x) {\n\t\t\treturn st[x];\n\t\t}\n\t}\n\n\tpublic int[][] readGraph(int n, int m) {\n\t\tint[][] to = new int[n][];\n\t\tint[] sz = new int[n];\n\t\tint[] x = new int[m];\n\t\tint[] y = new int[m];\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tx[i] = in.nextInt() - 1;\n\t\t\ty[i] = in.nextInt() - 1;\n\t\t\tsz[x[i]]++;\n\t\t\tsz[y[i]]++;\n\t\t}\n\t\tfor (int i = 0; i < to.length; i++) {\n\t\t\tto[i] = new int[sz[i]];\n\t\t\tsz[i] = 0;\n\t\t}\n\t\tfor (int i = 0; i < x.length; i++) {\n\t\t\tto[x[i]][sz[x[i]]++] = y[i];\n\t\t\tto[y[i]][sz[y[i]]++] = x[i];\n\t\t}\n\t\treturn to;\n\t}\n\n\tpublic class Pol {\n\t\tdouble[] coeff;\n\n\t\tpublic Pol(double[] coeff) {\n\t\t\tthis.coeff = coeff;\n\t\t}\n\n\t\tpublic Pol mult(Pol p) {\n\t\t\tdouble[] ans = new double[coeff.length + p.coeff.length - 1];\n\t\t\tfor (int i = 0; i < ans.length; i++) {\n\t\t\t\tfor (int j = Math.max(0, i - p.coeff.length + 1); j < coeff.length && j <= i; j++) {\n\t\t\t\t\tans[i] += coeff[j] * p.coeff[i - j];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn new Pol(ans);\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\tString ans = \"\";\n\t\t\tfor (int i = 0; i < coeff.length; i++) {\n\t\t\t\tans += coeff[i] + \" \";\n\t\t\t}\n\t\t\treturn ans;\n\t\t}\n\n\t\tpublic double value(double x) {\n\t\t\tdouble ans = 0;\n\t\t\tdouble p = 1;\n\t\t\tfor (int i = 0; i < coeff.length; i++) {\n\t\t\t\tans += coeff[i] * p;\n\t\t\t\tp *= x;\n\t\t\t}\n\t\t\treturn ans;\n\t\t}\n\n\t\tpublic double integrate(double r) {\n\t\t\tPol p = new Pol(new double[coeff.length + 1]);\n\t\t\tfor (int i = 0; i < coeff.length; i++) {\n\t\t\t\tp.coeff[i + 1] = coeff[i] / fact[i + 1];\n\t\t\t}\n\t\t\treturn p.value(r);\n\t\t}\n\n\t\tpublic double integrate(double l, double r) {\n\t\t\treturn integrate(r) - integrate(l);\n\t\t}\n\t}\n\n\tdouble[] fact = new double[100];\n\n\tpublic class DSU1 {\n\t\tint[] p;\n\t\tint[] sz;\n\t\tStack less;\n\t\tStack more;\n\t\tTreeSet[] q;\n\t\tboolean[] used;\n\n\t\t@SuppressWarnings(\"unchecked\")\n\t\tpublic DSU1(int[] v, int m) {\n\t\t\tint n = v.length;\n\t\t\tp = new int[n];\n\t\t\tsz = new int[n];\n\t\t\tq = new TreeSet[n];\n\t\t\tless = new Stack(m);\n\t\t\tmore = new Stack(m);\n\t\t\tused = new boolean[n + 1];\n\t\t\tfor (int i = 0; i < v.length; i++) {\n\t\t\t\tp[i] = i;\n\t\t\t\tsz[i] = 1;\n\t\t\t\tq[i] = new TreeSet<>();\n\t\t\t\tq[i].add(v[i]);\n\t\t\t}\n\t\t}\n\n\t\tpublic int get(int x) {\n\t\t\twhile (x != p[x]) {\n\t\t\t\tx = p[x];\n\t\t\t}\n\t\t\treturn x;\n\t\t}\n\n\t\tpublic boolean unite(int a, int b) {\n\t\t\tint pa = get(a);\n\t\t\tint pb = get(b);\n\t\t\tif (pa == pb) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (sz[pa] < sz[pb]) {\n\t\t\t\tp[pa] = pb;\n\t\t\t\tsz[pb] += sz[pa];\n\n\t\t\t\tless.add(pa);\n\t\t\t\tmore.add(pb);\n\t\t\t\tfor (int i : q[pa]) {\n\t\t\t\t\tq[pb].add(i);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tp[pb] = pa;\n\t\t\t\tsz[pa] += sz[pb];\n\n\t\t\t\tless.add(pb);\n\t\t\t\tmore.add(pa);\n\t\t\t\tfor (int i : q[pb]) {\n\t\t\t\t\tq[pa].add(i);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic void popEdge() {\n\t\t\tint pa = less.pop();\n\t\t\tint pb = more.pop();\n\t\t\tfor (int i : q[pa]) {\n\t\t\t\tq[pb].remove(i);\n\t\t\t}\n\t\t\tp[pa] = pa;\n\t\t\tsz[pb] -= sz[pa];\n\t\t}\n\n\t\tpublic int poll(int x) {\n\t\t\tint px = get(x);\n\t\t\twhile (!q[px].isEmpty()) {\n\t\t\t\tint v = q[px].pollLast();\n\t\t\t\tif (!used[v]) {\n\t\t\t\t\tused[v] = true;\n\t\t\t\t\treturn v;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn 0;\n\t\t}\n\n\t}\n\n\tpublic void solve() {\n\t\tint n = in.nextInt();\n\t\tint m = in.nextInt();\n\t\tint q = in.nextInt();\n\t\tint[] v = new int[n];\n\t\tfor (int i = 0; i < v.length; i++) {\n\t\t\tv[i] = in.nextInt();\n\t\t}\n\t\tint[] a = new int[m];\n\t\tint[] b = new int[m];\n\t\tfor (int i = 0; i < b.length; i++) {\n\t\t\ta[i] = in.nextInt() - 1;\n\t\t\tb[i] = in.nextInt() - 1;\n\t\t}\n\t\tboolean[] type = new boolean[q];\n\t\tint[] x = new int[q];\n\t\tboolean[] removed = new boolean[m];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (in.nextInt() == 1) {\n\t\t\t\tx[i] = in.nextInt() - 1;\n\t\t\t\ttype[i] = true;\n\t\t\t} else {\n\t\t\t\tx[i] = in.nextInt() - 1;\n\t\t\t\tremoved[x[i]] = true;\n\t\t\t}\n\t\t}\n\t\tDSU1 dsu = new DSU1(v, m);\n\t\tfor (int i = 0; i < removed.length; i++) {\n\t\t\tif (!removed[i]) {\n\t\t\t\tdsu.unite(a[i], b[i]);\n\t\t\t}\n\t\t}\n\t\tfor (int i = q - 1; i >= 0; i--) {\n\t\t\tif (!type[i]) {\n\t\t\t\tdsu.unite(a[x[i]], b[x[i]]);\n\t\t\t}\n\t\t}\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (type[i]) {\n\t\t\t\tout.println(dsu.poll(x[i]));\n\t\t\t} else {\n\t\t\t\tdsu.popEdge();\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic void add(HashMap map, int x) {\n\t\tif (map.containsKey(x)) {\n\t\t\tmap.put(x, map.get(x) + 1);\n\t\t} else {\n\t\t\tmap.put(x, 1);\n\t\t}\n\t}\n\n\tpublic void run() {\n\t\ttry {\n\t\t\tif (systemIO) {\n\t\t\t\tin = new FastScanner(System.in);\n\t\t\t\tout = new PrintWriter(System.out);\n\t\t\t} else {\n\t\t\t\tin = new FastScanner(new File(\"input.txt\"));\n\t\t\t\tout = new PrintWriter(new File(\"output.txt\"));\n\t\t\t}\n\t\t\tsolve();\n\n\t\t\tout.close();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n\n\tclass FastScanner {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tFastScanner(File f) {\n\t\t\ttry {\n\t\t\t\tbr = new BufferedReader(new FileReader(f));\n\t\t\t} catch (FileNotFoundException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\n\t\tFastScanner(InputStream f) {\n\t\t\tbr = new BufferedReader(new InputStreamReader(f));\n\t\t}\n\n\t\tString nextLine() {\n\t\t\ttry {\n\t\t\t\treturn br.readLine();\n\t\t\t} catch (IOException e) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\n\t\tString next() {\n\t\t\twhile (st == null || !st.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tint nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tdouble nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t}\n\n\t// AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n\tpublic static void main(String[] arg) {\n\t\tnew E().run();\n\t}\n}", "lang": "Java 11", "bug_code_uid": "256a0593af3286c4adf51045eb4a590c", "src_uid": "ad014bde729222db14f38caa521e4167", "apr_id": "5a69d7c1bba9db20c1f0c78922ea5978", "difficulty": 2600, "tags": ["dsu", "data structures", "implementation", "graphs", "trees"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9947764165749221, "equal_cnt": 13, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 6, "fix_ops_cnt": 12, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class E {\n\tFastScanner in;\n\tPrintWriter out;\n\tboolean systemIO = true;\n\n\tpublic class DSU {\n\t\tint[] sz;\n\t\tint[] p;\n\n\t\tpublic DSU(int n) {\n\t\t\tsz = new int[n];\n\t\t\tp = new int[n];\n\t\t\tfor (int i = 0; i < p.length; i++) {\n\t\t\t\tp[i] = i;\n\t\t\t\tsz[i] = 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic int get(int x) {\n\t\t\tif (x == p[x]) {\n\t\t\t\treturn x;\n\t\t\t}\n\t\t\tint par = get(p[x]);\n\t\t\tp[x] = par;\n\t\t\treturn par;\n\t\t}\n\n\t\tpublic boolean unite(int a, int b) {\n\t\t\tint pa = get(a);\n\t\t\tint pb = get(b);\n\t\t\tif (pa == pb) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (sz[pa] < sz[pb]) {\n\t\t\t\tp[pa] = pb;\n\t\t\t\tsz[pb] += sz[pa];\n\t\t\t} else {\n\t\t\t\tp[pb] = pa;\n\t\t\t\tsz[pa] += sz[pb];\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t}\n\n\tpublic class SegmentTreeAdd {\n\t\tint pow;\n\t\tlong[] max;\n\t\tlong[] delta;\n\t\tboolean[] flag;\n\n\t\tpublic SegmentTreeAdd(long[] a) {\n\t\t\tpow = 1;\n\t\t\twhile (pow < a.length) {\n\t\t\t\tpow *= 2;\n\t\t\t}\n\t\t\tflag = new boolean[2 * pow];\n\t\t\tmax = new long[2 * pow];\n\t\t\tdelta = new long[2 * pow];\n\t\t\tfor (int i = 0; i < max.length; i++) {\n\t\t\t\tmax[i] = Long.MIN_VALUE / 2;\n\t\t\t}\n\t\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\t\tmax[pow + i] = a[i];\n\t\t\t}\n\t\t\tfor (int i = pow - 1; i > 0; i--) {\n\t\t\t\tmax[i] = f(max[2 * i], max[2 * i + 1]);\n\t\t\t}\n\t\t}\n\n\t\tpublic long get(int v, int tl, int tr, int l, int r) {\n\t\t\tpush(v, tl, tr);\n\t\t\tif (l > r) {\n\t\t\t\treturn Long.MIN_VALUE / 2;\n\t\t\t}\n\t\t\tif (l == tl && r == tr) {\n\t\t\t\treturn max[v];\n\t\t\t}\n\t\t\tint tm = (tl + tr) / 2;\n\t\t\treturn f(get(2 * v, tl, tm, l, Math.min(r, tm)), get(2 * v + 1, tm + 1, tr, Math.max(l, tm + 1), r));\n\t\t}\n\n\t\tpublic void set(int v, int tl, int tr, int l, int r, long x) {\n\t\t\tpush(v, tl, tr);\n\t\t\tif (l > tr || r < tl) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (l <= tl && r >= tr) {\n\t\t\t\tdelta[v] += x;\n\t\t\t\tflag[v] = true;\n\t\t\t\tpush(v, tl, tr);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tint tm = (tl + tr) / 2;\n\t\t\tset(2 * v, tl, tm, l, r, x);\n\t\t\tset(2 * v + 1, tm + 1, tr, l, r, x);\n\t\t\tmax[v] = f(max[2 * v], max[2 * v + 1]);\n\t\t}\n\n\t\tpublic void push(int v, int tl, int tr) {\n\t\t\tif (flag[v]) {\n\t\t\t\tif (v < pow) {\n\t\t\t\t\tflag[2 * v] = true;\n\t\t\t\t\tflag[2 * v + 1] = true;\n\t\t\t\t\tdelta[2 * v] += delta[v];\n\t\t\t\t\tdelta[2 * v + 1] += delta[v];\n\t\t\t\t}\n\t\t\t\tflag[v] = false;\n\t\t\t\tmax[v] += delta[v];\n\t\t\t\tdelta[v] = 0;\n\t\t\t}\n\t\t}\n\n\t\tpublic long f(long a, long b) {\n\t\t\treturn Math.max(a, b);\n\t\t}\n\t}\n\n\tpublic class SegmentTreeSet {\n\t\tint pow;\n\t\tint[] sum;\n\t\tint[] delta;\n\t\tboolean[] flag;\n\n\t\tpublic SegmentTreeSet(int[] a) {\n\t\t\tpow = 1;\n\t\t\twhile (pow < a.length) {\n\t\t\t\tpow *= 2;\n\t\t\t}\n\t\t\tflag = new boolean[2 * pow];\n\t\t\tsum = new int[2 * pow];\n\t\t\tdelta = new int[2 * pow];\n\t\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\t\tsum[pow + i] = a[i];\n\t\t\t}\n\t\t}\n\n\t\tpublic int get(int v, int tl, int tr, int l, int r) {\n\t\t\tpush(v, tl, tr);\n\t\t\tif (l > r) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tif (l == tl && r == tr) {\n\t\t\t\treturn sum[v];\n\t\t\t}\n\t\t\tint tm = (tl + tr) / 2;\n\t\t\treturn f(get(2 * v, tl, tm, l, Math.min(r, tm)), get(2 * v + 1, tm + 1, tr, Math.max(l, tm + 1), r));\n\t\t}\n\n\t\tpublic void set(int v, int tl, int tr, int l, int r, int x) {\n\t\t\tpush(v, tl, tr);\n\t\t\tif (l > tr || r < tl) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (l <= tl && r >= tr) {\n\t\t\t\tdelta[v] = x;\n\t\t\t\tflag[v] = true;\n\t\t\t\tpush(v, tl, tr);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tint tm = (tl + tr) / 2;\n\t\t\tset(2 * v, tl, tm, l, r, x);\n\t\t\tset(2 * v + 1, tm + 1, tr, l, r, x);\n\t\t\tsum[v] = f(sum[2 * v], sum[2 * v + 1]);\n\t\t}\n\n\t\tpublic void push(int v, int tl, int tr) {\n\t\t\tif (flag[v]) {\n\t\t\t\tif (v < pow) {\n\t\t\t\t\tflag[2 * v] = true;\n\t\t\t\t\tflag[2 * v + 1] = true;\n\t\t\t\t\tdelta[2 * v] = delta[v];\n\t\t\t\t\tdelta[2 * v + 1] = delta[v];\n\t\t\t\t}\n\t\t\t\tflag[v] = false;\n\t\t\t\tsum[v] = delta[v] * (tr - tl + 1);\n\t\t\t}\n\t\t}\n\n\t\tpublic int f(int a, int b) {\n\t\t\treturn a + b;\n\t\t}\n\t}\n\n\tpublic class Pair implements Comparable {\n\t\tint x;\n\t\tint y;\n\n\t\tpublic Pair(int x, int y) {\n\t\t\tthis.x = x;\n\t\t\tthis.y = y;\n\t\t}\n\n\t\tpublic Pair clone() {\n\t\t\treturn new Pair(x, y);\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\treturn x + \" \" + y;\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(Pair o) {\n\t\t\tif (y > o.y) {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tif (y < o.y) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tif (x > o.x) {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tif (x < o.x) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\tlong mod = 1000000007;\n\tRandom random = new Random();\n\n\tpublic void shuffle(Pair[] a) {\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\tint x = random.nextInt(i + 1);\n\t\t\tPair t = a[x];\n\t\t\ta[x] = a[i];\n\t\t\ta[i] = t;\n\t\t}\n\t}\n\n\tpublic void sort(int[][] a) {\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\tArrays.sort(a[i]);\n\t\t}\n\t}\n\n\tpublic void add(HashMap map, long l) {\n\t\tif (map.containsKey(l)) {\n\t\t\tmap.put(l, map.get(l) + 1);\n\t\t} else {\n\t\t\tmap.put(l, 1);\n\t\t}\n\t}\n\n\tpublic void remove(TreeMap map, Integer s) {\n\t\tif (map.get(s) > 1) {\n\t\t\tmap.put(s, map.get(s) - 1);\n\t\t} else {\n\t\t\tmap.remove(s);\n\t\t}\n\t}\n\n\tlong max = Long.MAX_VALUE / 2;\n\tdouble eps = 1e-10;\n\n\tpublic int signum(double x) {\n\t\tif (x > eps) {\n\t\t\treturn 1;\n\t\t}\n\t\tif (x < -eps) {\n\t\t\treturn -1;\n\t\t}\n\t\treturn 0;\n\t}\n\n\tpublic long abs(long x) {\n\t\treturn x < 0 ? -x : x;\n\t}\n\n\tpublic long min(long x, long y) {\n\t\treturn x < y ? x : y;\n\t}\n\n\tpublic long max(long x, long y) {\n\t\treturn x > y ? x : y;\n\t}\n\n\tpublic long gcd(long x, long y) {\n\t\twhile (y > 0) {\n\t\t\tlong c = y;\n\t\t\ty = x % y;\n\t\t\tx = c;\n\t\t}\n\t\treturn x;\n\t}\n\n\tpublic final Vector ZERO = new Vector(0, 0);\n\n\t// public class Vector implements Comparable {\n\t// long x;\n\t// long y;\n\t// int type;\n\t// int number;\n\t//\n\t// public Vector() {\n\t// x = 0;\n\t// y = 0;\n\t// }\n\t//\n\t// public Vector(long x, long y, int type, int number) {\n\t// this.x = x;\n\t// this.y = y;\n\t// this.type = type;\n\t// this.number = number;\n\t// }\n\t//\n\t// public Vector(long x, long y) {\n\t//\n\t// }\n\t//\n\t// public Vector(Point begin, Point end) {\n\t// this(end.x - begin.x, end.y - begin.y);\n\t// }\n\t//\n\t// public void orient() {\n\t// if (x < 0) {\n\t// x = -x;\n\t// y = -y;\n\t// }\n\t// if (x == 0 && y < 0) {\n\t// y = -y;\n\t// }\n\t// }\n\t//\n\t// public void normalize() {\n\t// long gcd = gcd(abs(x), abs(y));\n\t// x /= gcd;\n\t// y /= gcd;\n\t// }\n\t//\n\t// public String toString() {\n\t// return x + \" \" + y;\n\t// }\n\t//\n\t// public boolean equals(Vector v) {\n\t// return x == v.x && y == v.y;\n\t// }\n\t//\n\t// public boolean collinear(Vector v) {\n\t// return cp(this, v) == 0;\n\t// }\n\t//\n\t// public boolean orthogonal(Vector v) {\n\t// return dp(this, v) == 0;\n\t// }\n\t//\n\t// public Vector ort(Vector v) {\n\t// return new Vector(-y, x);\n\t// }\n\t//\n\t// public Vector add(Vector v) {\n\t// return new Vector(x + v.x, y + v.y);\n\t// }\n\t//\n\t// public Vector multiply(long c) {\n\t// return new Vector(c * x, c * y);\n\t// }\n\t//\n\t// public int quater() {\n\t// if (x > 0 && y >= 0) {\n\t// return 1;\n\t// }\n\t// if (x <= 0 && y > 0) {\n\t// return 2;\n\t// }\n\t// if (x < 0) {\n\t// return 3;\n\t// }\n\t// return 0;\n\t// }\n\t//\n\t// public long len2() {\n\t// return x * x + y * y;\n\t// }\n\t//\n\t// @Override\n\t// public int compareTo(Vector o) {\n\t// if (quater() != o.quater()) {\n\t// return quater() - o.quater();\n\t// }\n\t// return signum(cp(o, this));\n\t// }\n\t// }\n\n\t// public long dp(Vector v1, Vector v2) {\n\t// return v1.x * v2.x + v1.y * v2.y;\n\t// }\n\t//\n\t// public long cp(Vector v1, Vector v2) {\n\t// return v1.x * v2.y - v1.y * v2.x;\n\t// }\n\n\t// public class Line implements Comparable {\n\t// Point p;\n\t// Vector v;\n\t//\n\t// public Line(Point p, Vector v) {\n\t// this.p = p;\n\t// this.v = v;\n\t// }\n\t//\n\t// public Line(Point p1, Point p2) {\n\t// if (p1.compareTo(p2) < 0) {\n\t// p = p1;\n\t// v = new Vector(p1, p2);\n\t// } else {\n\t// p = p2;\n\t// v = new Vector();\n\t// }\n\t// }\n\t//\n\t// public boolean collinear(Line l) {\n\t// return v.collinear(l.v);\n\t// }\n\t//\n\t// public boolean inLine(Point p) {\n\t// return hv(p) == 0;\n\t// }\n\t//\n\t// public boolean inSegment(Point p) {\n\t// if (!inLine(p)) {\n\t// return false;\n\t// }\n\t// Point p1 = p;\n\t// Point p2 = p.add(v);\n\t// return p1.x <= p.x && p.x <= p2.x && min(p1.y, p2.y) <= p.y && p.y <=\n\t// max(p1.y, p2.y);\n\t// }\n\t//\n\t// public boolean equalsSegment(Line l) {\n\t// return p.equals(l.p) && v.equals(l.v);\n\t// }\n\t//\n\t// public boolean equalsLine(Line l) {\n\t// return collinear(l) && inLine(l.p);\n\t// }\n\t//\n\t// public long hv(Point p) {\n\t// Vector v1 = new Vector(this.p, p);\n\t// return cp(v, v1);\n\t// }\n\t//\n\t// public double h(Point p) {\n\t// Vector v1 = new Vector(this.p, p);\n\t// return cp(v, v1) / Math.sqrt(v.len2());\n\t// }\n\t//\n\t// public long[] intersectLines(Line l) {\n\t// if (collinear(l)) {\n\t// return null;\n\t// }\n\t// long[] ans = new long[4];\n\t//\n\t// return ans;\n\t// }\n\t//\n\t// public long[] intersectSegment(Line l) {\n\t// long[] ans = intersectLines(l);\n\t// if (ans == null) {\n\t// return null;\n\t// }\n\t// Point p1 = p;\n\t// Point p2 = p.add(v);\n\t// boolean f1 = p1.x * ans[1] <= ans[0] && ans[0] <= p2.x * ans[1] && min(p1.y,\n\t// p2.y) * ans[3] <= ans[2]\n\t// && ans[2] <= max(p1.y, p2.y) * ans[3];\n\t// p1 = l.p;\n\t// p2 = l.p.add(v);\n\t// boolean f2 = p1.x * ans[1] <= ans[0] && ans[0] <= p2.x * ans[1] && min(p1.y,\n\t// p2.y) * ans[3] <= ans[2]\n\t// && ans[2] <= max(p1.y, p2.y) * ans[3];\n\t// if (!f1 || !f2) {\n\t// return null;\n\t// }\n\t// return ans;\n\t// }\n\t//\n\t// @Override\n\t// public int compareTo(Line o) {\n\t// return v.compareTo(o.v);\n\t// }\n\t// }\n\n\tpublic class Rect {\n\t\tlong x1;\n\t\tlong x2;\n\t\tlong y1;\n\t\tlong y2;\n\t\tint number;\n\n\t\tpublic Rect(long x1, long x2, long y1, long y2, int number) {\n\t\t\tthis.x1 = x1;\n\t\t\tthis.x2 = x2;\n\t\t\tthis.y1 = y1;\n\t\t\tthis.y2 = y2;\n\t\t\tthis.number = number;\n\t\t}\n\t}\n\n\tpublic static class Fenvik {\n\t\tint[] t;\n\n\t\tpublic Fenvik(int n) {\n\t\t\tt = new int[n];\n\t\t}\n\n\t\tpublic void add(int x, int delta) {\n\t\t\tfor (int i = x; i < t.length; i = (i | (i + 1))) {\n\t\t\t\tt[i] += delta;\n\t\t\t}\n\t\t}\n\n\t\tprivate int sum(int r) {\n\t\t\tint ans = 0;\n\t\t\tint x = r;\n\t\t\twhile (x >= 0) {\n\t\t\t\tans += t[x];\n\t\t\t\tx = (x & (x + 1)) - 1;\n\t\t\t}\n\t\t\treturn ans;\n\t\t}\n\n\t\tpublic int sum(int l, int r) {\n\t\t\treturn sum(r) - sum(l - 1);\n\t\t}\n\t}\n\n\tpublic class SegmentTreeMaxSum {\n\t\tint pow;\n\t\tint[] sum;\n\t\tint[] maxPrefSum;\n\t\tint[] maxSufSum;\n\t\tint[] maxSum;\n\n\t\tpublic SegmentTreeMaxSum(int[] a) {\n\t\t\tpow = 1;\n\t\t\twhile (pow < a.length) {\n\t\t\t\tpow *= 2;\n\t\t\t}\n\t\t\tsum = new int[2 * pow];\n\t\t\tmaxPrefSum = new int[2 * pow];\n\t\t\tmaxSum = new int[2 * pow];\n\t\t\tmaxSufSum = new int[2 * pow];\n\t\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\t\tsum[pow + i] = a[i];\n\t\t\t\tmaxSum[pow + i] = Math.max(a[i], 0);\n\t\t\t\tmaxPrefSum[pow + i] = maxSum[pow + i];\n\t\t\t\tmaxSufSum[pow + i] = maxSum[pow + i];\n\t\t\t}\n\t\t\tfor (int i = pow - 1; i > 0; i--) {\n\t\t\t\tupdate(i);\n\t\t\t}\n\t\t}\n\n\t\tpublic int[] get(int v, int tl, int tr, int l, int r) {\n\t\t\tif (r <= tl || l >= tr) {\n\t\t\t\tint[] ans = { 0, 0, 0, 0 };\n\t\t\t\treturn ans;\n\t\t\t}\n\t\t\tif (l <= tl && r >= tr) {\n\t\t\t\tint[] ans = { maxPrefSum[v], maxSum[v], maxSufSum[v], sum[v] };\n\t\t\t\treturn ans;\n\t\t\t}\n\t\t\tint tm = (tl + tr) / 2;\n\t\t\tint[] left = get(2 * v, tl, tm, l, r);\n\t\t\tint[] right = get(2 * v + 1, tm, tr, l, r);\n\t\t\tint[] ans = { Math.max(left[0], right[0] + left[3]),\n\t\t\t\t\tMath.max(left[1], Math.max(right[1], left[2] + right[0])), Math.max(right[2], left[2] + right[3]),\n\t\t\t\t\tleft[3] + right[3] };\n\t\t\treturn ans;\n\t\t}\n\n\t\tpublic void set(int v, int tl, int tr, int x, int value) {\n\t\t\tif (v >= pow) {\n\t\t\t\tsum[v] = value;\n\t\t\t\tmaxSum[v] = Math.max(value, 0);\n\t\t\t\tmaxPrefSum[v] = maxSum[v];\n\t\t\t\tmaxSufSum[v] = maxSum[v];\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tint tm = (tl + tr) / 2;\n\t\t\tif (x < tm) {\n\t\t\t\tset(2 * v, tl, tm, x, value);\n\t\t\t} else {\n\t\t\t\tset(2 * v + 1, tm, tr, x, value);\n\t\t\t}\n\t\t\tupdate(v);\n\t\t}\n\n\t\tpublic void update(int i) {\n\t\t\tsum[i] = f(sum[2 * i], sum[2 * i + 1]);\n\t\t\tmaxSum[i] = Math.max(maxSum[2 * i], Math.max(maxSum[2 * i + 1], maxSufSum[2 * i] + maxPrefSum[2 * i + 1]));\n\t\t\tmaxPrefSum[i] = Math.max(maxPrefSum[2 * i], maxPrefSum[2 * i + 1] + sum[2 * i]);\n\t\t\tmaxSufSum[i] = Math.max(maxSufSum[2 * i + 1], maxSufSum[2 * i] + sum[2 * i + 1]);\n\t\t}\n\n\t\tpublic int f(int a, int b) {\n\t\t\treturn a + b;\n\t\t}\n\t}\n\n\tpublic class Point implements Comparable {\n\t\tdouble x;\n\t\tdouble y;\n\n\t\tpublic Point() {\n\t\t\tx = 0;\n\t\t\ty = 0;\n\t\t}\n\n\t\tpublic Point(double x, double y) {\n\t\t\tthis.x = x;\n\t\t\tthis.y = y;\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\treturn x + \" \" + y;\n\t\t}\n\n\t\tpublic boolean equals(Point p) {\n\t\t\treturn x == p.x && y == p.y;\n\t\t}\n\n\t\tpublic double dist2() {\n\t\t\treturn x * x + y * y;\n\t\t}\n\n\t\tpublic Point add(Point v) {\n\t\t\treturn new Point(x + v.x, y + v.y);\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(Point o) {\n\t\t\tint z = signum(x + y - o.x - o.y);\n\t\t\tif (z != 0) {\n\t\t\t\treturn z;\n\t\t\t}\n\t\t\treturn signum(x - o.x) != 0 ? signum(x - o.x) : signum(y - o.y);\n\t\t}\n\t}\n\n\tpublic class Circle implements Comparable {\n\t\tPoint p;\n\t\tint r;\n\n\t\tpublic Circle(Point p, int r) {\n\t\t\tthis.p = p;\n\t\t\tthis.r = r;\n\t\t}\n\n\t\tpublic Point angle() {\n\t\t\tdouble z = r / sq2;\n\t\t\tz -= z % 1e-5;\n\t\t\treturn new Point(p.x - z, p.y - z);\n\t\t}\n\n\t\tpublic boolean inside(Point p) {\n\t\t\treturn hypot2(p.x - this.p.x, p.y - this.p.y) <= sq(r);\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(Circle o) {\n\t\t\tPoint a = angle();\n\t\t\tPoint oa = o.angle();\n\t\t\tint z = signum(a.x + a.y - oa.x - oa.y);\n\t\t\tif (z != 0) {\n\t\t\t\treturn z;\n\t\t\t}\n\t\t\treturn signum(a.y - oa.y);\n\t\t}\n\n\t}\n\n\tpublic class Fraction implements Comparable {\n\t\tlong x;\n\t\tlong y;\n\n\t\tpublic Fraction(long x, long y, boolean needNorm) {\n\t\t\tthis.x = x;\n\t\t\tthis.y = y;\n\t\t\tif (y < 0) {\n\t\t\t\tthis.x *= -1;\n\t\t\t\tthis.y *= -1;\n\t\t\t}\n\t\t\tif (needNorm) {\n\t\t\t\tlong gcd = gcd(this.x, this.y);\n\t\t\t\tthis.x /= gcd;\n\t\t\t\tthis.y /= gcd;\n\t\t\t}\n\t\t}\n\n\t\tpublic Fraction clone() {\n\t\t\treturn new Fraction(x, y, false);\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\treturn x + \"/\" + y;\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(Fraction o) {\n\t\t\tlong res = x * o.y - y * o.x;\n\t\t\tif (res > 0) {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tif (res < 0) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\tpublic class Event implements Comparable {\n\t\tFraction f;\n\t\tint type;\n\n\t\tpublic Event(Fraction f, int type) {\n\t\t\tthis.f = f;\n\t\t\tthis.type = type;\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(Event o) {\n\t\t\tint c = f.compareTo(o.f);\n\t\t\tif (c != 0) {\n\t\t\t\treturn c;\n\t\t\t}\n\t\t\treturn type - o.type;\n\t\t}\n\n\t}\n\n\tpublic double sq(double x) {\n\t\treturn x * x;\n\t}\n\n\tpublic long sq(long x) {\n\t\treturn x * x;\n\t}\n\n\tpublic double hypot2(double x, double y) {\n\t\treturn sq(x) + sq(y);\n\t}\n\n\tpublic long hypot2(long x, long y) {\n\t\treturn sq(x) + sq(y);\n\t}\n\n\tpublic boolean kuhn(int v, int[][] edge, boolean[] used, int[] mt) {\n\t\tused[v] = true;\n\t\tfor (int u : edge[v]) {\n\t\t\tif (mt[u] < 0 || (!used[mt[u]] && kuhn(mt[u], edge, used, mt))) {\n\t\t\t\tmt[u] = v;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic int matching(int[][] edge) {\n\t\tint n = edge.length;\n\t\tint[] mt = new int[n];\n\t\tArrays.fill(mt, -1);\n\t\tboolean[] used = new boolean[n];\n\t\tint ans = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (!used[i] && kuhn(i, edge, used, mt)) {\n\t\t\t\tArrays.fill(used, false);\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\t\treturn ans;\n\t}\n\n\tdouble sq2 = Math.sqrt(2);\n\n\tint small = 20;\n\n\tpublic class Stack {\n\t\tint[] st;\n\t\tint sz;\n\n\t\tpublic Stack(int n) {\n\t\t\tthis.st = new int[n];\n\t\t\tsz = 0;\n\t\t}\n\n\t\tpublic boolean isEmpty() {\n\t\t\treturn sz == 0;\n\t\t}\n\n\t\tpublic int peek() {\n\t\t\treturn st[sz - 1];\n\t\t}\n\n\t\tpublic int pop() {\n\t\t\tsz--;\n\t\t\treturn st[sz];\n\t\t}\n\n\t\tpublic void clear() {\n\t\t\tsz = 0;\n\t\t}\n\n\t\tpublic void add(int x) {\n\t\t\tst[sz++] = x;\n\t\t}\n\n\t\tpublic int get(int x) {\n\t\t\treturn st[x];\n\t\t}\n\t}\n\n\tpublic int[][] readGraph(int n, int m) {\n\t\tint[][] to = new int[n][];\n\t\tint[] sz = new int[n];\n\t\tint[] x = new int[m];\n\t\tint[] y = new int[m];\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tx[i] = in.nextInt() - 1;\n\t\t\ty[i] = in.nextInt() - 1;\n\t\t\tsz[x[i]]++;\n\t\t\tsz[y[i]]++;\n\t\t}\n\t\tfor (int i = 0; i < to.length; i++) {\n\t\t\tto[i] = new int[sz[i]];\n\t\t\tsz[i] = 0;\n\t\t}\n\t\tfor (int i = 0; i < x.length; i++) {\n\t\t\tto[x[i]][sz[x[i]]++] = y[i];\n\t\t\tto[y[i]][sz[y[i]]++] = x[i];\n\t\t}\n\t\treturn to;\n\t}\n\n\tpublic class Pol {\n\t\tdouble[] coeff;\n\n\t\tpublic Pol(double[] coeff) {\n\t\t\tthis.coeff = coeff;\n\t\t}\n\n\t\tpublic Pol mult(Pol p) {\n\t\t\tdouble[] ans = new double[coeff.length + p.coeff.length - 1];\n\t\t\tfor (int i = 0; i < ans.length; i++) {\n\t\t\t\tfor (int j = Math.max(0, i - p.coeff.length + 1); j < coeff.length && j <= i; j++) {\n\t\t\t\t\tans[i] += coeff[j] * p.coeff[i - j];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn new Pol(ans);\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\tString ans = \"\";\n\t\t\tfor (int i = 0; i < coeff.length; i++) {\n\t\t\t\tans += coeff[i] + \" \";\n\t\t\t}\n\t\t\treturn ans;\n\t\t}\n\n\t\tpublic double value(double x) {\n\t\t\tdouble ans = 0;\n\t\t\tdouble p = 1;\n\t\t\tfor (int i = 0; i < coeff.length; i++) {\n\t\t\t\tans += coeff[i] * p;\n\t\t\t\tp *= x;\n\t\t\t}\n\t\t\treturn ans;\n\t\t}\n\n\t\tpublic double integrate(double r) {\n\t\t\tPol p = new Pol(new double[coeff.length + 1]);\n\t\t\tfor (int i = 0; i < coeff.length; i++) {\n\t\t\t\tp.coeff[i + 1] = coeff[i] / fact[i + 1];\n\t\t\t}\n\t\t\treturn p.value(r);\n\t\t}\n\n\t\tpublic double integrate(double l, double r) {\n\t\t\treturn integrate(r) - integrate(l);\n\t\t}\n\t}\n\n\tdouble[] fact = new double[100];\n\n\tpublic class DSU1 {\n\t\tint[] p;\n\t\tint[] sz;\n\t\tStack less;\n\t\tStack more;\n\t\tTreeSet[] q;\n\t\tboolean[] used;\n\n\t\t@SuppressWarnings(\"unchecked\")\n\t\tpublic DSU1(int[] v, int m) {\n\t\t\tint n = v.length;\n\t\t\tp = new int[n];\n\t\t\tsz = new int[n];\n\t\t\tq = new TreeSet[n];\n\t\t\tless = new Stack(m);\n\t\t\tmore = new Stack(m);\n\t\t\tused = new boolean[n + 1];\n\t\t\tfor (int i = 0; i < v.length; i++) {\n\t\t\t\tp[i] = i;\n\t\t\t\tsz[i] = 1;\n\t\t\t\tq[i] = new TreeSet<>();\n\t\t\t\tq[i].add(v[i]);\n\t\t\t}\n\t\t}\n\n\t\tpublic int get(int x) {\n\t\t\twhile (x != p[x]) {\n\t\t\t\tx = p[x];\n\t\t\t}\n\t\t\treturn x;\n\t\t}\n\n\t\tpublic boolean unite(int a, int b) {\n\t\t\tint pa = get(a);\n\t\t\tint pb = get(b);\n\t\t\tif (pa == pb) {\n\t\t\t\tless.add(-1);\n\t\t\t\tmore.add(-1);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (sz[pa] < sz[pb]) {\n\t\t\t\tp[pa] = pb;\n\t\t\t\tsz[pb] += sz[pa];\n\n\t\t\t\tless.add(pa);\n\t\t\t\tmore.add(pb);\n\t\t\t\tfor (int i : q[pa]) {\n\t\t\t\t\tq[pb].add(i);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tp[pb] = pa;\n\t\t\t\tsz[pa] += sz[pb];\n\n\t\t\t\tless.add(pb);\n\t\t\t\tmore.add(pa);\n\t\t\t\tfor (int i : q[pb]) {\n\t\t\t\t\tq[pa].add(i);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic void popEdge() {\n\t\t\tint pa = less.pop();\n\t\t\tint pb = more.pop();\n\t\t\tif (pa < 0) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfor (int i : q[pa]) {\n\t\t\t\tq[pb].remove(i);\n\t\t\t}\n\t\t\tp[pa] = pa;\n\t\t\tsz[pb] -= sz[pa];\n\t\t}\n\n\t\tpublic int poll(int x) {\n\t\t\tint px = get(x);\n\t\t\twhile (!q[px].isEmpty()) {\n\t\t\t\tint v = q[px].pollLast();\n\t\t\t\tif (!used[v]) {\n\t\t\t\t\tused[v] = true;\n\t\t\t\t\treturn v;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn 0;\n\t\t}\n\n\t}\n\n\tpublic void solve() {\n\t\tint n = in.nextInt();\n\t\tint m = in.nextInt();\n\t\tint q = in.nextInt();\n\t\tint[] v = new int[n];\n\t\tfor (int i = 0; i < v.length; i++) {\n\t\t\tv[i] = in.nextInt();\n\t\t}\n\t\tint[] a = new int[m];\n\t\tint[] b = new int[m];\n\t\tfor (int i = 0; i < b.length; i++) {\n\t\t\ta[i] = in.nextInt() - 1;\n\t\t\tb[i] = in.nextInt() - 1;\n\t\t}\n\t\tboolean[] type = new boolean[q];\n\t\tint[] x = new int[q];\n\t\tboolean[] removed = new boolean[m];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (in.nextInt() == 1) {\n\t\t\t\tx[i] = in.nextInt() - 1;\n\t\t\t\ttype[i] = true;\n\t\t\t} else {\n\t\t\t\tx[i] = in.nextInt() - 1;\n\t\t\t\tremoved[x[i]] = true;\n\t\t\t}\n\t\t}\n\t\tDSU1 dsu = new DSU1(v, m);\n\t\tfor (int i = 0; i < removed.length; i++) {\n\t\t\tif (!removed[i]) {\n\t\t\t\tdsu.unite(a[i], b[i]);\n\t\t\t}\n\t\t}\n\t\tfor (int i = q - 1; i >= 0; i--) {\n\t\t\tif (!type[i]) {\n\t\t\t\tdsu.unite(a[x[i]], b[x[i]]);\n\t\t\t}\n\t\t}\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (type[i]) {\n\t\t\t\tout.println(dsu.poll(x[i]));\n\t\t\t} else {\n\t\t\t\tdsu.popEdge();\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic void add(HashMap map, int x) {\n\t\tif (map.containsKey(x)) {\n\t\t\tmap.put(x, map.get(x) + 1);\n\t\t} else {\n\t\t\tmap.put(x, 1);\n\t\t}\n\t}\n\n\tpublic void run() {\n\t\ttry {\n\t\t\tif (systemIO) {\n\t\t\t\tin = new FastScanner(System.in);\n\t\t\t\tout = new PrintWriter(System.out);\n\t\t\t} else {\n\t\t\t\tin = new FastScanner(new File(\"input.txt\"));\n\t\t\t\tout = new PrintWriter(new File(\"output.txt\"));\n\t\t\t}\n\t\t\tsolve();\n\n\t\t\tout.close();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n\n\tclass FastScanner {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tFastScanner(File f) {\n\t\t\ttry {\n\t\t\t\tbr = new BufferedReader(new FileReader(f));\n\t\t\t} catch (FileNotFoundException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\n\t\tFastScanner(InputStream f) {\n\t\t\tbr = new BufferedReader(new InputStreamReader(f));\n\t\t}\n\n\t\tString nextLine() {\n\t\t\ttry {\n\t\t\t\treturn br.readLine();\n\t\t\t} catch (IOException e) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\n\t\tString next() {\n\t\t\twhile (st == null || !st.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tint nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tdouble nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t}\n\n\t// AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n\tpublic static void main(String[] arg) {\n\t\tnew E().run();\n\t}\n}", "lang": "Java 11", "bug_code_uid": "678ce04fc0f8c4a202a5679aa4da7ff4", "src_uid": "ad014bde729222db14f38caa521e4167", "apr_id": "5a69d7c1bba9db20c1f0c78922ea5978", "difficulty": 2600, "tags": ["dsu", "data structures", "implementation", "graphs", "trees"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9918588873812755, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "\nimport java.util.*;\nimport java.io.*;\n\npublic class AmrandPins {\n\n\tpublic static void main(String[] args) throws IOException, FileNotFoundException {\n\t\tBufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n\t\t//BufferedReader in = new BufferedReader(new FileReader(\"AmrandPins\"));\n\n\t\tStringTokenizer st = new StringTokenizer(in.readLine());\n\t\tint n = Integer.parseInt(st.nextToken()); \n\t\tint x = Integer.parseInt(st.nextToken()); \n\t\tint y = Integer.parseInt(st.nextToken()); \n\t\tint xx = Integer.parseInt(st.nextToken()); \n\t\tint yy = Integer.parseInt(st.nextToken()); \n\t\t\n\t\tdouble dist = Math.sqrt((xx-x)*(xx-x) + (yy-y)*(yy-y));\n\t\tdist /= (double)(2*n);\n\t\tSystem.out.println((int)(Math.ceil(dist)));\n\n\t}\n\n}\n", "lang": "Java 11", "bug_code_uid": "9a8cd90bbe16501147f4ad7cb54a4042", "src_uid": "698da80c7d24252b57cca4e4f0ca7031", "apr_id": "bb04ba8be3423f52541e63828e966679", "difficulty": 1400, "tags": ["geometry", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9071383449147189, "equal_cnt": 11, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "package B;\n\nimport java.util.Scanner;\n\npublic class _888B_BuggyRobot {\n public static void main(String args[]){\n Scanner sc= new Scanner(System.in);\n int n = sc.nextInt(),max=0,x=0,y=0;\n String ch = sc.next();\n char h;\n for(int i=0;i= 1 && !visited[i][j][k] && !visited[j][i][k] && \n\t\t\t\t\t\t!visited[i][k][j] && !visited[j][k][i] && !visited[k][i][j] && !visited[k][j][i])\n\t\t\t\t\tif((i+j) > k && (i+k)>j && (j+k)>i)\t\t{\n\t\t\t\t\t\tvisited[i][j][k] = true;\n\t\t\t\t\t\tvisited[j][i][k] = true;\n\t\t\t\t\t\tvisited[i][k][j] = true;\n\t\t\t\t\t\tvisited[j][k][i] = true;\n\t\t\t\t\t\tvisited[k][i][j] = true;\n\t\t\t\t\t\tvisited[k][j][i] = true;\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n//\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "61a90dfb68745b2cc7eb68caba8fc7c6", "src_uid": "838f2e75fdff0f13f002c0dfff0b2e8d", "apr_id": "7059864bff25db755ed8438ba03835d3", "difficulty": 1300, "tags": ["brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.3554788610871441, "equal_cnt": 14, "replace_cnt": 12, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 14, "bug_source_code": "import java.util.Scanner;\n\t\n\tpublic class CloningToys {\n\t\n\t\tpublic static void main(String[] args) {\n\t\t\t// TODO Auto-generated method stub\n\t\t\t\n\t\t\tScanner in= new Scanner(System.in);\n\t\t\t\n\t\t\tlong a=in.nextLong();\n\t\t\tlong b=in.nextLong();\n\t\t\t\n\t\t\t\n\t\t\tif(b>0) {\n\t\t\t\t\n\t\t\t\tif(Math.abs(a-b)%2==0 || (b>1 && a==0) || b-a>1 || (a>1 && b==1)) {\n\t\t\t\t\tSystem.out.println(\"No\");\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tSystem.out.println(\"Yes\");\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\telse {\n\t\t\t\tSystem.out.println(\"No\");\n\t\t\t}\n\t\n\t\t}\n\t\n\t}\n", "lang": "Java 8", "bug_code_uid": "c475126e0a0365459faf8dc9e5b97fb7", "src_uid": "838f2e75fdff0f13f002c0dfff0b2e8d", "apr_id": "6f547838483b8e647190dd535b14c6c1", "difficulty": 1300, "tags": ["brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8233923578751164, "equal_cnt": 24, "replace_cnt": 16, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 23, "bug_source_code": "import java.io.*;\nimport java.util.*;\npublic class Lo \n{\n \n public static void main(String args[] ) throws Exception \n {\n FastReader in = new FastReader();\n int n = in.nextInt();\n int m = in.nextInt();\n int[] a = new int[n];\n int[] b = new int[m];\n int min1=Integer.MAX_VALUE;\n int min2=Integer.MAX_VALUE;\n for(int i=0;imin2)\n {\n System.out.print(min2+\"\"+min1);\n }\n\n \n\n\n }\n static class FastReader\n {\n BufferedReader br;\n StringTokenizer st;\n \n public FastReader()\n {\n br = new BufferedReader(new\n InputStreamReader(System.in));\n }\n \n String next()\n {\n while (st == null || !st.hasMoreElements())\n {\n try\n {\n st = new StringTokenizer(br.readLine());\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n \n int nextInt()\n {\n return Integer.parseInt(next());\n }\n \n long nextLong()\n {\n return Long.parseLong(next());\n }\n \n double nextDouble()\n {\n return Double.parseDouble(next());\n }\n \n String nextLine()\n {\n String str = \"\";\n try\n {\n str = br.readLine();\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n return str;\n }\n }\n}\n\n\n", "lang": "Java 8", "bug_code_uid": "8f77100f94fbdc48b7123276719fbc07", "src_uid": "3a0c1b6d710fd8f0b6daf420255d76ee", "apr_id": "7b104d82a811ce53ab82cc860aea59eb", "difficulty": 900, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9711037423022264, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "package com.javarush.test.level19.lesson10.bonus03;\n\nimport java.util.Scanner;\n\npublic class SolutionA {\n public static void main(String[] args) {\n int pixelNumber = new Scanner(System.in).nextInt();\n\n int[] dividers = new int[10000];\n int counter = 0;\n for (int i = 1; i < pixelNumber / 2 + 1; i++) {\n if (pixelNumber % i == 0) {\n dividers[counter] = i;\n counter++;\n }\n }\n\n dividers[counter] = pixelNumber;\n counter++;\n\n int minDifference = 1000000;\n int rows = 0;\n int columns = 0;\n for (int i = 0; i < counter; i++) {\n if (Math.abs(dividers[i] - dividers[--counter]) < minDifference) {\n rows = dividers[i];\n columns = dividers[counter];\n minDifference = Math.abs(rows - columns);\n }\n }\n if (rows > columns) {\n int temp = rows;\n rows = columns;\n columns = rows;\n }\n System.out.println(rows + \" \" + columns);\n }\n}", "lang": "Java 8", "bug_code_uid": "948c945c288f0fe5567a155d69bc9f8b", "src_uid": "f52af273954798a4ae38a1378bfbf77a", "apr_id": "39da6be833f749f510b094641916bc63", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.17339667458432304, "equal_cnt": 12, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 13, "bug_source_code": "package USACO;\n\npublic class ViciousKeyboard {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "71c5cb4915a34e32d2b64b9154d38715", "src_uid": "f52af273954798a4ae38a1378bfbf77a", "apr_id": "65b6ea85e93d4fbe09b88d04827580d8", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6973101804562478, "equal_cnt": 14, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 14, "bug_source_code": "import java.util.*;\npublic class MakingString {\n\n\n\tpublic static void main(String[] args) {\n\t\tScanner input = new Scanner (System.in);\n\t\tint n = input.nextInt(); \n\t\tint a[] = new int[n+1];\n\t\tlong ans = 0;\n\t\tboolean flag[] = new boolean[(int) 1e9 +1];\n\t\tfor (int i = 1 ; i <= n ; ++i){\n\t\t\ta[i] = input.nextInt();\n\t\t}\n\t\tArrays.sort(a);\n//\t\tfor (int i = 0 ; i <= n ; ++i){\n//\t\t\tSystem.out.print(a[i] + \" \");\n//\t\t}\n\t\t//soudi!\n\t\tint cnt = 0;\n\t\tfor (int i = 1 ; i <= n ; ++i){\n\t\t\tif (!flag[a[i]]){\n\t\t\t\tans += a[i];\n\t\t\t\tflag[a[i]] = true;\n\t\t\t//\tSystem.out.println(a[i]);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcnt = 0;\n\t\t\t\twhile (flag[a[i] - cnt] && a[i] - cnt > 0){\n\t\t\t\t\t++cnt;\n\t\t\t\t}\n\t\t\t\tans += a[i] - cnt;\n\t\t\t//\tSystem.out.println(a[i] - cnt);\n\t\t\t\tflag[a[i] - cnt] = true;\n\t\t\t}\n//\t\t\tif (a[i] != a[i-1] && !flag[a[i]]){\n//\t\t\t\tans += a[i];\n//\t\t\t\tcnt = 0;\n//\t\t\t\tflag[a[i]] = true;\n//\t\t\t\tcontinue;\n//\t\t\t}\n//\t\t\tif (a[i] != a[i-1] && flag[a[i] - cnt]);\n//\t\t\tif (a[i] == a[i-1]) {\n//\t\t\t\t++cnt;\n//\t\t\t\tif (a[i] - cnt > 0 && !flag[a[i] - cnt]){\n//\t\t\t\t\tans += a[i] - cnt;\n//\t\t\t\t\tflag [a[i] - cnt] = true;\n//\t\t\t\t\tcontinue;\n//\t\t\t\t}\n//\t\t\t\tif (a[i] - cnt > 0 && flag[a[i] - cnt]){\n//\t\t\t\t\t++cnt;\n//\t\t\t\t\tans += a[i] - cnt;\n//\t\t\t\t\tflag[a[i] - cnt] = true;\n//\t\t\t\t\tcontinue;\n//\t\t\t\t}\n//\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\n}\n", "lang": "Java 7", "bug_code_uid": "89817c358c1d9218258382e20341c2df", "src_uid": "3c4b2d1c9440515bc3002eddd2b89f6f", "apr_id": "bb771ee1b087d64a419cf842e877eb51", "difficulty": 1100, "tags": ["greedy", "sortings"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.43556895252449135, "equal_cnt": 20, "replace_cnt": 14, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 20, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.Set;\n\n/**\n * @author shakhawat.hossain\n * @since 2/4/2016 11:23 PM\n */\npublic class B624 {\n public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n br.readLine();\n\n boolean[] taken = new boolean[1000000000];\n\n String[] input = br.readLine().split(\" \");\n int maxAllowedOccurances[] = new int[input.length];\n\n for (int i = 0; i < input.length; i++) {\n maxAllowedOccurances[i] = Integer.parseInt(input[i]);\n }\n\n Arrays.sort(maxAllowedOccurances);\n\n int maxStringLength = 0;\n\n for (int maxAllowedOccurance : maxAllowedOccurances) {\n int selectedFreq = maxAllowedOccurance;\n\n if (taken[selectedFreq]) {\n while (true) {\n selectedFreq -= 1;\n\n if (!taken[selectedFreq] || selectedFreq == 0) {\n break;\n }\n }\n }\n\n taken[selectedFreq] = true;\n\n maxStringLength += selectedFreq;\n }\n\n System.out.println(maxStringLength);\n }\n}\n\n", "lang": "Java 7", "bug_code_uid": "87c863c12382bdc76dcfd87ad6169108", "src_uid": "3c4b2d1c9440515bc3002eddd2b89f6f", "apr_id": "30067b2d0ce70889e89c17df97dce651", "difficulty": 1100, "tags": ["greedy", "sortings"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.3324175824175824, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 4, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "import java.util.Scanner;\n\npublic class Solution {\n\n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n\n int n = scan.nextInt();\n String turn = \"Mahmoud\";\n \n if (n==1) {\n System.out.println(\"Ehab\");\n return;\n }\n \n if (n==2) {\n System.out.println(\"Mahmoud\");\n }\n\n while (n >= 0) {\n\n if (turn.equals(\"Mahmoud\")) {\n int a = scan.nextInt();\n if (n - a >= 0 && a % 2 == 0) {\n turn = \"Ehab\";\n n = n - a;\n } else {\n System.out.println(\"Ehab\");\n return;\n }\n }\n\n else if (turn.equals(\"Ehab\")) {\n int a = scan.nextInt();\n if (n - a >= 0 && a % 2 != 0) {\n turn = \"Mahmoud\";\n n = n - a;\n } else {\n System.out.println(\"Mahmoud\");\n return;\n }\n }\n }\n }\n}", "lang": "Java 11", "bug_code_uid": "b46f9ac2a8a4e99d14866801ea50c6f4", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "apr_id": "012f7c27d3f7194e7b0a3ac407e26a7c", "difficulty": 800, "tags": ["math", "games"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9632495164410058, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "package today;\n\nimport java.util.Scanner;\npublic class sp {\n\n\tpublic static void main(String[] args) {\n\tScanner input=new Scanner(System.in);\n\tint n;\n\tn=input.nextInt();\n\tif(n%2==0) {\n\t\tSystem.out.println(\"Mahmoud\");\n\t\t\n\t}\n\telse {\n\t\tSystem.out.println(\"Ehab\");\n\t}\n\t}\n}", "lang": "Java 11", "bug_code_uid": "e9b4125fe6184a17df97f5befbaee273", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "apr_id": "6dd43799de7c2daf19d3e4132e4f96ce", "difficulty": 800, "tags": ["math", "games"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9838709677419355, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*;\npublic class VasyaTheHipster {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\nScanner sc = new Scanner(System.in);\nint a=sc.nextInt();\nint b=sc.nextInt();int diffsocks=0,extra=0;\nif(a= 1 && y/2 >= 1)\n \t\tsign = \"YES\";\n \t\tx++;\n \t\ty--;\n\n }\n }\n else {\n\n while (x <= y){\n \tif ( x%2 == 0&& y%2 == 0 && x/2 >= 1 && y/2 >= 1)\n \t\tsign = \"YES\";\n \t\tx++;\n \t\ty--;\n\n }\n }\n System.out.print (sign);\n }\n\n\n}", "lang": "Java 7", "bug_code_uid": "d1daadfdbf0d82eb0dc1c71e92d70660", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "b1f13c8d5e576c9b363a11887a85ff5e", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9277184160905091, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Scanner;\npublic class MainActivity1 {\n\tpublic static void main(String[] args) {\n\t Scanner sc = new Scanner(System.in);\n\t String ch = sc.next();\n\t String str = sc.next();\n\t int f = 0, s = 0;\n\n\t if(str.charAt(0) == 'F') {f = 1;}\n\t if(str.charAt(0) == 'S') {s = 1;}\n\t \n\t for(int i = 0; i < str.length() - 1; i++) {\n\t\t\t\tif(str.charAt(i) == 'F' && str.charAt(i + 1) == 'S') {\n\t\t\t\t\tf++;\n\t\t\t\t}\n\t\t\t\tif(str.charAt(i) == 'S' && str.charAt(i + 1) == 'F') {\n\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t}\t\n\t \n\t if(str.charAt(str.length()) == 'F') {f++;}\n\t if(str.charAt(str.length()) == 'S') {s++;}\n\t \n\t if(s > f) {\n\t \t System.out.print(\"YES\");\n\t }\n\t if(s < f) {\n\t \t System.out.print(\"NO\");\n\t }\n\t if(s == f) {\n\t \t System.out.print(\"NO\");\n\t } \n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "e26d537ea33978d0ec12bddad93af994", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "apr_id": "3b2106d03cd1944167f2cba6ed35cc36", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9262807163681799, "equal_cnt": 11, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 10, "bug_source_code": "import java.util.*;\nimport java.io.*;\n\npublic class Main {\n\n\tBufferedReader in;\n\tStringTokenizer str = null;\n\tPrintWriter out;\n\t\n\tprivate String next() throws Exception{\n\t\twhile (str == null || !str.hasMoreElements())\n\t\t\tstr = new StringTokenizer(in.readLine());\n\t\treturn str.nextToken();\n\t}\n\t\n\tprivate int nextInt() throws Exception{\n\t\treturn Integer.parseInt(next());\n\t}\n\t\n\tprivate long nextLong() throws Exception{\n\t\treturn Long.parseLong(next());\n\t}\n\t\n\tprivate double nextDouble() throws Exception{\n\t\treturn Double.parseDouble(next());\n\t}\n\n\tV []tree;\n\tint size = 0;\n\n\tint n, m, v;\n\tchar []a, b, c;\n\n\tint [][][]dp;\n\n\tpublic void run() throws Exception{\n\t\tin = new BufferedReader(new InputStreamReader(System.in));\n\t\tout = new PrintWriter(System.out);\n\t\ta = next().toCharArray();\n\t\tb = next().toCharArray();\n\t\tc = next().toCharArray();\n\n\t\tn = a.length;\n\t\tm = b.length;\n\t\tv = c.length;\n\n\t\tinit();\n\t\taddString(c);\n\n\t\tfor(int i = 0; i < size; ++i) getLink(i);\n\t\t// for(int i = 0; i < size; ++i) System.out.println(i + \" \" + tree[i]);\n\n\t\tdp = new int[n][m][v];\n\t\tfor(int [][]i : dp)\n\t\t\tfor(int []j : i)\n\t\t\t\tArrays.fill(j, -1);\n\t\tint ret = dp(0, 0, 0);\n\t\tif (ret <= 0) {\n\t\t\tout.println(0);\n\t\t}else {\n\t\t\tprint(0, 0, 0);\n\t\t\tout.println();\n\t\t}\n\t\tout.close();\n\t}\n\n\tfinal static int oo = Integer.MAX_VALUE / 2;\n\n\tprivate void print(int i, int j, int k) {\n\t\tif (i == n) return;\n\t\tif (j == m) return;\n\n\t\tif (a[i] == b[j]) {\n\t\t\tint c = a[i] - 'A';\n\t\t\tint next = go(k, c);\n\t\t\tif (next != v) {\n\t\t\t\tout.print(a[i]);\n\t\t\t\tprint(i + 1, j + 1, next);\t\n\t\t\t}\n\t\t}else {\n\t\t\tint ret = dp(i + 1, j, k);\n\t\t\tif (ret < dp(i, j + 1, k)) {\n\t\t\t\tprint(i, j + 1, k);\n\t\t\t}else {\n\t\t\t\tprint(i + 1, j, k);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate int dp(int i, int j, int k) {\n\t\tif (k == v) return -oo;\n\t\tif (i == n) return 0;\n\t\tif (j == m) return 0;\n\n\t\tif (dp[i][j][k] != -1)\n\t\t\treturn dp[i][j][k];\n\n\t\tint ret = -oo;\n\t\tif (a[i] == b[j]) {\n\t\t\tint c = a[i] - 'A';\n\t\t\tint next = go(k, c);\n\t\t\tif (next == v) ret = 0;\n\t\t\tret = Math.max(ret, 1 + dp(i + 1, j + 1, next));\n\t\t}else {\n\t\t\tret = Math.max(ret, dp(i, j + 1, k));\n\t\t\tret = Math.max(ret, dp(i + 1, j, k));\t\n\t\t}\n\t\treturn dp[i][j][k] = ret;\n\t}\n\n\tprivate void init() {\n\t\ttree = new V[110];\n\t\ttree[size++] = new V(-1, -1);\n\t}\n\n\tprivate void addString(char []a) {\n\t\tint v = 0;\n\t\tfor(int i = 0; i < a.length; ++i) {\n\t\t\tint c = a[i] - 'A';\n\t\t\tif (tree[v].next[c] == -1) {\n\t\t\t\ttree[size] = new V(v, c);\n\t\t\t\ttree[v].next[c] = size++;\n\t\t\t}\n\t\t\tv = tree[v].next[c];\n\t\t}\n\t\ttree[v].leaf = true;\n\t}\n\n\tprivate int getLink(int v) {\n\t\tif (tree[v].link != -1) return tree[v].link;\n\t\tif (v == 0 || tree[v].p == 0) return tree[v].link = 0;\n\t\treturn tree[v].link = go(getLink(tree[v].p), tree[v].pchar);\n\t}\n\n\tprivate int go(int v, int c) {\n\t\tif (tree[v].go[c] != -1) return tree[v].go[c];\n\t\tif (tree[v].next[c] != -1) return tree[v].go[c] = tree[v].next[c];\n\t\tif (v == 0) return tree[v].go[c] = 0;\n\t\treturn tree[v].go[c] = go(getLink(v), c);\n\t}\n\n\tclass V {\n\t\tint []next, go;\n\t\tint p, pchar;\n\t\tboolean leaf;\n\t\tint link;\n\n\t\tpublic V(int p, int pchar) {\n\t\t\tthis.p = p;\n\t\t\tthis.pchar = pchar;\n\t\t\tlink = -1;\n\t\t\tleaf = false;\n\t\t\tnext = new int[26];\n\t\t\tgo = new int[26];\n\t\t\tArrays.fill(next, -1);\n\t\t\tArrays.fill(go, -1);\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\treturn \"[ parent=\" + p + \" pchar=\" + pchar + \" link=\" + link + \" ]\"; \n\t\t}\n\t}\n\t\t\n\tpublic static void main(String[] args) throws Exception{\n\t\tnew Main().run();\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "a3c62dcaf0db5272ea181a13e9b8db1c", "src_uid": "391c2abbe862139733fcb997ba1629b8", "apr_id": "1a778f286806e6e1bff219c7af397eba", "difficulty": 2000, "tags": ["dp", "strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9182692307692307, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "public class Ogurechik {\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int numberofpressedpanels = in.nextInt();\n in.nextLine();\n\n int[] array = new int[9];\n String answer = \"YES\";\n for (int i = 0; i < 4; i++) {\n String strochka = in.nextLine();\n for (char element : strochka.toCharArray()) {\n if (element != '.') {\n array[element-'1']++;\n }\n }\n }\n for (int i = 0; i < array.length; i++) {\n if (array[i] > numberofpressedpanels * 2) {\n System.out.println(\"NO\");\n break;\n }\n else{\n System.out.println(\"YES\");\n }\n\n }\n \n\n }\n}", "lang": "Java 8", "bug_code_uid": "b572a249279707c5c0e1d5ad8c7a3de3", "src_uid": "5fdaf8ee7763cb5815f49c0c38398f16", "apr_id": "05343b6700a699ba114450c8cd20b56b", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9352627570449352, "equal_cnt": 2, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "\timport java.util.Scanner;\n/**\n *\n * @author dell\n */\npublic class CollectingBeatsIsFun {\n\n\tpublic static void main(String args[]){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint k = sc.nextInt();\n\t\tsc.nextLine();\n\t\tint[] t = new int[9];\n\t\tString s;\n\t\tfor(int i = 0; i < 4; i++){\n\t\t\ts = sc.nextLine(); \n\t\t\tfor(int j = 0; j < 4; j++){\n\t\t\t\tif(s.charAt(j) == '.'){\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tt[s.charAt(j)-'1']++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tboolean sol = true;\n\t\tfor(int i = 0; i < 9; i++){\n\t\t\tif(t[i]>2*k){\n\t\t\t\tsol = false;\n\t\t\t}\n\t\t}\n\t\tif(sol){\n\t\t\tSystem.out.println(\"YES\");\n\t\t}\n\t\telse{\n\t\t\tSystem.out.println(\"NO\");\n\t\t}\n\t}\n}\n \n}\n", "lang": "Java 8", "bug_code_uid": "d0ff09682542d09cca19c1925dae9a22", "src_uid": "5fdaf8ee7763cb5815f49c0c38398f16", "apr_id": "ae56d545621f053097b2d0c888dae214", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.1798080614203455, "equal_cnt": 8, "replace_cnt": 1, "delete_cnt": 5, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "import java.awt.Point;\nimport java.io.BufferedReader;\nimport java.io.FileInputStream;\nimport java.io.FileNotFoundException;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Comparator;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Scanner;\nimport java.util.StringTokenizer;\n\npublic class B {\n ArrayList v = new ArrayList();\n long N = 0;\n\n void solve() throws IOException {\n long n = sl(), k = sl();\n N = n;\n ArrayList pipes = new ArrayList();\n for (int i = 1; i <= k; i++) {\n pipes.add(i);\n }\n dfs(pipes, 0, 0);\n System.out.println(found ? ans : -1);\n }\n\n boolean found = false;\n long ans = Long.MAX_VALUE - 1;\n\n void dfs(ArrayList pipes, long pcount, long o) {\n if (o >= N) {\n if (o == N) {\n ans = Math.min(ans, pcount);\n found = true;\n }\n return;\n } else {\n for (int i = 0; i < pipes.size(); i++) {\n ArrayList t = (ArrayList) pipes.clone();\n Integer x = t.remove(i);\n dfs(t, pcount + 1, x + (pcount > 0 ? o - 1 : o));\n }\n }\n }\n\n public static void main(String[] Args) throws IOException {\n new B().solve();\n }\n\n static int[] dx_ = { 0, 0, 1, -1 };\n static int[] dy_ = { 1, -1, 0, 0 };\n\n // ----------------------- Library ------------------------\n\n // ----------------------- GRAPH ------------------------\n\n /**\n * important for speed!!! PrintWriter out=new PrintWriter(new\n * OutputStreamWriter(System.out)); out.print(...); out.close();\n * \n * @param v\n */\n // leap year is 29\n int[] year = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };\n\n void initSystem() throws IOException {\n if (br != null)\n br.close();\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n void initFile() throws IOException {\n if (br != null)\n br.close();\n br = new BufferedReader(new InputStreamReader(new FileInputStream(\n \"input.txt\")));\n }\n\n void printWriter() {\n try {\n PrintWriter pr = new PrintWriter(\"output.txt\");\n pr.println(\"hello world\");\n pr.close();\n } catch (FileNotFoundException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }\n\n void comparator() {\n Point[] v = new Point[10];\n Arrays.sort(v, new Comparator() {\n @Override\n public int compare(Point a, Point b) {\n if (a.x != b.x)\n return -(a.x - b.x);\n return a.y - b.y;\n }\n });\n }\n\n double distance(Point a, Point b) {\n double dx = a.x - b.x, dy = a.y - b.y;\n return Math.sqrt(dx * dx + dy * dy);\n }\n\n Scanner in = new Scanner(System.in);\n\n String ss() {\n return in.next();\n }\n\n char[] sc() {\n return in.next().toCharArray();\n }\n\n String sline() {\n return in.nextLine();\n }\n\n int si() {\n return in.nextInt();\n }\n\n long sl() {\n return in.nextLong();\n }\n\n int[] sai(int n) {\n int[] a = new int[n];\n for (int i = 0; i < a.length; i++) {\n a[i] = in.nextInt();\n }\n return a;\n }\n\n int[] si(int n) {\n int[] a = new int[n];\n for (int i = 0; i < a.length; i++) {\n a[i] = in.nextInt();\n }\n return a;\n }\n\n String[] ss(int n) {\n String[] a = new String[n];\n for (int i = 0; i < a.length; i++) {\n a[i] = ss();\n }\n return a;\n }\n\n int[] sai_(int n) {\n int[] a = new int[n + 1];\n for (int i = 1; i <= n; i++) {\n a[i] = in.nextInt();\n }\n return a;\n }\n\n BufferedReader br;\n StringTokenizer tokenizer;\n {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n void tok() throws IOException {\n tokenizer = new StringTokenizer(br.readLine());\n }\n\n int toki() throws IOException {\n\n return Integer.parseInt(tokenizer.nextToken());\n }\n\n int[] rint(int n) throws IOException {\n int[] a = new int[n];\n for (int i = 0; i < a.length; i++)\n a[i] = Integer.parseInt(tokenizer.nextToken());\n\n return a;\n }\n\n int[] rint_(int n) throws IOException {\n int[] a = new int[n + 1];\n for (int i = 1; i <= n; i++)\n a[i] = Integer.parseInt(tokenizer.nextToken());\n\n return a;\n }\n\n String[] rstrlines(int n) throws IOException {\n String[] a = new String[n];\n for (int i = 0; i < n; i++) {\n a[i] = br.readLine();\n }\n return a;\n }\n\n long tokl() {\n return Long.parseLong(tokenizer.nextToken());\n }\n\n double tokd() {\n return Double.parseDouble(tokenizer.nextToken());\n }\n\n String toks() {\n return tokenizer.nextToken();\n }\n\n String rline() throws IOException {\n return br.readLine();\n }\n\n List toList(int[] a) {\n List v = new ArrayList();\n for (int i : a)\n v.add(i);\n return v;\n }\n\n static void pai(int[] a) {\n System.out.println(Arrays.toString(a));\n }\n\n static int toi(Object s) {\n return Integer.parseInt(s.toString());\n }\n\n static int[] dx3 = { 1, -1, 0, 0, 0, 0 };\n static int[] dy3 = { 0, 0, 1, -1, 0, 0 };\n static int[] dz3 = { 0, 0, 0, 0, 1, -1 };\n\n static int[] dx = { 1, 0, -1, 1, -1, 1, 0, -1 }, dy = { 1, 1, 1, 0, 0, -1,\n -1, -1 };\n\n static int INF = 2147483647; // =2^31-1 // -8\n static long LINF = 922337203854775807L; // -8\n static short SINF = 32767; // -32768\n\n // finds GCD of a and b using Euclidian algorithm\n public int GCD(int a, int b) {\n if (b == 0)\n return a;\n return GCD(b, a % b);\n }\n\n static List toList(String[] a) {\n return Arrays.asList(a);\n }\n\n static String[] toArray(List a) {\n String[] o = new String[a.size()];\n a.toArray(o);\n return o;\n }\n\n static int[] pair(int... a) {\n return a;\n }\n}", "lang": "Java 6", "bug_code_uid": "e4c67cb6681d13a8781cfcdc66f08803", "src_uid": "83bcfe32db302fbae18e8a95d89cf411", "apr_id": "72b3818ca74ed202cd39b7e346e418c4", "difficulty": 1700, "tags": ["math", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.4383561643835616, "equal_cnt": 19, "replace_cnt": 5, "delete_cnt": 5, "insert_cnt": 9, "fix_ops_cnt": 19, "bug_source_code": "import java.util.Scanner;\n\npublic class DrazilandFactorial {\n\tpublic static void main(String[] args) {\n\t\tScanner input = new Scanner(System.in);\n\t\tint n = input.nextInt();\n\n\t\tString aTemp = input.next();\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = Character.getNumericValue(aTemp.charAt(i));\n\n\t\tint sum = 1;\n\t\tfor (int i = 0; i < aTemp.length(); i++)\n\t\t\tsum *= factor(a[i]);\n\t\t// System.out.println(sum);\n\n\t\tString Result = \"\";\n\t\twhile (sum % 7 == 0) {\n\n\t\t\tsum /= 5040;\n\t\t\tResult += \"7\";\n\n\t\t}\n\t\twhile (sum % 5 == 0) {\n\t\t\tsum /= 120;\n\t\t\tResult += \"5\";\n\t\t}\n\t\twhile (sum % 3 == 0) {\n\t\t\tsum /= 6;\n\t\t\tResult += \"3\";\n\t\t}\n\t\twhile (sum % 2 == 0) {\n\t\t\tsum /= 2;\n\t\t\tResult += \"2\";\n\t\t}\n\t\tSystem.out.println(Result);\n\t}\n\n\tpublic static int factor(int n) {\n\t\tint result = 1;\n\t\tfor (int i = 1; i <= n; i++)\n\t\t\tresult *= i;\n\t\treturn result;\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "06b43e409c7327f471bb7c621a78389d", "src_uid": "60dbfc7a65702ae8bd4a587db1e06398", "apr_id": "cef8996a070a8ca9ba04a6f83147c2a4", "difficulty": 1400, "tags": ["greedy", "math", "sortings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.996172772006561, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\n/**\n *\n * @author PANKAJ\n */\npublic class bricks {\n public static int gcd(int x,int y){\n if(x>=y){\n if(x%y==0){\n return y;\n }\n else{\n return gcd(y,x%y);\n }\n }\n else{\n if(y%x==0){\n return x;\n }\n else{\n return gcd(x,y%x);\n }\n \n } \n };\n public static void main(String args[]) throws IOException{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n String str= br.readLine();\n String a[]= str.split(\" \");\n int arr[]= new int[4];\n for(int i=0;i<4;i++){\n arr[i]= Integer.parseInt(a[i]);\n }\n int f= gcd(arr[0],arr[1]);\n int g= arr[0]*arr[1]/f;\n int s= (arr[2]-1)/g;\n int t= arr[3]/g;\n System.out.println(t-s);\n }", "lang": "Java 7", "bug_code_uid": "6ae150f2e937e461206d6b368f12482f", "src_uid": "c7aa8a95d5f8832015853cffa1374c48", "apr_id": "8dba2b95cc4ef305e88cf917ceb11e7b", "difficulty": 1200, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.571875, "equal_cnt": 20, "replace_cnt": 12, "delete_cnt": 6, "insert_cnt": 2, "fix_ops_cnt": 20, "bug_source_code": "import java.util.Scanner;\npublic class Melancia {\n public static void main(String[] args) {\n Scanner entrada = new Scanner(System.in);\n int melancia;\n melancia = entrada.nextInt();\n for( ;melancia<100 && melancia>1;){\n if(melancia%2==0){\n System.out.println(\"YES\");\n }\n } \n } \n}\n\n// 1505572683048\n", "lang": "Java 8", "bug_code_uid": "1a7243e74ea2e6ae06e17dbb6840698a", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "7fba0fdaaa9ac0e6d44b8bf6e864ec3b", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8096590909090909, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class M {\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tlong x = Long.parseLong(br.readLine());\n\t\tx = -x;\n\n\t\tlong y = Math.abs(x);\n\n\t\tint z = (int) ((y % 360) * (long) Math.signum(x));\n\n\t\tint min = (int) Math.min(Math.abs(z), Math.abs(360 - z));\n\t\tint best = 0;\n\n\t\tfor (int i = 1; i < 4; i++) {\n\t\t\tz = (z + 90 + 360) % 360;\n\t\t\tint m = (int) Math.min(Math.abs(z), Math.abs(360 - z));\n\t\t\tif (m < min) {\n\t\t\t\tbest = i;\n\t\t\t\tmin = m;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(best);\n\n\t}\n\n}\n", "lang": "Java 7", "bug_code_uid": "6adbb1b7228038758e9748f8ba288f86", "src_uid": "509db9cb6156b692557ba874a09f150e", "apr_id": "071815c70c5110a4cad820e12d41665c", "difficulty": 1800, "tags": ["geometry", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7959386820625124, "equal_cnt": 29, "replace_cnt": 19, "delete_cnt": 4, "insert_cnt": 5, "fix_ops_cnt": 28, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\n\n\npublic class Balls {\n \n public static void main(String args[]) throws Exception {\n \n MyScanner in = new MyScanner();\n\n int n = in.nextInt();\n int m = in.nextInt();\n int k = in.nextInt();\n int[] b = new int [n];\n int sum=0,max=0,buf=0;\n for (int i = 0; i < n; i++) {\n b[i] = in.nextInt(); \n }\n for (int i = 0; i < n-1; i++) {\n if (b[i]==k && b[i+1]==k) {\n sum+=2;\n }\n if (i-1>0 && i+2=0 && b[x-1]==b[y]) {\n buf++;\n x--;\n }\n if (y+10) sum += buf+2;\n max = Math.max(max,sum);\n sum=0;\n buf=0;\n }\n \n System.out.println(max);\n \n }\n\n\n public static class MyScanner {\n BufferedReader br;\n StringTokenizer st;\n\n public MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n\n}\n\n}", "lang": "Java 7", "bug_code_uid": "e198a4a1258f6bb15090708e5e1f4061", "src_uid": "d73d9610e3800817a3109314b1e6f88c", "apr_id": "725773c67d7af2f301a5e35ac8d61704", "difficulty": 1400, "tags": ["brute force", "two pointers"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7439293598233996, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Scanner;\nimport java.util.Set;\nimport java.util.StringTokenizer;\n\n/**\n *\n * @author User\n */\npublic class TestingCode {\n \n /**\n * @param args the command line arguments\n */\n static public Set list = new HashSet();\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n PrintWriter pr = new PrintWriter(System.out);\n \n int n = in.nextInt();\n \n for (int i = 1; i <= n; i++) {\n CalculateLucky(\"\",i);\n }\n System.out.println(list.size());\n \n}\n public static void CalculateLucky(String lucky , int n )\n { \n if(lucky.length()>n)\n return ;\n if(!lucky.equals(\"\"))\n list.add(lucky);\n CalculateLucky(lucky+\"8\", n);\n CalculateLucky(lucky+\"7\", n);\n \n }\n }", "lang": "Java 8", "bug_code_uid": "d03c6bdf6eccedd2b1578c094360ee3d", "src_uid": "f1b43baa14d4c262ba616d892525dfde", "apr_id": "b5a7b39332fa7f27f36e4aafabe2ab07", "difficulty": 1100, "tags": ["math", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8588661037394452, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "/*\n * To change this license header, choose License Headers in Project Properties.\n * To change this template file, choose Tools | Templates\n * and open the template in the editor.\n */\n//package codeforces;\n\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.math.BigInteger;\n\n/**\n *\n * @author ADNAN\n */\npublic class AgainTwentyFive {\n\n public static void main(String args[]) {\n int n;\n InputStreamReader ir = new InputStreamReader(System.in);\n BufferedReader br = new BufferedReader(ir);\n PrintWriter pr = new PrintWriter(System.out);\n String line;\n String[] arr;\n try {\n\n line = br.readLine();\n\n n = Integer.parseInt(line);\n\n System.out.println(rec(new StringBuilder(\"\"), n));\n\n } catch (Exception ex) {\n ex.printStackTrace();\n }\n }\n\n public static int rec(StringBuilder sb, int n) {\n\n if (sb.length() >= n) {\n return 0;\n }\n\n return 2 + rec(new StringBuilder(sb + \"7\"), n) + rec(new StringBuilder(sb + \"8\"), n);\n\n }\n}\n", "lang": "Java 8", "bug_code_uid": "7084b5088bf6a855cd5ce9b97bee6322", "src_uid": "f1b43baa14d4c262ba616d892525dfde", "apr_id": "06bd98c182ebb1d555094e48745e6f96", "difficulty": 1100, "tags": ["math", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7833733013589129, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.BufferedWriter;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.OutputStreamWriter;\nimport java.math.BigInteger;\n\npublic class C630 {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader in= new BufferedReader(new InputStreamReader(System.in));\n\t\tBufferedWriter out= new BufferedWriter(new OutputStreamWriter(System.out));\n\t\tint n;\n\t\tint sum = 0;\n\t\tn = Integer.valueOf(in.readLine());\n\t\tBigInteger i ;\n\t\tfor(i= new BigInteger(\"7\");i.toString().length()<=n;i = i.add(new BigInteger(\"1\")))\n\t\t{\n\t\t\t\n\t\t\t//System.out.print(\"1\");\n\t\t\tif(i.toString().contains(\"0\")||i.toString().contains(\"1\")||i.toString().contains(\"2\")||i.toString().contains(\"3\")||i.toString().contains(\"4\")||i.toString().contains(\"5\")||i.toString().contains(\"6\")||i.toString().contains(\"9\"))\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tsum++;\n\t\t\t}\n\t\t}\n\t\tout.write(String.valueOf(sum));\n\t\tout.flush();\n\t\tout.close();\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "be1ccd42103db1337a3a641b3b8b7930", "src_uid": "f1b43baa14d4c262ba616d892525dfde", "apr_id": "364156c625d431fe599aa8c94ed1de62", "difficulty": 1100, "tags": ["math", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9772727272727273, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Scanner;\n\n\npublic class C {\n\tpublic static void main(String[] args) {\n\t\tScanner sc= new Scanner (System.in);\n\t\tint n= sc.nextInt();\n\t\tlong result=0L;\n\t\tfor(int i=1; i<=n; i++)\n\t\tresult+= (Math.pow(2, i));\n\t\tSystem.out.println((long)result);\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "858efb75689d183295dbb4584daf417e", "src_uid": "f1b43baa14d4c262ba616d892525dfde", "apr_id": "95326fda2f7108551bf00850accc1e2d", "difficulty": 1100, "tags": ["math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9896519285042333, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import java.io.*; //PrintWriter\nimport java.math.*; //BigInteger, BigDecimal\nimport java.util.*; //StringTokenizer, ArrayList\n\n\npublic class R342_Exper_Ed_C\n{\t\n\tFastReader in;\n\tPrintWriter out;\n\t\n\tpublic static void main(String[] args) {\n\t\tnew R342_Exper_Ed_C().run();\n\t}\n\t\n\tvoid run()\n\t{\t\t\n\t\tin = new FastReader(System.in);\n\t\tout = new PrintWriter(System.out);\n\t\tsolve();\n\t\tout.close();\n\t}\n\t\n\tvoid solve()\n\t{\n\t\tint n = in.nextInt();\n\t\tlong ans = 0;\n\t\tfor (int i = 1; i <= n; i++)\n\t\t\tans += Math.pow(2, i);\n\t\t\n\t\tout.println(ans);\t\t\n\t}\n\n\t//-----------------------------------------------------\n\tvoid runWithFiles() {\n\t\tin = new FastReader(new File(\"input.txt\"));\n\t\ttry {\n\t\t\tout = new PrintWriter(new File(\"output.txt\"));\n\t\t} \n\t\tcatch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\tsolve();\n\t\tout.close();\n\t}\n\t\n\tclass FastReader\n\t{\n\t BufferedReader br;\n\t StringTokenizer tokenizer;\n\t \n\t public FastReader(InputStream stream)\n\t {\n\t br = new BufferedReader(new InputStreamReader(stream));\n\t tokenizer = null;\n\t }\n\t\tpublic FastReader(File f) {\n\t\t\ttry {\n\t\t\t\tbr = new BufferedReader(new FileReader(f));\n\t\t\t\ttokenizer = null;\n\t\t\t}\n\t\t\tcatch (FileNotFoundException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t \n\t private String next() {\n\t while (tokenizer == null || !tokenizer.hasMoreTokens())\n\t try {\n\t \ttokenizer = new StringTokenizer(br.readLine());\n\t }\n\t catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t return tokenizer.nextToken();\n\t }\n\t\tpublic String nextLine() {\n\t\t\ttry\t{\n\t\t\t\treturn br.readLine();\n\t\t\t}\n\t\t\tcatch(Exception e) {\n\t\t\t\tthrow(new RuntimeException());\n\t\t\t}\n\t\t}\n\n\t int nextInt() {\n\t return Integer.parseInt(next());\n\t }\n\t long nextLong() {\n\t return Long.parseLong(next());\n\t }\n\t double nextDouble() {\n\t return Double.parseDouble(next());\n\t }\t \n\t BigInteger nextBigInteger() {\n\t return new BigInteger(next());\n\t }\n\t BigDecimal nextBigDecimal() {\n\t return new BigDecimal(next());\n\t }\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "43c858a1f32a44b11a07e1409b34dbff", "src_uid": "f1b43baa14d4c262ba616d892525dfde", "apr_id": "caf23ba84ba693c9da9a0e3c9cff9a33", "difficulty": 1100, "tags": ["math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8211143695014663, "equal_cnt": 12, "replace_cnt": 10, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "import java.util.*;\npublic class ProM {\n\tstatic int a,b,c,ans;\n\tstatic long x;\n\n\tpublic static void main(String[] args) {\n\t\tScanner in=new Scanner(System.in);\n\t\tx=-in.nextLong();\n\t\ta=(int)x%360;\n\t\tif(a<0) a+=360;\n\t\tc=360;\n\t\tfor(int i=0;i<=3;i++)\n\t\t{\n\t\t\tb=(a+i*90)%360;\n\t\t\tb=Math.min(b,360-b);\n\t\t\tif(b b + c) || (b > a + c) || (c > a + b))\n\t\t\tSystem.out.println(\"Impossible\");\n\t\telse {\n\t\t\tif ((a == b) && (b == c))\n\t\t\t\tSystem.out.println(\"Impossible\");\n\t\t\telse {\n\t\t\t\tr1=(b-c+a)/2;\n\t\t\t\tr2=(c-a+b)/2;\n\t\t\t\tr3=(a-b+c)/2;\n\t\t\t\ttc=0;\n\t\t\t\tif(r1==0) tc++;if(r2==0) tc++;if(r3==0) tc++;\n\t\t\t\tif(tc>1) System.out.println(\"Impossible\");else\n\t\t\t\t\tSystem.out.println(r1+\" \"+r2+\" \"+r3);\n\t\t\t}}\n\t\t\t\t\t\n\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "77481e2592761721fe1e7f643c8b7316", "src_uid": "b3b986fddc3770fed64b878fa42ab1bc", "apr_id": "a2405ce2fb7a42093d50d004afbef248", "difficulty": 1200, "tags": ["graphs", "math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8986615678776291, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "/*\n * To change this license header, choose License Headers in Project Properties.\n * To change this template file, choose Tools | Templates\n * and open the template in the editor.\n */\npackage javaapplication3;\n\nimport java.io.IOException;\nimport java.util.Scanner;\n\n/**\n *\n * @author Soslan\n */\npublic class JavaApplication3 {\n\n /**\n * @param args the command line arguments\n */\n public static void main(String[] args) throws IOException {\n Scanner in = new Scanner(System.in);\n int a = in.nextInt();\n int b = in.nextInt();\n int c = in.nextInt();\n \n if ((a + b - c) % 2 == 1 || (a + b - c < 0)){\n System.out.print(\"Impossible\");\n return;\n }\n int x = (a + b - c) / 2;\n if ((a - b + c) % 2 == 1 || (a - b + c < 0)){\n System.out.print(\"Impossible\");\n return;\n }\n int y = (a - b + c)/2;\n \n if ((c - a + b) % 2 == 1 || (c - a + b < 0)){\n System.out.print(\"Impossible\");\n return;\n }\n int z = (c - a + b) / 2;\n System.out.print(x + \" \" + z + \" \" + y); \n }\n}", "lang": "Java 7", "bug_code_uid": "c259937b8704c124fd0c5cb1c8d0c031", "src_uid": "b3b986fddc3770fed64b878fa42ab1bc", "apr_id": "f48e91ce50ca654a088d06f0cf903c9f", "difficulty": 1200, "tags": ["graphs", "math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.6498740554156172, "equal_cnt": 13, "replace_cnt": 5, "delete_cnt": 4, "insert_cnt": 4, "fix_ops_cnt": 13, "bug_source_code": "package danil;\nimport java.util.*;\npublic class acm {\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner (System.in);\n\t\tint a = in.nextInt();\n\t\tint b = in.nextInt();\n\t\tint c = in.nextInt();\n\t\tint max = 0;\n\t\tif( a > b && a > c ){\n\t\t\tmax = a ;\n\t\t}else{\n\t\t\tif( b > a && b > c){\n\t\t\t\tmax = b;\n\t\t\t}else{\n\t\t\t\tmax = c;\n\t\t\t}\n\t\t}\n\t\tint ans = 1;\n\t\tfor(int i = 0 ; i <= max ; i++ ){\n\t\t\tfor(int j = 0 ; j <= max ; j++ ){\n\t\t\t\tfor(int k=0 ; k <= max ; k++ ){\n\t\t\t\t\tif(i + k == a && i + j == b && j + k == c){\n\t\t\t\t\t\tans = 0;\n\t\t\t\t\t\tSystem.out.print(i);\n\t\t\t\t\t\tSystem.out.print(\" \");\n\t\t\t\t\t\tSystem.out.print(j);\n\t\t\t\t\t\tSystem.out.print(\" \");\n\t\t\t\t\t\tSystem.out.print(k);\n\t\t\t\t\t\tSystem.out.print(\"\\n\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(ans == 0){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(ans == 0){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(ans == 1){\n\t\t\tSystem.out.println(\"Impossible\");\n\t\t}\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "8fd56e4b7042bded3dba2416aa4e15e3", "src_uid": "b3b986fddc3770fed64b878fa42ab1bc", "apr_id": "6ac603095b3911422fafb1495e400fca", "difficulty": 1200, "tags": ["graphs", "math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9900464499004645, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n BufferedReader reader;\n StringTokenizer tok;\n PrintWriter out;\n\n String nextToken() throws IOException {\n if (tok == null || !tok.hasMoreTokens()) {\n tok = new StringTokenizer(reader.readLine());\n }\n return tok.nextToken();\n }\n\n int nextInt() throws IOException {\n return Integer.parseInt(nextToken());\n }\n\n long nextLong() throws IOException {\n return Integer.parseInt(nextToken());\n }\n\n double nextDouble() throws IOException {\n return Double.parseDouble(nextToken());\n }\n\n void open() throws FileNotFoundException {\n// reader = new BufferedReader(new InputStreamReader(new FileInputStream(\"input.txt\")));\n// out = new PrintWriter(\"output.txt\");\n reader = new BufferedReader(new InputStreamReader(System.in));\n }\n\n void close() {\n out.flush();\n }\n\n public static void main(String[] args) throws IOException {\n Main main = new Main();\n main.open();\n main.solve();\n// main.close();\n }\n\n private void solve() throws IOException {\n long number = nextLong();\n long first = 1;\n long second = 2;\n long answer = 0;\n while (!(first <= number && number <= second - 1)) {\n long next = first + second;\n first = second;\n second = next;\n answer++;\n }\n System.out.println(answer);\n }\n\n}\n", "lang": "Java 8", "bug_code_uid": "744a5e5ab820e43c7c4fbb55bd2f385a", "src_uid": "3d3432b4f7c6a3b901161fa24b415b14", "apr_id": "f89f6ca948daba80ad9624b730251e5d", "difficulty": 1600, "tags": ["dp", "combinatorics", "dfs and similar", "math", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9914984059511158, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "\nimport java.awt.Point;\nimport java.io.*;\nimport java.io.ObjectInputStream.GetField;\nimport java.math.MathContext;\nimport java.util.*;\nimport java.util.jar.Attributes.Name;\nimport java.util.logging.Level;\n\nimport org.json.simple.JSONObject;\nimport org.json.simple.JSONArray;\nimport org.json.simple.JSONValue;\nimport org.json.simple.parser.ParseException;\nimport org.json.simple.parser.JSONParser;\n\n \n \n \n \n \n \n \npublic class TestClass {\n \nstatic long mod ;\nstatic char[] ans;\nstatic long[] F;\nstatic long[] IF;\nstatic long[] lazy;\nstatic int[] W;\nstatic int index;\nstatic int[] c;\nstatic int[][] Batman;\nstatic ArrayList[] maps;\nstatic int[] Size;\nstatic ArrayList Q;\nstatic HashMap bad_words;\n\nstatic class Batman{\n\t\n\t String topic;\n\t HashMap question;\n\t ArrayList Q;\n\t\n\t public Batman(String topic ,HashMap question, ArrayList Q){\n\t\t \n\t\t this.topic = topic;\n\t\t this.question = question;\n\t\t this.Q = Q;\n\t\t \n\t }\n}\nprivate static final String[] categories = { \"gis\", \"security\",\n\t\"photo\", \"mathematica\", \"unix\", \"wordpress\", \"scifi\",\n\t\"electronics\", \"android\", \"apple\" };\n\nprivate static final String[] stopWordsList = { \"a's\", \"able\", \"about\",\n\t\"above\", \"according\", \"accordingly\", \"across\", \"actually\",\n\t\"after\", \"afterwards\", \"again\", \"against\", \"ain't\", \"all\",\n\t\"allow\", \"allows\", \"almost\", \"alone\", \"along\", \"already\",\n\t\"also\", \"although\", \"always\", \"am\", \"among\", \"amongst\", \"an\",\n\t\"and\", \"another\", \"any\", \"anybody\", \"anyhow\", \"anyone\",\n\t\"anything\", \"anyway\", \"anyways\", \"anywhere\", \"apart\", \"appear\",\n\t\"appreciate\", \"appropriate\", \"are\", \"aren't\", \"around\", \"as\",\n\t\"aside\", \"ask\", \"asking\", \"associated\", \"at\", \"available\",\n\t\"away\", \"awfully\", \"be\", \"became\", \"because\", \"become\",\n\t\"becomes\", \"becoming\", \"been\", \"before\", \"beforehand\",\n\t\"behind\", \"being\", \"believe\", \"below\", \"beside\", \"besides\",\n\t\"best\", \"better\", \"between\", \"beyond\", \"both\", \"brief\", \"but\",\n\t\"by\", \"c'mon\", \"c's\", \"came\", \"can\", \"can't\", \"cannot\", \"cant\",\n\t\"cause\", \"causes\", \"certain\", \"certainly\", \"changes\",\n\t\"clearly\", \"co\", \"com\", \"come\", \"comes\", \"concerning\",\n\t\"consequently\", \"consider\", \"considering\", \"contain\",\n\t\"containing\", \"contains\", \"corresponding\", \"could\", \"couldn't\",\n\t\"course\", \"currently\", \"definitely\", \"described\", \"despite\",\n\t\"did\", \"didn't\", \"different\", \"do\", \"does\", \"doesn't\", \"doing\",\n\t\"don't\", \"done\", \"down\", \"downwards\", \"during\", \"each\", \"edu\",\n\t\"eg\", \"eight\", \"either\", \"else\", \"elsewhere\", \"enough\",\n\t\"entirely\", \"especially\", \"et\", \"etc\", \"even\", \"ever\", \"every\",\n\t\"everybody\", \"everyone\", \"everything\", \"everywhere\", \"ex\",\n\t\"exactly\", \"example\", \"except\", \"far\", \"few\", \"fifth\", \"first\",\n\t\"five\", \"followed\", \"following\", \"follows\", \"for\", \"former\",\n\t\"formerly\", \"forth\", \"four\", \"from\", \"further\", \"furthermore\",\n\t\"get\", \"gets\", \"getting\", \"given\", \"gives\", \"go\", \"goes\",\n\t\"going\", \"gone\", \"got\", \"gotten\", \"greetings\", \"had\", \"hadn't\",\n\t\"happens\", \"hardly\", \"has\", \"hasn't\", \"have\", \"haven't\",\n\t\"having\", \"he\", \"he's\", \"hello\", \"help\", \"hence\", \"her\",\n\t\"here\", \"here's\", \"hereafter\", \"hereby\", \"herein\", \"hereupon\",\n\t\"hers\", \"herself\", \"hi\", \"him\", \"himself\", \"his\", \"hither\",\n\t\"hopefully\", \"how\", \"howbeit\", \"however\", \"i'd\", \"i'll\", \"i'm\",\n\t\"i've\", \"ie\", \"if\", \"ignored\", \"immediate\", \"in\", \"inasmuch\",\n\t\"inc\", \"indeed\", \"indicate\", \"indicated\", \"indicates\", \"inner\",\n\t\"insofar\", \"instead\", \"into\", \"inward\", \"is\", \"isn't\", \"it\",\n\t\"it'd\", \"it'll\", \"it's\", \"its\", \"itself\", \"just\", \"keep\",\n\t\"keeps\", \"kept\", \"know\", \"known\", \"knows\", \"last\", \"lately\",\n\t\"later\", \"latter\", \"latterly\", \"least\", \"less\", \"lest\", \"let\",\n\t\"let's\", \"like\", \"liked\", \"likely\", \"little\", \"look\",\n\t\"looking\", \"looks\", \"ltd\", \"mainly\", \"many\", \"may\", \"maybe\",\n\t\"me\", \"mean\", \"meanwhile\", \"merely\", \"might\", \"more\",\n\t\"moreover\", \"most\", \"mostly\", \"much\", \"must\", \"my\", \"myself\",\n\t\"name\", \"namely\", \"nd\", \"near\", \"nearly\", \"necessary\", \"need\",\n\t\"needs\", \"neither\", \"never\", \"nevertheless\", \"new\", \"next\",\n\t\"nine\", \"no\", \"nobody\", \"non\", \"none\", \"noone\", \"nor\",\n\t\"normally\", \"not\", \"nothing\", \"novel\", \"now\", \"nowhere\",\n\t\"obviously\", \"of\", \"off\", \"often\", \"oh\", \"ok\", \"okay\", \"old\",\n\t\"on\", \"once\", \"one\", \"ones\", \"only\", \"onto\", \"or\", \"other\",\n\t\"others\", \"otherwise\", \"ought\", \"our\", \"ours\", \"ourselves\",\n\t\"out\", \"outside\", \"over\", \"overall\", \"own\", \"particular\",\n\t\"particularly\", \"per\", \"perhaps\", \"placed\", \"please\", \"plus\",\n\t\"possible\", \"presumably\", \"probably\", \"provides\", \"que\",\n\t\"quite\", \"qv\", \"rather\", \"rd\", \"re\", \"really\", \"reasonably\",\n\t\"regarding\", \"regardless\", \"regards\", \"relatively\",\n\t\"respectively\", \"right\", \"said\", \"same\", \"saw\", \"say\",\n\t\"saying\", \"says\", \"second\", \"secondly\", \"see\", \"seeing\",\n\t\"seem\", \"seemed\", \"seeming\", \"seems\", \"seen\", \"self\", \"selves\",\n\t\"sensible\", \"sent\", \"serious\", \"seriously\", \"seven\", \"several\",\n\t\"shall\", \"she\", \"should\", \"shouldn't\", \"since\", \"six\", \"so\",\n\t\"some\", \"somebody\", \"somehow\", \"someone\", \"something\",\n\t\"sometime\", \"sometimes\", \"somewhat\", \"somewhere\", \"soon\",\n\t\"sorry\", \"specified\", \"specify\", \"specifying\", \"still\", \"sub\",\n\t\"such\", \"sup\", \"sure\", \"t's\", \"take\", \"taken\", \"tell\", \"tends\",\n\t\"th\", \"than\", \"thank\", \"thanks\", \"thanx\", \"that\", \"that's\",\n\t\"thats\", \"the\", \"their\", \"theirs\", \"them\", \"themselves\",\n\t\"then\", \"thence\", \"there\", \"there's\", \"thereafter\", \"thereby\",\n\t\"therefore\", \"therein\", \"theres\", \"thereupon\", \"these\", \"they\",\n\t\"they'd\", \"they'll\", \"they're\", \"they've\", \"think\", \"third\",\n\t\"this\", \"thorough\", \"thoroughly\", \"those\", \"though\", \"three\",\n\t\"through\", \"throughout\", \"thru\", \"thus\", \"to\", \"together\",\n\t\"too\", \"took\", \"toward\", \"towards\", \"tried\", \"tries\", \"truly\",\n\t\"try\", \"trying\", \"twice\", \"two\", \"un\", \"under\",\n\t\"unfortunately\", \"unless\", \"unlikely\", \"until\", \"unto\", \"up\",\n\t\"upon\", \"us\", \"use\", \"used\", \"useful\", \"uses\", \"using\",\n\t\"usually\", \"value\", \"various\", \"very\", \"via\", \"viz\", \"vs\",\n\t\"want\", \"wants\", \"was\", \"wasn't\", \"way\", \"we\", \"we'd\", \"we'll\",\n\t\"we're\", \"we've\", \"welcome\", \"well\", \"went\", \"were\", \"weren't\",\n\t\"what\", \"what's\", \"whatever\", \"when\", \"whence\", \"whenever\",\n\t\"where\", \"where's\", \"whereafter\", \"whereas\", \"whereby\",\n\t\"wherein\", \"whereupon\", \"wherever\", \"whether\", \"which\",\n\t\"while\", \"whither\", \"who\", \"who's\", \"whoever\", \"whole\", \"whom\",\n\t\"whose\", \"why\", \"will\", \"willing\", \"wish\", \"with\", \"within\",\n\t\"without\", \"won't\", \"wonder\", \"would\", \"wouldn't\", \"yes\",\n\t\"yet\", \"you\", \"you'd\", \"you'll\", \"you're\", \"you've\", \"your\",\n\t\"yours\", \"yourself\", \"yourselves\", \"zero\" };\n\npublic static long pow(long a , long b){\n\t\n\t long o=1;\n\t \n\t while(b>0){\n\t\t \n\t\t if((b&1)!=0) o*=a;\n\t\t \n\t\t a*=a;\n\t\t b/=2;\n\t\t a%=mod;\n\t\t o%=mod;\n\t }\n\t \n\t return o;\n}\n\n\n\npublic static long get_me_baby(int n , int[] A){\n\t\n\t long ways = F[n];\n\t \n\t for(int i=0;i[] P){\n\t\n\t\n\t for(int i=0;i wordcount(String S){\n\t\n\t StringTokenizer sr = new StringTokenizer(S);\n\t Q = new ArrayList();\n\t HashMap count = new HashMap();\n\t while(sr.hasMoreTokens()){\n\t\t String a = sr.nextToken();\n\t\t if(bad_words.containsKey(a)) continue;\n\t\t if(count.containsKey(a)) count.put(a,count.get(a)+1);\n\t\t else{ count.put(a,1); Q.add(a);}\n\t }\n\t \n\t \n\t return count;\n\t\n}\n\n\n\n\n\npublic static void main(String args[] ) throws java.lang.Exception {\n \n \n \nInputStream inputStream = System.in;\nInputReader in = new InputReader(inputStream);\n \n//BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n//BufferedReader in = new BufferedReader(new FileReader(\"C:\\\\Users\\\\Sompathak\\\\Desktop\\\\yes.txt\"));\n//Scanner in = new Scanner(new FileReader(\"C:\\\\Users\\\\Sompathak\\\\Desktop\\\\yes.txt\"));\n// PrintWriter pw = new PrintWriter(new FileWriter(\"C:\\\\Users\\\\Sompathak\\\\Desktop\\\\output.txt\"));\n//InputStream inputStream = System.in;\n//InputReader in = new InputReader(inputStream);\n//Scanner in = new Scanner(new InputStreamReader(System.in));\n//Scanner in = new Scanner(new FileReader(\"C:\\\\Users\\\\Sompathak\\\\Desktop\\\\yes.java\"));\n//we can we will ??? !!!!!! SOM RISES\n//long startTime = System.currentTimeMillis();\n//long startTime = System.currentTimeMillis();\n\nint n = in.nextInt();\nint[] A = new int[n];\nfor(int i=0;i2 || y>2 || z>2) continue;\n\t found = true;\n\t\t\t \n\t\t }\n if(found) System.out.println(\"YES\");\n else System.out.println(\"NO\");\n \n\n\n\n//System.out.println(totalTime+\" sec.....\"+\" \"+startTime+\" \"+endTime); \n \n \n \n \n}public static class InputReader\n{\nprivate InputStream stream;\nprivate byte[] buf = new byte[1024];\nprivate int curChar;\nprivate int numChars;\nprivate SpaceCharFilter filter;\n \npublic InputReader(InputStream stream)\n{\nthis.stream = stream;\n}\n \npublic int read()\n{\nif (numChars == -1)\nthrow new InputMismatchException();\nif (curChar >= numChars)\n{\ncurChar = 0;\ntry\n{\nnumChars = stream.read(buf);\n} catch (IOException e)\n{\nthrow new InputMismatchException();\n}\nif (numChars <= 0)\nreturn -1;\n}\nreturn buf[curChar++];\n}\n \npublic int nextInt()\n{\nint c = read();\nwhile (isSpaceChar(c))\nc = read();\nint sgn = 1;\nif (c == '-')\n{\nsgn = -1;\nc = read();\n}\nint res = 0;\ndo\n{\nif (c < '0' || c > '9')\nthrow new InputMismatchException();\nres *= 10;\nres += c - '0';\nc = read();\n} while (!isSpaceChar(c));\nreturn res * sgn;\n}\n \npublic String readString()\n{\nint c = read();\nwhile (isSpaceChar(c))\nc = read();\nStringBuilder res = new StringBuilder();\ndo\n{\nres.appendCodePoint(c);\nc = read();\n} while (!isSpaceChar(c));\nreturn res.toString();\n}\npublic double readDouble() {\nint c = read();\nwhile (isSpaceChar(c))\nc = read();\nint sgn = 1;\nif (c == '-') {\nsgn = -1;\nc = read();\n}\ndouble res = 0;\nwhile (!isSpaceChar(c) && c != '.') {\nif (c == 'e' || c == 'E')\nreturn res * Math.pow(10, nextInt());\nif (c < '0' || c > '9')\nthrow new InputMismatchException();\nres *= 10;\nres += c - '0';\nc = read();\n}\nif (c == '.') {\nc = read();\ndouble m = 1;\nwhile (!isSpaceChar(c)) {\nif (c == 'e' || c == 'E')\nreturn res * Math.pow(10, nextInt());\nif (c < '0' || c > '9')\nthrow new InputMismatchException();\nm /= 10;\nres += (c - '0') * m;\nc = read();\n}\n}\nreturn res * sgn;\n}\npublic long readLong() {\nint c = read();\nwhile (isSpaceChar(c))\nc = read();\nint sgn = 1;\nif (c == '-') {\nsgn = -1;\nc = read();\n}\nlong res = 0;\ndo {\nif (c < '0' || c > '9')\nthrow new InputMismatchException();\nres *= 10;\nres += c - '0';\nc = read();\n} while (!isSpaceChar(c));\nreturn res * sgn;\n}\npublic boolean isSpaceChar(int c)\n{\nif (filter != null)\nreturn filter.isSpaceChar(c);\nreturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n}\n \npublic String next()\n{\nreturn readString();\n}\n \npublic interface SpaceCharFilter\n{\npublic boolean isSpaceChar(int ch);\n}\n}\n} ", "lang": "Java 7", "bug_code_uid": "6abc2da90c0f1c83a56b950457be7527", "src_uid": "d6c876a84c7b92141710be5d76536eab", "apr_id": "ec1c098a9c829f7820cff1fe112844cd", "difficulty": 900, "tags": ["brute force", "sortings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9735327963176065, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\n\npublic class Main { \n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n long friends = in.nextLong();\n \n if (friends == 0) {\n System.out.println(0);\n }\n \n if (friends % 2 == 0) {\n System.out.println(friends + 1);\n } else if {\n System.out.println((friends + 1) / 2);\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "dc0da879409ca734bca8490418bd77ed", "src_uid": "236177ff30dafe68295b5d33dc501828", "apr_id": "0f1f1fdcbd0309f10ad58d1c0225f918", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8930817610062893, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*;\nimport java.util.*;\npublic class Pizza\n{\n public static void main(String args[])\n {\n Scanner sc=new Scanner(System.in);\n long n=sc.nextLong();\n \n if(n%2==0)\n System.out.println(n+1);\n else\n System.out.println((n+1)/2));\n }\n}", "lang": "Java 8", "bug_code_uid": "6c175b3bdfb02aae9ba43b90abfec92d", "src_uid": "236177ff30dafe68295b5d33dc501828", "apr_id": "07854fa6fcad173886dfe682e43d6b62", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9987293519695044, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner;\n\npublic class Test {\n \n private static final Scanner scanner = new Scanner(System.in);\n\n public static void main(String[] args) {\n long people = scanner.nextLong();\n if (people = 0) {\n System.out.println(\"0\");\n } else if (people%2 != 0) {\n System.out.println((people+1)/2);\n } else if (people%2 == 0){\n System.out.println(people+1);\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "4bc19231dafc96dc5b40851021e9b3e3", "src_uid": "236177ff30dafe68295b5d33dc501828", "apr_id": "df1f946673d74f0d550979994e4d7d4e", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9862825788751715, "equal_cnt": 9, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 8, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class tr0 {\n\tstatic PrintWriter out;\n\tstatic StringBuilder sb;\n\tstatic final double EPS = 1e-9;\n\tstatic long mod = 1000000007;\n\tstatic int inf = 1000000000;\n\tstatic long[] fac;\n\tstatic int[] si;\n\tstatic ArrayList primes;\n\tstatic int n,m;\n\tstatic ArrayList[] adjList, tree;\n\tstatic Stack stack;\n\tstatic int[] dfs_low, dfs_num, bridgeComp;\n\tstatic int V, counter,count;\n static int chosen;\n\tpublic static void main(String[] args) throws IOException {\n\t\tScanner sc = new Scanner(System.in);\n\t\tout = new PrintWriter(System.out);\n\t long x=sc.nextLong();\n\t long y=sc.nextLong();\n\t long l=sc.nextLong();\n\t long r=sc.nextLong();\n\t TreeSet in=new TreeSet<>();\n\t long limitx=(long)((double)Math.log10(10e18)/(double)Math.log10(x));\n\t long limity=(long)((double)Math.log10(10e18)/(double)Math.log10(y));\n\t for(int i=0;i<=limity;i++) {\n\t \tfor(int j=0;j<=limitx;j++) {\n\t \t\tlong h=power(x,j)+power(y,i);\n\t \t\tif(h>=l && h<=r)\n\t \t\t\tin.add(h);\n\t \t}\n\t }\n\t long ans=0;\n\t long last=l;\n\t for(long h:in) {\n\t \tans=Math.max(ans, h-last-1);\n\t \tlast=h;\n\t }\n\t if(!in.contains(r))\n\t ans=Math.max(ans, r-last);\n\t if(!in.contains(l))\n\t\t ans=Math.max(ans, in.first()-l);\n\t // System.out.println(in);\n\t out.println(ans);\n\t\tout.flush();\n\t}\n\tstatic long power(long base,long pow) {\n\t\tlong ans=1;\n\t\tif(pow==0)\n\t\t\treturn 1;\n\t\tfor(int y=0;y q=new LinkedList();\n\t\tq.add(s);\n\t\twhile(!q.isEmpty()) {\n\t\t\tint u=q.poll();\n\t\t\tfor(int v:tree[u]) {\n\t\t\t\tif(dist[v]==-1) {\n\t\t\t\t\tdist[v]=1+dist[u];\n\t\t\t\t\tq.add(v);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tstatic void bridgeTree()\n\t{\n\t\tcounter = 0;\n\t\tdfs_low = new int[V];\n\t\tdfs_num = new int[V];\n\t\tbridgeComp = new int[V];\n\t\tstack = new Stack();\n\t\ttree = new ArrayList[V];\n\t\tfor(int i = 0; i < V; ++i)\n\t\t\ttree[i] = new ArrayList();\n\t\tfor(int i = 0; i < V; ++i)\n\t\t\tif(dfs_num[i] == 0)\n\t\t\t\tdfs(i, -1);\n\t\tfor(int u = 0; u < V; ++u)\n\t\t\tfor(int v: adjList[u])\n\t\t\t{\n\t\t\t\tint x = bridgeComp[u], y = bridgeComp[v]; \n\t\t\t\tif(x != y)\n\t\t\t\t\ttree[x].add(y);\n\t\t\t}\n\t}\n\tstatic void dfs(int u, int p)\n\t{\n\t\tdfs_num[u] = dfs_low[u] = ++counter;\n\t\tstack.push(u);\n\t\tfor(int v: adjList[u])\n\t\t\tif(v != p)\n\t\t\t\tif(dfs_num[v] == 0)\n\t\t\t\t{\n\t\t\t\t\tdfs(v, u);\n\t\t\t\t\tdfs_low[u] = Math.min(dfs_low[u], dfs_low[v]);\n\t\t\t\t\tif(dfs_low[v] > dfs_num[u])\n\t\t\t\t\t\textract(v);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tdfs_low[u] = Math.min(dfs_low[u], dfs_num[v]);\n\t\tif(p == -1)\n\t\t\textract(u);\n\t}\n\tstatic void extract(int u) \n\t{ \n\t\twhile(true)\n\t\t{\n\t\t\tint v = stack.pop();\n\t\t\tbridgeComp[v] = u;\n\t\t\tif(v == u)\n\t\t\t\tbreak;\n\t\t}\t\n\t}\n\tstatic void seive() {\n\t\t si=new int [1000001];\n\t\t primes=new ArrayList<>();\n\t\t int N=1000001;\n\t\t si[1]=1;\n\t\t for(int i=2;i {\n\t\tlong x;\n\t\tlong y;\n\n\t\tpair(long x, long y) {\n\t\t\tthis.x = x;\n\t\t\tthis.y = y;\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\treturn x + \" \" + y;\n\t\t}\n\n\t\tpublic int compareTo(pair o) {\n\t\t\treturn (int)((o.x-o.y)-(x-y));\n\t\t}\n\t}\n\n\tstatic long inver(long x) {\n\t\tint a = (int) x;\n\t\tlong e = (mod - 2);\n\t\tlong res = 1;\n\t\twhile (e > 0) {\n\t\t\tif ((e & 1) == 1) {\n\t\t\t\t// System.out.println(res*a);\n\t\t\t\tres = (int) ((1l * res * a) % mod);\n\t\t\t}\n\t\t\ta = (int) ((1l * a * a) % mod);\n\t\t\te >>= 1;\n\t\t}\n\t\t// out.println(res+\" \"+x);\n\t\treturn res % mod;\n\t}\n\n\tstatic long fac(int n) {\n\t\tif (n == 0)\n\t\t\treturn fac[n] = 1;\n\t\tif (n == 1)\n\t\t\treturn fac[n] = 1;\n\t\tlong ans = 1;\n\t\tfor (int i = 1; i <= n; i++)\n\t\t\tfac[i] = ans = (i % mod * ans % mod) % mod;\n\t\treturn ans % mod;\n\t}\n\n\tstatic long gcd(long a, long b) {\n\n\t\tif (b == 0)\n\t\t\treturn a;\n\t\treturn gcd(b, a % b);\n\t}\n\n\tstatic class unionfind {\n\t\tint[] p;\n\t\tint[] size;\n\n\t\tunionfind(int n) {\n\t\t\tp = new int[n];\n\t\t\tsize = new int[n];\n\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tp[i] = i;\n\t\t\t}\n\t\t\tArrays.fill(size, 1);\n\t\t}\n\n\t\tint findSet(int v) {\n\t\t\tif (v == p[v])\n\t\t\t\treturn v;\n\t\t\treturn p[v] = findSet(p[v]);\n\t\t}\n\n\t\tboolean sameSet(int a, int b) {\n\t\t\ta = findSet(a);\n\t\t\tb = findSet(b);\n\t\t\tif (a == b)\n\t\t\t\treturn true;\n\t\t\treturn false;\n\t\t}\n\n\t\tint max() {\n\t\t\tint max = 0;\n\t\t\tfor (int i = 0; i < size.length; i++)\n\t\t\t\tif (size[i] > max)\n\t\t\t\t\tmax = size[i];\n\t\t\treturn max;\n\t\t}\n\n\t\tvoid combine(int a, int b) {\n\t\t\ta = findSet(a);\n\t\t\tb = findSet(b);\n\t\t\tif (a == b)\n\t\t\t\treturn;\n\t\t\tif (size[a] > size[b]) {\n\t\t\t\tp[b] = a;\n\t\t\t\tsize[a] += size[b];\n\n\t\t\t} else {\n\t\t\t\tp[a] = b;\n\t\t\t\tsize[b] += size[a];\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic class Scanner {\n\t\tStringTokenizer st;\n\t\tBufferedReader br;\n\n\t\tpublic Scanner(InputStream system) {\n\t\t\tbr = new BufferedReader(new InputStreamReader(system));\n\t\t}\n\n\t\tpublic Scanner(String file) throws Exception {\n\t\t\tbr = new BufferedReader(new FileReader(file));\n\t\t}\n\n\t\tpublic String next() throws IOException {\n\t\t\twhile (st == null || !st.hasMoreTokens())\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic String nextLine() throws IOException {\n\t\t\treturn br.readLine();\n\t\t}\n\n\t\tpublic int nextInt() throws IOException {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic double nextDouble() throws IOException {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tpublic char nextChar() throws IOException {\n\t\t\treturn next().charAt(0);\n\t\t}\n\n\t\tpublic Long nextLong() throws IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic boolean ready() throws IOException {\n\t\t\treturn br.ready();\n\t\t}\n\n\t\tpublic void waitForInput() throws InterruptedException {\n\t\t\tThread.sleep(3000);\n\t\t}\n\t}\n}", "lang": "Java 8", "bug_code_uid": "e98a6ce1147c0916c426b107274070db", "src_uid": "68ca8a8730db27ac2230f9fe9b120f5f", "apr_id": "0ebe51389311b2abfcd6da3bd202a551", "difficulty": 1800, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9856961220597584, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 4, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.math.*;\n\n\npublic class B{\n public static void main (String[] args) {\n FastScanner fs = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n\n TreeSet list = new TreeSet<>();\n long x = fs.nextLong(), y = fs.nextLong();\n long l = fs.nextLong(), r = fs.nextLong();\n\n BigInteger uLim = BigInteger.valueOf(r);\n BigInteger lLim = BigInteger.valueOf(l);\n\n\n for(int i = 0; i <= 63; i++) {\n for(int j = 0; j <= 63; j++) {\n BigInteger p1 = BigInteger.valueOf(x).pow(i);\n// if(j == 1 && i == 0) System.out.println(p1);\n if(p1.compareTo(uLim) > 0) continue;\n p1 = p1.add(BigInteger.valueOf(y).pow(j));\n if(p1.compareTo(uLim) > 0) continue;\n if(p1.compareTo(lLim) < 0) continue;\n\n list.add(p1.longValue());\n\n }\n }\n\n// System.out.println(list);\n\n ArrayList loop = new ArrayList<>(list);\n long max = 0;\n for(int i = 1; i < loop.size(); i++) {\n long one = loop.get(i), two = loop.get(i-1);\n long dist = one - two - 1;\n max = Math.max(max, dist);\n }\n max = Math.max(max, list.first() - l);\n max = Math.max(max, r - list.last());\n\n System.out.println(max);\n\n\n }\n\n static class FastScanner {\n BufferedReader br;\n StringTokenizer st;\n\n public FastScanner() {\n try {\n br = new BufferedReader(new InputStreamReader(System.in));\n// br = new BufferedReader(new FileReader(\"testdata.out\"));\n st = new StringTokenizer(\"\");\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n\n public String next() {\n if (st.hasMoreTokens()) return st.nextToken();\n try {\n st = new StringTokenizer(br.readLine());\n } catch (Exception e) {\n e.printStackTrace();\n }\n return st.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public String nextLine() {\n String line = \"\";\n try {\n line = br.readLine();\n } catch (Exception e) {\n e.printStackTrace();\n }\n return line;\n }\n\n public Integer[] nextIntegerArray(int n) {\n Integer[] a = new Integer[n];\n for (int i = 0; i < n; i++) a[i] = nextInt();\n return a;\n }\n\n public int[] nextIntArray(int n) {\n int[] a = new int[n];\n for (int i = 0; i < n; i++) a[i] = nextInt();\n return a;\n }\n\n public char[] nextCharArray() {\n return nextLine().toCharArray();\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "ccbf655ccbfa7b881c3439d8242ff1d7", "src_uid": "68ca8a8730db27ac2230f9fe9b120f5f", "apr_id": "ec8d575cf449a8206cc98e78e5b7f069", "difficulty": 1800, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9862483884830253, "equal_cnt": 10, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 9, "bug_source_code": "import java.io.*;\nimport java.math.*;\nimport java.security.KeyStore.Entry;\nimport java.util.*;\n\n\n public class Main {\n\tprivate InputStream is;\n\tprivate PrintWriter out;\n\tint time = 0, dp[][], DP[][], start[], end[], val[], black[], MOD = (int)(1e9+7), arr[], arr1[];\n\tint MAX = 10000000, N, K, p;\n\tArrayList[] amp, amp1;\n\tboolean b[], b1[];\n\tPair prr[];\n\tchar ch[][];\n\tHashSet hs = new HashSet<>();\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tnew Thread(null, new Runnable() {\n\t\tpublic void run() {\n\t\t\ttry {\n\n\t\t//new Main().soln();\n\t\t} catch (Exception e) {\n\t\t\t\tSystem.out.println(e);\n\t\t\t}\n\t\t}\n\t}, \"1\", 1 << 26).start();\n\t\tnew Main().soln();\n\t}\n\tvoid solve() {\n\t\tlong x = nl(), y = nl(), l = nl(), r = nl();\n\t\tlong temp = 1;\n\t\tArrayList amp1 = new ArrayList<>();\n\t\tArrayList amp2 = new ArrayList<>();\n\t\tamp1.add(temp);\n\t\tamp1.add(0L);\n\t\twhile(r/temp>=x){\n\t\t\ttemp *= x;\n\t\t\tamp1.add(temp);\n\t\t}\n\t\ttemp = 1;\n\t\tamp2.add(temp);\n\t\tamp2.add(0L);\n\t\twhile(r/temp>=y){\n\t\t\ttemp *= y;\n\t\t\tamp2.add(temp);\n\t\t}\n\t//\tSystem.out.println(amp1+\" \"+amp2);\n\t\tArrayList fa = new ArrayList<>();\n\t\tfor(int i = 0; i< amp1.size(); i ++){\n\t\t\tfor(int j = 0;j=l && aa<=r)\n\t\t\t\tfa.add(aa);\n\t\t\t}\n\t\t}\n\t\tCollections.sort(fa);\n\t\tlong max = fa.get(0)-l;\n\t\tlong left = fa.get(0);\n\t\tfor(int i = 0; i< fa.size();i++){\n\t\t\tmax = Math.max(max, fa.get(i)-left-1);\n\t\t\tleft = fa.get(i);\n\t\t}\n\t\t//System.out.println(fa);\n\t\tmax = Math.max(r-fa.get(fa.size()-1), max);\n\t\tSystem.out.println(max);\n\t}\n\t\n\tint calc(int[] c, int[] d, int n, int m, int e){\n\t\tint ans = 0;\n\t\tfor(int i = 0;iarr[high]){\n\t\t\treturn -high-2;\n\t\t}\n\t\twhile(high>=low){\n\t\t\tint mid = (low+high)/2;\n\t\t\tif(arr[mid]>=key){\n\t\t\t\thigh = mid-1;\n\t\t\t\tans = mid;\n\t\t\t}\n\t\t\telse low = mid+1;\n\t\t}\n\t\tif(arr[ans]!=key) return (-ans-1);\n\t\treturn ans;\n\t}\n\tint min(int x,int y){\n\t\tif(xy) return x;\n\t\treturn y;\n\t}\n\tvoid dfs(int x){\n\t\tb[x] = true;\n\t\tfor(int i : amp[x]){\n\t\t\tif(!b[i]){\n\t\t\t\tdfs(i);\n\t\t\t}\n\t\t}\n\t}\n\tvoid buildGraph(int m){\n\t\twhile(m-->0)\n\t\t{\n\t\t\tint x = ni(), y = ni();\n\t\t\tamp[--x].add(--y);\n\t\t}\n\t}\n\tlong modInverse(long a, long mOD2){\n return power(a, mOD2-2, mOD2);\n\t}\n\tlong power(long x, long y, long m)\n\t{\n\t\tif (y == 0)\n return 1;\n\tlong p = power(x, y/2, m) % m;\n\tp = (p * p) % m;\n\n\treturn (y%2 == 0)? p : (x * p) % m;\n\t}\n\tboolean isPrime(int x){\n\t\tfor(int i = 2;i*1L*i<=x;i++) if(x%i==0) return false;\n\t\treturn true;\n\t}\n\tpublic long gcd(long a, long b){\n\t\tif(b==0) return a;\n\t\treturn gcd(b,a%b);\n\t}\n\tvoid failFn(String str, int arr[]){\n\t\tint len = 0;\n\t\tarr[0] = 0;\n\t\tint i = 1;\n\t\twhile(ise || rr) return Integer.MAX_VALUE;\n\t\t\tif(l<=ss && r>=se) return st[si];\n\t\t\tint mid = (ss+se)/2;\n\t\t\tint val = 2*si;\n\t\t\treturn (get(ss,mid,l,r,val)+ get(mid+1,se,l,r,val+1));\n\t\t}\n\t}\n\tstatic class ST{\n\t\tint arr[],lazy[],n;\n\t\tST(int a){\n\t\t\tn = a;\n\t\t\tarr = new int[10*n];\n\t\t\tlazy = new int[10*n];\n\t\t}\n\t\tvoid up(int l,int r,int val){\n\t\t\tupdate(0,n-1,0,l,r,val);\n\t\t}\n\t\tvoid update(int l,int r,int c,int x,int y,int val){\n\t\t\tif(lazy[c]!=0){\n\t\t\t\tlazy[2*c+1]+=lazy[c];\n\t\t\t\tlazy[2*c+2]+=lazy[c];\n\t\t\t\tif(l==r)\n\t\t\t\t\tarr[c]+=lazy[c];\n\t\t\t\tlazy[c] = 0;\n\t\t\t}\n\t\t\tif(l>r||x>y||l>y||x>r)\n\t\t\t\treturn;\n\t\t\tif(x<=l&&y>=r){\n\t\t\t\tlazy[c]+=val;\n\t\t\t\treturn ;\n\t\t\t}\n\t\t\tint mid = l+r>>1;\n\t\t\tupdate(l,mid,2*c+1,x,y,val);\n\t\t\tupdate(mid+1,r,2*c+2,x,y,val);\n\t\t\tarr[c] = (arr[2*c+1]+ arr[2*c+2]);\n\t\t}\n\t\tint an(int ind){\n\t\t\treturn ans(0,n-1,0,ind);\n\t\t}\n\t\tint ans(int l,int r,int c,int ind){\n\t\t\tif(lazy[c]!=0){\n\t\t\t\tlazy[2*c+1]+=lazy[c];\n\t\t\t\tlazy[2*c+2]+=lazy[c];\n\t\t\t\tif(l==r)\n\t\t\t\t\tarr[c]+=lazy[c];\n\t\t\t\tlazy[c] = 0;\n\t\t\t}\n\t\t\tif(l==r)\n\t\t\t\treturn arr[c];\n\t\t\tint mid = l+r>>1;\n\t\t\tif(mid>=ind)\n\t\t\t\treturn ans(l,mid,2*c+1,ind);\n\t\t\treturn ans(mid+1,r,2*c+2,ind);\n\t\t}\n\t}\n\tpublic static class FenwickTree {\n\t\t\n\t int[] array; // 1-indexed array, In this array We save cumulative information to perform efficient range queries and updates\n\n\t public FenwickTree(int size) {\n\t array = new int[size + 1];\n\t }\n\t public int rsq(int ind) {\n\t assert ind > 0;\n\t int sum = 0;\n\t while (ind > 0) {\n\t sum += array[ind];\n\t //Extracting the portion up to the first significant one of the binary representation of 'ind' and decrementing ind by that number\n\t ind -= ind & (-ind);\n\t }\n\t return sum;\n\t }\n\t public int rsq(int a, int b) {\n\t assert b >= a && a > 0 && b > 0;\n\t return rsq(b) - rsq(a - 1);\n\t }\n\t public void update(int ind, int value) {\n\t assert ind > 0;\n\t while (ind < array.length) {\n\t array[ind] += value;\n\t //Extracting the portion up to the first significant one of the binary representation of 'ind' and incrementing ind by that number\n\t ind += ind & (-ind);\n\t }\n\t }\n\t public int size() {\n\t return array.length - 1;\n\t }\n\t}\n\tpublic static int[] shuffle(int[] a, Random gen){\n\t\tfor(int i = 0, n = a.length;i < n;i++)\n\t\t{ \n\t\t\tint ind = gen.nextInt(n-i)+i; \n\t\t\tint d = a[i]; \n\t\t\ta[i] = a[ind];\n\t\t\ta[ind] = d; \n\t\t} \n\treturn a; \n\t}\n\n\tclass Pair implements Comparable{\n\t\tint u, v;\n\t\tPair(int u, int v){\n\t\t\tthis.u = u;\n\t\t\tthis.v = v;\n\t\t}public int hashCode() {\n\t\t\treturn Objects.hash();\n\t\t}\n\t\tpublic boolean equals(Object o) {\n\t\t\tPair other = (Pair) o;\n\t\t\treturn ((u == other.u && v == other.v));// || (v == other.u && u == other.v));\n\t\t}\n\t\tpublic int compareTo(Pair other) {\n\t\t\t//return Integer.compare(val, other.val);\n\t\t\treturn Long.compare(u, other.u) != 0 ? (Long.compare(u, other.u)) : (Long.compare(other.v,v));\n\t\t}\t\n\t\tpublic String toString() {\n\t\t\treturn \"[u=\" + u + \", v=\" + v + \"]\";\n\t\t}\n\t}\n\tlong power(long x, long y, int mod){\n\t\tlong ans = 1;\n\t\twhile(y>0){\n\t\t\tif(y%2==0){\n\t\t\t\tx = (x*x)%mod;\n\t\t\t\ty/=2;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tans = (x*ans)%mod;\n\t\t\t\ty--;\n\t\t\t}\n\t\t}\n\t\treturn ans;\n\t}\n\tvoid soln() {\n\t\tis = System.in;\n\t\tout = new PrintWriter(System.out);\n\t\tlong s = System.currentTimeMillis();\n\t\tsolve();\n\t\t//out.close();\n\t\tout.flush();\n\t\t//tr(System.currentTimeMillis() - s + \"ms\");\n\t}\n\n\n\t// To Get Input\n\t// Some Buffer Methods\n\tprivate byte[] inbuf = new byte[1024];\n\tpublic int lenbuf = 0, ptrbuf = 0;\n\n\tprivate int readByte() {\n\t\tif (lenbuf == -1)\n\t\t\tthrow new InputMismatchException();\n\t\tif (ptrbuf >= lenbuf) {\n\t\t\tptrbuf = 0;\n\t\t\ttry {\n\t\t\t\tlenbuf = is.read(inbuf);\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t\tif (lenbuf <= 0)\n\t\t\t\treturn -1;\n\t\t}\n\t\treturn inbuf[ptrbuf++];\n\t}\n\n\tprivate boolean isSpaceChar(int c) {\n\t\treturn !(c >= 33 && c <= 126);\n\t}\n\n\tprivate int skip() {\n\t\tint b;\n\t\twhile ((b = readByte()) != -1 && isSpaceChar(b))\n\t\t\t;\n\t\treturn b;\n\t}\n\n\tprivate double nd() {\n\t\treturn Double.parseDouble(ns());\n\t}\n\n\tprivate char nc() {\n\t\treturn (char) skip();\n\t}\n\tprivate String ns() {\n\t\tint b = skip();\n\t\tStringBuilder sb = new StringBuilder();\n\t\twhile (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != '\n\t\t\t\t\t\t\t\t\t// ')\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\tprivate char[] ns(int n) {\n\t\tchar[] buf = new char[n];\n\t\tint b = skip(), p = 0;\n\t\twhile (p < n && !(isSpaceChar(b))) {\n\t\t\tbuf[p++] = (char) b;\n\t\t\tb = readByte();\n\t\t}\n\t\treturn n == p ? buf : Arrays.copyOf(buf, p);\n\t}\n\n\tprivate char[][] nm(int n, int m) {\n\t\tchar[][] map = new char[n][];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tmap[i] = ns(m);\n\t\treturn map;\n\t}\n\n\tprivate int[] na(int n) {\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = ni();\n\t\treturn a;\n\t}\n\n\tprivate int ni() {\n\t\tint num = 0, b;\n\t\tboolean minus = false;\n\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t;\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\tprivate long nl() {\n\t\tlong num = 0;\n\t\tint b;\n\t\tboolean minus = false;\n\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t;\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\tprivate boolean oj = System.getProperty(\"ONLINE_JUDGE\") != null;\n\n\tprivate void tr(Object... o) {\n\t\tif (!oj)\n\t\t\tSystem.out.println(Arrays.deepToString(o));\n\t}\n}", "lang": "Java 8", "bug_code_uid": "8cf0bb24ce28e288e718aa0a72274863", "src_uid": "68ca8a8730db27ac2230f9fe9b120f5f", "apr_id": "2792b4fb111073618b53c9f7b452248a", "difficulty": 1800, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7570332480818415, "equal_cnt": 13, "replace_cnt": 5, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 12, "bug_source_code": "import java.util.*;\npublic class cfRaviolisort {\n public static void main(String[] args) {\n Scanner sc= new Scanner(System.in);\n int n=sc.nextInt();\n ArrayList ar= new ArrayList<>();\n\n for(int i=0;iar.get(max)){\n max=j-1;\n }\n }\n ar.remove(max);\n }\n if(flag) System.out.println(\"NO\");\n else System.out.println(\"YES\");\n\n }\n}\n\n", "lang": "Java 11", "bug_code_uid": "f5e02018116ef91758f188d8f88d0188", "src_uid": "704d0ae50bccaa8bc49319812ae0be45", "apr_id": "010a4f5eb876000195c4fbce65da5720", "difficulty": 1600, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9959934708413711, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "import java.io.*;\nimport java.math.*;\nimport java.util.*;\n\npublic class SolutionB {\n\n\tpublic static void main(String[] args) {\n\t\tnew SolutionB().run();\n\t}\n\tint n, m;\n\tint c[], d[];\n\tvoid solve() {\n\t\tn = in.nextInt();\n\t\tm = in.nextInt();\n\t\tc = in.nextIntArray(n);\n\t\td = in.nextIntArray(n);\n\t\tMatrix st = new Matrix(50);\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tMatrix fi = new Matrix(50);\n\t\t\tfor(int j = 0; j<50; j++)\n\t\t\t\tfi.a[j][j] = Integer.MAX_VALUE/2; \n\t\t\tfor(int j = 0; j<49; j++){\n\t\t\t\tfi.a[j+1][j] = d[i];\n\t\t\t\tfi.a[j][j+1] = c[i];\n\t\t\t}\n\t\t\tst = st.mul(fi);\n\t\t}\n\t\tout.println(st.pow(m).a[0][0]);\n\t}\n\t\n\t\n\tclass Matrix{\n\t\tint n;\n\t\tint a[][];\n\t\tpublic Matrix(){\n\t\t\ta = new int[2][2];\n\t\t}\n\t\tpublic Matrix(int n){\n\t\t\tthis.n = n;\n\t\t\ta=new int[n][n];\n\t\t\tfor(int i = 0; i < n; i++){\n\t\t\t\tfor(int j=0; j < n; j++){\n\t\t\t\t\tif(i == j) a[i][j] = 0;\n\t\t\t\t\telse a[i][j] = Integer.MAX_VALUE/2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tMatrix mul(Matrix x){\n\t\t\tMatrix t = new Matrix(n);\n\t\t\tfor(int i = 0; i < n; i++)\n\t\t\t\tfor(int j = 0;j < n; j++){\n\t\t\t\t\tt.a[i][j] = Integer.MAX_VALUE/2;\n\t\t\t\t\tfor(int k = 0; k < n; k++){\n\t\t\t\t\t\tt.a[i][j] = Math.min(t.a[i][j], a[i][k] + x.a[k][j]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\treturn t;\n\t\t}\n\t\tMatrix pow(int x){\n\n\t\t\tif(x == 0) {\n\t\t\t\tMatrix t = new Matrix(n);\n\t\t\t\treturn t;\n\t\t\t}\n\t\t\tif(x % 2 == 0){\n\t\t\t\treturn this.mul(this).pow(x/2);\n\t\t\t}\n\t\t\treturn this.mul(this.pow(x-1));\n\t\t}\n\t}\n\n\tclass Pair implements Comparable {\n\t\tint x, y;\n\n\t\tPair(int x, int y) {\n\t\t\tthis.x = x;\n\t\t\tthis.y = y;\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(Pair o) {\n\t\t\tif (o.x == x)\n\t\t\t\treturn ((Integer) y).compareTo(o.y);\n\t\t\treturn ((Integer) x).compareTo(o.x);\n\t\t}\n\n\t}\n\n\tFastScanner in;\n\tPrintWriter out;\n\n\tvoid run() {\n\t\tin = new FastScanner(System.in);\n\t\tout = new PrintWriter(new OutputStreamWriter(System.out));\n\t\tsolve();\n\t\tout.close();\n\t}\n\n\tvoid runIO() {\n\t\ttry {\n\t\t\tin = new FastScanner(new File(\"expr.in\"));\n\t\t\tout = new PrintWriter(new FileWriter(new File(\"expr.out\")));\n\t\t\tsolve();\n\t\t\tout.close();\n\t\t} catch (Exception ex) {\n\t\t\tex.printStackTrace();\n\t\t}\n\t}\n\n\tclass FastScanner {\n\t\tBufferedReader bf;\n\t\tStringTokenizer st;\n\n\t\tpublic FastScanner(File f) {\n\t\t\ttry {\n\t\t\t\tbf = new BufferedReader(new FileReader(f));\n\t\t\t} catch (IOException ex) {\n\t\t\t\tex.printStackTrace();\n\t\t\t}\n\t\t}\n\n\t\tpublic FastScanner(InputStream is) {\n\t\t\tbf = new BufferedReader(new InputStreamReader(is), 32768);\n\t\t}\n\n\t\tString next() {\n\t\t\twhile (st == null || !st.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(bf.readLine());\n\t\t\t\t} catch (IOException ex) {\n\t\t\t\t\tex.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tint nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tdouble nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tfloat nextFloat() {\n\t\t\treturn Float.parseFloat(next());\n\t\t}\n\n\t\tString nextLine() {\n\t\t\ttry {\n\t\t\t\treturn bf.readLine();\n\t\t\t} catch (Exception ex) {\n\t\t\t\tex.printStackTrace();\n\t\t\t}\n\t\t\treturn \"\";\n\t\t}\n\n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tBigInteger nextBigInteger() {\n\t\t\treturn new BigInteger(next());\n\t\t}\n\n\t\tBigDecimal nextBigDecimal() {\n\t\t\treturn new BigDecimal(next());\n\t\t}\n\n\t\tint[] nextIntArray(int n) {\n\t\t\tint a[] = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = Integer.parseInt(next());\n\t\t\treturn a;\n\t\t}\n\n\t\tlong[] nextLongArray(int n) {\n\t\t\tlong a[] = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = Long.parseLong(next());\n\t\t\treturn a;\n\t\t}\n\t}\n}", "lang": "Java 8", "bug_code_uid": "ea4653a1baf70f0c4af421ac8ae7fe6b", "src_uid": "f40900973f4ebeb6fdafd75ebe4e9601", "apr_id": "b4149ddfd65cf48df4be5276e7653066", "difficulty": 2500, "tags": ["matrices", "dp"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.20905746543194215, "equal_cnt": 54, "replace_cnt": 36, "delete_cnt": 9, "insert_cnt": 8, "fix_ops_cnt": 53, "bug_source_code": "import java.io.*;\nimport java.util.Arrays;\n\npublic class CF351C\n{\n public static int[] a = null;\n public static int[] b = null;\n public static int n = 0;\n public static int m = 0;\n \n public static int[] intArray(String s)\n {\n String[] splits = s.trim().split(\" +\");\n int[] array = new int[splits.length];\n for (int i = 0; i < array.length; i++)\n array[i] = Integer.parseInt(splits[i]);\n return array;\n }\n \n public static int calcInkRequired(Boolean[] brackets)\n {\n int inkRequired = 0;\n for (int i = 0; i < n; i++)\n {\n if (brackets[i].booleanValue())\n inkRequired += b[i];\n else\n inkRequired += a[i];\n }\n return inkRequired;\n }\n \n public static void widen()\n {\n int[] _a = Arrays.copyOf(a, n * 2);\n for (int i = 0; i < n; i++)\n _a[i + n] = _a[i];\n a = _a;\n int[] _b = Arrays.copyOf(b, n * 2);\n for (int i = 0; i < n; i++)\n _b[i + n] = _b[i];\n b = _b;\n n *= 2;\n m /= 2;\n return;\n }\n \n public static void main(String[] args) throws IOException\n {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int[] _nm = intArray(br.readLine());\n n = _nm[0];\n m = _nm[1];\n a = intArray(br.readLine());\n b = intArray(br.readLine());\n \n if ((n % 2) == 1)\n widen();\n \n int bestBestInkRequired = 0;\n if (n > 0)\n {\n while (true)\n {\n int halfN = n / 2;\n // false = open, true = close\n Boolean[] brackets = new Boolean[n];\n int level = 0;\n int[] sizes = new int[halfN];\n int[] indexes = new int[halfN];\n int bestInkRequired = 0;\nlevelLoop:\n while (level >= 0)\n {\n int curSize = sizes[level];\n int curIndex = indexes[level];\n if (curSize == 0)\n {\n for (int i = 0; i < n; i++)\n {\n if (brackets[i] == null)\n {\n indexes[level] = i;\n curIndex = i;\n break;\n }\n }\n sizes[level] = 2;\n }\n else\n {\n brackets[curIndex] = null;\n brackets[curIndex + curSize - 1] = null;\n sizes[level] += 2;\n }\n curSize = sizes[level];\n if ((curIndex + curSize) > n)\n {\n level--;\n continue levelLoop;\n }\n for (int i = 0; i < curSize; i++)\n {\n if (brackets[curIndex + i] != null)\n {\n level--;\n continue levelLoop;\n }\n }\n brackets[curIndex] = Boolean.FALSE;\n brackets[curIndex + curSize - 1] = Boolean.TRUE;\n level++;\n if (level < halfN)\n sizes[level] = 0;\n else\n {\n int inkRequired = calcInkRequired(brackets);\n if ((bestInkRequired == 0) || (inkRequired < bestInkRequired))\n bestInkRequired = inkRequired;\n level--;\n }\n }\n \n if ((bestBestInkRequired == 0) || (bestInkRequired < bestBestInkRequired))\n {\n bestBestInkRequired = bestInkRequired;\n if ((m % 2) == 1)\n break;\n // Retry with wider scope\n widen();\n }\n else\n {\n n /= 2;\n m *= 2;\n break;\n }\n }\n }\n System.out.println(String.valueOf(bestBestInkRequired * m));\n return;\n }\n}\n", "lang": "Java 6", "bug_code_uid": "78b335c4dc604afefc0904f0c314b35e", "src_uid": "f40900973f4ebeb6fdafd75ebe4e9601", "apr_id": "50bbeea6c1aeb97004db4eae1af5f056", "difficulty": 2500, "tags": ["matrices", "dp"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9997175939000282, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.*;\n\npublic class R204C { \n BufferedReader reader;\n StringTokenizer tokenizer;\n PrintWriter out;\n \n int INF = Integer.MAX_VALUE/3;\n public void solve() throws IOException { \n int N = nextInt();\n int M = nextInt();\n int[] A = new int[N];\n int[] B = new int[N];\n for (int i = 0; i < N; i++)\n A[i] = nextInt();\n for (int i = 0; i < N; i++)\n B[i] = nextInt();\n \n int[][][] dp = new int[N+1][2*N+1][2*N+1];\n for(int i = 0; i <= N; i++){\n for(int j = 0; j <= 2*N; j++){\n Arrays.fill(dp[i][j], INF);\n }\n }\n for(int i = 0; i <= 2*N; i++){\n dp[0][i][i] = 0;\n }\n \n for(int i = 0; i < N; i++){\n for(int j = 0; j <= 2*N; j++){\n for(int k = 0; k <= 2*N; k++){\n if (dp[i][j][k] == INF) continue;\n \n if(k < 2*N)\n dp[i+1][j][k+1] = Math.min(dp[i+1][j][k+1], dp[i][j][k] + A[i]);\n \n if(k > 0)\n dp[i+1][j][k-1] = Math.min(dp[i+1][j][k-1], dp[i][j][k] + B[i]); \n } \n }\n } \n \n int[][] T = new int[2*N+1][2*N+1];\n for(int i = 0; i <= 2*N; i++){\n for(int j = 0; j <= 2*N; j++){\n T[i][j] = dp[N][i][j]; \n }\n }\n int[][] TT = pow(T, M);\n \n// for(int i = 0; i <= 2*N; i++){\n// for(int j = 0; j <= 2*N; j++){\n// out.print(T[i][j] + \" \"); \n// }\n// out.println();\n// } \n out.println(TT[0][0]); \n }\n \n public int[][] pow(int[][] A, int N){\n if (N == 1){\n int[][] ret = A.clone();\n return ret;\n }\n \n if (N % 2 == 1) \n return mul(A, pow(A, N-1));\n else\n return pow(mul(A, A), N/2); \n }\n \n public int[][] mul(int[][] A, int[][] B){\n int[][] ret = new int[A.length][A[0].length];\n for(int i = 0; i < A.length; i++){\n Arrays.fill(ret[i], INF);\n }\n \n for(int k = 0; k < A.length; k++){\n for(int i = 0; i < A.length; i++){\n for(int j = 0; j < A.length; j++){ \n if (A[i][k] == INF || B[k][j] == INF) continue;\n ret[i][j] = Math.min(ret[i][j], A[i][k] + B[k][j]);\n }\n }\n }\n return ret;\n }\n \n /**\n * @param args\n */\n public static void main(String[] args) {\n new R204C().run();\n }\n \n public void run() {\n try {\n reader = new BufferedReader(new InputStreamReader(System.in));\n tokenizer = null;\n out = new PrintWriter(System.out);\n solve();\n reader.close();\n out.close();\n } catch (Exception e) {\n e.printStackTrace();\n System.exit(1);\n }\n }\n\n int nextInt() throws IOException {\n return Integer.parseInt(nextToken());\n }\n\n long nextLong() throws IOException {\n return Long.parseLong(nextToken());\n }\n\n double nextDouble() throws IOException {\n return Double.parseDouble(nextToken());\n }\n\n String nextToken() throws IOException {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n tokenizer = new StringTokenizer(reader.readLine());\n }\n return tokenizer.nextToken();\n }\n\n}", "lang": "Java 6", "bug_code_uid": "351e36991f48f1ac3f1e45f8f9ae979e", "src_uid": "f40900973f4ebeb6fdafd75ebe4e9601", "apr_id": "ef646ea9c5bf6302b25ae720cc946567", "difficulty": 2500, "tags": ["matrices", "dp"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9960098219766728, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.awt.Point;\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.InputMismatchException;\n\npublic class R3_D2_D {\n static ArrayList[] edge;\n static ArrayList[] revEdge;\n static boolean vis1[];\n static boolean vis2[];\n\n public static void dfs1(int index) {\n if (!vis1[index]) {\n vis1[index] = true;\n for (int a : edge[index])\n dfs1(a);\n }\n }\n\n public static void dfs2(int index) {\n if (!vis2[index]) {\n vis2[index] = true;\n for (int a : revEdge[index])\n dfs2(a);\n }\n }\n\n public static void main(String[] args) {\n // BufferedReader in = new BufferedReader(new\n // InputStreamReader(System.in));\n\n InputReader in = new InputReader(System.in);\n int n = in.readInt();\n int m = in.readInt();\n vis1 = new boolean[n];\n vis2 = new boolean[n];\n int[] inp = new int[n];\n for (int i = 0; i < inp.length; i++) {\n inp[i] = in.readInt();\n }\n edge = new ArrayList[n];\n revEdge = new ArrayList[n];\n for (int j = 0; j < inp.length; j++) {\n edge[j] = new ArrayList();\n revEdge[j] = new ArrayList();\n }\n for (int i = 0; i < m; i++) {\n int a = in.readInt() - 1;\n int b = in.readInt() - 1;\n edge[a].add(b);\n revEdge[b].add(a);\n }\n for (int i = 0; i < inp.length; i++) {\n if (inp[i] == 1)\n dfs1(i);\n }\n for (int i = 0; i < inp.length; i++) {\n if (inp[i] == 2)\n dfs2(i);\n }\n for (int i = 0; i < inp.length; i++) {\n if(vis1[i] && vis2[i])\n System.out.println(1);\n else\n System.out.println(0);\n }\n }\n\n public static class tr {\n int x;\n int y;\n int z;\n\n public tr(int a, int b, int c) {\n x = a;\n y = b;\n z = c;\n }\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1000];\n private int curChar, numChars;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n private int read() {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int readInt() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long readLong() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public String readString() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuffer res = new StringBuffer();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n\n private boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n private String readLine0() {\n StringBuffer buf = new StringBuffer();\n int c = read();\n while (c != '\\n' && c != -1) {\n buf.appendCodePoint(c);\n c = read();\n }\n return buf.toString();\n }\n\n public String readLine() {\n String s = readLine0();\n while (s.trim().length() == 0)\n s = readLine0();\n return s;\n }\n\n public String readLine(boolean ignoreEmptyLines) {\n if (ignoreEmptyLines)\n return readLine();\n else\n return readLine0();\n }\n\n public char readCharacter() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n return (char) c;\n }\n\n public double readDouble() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n double res = 0;\n while (!isSpaceChar(c) && c != '.') {\n if (c == 'e' || c == 'E')\n return res * Math.pow(10, readInt());\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n }\n if (c == '.') {\n c = read();\n double m = 1;\n while (!isSpaceChar(c)) {\n if (c == 'e' || c == 'E')\n return res * Math.pow(10, readInt());\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n m /= 10;\n res += (c - '0') * m;\n c = read();\n }\n }\n return res * sgn;\n }\n }\n\n}\n", "lang": "Java 6", "bug_code_uid": "c3e1c894f6842627c3edc905eb830774", "src_uid": "87d869a0fd4a510c5e7e310886b86a57", "apr_id": "02c3bc8dc786eafda64648448f168ebb", "difficulty": 1700, "tags": ["graphs"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6136496208438654, "equal_cnt": 30, "replace_cnt": 18, "delete_cnt": 1, "insert_cnt": 11, "fix_ops_cnt": 30, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.HashSet;\nimport java.util.StringTokenizer;\n\n\npublic class VKRound3A {\n static BufferedReader br = new BufferedReader(new InputStreamReader(\n System.in));\n static StringTokenizer st = new StringTokenizer(\"\");\n static int nextInt() throws Exception {\n return Integer.parseInt(next());\n }\n static String next() throws Exception {\n while (true) {\n if (st.hasMoreTokens()) {\n return st.nextToken();\n }\n String s = br.readLine();\n if (s == null) {\n return null;\n }\n st = new StringTokenizer(s);\n }\n }\n static int n, m;\n static int state [];\n static ArrayList graph [];\n static boolean vis [];\n static ArrayList curpath = new ArrayList();\n static HashSet important = new HashSet();\n public static void dfs(int idx){ \n if(state[idx] == 2){\n important.add(idx);\n for(int i = curpath.size() - 1 ; i >= 0 ; --i){\n if(state[curpath.get(i)] == 1){\n important.add(curpath.get(i));\n break;\n }else{\n important.add(curpath.get(i));\n }\n }\n vis[idx] = true;\n return;\n }\n if(vis[idx])\n return;\n vis[idx] = true;\n curpath.add(idx);\n for(int i = 0 ; i < graph[idx].size() ; ++i){\n int nxt = graph[idx].get(i); \n dfs(nxt);\n }\n curpath.remove((Integer) idx);\n }\n @SuppressWarnings(\"unchecked\")\n public static void main(String[] args)throws Exception {\n n = nextInt();\n m = nextInt();\n state = new int [n + 1];\n vis = new boolean [n + 1];\n graph = new ArrayList [n + 1];\n for(int i = 0 ; i < n + 1 ; ++i)\n graph[i] = new ArrayList();\n for(int i = 1 ; i < n + 1 ; ++i)\n state[i] = nextInt();\n for(int i = 0 ; i < m ; ++i){\n int a = nextInt();\n int b = nextInt();\n graph[a].add(b);\n }\n for(int i = 1 ; i < n + 1 ; ++i){\n if(!vis[i] && state[i] == 1)\n dfs(i);\n }\n for(int i = 1 ; i < n + 1 ; ++i)\n if(important.contains(i))\n System.out.println(1);\n else\n System.out.println(0);\n }\n}\n", "lang": "Java 6", "bug_code_uid": "45c9197f52563a825150ea001654b9d3", "src_uid": "87d869a0fd4a510c5e7e310886b86a57", "apr_id": "73d560e7a0c8e439638774c6fa2aec41", "difficulty": 1700, "tags": ["graphs"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5798733286418015, "equal_cnt": 16, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 15, "bug_source_code": "import java.util.*;\n\npublic class ChatRoom {\n\n public static void main(String[] args) {\n // TODO code application logic here\n Scanner in = new Scanner(System.in);\n String stg = in.next();\n\n String hello = \"hello\";\n int count = 0;\n for (int i = 0; i < stg.length();) {\n for (int j = 0; j < hello.length(); j++) {\n if (stg.charAt(i) == hello.charAt(j)) {\n count++;\n }\n }\n\n }\n if (count >= 5) {\n System.out.println(\"YES\");\n } else {\n System.out.println(\"NO\");\n }\n }\n\n}\n", "lang": "Java 8", "bug_code_uid": "4f68fc759621eba729a1620dd88772e8", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "apr_id": "9a3da12dd21b7520fa478619d0be2297", "difficulty": 1000, "tags": ["strings", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8950299914310197, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.IOException;\nimport java.util.HashSet;\nimport java.util.Scanner;\nimport java.util.Set;\n\npublic class ProblemE {\n public static int w, h;\n \n public static int MAX = 9999999;\n \n public static Set result = new HashSet();\n \n public static void dfs(int n, int m, int mask) {\n if (n >= w) {\n result.add(mask);\n return;\n }\n if (m >= 1) {\n dfs(n+1, m, mask|(1<= 1) {\n dfs(n+1, m, mask|(1<<((n-1)+w)));\n }\n if (n <= w - 2) {\n dfs(n+1, m, mask|(1<<((n+1)+w)));\n }\n dfs(n+1, m, mask|(1<<(n+w)));\n }\n \n public static void main(String[] args) throws IOException {\n Scanner s = new Scanner(System.in);\n String[] line = s.nextLine().split(\" \");\n w = Integer.valueOf(line[0]);\n h = Integer.valueOf(line[1]);\n if (w > h) {\n int tmp = w;\n w = h;\n h = tmp;\n }\n \n int[][] dp = new int[h+1][1<<(w*3)];\n for (int i = 0 ; i <= h ; i++) {\n for (int j = 0 ; j < 1<<(w*3) ; j++) {\n dp[i][j] = MAX;\n }\n }\n dp[0][0] = 0;\n \n \n for (int i = 0 ; i < h ; i++) {\n result.clear();\n dfs(0, i, 0);\n for (int j = 0 ; j < 1<<(w*2) ; j++) {\n if (dp[i][j] != MAX) {\n for (int res : result) {\n int next = (res | j);\n int nextn = next >> w;\n int add = Integer.bitCount(next & ((1<();\n\t\tout.println(n*m-rec(f, n, m, 0, 0, 0));\n\t}\n\t\n\tSet cache;\n\t\n\tlong hash(boolean[][] f, int n, int m, int r, int c, int cur)\n\t{\n\t\tlong x = 0;\n\t\tfor(int i = 0;i < n;i++){\n\t\t\tfor(int j = 0;j < m;j++){\n\t\t\t\tif(f[i][j])x |= 1L<= m)return rec(f, n, m, r+1, 0, cur);\n\t\tlong h = hash(f, n, m, r, c, cur);\n\t\tif(cache.contains(h))return 99999;\n\t\tcache.add(h);\n\t\tint min = f[r][c] ? rec(f, n, m, r, c+1, cur) : 99999;\n\t\t{\n\t\t\tboolean[] memo = new boolean[]{f[r][c], f[r+1][c], f[r+2][c], f[r+1][c+1], c-1>=0 ? f[r+1][c-1] : false};\n\t\t\tf[r][c] = true;\n\t\t\tf[r+1][c] = true;\n\t\t\tf[r+2][c] = true;\n\t\t\tf[r+1][c+1] = true;\n\t\t\tif(c-1 >= 0)f[r+1][c-1] = true;\n\t\t\tmin = Math.min(min, rec(f, n, m, r, c+1, cur+1));\n\t\t\tf[r][c] = memo[0];\n\t\t\tf[r+1][c] = memo[1];\n\t\t\tf[r+2][c] = memo[2];\n\t\t\tf[r+1][c+1] = memo[3];\n\t\t\tif(c-1 >= 0)f[r+1][c-1] = memo[4];\n\t\t}\n\t\t{\n\t\t\tboolean[] memo = new boolean[]{f[r][c], f[r][c+1], f[r][c+2], f[r+1][c+1]};\n\t\t\tf[r][c] = true;\n\t\t\tf[r][c+1] = true;\n\t\t\tf[r][c+2] = true;\n\t\t\tf[r+1][c+1] = true;\n\t\t\tmin = Math.min(min, rec(f, n, m, r, c+3, cur+1));\n\t\t\tf[r][c] = memo[0];\n\t\t\tf[r][c+1] = memo[1];\n\t\t\tf[r][c+2] = memo[2];\n\t\t\tf[r+1][c+1] = memo[3];\n\t\t}\n\t\treturn min;\n\t}\n\n\tint count(int n, int m, int p, int step)\n\t{\n\t\tint[] dr = {1, 0, -1, 0, 0};\n\t\tint[] dc = {0, 1, 0, -1, 0};\n\t\t\n\t\t// (0,i)\n\t\tint ct = 0;\n\t\tboolean[][] f = new boolean[n][m];\n\t\tfor(int j = 0;j < n;j++){\n\t\t\tfor(int k = 0;k < m;k++){\n\t\t\t\tif(k % 5 == p){\n\t\t\t\t\tct++;\n\t\t\t\t\tfor(int l = 0;l < 5;l++){\n\t\t\t\t\t\tint nr = j+dr[l];\n\t\t\t\t\t\tint nc = k+dc[l];\n\t\t\t\t\t\tif(nr >= 0 && nr < n && nc >= 0 && nc < m){\n\t\t\t\t\t\t\tf[nr][nc] = true;\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\tp = (p+step)%5;\n\t\t}\n\t\t\n\t\tfor(int j = 0;j < n;j++){\n\t\t\tfor(int k = 0;k < m;k++){\n\t\t\t\tif(!f[j][k]){\n\t\t\t\t\tct++;\n\t\t\t\t\tfor(int l = 0;l < 5;l++){\n\t\t\t\t\t\tint nr = j+dr[l];\n\t\t\t\t\t\tint nc = k+dc[l];\n\t\t\t\t\t\tif(nr >= 0 && nr < n && nc >= 0 && nc < m){\n\t\t\t\t\t\t\tf[nr][nc] = true;\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\treturn ct;\n\t}\n\t\n\tvoid run() throws Exception\n\t{\n\t\tin = oj ? new Scanner(System.in) : new Scanner(INPUT);\n\t\tout = new PrintWriter(System.out);\n\n\t\tlong s = System.currentTimeMillis();\n\t\tsolve();\n\t\tout.flush();\n\t\ttr(System.currentTimeMillis()-s+\"ms\");\n\t}\n\t\n\tpublic static void main(String[] args) throws Exception\n\t{\n\t\tnew C2().run();\n\t}\n\t\n\tint ni() { return Integer.parseInt(in.next()); }\n\tlong nl() { return Long.parseLong(in.next()); }\n\tdouble nd() { return Double.parseDouble(in.next()); }\n\tboolean oj = System.getProperty(\"ONLINE_JUDGE\") != null;\n\tvoid tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }\n}\n", "lang": "Java 6", "bug_code_uid": "080d270d1e637320f08e87d39275d6b1", "src_uid": "097674b4dd696b30e102938f71dd39b9", "apr_id": "1ff09d5171df8b86cebf2214230a795e", "difficulty": 2100, "tags": ["dp", "bitmasks", "dsu"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9815950920245399, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "package com;\n\nimport java.io.InputStreamReader;\nimport java.util.Scanner;\n\npublic class A {\n\t\n\tpublic static void main(String[] args){\n\t\tString n;\n\t\tString line;\n\t\tScanner scanner = new Scanner(new InputStreamReader(System.in));\n\n\t\t\n\t\tline = scanner.nextLine();\n\n\t\tscanner.close();\t\t\n\t\t\n\t\tif((Integer.valueOf(line))%2 == 0) {\n\t\t\tSystem.out.println(\"Mahmoud\");\n\t\t} else {\n\t\t\tSystem.out.println(\"Ehab\");\n\t\t}\n\t\t\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "d7e77cf0258e9967d91d8d99c7ec6909", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "apr_id": "0ab70d35ae19aba94eb2aa4ea8404cca", "difficulty": 800, "tags": ["math", "games"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9791666666666666, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "\nimport java.util.Scanner;\n\n/*\n * To change this license header, choose License Headers in Project Properties.\n * To change this template file, choose Tools | Templates\n * and open the template in the editor.\n */\n\n/**\n *\n * @author Adly\n */\npublic class BIGBRAIN {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int tmp1=in.nextInt();\n if(in.nextInt()==1){\n System.out.println(\"Ehab\");\n }else{\n System.out.println(\"Mahmoud\");\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "bb4bfa5b4b5a96e064b3285ed90ce2f4", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "apr_id": "ec1b70379c9bdb84539c63413401c0a8", "difficulty": 800, "tags": ["math", "games"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9582637729549248, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package math.codeforces;\n\nimport java.util.Scanner;\n\npublic class AddOrSubtractOddEven {\n\n\tpublic static void main(String[] args) {\n\t\tScanner s = new Scanner(System.in);\n\t\tlong T = s.nextLong();\n\t\tif(T%2==0){\n\t\t System.out.println(\"Mahmoud\");\n\t\t}else{\n\t\t System.out.println(\"Ehab\");\n\t\t}\n\t\ts.close();\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "83aa3908f3065e5761a62f799dac587a", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "apr_id": "9474d8fabd2262f4226b4e36fbcc9bd1", "difficulty": 800, "tags": ["math", "games"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9529243937232525, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "package codeforces;\n\nimport java.io.*;\nimport java.util.*;\npublic class problemA {\n\n\tpublic static void main(String[] args) throws IOException{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tlong n = Long.valueOf(br.readLine());\n\t\tif(n%2 == 0) {\n\t\t\tSystem.out.println(\"Mahmoud\");\n\t\t} else {\n\t\t\tSystem.out.println(\"Ehab\");\n\t\t}\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "74763f2454aa01d209ab8315d10ce3a0", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "apr_id": "18f766eef39e49a9f2e8e5894ab5f547", "difficulty": 800, "tags": ["math", "games"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.44752818733738076, "equal_cnt": 22, "replace_cnt": 14, "delete_cnt": 4, "insert_cnt": 4, "fix_ops_cnt": 22, "bug_source_code": "import java.util.Scanner;\nimport java.util.HashMap;\nimport java.util.Map; \npublic class CF429B {\n\tpublic static void main(String[]args){\n\t\tScanner scan = new Scanner(System.in);\n\t\tint x = scan.nextInt();\n\t\tint y = scan.nextInt();\n\t\tString string = scan.next();\n\t\tint len = string.length();\n\t\tMap numChars = new HashMap(Math.min(len, 26));\n\n\t\tfor (int i = 0; i < len; ++i)\n\t\t{\n\t\t char charAt = string.charAt(i);\n\n\t\t if (!numChars.containsKey(charAt))\n\t\t {\n\t\t numChars.put(charAt, 1);\n\t\t }\n\t\t else\n\t\t {\n\t\t numChars.put(charAt, numChars.get(charAt) + 1);\n\t\t }\n\t\t} if (len % y == 0){\n\t\t\tSystem.out.println(\"YES\");\n\t\t} else{\n\t\t\tSystem.out.println(\"NO\");\n\t\t}\n\n\t\t\n\t\t\n\t\t\n\t\t\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "49f05bb3e34e786a95b899c1cecd5a08", "src_uid": "ceb3807aaffef60bcdbcc9a17a1391be", "apr_id": "ad2c9d62876249c1bc02ef6e031b2645", "difficulty": 900, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.45255474452554745, "equal_cnt": 12, "replace_cnt": 3, "delete_cnt": 7, "insert_cnt": 2, "fix_ops_cnt": 12, "bug_source_code": "import java.util.Scanner;\n\npublic class OddsAndEnds {\n static int [] arr;\n static boolean done = false;\n \n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n int len = scan.nextInt();\n arr = new int[len];\n for (int i = 0; i < len; i++) {\n arr[i] = scan.nextInt();\n }\n partition(new int[len], len, len, 0);\n if (done) {\n System.out.println(\"Yes\");\n }\n else {\n System.out.println(\"No\");\n }\n scan.close();\n }\n\n private static void checkAnswer(int[] p, int n) {\n int begin = 0;\n for (int i = 0; i < n; i++) {\n if (arr[begin] % 2 == 0) {\n return;\n }\n if (arr[begin + p[i] - 1] % 2 == 0) {\n return;\n }\n begin += p[i];\n }\n\n done = true;\n }\n\n private static void partition(int[] p, int n, int m, int i) {\n if (n == 0) {\n if (i % 2 != 0) {\n checkAnswer(p, i);\n } \n }\n else {\n for (int k = m; k > 0; k--) {\n if (done) {\n return;\n }\n \n if (k % 2 != 0) {\n p[i] = k;\n partition(p, n - k, n - k, i + 1);\n }\n }\n }\n }\n\n}\n", "lang": "Java 8", "bug_code_uid": "f4769c919fcd53d10ce9d53edad795c1", "src_uid": "2b8c2deb5d7e49e8e3ededabfd4427db", "apr_id": "1ebf5bb300b2f8aad462c2614d42cafa", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.3181818181818182, "equal_cnt": 23, "replace_cnt": 10, "delete_cnt": 5, "insert_cnt": 8, "fix_ops_cnt": 23, "bug_source_code": "\n//package semanai;\nimport java.util.Scanner;\n\npublic class OddsEnds {\n \n public static void oddsEnds(){\n Scanner sc = new Scanner(System.in);\n int size = sc.nextInt();\n \n int phase =1;\n \n int previous = 0;\n boolean still_valid= true;\n \n for (int i =0; iprevious)&&(phase==1)){\n previous = current;\n \n }else if ((current==previous)&&(phase==1)){\n previous = current;\n phase=2;\n \n }else if ((currentprevious)&&(phase==2)){\n still_valid=false;\n break;\n \n }else if ((current==previous)&&(phase==2)){\n previous = current;\n\n }else if ((currentprevious)&&(phase==3)){\n still_valid=false;\n break;\n \n }else if ((current==previous)&&(phase==3)){\n still_valid=false;\n break;\n \n }else if ((current 0 && x <= count)\n answer++;\n if (x > count)\n return;\n for (int i = 0; i < 10; i++) {\n if (10 * x + i > 0 && haveTwoDigit(10 * x + i))\n dfs(10 * x + i, count);\n }\n }\n\n private boolean haveTwoDigit(long x) {\n int[] numberDigit = new int[10];\n int cnt = 0;\n while (x > 0) {\n numberDigit[(int)x % 10]++;\n x /= 10;\n }\n for (int i = 0; i < 10; i++)\n if (numberDigit[i] > 0)\n cnt++;\n return (cnt <= 2);\n }\n}\n\nclass InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int readInt() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n\n }\n\nclass OutputWriter {\n private final PrintWriter writer;\n\n public OutputWriter(OutputStream outputStream) {\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }\n\n public OutputWriter(Writer writer) {\n this.writer = new PrintWriter(writer);\n }\n\n public void print(Object...objects) {\n for (int i = 0; i < objects.length; i++) {\n if (i != 0)\n writer.print(' ');\n writer.print(objects[i]);\n }\n }\n\n public void printLine(Object...objects) {\n print(objects);\n writer.println();\n }\n\n public void close() {\n writer.close();\n }\n\n}\n", "lang": "Java 7", "bug_code_uid": "201433ccc9812b94d920b52d704d7e9d", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "apr_id": "01766e219884173456596a42af00f0eb", "difficulty": 1600, "tags": ["dfs and similar", "brute force", "bitmasks"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8873563218390804, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.math.BigInteger;\nimport java.util.HashSet;\nimport java.util.StringTokenizer;\n\npublic class Round150_B {\n\n static HashSet hash = new HashSet();\n public static void main(String[] args) throws Exception {\n InputReader in = new InputReader();\n\n int N = in.nextInt();\n String s = N + \"\";\n int len = s.length();\n int c = 0;\n\n while (len > 0) {\n for (int first = 0; first < 10; first++)\n for (int second = first + 1; second < 10; second++) {\n if (first == second)\n continue;\n\n for (int i = 0; i < (1 << len); i++) {\n StringBuffer res = new StringBuffer(\"\");\n for (int j = 0; j < len; j++)\n if ((i & (1 << j)) != 0)\n res.append(first + \"\");\n else\n res.append(second + \"\");\n int z = Integer.parseInt(res.toString());\n if (z <= N && (z + \"\").length() == len && !hash.contains(z)) {\n hash.add(z);\n c++;\n }\n\n }\n }\n len--;\n if(len == 0)break;\n StringBuffer q = new StringBuffer(\"\");\n for (int i = 0; i < len; i++)\n q.append(9);\n N = Integer.parseInt(q.toString());\n }\n System.out.println(c-1);\n\n }\n\n static class InputReader {\n BufferedReader in;\n StringTokenizer st;\n\n public InputReader() throws IOException {\n in = new BufferedReader(new InputStreamReader(System.in));\n st = new StringTokenizer(in.readLine());\n\n }\n\n public String next() throws IOException {\n\n while (!st.hasMoreElements())\n st = new StringTokenizer(in.readLine());\n return st.nextToken();\n }\n\n public int nextInt() throws NumberFormatException, IOException {\n return Integer.parseInt(next());\n }\n\n public long nextLong() throws NumberFormatException, IOException {\n return Long.parseLong(next());\n }\n }\n\n}\n", "lang": "Java 7", "bug_code_uid": "3947d3a95d0928ff154b1295423fbebe", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "apr_id": "55de9e45dddedd1f7568f9329f7ca8da", "difficulty": 1600, "tags": ["dfs and similar", "brute force", "bitmasks"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.3385093167701863, "equal_cnt": 14, "replace_cnt": 9, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 14, "bug_source_code": "import java.util.Scanner;\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String s = sc.nextLine();\n String ch = \"hello\";\n boolean w = true;\n int i = 0, j = 0;\n while(w && i < s.length())\n {\n if(s.charAt(i) == 'h')\n {\n if( s.charAt(i) != ch.charAt(j) )\n {\n if( s.charAt(i) == ch.charAt(j + 1))\n {\n j++;\n \n }\n else{\n w = false;\n }\n \n }\n }\n else{\n i++;\n }\n }\n System.out.println(w ? \"YES\" : \"NO\");\n }\n\n}\n", "lang": "Java 11", "bug_code_uid": "8f827c97f76d2fd7f06a778584f893c5", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "apr_id": "fbfd7fef914d7f7acbd37f51f319d57d", "difficulty": 1000, "tags": ["strings", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9845978322875071, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.*;\n\n\npublic class A {\n\n public static void main(String[] args) {\n FastScanner fs = new FastScanner();\n// int T = fs.nextInt();\n\n\n\n// for (int tt = 0; tt < T; tt++) {\n String s = fs.nextLine();\n String h = \"hello\";\n int j =4;\n for(int i=s.length()-1;i>=0;i--){\n if(j>-1&&s.charAt(i)==h.charAt(j)){\n System.out.println(h.charAt(j)+\" \"+j);\n j--;\n }\n\n }\n\n if(j==-1)\n System.out.println(\"YES\");\n else\n System.out.println(\"NO\");\n\n\n\n\n\n\n\n\n\n// }\n\n\n\n }\n\n\n\n\n static void sort(int[] a) {\n ArrayList l=new ArrayList<>();\n for (int i:a) l.add(i);\n Collections.sort(l);\n for (int i=0; i results=new ArrayList();\n\t\tresults.add(1);\n\t\tfor (int i = 1; i < input; i++) {\n\t\t\tint last=results.get(results.size()-1);\n\t\t\t//System.out.println(\"size of the array is \"+results.size());\n\t\t\t//System.out.println(\"last is \"+last);\n\t\t\tif(last==1){\n\t\t\t\tresults.remove(results.size()-1);\n\t\t\t\tresults.add(2);\n\t\t\t\tcombine(results);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tresults.add(1);\n\t\t\t}\n\t\t}\n\t\tString R=\"\";\n\t\tfor (int i = 0; i < results.size(); i++) {\n\t\t\tR+=results.get(i)+\" \";\n\t\t}\n\t\tSystem.out.println(R);\n\t\t}\n\tpublic static void combine(ArrayListresults){\n\t\tfor (int i = results.size()-1; i>0; i--) {\n\t\t\t//System.out.println(\"you have called combine\");\n\t\t\tif(results.get(i)==results.get(i-1)){\n\t\t\t\tresults.remove(i);\n\t\t\t\tint new_value=results.remove(i-1)+1;\n\t\t\t\tresults.add(new_value);\n\t\t\t\t//System.out.println(\"iam removing \"+results.get(i-1)+\" and adding \"\n\t\t\t\t//+new_value+\" array size is \"+results.size());\n\t\t\t}\n\t\t}\n\t}\n\t}\n", "lang": "Java 7", "bug_code_uid": "21746c20bff00f64a9a443f252330873", "src_uid": "757cd804aba01dc4bc108cb0722f68dc", "apr_id": "14b51e1a88b6a4e63d9eea232414405c", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9844192634560907, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package com.company;\n\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int value = scanner.nextInt();\n StringBuffer sb = new StringBuffer();\n while (value > 0) {\n int pw = (int) lg(value);\n if (sb.length() > 0) {\n sb.append(\" \");\n }\n sb.append(String.valueOf(pw + 1));\n value = value - powInt(pw);\n }\n System.out.println(sb.toString());\n }\n\n private static int powInt(int i) {\n return (int) Math.pow(2, i);\n }\n\n private static double lg(int x) {\n return (Math.log(x) / Math.log(2));\n }\n}\n", "lang": "Java 7", "bug_code_uid": "76ce8206a559748152c52e1e89557319", "src_uid": "757cd804aba01dc4bc108cb0722f68dc", "apr_id": "6cbfb3d6e98ea5ff34ca16a8c35ccfad", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.5746572804742497, "equal_cnt": 39, "replace_cnt": 25, "delete_cnt": 5, "insert_cnt": 9, "fix_ops_cnt": 39, "bug_source_code": "\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.Comparator;\nimport java.util.SortedSet;\nimport java.util.TreeSet;\n\npublic class E {\n\n\n static class cup {\n int x, i, i0;\n \n cup(int i, int i0) {\n this.i=i; this.i0=i0;\n }\n }\n \n static cup find_cup(TreeSet t, int y, int lo, int hi) {\n cup aux=new cup(0, 0);\n while(lo<=hi) {\n int mid=(lo+hi)>>1;\n aux.i=mid;\n SortedSet sub=t.headSet(aux);\n if(sub.size()==y) {\n return sub.last();\n } else if(sub.size() t=new TreeSet(new Comparator() {\n public int compare(cup o1, cup o2) {\n return o1.i-o2.i;\n }\n });\n \n for (int i=0; i0&&c.x!=x) {\n System.out.println(\"-1\");\n return;\n } else {\n c.x=x;\n }\n t.remove(c);\n c.i=m-i;\n t.add(c);\n }\n \n int[] out=new int[n];\n boolean[] b=new boolean[n+1]; int j=1;\n for (cup c: t) {\n if(c.x==0) {\n while(b[j]) {\n j++;\n }\n c.x=j;\n }\n if(b[c.x]) {\n System.out.println(\"-1\");\n return;\n }\n b[c.x]=true;\n out[c.i0]=c.x;\n }\n \n StringBuilder sb=new StringBuilder();\n for (int i=0; i ll = new LinkedList(); ll.add(1);\n\t\twhile(!ll.isEmpty()) {\n\t\t\tint n = ll.pop(); for(int i = 1; i<=N; i++) if(graph[n][i] > 0 && par[i] == 0) {\n\t\t\t\tpar[i] = n; min[i] = Math.min(min[n], graph[n][i]); ll.add(i);\n\t\t\t}\n\t\t}\n\t\tif(par[N] == 0) return 0;\n\t\tflow = min[N]; int crnt = N; while(crnt != 1) {\n\t\t\tgraph[par[crnt]][crnt] -= flow; graph[crnt][par[crnt]] += flow; crnt = par[crnt];\n\t\t}\n\t\treturn flow;\n\t}\n\n\tfinal private static int BUFFER_SIZE = 1 << 16;\n\tprivate static DataInputStream din = new DataInputStream(System.in);\n\tprivate static byte[] buffer = new byte[BUFFER_SIZE];\n\tprivate static int bufferPointer = 0, bytesRead = 0;\n\tstatic PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n\n\tpublic static String readLine() throws IOException {\n\t\tbyte[] buf = new byte[64]; // line length\n\t\tint cnt = 0, c;\n\t\twhile ((c = Read()) != -1) {\n\t\t\tif (c == '\\n')\n\t\t\t\tbreak;\n\t\t\tbuf[cnt++] = (byte) c;\n\t\t}\n\t\treturn new String(buf, 0, cnt);\n\t}\n\n\tpublic static String read() throws IOException {\n\t\tbyte[] ret = new byte[1024];\n\t\tint idx = 0;\n\t\tbyte c = Read();\n\t\twhile (c <= ' ') {\n\t\t\tc = Read();\n\t\t}\n\t\tdo {\n\t\t\tret[idx++] = c;\n\t\t\tc = Read();\n\t\t} while (c != -1 && c != ' ' && c != '\\n' && c != '\\r');\n\t\treturn new String(ret, 0, idx);\n\t}\n\n\tpublic static int readInt() throws IOException {\n\t\tint ret = 0;\n\t\tbyte c = Read();\n\t\twhile (c <= ' ')\n\t\t\tc = Read();\n\t\tboolean neg = (c == '-');\n\t\tif (neg)\n\t\t\tc = Read();\n\t\tdo {\n\t\t\tret = ret * 10 + c - '0';\n\t\t} while ((c = Read()) >= '0' && c <= '9');\n\n\t\tif (neg)\n\t\t\treturn -ret;\n\t\treturn ret;\n\t}\n\n\tpublic static long readLong() throws IOException {\n\t\tlong ret = 0;\n\t\tbyte c = Read();\n\t\twhile (c <= ' ')\n\t\t\tc = Read();\n\t\tboolean neg = (c == '-');\n\t\tif (neg)\n\t\t\tc = Read();\n\t\tdo {\n\t\t\tret = ret * 10 + c - '0';\n\t\t} while ((c = Read()) >= '0' && c <= '9');\n\t\tif (neg)\n\t\t\treturn -ret;\n\t\treturn ret;\n\t}\n\n\tpublic static double readDouble() throws IOException {\n\t\tdouble ret = 0, div = 1;\n\t\tbyte c = Read();\n\t\twhile (c <= ' ')\n\t\t\tc = Read();\n\t\tboolean neg = (c == '-');\n\t\tif (neg)\n\t\t\tc = Read();\n\n\t\tdo {\n\t\t\tret = ret * 10 + c - '0';\n\t\t} while ((c = Read()) >= '0' && c <= '9');\n\n\t\tif (c == '.') {\n\t\t\twhile ((c = Read()) >= '0' && c <= '9') {\n\t\t\t\tret += (c - '0') / (div *= 10);\n\t\t\t}\n\t\t}\n\n\t\tif (neg)\n\t\t\treturn -ret;\n\t\treturn ret;\n\t}\n\n\tprivate static void fillBuffer() throws IOException {\n\t\tbytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);\n\t\tif (bytesRead == -1)\n\t\t\tbuffer[0] = -1;\n\t}\n\n\tprivate static byte Read() throws IOException {\n\t\tif (bufferPointer == bytesRead)\n\t\t\tfillBuffer();\n\t\treturn buffer[bufferPointer++];\n\t}\n\n\tpublic void close() throws IOException {\n\t\tif (din == null)\n\t\t\treturn;\n\t\tdin.close();\n\t}\n\n\tstatic void print(Object o) {\n\t\tpr.print(o);\n\t}\n\n\tstatic void println(Object o) {\n\t\tpr.println(o);\n\t}\n\n\tstatic void flush() {\n\t\tpr.flush();\n\t}\n\n\tstatic void println() {\n\t\tpr.println();\n\t}\n\n\tstatic void exit() throws IOException {\n\t\tdin.close();\n\t\tpr.close();\n\t\tSystem.exit(0);\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "d5a18debb24264d5927a6d5beddf5219", "src_uid": "d82278932881e3aa997086c909f29051", "apr_id": "56bd70922f9673ec3ec501b2d0457d0f", "difficulty": 900, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9008347245409015, "equal_cnt": 10, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 9, "bug_source_code": "/*\n * To change this license header, choose License Headers in Project Properties.\n * To change this template file, choose Tools | Templates\n * and open the template in the editor.\n */\npackage codeforces;\nimport java.util.*;\n/**\n *\n * @author Ashraf\n */\npublic class cFA1 {\n public static void main(String []args){\n String s=\"\";\n char c[]=new char[100];\n Scanner input=new Scanner(System.in);\n s=input.nextLine();\n c=s.toCharArray();\n boolean bool=false;\n int p=s.length();\n if(p==1){\n System.out.println(\"YES\");\n }\n else{\n LeadingZero lz=new LeadingZero(p, c);\n if(c[p-1]=='0') s=lz.loop()+s;\n c=s.toCharArray();\n p=s.length();\n if(p%2==0){\n for(int i=0;i

=2){\n\t\t\t\tans+=(sb.length()-2+sa.length())*(sb.length()-sa.length()-1)/2;\n\t\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\n}\n\t}\n", "lang": "Java 8", "bug_code_uid": "8ca71533f8a403544a6016a4a8418d16", "src_uid": "581f61b1f50313bf4c75833cefd4d022", "apr_id": "b753bde8090aebc067000185a8fbdb0f", "difficulty": 1300, "tags": ["bitmasks", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9827160493827161, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "\nimport java.util.Scanner;\n\npublic class tennis {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] dp = new long[10000];\n\t\tdp[0] = 1;\n\t\tdp[1] = 2;\n\t\tint i = 1;\n\t\twhile(true){\n\t\t\t\n\t\t\t\tdp[i + 1] = dp[i] + dp[i - 1];\n\t\t\tif(dp[i] > n)\n\t\t\t\tbreak;\n\t\t\ti++;\n\t\t\t\n\t\t} \n\t\tif(i==1 )\n\t\t\tSystem.out.println(i);\n\t\telse\n\t\t\tSystem.out.println(i - 1);\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "79a94020e519c92cbe42166be2007098", "src_uid": "3d3432b4f7c6a3b901161fa24b415b14", "apr_id": "484524812ceac7c6bdf5c140591737eb", "difficulty": 1600, "tags": ["math", "combinatorics", "greedy", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9170403587443946, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 5, "bug_source_code": "import java.math.*;\nimport java.util.*;\npublic class CodeForces \n{ \n public static void main(String[] args)\n {\n Scanner sc = new Scanner(System.in);\n int a,b,c;\n a=sc.nextInt();\n b=sc.nextInt();\n c=sc.nextInt();\n \n int x=abs(b-a)+abs(c-a);\n int y=abs(a-b)+abs(c-b);\n int z=abs(a-c)+abs(b-c);\n x=Math.min(x, y);\n y=Math.min(x, z); \n System.out.println(y);\n }\n}", "lang": "Java 8", "bug_code_uid": "538993a882e79a627cb557ea27c1cb36", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "apr_id": "997be43cdaf4b04d0bbad0e5ee34ac3f", "difficulty": 800, "tags": ["math", "sortings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9354120267260579, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import static java.lang.Math.abs;\nimport static java.util.Arrays.*;\nimport java.util.Scanner;\n\npublic class Main {\n \n public static void main(String[] args) {\n \n int [] friends =new int[3];\n Scanner scan = new Scanner(System.in);\n\tfor (int i = 0; i < 3; i++)\n\t\t friends[i] = scan.nextInt();\n\tsort(friends);\n System.out.println(abs(friends[1] - friends[0]) + abs(friends[1] - friends[2]));\n\t\n }", "lang": "Java 8", "bug_code_uid": "582d05821f745e899b0640c66788e60d", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "apr_id": "25a01d319fa9f1a4557820403f819e9f", "difficulty": 800, "tags": ["math", "sortings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9837251356238698, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package cf401Div2;\n\nimport java.util.Scanner;\n\npublic class ShellGame {\n\n\tpublic int solve(int n, int p) {\n\t\tif(p == 0) {\n\t\t\treturn solve(n % 2 == 0 ? n + 1 : n + 2, 1);\n\t\t}\n\t\tif (p == 2) {\n\t\t\treturn solve(n % 2 == 0 ? n + 2 : n + 1, 1);\n\t\t}\n\t\tif (n % 3 == 0) {\n\t\t\treturn 1;\n\t\t}\n\t\tif (n % 3 == 1) {\n\t\t\treturn 0;\n\t\t} else {\n\t\t\treturn 2;\n\t\t}\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\ttry (Scanner scanner = new Scanner(System.in)) {\n\t\t\tint n = scanner.nextInt();\n\t\t\tint p = scanner.nextInt();\n\t\t\tSystem.out.println(new ShellGame().solve(n, p));\n\t\t}\n\t}\n\n\t\n}\n", "lang": "Java 8", "bug_code_uid": "fb9b43d968899147ad4cedeccc74753e", "src_uid": "7853e03d520cd71571a6079cdfc4c4b0", "apr_id": "93f57b507eb2ce701786a1e8e491df75", "difficulty": 1000, "tags": ["math", "constructive algorithms", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.7518796992481203, "equal_cnt": 13, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 7, "fix_ops_cnt": 13, "bug_source_code": "import java.io.InputStream;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n long x,y,a,b;\n InputStream inputStream = System.in;\n// OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n// PrintWriter out = new PrintWriter(outputStream); \n \n \n x=in.nextInt();\n y=in.nextInt();\n a=in.nextInt();\n b=in.nextInt();\n long count=0;\n long x_,y_;\n long xmin,xmax;\n x_=Math.max(x, y);\n y_=Math.min(x, y);\n if (x_%y_==0)count=(b-a)/x_;\n else{\n xmin=a/x_;\n if(a%x_>0)xmin++;\n xmax=b/x_;\n for(long i=xmin;(x_*i)<=b;i++){\n if (((i*x_)%y_==0))count++;\n }}\n \n System.out.println(count);\n\n\n }", "lang": "Java 7", "bug_code_uid": "26c9e6a48c14399b033b88232c3fac90", "src_uid": "c7aa8a95d5f8832015853cffa1374c48", "apr_id": "e0c1ef5fdcbc0e3c35d09b201dc50329", "difficulty": 1200, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.993, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*;\n\npublic class r589c {\n\tstatic final int MOD=1000000007;\n\tpublic static void main(String[] args) {\n\t\tScanner scan=new Scanner(System.in);\n\t\tint x=scan.nextInt();\n\t\tlong n=scan.nextLong();\n\t\tArrayList set=new ArrayList<>();\n\t\tfor(int i=2;i*i<=x;i++) {\n\t\t\tif(x%i==0) {\n\t\t\t\tset.add(i);\n\t\t\t\twhile(x%i==0) x/=i;\n\t\t\t}\n\t\t}\n\t\tset.add(x);\n\t\tlong res=1L;\n\t\tfor(int i=0;i sieveFactors(int n)\n\t{\n\t\tboolean[] composite = new boolean[n + 1];\n\t\tint cap = (int)Math.round(Math.sqrt(n));\n\n\t\tfor (int i = 2; i <= cap; i++)\n\t\t\tfor (int j = 2; i * j <= n; j++)\n\t\t\t\tcomposite[i * j] = true;\n\n\t\tArrayList primes = new ArrayList<>();\n\n\t\tfor (int i = 2; i <= cap; i++)\n\t\t\tif (!composite[i] && n % i == 0)\n\t\t\t\tprimes.add(i);\n\n\t\treturn primes;\n\t}\n\n\t\n\tpublic static void main(String[] args) throws ArithmeticException\n\t{\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint x = sc.nextInt();\n\t\tlong n = Long.parseLong(sc.next());\n\n\t\tArrayList factors = sieveFactors(x);\n\n\t\tBigInteger prod = BigInteger.ONE;\n\t\tBigInteger bigX = BigInteger.valueOf(x);\n\t\t// System.out.println(factors.toString());\n\n\t\tBigInteger m = new BigInteger(\"1000000007\");\n\n\t\tfor (int p = 0; p < factors.size(); p++)\n\t\t{\n\t\t\tlong div = factors.get(p);\n\t\t\tint k = 0;\n\n\t\t\twhile (div > 0 && div <= n)\n\t\t\t{\n\t\t\t\tk += n / div;\n\t\t\t\tdiv = div * factors.get(p);\n\t\t\t}\n\n\t\t\t// System.out.println(BigInteger.valueOf(factors.get(p)).pow(k));\n\t\t\tprod = prod.multiply(BigInteger.valueOf(factors.get(p)).pow(k));\n\t\t}\n\n\t\t// for (long i = 1; i <= n; i++)\n\t\t// {\t\n\t\t// \t// System.out.printf(\"dividing %d...\\n\", i);\n\n\t\t// \t// for (int p = 0; p < factors.size(); p++)\n\t\t// \t// {\n\t\t// \t// \tlong curr = i;\n\t\t// \t// \twhile (curr >= factors.get(p) && curr % factors.get(p) == 0)\n\t\t// \t// \t{\n\t\t// \t// \t\t// System.out.printf(\"%d divisible by %d\\n\", i, factors.get(p));\n\t\t// \t// \t\tprod = prod.multiply(BigInteger.valueOf(factors.get(p)));\n\t\t// \t// \t\tcurr /= factors.get(p);\n\t\t// \t// \t}\n\t\t// \t// }\n\n\t\t\t// prod = prod.multiply(bigX.gcd(BigInteger.valueOf(i)));\n\t\t// }\n\n\t\t// System.out.println(prod.toString());\n\t\tSystem.out.println(prod.mod(m).toString());\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "6468cacfad41dbed27d8b270d78fbe0d", "src_uid": "04610fbaa746c083dda30e21fa6e1a0c", "apr_id": "c4cddbca6ca1e502e641e63662646422", "difficulty": 1700, "tags": ["math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9895052473763118, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "/**\n * ******* Created by K1K on 29/9/19 6:29 PM*******\n */\n\nimport java.io.*;\nimport java.util.*;\n\npublic class C1228 implements Runnable {\n List primes = new ArrayList<>();\n public static final int MAX =(int) (1E5+100);\n public static final int MOD =(int) (1E9+7);\n boolean[] flag = new boolean[MAX];\n private void solve() throws IOException {\n int x = reader.nextInt();\n long n = reader.nextLong();\n sieve();\n for(int i=0;i p = new ArrayList<>();\n int temp =x;\n for(int i=0;i0;i++){\n if(temp% primes.get(i)==0){\n while(temp >0 && temp%primes.get(i)==0)temp/=primes.get(i);\n p.add(primes.get(i));\n }\n }\n if(temp>0)p.add(temp);\n if(p.size() ==0){\n System.out.println(\"0\");\n return;\n }\n long ans =1;\n for(int i=0;i0){\n long tem = t/p1;\n long val =power(p.get(i),tem)%MOD;\n ans = (ans * val) %MOD;\n t/=p.get(i);\n }\n }\n System.out.println(ans);\n }\n\n private long power(long a, long b) {\n long res =1;\n while(b>0){\n if(b%2 ==1)res =(res*a)%MOD;\n a= (a*a)%MOD;\n b/=2;\n }\n return res;\n }\n\n private void sieve() {\n flag[0] = true;\n flag[1]=true;\n for(int i=2;i*i listOfPrimes = new ArrayList<>();\n int r = n*1;\n for (int i=2;i<=Math.sqrt(n);i++) {\n if (r == 1) {\n break;\n }\n if (r % i == 0) {\n listOfPrimes.add(i);\n }\n int t = 0;\n while(r % i == 0) {\n t+=1;\n r/=i;\n }\n }\n if (r>1) {\n listOfPrimes.add(r);\n }\n long g = sc.nextInt();\n long ans = 1;\n for (int i=0;ig) {\n break;\n }\n long l = listOfPrimes.get(i);\n for (int j=1;j<62;j++) {\n long ok = g/l;\n ans*=fastPow(listOfPrimes.get(i),(ok % 1000000006),1000000007);\n ans%=1000000007;\n if (g/listOfPrimes.get(i) prime_factors = prime_factors(x);\n\t\tlong ans = 1;\n\t\t\n\t\tfor(int val: prime_factors) {\n\t\t\tint prime = val;\n\t\t\tlong count = 0;\n\t\t\tlong times = n / prime;\n\t\t\t\n\t\t\twhile(times > 0) {\n\t\t\t\tcount += times;\n\t\t\t\ttimes = times / prime;\n\t\t\t}\n\t\t\t\n\t\t\tcount = count % (mod - 1);\n\t\t\tans = ans * pow(prime, count);\n\t\t}\n\t\t\n\t\tans = ans % mod;\n\t\tSystem.out.println(ans);\n\t\t\n\t}\n\t\n\tpublic static long pow(int base, long exp) {\n\t\tif(exp == 0) {\n\t\t\treturn 1;\n\t\t}\n\t\t\n\t\tlong ans = pow(base, exp / 2);\n\t\tans = ans % mod;\n\t\t\n\t\tans = ans * ans;\n\t\tans = ans % mod;\n\t\t\n\t\tif(exp % 2 == 1) {\n\t\t\tans = ans * base;\n\t\t\tans = ans % mod;\n\t\t}\n\t\t\n\t\treturn ans;\n\t}\n\t\n\tpublic static ArrayList prime_factors(int x){\n\t\tboolean bool[] = new boolean[x+1];\n\t\tbool[0] = bool[1] = true;\n\t\tfor(int i=2;i<=x;i++) {\n\t\t\tif(!bool[i]) {\n\t\t\t\tint j = 2;\n\t\t\t\twhile(i * j <= x) {\n\t\t\t\t\tbool[i * j] = true;\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tArrayList arr = new ArrayList<>();\n\t\tfor(int i=2;i<=x;i++) {\n\t\t\tif(!bool[i] && x % i == 0) {\n\t\t\t\tarr.add(i);\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn arr;\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "8eb346edb0dc761ed50894ac15efed38", "src_uid": "04610fbaa746c083dda30e21fa6e1a0c", "apr_id": "fca14294e25b327682cd93999c73af2e", "difficulty": 1700, "tags": ["math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9980674253811467, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.PrintWriter;\nimport java.math.BigInteger;\nimport java.util.ArrayDeque;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class C_big {\n static boolean isPrime[];\n static int primes[];\n\n public static void main(String[] args) throws Exception {\n Scanner in = new Scanner(System.in);\n PrintWriter pw = new PrintWriter(System.out);\n sieve((int) 1e5);\n int x = in.nextInt();\n long n = in.nextLong();\n ArrayDeque pf = primeFactors(x);\n long ans = 1, mod = (long) 1e9 + 7;\n BigInteger N = BigInteger.valueOf(n);\n for (int p : pf) {\n BigInteger P = BigInteger.valueOf(p);\n for (BigInteger i = P; i.compareTo(N) <= 0; i = i.multiply(P)) {\n long d = n / i.longValue();\n ans = (ans * bigMod(p, d, mod)) % mod;\n }\n }\n\n pw.println(ans);\n\n pw.close();\n }\n\n static long bigMod(long a, long p, long m) { // returns (a^p) % m\n long res = 1 % m, x = a % m;\n while (p > 0) {\n if ((p & 1) > 0) res = (res * x) % m;\n x = (x * x) % m;\n p >>= 1;\n }\n return res;\n }\n\n static ArrayDeque primeFactors(int n) {\n ArrayDeque pf = new ArrayDeque<>();\n for (int p : primes) {\n if (n <= 1) break;\n if (n % p == 0) {\n pf.addLast(p);\n while (n % p == 0) n /= p;\n }\n }\n if (n > 1) pf.addLast(n);\n return pf;\n }\n\n static int[] sieve(int n) {\n isPrime = new boolean[n + 1];\n Arrays.fill(isPrime, true);\n isPrime[0] = isPrime[1] = false;\n for (int i = 4; i <= n; i += 2) isPrime[i] = false;\n for (int i = 3; i * i <= n; i += 2) {\n if (isPrime[i]) {\n for (int j = i * i; j <= n; j += 2 * i)\n isPrime[j] = false;\n }\n }\n primes = new int[n + 1];\n int idx = 0;\n primes[idx++] = 2;\n for (int i = 3; i <= n; i += 2) {\n if (isPrime[i]) {\n primes[idx++] = i;\n }\n }\n return Arrays.copyOf(primes, idx);\n }\n\n static void debug(Object... obj) {\n System.err.println(Arrays.deepToString(obj));\n }\n}", "lang": "Java 8", "bug_code_uid": "a105f865ee9f9a7baffcf97ef4357daa", "src_uid": "04610fbaa746c083dda30e21fa6e1a0c", "apr_id": "3fd9ac362c2eb5f17bb2a06394a228f8", "difficulty": 1700, "tags": ["math", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9820267686424474, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 4, "bug_source_code": "import java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\t\n\tpublic static void main(String[] args)\n\t{\n\t\tScanner s=new Scanner(System.in);\n\t\t\n\t\tlong m=1000000007;\n\t\t\n\t\tlong x=s.nextLong();\n\t\tlong n=s.nextLong();\n\t\t\n\t\tboolean[] prime=new boolean[500001];\n\t\t\n\t\tseive(prime,500000);\n\t\t\n\t\tArrayList list=new ArrayList<>();\n\t\t\n\t\tfor(long i=2;i<=500000;i++)\n\t\t{\n\t\t\tif(prime[(int)i]&&x%i==0)\n\t\t\t{\n\t\t\t\tlist.add(i);\n\t\t\t\tx=x/i;\n\t\t\t}\n\t\t}\n\t\t\n\t\tlist.add(x);\n\t\t\n\t\t//System.out.println(list);\n\t\t\n\t\tlong ans=1;\n\t\t\n\t\t\n\t\t\n\t\tfor(int i=0;i0)\n\t\t{\n\t\t\tif(b%2!=0)\n\t\t\t{\n\t\t\t\tres=(res%m*a%m)%m;\n\t\t\t}\n\t\t\t\n\t\t\tb=b/2;\n\t\t\ta=(a%m*a%m)%m;\n\t\t}\n\t\t\n\t\treturn res;\n\t}\n\t\n\tpublic static void seive(boolean[] prime,int n)\n\t{\n\t\tArrays.fill(prime,true);\n\t\t\n\t\tprime[0]=false;\n\t\tprime[1]=false;\n\t\t\n\t\tfor(int i=2;i<=Math.sqrt(n);i++)\n\t\t{\n\t\t\tif(prime[i])\n\t\t\t{\n\t\t\t\tfor(int j=i*i;j<=n;j=j+i)\n\t\t\t\t{\n\t\t\t\t\tprime[j]=false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n}", "lang": "Java 8", "bug_code_uid": "77a25624de5860f36a82dfbec3eff373", "src_uid": "04610fbaa746c083dda30e21fa6e1a0c", "apr_id": "887fa431badd03a38ffd7e8b3272f22e", "difficulty": 1700, "tags": ["math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.10357904716757525, "equal_cnt": 61, "replace_cnt": 44, "delete_cnt": 8, "insert_cnt": 9, "fix_ops_cnt": 61, "bug_source_code": "import java.nio.charset.IllegalCharsetNameException;\nimport java.util.*;\nimport java.lang.*;\nimport java.io.*;\n\n/* Name of the class has to be \"Main\" only if the class is public. */\n\npublic class Codeforces {\n public static HashMap primeMap(long n)\n {\n HashMap prime_set=new HashMap<>();\n // Prlong the number of 2s that divide n\n while (n%2==0)\n {\n if(prime_set.containsKey(2L)) {\n prime_set.replace(2L, prime_set.get(2L), prime_set.get(2L) + 1);\n }else\n {\n prime_set.put(2L,1);\n }\n n /= 2;\n }\n\n // n must be odd at this polong. So we can\n // skip one element (Note i = i +2)\n for (int i = 3; i <= Math.sqrt(n); i+= 2)\n {\n // While i divides n, prlong i and divide n\n while (n%i == 0)\n {\n if(prime_set.containsKey((long)i))\n {\n prime_set.replace((long)i,prime_set.get((long)i),prime_set.get((long)i)+1);\n }\n else {\n prime_set.put((long) i,1);\n }\n n /= i;\n }\n }\n\n // This condition is to handle the case whien\n // n is a prime number greater than 2\n if (n > 2)\n if(prime_set.containsKey(n))\n {\n prime_set.replace(n,prime_set.get(n),prime_set.get(n)+1);\n }\n else {\n prime_set.put(n,1);\n }\n return prime_set;\n }\n static long calc_g(long x,long p)\n {\n long i=0;\n int count=0;\n while(x%p==0)\n {\n x/=p;\n count++;\n }\n\n return (long) Math.pow(p,count);\n }\n static long calc_f(long x,long n)\n {\n long prod=1;\n HashSet prime_set=primeFactors(x);\n for (long i=2;i<=n;i++)\n {\n// long min_prod=1;\n// for (long val : prime_set) {\n// min_prod *= calc_g(i, val);\n// }\n\n long min_prod=1;\n HashMap map=primeMap(i);\n for(Long l:map.keySet())\n {\n if(prime_set.contains(l))\n {\n min_prod*=Math.pow(l,map.get(l));\n }\n }\n min_prod%=1000000007;\n prod*=min_prod;\n prod%=1000000007;\n }\n\n return prod;\n }\n public static HashSet primeFactors(long n)\n {\n HashSet prime_set=new HashSet<>();\n // Prlong the number of 2s that divide n\n while (n%2==0)\n {\n prime_set.add(2L);\n n /= 2;\n }\n\n // n must be odd at this polong. So we can\n // skip one element (Note i = i +2)\n for (int i = 3; i <= Math.sqrt(n); i+= 2)\n {\n // While i divides n, prlong i and divide n\n while (n%i == 0)\n {\n prime_set.add((long)i);\n n /= i;\n }\n }\n\n // This condition is to handle the case whien\n // n is a prime number greater than 2\n if (n > 2)\n prime_set.add(n);\n return prime_set;\n }\n public static void main(String[] args) throws java.lang.Exception {\n // your code goes here\n BufferedReader s = new BufferedReader(new InputStreamReader(System.in));\n String line = s.readLine();\n String[] vals = line.split(\" \");\n long x=Long.parseLong(vals[0]);\n long n=Long.parseLong(vals[1]);\n System.out.println(calc_f(x,n));\n }\n}", "lang": "Java 8", "bug_code_uid": "dbbe94c5cfff46eb437515282da121d2", "src_uid": "04610fbaa746c083dda30e21fa6e1a0c", "apr_id": "53e268fe7b932fffcc0476f16a397956", "difficulty": 1700, "tags": ["math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8850393700787401, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int a = scanner.nextInt();\n int b = scanner.nextInt();\n int c = scanner.nextInt();\n System.out.print(7 * (Math.min(a, b/2, c/4)));\n }\n}", "lang": "Java 11", "bug_code_uid": "1836818594f802498ae9586d41cc8b19", "src_uid": "82a4a60eac90765fb62f2a77d2305c01", "apr_id": "f3858d111f897e6eb7f9b28fc4b9023b", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7671165036523462, "equal_cnt": 28, "replace_cnt": 19, "delete_cnt": 2, "insert_cnt": 6, "fix_ops_cnt": 27, "bug_source_code": "//package round243;\nimport java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.InputMismatchException;\n\npublic class E2 {\n\tInputStream is;\n\tPrintWriter out;\n\tString INPUT = \"\";\n\t\n\tint mod = 1000000007;\n\tlong BIG = (long)mod<<32;\n\t\n\tvoid solve()\n\t{\n\t\tint n = ni(), K = ni();\n\t\tlong[][] dp = new long[n+1][K+1]; // [pos][maxchain]\n\t\tlong[] two = new long[501];\n\t\ttwo[0] = 1;\n\t\tfor(int i = 1;i < 501;i++){\n\t\t\ttwo[i] = two[i-1] * 2;\n\t\t\tif(two[i] >= mod)two[i] -= mod;\n\t\t}\n\t\tdp[0][0] = 1;\n\t\tfor(int j = 1;j <= n;j++){\n\t\t\tfor(int k = K;k >= 0;k--){\n\t\t\t\t// k->k+1\n\t\t\t\tlong all = dp[j-1][k] * two[j]%mod;\n//\t\t\t\tlong all = dp[j-1][k]*pow(2, j, mod)%mod;\n\t\t\t\tlong plus = 0;\n\t\t\t\tfor(int i = 1;i < j;i++){ // add[i,j]\n//\t\t\t\t\tplus += (dp[i][k]-dp[i-1][k]+mod)*(pow(2, j, mod)-pow(2, i, mod)+mod)%mod;\n\t\t\t\t\tplus += (dp[i][k]-dp[i-1][k]+mod)*(two[j]-two[i]+mod);\n\t\t\t\t\tif(plus >= BIG)plus -= BIG;\n\t\t\t\t}\n//\t\t\t\tplus += (dp[0][k])*(pow(2, j, mod)+mod-1)%mod;\n\t\t\t\tplus += (dp[0][k])*(two[j]+mod-1);\n\t\t\t\tplus %= mod;\n//\t\t\t\ttr(j,k,all,plus);\n\t\t\t\tall = (all-plus + mod)%mod;\n\t\t\t\tdp[j-1][k] = all;\n\t\t\t\tdp[j][k] += all;\n\t\t\t\tif(dp[j][k] >= mod)dp[j][k] -= mod;\n\t\t\t\tif(k+1 <= K){\n\t\t\t\t\tdp[j][k+1] += plus;\n\t\t\t\t\tif(dp[j][k+1] >= mod)dp[j][k+1] -= mod;\n\t\t\t\t}\n\t\t\t}\n//\t\t\tfor(int i = 0;i <= n;i++){\n//\t\t\t\ttr(dp[i]);\n//\t\t\t}\n//\t\t\ttr();\n\t\t}\n\t\tout.println(dp[n][K]);\n\t}\n\t\n\tpublic static long pow(long a, long n, long mod) {\n\t\t//\t\ta %= mod;\n\t\tlong ret = 1;\n\t\tint x = 63 - Long.numberOfLeadingZeros(n);\n\t\tfor(;x >= 0;x--){\n\t\t\tret = ret * ret % mod;\n\t\t\tif(n << 63 - x < 0)\n\t\t\t\tret = ret * a % mod;\n\t\t}\n\t\treturn ret;\n\t}\n\t\n\tvoid run() throws Exception\n\t{\n\t\tis = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n\t\tout = new PrintWriter(System.out);\n\t\t\n\t\tlong s = System.currentTimeMillis();\n\t\tsolve();\n\t\tout.flush();\n\t\ttr(System.currentTimeMillis()-s+\"ms\");\n\t}\n\t\n\tpublic static void main(String[] args) throws Exception { new E2().run(); }\n\t\n\tprivate byte[] inbuf = new byte[1024];\n\tprivate int lenbuf = 0, ptrbuf = 0;\n\t\n\tprivate int readByte()\n\t{\n\t\tif(lenbuf == -1)throw new InputMismatchException();\n\t\tif(ptrbuf >= lenbuf){\n\t\t\tptrbuf = 0;\n\t\t\ttry { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }\n\t\t\tif(lenbuf <= 0)return -1;\n\t\t}\n\t\treturn inbuf[ptrbuf++];\n\t}\n\t\n\tprivate boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }\n\tprivate int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }\n\t\n\tprivate double nd() { return Double.parseDouble(ns()); }\n\tprivate char nc() { return (char)skip(); }\n\t\n\tprivate String ns()\n\t{\n\t\tint b = skip();\n\t\tStringBuilder sb = new StringBuilder();\n\t\twhile(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\t\n\tprivate char[] ns(int n)\n\t{\n\t\tchar[] buf = new char[n];\n\t\tint b = skip(), p = 0;\n\t\twhile(p < n && !(isSpaceChar(b))){\n\t\t\tbuf[p++] = (char)b;\n\t\t\tb = readByte();\n\t\t}\n\t\treturn n == p ? buf : Arrays.copyOf(buf, p);\n\t}\n\t\n\tprivate char[][] nm(int n, int m)\n\t{\n\t\tchar[][] map = new char[n][];\n\t\tfor(int i = 0;i < n;i++)map[i] = ns(m);\n\t\treturn map;\n\t}\n\t\n\tprivate int[] na(int n)\n\t{\n\t\tint[] a = new int[n];\n\t\tfor(int i = 0;i < n;i++)a[i] = ni();\n\t\treturn a;\n\t}\n\t\n\tprivate int ni()\n\t{\n\t\tint num = 0, b;\n\t\tboolean minus = false;\n\t\twhile((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));\n\t\tif(b == '-'){\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\t\n\t\twhile(true){\n\t\t\tif(b >= '0' && b <= '9'){\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t}else{\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\t\n\tprivate long nl()\n\t{\n\t\tlong num = 0;\n\t\tint b;\n\t\tboolean minus = false;\n\t\twhile((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));\n\t\tif(b == '-'){\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\t\n\t\twhile(true){\n\t\t\tif(b >= '0' && b <= '9'){\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t}else{\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\t\n\tprivate boolean oj = System.getProperty(\"ONLINE_JUDGE\") != null;\n\tprivate void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }\n}\n", "lang": "Java 7", "bug_code_uid": "124bcc881c7c7c8b1d71b8e222c92359", "src_uid": "111673158df2e37ac6c019bb99225ccb", "apr_id": "0ff4a2553b946d29a0fd5dc51a676040", "difficulty": 2500, "tags": ["dp"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8557171126215263, "equal_cnt": 21, "replace_cnt": 2, "delete_cnt": 12, "insert_cnt": 6, "fix_ops_cnt": 20, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Problem {\n\n class Rib {\n Vertex to;\n int capacity, weight, flow;\n Rib invert, next;\n\n Rib(Vertex to, int capacity, int weight) {\n this.to = to;\n this.capacity = capacity;\n this.weight = weight;\n this.flow = 0;\n next = null;\n }\n }\n\n class Vertex {\n Rib last;\n int phi, dist;\n int flow;\n boolean used;\n Rib way;\n\n Vertex() {\n last = null;\n phi = dist = 0;\n flow = 0;\n used = false;\n way = null;\n }\n }\n\n\n Scanner in = new Scanner(System.in);\n PrintWriter out = new PrintWriter(System.out);\n\n int minCostMaxFlow(Vertex[] g) {\n int n = g.length - 2;\n Vertex s, t;\n int cost = 0;\n\n while (true) {\n s = g[n];\n t = g[n + 1];\n dejkstra(g, s);\n if (t.way == null) break;\n int df = t.flow;\n// out.println(\"(\" + t.dist + \"-(\" + s.phi + \"-\" + t.phi + \"))*\" + t.flow);\n cost += (t.dist - (s.phi - t.phi)) * t.flow;\n while (t.way != null) {\n t.way.flow += df;\n t.way.invert.flow -= df;\n t = t.way.invert.to;\n }\n }\n\n return cost;\n }\n\n// void outVertex(Vertex v, Vertex[] g, Vertex s, Vertex t) {\n// if (v == s) out.print(\"s\"); else\n// if (v == t) out.print(\"t\"); else\n// for (int i = 0; i < g.length; i++) {\n// if (v == g[i]) out.print(i);\n// }\n// out.flush();\n// }\n int goCnt = 0;\n\n void dejkstra(Vertex[] g, Vertex s) {\n for (Vertex v : g) {\n v.way = null;\n v.phi += v.dist;\n v.dist = g.length * g.length;\n v.used = false;\n }\n s.flow = g.length * g.length;\n class GoInfo {\n int dist;\n Rib rib;\n Vertex vertex;\n int ind;\n\n GoInfo(int dist, Vertex vertex, Rib rib, int ind) {\n this.dist = dist;\n this.vertex = vertex;\n this.rib = rib;\n this.ind = ind;\n }\n }\n class GoComp implements Comparator {\n public int compare(GoInfo a, GoInfo b) {\n if (a.dist == b.dist) {\n return a.ind - b.ind;\n }\n return a.dist - b.dist;\n }\n }\n TreeSet q = new TreeSet(new GoComp());\n// SortedSet q = Collections.synchronizedSortedSet(treeSet);\n q.add(new GoInfo(0, s, null, goCnt++));\n while (!q.isEmpty()) {\n GoInfo info = q.first();\n q.remove(info);\n Vertex v = info.vertex;\n if (v.used) continue;\n\n\n v.dist = info.dist;\n v.way = info.rib;\n v.used = true;\n if (info.rib != null) v.flow = Math.min(info.rib.invert.to.flow, info.rib.capacity - info.rib.flow);\n for (Rib rib = v.last; rib != null; rib = rib.next) {\n if (rib.flow == rib.capacity) continue;\n q.add(new GoInfo(v.dist + rib.weight + (v.phi - rib.to.phi), rib.to, rib, goCnt++));\n// out.print(v.dist + \" [\");\n// outVertex(v, g, s, t);\n// out.print(\" \");\n// outVertex(rib.to, g, s, t);\n// out.println(\"]\");\n }\n }\n// out.println(\"\\n\");\n }\n\n void addRib(Vertex from, Vertex to, int capacity, int weight) {\n Rib direct = new Rib(to, capacity, weight);\n Rib invert = new Rib(from, 0, weight);\n direct.invert = invert;\n invert.invert = direct;\n direct.next = from.last;\n from.last = direct;\n invert.next = to.last;\n to.last = invert;\n }\n\n boolean inRange(int x, int min, int max) {\n return x >= min && x <= max;\n }\n\n Vertex[] readAndMakeGraph() {\n int n = in.nextInt();\n int m = in.nextInt();\n int[][] a = new int[n][m];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n a[i][j] = in.nextInt();\n }\n }\n Vertex[] v = new Vertex[n * m + 2];\n for (int i = 0; i < n * m + 2; i++) v[i] = new Vertex();\n Vertex s = v[n * m];\n Vertex t = v[n * m + 1];\n for (int i = 0; i < n; i++) {\n for (int j = i % 2; j < m; j += 2) {\n for (int dx = -1; dx <= 1; dx++) {\n for (int dy = -1; dy <= 1; dy++) {\n if (Math.abs(dx) + Math.abs(dy) == 1) {\n int ni = i + dx;\n int nj = j + dy;\n if (inRange(ni, 0, n - 1) && inRange(nj, 0, m - 1)) {\n addRib(v[i * m + j], v[ni * m + nj], 1, (a[i][j] == a[ni][nj]? 0 : 1));\n }\n }\n }\n }\n }\n }\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n if ((i + j) % 2 == 0) {\n addRib(s, v[i * m + j], 1, 0);\n } else {\n addRib(v[i * m + j], t, 1, 0);\n }\n }\n }\n\n return v;\n }\n\n void solve() {\n out.print(minCostMaxFlow(readAndMakeGraph()));\n out.close();\n }\n\n public static void main(String[] args) {\n (new Problem()).solve();\n }\n}\n", "lang": "Java 7", "bug_code_uid": "2099f5d7fc6729f1f70b3c3578d23f0f", "src_uid": "1f0e8bbd5bf4fcdea927fbb505a8949b", "apr_id": "cc0496256d16c044363651bb8c498992", "difficulty": 2200, "tags": ["flows"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9993553470381777, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\n\n/**\n * @author pashka\n */\npublic class Main {\n\n\n private void solve() throws IOException {\n int n = nextInt();\n int m = nextInt();\n int[][] a = new int[n][m];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n a[i][j] = nextInt();\n }\n }\n init(n * m + 2, n * m * 6);\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n int c = i * n + j;\n if ((i + j) % 2 == 0) {\n addEdge(0, 2 + c, 1, 0);\n } else {\n addEdge(2 + c, 1, 1, 0);\n }\n if (i < n - 1) {\n int cost = 0;\n if (a[i][j] != a[i + 1][j]) cost = 1;\n addEdge(2 + c, 2 + c + n, 1, cost);\n addEdge(2 + c + n, 2 + c, 1, cost);\n }\n if (j < m - 1) {\n int cost = 0;\n if (a[i][j] != a[i][j + 1]) cost = 1;\n addEdge(2 + c, 2 + c + 1, 1, cost);\n addEdge(2 + c + 1, 2 + c, 1, cost);\n }\n }\n }\n long res = minCostMaxFlow(0, 1);\n out.println(res);\n }\n\n private BufferedReader br;\n private PrintWriter out;\n private StringTokenizer st;\n\n String next() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return st.nextToken();\n }\n\n int nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n\n long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n\n public static void main(String[] args) throws IOException {\n new Main().run();\n }\n\n private void run() throws IOException {\n br = new BufferedReader(new InputStreamReader(System.in));\n// br = new BufferedReader(new FileReader(\"input.txt\"));\n out = new PrintWriter(System.out);\n solve();\n out.close();\n }\n\n\n\n\n void init(int n, int m) {\n m *= 2;\n this.n = n;\n this.m = m;\n last = 0;\n head = new int[n];\n nx = new int[m];\n dst = new int[m];\n src = new int[m];\n cp = new int[m];\n ct = new long[m];\n fl = new int[m];\n prev = new int[n];\n heap = new int[n];\n heapRev = new int[n];\n d = new long[n];\n bestDist = new long[n];\n for (int i = 0; i < n; i++) {\n heap[i] = i;\n heapRev[i] = i;\n }\n Arrays.fill(head, -1);\n }\n\n void addEdge(int x, int y, int capacity, int cost) {\n nx[last] = head[x];\n src[last] = x;\n dst[last] = y;\n cp[last] = capacity;\n ct[last] = cost;\n head[x] = last;\n last++;\n nx[last] = head[y];\n src[last] = y;\n dst[last] = x;\n cp[last] = 0;\n ct[last] = -cost;\n head[y] = last;\n last++;\n }\n\n // Returns the total cost. Max flow value will be in field maxFlow.\n long minCostMaxFlow(int s, int t) {\n for (int i = 0; i < n; i++) {\n d[i] = INF;\n }\n d[s] = 0;\n boolean ok = false;\n while (!ok) {\n ok = true;\n for (int j = 0; j < m; j++)\n if (fl[j] < cp[j]) {\n int x = src[j];\n int y = dst[j];\n if (d[x] < INF) {\n if (d[y] > d[x] + ct[j]) {\n d[y] = d[x] + ct[j];\n ok = false;\n }\n }\n }\n }\n long res = 0;\n maxFlow = 0;\n while (true) {\n dijkstra(s);\n if (bestDist[t] == INF) break;\n {\n int i = t;\n int f = Integer.MAX_VALUE;\n while (i != s) {\n int e = prev[i];\n f = Math.min(f, cp[e] - fl[e]);\n i = src[e];\n }\n if (f < 0) throw new RuntimeException();\n maxFlow += f;\n i = t;\n while (i != s) {\n int e = prev[i];\n fl[e] += f;\n fl[e ^ 1] -= f;\n if (fl[e] > cp[e]) throw new RuntimeException();\n res += ct[e] * f;\n i = src[e];\n }\n }\n for (int i = 0; i < n; i++) {\n d[i] += bestDist[i];\n }\n }\n return res;\n }\n\n private static final long INF = Long.MAX_VALUE;\n\n int n, m;\n int[] head;\n int[] nx;\n int[] src;\n int[] dst;\n int[] cp;\n long[] ct;\n int[] fl;\n int last;\n\n long[] d;\n long[] bestDist;\n int[] prev;\n int[] heap;\n int[] heapRev;\n int heapSize;\n long maxFlow;\n\n private void dijkstra(int start) {\n Arrays.fill(bestDist, INF);\n heapSize = n;\n bestDist[start] = 0;\n siftUp(heapRev[start]);\n for (int i = 0; i < n; i++) {\n int x = removeMin();\n if (bestDist[x] == INF) {\n break;\n }\n int j = head[x];\n while (j >= 0) {\n if (fl[j] < cp[j]) {\n int y = dst[j];\n long d = ct[j] + this.d[x] - this.d[y];\n if (d < 0) {\n throw new AssertionError(\"negative edge\");\n }\n long ll = bestDist[x] + d;\n if (bestDist[y] > ll) {\n prev[y] = j;\n bestDist[y] = ll;\n siftUp(heapRev[y]);\n }\n }\n j = nx[j];\n }\n }\n }\n\n private void siftUp(int i) {\n while (i > 0 && bestDist[heap[(i - 1) / 2]] > bestDist[heap[i]]) {\n swap(i, (i - 1) / 2);\n i = (i - 1) / 2;\n }\n }\n\n private int removeMin() {\n int res = heap[0];\n swap(0, heapSize - 1);\n heapSize--;\n int i = 0;\n while (2 * i + 1 < heapSize) {\n int j = i;\n if (bestDist[heap[2 * i + 1]] < bestDist[heap[j]]) {\n j = 2 * i + 1;\n }\n if (2 * i + 2 < heapSize && bestDist[heap[2 * i + 2]] < bestDist[heap[j]]) {\n j = 2 * i + 2;\n }\n if (i == j) break;\n swap(i, j);\n i = j;\n }\n return res;\n }\n\n private void swap(int i, int j) {\n int t = heap[i];\n heap[i] = heap[j];\n heap[j] = t;\n heapRev[heap[i]] = i;\n heapRev[heap[j]] = j;\n }}\n", "lang": "Java 7", "bug_code_uid": "67639ae93f2df0b5ff76c182f8b39667", "src_uid": "1f0e8bbd5bf4fcdea927fbb505a8949b", "apr_id": "8688547f2f4bf225a28323aaaafa8978", "difficulty": 2200, "tags": ["flows"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9886994041504007, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 4, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*;\nimport java.io.*;\nimport java.math.*;\nimport java.awt.geom.*;\n\nimport static java.lang.Math.*;\n\npublic class Solution implements Runnable {\n\t\n\tclass Edge {\n\t\t\n\t\tint to, capacity, cost;\n\t\tint flow = 0;\n\t\tEdge compl = null;\n\t\t\n\t\tpublic Edge(int to, int capacity, int cost) {\n\t\t\tthis.to = to;\n\t\t\tthis.capacity = capacity;\n\t\t\tthis.cost = cost;\n\t\t}\n\t\t\n\t}\n\t\n\tint n, m;\n\tEdge[][] graph;\n\tint[] size;\n\t\n\tvoid addEdge(int from, int to, int cost) {\n\t\tEdge e1 = new Edge(to, 1, cost);\n\t\tEdge e2 = new Edge(from, 0, -cost);\n\t\te1.compl = e2;\n\t\te2.compl = e1;\n\t\tgraph[from][size[from]++] = e1;\n\t\tgraph[to][size[to]++] = e2;\n\t}\n\t\n\tboolean inBounds(int i, int j) {\n\t\treturn i >= 0 && i < n && j >= 0 && j < m;\n\t}\n\t\n\tint getIndex(int i, int j) {\n\t\treturn i * m + j;\n\t}\n\t\n\tvoid randomShuffle(int[] arr) {\n\t\tRandom rnd = new Random();\n\t\tfor (int i = arr.length - 1; i >= 0; i--) {\n\t\t\tint pos = rnd.nextInt(i + 1);\n\t\t\tint temp = arr[pos];\n\t\t\tarr[pos] = arr[i];\n\t\t\tarr[i] = temp;\n\t\t}\n\t}\n\t\n\tpublic void solve() throws Exception {\n\t\tn = sc.nextInt();\n\t\tm = sc.nextInt();\n\t\tint[][] field = new int[n][m];\n\t\t\n\t\tint[] arr = new int[n * m];\n\t\tfor (int i = 0; i < n * m; i += 2) {\n\t\t\tarr[i] = arr[i + 1] = i / 2 + 1;\n\t\t}\n\t\t\n\t\trandomShuffle(arr);\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tfor (int j = 0; j < m; j++) {\n\t\t\t\t//field[i][j] = sc.nextInt();\n\t\t\t\tfield[i][j] = arr[getIndex(i, j)];\n\t\t\t\tout.print(field[i][j] + \" \");\n\t\t\t}\n\t\t\tout.println();\n\t\t}\n\t\tout.println();\n\t\tgraph = new Edge[n * m + 2][20];\n\t\tsize = new int[n * m + 2];\n\t\tint source = n * m;\n\t\tint sink = n * m + 1;\n\t\tgraph[source] = new Edge[n * m];\n\t\tgraph[sink] = new Edge[n * m];\n\t\tint gsize = n * m + 2;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tfor (int j = 0; j < m; j++) {\n\t\t\t\tif ((i + j) % 2 == 0) {\n\t\t\t\t\taddEdge(source, getIndex(i, j), 0);\n\t\t\t\t\tif (inBounds(i - 1, j)) {\n\t\t\t\t\t\tif (field[i - 1][j] == field[i][j]) {\n\t\t\t\t\t\t\taddEdge(getIndex(i, j), getIndex(i - 1, j), 0);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\taddEdge(getIndex(i, j), getIndex(i - 1, j), 1);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (inBounds(i + 1, j)) {\n\t\t\t\t\t\tif (field[i + 1][j] == field[i][j]) {\n\t\t\t\t\t\t\taddEdge(getIndex(i, j), getIndex(i + 1, j), 0);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\taddEdge(getIndex(i, j), getIndex(i + 1, j), 1);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (inBounds(i, j - 1)) {\n\t\t\t\t\t\tif (field[i][j - 1] == field[i][j]) {\n\t\t\t\t\t\t\taddEdge(getIndex(i, j), getIndex(i, j - 1), 0);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\taddEdge(getIndex(i, j), getIndex(i, j - 1), 1);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (inBounds(i, j + 1)) {\n\t\t\t\t\t\tif (field[i][j + 1] == field[i][j]) {\n\t\t\t\t\t\t\taddEdge(getIndex(i, j), getIndex(i, j + 1), 0);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\taddEdge(getIndex(i, j), getIndex(i, j + 1), 1);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\taddEdge(getIndex(i, j), sink, 0);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\tint[] dist = new int[gsize];\n\t\tint[] from = new int[gsize];\n\t\tEdge[] byEdge = new Edge[gsize];\n\t\tDeque q = new ArrayDeque();\n\t\t\n\t\tint cost = 0;\n\t\tint flow = 0;\n\t\t\n\t\twhile (true) {\n\t\t\tArrays.fill(dist, Integer.MAX_VALUE / 4);\n\t\t\tq.clear();\n\t\t\tArrays.fill(from, -1);\n\t\t\tArrays.fill(byEdge, null);\n\t\t\tdist[source] = 0;\n\t\t\tq.offer(source);\n\t\t\twhile (!q.isEmpty()) {\n\t\t\t\tint v = q.poll();\n\t\t\t\tfor (int i = 0; i < size[v]; i++) {\n\t\t\t\t\tEdge e = graph[v][i];\n\t\t\t\t\tif (e.capacity - e.flow > 0 && dist[e.to] > dist[v] + e.cost) {\n\t\t\t\t\t\tdist[e.to] = dist[v] + e.cost;\n\t\t\t\t\t\tfrom[e.to] = v;\n\t\t\t\t\t\tbyEdge[e.to] = e;\n\t\t\t\t\t\tif (e.cost == 0) {\n\t\t\t\t\t\t\tq.offerFirst(e.to);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tq.offerLast(e.to);\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\tif (dist[sink] == Integer.MAX_VALUE / 4) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcost += dist[sink];\n\t\t\tflow++;\n\t\t\tint curv = sink;\n\t\t\twhile (from[curv] != -1) {\n\t\t\t\tEdge e = byEdge[curv];\n\t\t\t\tEdge compl = e.compl;\n\t\t\t\te.flow++;\n\t\t\t\tcompl.flow--;\n\t\t\t\tcurv = from[curv];\n\t\t\t}\n\t\t}\n\t\t\n\t\tout.println(cost);\n\t}\n\n\tstatic Throwable uncaught;\n\n\tBufferedReader in;\n\tFastScanner sc;\n\tPrintWriter out;\n\n\t@Override\n\tpublic void run() {\n\t\ttry {\n\t\t\tin = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tout = new PrintWriter(System.out);\n\t\t\tsc = new FastScanner(in);\n\t\t\tsolve();\n\t\t} catch (Throwable uncaught) {\n\t\t\tSolution.uncaught = uncaught;\n\t\t} finally {\n\t\t\tout.close();\n\t\t}\n\t}\n\n\tpublic static void main(String[] args) throws Throwable {\n\t\tThread thread = new Thread(null, new Solution(), \"\", (1 << 26));\n\t\tthread.start();\n\t\tthread.join();\n\t\tif (Solution.uncaught != null) {\n\t\t\tthrow Solution.uncaught;\n\t\t}\n\t}\n\n}\n\nclass FastScanner {\n\n\tBufferedReader in;\n\tStringTokenizer st;\n\n\tpublic FastScanner(BufferedReader in) {\n\t\tthis.in = in;\n\t}\n\n\tpublic String nextToken() throws Exception {\n\t\twhile (st == null || !st.hasMoreTokens()) {\n\t\t\tst = new StringTokenizer(in.readLine());\n\t\t}\n\t\treturn st.nextToken();\n\t}\n\n\tpublic int nextInt() throws Exception {\n\t\treturn Integer.parseInt(nextToken());\n\t}\n\n\tpublic long nextLong() throws Exception {\n\t\treturn Long.parseLong(nextToken());\n\t}\n\n\tpublic double nextDouble() throws Exception {\n\t\treturn Double.parseDouble(nextToken());\n\t}\n\n}", "lang": "Java 7", "bug_code_uid": "5a804e9463c7d4ff671a3aaa404990d3", "src_uid": "1f0e8bbd5bf4fcdea927fbb505a8949b", "apr_id": "012d9e78f827d5f656126216a8a6a734", "difficulty": 2200, "tags": ["flows"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8948989155174722, "equal_cnt": 14, "replace_cnt": 3, "delete_cnt": 5, "insert_cnt": 5, "fix_ops_cnt": 13, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class C {\n\n\tBufferedReader br;\n\tPrintWriter out;\n\tStringTokenizer st;\n\tboolean eof;\n\n\tint n, m;\n\n\tclass Edge {\n\t\tint to, flow, cap, cost;\n\t\tEdge rev;\n\n\t\tpublic Edge(int to, int cap, int cost) {\n\t\t\tthis.to = to;\n\t\t\tthis.cap = cap;\n\t\t\tthis.cost = cost;\n\t\t}\n\t}\n\n\tstatic final int[] dx = { -1, 0, 1, 0 };\n\tstatic final int[] dy = { 0, -1, 0, 1 };\n\tstatic final int INF = Integer.MAX_VALUE / 3;\n\n\tList[] g;\n\n\tvoid addEdge(int v1, int v2, int cost) {\n\t\tEdge e1 = new Edge(v2, 1, cost);\n\t\tEdge e2 = new Edge(v1, 0, -cost);\n\t\te1.rev = e2;\n\t\te2.rev = e1;\n\t\tg[v1].add(e1);\n\t\tg[v2].add(e2);\n\t}\n\n\tint S, T;\n\n\tvoid solve() throws IOException {\n\t\tn = nextInt();\n\t\tm = nextInt();\n\n\t\tint[][] f = new int[n][m];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tfor (int j = 0; j < m; j++)\n\t\t\t\tf[i][j] = nextInt();\n\n\t\tg = new ArrayList[n * m + 2];\n\t\tS = n * m;\n\t\tT = n * m + 1;\n\t\tfor (int i = 0; i < n * m; i++)\n\t\t\tg[i] = new ArrayList<>(4);\n\t\tg[S] = new ArrayList<>(n * m / 2);\n\t\tg[T] = new ArrayList<>(n * m / 2);\n\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tfor (int j = 0; j < m; j++) {\n\t\t\t\tint v = i * m + j;\n\t\t\t\tint col = (i + j) & 1;\n\t\t\t\tif (col == 0) {\n\t\t\t\t\taddEdge(S, v, 0);\n\t\t\t\t\tfor (int dir = 0; dir < 4; dir++) {\n\t\t\t\t\t\tint ni = i + dx[dir];\n\t\t\t\t\t\tint nj = j + dy[dir];\n\t\t\t\t\t\tif (ni >= 0 && ni < n && nj >= 0 && nj < m) {\n\t\t\t\t\t\t\tint to = ni * m + nj;\n\t\t\t\t\t\t\tint cost = (f[i][j] == f[ni][nj] ? 0 : 1);\n\t\t\t\t\t\t\taddEdge(v, to, cost);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\taddEdge(v, T, 0);\n\t\t\t\t}\n\t\t\t}\n\t\t\n\t\tint ans = 0;\n\t\tint[] pi = new int[n * m + 2];\n\t\t\n\t\tfinal int[] d = new int[n * m + 2];\n\t\tEdge[] from = new Edge[n * m + 2];\n\t\t\n\t\tInteger[] Integers = new Integer[n * m + 2];\n\t\tfor (int i = 0; i < n * m + 2; i++)\n\t\t\tIntegers[i] = i;\n\t\t\n\t\tTreeSet set = new TreeSet<>(new Comparator() {\n\n\t\t\t@Override\n\t\t\tpublic int compare(Integer o1, Integer o2) {\n\t\t\t\tif (d[o1] != d[o2])\n\t\t\t\t\treturn Integer.compare(d[o1], d[o2]);\n\t\t\t\treturn o1.compareTo(o2);\n\t\t\t}\n\t\t\t\n\t\t});\n\t\t\n\t\tList permLabeled = new ArrayList<>();\n\t\t\n\t\tfor (int iter = 0; iter < n * m / 2; iter++) {\n\t\t\t\n\t\t\tArrays.fill(d, INF);\n\t\t\td[S] = 0;\n\t\t\t\n\t\t\tfor (int i = 0; i < n * m + 2; i++)\n\t\t\t\tset.add(Integers[i]);\n\t\t\t\n\t\t\t\n\t\t\tpermLabeled.clear();\n\t\t\t\n\t\t\twhile (true) {\n\t\t\t\tint v = set.pollFirst();\n\t\t\t\t\n//\t\t\t\tSystem.err.println(v + \" \" + Arrays.toString(d));\n\t\t\t\t\n\t\t\t\tif (v == T) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tpermLabeled.add(Integers[v]);\n\t\t\t\t\n\t\t\t\tfor (int i = 0; i < g[v].size(); i++) {\n\t\t\t\t\tEdge e = g[v].get(i);\n\t\t\t\t\tif (e.flow < e.cap) {\n\t\t\t\t\t\tint redCost = e.cost - pi[v] + pi[e.to];\n\t\t\t\t\t\tif (d[e.to] > d[v] + redCost) {\n\t\t\t\t\t\t\tset.remove(Integers[e.to]);\n\t\t\t\t\t\t\tfrom[e.to] = e; \n\t\t\t\t\t\t\td[e.to] = d[v] + redCost;\n\t\t\t\t\t\t\tset.add(Integers[e.to]);\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\t\n\t\t\tfor (int i = 0; i < permLabeled.size(); i++) {\n\t\t\t\tint v = permLabeled.get(i);\n\t\t\t\tpi[v] = pi[v] - d[v] + d[T];\n\t\t\t}\n\t\t\t\n\t\t\tfor (int v = T; v != S; ) {\n\t\t\t\tEdge last = from[v];\n\t\t\t\tlast.flow++;\n\t\t\t\tlast.rev.flow--;\n\t\t\t\tans += last.cost;\n\t\t\t\tv = last.rev.to;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tout.println(ans);\n\n\t}\n\n\tC() throws IOException {\n\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\tout = new PrintWriter(System.out);\n\t\tsolve();\n\t\tout.close();\n\t}\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tnew C();\n\t}\n\n\tString nextToken() {\n\t\twhile (st == null || !st.hasMoreTokens()) {\n\t\t\ttry {\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t} catch (Exception e) {\n\t\t\t\teof = true;\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t\treturn st.nextToken();\n\t}\n\n\tString nextString() {\n\t\ttry {\n\t\t\treturn br.readLine();\n\t\t} catch (IOException e) {\n\t\t\teof = true;\n\t\t\treturn null;\n\t\t}\n\t}\n\n\tint nextInt() throws IOException {\n\t\treturn Integer.parseInt(nextToken());\n\t}\n\n\tlong nextLong() throws IOException {\n\t\treturn Long.parseLong(nextToken());\n\t}\n\n\tdouble nextDouble() throws IOException {\n\t\treturn Double.parseDouble(nextToken());\n\t}\n}", "lang": "Java 7", "bug_code_uid": "0c77f4307b2fa003a03f83c14e05caf0", "src_uid": "1f0e8bbd5bf4fcdea927fbb505a8949b", "apr_id": "71c73b8ff0eed910f5738abc7cf016ff", "difficulty": 2200, "tags": ["flows"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9915492957746479, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*;\n\npublic class Main\n{\n public static void main(String[] args)\n {\n int a,b,c,d;\n Scanner scn=new Scanner(System.in);\n a=scn.nextInt();\n b=scn.nextInt();\n c=scn.nextInt();\n d=scn.nextInt();\n \n int x,y,z;\n if(a==c&&b==d)\n x=0;\nelse if(a==c||b==d)\n x=1;\n else\n x=2;\nif(a==b&&b==c)\ny=0;\nelse if((a+b)%2==(c+d)%2)\n{\n if(Math.abs(c-a)==Math.abs(d-b))\n y=1;\n else\n y=2;\n}\nelse \ny=0;\n\nz=max(Math.abs(c-a),Math.abs(d-b));\nSystem.out.println(x+\" \"+y+\" \"+z);\n}\n}", "lang": "Java 11", "bug_code_uid": "d2efe58ca8d96b7d14b171a45b99700e", "src_uid": "7dbf58806db185f0fe70c00b60973f4b", "apr_id": "f8ba65c0689142c98944c2416d9618db", "difficulty": 1100, "tags": ["graphs", "math", "shortest paths"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9760559190957763, "equal_cnt": 18, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 7, "fix_ops_cnt": 17, "bug_source_code": "import java.io.*;\nimport java.math.BigInteger;\nimport java.util.*;\nimport java.util.concurrent.atomic.AtomicIntegerArray;\n\npublic class Solution {\n\n public static void main(String[] args) throws Exception {\n MyReader reader = new MyReader(System.in);\n// MyReader reader = new MyReader(new FileInputStream(\"input.txt\"));\n MyWriter writer = new MyWriter(System.out);\n new Solution().run(reader, writer);\n writer.close();\n }\n\n private void run(MyReader reader, MyWriter writer) throws Exception {\n long a = reader.nextInt();\n long b = reader.nextInt();\n long bb = b;\n int p = reader.nextInt();\n long x = reader.nextLong();\n long[] q = new long[p];\n long[] qq = new long[p];\n long[] aa = new long[p];\n q[0] = 1;\n for (int i = 1; i < p; i++) {\n q[i] = (q[i - 1] * a) % p;\n qq[i] = (q[i] * i) % p;\n aa[(int)qq[i]]++;\n }\n long ans = 0;\n for (int i = 0; i < x / p; i++) {\n ans += aa[(int)b];\n b = b * q[p - 2] % p;\n }\n long t = x / p * p;\n for (long i = t; i <= x; i++) {\n if (i * q[(int)(i - t)] % p == b) {\n ans++;\n }\n }\n System.out.println(ans);\n }\n\n static class MyReader {\n\n final BufferedInputStream in;\n final int bufSize = 1 << 16;\n final byte buf[] = new byte[bufSize];\n int i = bufSize;\n int k = bufSize;\n boolean end = false;\n final StringBuilder str = new StringBuilder();\n\n MyReader(InputStream in) {\n this.in = new BufferedInputStream(in, bufSize);\n }\n\n int nextInt() throws IOException {\n return (int) nextLong();\n }\n\n int[] nextIntArray(int n) throws IOException {\n int[] m = new int[n];\n for (int i = 0; i < n; i++) {\n m[i] = nextInt();\n }\n return m;\n }\n\n int[][] nextIntMatrix(int n, int m) throws IOException {\n int[][] a = new int[n][0];\n for (int j = 0; j < n; j++) {\n a[j] = nextIntArray(m);\n }\n return a;\n }\n\n long nextLong() throws IOException {\n int c;\n long x = 0;\n boolean sign = true;\n while ((c = nextChar()) <= 32) ;\n if (c == '-') {\n sign = false;\n c = nextChar();\n }\n if (c == '+') {\n c = nextChar();\n }\n while (c >= '0') {\n x = x * 10 + (c - '0');\n c = nextChar();\n }\n return sign ? x : -x;\n }\n\n long[] nextLongArray(int n) throws IOException {\n long[] m = new long[n];\n for (int i = 0; i < n; i++) {\n m[i] = nextLong();\n }\n return m;\n }\n\n int nextChar() throws IOException {\n if (i == k) {\n k = in.read(buf, 0, bufSize);\n i = 0;\n }\n return i >= k ? -1 : buf[i++];\n }\n\n String nextString() throws IOException {\n if (end) {\n return null;\n }\n str.setLength(0);\n int c;\n while ((c = nextChar()) <= 32 && c != -1) ;\n if (c == -1) {\n end = true;\n return null;\n }\n while (c > 32) {\n str.append((char) c);\n c = nextChar();\n }\n return str.toString();\n }\n\n String nextLine() throws IOException {\n if (end) {\n return null;\n }\n str.setLength(0);\n int c = nextChar();\n while (c != '\\n' && c != '\\r' && c != -1) {\n str.append((char) c);\n c = nextChar();\n }\n if (c == -1) {\n end = true;\n if (str.length() == 0) {\n return null;\n }\n }\n if (c == '\\r') {\n nextChar();\n }\n return str.toString();\n }\n\n char[] nextCharArray() throws IOException {\n return nextString().toCharArray();\n }\n\n char[][] nextCharMatrix(int n) throws IOException {\n char[][] a = new char[n][0];\n for (int i = 0; i < n; i++) {\n a[i] = nextCharArray();\n }\n return a;\n }\n }\n\n static class MyWriter {\n\n final BufferedOutputStream out;\n final int bufSize = 1 << 16;\n final byte buf[] = new byte[bufSize];\n int i = 0;\n final byte c[] = new byte[30];\n static final String newLine = System.getProperty(\"line.separator\");\n\n MyWriter(OutputStream out) {\n this.out = new BufferedOutputStream(out, bufSize);\n }\n\n void print(long x) throws IOException {\n int j = 0;\n if (i + 30 >= bufSize) {\n flush();\n }\n if (x < 0) {\n buf[i++] = (byte) ('-');\n x = -x;\n }\n while (j == 0 || x != 0) {\n c[j++] = (byte) (x % 10 + '0');\n x /= 10;\n }\n while (j-- > 0)\n buf[i++] = c[j];\n }\n\n void print(int[] m) throws IOException {\n for (int a : m) {\n print(a);\n print(' ');\n }\n }\n\n void print(long[] m) throws IOException {\n for (long a : m) {\n print(a);\n print(' ');\n }\n }\n\n void print(String s) throws IOException {\n for (int i = 0; i < s.length(); i++) {\n print(s.charAt(i));\n }\n }\n\n void print(char x) throws IOException {\n if (i == bufSize) {\n flush();\n }\n buf[i++] = (byte) x;\n }\n\n void print(char[] m) throws IOException {\n for (char c : m) {\n print(c);\n }\n }\n\n void println(String s) throws IOException {\n print(s);\n println();\n }\n\n void println() throws IOException {\n print(newLine);\n }\n\n void flush() throws IOException {\n out.write(buf, 0, i);\n out.flush();\n i = 0;\n }\n\n void close() throws IOException {\n flush();\n out.close();\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "5fd0ab0b46542c89f8da71c914d2ed21", "src_uid": "4b9f470e5889da29affae6376f6c9f6a", "apr_id": "5926dc764cef5e92b9a19e99dab106c5", "difficulty": 2100, "tags": ["math", "chinese remainder theorem", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9640048731863994, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "import java.io.BufferedWriter;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStreamWriter;\nimport java.math.BigDecimal;\nimport java.math.MathContext;\nimport java.math.RoundingMode;\n\n\nimport java.util.ArrayDeque;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.Map.Entry;\nimport java.util.PriorityQueue;\nimport java.util.Random;\nimport java.util.TreeSet;\n\n\npublic final class CF_460_E{\n\n\tstatic boolean verb=true;\n\tstatic void log(Object X){if (verb) System.err.println(X);}\n\tstatic void log(Object[] X){if (verb) {for (Object U:X) System.err.print(U+\" \");System.err.println(\"\");}}\n\tstatic void log(int[] X){if (verb) {for (int U:X) System.err.print(U+\" \");System.err.println(\"\");}}\n\tstatic void log(int[] X,int L){if (verb) {for (int i=0;i0) {\n\t\t\tif (e%2==1)\n\t\t\t\tx=(b*x)%m;\n\t\t\tb=(b*b)%m;\n\t\t\te=e/2;\n\t\t}\n\t\treturn x; \n\t}\n\n\n\n\tstatic void process() throws Exception {\n\n\n\t\tout = new BufferedWriter(new OutputStreamWriter(System.out));\n\t\treader=new InputReader(System.in);\n\n\n\n\t\tint a=reader.readInt();\n\t\tint b=reader.readInt();\n\t\tint p=reader.readInt();\n\t\tlong x=reader.readLong();\n\t\t\n\t\tlong pp=p;\n\t\t\n\t\tArrayList[] targy=new ArrayList[p];\n\t\tArrayList[] targk=new ArrayList[p];\n\t\tfor (int u=1;u();\n\t\t\ttargk[u]=new ArrayList();\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\tfor (int y=1;y0 && targk[u].size()>0){\n\t\t\t\tfor (long k:targk[u])\n\t\t\t\t\tfor (long y:targy[u]){\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (p*k+y<=x){\n\t\t\t\t\t\t\tlong mt=(x-y-pp*k)/(pp*(pp-1));\n\t\t\t\t\t\t\tsum+=mt+1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t/*\n\t\t\t\t\t\tlong t=0;\n\t\t\t\t\t\twhile (((p-1)*t+k)*p+y<=x){\n\t\t\t\t\t\t\tt++;\n\t\t\t\t\t\t\tsum++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t*/\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\toutput(sum);\n\n\t\ttry {\n\t\t\tout.close();\n\t\t}\n\t\tcatch (Exception EX){}\n\n\n\t}\n\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tprocess();\n\n\t}\n\n\tstatic final class InputReader {\n\t\tprivate final InputStream stream;\n\t\tprivate final byte[] buf = new byte[1024];\n\t\tprivate int curChar;\n\t\tprivate int numChars;\n\n\t\tpublic InputReader(InputStream stream) {\n\t\t\tthis.stream = stream;\n\t\t}\n\n\t\tprivate int read() throws IOException {\n\t\t\tif (curChar >= numChars) {\n\t\t\t\tcurChar = 0;\n\t\t\t\tnumChars = stream.read(buf);\n\t\t\t\tif (numChars <= 0) {\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn buf[curChar++];\n\t\t}\n\n\n\t\tpublic final String readString() throws IOException {\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c)) {\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tStringBuilder res=new StringBuilder();\n\t\t\tdo {\n\t\t\t\tres.append((char)c);\n\t\t\t\tc = read();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn res.toString();\n\t\t}\n\n\t\tpublic final int readInt() throws IOException {\n\t\t\tint c = read();\n\t\t\tboolean neg=false;\n\t\t\twhile (isSpaceChar(c)) {\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tchar d=(char)c;\n\t\t\t//log(\"d:\"+d);\n\t\t\tif (d=='-') {\n\t\t\t\tneg=true;\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tint res = 0;\n\t\t\tdo {\n\t\t\t\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = read();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\t//log(\"res:\"+res);\n\t\t\tif (neg)\n\t\t\t\treturn -res;\n\t\t\treturn res;\n\n\t\t}\n\n\t\tpublic final long readLong() throws IOException {\n\t\t\tint c = read();\n\t\t\tboolean neg=false;\n\t\t\twhile (isSpaceChar(c)) {\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tchar d=(char)c;\n\t\t\t//log(\"d:\"+d);\n\t\t\tif (d=='-') {\n\t\t\t\tneg=true;\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tlong res = 0;\n\t\t\tdo {\n\t\t\t\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = read();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\t//log(\"res:\"+res);\n\t\t\tif (neg)\n\t\t\t\treturn -res;\n\t\t\treturn res;\n\n\t\t}\n\n\n\n\n\t\tprivate boolean isSpaceChar(int c) {\n\t\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t\t}\n\t}\n\n\n}", "lang": "Java 8", "bug_code_uid": "fc4b4a2a9173d02b57181dc59ee68afe", "src_uid": "4b9f470e5889da29affae6376f6c9f6a", "apr_id": "23f53564a051da680706b3a8d53b11be", "difficulty": 2100, "tags": ["math", "chinese remainder theorem", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7818696883852692, "equal_cnt": 22, "replace_cnt": 16, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 22, "bug_source_code": "import java.util.Scanner;\n\npublic class E {\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n\n int a = in.nextInt();\n int b = in.nextInt();\n int p = in.nextInt();\n long x = in.nextInt();\n\n int answer = 0;\n for (int i = 0; i < p; i++) {\n int tmp = (b * modPow(modPow(a, i, p), p - 2, p)) % p;\n if (i >= tmp) {\n int first = (i - tmp) * (p-1) + i;\n if (first <= x)\n answer += (x - first) / (p*(p-1)) + 1;\n }\n }\n\n System.out.println(answer);\n }\n\n private static int modPow(int a, int b, int mod) {\n int modPow = 1;\n for (; b > 0; b >>= 1) {\n if ((b & 1) != 0)\n modPow = (int) ((1L * modPow * a) % mod);\n a = (int) ((1L * a * a) % mod);\n }\n return modPow;\n }\n\n}\n", "lang": "Java 8", "bug_code_uid": "a83360e1cfea03ce0574e6948866a354", "src_uid": "4b9f470e5889da29affae6376f6c9f6a", "apr_id": "f686d150321271c7c7cb72a8d71b6a19", "difficulty": 2100, "tags": ["math", "chinese remainder theorem", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7586775885438152, "equal_cnt": 35, "replace_cnt": 22, "delete_cnt": 6, "insert_cnt": 6, "fix_ops_cnt": 34, "bug_source_code": "\n/**\n * Date: 4 Jan, 2019\n * Link:\n *\n * @author Prasad-Chaudhari\n * @linkedIn: https://www.linkedin.com/in/prasad-chaudhari-841655a6/\n * @git: https://github.com/Prasad-Chaudhari\n */\nimport java.io.BufferedReader;\nimport java.io.BufferedWriter;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.OutputStreamWriter;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.Hashtable;\nimport java.util.LinkedList;\nimport java.util.Map;\nimport java.util.Set;\n\npublic class newProgram6 {\n\n public static void main(String[] args) throws IOException {\n // TODO code application logic here\n FastIO in = new FastIO();\n long n = in.nl();\n int k = in.ni();\n Set s = new HashSet<>();\n int limit = (int) Math.sqrt(n) + 10;\n for (int i = 1; i <= limit; i++) {\n if (n % i == 0) {\n s.add((long) i);\n s.add(n / i);\n }\n }\n Long a[] = s.toArray(new Long[0]);\n int index = a.length;\n Arrays.sort(a);\n long mod = 1000000007;\n long nods[] = new long[index];\n ArrayList> a_l = new ArrayList<>();\n for (int i = 0; i < index; i++) {\n a_l.add(new LinkedList<>());\n for (int j = 0; j < index && a[j] <= a[i]; j++) {\n if (a[i] % a[j] == 0) {\n nods[i]++;\n a_l.get(i).add(j);\n }\n }\n nods[i] = Expo.a_pow_n_mod_m(nods[i], mod - 2, mod);\n }\n long dp[][] = new long[index][2];\n for (int i = 0; i <= 1; i++) {\n dp[0][i] = 1;\n }\n for (int i = 0; i < index; i++) {\n dp[i][0] = a[i] % mod;\n }\n for (int i = 1; i <= k; i++) {\n for (int j = 1; j < index; j++) {\n for (int l : a_l.get(j)) {\n dp[j][1] += dp[l][0];\n }\n dp[j][1] %= mod;\n dp[j][1] *= nods[j];\n dp[j][1] %= mod;\n }\n for (int j = 1; j < index; j++) {\n dp[j][0] = dp[j][1];\n dp[j][1] = 0;\n }\n }\n System.out.println(dp[index - 1][0]);\n }\n\n static class Expo {\n\n static long a_pow_n_mod_m(long a, long n, long m) {\n if (n == 0) {\n return 1;\n }\n if (n == 1) {\n return a;\n }\n long p = a_pow_n_mod_m(a, n / 2, m);\n if (n % 2 == 0) {\n return (p * p) % m;\n } else {\n return ((p * p) % m * a) % m;\n }\n }\n\n static long a_pow_n(long a, long n) {\n if (n == 0) {\n return 1;\n }\n if (n == 1) {\n return a;\n }\n long p = a_pow_n(a, n / 2);\n if (n % 2 == 0) {\n return (p * p);\n } else {\n return ((p * p) * a);\n }\n }\n }\n\n static class FastIO {\n\n private final BufferedReader br;\n private final BufferedWriter bw;\n private String s[];\n private int index;\n private StringBuilder sb;\n\n public FastIO() throws IOException {\n br = new BufferedReader(new InputStreamReader(System.in));\n bw = new BufferedWriter(new OutputStreamWriter(System.out, \"UTF-8\"));\n s = br.readLine().split(\" \");\n sb = new StringBuilder();\n index = 0;\n }\n\n public int ni() throws IOException {\n return Integer.parseInt(nextToken());\n }\n\n public double nd() throws IOException {\n return Double.parseDouble(nextToken());\n }\n\n public long nl() throws IOException {\n return Long.parseLong(nextToken());\n }\n\n public String next() throws IOException {\n return nextToken();\n }\n\n public String nli() throws IOException {\n try {\n return br.readLine();\n } catch (IOException ex) {\n\n }\n return null;\n }\n\n public int[] gia(int n) throws IOException {\n int a[] = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = ni();\n }\n return a;\n }\n\n public int[] gia(int n, int start, int end) throws IOException {\n validate(n, start, end);\n int a[] = new int[n];\n for (int i = start; i < end; i++) {\n a[i] = ni();\n }\n return a;\n }\n\n public double[] gda(int n) throws IOException {\n double a[] = new double[n];\n for (int i = 0; i < n; i++) {\n a[i] = nd();\n }\n return a;\n }\n\n public double[] gda(int n, int start, int end) throws IOException {\n validate(n, start, end);\n double a[] = new double[n];\n for (int i = start; i < end; i++) {\n a[i] = nd();\n }\n return a;\n }\n\n public long[] gla(int n) throws IOException {\n long a[] = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = nl();\n }\n return a;\n }\n\n public long[] gla(int n, int start, int end) throws IOException {\n validate(n, start, end);\n long a[] = new long[n];\n for (int i = start; i < end; i++) {\n a[i] = nl();\n }\n return a;\n }\n\n public int[][] gg(int n, int m) throws IOException {\n int adja[][] = new int[n + 1][];\n int from[] = new int[m];\n int to[] = new int[m];\n int count[] = new int[n + 1];\n for (int i = 0; i < m; i++) {\n from[i] = ni();\n to[i] = ni();\n count[from[i]]++;\n count[to[i]]++;\n }\n for (int i = 0; i <= n; i++) {\n adja[i] = new int[count[i]];\n }\n for (int i = 0; i < m; i++) {\n adja[from[i]][--count[from[i]]] = to[i];\n adja[to[i]][--count[to[i]]] = from[i];\n }\n return adja;\n }\n\n public void print(String s) throws IOException {\n bw.write(s);\n }\n\n public void println(String s) throws IOException {\n bw.write(s);\n bw.newLine();\n }\n\n private String nextToken() throws IndexOutOfBoundsException, IOException {\n if (index == s.length) {\n s = br.readLine().split(\" \");\n index = 0;\n }\n return s[index++];\n }\n\n private void validate(int n, int start, int end) {\n if (start < 0 || end >= n) {\n throw new IllegalArgumentException();\n }\n }\n }\n\n static class Data implements Comparable {\n\n int a, b;\n\n public Data(int a, int b) {\n this.a = a;\n this.b = b;\n }\n\n @Override\n public int compareTo(Data o) {\n if (a == o.a) {\n return Integer.compare(b, o.b);\n }\n return Integer.compare(a, o.a);\n }\n\n public static void sort(int a[]) {\n Data d[] = new Data[a.length];\n for (int i = 0; i < a.length; i++) {\n d[i] = new Data(a[i], 0);\n }\n Arrays.sort(d);\n for (int i = 0; i < a.length; i++) {\n a[i] = d[i].a;\n }\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "d6ecf51e948b2b6aa34ef7141efb6ad2", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "apr_id": "225a2e6e0a53cf1e260a0b9f31c58813", "difficulty": 2200, "tags": ["dp", "math", "probabilities", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.683404255319149, "equal_cnt": 32, "replace_cnt": 17, "delete_cnt": 6, "insert_cnt": 8, "fix_ops_cnt": 31, "bug_source_code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.io.FilterInputStream;\nimport java.io.BufferedInputStream;\nimport java.util.HashMap;\nimport java.util.ArrayList;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author Jenish\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n ScanReader in = new ScanReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n DMakotoAndABlackboard solver = new DMakotoAndABlackboard();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class DMakotoAndABlackboard {\n long mod = 1000000007;\n long[][] dp;\n HashMap div;\n\n public void solve(int testNumber, ScanReader in, PrintWriter out) {\n long n = in.scanLong();\n int k = in.scanInt();\n div = new HashMap<>();\n ArrayList divoo = new ArrayList<>();\n for (long i = 1; i * i <= n; i++) {\n if (n % i == 0) {\n divoo.add(i);\n if (i * i != n) {\n divoo.add(n / i);\n }\n }\n }\n\n int index = 0;\n for (long tt : divoo) {\n div.put(tt, index);\n index++;\n }\n dp = new long[div.size() + 5][k + 5];\n for (long arr[] : dp) {\n Arrays.fill(arr, -1);\n }\n out.println(tt(n, k));\n\n\n }\n\n long tt(long n, int step) {\n\n\n if (!div.containsKey(n)) {\n throw new ArrayIndexOutOfBoundsException(\"ERRO\");\n\n }\n if (dp[div.get(n)][step] != -1) return dp[div.get(n)][step];\n if (step == 0) {\n return dp[div.get(n)][0] = n;\n } else {\n long sum = 0;\n int c = 0;\n for (long i = 1; i * i <= n; i++) {\n if (n % i == 0) {\n sum = (sum + tt(i, step - 1)) % mod;\n c++;\n if (i * i != n) {\n sum = (sum + tt(n / i, step - 1)) % mod;\n c++;\n }\n }\n }\n\n sum = (sum * CodeX.modinv(c, mod)) % mod;\n return dp[div.get(n)][step] = sum;\n\n }\n }\n\n }\n\n static class CodeX {\n public static long power(long x, long y, long p) {\n long res = 1;\n x = x % p;\n while (y > 0) {\n if ((y & 1) != 0)\n res = (res * x) % p;\n y = y >> 1;\n x = (x * x) % p;\n }\n return res;\n }\n\n public static long modinv(long k, long mod) {\n return power(k, mod - 2, mod);\n }\n\n }\n\n static class ScanReader {\n private byte[] buf = new byte[4 * 1024];\n private int INDEX;\n private BufferedInputStream in;\n private int TOTAL;\n\n public ScanReader(InputStream inputStream) {\n in = new BufferedInputStream(inputStream);\n }\n\n private int scan() {\n if (INDEX >= TOTAL) {\n INDEX = 0;\n try {\n TOTAL = in.read(buf);\n } catch (Exception e) {\n e.printStackTrace();\n }\n if (TOTAL <= 0) return -1;\n }\n return buf[INDEX++];\n }\n\n public int scanInt() {\n int I = 0;\n int n = scan();\n while (isWhiteSpace(n)) n = scan();\n int neg = 1;\n if (n == '-') {\n neg = -1;\n n = scan();\n }\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n I *= 10;\n I += n - '0';\n n = scan();\n }\n }\n return neg * I;\n }\n\n private boolean isWhiteSpace(int n) {\n if (n == ' ' || n == '\\n' || n == '\\r' || n == '\\t' || n == -1) return true;\n else return false;\n }\n\n public long scanLong() {\n long I = 0;\n int n = scan();\n while (isWhiteSpace(n)) n = scan();\n int neg = 1;\n if (n == '-') {\n neg = -1;\n n = scan();\n }\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n I *= 10;\n I += n - '0';\n n = scan();\n }\n }\n return neg * I;\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "388a746a89961164c5389330f6096d5e", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "apr_id": "3b405a09ebbfaaa2c02d40154454a30c", "difficulty": 2200, "tags": ["dp", "math", "probabilities", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9708259661530689, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws FileNotFoundException {\n ConsoleIO io = new ConsoleIO(new InputStreamReader(System.in), new PrintWriter(System.out));\n\n// String fileName = \"C-large-practice\";\n// ConsoleIO io = new ConsoleIO(new FileReader(\"D:\\\\Dropbox\\\\code\\\\practice\\\\jb\\\\src\\\\\" + fileName + \".in\"), new PrintWriter(new File(\"D:\\\\Dropbox\\\\code\\\\practice\\\\jb\\\\src\\\\\" + fileName + \".out\")));\n\n new Main(io).solve();\n// new Main(io).solveLocal();\n\n io.close();\n }\n\n ConsoleIO io;\n\n Main(ConsoleIO io) {\n this.io = io;\n }\n\n ConsoleIO opt;\n\n Main(ConsoleIO io, ConsoleIO opt) {\n this.io = io;\n this.opt = opt;\n }\n\n List> gr = new ArrayList<>();\n\n long MOD = 1_000_000_007;\n\n public void solve() {\n long n = io.readLong();\n int k = io.ri();\n\n List divs = new ArrayList<>();\n for(long d = 1; d*d<= n; d++) {\n if (n % d == 0) {\n divs.add(d);\n if (d * d != n) {\n divs.add(n / d);\n }\n }\n }\n\n divs.sort(Comparator.naturalOrder());\n\n int[][] subs = new int[divs.size()][];\n long[] numd = new long[divs.size()];\n for(int i = 0; i < divs.size(); i++){\n List list = new ArrayList<>();\n long v = divs.get(i);\n for(int j = i; j < divs.size(); j++){\n if(divs.get(j) % v == 0){\n list.add(j);\n numd[j]++;\n }\n }\n subs[i] = new int[list.size()];\n for(int j = 0; j < list.size(); j++){\n subs[i][j] = list.get(j);\n }\n }\n\n for(int i = 0; i < divs.size(); i++){\n numd[i] = pow(numd[i], MOD - 2, MOD);\n }\n\n long[] count = new long[divs.size()];\n count[count.length - 1] = 1L;\n for(int step = 0; step < k; step++) {\n for (int i = 0; i < count.length; i++) {\n count[i] = (count[i] * numd[i]) % MOD;\n }\n for (int i = 0; i < count.length; i++) {\n int[] list = subs[i];\n\n long next = 0;\n for (int j : list) {\n next = next + count[j];\n }\n count[i] = next % MOD;\n }\n }\n\n long res = 0;\n for(int i = 0; i < count.length; i++) {\n res = (res + divs.get(i) % MOD * count[i] % MOD) % MOD;\n }\n\n io.writeLine(res+\"\");\n }\n\n long div(long a, long b, long mod) {\n return (a * pow(b, mod - 2, mod)) % mod;\n }\n\n long pow(long a, long p, long mod) {\n long res = 1;\n while (p > 0) {\n if (p % 2 == 1) res = (res * a) % mod;\n a = (a * a) % mod;\n p /= 2;\n }\n return res;\n }\n\n}\n\n\nclass ConsoleIO {\n\n BufferedReader br;\n PrintWriter out;\n public ConsoleIO(Reader reader, PrintWriter writer){br = new BufferedReader(reader);out = writer;}\n public void flush(){this.out.flush();}\n public void close(){this.out.close();}\n public void writeLine(String s) {this.out.println(s);}\n public void writeInt(int a) {this.out.print(a);this.out.print(' ');}\n public void writeWord(String s){\n this.out.print(s);\n }\n public void writeIntArray(int[] a, int k, String separator) {\n StringBuilder sb = new StringBuilder();\n for (int i = 0; i < k; i++) {\n if (i > 0) sb.append(separator);\n sb.append(a[i]);\n }\n this.writeLine(sb.toString());\n }\n public void writeLongArray(long[] a, int k, String separator) {\n StringBuilder sb = new StringBuilder();\n for (int i = 0; i < k; i++) {\n if (i > 0) sb.append(separator);\n sb.append(a[i]);\n }\n this.writeLine(sb.toString());\n }\n public int read(char[] buf, int len){try {return br.read(buf,0,len);}catch (Exception ex){ return -1; }}\n public String readLine() {try {return br.readLine();}catch (Exception ex){ return \"\";}}\n public long[] readLongArray() {\n String[]n=this.readLine().trim().split(\"\\\\s+\");long[]r=new long[n.length];\n for(int i=0;i='0' && all[i]<='9'){\n cur = cur*10+all[i]-'0';\n have = true;\n }else if(all[i]=='-') {\n neg = true;\n }\n else if(have){\n res[k++] = neg?-cur:cur;\n cur = 0;\n have = false;\n neg = false;\n }\n }\n if(have)res[k++] = neg?-cur:cur;\n return res;\n }\n public int ri() {\n try {\n int r = 0;\n boolean start = false;\n boolean neg = false;\n while (true) {\n int c = br.read();\n if (c >= '0' && c <= '9') {\n r = r * 10 + c - '0';\n start = true;\n } else if (!start && c == '-') {\n start = true;\n neg = true;\n } else if (start || c == -1) return neg ? -r : r;\n }\n } catch (Exception ex) {\n return -1;\n }\n }\n public long readLong() {\n try {\n long r = 0;\n boolean start = false;\n boolean neg = false;\n while (true) {\n int c = br.read();\n if (c >= '0' && c <= '9') {\n r = r * 10 + c - '0';\n start = true;\n } else if (!start && c == '-') {\n start = true;\n neg = true;\n } else if (start || c == -1) return neg ? -r : r;\n }\n } catch (Exception ex) {\n return -1;\n }\n }\n public String readWord() {\n try {\n boolean start = false;\n StringBuilder sb = new StringBuilder();\n while (true) {\n int c = br.read();\n if (c!= ' ' && c!= '\\r' && c!='\\n' && c!='\\t') {\n sb.append((char)c);\n start = true;\n } else if (start || c == -1) return sb.toString();\n }\n } catch (Exception ex) {\n return \"\";\n }\n }\n public char readSymbol() {\n try {\n while (true) {\n int c = br.read();\n if (c != ' ' && c != '\\r' && c != '\\n' && c != '\\t') {\n return (char) c;\n }\n }\n } catch (Exception ex) {\n return 0;\n }\n }\n//public char readChar(){try {return (char)br.read();}catch (Exception ex){ return 0; }}\n}\nclass Pair {\n public Pair(int a, int b) {this.a = a;this.b = b;}\n public int a;\n public int b;\n}\nclass PairLL {\n public PairLL(long a, long b) {this.a = a;this.b = b;}\n public long a;\n public long b;\n}\nclass Triple {\n public Triple(int a, int b, int c) {this.a = a;this.b = b;this.c = c;}\n public int a;\n public int b;\n public int c;\n}\n", "lang": "Java 8", "bug_code_uid": "ace174aefba7318f67e59fe98061aff0", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "apr_id": "269eb515b9f85667962081f0bd42d598", "difficulty": 2200, "tags": ["dp", "math", "probabilities", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6741900963128709, "equal_cnt": 51, "replace_cnt": 35, "delete_cnt": 13, "insert_cnt": 2, "fix_ops_cnt": 50, "bug_source_code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.io.FilterInputStream;\nimport java.io.BufferedInputStream;\nimport java.util.Random;\nimport java.util.ArrayList;\nimport java.io.InputStream;\n\n/**\n * @author khokharnikunj8\n */\n\npublic class Main {\n public static void main(String[] args) {\n new Thread(null, new Runnable() {\n public void run() {\n new Main().solve();\n }\n }, \"1\", 1 << 26).start();\n }\n\n void solve() {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n ScanReader in = new ScanReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n DMakotoAndABlackboard solver = new DMakotoAndABlackboard();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class DMakotoAndABlackboard {\n int mod = 1000000007;\n\n public void solve(int testNumber, ScanReader in, PrintWriter out) {\n long n = in.scanLong();\n int k = in.scanInt();\n ArrayList div = new ArrayList<>();\n for (long i = 1; i * i <= n; i++) {\n if (n % i == 0) {\n if (n / i != i) div.add(n / i);\n div.add(i);\n }\n }\n long[] inverse = new long[div.size() + 1];\n for (int i = 0; i <= div.size(); i++) inverse[i] = CodeHash.pow(i, mod - 2, mod);\n long[] ar = new long[div.size()];\n int tt = 0;\n for (long i : div) ar[tt++] = i;\n CodeHash.shuffle(ar);\n Arrays.sort(ar);\n int[] size = new int[tt];\n ArrayList[] index = new ArrayList[tt];\n for (int i = 0; i < tt; i++) index[i] = new ArrayList<>();\n for (int i = 0; i < tt; i++) {\n for (int j = 0; j <= i; j++) {\n if (ar[i] % ar[j] == 0) {\n size[i]++;\n index[i].add(j);\n }\n\n }\n }\n\n int[][] dp = new int[2][tt];\n dp[0][tt - 1] = 1;\n for (int i = 0; i < k; i++) {\n for (int j = 0; j < tt; j++) dp[(i + 1) & 1][j] = 0;\n for (int j = 0; j < tt; j++) {\n int add = (int) ((dp[i & 1][j] * inverse[size[j]]) % mod);\n for (int temp : index[j]) {\n dp[(i + 1) & 1][temp] = (dp[(i + 1) & 1][temp] + add);\n if (dp[(i + 1) & 1][temp] >= mod) dp[(i + 1) & 1][temp] -= mod;\n }\n }\n }\n long ans = 0;\n for (int i = 0; i < tt; i++) ans = (ans + (((ar[i] % mod) * dp[k & 1][i]) % mod)) % mod;\n while (ans < 0) ans += mod;\n out.println(ans);\n }\n\n }\n\n static class CodeHash {\n public static void shuffle(long[] ar) {\n Random rd = new Random(new Random().nextInt());\n for (int i = 0; i < ar.length; i++) {\n int index = rd.nextInt(ar.length);\n long tt = ar[i];\n ar[i] = ar[index];\n ar[index] = tt;\n }\n }\n\n public static long pow(long a, long b, long m) {\n long res = 1;\n a %= m;\n while (b > 0) {\n if ((b & 1) == 1) res = (res * a) % m;\n a = (a * a) % m;\n b >>= 1;\n }\n return res;\n }\n\n }\n\n static class ScanReader {\n private byte[] buf = new byte[4 * 1024];\n private int index;\n private BufferedInputStream in;\n private int total;\n\n public ScanReader(InputStream inputStream) {\n in = new BufferedInputStream(inputStream);\n }\n\n private int scan() {\n if (index >= total) {\n index = 0;\n try {\n total = in.read(buf);\n } catch (Exception e) {\n e.printStackTrace();\n }\n if (total <= 0) return -1;\n }\n return buf[index++];\n }\n\n public int scanInt() {\n int integer = 0;\n int n = scan();\n while (isWhiteSpace(n)) n = scan();\n int neg = 1;\n if (n == '-') {\n neg = -1;\n n = scan();\n }\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n integer *= 10;\n integer += n - '0';\n n = scan();\n }\n }\n return neg * integer;\n }\n\n private boolean isWhiteSpace(int n) {\n if (n == ' ' || n == '\\n' || n == '\\r' || n == '\\t' || n == -1) return true;\n else return false;\n }\n\n public long scanLong() {\n long integer = 0;\n int n = scan();\n while (isWhiteSpace(n)) n = scan();\n int neg = 1;\n if (n == '-') {\n neg = -1;\n n = scan();\n }\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n integer *= 10;\n integer += n - '0';\n n = scan();\n }\n }\n return neg * integer;\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "4d4f296a49eaec72ba2a10c59fb4b5c8", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "apr_id": "d7a1f9cc1dc84f55e3709671a2a90e69", "difficulty": 2200, "tags": ["dp", "math", "probabilities", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8573505360712339, "equal_cnt": 17, "replace_cnt": 12, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 16, "bug_source_code": "import java.io.*;\nimport java.text.*;\nimport java.util.*;\nimport java.math.*;\npublic class template {\n\tpublic static void main(String[] args) throws Exception {\n\t\tnew template().run();\n\t}\n\tpublic static final int MOD = 1_000_000_007;\n\tpublic void run() throws Exception {\n\t\tFastScanner f = new FastScanner();\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tint n = f.nextInt();\n\t\tint k = f.nextInt();\n\t\tlong[] inv = new long[51];\n\t\tfor(int i = 1; i <= 50; i++) {\n\t\t\tinv[i] = modInv(i, MOD);\n\t\t}\n\t\tlong[][] probs = new long[50][];\n\t\tfor(int i = 0; i < 50; i++) {\n\t\t\tprobs[i] = new long[i+1];\n\t\t\tArrays.fill(probs[i], inv[i+1]);\n\t\t\tlong[] aux = new long[i+1];\n\t\t\tfor(int a = 1; a < k; a++) {\n\t\t\t\taux[i] = inv[i+1] * probs[i][i] % MOD;\n\t\t\t\tfor(int j = i-1; j >= 0; j--) {\n\t\t\t\t\taux[j] = (probs[i][j] * inv[j+1] % MOD + aux[j+1]) % MOD;\n\t\t\t\t}\n\t\t\t\tfor(int j = 0; j <= i; j++)\n\t\t\t\t\tprobs[i][j] = aux[j];\n\t\t\t}\n\t\t}\n\t\tlong total = 1;\n\t\tfor(long i = 2; i <= n; i++) {\n\t\t\tint cnt = 0;\n\t\t\twhile(n % i == 0) {\n\t\t\t\tn /= i;\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t\tlong cur = 0;\n\t\t\tlong pow = 1;\n\t\t\tfor(int a = 0; a <= cnt; a++) {\n\t\t\t\tcur = (cur + (pow * probs[cnt][a]) % MOD) % MOD;\n\t\t\t\tpow = (pow * i) % MOD;\n\t\t\t} \n\t\t\ttotal = (total * cur) % MOD;\n\t\t}\n\t\tout.println(total);\n\t\tout.flush();\n\t}\n\tpublic long modInv(int a, int b) {\n\t\tgcd(a,b);\n\t\treturn ((x % b) + b) % b;\n\t}\n\tlong x, y;\n\tpublic long gcd(int a, int b) {\n\t\tif(a == 0 || b == 0) {\n\t\t\tx = 0;\n\t\t\ty = 1;\n\t\t\treturn a+b;\n\t\t}\n\t\tlong res = gcd(b%a,a);\n\t\tlong nx = y - b/a * x;\n\t\tlong ny = x;\n\t\tx = nx;\n\t\ty = ny;\n\t\treturn res;\n\t}\n static class FastScanner {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n public FastScanner() {\n reader = new BufferedReader(new InputStreamReader(System.in), 32768);\n tokenizer = null;\n }\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n public int nextInt() {\n return Integer.parseInt(next());\n }\n public long nextLong() {\n \treturn Long.parseLong(next());\n }\n public double nextDouble() {\n \treturn Double.parseDouble(next());\n }\n public String nextLine() {\n \ttry {\n \t\treturn reader.readLine();\n \t} catch(IOException e) {\n \t\tthrow new RuntimeException(e);\n \t}\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "6077f65704e66fc82b8a0e2f0a201711", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "apr_id": "bd5519457ae8907482c3248edf290a90", "difficulty": 2200, "tags": ["dp", "math", "probabilities", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8599455040871935, "equal_cnt": 15, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 14, "bug_source_code": "import java.io.*;\nimport java.text.*;\nimport java.util.*;\nimport java.math.*;\npublic class template {\n\tpublic static void main(String[] args) throws Exception {\n\t\tnew template().run();\n\t}\n\tpublic static final int MOD = 1_000_000_007;\n\tpublic void run() throws Exception {\n\t\tFastScanner f = new FastScanner();\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tlong n = f.nextLong();\n\t\tint k = f.nextInt();\n\t\tlong[] inv = new long[51];\n\t\tfor(int i = 1; i <= 50; i++) {\n\t\t\tinv[i] = modInv(i, MOD);\n\t\t}\n\t\tlong[][] probs = new long[50][];\n\t\tfor(int i = 0; i < 50; i++) {\n\t\t\tprobs[i] = new long[i+1];\n\t\t\tArrays.fill(probs[i], inv[i+1]);\n\t\t\tlong[] aux = new long[i+1];\n\t\t\tfor(int a = 1; a < k; a++) {\n\t\t\t\taux[i] = inv[i+1] * probs[i][i] % MOD;\n\t\t\t\tfor(int j = i-1; j >= 0; j--) {\n\t\t\t\t\taux[j] = (probs[i][j] * inv[j+1] % MOD + aux[j+1]) % MOD;\n\t\t\t\t}\n\t\t\t\tfor(int j = 0; j <= i; j++)\n\t\t\t\t\tprobs[i][j] = aux[j];\n\t\t\t}\n\t\t}\n\t\tlong total = 1;\n\t\tfor(long i = 2; i <= n; i++) {\n\t\t\tint cnt = 0;\n\t\t\twhile(n % i == 0) {\n\t\t\t\tn /= i;\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t\tlong cur = 0;\n\t\t\tlong pow = 1;\n\t\t\tfor(int a = 0; a <= cnt; a++) {\n\t\t\t\tcur = (cur + (pow * probs[cnt][a]) % MOD) % MOD;\n\t\t\t\tpow = (pow * i) % MOD;\n\t\t\t} \n\t\t\ttotal = (total * cur) % MOD;\n\t\t}\n\t\tout.println(total);\n\t\tout.flush();\n\t}\n\tpublic long modInv(int a, int b) {\n\t\tgcd(a,b);\n\t\treturn ((x % b) + b) % b;\n\t}\n\tlong x, y;\n\tpublic long gcd(int a, int b) {\n\t\tif(a == 0 || b == 0) {\n\t\t\tx = 0;\n\t\t\ty = 1;\n\t\t\treturn a+b;\n\t\t}\n\t\tlong res = gcd(b%a,a);\n\t\tlong nx = y - b/a * x;\n\t\tlong ny = x;\n\t\tx = nx;\n\t\ty = ny;\n\t\treturn res;\n\t}\n static class FastScanner {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n public FastScanner() {\n reader = new BufferedReader(new InputStreamReader(System.in), 32768);\n tokenizer = null;\n }\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n public int nextInt() {\n return Integer.parseInt(next());\n }\n public long nextLong() {\n \treturn Long.parseLong(next());\n }\n public double nextDouble() {\n \treturn Double.parseDouble(next());\n }\n public String nextLine() {\n \ttry {\n \t\treturn reader.readLine();\n \t} catch(IOException e) {\n \t\tthrow new RuntimeException(e);\n \t}\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "f7182b1e1feac219ee6bc5e1d477be21", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "apr_id": "bd5519457ae8907482c3248edf290a90", "difficulty": 2200, "tags": ["dp", "math", "probabilities", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9707112970711297, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "\n\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(){\n\t\tScanner s=new Scanner(System.in);\n\t\tlong n=s.nextLong();\n\t\tif(n % 2 ==0)\n\t\t\tSystem.out.print(\"white\\n1 2\");\n\t\telse\n\t\t\tSystem.out.print(\"black\");\n\t\t\t\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "8f4c0445e0595be3e26cfa3d3a055a09", "src_uid": "52e07d176aa1d370788f94ee2e61df93", "apr_id": "7e1575dd99970a78ef72340579d75ca5", "difficulty": 1700, "tags": ["math", "games", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9457364341085271, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "public class Main {\nstatic int A,B,C;\npublic static void main(String[] args) {\n\tScanner in=new Scanner(System.in);\n\tA=in.nextInt();\n\tB=in.nextInt();\n\tC=in.nextInt();\n\tint te1=(C+B-1)*(A+B-1);\n\tint te2=B*(B-1);\n\tSystem.out.println(te1-te2);\n}\n}\n", "lang": "Java 7", "bug_code_uid": "05d40042872c7e8daffbdcc709b82e84", "src_uid": "8ab25ed4955d978fe20f6872cb94b0da", "apr_id": "fbda87bc422fc9926d7eaccf5e223ad2", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.926391382405745, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Scanner;\n\n\npublic class A {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n int b = sc.nextInt();\n int c = sc.nextInt();\n int cnt = b+c-1;\n long ans = 0;\n int t = a;\n while (cnt > 0) {\n ans += t;\n cnt--;\n if (cnt==0)\n break;\n ans += t;\n cnt--;\n t++;\n }\n System.out.println(ans);\n }\n\n}\n", "lang": "Java 6", "bug_code_uid": "1e20f1a5c2e445f8b11ec3d308e7abf0", "src_uid": "8ab25ed4955d978fe20f6872cb94b0da", "apr_id": "c276ce114c7eab6cd1d295d1985f6b9c", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6618566618566618, "equal_cnt": 35, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 24, "fix_ops_cnt": 35, "bug_source_code": "public class CheapTravel {\n public static void main(String[] args) {\n Scanner sin = new Scanner(System.in);\n while(sin.hasNext()) {\n int n,m,a,b;\n n = sin.nextInt();//total rides of n\n m = sin.nextInt();//special rides of m\n a = sin.nextInt();//cost of m rides \n b = sin.nextInt();//cost of one ride\n int spending = 1000;\n int x = 0;\n //work out the minimum of the spending\n \n while(x <= n/m) {\n if(spending > (b-a*m)*x +a*n) {\n spending = (b-a*m)*x +a*n;\n }\n x++;\n }\n System.out.print(spending); \n }\n }\n}\n", "lang": "Java 6", "bug_code_uid": "e5c03f7e7211b7b411944cbc346cb34d", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "apr_id": "eb7bc101299ad374a2e85c7f0f72ad17", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6554621848739496, "equal_cnt": 24, "replace_cnt": 22, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 24, "bug_source_code": "public class Solution {\n\tpublic static void main( String[] args ) {\n\t\tScanner in = new Scanner(System.in);\n\t\tString s = \"\";\n\t\ttry {\n\t\t\ts = in.nextLine();\n\t\t}\n\t\tcatch (Exception e){\n\t\t\te.printStackTrace();\n\t\t}\n\t\tin.close();\n\t\t\n\t\tSystem.out.println(get(s));\n\t}\n\t\n\tpublic static int get( String s ) {\n\t\tint ret = 0;\n\t\tint count = 1;\n\t\tfor( int i = 0; i < s.length(); i++ ) {\n\t\t\twhile( i + 1 < s.length() && s.charAt(i) == s.charAt(i+1) ) {\n\t\t\t\tcount++;\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tif( count % 2 == 0 ) {\n\t\t\t\tret++;\n\t\t\t}\n\t\t\tcount = 1;\n\t\t}\n\t\treturn ret;\n\t}\n}", "lang": "Java 7", "bug_code_uid": "e94a2a9c2bf5562b94d445061a367de5", "src_uid": "8b26ca1ca2b28166c3d25dceb1f3d49f", "apr_id": "991a44d830397f0d18b8ae694875ec48", "difficulty": null, "tags": ["implementation", "two pointers"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9798775153105862, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import com.sun.tools.javac.resources.legacy;\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\n/**\n * @author arshsab\n * @since 05 2014\n */\n\npublic class PashaMaximizes {\n public static void main(String... args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n String[] log = br.readLine().split(\" \");\n\n final char[] A = log[0].toCharArray();\n int K = Integer.parseInt(log[1]);\n\n for (int i = 0; i < A.length && K > 0; i++) {\n int max = Integer.MIN_VALUE;\n int maxPos = -1;\n\n for (int j = i; j < A.length && j <= K + i; j++) {\n int fixed = A[j] - '0';\n\n if (fixed > max) {\n max = fixed;\n maxPos = j;\n }\n }\n\n if (max > A[i] - '0') {\n for (int j = maxPos - 1; j >= i; j--) {\n A[j + 1] = A[j];\n }\n\n A[i] = (char) (max + '0');\n K -= maxPos - i;\n }\n }\n\n System.out.println(new String(A));\n }\n}\n", "lang": "Java 6", "bug_code_uid": "97cd5b60b795c8858714a0d990d0b26d", "src_uid": "e56f6c343167745821f0b18dcf0d0cde", "apr_id": "39388e848f169c69b44e4bb9f4e123ce", "difficulty": 1400, "tags": ["greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9424993611040122, "equal_cnt": 10, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 9, "bug_source_code": "import java.io.BufferedReader;\n\n\npublic class Main {\n\n public static void main(String args[]){\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n int x = sc.nextInt();\n int algarisms[] = new int[s.length()];\n int nAlgarisms=s.length();\n\n for(int i=0; i0 && i0; j--){\n int temp=algarisms[i+j];\n algarisms[i+j]=algarisms[i+j-1];\n algarisms[i+j-1]=temp;\n }\n i++;\n subArray = new int[x+1];\n\n }\n\n double result=0;\n for(int j=nAlgarisms-1; j>=0; j--){\n result+=Math.pow(10,j)*(double)(algarisms[nAlgarisms-1-j]);\n }\n System.out.println(String.format(\"%.0f\",result));\n //System.out.println(result);\n //System.out.println(Arrays.toString(algarisms));\n\n }\n\n public static int getMaxIndexArray(int array[]){\n int max = 0;\n int index = 0;\n for(int i=0; imax){\n max=array[i];\n index=i;\n } \n }\n\n return index;\n }\n\n public static int[] getSubArray(int array[], int startIndex, int plus){\n int newArray[] = new int[plus+1];\n int endIndex = startIndex+plus0;l--)\n\t{\n\t for(i=0;i waitingList= new Hashtable<>();\n\n int simonTime= hr*60 + min;\n int reachSimon= simonTime + ta;\n int count = 0;\n for(int hour= 5; hour <= 23; hour++){\n for(int minute= 0; minute <= 59; minute++){\n int currentTime= hour * 60 + minute;\n\n if(currentTime % b == 0) {\n waitingList.putIfAbsent(currentTime + tb, currentTime);\n if(currentTime > simonTime && currentTime != reachSimon) count++;\n }\n if(waitingList.get(currentTime) != null)\n waitingList.remove(currentTime);\n\n if(currentTime == simonTime)\n count+= waitingList.size();\n if(currentTime == reachSimon) {\n hour = 25; break;\n }\n }\n }\n System.out.println(count);\n }\n}\n", "lang": "Java 11", "bug_code_uid": "1b8dd77a76e42439db2a0e46c6dd358d", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "apr_id": "3d70ee68dd1a6ec84df634f6785a8223", "difficulty": 1600, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.841802971656886, "equal_cnt": 25, "replace_cnt": 15, "delete_cnt": 4, "insert_cnt": 5, "fix_ops_cnt": 24, "bug_source_code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.InputMismatchException;\nimport java.io.IOException;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n MyScan in = new MyScan(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Te solver = new Te();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class Te {\n public void solve(int testNumber, MyScan in, PrintWriter out) {\n int n = in.nextInt();\n int k = in.nextInt();\n long[] res = new long[n + 1];\n long[] sum = new long[n + 1];\n for (int t = k + 2; t <= n; t++) {\n long cur0 = Util.fact(t - 2);\n long cur1 = (t - k - 1) + sum[t - 1] - sum[t - k - 1] + Util._m;\n cur1 %= Util._m;\n res[t] = cur0 * cur1 % Util._m;\n sum[t] = (sum[t - 1] + res[t] * Util.inv(t - 1) % Util._m) % Util._m;\n }\n out.println(res[n]);\n }\n\n }\n\n static class Util {\n public static final long M07 = 1000_000_007;\n public static final long _m = M07;\n private static long[] fact;\n private static long[] inv;\n private static long[] ifact;\n\n public static void l() {\n fact = new long[1000001];\n inv = new long[1000001];\n ifact = new long[1000001];\n for (int s = 0; s < 2; s++) {\n fact[s] = 1;\n ifact[s] = 1;\n inv[s] = 1;\n }\n inv[0] = 0;\n for (int i = 2; i < inv.length; i++) {\n inv[i] = (_m - (_m / i) * inv[(int) (_m % i)] % _m) % _m;\n }\n for (int i = 2; i < fact.length; i++) {\n fact[i] = i * fact[i - 1] % _m;\n ifact[i] = inv[i] * ifact[i - 1] % _m;\n }\n }\n\n public static long fact(int a) {\n if (fact == null) l();\n return fact[a];\n }\n\n public static long pow(long v, long k, long m) {\n if (k == 0) return 1;\n long t = pow(v, k / 2, m);\n t *= t;\n t %= m;\n if (k % 2 == 1) {\n t *= v;\n }\n return t % m;\n\n }\n\n public static long powm(long v, long k) {\n return pow(v, k, _m);\n }\n\n public static long inv(long v) {\n if (inv == null) l();\n if (v < inv.length) return inv[(int) v];\n return powm(v, _m - 2);\n }\n\n }\n\n static class MyScan {\n private final InputStream in;\n private byte[] inbuf = new byte[1024];\n public int lenbuf = 0;\n public int ptrbuf = 0;\n\n public MyScan(InputStream in) {\n this.in = in;\n }\n\n private int readByte() {\n if (lenbuf == -1) throw new InputMismatchException();\n if (ptrbuf >= lenbuf) {\n ptrbuf = 0;\n try {\n lenbuf = in.read(inbuf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (lenbuf <= 0) return -1;\n }\n return inbuf[ptrbuf++];\n }\n\n public int nextInt() {\n int num = 0, b;\n boolean minus = false;\n while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n\n while (true) {\n if (b >= '0' && b <= '9') {\n num = num * 10 + (b - '0');\n } else {\n return minus ? -num : num;\n }\n b = readByte();\n }\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "4514cac65982ea9459ab841ce68a4065", "src_uid": "0644605611a2cd10ab3a9f12f18d7ae4", "apr_id": "48f26d730c4264424085dc382ba9719c", "difficulty": 2400, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9921787709497206, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\n\npublic class Main {\n public static int pow(int base, int exp, int mod) {\n if (exp == 0)\n return 1 % mod ;\n else\n return (base * pow(base, exp - 1, mod)) % mod;\n }\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n\n int size = in.nextInt();\n System.out.println(((size==0)?1:(pow(3, size - 1, (int)Math.pow(10, 6) + 3)));\n }\n}", "lang": "Java 6", "bug_code_uid": "c0889e204eaccff2a61bf6313d8ad52d", "src_uid": "1a335a9638523ca0315282a67e18eec7", "apr_id": "c3f2c8e587926dc6ab3272281068be4a", "difficulty": 1300, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6741016109045849, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "import java.io.IOException;\nimport java.util.Scanner;\n\n\npublic class seventyA {\n\tpublic static void main(String srgs[]) throws IOException {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt(), l = 0;\n\t\tlong r = 1;\n\t\tfor (int i = 0; i < n - 1; i ++) {\n\t\t\tr = r * 3;\n\t\t}\n\t\twhile (l < 1) {\n\t\t\tif (r > 1000003) r = Math.abs(r-1000003); else l = 1;\n\t\t}\n\t\tSystem.out.print(r);\n\t}\n}\n", "lang": "Java 6", "bug_code_uid": "ab1e498a196340ea7e8213af3c5812e8", "src_uid": "1a335a9638523ca0315282a67e18eec7", "apr_id": "1dcc25cc9d3adcf7217089010d9c07f5", "difficulty": 1300, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9849041207670338, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\n\npublic class Reflection {\n public static void main (String [] args){\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n try{\n String in[] = br.readLine().split(\" \");\n long l = Integer.parseInt(in[0]);\n long r = Integer.parseInt(in[1]);\n long opt = (int)(5*Math.pow(10,in[1].length()-1));\n long max =0;\n if(l<= opt && opt<=r){\n max = opt * reflection(opt);\n }\n else{\n long wl = l*reflection(l);\n long wr = r*reflection(r);\n if(wl gen(best))\n\t\t\t\tbest = i;\n\t\t}\n\t\tSystem.out.println(gen(best));\n\t\t// 10^len\n\t\t// 10^(len+1)-1\n\t\t// min\n\t\t// max\n\t\t// 4999999\n\t\t// 5000000\n\t}\n\tpublic static long gen(int x)\t{\n\t\tint length = Integer.toString(x).length();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor(int i = 0; i < length; i++)\n\t\t\tsb.append(9);\n\t\tint y = Integer.parseInt(sb.toString())-x;\n\t\treturn 1L*x*y;\n\t}\n}\n", "lang": "Java 6", "bug_code_uid": "20c6d71339485e188867f040d31c5ebc", "src_uid": "2c4b2a162563242cb2f43f6209b59d5e", "apr_id": "0e38957e543f040212d366eb3b93c984", "difficulty": 1600, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7416934619506966, "equal_cnt": 16, "replace_cnt": 11, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 15, "bug_source_code": "import java.io.*;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\n\npublic class Reflections {\n\n\tprivate int[] memo;\n\n\tprivate int reflect(int x) {\n\t\tif(x == 0) {\n\t\t\treturn 0;\n\t\t}\n\t\tif(memo[x] != -1) {\n\t\t\treturn memo[x];\n\t\t}\n\n\t\tint r = 10 * reflect(x / 10) + 9 - (x % 10);\n\t\tmemo[x] = r;\n\t\treturn r;\n\t}\n\n\tpublic void run() throws IOException {\n\t\tint l = nextInt();\n\t\tint r = nextInt();\n\n\t\tmemo = new int[l + 1];\n\t\tArrays.fill(memo, -1);\n\n\t\tlong max = 0;\n\n\t\tfor(; l <= r; ++l) {\n\t\t\tmax = Math.max(max, (long)l * reflect(l));\n\t\t}\n\t\twriter.print(max);\n\n\t\treader.close();\n\t\twriter.close();\n\t}\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tnew Reflections(System.in, System.out).run();\n\t}\n\n\tprivate BufferedReader reader;\n\tprivate PrintWriter writer;\n\tprivate StringTokenizer tokenizer;\n\n\tpublic Reflections(InputStream in, OutputStream out) {\n\t\tthis.reader = new BufferedReader(new InputStreamReader(in));\n\t\tthis.writer = new PrintWriter(new OutputStreamWriter(out));\n\t}\n\n\tprivate int nextInt() throws IOException {\n\t\treturn Integer.parseInt(nextToken());\n\t}\n\n\tprivate float nextFloat() throws IOException {\n\t\treturn Float.parseFloat(nextToken());\n\t}\n\n\tprivate String nextToken() throws IOException {\n\t\twhile(tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t}\n\t\treturn tokenizer.nextToken();\n\t}\n}\n", "lang": "Java 6", "bug_code_uid": "cc6d3afdea093f1f7e0497cc58bb6c0d", "src_uid": "2c4b2a162563242cb2f43f6209b59d5e", "apr_id": "a8dfd6974e4c53a9d7f9247278076c17", "difficulty": 1600, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7416934619506966, "equal_cnt": 16, "replace_cnt": 11, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 15, "bug_source_code": "import java.io.*;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\n\npublic class Reflections {\n\n\tprivate int[] memo;\n\n\tprivate int reflect(int x) {\n\t\tif(x == 0) {\n\t\t\treturn 0;\n\t\t}\n\t\tif(memo[x] != -1) {\n\t\t\treturn memo[x];\n\t\t}\n\n\t\tint r = 10 * reflect(x / 10) + 9 - (x % 10);\n\t\tmemo[x] = r;\n\t\treturn r;\n\t}\n\n\tpublic void run() throws IOException {\n\t\tint l = nextInt();\n\t\tint r = nextInt();\n\n\t\tmemo = new int[r + 1];\n\t\tArrays.fill(memo, -1);\n\n\t\tlong max = 0;\n\n\t\tfor(; l <= r; ++l) {\n\t\t\tmax = Math.max(max, (long)l * reflect(l));\n\t\t}\n\t\twriter.print(max);\n\n\t\treader.close();\n\t\twriter.close();\n\t}\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tnew Reflections(System.in, System.out).run();\n\t}\n\n\tprivate BufferedReader reader;\n\tprivate PrintWriter writer;\n\tprivate StringTokenizer tokenizer;\n\n\tpublic Reflections(InputStream in, OutputStream out) {\n\t\tthis.reader = new BufferedReader(new InputStreamReader(in));\n\t\tthis.writer = new PrintWriter(new OutputStreamWriter(out));\n\t}\n\n\tprivate int nextInt() throws IOException {\n\t\treturn Integer.parseInt(nextToken());\n\t}\n\n\tprivate float nextFloat() throws IOException {\n\t\treturn Float.parseFloat(nextToken());\n\t}\n\n\tprivate String nextToken() throws IOException {\n\t\twhile(tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t}\n\t\treturn tokenizer.nextToken();\n\t}\n}\n", "lang": "Java 6", "bug_code_uid": "d057bcb5d2354a587ce0ef82b378f6a2", "src_uid": "2c4b2a162563242cb2f43f6209b59d5e", "apr_id": "a8dfd6974e4c53a9d7f9247278076c17", "difficulty": 1600, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9558573853989814, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class cf553B {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner in=new Scanner(System.in);\n\t\tlong values[]=new long[100005];\n\t\tint n=in.nextInt();\n\t\tint number[]=new int[n+1];\n\t\tfor(int j=1;j<=n;j++) {\n\t\t\tnumber[j]=j;\n\t\t}\n\t\tlong k=in.nextLong();\n\t\tvalues[0]=1;\n\t\tvalues[1]=2;\n\t\tvalues[2]=3;\n\t\tint up=0,low=1;\n\t\t\n\t\tfor(int i=3;;i++) {\n\t\t\tvalues[i]=values[i-1]+values[i-2];\n\t\t\tif(values[i]>k) { up=i; break; }\n\t\t}\n\t\tint pos=up;\n\t\t\n\t\twhile(k>1) {\n\t\t\t pos=binarysearch(values,pos,low,k);\n\t\t\t int temp=number[pos];\n\t\t\t number[pos]=number[pos+1];\n\t\t\t number[pos+1]=temp;\n\t\t\t k=k-values[pos-1];\n\t\t\t //System.out.println(pos);\n\t\t}\n\t\t\n\t\tfor(int i=1;i<=n;i++)\n\t\t\tSystem.out.print(number[i]+\" \");\n\t\t\n\t\t\n\t\t\n\n\t}\n\t\n\tpublic static int binarysearch(long arr[],int up,int low,long val ) \n\t{\n\t\tint mid;\n\t\twhile(true) {\n\t\t\tmid=(up+low)/2;\n\t\t\t// Equals to condition\n\t\t\tif(arr[mid]>=val && arr[mid-1]val ) up=mid-1;\n\t\t\t\n\t\t\t//Lesser codition\n\t\t\telse if(arr[mid]= 0; i--) {\n cnt[i] = cnt[i + 1] + cnt[i + 2];\n }\n\n int[] ans = new int[n];\n for (int i = 0; i < n; i++) ans[i] = i + 1;\n for (int i = 0; i + 1 < n; ) {\n if (k > cnt[i + 1]) {\n k -= cnt[i + 1];\n int tmp = ans[i];\n ans[i] = ans[i + 1];\n ans[i + 1] = tmp;\n if (k == 0) break;\n i += 2;\n } else {\n i += 1;\n }\n }\n for (int i = 0; i < n; i++) out.print((i == 0 ? \"\" : \" \") + ans[i]);\n }\n}\n\nclass FastReader extends BufferedReader {\n private StringTokenizer st;\n\n public FastReader(InputStream is) {\n super(new InputStreamReader(is));\n }\n\n public String nextToken() {\n try {\n while (st == null || !st.hasMoreElements()) {\n st = new StringTokenizer(readLine());\n }\n return st.nextToken();\n } catch (IOException e) {\n return null;\n }\n }\n\n public int nextInt() {\n return Integer.parseInt(nextToken());\n }\n\n public long nextLong() {\n return Long.parseLong(nextToken());\n }\n\n public int[] nextArrayInt(int size) {\n int[] ret = new int[size];\n for (int i = 0; i < size; i++) {\n ret[i] = nextInt();\n }\n return ret;\n }\n}", "lang": "Java 8", "bug_code_uid": "f4e9353355eada54817468c9a3a9ff36", "src_uid": "e03c6d3bb8cf9119530668765691a346", "apr_id": "c2afa8e57057c90f2973604d5e0c7efe", "difficulty": 1900, "tags": ["combinatorics", "greedy", "math", "implementation", "constructive algorithms", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9254901960784314, "equal_cnt": 10, "replace_cnt": 4, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "public class Main{\n public static long gcd(long a, long b) {\n\t \tif (b==0)\n\t \t\treturn a;\n\t \treturn gcd(b,a%b);\n\t}\n\tpublic static void main(String[] args){\n\t\tScanner in=new Scanner(System.in);\n\t\tlong l=in.nextLong();\n\t\tlong r=in.nextLong();\n\t\tlong x=in.nextLong();\n\t\tlong y=in.nextLong();\n\t\tlong count=0,p=x*y;\n\t\tfor(long i=x;i<=y;i+=x){\n\t\t\tlong rem=p/i;\n\t\t\tif(p%i==0 && rem>=l && rem<=r && i>=l && i<=r && gcd(i,rem)==x){\n\t\t\t\tif(i==rem)count+=2;\n\t\t\t\telse count++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "25fb1d433d48f624fb535b16dcaba015", "src_uid": "d37dde5841116352c9b37538631d0b15", "apr_id": "2506d0da35de74830a4249a1a873b9c2", "difficulty": 1600, "tags": ["math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9979338842975206, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\nimport java.util.Scanner;\n\n\npublic class Test\n{\n public static void main(String args[])\n {\n int n;\n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n String s = sc.next();\n String u = new String(\"xxx\");\n int count = 0;\n while(s.indexOf(u) != -1)\n {\n int x = s.indexOf(u);\n count++;\n s = s.substring(0, x) + s.substring(x + 1);\n }\n System.out.println(count);\n}", "lang": "Java 8", "bug_code_uid": "f57549e7dd12f812b1dd2affb4212622", "src_uid": "8de14db41d0acee116bd5d8079cb2b02", "apr_id": "b34dccd8929ae9503c9c6424ed1d0a17", "difficulty": 800, "tags": ["strings", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.34282253179890976, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import java.util.Scanner;\n\npublic class Wall {\n public static void main (String[] args) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int y = sc.nextInt();\n int a = sc.nextInt();\n int b = sc.nextInt();\n int ans = 0;\n int max;\n\n int[] arX = new int[b + x * y];\n int[] arY = new int[b + x * y];\n\n if (x > y) max = x;\n else max = y;\n\n if (max == x) {\n for (int i = 1; i <= b; i++) {\n arX[i] = x * i;\n }\n\n for (int i = 1; i <= b; i++) {\n if (arX[i] >= a && arX[i] % x == 0 && arX[i] % y == 0) {\n if (arX[i] > b) break;\n ans++;\n }\n }\n }\n else {\n for (int i = 1; i <= b; i++) {\n arY[i] = y * i;\n }\n\n for (int i = 1; i <= b; i++) {\n if (arY[i] >= a && arY[i] % x == 0 && arY[i] % y == 0) {\n if (arY[i] > b) break;\n ans++;\n }\n }\n }\n \n System.out.println(ans);\n }\n}\n", "lang": "Java 7", "bug_code_uid": "c4d03fa82c5733f931e8556f1abbbcfe", "src_uid": "c7aa8a95d5f8832015853cffa1374c48", "apr_id": "43661b12692ff053ebaff6bebd206ff7", "difficulty": 1200, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9881796690307328, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Scanner;\n\npublic class Main{\n public static void main(String args[]){\n Scanner s = new Scanner(System.in);\n int n=s.nextInt(), k=s.nextInt(), l=s.nextInt(), c=s.nextInt();\n int d=s.nextInt(), p=s.nextInt(), nl=s.nextInt(), np=s.nextInt();\n \n int a1= (k*l)/nl;\n int a2 = c*d;\n int a3 = p/np;\n System.out.println(Math.min(a1,a2,a3)/n);\n }\n}", "lang": "Java 8", "bug_code_uid": "beda2eb424432c9d58949dfd51070a11", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "apr_id": "6927a19bcbd9bbcea8823d2a5f5905da", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9998980320179464, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "public class E {\n\n\tprivate final static boolean autoflush = false;\n\n\tlong [][] A = {\n\t\t\t{ 1, 0, 0, 0, 0, 0 },\n\t\t\t{ 1, 1, 0, 0, 0, 0 },\n\t\t\t{ 2, 1, 2, 1, 1, 0 },\n\t\t\t{ 2, 1, 1, 2, 0, 1 },\n\t\t\t{ 2, 1, 1, 1, 1, 0 },\n\t\t\t{ 2, 1, 1, 1, 0, 1 }\n\t};\n\n\tpublic E () {\n\t\tint N = sc.nextInt();\n\t\tint X = sc.nextInt() - 1;\n\t\tint Y = sc.nextInt() - 1;\n\t\tint VX = sc.nextInt();\n\t\tint VY = sc.nextInt();\n\t\tlong T = sc.nextLong();\n\n\t\tlong [] V = { 1, 0, X, Y, VX, VY };\n\t\tlong [] W = prod(pow(A, T, N), V, N);\n\t\texit(W[2] + 1, W[3] + 1);\n\t}\n\n\tlong [] prod(long [][] A, long [] V, long mod) {\n\t\tlong [][] W = new long [V.length][1];\n\t\tfor (int i : rep(V.length))\n\t\t\tW[i][0] = V[i];\n\t\tlong [][] X = prod(A, W, mod);\n\t\tlong [] res = new long [X.length];\n\t\tfor (int i : rep(X.length))\n\t\t\tres[i] = X[i][0];\n\t\treturn res;\n\t}\n\n\tlong [][] sum (long [][] A, long [][] B, long mod) {\n\t\tint M = A.length, K = A[0].length, N = B[0].length;\n\t\tassert(K == B.length);\n\t\tlong [][] res = new long [M][N];\n\n\t\tfor (int i = 0; i < M; ++i)\n\t\t\tfor (int j = 0; j < N; ++j)\n\t\t\t\tres[i][j] = mod(A[i][j] + B[i][j], mod);\n\t\treturn res;\n\t}\n\n\tlong [][] prod (long [][] A, long [][] B, long mod) {\n\t\tint M = A.length, K = A[0].length, N = B[0].length;\n\t\tassert(K == B.length);\n\t\tlong [][] res = new long [M][N];\n\n\t\tfor (int i = 0; i < M; ++i)\n\t\t\tfor (int j = 0; j < N; ++j)\n\t\t\t\tfor (int k = 0; k < K; ++k)\n\t\t\t\t\tres[i][j] = mod(res[i][j] + A[i][k] * B[k][j], mod);\n\t\treturn res;\n\t}\n\n\tlong [][] pow (long [][] A, long e, long mod) {\n\t\tlong [][] res = id(A.length);\n\t\tif (e > 0) {\n\t\t\tint M = 1 + Long.numberOfTrailingZeros(Long.highestOneBit(e));\n\t\t\tlong [][][] P = new long[M][][]; P[0] = A;\n\t\t\tfor (int i : rep(1, M))\n\t\t\t\tP[i] = prod(P[i-1], P[i-1], mod);\n\t\t\tfor (int i : rep(M))\n\t\t\t\tif ((e & (1 << i)) != 0)\n\t\t\t\t\tres = prod(res, P[i], mod);\n\t\t}\n\t\treturn res;\n\t}\n\n\tlong [][] id (int N) {\n\t\tlong [][] res = new long [N][N];\n\t\tfor (int i : rep(N))\n\t\t\tres[i][i] = 1;\n\t\treturn res;\n\t}\n\n\t///////////////////////////////////////////////////////////////////////////\n\tprivate static int [] rep(int N) { return rep(0, N); }\n\tprivate static int [] rep(int S, int T) { if (T <= S) return new int [0]; int [] res = new int [T-S]; for (int i = S; i < T; ++i) res[i-S] = i; return res; }\n\tprivate static long mod(long x, long mod) { return ((x % mod) + mod) % mod; }\n\t////////////////////////////////////////////////////////////////////////////////////\n\tprivate final static MyScanner sc = new MyScanner();\n\tprivate static class MyScanner {\n\t\tpublic String next() { newLine(); return line[index++]; }\n\t\tpublic int nextInt() { return Integer.parseInt(next()); }\n\t\tpublic long nextLong() { return Long.parseLong(next()); }\n\t\t//////////////////////////////////////////////\n\t\tprivate boolean eol() { return index == line.length; }\n\t\tprivate String readLine() {\n\t\t\ttry {\n\t\t\t\treturn r.readLine();\n\t\t\t} catch (Exception e) {\n\t\t\t\tthrow new Error (e);\n\t\t\t}\n\t\t}\n\t\tprivate final java.io.BufferedReader r;\n\t\tprivate MyScanner () { this(new java.io.BufferedReader(new java.io.InputStreamReader(System.in))); }\n\t\tprivate MyScanner (java.io.BufferedReader r) {\n\t\t\ttry {\n\t\t\t\tthis.r = r;\n\t\t\t\twhile (!r.ready())\n\t\t\t\t\tThread.sleep(1);\n\t\t\t\tstart();\n\t\t\t} catch (Exception e) {\n\t\t\t\tthrow new Error(e);\n\t\t\t}\n\t\t}\n\t\tprivate String [] line;\n\t\tprivate int index;\n\t\tprivate void newLine() {\n\t\t\tif (line == null || eol()) {\n\t\t\t\tline = readLine().split(\" \");\n\t\t\t\tindex = 0;\n\t\t\t}\n\t\t}\n\t}\n\tprivate static void print (Object o, Object... a) { printDelim(\" \", o, a); }\n\tprivate static void printDelim (String delim, Object o, Object... a) { pw.println(build(delim, o, a)); }\n\tprivate static void exit (Object o, Object... a) { print(o, a); exit(); }\n\tprivate static void exit() {\n\t\tpw.close();\n\t\tSystem.out.flush();\n\t\tSystem.err.println(\"------------------\");\n\t\tSystem.err.println(\"Time: \" + ((millis() - t) / 1000.0));\n\t\tSystem.exit(0);\n\t}\n\t////////////////////////////////////////////////////////////////////////////////////\n\tprivate static String build (String delim, Object o, Object... a) {\n\t\tStringBuilder b = new StringBuilder();\n\t\tappend(b, o, delim);\n\t\tfor (Object p : a)\n\t\t\tappend(b, p, delim);\n\t\treturn b.substring(delim.length());\n\t}\n\tprivate static void append(StringBuilder b, Object o, String delim) {\n\t\tif (o.getClass().isArray()) {\n\t\t\tint L = java.lang.reflect.Array.getLength(o);\n\t\t\tfor (int i = 0; i < L; ++i)\n\t\t\t\tappend(b, java.lang.reflect.Array.get(o, i), delim);\n\t\t} else if (o instanceof Iterable)\n\t\t\tfor (Object p : (Iterable)o)\n\t\t\t\tappend(b, p, delim);\n\t\telse\n\t\t\tb.append(delim).append(o);\n\t}\n\t////////////////////////////////////////////////////////////////////////////////////\n\tprivate static void start() { t = millis(); }\n\tprivate static java.io.PrintWriter pw = new java.io.PrintWriter(System.out, autoflush);\n\tprivate static long t;\n\tprivate static long millis() { return System.currentTimeMillis(); }\n\tpublic static void main (String[] args) { new E(); exit(); }\n}\n", "lang": "Java 7", "bug_code_uid": "13f5d14e7a697e6053715a6fbf9b14d0", "src_uid": "ee9fa8be2ae05a4e831a4f608c0cc785", "apr_id": "d35c53507e6ceeef3350a79ceacfa63c", "difficulty": 2300, "tags": ["matrices", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9937416641017749, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "public class E {\n\n\tprivate final static boolean autoflush = false;\n\n\tlong [][] A = {\n\t\t\t{ 1, 0, 0, 0, 0, 0 },\n\t\t\t{ 1, 1, 0, 0, 0, 0 },\n\t\t\t{ 2, 1, 2, 1, 1, 0 },\n\t\t\t{ 2, 1, 1, 2, 0, 1 },\n\t\t\t{ 2, 1, 1, 1, 1, 0 },\n\t\t\t{ 2, 1, 1, 1, 0, 1 }\n\t};\n\n\tpublic E () {\n\t\tint N = sc.nextInt();\n\t\tint X = sc.nextInt() - 1;\n\t\tint Y = sc.nextInt() - 1;\n\t\tint VX = sc.nextInt();\n\t\tint VY = sc.nextInt();\n\t\tlong T = sc.nextLong();\n\n\t\tlong [] V = { 1, 0, X, Y, VX, VY };\n\t\tlong [] W = prod(pow(A, T, N), V, N);\n\t\texit(W[2] + 1, W[3] + 1);\n\t}\n\n\tlong [] prod(long [][] A, long [] V, long mod) {\n\t\tlong [][] W = new long [V.length][1];\n\t\tfor (int i : rep(V.length))\n\t\t\tW[i][0] = V[i];\n\t\tlong [][] X = prod(A, W, mod);\n\t\tlong [] res = new long [X.length];\n\t\tfor (int i : rep(X.length))\n\t\t\tres[i] = X[i][0];\n\t\treturn res;\n\t}\n\n\tlong [][] sum (long [][] A, long [][] B, long mod) {\n\t\tint M = A.length, K = A[0].length, N = B[0].length;\n\t\tassert(K == B.length);\n\t\tlong [][] res = new long [M][N];\n\n\t\tfor (int i = 0; i < M; ++i)\n\t\t\tfor (int j = 0; j < N; ++j)\n\t\t\t\tres[i][j] = mod(A[i][j] + B[i][j], mod);\n\t\treturn res;\n\t}\n\n\tlong [][] prod (long [][] A, long [][] B, long mod) {\n\t\tint M = A.length, K = A[0].length, N = B[0].length;\n\t\tassert(K == B.length);\n\t\tlong [][] res = new long [M][N];\n\n\t\tfor (int i = 0; i < M; ++i)\n\t\t\tfor (int j = 0; j < N; ++j)\n\t\t\t\tfor (int k = 0; k < K; ++k)\n\t\t\t\t\tres[i][j] = mod(res[i][j] + A[i][k] * B[k][j], mod);\n\t\treturn res;\n\t}\n\n\tlong [][] pow (long [][] A, long e, long mod) {\n\t\tlong [][] res = id(A.length);\n\t\tif (e > 0) {\n\t\t\tint M = 1 + Long.numberOfTrailingZeros(Long.highestOneBit(e));\n\t\t\tlong [][][] P = new long[M][][]; P[0] = A;\n\t\t\tfor (int i : rep(1, M))\n\t\t\t\tP[i] = prod(P[i-1], P[i-1], mod);\n\t\t\tfor (int i : rep(M))\n\t\t\t\tif ((e & (1 << i)) != 0)\n\t\t\t\t\tres = prod(res, P[i], mod);\n\t\t}\n\t\treturn res;\n\t}\n\n\tlong [][] id (int N) {\n\t\tlong [][] res = new long [N][N];\n\t\tfor (int i : rep(N))\n\t\t\tres[i][i] = 1;\n\t\treturn res;\n\t}\n\n\t///////////////////////////////////////////////////////////////////////////\n\tprivate static int [] rep(int N) { return rep(0, N); }\n\tprivate static int [] rep(int S, int T) { if (T <= S) return new int [0]; int [] res = new int [T-S]; for (int i = S; i < T; ++i) res[i-S] = i; return res; }\n\tprivate static long mod(long x, long mod) { return ((x % mod) + mod) % mod; }\n\t////////////////////////////////////////////////////////////////////////////////////\n\tprivate final static MyScanner sc = new MyScanner();\n\tprivate static class MyScanner {\n\t\tpublic String next() { newLine(); return line[index++]; }\n\t\tpublic int nextInt() { return Integer.parseInt(next()); }\n\t\t//////////////////////////////////////////////\n\t\tprivate boolean eol() { return index == line.length; }\n\t\tprivate String readLine() {\n\t\t\ttry {\n\t\t\t\treturn r.readLine();\n\t\t\t} catch (Exception e) {\n\t\t\t\tthrow new Error (e);\n\t\t\t}\n\t\t}\n\t\tprivate final java.io.BufferedReader r;\n\t\tprivate MyScanner () { this(new java.io.BufferedReader(new java.io.InputStreamReader(System.in))); }\n\t\tprivate MyScanner (java.io.BufferedReader r) {\n\t\t\ttry {\n\t\t\t\tthis.r = r;\n\t\t\t\twhile (!r.ready())\n\t\t\t\t\tThread.sleep(1);\n\t\t\t\tstart();\n\t\t\t} catch (Exception e) {\n\t\t\t\tthrow new Error(e);\n\t\t\t}\n\t\t}\n\t\tprivate String [] line;\n\t\tprivate int index;\n\t\tprivate void newLine() {\n\t\t\tif (line == null || eol()) {\n\t\t\t\tline = readLine().split(\" \");\n\t\t\t\tindex = 0;\n\t\t\t}\n\t\t}\n\t}\n\tprivate static void print (Object o, Object... a) { printDelim(\" \", o, a); }\n\tprivate static void printDelim (String delim, Object o, Object... a) { pw.println(build(delim, o, a)); }\n\tprivate static void exit (Object o, Object... a) { print(o, a); exit(); }\n\tprivate static void exit() {\n\t\tpw.close();\n\t\tSystem.out.flush();\n\t\tSystem.err.println(\"------------------\");\n\t\tSystem.err.println(\"Time: \" + ((millis() - t) / 1000.0));\n\t\tSystem.exit(0);\n\t}\n\t////////////////////////////////////////////////////////////////////////////////////\n\tprivate static String build (String delim, Object o, Object... a) {\n\t\tStringBuilder b = new StringBuilder();\n\t\tappend(b, o, delim);\n\t\tfor (Object p : a)\n\t\t\tappend(b, p, delim);\n\t\treturn b.substring(delim.length());\n\t}\n\tprivate static void append(StringBuilder b, Object o, String delim) {\n\t\tif (o.getClass().isArray()) {\n\t\t\tint L = java.lang.reflect.Array.getLength(o);\n\t\t\tfor (int i = 0; i < L; ++i)\n\t\t\t\tappend(b, java.lang.reflect.Array.get(o, i), delim);\n\t\t} else if (o instanceof Iterable)\n\t\t\tfor (Object p : (Iterable)o)\n\t\t\t\tappend(b, p, delim);\n\t\telse\n\t\t\tb.append(delim).append(o);\n\t}\n\t////////////////////////////////////////////////////////////////////////////////////\n\tprivate static void start() { t = millis(); }\n\tprivate static java.io.PrintWriter pw = new java.io.PrintWriter(System.out, autoflush);\n\tprivate static long t;\n\tprivate static long millis() { return System.currentTimeMillis(); }\n\tpublic static void main (String[] args) { new E(); exit(); }\n}\n", "lang": "Java 7", "bug_code_uid": "842d0c032019eb0f45a7f124d48f33cc", "src_uid": "ee9fa8be2ae05a4e831a4f608c0cc785", "apr_id": "d35c53507e6ceeef3350a79ceacfa63c", "difficulty": 2300, "tags": ["matrices", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9958401157533008, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.InputStreamReader;\nimport java.io.IOException;\nimport java.util.InputMismatchException;\nimport java.io.PrintStream;\nimport java.io.BufferedReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.io.Reader;\nimport java.io.Writer;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n * @author Nipuna Samarasekara\n */\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tFastScanner in = new FastScanner(inputStream);\n\t\tFastPrinter out = new FastPrinter(outputStream);\n\t\tTaskE solver = new TaskE();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass TaskE {\n /////////////////////////////////////////////////////////////\n static int mod;\n\n public void solve(int testNumber, FastScanner in, FastPrinter out) {\n long n=in.nextLong();\n mod=(int)n;\n int sx=in.nextInt(),sy=in.nextInt();\n long dx=in.nextInt(),dy=in.nextInt(),t=in.nextLong();\n int[][] A={{2,1,1,1,0,0},\n {1,2,1,1,0,0},\n {1,0,1,0,0,0},\n {0,1,0,1,0,0},\n {1,1,1,1,1,0},\n {0,0,0,0,1,1}\n };\n int[][] B={{sx,sy,(int)dx,(int)dy,0,1},\n {1,2,1,1,0,0},\n {1,0,1,0,0,0},\n {0,1,0,1,0,0},\n {1,1,1,1,1,0},\n {0,0,0,0,1,1}\n };\n Matrix base= new Matrix(A),init= new Matrix(B);\n Matrix fin=Matrix.powMod(base,t,mod);\n Matrix ans= init.multiplyMod(fin,mod);\n int x=ans.get(0,0),y=ans.get(0,1);\n if(x==0)x=mod;\n if(y==0)y=mod;\n\n out.println(x+\" \"+y);\n\n }\n}\n\nclass FastScanner extends BufferedReader {\n\n public FastScanner(InputStream is) {\n super(new InputStreamReader(is));\n }\n\n public int read() {\n try {\n int ret = super.read();\n// if (isEOF && ret < 0) {\n// throw new InputMismatchException();\n// }\n// isEOF = ret == -1;\n return ret;\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n }\n\n public String next() {\n StringBuilder sb = new StringBuilder();\n int c = read();\n while (isWhiteSpace(c)) {\n c = read();\n }\n if (c < 0) {\n return null;\n }\n while (c >= 0 && !isWhiteSpace(c)) {\n sb.appendCodePoint(c);\n c = read();\n }\n return sb.toString();\n }\n\n static boolean isWhiteSpace(int c) {\n return c >= 0 && c <= 32;\n }\n\n public int nextInt() {\n int c = read();\n while (isWhiteSpace(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int ret = 0;\n while (c >= 0 && !isWhiteSpace(c)) {\n if (c < '0' || c > '9') {\n throw new NumberFormatException(\"digit expected \" + (char) c\n + \" found\");\n }\n ret = ret * 10 + c - '0';\n c = read();\n }\n return ret * sgn;\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public String readLine() {\n try {\n return super.readLine();\n } catch (IOException e) {\n return null;\n }\n }\n\n }\n\nclass FastPrinter extends PrintWriter {\n\n public FastPrinter(OutputStream out) {\n super(out);\n }\n\n public FastPrinter(Writer out) {\n super(out);\n }\n\n\n}\n\nclass Matrix {\n final int[][] a;\n public final int n;\n public final int m;\n\n public Matrix(int n, int m) {\n this.n = n;\n this.m = m;\n a = new int[n][m];\n }\n\n public Matrix(int n) {\n this(n, n);\n }\n\n public Matrix(int[][] a) {\n n = a.length;\n if (n == 0) {\n throw new AssertionError();\n }\n m = a[0].length;\n this.a = new int[n][];\n for (int i = 0; i < n; i++) {\n if (m != a[i].length) {\n throw new AssertionError();\n }\n this.a[i] = a[i].clone();\n }\n }\n\n public int get(int x, int y) {\n return a[x][y];\n }\n\n public static Matrix getOne(int n) {\n Matrix ret = new Matrix(n);\n for (int i = 0; i < n; i++) {\n ret.a[i][i] = 1;\n }\n return ret;\n }\n\n public Matrix multiplyMod(Matrix b, int mod) {\n if (m != b.n) {\n throw new AssertionError();\n }\n Matrix ret = new Matrix(n, b.m);\n long modmod = (long) mod * mod;\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < b.m; j++) {\n long d = 0;\n for (int k = 0; k < m; k++) {\n d = (d + (long) a[i][k] * b.a[k][j]);\n if (d >= modmod) {\n d -= modmod;\n }\n }\n ret.a[i][j] = (int) (d % mod);\n }\n }\n return ret;\n }\n\n public static Matrix powMod(Matrix a, long b, int mod) {\n if (a.n != a.m) {\n throw new AssertionError();\n }\n Matrix ret = getOne(a.n);\n while (b > 0) {\n if ((b & 1) == 1) {\n ret = ret.multiplyMod(a, mod);\n }\n a = a.multiplyMod(a, mod);\n b >>= 1;\n }\n return ret;\n }\n\n }\n\n", "lang": "Java 7", "bug_code_uid": "6183bcffd5629f4120156cff9da5ca4b", "src_uid": "ee9fa8be2ae05a4e831a4f608c0cc785", "apr_id": "2f537260abdd613d58ee212f28aa0187", "difficulty": 2300, "tags": ["matrices", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8414634146341463, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "import java.util.Scanner;\n\npublic class BEAR {\n public static int[][] mul(int[][] a, int[][] b, int mod){\n int n = a.length;\n int m = a[0].length;\n int l = b[0].length;\n int[][] ret = new int[n][l];\n for(int i = 0;i0){\n if((t & 1)!=0){\n ret = mul(ret, a, mod);\n }\n a = mul(a, a, mod);\n t>>=1;\n }\n return ret;\n }\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int x0 = in.nextInt()-1;\n int y0 = in.nextInt()-1;\n int dx0 =(in.nextInt()%n+n)%n;\n int dy0 =( in.nextInt()%n+n)%n;\n long t = in.nextLong();\n\n int[][] m = { \n { 2, 1, 1, 0, 1, 0 }, \n { 1, 2, 0, 1, 1, 0 }, \n { 1, 1, 1, 0, 1, 0 },\n { 1, 1, 0, 1, 1, 0 }, \n { 0, 0, 0, 0, 1, 1 },\n {0, 0, 0, 0, 0, 1}\n };\n int[][] original = {{x0}, \n {y0}, \n {dx0}, \n {dy0}, \n {0}, \n {1}};\n m = pow(m, t,n);\n int[][] res = mul(m , original, n);\n System.out.println((1+res[0][0])+\" \"+(1+res[1][0]));\n }\n}\n", "lang": "Java 7", "bug_code_uid": "9333dcc3f51895eed27d39a83fff8b42", "src_uid": "ee9fa8be2ae05a4e831a4f608c0cc785", "apr_id": "0439e449baca0e777f3e95ef2af9cc7d", "difficulty": 2300, "tags": ["matrices", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9482816901408451, "equal_cnt": 13, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 7, "fix_ops_cnt": 12, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tFastScanner in = new FastScanner(inputStream);\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\tTaskE solver = new TaskE();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass TaskE {\n public void solve(int testNumber, FastScanner in, PrintWriter out) {\n long n = in.nextLong();\n long sx = in.nextLong();\n long sy = in.nextLong();\n sx--;\n sy--;\n long dx = in.nextLong();\n long dy = in.nextLong();\n long t = in.nextLong();\n long[][] base = {\n {2, 1, 1, 0, 1, 2},\n {1, 2, 0, 1, 1, 2},\n {1, 1, 1, 0, 1, 2},\n {1, 1, 0, 1, 1, 2},\n {0, 0, 0, 0, 1, 1},\n {0, 0, 0, 0, 0, 1}};\n Matrix init = new Matrix(base, n);\n Matrix res = init.power(init, t);\n /*for (int i = 0; i < 6; i++) {\n for (int j = 0; j < 6; j++)\n out.print(res.value[i][j] + \" \");\n out.println();\n }*/\n sx = res.value[0][0] * sx + res.value[0][1] * sy + res.value[0][2] * dx + res.value[0][3] * dy +\n res.value[0][4] * 0 + res.value[0][5];\n sy = res.value[1][0] * sx + res.value[1][1] * sy + res.value[1][2] * dx + res.value[1][3] * dy +\n res.value[1][4] * 0 + res.value[1][5];\n sx %= n;\n sx += n;\n sx %= n;\n sy %= n;\n sy += n;\n sy %= n;\n sx++;\n sy++;\n out.println(sx + \" \" + sy);\n }\n}\n\nclass Matrix {\n long mod;\n long[][] value;\n final static int n = 6;\n\n Matrix(long[][] value, long mod) {\n this.value = value;\n this.mod = mod;\n }\n\n Matrix getOne() {\n long[][] one = new long[n][n];\n for (int i = 0; i < n; i++)\n one[i][i] = 1;\n return new Matrix(one, mod);\n }\n\n Matrix multiply(Matrix other) {\n Matrix res = new Matrix(new long[n][n], mod);\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 res.value[i][j] += value[i][k] * other.value[k][j] % mod;\n res.value[i][j] %= mod;\n }\n return res;\n }\n\n Matrix power(Matrix base, long pow) {\n Matrix res = getOne();\n while (pow > 0) {\n if (pow % 2 == 1)\n res = base.multiply(res);\n base = base.multiply(base);\n pow /= 2;\n }\n return res;\n }\n}\n\nclass FastScanner {\n BufferedReader reader;\n StringTokenizer tokenizer;\n\n public FastScanner(InputStream inputStream) {\n reader = new BufferedReader(new InputStreamReader(inputStream));\n }\n\n public String nextToken() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n String line;\n try {\n line = reader.readLine();\n } catch (IOException e) {\n return null;\n }\n tokenizer = new StringTokenizer(line);\n }\n return tokenizer.nextToken();\n }\n\n public long nextLong() {\n return Long.parseLong(nextToken());\n }\n\n }\n\n", "lang": "Java 7", "bug_code_uid": "aca5b70c0613a1faff8438c565fc9228", "src_uid": "ee9fa8be2ae05a4e831a4f608c0cc785", "apr_id": "a68d90676db2aed85856ff7da19638a4", "difficulty": 2300, "tags": ["matrices", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6994923857868021, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "\nimport java.util.Scanner;\n\n/**\n *\n * @author RS\n */\npublic class AChatRoom {\n\n /**\n * @param args the command line arguments\n */\n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n String str = scan.next();\n int index = 0 , leng = str.length();\n int counter = 0;\n char[] chr = {'h' , 'e' , 'l' , 'l', 'o'};\n char currentChar , lastChar;\n boolean equ = true;\n char current;\n while(indexk && j+k>i && k+i>j)\n c++;\n //System.out.println(i+ \" \"+ j+\" \"+k+\" \"+c);\n }\n }\n }\n }\n System.out.println(c);\n }\n\n}\n", "lang": "Java 8", "bug_code_uid": "84c1e99faa428e312cac360c3e74de69", "src_uid": "838f2e75fdff0f13f002c0dfff0b2e8d", "apr_id": "19919404746b9265244d1cc0c6886bf8", "difficulty": 1300, "tags": ["brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7281294816635935, "equal_cnt": 24, "replace_cnt": 19, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 23, "bug_source_code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.io.OutputStream;\nimport java.util.StringTokenizer;\nimport java.io.IOException;\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.InputStream;\nimport java.io.BufferedOutputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author Aeroui\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Kattio in = new Kattio(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n TaskA solver = new TaskA();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class TaskA {\n public void solve(int testNumber, Kattio in, PrintWriter out) {\n long x = in.nextLong();\n long y = in.nextLong();\n\n if (x < y) {\n out.println(\"No\");\n } else {\n long diff = Math.abs(x - y);\n out.println(diff % 2 == 0 ? \"Yes\" : \"No\");\n\n }\n }\n\n }\n\n static class Kattio extends PrintWriter {\n private BufferedReader r;\n private String line;\n private StringTokenizer st;\n private String token;\n\n public Kattio(InputStream i) {\n super(new BufferedOutputStream(System.out));\n r = new BufferedReader(new InputStreamReader(i));\n }\n\n public Kattio(InputStream i, OutputStream o) {\n super(new BufferedOutputStream(o));\n r = new BufferedReader(new InputStreamReader(i));\n }\n\n public long nextLong() {\n return Long.parseLong(nextToken());\n }\n\n private String peekToken() {\n if (token == null)\n try {\n while (st == null || !st.hasMoreTokens()) {\n line = r.readLine();\n if (line == null) return null;\n st = new StringTokenizer(line);\n }\n token = st.nextToken();\n } catch (IOException e) {\n }\n return token;\n }\n\n private String nextToken() {\n String ans = peekToken();\n token = null;\n return ans;\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "e517e1da29da7ba463c4d8fa3dcd271f", "src_uid": "838f2e75fdff0f13f002c0dfff0b2e8d", "apr_id": "b2b94c11a648c153314a61ecc454e664", "difficulty": 1300, "tags": ["brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8249733191035219, "equal_cnt": 18, "replace_cnt": 9, "delete_cnt": 6, "insert_cnt": 2, "fix_ops_cnt": 17, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.lang.reflect.Array;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\n\npublic class B {\n\tstatic boolean visited[][][];\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tboolean[] numbers = new boolean[n + 1];\n\n\t\tint count = 0;\n\n\t\tvisited = new boolean[n + 1][n + 1][n + 1];\n\n\t\tfor (int i = 1; i <= n; i++) {\n\t\t\tfor (int j = 1; j <= n; j++) {\n\t\t\t\tfor (int z = Math.max(i, j); z<=n&&i != j && z < i+j; z++) {\n\t\t\t\t//\tSystem.out.println(i + \" \"+j + \" \"+z);\n\t\t\t\t\tif (z != j && (i ^ j ^ z) == 0 && check(i,j,z)) {\n\t\t\t\t\t\tvisited[i][j][z] = true;\n\t\t\t\t\t\tvisited[i][z][j] = true;\n\t\t\t\t\t\tvisited[z][i][j] = true;\n\t\t\t\t\t\tvisited[z][j][i] = true;\n\t\t\t\t\t\tvisited[j][i][z] = true;\n\t\t\t\t\t\tvisited[j][z][i] = true;\n\t\t\t\t\t\t\n\n\t\t\t\t\t\t//System.out.println(i + \" \" + j + \" \" + z);\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t\t// 011 101 110\n\t\t// 00 10 10\n\t}\n\n\tstatic boolean check(int i, int j, int z) {\n\t\tif (!visited[i][j][z] && !visited[i][z][j] && !visited[z][i][j] && !visited[z][j][i] && !visited[j][i][z]\n\t\t\t\t&& !visited[j][z][i])\n\t\t\treturn true;\n\t\treturn false;\n\t}\n\n\n\tstatic int log(int x, int base) {\n\t\treturn (int) (Math.log(x) / Math.log(base));\n\t}\n\n\tstatic class Scanner {\n\t\tStringTokenizer st;\n\t\tBufferedReader br;\n\n\t\tpublic Scanner(InputStream s) {\n\t\t\tbr = new BufferedReader(new InputStreamReader(s));\n\t\t}\n\n\t\tpublic String next() throws IOException {\n\t\t\twhile (st == null || !st.hasMoreTokens())\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic int nextInt() throws IOException {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic long nextLong() throws IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic String nextLine() throws IOException {\n\t\t\treturn br.readLine();\n\t\t}\n\n\t\tpublic boolean ready() throws IOException {\n\t\t\treturn br.ready();\n\t\t}\n\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "34e03abce5c9f26f8b6e9bcb3615522c", "src_uid": "838f2e75fdff0f13f002c0dfff0b2e8d", "apr_id": "bbbb9dc4ea2fed179943dc0ec1099b65", "difficulty": 1300, "tags": ["brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.15726889144610665, "equal_cnt": 11, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "import java.util.*;\nimport java.io.*;\n\npublic class SimpleMolecules {\n \n public static void findBonds(long[] val, long[] mol){\n if ((val[0] == 0 && val[1] == 0) ||\n (val[1] == 0 && val[2] == 0) ||\n (val[0] == 0 && val[2] == 0))\n return;\n \n int maxpos = findMax(val);\n int minpos = findMin(val);\n \n val[maxpos] -= 1;\n val[minpos] -= 1;\n mol[maxpos + minpos - 1]++;\n \n findBonds(val, mol);\n }\n \n public static int findMax(long[] val){\n int maxpos = 0;\n long max = val[0];\n for(int i = 1; i < val.length; i++)\n if(val[i] > max){\n maxpos = i;\n max = val[i];\n }\n \n return maxpos; \n }\n \n public static int findMin(long[] val){\n int minpos = findMax(val);\n long min = val[findMax(val)];\n for(int i = 0; i < val.length; i++)\n if(i != minpos){\n if(val[i] <= min && val[i] > 0){\n minpos = i;\n min = val[i];\n }\n }\n \n return minpos;\n } \n\n public static boolean unconnAtom(long[] mol){\n if(mol[0] == 0 && mol[1] == 0)\n return true;\n if(mol[0] == 0 && mol[2] == 0)\n return true;\n if(mol[1] == 0 && mol[2] == 0)\n return true;\n \n return false;\n }\n \n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n long[] val = new long[3];\n val[0] = sc.nextLong();\n val[1] = sc.nextLong();\n val[2] = sc.nextLong();\n long[] mol = new long[3];\n \n findBonds(val, mol);\n \n if(unconnAtom(mol)){\n System.out.println(\"Impossible\");\n System.exit(1);\n }\n else if(!(val[0] == 0 && val[1] == 0 && val[2] == 0)) {\n System.out.println(\"Impossible\");\n System.exit(1);\n }\n else\n System.out.println(mol[0] + \" \" + mol[2] + \" \" + mol[1]);\n }\n} ", "lang": "Java 6", "bug_code_uid": "9c5ba4feacc0a3390f5e260b0d38db7c", "src_uid": "b3b986fddc3770fed64b878fa42ab1bc", "apr_id": "78b93f0110d16a582a241a9df7fd68d8", "difficulty": 1200, "tags": ["graphs", "math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9916083916083916, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "import java.io.*;\nimport java.util.*;\npublic class SumOfDigits\n{\n public static void main(String[] args) throws IOException\n {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n String[] s=br.readLine().split(\" \");\n int n=Integer.parseInt(s[0]);\n int k=Integer.parseInt(s[1]);\n int l=Integer.parseInt(s[2]);\n int c=Integer.parseInt(s[3]);\n int d=Integer.parseInt(s[4]);\n int p=Integer.parseInt(s[5]);\n int nl=Integer.parseInt(s[6]);\n int np=Integer.parseInt(s[7]);\n int tl=(k*l)/n;\n int cd=c*d;\n int pnp=p/np;\n int ans=Math.min(tl,cd,pnp)/nl;\n System.out.println(ans);\n }\n}", "lang": "Java 8", "bug_code_uid": "49f7ecde508b25d7393e52426d9669f6", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "apr_id": "0aee899d73022fa32703081150ed4b59", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9001793185893604, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "public class Binnum {\n\npublic static void main(String args[] ) throws Exception {\n \n Scanner scan = new Scanner(System.in);\n \n int n, k, l, c, d, p, nl, np;\n long totml, totmltofrnds, totslices, totsalt, tottoast;\n \n n = scan.nextInt();\n k = scan.nextInt();\n l = scan.nextInt();\n c = scan.nextInt();\n d = scan.nextInt();\n p = scan.nextInt();\n nl = scan.nextInt();\n np = scan.nextInt();\n \n totml = k*l;\n totmltofrnds = totml/n;\n totslices = c*d;\n totsalt = p*np;\n \n long min = Math.min(totmltofrnds, totslices);\n tottoast = Math.min(min, totsalt)/n;\n \n if(n == 1){\n \t tottoast = tottoast/l;\n }\n \n if(n == 2){\n \t tottoast = (tottoast/n) - l;\n }\n \n System.out.println(tottoast);\n}\n}", "lang": "Java 8", "bug_code_uid": "f10c967c3e38ea1168bda5ac9b21e32b", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "apr_id": "434b648f43b1b6d33ea2ccfc907dcb47", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8777684664192505, "equal_cnt": 31, "replace_cnt": 16, "delete_cnt": 0, "insert_cnt": 15, "fix_ops_cnt": 31, "bug_source_code": "/*\n * To change this template, choose Tools | Templates\n * and open the template in the editor.\n */\n\n/**\n *cf244b_uln\n * @author zulkan\n */\nimport java.util.StringTokenizer;\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport static java.lang.System.*;\nimport java.math.BigInteger;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Scanner;\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.HashSet;\n\npublic class cf244b_uln {\n\n static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n static Scanner sc = new Scanner(System.in);\n\n public static String getString() {\n try {\n return br.readLine();\n } catch (Exception e) {\n }\n return \"\";\n }\n\n public static Integer getInt() {\n try {\n return Integer.parseInt(br.readLine());\n } catch (Exception e) {\n }\n return 0;\n }\n\n public static Integer[] getIntArr() {\n try {\n StringTokenizer temp = new StringTokenizer(br.readLine());\n int n = temp.countTokens();\n Integer temp2[] = new Integer[n];\n for (int i = 0; i < n; i++) {\n temp2[i] = Integer.parseInt(temp.nextToken());\n }\n return temp2;\n } catch (Exception e) {\n }\n return null;\n }\n\n public static int getMax(Integer[] ar) {\n int t = ar[0];\n for (int i = 0; i < ar.length; i++) {\n if (ar[i] > t) {\n t = ar[i];\n }\n }\n return t;\n }\n\n public static void print(Object a) {\n out.println(a);\n }\n\n public static int nextInt() {\n return sc.nextInt();\n }\n\n public static double nextDouble() {\n return sc.nextDouble();\n }\n\n public static BigInteger getFact(long in) {\n BigInteger ot = new BigInteger(\"1\");\n for (Integer i = 1; i <= in; i++) {\n ot = ot.multiply(new BigInteger(i.toString()));\n }\n return ot;\n }\n\n public static String gbase(int a, int base) {\n StringBuilder out = new StringBuilder();\n int temp = a;\n while (temp > 0) {\n //out = temp % base + out;\n out.insert(0, temp % base);\n temp /= base;\n }\n return out.toString();\n }\n\n public static void main(String[] ar) {\n\n\n\n int n = getInt();\n int out = 0;\n\n boolean all[] = new boolean[n + 1];\n for (int i = 0; i < 10; i++) {\n for (int j = i; j < 10; j++) {\n if (i != 0 || j != 0) {\n ArrayList last = new ArrayList();\n last.add(i);\n last.add(j);\n all[i] = true;\n all[j] = true;\n\n int ls = j;\n while (ls < n) {\n ArrayList last2 = new ArrayList();\n for (int ii = 0; ii < last.size(); ii++) {\n int a = last.get(ii) * 10 + i;\n int b = last.get(ii) * 10 + j;\n last2.add(a);\n last2.add(b);\n //print(a + \" \" + b);\n if (b <= n) {\n\n all[b] = true;\n }\n if (a <= n) {\n all[a] = true;\n }\n ls = b;\n }\n // print(ls + \" \" + last2);\n last = last2;\n\n }\n\n }\n }\n }\n for (int i = 1; i <= n; i++) {\n //print(i + \" \" + all[i]);\n if (all[i]) {\n out++;\n }\n }\n print(out);\n\n\n }\n}\n", "lang": "Java 7", "bug_code_uid": "6b1b349b4627b168e395c8b30b12ad20", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "apr_id": "a8a55605f2ae7dc0e73c99a089e81cea", "difficulty": 1600, "tags": ["dfs and similar", "brute force", "bitmasks"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9635369188696444, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\n/**\n *\n * @author sukhdeep\n */\npublic class Code {\n public static void main(String arg[]) throws IOException\n {\n BufferedReader r=new BufferedReader(new InputStreamReader(System.in));\n \n \n \n StringBuilder str=new StringBuilder(r.readLine());\n long x=1;\n int a[]=new int[10];\n int count=10;\n if(str.charAt(0)=='?')\n x=x*9;\n if(str.charAt(0)>=65&&str.charAt(0)<=74)\n {\n x=x*9;\n a[str.charAt(0)-65 ]=1;\n count--;\n }\n for(int i=1;i=65&&str.charAt(i)<=74))\n {a[str.charAt(i)-65]=1;\n x=x*count;\n count--;\n }\n }\n System.out.println(x);\n \n}\n}", "lang": "Java 6", "bug_code_uid": "28ad9aa31c7b158048aeee5620bb9eb7", "src_uid": "d3c10d1b1a17ad018359e2dab80d2b82", "apr_id": "553805738131b8f8bf6715cbc002a2e1", "difficulty": 1100, "tags": ["greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.635827664399093, "equal_cnt": 13, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 12, "bug_source_code": "import java.util.Arrays;\nimport java.util.Scanner;\npublic class Pretty_Integers {\n public static void main(String[] args) {\n Scanner in=new Scanner(System.in);\n int m=in.nextInt();\n int n=in.nextInt();\n String X=\"\";\n int [] a=new int[m];\n int [] b=new int [n];\n for (int i = 0; i < m; i++) {\n a[i]=in.nextInt(); \n }\n for (int i = 0; i < n; i++) {\n b[i]=in.nextInt(); \n }\n Arrays.sort(a);\n Arrays.sort(b);\n if(a[0]==b[0])\n X+=a[0];\n else{\n if(a[0] 0 && b[i] > 0){\n ans = i;\n break;\n }\n }\n if(ans > 0){\n System.out.println(ans);\n }else{\n int first = 0;\n int second = 0;\n for(int i = 0; i < 10; i++){\n if(a[i] > 0){\n first = i;\n break;\n }\n }\n for(int i = 0; i < 10; i++){\n if(b[i] > 0){\n second = i;\n break;\n }\n }\n ans += Math.min(first, second);\n ans *= 10;\n ans += Math.max(first, second);\n System.out.println(ans);\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "e9f58b9c6babe0e2b4f3d3cbc4a9523c", "src_uid": "3a0c1b6d710fd8f0b6daf420255d76ee", "apr_id": "a6cc8c80eee2a6581bbcc30b8ea292d4", "difficulty": 900, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9096313912009513, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "import java.io.*;\nimport java.util.Scanner;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.lang.Math;\n\npublic class MyCode {\n\tpublic static void main (String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int k = sc.nextInt();\n int x = sc.nextInt();\n \n ArrayList list = new ArrayList<>();\n for(int i = 0; i < n; i++){\n list.add(sc.nextInt());\n }\n \n ArrayList newL = new ArrayList<>();\n for(int i = 0; i < n; i++){\n int s = list.get(i);\n if(newL.size() == 0){\n newL.add(new Group(s, 1));\n } else {\n Group last = newL.get(newL.size() - 1);\n int lastVal = last.val;\n if(s == lastVal){\n last.countUp();\n } else {\n newL.add(new Group(s, 1));\n }\n }\n }\n \n int ansCount = 0;\n int l = 0;\n int r = 0;\n for(int i = 0; i < newL.size(); i++){\n Group s = newL.get(i);\n if(x == s.val){\n if(s.count > 1){\n l = i - 1;\n r = i + 1;\n int tempCount = 2;\n while(l >= 0 && r < newL.size() \n && newL.get(l).val == newL.get(r).val\n && newL.get(l).count + newL.get(r).count >= 3){\n tempCount += newL.get(r).count + newL.get(l).count;\n r += 1;\n l -= 1;\n }\n if(tempCount > ansCount){\n ansCount = tempCount;\n }\n }\n }\n }\n \n System.out.print(ansCount);\n }\n}\n\npublic class Group {\n public int val;\n public int count;\n \n public Group(int val, int count){\n this.val = val;\n this.count = count;\n }\n \n public void countUp(){\n this.count += 1;\n }\n}", "lang": "Java 8", "bug_code_uid": "645e5b893ee2373adcf7bdbdb0ad660f", "src_uid": "d73d9610e3800817a3109314b1e6f88c", "apr_id": "376455d146256717258d18b6b7f3d2dd", "difficulty": 1400, "tags": ["brute force", "two pointers"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9865030674846625, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "\nimport java.io.*;\nimport static java.lang.Math.max;\nimport static java.lang.Long.min;\nimport static java.lang.Math.abs;\nimport static java.lang.Math.pow;\nimport static java.lang.System.out;\nimport java.util.*;\n \npublic class Kaudo { \n static Reader in =new Reader();\n static StringBuilder Sd=new StringBuilder();\n static long ans=0,res;\n public static void main(String [] args) {\n int n =in.nextInt(),k=in.nextInt(),x=in.nextInt();\n int a[]=new int [n];\n for(int i=0;i=0&&a[u]==xo){l++;u--;}\n if(o=0&&o=3){ans+=l;}\n else break;\n l=0;}\n if(o>=n&&u<0){\n if(l>=3){ans+=l;}\n \n break;}\n if(u<0&&a[o]!=xo){ if(l>=3){ans+=l;}\n break;}\n if(o>=n&&a[u]!=xo){ if(l>=3){ans+=l;}\n break;}}}\n res=max(res,ans-1);\n ans=0;\n }\n System.out.println(res);\n }\n\n static class Reader \n { \n private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;} \n public int read() {if (numChars == -1) throw new InputMismatchException();if (curChar >= numChars) {curChar = 0;try { numChars = mIs.read(buf);} catch (IOException e) { throw new InputMismatchException();}if (numChars <= 0) return -1; }return buf[curChar++];} \n public String nextLine(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isEndOfLine(c));return res.toString() ;} \n public String s(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isSpaceChar(c));return res.toString();} \n public long l(){int c = read();while (isSpaceChar(c)) c = read();int sgn = 1;if (c == '-') { sgn = -1 ; c = read() ; }long res = 0; do{ if (c < '0' || c > '9') throw new InputMismatchException();res *= 10 ; res += c - '0' ; c = read();}while(!isSpaceChar(c));return res * sgn;} \n public int nextInt(){int c = read() ;while (isSpaceChar(c)) c = read();int sgn = 1;if (c == '-') { sgn = -1 ; c = read() ; }int res = 0;do{if (c < '0' || c > '9') throw new InputMismatchException();res *= 10 ; res += c - '0' ; c = read() ;}while(!isSpaceChar(c));return res * sgn;} \n public double d() throws IOException {return Double.parseDouble(s()) ;}\n public boolean isSpaceChar(int c) { return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1; } \n public boolean isEndOfLine(int c) { return c == '\\n' || c == '\\r' || c == -1; } \n public int[] arr(int n){int[] ret = new int[n];for (int i = 0; i < n; i++) {ret[i] = nextInt();}return ret;}\n }\n \n}\nclass Sorting{\n \n public static int[] bucketSort(int[] array, int bucketCount) {\n \n if (bucketCount <= 0) throw new IllegalArgumentException(\"Invalid bucket count\");\n \n if (array.length <= 1) return array; //trivially sorted\n \n \n \n int high = array[0];\n \n int low = array[0];\n \n for (int i = 1; i < array.length; i++) { //find the range of input elements\n \n if (array[i] > high) high = array[i];\n \n if (array[i] < low) low = array[i];\n \n }\n \n double interval = ((double)(high - low + 1))/bucketCount; //range of one bucket\n \n \n ArrayList buckets[] = new ArrayList[bucketCount];\n \n for (int i = 0; i < bucketCount; i++) { //initialize buckets\n \n buckets[i] = new ArrayList();\n \n }\n \n \n \n for (int i = 0; i < array.length; i++) { //partition the input array\n \n buckets[(int)((array[i] - low)/interval)].add(array[i]);\n \n }\n \n \n int pointer = 0;\n \n for (int i = 0; i < buckets.length; i++) {\n \n Collections.sort(buckets[i]); //mergeSort\n \n for (int j = 0; j < buckets[i].size(); j++) { //merge the buckets\n \n array[pointer] = buckets[i].get(j);\n \n pointer++;\n \n }\n \n}\n \nreturn array;\n \n}\n \n}", "lang": "Java 8", "bug_code_uid": "98f6a4c5313398f178a42b6e28f3134f", "src_uid": "d73d9610e3800817a3109314b1e6f88c", "apr_id": "1ec3e7e5af8d12fd30167f65088ce9f3", "difficulty": 1400, "tags": ["brute force", "two pointers"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9886992065400336, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 8, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.util.*;\n\npublic class Main {public static void main(String[] args) throws Exception {new Solve();}}\n\nclass Solve { public Solve() throws Exception {solve();}\n\n void solve() throws Exception {\n int n = NI();\n int k = NI();\n int x = NI();\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = NI();\n int res = 0;\n for (int i = 0; i < n - 1; i++) {\n if (a[i] == x)\n res = max(res, count(a, i, i + 1));\n\n }\n System.out.println(res);\n\n\n }\n\n int count(int[] a, int l, int r) {\n if (l < 0 || r >= a.length || a[l] != a[r])\n return 0;\n int tl = l, tr = r;\n while (tl > 0 && a[l] == a[tl - 1])\n tl--;\n while (tr + 1 < a.length && a[r] == a[tr + 1])\n tr++;\n if (a[tl] == a[l] && a[tr] == a[r]\n && a[tr] - a[r] + a[l] - a[tl] >= 0) {\n return count(a, tl - 1, tr + 1) + tr - r + l - tl + 2;\n } else {\n return 0;\n }\n }\n\n class Pair {\n int index, value, color;\n public Pair(int ind, int val) {\n index = ind;\n value = val;\n }\n }\n\n static BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in));\n static StringTokenizer st=new StringTokenizer(\"\");\n static Scanner sc = new Scanner(System.in);\n int min(int i1,int i2){return i1i2?i1:i2;}\n long max(long i1,long i2){return i1>i2?i1:i2;}\n String NS()throws Exception{while(!st.hasMoreTokens())st=new StringTokenizer(stdin.readLine());return st.nextToken();}\n String NLn() throws Exception {return stdin.readLine();}\n int NI()throws Exception{return Integer.parseInt(NS());}\n long NL()throws Exception{return Long.parseLong(NS());}\n double ND()throws Exception{return Double.parseDouble(NS());}\n int abs(int x){return x<0?-x:x;}\n}", "lang": "Java 8", "bug_code_uid": "1c6932ada6dbb03741ae522751a067d9", "src_uid": "d73d9610e3800817a3109314b1e6f88c", "apr_id": "421f99771f5f54978cbab83d1fc49603", "difficulty": 1400, "tags": ["brute force", "two pointers"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8749063670411985, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "public class NewWall {\n public static void main(String[] args) {\n Scanner input=new Scanner (System.in);\n int x,y,a,b,a1,b1,c=1,k,count=0;\n x=input.nextInt();\n y=input.nextInt();\n a=input.nextInt();\n b=input.nextInt();\n a1=x;\n b1=y;\n while(true){\n c=b1%a1;\n if(c==0)\n break;\n b1=a1;\n a1=c;\n }\n \n k=((x*y)/a1);\n int i;\n for ( i = a; i <= b; i++)\n if (i>=k && i%k==0)\n break;\n for (int j = i; j <= b; j+=k)\n count++;\n System.out.println(count);\n }\n}", "lang": "Java 8", "bug_code_uid": "1582952613406bd3ba682f1ffb3c3c74", "src_uid": "c7aa8a95d5f8832015853cffa1374c48", "apr_id": "ae735acdb9762f569390d6fab722cc18", "difficulty": 1200, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8147699757869249, "equal_cnt": 11, "replace_cnt": 11, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "public class Shovel {\n\n /**\n * @param args the command line arguments\n */\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n,k,l,c,d,p,nl,np,r;\n String scentence = sc.nextLine();\n String []arr = scentence.split(\" \");\n n = Integer.parseInt(arr[0]);\n k = Integer.parseInt(arr[1]);\n l = Integer.parseInt(arr[2]);\n c = Integer.parseInt(arr[3]);\n d = Integer.parseInt(arr[4]);\n p = Integer.parseInt(arr[5]);\n nl = Integer.parseInt(arr[6]);\n np = Integer.parseInt(arr[7]);\n \n r = n*nl/k*l;\n if(r<=(c*d)&&r<=(p/np*n)){System.out.println(\"\"+r);}\n \n \n } \n}\n", "lang": "Java 8", "bug_code_uid": "f3260f60e602e700242a825718b44016", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "apr_id": "5f16e7ee63a93891b1532a9cbd19c292", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9986568166554735, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\nimport java.io.*;\n\npublic class mainsource {\n\tpublic static class point {\n\t\tint first, second;\n\n\t\tpoint() {\n\t\t}\n\n\t\tpoint(int f, int s) {\n\t\t\tthis.first = f;\n\t\t\tthis.second = s;\n\t\t}\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tpoint set[] = new point[8];\n\t\tArrayList arr1 = new ArrayList<>();\n\t\tArrayList arr2 = new ArrayList<>();\n\t\tfor (int i = 0; i < 8; ++i) {\n\t\t\tint first = sc.nextInt();\n\t\t\tint second = sc.nextInt();\n\t\t\tset[i] = new point(first, second);\n\t\t\tif (!arr1.contains(first))\n\t\t\t\tarr1.add(first);\n\t\t\tif (!arr2.contains(second))\n\t\t\t\tarr2.add(second);\n\t\t}\n\t\tif (arr1.size()!=3 && arr2.size() != 3) {\n\t\t\tSystem.out.print(\"ugly\");\n\t\t} else {\n\t\t\tArrays.sort(set, new Comparator() {\n\t\t\t\t@Override\n\t\t\t\tpublic int compare(point a, point b) {\n\t\t\t\t\tif (a.first == b.first) {\n\t\t\t\t\t\treturn a.second - b.second;\n\t\t\t\t\t} else\n\t\t\t\t\t\treturn a.first - b.first;\n\t\t\t\t}\n\t\t\t});\n\t\t\tint idx=0;\n\t\t\tpoint checker[]=new point[8];\n\t\t\tCollections.sort(arr1);\n\t\t\tCollections.sort(arr2);\n\t\t\tfor(int i=0;i<3;++i)\n\t\t\t{\n\t\t\t\tfor(int j=0;j<3;++j)\n\t\t\t\t{\n\t\t\t\t\tif(i==1 && j==1)\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tchecker[idx++]=new point(arr1.get(i),arr2.get(j));\n\t\t\t\t}\n\t\t\t}\n\t\t\tBoolean flag=true;\n\t\t\tfor(int i=0;i<8;++i)\n\t\t\t{\n\t\t\t\tif(checker[i].first!=set[i].first || checker[i].second!=set[i].second)\n\t\t\t\t{\n\t\t\t\t\tflag=false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(flag)\n\t\t\t\tSystem.out.print(\"respectable\");\n\t\t\telse\n\t\t\t\tSystem.out.print(\"ugly\");\n\t\t}\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "c0db5134b178b69d00eb6428bd91a4cf", "src_uid": "f3c96123334534056f26b96f90886807", "apr_id": "45944e2a87bfa6da55ade2ca03e26e76", "difficulty": 1400, "tags": ["sortings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9817311874728143, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\n\n//Current File Class\npublic class HELL \n{\n static Scanner cin=new Scanner(System.in);\n public static void main(String[] args)\n {\n //itr1.hasNext() return boolean (True,False)\n //itr1.next() returns the current integer and go to next element in set;\n int[][] arr=new int[3][3];\n Set s1=new TreeSet();\n Set s2=new TreeSet();\n List l1=new LinkedList();\n List l2=new LinkedList();\n for(int j=0;j<8;++j)\n {\n int a=cin.nextInt(),b=cin.nextInt();\n l1.add(a); l2.add(b);\n s1.add(a); s2.add(b);\n }\n if(s1.size()>3 || s2.size()>3)\n System.out.println(\"ugly\");\n else\n {\n Iterator itr1,itr2;\n itr1=s1.iterator(); itr2=s2.iterator();\n int x1=itr1.next(), x2=itr2.next();\n int y1=itr1.next(), y2=itr2.next();\n int z1=itr1.next(), z2=itr2.next();\n \n for(int j=0;j<8;++j)\n {\n if(l1.get(j)==x1)\n { l1.remove(j); l1.add(j,0); }\n else if(l1.get(j)==y1)\n { l1.remove(j); l1.add(j,1); }\n else if(l1.get(j)==z1)\n { l1.remove(j); l1.add(j,2); }\n if(l2.get(j)==x2)\n { l2.remove(j); l2.add(j,0); }\n else if(l2.get(j)==y2)\n { l2.remove(j); l2.add(j,1); }\n else if(l2.get(j)==z2)\n { l2.remove(j); l2.add(j,2); } \n }\n for(int j=0;j<8;++j)\n arr[l1.get(j)][l2.get(j)]=1;\n \n for(int j=0;j<3;++j)\n for(int i=0;i<3;++i)\n if(j!=1 || i!=1)\n if(arr[j][i]!=1)\n { System.out.println(\"ugly\"); return; }\n \n if(arr[1][1]!=0)\n System.out.println(\"ugly\");\n else\n System.out.println(\"respectable\");\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "73e0de7f5fd32972a8a3166d9751017b", "src_uid": "f3c96123334534056f26b96f90886807", "apr_id": "5cf41b45670f96ff015c9394436b8c69", "difficulty": 1400, "tags": ["sortings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9983606557377049, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "\n\nimport java.util.Scanner;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\n\npublic class B {\n\n\tpublic static void main (String args[]){\n\t\t\n\t\tScanner in = new Scanner(System.in);\n\t\t\n\t\t\n\t\t\n\t\tint x[] = new int[8];\n\t\tint y[] = new int[8];\n\t\tTreeMaps = new TreeMap();\n\t\t\n\t\tTreeMapz = new TreeMap();\n\t\n\t\t\n\t\tfor(int i = 0 ; i < 8 ; i++){\n\t\t\tx[i]=in.nextInt();\n\t\t\ty[i]=in.nextInt();\n\t\t\t\n\t\t\ts.put(x[i],x[i]);\n\t\t\tz.put(y[i],y[i]);\n\t\t}\n\n\t\tif(s.size()!=z.size() && s.size()!=3){\n\t\t\tSystem.out.println(\"ugly\");\n\t\t}\n\t\telse{\t\n\t\t\n\t\tint a[] = new int[3];\n\t\tint b[] = new int[3];\n\t\t\n\t\n\t\tfor(int i=0;i<3;i++){\n\t\t\t a[i]=s.lastEntry().getKey();\n\t\t\n\t\t\t s.remove(a[i]);\n\t\t\t\n\t\t\t b[i]=z.lastEntry().getKey();\n\t\t\t\t\n\t\t\t z.remove(b[i]);\n\t\t\t \n\t\t}\n\t\t\n\t\t\n\t\t\n\t\tboolean m=true;\n\t\t\n\t\tfor(int i = 0 ; i < 3 && m; i++){\n\t\t\tfor(int j = 0 ; j < 3 && m; j++){\n\t\t\t\tif(j==1 && i ==1) \n\t\t\t\t\tcontinue;\n\t\t\t\t\n\t\t\t\tboolean f = false;\n\t\t\t\tfor(int k = 0 ; k < 8 ; k++){\n\t\t\t\t\tif(x[k]==a[i] && y[k]==b[j]){\n\t\t\t\t\t\tf=true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(!f){\n\t\t\t\t\tSystem.out.println(\"ugly\");\n\t\t\t\t\tm=false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(m)\n\t\tSystem.out.println(\"respectable\");\n\t\t\t\n\t}\n\t}\n\t\n}\n", "lang": "Java 6", "bug_code_uid": "9c224dac040cc22ea8f662fdca01ef4c", "src_uid": "f3c96123334534056f26b96f90886807", "apr_id": "5feda10c962f46a0a823e22736078fec", "difficulty": 1400, "tags": ["sortings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9992395437262357, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner;\npublic class Ishu\n{\n public static void main(String[] args)\n {\n Scanner scan=new Scanner(System.in); \n int i; \n String s;\n s=scan.next();\n for(i=1;i c && a + c > b && b + c > a);\n\t}\n\t\n\tpublic void solve() throws IOException {\n\t\tString[] next = in.readLine().split(\" \");\n\t\tint a = Integer.parseInt(next[0]);\n\t\tint b = Integer.parseInt(next[1]);\n\t\tint c = Integer.parseInt(next[2]);\n\t\tint l = Integer.parseInt(next[3]);\n\t\t\n\t\tlong ways = 0;\n\t\tfor (int i = 0; i <= l; i++) {\n\t\t\t// length of one side >= second = third side + whats left of l\n\t\t\t//if (a + i > b + c + l - i) break;\n\t\t\tfor (int j = 0; i + j <= l; j++) {\n\t\t\t\t//if (b + j > a + c + l - i - j) break;\n\t\t\t\tfor (int k = 0; i + j + k <= l; k++) {\n\t\t\t\t\tif (isTriangle(a + i,b + j,c + k)) {\n\t\t\t\t\t\tways++;\n\t\t\t\t\t}\n\t\t\t\t\t//else { break; } \n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ways);\n\t\tin.close();\n\t}\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tnew LenghteningSticks().solve();\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "7fb93bbb83db7720f082494b8fbc8b0d", "src_uid": "185ff90a8b0ae0e2b75605f772589410", "apr_id": "ff91c72c63647578dacb8735765f1c92", "difficulty": 2100, "tags": ["brute force", "dp", "math", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9784897025171625, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\n\n/**\n * @author Don Li\n */\npublic class LengtheningSticks {\n void solve() {\n int a = in.nextInt(), b = in.nextInt(), c = in.nextInt(), l = in.nextInt();\n\n long ans = binomialCoefficient(l + 3, 3) - count(a, b, c, l) - count(b, a, c, l) - count(c, a, b, l);\n\n out.println(ans);\n }\n\n private long count(int a, int b, int c, int l) {\n long res = 0;\n int lb = Math.max(c, a + b);\n int ub = c + l;\n for (int i = lb; i <= ub; i++) {\n int x = Math.min(i - a - b, l - i + c);\n if (x >= 0) res += binomialCoefficient(x + 2, 2);\n }\n return res;\n }\n\n private long binomialCoefficient(int n, int k) {\n if (k > n - k) return binomialCoefficient(n, n - k);\n if (k == 0) return 1;\n long ans = 1;\n for (int i = 1; i <= k; i++) {\n ans = ans * (n - i + 1) / i;\n }\n return ans;\n }\n\n public static void main(String[] args) {\n in = new FastScanner(new BufferedReader(new InputStreamReader(System.in)));\n out = new PrintWriter(System.out);\n new LengtheningSticks().solve();\n out.close();\n }\n\n static FastScanner in;\n static PrintWriter out;\n\n static class FastScanner {\n BufferedReader in;\n StringTokenizer st;\n\n public FastScanner(BufferedReader in) {\n this.in = in;\n }\n\n public String nextToken() {\n while (st == null || !st.hasMoreTokens()) {\n try {\n st = new StringTokenizer(in.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(nextToken());\n }\n\n public long nextLong() {\n return Long.parseLong(nextToken());\n }\n\n public double nextDouble() {\n return Double.parseDouble(nextToken());\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "1cbc8dc45624b91e1a03f837d6d4ca92", "src_uid": "185ff90a8b0ae0e2b75605f772589410", "apr_id": "a82b41ec969f60fc565fd1dbf00b57dd", "difficulty": 2100, "tags": ["brute force", "dp", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.3100454733360893, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "import java.util.*;\nimport java.util.Arrays;\npublic class Lengthening {\n\tstatic Scanner seer = new Scanner(System.in);\n\tstatic int a,b,c,l;\n\tpublic static void main(String[] args) {\n\t\ta = seer.nextInt();\n\t\tb = seer.nextInt();\n\t\tc = seer.nextInt();\n\t\tl = seer.nextInt();\n\t\t\n\t\tlong res = 0;\n\t\tfor(int k = 0; k <= l; k++){\n\t\t\tres+= calc(k); //System.out.println(calc(k));\n\t\t}\n\t\t\n\t\tSystem.out.println(res);\n\t}\n\tpublic static long calc(int k){\n\t\tint c = Lengthening.c + k;\n\t\tint l = Lengthening.l - k;\n\t\tif(Math.abs(a-b) < c){\n\t\t\tint parte_grande = (l+1)*(l+2)/2;\n\t\t\tint parte_chica = (a+b>c)? 0:(c-a-b+1)*(c-a-b+2)/2;\n\t\t\tparte_chica = Math.min(parte_grande,parte_chica);\n\t\t\tint n = a+l-b-c+1;\n\t\t\tint parte_arriba = 0>=n? 0:(n%2==0?(n/2)*(n/2 + 1):(n/2 + 1)*(n/2 + 1));\n\t\t\tn = b+l-a-c+1;\n\t\t\tint parte_abajo = 0>=n? 0:(n%2==0?(n/2)*(n/2 + 1):(n/2 + 1)*(n/2 + 1));\n\t\t\t\t\t\n\t\t\treturn parte_grande - parte_chica - parte_arriba - parte_abajo;\t\t\n\t\t}\n\t\telse{\n\t\t\tint p = Math.abs(a-b);\n\t\t\tint n = -p + l + c;\n\t\t\tint parte_grande = 0>=n? 0:(n%2==0?(n/2)*(n/2 + 1):(n/2 + 1)*(n/2 + 1));\n\t\t\tn = -p + l - c + 1;\n\t\t\tint parte_chica = 0>=n? 0:(n%2==0?(n/2)*(n/2 + 1):(n/2 + 1)*(n/2 + 1));\n\t\t\t\n\t\t\treturn parte_grande - parte_chica;\n\t\t}\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "70860468ec41b550f1f937a7d77b88d7", "src_uid": "185ff90a8b0ae0e2b75605f772589410", "apr_id": "7b74fbbdcdfd51545b6efc7d86b787d6", "difficulty": 2100, "tags": ["brute force", "dp", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7216083486801719, "equal_cnt": 21, "replace_cnt": 7, "delete_cnt": 4, "insert_cnt": 9, "fix_ops_cnt": 20, "bug_source_code": "import java.io.BufferedOutputStream;\nimport java.io.BufferedReader;\nimport java.io.FileInputStream;\nimport java.io.FileNotFoundException;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.Random;\nimport java.util.StringTokenizer;\n\npublic class C\n{\n\tpublic static final Random RANDOM = new Random(System.currentTimeMillis());\n\tprivate BufferedReader bufferedReader;\n\tprivate StringTokenizer stringTokenizer;\n\tprivate PrintWriter out;\n\n\tpublic C()\n\t{\n\t\tthis(new BufferedReader(new InputStreamReader(System.in)));\n\t}\n\n\tpublic C(BufferedReader bufferedReader)\n\t{\n\t\tthis.bufferedReader = bufferedReader;\n\t\tthis.stringTokenizer = null;\n\t\tthis.out = new PrintWriter(new BufferedOutputStream(System.out));\n\t}\n\n\tpublic C(String file) throws FileNotFoundException\n\t{\n\t\tthis(new BufferedReader(new InputStreamReader(new FileInputStream(file))));\n\t}\n\n\tprivate String next() throws IOException\n\t{\n\t\twhile ((this.stringTokenizer == null) || (!this.stringTokenizer.hasMoreTokens()))\n\t\t{\n\t\t\tthis.stringTokenizer = new StringTokenizer(this.bufferedReader.readLine());\n\t\t}\n\t\treturn stringTokenizer.nextToken();\n\t}\n\n\tpublic int nextInt() throws IOException\n\t{\n\t\treturn Integer.parseInt(next());\n\t}\n\n\tpublic double nextDouble() throws IOException\n\t{\n\t\treturn Double.parseDouble(next());\n\t}\n\n\tpublic long nextLong() throws IOException\n\t{\n\t\treturn Long.parseLong(next());\n\t}\n\n\tpublic String nextLine() throws IOException\n\t{\n\t\treturn this.bufferedReader.readLine();\n\t}\n\n\tpublic void close()\n\t{\n\t\tout.close();\n\t}\n\n\tpublic static void main(String[] args)\n\t{\n\t\tC template = new C();\n\t\ttry\n\t\t{\n\t\t\ttemplate.solve();\n\t\t}\n\t\tcatch (IOException exception)\n\t\t{\n\t\t\texception.printStackTrace();\n\t\t}\n\t\ttemplate.close();\n\t}\n\n\tpublic boolean degenerate(int[] x)\n\t{\n\t\tboolean result = false;\n\t\tfor (int index = 0; index < 3; index++)\n\t\t{\n\t\t\tresult |= x[index] >= x[(index + 1) % 3] + x[(index + 2) % 3];\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic void solve() throws IOException\n\t{\n\t\tint x[] = new int[3];\n\t\tx[0] = nextInt();\n\t\tx[1] = nextInt();\n\t\tx[2] = nextInt();\n\t\tint l = nextInt();\n\t\tArrays.sort(x);\n\t\tlong result = 0;\n\t\tfor (int l2 = 0; l2 <= l; l2++)\n\t\t{\n\t\t\tfor (int l1 = 0; l1 <= l - l2; l1++)\n\t\t\t{\n\t\t\t\tint x1 = Math.min(x[1] + l1, x[2] + l2);\n\t\t\t\tint x2 = Math.max(x[1] + l1, x[2] + l2);\n\t\t\t\tint l0Min = Math.max(0, x2 - x1 - x[0] + 1);\n\t\t\t\tint l0Max = Math.min(l - l2 - l1, x1 + x2 - x[0] - 1);\n//\t\t\t\tout.println(x1 + \", \" + x2 + \", \" + l0Min + \"-\" + l0Max);\n\t\t\t\tresult += Math.max(0, l0Max - l0Min + 1);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(result);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "2b6ff6ec725e6b6ac01c4c08742f9ce4", "src_uid": "185ff90a8b0ae0e2b75605f772589410", "apr_id": "d81ab1c65d98ef3b2add057f16335b06", "difficulty": 2100, "tags": ["brute force", "dp", "math", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9982161060142711, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedOutputStream;\nimport java.io.BufferedReader;\nimport java.io.FileInputStream;\nimport java.io.FileNotFoundException;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.Random;\nimport java.util.StringTokenizer;\n\npublic class C\n{\n\tpublic static final Random RANDOM = new Random(System.currentTimeMillis());\n\tprivate BufferedReader bufferedReader;\n\tprivate StringTokenizer stringTokenizer;\n\tprivate PrintWriter out;\n\n\tpublic C()\n\t{\n\t\tthis(new BufferedReader(new InputStreamReader(System.in)));\n\t}\n\n\tpublic C(BufferedReader bufferedReader)\n\t{\n\t\tthis.bufferedReader = bufferedReader;\n\t\tthis.stringTokenizer = null;\n\t\tthis.out = new PrintWriter(new BufferedOutputStream(System.out));\n\t}\n\n\tpublic C(String file) throws FileNotFoundException\n\t{\n\t\tthis(new BufferedReader(new InputStreamReader(new FileInputStream(file))));\n\t}\n\n\tprivate String next() throws IOException\n\t{\n\t\twhile ((this.stringTokenizer == null) || (!this.stringTokenizer.hasMoreTokens()))\n\t\t{\n\t\t\tthis.stringTokenizer = new StringTokenizer(this.bufferedReader.readLine());\n\t\t}\n\t\treturn stringTokenizer.nextToken();\n\t}\n\n\tpublic int nextInt() throws IOException\n\t{\n\t\treturn Integer.parseInt(next());\n\t}\n\n\tpublic double nextDouble() throws IOException\n\t{\n\t\treturn Double.parseDouble(next());\n\t}\n\n\tpublic long nextLong() throws IOException\n\t{\n\t\treturn Long.parseLong(next());\n\t}\n\n\tpublic String nextLine() throws IOException\n\t{\n\t\treturn this.bufferedReader.readLine();\n\t}\n\n\tpublic void close()\n\t{\n\t\tout.close();\n\t}\n\n\tpublic static void main(String[] args)\n\t{\n\t\tC template = new C();\n\t\ttry\n\t\t{\n\t\t\ttemplate.solve();\n\t\t}\n\t\tcatch (IOException exception)\n\t\t{\n\t\t\texception.printStackTrace();\n\t\t}\n\t\ttemplate.close();\n\t}\n\n\tpublic static boolean degenerate(int[] x)\n\t{\n\t\tboolean result = false;\n\t\tfor (int index = 0; index < 3; index++)\n\t\t{\n\t\t\tresult |= x[index] >= x[(index + 1) % 3] + x[(index + 2) % 3];\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic static long sumUpTo(int n)\n\t{\n\t\tn = Math.max(0, n);\n\t\treturn n * (n + 1) / 2;\n\t}\n\n\tpublic static long countTooLongX0(int x0, int x1, int x2, int l, int l0)\n\t{\n\t\treturn sumUpTo(Math.min(x0 + l0 - x1 - x2 + 1, l - l0 + 1));\n\t}\n\n\tpublic static long countTooLongX1(int x0, int x1, int x2, int l, int l0)\n\t{\n\t\tlong result;\n\t\tint diff = Math.max(0, l - l0 - (x0 + l0 + x2 - x1 - 1));\n\t\tif (diff % 2 == 0)\n\t\t{\n\t\t\tresult = sumUpTo(diff / 2) * 2;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tresult = (diff + 1) * (diff + 1) / 2 / 2;\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic static long solveUnsorted(int[] x, int l)\n\t{\n\t\tlong result = 0;\n\t\tfor (int l0 = 0; l0 <= l; l0++)\n\t\t{\n\t\t\tresult += sumUpTo(l - l0 + 1);\n\t\t\tresult -= countTooLongX0(x[0], x[1], x[2], l, l0);\n\t\t\tresult -= countTooLongX1(x[0], x[1], x[2], l, l0);\n\t\t\tresult -= countTooLongX1(x[0], x[2], x[1], l, l0);\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic static long solve(int[] x, int l)\n\t{\n\t\tArrays.sort(x);\n\t\treturn solveUnsorted(new int[]\n\t\t{ x[2], x[1], x[0] }, l);\n\t}\n\n\tpublic static long solveSlow(int x0, int x1, int x2, int l)\n\t{\n\t\tlong result = 0;\n\t\tfor (int l0 = 0; l0 <= l; l0++)\n\t\t{\n\t\t\tfor (int l1 = 0; l1 <= l; l1++)\n\t\t\t{\n\t\t\t\tfor (int l2 = 0; l2 <= l; l2++)\n\t\t\t\t{\n\t\t\t\t\tif (l0 + l1 + l2 <= l)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (!degenerate(new int[]\n\t\t\t\t\t\t{ x0 + l0, x1 + l1, x2 + l2 }))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tresult += 1;\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\treturn result;\n\t}\n\n\tpublic void solve() throws IOException\n\t{\n\t\tint[] x = new int[3];\n\t\tx[0] = nextInt();\n\t\tx[1] = nextInt();\n\t\tx[2] = nextInt();\n\t\tint l = nextInt();\n\t\t//\t\tfor (int l2 = 0; l2 <= l; l2++)\n\t\t//\t\t{\n\t\t//\t\t\tfor (int l1 = 0; l1 <= l - l2; l1++)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tint x1 = Math.min(x[1] + l1, x[2] + l2);\n\t\t//\t\t\t\tint x2 = Math.max(x[1] + l1, x[2] + l2);\n\t\t//\t\t\t\tint l0Min = Math.max(0, x2 - x1 - x[0] + 1);\n\t\t//\t\t\t\tint l0Max = Math.min(l - l2 - l1, x1 + x2 - x[0] - 1);\n\t\t//\t\t\t\tresult += Math.max(0, l0Max - l0Min + 1);\n\t\t//\t\t\t}\n\t\t//\t\t}\n\t\tSystem.out.println(solve(x, l));\n\t}\n}", "lang": "Java 8", "bug_code_uid": "42b67b6c341669d02079453d0264f434", "src_uid": "185ff90a8b0ae0e2b75605f772589410", "apr_id": "d81ab1c65d98ef3b2add057f16335b06", "difficulty": 2100, "tags": ["brute force", "dp", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.27283950617283953, "equal_cnt": 18, "replace_cnt": 13, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 18, "bug_source_code": "import java.util.*;\npublic class Pipeline {\n\tpublic static void main(String [] args){\n\t\tScanner input=new Scanner (System.in);\n\t\tint n=input.nextInt();\n\t\tint k=input.nextInt();\n\t\tSystem.out.println(min(n,k));\n\t}\n\tpublic static int min(int n,int k){\n\t\tint min=1;\n\t\tint max=k;\n\t\tint num=(k*(k-1))/2+1;\n\t\tif(numn);\n\t}\n\tpublic static long sumMid(int mid,int k){\n\t\tlong sumFromMid=(mid*(mid-1))/2+1;\n\t\tlong sumToEnd= (k*(k-1))/2+1;\n\t\treturn sumToEnd-sumFromMid;\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "69b5b35e208275611f4f38813b634dac", "src_uid": "83bcfe32db302fbae18e8a95d89cf411", "apr_id": "6540267f319a78f4d67aea569e9a821e", "difficulty": 1700, "tags": ["math", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9916423577348706, "equal_cnt": 28, "replace_cnt": 19, "delete_cnt": 4, "insert_cnt": 4, "fix_ops_cnt": 27, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.math.*;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tInputReader in = new InputReader(inputStream);\n\t\tOutputWriter out = new OutputWriter(outputStream);\n\t\tTask solver = new Task();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass Task {\n\t\n\tMap map=new EHashMap<>(); \n\tMap> divides=new TreeMap<>();\n\tMap[] dp;\n\tint idx=0;\n\t\n\tpublic void solve(int testNumber, InputReader in, OutputWriter out) {\n\t\tlong A=in.readLong();\n\t\tfor (long i=1; i*i<=A; i++) if (A%i==0) {\n\t\t\tprocess(i);\n\t\t\tif (i*i!=A) process(A/i);\n\t\t}\n\t\tdp=new Map[divides.size()+1];\n\t\tfor (int i=0; i();\n\t\t\tfor (long j: map.keySet()) dp[i].put(j, 0L);\n\t\t}\n\t\tdp[0].put(1L, 1L);\n\t\tint idx=0;\n\t\tfor (long i: divides.keySet()) {\n\t\t\tidx++;\n\t\t\tif (idx>1) dp[idx-2].clear();\n\t\t\tfor (long j: map.keySet()) {\n\t\t\t\tdp[idx].put(j, dp[idx-1].get(j));\n\t\t\t\tfor (long x: divides.get(i)) \n\t\t\t\t\tif (j%x==0) {\n//\t\t\t\t\t\tSystem.out.println(idx);\n//\t\t\t\t\t\tSystem.out.println(dp[idx]);\n//\t\t\t\t\t\tSystem.out.println(dp[idx-1]);\n\t\t\t\t\t\tdp[idx].put(j, dp[idx].get(j)+dp[idx-1].get(j/x));\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tout.printLine(dp[idx].get(A));\n\t}\n\t\n\tlong prime(long n) {\n\t\tif (n<=1) return -1;\n\t\tfor (long i=2; i*i<=n; i++) if (n%i==0) {\n\t\t\twhile (n%i==0) n/=i;\n\t\t\treturn n==1?i:-1;\n\t\t}\n\t\treturn n;\n\t}\n\t\n\tvoid process(long x) {\n\t\tmap.put(x, idx++);\n\t\tlong p=prime(x-1);\n\t\tif (p>0) {\n\t\t\tif (!divides.containsKey(p)) divides.put(p, new ArrayList());\n\t\t\tdivides.get(p).add(x);\n\t\t}\n\t}\n}\n\nclass InputReader {\n\tprivate boolean finished = false;\n\n\tprivate InputStream stream;\n\tprivate byte[] buf = new byte[1024];\n\tprivate int curChar;\n\tprivate int numChars;\n\tprivate SpaceCharFilter filter;\n\n\tpublic InputReader(InputStream stream) {\n\t\tthis.stream = stream;\n\t}\n\n\tpublic int read() {\n\t\tif (numChars == -1)\n\t\t\tthrow new InputMismatchException();\n\t\tif (curChar >= numChars) {\n\t\t\tcurChar = 0;\n\t\t\ttry {\n\t\t\t\tnumChars = stream.read(buf);\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t\tif (numChars <= 0)\n\t\t\t\treturn -1;\n\t\t}\n\t\treturn buf[curChar++];\n\t}\n\n\tpublic int peek() {\n\t\tif (numChars == -1)\n\t\t\treturn -1;\n\t\tif (curChar >= numChars) {\n\t\t\tcurChar = 0;\n\t\t\ttry {\n\t\t\t\tnumChars = stream.read(buf);\n\t\t\t} catch (IOException e) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tif (numChars <= 0)\n\t\t\t\treturn -1;\n\t\t}\n\t\treturn buf[curChar];\n\t}\n\n\tpublic int readInt() {\n\t\tint c = read();\n\t\twhile (isSpaceChar(c))\n\t\t\tc = read();\n\t\tint sgn = 1;\n\t\tif (c == '-') {\n\t\t\tsgn = -1;\n\t\t\tc = read();\n\t\t}\n\t\tint res = 0;\n\t\tdo {\n\t\t\tif (c < '0' || c > '9')\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tres *= 10;\n\t\t\tres += c - '0';\n\t\t\tc = read();\n\t\t} while (!isSpaceChar(c));\n\t\treturn res * sgn;\n\t}\n\n\tpublic long readLong() {\n\t\tint c = read();\n\t\twhile (isSpaceChar(c))\n\t\t\tc = read();\n\t\tint sgn = 1;\n\t\tif (c == '-') {\n\t\t\tsgn = -1;\n\t\t\tc = read();\n\t\t}\n\t\tlong res = 0;\n\t\tdo {\n\t\t\tif (c < '0' || c > '9')\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tres *= 10;\n\t\t\tres += c - '0';\n\t\t\tc = read();\n\t\t} while (!isSpaceChar(c));\n\t\treturn res * sgn;\n\t}\n\n\tpublic String readString() {\n\t\tint c = read();\n\t\twhile (isSpaceChar(c))\n\t\t\tc = read();\n\t\tStringBuilder res = new StringBuilder();\n\t\tdo {\n\t\t\tif (Character.isValidCodePoint(c))\n\t\t\t\tres.appendCodePoint(c);\n\t\t\tc = read();\n\t\t} while (!isSpaceChar(c));\n\t\treturn res.toString();\n\t}\n\n\tpublic boolean isSpaceChar(int c) {\n\t\tif (filter != null)\n\t\t\treturn filter.isSpaceChar(c);\n\t\treturn isWhitespace(c);\n\t}\n\n\tpublic static boolean isWhitespace(int c) {\n\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t}\n\n\tprivate String readLine0() {\n\t\tStringBuilder buf = new StringBuilder();\n\t\tint c = read();\n\t\twhile (c != '\\n' && c != -1) {\n\t\t\tif (c != '\\r')\n\t\t\t\tbuf.appendCodePoint(c);\n\t\t\tc = read();\n\t\t}\n\t\treturn buf.toString();\n\t}\n\n\tpublic String readLine() {\n\t\tString s = readLine0();\n\t\twhile (s.trim().length() == 0)\n\t\t\ts = readLine0();\n\t\treturn s;\n\t}\n\n\tpublic String readLine(boolean ignoreEmptyLines) {\n\t\tif (ignoreEmptyLines)\n\t\t\treturn readLine();\n\t\telse\n\t\t\treturn readLine0();\n\t}\n\n\tpublic BigInteger readBigInteger() {\n\t\ttry {\n\t\t\treturn new BigInteger(readString());\n\t\t} catch (NumberFormatException e) {\n\t\t\tthrow new InputMismatchException();\n\t\t}\n\t}\n\n\tpublic char readCharacter() {\n\t\tint c = read();\n\t\twhile (isSpaceChar(c))\n\t\t\tc = read();\n\t\treturn (char) c;\n\t}\n\n\tpublic double readDouble() {\n\t\tint c = read();\n\t\twhile (isSpaceChar(c))\n\t\t\tc = read();\n\t\tint sgn = 1;\n\t\tif (c == '-') {\n\t\t\tsgn = -1;\n\t\t\tc = read();\n\t\t}\n\t\tdouble res = 0;\n\t\twhile (!isSpaceChar(c) && c != '.') {\n\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\treturn res * Math.pow(10, readInt());\n\t\t\tif (c < '0' || c > '9')\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tres *= 10;\n\t\t\tres += c - '0';\n\t\t\tc = read();\n\t\t}\n\t\tif (c == '.') {\n\t\t\tc = read();\n\t\t\tdouble m = 1;\n\t\t\twhile (!isSpaceChar(c)) {\n\t\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\t\treturn res * Math.pow(10, readInt());\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tm /= 10;\n\t\t\t\tres += (c - '0') * m;\n\t\t\t\tc = read();\n\t\t\t}\n\t\t}\n\t\treturn res * sgn;\n\t}\n\n\tpublic boolean isExhausted() {\n\t\tint value;\n\t\twhile (isSpaceChar(value = peek()) && value != -1)\n\t\t\tread();\n\t\treturn value == -1;\n\t}\n\n\tpublic String next() {\n\t\treturn readString();\n\t}\n\n\tpublic SpaceCharFilter getFilter() {\n\t\treturn filter;\n\t}\n\n\tpublic void setFilter(SpaceCharFilter filter) {\n\t\tthis.filter = filter;\n\t}\n\n\tpublic interface SpaceCharFilter {\n\t\tpublic boolean isSpaceChar(int ch);\n\t}\n}\n\nclass OutputWriter {\n\tprivate final PrintWriter writer;\n\n\tpublic OutputWriter(OutputStream outputStream) {\n\t\twriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter(\n\t\t\t\toutputStream)));\n\t}\n\n\tpublic OutputWriter(Writer writer) {\n\t\tthis.writer = new PrintWriter(writer);\n\t}\n\n\tpublic void print(char[] array) {\n\t\twriter.print(array);\n\t}\n\n\tpublic void print(Object... objects) {\n\t\tfor (int i = 0; i < objects.length; i++) {\n\t\t\tif (i != 0)\n\t\t\t\twriter.print(' ');\n\t\t\twriter.print(objects[i]);\n\t\t}\n\t}\n\n\tpublic void print(int[] array) {\n\t\tfor (int i = 0; i < array.length; i++) {\n\t\t\tif (i != 0)\n\t\t\t\twriter.print(' ');\n\t\t\twriter.print(array[i]);\n\t\t}\n\t}\n\n\tpublic void print(long[] array) {\n\t\tfor (int i = 0; i < array.length; i++) {\n\t\t\tif (i != 0)\n\t\t\t\twriter.print(' ');\n\t\t\twriter.print(array[i]);\n\t\t}\n\t}\n\n\tpublic void print(Collection collection) {\n\t\tboolean first = true;\n\t\tfor (int i : collection) {\n\t\t\tif (first)\n\t\t\t\tfirst = false;\n\t\t\telse\n\t\t\t\twriter.print(' ');\n\t\t\twriter.print(i);\n\t\t}\n\t}\n\n\tpublic void printLine(int[] array) {\n\t\tprint(array);\n\t\twriter.println();\n\t}\n\n\tpublic void printLine(long[] array) {\n\t\tprint(array);\n\t\twriter.println();\n\t}\n\n\tpublic void printLine(Collection collection) {\n\t\tprint(collection);\n\t\twriter.println();\n\t}\n\n\tpublic void printLine() {\n\t\twriter.println();\n\t}\n\n\tpublic void printLine(Object... objects) {\n\t\tprint(objects);\n\t\twriter.println();\n\t}\n\n\tpublic void print(char i) {\n\t\twriter.print(i);\n\t}\n\n\tpublic void printLine(char i) {\n\t\twriter.println(i);\n\t}\n\n\tpublic void printLine(char[] array) {\n\t\twriter.println(array);\n\t}\n\n\tpublic void printFormat(String format, Object... objects) {\n\t\twriter.printf(format, objects);\n\t}\n\n\tpublic void close() {\n\t\twriter.close();\n\t}\n\n\tpublic void flush() {\n\t\twriter.flush();\n\t}\n\n\tpublic void print(long i) {\n\t\twriter.print(i);\n\t}\n\n\tpublic void printLine(long i) {\n\t\twriter.println(i);\n\t}\n\n\tpublic void print(int i) {\n\t\twriter.print(i);\n\t}\n\n\tpublic void printLine(int i) {\n\t\twriter.println(i);\n\t}\n}\n\nclass Polygon {\n\tpublic final Point[] vertices;\n\tprivate Segment[] sides;\n\n\tpublic Polygon(Point... vertices) {\n\t\tthis.vertices = vertices.clone();\n\t}\n\n\tpublic double square() {\n\t\tdouble sum = 0;\n\t\tfor (int i = 1; i < vertices.length; i++)\n\t\t\tsum += (vertices[i].x - vertices[i - 1].x)\n\t\t\t\t\t* (vertices[i].y + vertices[i - 1].y);\n\t\tsum += (vertices[0].x - vertices[vertices.length - 1].x)\n\t\t\t\t* (vertices[0].y + vertices[vertices.length - 1].y);\n\t\treturn Math.abs(sum) / 2;\n\t}\n\n\tpublic Point center() {\n\t\tdouble sx = 0;\n\t\tdouble sy = 0;\n\t\tfor (Point point : vertices) {\n\t\t\tsx += point.x;\n\t\t\tsy += point.y;\n\t\t}\n\t\treturn new Point(sx / vertices.length, sy / vertices.length);\n\t}\n\n\tpublic static boolean over(Point a, Point b, Point c) {\n\t\treturn a.x * (b.y - c.y) + b.x * (c.y - a.y) + c.x * (a.y - b.y) < -GeometryUtils.epsilon;\n\t}\n\n\tprivate static boolean under(Point a, Point b, Point c) {\n\t\treturn a.x * (b.y - c.y) + b.x * (c.y - a.y) + c.x * (a.y - b.y) > GeometryUtils.epsilon;\n\t}\n\n\tpublic static Polygon convexHull(Point[] points) {\n\t\tif (points.length == 1)\n\t\t\treturn new Polygon(points);\n\t\tArrays.sort(points, new Comparator() {\n\t\t\tpublic int compare(Point o1, Point o2) {\n\t\t\t\tint value = Double.compare(o1.x, o2.x);\n\t\t\t\tif (value != 0)\n\t\t\t\t\treturn value;\n\t\t\t\treturn Double.compare(o1.y, o2.y);\n\t\t\t}\n\t\t});\n\t\tPoint left = points[0];\n\t\tPoint right = points[points.length - 1];\n\t\tList up = new ArrayList();\n\t\tList down = new ArrayList();\n\t\tfor (Point point : points) {\n\t\t\tif (point == left || point == right || !under(left, point, right)) {\n\t\t\t\twhile (up.size() >= 2\n\t\t\t\t\t\t&& under(up.get(up.size() - 2), up.get(up.size() - 1),\n\t\t\t\t\t\t\t\tpoint))\n\t\t\t\t\tup.remove(up.size() - 1);\n\t\t\t\tup.add(point);\n\t\t\t}\n\t\t\tif (point == left || point == right || !over(left, point, right)) {\n\t\t\t\twhile (down.size() >= 2\n\t\t\t\t\t\t&& over(down.get(down.size() - 2),\n\t\t\t\t\t\t\t\tdown.get(down.size() - 1), point))\n\t\t\t\t\tdown.remove(down.size() - 1);\n\t\t\t\tdown.add(point);\n\t\t\t}\n\t\t}\n\t\tPoint[] result = new Point[up.size() + down.size() - 2];\n\t\tint index = 0;\n\t\tfor (Point point : up)\n\t\t\tresult[index++] = point;\n\t\tfor (int i = down.size() - 2; i > 0; i--)\n\t\t\tresult[index++] = down.get(i);\n\t\treturn new Polygon(result);\n\t}\n\n\tpublic boolean contains(Point point) {\n\t\treturn contains(point, false);\n\t}\n\n\tpublic boolean contains(Point point, boolean strict) {\n\t\tfor (Segment segment : sides()) {\n\t\t\tif (segment.contains(point, true))\n\t\t\t\treturn !strict;\n\t\t}\n\t\tdouble totalAngle = GeometryUtils.canonicalAngle(Math.atan2(\n\t\t\t\tvertices[0].y - point.y, vertices[0].x - point.x)\n\t\t\t\t- Math.atan2(vertices[vertices.length - 1].y - point.y,\n\t\t\t\t\t\tvertices[vertices.length - 1].x - point.x));\n\t\tfor (int i = 1; i < vertices.length; i++) {\n\t\t\ttotalAngle += GeometryUtils.canonicalAngle(Math.atan2(vertices[i].y\n\t\t\t\t\t- point.y, vertices[i].x - point.x)\n\t\t\t\t\t- Math.atan2(vertices[i - 1].y - point.y, vertices[i - 1].x\n\t\t\t\t\t\t\t- point.x));\n\t\t}\n\t\treturn Math.abs(totalAngle) > Math.PI;\n\t}\n\n\tpublic Segment[] sides() {\n\t\tif (sides == null) {\n\t\t\tsides = new Segment[vertices.length];\n\t\t\tfor (int i = 0; i < vertices.length - 1; i++)\n\t\t\t\tsides[i] = new Segment(vertices[i], vertices[i + 1]);\n\t\t\tsides[sides.length - 1] = new Segment(\n\t\t\t\t\tvertices[vertices.length - 1], vertices[0]);\n\t\t}\n\t\treturn sides;\n\t}\n\n\tpublic static double triangleSquare(Point a, Point b, Point c) {\n\t\treturn Math.abs((a.x - b.x) * (a.y + b.y) + (b.x - c.x) * (b.y + c.y)\n\t\t\t\t+ (c.x - a.x) * (c.y + a.y)) / 2;\n\t}\n\n\tpublic double perimeter() {\n\t\tdouble result = vertices[0].distance(vertices[vertices.length - 1]);\n\t\tfor (int i = 1; i < vertices.length; i++)\n\t\t\tresult += vertices[i].distance(vertices[i - 1]);\n\t\treturn result;\n\t}\n}\n\nclass Point {\n\tpublic static final Point ORIGIN = new Point(0, 0);\n\tpublic final double x;\n\tpublic final double y;\n\n\t@Override\n\tpublic String toString() {\n\t\treturn \"(\" + x + \", \" + y + \")\";\n\t}\n\n\tpublic Point(double x, double y) {\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t}\n\n\tpublic Line line(Point other) {\n\t\tif (equals(other))\n\t\t\treturn null;\n\t\tdouble a = other.y - y;\n\t\tdouble b = x - other.x;\n\t\tdouble c = -a * x - b * y;\n\t\treturn new Line(a, b, c);\n\t}\n\n\t@Override\n\tpublic boolean equals(Object o) {\n\t\tif (this == o)\n\t\t\treturn true;\n\t\tif (o == null || getClass() != o.getClass())\n\t\t\treturn false;\n\n\t\tPoint point = (Point) o;\n\n\t\treturn Math.abs(x - point.x) <= GeometryUtils.epsilon\n\t\t\t\t&& Math.abs(y - point.y) <= GeometryUtils.epsilon;\n\t}\n\n\t@Override\n\tpublic int hashCode() {\n\t\tint result;\n\t\tlong temp;\n\t\ttemp = x != +0.0d ? Double.doubleToLongBits(x) : 0L;\n\t\tresult = (int) (temp ^ (temp >>> 32));\n\t\ttemp = y != +0.0d ? Double.doubleToLongBits(y) : 0L;\n\t\tresult = 31 * result + (int) (temp ^ (temp >>> 32));\n\t\treturn result;\n\t}\n\n\tpublic double distance(Point other) {\n\t\treturn GeometryUtils.fastHypot(x - other.x, y - other.y);\n\t}\n\n\tpublic double distance(Line line) {\n\t\treturn Math.abs(line.a * x + line.b * y + line.c);\n\t}\n\n\tpublic double value() {\n\t\treturn GeometryUtils.fastHypot(x, y);\n\t}\n\n\tpublic double angle() {\n\t\treturn Math.atan2(y, x);\n\t}\n\n\tpublic static Point readPoint(InputReader in) {\n\t\tdouble x = in.readDouble();\n\t\tdouble y = in.readDouble();\n\t\treturn new Point(x, y);\n\t}\n\n\tpublic Point rotate(double angle) {\n\t\tdouble nx = x * Math.cos(angle) - y * Math.sin(angle);\n\t\tdouble ny = y * Math.cos(angle) + x * Math.sin(angle);\n\t\treturn new Point(nx, ny);\n\t}\n}\n\nclass Segment {\n\tpublic final Point a;\n\tpublic final Point b;\n\tprivate double distance = Double.NaN;\n\tprivate Line line = null;\n\n\tpublic Segment(Point a, Point b) {\n\t\tthis.a = a;\n\t\tthis.b = b;\n\t}\n\n\tpublic double length() {\n\t\tif (Double.isNaN(distance))\n\t\t\tdistance = a.distance(b);\n\t\treturn distance;\n\t}\n\n\tpublic double distance(Point point) {\n\t\tdouble length = length();\n\t\tdouble left = point.distance(a);\n\t\tif (length < GeometryUtils.epsilon)\n\t\t\treturn left;\n\t\tdouble right = point.distance(b);\n\t\tif (left * left > right * right + length * length)\n\t\t\treturn right;\n\t\tif (right * right > left * left + length * length)\n\t\t\treturn left;\n\t\treturn point.distance(line());\n\t}\n\n\tpublic Point intersect(Segment other, boolean includeEnds) {\n\t\tLine line = line();\n\t\tLine otherLine = other.a.line(other.b);\n\t\tif (line.parallel(otherLine))\n\t\t\treturn null;\n\t\tPoint intersection = line.intersect(otherLine);\n\t\tif (contains(intersection, includeEnds)\n\t\t\t\t&& other.contains(intersection, includeEnds))\n\t\t\treturn intersection;\n\t\telse\n\t\t\treturn null;\n\t}\n\n\tpublic boolean contains(Point point, boolean includeEnds) {\n\t\tif (a.equals(point) || b.equals(point))\n\t\t\treturn includeEnds;\n\t\tif (a.equals(b))\n\t\t\treturn false;\n\t\tLine line = line();\n\t\tif (!line.contains(point))\n\t\t\treturn false;\n\t\tLine perpendicular = line.perpendicular(a);\n\t\tdouble aValue = perpendicular.value(a);\n\t\tdouble bValue = perpendicular.value(b);\n\t\tdouble pointValue = perpendicular.value(point);\n\t\treturn aValue < pointValue && pointValue < bValue\n\t\t\t\t|| bValue < pointValue && pointValue < aValue;\n\t}\n\n\tpublic Line line() {\n\t\tif (line == null)\n\t\t\tline = a.line(b);\n\t\treturn line;\n\t}\n\n\tpublic Point middle() {\n\t\treturn new Point((a.x + b.x) / 2, (a.y + b.y) / 2);\n\t}\n\n\tpublic Point[] intersect(Circle circle) {\n\t\tPoint[] result = line().intersect(circle);\n\t\tif (result.length == 0)\n\t\t\treturn result;\n\t\tif (result.length == 1) {\n\t\t\tif (contains(result[0], true))\n\t\t\t\treturn result;\n\t\t\treturn new Point[0];\n\t\t}\n\t\tif (contains(result[0], true)) {\n\t\t\tif (contains(result[1], true))\n\t\t\t\treturn result;\n\t\t\treturn new Point[] { result[0] };\n\t\t}\n\t\tif (contains(result[1], true))\n\t\t\treturn new Point[] { result[1] };\n\t\treturn new Point[0];\n\t}\n\n\tpublic Point intersect(Line line) {\n\t\tLine selfLine = line();\n\t\tPoint intersect = selfLine.intersect(line);\n\t\tif (intersect == null)\n\t\t\treturn null;\n\t\tif (contains(intersect, true))\n\t\t\treturn intersect;\n\t\treturn null;\n\t}\n\n\tpublic double distance(Segment other) {\n\t\tLine line = line();\n\t\tLine otherLine = other.line();\n\t\tPoint p = line == null || otherLine == null ? null : line\n\t\t\t\t.intersect(otherLine);\n\t\tif (p != null && contains(p, true) && other.contains(p, true))\n\t\t\treturn 0;\n\t\treturn Math.min(Math.min(other.distance(a), other.distance(b)),\n\t\t\t\tMath.min(distance(other.a), distance(other.b)));\n\t}\n}\n\nclass GeometryUtils {\n\tpublic static double epsilon = 1e-8;\n\n\tpublic static double fastHypot(double... x) {\n\t\tif (x.length == 0)\n\t\t\treturn 0;\n\t\telse if (x.length == 1)\n\t\t\treturn Math.abs(x[0]);\n\t\telse {\n\t\t\tdouble sumSquares = 0;\n\t\t\tfor (double value : x)\n\t\t\t\tsumSquares += value * value;\n\t\t\treturn Math.sqrt(sumSquares);\n\t\t}\n\t}\n\n\tpublic static double fastHypot(double x, double y) {\n\t\treturn Math.sqrt(x * x + y * y);\n\t}\n\n\tpublic static double fastHypot(double[] x, double[] y) {\n\t\tif (x.length == 0)\n\t\t\treturn 0;\n\t\telse if (x.length == 1)\n\t\t\treturn Math.abs(x[0] - y[0]);\n\t\telse {\n\t\t\tdouble sumSquares = 0;\n\t\t\tfor (int i = 0; i < x.length; i++) {\n\t\t\t\tdouble diff = x[i] - y[i];\n\t\t\t\tsumSquares += diff * diff;\n\t\t\t}\n\t\t\treturn Math.sqrt(sumSquares);\n\t\t}\n\t}\n\n\tpublic static double fastHypot(int[] x, int[] y) {\n\t\tif (x.length == 0)\n\t\t\treturn 0;\n\t\telse if (x.length == 1)\n\t\t\treturn Math.abs(x[0] - y[0]);\n\t\telse {\n\t\t\tdouble sumSquares = 0;\n\t\t\tfor (int i = 0; i < x.length; i++) {\n\t\t\t\tdouble diff = x[i] - y[i];\n\t\t\t\tsumSquares += diff * diff;\n\t\t\t}\n\t\t\treturn Math.sqrt(sumSquares);\n\t\t}\n\t}\n\n\tpublic static double missileTrajectoryLength(double v, double angle,\n\t\t\tdouble g) {\n\t\treturn (v * v * Math.sin(2 * angle)) / g;\n\t}\n\n\tpublic static double sphereVolume(double radius) {\n\t\treturn 4 * Math.PI * radius * radius * radius / 3;\n\t}\n\n\tpublic static double triangleSquare(double first, double second,\n\t\t\tdouble third) {\n\t\tdouble p = (first + second + third) / 2;\n\t\treturn Math.sqrt(p * (p - first) * (p - second) * (p - third));\n\t}\n\n\tpublic static double canonicalAngle(double angle) {\n\t\twhile (angle > Math.PI)\n\t\t\tangle -= 2 * Math.PI;\n\t\twhile (angle < -Math.PI)\n\t\t\tangle += 2 * Math.PI;\n\t\treturn angle;\n\t}\n\n\tpublic static double positiveAngle(double angle) {\n\t\twhile (angle > 2 * Math.PI - GeometryUtils.epsilon)\n\t\t\tangle -= 2 * Math.PI;\n\t\twhile (angle < -GeometryUtils.epsilon)\n\t\t\tangle += 2 * Math.PI;\n\t\treturn angle;\n\t}\n}\n\nclass Line {\n\tpublic final double a;\n\tpublic final double b;\n\tpublic final double c;\n\n\tpublic Line(Point p, double angle) {\n\t\ta = Math.sin(angle);\n\t\tb = -Math.cos(angle);\n\t\tc = -p.x * a - p.y * b;\n\t}\n\n\tpublic Line(double a, double b, double c) {\n\t\tdouble h = GeometryUtils.fastHypot(a, b);\n\t\tthis.a = a / h;\n\t\tthis.b = b / h;\n\t\tthis.c = c / h;\n\t}\n\n\tpublic Point intersect(Line other) {\n\t\tif (parallel(other))\n\t\t\treturn null;\n\t\tdouble determinant = b * other.a - a * other.b;\n\t\tdouble x = (c * other.b - b * other.c) / determinant;\n\t\tdouble y = (a * other.c - c * other.a) / determinant;\n\t\treturn new Point(x, y);\n\t}\n\n\tpublic boolean parallel(Line other) {\n\t\treturn Math.abs(a * other.b - b * other.a) < GeometryUtils.epsilon;\n\t}\n\n\tpublic boolean contains(Point point) {\n\t\treturn Math.abs(value(point)) < GeometryUtils.epsilon;\n\t}\n\n\tpublic Line perpendicular(Point point) {\n\t\treturn new Line(-b, a, b * point.x - a * point.y);\n\t}\n\n\tpublic double value(Point point) {\n\t\treturn a * point.x + b * point.y + c;\n\t}\n\n\tpublic Point[] intersect(Circle circle) {\n\t\tdouble distance = distance(circle.center);\n\t\tif (distance > circle.radius + GeometryUtils.epsilon)\n\t\t\treturn new Point[0];\n\t\tPoint intersection = intersect(perpendicular(circle.center));\n\t\tif (Math.abs(distance - circle.radius) < GeometryUtils.epsilon)\n\t\t\treturn new Point[] { intersection };\n\t\tdouble shift = Math.sqrt(circle.radius * circle.radius - distance\n\t\t\t\t* distance);\n\t\treturn new Point[] {\n\t\t\t\tnew Point(intersection.x + shift * b, intersection.y - shift\n\t\t\t\t\t\t* a),\n\t\t\t\tnew Point(intersection.x - shift * b, intersection.y + shift\n\t\t\t\t\t\t* a) };\n\t}\n\n\tpublic double distance(Point center) {\n\t\treturn Math.abs(value(center));\n\t}\n\n\t@Override\n\tpublic boolean equals(Object o) {\n\t\tif (this == o)\n\t\t\treturn true;\n\t\tif (o == null || getClass() != o.getClass())\n\t\t\treturn false;\n\n\t\tLine line = (Line) o;\n\n\t\tif (!parallel(line))\n\t\t\treturn false;\n\t\tif (Math.abs(a * line.c - c * line.a) > GeometryUtils.epsilon\n\t\t\t\t|| Math.abs(b * line.c - c * line.b) > GeometryUtils.epsilon)\n\t\t\treturn false;\n\n\t\treturn true;\n\t}\n}\n\nclass Circle {\n\tpublic final Point center;\n\tpublic final double radius;\n\n\tpublic Circle(Point center, double radius) {\n\t\tthis.center = center;\n\t\tthis.radius = radius;\n\t}\n\n\tpublic boolean contains(Point point) {\n\t\treturn center.distance(point) < radius + GeometryUtils.epsilon;\n\t}\n\n\tpublic boolean strictContains(Point point) {\n\t\treturn center.distance(point) < radius - GeometryUtils.epsilon;\n\t}\n\n\tpublic Point[] findTouchingPoints(Point point) {\n\t\tdouble distance = center.distance(point);\n\t\tif (distance < radius - GeometryUtils.epsilon)\n\t\t\treturn new Point[0];\n\t\tif (distance < radius + GeometryUtils.epsilon)\n\t\t\treturn new Point[] { point };\n\t\tCircle power = new Circle(point, Math.sqrt((distance - radius)\n\t\t\t\t* (distance + radius)));\n\t\treturn intersect(power);\n\t}\n\n\tpublic Point[] intersect(Circle other) {\n\t\tdouble distance = center.distance(other.center);\n\t\tif (distance > radius + other.radius + GeometryUtils.epsilon\n\t\t\t\t|| Math.abs(radius - other.radius) > distance\n\t\t\t\t\t\t+ GeometryUtils.epsilon)\n\t\t\treturn new Point[0];\n\t\tdouble p = (radius + other.radius + distance) / 2;\n\t\tdouble height = 2\n\t\t\t\t* Math.sqrt(p * (p - radius) * (p - other.radius)\n\t\t\t\t\t\t* (p - distance)) / distance;\n\t\tdouble l1 = Math.sqrt(radius * radius - height * height);\n\t\tdouble l2 = Math.sqrt(other.radius * other.radius - height * height);\n\t\tif (radius * radius + distance * distance < other.radius * other.radius)\n\t\t\tl1 = -l1;\n\t\tif (radius * radius > distance * distance + other.radius * other.radius)\n\t\t\tl2 = -l2;\n\t\tPoint middle = new Point((center.x * l2 + other.center.x * l1)\n\t\t\t\t/ (l1 + l2), (center.y * l2 + other.center.y * l1) / (l1 + l2));\n\t\tLine line = center.line(other.center).perpendicular(middle);\n\t\treturn line.intersect(this);\n\t}\n}\n\nclass Pair implements Comparable> {\n\tpublic final U first;\n\tpublic final V second;\n\n\tpublic static Pair makePair(U first, V second) {\n\t\treturn new Pair(first, second);\n\t}\n\n\tprivate Pair(U first, V second) {\n\t\tthis.first = first;\n\t\tthis.second = second;\n\t}\n\n\tpublic boolean equals(Object o) {\n\t\tif (this == o)\n\t\t\treturn true;\n\t\tif (o == null || getClass() != o.getClass())\n\t\t\treturn false;\n\n\t\tPair pair = (Pair) o;\n\n\t\treturn !(first != null ? !first.equals(pair.first) : pair.first != null)\n\t\t\t\t&& !(second != null ? !second.equals(pair.second)\n\t\t\t\t\t\t: pair.second != null);\n\n\t}\n\n\tpublic int hashCode() {\n\t\tint result = first != null ? first.hashCode() : 0;\n\t\tresult = 31 * result + (second != null ? second.hashCode() : 0);\n\t\treturn result;\n\t}\n\n\tpublic String toString() {\n\t\treturn \"(\" + first + \",\" + second + \")\";\n\t}\n\n\tpublic int compareTo(Pair o) {\n\t\tint value = ((Comparable) first).compareTo(o.first);\n\t\tif (value != 0)\n\t\t\treturn value;\n\t\treturn ((Comparable) second).compareTo(o.second);\n\t}\n}\n\nclass IOUtils {\n\n\tpublic static void readIntArrays(InputReader in, int[]... arrays) {\n\t\tfor (int i = 0; i < arrays[0].length; i++) {\n\t\t\tfor (int j = 0; j < arrays.length; j++)\n\t\t\t\tarrays[j][i] = in.readInt();\n\t\t}\n\t}\n\n}\n\nclass TreapSet implements NavigableSet {\n\tprotected static final Random rnd = new Random(239);\n\n\tprotected final Node nullNode;\n\tprotected final Comparator comparator;\n\tprotected Node root;\n\tprivate final K from;\n\tprivate final K to;\n\tprivate final boolean fromInclusive;\n\tprivate final boolean toInclusive;\n\n\tpublic TreapSet() {\n\t\tthis((Comparator) null);\n\t}\n\n\tpublic TreapSet(Comparator comparator) {\n\t\tthis(null, null, false, false, comparator, null, null);\n\t}\n\n\tprotected TreapSet(K from, K to, boolean fromInclusive,\n\t\t\tboolean toInclusive, Comparator comparator, Node root,\n\t\t\tNode nullNode) {\n\t\tthis.comparator = comparator;\n\t\tthis.from = from;\n\t\tthis.to = to;\n\t\tthis.fromInclusive = fromInclusive;\n\t\tthis.toInclusive = toInclusive;\n\t\tif (nullNode == null)\n\t\t\tnullNode = new NullNode();\n\t\tif (root == null)\n\t\t\troot = nullNode;\n\t\tthis.root = root;\n\t\tthis.nullNode = nullNode;\n\t}\n\n\tpublic boolean addAll(Iterable collection) {\n\t\tboolean result = false;\n\t\tfor (K element : collection)\n\t\t\tresult |= add(element);\n\t\treturn result;\n\t}\n\n\tpublic K lower(K k) {\n\t\tNode target = root.lower(k);\n\t\tif (target == nullNode)\n\t\t\treturn null;\n\t\tif (belongs(target.key))\n\t\t\treturn target.key;\n\t\treturn null;\n\t}\n\n\tprivate boolean belongs(K key) {\n\t\tint valueFrom = compare(from, key);\n\t\tint valueTo = compare(key, to);\n\t\treturn (valueFrom < 0 || valueFrom == 0 && fromInclusive)\n\t\t\t\t&& (valueTo < 0 || valueTo == 0 && toInclusive);\n\t}\n\n\tpublic K floor(K k) {\n\t\tNode target = root.floor(k);\n\t\tif (target == nullNode)\n\t\t\treturn null;\n\t\tif (belongs(target.key))\n\t\t\treturn target.key;\n\t\treturn null;\n\t}\n\n\tpublic K ceiling(K k) {\n\t\tNode target = root.ceil(k);\n\t\tif (target == nullNode)\n\t\t\treturn null;\n\t\tif (belongs(target.key))\n\t\t\treturn target.key;\n\t\treturn null;\n\t}\n\n\tpublic K higher(K k) {\n\t\tNode target = root.higher(k);\n\t\tif (target == nullNode)\n\t\t\treturn null;\n\t\tif (belongs(target.key))\n\t\t\treturn target.key;\n\t\treturn null;\n\t}\n\n\tpublic K pollFirst() {\n\t\tK first = first();\n\t\tif (first == null)\n\t\t\tthrow new NoSuchElementException();\n\t\troot.erase(first);\n\t\treturn first;\n\t}\n\n\tpublic K pollLast() {\n\t\tK last = last();\n\t\tif (last == null)\n\t\t\tthrow new NoSuchElementException();\n\t\troot.erase(last);\n\t\treturn last;\n\t}\n\n\tpublic int size() {\n\t\tif (from == null && to == null)\n\t\t\treturn root.size;\n\t\tif (from == null) {\n\t\t\tNode to = toInclusive ? root.floor(this.to) : root.lower(this.to);\n\t\t\tif (to == nullNode)\n\t\t\t\treturn 0;\n\t\t\treturn root.indexOf(to) + 1;\n\t\t}\n\t\tif (to == null) {\n\t\t\tNode from = fromInclusive ? root.ceil(this.from) : root\n\t\t\t\t\t.higher(this.from);\n\t\t\tif (from == nullNode)\n\t\t\t\treturn 0;\n\t\t\treturn root.size - root.indexOf(from);\n\t\t}\n\t\tNode from = fromInclusive ? root.ceil(this.from) : root\n\t\t\t\t.higher(this.from);\n\t\tif (from == nullNode || !belongs(from.key))\n\t\t\treturn 0;\n\t\tNode to = toInclusive ? root.floor(this.to) : root.lower(this.to);\n\t\treturn root.indexOf(to) - root.indexOf(from) + 1;\n\t}\n\n\tpublic boolean isEmpty() {\n\t\treturn size() == 0;\n\t}\n\n\tpublic boolean contains(Object o) {\n\t\treturn belongs((K) o) && root.search((K) o) != nullNode;\n\t}\n\n\tpublic Iterator iterator() {\n\t\treturn new Iterator() {\n\t\t\tprivate K current = first();\n\n\t\t\tpublic boolean hasNext() {\n\t\t\t\treturn current != null;\n\t\t\t}\n\n\t\t\tpublic K next() {\n\t\t\t\tK result = current;\n\t\t\t\tcurrent = higher(current);\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\tpublic void remove() {\n\t\t\t\tTreapSet.this.remove(current);\n\t\t\t}\n\t\t};\n\t}\n\n\tpublic Object[] toArray() {\n\t\tObject[] array = new Object[size()];\n\t\tint index = 0;\n\t\tfor (K key : this)\n\t\t\tarray[index++] = key;\n\t\treturn array;\n\t}\n\n\tpublic T[] toArray(T[] a) {\n\t\tif (a.length < size())\n\t\t\tthrow new IllegalArgumentException();\n\t\tint index = 0;\n\t\tfor (K key : this)\n\t\t\ta[index++] = (T) key;\n\t\treturn a;\n\t}\n\n\tpublic boolean add(K k) {\n\t\tif (k == null)\n\t\t\tthrow new NullPointerException();\n\t\tif (contains(k))\n\t\t\treturn false;\n\t\troot = root.insert(createNode(k));\n\t\treturn true;\n\t}\n\n\tprotected Node createNode(K k) {\n\t\treturn new Node(k, rnd.nextLong());\n\t}\n\n\tpublic boolean remove(Object o) {\n\t\tif (!contains(o))\n\t\t\treturn false;\n\t\t// noinspection unchecked\n\t\troot = root.erase((K) o);\n\t\treturn true;\n\t}\n\n\tpublic boolean containsAll(Collection c) {\n\t\tfor (Object o : c) {\n\t\t\tif (!contains(o))\n\t\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic boolean addAll(Collection c) {\n\t\treturn addAll((Iterable) c);\n\t}\n\n\tpublic boolean retainAll(Collection c) {\n\t\tList toRemove = new ArrayList();\n\t\tfor (K key : this) {\n\t\t\tif (!c.contains(key))\n\t\t\t\ttoRemove.add(key);\n\t\t}\n\t\treturn removeAll(toRemove);\n\t}\n\n\tpublic boolean removeAll(Collection c) {\n\t\tboolean result = false;\n\t\tfor (Object o : c)\n\t\t\tresult |= remove(o);\n\t\treturn result;\n\t}\n\n\tpublic void clear() {\n\t\tretainAll(Collections. emptySet());\n\t}\n\n\tpublic NavigableSet descendingSet() {\n\t\tthrow new UnsupportedOperationException();\n\t}\n\n\tpublic Iterator descendingIterator() {\n\t\treturn new Iterator() {\n\t\t\tprivate K current = last();\n\n\t\t\tpublic boolean hasNext() {\n\t\t\t\treturn current != null;\n\t\t\t}\n\n\t\t\tpublic K next() {\n\t\t\t\tK result = current;\n\t\t\t\tcurrent = lower(current);\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\tpublic void remove() {\n\t\t\t\tTreapSet.this.remove(current);\n\t\t\t}\n\t\t};\n\t}\n\n\tpublic NavigableSet subSet(K fromElement, boolean fromInclusive,\n\t\t\tK toElement, boolean toInclusive) {\n\t\treturn new TreapSet(fromElement, toElement, fromInclusive,\n\t\t\t\ttoInclusive, comparator, root, nullNode);\n\t}\n\n\tpublic NavigableSet headSet(K toElement, boolean inclusive) {\n\t\treturn subSet(null, false, toElement, inclusive);\n\t}\n\n\tpublic NavigableSet tailSet(K fromElement, boolean inclusive) {\n\t\treturn subSet(fromElement, inclusive, null, false);\n\t}\n\n\tpublic Comparator comparator() {\n\t\treturn comparator;\n\t}\n\n\tpublic SortedSet subSet(K fromElement, K toElement) {\n\t\treturn subSet(fromElement, true, toElement, false);\n\t}\n\n\tpublic SortedSet headSet(K toElement) {\n\t\treturn subSet(null, false, toElement, false);\n\t}\n\n\tpublic SortedSet tailSet(K fromElement) {\n\t\treturn tailSet(fromElement, true);\n\t}\n\n\tpublic K first() {\n\t\tif (isEmpty())\n\t\t\treturn null;\n\t\tif (from == null)\n\t\t\treturn root.first().key;\n\t\tif (fromInclusive)\n\t\t\treturn ceiling(from);\n\t\treturn higher(from);\n\t}\n\n\tpublic K last() {\n\t\tif (isEmpty())\n\t\t\treturn null;\n\t\tif (to == null)\n\t\t\treturn root.last().key;\n\t\tif (toInclusive)\n\t\t\treturn floor(to);\n\t\treturn lower(to);\n\t}\n\n\tprotected int compare(K first, K second) {\n\t\tif (first == null || second == null)\n\t\t\treturn -1;\n\t\tif (comparator != null)\n\t\t\treturn comparator.compare(first, second);\n\t\t// noinspection unchecked\n\t\treturn ((Comparable) first).compareTo(second);\n\t}\n\n\tprotected class Node {\n\t\tprotected final K key;\n\t\tprotected final long priority;\n\t\tprotected Node left;\n\t\tprotected Node right;\n\t\tprotected int size;\n\n\t\tprotected Node(K key, long priority) {\n\t\t\tthis.key = key;\n\t\t\tthis.priority = priority;\n\t\t\tleft = nullNode;\n\t\t\tright = nullNode;\n\t\t\tsize = 1;\n\t\t}\n\n\t\tprotected Object[] split(K key) {\n\t\t\tif (compare(key, this.key) < 0) {\n\t\t\t\tObject[] result = left.split(key);\n\t\t\t\tleft = (Node) result[1];\n\t\t\t\tresult[1] = this;\n\t\t\t\tupdateSize();\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\tObject[] result = right.split(key);\n\t\t\tright = (Node) result[0];\n\t\t\tresult[0] = this;\n\t\t\tupdateSize();\n\t\t\treturn result;\n\t\t}\n\n\t\tprotected void updateSize() {\n\t\t\tsize = left.size + right.size + 1;\n\t\t}\n\n\t\tprotected Node insert(Node node) {\n\t\t\tif (node.priority > priority) {\n\t\t\t\tObject[] result = split(node.key);\n\t\t\t\tnode.left = (Node) result[0];\n\t\t\t\tnode.right = (Node) result[1];\n\t\t\t\tnode.updateSize();\n\t\t\t\treturn node;\n\t\t\t}\n\t\t\tif (compare(node.key, this.key) < 0) {\n\t\t\t\tleft = left.insert(node);\n\t\t\t\tupdateSize();\n\t\t\t\treturn this;\n\t\t\t}\n\t\t\tright = right.insert(node);\n\t\t\tupdateSize();\n\t\t\treturn this;\n\t\t}\n\n\t\tprotected Node merge(Node left, Node right) {\n\t\t\tif (left == nullNode)\n\t\t\t\treturn right;\n\t\t\tif (right == nullNode)\n\t\t\t\treturn left;\n\t\t\tif (left.priority > right.priority) {\n\t\t\t\tleft.right = left.right.merge(left.right, right);\n\t\t\t\tleft.updateSize();\n\t\t\t\treturn left;\n\t\t\t}\n\t\t\tright.left = right.left.merge(left, right.left);\n\t\t\tright.updateSize();\n\t\t\treturn right;\n\t\t}\n\n\t\tprotected Node erase(K key) {\n\t\t\tint value = compare(key, this.key);\n\t\t\tif (value == 0)\n\t\t\t\treturn merge(left, right);\n\t\t\tif (value < 0) {\n\t\t\t\tleft = left.erase(key);\n\t\t\t\tupdateSize();\n\t\t\t\treturn this;\n\t\t\t}\n\t\t\tright = right.erase(key);\n\t\t\tupdateSize();\n\t\t\treturn this;\n\t\t}\n\n\t\tprotected Node lower(K key) {\n\t\t\tif (compare(key, this.key) <= 0)\n\t\t\t\treturn left.lower(key);\n\t\t\tNode result = right.lower(key);\n\t\t\tif (result == nullNode)\n\t\t\t\treturn this;\n\t\t\treturn result;\n\t\t}\n\n\t\tprotected Node floor(K key) {\n\t\t\tif (compare(key, this.key) < 0)\n\t\t\t\treturn left.floor(key);\n\t\t\tNode result = right.floor(key);\n\t\t\tif (result == nullNode)\n\t\t\t\treturn this;\n\t\t\treturn result;\n\t\t}\n\n\t\tprotected Node higher(K key) {\n\t\t\tif (compare(key, this.key) >= 0)\n\t\t\t\treturn right.higher(key);\n\t\t\tNode result = left.higher(key);\n\t\t\tif (result == nullNode)\n\t\t\t\treturn this;\n\t\t\treturn result;\n\t\t}\n\n\t\tprotected Node ceil(K key) {\n\t\t\tif (compare(key, this.key) > 0)\n\t\t\t\treturn right.ceil(key);\n\t\t\tNode result = left.ceil(key);\n\t\t\tif (result == nullNode)\n\t\t\t\treturn this;\n\t\t\treturn result;\n\t\t}\n\n\t\tprotected Node first() {\n\t\t\tif (left == nullNode)\n\t\t\t\treturn this;\n\t\t\treturn left.first();\n\t\t}\n\n\t\tprotected Node last() {\n\t\t\tif (right == nullNode)\n\t\t\t\treturn this;\n\t\t\treturn right.last();\n\t\t}\n\n\t\tprotected Node search(K key) {\n\t\t\tint value = compare(key, this.key);\n\t\t\tif (value == 0)\n\t\t\t\treturn this;\n\t\t\tif (value < 0)\n\t\t\t\treturn left.search(key);\n\t\t\treturn right.search(key);\n\t\t}\n\n\t\tpublic int indexOf(Node node) {\n\t\t\tif (this == node)\n\t\t\t\treturn left.size;\n\t\t\tif (compare(node.key, this.key) > 0)\n\t\t\t\treturn left.size + 1 + right.indexOf(node);\n\t\t\treturn left.indexOf(node);\n\t\t}\n\n\t}\n\n\tprivate class NullNode extends Node {\n\t\tprivate Object[] splitResult = new Object[2];\n\n\t\tprivate NullNode() {\n\t\t\tsuper(null, Long.MIN_VALUE);\n\t\t\tleft = this;\n\t\t\tright = this;\n\t\t\tsize = 0;\n\t\t}\n\n\t\tprotected Object[] split(K key) {\n\t\t\tsplitResult[0] = splitResult[1] = this;\n\t\t\treturn splitResult;\n\t\t}\n\n\t\tprotected Node insert(Node node) {\n\t\t\treturn node;\n\t\t}\n\n\t\tprotected Node erase(K key) {\n\t\t\treturn this;\n\t\t}\n\n\t\tprotected Node lower(K key) {\n\t\t\treturn this;\n\t\t}\n\n\t\tprotected Node floor(K key) {\n\t\t\treturn this;\n\t\t}\n\n\t\tprotected Node higher(K key) {\n\t\t\treturn this;\n\t\t}\n\n\t\tprotected Node ceil(K key) {\n\t\t\treturn this;\n\t\t}\n\n\t\tprotected Node first() {\n\t\t\tthrow new NoSuchElementException();\n\t\t}\n\n\t\tprotected Node last() {\n\t\t\tthrow new NoSuchElementException();\n\t\t}\n\n\t\tprotected void updateSize() {\n\t\t}\n\n\t\tprotected Node search(K key) {\n\t\t\treturn this;\n\t\t}\n\n\t}\n}\n\nclass EHashMap extends AbstractMap {\n\tprivate static final int[] shifts = new int[10];\n\n\tprivate int size;\n\tprivate HashEntry[] data;\n\tprivate int capacity;\n\tprivate Set> entrySet;\n\n\tstatic {\n\t\tRandom random = new Random(System.currentTimeMillis());\n\t\tfor (int i = 0; i < 10; i++)\n\t\t\tshifts[i] = 1 + 3 * i + random.nextInt(3);\n\t}\n\n\tpublic EHashMap() {\n\t\tthis(4);\n\t}\n\n\tprivate void setCapacity(int size) {\n\t\tcapacity = Integer.highestOneBit(4 * size);\n\t\t// noinspection unchecked\n\t\tdata = new HashEntry[capacity];\n\t}\n\n\tpublic EHashMap(int maxSize) {\n\t\tsetCapacity(maxSize);\n\t\tentrySet = new AbstractSet>() {\n\t\t\tpublic Iterator> iterator() {\n\t\t\t\treturn new Iterator>() {\n\t\t\t\t\tprivate HashEntry last = null;\n\t\t\t\t\tprivate HashEntry current = null;\n\t\t\t\t\tprivate HashEntry base = null;\n\t\t\t\t\tprivate int lastIndex = -1;\n\t\t\t\t\tprivate int index = -1;\n\n\t\t\t\t\tpublic boolean hasNext() {\n\t\t\t\t\t\tif (current == null) {\n\t\t\t\t\t\t\tfor (index++; index < capacity; index++) {\n\t\t\t\t\t\t\t\tif (data[index] != null) {\n\t\t\t\t\t\t\t\t\tbase = current = data[index];\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn current != null;\n\t\t\t\t\t}\n\n\t\t\t\t\tpublic Entry next() {\n\t\t\t\t\t\tif (!hasNext())\n\t\t\t\t\t\t\tthrow new NoSuchElementException();\n\t\t\t\t\t\tlast = current;\n\t\t\t\t\t\tlastIndex = index;\n\t\t\t\t\t\tcurrent = current.next;\n\t\t\t\t\t\tif (base.next != last)\n\t\t\t\t\t\t\tbase = base.next;\n\t\t\t\t\t\treturn last;\n\t\t\t\t\t}\n\n\t\t\t\t\tpublic void remove() {\n\t\t\t\t\t\tif (last == null)\n\t\t\t\t\t\t\tthrow new IllegalStateException();\n\t\t\t\t\t\tsize--;\n\t\t\t\t\t\tif (base == last)\n\t\t\t\t\t\t\tdata[lastIndex] = last.next;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tbase.next = last.next;\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tpublic int size() {\n\t\t\t\treturn size;\n\t\t\t}\n\t\t};\n\t}\n\n\tpublic Set> entrySet() {\n\t\treturn entrySet;\n\t}\n\n\tpublic void clear() {\n\t\tArrays.fill(data, null);\n\t\tsize = 0;\n\t}\n\n\tprivate int index(Object o) {\n\t\treturn getHash(o.hashCode()) & (capacity - 1);\n\t}\n\n\tprivate int getHash(int h) {\n\t\tint result = h;\n\t\tfor (int i : shifts)\n\t\t\tresult ^= h >>> i;\n\t\treturn result;\n\t}\n\n\tpublic V remove(Object o) {\n\t\tif (o == null)\n\t\t\treturn null;\n\t\tint index = index(o);\n\t\tHashEntry current = data[index];\n\t\tHashEntry last = null;\n\t\twhile (current != null) {\n\t\t\tif (current.key.equals(o)) {\n\t\t\t\tif (last == null)\n\t\t\t\t\tdata[index] = current.next;\n\t\t\t\telse\n\t\t\t\t\tlast.next = current.next;\n\t\t\t\tsize--;\n\t\t\t\treturn current.value;\n\t\t\t}\n\t\t\tlast = current;\n\t\t\tcurrent = current.next;\n\t\t}\n\t\treturn null;\n\t}\n\n\tpublic V put(E e, V value) {\n\t\tif (e == null)\n\t\t\treturn null;\n\t\tint index = index(e);\n\t\tHashEntry current = data[index];\n\t\tif (current != null) {\n\t\t\twhile (true) {\n\t\t\t\tif (current.key.equals(e)) {\n\t\t\t\t\tV oldValue = current.value;\n\t\t\t\t\tcurrent.value = value;\n\t\t\t\t\treturn oldValue;\n\t\t\t\t}\n\t\t\t\tif (current.next == null)\n\t\t\t\t\tbreak;\n\t\t\t\tcurrent = current.next;\n\t\t\t}\n\t\t}\n\t\tif (current == null)\n\t\t\tdata[index] = new HashEntry(e, value);\n\t\telse\n\t\t\tcurrent.next = new HashEntry(e, value);\n\t\tsize++;\n\t\tif (2 * size > capacity) {\n\t\t\tHashEntry[] oldData = data;\n\t\t\tsetCapacity(size);\n\t\t\tfor (HashEntry entry : oldData) {\n\t\t\t\twhile (entry != null) {\n\t\t\t\t\tHashEntry next = entry.next;\n\t\t\t\t\tindex = index(entry.key);\n\t\t\t\t\tentry.next = data[index];\n\t\t\t\t\tdata[index] = entry;\n\t\t\t\t\tentry = next;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tpublic V get(Object o) {\n\t\tif (o == null)\n\t\t\treturn null;\n\t\tint index = index(o);\n\t\tHashEntry current = data[index];\n\t\twhile (current != null) {\n\t\t\tif (current.key.equals(o))\n\t\t\t\treturn current.value;\n\t\t\tcurrent = current.next;\n\t\t}\n\t\treturn null;\n\t}\n\n\tpublic boolean containsKey(Object o) {\n\t\tif (o == null)\n\t\t\treturn false;\n\t\tint index = index(o);\n\t\tHashEntry current = data[index];\n\t\twhile (current != null) {\n\t\t\tif (current.key.equals(o))\n\t\t\t\treturn true;\n\t\t\tcurrent = current.next;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic int size() {\n\t\treturn size;\n\t}\n\n\tprivate static class HashEntry implements Entry {\n\t\tprivate final E key;\n\t\tprivate V value;\n\t\tprivate HashEntry next;\n\n\t\tprivate HashEntry(E key, V value) {\n\t\t\tthis.key = key;\n\t\t\tthis.value = value;\n\t\t}\n\n\t\tpublic E getKey() {\n\t\t\treturn key;\n\t\t}\n\n\t\tpublic V getValue() {\n\t\t\treturn value;\n\t\t}\n\n\t\tpublic V setValue(V value) {\n\t\t\tV oldValue = this.value;\n\t\t\tthis.value = value;\n\t\t\treturn oldValue;\n\t\t}\n\t}\n}\n\nabstract class IntervalTree {\n\tprotected int size;\n\n\tpublic IntervalTree(int size, boolean shouldInit) {\n\t\tthis.size = size;\n\t\tint nodeCount = Math.max(1, Integer.highestOneBit(size) << 2);\n\t\tinitData(size, nodeCount);\n\t\tif (shouldInit)\n\t\t\tinit();\n\t}\n\n\tprotected abstract void initData(int size, int nodeCount);\n\n\tprotected abstract void initAfter(int root, int left, int right, int middle);\n\n\tprotected abstract void initBefore(int root, int left, int right, int middle);\n\n\tprotected abstract void initLeaf(int root, int index);\n\n\tprotected abstract void updatePostProcess(int root, int left, int right,\n\t\t\tint from, int to, long delta, int middle);\n\n\tprotected abstract void updatePreProcess(int root, int left, int right,\n\t\t\tint from, int to, long delta, int middle);\n\n\tprotected abstract void updateFull(int root, int left, int right, int from,\n\t\t\tint to, long delta);\n\n\tprotected abstract long queryPostProcess(int root, int left, int right,\n\t\t\tint from, int to, int middle, long leftResult, long rightResult);\n\n\tprotected abstract void queryPreProcess(int root, int left, int right,\n\t\t\tint from, int to, int middle);\n\n\tprotected abstract long queryFull(int root, int left, int right, int from,\n\t\t\tint to);\n\n\tprotected abstract long emptySegmentResult();\n\n\tpublic void init() {\n\t\tif (size == 0)\n\t\t\treturn;\n\t\tinit(0, 0, size - 1);\n\t}\n\n\tprivate void init(int root, int left, int right) {\n\t\tif (left == right) {\n\t\t\tinitLeaf(root, left);\n\t\t} else {\n\t\t\tint middle = (left + right) >> 1;\n\t\t\tinitBefore(root, left, right, middle);\n\t\t\tinit(2 * root + 1, left, middle);\n\t\t\tinit(2 * root + 2, middle + 1, right);\n\t\t\tinitAfter(root, left, right, middle);\n\t\t}\n\t}\n\n\tpublic void update(int from, int to, long delta) {\n\t\tupdate(0, 0, size - 1, from, to, delta);\n\t}\n\n\tprotected void update(int root, int left, int right, int from, int to,\n\t\t\tlong delta) {\n\t\tif (left > to || right < from)\n\t\t\treturn;\n\t\tif (left >= from && right <= to) {\n\t\t\tupdateFull(root, left, right, from, to, delta);\n\t\t\treturn;\n\t\t}\n\t\tint middle = (left + right) >> 1;\n\t\tupdatePreProcess(root, left, right, from, to, delta, middle);\n\t\tupdate(2 * root + 1, left, middle, from, to, delta);\n\t\tupdate(2 * root + 2, middle + 1, right, from, to, delta);\n\t\tupdatePostProcess(root, left, right, from, to, delta, middle);\n\t}\n\n\tpublic long query(int from, int to) {\n\t\treturn query(0, 0, size - 1, from, to);\n\t}\n\n\tprotected long query(int root, int left, int right, int from, int to) {\n\t\tif (left > to || right < from)\n\t\t\treturn emptySegmentResult();\n\t\tif (left >= from && right <= to)\n\t\t\treturn queryFull(root, left, right, from, to);\n\t\tint middle = (left + right) >> 1;\n\t\tqueryPreProcess(root, left, right, from, to, middle);\n\t\tlong leftResult = query(2 * root + 1, left, middle, from, to);\n\t\tlong rightResult = query(2 * root + 2, middle + 1, right, from, to);\n\t\treturn queryPostProcess(root, left, right, from, to, middle,\n\t\t\t\tleftResult, rightResult);\n\t}\n}\n\nabstract class LongIntervalTree extends IntervalTree {\n\tprotected long[] value;\n\tprotected long[] delta;\n\n\tprotected LongIntervalTree(int size) {\n\t\tthis(size, true);\n\t}\n\n\tpublic LongIntervalTree(int size, boolean shouldInit) {\n\t\tsuper(size, shouldInit);\n\t}\n\n\tprotected void initData(int size, int nodeCount) {\n\t\tvalue = new long[nodeCount];\n\t\tdelta = new long[nodeCount];\n\t}\n\n\tprotected abstract long joinValue(long left, long right);\n\n\tprotected abstract long joinDelta(long was, long delta);\n\n\tprotected abstract long accumulate(long value, long delta, int length);\n\n\tprotected abstract long neutralValue();\n\n\tprotected abstract long neutralDelta();\n\n\tprotected long initValue(int index) {\n\t\treturn neutralValue();\n\t}\n\n\tprotected void initAfter(int root, int left, int right, int middle) {\n\t\tvalue[root] = joinValue(value[2 * root + 1], value[2 * root + 2]);\n\t\tdelta[root] = neutralDelta();\n\t}\n\n\tprotected void initBefore(int root, int left, int right, int middle) {\n\t}\n\n\tprotected void initLeaf(int root, int index) {\n\t\tvalue[root] = initValue(index);\n\t\tdelta[root] = neutralDelta();\n\t}\n\n\tprotected void updatePostProcess(int root, int left, int right, int from,\n\t\t\tint to, long delta, int middle) {\n\t\tvalue[root] = joinValue(value[2 * root + 1], value[2 * root + 2]);\n\t}\n\n\tprotected void updatePreProcess(int root, int left, int right, int from,\n\t\t\tint to, long delta, int middle) {\n\t\tpushDown(root, left, middle, right);\n\t}\n\n\tprotected void pushDown(int root, int left, int middle, int right) {\n\t\tvalue[2 * root + 1] = accumulate(value[2 * root + 1], delta[root],\n\t\t\t\tmiddle - left + 1);\n\t\tvalue[2 * root + 2] = accumulate(value[2 * root + 2], delta[root],\n\t\t\t\tright - middle);\n\t\tdelta[2 * root + 1] = joinDelta(delta[2 * root + 1], delta[root]);\n\t\tdelta[2 * root + 2] = joinDelta(delta[2 * root + 2], delta[root]);\n\t\tdelta[root] = neutralDelta();\n\t}\n\n\tprotected void updateFull(int root, int left, int right, int from, int to,\n\t\t\tlong delta) {\n\t\tvalue[root] = accumulate(value[root], delta, right - left + 1);\n\t\tthis.delta[root] = joinDelta(this.delta[root], delta);\n\t}\n\n\tprotected long queryPostProcess(int root, int left, int right, int from,\n\t\t\tint to, int middle, long leftResult, long rightResult) {\n\t\treturn joinValue(leftResult, rightResult);\n\t}\n\n\tprotected void queryPreProcess(int root, int left, int right, int from,\n\t\t\tint to, int middle) {\n\t\tpushDown(root, left, middle, right);\n\t}\n\n\tprotected long queryFull(int root, int left, int right, int from, int to) {\n\t\treturn value[root];\n\t}\n\n\tprotected long emptySegmentResult() {\n\t\treturn neutralValue();\n\t}\n}", "lang": "Java 8", "bug_code_uid": "50035c42587ec7e4e7c1ec9d58abaf17", "src_uid": "1f68bd6f8b40e45a5bd360b03a264ef4", "apr_id": "140152b4c54f0225585d439454aee265", "difficulty": 2600, "tags": ["dp", "hashing", "dfs and similar", "number theory", "math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.734897804693414, "equal_cnt": 30, "replace_cnt": 14, "delete_cnt": 5, "insert_cnt": 10, "fix_ops_cnt": 29, "bug_source_code": "import java.util.*;\nimport java.io.*;\nimport java.lang.*;\nimport java.math.*;\npublic class A {\n public static void main(String[] args) throws Exception {\n BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n // Scanner scan = new Scanner(System.in);\n // PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); \n long A = Long.parseLong(bf.readLine());\n Map> m = new HashMap>();\n Map div = new HashMap();\n ArrayList divisors = new ArrayList();\n long sqrt = (long)Math.sqrt(A);\n \n for(int i=1; i<=sqrt; i++) {\n if(A % i == 0) {\n divisors.add(i+0L);\n if(1L*i*i != A) divisors.add(A/i);\n }\n }\n Collections.sort(divisors);\n\n hi: for(long i : divisors) {\n //System.out.println(i);\n boolean done = false;\n sqrt = (long)Math.sqrt(i-1);\n for(long j=2; j<=sqrt; j++) {\n if((i-1) % j == 0) {\n long val = i-1;\n double t = Math.log(val)/Math.log(j);\n if(Math.abs(t - Math.round(t)) > 0.00001) continue hi;\n int count = (int)Math.round(t);\n if(!m.containsKey(j)) m.put(j, new HashSet());\n m.get(j).add(count);\n div.put(i, j);\n done = true;\n break;\n }\n }\n if(!done && i != 1 && i != 2 ) {\n if(!m.containsKey(i-1)) m.put(i-1, new HashSet());\n m.get(i-1).add(1);\n div.put(i, i-1);\n }\n }\n //\n ArrayList P = new ArrayList();\n for(long l : m.keySet()) P.add(l);\n Collections.sort(P);\n int[] dp = new int[divisors.size()];\n //System.out.println(P.size() + \" \" + divisors.size());\n Map divis = new HashMap();\n for(int i=0; i=0; j--) {\n for(int k : m.get(P.get(i-1))) {\n long val = (long)(Math.pow(P.get(i-1), k) + 1);\n if(divisors.get(j) % val == 0)\n dp[j] += dp[divis.get(divisors.get(j)/val)];\n }\n }\n }\n System.out.println(dp[divisors.size() - 1]);\n // System.out.println(P);\n // StringTokenizer st = new StringTokenizer(bf.readLine());\n // int[] a = new int[n]; for(int i=0; i> m = new HashMap>();\n Map div = new HashMap();\n ArrayList divisors = new ArrayList();\n long sqrt = (long)Math.sqrt(A);\n \n for(int i=1; i 0.00001) continue hi;\n int count = (int)Math.round(t);\n HashSet set = m.get(j);\n if(set == null) {\n set = new HashSet();\n m.put(j, set);\n }\n set.add(count);\n div.put(i, j);\n done = true;\n break;\n }\n }\n if(!done && i != 1 && i != 2 ) {\n HashSet set = m.get(i - 1);\n if(set == null) {\n set = new HashSet();\n m.put(i - 1, set);\n }\n set.add(1);\n div.put(i, i-1);\n }\n }\n\n //\n ArrayList P = new ArrayList();\n for(long l : m.keySet()) P.add(l);\n Collections.sort(P);\n int[] dp = new int[divisors.size()];\n //System.out.println(P.size() + \" \" + divisors.size());\n Map divis = new HashMap();\n for(int i=0; i> temp = new ArrayList<>();\n for(int i = 1; i <= P.size(); i++) {\n ArrayList list = new ArrayList();\n temp.add(list);\n pp = P.get(i - 1);\n for(int k : m.get(pp)) {\n val = (long)(Math.pow(pp, k) + 1);\n list.add(val);\n \n }\n }\n for(int i=1; i<=P.size(); ++i) {\n for(int j=divisors.size()-1; j>=0; --j) {\n divv = divisors.get(j);\n pp = P.get(i - 1);\n int iter = 0;\n ArrayList tempp = temp.get(i - 1);\n for(int k : m.get(pp)) {\n val = tempp.get(iter++);\n if(divv % val == 0)\n dp[j] += dp[divis.get(divv/val)];\n }\n }\n }\n System.out.println(System.currentTimeMillis() - start);\n System.out.println(dp[divisors.size() - 1]);\n // System.out.println(P);\n // StringTokenizer st = new StringTokenizer(bf.readLine());\n // int[] a = new int[n]; for(int i=0; i[] readGraph(int vertexNumber, int edgeNumber)\n\tthrows IOException{\n\t\t@SuppressWarnings(\"unchecked\")\n\t\tList[] graph = new List[vertexNumber];\n\t\t\n\t\tfor (int index = 0; index < vertexNumber; ++index){\n\t\t\tgraph[index] = new ArrayList();\n\t\t}\n\t\t\n\t\twhile (edgeNumber-- > 0){\n\t\t\tint from = readInt() - 1;\n\t\t\tint to = readInt() - 1;\n\t\t\t\n\t\t\tgraph[from].add(to);\n\t\t\tgraph[to].add(from);\n\t\t}\n\t\t\n\t\treturn graph;\n\t}\n\t\n\t/////////////////////////////////////////////////////////////////////\n\t\n\tstatic class IntIndexPair {\n\t\t\n\t\tstatic Comparator increaseComparator = new Comparator() {\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic int compare(IntIndexPair indexPair1, IntIndexPair indexPair2) {\n\t\t\t\tint value1 = indexPair1.value;\n\t\t\t\tint value2 = indexPair2.value;\n\t\t\t\t\n\t\t\t\tif (value1 != value2) return value1 - value2;\n\t\t\t\t\n\t\t\t\tint index1 = indexPair1.index;\n\t\t\t\tint index2 = indexPair2.index;\n\t\t\t\t\n\t\t\t\treturn index1 - index2;\n\t\t\t}\n\t\t};\n\t\t\n\t\tstatic Comparator decreaseComparator = new Comparator() {\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic int compare(IntIndexPair indexPair1, IntIndexPair indexPair2) {\n\t\t\t\tint value1 = indexPair1.value;\n\t\t\t\tint value2 = indexPair2.value;\n\t\t\t\t\n\t\t\t\tif (value1 != value2) return -(value1 - value2);\n\t\t\t\t\n\t\t\t\tint index1 = indexPair1.index;\n\t\t\t\tint index2 = indexPair2.index;\n\t\t\t\t\n\t\t\t\treturn index1 - index2;\n\t\t\t}\n\t\t};\n\t\t\n\t\tint value, index;\n\n\t\tpublic IntIndexPair(int value, int index) {\n\t\t\tsuper();\n\t\t\tthis.value = value;\n\t\t\tthis.index = index;\n\t\t}\t\t\n\t\t\n\t\tpublic int getRealIndex() {\n\t\t\treturn index + 1;\n\t\t}\n\t}\n\t\n\tIntIndexPair[] readIntIndexArray(int size) throws IOException {\n\t\tIntIndexPair[] array = new IntIndexPair[size];\n\t\t\n\t\tfor (int index = 0; index < size; ++index) {\n\t\t\tarray[index] = new IntIndexPair(readInt(), index);\n\t\t}\n\t\t\n\t\treturn array;\n\t}\n\t\n\t/////////////////////////////////////////////////////////////////////\n\t\n\tstatic class OutputWriter extends PrintWriter {\n\n\t\tfinal int DEFAULT_PRECISION = 12;\n\t\t\n\t\tprotected int precision;\n\t\tprotected String format, formatWithSpace;\n\t\t\n\t\t{\n\t\t\tprecision = DEFAULT_PRECISION;\n\t\t\t\n\t\t\tformat = createFormat(precision);\n\t\t\tformatWithSpace = format + \" \";\n\t\t}\n\t\t\n\t\tpublic OutputWriter(OutputStream out) {\n\t\t\tsuper(out);\n\t\t}\n\n\t\tpublic OutputWriter(String fileName) throws FileNotFoundException {\n\t\t\tsuper(fileName);\n\t\t}\n\t\t\n\t\tpublic int getPrecision() {\n\t\t\treturn precision;\n\t\t}\n\n\t\tpublic void setPrecision(int precision) {\n\t\t\tprecision = max(0, precision);\n\t\t\tthis.precision = precision;\n\t\t\t\n\t\t\tformat = createFormat(precision);\n\t\t\tformatWithSpace = format + \" \";\n\t\t}\n\t\t\n\t\tprivate String createFormat(int precision){\n\t\t\treturn \"%.\" + precision + \"f\";\n\t\t}\n\t\t\n\t\t@Override\n\t\tpublic void print(double d){\n\t\t\tprintf(format, d);\n\t\t}\n\t\t\n\t\tpublic void printWithSpace(double d){\n\t\t\tprintf(formatWithSpace, d);\n\t\t}\n\n\t\tpublic void printAll(double...d){\n\t\t\tfor (int i = 0; i < d.length - 1; ++i){\n\t\t\t\tprintWithSpace(d[i]);\n\t\t\t}\n\t\t\t\n\t\t\tprint(d[d.length - 1]);\n\t\t}\n\t\t\n\t\t@Override\n\t\tpublic void println(double d){\n\t\t\tprintlnAll(d);\n\t\t}\n\t\t\n\t\tpublic void printlnAll(double... d){\n\t\t\tprintAll(d);\n\t\t\tprintln();\n\t\t}\n\t}\n\t\n\t/////////////////////////////////////////////////////////////////////\n\t\n\tstatic final int[][] steps = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}}; \n\tstatic final int[][] steps8 = {\n\t\t\t{-1, 0}, {1, 0}, {0, -1}, {0, 1},\n\t\t\t{-1, -1}, {1, 1}, {1, -1}, {-1, 1}\n\t};\n\t\n\tstatic final boolean check(int index, int lim){\n\t\treturn (0 <= index && index < lim);\n\t}\n\t\n\t/////////////////////////////////////////////////////////////////////\n\t\n\tstatic final boolean checkBit(int mask, int bit){\n\t\treturn (mask & (1 << bit)) != 0;\n\t}\n\t\n\t/////////////////////////////////////////////////////////////////////\n\t\n\tstatic final long getSum(int[] array) {\n\t\tlong sum = 0;\n\t\tfor (int value: array) {\n\t\t\tsum += value;\n\t\t}\n\t\t\n\t\treturn sum;\n\t}\n\t\n\tstatic final Point getMinMax(int[] array) {\n\t\tint min = array[0];\n\t\tint max = array[0];\n\t\t\n\t\tfor (int index = 0, size = array.length; index < size; ++index, ++index) {\n\t\t\tint value = array[index];\n\t\t\t\n\t\t\tif (index == size - 1) {\n\t\t\t\tmin = min(min, value);\n\t\t\t\tmax = max(max, value);\n\t\t\t} else {\n\t\t\t\tint otherValue = array[index + 1];\n\t\t\t\t\n\t\t\t\tif (value <= otherValue) {\n\t\t\t\t\tmin = min(min, value);\n\t\t\t\t\tmax = max(max, otherValue);\n\t\t\t\t} else {\n\t\t\t\t\tmin = min(min, otherValue);\n\t\t\t\t\tmax = max(max, value);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn new Point(min, max);\n\t}\n\t\n\t/////////////////////////////////////////////////////////////////////\n\t\n\tvoid solve() throws IOException {\n\t\tlong sum = readLong();\n\t\t\n\t\tList divisors = new ArrayList();\n\t\tfor (long d = 1; d <= sum / d; ++d) {\n\t\t\tif (sum % d == 0) {\n\t\t\t\tdivisors.add(d);\n\t\t\t\tif (sum / d != d) {\n\t\t\t\t\tdivisors.add(sum / d);\n\t\t\t\t}\n\t\t\t}\n\t\t} \n\t\t\n\t\tMap indexes = new HashMap();\n\t\tfor (int i = 0; i < divisors.size(); ++i) {\n\t\t\tlong d = divisors.get(i);\n\t\t\tindexes.put(d, i);\n\t\t}\n\t\t\n\t\tMap> classes = new HashMap>();\n\t\tfor (int i = 0; i < divisors.size(); ++i) {\n\t\t\tlong d = divisors.get(i) - 1;\n\t\t\t\n\t\t\tboolean found = false;\n\t\t\tfor (long prime = 2; prime <= d / prime; ++prime) {\n\t\t\t\tif (d % prime == 0) {\n\t\t\t\t\tlong x = d;\n\t\t\t\t\twhile (x % prime == 0) {\n\t\t\t\t\t\tx /= prime;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (x == 1) {\n\t\t\t\t\t\tadd(classes, prime, i);\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (!found) {\n\t\t\t\tboolean isPrime = (d > 1);\n\t\t\t\tfor (long dd = 2; dd <= d / dd; ++dd) {\n\t\t\t\t\tif (d % dd == 0) {\n\t\t\t\t\t\tisPrime = false;\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 (isPrime) {\n\t\t\t\t\tadd(classes, d, i);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tint divisorsCount = divisors.size();\n\t\tint classesCount = classes.size();\n\t\t\n\t\tlong[] curDp = new long[divisorsCount];\n\t\tlong[] nextDp = new long[divisorsCount];\n\t\t\n\t\tcurDp[indexes.get(1L)] = 1;\n\t\t\n\t\tfor (Map.Entry> e : classes.entrySet()) {\n\t\t\tList classIndexes = e.getValue();\n\t\t\t\n\t\t\tfor (int i = 0; i < divisorsCount; ++i) {\n\t\t\t\tlong d = divisors.get(i);\n\t\t\t\tif (curDp[i] == 0) continue;\n\t\t\t\t\n\t\t\t\tfor (int classIndex : classIndexes) {\n\t\t\t\t\tlong classD = divisors.get(classIndex);\n\t\t\t\t\t\n\t\t\t\t\tif (sum / classD >= d) {\n\t\t\t\t\t\tlong nextD = d * classD;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (sum % nextD == 0) {\n\t\t\t\t\t\t\tint nextI = indexes.get(nextD);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (nextI == indexes.get(3003L)) {\n\t\t\t\t\t\t\t\tnextI = nextI;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tnextDp[nextI] += curDp[i];\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\t\n\t\t\tfor (int i = 0; i < divisorsCount; ++i) {\n\t\t\t\tcurDp[i] += nextDp[i];\n\t\t\t\tnextDp[i] = 0;\n\t\t\t}\n\t\t}\n\t\t\n\t\tout.println(curDp[indexes.get(sum)]);\n\t}\n\t\n\tvoid add(Map> classes, long key, int value) {\n\t\tList keyClass = classes.get(key);\n\t\tif (keyClass == null) {\n\t\t\tclasses.put(key, keyClass = new ArrayList());\n\t\t}\n\t\t\n\t\tkeyClass.add(value);\n\t}\n}\n\n", "lang": "Java 8", "bug_code_uid": "62658aff66acd3207d9bafab8ff48639", "src_uid": "1f68bd6f8b40e45a5bd360b03a264ef4", "apr_id": "49bd6b9969273cdcd8babcf9bc5b5ca3", "difficulty": 2600, "tags": ["dp", "hashing", "dfs and similar", "number theory", "math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8856900931414056, "equal_cnt": 13, "replace_cnt": 10, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 14, "bug_source_code": "\nimport java.util.Scanner;\n\npublic class WaterMelon {\n\n public static void main(String[] args) /*throws IOException*/ {\n \n Scanner in = new Scanner(System.in);\n int k = in.nextInt();\n \n for(int i=1;i<=k;k++)\n if(i==1)\n System.out.println(i + \"=NO\");\n else if(i==2)\n System.out.println(i + \"=NO\");\n else if((i-2)%2 == 0)\n System.out.println(i + \"=YES\");\n else if(i%2==0)\n System.out.println(i + \"=YES\");\n \n else System.out.println(i + \"=NO\");\n }\n \n}", "lang": "Java 6", "bug_code_uid": "e1f676803331d43b04e94af9635edbe2", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "a74ed5edfe8b2421719b6a656c32ece5", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9568245125348189, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 5, "bug_source_code": "public class SoftDrinking {\n\n\tint getNumToasts(int n, int k, int l, int c, int d, int p, int nl, int np) {\n\t\tint toasts = (k * l) / nl;\n\t\ttoasts = Math.min(toasts, c * d);\n\t\ttoasts = Math.min(toasts, p / np);\n\t\t\n\t\treturn toasts / n;\n\t}\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n\t\tString s = in.readLine();\n\t\tin.close();\n\t\t\n\t\tString[] t = s.split(\" \");\n\t\treturn getNumToasts\n\t\t\tInteger.parseInt(t[0]),\n\t\t\tInteger.parseInt(t[1]),\n\t\t\tInteger.parseInt(t[2]),\n\t\t\tInteger.parseInt(t[3]),\n\t\t\tInteger.parseInt(t[4]),\n\t\t\tInteger.parseInt(t[5]),\n\t\t\tInteger.parseInt(t[6]),\n\t\t\tInteger.parseInt(t[7])\n\t\t);\n\t}\n}", "lang": "Java 6", "bug_code_uid": "9045796dd22dfb46ec212995327dbf28", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "apr_id": "6b94c51f7f1886ce3779440ed018d1a8", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7206896551724138, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "import java.util.Scanner;\n\npublic class Spider120F {\n\n /**\n * @param args the command line arguments\n */\n \n public static void main(String[] args) throws Exception{\n // TODO code application logic here\n Scanner input=new Scanner(System.in);\n \n long p=input.nextLong();\n long d=input.nextLong();\n long bound=p-d;\n long tmp=p;\n long max=p;\n int i=1;\n while(tmp!=-1){\n tmp=(long)(p-(long)(p%Math.pow(10,i))-1);\n i++;\n if(tmp>=bound)\n max=tmp;\n }\n System.out.println(max);\n }\n \n}", "lang": "Java 7", "bug_code_uid": "d16c2386117cff015dff9256b7ded4e5", "src_uid": "c706cfcd4c37fbc1b1631aeeb2c02b6a", "apr_id": "1afdd6a25d730adc4fcbb4babfc899e1", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9752380952380952, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\nimport java.util.Map;\nimport java.util.HashMap;\nimport java.io.IOException;\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n TaskA solver = new TaskA();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class TaskA {\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n char[] v = in.next().toCharArray();\n int res = 0;\n int[] dx = {1, -1, 0, 0};\n int[] dy = {0, 0, -1, 1};\n Map c = new HashMap<>();\n c.put('U', 0);\n c.put('D', 1);\n c.put('L', 2);\n c.put('R', 3);\n for (int i = 0; i < n; ++i) {\n boolean[][] dp = new boolean[5000][5000];\n int x = 1000;\n int y = 1000;\n dp[x][y] = true;\n for (int j = i; j < n; ++j) {\n x += dx[c.get(v[j])];\n y += dy[c.get(v[j])];\n if (dp[x][y]) ++res;\n }\n }\n out.println(res);\n }\n\n }\n\n static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "2dca73ec9e3d3c6cc60742b4d52df7c8", "src_uid": "7bd5521531950e2de9a7b0904353184d", "apr_id": "9ede6864924332659ec58b2c7edac11e", "difficulty": 1000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9979338842975206, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\n\npublic class A {\n\t\n\tpublic static void main(String[] args){\n\t\t\n\t\tMyScanner in = new MyScanner();\t\t\n\t\tint n = in.nextInt();\t\t\n\t\tString s = in.next();\n\t\t\n\t\tint result = 0;\t\t\n\t\tfor(int i=0;i 0 && n < 200){\n \t\tfor( int i = 0; i < n; i++){\n \t\t\tx = 0;\n \t\t\ty = 0;\t\n \t\t\tfor(int j = i ; j < n; j++){\n \t\t\t\tswitch (st[j]){\n \t\t\t\t\tcase 'U': y++; break;\n \t\t\t\t\tcase 'D': y--; break;\n \t\t\t\t\tcase 'R': x++; break;\n \t\t\t\t\tcase 'L': x--; break;\t\t\n \t\t\t\t} \n \t\t\t\t\tif (x==0 && y==0){\n \t\t\t\t\tcount++;\n \t\t\t\t\t}\n \t\t\t}\n \t\t}\n \t}\n \n System.out.println(count);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "9586cefa0a963a03d1b2ebeee21be11c", "src_uid": "7bd5521531950e2de9a7b0904353184d", "apr_id": "fc39ccdaf1162c066c20b3bb278a2323", "difficulty": 1000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.975747320924986, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import java.util.ArrayList;\nimport java.util.Scanner;\n\n\n/**\n * Created by Dipto on 14/02/2016.\n */\npublic class problem {\n public static void main(String[] args) {\n int i,j,k;\n int n;\n Scanner input = new Scanner(System.in);\n n=input.nextInt();\n String array = input.nextLine();\n int count = 0;\n for(i=0;itime && ttime>i) \n\t\t\t\tans++;\n }\n System.out.println(ans);\n\n }\n}", "lang": "Java 8", "bug_code_uid": "e3b9ffd020621cb25a6cefc70d6a80d5", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "apr_id": "a7114741ce435b362e7467e927b83fb4", "difficulty": 1600, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9993957703927493, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner;\n\n/**\n * Created by \u041e\u043b\u0435\u0433 on 23.04.2016.\n */\npublic class BusBetweenCities {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n final int STARTTIME = 5*60;\n final int ENDTIME = 23*60+59;\n int a = in.nextInt();\n int t_a = in.nextInt();\n int b = in.nextInt();\n int t_b = in.nextInt();\n String s = in.next();\n String[] strings = s.split(\":\");\n int hh = Integer.valueOf(strings[0]);\n int mm = Integer.valueOf(strings[1]);\n int startTime = mm + hh*60;\n int endTime = startTime + t_a;\n int result =0;\n for (int time = STARTTIME; time < ENDTIME; time+=b) {\n if (time+t_b>startTime&&time myAr = new ArrayList();\n ArrayList extra = new ArrayList();\n ArrayList other = new ArrayList();\n String st = in.next();\n long tStart=System.currentTimeMillis();\n int permutations=in.nextInt();\n int permut=0,counter=0;\n permut=permutations;\n for (int i=0; i sup = new ArrayList();\n while((permut!=0)&&!(extra.equals(myAr))) {\n Character max=myAr.get(counter);\n Character bigMax=myAr.get(counter);\n for (int i=0;i ar, int index)\n {\n char extra;\n if (index!=0)\n {\n extra=ar.get(index-1);\n ar.set(index-1,ar.get(index));\n ar.set(index,extra);\n }\n }\n }\n\n\n", "lang": "Java 7", "bug_code_uid": "a9a76aa28a97e2e032a7eb4d57945533", "src_uid": "e56f6c343167745821f0b18dcf0d0cde", "apr_id": "5f93bb45fe25f239262aa635c7cecf8e", "difficulty": 1400, "tags": ["greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5213628988642509, "equal_cnt": 31, "replace_cnt": 26, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 30, "bug_source_code": "import java.io.*;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n static int n, f[];\n static String s;\n static long ans, dp[][];\n\n\n public static void main(String[] args) {\n InputReader cin = new InputReader(System.in);\n n = cin.nextInt();\n s = cin.next();\n f = new int[s.length() + 1];\n ans = 0;\n\n // build failure function F[i] = index of largest prefix/suffix with end < i = where to look if i doesn't match\n f[0] = -1;\n f[1] = 0;\n for(int i = 2; i <= s.length(); i++) {\n f[i] = f[i-1];\n while(f[i] != -1 && s.charAt(i-1) != s.charAt(f[i])) f[i] = f[f[i]];\n ++f[i]; // ++ because this is on the scale of i-2 and not i-1\n }\n\n for(int suff_len = 0; suff_len < s.length(); suff_len++) {\n\n // calculate initial next state\n int pref = 0;\n for(int i = s.length() - suff_len; i < s.length(); i++) {\n while(pref != -1 && s.charAt(i) != s.charAt(pref)) pref = f[pref];\n ++pref;\n }\n\n dp = new long[n + 1][s.length() + 1]; // dp[i][index to look for i+1]\n\n // base case\n dp[suff_len][pref + 1] = 1;\n int tmp = pref;\n char val = s.charAt(pref) == '0' ? '1' : '0';\n while(tmp != -1 && s.charAt(tmp) != val) tmp = f[tmp];\n dp[suff_len][tmp + 1] = 1;\n\n for(int i = suff_len; i < n - 1; i++) {\n for(int state = 0; state < s.length(); state++) {\n dp[i + 1][state + 1] += dp[i][state];\n tmp = state;\n val = s.charAt(state) == '0' ? '1' : '0';\n while(tmp != -1 && s.charAt(tmp) != val) tmp = f[tmp];\n dp[i + 1][tmp + 1] += dp[i][state];\n }\n dp[i + 1][s.length()] += dp[i][s.length()] << 1;\n }\n ans += dp[n - 1][s.length() - suff_len];\n }\n System.out.println(ans);\n }\n\n static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "053c2d418b3f65537382a9505627ee19", "src_uid": "0034806908c9794086736a2d07fc654c", "apr_id": "5f20b1e4d6487095f5114cb1ecb08bed", "difficulty": 2900, "tags": ["dp", "strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.31001890359168244, "equal_cnt": 31, "replace_cnt": 22, "delete_cnt": 5, "insert_cnt": 3, "fix_ops_cnt": 30, "bug_source_code": "import java.util.List;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\nimport java.util.ArrayList;\nimport java.util.Comparator;\nimport java.io.BufferedReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\nimport java.math.BigInteger;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n * @author AlexFetisov\n */\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tInputReader in = new InputReader(inputStream);\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\tTaskD solver = new TaskD();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass TaskD {\n private static final int MOD = 777777777;\n static final int[][] C = IntegerUtils.getC(1000, MOD);\n\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n int k = in.nextInt();\n out.println(calcDP(n, k));\n }\n\n int calcDP(int n, int k) {\n long[][][] dp = new long[n + 1][n + 1][n + 1];\n for (int i = 0; i <= n; ++i) {\n if (i == 1) {\n dp[1][i][0] = C[n][i];\n } else {\n dp[1][i][i] = C[n][i];\n }\n }\n for (int i = 1; i < n; ++i) {\n for (int j = 0; j <= n; ++j) {\n for (int p = 0; p <= k; ++p) {\n if (dp[i][j][p] != 0) {\n int rest = n - j;\n for (int am = 0; am <= rest; ++am) {\n if (am == i + 1) {\n dp[i+1][j + am][p] += dp[i][j][p] * C[rest][am];\n dp[i + 1][j + am][p] %= MOD;\n } else {\n if (p + am <= k) {\n dp[i + 1][j + am][p + am] += dp[i][j][p] * C[rest][am];\n dp[i + 1][j + am][p + am] %= MOD;\n }\n }\n }\n }\n }\n }\n }\n return (int)dp[n][n][k];\n }\n}\n\nclass IntegerUtils {\n\n public static int[][] getC(int N, int MOD) {\n int[][] C = new int[N][];\n for (int i = 0; i < N; ++i) {\n C[i] = new int[i + 1];\n for (int j = 0; j <= i; ++j) {\n if (j == 0 || j == i) {\n C[i][j] = 1;\n if (C[i][j] >= MOD) C[i][j] -= MOD;\n } else {\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 }\n return C;\n }\n\n}\n\nclass InputReader {\n private BufferedReader reader;\n private StringTokenizer stt;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream));\n }\n\n public String nextLine() {\n try {\n return reader.readLine();\n } catch (IOException e) {\n return null;\n }\n }\n\n public String nextString() {\n while (stt == null || !stt.hasMoreTokens()) {\n stt = new StringTokenizer(nextLine());\n }\n return stt.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(nextString());\n }\n\n}\n\n", "lang": "Java 8", "bug_code_uid": "05ff04f9fe50590f93ef6f08246f3c2d", "src_uid": "cfe19131644e5925e32084a581e23286", "apr_id": "2313469675e4b934fd2b590d2ef22af4", "difficulty": 2700, "tags": ["dp"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.996628266366957, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.List;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\nimport java.util.ArrayList;\nimport java.util.Comparator;\nimport java.io.BufferedReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\nimport java.math.BigInteger;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n * @author AlexFetisov\n */\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tInputReader in = new InputReader(inputStream);\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\tTaskD solver = new TaskD();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass TaskD {\n\n static int[][] precalc = new int[][]{{0},{2,1},{32,30,80,109},{6824,59808,147224,415870,1757896,1897056,4898872,7593125},{776830421,290516100,746623577,293783147,33900006,735127505,565460332,428982705,472062098,161873957,117354594,515619293,578944191,312106242,569389279,391464593},{261086313,584837659,683961846,468868529,211593382,736955478,229471758,157617135,398169441,360252438,629394768,264125799,647490480,342079395,391579767,225200475,486011304,513156108,628771752,132906648,142138221,20119449,444199674,195188679,387329805,44684703,651912135,737154512,612549793,519860281,186175544,212568440},{240805271,239509872,581127897,6511239,156126222,509425833,672407328,366667722,459185405,509737025,554790222,165216555,703150560,74806569,398730015,383350905,506108358,51326142,298053147,104256117,391428765,374020479,206607807,87664059,275899176,56407680,551553401,448939463,582889860,129676638,226078251,135769095,61292868,578972226,190181628,390739055,184587732,446575689,732674124,232198470,676760679,352474101,611444862,575661807,628905585,320813094,522840969,469781928,156006018,554473341,239654268,643714911,433540170,199307003,496385218,291740751,67309914,370826673,202356819,279421821,421203111,63744786,520987612,550671827},{482164403,768209115,462063756,154906374,36099042,341766705,678182556,621882744,478771358,231881111,175889805,243630450,168908523,671961765,55761813,652682670,773939082,517628076,756201264,124604900,750976272,498253248,676047609,137170026,705610017,495032139,561797418,703097347,500815609,95984586,739707108,265613565,387099846,777331779,594676173,591219559,407997044,208947235,93337440,478908360,685013007,487033953,671903001,39521181,738490312,33785059,465470131,310453920,54648783,346831137,427694175,474743430,705296781,435828036,429824745,663532359,261388683,244690731,533997135,596108961,506813013,371892402,590145264,104733162,143420103,654339672,700348950,685038942,578826927,286484229,501639192,434962491,299270097,27702486,335375775,111746817,565603164,294926121,676063665,735862995,710035809,437011960,668528077,138765186,508213986,615036450,353784942,624827616,343900011,241289776,52410890,72018835,352406796,415705878,4802637,376367145,65589678,333633477,341834527,303717460,282387700,42951006,254706039,423048528,526429710,68131467,669954708,12787348,500636381,317959019,479433192,657133515,416259390,610216692,340129188,44594256,257373347,138718678,530767740,292922628,37220268,605295159,480722613,458170419,30540300,487159055,232966794,149150650},{412133651,386543325,139952108,289303402,102404925,317067177,396414708,80515854,663739304,317300809,228877044,493725043,715317967,490300965,315527373,743539734,488329191,553627998,533025234,242583957,706116537,614109258,645447222,523195911,492109128,722623041,111085128,766395126,654378921,691964847,496688157,399056049,654363234,102052314,191720088,473910948,259736526,332840025,388047555,665791056,627111387,139696515,441456687,443032569,283264821,771641703,452641455,511306362,117572859,127701891,721298331,176520078,357242229,611296308,696994956,405628839,429224274,465336054,695091546,689828796,574648641,351220905,507964023,675326610,517248963,453528621,220301928,494463186,681789969,339589656,44524053,417125457,339589404,747135963,341780733,734158215,396817281,21997836,5728464,147611205,456248898,714128667,377654949,3862068,128418948,589390074,304947090,11703825,228266073,127304142,429215724,361541124,521572968,468358191,341231688,65323503,613778508,15985323,291661029,410970006,591638112,349541550,89967528,224922159,361094166,584206074,640051812,324264456,652625388,693768537,11740617,309238398,211085469,194905872,639416484,110110707,296645895,748118511,131177718,511142751,775975599,421403409,475528473,434685258,1768977,80301375,708023862,569195676,56238084,632887668,88089750,631539342,396695565,38780154,695798271,469819224,439587099,69045921,682966116,112310856,64943298,534475872,40215357,389728458,286368453,736006257,501181650,54829908,603489402,338032656,512182818,627500097,462674016,3103092,157324491,43978329,596818971,259025598,9088632,91991781,577291428,211245489,429471231,142626330,172560633,510907446,444609585,758102058,375112647,744786693,276174402,19259856,233672418,745389414,225772848,23385663,324290610,519804558,120337812,402578568,360676008,450089262,551043738,337388940,512108856,28879011,690040638,106017282,558262341,99972432,608226003,612152037,42414435,776201013,39580443,518796945,494437752,583194366,723936555,415359657,309569589,751104774,166684527,249229170,353120823,130668327,753823584,580966092,561963717,543672234,393846327,586278000,327398400,278403867,156455586,363920382,190245195,290039148,547014447,466218648,146037150,585462906,666008595,691786683,374707494,622498779,231158277,685740951,115612245,681825249,545555745,551718468,277206615,640171035,757727334,195193908,658656684,457760646,225925875,505761984,18685233,506832921,112511021,396846646,290147622,113924623,669986155,336008070,63611061,238586775,119956662,616557739,772784623,334527774,410403148,51933421}};\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n// out.print(\"{\");\n// for (int i = 1; i <= (1 << 8); i *= 2) {\n// System.err.println(i);\n// out.print(\"{\");\n// calcDP(i);\n// for (int j = 1; j <= i; ++j) {\n// out.print(dp[i][i][j]);\n// if (j == i) {\n// out.print(\"},\");\n// } else {\n// out.print(\",\");\n// }\n// }\n// }\n// out.print(\"}\");\n int n = in.nextInt();\n int k = in.nextInt();\n out.println(precalc[n-1][k-1]);\n }\n\n}\n\nclass InputReader {\n private BufferedReader reader;\n private StringTokenizer stt;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream));\n }\n\n public String nextLine() {\n try {\n return reader.readLine();\n } catch (IOException e) {\n return null;\n }\n }\n\n public String nextString() {\n while (stt == null || !stt.hasMoreTokens()) {\n stt = new StringTokenizer(nextLine());\n }\n return stt.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(nextString());\n }\n\n}\n\n", "lang": "Java 8", "bug_code_uid": "f8556542b146a33d87aeca118499c52d", "src_uid": "cfe19131644e5925e32084a581e23286", "apr_id": "2313469675e4b934fd2b590d2ef22af4", "difficulty": 2700, "tags": ["dp"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.32406671961874506, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "package day11;\nimport java.util.Scanner;\n\npublic class ShellGame {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint x = sc.nextInt();\n\t\tsc.close();\n\t\tint mod =6 - n%6;\n\t\tif(x == 0){\n\t\t\tif(mod == 5|| mod == 6){\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn ;\n\t\t\t}\n\t\t\tif(mod == 1|| mod == 4){\n\t\t\t\tSystem.out.println(1);\n\t\t\t\treturn ;\n\t\t\t}\n\t\t\tif(mod == 3|| mod == 2){\n\t\t\t\tSystem.out.println(2);\n\t\t\t\treturn ;\n\t\t\t}\n\t\t}\n\t\tif(x == 1){\n\t\t\tif(mod == 1|| mod == 2){\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn ;\n\t\t\t}\n\t\t\tif(mod == 3|| mod == 6){\n\t\t\t\tSystem.out.println(1);\n\t\t\t\treturn ;\n\t\t\t}\n\t\t\tif(mod == 4|| mod == 5){\n\t\t\t\tSystem.out.println(2);\n\t\t\t\treturn ;\n\t\t\t}\n\t\t}\n\t\tif(x == 2){\n\t\t\tif(mod == 3|| mod == 4){\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn ;\n\t\t\t}\n\t\t\tif(mod == 2|| mod == 5){\n\t\t\t\tSystem.out.println(1);\n\t\t\t\treturn ;\n\t\t\t}\n\t\t\tif(mod == 1|| mod == 6){\n\t\t\t\tSystem.out.println(2);\n\t\t\t\treturn ;\n\t\t\t}\n\t\t}\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "82c0873f6255a13ac4450e7b05fd280e", "src_uid": "7853e03d520cd71571a6079cdfc4c4b0", "apr_id": "7ff4d733a1e647bfbfb2075c047166b2", "difficulty": 1000, "tags": ["math", "constructive algorithms", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8246445497630331, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.math.*;\n \npublic class _400div2Q1\n{\n public static void main(String[] args) throws IOException\n {\n FastScanner obj = new FastScanner();\n out = new PrintWriter(new BufferedOutputStream(System.out));\n\t\t\n\t\tint n = obj.nextInt();\n\t\tint[] arr = new int[n];\n\t\tfor(int i=0;i= MOD) res -= MOD;\n } else {\n int A2 = BitUtils.checkBit(yy1, 0) ? amY1 : amY0;\n long cur = A1 * A2;\n cur = cur * B1 * B4;\n cur %= MOD;\n res += cur;\n if (res >= MOD) res -= MOD;\n }\n }\n }\n }\n }\n\n for (int dx = 0; dx <= n; ++dx) {\n for (int dy = 0; dy <= m; ++dy) {\n if (dx == 0 && dy == 0) continue;\n int amX = n - dx + 1;\n int amY = m - dy + 1;\n int amPoints = IntegerUtils.gcd(dx, dy);\n if (dx == 0 || dy == 0) {\n res -= (amPoints * 6L * amX * amY) % MOD;\n } else {\n res -= (amPoints * 12L * amX * amY) % MOD;\n }\n res += MOD;\n if (res >= MOD) {\n res -= MOD;\n }\n }\n }\n\n res -= (n + 1) * (m + 1);\n res += MOD;\n if (res >= MOD) {\n res -= MOD;\n }\n\n out.println(res);\n }\n\n private int odd(int x) {\n return BitUtils.checkBit(x, 0) ? 1 : 0;\n }\n\n private int getAm(boolean odd, int begin, int end) {\n if (BitUtils.checkBit(begin, 0) != odd) {\n ++begin;\n }\n if (BitUtils.checkBit(end, 0) != odd) {\n --end;\n }\n if (begin <= end) {\n return (end - begin) / 2 + 1;\n }\n return 0;\n }\n}\n\nclass InputReader {\n private BufferedReader reader;\n private StringTokenizer stt;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream));\n }\n\n public String nextLine() {\n try {\n return reader.readLine();\n } catch (IOException e) {\n return null;\n }\n }\n\n public String nextString() {\n while (stt == null || !stt.hasMoreTokens()) {\n stt = new StringTokenizer(nextLine());\n }\n return stt.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(nextString());\n }\n\n}\n\nclass BitUtils {\n public static boolean checkBit(int mask, int bit) {\n return (mask & (1 << bit)) > 0;\n }\n\n}\n\nclass IntegerUtils {\n\n public static int gcd(int x, int y) {\n return y == 0 ? x : gcd(y, x % y);\n }\n\n}\n\n", "lang": "Java 8", "bug_code_uid": "f510ccab9444ae6cf07344f7a4f1770b", "src_uid": "984788e4b4925c15c9c6f31e42f2f8fa", "apr_id": "59656d266c7bdbc4e184ee5d367088cc", "difficulty": 2500, "tags": ["geometry", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.5392679154493899, "equal_cnt": 66, "replace_cnt": 41, "delete_cnt": 14, "insert_cnt": 10, "fix_ops_cnt": 65, "bug_source_code": "import java.util.List;\nimport java.io.InputStreamReader;\nimport java.io.IOException;\nimport java.util.Arrays;\nimport java.util.Locale;\nimport java.util.ArrayList;\nimport java.util.Comparator;\nimport java.io.BufferedReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\nimport java.math.BigInteger;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n * @author AlexFetisov\n */\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tLocale.setDefault(Locale.US);\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tInputReader in = new InputReader(inputStream);\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\tTaskD_LittleElAndTriangle solver = new TaskD_LittleElAndTriangle();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass TaskD_LittleElAndTriangle {\n public static final int MOD = (int) 1e9 + 7;\n\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n int m = in.nextInt();\n\n int res = 0;\n for (int x = 0; x <= n; ++x) {\n for (int y = 0; y <= m; ++y) {\n for (int d = 0; d < (1 << 3); ++d) {\n int x1 = BitUtils.checkBit(d, 0) ? 1 : 0;\n int y1 = BitUtils.checkBit(d, 1) ? 1 : 0;\n int x2 = BitUtils.checkBit(d, 2) ? 1 : 0;\n //int y2 = BitUtils.checkBit(d, 3) ? 1 : 0;\n\n x1 = odd(x1 - x);\n y1 = odd(y1 - y);\n x2 = odd(x2 - x);\n //y2 = odd(y2 - y);\n if (x2 * y1 == 0) {\n if (x1 == 1) {\n // y2 == 0 => y2 == y\n long cur = getAm(BitUtils.checkBit(d, 0), 0, n);\n cur *= getAm(BitUtils.checkBit(d, 1), 0, m);\n cur *= getAm(BitUtils.checkBit(d, 2), 0, n);\n cur *= getAm(BitUtils.checkBit(y, 0), 0, m);\n cur %= MOD;\n res += cur;\n if (res >= MOD) {\n res -= MOD;\n }\n } else {\n long cur = getAm(BitUtils.checkBit(d, 0), 0, n);\n cur *= getAm(BitUtils.checkBit(d, 1), 0, m);\n cur *= getAm(BitUtils.checkBit(d, 2), 0, n);\n cur %= MOD;\n cur *= (m + 1);\n cur %= MOD;\n res += cur;\n if (res >= MOD) {\n res -= MOD;\n }\n }\n } else {\n if (x1 == 1) {\n // y2 == 1 => y2 != y\n long cur = getAm(BitUtils.checkBit(d, 0), 0, n);\n cur *= getAm(BitUtils.checkBit(d, 1), 0, m);\n cur *= getAm(BitUtils.checkBit(d, 2), 0, n);\n cur *= getAm(BitUtils.checkBit((1 - y), 0), 0, m);\n cur %= MOD;\n res += cur;\n if (res >= MOD) {\n res -= MOD;\n }\n }\n }\n// if (odd(x1 * y2 - x2 * y1) == 0) {\n// long cur = getAm(BitUtils.checkBit(d, 0), 0, n);\n// cur *= getAm(BitUtils.checkBit(d, 1), 0, m);\n// cur *= getAm(BitUtils.checkBit(d, 2), 0, n);\n// cur *= getAm(BitUtils.checkBit(d, 3), 0, m);\n// cur %= MOD;\n// res += cur;\n// if (res >= MOD) {\n// res -= MOD;\n// }\n// }\n }\n// res %= MOD;\n\n int amX = n - x + 1;\n int amY = m - y + 1;\n int amPoints = IntegerUtils.gcd(x, y) + 1;\n --amPoints;\n --amPoints;\n if (amPoints > 0) {\n if (x == 0 || y == 0) {\n res -= (amPoints * 6 * amX * amY) % MOD;\n } else {\n res -= (amPoints * 12 * amX * amY) % MOD;\n }\n res += MOD;\n if (res >= MOD) {\n res -= MOD;\n }\n }\n\n if (x == 0 && y == 0) continue;\n if (x == 0 || y == 0) {\n res -= (6 * amX * amY);\n } else {\n res -= (12 * amX * amY);\n }\n res += MOD;\n if (res >= MOD) {\n res -= MOD;\n }\n }\n }\n\n res -= (n + 1) * (m + 1);\n res += MOD;\n if (res >= MOD) {\n res -= MOD;\n }\n\n out.println(res);\n }\n\n private int odd(int x) {\n if (x < 0) {\n x = -x;\n }\n return BitUtils.checkBit(x, 0) ? 1 : 0;\n }\n\n private long getAm(boolean odd, int begin, int end) {\n if (BitUtils.checkBit(begin, 0) != odd) {\n ++begin;\n }\n if (BitUtils.checkBit(end, 0) != odd) {\n --end;\n }\n if (begin <= end) {\n return ((end - begin) >> 1) + 1;\n }\n return 0;\n }\n}\n\nclass InputReader {\n private BufferedReader reader;\n private StringTokenizer stt;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream));\n }\n\n public String nextLine() {\n try {\n return reader.readLine();\n } catch (IOException e) {\n return null;\n }\n }\n\n public String nextString() {\n while (stt == null || !stt.hasMoreTokens()) {\n stt = new StringTokenizer(nextLine());\n }\n return stt.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(nextString());\n }\n\n}\n\nclass BitUtils {\n public static boolean checkBit(int mask, int bit) {\n return (mask & (1 << bit)) > 0;\n }\n\n}\n\nclass IntegerUtils {\n\n public static int gcd(int x, int y) {\n return y == 0 ? x : gcd(y, x % y);\n }\n\n}\n\n", "lang": "Java 8", "bug_code_uid": "721c0feb76c234bed67657d15a9b15ce", "src_uid": "984788e4b4925c15c9c6f31e42f2f8fa", "apr_id": "59656d266c7bdbc4e184ee5d367088cc", "difficulty": 2500, "tags": ["geometry", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.22404595814526057, "equal_cnt": 23, "replace_cnt": 12, "delete_cnt": 6, "insert_cnt": 6, "fix_ops_cnt": 24, "bug_source_code": "public class NewYearandOldPropertyB {\n\tprivate static final int MAX_ARRAY_SIZE = Integer.MAX_VALUE - 8;\n\tpublic static void main(String[] args) {\n\t\t\n\t\tScanner key = new Scanner(System.in);\n\t\tLong start = key.nextLong();\n\t\tLong stop = key.nextLong();\n\t\tint count=0,f=0,say=0;\n\t\t\n\t\tfor(Long i=start;i<=stop;i++){\n\t\t\tString detect = Long.toBinaryString(i);\n\t\t\tif(detect.contains(\"0\")){\n\t\t\t\tif(detect.substring(detect.indexOf(\"0\")+1).contains(\"0\")){\n\t\t\t\t\tcount=5;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tcount++;\n\t\t\t}\n\t\t\tif(count==1)\n\t\t\t\tsay++;\n\t\t\tcount=0;\n\t\t}\n\t\tSystem.out.println(say);\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "1eea484126dbe112d31c1734e2f00897", "src_uid": "581f61b1f50313bf4c75833cefd4d022", "apr_id": "669031330eeff296bad2c20e5e6b6223", "difficulty": 1300, "tags": ["bitmasks", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9999205213797489, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedOutputStream;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.*;\n\n// NEW WAY here, OLD WAY down below\n\npublic class B {\n \n // 40 lines of main for this specific exercise\n // ..using general purpose library \"Binary\"\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n long a = scanner.nextLong();\n long b = scanner.nextLong();\n Binary bin = new Binary(Long.toBinaryString(a));\n Binary goal = new Binary(Long.toBinaryString(b));\n \n // If too many zeroes, block out least remarkable ones\n int zeroCount = 0;\n for (int i=bin.length-1; i>=0; i--) {\n if (bin.get(i) == '0') zeroCount++;\n }\n for (int i=bin.length-1; i>=0 && zeroCount > 1; i--) {\n if (bin.get(i) != '0') continue;\n bin.set(i, '1');\n zeroCount--;\n }\n // If not enough\n if (zeroCount == 0) {\n bin.addFirst('1');\n bin.set(1, '0');\n }\n \n // Jump through and count binaries with one '0'\n int count = 0;\n int i = 1;\n while (bin.compareTo(goal) <= 0) {\n count++;\n while (bin.get(i) != '0') {\n i++;\n }\n \n // Modify bin to get next binary with one '0'\n bin.set(i, '1');\n i++;\n if (i >= bin.length) {\n bin.addFirst('1');\n i = 1;\n }\n bin.set(i, '0');\n }\n System.out.println(count);\n scanner.close();\n }\n \n public static void mainExample(String[] args) {\n Long n = 9891372933152L;\n String binaryString = Long.toBinaryString(n);\n Binary b = new Binary(binaryString);\n }\n \n}\n\n\n/**\n * When manipulating small binary strings, instantiate new Binary(string)\n * When just reading large binary strings, instantiate new Binary(string,true).\n */\nclass Binary implements Comparable {\n private boolean[] d;\n private int first; // Starting from left, the first (most remarkable) '1'\n public int length;\n\n \n public Binary(String binaryString) {\n this(binaryString, false);\n }\n public Binary(String binaryString, boolean limitSize) {\n length = binaryString.length();\n int size = Math.max(2*length, 1);\n first = length/4;\n if (limitSize) {\n first = 0;\n size = Math.max(length, 1);\n }\n d = new boolean[size];\n for (int i=0; i= d.length) doubleArraySize();\n d[first+length] = (c == '1' ? true : false);\n length++;\n }\n \n private void doubleArraySize() {\n boolean[] bigArray = new boolean[(d.length+1) * 2];\n int newFirst = bigArray.length / 4;\n for (int i=0; ileft to increase value as little as possible\n int zerosInBin = countZeros(bin);\n for (int i=bin.length()-1; zerosInBin>1; i--) {\n if (bin.charAt(i) == '0') {\n zerosInBin--;\n StringBuilder newBin = new StringBuilder();\n if (i>0) newBin.append(bin.substring(0,i));\n newBin.append('1');\n if (i 1011\n if (zerosInBin == 0) {\n String possibleAddition = \"\";\n if (bin.length() > 1) possibleAddition = bin.substring(1,bin.length());\n if (goal.length() < bin.length()+1) return 0;\n if (goal.length() == bin.length()+1 && !stringIsBelowOrAtGoal(1, goal)) {\n Long parsed = Long.parseLong(\"10\" + possibleAddition, 2);\n if (parsed > b) {\n //System.out.println(\"parsed: \" + parsed);\n return 0;\n }\n else {\n long count = 0;\n if (goal.contains(\"0\")) count++;\n if (b != parsed) count++;\n return count;\n }\n }\n bin = \"10\" + possibleAddition;\n } \n // Find initial zero\n int i=0;\n for ( ;i= b) return count;\n \n int len = bin.length();\n bin = \"\";\n \n for (int j=0; j<=i; j++) {\n bin += '1';\n }\n if (bin.length() < len) {\n bin += '0';\n }\n for (int j=i+2; j 10111\n int specRep = bin.length()+1;\n boolean doneSomethingHere = false;\n while (specRep <= goal.length() + 1) {\n if (specRep == goal.length()+1) {\n // We possibly counted too many\n // Subtract the ones that went over\n if (!doneSomethingHere) return count;\n while (specRep > goal.length()) specRep--;\n for (i=specRep-1; i>=1; i--) {\n if (stringIsBelowOrAtGoal(i, goal)) break;\n count--;\n }\n return count;\n }\n doneSomethingHere = true;\n count += (specRep-1); // bc cant replace first '1' with '0'\n specRep++;\n }\n\n return count;\n }\n \n public static boolean stringIsBelowOrAtGoal(int a, String b) {\n // a represents a string that has same length as b\n // with all characters '1' except for a single '0' in index a\n for (int i=1; i= '0' && buf[bufi] <= '9') {\n\t\t\t\t\tif(ret < -214748364) throw new RuntimeException(\"IO.nextInt: Invalid int.\");\n\t\t\t\t\tret *= 10;\n\t\t\t\t\tret -= (int)(buf[bufi] - '0');\n\t\t\t\t\tif(ret > 0) throw new RuntimeException(\"IO.nextInt: Invalid int.\");\n\t\t\t\t} else {\n\t\t\t\t\tthrow new RuntimeException(\"IO.nextInt: Invalid int.\");\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t++bufi;\n\t\t\t}\n\t\t\t\n\t\t\tif(positive) {\n\t\t\t\tif(ret == -2147483648) throw new RuntimeException(\"IO.nextInt: Invalid int.\");\n\t\t\t\tret = -ret;\n\t\t\t}\n\t\t\t\n\t\t\treturn ret;\n\t\t} catch(IOException e) {\n\t\t\tthrow new RuntimeException(\"IO.nextInt: Caught IOException.\");\n\t\t}\n\t}\n\t\n\tpublic long nextLong() {\n\t\ttry {\n\t\t\tlong ret = 0;\n\t\t\t\n\t\t\teatDelimiters();\n\t\t\t\n\t\t\tboolean positive = true;\n\t\t\tif(buf[bufi] == '-') {\n\t\t\t\t++bufi;\n\t\t\t\tif(!pumpBuf()) throw new RuntimeException(\"IO.nextLong: Invalid long.\");\n\t\t\t\tpositive = false;\n\t\t\t}\n\t\t\t\n\t\t\tboolean first = true;\n\t\t\twhile(true) {\n\t\t\t\tif(!pumpBuf()) break;\n\t\t\t\tif(isDelimiter(buf[bufi])) {\n\t\t\t\t\tif(first) throw new RuntimeException(\"IO.nextLong: Invalid long.\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tfirst = false;\n\t\t\t\t\n\t\t\t\tif(buf[bufi] >= '0' && buf[bufi] <= '9') {\n\t\t\t\t\tif(ret < -922337203685477580L) throw new RuntimeException(\"IO.nextLong: Invalid long.\");\n\t\t\t\t\tret *= 10;\n\t\t\t\t\tret -= (long)(buf[bufi] - '0');\n\t\t\t\t\tif(ret > 0) throw new RuntimeException(\"IO.nextLong: Invalid long.\");\n\t\t\t\t} else {\n\t\t\t\t\tthrow new RuntimeException(\"IO.nextLong: Invalid long.\");\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t++bufi;\n\t\t\t}\n\t\t\t\n\t\t\tif(positive) {\n\t\t\t\tif(ret == -9223372036854775808L) throw new RuntimeException(\"IO.nextLong: Invalid long.\");\n\t\t\t\tret = -ret;\n\t\t\t}\n\t\t\t\n\t\t\treturn ret;\n\t\t} catch(IOException e) {\n\t\t\tthrow new RuntimeException(\"IO.nextLong: Caught IOException.\");\n\t\t}\n\t}\n\t\n\tpublic double nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}\n\n }\n}\n\n/*", "lang": "Java 8", "bug_code_uid": "64eb198174cb52a997b09ad6e74adc38", "src_uid": "581f61b1f50313bf4c75833cefd4d022", "apr_id": "20aef17bfbf10fd7a133342bf9c91453", "difficulty": 1300, "tags": ["bitmasks", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9998148491020181, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;import java.io.*;import java.math.*;\npublic class Main\n{\n public static void process()throws IOException\n {\n int n=ni();\n if(n%2==0)\n {\n pn(\"white\");\n pn(\"1 2\");\n }\n else pn(\"black\");\n }\n\n static AnotherReader sc;\n static PrintWriter out;\n public static void main(String[]args)throws IOException\n {\n boolean oj = System.getProperty(\"ONLINE_JUDGE\") != null;\n if(oj){sc=new AnotherReader();out=new PrintWriter(System.out);}\n else{sc=new AnotherReader(100);out=new PrintWriter(\"output.txt\");}\n int t=1;\n // t=ni();\n while(t-->0) {process();}\n out.flush();out.close(); \n }\n\n static void pn(Object o){out.println(o);}\n static void p(Object o){out.print(o);}\n static void pni(Object o){out.println(o);out.flush();}\n static int ni()throws IOException{return sc.nextInt();}\n static long nl()throws IOException{return sc.nextLong();}\n static double nd()throws IOException{return sc.nextDouble();}\n static String nln()throws IOException{return sc.nextLine();}\n static int[] nai(int N)throws IOException{int[]A=new int[N];for(int i=0;i!=N;i++){A[i]=ni();}return A;}\n static long[] nal(int N)throws IOException{long[]A=new long[N];for(int i=0;i!=N;i++){A[i]=nl();}return A;}\n static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}\n static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}\n static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}\n\n/////////////////////////////////////////////////////////////////////////////////////////////////////////\n\n static class AnotherReader{BufferedReader br; StringTokenizer st;\n AnotherReader()throws FileNotFoundException{\n br=new BufferedReader(new InputStreamReader(System.in));}\n AnotherReader(int a)throws FileNotFoundException{\n br = new BufferedReader(new FileReader(\"input.txt\"));}\n String next()throws IOException{\n while (st == null || !st.hasMoreElements()) {try{\n st = new StringTokenizer(br.readLine());}\n catch (IOException e){ e.printStackTrace(); }}\n return st.nextToken(); } int nextInt() throws IOException{\n return Integer.parseInt(next());}\n long nextLong() throws IOException\n {return Long.parseLong(next());}\n double nextDouble()throws IOException { return Double.parseDouble(next()); }\n String nextLine() throws IOException{ String str = \"\"; try{\n str = br.readLine();} catch (IOException e){\n e.printStackTrace();} return str;}}\n \n/////////////////////////////////////////////////////////////////////////////////////////////////////////////\n}v", "lang": "Java 8", "bug_code_uid": "d7857411e544fd026b9de2bd078189b4", "src_uid": "52e07d176aa1d370788f94ee2e61df93", "apr_id": "019654d26c48c07e16277f31c05a6e03", "difficulty": 1700, "tags": ["math", "games", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9745762711864406, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "package all1500;\n\nimport java.util.Scanner;\n\npublic class Asdf \n{\n\tstatic Scanner sc = new Scanner(System.in);\n\tstatic int n;\n\n\n\tpublic static void main(String[] args) \n\t{\n\t\tn = sc.nextInt();\n\t\tint m = n%2;\n\t\tif(m < 0)m+=2;\n\t\t\n\t\tif(m == 1)\n\t\t{\n\t\t\tSystem.out.println(\"black\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tSystem.out.println(\"white\");\n\t\t\tSystem.out.println(\"1 2\");\n\t\t}\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "0dd77b35ade5d6de65683115ea28cded", "src_uid": "52e07d176aa1d370788f94ee2e61df93", "apr_id": "be2ec418247e431716f9654af30c7112", "difficulty": 1700, "tags": ["math", "games", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9688888888888889, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "public class ComProgSetUp {\n\n\tpublic static int getNumber(String fN) {\n\t\tint res=0;\n\t\tint n = fN.length();\n\t\tfor(int i=1; i adjList[];\n static int cand;\n\n public static void main(String[] args) throws IOException {\n Scanner sc = new Scanner();\n PrintWriter out = new PrintWriter(System.out);\n int n = sc.nextInt(), m = sc.nextInt();\n if (n != 7) out.println(m);\n else {\n adjList = new ArrayList[n];\n for (int i = 0; i < n; i++)\n adjList[i] = new ArrayList<>();\n while (m-- > 0) {\n int a = sc.nextInt() - 1, b = sc.nextInt() - 1;\n adjList[a].add(b);\n adjList[b].add(a);\n }\n deg = new int[n];\n int ans = 0;\n for (int i = 0; i < n - 1; i++)\n deg[i] = i;\n for (int d = 0; d < n - 1; d++) {\n deg[n - 1] = d;\n vis = new boolean[n];\n taken = new boolean[n][n];\n cand = 0;\n for (int i = 0; i < n; i++)\n if (!vis[i]) {\n dfs(i);\n }\n ans = Math.max(ans, cand);\n }\n out.println(ans);\n }\n out.flush();\n }\n\n static void dfs(int u) {\n vis[u] = true;\n for (int v : adjList[u]) {\n if (!taken[deg[u]][deg[v]]) {\n taken[deg[u]][deg[v]] = true;\n taken[deg[v]][deg[u]] = true;\n cand++;\n }\n if (!vis[v]) dfs(v);\n }\n }\n\n\n static class Scanner {\n BufferedReader br;\n StringTokenizer st;\n\n Scanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n\n }\n\n String nextLine() throws IOException {\n return br.readLine();\n }\n\n long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n\n int[] nextIntArray(int n) throws IOException {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = nextInt();\n return ans;\n }\n\n String next() throws IOException {\n while (st == null || !st.hasMoreTokens())\n st = new StringTokenizer(br.readLine());\n return st.nextToken();\n }\n\n int nextInt() throws NumberFormatException, IOException {\n return Integer.parseInt(next());\n }\n\n boolean isReady() throws IOException {\n return br.ready();\n }\n\n }\n\n}", "lang": "Java 8", "bug_code_uid": "fc1c9c130f33cee027cb0a8c74a7980a", "src_uid": "11e6559cfb71b8f6ca88242094b17a2b", "apr_id": "4b82859d5a4b3515393418c416d51d4b", "difficulty": 1700, "tags": ["graphs", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.3224866440019427, "equal_cnt": 13, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 13, "bug_source_code": "import java.util.*;\n\n\npublic class bucky{\n\n\n\n\npublic static void main (String args[]) {\n\nScanner input=new Scanner(System.in);\n\nHashMap map= new HashMap();\nHashMap map2= new HashMap();\n\n\t\n\t\n\t\n\t\n\t\tint n=input.nextInt();\n\t\t\n\t\tString nums[]=new String[100001];\n\t\t\n\t\tnums[1]=\"1\";\n\t\tnums[2]=\"2\";\n\t\t\n\t\t\n\t\t\n\t\t\n\t\tfor(int i=3;i<=10;i++){\n\t\t \n\t\t \n\t\t\n\t\tString intrare=nums[i-1]+\"1\";\n\t\t\n\t//\tSystem.out.println(intrare);\n\t\t\n\t\tnums[i]=functie(intrare);\n\t\t\n\t\t\n\t\t\n\t//\tSystem.out.println(i+\" \"+nums[i]);\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t}\n\t\t\n\t\tfor(int i=0;i g = new TreeMap();\n g.put(1, 0);\n g.put(3, 1);\n for (int d = 3; d < p - 1; ) {\n int a = d / 3;\n int b = d - d / 3;\n Integer na = g.higherKey(a);\n Integer nb = g.higherKey(b);\n if (na == null || nb == null) {\n throw new AssertionError();\n }\n long z1 = na * 3L;\n long z2 = 3L * nb / 2;\n while (z2 - z2 / 3 >= nb) {\n z2--;\n }\n while (z2 - z2 / 3 < nb) {\n ++z2;\n }\n long z = Math.min(z1, z2);\n if (z > p - 1) {\n break;\n }\n int zi = (int) z;\n int ga = g.get(g.floorKey(zi / 3));\n int gb = g.get(g.floorKey(zi - zi / 3));\n int ng = -1;\n for (int j = 0; j < 3; j++) {\n if (j == ga || j == gb) {\n continue;\n }\n ng = j;\n break;\n }\n g.put(zi, ng);\n d = zi;\n }\n long[] count = new long[3];\n for (int i : g.keySet()) {\n Integer ni = g.higherKey(i);\n if (ni == null) {\n ni = p;\n }\n int first = p - i;\n int second = p - ni;\n count[g.get(i)] += s(second + 1, first + 1);\n }\n for (int i = 0; i < 3; i++) {\n count[i] %= MOD;\n }\n int[][] dp = new int[n + 1][4];\n dp[0][0] = 1;\n for (int i = 1; i <= n; i++) {\n for (int x = 0; x < 3; x++) {\n for (int y = 0; y < 4; y++) {\n dp[i][x ^ y] = (int) ((dp[i][x ^ y] + (long) dp[i - 1][y] * count[x]) % MOD);\n }\n }\n }\n long ans = 0L + dp[n][1] + dp[n][2] + dp[n][3];\n out.println(ans % MOD);\n }\n\n static long s(int a, int b) {\n if (a >= b) {\n return 0;\n }\n --b;\n --a;\n long ret = ss(b) - ss(a);\n return ret;\n }\n\n static long ss(int n) {\n return (long) n * (n + 1) / 2;\n }\n}\n\nclass FastScanner extends BufferedReader {\n\n boolean isEOF;\n\n public FastScanner(InputStream is) {\n super(new InputStreamReader(is));\n }\n\n public int read() {\n try {\n int ret = super.read();\n if (isEOF && ret < 0) {\n throw new InputMismatchException();\n }\n isEOF = ret == -1;\n return ret;\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n }\n\n static boolean isWhiteSpace(int c) {\n return c >= -1 && c <= 32;\n }\n\n public int nextInt() {\n int c = read();\n while (isWhiteSpace(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int ret = 0;\n while (!isWhiteSpace(c)) {\n if (c < '0' || c > '9') {\n throw new NumberFormatException(\"digit expected \" + (char) c\n + \" found\");\n }\n ret = ret * 10 + c - '0';\n c = read();\n }\n return ret * sgn;\n }\n\n }\n\nclass FastPrinter extends PrintWriter {\n\n public FastPrinter(OutputStream out) {\n super(out);\n }\n\n public FastPrinter(Writer out) {\n super(out);\n }\n\n\n}\n\n", "lang": "Java 7", "bug_code_uid": "bd72b0320378c964f455d64af6dc01a4", "src_uid": "c03b6379e9d186874ac3d97c6968fbd0", "apr_id": "e6eb086873d5fe67011098d6471c5c9f", "difficulty": 2600, "tags": ["dp", "games"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9779657244602715, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "import java.util.Map;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.InputMismatchException;\nimport java.util.TreeMap;\nimport java.util.Set;\nimport java.io.BufferedReader;\nimport java.io.OutputStream;\nimport java.util.NavigableMap;\nimport java.io.PrintWriter;\nimport java.io.Reader;\nimport java.io.Writer;\nimport java.util.SortedMap;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n * @author Niyaz Nigmatullin\n */\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tFastScanner in = new FastScanner(inputStream);\n\t\tFastPrinter out = new FastPrinter(outputStream);\n\t\tTaskE solver = new TaskE();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass TaskE {\n\n static final int MOD = 1000000007;\n\n public void solve(int testNumber, FastScanner in, FastPrinter out) {\n int n = in.nextInt();\n int p = in.nextInt();\n NavigableMap g = new TreeMap();\n g.put(1, 0);\n g.put(3, 1);\n for (int d = 3; d < p - 1; ) {\n int a = d / 3;\n int b = d - d / 3;\n Integer na = g.higherKey(a);\n Integer nb = g.higherKey(b);\n if (na == null || nb == null) {\n throw new AssertionError();\n }\n long z1 = na * 3L;\n long z2 = 3L * nb / 2;\n while (z2 - z2 / 3 >= nb) {\n z2--;\n }\n while (z2 - z2 / 3 < nb) {\n ++z2;\n }\n long z = Math.min(z1, z2);\n if (z > p - 1) {\n break;\n }\n int zi = (int) z;\n int ga = g.get(g.floorKey(zi / 3));\n int gb = g.get(g.floorKey(zi - zi / 3));\n int ng = -1;\n for (int j = 0; j < 3; j++) {\n if (j == ga || j == gb) {\n continue;\n }\n ng = j;\n break;\n }\n g.put(zi, ng);\n d = zi;\n }\n long[] count = new long[3];\n for (int i : g.keySet()) {\n Integer ni = g.higherKey(i);\n if (ni == null) {\n ni = p;\n }\n int first = p - i;\n int second = p - ni;\n count[g.get(i)] += s(second + 1, first + 1);\n }\n for (int i = 0; i < 3; i++) {\n count[i] %= MOD;\n }\n int[][] dp = new int[n + 1][4];\n dp[0][0] = 1;\n for (int i = 1; i <= n; i++) {\n for (int x = 0; x < 3; x++) {\n for (int y = 0; y < 4; y++) {\n dp[i][x ^ y] = (int) ((dp[i][x ^ y] + (long) dp[i - 1][y] * count[x]) % MOD);\n }\n }\n }\n long ans = 0L + dp[n][1] + dp[n][2] + dp[n][3];\n out.println(ans % MOD);\n }\n\n static long s(int a, int b) {\n if (a >= b) {\n return 0;\n }\n --b;\n --a;\n long ret = ss(b) - ss(a);\n return ret;\n }\n\n static long ss(int n) {\n return (long) n * (n + 1) / 2;\n }\n}\n\nclass FastScanner extends BufferedReader {\n\n boolean isEOF;\n\n public FastScanner(InputStream is) {\n super(new InputStreamReader(is));\n }\n\n public int read() {\n try {\n int ret = super.read();\n if (isEOF && ret < 0) {\n throw new InputMismatchException();\n }\n isEOF = ret == -1;\n return ret;\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n }\n\n static boolean isWhiteSpace(int c) {\n return c >= -1 && c <= 32;\n }\n\n public int nextInt() {\n int c = read();\n while (isWhiteSpace(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int ret = 0;\n while (!isWhiteSpace(c)) {\n if (c < '0' || c > '9') {\n throw new NumberFormatException(\"digit expected \" + (char) c\n + \" found\");\n }\n ret = ret * 10 + c - '0';\n c = read();\n }\n return ret * sgn;\n }\n\n }\n\nclass FastPrinter extends PrintWriter {\n\n public FastPrinter(OutputStream out) {\n super(out);\n }\n\n public FastPrinter(Writer out) {\n super(out);\n }\n\n\n}\n\n", "lang": "Java 7", "bug_code_uid": "86d8a4b8dd5c4b2020ceafa7b71388ef", "src_uid": "c03b6379e9d186874ac3d97c6968fbd0", "apr_id": "e6eb086873d5fe67011098d6471c5c9f", "difficulty": 2600, "tags": ["dp", "games"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7398858921161826, "equal_cnt": 25, "replace_cnt": 12, "delete_cnt": 4, "insert_cnt": 8, "fix_ops_cnt": 24, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\n\npublic class TaskC {\n\n private static long MOD = 1_000_000_000+7;\n\n public static void main(String[] arg) {\n final FastScanner in = new FastScanner(System.in);\n final PrintWriter out = new PrintWriter(System.out);\n final int n = in.nextInt();\n final int x = in.nextInt();\n final int pos = in.nextInt();\n out.println(solution(pos, n, x));\n out.close();\n in.close();\n }\n\n private static long solution(int pos,\n int len,\n int e){\n String path = bs(pos, len, e);\n //System.out.println(path);\n long permut = mod_fact(len-1-path.length());\n long traverse = traverse(e, 1, len, path.toCharArray(),0);\n return (permut*traverse)%MOD;\n }\n\n private static String bs(int pos, int len,\n int element){\n int left = 0;\n int right = len;\n int deep = 1;\n StringBuilder path = new StringBuilder();\n while(left=1;i--){\n result+=(i-1);\n }\n return result;\n }\n\n\n private static long mod_fact(int n){\n long result =1;\n for(int i=2;i<=n;i++){\n result*=i;\n result%=MOD;\n }\n return result;\n }\n\n private static class FastScanner {\n BufferedReader br;\n StringTokenizer st;\n\n FastScanner(InputStream stream) {\n try {\n br = new BufferedReader(new InputStreamReader(stream));\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n\n String next() {\n while (st == null || !st.hasMoreTokens()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n int[] readIntArr(int n) {\n int[] result = new int[n];\n for (int i = 0; i < n; i++) {\n result[i] = Integer.parseInt(next());\n }\n return result;\n }\n\n void close() {\n try {\n br.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n }\n}\n", "lang": "Java 8", "bug_code_uid": "1f4d34eae74583f2bedfd8af675c9858", "src_uid": "24e2f10463f440affccc2755f4462d8a", "apr_id": "e3909ef1d6344601dee1e0966fec1011", "difficulty": 1500, "tags": ["combinatorics", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9952558454761098, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.*;\n\nimport Combinatorics.Pair;\n\npublic class C {\n\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner();\n\t\tint n = sc.nextInt();\n\t\tint x = sc.nextInt();\n\t\tint p = sc.nextInt();\n\t\tint[] arr = new int[n];\n\t\tfor(int i = 0; i <= p; i++) {\n\t\t\tarr[i] = x;\n\t\t}\n\t\tfor(int i = p+1; i < n; i++) {\n\t\t\tarr[i] = x+1;\n\t\t}\n\t\tboolean[] mark = new boolean[n];\n\t\tint a = 0, b = n;\n\t\twhile(a < b) {\n\t\t\tint c = (a+b)/2;\n\t\t\tmark[c] = true;\n\t\t\tif(arr[c] <= x) a = c+1;\n\t\t\telse b = c;\n\t\t}\n\t\tint leq = 0, high = 0;\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tif(mark[i] && arr[i] == x) leq++;\n\t\t\tif(mark[i] && arr[i] > x) high++;\n\t\t}\n\t\tlong res = choose(x-1, leq-1) * fac(leq-1) % mod;\n\t\tres = res * choose(n-x, high) % mod * fac(high) % mod;\n\t\tSystem.out.println(res * fac(n - leq - high) % mod);\n\t}\n\tstatic long mod = 1000000007;\n\tstatic int N = 1001;\n\tstatic long[] fac = new long[N+1];\n\tstatic long[] invfac = new long[N+1];\n\tstatic long fac(int n){\n\t\tif(n == 0) return fac[0] = 1;\n\t\telse if(fac[n] > 0) return fac[n];\n\t\telse return fac[n] = n * fac(n-1) % mod;\n\t}\n\tstatic long invfac(int n){\n\t\tif(invfac[n] > 0) return invfac[n];\n\t\telse return invfac[n] = inv(fac[n]);\n\t}\n\tstatic long choose(int n, int k){\n\t\tif(k > n || k < 0) return 0;\n\t\treturn fac(n) * invfac(k) % mod * invfac(n-k) % mod;\n\t}\n\tstatic long inv(long a){\n\t\treturn (gcdex(a, mod).r + mod) % mod;\n\t}\n\tstatic Pair gcdex(long a, long b){\n\t\tif(b > a) return gcdex(b, a).invert();\n\t\telse if(b == 0) return new Pair(1, 0);\n\t\telse{\n\t\t\tPair p = gcdex(b, a % b);\n\t\t\treturn new Pair(p.s, p.r - p.s*(a/b));\n\t\t}\n\t}\n\tstatic class Pair{\n\t\tlong r, s;\n\t\tpublic Pair(long r, long s){\n\t\t\tthis.r = r; this.s = s;\n\t\t}\n\t\tpublic Pair invert(){\n\t\t\treturn new Pair(s, r);\n\t\t}\n\t\tpublic String toString() {\n\t\t\treturn r+\" \"+s;\n\t\t}\n\t}\n\t\n\tstatic class FastScanner {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n public FastScanner() {\n reader = new BufferedReader(new InputStreamReader(System.in), 32768);\n tokenizer = null;\n }\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n public int nextInt() {\n return Integer.parseInt(next());\n }\n public long nextLong() {\n \treturn Long.parseLong(next());\n }\n public double nextDouble() {\n \treturn Double.parseDouble(next());\n }\n public String nextLine() {\n \ttry {\n \t\treturn reader.readLine();\n \t} catch(IOException e) {\n \t\tthrow new RuntimeException(e);\n \t}\n }\n }\n\n}\n", "lang": "Java 8", "bug_code_uid": "be03c159cf17d2648869f5b431c7b3c8", "src_uid": "24e2f10463f440affccc2755f4462d8a", "apr_id": "ae6ef9942f654c8029f815c2de035d10", "difficulty": 1500, "tags": ["combinatorics", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8921117792713124, "equal_cnt": 11, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 10, "fix_ops_cnt": 10, "bug_source_code": "import java.io.InputStreamReader;\nimport java.util.Scanner;\n\npublic class Main {\n static long MOD = 1000000007;\n\n\n public static void main(String[] args) throws IOException {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int x = sc.nextInt();\n int pos = sc.nextInt();\n long ans = 1;\n int left= 0, right = n, mid, low = x-1, high = n-x;\n while (left < right) {\n mid = (left + right)/2;\n if (mid < pos) {\n\n if (low == 0) {\n System.out.println(0);\n return;\n } else {\n ans = (ans*low)%MOD;\n low--;\n }\n left = mid+1;\n } else if (mid == pos) {\n left = mid+1;\n } else {\n if (high == 0) {\n System.out.println(0);\n return;\n } else {\n ans = (ans*high)%MOD;\n high--;\n }\n right = mid;\n }\n }\n System.out.println(ans);\n\n for (int i = 0; i < low+high; i++)\n ans = (ans*(low+high-i)) % MOD;\n System.out.println(ans);\n\n }\n}", "lang": "Java 8", "bug_code_uid": "e9417b2e72a8cf21ae159ec381e0f197", "src_uid": "24e2f10463f440affccc2755f4462d8a", "apr_id": "b1470216e1e09577baa03f1e11d6a77d", "difficulty": 1500, "tags": ["combinatorics", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9643201542912246, "equal_cnt": 8, "replace_cnt": 1, "delete_cnt": 6, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "package CodeForces;\n\n\nimport java.io.*;\nimport java.util.*;\n\t\npublic class C \n{\t\n\tstatic long facts[],factInvs[],mod=(long)1e9+7;\n\t\n\tpublic static void main(String[] args)throws IOException \n\t{\t\n\t\tFastReader f=new FastReader();\n\t\tStringBuffer sb = new StringBuffer();\n\t\tprecomp();\n\t\t\n\t\tint test=1;\n\t\twhile(test-->0)\n\t\t{\t\n\t\t\tint n=f.nextInt();\n\t\t\tint x=f.nextInt();\n\t\t\tint pos=f.nextInt();\n\t\t\t\n\t\t\tint small=0;int big=0;\n\t\t\tint l=0;\n\t\t\tint r=n;\n\t\t\twhile(lpos) \n\t\t\t\t\tbig++;\n\t\t\t\tif(mid= 0; i--)\n\t\t\tfactInvs[i] = mul(factInvs[i + 1], i + 1);\n\t}\n\n\tstatic long getNcR(int n, int k) {\n\t\treturn mul(facts[n], mul(factInvs[k], factInvs[n - k]));\n\t}\n\n\tstatic long mul(long a, long b) {\n\t\treturn a * b % mod;\n\t}\n\n\tstatic long modInv(long x) {\n\t\treturn exp(x, mod - 2);\n\t}\n\n\tstatic long exp(long base, long e) {\n\t\tif (e == 0)\n\t\t\treturn 1;\n\t\tlong half = exp(base, e / 2);\n\t\tif (e % 2 == 0)\n\t\t\treturn mul(half, half);\n\t\telse\n\t\t\treturn mul(half, mul(half, base));\n\t}\n\t\n\tstatic class FastReader \n\t{ \n\t BufferedReader br; \n\t StringTokenizer st; \n\n\t public FastReader() {\n\t \tbr = new BufferedReader(new\n\t InputStreamReader(System.in)); \n\t }\n\t String next() { \n\t while (st == null || !st.hasMoreElements()) { \n\t try{ \n\t st = new StringTokenizer(br.readLine()); \n\t } \n\t catch (IOException e) { \n\t e.printStackTrace(); \n\t } \n\t } \n\t return st.nextToken(); \n\t } \n\t int nextInt() { \n\t return Integer.parseInt(next()); \n\t } \n\t long nextLong() { \n\t return Long.parseLong(next()); \n\t } \n\t double nextDouble() { \n\t return Double.parseDouble(next()); \n\t } \n\t String nextLine() { \n\t String str = \"\"; \n\t try{ \n\t str = br.readLine(); \n\t } \n\t catch (IOException e) { \n\t e.printStackTrace(); \n\t } \n\t return str; \n\t } \n\t} \n\n}", "lang": "Java 8", "bug_code_uid": "de05c65c71a62f1bd54edfb1c5f9cf26", "src_uid": "24e2f10463f440affccc2755f4462d8a", "apr_id": "2f57b612ae29f64a5edeff832f0590fc", "difficulty": 1500, "tags": ["combinatorics", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.7871198568872988, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "import java.util.*;\npublic class susbus{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int y = sc.nextInt();\n int a = sc.nextInt();\n int b = sc.nextInt();\n int s = b/gcd(x,y);\n int t = (a-1)/gcd(x,y);\n System.out.println(s-t);\n }\n public static int gcd(int x, int y){\n int result=0;\n int k = Math.sqrt(Math.min(x,y));\n for (int i=1;i<=k;i++){\n if(x%i==0 && y%i==0){\n result=i;\n }\n }\n return result;\n }\n}", "lang": "Java 8", "bug_code_uid": "142ef372c4cc215179b97511ca15092f", "src_uid": "c7aa8a95d5f8832015853cffa1374c48", "apr_id": "c278d345e358f87b9477e40f8ae357b9", "difficulty": 1200, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9987255734919286, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.Random;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n\tstatic int MOD = 1000 * 1000 * 1000 + 7;\n\n\tpublic static void shuffleArray(int[] arr) {\n\t\tint n = arr.length;\n\t\tRandom rnd = new Random();\n\t\tfor (int i = 0; i < n; ++i) {\n\t\t\tint tmp = arr[i];\n\t\t\tint randomPos = i + rnd.nextInt(n - i);\n\t\t\tarr[i] = arr[randomPos];\n\t\t\tarr[randomPos] = tmp;\n\t\t}\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tInputReader in = new InputReader(inputStream);\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\tsolve(in, out);\n\t\tout.close();\n\t\tSystem.exit(0);\n\t}\n\n\tprivate static void solve(InputReader in, PrintWriter out) {\n\n\t\tint n = in.nextInt();\n\t\tlong k = in.nextLong();\n\t\tlong[] fib = new long[51];\n\t\tfib[0] = 0;\n\t\tfib[1] = 1;\n\t\tfib[2] = 2;\n\t\tfor (int i = 3; i <= 50; i++) {\n\t\t\tfib[i] = fib[i - 1] + fib[i - 2];\n\t\t}\n\n\t\tint pos = 1;\n\t\tint i = n;\n\t\twhile (pos <= n) {\n\t\t\tif (pos == n && k == 1) {\n\t\t\t\tout.print(pos);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (k <= fib[i - 1]) {\n\t\t\t\tout.print(pos + \" \");\n\t\t\t\tpos++;\n\t\t\t\ti -= 1;\n\t\t\t} else {\n\t\t\t\tk -= fib[i - 1];\n\t\t\t\tout.print((pos + 1) + \" \" + pos);\n\t\t\t\tpos += 2;\n\t\t\t\ti -= 2;\n\t\t\t}\n\t\t}\n\n\t}\n\n\t/*\n\t * \n\t */\n\t// --------------------------------------------------------\n\tstatic class InputReader {\n\t\tpublic BufferedReader reader;\n\t\tpublic StringTokenizer tokenizer;\n\n\t\tpublic InputReader(InputStream stream) {\n\t\t\treader = new BufferedReader(new InputStreamReader(stream), 32768);\n\t\t\ttokenizer = null;\n\t\t}\n\n\t\tpublic String next() {\n\t\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn tokenizer.nextToken();\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic double nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tpublic String nextLine() {\n\t\t\tString str = \"\";\n\t\t\ttry {\n\t\t\t\tstr = reader.readLine();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\n\t\t\treturn str;\n\t\t}\n\t}\n\n}", "lang": "Java 8", "bug_code_uid": "cf06c83467688ca0d4901d68e884d1b2", "src_uid": "e03c6d3bb8cf9119530668765691a346", "apr_id": "4340fdce0b6d88fc5737a87d79c8046e", "difficulty": 1900, "tags": ["math", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9974035608308606, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n MyScanner in = new MyScanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n TaskD solver = new TaskD();\n solver.solve(1, in, out);\n out.close();\n }\n}\n\nclass TaskD {\n int MOD = (int) (1e9+7);\n public void solve(int testNumber, MyScanner in, PrintWriter out) {\n int h = in.nextInt(), w = in.nextInt();\n long res = solve(h,w);\n out.println(res);\n }\n\n private long solve(int h, int w) {\n h++; w++;\n long[][] num = new long[2][2];\n for (int i = 0; i < h; i++) for (int j = 0; j < w; j++)num[i%2][j%2]++;\n long numInt = 0;\n for (int x0 = 0; x0 < 2; x0++) for (int y0 = 0; y0 < 2; y0++) for (int x1 = 0; x1 < 2; x1++)\n for (int y1 = 0; y1 < 2; y1++) for (int x2 = 0; x2 < 2; x2++) for (int y2 = 0; y2 < 2; y2++){\n int dx1 = (x1-x0)&1, dy1 = (y1-y0)&1;\n int dx2 = (x2-x0)&1, dy2 = (y2-y0)&1;\n if((dx1*dy2-dx2*dy1&1)==0){\n numInt = (numInt + num[x0][y0] * num[x1][y1] % MOD * num[x2][y2]) % MOD;\n }\n }\n\n long zero = 0;\n long S = h * w;\n zero += S;\n zero += S*(S-1)*3; zero %= MOD;\n\n zero += h*(h-1)%MOD*(h-2)*w;\n zero += w*(w-1)%MOD*(w-2)*h;\n zero %= MOD;\n\n for(int x=1;x>1) * ((Y+1)>>1);\n\t\tlong oe = ((X+1)>>1) * ((Y+2)>>1);\n\t\tlong eo = ((X+2)>>1) * ((Y+1)>>1);\n\t\tlong ee = ((X+2)>>1) * ((Y+2)>>1);\n\t\t\n\t\t//two\n\t\tadd+=(ee)*(ee-1)*(combs-ee);\n\t\tadd+=(eo)*(eo-1)*(combs-eo);\n\t\tadd+=(oe)*(oe-1)*(combs-oe);\n\t\tadd+=(oo)*(oo-1)*(combs-oo);\n\t\t\n\t\tadd*=3;\n\t\tadd%=mod;\n\t\t\n\t\t//three\n\t\tadd+=(ee)*(ee-1)*(ee-2);\n\t\tadd+=(eo)*(eo-1)*(eo-2);\n\t\tadd+=(oe)*(oe-1)*(oe-2);\n\t\tadd+=(oo)*(oo-1)*(oo-2);\n\t\t\n\t\tadd%=mod;\n\t\t\n\t\tfor (int x = (int)-X; x <= X; x++) {\n\t\t\tfor (int y = 0; y <= Y; y++) {\n\t\t\t\tif(x<=0 && y == 0) continue;\n\t\t\t\tlong ways = GCD(Math.abs(y), Math.abs(x)) + 1;\n\t\t\t\tlong pick = (X - Math.abs(x) + 1) * (Y - y + 1);\n\t\t\t\tlong temp = (pick * (6*(ways-2))) % mod;\n\t\t\t\tif(temp>0){\n\t\t\t\t\tsub+=temp%mod;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t//\tSystem.out.println(add+\" \"+sub);\n\t\tSystem.out.println((((add-sub) % mod)+mod)%mod);\n\t}\n\n\tprivate static long GCD(long a, long b) {\n\t\tif (b == 0)\n\t\t\treturn a;\n\t\treturn GCD(b, a % b);\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "c80bd8b1ccda5ca60e64999c8f3002b3", "src_uid": "984788e4b4925c15c9c6f31e42f2f8fa", "apr_id": "1e6ae3e38cd9c3d1dc58f3b159da1bb0", "difficulty": 2500, "tags": ["geometry", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9573863636363636, "equal_cnt": 14, "replace_cnt": 6, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 13, "bug_source_code": "import java.util.Scanner;\n\npublic class G {\n\tstatic final long mod = 1000000007;\n\tstatic Long[][] memo = new Long[4005][4005];\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong X = sc.nextInt();\n\t\tlong Y = sc.nextInt();\n\t\tlong add = 0, sub =0;\n\t\t\n\t\tlong combs = (X+1)*(Y+1);\n\t\tlong oo = ((X+1)>>1) * ((Y+1)>>1);\n\t\tlong oe = ((X+1)>>1) * ((Y+2)>>1);\n\t\tlong eo = ((X+2)>>1) * ((Y+1)>>1);\n\t\tlong ee = ((X+2)>>1) * ((Y+2)>>1);\n\t\t\n\t\t//two\n\t\tadd+=trip(ee,ee-1,combs-ee);\n\t\tadd+=trip(eo,eo-1,combs-eo);\n\t\tadd+=trip(oe,oe-1,combs-oe);\n\t\tadd+=trip(oo,oo-1,combs-oo);\n\t\tadd*=3;\n\t\tadd%=mod;\n\t\t\n\t\t//three\n\t\tadd+=trip(ee,ee-1,ee-2);\n\t\tadd+=trip(eo,eo-1,eo-2);\n\t\tadd+=trip(oe,oe-1,oe-2);\n\t\tadd+=trip(oo,oo-1,oo-2);\n\t\t\n\t\tadd%=mod;\n\t\t\n\t\tfor (int x = (int)-X; x <= X; x++) {\n\t\t\tfor (int y = 0; y <= Y; y++) {\n\t\t\t\tif(x<=0 && y == 0) continue;\n\t\t\t\tlong ways = GCD(Math.abs(y), Math.abs(x)) + 1;\n\t\t\t\tlong pick = (X - Math.abs(x) + 1) * (Y - y + 1);\n\t\t\t\tlong temp = (pick * (6*(ways-2))) % mod;\n\t\t\t\tif(temp>0){\n\t\t\t\t\tsub+=temp;\n\t\t\t\t\tsub%=mod;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t//\tSystem.out.println(add+\" \"+sub);\n\t\tSystem.out.println((((add-sub) % mod)+mod)%mod);\n\t}\n\n\tprivate static long trip(long A, long B, long C) {\n\t\treturn (((A*B)%mod)*C)%mod;\n\t}\n\n\tprivate static Long GCD(int a, int b) {\n\t\tif(memo[a][b]!=null)return memo[a][b];\n\t\tif (b == 0)\treturn memo[a][b]=(long)a;\n\t\treturn memo[a][b]=GCD(b, a % b);\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "de01d2454b4f10255a2d6b0aaf9e0ea9", "src_uid": "984788e4b4925c15c9c6f31e42f2f8fa", "apr_id": "1e6ae3e38cd9c3d1dc58f3b159da1bb0", "difficulty": 2500, "tags": ["geometry", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.922667376547318, "equal_cnt": 15, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 14, "bug_source_code": "import java.io.IOException;\nimport java.io.OutputStreamWriter;\nimport java.util.Arrays;\nimport java.io.BufferedWriter;\nimport java.util.InputMismatchException;\nimport java.util.ArrayList;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.io.Writer;\nimport java.math.BigInteger;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n * @author Crash\n */\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tInputReader in = new InputReader(inputStream);\n\t\tOutputWriter out = new OutputWriter(outputStream);\n\t\tTaskD solver = new TaskD();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass TaskD {\n\tprivate static final int modulo = 1000000007;\n\tprivate int[] calc(int a, int b) {\n\t\treturn new int[] {1 + a / 2 + b / 2, (a + 1) / 2 + (b + 1) / 2};\n\t}\n\tpublic void solve(int testNumber, InputReader in, OutputWriter out) {\n\t\tint w = in.readInt();\n\t\tint h = in.readInt();\n\t\tlong ans = 0;\n\t\tfor (int i = 0; i <= w; i ++)\n\t\t\tfor (int j = 0; j <= h; j ++) {\n\t\t\t\tint[] cx = calc(i, w - i);\n\t\t\t\tint[] cy = calc(j, h - j);\n\t\t\t\tfor (int s = 0; s < 16; s ++) {\n\t\t\t\t\tint x1 = s & 1;\n\t\t\t\t\tint y1 = s >> 1 & 1;\n\t\t\t\t\tint x2 = s >> 2 & 1;\n\t\t\t\t\tint y2 = s >> 3 & 1;\n\t\t\t\t\tif ((x1 * y2 - x2 * y1) % 2 == 0) {\n\t\t\t\t\t\tans = (ans + (long)cx[x1] * cy[y1] % modulo * cx[x2] % modulo * cy[y2]) % modulo;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tans = (ans - (w + 1) * (h + 1)) % modulo;\n\t\tans = (ans - (long)(w + 1) * (h + 1) * ((w + 1) * (h + 1) - 1) * 3) % modulo;\n\t\tans = (ans - (long)(w + 1) * (h + 1) * h * (h - 1)) % modulo;\n\t\tans = (ans - (long)(h + 1) * (w + 1) * w * (w - 1)) % modulo;\n\t\tfor (int i = 1; i <= w; i ++)\n\t\t\tfor (int j = 1; j <= h; j ++) {\n\t\t\t\tint t = NumberTheory.gcd(i, j) - 1;\n\t\t\t\tans = (ans - (long)(w - i + 1) * (h - j + 1) % modulo * t * 12) % modulo;\n\t\t\t}\n\t\tans = (ans + modulo) % modulo;\n\t\tout.printLine(ans);\n\t}\n}\n\nclass InputReader {\n\tprivate InputStream stream;\n\tprivate byte[] buf = new byte[1000];\n\tprivate int curChar;\n\tprivate int numChars;\n\n\tpublic InputReader(InputStream stream) {\n\t\tthis.stream = stream;\n\t}\n\n\tprivate int read() {\n\t\tif (numChars == -1)\n\t\t\tthrow new InputMismatchException();\n\t\tif (curChar >= numChars) {\n\t\t\tcurChar = 0;\n\t\t\ttry {\n\t\t\t\tnumChars = stream.read(buf);\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t\tif (numChars <= 0)\n\t\t\t\treturn -1;\n\t\t}\n\t\treturn buf[curChar++];\n\t}\n\n\tpublic int readInt() {\n\t\tint c = read();\n\t\twhile (isSpaceChar(c))\n\t\t\tc = read();\n\t\tint sgn = 1;\n\t\tif (c == '-') {\n\t\t\tsgn = -1;\n\t\t\tc = read();\n\t\t}\n\t\tint res = 0;\n\t\tdo {\n\t\t\tif (c < '0' || c > '9')\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tres *= 10;\n\t\t\tres += c - '0';\n\t\t\tc = read();\n\t\t} while (!isSpaceChar(c));\n\t\treturn res * sgn;\n\t}\n\n\tprivate boolean isSpaceChar(int c) {\n\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t}\n}\n\nclass OutputWriter {\n\tprivate final PrintWriter writer;\n\n\tpublic OutputWriter(OutputStream outputStream) {\n\t\twriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n\t}\n\n\tpublic OutputWriter(Writer writer) {\n\t\tthis.writer = new PrintWriter(writer);\n\t}\n\n\tpublic void print(Object...objects) {\n\t\tfor (int i = 0; i < objects.length; i++) {\n\t\t\tif (i != 0)\n\t\t\t\twriter.print(' ');\n\t\t\twriter.print(objects[i]);\n\t\t}\n\t}\n\n\tpublic void printLine(Object...objects) {\n\t\tprint(objects);\n\t\twriter.println();\n\t}\n\n\tpublic void close() {\n\t\twriter.close();\n\t}\n}\n\nclass NumberTheory {\n\tprivate NumberTheory() {\n\t}\n\n\tpublic static int gcd(int m, int n) {\n\t\tif (m == 0) return n;\n\t\twhile (n > 0) {\n\t\t\tint r = m % n;\n\t\t\tm = n;\n\t\t\tn = r;\n\t\t}\n\t\treturn m;\n\t}\n\n\t}\n\n", "lang": "Java 7", "bug_code_uid": "a4156dc91f1e382ae60f8ed9fcd7244d", "src_uid": "984788e4b4925c15c9c6f31e42f2f8fa", "apr_id": "78c57ffdcc82a8b129cb47e49411c885", "difficulty": 2500, "tags": ["geometry", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9502736140851773, "equal_cnt": 10, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 9, "bug_source_code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.PrintWriter;\nimport java.util.InputMismatchException;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n * @author George Marcus\n */\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tStreamInputReader in = new StreamInputReader(inputStream);\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\tTaskD solver = new TaskD();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass TaskD {\n public static final int MOD = 1000000007;\n private int N, M;\n\tpublic void solve(int testNumber, StreamInputReader in, PrintWriter out) {\n M = in.readInt();\n N = in.readInt();\n long ans = 0;\n for(int px0 = 0; px0 < 2; px0++)\n for(int py0 = 0; py0 < 2; py0++)\n for(int px1 = 0; px1 < 2; px1++)\n for(int py1 = 0; py1 < 2; py1++)\n for(int px2 = 0; px2 < 2; px2++)\n for(int py2 = 0; py2 < 2; py2++)\n if((px0 * (py1 - py2 + 2) + py0 * (px2 - px1 + 2) + px1 * py2 - px2 * py1 + 2) % 2 == 0) {\n long crt = 1;\n crt *= px(px0);\n crt *= px(px1);\n crt *= px(px2);\n crt %= MOD;\n crt *= py(py0);\n crt *= py(py1);\n crt *= py(py2);\n ans = (ans + crt) % MOD;\n }\n\n int[][] gcd = new int[M + 1][N + 1];\n for(int i = 0; i <= M; i++)\n for(int j = 0; j <= N; j++) {\n if(i == 0)\n gcd[i][j] = j;\n else if(j == 0)\n gcd[i][j] = i;\n else if(i >= j)\n gcd[i][j] = gcd[j][i - j];\n else\n gcd[i][j] = gcd[i][j - i];\n }\n\n long bad = 0;\n for(int dx = 0; dx <= M; dx++)\n for(int dy = 0; dy <= N; dy++) {\n int numPoints = gcd[dx][dy] + 1;\n\n long pos = -1;\n if(numPoints == 1)\n pos = 1;\n else if(numPoints == 2)\n pos = 6;\n else pos = (numPoints - 2) * 6 + 6;\n\n if(pos == -1)\n throw new RuntimeException();\n\n pos = pos * (M - dx + 1) * (N - dy + 1);\n if(dx > 0 && dy > 0) {\n pos *= 2;\n }\n\n bad = (bad + pos) % MOD;\n }\n\n ans = (ans - bad + MOD) % MOD;\n out.print(ans);\n\t}\n\n private long py(int p) {\n return (long)N / 2 + ((p == 0 || N % 2 == 1) ? 1 : 0);\n }\n\n private long px(int p) {\n return (long)M / 2 + ((p == 0 || M % 2 == 1) ? 1 : 0);\n }\n}\n\nclass StreamInputReader extends InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar, numChars;\n\n public StreamInputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n }\n\nabstract class InputReader {\n\n public abstract int read();\n\n public int readInt() {\n return Integer.parseInt(readString());\n }\n\n public String readString() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuffer res = new StringBuffer();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n\n private boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n }\n\n", "lang": "Java 7", "bug_code_uid": "d020ef6956fa1a60409912ea634a1f89", "src_uid": "984788e4b4925c15c9c6f31e42f2f8fa", "apr_id": "50cb71caf171f09e98a5a133f9e7a8ca", "difficulty": 2500, "tags": ["geometry", "math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9519276534983341, "equal_cnt": 8, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 7, "bug_source_code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.PrintWriter;\nimport java.util.InputMismatchException;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n * @author George Marcus\n */\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tStreamInputReader in = new StreamInputReader(inputStream);\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\tTaskD solver = new TaskD();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass TaskD {\n public static final int MOD = 1000000007;\n private int N, M;\n\tpublic void solve(int testNumber, StreamInputReader in, PrintWriter out) {\n M = in.readInt();\n N = in.readInt();\n long ans = 0;\n for(int px0 = 0; px0 < 2; px0++)\n for(int py0 = 0; py0 < 2; py0++)\n for(int px1 = 0; px1 < 2; px1++)\n for(int py1 = 0; py1 < 2; py1++)\n for(int px2 = 0; px2 < 2; px2++)\n for(int py2 = 0; py2 < 2; py2++)\n if((px0 * (py1 - py2 + 2) + py0 * (px2 - px1 + 2) + px1 * py2 - px2 * py1 + 2) % 2 == 0) {\n long crt = 1;\n crt *= px(px0);\n crt *= px(px1);\n crt *= px(px2);\n crt %= MOD;\n crt *= py(py0);\n crt *= py(py1);\n crt *= py(py2);\n ans = (ans + crt) % MOD;\n }\n\n int[][] gcd = new int[4001][4001];\n for(int i = 0; i <= M; i++)\n for(int j = 0; j <= N; j++) {\n if(i == 0)\n gcd[i][j] = j;\n else if(j == 0)\n gcd[i][j] = i;\n else if(i >= j)\n gcd[i][j] = gcd[j][i - j];\n else\n gcd[i][j] = gcd[i][j - i];\n }\n\n long bad = 0;\n for(int dx = 0; dx <= M; dx++)\n for(int dy = 0; dy <= N; dy++) {\n int numPoints = gcd[dx][dy] + 1;\n\n long pos = -1;\n if(numPoints == 1)\n pos = 1;\n else if(numPoints == 2)\n pos = 6;\n else pos = (numPoints - 2) * 6 + 6;\n\n if(pos == -1)\n throw new RuntimeException();\n\n pos = pos * (M - dx + 1) * (N - dy + 1);\n if(dx > 0 && dy > 0) {\n pos *= 2;\n }\n\n bad = (bad + pos) % MOD;\n }\n\n ans = (ans - bad + MOD) % MOD;\n out.print(ans);\n\t}\n\n private long py(int p) {\n return (long)N / 2 + ((p == 0 || N % 2 == 1) ? 1 : 0);\n }\n\n private long px(int p) {\n return (long)M / 2 + ((p == 0 || M % 2 == 1) ? 1 : 0);\n }\n}\n\nclass StreamInputReader extends InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar, numChars;\n\n public StreamInputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n }\n\nabstract class InputReader {\n\n public abstract int read();\n\n public int readInt() {\n return Integer.parseInt(readString());\n }\n\n public String readString() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuffer res = new StringBuffer();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n\n private boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n }\n\n", "lang": "Java 7", "bug_code_uid": "3f4a20bd431f53748d068ec19f214c31", "src_uid": "984788e4b4925c15c9c6f31e42f2f8fa", "apr_id": "50cb71caf171f09e98a5a133f9e7a8ca", "difficulty": 2500, "tags": ["geometry", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9995333644423705, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner;\n \npublic class Solution1 {\n \n public static void main(String[] args) {\n \n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int m = in.nextInt();\n int c0 = in.nextInt();\n int d0 = in.nextInt();\n \n int[] a = new int[m + 1];\n int[] b = new int[m + 1];\n int[] c = new int[m + 1];\n int[] d = new int[m + 1];\n \n for (int i = 1; i <= m; i++) {\n a[i] = in.nextInt();\n b[i] = in.nextInt();\n c[i] = in.nextInt();\n d[i] = in.nextInt();\n }\n a[0] = n;\n b[0] = 1;\n c[0] = c0;\n d[0] = d0;\n int dp[][] = new int[n + 1][m + 1];\n \n \n \n for (int i = 0; i <= n; ++i) {\n for (int j = 0; j <= m; ++j) {\n for (int k = 0; k <= a[j] / b[j]; ++k) {\nif(c[j] * k <= i)\n dp[i][j] = Math.max(dp[i][j], d[j] * k + (j > 0 ? dp[i - k * c[j]][j - 1] : 0));\n }\n}\n }\n }\n \n System.out.println(dp[n][m]);\n \n }\n}", "lang": "Java 8", "bug_code_uid": "fe448cb90c07cb97da0e5aa3b83d2062", "src_uid": "4e166b8b44427b1227e0f811161d3a6f", "apr_id": "83131855270569092fd29f39d93334b6", "difficulty": 1700, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9973284200829111, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.io.BufferedWriter;\nimport java.io.Writer;\nimport java.io.OutputStreamWriter;\nimport java.util.InputMismatchException;\nimport java.io.IOException;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author El-Bishoy\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n OutputWriter out = new OutputWriter(outputStream);\n div2C_C106Buns solver = new div2C_C106Buns();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class div2C_C106Buns {\n int c0;\n int d0;\n int m;\n int doughAvailable;\n int[] cost;\n int[] stuffingAvailable;\n int[] stuffingNeeded;\n int[] doughNeeded;\n int memo;\n\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n\n doughAvailable = in.nextInt();\n m = in.nextInt();\n c0 = in.nextInt();\n d0 = in.nextInt();\n cost = new int[m];\n stuffingAvailable = new int[m];\n stuffingNeeded = new int[m];\n doughNeeded = new int[m];\n\n memo = new int[102][102];\n\n for (int i = 0; i < memo.length; i++) {\n Arrays.fill(memo[i], -1);\n }\n\n for (int i = 0; i < m; i++) {\n stuffingAvailable[i] = in.nextInt();\n stuffingNeeded[i] = in.nextInt();\n doughNeeded[i] = in.nextInt();\n cost[i] = in.nextInt();\n }\n\n int ans = dp(doughAvailable, 0);\n\n out.print(ans);\n\n }\n\n int dp(int doughAvail, int i) {\n\n\n if (doughAvail == 0) return 0;\n\n //already taken sufficient m but still have dough use it with no stuffing\n if (i == m) return (doughAvail / c0) * d0;\n\n //try all combs of no stuffings\n //try all coming with a stuffing\n\n\n if (memo[doughAvail][i] != -1) return memo[doughAvail][i];\n\n int max = Integer.MIN_VALUE;\n\n\n for (int amountNoStuffing = 0; amountNoStuffing * c0 <= doughAvail; amountNoStuffing++) {\n max = Math.max(max, amountNoStuffing * d0 + dp(doughAvail - amountNoStuffing * c0, i + 1));\n }\n\n //take one of ms\n for (int amountOfStuffingOfM = 0;\n doughAvail >= amountOfStuffingOfM * doughNeeded[i] && stuffingAvailable[i] >= amountOfStuffingOfM * stuffingNeeded[i];\n amountOfStuffingOfM++) {\n\n max = Math.max(max, amountOfStuffingOfM * cost[i] + dp(doughAvail - amountOfStuffingOfM * doughNeeded[i], i + 1));\n }\n\n\n return memo[doughAvail][i] = max;\n }\n\n }\n\n static class OutputWriter {\n private final PrintWriter writer;\n\n public OutputWriter(OutputStream outputStream) {\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }\n\n public OutputWriter(Writer writer) {\n this.writer = new PrintWriter(writer);\n }\n\n public void close() {\n writer.close();\n }\n\n public void print(int i) {\n writer.print(i);\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "68463080a5e02aa6c6a11b891de4476e", "src_uid": "4e166b8b44427b1227e0f811161d3a6f", "apr_id": "589ae0d5c655c503841bc23224f5db64", "difficulty": 1700, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.21777897865441773, "equal_cnt": 34, "replace_cnt": 23, "delete_cnt": 6, "insert_cnt": 6, "fix_ops_cnt": 35, "bug_source_code": "\nimport java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class D {\n static boolean[] vis;\n static boolean[] source, destination;\n static boolean[] interesting;\n static ArrayList> graph;\n\n public static boolean dfs(int cur) {\n if (destination[cur])\n return interesting[cur]=true;\n vis[cur] = true;\n boolean interst = false;\n for (Integer i : graph.get(cur)) {\n if (!vis[i] ) {\n interst |= dfs(i);\n }\n }\n return interesting[cur] = interst;\n }\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int m = sc.nextInt();\n graph = new ArrayList>();\n source=new boolean[n];\n destination=new boolean[n];\n interesting=new boolean[n];\n for (int i = 0; i < n; i++)\n graph.add(new ArrayList());\n for (int i = 0; i < n; i++) {\n int val = sc.nextInt();\n if (val == 1) {\n source[i] = true;\n } else if (val == 2) {\n destination[i] = true;\n }\n }\n for(int i=0;i\n * @category ?\n * @date 2/07/2020\n **/\n\nimport java.io.*;\nimport java.util.*;\n\nimport static java.lang.Integer.*;\nimport static java.lang.Math.*;\n\npublic class CF41C {\n public static void main(String args[]) throws Throwable {\n BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n for (String ln; (ln = in.readLine()) != null && !ln.equals(\"\"); ) {\n String a = ln;\n char begin = a.charAt(0), last = a.charAt(a.length() - 1);\n a = a.substring(1, a.length() - 1).replaceAll(\"dot\", \".\");\n int index = a.lastIndexOf(\"at\");\n a = a.substring(0, index) + \"@\" + a.substring(index + 2);\n System.out.println(begin + a + last);\n }\n }\n}\n", "lang": "Java 11", "bug_code_uid": "2a7127d6ad3577f4bb3938f636686cf8", "src_uid": "a11c9679d8e2dca51be17d466202df6e", "apr_id": "b17b1b8db0aa4258ad031c62295601c4", "difficulty": 1300, "tags": ["implementation", "expression parsing"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.15572625698324022, "equal_cnt": 13, "replace_cnt": 7, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 13, "bug_source_code": "import java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class DrazilandFactorial {\n static long fact[] = {1,1,2,6,24,120,720,5040,40320,362880};\n\n static long func(long n){\n long ans = 1;\n while(n>0){\n long b = n%10;\n ans*=fact[ (int) b ];\n n/=10;\n }\n return ans;\n }\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n long f = sc.nextLong();\n funcTarget = func(f);\n rec(1,f,\"\");\n System.out.println(mx);\n }\n static int n;\n static long funcTarget;\n static long mx = Long.MIN_VALUE;\n static void rec(long cur,long target,String res){\n if((cur)==funcTarget){\n mx = Math.max(mx,Long.parseLong(res));\n return;\n }\n if(res.length()>n+1)return;\n rec(cur*fact[2],target,res+2);\n rec(cur*fact[3],target,res+3);\n rec(cur*fact[4],target,res+4);\n rec(cur*fact[5],target,res+5);\n rec(cur*fact[6],target,res+6);\n rec(cur*fact[7],target,res+7);\n rec(cur*fact[8],target,res+8);\n rec(cur*fact[9],target,res+9);\n\n\n\n }\n}\n", "lang": "Java 8", "bug_code_uid": "056e39515c7d3c4ab8d63e4cf7534984", "src_uid": "60dbfc7a65702ae8bd4a587db1e06398", "apr_id": "6a8e5513cf537dec64e7912f4788384b", "difficulty": 1400, "tags": ["greedy", "math", "sortings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9658739962940086, "equal_cnt": 16, "replace_cnt": 6, "delete_cnt": 6, "insert_cnt": 3, "fix_ops_cnt": 15, "bug_source_code": "import java.util.*;\nimport java.util.logging.Level;\nimport java.awt.Point;\n\nimport java.io.*;\n\npublic class tr0 {\n\tstatic PrintWriter out;\n\tstatic StringBuilder sb;\n\tstatic final double EPS = 1e-9;\n\tstatic long mod = 1000000007;\n\tstatic int inf = (int) 1e9 + 2;\n\tstatic long[] fac;\n\tstatic int[] si;\n\tstatic ArrayList primes;\n\tstatic ArrayList[] ad;\n\tstatic ArrayList[] d;\n\tstatic edge[] ed;\n\tstatic int[] ch;\n\tstatic int[] occ;\n\tstatic long[][] adjMatrix;\n\tstatic Queue[] can;\n\tstatic String s;\n\tstatic int[][] memo;\n\tstatic int n, m, r, k;\n\tstatic int[] o;\n\tstatic boolean[] t;\n\tstatic HashMap pri;\n\tstatic TreeMap map;\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n\t\tout = new PrintWriter(System.out);\n\t\tn = sc.nextInt();\n\t\tint ans = 0;\n\t\tString s = sc.nextLine();\n\t\tsb = new StringBuilder();\n\t\tsb.append(s);\n\t\tfor (int i = 25; i > 0; i--) {\n\t\t\tStringBuilder sb1 = new StringBuilder();\n\t\t\tfor (int j = 0; j < sb.length(); j++) {\n\t\t\t\tif (sb.length() == 1) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (sb.charAt(j) == 'a' + i) {\n\t\t\t\t\tint st = j;\n\t\t\t\t\twhile (j < sb.length() && sb.charAt(j) == 'a' + i) {\n\t\t\t\t\t\tj++;\n\t\t\t\t\t}\n\t\t\t\t\tint ed = j;\n\t\t\t\t\tif (st == 0 && ed==sb.length()) {\n continue;\n\t\t\t\t\t}\n\t\t\t\t\tif(st==0 && sb.charAt(ed)=='a'+i-1) {\n\t\t\t\t\t\tans+=ed-st;\n\t\t\t\t\t}\n\t\t\t\t\telse if(st!=0 && ed==sb.length() && sb.charAt(st-1)=='a'+i-1) {\n\t\t\t\t\t\tans+=ed-st;\n\t\t\t\t\t}\n\t\t\t\t\telse if(st!=0 && ed!=sb.length() &&(sb.charAt(st-1)=='a'+i-1 || sb.charAt(ed)=='a'+i-1)) {\n\t\t\t\t\t\tans+=ed-st;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tsb1.append(sb.charAt(j));\n\t\t\t\t\t}\n\t\t\t\t\tj--;\n\t\t\t\t} else\n\t\t\t\t\tsb1.append(sb.charAt(j));\n\t\t\t//\tsb=sb1;\n\t\t\t}\n\t\t\tsb=sb1;\n\t\t//\tSystem.out.println(ans+\" \"+sb1);\n\t\t}\n\t\tout.print(ans);\n\t\tout.flush();\n\t}\n\n\tstatic boolean valid(int i, int j) {\n\t\treturn i >= 0 && i < n && j >= 0 && j < m;\n\t}\n\n\tstatic long cal(int i, int j) {\n\t\treturn (Math.min(i, n - r) - Math.max(0, i - r + 1) + 1) * 1l\n\t\t\t\t* (Math.min(j, m - r) - Math.max(0, j - r + 1) + 1);\n\t}\n\n\tstatic class qu implements Comparable {\n\t\tint a;\n\t\tint b;\n\t\tint w;\n\t\tint i;\n\n\t\tqu(int aa, int bb, int cc, int id) {\n\t\t\ta = aa;\n\t\t\tb = bb;\n\t\t\tw = cc;\n\t\t\ti = id;\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\treturn a + \" \" + b + \" \" + w + \" \" + i;\n\t\t}\n\n\t\tpublic int compareTo(qu o) {\n\t\t\tif (a == o.a)\n\t\t\t\tif (b == o.b)\n\t\t\t\t\treturn i - o.i;\n\t\t\t\telse\n\t\t\t\t\treturn b - o.b;\n\t\t\treturn a - o.a;\n\t\t}\n\t}\n\n\tstatic class seg implements Comparable {\n\t\tint a;\n\t\tint b;\n\t\tlong v;\n\n\t\tseg(int s, int e, long vv) {\n\t\t\ta = s;\n\t\t\tb = e;\n\t\t\tv = vv;\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\treturn a + \" \" + b + \" \" + v;\n\t\t}\n\n\t\tpublic int compareTo(seg o) {\n\t\t\t// if(a==o.a)\n\t\t\treturn Long.compare(o.v, v);\n\t\t\t// return\n\t\t}\n\t}\n\n\tstatic class pair implements Comparable {\n\t\tint to;\n\t\tint number;\n\n\t\tpair(int t, int n) {\n\t\t\tnumber = n;\n\t\t\tto = t;\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\treturn to + \" \" + number;\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(pair o) {\n\t\t\tif (to == o.to)\n\t\t\t\treturn number - o.number;\n\t\t\treturn to - o.to;\n\t\t}\n\n\t}\n\n\tstatic long modPow(long a, long e)\n\n\t{\n\t\tlong res = 1;\n\t\twhile (e > 0) {\n\t\t\tif ((e & 1) == 1)\n\t\t\t\tres = (res * a) % mod;\n\t\t\ta = (a * a) % mod;\n\t\t\te >>= 1;\n\t\t}\n\t\treturn res;\n\t}\n\n\tstatic long inver(long x) {\n\t\tlong a = x;\n\t\tlong e = (mod - 2);\n\t\tlong res = 1;\n\t\twhile (e > 0) {\n\t\t\tif ((e & 1) == 1) {\n\t\t\t\tres = ((1l * res * a) % mod);\n\t\t\t}\n\t\t\ta = ((1l * a * a) % mod);\n\t\t\te >>= 1;\n\t\t}\n\t\treturn res % mod;\n\t}\n\n\tstatic class edge implements Comparable {\n\t\tint from;\n\t\tint to;\n\t\tint number;\n\n\t\tedge(int f, int t, int n) {\n\t\t\tfrom = f;\n\t\t\tto = t;\n\t\t\tnumber = n;\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\treturn from + \" \" + to + \" \" + number;\n\t\t}\n\n\t\tpublic int compareTo(edge f) {\n\t\t\treturn f.number - number;\n\t\t}\n\t}\n\n\tstatic void seive(int N) {\n\t\tsi = new int[N];\n\t\tprimes = new ArrayList<>();\n\t\tsi[1] = 1;\n\t\tfor (int i = 2; i < N; i++) {\n\t\t\tif (si[i] == 0) {\n\t\t\t\tsi[i] = i;\n\t\t\t\tprimes.add(i);\n\t\t\t}\n\t\t\tfor (int j = 0; j < primes.size() && primes.get(j) <= si[i] && (i * primes.get(j)) < N; j++)\n\t\t\t\tsi[primes.get(j) * i] = primes.get(j);\n\t\t}\n\t}\n\n\tstatic long fac(int n) {\n\t\tif (n == 0)\n\t\t\treturn fac[n] = 1;\n\t\tif (n == 1)\n\t\t\treturn fac[n] = 1;\n\t\tlong ans = 1;\n\t\tfor (int i = 1; i <= n; i++)\n\t\t\tfac[i] = ans = (i % mod * ans % mod) % mod;\n\t\treturn ans % mod;\n\t}\n\n\tstatic long gcd(long a, long b) {\n\n\t\tif (b == 0)\n\t\t\treturn a;\n\t\treturn gcd(b, a % b);\n\t}\n\n\tstatic class unionfind {\n\t\tint[] p;\n\t\tint[] size;\n\t\tint[] max;\n\t\tint num;\n\n\t\tunionfind(int n) {\n\t\t\tp = new int[n];\n\t\t\tsize = new int[n];\n\t\t\tmax = new int[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tp[i] = i;\n\t\t\t\tmax[i] = i;\n\t\t\t}\n\t\t\tArrays.fill(size, 1);\n\t\t\tnum = n;\n\t\t}\n\n\t\tint findSet(int v) {\n\t\t\tif (v == p[v])\n\t\t\t\treturn v;\n\n\t\t\tmax[v] = Math.max(max[v], max[p[v]]);\n\n\t\t\tp[v] = findSet(p[v]);\n\n\t\t\tmax[v] = Math.max(max[v], max[p[v]]);\n\n\t\t\treturn p[v];\n\t\t}\n\n\t\tboolean sameSet(int a, int b) {\n\t\t\ta = findSet(a);\n\t\t\tb = findSet(b);\n\t\t\tif (a == b)\n\t\t\t\treturn true;\n\t\t\treturn false;\n\t\t}\n\n\t\tint max() {\n\t\t\tint max = 0;\n\t\t\tfor (int i = 0; i < size.length; i++)\n\t\t\t\tif (size[i] > max)\n\t\t\t\t\tmax = size[i];\n\t\t\treturn max;\n\t\t}\n\n\t\tboolean combine(int a, int b) {\n\t\t\ta = findSet(a);\n\t\t\tb = findSet(b);\n\t\t\tif (a == b)\n\t\t\t\treturn true;\n\t\t\t// System.out.println(num+\" ppp\");\n\t\t\tnum--;\n\t\t\tif (size[a] > size[b]) {\n\t\t\t\tp[b] = a;\n\t\t\t\tmax[a] = Math.max(max[a], max[b]);\n\t\t\t\tsize[a] += size[b];\n\n\t\t\t} else {\n\t\t\t\tp[a] = b;\n\t\t\t\tmax[b] = Math.max(max[a], max[b]);\n\t\t\t\tsize[b] += size[a];\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tstatic class Scanner {\n\t\tStringTokenizer st;\n\t\tBufferedReader br;\n\n\t\tpublic Scanner(InputStream system) {\n\t\t\tbr = new BufferedReader(new InputStreamReader(system));\n\t\t}\n\n\t\tpublic Scanner(String file) throws Exception {\n\t\t\tbr = new BufferedReader(new FileReader(file));\n\t\t}\n\n\t\tpublic String next() throws IOException {\n\t\t\twhile (st == null || !st.hasMoreTokens())\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic String nextLine() throws IOException {\n\t\t\treturn br.readLine();\n\t\t}\n\n\t\tpublic int nextInt() throws IOException {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic double nextDouble() throws IOException {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tpublic char nextChar() throws IOException {\n\t\t\treturn next().charAt(0);\n\t\t}\n\n\t\tpublic Long nextLong() throws IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic boolean ready() throws IOException {\n\t\t\treturn br.ready();\n\t\t}\n\n\t\tpublic void waitForInput() throws InterruptedException {\n\t\t\tThread.sleep(3000);\n\t\t}\n\t}\n}", "lang": "Java 8", "bug_code_uid": "50c7e7e32293d07b664e56c67bb4de8d", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "apr_id": "45be5043e4f5687f6f2c75bde19da9dc", "difficulty": 1600, "tags": ["strings", "brute force", "greedy", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.3501006036217304, "equal_cnt": 28, "replace_cnt": 15, "delete_cnt": 7, "insert_cnt": 6, "fix_ops_cnt": 28, "bug_source_code": "import java.util.*;\n\n\n\npublic class Main{\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = Integer.parseInt(sc.nextLine());\n String s = sc.nextLine();\n System.out.println( get_ans(new StringBuilder(s),n));\n }\n\n private static long get_ans(StringBuilder s,int n){\n char c = '0';\n int ans = 0;\n boolean flag =false;\n for(int i=0;i0&&s.charAt(i-ans+1)-s.charAt(i-ans)==-1) {\n s.deleteCharAt(i - ans);\n ans++;\n }\n\n }\n return ans;\n }\n\n\n\n}", "lang": "Java 8", "bug_code_uid": "0fd6415a2245e769c1c94b2399b08b0d", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "apr_id": "a70067c831f7202a7484e52bc00ce90a", "difficulty": 1600, "tags": ["strings", "brute force", "greedy", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9750173490631506, "equal_cnt": 13, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 12, "bug_source_code": "import java.util.*;\nimport java.io.*;\nimport java.math.BigInteger;\n \npublic class Main\n{\n\tstatic final int mod = (int)1e9+7;\n\tpublic static void main(String[] args) throws Exception\n\t{\n\t\tFastReader in = new FastReader();\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tint n = in.nextInt();\n\t\tint m = in.nextInt();\n\t\tif(n < 7)\n\t\t\tout.println(m);\n\t\telse\n\t\t{\n\t\t\tint[][] adj = new int[n+1][n+1];\n\t\t\tint[][] e = new int[m][2];\n\t\t\tfor(int i = 0; i < m; i++)\n\t\t\t{\n\t\t\t\te[i][0] = in.nextInt();\n\t\t\t\te[i][1] = in.nextInt();\n\t\t\t\tadj[e[i][0]][e[i][1]]++;\n\t\t\t\tadj[e[i][1]][e[i][0]]++;\n\t\t\t}\n\t\t\tint ans = 0;\n\t\t\tfor(int i = 1; i < 7; i++)\n\t\t\t{\n\t\t\t\tint c = 0;\n\t\t\t\tfor(int j = 1; j <= 7; j++)\n\t\t\t\t{\n\t\t\t\t\tif(adj[i][j] == 1 && adj[7][j] == 1)\n\t\t\t\t\t\tc++;\n\t\t\t\t}\n\t\t\t\tans = Math.max(ans, m - c);\n\t\t\t}\n\t\t\tout.println(ans);\n\t\t}\n\t\tout.flush();\n\t}\n}\n\nclass FastReader\n{\n\tBufferedReader br;\n\tStringTokenizer st;\n \n\tpublic FastReader()\n\t{\n\t br = new BufferedReader(new InputStreamReader(System.in));\n\t}\n \n\tpublic String next() throws IOException\n\t{\n\t if(st == null || !st.hasMoreElements())\n\t {\n\t st = new StringTokenizer(br.readLine());\n\t }\n\t return st.nextToken();\n\t}\n \n\tpublic int nextInt() throws IOException\n\t{\n\t return Integer.parseInt(next());\n\t}\n \n\tpublic long nextLong() throws IOException\n\t{\n\t return Long.parseLong(next());\n\t}\n\n\tpublic String nextLine() throws IOException\n\t{\n\t\treturn br.readLine();\n\t}\n}", "lang": "Java 8", "bug_code_uid": "433432179992b8aa76ec20e8eff65ba5", "src_uid": "11e6559cfb71b8f6ca88242094b17a2b", "apr_id": "5c8ec25a33609175b2d941f901ce48c8", "difficulty": 1700, "tags": ["graphs", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9956086026348384, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": " import java.io.BufferedWriter;\n import java.io.IOException;\n import java.io.InputStream;\n import java.io.OutputStream;\n import java.io.OutputStreamWriter;\n import java.io.PrintWriter;\n import java.io.Writer;\n import java.util.Arrays;\n import java.util.InputMismatchException;\n import java.util.*;\n import java.io.*;\n import java.math.*;\n public class Main7{\n \n static class Pair\n { \n int x;\n int y;\n public Pair(int x,int y) \n { \n this.x= x; \n this.y= y;\n } \n \n @Override\n public int hashCode() \n { \n final int temp = 14; \n int ans = 1; \n ans =x*31+y*13; \n return ans; \n } \n \n // Equal objects must produce the same \n // hash code as long as they are equal \n @Override\n public boolean equals(Object o) \n { \n if (this == o) { \n return true; \n } \n if (o == null) { \n return false; \n } \n if (this.getClass() != o.getClass()) { \n return false; \n } \n Pair other = (Pair)o; \n if (this.x != other.x || this.y!=other.y) { \n return false; \n } \n return true; \n } \n \n } \n static class Pair1\n {\n String x;\n int y;\n int z;\n \n }\n static class Compare\n { \n static void compare(Pair arr[], int n) \n { \n // Comparator to sort the pair according to second element \n /* Arrays.sort(arr, new Comparator() { \n @Override public int compare(Pair p1, Pair p2) \n { \n if(p1.start>p2.start)\n {\n return 1;\n }\n else if(p1.start==p2.start)\n {\n return 0;\n }\n else\n {\n return -1;\n }\n } \n }); */\n }\n \n }\n \n \n public static long pow(long a, long b)\n {\n long result=1;\n while(b>0)\n {\n if (b % 2 != 0)\n {\n result=(result*a)%998244353;\n b--;\n } \n a=(a*a)%998244353;\n b /= 2;\n } \n return result;\n }\n public static long fact(long num)\n {\n long value=1;\n int i=0;\n for(i=2;i arr=new ArrayList();\n arr=graph.get(parent);\n visited[parent]=true;\n for(int i=0;i> graph;\n \n public static void bfs(int num,int size)\n {\n boolean[] visited=new boolean[size+1];\n Queue q=new LinkedList<>();\n q.add(num);\n ans[num]=1;\n visited[num]=true;\n while(!q.isEmpty())\n {\n int x=q.poll();\n ArrayList al=graph.get(x);\n for(int i=0;i ar=new ArrayList<>();\n for(int i=0;i=0;i--)\n\t\t\t\t\t{\n\t\t\t\t\t\tfor(int j=6;j>=0;j--)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfor(int k=6;k>=0;k--)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfor(int l=6;l>=0;l--)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tfor(int m=6;m>=0;m--)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tfor(int n=6;n>=0;n--)\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tfor(int o=6;o>=0;o--)\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tint ans=0;\n\t\t\t\t\t\t\t\t\t\t\t\tint[] x=new int[]{i,j,k,l,m,n,o};\n\t\t\t\t\t\t\t\t\t\t\t\tHashMap,Integer> hash=new HashMap<>();\n\t\t\t\t\t\t\t\t\t\t\t\tfor(int p=0;p ar=new ArrayList<>();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tar.add(x[a[p]]);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tar.add(x[b[p]]);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tArrayList ar1=new ArrayList<>();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tar1.add(x[b[p]]);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tar1.add(x[a[p]]);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif(hash.containsKey(ar)==false && hash.containsKey(ar1)==false)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tans++;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\thash.put(ar,1);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tar.clear();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tar.add(x[b[p]]);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tar.add(x[a[p]]);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\thash.put(ar,1);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif(ans==m1)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpln(m1+\"\");\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tmax=Math.max(ans,max);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tpln(max+\"\");\n }\n \n /**/\n static InputReader in=new InputReader(System.in);\n static OutputWriter out=new OutputWriter(System.out);\n public static long l()\n {\n String s=in.String();\n return Long.parseLong(s);\n }\n public static void pln(String value)\n {\n System.out.println(value);\n }\n public static int i()\n {\n return in.Int();\n }\n public static String s()\n {\n return in.String();\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 class InputReader {\n \n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private SpaceCharFilter filter;\n \n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n \n public int read() {\n if (numChars== -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n \n public int Int() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n \n public String String() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n \n public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n \n public String next() {\n return String();\n }\n \n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n }\n \n class OutputWriter {\n private final PrintWriter writer;\n \n public OutputWriter(OutputStream outputStream) {\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }\n \n public OutputWriter(Writer writer) {\n this.writer = new PrintWriter(writer);\n }\n \n public void print(Object...objects) {\n for (int i = 0; i < objects.length; i++) {\n if (i != 0)\n writer.print(' ');\n writer.print(objects[i]);\n }\n }\n \n public void printLine(Object...objects) {\n print(objects);\n writer.println();\n }\n \n public void close() {\n writer.close();\n }\n \n public void flush() {\n writer.flush();\n }\n \n }\n \n class IOUtils {\n \n public static int[] readIntArray(InputReader in, int size) {\n int[] array = new int[size];\n for (int i = 0; i < size; i++)\n array[i] = in.Int();\n return array;\n }\n \n } \n ", "lang": "Java 8", "bug_code_uid": "11e4606393f615b62ba2f56599af4d22", "src_uid": "11e6559cfb71b8f6ca88242094b17a2b", "apr_id": "2064c47528b73ff0a9190b0b742338ab", "difficulty": 1700, "tags": ["graphs", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9994765572422044, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": " import java.io.BufferedWriter;\n import java.io.IOException;\n import java.io.InputStream;\n import java.io.OutputStream;\n import java.io.OutputStreamWriter;\n import java.io.PrintWriter;\n import java.io.Writer;\n import java.util.Arrays;\n import java.util.InputMismatchException;\n import java.util.*;\n import java.io.*;\n import java.math.*;\n public class Main7{\n \n static class Pair\n { \n int x;\n int y;\n public Pair(int x,int y) \n { \n this.x= x; \n this.y= y;\n } \n \n @Override\n public int hashCode() \n { \n final int temp = 14; \n int ans = 1; \n ans =x*31+y*13; \n return ans; \n } \n \n // Equal objects must produce the same \n // hash code as long as they are equal \n @Override\n public boolean equals(Object o) \n { \n if (this == o) { \n return true; \n } \n if (o == null) { \n return false; \n } \n if (this.getClass() != o.getClass()) { \n return false; \n } \n Pair other = (Pair)o; \n if (this.x != other.x || this.y!=other.y) { \n return false; \n } \n return true; \n } \n \n } \n static class Pair1\n {\n String x;\n int y;\n int z;\n \n }\n static class Compare\n { \n static void compare(Pair arr[], int n) \n { \n // Comparator to sort the pair according to second element \n /* Arrays.sort(arr, new Comparator() { \n @Override public int compare(Pair p1, Pair p2) \n { \n if(p1.start>p2.start)\n {\n return 1;\n }\n else if(p1.start==p2.start)\n {\n return 0;\n }\n else\n {\n return -1;\n }\n } \n }); */\n }\n \n }\n \n \n public static long pow(long a, long b)\n {\n long result=1;\n while(b>0)\n {\n if (b % 2 != 0)\n {\n result=(result*a)%998244353;\n b--;\n } \n a=(a*a)%998244353;\n b /= 2;\n } \n return result;\n }\n public static long fact(long num)\n {\n long value=1;\n int i=0;\n for(i=2;i arr=new ArrayList();\n arr=graph.get(parent);\n visited[parent]=true;\n for(int i=0;i> graph;\n \n public static void bfs(int num,int size)\n {\n boolean[] visited=new boolean[size+1];\n Queue q=new LinkedList<>();\n q.add(num);\n ans[num]=1;\n visited[num]=true;\n while(!q.isEmpty())\n {\n int x=q.poll();\n ArrayList al=graph.get(x);\n for(int i=0;i ar=new ArrayList<>();\n for(int i=0;i=0;i--)\n\t\t\t\t\t{\n\t\t\t\t\t\tfor(int j=6;j>=0;j--)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfor(int k=6;k>=0;k--)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfor(int l=6;l>=0;l--)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tfor(int m=6;m>=0;m--)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tfor(int n=6;n>=0;n--)\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tfor(int o=6;o>=0;o--)\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tint ans=0;\n\t\t\t\t\t\t\t\t\t\t\t\tint[] x=new int[]{i,j,k,l,m,n,o};\n\t\t\t\t\t\t\t\t\t\t\t\tHashMap,Integer> hash=new HashMap<>();\n\t\t\t\t\t\t\t\t\t\t\t\tfor(int p=0;p ar=new ArrayList<>();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tar.add(x[a[p]]);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tar.add(x[b[p]]);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tArrayList ar1=new ArrayList<>();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tar1.add(x[b[p]]);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tar1.add(x[a[p]]);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif(hash.containsKey(ar)==false && hash.containsKey(ar1)==false)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tans++;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\thash.put(ar,1);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tar.clear();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tar.add(x[b[p]]);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tar.add(x[a[p]]);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\thash.put(ar,1);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif(ans==m1)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpln(m1+\"\");\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif(c++==200000)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpln(max+\"\");\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn ;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tmax=Math.max(ans,max);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tpln(max+\"\");\n }\n \n /**/\n static InputReader in=new InputReader(System.in);\n static OutputWriter out=new OutputWriter(System.out);\n public static long l()\n {\n String s=in.String();\n return Long.parseLong(s);\n }\n public static void pln(String value)\n {\n System.out.println(value);\n }\n public static int i()\n {\n return in.Int();\n }\n public static String s()\n {\n return in.String();\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 class InputReader {\n \n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private SpaceCharFilter filter;\n \n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n \n public int read() {\n if (numChars== -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n \n public int Int() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n \n public String String() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n \n public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n \n public String next() {\n return String();\n }\n \n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n }\n \n class OutputWriter {\n private final PrintWriter writer;\n \n public OutputWriter(OutputStream outputStream) {\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }\n \n public OutputWriter(Writer writer) {\n this.writer = new PrintWriter(writer);\n }\n \n public void print(Object...objects) {\n for (int i = 0; i < objects.length; i++) {\n if (i != 0)\n writer.print(' ');\n writer.print(objects[i]);\n }\n }\n \n public void printLine(Object...objects) {\n print(objects);\n writer.println();\n }\n \n public void close() {\n writer.close();\n }\n \n public void flush() {\n writer.flush();\n }\n \n }\n \n class IOUtils {\n \n public static int[] readIntArray(InputReader in, int size) {\n int[] array = new int[size];\n for (int i = 0; i < size; i++)\n array[i] = in.Int();\n return array;\n }\n \n } \n ", "lang": "Java 8", "bug_code_uid": "4e07426be53e093754424e78b5cc914e", "src_uid": "11e6559cfb71b8f6ca88242094b17a2b", "apr_id": "2064c47528b73ff0a9190b0b742338ab", "difficulty": 1700, "tags": ["graphs", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9618320610687023, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package codeforces;\n\nimport java.util.Scanner;\n\npublic class d {\n\tpublic static void main(String[] args) {\n\t\tScanner input = new Scanner(System.in);\n\t\t\n\t\tint n = input.nextInt();\n\t\tif(n%2 == 0) System.out.println(\"white\\n1 2\");\n\t\telse\n\t\t\tSystem.out.println(\"black\");\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "5996d8527a627713c97677facdf16b23", "src_uid": "52e07d176aa1d370788f94ee2e61df93", "apr_id": "3c44de88c01894c51258b0ce89451fb2", "difficulty": 1700, "tags": ["math", "games", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.2713773681515617, "equal_cnt": 15, "replace_cnt": 13, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 16, "bug_source_code": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Pipeline {\n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n long n = scan.nextLong();\n int k = scan.nextInt();\n int[] a = new int[k];\n for (int i = 0; i < k; i++)\n a[i] = i + 1;\n long av = 1;\n int count = 0;\n while (av < n) {\n boolean found = false;\n for (int i = k - 1; i >= 0; i--)\n if (a[i] > 0 && av + a[i] - 1 <= n) {\n found = true;\n av += a[i];\n av--;\n a[i] = -1;\n count++;\n if(av == n)\n break;\n }\n if (!found)\n break;\n found = false;\n }\n if (av == n)\n System.out.println(count);\n else\n System.out.println(-1);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "b4700ca4559e55707d81664781305072", "src_uid": "83bcfe32db302fbae18e8a95d89cf411", "apr_id": "cd04bf4146594b5267902a5a09fd8ded", "difficulty": 1700, "tags": ["math", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.653281096963761, "equal_cnt": 8, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "\n\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc=new Scanner(System.in);\n while(sc.hasNext()){\n long a=sc.nextLong();int len=sc.nextInt();\n if(a==len){\n System.out.println(1);\n continue;}\n if(sum(2,len,len-1)a){\n l=mid;\n }else if(sum=0)){\nSystem.out.println(arr[2]-(arr[0]+arr[1])+1);\n}else {\n\tSystem.out.println(\"0\");\n}\n}\n}\n", "lang": "Java 8", "bug_code_uid": "8c39021081702de038c3c86db6675c78", "src_uid": "3dc56bc08606a39dd9ca40a43c452f09", "apr_id": "20ea997d82ce8351dfa6530ed7ae3a5d", "difficulty": 800, "tags": ["geometry", "math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9945862335653519, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*;\npublic class Q1064A\n{\n public static void main(String[] args)\n {\n int a[],max=0;\n Scanner sc=new Scanner(System.in);\n a=new int[3]; \n for(int i=0;i<3;i++)\n {\n a[i]=sc.nextInt();\n }\n for(int i=0;i<3;i++)\n {\n if(a[i]>a[i+1])\n {\n max=a[i+1];\n a[i+1]=a[i];\n a[i]=max;\n }\n }\n if(a[2]==(a[1]+1[0]))\n {\n System.out.println(0);\n }\n else\n {\n System.out.println((a[2]-(a[1]+a[0])+1));\n }\n sc.close();\n }\n}", "lang": "Java 8", "bug_code_uid": "91392821e5cefc6edd3914ab92a660de", "src_uid": "3dc56bc08606a39dd9ca40a43c452f09", "apr_id": "ee99864fb2d2632fdecd3c87daa7f182", "difficulty": 800, "tags": ["geometry", "math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.99880810488677, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\n\npublic class Finals {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint a = sc.nextInt();\n\t\tint b = sc.nextInt();\n\t\tint c = sc.nextInt();\n\t\tint s1 = Math.min(a, b);\n\t\tint s2 = Math.min(Math.max(a, b), c);\n\t\tint s3 = Math.max(Math.max(a, b), c);\n\t\tint result;\n\t\tif(s1+s2>s3)\n\t\t\tresult = 0;\n\t\telse\n\t\t\tresult = (s3+1)-(s1+s2);\n\t\tSystem.out.println(result);\n\t}\n\n}\n}", "lang": "Java 8", "bug_code_uid": "07537aff8427f04fcb58f3dded8e7f22", "src_uid": "3dc56bc08606a39dd9ca40a43c452f09", "apr_id": "ccea2cdc47dfb7603168524dea4ac476", "difficulty": 800, "tags": ["geometry", "math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9953051643192489, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.IOException;\n\nimport java.util.Arrays;\n\npublic class Main{\n public static void main(String[] args) throws IOException {\n \n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n String[] arr = br.readLine().split(\" \");\n int[] a = new int[3];\n a[0] = Integer.parseInt(arr[0]);\n a[1] = Integer.parseInt(arr[1]);\n a[2] = Integer.parseInt(arr[2]);\n\n System.out.println(1* totalInc(a));\n }\n\n public int totalInc(int[] a) {\n Arrays.sort(a);\n if (a[0] + a[1] > a[2]) {\n return 0;\n } else {\n return a[2] - (a[0] + a[1]) + 1;\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "9652b641e6ce339419d6335ebd41b509", "src_uid": "3dc56bc08606a39dd9ca40a43c452f09", "apr_id": "87059c9e5ee7d2dba65f8e01e1b31074", "difficulty": 800, "tags": ["geometry", "math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8257411424439624, "equal_cnt": 18, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 10, "fix_ops_cnt": 18, "bug_source_code": "public class Main {\n static long nCk(long n, long k) {\n if (n < k) {\n return 0;\n }\n if (k == 0) {\n return 1;\n }\n if (k == 1) {\n return n;\n }\n long x = n;\n for (int i = 1; i 0) {\n y *= k;\n }\n return x / y;\n }\n \n public static void main() {\n Scanner s new Scanner();\n int z = s.nextInt();\n long n = (long) z;\n System.out.println(6 * nCk(n - 3, 0) + 12 * nCk(n - 3, 1) + 8 * nCk(n - 3, 2) + 2 * nCk(n - 3, 3))\n \n }\n}", "lang": "Java 11", "bug_code_uid": "c97cb36916190c8b8bf19dfc4554c3e8", "src_uid": "1bd29d7a8793c22e81a1f6fd3991307a", "apr_id": "e7065cfadc5f121bcfe7aaac4dab7a41", "difficulty": 1200, "tags": ["dp", "math", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9759887005649718, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Scanner;\n\npublic class Seth {\n static long nCk(long n, long k) {\n if (n < k) {\n return 0;\n }\n if (k == 0) {\n return 1;\n }\n if (k == 1) {\n return n;\n }\n long x = n;\n for (int i = 1; i < k; i++) {\n x *= (n - i);\n }\n long y = 1;\n while (k > 0) {\n y *= k;\n }\n return x / y;\n }\n\n public static void main() {\n Scanner s = new Scanner(System.in);\n int z = s.nextInt();\n System.out.println(6 * nCk((long) z - 3, 0) + 12 * nCk((long) z - 3, 1) + 8 * nCk((long) z - 3, 2) + 2 * nCk((long) z - 3, 3));\n\n }\n}", "lang": "Java 11", "bug_code_uid": "82732b88cb7f5fb738c97d3362111463", "src_uid": "1bd29d7a8793c22e81a1f6fd3991307a", "apr_id": "e7065cfadc5f121bcfe7aaac4dab7a41", "difficulty": 1200, "tags": ["dp", "math", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9948615114676025, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\nimport java.util.Map.Entry;\nimport java.io.*;\nimport java.awt.Point;\nimport java.math.BigInteger;\n\nimport static java.lang.Math.*;\n\npublic class CodeforcesA implements Runnable {\n\n final boolean ONLINE_JUDGE = System.getProperty(\"ONLINE_JUDGE\") != null;\n\n BufferedReader in;\n PrintWriter out;\n StringTokenizer tok = new StringTokenizer(\"\");\n\n void init() throws FileNotFoundException {\n if (ONLINE_JUDGE) {\n in = new BufferedReader(new InputStreamReader(System.in));\n out = new PrintWriter(System.out);\n } else {\n in = new BufferedReader(new FileReader(\"input.txt\"));\n out = new PrintWriter(\"output.txt\");\n }\n }\n\n String readString() throws IOException {\n while (!tok.hasMoreTokens()) {\n try {\n tok = new StringTokenizer(in.readLine());\n } catch (Exception e) {\n return null;\n }\n }\n return tok.nextToken();\n }\n\n int readInt() throws IOException {\n return Integer.parseInt(readString());\n }\n\n int[] readIntArray(int n) throws IOException {\n int[] array = new int[n];\n for (int i = 0; i < n; i++)\n array[i] = readInt();\n return array;\n }\n\n long readLong() throws IOException {\n return Long.parseLong(readString());\n }\n\n double readDouble() throws IOException {\n return Double.parseDouble(readString());\n }\n\n public static void main(String[] args) {\n new Thread(null, new CodeforcesA(), \"\", 128 * (1L << 20)).start();\n }\n\n long timeBegin, timeEnd;\n\n void time() {\n timeEnd = System.currentTimeMillis();\n System.err.println(\"Time = \" + (timeEnd - timeBegin));\n }\n\n long memoryTotal, memoryFree;\n\n void memory() {\n memoryFree = Runtime.getRuntime().freeMemory();\n System.err.println(\"Memory = \" + ((memoryTotal - memoryFree) >> 10)\n + \" KB\");\n }\n\n void debug(Object... objects) {\n if (DEBUG) {\n for (Object o : objects) {\n System.err.println(o.toString());\n }\n }\n }\n\n public void run() {\n try {\n timeBegin = System.currentTimeMillis();\n memoryTotal = Runtime.getRuntime().freeMemory();\n init();\n solve();\n out.close();\n time();\n memory();\n } catch (Exception e) {\n e.printStackTrace(System.err);\n System.exit(-1);\n }\n }\n\n boolean DEBUG = false;\n\n void solve() throws IOException {\n\n long[] fact = new long[12];\n fact[1] = 1;\n\n int n = readInt();\n\n for (int i = 2; i < 10; i++) {\n fact[i] = fact[i - 1] * i;\n }\n\n int[] primes = new int[] { 2, 3, 5, 7 };\n\n char[] num = readString().toCharArray();\n ArrayList s = new ArrayList();\n for (int i = 0; i < num.length; i++) {\n long curFac = fact[num[i] - '0'];\n for (int prime : primes) {\n while (curFac % prime == 0) {\n curFac /= prime;\n s.add(prime);\n }\n }\n }\n\n int a2 = 0, a3 = 0, a5 = 0, a7 = 0;\n for (int x : s) {\n if (x == 2)\n a2++;\n if (x == 3)\n a3++;\n if (x == 5)\n a5++;\n if (x == 7)\n a7++;\n }\n \n while (a7 > 0) {\n a7--;\n a5--;\n a3 -= 2;\n a2 -= 4;\n out.print(7);\n }\n \n while (a5 > 0) {\n a5--;\n a3 --;\n a2 -= 3;\n out.print(5);\n }\n\n while (a3 > 0) {\n a3 --;\n a2 --;\n out.print(3);\n }\n \n while (a2 > 0) {\n a2 --;\n out.print(2);\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "dd8dc99f3fbf4bf81b095f76625960e0", "src_uid": "60dbfc7a65702ae8bd4a587db1e06398", "apr_id": "fd4a72a0bb2df2e15d79ebe0948ebe60", "difficulty": 1400, "tags": ["dp", "greedy", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9754833565876021, "equal_cnt": 35, "replace_cnt": 28, "delete_cnt": 5, "insert_cnt": 1, "fix_ops_cnt": 34, "bug_source_code": "import java.io.OutputStreamWriter;\nimport java.io.BufferedWriter;\nimport java.util.Comparator;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.io.Writer;\nimport java.io.IOException;\nimport java.util.Arrays;\nimport java.util.InputMismatchException;\nimport java.util.NoSuchElementException;\nimport java.math.BigInteger;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n * @author Egor Kulikov (egor@egork.net)\n */\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tInputReader in = new InputReader(inputStream);\n\t\tOutputWriter out = new OutputWriter(outputStream);\n\t\tTaskC solver = new TaskC();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass TaskC {\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n\t\tint count = in.readInt();\n\t\tint repeats = in.readInt();\n\t\tint[] openCost = IOUtils.readIntArray(in, count);\n\t\tint[] closeCost = IOUtils.readIntArray(in, count);\n\t\tint[][][] answer = new int[count + 1][2 * count + 1][count + 1];\n\t\tArrayUtils.fill(answer, Integer.MAX_VALUE);\n\t\tanswer[0][count][0] = 0;\n\t\tfor (int i = 0; i < count; i++) {\n\t\t\tfor (int j = 0; j <= 2 * count; j++) {\n\t\t\t\tfor (int k = 0; k < count; k++) {\n\t\t\t\t\tif (answer[i][j][k] == Integer.MAX_VALUE)\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tanswer[i + 1][j + 1][k] = Math.min(answer[i + 1][j + 1][k], answer[i][j][k] + openCost[i]);\n\t\t\t\t\tanswer[i + 1][j - 1][Math.max(k, count - j + 1)] = Math.min(answer[i + 1][j - 1][Math.max(k, count - j + 1)], answer[i][j][k] + closeCost[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint[][] delta = answer[count];\n\t\tint[][] matrix = new int[count * count + 1][count * count + 1];\n\t\tArrayUtils.fill(matrix, Integer.MAX_VALUE / 2);\n\t\tfor (int i = 0; i < matrix.length; i++) {\n\t\t\tfor (int j = Math.max(0, count - i); j <= 2 * count && i + j - count < matrix.length; j++) {\n\t\t\t\tfor (int k = 0; k <= i && k <= count; k++)\n\t\t\t\t\tmatrix[i][i + j - count] = Math.min(matrix[i][i + j - count], delta[j][k]);\n\t\t\t}\n\t\t}\n\t\tint[][] result = new int[matrix.length][matrix.length];\n\t\tint[][] temp = new int[matrix.length][matrix.length];\n\t\tpower(repeats, result, temp, matrix);\n\t\tout.printLine(result[0][0]);\n }\n\n\tprivate void power(int exponent, int[][] result, int[][] temp, int[][] matrix) {\n\t\tif (exponent == 1) {\n\t\t\tfor (int i = 0; i < matrix.length; i++)\n\t\t\t\tSystem.arraycopy(matrix[i], 0, result[i], 0, matrix.length);\n\t\t\treturn;\n\t\t}\n\t\tif ((exponent & 1) == 0) {\n\t\t\tpower(exponent >> 1, temp, result, matrix);\n\t\t\tmultiply(result, temp, temp);\n\t\t} else {\n\t\t\tpower(exponent - 1, temp, result, matrix);\n\t\t\tmultiply(result, temp, matrix);\n\t\t}\n\t}\n\n\tprivate void multiply(int[][] a, int[][] b, int[][] c) {\n\t\tArrayUtils.fill(a, Integer.MAX_VALUE / 2);\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\tfor (int j = 0; j < a.length; j++) {\n\t\t\t\tfor (int k = 0; k < a.length; k++)\n\t\t\t\t\ta[i][k] = Math.min(a[i][k], b[i][j] + c[j][k]);\n\t\t\t}\n\t\t}\n\t}\n\n\t}\n\nclass InputReader {\n\n\tprivate InputStream stream;\n\tprivate byte[] buf = new byte[1024];\n\tprivate int curChar;\n\tprivate int numChars;\n\tprivate SpaceCharFilter filter;\n\n\tpublic InputReader(InputStream stream) {\n\t\tthis.stream = stream;\n\t}\n\n\tpublic int read() {\n\t\tif (numChars == -1)\n\t\t\tthrow new InputMismatchException();\n\t\tif (curChar >= numChars) {\n\t\t\tcurChar = 0;\n\t\t\ttry {\n\t\t\t\tnumChars = stream.read(buf);\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t\tif (numChars <= 0)\n\t\t\t\treturn -1;\n\t\t}\n\t\treturn buf[curChar++];\n\t}\n\n\tpublic int readInt() {\n\t\tint c = read();\n\t\twhile (isSpaceChar(c))\n\t\t\tc = read();\n\t\tint sgn = 1;\n\t\tif (c == '-') {\n\t\t\tsgn = -1;\n\t\t\tc = read();\n\t\t}\n\t\tint res = 0;\n\t\tdo {\n\t\t\tif (c < '0' || c > '9')\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tres *= 10;\n\t\t\tres += c - '0';\n\t\t\tc = read();\n\t\t} while (!isSpaceChar(c));\n\t\treturn res * sgn;\n\t}\n\n\tpublic boolean isSpaceChar(int c) {\n\t\tif (filter != null)\n\t\t\treturn filter.isSpaceChar(c);\n\t\treturn isWhitespace(c);\n\t}\n\n\tpublic static boolean isWhitespace(int c) {\n\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t}\n\n\tpublic interface SpaceCharFilter {\n\t\tpublic boolean isSpaceChar(int ch);\n\t}\n}\n\nclass OutputWriter {\n\tprivate final PrintWriter writer;\n\n\tpublic OutputWriter(OutputStream outputStream) {\n\t\twriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n\t}\n\n\tpublic OutputWriter(Writer writer) {\n\t\tthis.writer = new PrintWriter(writer);\n\t}\n\n\tpublic void close() {\n\t\twriter.close();\n\t}\n\n\tpublic void printLine(int i) {\n\t\twriter.println(i);\n\t}\n}\n\nclass IOUtils {\n\n\tpublic static int[] readIntArray(InputReader in, int size) {\n\t\tint[] array = new int[size];\n\t\tfor (int i = 0; i < size; i++)\n\t\t\tarray[i] = in.readInt();\n\t\treturn array;\n\t}\n\n\t}\n\nclass ArrayUtils {\n\n\tpublic static void fill(int[][] array, int value) {\n\t\tfor (int[] row : array)\n\t\t\tArrays.fill(row, value);\n\t}\n\n\tpublic static void fill(int[][][] array, int value) {\n\t\tfor (int[][] subArray : array)\n\t\t\tfill(subArray, value);\n\t}\n\n\t}\n\n", "lang": "Java 7", "bug_code_uid": "7d3024c27585e66c2674b3735d6f076f", "src_uid": "f40900973f4ebeb6fdafd75ebe4e9601", "apr_id": "4952238723ba4f100f89b8918aac9dd6", "difficulty": 2500, "tags": ["matrices", "dp"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.976261719529224, "equal_cnt": 35, "replace_cnt": 28, "delete_cnt": 5, "insert_cnt": 1, "fix_ops_cnt": 34, "bug_source_code": "import java.io.OutputStreamWriter;\nimport java.io.BufferedWriter;\nimport java.util.Comparator;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.io.Writer;\nimport java.io.IOException;\nimport java.util.Arrays;\nimport java.util.InputMismatchException;\nimport java.util.NoSuchElementException;\nimport java.math.BigInteger;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n * @author Egor Kulikov (egor@egork.net)\n */\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tInputReader in = new InputReader(inputStream);\n\t\tOutputWriter out = new OutputWriter(outputStream);\n\t\tTaskC solver = new TaskC();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass TaskC {\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n\t\tint count = in.readInt();\n\t\tint repeats = in.readInt();\n\t\tint[] openCost = IOUtils.readIntArray(in, count);\n\t\tint[] closeCost = IOUtils.readIntArray(in, count);\n\t\tint[][][] answer = new int[count + 1][2 * count + 1][count + 1];\n\t\tArrayUtils.fill(answer, Integer.MAX_VALUE);\n\t\tanswer[0][count][0] = 0;\n\t\tfor (int i = 0; i < count; i++) {\n\t\t\tfor (int j = 0; j <= 2 * count; j++) {\n\t\t\t\tfor (int k = 0; k < count; k++) {\n\t\t\t\t\tif (answer[i][j][k] == Integer.MAX_VALUE)\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tanswer[i + 1][j + 1][k] = Math.min(answer[i + 1][j + 1][k], answer[i][j][k] + openCost[i]);\n\t\t\t\t\tanswer[i + 1][j - 1][Math.max(k, count - j + 1)] = Math.min(answer[i + 1][j - 1][Math.max(k, count - j + 1)], answer[i][j][k] + closeCost[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint[][] delta = answer[count];\n\t\tint[][] matrix = new int[2 * count + 1][2 * count + 1];\n\t\tArrayUtils.fill(matrix, Integer.MAX_VALUE / 2);\n\t\tfor (int i = 0; i < matrix.length; i++) {\n\t\t\tfor (int j = Math.max(0, count - i); j <= 2 * count && i + j - count < matrix.length; j++) {\n\t\t\t\tfor (int k = 0; k <= i && k <= count; k++)\n\t\t\t\t\tmatrix[i][i + j - count] = Math.min(matrix[i][i + j - count], delta[j][k]);\n\t\t\t}\n\t\t}\n\t\tint[][] result = new int[matrix.length][matrix.length];\n\t\tint[][] temp = new int[matrix.length][matrix.length];\n\t\tpower(repeats, result, temp, matrix);\n\t\tout.printLine(result[0][0]);\n }\n\n\tprivate void power(int exponent, int[][] result, int[][] temp, int[][] matrix) {\n\t\tif (exponent == 1) {\n\t\t\tfor (int i = 0; i < matrix.length; i++)\n\t\t\t\tSystem.arraycopy(matrix[i], 0, result[i], 0, matrix.length);\n\t\t\treturn;\n\t\t}\n\t\tif ((exponent & 1) == 0) {\n\t\t\tpower(exponent >> 1, temp, result, matrix);\n\t\t\tmultiply(result, temp, temp);\n\t\t} else {\n\t\t\tpower(exponent - 1, temp, result, matrix);\n\t\t\tmultiply(result, temp, matrix);\n\t\t}\n\t}\n\n\tprivate void multiply(int[][] a, int[][] b, int[][] c) {\n\t\tArrayUtils.fill(a, Integer.MAX_VALUE / 2);\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\tfor (int j = 0; j < a.length; j++) {\n\t\t\t\tfor (int k = 0; k < a.length; k++)\n\t\t\t\t\ta[i][k] = Math.min(a[i][k], b[i][j] + c[j][k]);\n\t\t\t}\n\t\t}\n\t}\n\n\t}\n\nclass InputReader {\n\n\tprivate InputStream stream;\n\tprivate byte[] buf = new byte[1024];\n\tprivate int curChar;\n\tprivate int numChars;\n\tprivate SpaceCharFilter filter;\n\n\tpublic InputReader(InputStream stream) {\n\t\tthis.stream = stream;\n\t}\n\n\tpublic int read() {\n\t\tif (numChars == -1)\n\t\t\tthrow new InputMismatchException();\n\t\tif (curChar >= numChars) {\n\t\t\tcurChar = 0;\n\t\t\ttry {\n\t\t\t\tnumChars = stream.read(buf);\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t\tif (numChars <= 0)\n\t\t\t\treturn -1;\n\t\t}\n\t\treturn buf[curChar++];\n\t}\n\n\tpublic int readInt() {\n\t\tint c = read();\n\t\twhile (isSpaceChar(c))\n\t\t\tc = read();\n\t\tint sgn = 1;\n\t\tif (c == '-') {\n\t\t\tsgn = -1;\n\t\t\tc = read();\n\t\t}\n\t\tint res = 0;\n\t\tdo {\n\t\t\tif (c < '0' || c > '9')\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tres *= 10;\n\t\t\tres += c - '0';\n\t\t\tc = read();\n\t\t} while (!isSpaceChar(c));\n\t\treturn res * sgn;\n\t}\n\n\tpublic boolean isSpaceChar(int c) {\n\t\tif (filter != null)\n\t\t\treturn filter.isSpaceChar(c);\n\t\treturn isWhitespace(c);\n\t}\n\n\tpublic static boolean isWhitespace(int c) {\n\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t}\n\n\tpublic interface SpaceCharFilter {\n\t\tpublic boolean isSpaceChar(int ch);\n\t}\n}\n\nclass OutputWriter {\n\tprivate final PrintWriter writer;\n\n\tpublic OutputWriter(OutputStream outputStream) {\n\t\twriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n\t}\n\n\tpublic OutputWriter(Writer writer) {\n\t\tthis.writer = new PrintWriter(writer);\n\t}\n\n\tpublic void close() {\n\t\twriter.close();\n\t}\n\n\tpublic void printLine(int i) {\n\t\twriter.println(i);\n\t}\n}\n\nclass IOUtils {\n\n\tpublic static int[] readIntArray(InputReader in, int size) {\n\t\tint[] array = new int[size];\n\t\tfor (int i = 0; i < size; i++)\n\t\t\tarray[i] = in.readInt();\n\t\treturn array;\n\t}\n\n\t}\n\nclass ArrayUtils {\n\n\tpublic static void fill(int[][] array, int value) {\n\t\tfor (int[] row : array)\n\t\t\tArrays.fill(row, value);\n\t}\n\n\tpublic static void fill(int[][][] array, int value) {\n\t\tfor (int[][] subArray : array)\n\t\t\tfill(subArray, value);\n\t}\n\n\t}\n\n", "lang": "Java 7", "bug_code_uid": "8d92da0f820bc9386d806191473e2d24", "src_uid": "f40900973f4ebeb6fdafd75ebe4e9601", "apr_id": "4952238723ba4f100f89b8918aac9dd6", "difficulty": 2500, "tags": ["matrices", "dp"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9956584659913169, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "\n\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\n\npublic class C {\n\tstatic int[] openCost, closedCost;\n\tstatic int[][][] dp;\n\tstatic int inf = 10000000;\n\n\tpublic static int solve(int curCost, int endCost, int remMoves) {\n\t\tif (remMoves == openCost.length) {\n\t\t\tif (curCost == endCost) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\treturn inf;\n\t\t}\n\t\tif (dp[curCost][endCost][remMoves] != -1) {\n\t\t\treturn dp[curCost][endCost][remMoves];\n\t\t}\n\t\tint min = Integer.MAX_VALUE;\n\t\tif (curCost > 0) {\n\t\t\tif (curCost < 2 * openCost.length) {\n\t\t\t\tmin = Math.min(\n\t\t\t\t\t\topenCost[remMoves]\n\t\t\t\t\t\t\t\t+ solve(curCost + 1, endCost, remMoves + 1),\n\t\t\t\t\t\tclosedCost[remMoves]\n\t\t\t\t\t\t\t\t+ solve(curCost - 1, endCost, remMoves + 1));\n\t\t\t} else {\n\t\t\t\tmin = Math.min(\n\t\t\t\t\t\tmin,\n\t\t\t\t\t\tclosedCost[remMoves]\n\t\t\t\t\t\t\t\t+ solve(curCost - 1, endCost, remMoves + 1));\n\t\t\t}\n\t\t} else {\n\t\t\tmin = Math.min(\n\t\t\t\t\tmin,\n\t\t\t\t\topenCost[remMoves]\n\t\t\t\t\t\t\t+ solve(curCost + 1, endCost, remMoves + 1));\n\t\t}\n\t\treturn dp[curCost][endCost][remMoves] = min;\n\t}\n\n\tpublic static int[][] getOpt(int[][] mat1, int[][] mat2) {\n\t\tint[][] res = new int[mat1.length][mat2.length];\n\t\tfor (int i = 0; i < mat1.length; i++) {\n\t\t\tfor (int j = 0; j < mat1.length; j++) {\n\t\t\t\tres[i][j] = Integer.MAX_VALUE;\n\t\t\t\tfor (int k = 0; k < mat1.length; k++) {\n\t\t\t\t\tres[i][j] = Math.min(res[i][j], mat1[i][k] + mat2[k][j]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn res;\n\t}\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tint n = nextInt();\n\t\tint m = nextInt();\n\t\topenCost = new int[n];\n\t\tclosedCost = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\topenCost[i] = nextInt();\n\t\t}\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tclosedCost[i] = nextInt();\n\t\t}\n\t\tdp = new int[2 * n + 1][2 * n + 1][n];\n\t\tfor (int i = 0; i < dp.length; i++) {\n\t\t\tfor (int j = 0; j < dp[0].length; j++) {\n\t\t\t\tArrays.fill(dp[i][j], -1);\n\t\t\t}\n\t\t}\n\t\tint[][] costMatrix = new int[2 * n + 1][2 * n + 1];\n\t\tfor (int i = 0; i <= 2 * n; i++) {\n\t\t\tfor (int j = 0; j <= 2 * n; j++) {\n\t\t\t\tcostMatrix[i][j] = solve(i, j, 0);\n\t\t\t}\n\t\t}\n//\t\tfor(int i=0;i 0) {\n\t\t\tif ((m & 1) == 1) {\n\t\t\t\tres = getOpt(res, costMatrix);\n\t\t\t}\n\t\t\tcostMatrix = getOpt(costMatrix, costMatrix);\n\t\t\tm >>= 1;\n\t\t}\n\t\tSystem.out.println(res[0][0]);\n\t}\n\n\tstatic BufferedReader br = new BufferedReader(new InputStreamReader(\n\t\t\tSystem.in));\n\tstatic StringTokenizer tokenizer = new StringTokenizer(\"\");\n\n\tstatic int nextInt() throws Exception {\n\t\treturn Integer.parseInt(next());\n\t}\n\n\tstatic double nextDouble() throws Exception {\n\t\treturn Double.parseDouble(next());\n\t}\n\n\tstatic String next() throws Exception {\n\t\twhile (true) {\n\t\t\tif (tokenizer.hasMoreTokens()) {\n\t\t\t\treturn tokenizer.nextToken();\n\t\t\t}\n\t\t\tString s = br.readLine();\n\t\t\tif (s == null) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\ttokenizer = new StringTokenizer(s);\n\t\t}\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "7f51bd0cdfe48322aacc32eccfead89b", "src_uid": "f40900973f4ebeb6fdafd75ebe4e9601", "apr_id": "59048212b08128f5e7f5505345067eb3", "difficulty": 2500, "tags": ["matrices", "dp"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9876815591101306, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "\nimport java.io.BufferedReader;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\n/**\n * 4:41 ~ \n *\n */\npublic class Main {\n\t\n\tpublic static void main(String[] argv) {\n\t\tFastScanner scan = new FastScanner(System.in);\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\t\n\t\tint n = scan.nextInt();\n\t\tint t = scan.nextInt();\n\t\tint dp[][][][] = new int[n+2][4 * 4 + 5][n+1][n+1];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tif(i == 0){\n\t\t\t\tfor(int j = 0; j < 4; j++){\n\t\t\t\t\tdp[i+1][j][0][0] = 1;\n\t\t\t\t}\n\t\t\t} else if(i == 1){\n\t\t\t\tfor(int state = 0; state < 4; state++){\n\t\t\t\t\tfor(int j = 0; j < 4; j++){\n\t\t\t\t\t\tif(state == j) continue;\n\t\t\t\t\t\tdp[i+1][state * 4 + j][0][0] += dp[i][state][0][0];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\t\t\t\n\t\t\t\tfor(int state = 0; state < 16; state++){\n\t\t\t\t\tint first = state / 4;\n\t\t\t\t\tint second = state % 4;\n\t\t\t\t\tif(first == second) continue;\n\t\t\t\t\tfor(int c = 0; c <= i/2; c++){\n\t\t\t\t\t\tfor(int d = 0; d <= i/2; d++){\n\t\t\t\t\t\t\tfor(int j = 0; j < 4; j++){\n\t\t\t\t\t\t\t\tif(second == j) continue;\n\t\t\t\t\t\t\t\tif(first < second){\n\t\t\t\t\t\t\t\t\tif(second < j){\n\t\t\t\t\t\t\t\t\t\tdp[i+1][second * 4 + j][c][d] += dp[i][state][c][d];\n\t\t\t\t\t\t\t\t\t} else if(second > j){\n\t\t\t\t\t\t\t\t\t\tdp[i+1][second * 4 + j][c+1][d] += dp[i][state][c][d];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else if(first > second){\n\t\t\t\t\t\t\t\t\tif(second < j){\n\t\t\t\t\t\t\t\t\t\tdp[i+1][second * 4 + j][c][d+1] += dp[i][state][c][d];\n\t\t\t\t\t\t\t\t\t} else if(second > j){\n\t\t\t\t\t\t\t\t\t\tdp[i+1][second * 4 + j][c][d] += dp[i][state][c][d];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\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\t/*\n\t\tfor(int i = 0; i <= n+1; i++)\n\t\t\tfor(int state = 0; state < 16; state++)\n\t\t\t\tfor(int c = 0; c <= i / 2; c++)\n\t\t\t\t\tfor(int d = 0; d <= i / 2; d++)\n\t\t\t\t\t\tSystem.out.println(i + \", (\" + (state / 4) + \",\" + (state % 4) + \"), \" + c + \",\" + d + \" => \" + dp[i][state][c][d]);\n\t\t*/\n\t\tint ret = 0;\n\t\tfor(int state = 0; state < 16; state++){\n\t\t\tint first = state / 4;\n\t\t\tint second = state % 4;\n\t\t\tif(first == second) continue;\n\t\t\tret += dp[n][state][t][t-1];\n\t\t}\n\t\tout.println(ret);\n\t\tout.close();\t\t\n\t}\n\n\tstatic class FastScanner {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tFastScanner(InputStream is) {\n\t\t\ttry {\n\t\t\t\tbr = new BufferedReader(new InputStreamReader(is));\n\t\t\t} catch (Exception e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\n\t\tString next() {\n\t\t\twhile (st == null || !st.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tint nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tdouble nextDouble() {\n\t\t\treturn Double.valueOf(next());\n\t\t}\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "0ee94c8d3f349868da666831fee4b7a1", "src_uid": "6d67559744583229455c5eafe68f7952", "apr_id": "b19567f6b1e998eb2454ae5baca0a048", "difficulty": 1900, "tags": ["dp"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.999697428139183, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*;\nimport java.math.*;\nimport java.util.*;\n\npublic class Camels {\n static Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System. in )));\n\n static int n, t, wise[][][][][];\n static boolean done[][][][][];\n public static void main(String[] args) {\n n = in .nextInt();\n t = in .nextInt();\n wise = new int[n][t + 1][t][4][4];\n done = new boolean[n][t + 1][t][4][4];\n int ans = 0;\n for (int i = 0; i < 4; i++)\n for (int j = 0; j < i; j++) ans += remember(1, 0, 0, i, j);\n System.out.println(ans);\n }\n\n static int remember(int x, int h, int v, int y, int yprev) {\n if (done[x][h][v][y][yprev]) return wise[x][h][v][y][yprev];\n int ans = 0;\n if (x == n - 2) {\n if (v == t - 1) {\n for (int ynext = 0; ynext < y; ynext++) {\n if (ynext < y && yprev < y) a{\n if (h < t) ans++;\n } else {\n if (h == t) ans++;\n }\n }\n }\n } else {\n for (int ynext = 0; ynext < 4; ynext++)\n if (ynext != y) {\n if (ynext < y && yprev < y) {\n if (h < t) ans += remember(x + 1, h + 1, v, ynext, y);\n } else if (ynext > y && yprev > y) {\n if (v < t - 1) ans += remember(x + 1, h, v + 1, ynext, y);\n } else ans += remember(x + 1, h, v, ynext, y);\n }\n }\n done[x][h][v][y][yprev] = true;\n return wise[x][h][v][y][yprev] = ans;\n }\n}", "lang": "Java 7", "bug_code_uid": "4d01e9bfbb50faced0484130a9e226e1", "src_uid": "6d67559744583229455c5eafe68f7952", "apr_id": "6cf793da514f091fec23b5c4ff2959b1", "difficulty": 1900, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9801202034211743, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Scanner;\nimport java.io.OutputStream;\nimport java.io.IOException;\nimport java.util.Arrays;\nimport java.io.PrintWriter;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n * @author codeKNIGHT\n */\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tScanner in = new Scanner(inputStream);\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\tTaskC solver = new TaskC();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass TaskC {\n\tpublic void solve(int testNumber, Scanner in, PrintWriter out) {\n int n=in.nextInt(),m=in.nextInt(),k=in.nextInt(),i,j,x,y,max=0;\n String s;\n int a[][][]=new int[n][m][3];\n for(i=0;i0&&xmax)\n max=count;\n \n\n }\n }\n out.println(max);\n\t}\n class items implements Comparable\n {\n int index,p;\n public items(int p,int index)\n {\n this.p=p;\n this.index=index;\n }\n public int compareTo(items a)\n {\n if(a.p>this.p)\n return 1;\n return -1;\n }\n }\n}\n\n", "lang": "Java 6", "bug_code_uid": "9ec2861c8ef89dda7f12e7a7aed736a5", "src_uid": "7419c4268a9815282fadca6581f28ec1", "apr_id": "1d59c7e27024362e7a0fe050dcd5f093", "difficulty": 1200, "tags": ["games", "greedy", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9805091487669053, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 6, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Queue;\nimport java.util.Set;\n\n\npublic class Main {\n\t\n\tpublic static class Goods{\n\t\tint[]buy = null;\n\t\tint[]sell = null;\n\t\tint[]rem = null;\n\t\tpublic Goods(int[]buyi, int[]selli, int[]remi){\n\t\t\tbuy = buyi;\n\t\t\tsell = selli;\n\t\t\trem = remi;\n\t\t}\n\t\tpublic Goods clone(){\n\t\t\tint[]buyi = new int[buy.length];\n\t\t\tint[]selli = new int[buy.length];\n\t\t\tint[]remi = new int[buy.length];\n\t\t\tfor(int i = 0; i < buy.length; i++){\n\t\t\t\tbuyi[i] = buy[i];\n\t\t\t\tselli[i] = sell[i];\n\t\t\t\tremi[i] = rem[i];\n\t\t\t}\n\t\t\treturn new Goods(buyi, selli, remi);\n\t\t}\n\t}\n\n\t/**\n\t * @param args\n\t * @throws IOException \n\t */\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tString[]parts = br.readLine().split(\"\\\\s+\");\n\t\tint n = Integer.parseInt(parts[0]);\n\t\tint m = Integer.parseInt(parts[1]);\n\t\tint k = Integer.parseInt(parts[2]);\n\n\t\tMap map = new HashMap();\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tString name = br.readLine();\n\t\t\tint[]buy = new int[m];\n\t\t\tint[]sell = new int[m];\n\t\t\tint[]rem = new int[m];\n\t\t\tfor(int j = 0; j < m; j++){\n\t\t\t\tparts = br.readLine().split(\"\\\\s+\");\n\t\t\t\tbuy[j] = Integer.parseInt(parts[0]);\n\t\t\t\tsell[j] = Integer.parseInt(parts[1]);\n\t\t\t\trem[j] = Integer.parseInt(parts[2]);\n\t\t\t}\n\t\t\tGoods g = new Goods(buy, sell, rem);\n\t\t\tmap.put(i, g);\n\t\t}\t\t\n\t\tint max = 0;\n\t\tfor(int i = 0; i < n; i++){\t\t\t\n\t\t\tfor(int j = 0; j < n; j++){\n\t\t\t\tif(i == j)continue;\n\t\t\t\tSet used = new HashSet();\n\t\t\t\tint prods = k;\n\t\t\t\tGoods buyFrom = map.get(i).clone();\n\t\t\t\tGoods sellTo = map.get(j).clone();\n\t\t\t\tint profit = 0;\n\t\t\t\twhile(prods>0&&used.size()!=m){\n\t\t\t\t\tint maxPrice = Integer.MIN_VALUE;\n\t\t\t\t\tint idx = -1;\n\t\t\t\t\tfor(int l = 0; l < m; l++){\n\t\t\t\t\t\tif(used.contains(l))continue;\n\t\t\t\t\t\tif(maxPrice < sellTo.sell[l]-buyFrom.buy[l]){\n\t\t\t\t\t\t\tmaxPrice = sellTo.sell[l]-buyFrom.buy[l];\n\t\t\t\t\t\t\tidx = l;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tint numToBuy = Math.min(buyFrom.rem[idx],prods);\n\t\t\t\t\tprofit += numToBuy*maxPrice;\n\t\t\t\t\tbuyFrom.rem[idx] -= numToBuy;\n\t\t\t\t\tif(buyFrom.rem[idx] == 0){\n\t\t\t\t\t\tused.add(idx);\n\t\t\t\t\t}\n\t\t\t\t\tprods -= numToBuy;\n\t\t\t\t}\n\t\t\t\tif(profit > max)max = profit;\n\t\t\t} \n\t\t}\n\t\tSystem.out.println(max);\n\t\t\n\t}\n}\n", "lang": "Java 6", "bug_code_uid": "803d1e6eea9dec476b6146613cc7b24f", "src_uid": "7419c4268a9815282fadca6581f28ec1", "apr_id": "7c350c8b84c52dced8c0aa6ed38ce3fa", "difficulty": 1200, "tags": ["games", "greedy", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9930579659840333, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.Hashtable;\nimport java.util.Vector;\nimport java.util.PriorityQueue;\n\npublic class Main {\n\n /**\n * @param args\n * @throws IOException \n */\n public static class Product{\n public int a;\n public int b;\n public int c;\n Product(int a,int b,int c){\n this.a=a;\n this.b=b;\n this.c=c;\n }\n }\n public static class Profit{\n public int dif;\n public int c;\n Profit(int d,int c){\n this.dif=d;\n this.c=c;\n }\n }\n public static void main(String[] args) throws IOException {\n // TODO Auto-generated method stub\n BufferedReader in=new BufferedReader(new InputStreamReader(System.in));\n //Scanner in=new Scanner(System.in);\n PrintWriter out=new PrintWriter(System.out);\n String[] cur=in.readLine().split(\" \");\n int n=Integer.parseInt(cur[0]);\n int m=Integer.parseInt(cur[1]);\n int k=Integer.parseInt(cur[2]);\n Vector> vect=new Vector>();\n Vector names=new Vector();\n for(int i=0; i());\n for(int j=0; j f=vect.get(i);\n Vector s=vect.get(j);\n PriorityQueue ch=new PriorityQueue(m,new Comparator(){\n public int compare(Profit a,Profit b){\n if(a.dif>b.dif) return -1;\n else if(a.dif0 && !ch.isEmpty()){\n Profit curProf=ch.poll();\n int step=Math.min(curK,curProf.c);\n if(curProf.dif>0) curProfit+=step*curProf.dif;\n else break;\n curK-=curProf.c;\n }\n if(curProfit>maxProfit) maxProfit=curProfit;\n }\n }\n out.println(maxProfit);\n out.close();\n }\n\n}", "lang": "Java 6", "bug_code_uid": "83cd6174af65cf1f8037f0a161d101b4", "src_uid": "7419c4268a9815282fadca6581f28ec1", "apr_id": "f2e032b7f3aefa8e3adfc0c4975aff1c", "difficulty": 1200, "tags": ["games", "greedy", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9993041057759221, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\npublic class C {\n\tScanner sc = new Scanner(System.in);\n\tclass Data {\n\t\tint a, b, c;\n\t\tData() {}\n\t\tData(int a, int b, int c) {\n\t\t\tthis.a = a; this.b = b; this.c = c;\n\t\t}\n\t}\n\tclass Diff implements Comparable{\n\t\tint d; int idx;\n\t\tDiff() { }\n\t\tDiff(int d, int idx) { this.d = d; this.idx = idx; }\n\t\tpublic int compareTo(Diff other) { // \u5927\u304d\u3044\u9806\u306b\u4e26\u3073\u66ff\u3048\u308b\n\t\t\tif(d > other.d) return -1;\n\t\t\tif(d < other.d) return +1;\n\t\t\treturn 0;\n\t\t}\n\t}\n\tvoid doIt()\n\t{\n\t\tint n = sc.nextInt(), m = sc.nextInt(), k = sc.nextInt();\n\t\tData [][] data = new Data[n][m];\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tString name = sc.next();\n\t\t\tfor(int j = 0; j < m; j++) {\n\t\t\t\tint a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt();\n\t\t\t\tdata[i][j] = new Data(a, b, c);\n\t\t\t}\n\t\t}\n\t\tint ans = 0;\n\t\tfor(int from = 0; from < n; from++) {\n\t\t\tfor(int to = 0; to < n; to++) {\n\t\t\t\tif(from==to) continue;\n\t\t\t\tArrayList diffs = new ArrayList();\n\t\t\t\tfor(int i = 0; i < n; i++) {\n\t\t\t\t\tint d = data[to][i].b - data[from][i].a;\n\t\t\t\t\tif(d > 0) diffs.add(new Diff(d, i)); \n\t\t\t\t}\n\t\t\t\tCollections.sort(diffs);\n\t\t\t\tint rem = k, work = 0;\n\t\t\t\tfor(Diff d: diffs) {\n\t\t\t\t\tint qty = data[from][d.idx].c;\n\t\t\t\t\tif(qty < rem) {\n\t\t\t\t\t\trem -= qty;\n\t\t\t\t\t\twork += qty * d.d;\n\t\t\t\t\t} else {\n\t\t\t\t\t\twork += rem * d.d;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tans = Math.max(ans, work);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\tpublic static void main(String[] args) {\n\t\tnew C().doIt();\n\t}\n\n}\n", "lang": "Java 6", "bug_code_uid": "b4b38ef652a495cf878ad87ddb333bfb", "src_uid": "7419c4268a9815282fadca6581f28ec1", "apr_id": "f96449750e69222260dac72b9da9bd4e", "difficulty": 1200, "tags": ["games", "greedy", "graph matchings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9992242048099301, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\npublic class C181{\n\tpublic static void main(String[] args){\n\t\tScanner br = new Scanner(System.in);\n\t\tint n = br.nextInt();\n\t\tint m = br.nextInt();\n\t\tint k = br.nextInt();\n\t\tint[][] cost = new int[n][m];\n\t\tint[][] sell = new int[n][m];\n\t\tint[][] am = new int[n][m];\n\t\tfor(int i = 0;i 0 && bought){\n\t\t\t\t\tbought = false;\n\t\t\t\t\tint bp = -1;\n\t\t\t\t\tint index = -1;\n\t\t\t\t\tfor(int something = 0;something 0){\n\t\t\t\t\t\t\tif(sell[j][something]-cost[i][something] > bp){\n\t\t\t\t\t\t\t\tbp = sell[j][something]-cost[i][something];\n\t\t\t\t\t\t\t\tindex = something;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(bp != -1){\n\t\t\t\t\t\tbought = true;\n\t\t\t\t\t\tint tam = Math.min(tk, left[index]);\n\t\t\t\t\t\ttk-=tam;\n\t\t\t\t\t\tleft[index]-=tam;\n\t\t\t\t\t\tprofit+=(bp*tam);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbest = Math.max(best, profit);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(best);\n\t}\n}", "lang": "Java 6", "bug_code_uid": "8746d1c405526e446a92c07c5880aa25", "src_uid": "7419c4268a9815282fadca6581f28ec1", "apr_id": "c83dfb029b8456034fad6821eaf7a979", "difficulty": 1200, "tags": ["games", "greedy", "graph matchings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.3493975903614458, "equal_cnt": 13, "replace_cnt": 6, "delete_cnt": 5, "insert_cnt": 3, "fix_ops_cnt": 14, "bug_source_code": "public class Mahmoud {\n\n public String isEven(double n) {\n if ((n % 2) == 0)\n return \"Mahmoud\";\n else\n return \"Ehab\";\n }\n }\n\n", "lang": "Java 8", "bug_code_uid": "ce2ffa836099053ce147b50e6a83c833", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "apr_id": "bc2e1be4166a38b996cd32662d37ab92", "difficulty": 800, "tags": ["math", "games"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9903370256893708, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\n\n\npublic class Bun {\n\n public static int a[]=new int[200];\n public static int b[]=new int[200];\n public static int c[]=new int[200];\n public static int d[]=new int[200];\n public static long dp[][][]=new long[2000][200][200];\n public static int m;\n public static long sol(int index,int dough,int staff){\n if(dough<0||index==m+1){\n return 0;\n }\n if(dp[dough][staff][index]!=-1){\n return dp[dough][staff][index];\n }\n long way1=0;\n if(staff>=b[index]&&dough>=c[index]){\n way1=d[index]+sol(index,dough-c[index],staff-b[index]);\n }\n long way2=sol(index+1,dough,a[index+1]);\n return dp[dough][staff][index]=Math.max(way1, way2);\n }\n public static void main(String[] args) throws IOException {\n BufferedReader in=new BufferedReader(new InputStreamReader(System.in));\n PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));\n String s=\"\";\n while((s=in.readLine())!=null){\n String f[]=s.split(\" \");\n int dough=Integer.parseInt(f[0]);\n m=Integer.parseInt(f[1]);\n int c0=Integer.parseInt(f[2]);\n int d0=Integer.parseInt(f[3]);\n a[0]=0;\n c[0]=c0;\n d[0]=d0;\n for (int i = 1; i l=new ArrayList<>();\n for (int i:a) l.add(i);\n Collections.sort(l);\n for (int i=0; i l=new ArrayList<>();\n for (long i:a) l.add(i);\n// Collections.sort.(l);\n Collections.sort(l,Collections.reverseOrder());\n for (int i=0; i= x || more > (n - x)) {\n out.println(\"0\");\n return;\n }\n long ans = A(x - 1, less);\n ans = (ans * A(n - x, more)) % MOD;\n ans = (ans * A(n - less - more - 1, n - less - more - 1)) % MOD;\n out.println(ans);\n\n }\n\n private long A(int a, int b) {\n long ans = 1;\n for (int i = 0; i < b; i++) {\n ans = (ans * (a - i)) % MOD;\n }\n return ans;\n }\n\n }\n\n static class FastReader {\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n public FastReader(InputStream in) {\n br = new BufferedReader(new InputStreamReader(in));\n }\n\n public String next() {\n while (st == null || (!st.hasMoreElements())) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n }\n return st.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "e79669484f88ae0adadb9bda1642d6c5", "src_uid": "24e2f10463f440affccc2755f4462d8a", "apr_id": "a6e5c64674f31aae6edfff3c2387b762", "difficulty": 1500, "tags": ["combinatorics", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9852700490998363, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.uti.*;\npublic class A1{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n long r = sc.nextLong();\n if(r%2==0){\n System.out.println(\"NO\");\n }\n else{\n System.out.print(1+\" \"+(r-3)/2);\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "3f51f7140cc82710bb19b375673b5905", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "apr_id": "618d71688f4f3d963515e82936f194a5", "difficulty": 1200, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7359389895138226, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Scanner;\n\npublic class A1 {\n\tpublic static long h(long x) {\n\t\treturn x * x + 2 * x + x + 1;\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong r = sc.nextLong();\n\t\tlong dod = 2;\n\t\tlong osn = h(1);\n\t\tlong x = 1;\n\t\tlong res;\n\t\twhile (osn <= r) {\n\t\t\tres = osn;\n\t\t\tlong i = 1;\n\t\t\twhile (res <= r) {\n\t\t\t\t// System.out.println(res);\n\t\t\t\tif (res == r) {\n\t\t\t\t\tSystem.out.println(x + \" \" + i);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\ti++;\n\t\t\t\tres += dod;\n\t\t\t}\n\t\t\tdod += 2;\n\t\t\tx++;\n\t\t\tosn = h(x);\n\t\t}\n\t\tSystem.out.println(\"NO\");\n\t}\n}", "lang": "Java 8", "bug_code_uid": "ccb483049e5889b463a7bc21e1695341", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "apr_id": "712a4f94777e40352768d3d03f738b6e", "difficulty": 1200, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.985941893158388, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*;\n \npublic class A1{\n public static void main(String[] args){\n Scanner s=new Scanner(System.in);\n long r=s.nextInt();\n long finalx=-1,finaly=-1;\n for(long x=1;x<=(int)1e6;x++){\n long temp=r-x*x-x-1;\n if(temp!=0&&temp%(2*x)==0){\n finalx=x;\n finaly=temp;\n break;\n }\n }\n if(finalx!=-1 && finaly!=-1)System.out.println(finalx+\" \"+finaly);\n else System.out.println(\"NO\");\n \n }", "lang": "Java 8", "bug_code_uid": "e4d870f6bdbf893967a61a8f6615b577", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "apr_id": "2ffbc995e8248ba5e0fcea91bef5bd1a", "difficulty": 1200, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9876543209876543, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*;\nimport java.io.*;\npublic class hele{\n\tpublic static void main(String s[]){\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong k = sc.nextLong();\n\t\tlong sqrt = 1000000;\n\t\tboolean b=false;\n\t\tfor(int i=1;i<=sqrt;i++){\n\t\t\tlong y = (long)((long)k-(long)(i*i)-(long)i-(long)1)%(long)(2*(long)i);\n\t\t\tif(y==0){\n\t\t\t\tlong df = (long)((k-(long)(i*i)-(long)i-(long)1)/(long)(2*(long)i);\n\t\t\t\tif(df>0){\n\t\t\t\tSystem.out.println(i+\" \"+df);\n\t\t\t\tb=true;\n\t\t\t\tbreak;}\n\t\t\t}\n\t\t}\n\t\tif(b==false)\n\t\t\tSystem.out.println(\"NO\");\n\t}\t\n}", "lang": "Java 8", "bug_code_uid": "8bbbe5fc379125ab39373f5645e761e2", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "apr_id": "b9f5b1ffa828eed5cb30c8922242978e", "difficulty": 1200, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.42239922761284093, "equal_cnt": 12, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "\nimport java.io.*;\nimport java.security.KeyPair;\nimport java.util.*;\n\npublic class Main \n{\n\tpublic static int[][] arr = new int[1][1];\n\tpublic static boolean[][] visited = new boolean[1][1];\n\tpublic static boolean game = false;\n public static void main(String[] args) \n {\n \tScanner sc = new Scanner(System.in);\n \tint currenti = sc.nextInt();\n \tint currentj = sc.nextInt();\n \tint reachi = sc.nextInt();\n \tint reachj = sc.nextInt();\n \tif(currenti == reachi && currentj == reachj) {\n \t\tSystem.out.print(0 + \" \" );\n \t}else if(currenti == reachi || currentj == reachj) {\n \t\tSystem.out.print(1 + \" \");\n \t}else {\n \t\tSystem.out.print(2+ \" \");\n \t}\n \tint evencountcurrent = 0;\n \tint oddcountcurrent = 0;\n \tif(currenti % 2 ==0 ) {\n \t\tevencountcurrent++;\n \t}else {\n \t\toddcountcurrent++;\n \t}\n \tif(currentj % 2 == 0) {\n \t\tevencountcurrent++;\n \t}else {\n \t\toddcountcurrent++;\n \t}\n \tint evencountd = 0;\n \tint oddcountd = 0;\n \tif(reachi % 2 ==0 ) {\n \t\tevencountd++;\n \t}else {\n \t\toddcountd++;\n \t}\n \tif(reachj % 2 == 0) {\n \t\tevencountd++;\n \t}else {\n \t\toddcountd++;\n \t}\n \tif(!(evencountcurrent == evencountd && oddcountd == oddcountcurrent)) {\n \t\tSystem.out.print(0+ \" \");\n \t}else if(checkdiagnol(currenti,currentj,reachi,reachj)) {\n \t\tSystem.out.print(1+ \" \");\n \t}else {\n \t\tSystem.out.print(2+ \" \");\n \t}\n \tSystem.out.println(counter(currenti,currentj,reachi,reachj));\n }\n public static int counter(int ci,int cj, int ri,int rj) {\n \tint count = 0;\n \twhile(ci != ri || rj != cj) {\n \t\tif(ri > ci) {\n \t\t\tci++;\n \t\t}else if(ri < ci) {\n \t\t\tci--;\n \t\t}\n \t\tif(ri > cj) {\n \t\t\tcj++;\n \t\t}else if(ri < cj) {\n \t\t\tcj--;\n \t\t}\n \t\tcount++;\n \t}\n \treturn count;\n \t\n }\n public static boolean checkdiagnol(int ci,int cj, int ri,int rj) {\n \tint cci = ci;\n \tint ccj = cj;\n \twhile(cci >= 0 && ccj >=0) {\n \t\tif(cci == ri && ccj == rj) {\n \t\t\treturn true;\n \t\t}\n \t\tcci--;\n \t\tccj--;\n \t}\n \tcci = ci;\n ccj = cj;\n \twhile(cci < 8 && ccj < 8) {\n \t\tif(cci == ri && ccj == rj) {\n \t\t\treturn true;\n \t\t}\n \t\tcci++;\n \t\tccj++;\n \t}\n \tcci = ci;\n ccj = cj;\n \twhile(cci >=0 && ccj < 8) {\n \t\tif(cci == ri && ccj == rj) {\n \t\t\treturn true;\n \t\t}\n \t\tcci--;\n \t\tccj++;\n \t}\n \tcci = ci;\n ccj = cj;\n \twhile(cci < 8 && ccj >= 0) {\n \t\tif(cci == ri && ccj == rj) {\n \t\t\treturn true;\n \t\t}\n \t\tcci++;\n \t\tccj--;\n \t}\n \treturn false;\n \t\t\t\n \t\n }\n}", "lang": "Java 8", "bug_code_uid": "9caf0260476730849b7037c7e5bc9e26", "src_uid": "7dbf58806db185f0fe70c00b60973f4b", "apr_id": "1f6711b877149892feac258f140d42c7", "difficulty": 1100, "tags": ["graphs", "math", "shortest paths"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.4945091514143095, "equal_cnt": 35, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 31, "fix_ops_cnt": 36, "bug_source_code": "package practice;\n\nimport util.FastReader;\nimport java.io.PrintWriter;\n\npublic class RookBishopKing {\n public void solve(int testNumber, FastReader in, PrintWriter out) {\n int r1 = in.nextInt();\n int c1 = in.nextInt();\n int r2 = in.nextInt();\n int c2 = in.nextInt();\n\n // rook\n if (r1 == r2 || c1 == c2) {\n out.print(\"1 \");\n } else {\n out.print(\"2 \");\n }\n\n // bishop\n if ((r1 + r2) % 2 != (c1 + c2) % 2) {\n out.print(\"0 \");\n } else {\n if (Math.abs(r1 - r2) == Math.abs(c1 - c2)) {\n out.print(\"1 \");\n } else {\n out.print(\"2 \");\n }\n }\n\n // king\n out.print(Math.max(Math.abs(r1-r2), Math.abs(c1-c2)));\n }\n}\n", "lang": "Java 8", "bug_code_uid": "30c0c219ee8794a82a54e5522bd205c5", "src_uid": "7dbf58806db185f0fe70c00b60973f4b", "apr_id": "78608990fdb3aa82d3ba37100077b2a4", "difficulty": 1100, "tags": ["graphs", "math", "shortest paths"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9861415025528811, "equal_cnt": 10, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 9, "bug_source_code": "////package CodeForce;\nimport java.io.*;\nimport java.util.*;\n/**\n *\n * @author prabhat\n */\npublic class R455D2A {\n\n\n static long[] a;\n static int[] S;\n static long[] sum;\n static int mod=1000000007;\n static int[][] dp;\n static boolean[][] isPalin;\n static int max1=5000+10;\n static int[][] g;\n static int ver;\n static int n;\n static boolean[] visit;\n static LinkedList l[];\n static int ans=0;\n static int[] color;\n static LinkedList list[];\n public static void main(String[] args) throws Exception\n {\n \tInputReader in = new InputReader(System.in);\n \tPrintWriter pw=new PrintWriter(System.out);\n int n=in.ii();\n int k=n*(n+1)/2;\n if(n%2==0&&k%2==0)pw.println(k-n);\n else if(n!=1&&n%2!=0&&k%2!=0)pw.println(k-n-1);\n else if((n%2==0&&k%2!=0)||(n%2!=0&&k%2==0))pw.println(k-n+1);\n else if(n==1)pw.println(1);\n /* String s1=in.is().trim();\n String s2=in.is();\n LinkedList l=new LinkedList<>();\n for(int i=0;i list=new LinkedList<>();\n for(int i=0;i0)\n {\n cnt++;\n n>>=1;\n }\n return cnt;\n }\n static void dfs(int i)\n {\n\t if(visit[i])return ;\n\t visit[i]=true;\n\t for(int o:g[i])\n\t\t if(!visit[o])\n\t\t\t dfs(o);\n\t\t \n }\n private static class DSU{\n\t\tint[] parent;\n\t\tint[] rank;\n\t\tint cnt;\n\t\tpublic DSU(int n){\n\t\t\tparent=new int[n];\n\t\t\trank=new int[n];\n\t\t\tfor(int i=0;i target)\n high = mid - 1;\n else\n low = mid;\n }\n return nums[low] == target ? low : -1;\n }\n public static boolean palin(String s)\n\t{\n\t int i=0;\n\t int j=s.length()-1;\n\t while(i=1){b=true;}\n\t \t }\n\t }\n\t \n\t return b; \n // return dp[0][n-1];\n\t \n }\n \n \n \n \n \npublic static int gcd(int a,int b)\n{\n\tint res=1;\n\twhile(a>0)\n\t{\n\t\tres=a;\n\t\ta=b%a;\n\t\tb=res;\n\t}\n\treturn res;\n}\n \n \npublic static long pow(long n,long p,long m)\n{\n\t long result = 1;\n\t if(p==0)\n\t return 1;\n\tif (p==1)\n\t return n;\n\twhile(p!=0)\n\t{\n\t if(p%2==1)\n\t result *= n;\n\t if(result>=m)\n\t result%=m;\n\t p >>=1;\n\t n*=n;\n\t if(n>=m)\n\t n%=m;\n\t}\n\treturn result;\n}\npublic static long pow(long n,long p)\n{\n\tlong result = 1;\n\t if(p==0)\n\t return 1;\n\tif (p==1)\n\t return n;\n\twhile(p!=0)\n\t{\n\t if(p%2==1)\n\t result *= n;\n\t p >>=1;\n\t n*=n;\n\t}\n\treturn result;\n \n}\n \n \n \n \nstatic class Edge implements Comparator {\n\tprivate int u;\n\tprivate int v;\n\tprivate int w;\n\tpublic Edge() {\n\t}\n\tpublic Edge(int u, int v, int w) {\n\t\tthis.u=u;\n\t\tthis.v=v;\n\t\tthis.w=w;\n\t}\n\tpublic int getU() {\n\t\treturn u;\n\t}\n\tpublic void setU(int u) {\n\t\tthis.u = u;\n\t}\n\tpublic int getV() {\n\t\treturn v;\n\t}\n\tpublic void setV(int v) {\n\t\tthis.v = v;\n\t}\n\tpublic int getW() {\n\t\treturn w;\n\t}\n\tpublic void setW(int w) {\n\t\tthis.w = w;\n\t }\n\tpublic int compareTo(Edge e)\n\t {\n\t\treturn this.getW() - e.getW();\n\t}\n\t@Override\n\tpublic String toString() {\n\t\treturn \"Edge [u=\" + u + \", v=\" + v + \", w=\" + w + \"]\";\n\t}\n\t@Override\n\tpublic int compare(Edge arg0, Edge arg1) {\n\t\t// TODO Auto-generated method stub\n\t\treturn 0;\n\t}\n}\n \n \n \nstatic class Pair implements Comparable\n{\n\tint a,b;\n\tPair (int a,int b)\n\t{\n\t\tthis.a=a;\n\t\tthis.b=b;\n\t}\n \n\tpublic int compareTo(Pair o) {\n\t\t// TODO Auto-generated method stub\n\t\tif(this.a!=o.a)\n\t\treturn -Integer.compare(this.a,o.a);\n\t\telse\n\t\t\treturn -Integer.compare(this.b, o.b);\n\t\t//return 0;\n\t}\n\tpublic boolean equals(Object o) {\n if (o instanceof Pair) {\n Pair p = (Pair)o;\n return p.a == a && p.b == b;\n }\n return false;\n }\n public int hashCode() {\n return new Integer(a).hashCode() * 31 + new Integer(b).hashCode();\n }\n}\n \nstatic class InputReader\n{\n private InputStream stream;\n private byte[] buf = new byte[1024];\n \n private SpaceCharFilter filter;\n byte inbuffer[] = new byte[1024];\n int lenbuffer = 0, ptrbuffer = 0;\n final int M = (int) 1e9 + 7;\n int md=(int)(1e7+1);\n int[] SMP=new int[md];\n final double eps = 1e-6;\n final double pi = Math.PI;\n \n\tPrintWriter out;\n String check = \"\";\n InputStream obj = check.isEmpty() ? System.in : new ByteArrayInputStream(check.getBytes());\n public InputReader(InputStream stream)\n {\n this.stream = stream;\n }\n \n int readByte() {\n\t if (lenbuffer == -1) throw new InputMismatchException();\n\t if (ptrbuffer >= lenbuffer) {\n\t ptrbuffer = 0;\n\t try {\n\t lenbuffer = obj.read(inbuffer);\n\t } catch (IOException e) {\n\t throw new InputMismatchException();\n\t }\n\t }\n\t if (lenbuffer <= 0) return -1;\n\t return inbuffer[ptrbuffer++];\n }\n \n public int read()\n {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-')\n {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do\n {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n \n String is() {\n\t int b = skip();\n\t StringBuilder sb = new StringBuilder();\n\t while (!(isSpaceChar(b))) // when nextLine, (isSpaceChar(b) && b!=' ')\n\t {\n\t sb.appendCodePoint(b);\n\t b = readByte();\n\t }\n\t return sb.toString();\n }\n public int ii() {\n\t int num = 0, b;\n\t boolean minus = false;\n\t while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;\n\t if (b == '-') {\n\t minus = true;\n\t b = readByte();\n\t }\n\t while (true) {\n\t if (b >= '0' && b <= '9') {\n\t num = num * 10 + (b - '0');\n\t } else {\n\t return minus ? -num : num;\n\t }\n\t b = readByte();\n\t }\n }\n public long il() {\n\t long num = 0;\n\t int b;\n\t boolean minus = false;\n\t while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;\n\t if (b == '-') {\n\t minus = true;\n\t b = readByte();\n\t }\n\t while (true) {\n\t if (b >= '0' && b <= '9') {\n\t num = num * 10 + (b - '0');\n\t } else {\n\t return minus ? -num : num;\n\t }\n\t b = readByte();\n\t }\n }\n \n\t boolean isSpaceChar(int c) {\n\t return (!(c >= 33 && c <= 126));\n\t }\n \n\t int skip()\n\t {\n\t int b;\n\t while ((b = readByte()) != -1 && isSpaceChar(b)) ;\n\t return b;\n\t }\n \n\t float nf() {\n\t return Float.parseFloat(is());\n\t }\n \n\t double id() {\n\t return Double.parseDouble(is());\n\t }\n \n\t char ic() {\n\t return (char) skip();\n\t }\n \n\t int[] iia(int n) {\n\t int a[] = new int[n];\n\t for (int i = 0; i= 0 && x <= 45) {System.out.println(0); return;}\n\t\tif (x > 45 && x <= 135) {System.out.println(1); return;}\n\t\tif (x > 135 && x <= 225) {System.out.println(2); return;}\n\t\tif (x > 225 && x < 315) {System.out.println(3); return;}\n\t\tif (x >= 315) {System.out.println(0); return;}\n\t\t\n\t\tif (x <= 0 && x >= -45) {System.out.println(0); return;}\n\t\tif (x < -45 && x > -135) {System.out.println(3); return;}\n\t\tif (x <= -135 && x > -225) {System.out.println(2); return;}\n\t\tif (x <= -225 && x > - 315) {System.out.println(1); return;}\n\t\tif (x <= -315 && x > 0) {System.out.println(0); return;}\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "22c9af3ea363311ae760e9f47eb26800", "src_uid": "509db9cb6156b692557ba874a09f150e", "apr_id": "182a44100caf80177fab532616afcf6d", "difficulty": 1800, "tags": ["geometry", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8652886671418389, "equal_cnt": 25, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 20, "fix_ops_cnt": 24, "bug_source_code": "import java.awt.Point;\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.*;\n\n\npublic class Candidate {\n public static void main(String[] args) throws Exception {\n FastReader sc=new FastReader();\n int n=sc.nextInt();\n int x=1,y=1,p=1,q=n;\n boolean z=true;\n boolean a=true;\n LinkedList ll=new LinkedList<>();\n while(a){\n if(z){\n if(Math.abs(q-y)==1){\n ll.add(new Point(x,y+1));\n System.out.println(\"white\");\n System.out.println(ll.getFirst().x+\" \"+ll.getFirst().y);\n return;\n }\n else{\n z=false;\n y=y+1;\n ll.add(new Point(x,y));\n }\n }\n else{\n if(Math.abs(q-y)==1){\n System.out.println(\"black\");\n return;\n }\n else{\n z=true;\n q=q-1;\n }\n }\n }\n }\n}\nclass FastReader {\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader() {\n br = new BufferedReader(new\n InputStreamReader(System.in));\n }\n\n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n}\n\n", "lang": "Java 11", "bug_code_uid": "a043bff3bf889ce7bdcf086f0dee97af", "src_uid": "52e07d176aa1d370788f94ee2e61df93", "apr_id": "380213628b3b6e9f81fcd67558d91f52", "difficulty": 1700, "tags": ["math", "games", "constructive algorithms"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9189704480457579, "equal_cnt": 17, "replace_cnt": 1, "delete_cnt": 16, "insert_cnt": 0, "fix_ops_cnt": 17, "bug_source_code": " import java.util.Scanner;\n\n public class Solution{\n\n public static void main(String args[]){\n Scanner scn = new Scanner(System.in);\n long n = scn.nextLong();\n StringBuilder sb = new StringBuilder();\n if((n%2 == 0){\n sb.append(\"white\");\n sb.append(\"\\n\");\n sb.append(\"1 2\");\n System.out.println(sb.toString());\n return;\n }\n sb.append(\"black\");\n System.out.println(sb.toString());\n }\n }", "lang": "Java 11", "bug_code_uid": "e9807b7979f77699406b5c53b0586134", "src_uid": "52e07d176aa1d370788f94ee2e61df93", "apr_id": "f8cb8263307e03482d5ea7d11a12875e", "difficulty": 1700, "tags": ["math", "games", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9168081494057725, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.util.Scanner;\npublic class Main{\n public static void main(String[] args){\n Scanner input = new Scanner(System.in);\n int n = input.nextInt();\n while(n>=1&&n<=100){\n if(n%2==0){\n System.out.println(\"YES\");\n }\n else{\n System.out.println(\"NO\");\n }\n }\n }\n}", "lang": "Java 11", "bug_code_uid": "ff0bfb82679d7574f2ee1f4ab4088724", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "7759cea22170cdb0ebe258df286f3059", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.09511568123393316, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "/* package whatever; // don't place package name! */\n\nimport java.util.*;\nimport java.lang.*;\nimport java.io.*;\n\n/* Name of the class has to be \"Main\" only if the class is public. */\n public class Ideone\n{\n\tpublic static void main (String[] args) throws java.lang.Exception\n\t{\n\tScanner n=new Scanner(System.in);\n\tint a=n.nextInt();\n\twhile(a>=1 || a<=100){\n\tif(a%2==0)\n\tSystem.out.print(\"Yes\");\n\telse\n\tSystem.out.print(\"No\");\n\t}\n\t}\n}", "lang": "Java 11", "bug_code_uid": "6da08dd2b0f2a7d14e9997e72c3f69e1", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "4821cba3c87817f087b3e471d3b59d0c", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9989240370131267, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\n/**\n * Created by saksham on 10-08-2016.\n * 370A\n */\npublic class RookBishopAndKing {\n public static void main(String []args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st = new StringTokenizer(br.readLine(), \" \");\n int x1 = Integer.parseInt(st.nextToken());\n int y1 = Integer.parseInt(st.nextToken());\n int x2 = Integer.parseInt(st.nextToken());\n int y2 = Integer.parseInt(st.nextToken());\n //Rook\n if(x1 == x2 || y1 == y2) {\n System.out.print(1 + \" \");\n } else {\n System.out.print(2 + \" \");\n }\n int diffX = x1 - x2;\n if(diffX < 0) diffX = -diffX;\n int diffY = y1 - y2;\n if(diffY < 0) diffY = -diffY;\n //bishop\n if((diffX-diffY) == 0) {\n System.out.print(1 + \" \");\n } else if((diffX-diffY)%2 == 0) {\n System.out.print(2 + \" \");\n } else {\n System.out.print(0 + \" \");\n }\n //king\n if((diffX-diffY) == 0 || y1 == y2) {\n System.out.print(diffX + \" \");\n } else if(x1 == x2) {\n System.out.print(diffY + \" \");\n } else {\n int steps = 0;\n while(x1 != x2 && y1 != y2) {\n if(x1 < x2 && y1 < y2) {\n x1++;\n y1++;\n steps++;\n } else if(x1 > x2 && y1 < y2) {\n x1--;\n y1++;\n steps++;\n } else if(x1 < x2 && y1 < y2) {\n x1--;\n y1--;\n steps++;\n } else if(x1 < x2 && y1 > y2) {\n x1++;\n y1--;\n steps++;\n }\n\n }\n if(x1 == x2) {\n diffY = y1 - y2;\n if(diffY < 0) diffY = -diffY;\n System.out.print((steps+diffY) + \" \");\n } else if(y1 == y2) {\n diffX = x1 - x2;\n if(diffX < 0) diffX = -diffX;\n System.out.print((steps+diffX) + \" \");\n }\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "ad0e56b178c826b76536fe660ff89335", "src_uid": "7dbf58806db185f0fe70c00b60973f4b", "apr_id": "d8a0e0e033f25032492f5254944f1137", "difficulty": 1100, "tags": ["graphs", "math", "shortest paths"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9933774834437086, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package com.company;\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\n\n/**\n *\n * @author ramilagger\n *\n */\npublic class Main {\n\n public final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n public final PrintWriter pw = new PrintWriter(System.out);\n public StringTokenizer st;\n int n,m;\n\n public void solve() throws IOException {\n int[] a = new int[100001];\n int n = nextInt();\n int cnt = 1;\n a[cnt] = 1;\n\n for (int i = 1; i < n; i++) {\n a[++cnt] = 1;\n while (cnt - 1 >= 0 && a[cnt] == a[cnt - 1]) {\n a[cnt - 1] = a[cnt] + 1;\n a[cnt] = 0;\n cnt--;\n }\n }\n for (int i = 1; i <= cnt; i++) {\n pw.print(a[i] + \" \");\n }\n }\n\n public void run() throws IOException {\n\n this.solve();\n pw.close();\n\n }\n\n public static void main(String[] args) throws IOException {\n new Main().run();\n }\n\n public String next() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return st.nextToken();\n }\n\n public int nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n\n public long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n\n public double nextDouble() throws IOException {\n return Double.parseDouble(next());\n }\n\n}\n", "lang": "Java 8", "bug_code_uid": "939e6dc172d247d7f0a4baea53ba20d4", "src_uid": "757cd804aba01dc4bc108cb0722f68dc", "apr_id": "6bbb203df7674f02ebf2f49827f9e887", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9979550102249489, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner;\n\n/**\n * 1/29/16\n **/\npublic class A {\n\n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n\n int[] a = new int[100000];\n int temp = n;\n for(int i =0;i < n; i++) {\n a[i] = temp%2;\n temp = temp/2;\n }\n\n for(int i =n; i >= 0; i--) {\n if(a[i] == 1) {\n System.out.print(i+1 + \" \");\n }\n }\n\n }\n}", "lang": "Java 8", "bug_code_uid": "5da53a5c190e4c6f1426b0e0a14e9f2a", "src_uid": "757cd804aba01dc4bc108cb0722f68dc", "apr_id": "c489908d53e9029a15ff8fb0da172284", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7037815126050421, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "\npackage force_c1_q1;\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Force_c1_q1 {\n\n public static void main(String[] args) throws IOException {\n BufferedReader scan = new BufferedReader(new InputStreamReader(System.in));\n int t = Integer.parseInt(scan.readLine());\n\tfor(int p=0;p= lenbuf){\n\t\t\tptrbuf = 0;\n\t\t\ttry { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }\n\t\t\tif(lenbuf <= 0)return -1;\n\t\t}\n\t\treturn inbuf[ptrbuf++];\n\t}\n\t\n\tprivate boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }\n\tprivate int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }\n\t\n\tprivate double nd() { return Double.parseDouble(ns()); }\n\tprivate char nc() { return (char)skip(); }\n\t\n\tprivate String ns()\n\t{\n\t\tint b = skip();\n\t\tStringBuilder sb = new StringBuilder();\n\t\twhile(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\t\n\tprivate char[] ns(int n)\n\t{\n\t\tchar[] buf = new char[n];\n\t\tint b = skip(), p = 0;\n\t\twhile(p < n && !(isSpaceChar(b))){\n\t\t\tbuf[p++] = (char)b;\n\t\t\tb = readByte();\n\t\t}\n\t\t\n\t\treturn n == p ? buf : Arrays.copyOf(buf, p);\n\t}\n\t\n\tprivate char[][] nm(int n, int m)\n\t{\n\t\tchar[][] map = new char[n][];\n\t\tfor(int i = 0;i < n;i++)map[i] = ns(m);\n\t\treturn map;\n\t}\n\t\n\tprivate int[] na(int n)\n\t{\n\t\tint[] a = new int[n];\n\t\tfor(int i = 0; i < n; i++)a[i] = ni();\n\t\treturn a;\n\t}\n\t\n\tprivate int ni()\n\t{\n\t\tint num = 0, b;\n\t\tboolean minus = false;\n\t\twhile((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));\n\t\tif(b == '-'){\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\t\n\t\twhile(true){\n\t\t\tif(b >= '0' && b <= '9'){\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t}else{\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\t\n\tprivate long nl()\n\t{\n\t\tlong num = 0;\n\t\tint b;\n\t\tboolean minus = false;\n\t\twhile((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));\n\t\tif(b == '-'){\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\t\n\t\twhile(true){\n\t\t\tif(b >= '0' && b <= '9'){\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t}else{\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\t\n\tprivate boolean oj = System.getProperty(\"ONLINE_JUDGE\") != null;\n\tprivate void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }\n}", "lang": "Java 8", "bug_code_uid": "350c3947d971be80f999bd62bdc68871", "src_uid": "7bd5521531950e2de9a7b0904353184d", "apr_id": "f352ec8555045414f93dea621be614a7", "difficulty": 1000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.900574458683164, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "/*\n * To change this license header, choose License Headers in Project Properties.\n * To change this template file, choose Tools | Templates\n * and open the template in the editor.\n */\npackage acm;\n\nimport java.util.Scanner;\n\n/**\n *\n * @author OmarNasr\n */\npublic class Acm {\n\n /**\n * @param args the command line arguments\n */\n public static void main(String[] args) throws java.lang.Exception {\n // your code goes here\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n String s = in.next();\n int x = 0, y = 0, count = 0;\n\n for (int i = 0; i < n; i++) {\n for (int j = i; j < n; j++) {\n x = 0;\n y = 0;\n for (char c : s.substring(i, j + 1).toCharArray()) {\n if (c == 'U') {\n y++;\n } else if (c == 'D') {\n y--;\n } else if (c == 'R') {\n x++;\n } else {\n x--;\n }\n }\n if (x == 0 && y == 0) {\n count++;\n }\n }\n\n }\n System.out.println(count);\n }\n\n}\n", "lang": "Java 8", "bug_code_uid": "cdb5589bd534b6738390d21e874723ab", "src_uid": "7bd5521531950e2de9a7b0904353184d", "apr_id": "09b5fa6ea3efc8acd5f0840113c658d0", "difficulty": 1000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.3488, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "import java.util.*;\nimport java.Math.*;\n\npublic class Solution{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n \n int x1 = sc.nextInt();\n int x2 = sc.nextInt();\n int x3 = sc.nextInt();\n \n int avg = (x1+x2+x3)/3;\n \n int distance = Math.abs(x1-avg) + Math.abs(x2-avg) + Math.abs(x3-avg);\n \n System.out.println(distance);\n }\n}", "lang": "Java 11", "bug_code_uid": "a7ac8f4fd59e3141c92219a4f122cbbb", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "apr_id": "db419b6bffa6f9100f68a406ff2ab387", "difficulty": 800, "tags": ["math", "sortings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.887189292543021, "equal_cnt": 10, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 9, "bug_source_code": "//package codeForcesTry;\n\nimport java.io.BufferedReader;\nimport java.io.Closeable;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\n\npublic class B509_AmrPins implements Closeable {\n\tBufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter writer = new PrintWriter(System.out);\n StringTokenizer stringTokenizer;\n \n String next() throws IOException {\n while (stringTokenizer == null || !stringTokenizer.hasMoreTokens()) {\n stringTokenizer = new StringTokenizer(reader.readLine());\n }\n return stringTokenizer.nextToken();\n }\n\n double nextDouble() throws IOException {\n return Double.parseDouble(next());\n }\n\n int nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n\n long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n public void solve()throws IOException {\n \tint r,x,y,x1,y1;\n \tr=nextInt();x=nextInt();y=nextInt();x1=nextInt();y1=nextInt();\n \tlong xy=(x-x1)*(x-x1)+(y-y1)*(y-y1);\n \tdouble dist=Math.sqrt(xy);\n \n \tint i=0;\n \n \twhile(true){\n \t\tif(2*r*i>=dist)\n \t\t\tbreak;\n \t\t\ti++;\n \t}\n \tif(dist==0){\n \t\ti=0;\n \t}\n \twriter.println(i);\n }\n public static void main(String args[]) throws IOException{ \n \ttry(B509_AmrPins c=new B509_AmrPins()){\n \tc.solve();\n \t}\n }\n public void close() throws IOException {\n reader.close();\n writer.close();\n }\n\n}\n", "lang": "Java 8", "bug_code_uid": "134775cc425405d45acd934e460b4d96", "src_uid": "698da80c7d24252b57cca4e4f0ca7031", "apr_id": "0f6cafa9332e982bb2c622433f18ac50", "difficulty": 1400, "tags": ["geometry", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9028661033191044, "equal_cnt": 12, "replace_cnt": 11, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 11, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.nio.charset.StandardCharsets;\n// import java.math.BigInteger;\n\npublic class B {\n static Writer wr;\n\n static class State {\n public int u;\n public int v;\n public int d;\n public State(int a, int b, int dd) {\n u = a;\n v = b;\n d = dd;\n }\n\n public boolean equals(Object obj) {\n if (this == obj)\n return true;\n if (obj == null)\n return false;\n\n State other = (State)obj;\n if((other.u==u && other.v==v))\n {\n return true;\n }\n return false;\n }\n\n public int hashCode() {\n final int prime = 31;\n int result = 23;\n result = prime * result + u;\n result = prime * result + v;\n // result = prime * result + w;\n // System.out.print(result + \" \");\n return result;\n }\n }\n\n public static void main(String[] args) throws Exception {\n // long startTime = System.nanoTime();\n\n // String testString = \"\";\n // InputStream stream = new ByteArrayInputStream(testString.getBytes(StandardCharsets.UTF_8));\n // Reader in = new Reader(stream);\n\n Reader in = new Reader();\n BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));\n \n wr = new Writer();\n\n /* Precomputation */\n\n\n // long elapsedTime = System.nanoTime() - startTime;\n // double seconds = (double)elapsedTime / 1000000000.0;\n // wr.writeRedLn(seconds);\n\n /* Input */\n int r = in.nextInt();\n int x = in.nextInt();\n int y = in.nextInt();\n int x1 = in.nextInt();\n int y1 = in.nextInt();\n\n int dx[] = {1*r,-1*r,1*r,-1*r,2*r,-2*r,0,0};\n int dy[] = {1*r,-1*r,-1*r,1*r,0,0,2*r,-2*r};\n\n Queue q = new LinkedList<>();\n State start = new State(x,y,0);\n q.add(start);\n\n HashSet visited = new HashSet<>();\n visited.add(start);\n\n int ans = 0;\n outer:\n while(q.size()>0) {\n State curr = q.poll();\n // wr.writeRedLn(curr.u + \", \" + curr.v + \", d: \" + curr.d);\n // if(curr.d==4) break;\n if((curr.u == x1) && (curr.v == y1)) {\n ans = curr.d;\n break outer;\n }\n for(int i=0;i='0'&&c<='9');if(neg)return -ret;return ret;} \n public long nextLong()throws IOException{long ret=0;byte c=read();while(c<=' ')c=read();boolean neg=(c=='-');\n if(neg)c=read();do{ret=ret*10+c-'0';}while((c=read())>='0'&&c<='9');if(neg)return -ret;return ret;}\n public double nextDouble()throws IOException{double ret=0,div=1;byte c=read();while(c<=' ')c=read();boolean neg=(c=='-');if(neg)c = read();do {ret=ret*10+c-'0';}while((c=read())>='0'&&c<='9');\n if(c=='.')while((c=read())>='0'&&c<='9')ret+=(c-'0')/(div*=10);if(neg)return -ret;return ret;}\n private void fillBuffer()throws IOException{bytesRead=din.read(buffer,bufferPointer=0,BUFFER_SIZE);if(bytesRead==-1)buffer[0]=-1;}\n private byte read()throws IOException{if(bufferPointer==bytesRead)fillBuffer();return buffer[bufferPointer++];}\n public void close()throws IOException{if(din==null) return;din.close();}\n}\n", "lang": "Java 8", "bug_code_uid": "8c45601bdf4e676391cc256e83c4146c", "src_uid": "698da80c7d24252b57cca4e4f0ca7031", "apr_id": "163c0212ac58cd32182e0684a8ffd405", "difficulty": 1400, "tags": ["geometry", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.4781382228490832, "equal_cnt": 14, "replace_cnt": 11, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 13, "bug_source_code": "/*\n * To change this license header, choose License Headers in Project Properties.\n * To change this template file, choose Tools | Templates\n * and open the template in the editor.\n */\n//package amrandpins;\nimport java.util.*;\n/**\n *\n * @author Rawhi\n */\npublic class AmrAndPins {\n\n /**\n * @param args the command line arguments\n */\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int r = sc.nextInt(),x = sc.nextInt(),y = sc.nextInt(),xP = sc.nextInt(),yP = sc.nextInt();\n int totalSteps = 0, lastX = x, lastY = y;\n boolean flag = true;\n while (flag) {\n if(x < xP){\n x += r;\n if(lastY == yP){\n x += r;\n }\n //System.out.println(\"X<\");\n }else if( x > xP){\n //System.out.println(\"X>\");\n x -= r;\n if(lastY == yP){\n x -= r;\n }\n }else{\n //System.out.println(\"X=\");\n if(y == yP){\n break;\n }\n }\n if(y < yP){\n //System.out.println(\"Y<\");\n y += r;\n if(lastX == xP){\n y += r;\n }\n }else if( y > yP){\n //System.out.println(\"Y>\");\n y -= r;\n if(lastX == xP){\n y -= r;\n }\n }else{\n //System.out.println(\"Y=\");\n if(x == xP && totalSteps != 0){\n break;\n }\n }\n lastX = x;\n lastY = y;\n //System.out.println(\"Round\");\n totalSteps++;\n }\n System.out.println(totalSteps);\n }\n \n}\n", "lang": "Java 8", "bug_code_uid": "1fd34d78d47e92c3dcef6a987ae9451b", "src_uid": "698da80c7d24252b57cca4e4f0ca7031", "apr_id": "56b8fb859b15889966169561fc6886b8", "difficulty": 1400, "tags": ["geometry", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.2631578947368421, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 9, "bug_source_code": "import java.util.Scanner;\n\npublic class Solution{\n \n Scanner sc = new Scanner(System.in);\n int x1 = sc.nextInt();\n int x2 = sc.nextInt();\n int x3 = sc.nextInt();\n \n int median = Math.max(Math.min(a,b), Math.min(Math.max(a,b),c));\n int total = 0;\n \n if(median != x1) total += Math.abs(median - x1);\n if(median != x2) total += Math.abs(median - x2);\n if(median != x3) total = Math.abs(median - x3);\n \n System.out.println(total);\n}", "lang": "Java 8", "bug_code_uid": "e2bf5bc20d55a26ebf1cfd9406248d82", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "apr_id": "f9615178cef9475054247f9eb4f74410", "difficulty": 800, "tags": ["math", "sortings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9917184265010351, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Scanner;\nimport java.util.*;\n\npublic class Main\n{\n static Scanner in = new Scanner( System.in );\n\n public static void main( String[] args )\n {\n int a = in.nextInt();\n int b = in.nextInt();\n int c = in.nextInt();\n int sum = 0;\n while ( a != 1 || b != 1 || c != 1 )\n {\n sum += ( a + b + c ) * 2 - 6;\n a--; b--; c--;\n }\n sum += a * b * c;\n System.out.println( sum );\n }\n}\n", "lang": "Java 7", "bug_code_uid": "d17ef9d659b03f7b4e8eb3ceffe97f71", "src_uid": "8ab25ed4955d978fe20f6872cb94b0da", "apr_id": "99df8e67d2c5c1707fd85ce8b699612f", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9578844270323212, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "\n import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class blah {\n\n\tpublic static void main(String[] args) {\n\t\t\n\t\tScanner scan = new Scanner(System.in);\n\t\tint n = scan.nextInt();\n\t\tint k = scan.nextInt();\tscan.nextLine();\n\t\tString s = scan.nextLine();\n\t\tint[] arr = new int[26];\n\t\t\n\t\tfor (int i=0; i k) {\n\t\t\t\tSystem.out.println(\"NO\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"YES\");\n\t}\n\n}", "lang": "Java 8", "bug_code_uid": "4a94182accaedecc1e6511b99c98f3d5", "src_uid": "ceb3807aaffef60bcdbcc9a17a1391be", "apr_id": "aea0ad31acb049fd2ad19add2a16844b", "difficulty": 900, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8381691867592971, "equal_cnt": 31, "replace_cnt": 11, "delete_cnt": 2, "insert_cnt": 17, "fix_ops_cnt": 30, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.math.BigInteger;\nimport java.util.Collections.*;\nimport static java.lang.Math.*;\nimport static java.lang.Math.max;\nimport static java.lang.Math.min;\nimport static java.util.Arrays.*;\nimport static java.math.BigInteger.*;\n\n\npublic class Main{\n\n void run(){\n Locale.setDefault(Locale.US);\n boolean my;\n try {\n my = System.getProperty(\"MY_LOCAL\") != null;\n } catch (Exception e) {\n my = false;\n\n }\n try{\n err = System.err;\n if( my ){\n sc = new FastScanner(new BufferedReader(new FileReader(\"input.txt\")));\n// sc = new FastScanner(new BufferedReader(new FileReader(\"C:\\\\myTest.txt\")));\n out = new PrintWriter (new FileWriter(\"output.txt\"));\n }\n else {\n sc = new FastScanner(new BufferedReader(new InputStreamReader(System.in)));\n out = new PrintWriter(new OutputStreamWriter(System.out));\n }\n// out = new PrintWriter(new OutputStreamWriter(System.out));\n }catch(Exception e){\n MLE();\n }\n if( my )\n tBeg = System.currentTimeMillis();\n solve();\n if( my )\n err.println( \"TIME: \" + (System.currentTimeMillis() - tBeg ) / 1e3 );\n exit(0);\n }\n\n void exit( int val ){\n err.flush();\n out.flush();\n System.exit(val);\n }\n\n double tBeg;\n FastScanner sc;\n PrintWriter out;\n PrintStream err;\n\n class FastScanner{\n\n StringTokenizer st;\n BufferedReader br;\n\n FastScanner( BufferedReader _br ){\n br = _br;\n }\n\n String readLine(){\n try {\n return br.readLine();\n } catch (IOException e) {\n return null;\n }\n }\n\n String next(){\n while( st==null || !st.hasMoreElements() )\n st = new StringTokenizer(readLine());\n return st.nextToken();\n }\n\n int nextInt(){ return Integer.parseInt(next()); }\n long nextLong(){ return Long.parseLong(next()); }\n double nextDouble(){ return Double.parseDouble(next()); }\n }\n\n void MLE(){\n int[][] arr = new int[1024*1024][]; for( int i = 0; i < 1024*1024; ++i ) arr[i] = new int[1024*1024];\n }\n\n void MLE( boolean doNotMLE ){ if( !doNotMLE ) MLE(); }\n\n void TLE(){\n for(;;);\n }\n\n public static void main(String[] args) {\n new Main().run();\n// new Thread( null, new Runnable() {\n// @Override\n// public void run() {\n// new Main().run();\n// }\n// }, \"Lolka\", 256_000_000L ).run();\n }\n\n ////////////////////////////////////////////////////////////////\n\n final int mod = (int)1e9 + 7;\n int n, k;\n Long[][] dp0, dp1;\n long[] pow2 = new long[1000];\n {\n pow2[0] = 1;\n for (int i = 1; i < pow2.length; i++) {\n pow2[i] = (pow2[i-1] * 2) % mod;\n }\n }\n\n void solve(){\n n = sc.nextInt();\n k = sc.nextInt();\n dp0 = new Long[k+1][n+1];\n for (Long[] val : dp0) fill(val, 0L);\n\n for (int sz = 1; sz <= n; sz++) {\n dp1 = new Long[k+1][n+1];\n\n for (int cnt = 0; cnt <= k; cnt++) {\n for (int last = 0; last <= sz; last++) {\n if( cnt == 0 ){\n if( last == 0 ) dp1[cnt][last] = 1L;\n else dp1[cnt][last] = 0L;\n }\n else if( sz == last ){\n if( cnt == 1 ){\n dp1[cnt][last] = (pow2[last]-1);\n }\n else{\n dp1[cnt][last] = 0L;\n for (int l = 1; l <= sz - 1; l++) {\n dp1[cnt][last] += dp1[cnt-1][l] * (pow2[sz-l]-1);\n }\n }\n }\n else{\n dp1[cnt][last] = dp0[cnt][last] * pow2[last];\n }\n dp1[cnt][last] = ( dp1[cnt][last]%mod + mod ) % mod;\n }\n }\n //\n dp0 = dp1;\n }\n long ans = 0;\n for (int last = 0; last <= n; last++) {\n ans += dp0[k][last];\n }\n ans %= mod;\n out.println( ans );\n }\n\n\n}", "lang": "Java 8", "bug_code_uid": "1a2ac961ea14506ce2b2aab3157606eb", "src_uid": "111673158df2e37ac6c019bb99225ccb", "apr_id": "8a81cde82a76dbad9bc1d749e049a913", "difficulty": 2500, "tags": ["dp"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8382157803409207, "equal_cnt": 30, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 17, "fix_ops_cnt": 29, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.math.BigInteger;\nimport java.util.Collections.*;\nimport static java.lang.Math.*;\nimport static java.lang.Math.max;\nimport static java.lang.Math.min;\nimport static java.util.Arrays.*;\nimport static java.math.BigInteger.*;\n\n\npublic class Main{\n\n void run(){\n Locale.setDefault(Locale.US);\n boolean my;\n try {\n my = System.getProperty(\"MY_LOCAL\") != null;\n } catch (Exception e) {\n my = false;\n\n }\n try{\n err = System.err;\n if( my ){\n sc = new FastScanner(new BufferedReader(new FileReader(\"input.txt\")));\n// sc = new FastScanner(new BufferedReader(new FileReader(\"C:\\\\myTest.txt\")));\n out = new PrintWriter (new FileWriter(\"output.txt\"));\n }\n else {\n sc = new FastScanner(new BufferedReader(new InputStreamReader(System.in)));\n out = new PrintWriter(new OutputStreamWriter(System.out));\n }\n// out = new PrintWriter(new OutputStreamWriter(System.out));\n }catch(Exception e){\n MLE();\n }\n if( my )\n tBeg = System.currentTimeMillis();\n solve();\n if( my )\n err.println( \"TIME: \" + (System.currentTimeMillis() - tBeg ) / 1e3 );\n exit(0);\n }\n\n void exit( int val ){\n err.flush();\n out.flush();\n System.exit(val);\n }\n\n double tBeg;\n FastScanner sc;\n PrintWriter out;\n PrintStream err;\n\n class FastScanner{\n\n StringTokenizer st;\n BufferedReader br;\n\n FastScanner( BufferedReader _br ){\n br = _br;\n }\n\n String readLine(){\n try {\n return br.readLine();\n } catch (IOException e) {\n return null;\n }\n }\n\n String next(){\n while( st==null || !st.hasMoreElements() )\n st = new StringTokenizer(readLine());\n return st.nextToken();\n }\n\n int nextInt(){ return Integer.parseInt(next()); }\n long nextLong(){ return Long.parseLong(next()); }\n double nextDouble(){ return Double.parseDouble(next()); }\n }\n\n void MLE(){\n int[][] arr = new int[1024*1024][]; for( int i = 0; i < 1024*1024; ++i ) arr[i] = new int[1024*1024];\n }\n\n void MLE( boolean doNotMLE ){ if( !doNotMLE ) MLE(); }\n\n void TLE(){\n for(;;);\n }\n\n public static void main(String[] args) {\n new Main().run();\n// new Thread( null, new Runnable() {\n// @Override\n// public void run() {\n// new Main().run();\n// }\n// }, \"Lolka\", 256_000_000L ).run();\n }\n\n ////////////////////////////////////////////////////////////////\n\n final long mod = (int)1e9 + 7;\n int n, k;\n Long[][] dp0, dp1;\n long[] pow2 = new long[1000];\n {\n pow2[0] = 1;\n for (int i = 1; i < pow2.length; i++) {\n pow2[i] = (pow2[i-1] * 2) % mod;\n }\n }\n\n void solve(){\n n = sc.nextInt();\n k = sc.nextInt();\n dp0 = new Long[k+1][n+1];\n for (Long[] val : dp0) fill(val, 0L);\n\n for (int sz = 1; sz <= n; sz++) {\n dp1 = new Long[k+1][n+1];\n\n for (int cnt = 0; cnt <= k; cnt++) {\n for (int last = 0; last <= sz; last++) {\n if( cnt == 0 ){\n if( last == 0 ) dp1[cnt][last] = 1L;\n else dp1[cnt][last] = 0L;\n }\n else if( sz == last ){\n if( cnt == 1 ){\n dp1[cnt][last] = (pow2[last]-1);\n }\n else{\n dp1[cnt][last] = 0L;\n for (int l = 1; l <= sz - 1; l++) {\n dp1[cnt][last] += (dp1[cnt-1][l] * (pow2[sz-l]-1)) % mod;\n }\n }\n }\n else{\n dp1[cnt][last] = dp0[cnt][last] * pow2[last];\n }\n dp1[cnt][last] = ( dp1[cnt][last]%mod + mod ) % mod;\n }\n }\n //\n dp0 = dp1;\n }\n long ans = 0;\n for (int last = 0; last <= n; last++) {\n ans += dp0[k][last];\n }\n ans %= mod;\n out.println( ans );\n }\n\n\n}", "lang": "Java 8", "bug_code_uid": "9248f317619b8f48f424d83f82a5e949", "src_uid": "111673158df2e37ac6c019bb99225ccb", "apr_id": "8a81cde82a76dbad9bc1d749e049a913", "difficulty": 2500, "tags": ["dp"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9914275917247686, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.math.BigInteger;\nimport java.util.Collections.*;\nimport static java.lang.Math.*;\nimport static java.lang.Math.max;\nimport static java.lang.Math.min;\nimport static java.util.Arrays.*;\nimport static java.math.BigInteger.*;\n\n\npublic class Main{\n\n void run(){\n Locale.setDefault(Locale.US);\n boolean my;\n try {\n my = System.getProperty(\"MY_LOCAL\") != null;\n } catch (Exception e) {\n my = false;\n\n }\n try{\n err = System.err;\n if( my ){\n sc = new FastScanner(new BufferedReader(new FileReader(\"input.txt\")));\n// sc = new FastScanner(new BufferedReader(new FileReader(\"C:\\\\myTest.txt\")));\n out = new PrintWriter (new FileWriter(\"output.txt\"));\n }\n else {\n sc = new FastScanner(new BufferedReader(new InputStreamReader(System.in)));\n out = new PrintWriter(new OutputStreamWriter(System.out));\n }\n// out = new PrintWriter(new OutputStreamWriter(System.out));\n }catch(Exception e){\n MLE();\n }\n if( my )\n tBeg = System.currentTimeMillis();\n solve();\n if( my )\n err.println( \"TIME: \" + (System.currentTimeMillis() - tBeg ) / 1e3 );\n exit(0);\n }\n\n void exit( int val ){\n err.flush();\n out.flush();\n System.exit(val);\n }\n\n double tBeg;\n FastScanner sc;\n PrintWriter out;\n PrintStream err;\n\n class FastScanner{\n\n StringTokenizer st;\n BufferedReader br;\n\n FastScanner( BufferedReader _br ){\n br = _br;\n }\n\n String readLine(){\n try {\n return br.readLine();\n } catch (IOException e) {\n return null;\n }\n }\n\n String next(){\n while( st==null || !st.hasMoreElements() )\n st = new StringTokenizer(readLine());\n return st.nextToken();\n }\n\n int nextInt(){ return Integer.parseInt(next()); }\n long nextLong(){ return Long.parseLong(next()); }\n double nextDouble(){ return Double.parseDouble(next()); }\n }\n\n void MLE(){\n int[][] arr = new int[1024*1024][]; for( int i = 0; i < 1024*1024; ++i ) arr[i] = new int[1024*1024];\n }\n\n void MLE( boolean doNotMLE ){ if( !doNotMLE ) MLE(); }\n\n void TLE(){\n for(;;);\n }\n\n public static void main(String[] args) {\n new Main().run();\n// new Thread( null, new Runnable() {\n// @Override\n// public void run() {\n// new Main().run();\n// }\n// }, \"Lolka\", 256_000_000L ).run();\n }\n\n ////////////////////////////////////////////////////////////////\n\n final int mod = (int)1e9 + 7;\n int n, k;\n long[][] dp0, dp1;\n long[] pow2 = new long[600];\n {\n pow2[0] = 1;\n for (int i = 1; i < pow2.length; i++) {\n pow2[i] = (pow2[i-1] * 2) % mod;\n }\n }\n\n void solve(){\n n = sc.nextInt();\n k = sc.nextInt();\n dp0 = new long[k+1][n+1];\n for (long[] val : dp0) fill(val, 0L);\n\n for (int sz = 1; sz <= n; sz++) {\n dp1 = new long[k+1][n+1];\n\n for (int cnt = 0; cnt <= k; cnt++) {\n for (int last = 0; last <= sz; last++) {\n if( cnt == 0 ){\n if( last == 0 ) dp1[cnt][last] = 1L;\n else dp1[cnt][last] = 0L;\n }\n else if( sz == last ){\n if( cnt == 1 ){\n dp1[cnt][last] = pow2[last] - 1;\n }\n }\n else{\n dp1[cnt][last] = (dp0[cnt][last] * pow2[last]) % mod;\n }\n dp1[cnt][last] = dp1[cnt][last];\n\n if( 1<=last && last <= sz-1 && 1 <= cnt && cnt+1 <= k ){\n dp1[cnt+1][sz] += (dp1[cnt][last] * (pow2[sz-last]-1)) % mod;\n }\n }\n }\n //\n dp0 = dp1;\n }\n long ans = 0;\n for (int last = 0; last <= n; last++) {\n ans += dp0[k][last];\n }\n ans %= mod;\n out.println( ans );\n }\n\n\n}", "lang": "Java 8", "bug_code_uid": "efc3c9c9001c821eeceedcfe53258fe8", "src_uid": "111673158df2e37ac6c019bb99225ccb", "apr_id": "8a81cde82a76dbad9bc1d749e049a913", "difficulty": 2500, "tags": ["dp"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8235897435897436, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 5, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "/*\n * To change this license header, choose License Headers in Project Properties.\n * To change this template file, choose Tools | Templates\n * and open the template in the editor.\n */\npackage robot;\n\nimport java.util.Scanner;\n\n/**\n *\n * @author KaYdaz\n */\npublic class Robot {\n\n /**\n * @param args the command line arguments\n */\n public static void main(String[] args) {\n // TODO code application logic here\n Scanner scan = new Scanner(System.in);\n int n = Integer.parseInt(scan.nextLine());\n String ch = scan.nextLine();\n int nbr_move=0;\n boolean b = true;\n while (b)\n {\n if ((ch.contains(\"U\")&&ch.contains(\"D\")))\n {\n ch = ch.replaceFirst(\"U\", \"\");\n ch = ch.replaceFirst(\"D\", \"\");\n nbr_move+=2;\n }\n else if (ch.contains(\"L\")&&ch.contains(\"R\"))\n {\n ch = ch.replaceFirst(\"L\", \"\");\n ch = ch.replaceFirst(\"R\", \"\");\n nbr_move+=2;\n }\n else b = false;\n }\n System.out.println(nbr_move);\n }\n \n}\n", "lang": "Java 8", "bug_code_uid": "1613ca9782cd42cd7e93b5b156b8822d", "src_uid": "b9fa2bb8001bd064ede531a5281cfd8a", "apr_id": "8118e7a400e269ecbf42407eb81b94a5", "difficulty": 1000, "tags": ["greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9529616724738676, "equal_cnt": 8, "replace_cnt": 3, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "package main;\n\nimport java.util.Scanner;\nimport java.io.*;\n\npublic class main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner input =new Scanner(System.in);\n\t\tint quan= input.nextInt();\n\t\tScanner input2 =new Scanner(System.in);\n\t\tString command= input2.next();\n\t\tint upA=0,downA=0,leftA=0,rightA=0;\n\t\tfor (int i=0;i> 1, i == 1 ? 1 : posA,\n\t\t\t\t\t\tother == 1 ? 1 : posB, x, sum);\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic static int[] KMP(String val) {\n\t\tint i = 0;\n\t\tint j = -1;\n\t\tint[] result = new int[val.length() + 1];\n\t\tresult[0] = -1;\n\t\twhile (i < val.length()) {\n\t\t\twhile (j >= 0 && val.charAt(j) != val.charAt(i)) {\n\t\t\t\tj = result[j];\n\t\t\t}\n\t\t\tj++;\n\t\t\ti++;\n\t\t\tresult[i] = j;\n\t\t}\n\t\treturn result;\n\n\t}\n\n\tpublic static boolean nextPer(int[] data) {\n\t\tint i = data.length - 1;\n\t\twhile (i > 0 && data[i] < data[i - 1]) {\n\t\t\ti--;\n\t\t}\n\t\tif (i == 0) {\n\t\t\treturn false;\n\t\t}\n\t\tint j = data.length - 1;\n\t\twhile (data[j] < data[i - 1]) {\n\t\t\tj--;\n\t\t}\n\t\tint temp = data[i - 1];\n\t\tdata[i - 1] = data[j];\n\t\tdata[j] = temp;\n\t\tArrays.sort(data, i, data.length);\n\t\treturn true;\n\t}\n\n\tpublic static int digit(long n) {\n\t\tint result = 0;\n\t\twhile (n > 0) {\n\t\t\tn /= 10;\n\t\t\tresult++;\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic static double dist(long a, long b, long x, long y) {\n\t\tdouble val = (b - a) * (b - a) + (x - y) * (x - y);\n\t\tval = Math.sqrt(val);\n\t\tdouble other = x * x + a * a;\n\t\tother = Math.sqrt(other);\n\t\treturn val + other;\n\n\t}\n\n\tpublic static class Point implements Comparable {\n\n\t\tint x, y;\n\n\t\tpublic Point(int start, int end) {\n\t\t\tthis.x = start;\n\t\t\tthis.y = end;\n\t\t}\n\n\t\t@Override\n\t\tpublic int hashCode() {\n\t\t\tint hash = 5;\n\t\t\thash = 47 * hash + this.x;\n\t\t\thash = 47 * hash + this.y;\n\t\t\treturn hash;\n\t\t}\n\n\t\t@Override\n\t\tpublic boolean equals(Object obj) {\n\t\t\tif (obj == null) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (getClass() != obj.getClass()) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tfinal Point other = (Point) obj;\n\t\t\tif (this.x != other.x) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (this.y != other.y) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(Point o) {\n\t\t\treturn x - o.x;\n\t\t}\n\t}\n\n\tpublic static class FT {\n\n\t\tlong[] data;\n\n\t\tFT(int n) {\n\t\t\tdata = new long[n];\n\t\t}\n\n\t\tpublic void update(int index, long value) {\n\t\t\twhile (index < data.length) {\n\t\t\t\tdata[index] += value;\n\t\t\t\tindex += (index & (-index));\n\t\t\t}\n\t\t}\n\n\t\tpublic long get(int index) {\n\t\t\tlong result = 0;\n\t\t\twhile (index > 0) {\n\t\t\t\tresult += data[index];\n\t\t\t\tindex -= (index & (-index));\n\t\t\t}\n\t\t\treturn result;\n\n\t\t}\n\t}\n\n\tpublic static long gcd(long a, long b) {\n\t\tif (b == 0) {\n\t\t\treturn a;\n\t\t}\n\t\treturn gcd(b, a % b);\n\t}\n\n\tpublic static long pow(long a, long b) {\n\t\tif (b == 0) {\n\t\t\treturn 1;\n\t\t}\n\t\tif (b == 1) {\n\t\t\treturn a;\n\t\t}\n\t\tlong val = pow(a, b / 2);\n\t\tif (b % 2 == 0) {\n\t\t\treturn val * val % MOD;\n\t\t} else {\n\t\t\treturn val * (val * a % MOD) % MOD;\n\n\t\t}\n\t}\n\n\tstatic class Scanner {\n\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tpublic Scanner() throws FileNotFoundException {\n\t\t\t// System.setOut(new PrintStream(new\n\t\t\t// BufferedOutputStream(System.out), true));\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t\t// br = new BufferedReader(new InputStreamReader(new\n\t\t\t// FileInputStream(new File(\"input.txt\"))));\n\t\t}\n\n\t\tpublic String next() {\n\n\t\t\twhile (st == null || !st.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tthrow new RuntimeException();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic double nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tpublic String nextLine() {\n\t\t\tst = null;\n\t\t\ttry {\n\t\t\t\treturn br.readLine();\n\t\t\t} catch (Exception e) {\n\t\t\t\tthrow new RuntimeException();\n\t\t\t}\n\t\t}\n\n\t\tpublic boolean endLine() {\n\t\t\ttry {\n\t\t\t\tString next = br.readLine();\n\t\t\t\twhile (next != null && next.trim().isEmpty()) {\n\t\t\t\t\tnext = br.readLine();\n\t\t\t\t}\n\t\t\t\tif (next == null) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tst = new StringTokenizer(next);\n\t\t\t\treturn st.hasMoreTokens();\n\t\t\t} catch (Exception e) {\n\t\t\t\tthrow new RuntimeException();\n\t\t\t}\n\t\t}\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "89d2aeb56e974579798c8b3223038aaf", "src_uid": "18410980789b14c128dd6adfa501aea5", "apr_id": "6762cd38d632469bccd7dbe1fea8f65c", "difficulty": 1700, "tags": ["dp", "math", "constructive algorithms", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.4679474985733308, "equal_cnt": 30, "replace_cnt": 14, "delete_cnt": 15, "insert_cnt": 1, "fix_ops_cnt": 30, "bug_source_code": "import java.util.*;\nimport java.io.*;\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\nimport java.math.MathContext;\n \npublic class Es\n{\n\tstatic class P implements Comparable\n\t{\n\t\tint first;\n\t\tint second;\n\t\t\n\t\tpublic P(int f, int s)\n\t\t{\n\t\t\tfirst = f;\n\t\t\tsecond = s;\n\t\t}\n\t\t\n\t\tpublic String toString()\n\t\t{\n\t\t\treturn first + \" \" + second;\n\t\t}\n\t\t\n\t\tpublic int compareTo(Object o)\n\t\t{\n\t\t\tP p2 = (P)o;\n\t\t\tif(this.first - this.second > p2.first - p2.second)\n\t\t\t\treturn -1;\n\t\t\tif(this.first - this.second < p2.first - p2.second)\n\t\t\t\treturn 1;\n\t\t\treturn 0;\n\t\t}\n\t}\n\t\n\tstatic int log2(double a)\n\t{\n\t\treturn (int)(Math.log(a) / Math.log(2));\n\t}\n\t\n\tstatic long gcd(long a, long b)\n\t{\n\t\tlong r;\n\t\twhile((r = a % b) > 0)\n\t\t{\n\t\t\ta = b;\n\t\t\tb = r;\n\t\t}\n\t\treturn b;\n\t}\n\t\n\tstatic long ans = 0;\n\tstatic int n, m;\n\t\n\tstatic void fun(long[] v, int i, long curr)\n\t{\n\t\tfor(int j = i; j < n; j ++)\n\t\t{\n\t\t\tlong possibleAns = (curr + v[j]) % m;\n\t\t\tif(m - ans > m - possibleAns)\n\t\t\t\tans = possibleAns;\n\t\t\tfun(v, j + 1, possibleAns);\n\t\t}\n\t}\n\t\n\tpublic static void main(String[] args) throws IOException\n\t{\n\t\tn = in.nextInt();\n\t\tm = in.nextInt();\n\t\tlong[] v = new long[n];\n\t\tfor(int i = 0; i < n; i ++)\n\t\t\tv[i] = in.nextLong() % m;\n\t\tfun(v, 0, 0);\n\t\tsop(ans);\n\t}\n \n\tstatic class FastReader\n {\n BufferedReader br;\n StringTokenizer st;\n \n public FastReader()\n {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n \n String next()\n {\n while (st == null || !st.hasMoreElements())\n {\n try\n {\n st = new StringTokenizer(br.readLine());\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n \n int nextInt()\n {\n return Integer.parseInt(next());\n }\n \n long nextLong()\n {\n return Long.parseLong(next());\n }\n \n double nextDouble()\n {\n return Double.parseDouble(next());\n }\n \n String nextLine()\n {\n String str = \"\";\n try\n {\n str = br.readLine();\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n return str;\n }\n }\n\t\n static FastReader in = new FastReader();\n \n public static void sop(Object o)\n {\n \tSystem.out.print(o);\n }\n}", "lang": "Java 8", "bug_code_uid": "c9caf81c477f716abfe716fbfdb1d3c5", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "apr_id": "6fb0f7143c6753993f5228ff97a0684e", "difficulty": 1800, "tags": ["divide and conquer", "meet-in-the-middle", "bitmasks"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9819922498290403, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*;\nimport java.io.*;\npublic class A\n{\n public static void main(String ar[]) throws Exception\n {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n String s1[]=br.readLine().split(\" \");\n String s2[]=br.readLine().split(\" \");\n \n int n=Integer.parseInt(s1[0]);\n long m=Long.parseLong(s1[1]);\n \n int l1=n/2;\n int l2=n-n/2;\n long a[]=new long[l1];\n long b[]=new long[l2];\n for(int i=0;i al1=new ArrayList();\n ArrayList al2=new ArrayList();\n long ll1=(long)Math.pow(2,l1)-1;\n long ll2=(long)Math.pow(2,l2)-1;\n for(int i=0;i<=ll1;i++)\n {\n int u=i;\n int j=0;\n long S=0;\n while(u>0)\n {\n if(u%2==1)\n S+=a[j];\n u=u/2; j++;\n }\n al1.add(S%m);\n }\n \n for(int i=0;i<=ll2;i++)\n {\n int u=i;\n int j=0;\n long S=0;\n while(u>0)\n {\n if(u%2==1)\n S+=b[j];\n u=u/2; j++;\n }\n al2.add(S%m);\n }\n \n Collections.sort(al1);\n Collections.sort(al2);\n long t=0;\n for(int i=0;i hs = new HashSet<>();\n hs.add(0);\n for (int i = 0; i < n; i++) {\n ArrayList aa = new ArrayList<>();\n for (int j : hs) {\n aa.add((j + a[i]) % m);\n }\n hs.addAll(aa);\n }\n int res = 0;\n for (int j : hs) {\n res = Math.max(res, j);\n }\n out.println(res);\n\n }\n\n }\n\n\n public static int GetMax(int[] ar) {\n int max = Integer.MIN_VALUE;\n for (int a : ar) {\n max = Math.max(max, a);\n }\n return max;\n }\n\n public static int GetMin(int[] ar) {\n int min = Integer.MAX_VALUE;\n for (int a : ar) {\n min = Math.min(min, a);\n }\n return min;\n }\n\n public static long GetSum(int[] ar) {\n long s = 0;\n for (int a : ar) s += a;\n return s;\n }\n\n public static int[] GetCount(int[] ar) {\n return GetCount(ar, GetMax(ar));\n }\n\n public static int[] GetCount(int[] ar, int maxValue) {\n int[] dp = new int[maxValue + 1];\n for (int a : ar) {\n dp[a]++;\n }\n return dp;\n }\n\n static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n public String Next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine(), \" \\t\\n\\r\\f,\");\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int NextInt() {\n return Integer.parseInt(Next());\n }\n\n public long NextLong() {\n return Long.parseLong(Next());\n }\n\n public double NextDouble() {\n return Double.parseDouble(Next());\n }\n\n public int[] NextIntArray(int n) {\n return NextIntArray(n, 0);\n }\n\n public int[] NextIntArray(int n, int offset) {\n int[] a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = NextInt() - offset;\n }\n return a;\n }\n\n public int[][] NextIntMatrix(int n, int m) {\n return NextIntMatrix(n, m, 0);\n }\n\n public int[][] NextIntMatrix(int n, int m, int offset) {\n int[][] a = new int[n][m];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n a[i][j] = NextInt() - offset;\n }\n }\n return a;\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "25568022249a4d255f0349e48cf41910", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "apr_id": "4c2cfcf31ed88ef0d376680529ef0f39", "difficulty": 1800, "tags": ["divide and conquer", "meet-in-the-middle", "bitmasks"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.997655663915979, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\nimport java.io.*;\nimport java.io.FileWriter; \nimport java.math.BigInteger;\nimport java.math.BigDecimal;\n// Solution\n \npublic class Main \n{ \n public static void main (String[] argv) \n {\n\t new Main();\n } \n \n \n boolean test = false; \n final int[][] dirs8 = {{0,1}, {0,-1}, {-1,0}, {1,0}, {1,1},{1,-1},{-1,1},{-1,-1}};\n final int[][] dirs4 = {{0,1}, {0,-1}, {-1,0}, {1,0}};\n final int MOD = 1000000007; //998244353;\n \n \n \n final int WALL = -1;\n final int EMPTY = -2;\n final int VISITED = 1;\n final int FULL = 2;\n \n final int START = 1;\n final int END = 0;\n \n int[] fac;\n int[] ifac;\n int[] rfac;\n \n int[] pow2;\n \n int[] mobius;\n int[] sieve;\n int[][] factors;\n \n int[][] dp;\n final int OK = Integer.MAX_VALUE;\n\n public Main() {\n\tFastReader in = new FastReader(new BufferedReader(new InputStreamReader(System.in)));\n\t\n \n //FastReader in = new FastReader(new BufferedReader(new FileReader(\"Main.in\"))); \n \n //int nt = in.nextInt(); \n int nt = 1;\n StringBuilder sb = new StringBuilder();\n \n \n for (int it = 0; it < nt; it++) \n { \n //long k = in.nextLong();\n \n int n = in.nextInt();\n int m = in.nextInt();\n int[] a = new int[n];\n\n for (int i = 0; i < n; i++) {\n a[i] = in.nextInt() % m;\n }\n int mid = (n-1)/2;\n Integer[] lvals = build(a, 0, mid, m);\n Integer[] rvals = build(a, mid+1, n - 1, m);\n int llen = lvals.length;\n int rlen = rvals.length;\n int lmax = lvals[llen - 1];\n int rmax = rvals[rlen - 1];\n if (lmax == m - 1 || rmax == m - 1) {\n System.out.println(m-1);\n return;\n }\n \n int max = Math.max(lmax, rmax);\n for (int i = 0, j = rlen - 1; i < llen; i++) {\n int tgt = m - 1 - lvals[i];\n while (j >= 0 && rvals[j] > tgt) j--;\n if (j < 0) break;\n max = Math.max(max, rvals[j] + lvals[i]);\n }\n System.out.println(max);\n }\n \n System.out.print(sb);\n }\n \n private Integer[] build(int[] a, int lo, int hi, int m)\n { \n int n = hi - lo + 1;\n int S = (1 << n);\n Integer[] ans = new Integer[S-1];\n int k = 0;\n for (int i = 1; i < S; i++)\n {\n int sum = 0; \n for (int j = 0; j < n; j++)\n {\n if (((i >>> j) & 1) != 0){\n //pick current location\n sum += a[j+lo];\n if (sum >= m) sum -= m;\n }\n }\n ans[k++] = sum;\n }\n Arrays.sort(ans);\n return ans;\n }\n \n class Node implements Comparable{\n int lo, hi;\n public Node(int lo, int hi)\n {\n this.lo = lo;\n this.hi = hi;\n }\n \n @Override\n public int compareTo(Node o){\n if (lo != o.lo) return lo - o.lo;\n return hi - o.hi;\n }\n }\n \n private long[][] matIdentity(int n)\n {\n long[][] a = new long[n][n];\n for (int i = 0; i < n; i++)\n a[i][i] = 1;\n return a;\n }\n private long[][] matPow(long[][] mat0, long p)\n {\n int n = mat0.length;\n long[][] ans = matIdentity(n);\n long[][] mat = matCopy(mat0);\n while (p > 0)\n {\n if (p % 2 == 1){\n ans = matMul(ans, mat);\n }\n \n p /= 2;\n mat = matMul(mat, mat);\n }\n return ans;\n }\n \n private long[][] matCopy(long[][] a)\n {\n int n = a.length;\n long[][] b = new long[n][n];\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n b[i][j] = a[i][j];\n return b;\n }\n private long[][] matMul(long[][] a, long[][] b)\n {\n int n = a.length;\n \n long[][] c = new long[n][n];\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n for (int k = 0; k < n; k++)\n c[i][j] = (c[i][j] + a[i][k] * b[k][j]) % MOD;\n }\n }\n \n return c;\n }\n \n private long[] matMul(long[][] a, long[] b)\n {\n int n = a.length;\n \n long[] c = new long[n];\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n c[i] = (c[i] + a[i][j] * b[j]) % MOD;\n }\n \n return c;\n }\n \n class Mark implements Comparable {\n int type, h;\n long x;\n public Mark(int h, long x, int type)\n {\n this.h = h;\n this.x = x;\n this.type = type;\n } \n \n @Override\n public int compareTo(Mark o)\n {\n if (this.x == o.x) return type - o.type; // let end comes before start\n return Long.compare(x, o.x); \n }\n }\n \n private boolean coLinear(int[] p, int[] q, int[] r)\n {\n return 1L * (p[1] - r[1]) * (q[0] - r[0]) == 1L * (q[1] - r[1]) * (p[0] - r[0]);\n }\n \n \n private void fill(char[] a, int lo, int c, char letter)\n {\n //System.out.println(\"fill \" + lo + \" \" + c + \" \" + letter);\n for (int i = lo; i < lo + c; i++) a[i] = letter;\n }\n \n \n \n private int cntBitOne(String s){\n int c = 0, n = s.length();\n for (int i = 0; i < n; i++) \n if (s.charAt(i) == '1') c++;\n return c;\n }\n \n class DSU {\n int n;\n int[] par;\n int[] sz;\n int nGroup;\n \n public DSU(int n)\n {\n this.n = n;\n par = new int[n];\n sz = new int[n];\n for (int i = 0; i < n; i++){\n par[i] = i;\n sz[i] = 1;\n }\n nGroup = n; \n }\n \n private boolean add(int p, int q) {\n int rp = find(p);\n int rq = find(q);\n if (rq == rp) return false;\n \n if (sz[rp] <= sz[rq]) {\n sz[rq] += sz[rp];\n par[rp] = rq;\n }else {\n sz[rp] += sz[rq];\n par[rq] = rp;\n }\n nGroup--;\n return true;\n }\n \n private int find(int p)\n {\n int r = p;\n while (par[r] != r) r = par[r];\n \n while (r != p) {\n int t = par[p];\n par[p] = r;\n p = t;\n }\n return r;\n }\n \n }\n \n \n // \u03bc(n) = 1 if n is a square-free positive integer with an even number of prime factors. e.g. 6, 15\n // \u03bc(n) = \u22121 if n is a square-free positive integer with an odd number of prime factors. e.g. 2, 3, 5, 2*3*5\n // \u03bc(n) = 0 if n has a squared prime factor. e.g : 2*2, 3*3*5\n private void build_pow2_function(int n)\n {\n pow2 = new int[n+1];\n pow2[0] = 1;\n for (int i = 1; i <= n; i++) pow2[i] = (int)(1L * pow2[i-1] * 2 % MOD);\n }\n \n private void build_fac_function(int n)\n {\n fac = new int[n+1];\n fac[0] = 1;\n for (int i = 1; i <= n; i++)\n fac[i] = (int)(1L * fac[i-1] * i % MOD);\n }\n \n private void build_ifac_function(int n)\n {\n ifac = new int[n+1];\n ifac[0] = 1;\n for (int i = 1; i <= n; i++)\n ifac[i] = (int)(1L * ifac[i-1] * inv(i) % MOD);\n }\n \n private void build_sieve_function(int n)\n {\n sieve = new int[n+1];\n for (int i = 2; i <= n; i++)\n sieve[i] = i;\n for (int i = 2; i <= n; i++) \n {\n if (sieve[i] == i){\n for (long j = 1L * i * i; j <= n; j += i)\n sieve[(int)j] = i;\n }\n }\n }\n \n private void build_mobius_function(int n)\n {\n mobius = new int[n+1];\n sieve = new int[n+1];\n factors = new int[n+1][];\n //for (int i = 1; i <= n; i++)factors[i] = new ArrayList<>();\n for (int i = 2; i <= n; i++)\n sieve[i] = i;\n for (int i = 2; i <= n; i++) \n {\n if (sieve[i] == i){\n mobius[i] = -1;\n for (long j = 1L * i * i; j <= n; j += i)\n sieve[(int)j] = i;\n }\n }\n \n for (int i = 6; i <= n; i++)\n {\n if (sieve[i] != i) {\n int pre = i / sieve[i];\n if (pre % sieve[i] != 0)\n mobius[i] = -mobius[pre];\n }\n }\n int[] sz = new int[n+1];\n long tot = 0;\n for (int i = 2; i <= n; i++) \n {\n if (mobius[i] != 0)\n {\n for (int j = i * 2; j <= n; j += i) { \n sz[j]++;\n tot++;\n } \n }\n }\n for (int i = 2; i <= n; i++) {\n factors[i] = new int[sz[i]];\n sz[i] = 0;\n }\n \n \n for (int i = 2; i <= n; i++) \n {\n if (mobius[i] != 0)\n {\n for (int j = i * 2; j <= n; j += i) {\n factors[j][sz[j]++] = i;\n //factors[j].add(i);\n } \n }\n }\n //System.out.println(\"tot = \" + tot);\n }\n \n private int[] build_z_function(String s)\n {\n int n = s.length();\n int[] zfun = new int[n];\n \n int l = -1, r = -1;\n for (int i = 1; i < n; i++)\n {\n // Set the start value\n if (i <= r)\n zfun[i] = Math.min(zfun[i-l], r - i + 1);\n \n while (i + zfun[i] < n && s.charAt(i + zfun[i]) == s.charAt(zfun[i])) \n zfun[i]++; \n \n if (i + zfun[i] - 1> r){\n l = i;\n r = i + zfun[i] - 1;\n }\n }\n \n if (test)\n {\n System.out.println(\"Z-function of \" + s);\n for (int i = 0; i < n; i++) System.out.print(zfun[i] + \" \");\n System.out.println();\n }\n return zfun;\n }\n \n class BIT {\n int[] bit;\n int n;\n \n public BIT(int n){\n this.n = n;\n bit = new int[n+1];\n }\n \n private int query(int p)\n {\n int sum = 0;\n for (; p > 0; p -= (p & (-p)))\n sum += bit[p];\n \n return sum;\n }\n \n private void add(int p, int val)\n {\n //System.out.println(\"add to BIT \" + p);\n for (; p <= n; p += (p & (-p)))\n bit[p] += val;\n }\n \n \n }\n \n \n \n private List getMinFactor(int sum)\n {\n List factors = new ArrayList<>();\n \n for (int sz = 2; sz <= sum / sz; sz++){\n if (sum % sz == 0) {\n factors.add(sz);\n factors.add(sum / sz);\n }\n }\n if (factors.size() == 0)\n factors.add(sum);\n \n return factors;\n }\n \n /* Tree class */\n class Tree {\n int V = 0;\n int root = 0;\n List[] nbs;\n int[][] timeRange;\n int[] subTreeSize;\n int t;\n boolean dump = false;\n \n public Tree(int V, int root)\n {\n if (dump) \n System.out.println(\"build tree with size = \" + V + \", root = \" + root); \n \n this.V = V; \n this.root = root;\n nbs = new List[V];\n subTreeSize = new int[V];\n for (int i = 0; i < V; i++)\n nbs[i] = new ArrayList<>();\n \n \n }\n \n public void doneInput()\n {\n dfsEuler();\n }\n \n public void addEdge(int p, int q)\n {\n nbs[p].add(q);\n nbs[q].add(p);\n }\n \n private void dfsEuler()\n {\n timeRange = new int[V][2]; \n t = 1;\n dfs(root); \n }\n \n private void dfs(int node)\n {\n if (dump)\n System.out.println(\"dfs on node \" + node + \", at time \" + t);\n timeRange[node][0] = t;\n \n for (int next : nbs[node]) {\n if (timeRange[next][0] == 0)\n {\n ++t;\n dfs(next); \n }\n }\n timeRange[node][1] = t;\n subTreeSize[node] = t - timeRange[node][0] + 1;\n }\n \n public List getNeighbors(int p) {\n return nbs[p];\n }\n \n public int[] getSubTreeSize(){\n return subTreeSize;\n }\n \n public int[][] getTimeRange()\n {\n if (dump){\n for (int i = 0; i < V; i++){\n System.out.println(i + \": \" + timeRange[i][0] + \" - \" + timeRange[i][1]);\n }\n }\n return timeRange;\n }\n \n }\n \n /* segment tree */\n class SegTree {\n int[] a;\n int[] tree;\n int[] treeMin;\n int[] treeMax;\n int[] lazy;\n int n;\n boolean dump = false;\n \n public SegTree(int n)\n {\n if (dump)\n System.out.println(\"create segTree with size \" + n);\n this.n = n;\n treeMin = new int[n*4];\n treeMax = new int[n*4];\n lazy = new int[n*4];\n }\n \n public SegTree(int n, int[] a) {\n this(n);\n this.a = a;\n buildTree(1, 0, n-1); \n }\n \n private void buildTree(int node, int lo, int hi)\n {\n if (lo == hi) {\n tree[node] = lo;\n return;\n }\n \n int m = (lo + hi) / 2;\n buildTree(node * 2, lo, m);\n buildTree(node * 2 + 1, m + 1, hi);\n pushUp(node, lo, hi);\n }\n \n \n private void pushUp(int node, int lo, int hi)\n {\n if (lo >= hi) return;\n \n // note that, if we need to call pushUp on a node, then lazy[node] must be zero.\n \n //the true value is the value + lazy\n treeMin[node] = Math.min(treeMin[node * 2] + lazy[node * 2], treeMin[node * 2 + 1] + lazy[node * 2 + 1]);\n treeMax[node] = Math.max(treeMax[node * 2] + lazy[node * 2], treeMax[node * 2 + 1] + lazy[node * 2 + 1]);\n // add combine fcn\n }\n \n private void pushDown(int node, int lo, int hi)\n {\n if (lazy[node] == 0) return;\n \n int lz = lazy[node];\n lazy[node] = 0; \n \n \n treeMin[node] += lz;\n treeMax[node] += lz; \n \n if (lo == hi) return;\n \n int mid = (lo + hi) / 2;\n lazy[node * 2] += lz;\n lazy[node * 2 + 1] += lz;\n }\n \n public int rangeQueryMax(int fr, int to)\n {\n return rangeQueryMax(1, 0, n-1, fr, to);\n }\n \n public int rangeQueryMax(int node, int lo, int hi, int fr, int to)\n {\n if (lo == fr && hi == to)\n return treeMax[node] + lazy[node];\n \n int mid = (lo + hi) / 2;\n pushDown(node, lo, hi);\n \n if (to <= mid) {\n return rangeQueryMax(node * 2, lo, mid, fr, to);\n }else if (fr > mid)\n return rangeQueryMax(node * 2 + 1, mid + 1, hi, fr, to);\n else {\n return Math.max(rangeQueryMax(node * 2, lo, mid, fr, mid),\n rangeQueryMax(node * 2 + 1, mid + 1, hi, mid + 1, to)); \n }\n }\n \n public int rangeQueryMin(int fr, int to)\n {\n return rangeQueryMin(1, 0, n-1, fr, to);\n }\n \n public int rangeQueryMin(int node, int lo, int hi, int fr, int to)\n {\n if (lo == fr && hi == to)\n return treeMin[node] + lazy[node];\n \n int mid = (lo + hi) / 2;\n pushDown(node, lo, hi);\n \n if (to <= mid) {\n return rangeQueryMin(node * 2, lo, mid, fr, to);\n }else if (fr > mid)\n return rangeQueryMin(node * 2 + 1, mid + 1, hi, fr, to);\n else {\n return Math.min(rangeQueryMin(node * 2, lo, mid, fr, mid),\n rangeQueryMin(node * 2 + 1, mid + 1, hi, mid + 1, to)); \n }\n }\n \n public void rangeUpdate(int fr, int to, int delta){\n rangeUpdate(1, 0, n-1, fr, to, delta);\n }\n \n \n public void rangeUpdate(int node, int lo, int hi, int fr, int to, int delta){\n pushDown(node, lo, hi);\n if (fr == lo && to == hi)\n {\n lazy[node] = delta;\n return;\n }\n \n int m = (lo + hi) / 2;\n if (to <= m) \n rangeUpdate(node * 2, lo, m, fr, to, delta);\n else if (fr > m)\n rangeUpdate(node * 2 + 1, m + 1, hi, fr, to, delta);\n else {\n rangeUpdate(node * 2, lo, m, fr, m, delta);\n rangeUpdate(node * 2 + 1, m + 1, hi, m + 1, to, delta); \n }\n \n // re-set the in-variant\n pushUp(node, lo, hi);\n }\n \n \n \n public int query(int node, int lo, int hi, int fr, int to)\n {\n if (fr == lo && to == hi)\n return tree[node];\n \n int m = (lo + hi) / 2;\n if (to <= m) \n return query(node * 2, lo, m, fr, to);\n else if (fr > m)\n return query(node * 2 + 1, m + 1, hi, fr, to);\n \n int lid = query(node * 2, lo, m, fr, m);\n int rid = query(node * 2 + 1, m + 1, hi, m + 1, to);\n return a[lid] >= a[rid] ? lid : rid;\n }\n \n \n }\n \n \n private long inv(long v)\n {\n return pow(v, MOD-2);\n }\n \n private long pow(long v, long p)\n {\n long ans = 1;\n while (p > 0)\n {\n if (p % 2 == 1)\n ans = ans * v % MOD;\n v = v * v % MOD;\n p = p / 2;\n }\n return ans;\n }\n \n private double dist(double x, double y, double xx, double yy)\n {\n return Math.sqrt((xx - x) * (xx - x) + (yy - y) * (yy - y));\n }\n \n \n \n \n private int mod_add(int a, int b) {\n int v = a + b;\n if (v >= MOD) v -= MOD;\n return v;\n }\n \n \n private long overlap(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) {\n if (x1 > x3) return overlap(x3, y3, x4, y4, x1, y1, x2, y2);\n \n if (x3 > x2 || y4 < y1 || y3 > y2) return 0L;\n \n //(x3, ?, x2, ?)\n int yL = Math.max(y1, y3);\n int yH = Math.min(y2, y4); \n int xH = Math.min(x2, x4);\n \n return f(x3, yL, xH, yH);\n }\n //return #black cells in rectangle\n private long f(int x1, int y1, int x2, int y2) {\n long dx = 1L + x2 - x1;\n long dy = 1L + y2 - y1;\n if (dx % 2 == 0 || dy % 2 == 0 || (x1 + y1) % 2 == 0) \n return 1L * dx * dy / 2;\n return 1L * dx * dy / 2 + 1;\n }\n \n private int distM(int x, int y, int xx, int yy) {\n return abs(x - xx) + abs(y - yy);\n }\n \n private boolean less(int x, int y, int xx, int yy) {\n return x < xx || y > yy;\n }\n \n private int mul(int x, int y) {\n return (int)(1L * x * y % MOD);\n }\n \n \n \n \n private int nBit1(int v) {\n int v0 = v;\n int c = 0;\n while (v != 0) {\n ++c;\n v = v & (v - 1);\n }\n return c;\n }\n \n private long abs(long v) {\n return v > 0 ? v : -v;\n }\n \n private int abs(int v) {\n return v > 0 ? v : -v;\n }\n \n private int common(int v) {\n int c = 0;\n while (v != 1) {\n v = (v >>> 1);\n ++c;\n }\n \n return c;\n }\n \n private void reverse(char[] a, int i, int j) {\n while (i < j) {\n swap(a, i++, j--);\n }\n }\n \n private void swap(char[] a, int i, int j) {\n char t = a[i];\n a[i] = a[j];\n a[j] = t;\n }\n \n private int gcd(int x, int y) {\n if (y == 0) return x;\n return gcd(y, x % y);\n }\n private long gcd(long x, long y) {\n if (y == 0) return x;\n return gcd(y, x % y);\n }\n private int max(int a, int b) {\n return a > b ? a : b;\n }\n \n private long max(long a, long b) {\n return a > b ? a : b;\n }\n \n private int min(int a, int b) {\n return a > b ? b : a;\n }\n \n private long min(long a, long b) {\n return a > b ? b : a;\n }\n \n static class FastReader\n {\n BufferedReader br;\n StringTokenizer st;\n \n public FastReader(BufferedReader in)\n { \n br = in;\n }\n \n String next()\n {\n while (st == null || !st.hasMoreElements())\n {\n try\n {\n String line = br.readLine();\n if (line == null || line.length() == 0) return \"\";\n st = new StringTokenizer(line);\n }\n catch (IOException e)\n {\n return \"\";\n //e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n \n int nextInt()\n {\n return Integer.parseInt(next());\n }\n \n long nextLong()\n {\n return Long.parseLong(next());\n }\n \n double nextDouble()\n {\n return Double.parseDouble(next());\n }\n \n String nextLine()\n {\n String str = \"\";\n try\n {\n str = br.readLine();\n }\n catch (IOException e)\n {\n return null;\n //e.printStackTrace();\n }\n return str;\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "4633770c198a63e33bd0e8ead4cd7e2f", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "apr_id": "2a1f61de77302fd019e696ca81250553", "difficulty": 1800, "tags": ["divide and conquer", "meet-in-the-middle", "bitmasks"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9785042543663234, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 6, "bug_source_code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Scanner;\nimport java.util.Set;\nimport java.util.Collections;\nimport java.util.TreeSet;\nimport java.util.ArrayList;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author ZYCSwing\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n TaskE solver = new TaskE();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class TaskE {\n List solve(int[] a, int s, int e) {\n Set foo = new TreeSet<>();\n foo.add(0);\n for (int i = s; i < e; ++i) {\n Set tmp = new HashSet<>();\n for (int val : foo) {\n if (!foo.contains(val + a[i])) {\n tmp.add(val + a[i]);\n }\n }\n for (int val : tmp) {\n foo.add(val);\n }\n }\n\n List res = new ArrayList<>();\n res.addAll(foo);\n\n return res;\n }\n\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int n = in.nextInt(), m = in.nextInt();\n\n int[] a = new int[n];\n for (int i = 0; i < n; ++i) {\n a[i] = in.nextInt();\n a[i] %= m;\n }\n List left = solve(a, 0, n / 2);\n List right = solve(a, n / 2, n);\n\n int res = 0;\n for (int i : left) {\n int tmp = Collections.binarySearch(right, m - 1 - i);\n\n if (tmp >= 0) {\n res = m - 1;\n break;\n } else {\n tmp = -tmp - 2;\n res = Math.max(res, i + right.get(tmp));\n }\n }\n\n out.println(res);\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "d801c256a1f3a0cc255e48dabb2f19ba", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "apr_id": "6c479582f07faa5d26f88b1f9826e71b", "difficulty": 1800, "tags": ["divide and conquer", "meet-in-the-middle", "bitmasks"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.49712643678160917, "equal_cnt": 49, "replace_cnt": 39, "delete_cnt": 3, "insert_cnt": 6, "fix_ops_cnt": 48, "bug_source_code": "import java.util.* ;\nimport java.io.* ;\n\npublic class MaximumSubsequence\n{\n\tstatic boolean[] setChecker(int[] A,int m)\n\t{\n\t\tboolean[] M = new boolean[m] ;\n\t\tint set_size = A.length ;\n\t\tint power_set_size = (int)Math.pow(2,set_size) ;\n\t\tfor(int i=0;imaxPV)\n\t\t\t\t\t\t\tmaxPV = (i+j)%m ;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn maxPV ;\n\t}\n\tpublic static void main(String args[]) throws Exception\n\t{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in)) ;\n\t\tString line1 = br.readLine() ;\n\t\tString line2 = br.readLine() ;\n\t\tint size = Integer.parseInt(line1.split(\" \")[0]) ;\n\t\tint m = Integer.parseInt(line1.split(\" \")[1]) ;\n\t\tint[] A = new int[size] ;\n\t\tfor(int i=0;i>=1;\n\t\t n*=n;\t \n\t\t}\n\t\treturn result;\n\t}\n\tstatic HashSet setChecker(int[] A,int m)\n\t{\n\t\t// boolean[] M = new boolean[m] ;\n\t\tHashSet H = new HashSet() ;\n\t\tint set_size = A.length ;\n\t\tint power_set_size = (int)pow(2,set_size) ;\n\t\tfor(int i=0;i H1 = setChecker(first_half,m) ;\n\t\tHashSet H2 = setChecker(second_half,m) ;\n\t\tInteger[] A1 = H1.toArray(new Integer[H1.size()]) ;\n\t\tInteger[] A2 = H2.toArray(new Integer[H2.size()]) ;\n\t\t\n\t\t// Iterator I1 = H1.iterator() ;\n\t\t// Iterator I2 = H2.iterator() ;\n\t\t// System.out.println(\"H1:\") ;\n\t\tint maxPV = 0 ;\n\t\tfor(int i=0;i maxPV)\n\t\t\t\t\tmaxPV = (A1[i]+A2[j])%m ;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println() ;\n\t\t// while(I1.hasNext())\n\t\t// {\n\t\t\t// int i = I1.next() ;\n\t\t\t// while(I2.hasNext)\n\t\t\t// {\n\t\t\t\t// int j = I2.next() ;\n\t\t\t\t// if((i+j)%m>maxPV)\n\t\t\t\t\t// maxPV = (i+j)%m ;\n\t\t\t// }\n\t\t// }\n\t\t// System.out.println(maxPV) ;\n\t\t// System.out.println(\"\\nH2:\") ;\n\t\t// while(I2.hasNext())\n\t\t// {\n\t\t\t// System.out.print(I2.next()+\" \") ;\n\t\t// }\n\t\t// for(int i=0;imaxPV)\n\t\t\t\t\t\t\t// maxPV = (i+j)%m ;\n\t\t\t\t\t// }\n\t\t\t\t// }\n\t\t\t// }\n\t\t// }\n\t\t\t\n\t\treturn maxPV ;\n\t}\n\tpublic static void main(String args[]) throws Exception\n\t{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in)) ;\n\t\tString line1 = br.readLine() ;\n\t\tString line2 = br.readLine() ;\n\t\tint size = Integer.parseInt(line1.split(\" \")[0]) ;\n\t\tint m = Integer.parseInt(line1.split(\" \")[1]) ;\n\t\tint[] A = new int[size] ;\n\t\tfor(int i=0;i charsCount = new HashMap<>();\n\n for (char c: baloons.toCharArray()) {\n Integer count = charsCount.get(c);\n if (count == null) {\n count = 0;\n }\n charsCount.put(c, count + 1);\n }\n\n boolean valid = true;\n for (Map.Entry c :\n charsCount.entrySet()) {\n if (c.getValue() < friendsCnt) {\n valid = false;\n break;\n }\n }\n System.out.println(valid ? \"YES\" : \"NO\");\n }\n}\n", "lang": "Java 8", "bug_code_uid": "0526e202017da0d6c8ba632696c7372c", "src_uid": "ceb3807aaffef60bcdbcc9a17a1391be", "apr_id": "529db78dec1717bbc41d7c2f84cc3262", "difficulty": 900, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9995217599234816, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.File;\nimport java.io.FileInputStream;\nimport java.io.FileNotFoundException;\nimport java.io.PrintWriter;\nimport java.text.DecimalFormat;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.List;\nimport java.util.PriorityQueue;\nimport java.util.Random;\nimport java.util.Scanner;\nimport java.io.*;\n\npublic class Main {\n\tpublic static void main(String[] args) throws FileNotFoundException {\n\t\t// Scanner read = new Scanner(new FileInputStream(new\n\t\t// File(\"input.txt\")));\n\t\t// PrintWriter out = new PrintWriter(new File(\"output.txt\"));\n\t\tScanner read = new Scanner(System.in);\n\t\tint n = read.nextInt(), k = read.nextInt(), arr[] = new int[26];\n\t\tString s = read.next();\n\t\tread.nextLine();\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tarr[s.charAt(i) - 97]++;\n\t\tboolean check = true;\n\t\t\n\t\t\tfor (int i = 0; i < 26; i++) {\n\t\t\t\tif (arr[i] >= k) {\n\t\t\t\t\tcheck = false;\n\t\t\t\t\tSystem.out.println(\"NO\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\n\t\tif (check)\n\t\t\tSystem.out.println(\"YES\");\n\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "fa886ec2fdd841959cd48c19900c5929", "src_uid": "ceb3807aaffef60bcdbcc9a17a1391be", "apr_id": "6f6041150e95f64e1ea38f8890708123", "difficulty": 900, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8771686328938237, "equal_cnt": 13, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 7, "fix_ops_cnt": 12, "bug_source_code": "import java.util.Scanner;\n\n\npublic class ballons4 {\npublic static void main (String[] args){\n\t//int nb=7;\n\t//int nf=2;\n\t//String s=\"ovovm\";\n\tScanner input=new Scanner(System.in);\n\tint nb=input.nextInt();\n\tint\tnf=input.nextInt();\n\tString s=input.next();\n\n\tchar[] charsu = new char[nb];\n\tlong[] numsu = new long[nb];\n\tint num=0;\n\t//int k=0;\n\tfor (int i=0; inf){\n\t\t\tSystem.out.println( \"NO\");\n\t\t\t\treturn;\n\t\t}\n\t\t\n\t\t\n\t}\n\t System.out.println (\"YES\");\n\t\n}\n}\n", "lang": "Java 8", "bug_code_uid": "5c20e2962b722581f3518c8224cfb96e", "src_uid": "ceb3807aaffef60bcdbcc9a17a1391be", "apr_id": "ceddb043d248f653e9eb6feb40ec2d2b", "difficulty": 900, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.37123420796890183, "equal_cnt": 19, "replace_cnt": 14, "delete_cnt": 5, "insert_cnt": 0, "fix_ops_cnt": 19, "bug_source_code": "import java.util.Scanner;\nimport java.util.regex.Matcher;\nimport java.util.regex.Pattern;\n\npublic class BetweenOffices {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint t = sc.nextInt();\n\t\tint count = 0;\n\t\tint count1=0;\n\t\tfor (int i=0;icount1) {\n\t\t\tSystem.out.println(\"YES\");\n\t\t}\n\t\telse {\n\t\t\tSystem.out.println(\"NO\");\n\t\t}\n\t\t}\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "56f67959ce5140472b1eea248b70387e", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "apr_id": "8e162c03954ec459de7efa8405daeafe", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9565716472163766, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "import java.io.*;\nimport java.math.*;\nimport java.util.*;\n\npublic class Main {\n static int MOD = (int)1e9 + 7;\n\n public void run() {\n try {\n int n = reader.nextInt();\n int m = reader.nextInt();\n int[] pow = new int[n + 1];\n pow[0] = 1;\n for (int i = 1; i <= n; ++ i) {\n pow[i] = (pow[i - 1] << 1) % MOD;\n }\n int[][] ways = new int[m + 1][1];\n ways[0][0] = 1;\n for (int i = 0; i < n; ++ i) {\n int[][] newWays = new int[m + 1][i + 2];\n for (int maximum = 0; maximum <= m; ++ maximum) {\n for (int last = 0; last <= i; ++ last) {\n newWays[maximum][last] = add(newWays[maximum][last], ways[maximum][last]);\n newWays[maximum][last] = add(newWays[maximum][last], (int)(ways[maximum][last] * (pow[last] - 1) % MOD));\n if (maximum + 1 <= m) {\n newWays[maximum + 1][i + 1] = add(newWays[maximum + 1][i + 1], (int)(ways[maximum][last] * (pow[i + 1] - pow[last]) % MOD));\n }\n }\n }\n ways = newWays;\n }\n int result = 0;\n for (int last = 0; last <= n; ++ last) {\n result = add(result, ways[m][last]);\n }\n writer.println(result);\n } catch (IOException ex) {\n }\n writer.close();\n }\n\n int add(int x, int a) {\n if (a < 0) {\n a += MOD;\n }\n x += a;\n if (x >= MOD) {\n x -= MOD;\n }\n return x;\n }\n\n Main() {\n reader = new InputReader(System.in);\n writer = new PrintWriter(System.out);\n }\n\n public static void main(String[] args) {\n new Main().run();\n }\n\n private void debug(Object...os) {\n System.err.println(Arrays.deepToString(os));\n }\n\n private InputReader reader;\n private PrintWriter writer;\n}\n\nclass InputReader {\n InputReader(InputStream in) {\n reader = new BufferedReader(new InputStreamReader(in));\n tokenizer = new StringTokenizer(\"\");\n }\n\n private String next() throws IOException {\n while (!tokenizer.hasMoreTokens()) {\n tokenizer = new StringTokenizer(reader.readLine());\n }\n return tokenizer.nextToken();\n }\n\n public Integer nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n\n private BufferedReader reader;\n private StringTokenizer tokenizer;\n}\n", "lang": "Java 7", "bug_code_uid": "a645ee5df3cc772c1d43f33514381942", "src_uid": "111673158df2e37ac6c019bb99225ccb", "apr_id": "9e4ce734cce51719222581c542b8fe8c", "difficulty": 2500, "tags": ["dp"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.1251838535708449, "equal_cnt": 27, "replace_cnt": 17, "delete_cnt": 5, "insert_cnt": 6, "fix_ops_cnt": 28, "bug_source_code": "import java.awt.*;\nimport java.util.ArrayDeque;\nimport java.util.ArrayList;\nimport java.util.Scanner;\n \npublic class Main {\n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n int m = scan.nextInt();\n int[][] arr = new int[n][m];\n int num = 0;\n for (int i=0;i list = new ArrayList();\n for (int i=0;i 0) {\n calc(i, j + 1, cnt);\n } else {\n for (int r = 1; r <= k; ++r) {\n if (!mask[r - 1]) {\n c[i][j] = r;\n mask[r - 1] = true;\n if (j < m - 1) {\n c[i][j + 1] = r;\n int d = 0;\n if (c[i][j] != f[i][j]) ++d;\n if (c[i][j + 1] != f[i][j + 1]) ++d;\n calc(i, j + 2, cnt + d);\n c[i][j + 1] = 0;\n }\n if (i < n - 1) {\n c[i + 1][j] = r;\n int d = 0;\n if (c[i][j] != f[i][j]) ++d;\n if (c[i + 1][j] != f[i + 1][j]) ++d;\n calc(i, j + 1, cnt + d);\n c[i + 1][j] = 0;\n }\n mask[r - 1] = false;\n }\n }\n c[i][j] = 0;\n }\n }\n }\n }\n\n void solve() throws IOException {\n in(\"__std\"); out(\"__std\");\n\n n = readInt();\n m = readInt();\n k = n * m / 2;\n f = new int[n][m];\n c = new int[n][m];\n mask = new boolean[k];\n for (int i = 0; i < n; ++i) {\n for (int j = 0; j < m; ++j) {\n f[i][j] = readInt();\n }\n }\n calc(0, 0, 0);\n println(best);\n\n exit();\n }\n\n void in(String name) throws IOException {\n if (name.equals(\"__std\")) {\n in = new BufferedReader(new InputStreamReader(System.in));\n } else {\n in = new BufferedReader(new FileReader(name));\n }\n }\n\n void out(String name) throws IOException {\n if (name.equals(\"__std\")) {\n out = new PrintWriter(System.out);\n } else {\n out = new PrintWriter(name);\n }\n }\n\n void exit() {\n out.close();\n System.exit(0);\n }\n\n char readChar() throws IOException {\n return (char) in.read();\n }\n\n int readInt() throws IOException {\n return Integer.parseInt(readToken());\n }\n\n long readLong() throws IOException {\n return Long.parseLong(readToken());\n }\n\n double readDouble() throws IOException {\n return Double.parseDouble(readToken());\n }\n\n String readLine() throws IOException {\n st = null;\n return in.readLine();\n }\n\n String readToken() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(in.readLine());\n }\n return st.nextToken();\n }\n\n boolean eof() throws IOException {\n return !in.ready();\n }\n\n void print(String format, Object ... args) {\n out.print(new Formatter(Locale.US).format(format, args));\n }\n\n void println(String format, Object ... args) {\n out.println(new Formatter(Locale.US).format(format, args));\n }\n\n void print(Object value) {\n out.print(value);\n }\n\n void println(Object value) {\n out.println(value);\n }\n\n void println() {\n out.println();\n }\n\n StringTokenizer st;\n\n BufferedReader in;\n PrintWriter out;\n\n public static void main(String[] args) throws IOException {\n new C().solve();\n }\n}\n", "lang": "Java 6", "bug_code_uid": "74591bdc9a96767e381984f9a6778769", "src_uid": "1f0e8bbd5bf4fcdea927fbb505a8949b", "apr_id": "ae7fb73773a49f5a24acbef7a3d1dbb3", "difficulty": 2200, "tags": ["flows"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8018534325082307, "equal_cnt": 26, "replace_cnt": 12, "delete_cnt": 5, "insert_cnt": 8, "fix_ops_cnt": 25, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class C1 {\n\n int n, m, k;\n int[][] f;\n boolean[][] c;\n boolean[] mask;\n int best = Integer.MAX_VALUE;\n\n void calc(int i, int j, int cnt) {\n if (cnt < best) {\n if (i == n - 1 && j == m) {\n best = cnt;\n } else {\n if (j == m) {\n j = 0;\n ++i;\n }\n if (c[i][j]) {\n calc(i, j + 1, cnt);\n } else {\n for (int r = 1; r <= k; ++r) {\n if (!mask[r - 1]) {\n mask[r - 1] = true;\n c[i][j] = true;\n if (j < m - 1 && !c[i][j + 1]) {\n c[i][j + 1] = true;\n int d = 0;\n if (r != f[i][j]) ++d;\n if (r != f[i][j + 1]) ++d;\n calc(i, j + 1, cnt + d);\n c[i][j + 1] = false;\n }\n if (i < n - 1) {\n c[i + 1][j] = true;\n int d = 0;\n if (r != f[i][j]) ++d;\n if (r != f[i + 1][j]) ++d;\n calc(i, j + 1, cnt + d);\n c[i + 1][j] = false;\n }\n mask[r - 1] = false;\n c[i][j] = false;\n }\n }\n }\n }\n }\n }\n\n void solve() throws IOException {\n in(\"__std\"); out(\"__std\");\n\n n = readInt();\n m = readInt();\n k = n * m / 2;\n f = new int[n][m];\n c = new boolean[n][m];\n mask = new boolean[k];\n for (int i = 0; i < n; ++i) {\n for (int j = 0; j < m; ++j) {\n f[i][j] = readInt();\n }\n }\n calc(0, 0, 0);\n println(best);\n\n exit();\n }\n\n void in(String name) throws IOException {\n if (name.equals(\"__std\")) {\n in = new BufferedReader(new InputStreamReader(System.in));\n } else {\n in = new BufferedReader(new FileReader(name));\n }\n }\n\n void out(String name) throws IOException {\n if (name.equals(\"__std\")) {\n out = new PrintWriter(System.out);\n } else {\n out = new PrintWriter(name);\n }\n }\n\n void exit() {\n out.close();\n System.exit(0);\n }\n\n char readChar() throws IOException {\n return (char) in.read();\n }\n\n int readInt() throws IOException {\n return Integer.parseInt(readToken());\n }\n\n long readLong() throws IOException {\n return Long.parseLong(readToken());\n }\n\n double readDouble() throws IOException {\n return Double.parseDouble(readToken());\n }\n\n String readLine() throws IOException {\n st = null;\n return in.readLine();\n }\n\n String readToken() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(in.readLine());\n }\n return st.nextToken();\n }\n\n boolean eof() throws IOException {\n return !in.ready();\n }\n\n void print(String format, Object ... args) {\n out.print(new Formatter(Locale.US).format(format, args));\n }\n\n void println(String format, Object ... args) {\n out.println(new Formatter(Locale.US).format(format, args));\n }\n\n void print(Object value) {\n out.print(value);\n }\n\n void println(Object value) {\n out.println(value);\n }\n\n void println() {\n out.println();\n }\n\n StringTokenizer st;\n\n BufferedReader in;\n PrintWriter out;\n\n public static void main(String[] args) throws IOException {\n new C1().solve();\n }\n}\n", "lang": "Java 6", "bug_code_uid": "0bcd47ff1b6d8f49f0a119ccd1e600da", "src_uid": "1f0e8bbd5bf4fcdea927fbb505a8949b", "apr_id": "ae7fb73773a49f5a24acbef7a3d1dbb3", "difficulty": 2200, "tags": ["flows"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.680219278209228, "equal_cnt": 13, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 12, "bug_source_code": "/*\n * Code Author: Jayesh Udhani\n * Dhirubhai Ambani Institute of Information and Communication Technology (DA-IICT ,Gandhinagar)\n * 2nd Year ICT BTECH Student\n */\nimport java.io.*;\nimport java.util.*;\n\npublic class Main {\n\tpublic static void main(String args[])\n\t{\n\t\tInputReader in = new InputReader(System.in);\n\t\tOutputStream outputStream = System.out;\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\t//----------My Code Starts Here----------\n\t\tint n=in.nextInt(),i,ans=0;\n\t\tint t=0;\n\t\tint[] arr=new int[n];\n\t\tint s=(int) (1e9+1);\n\t\tint[] ctr=new int[s];\n\t\tArrays.fill(ctr, 0);\n\t\tfor(i=0;i1)\n\t\t\t{\n\t\t\t\tans++;\n\t\t\t\tint x=arr[i],index=arr[i];\n\t\t\t\twhile(ctr[x]!=1)\n\t\t\t\t{\n\t/*\t\t\t\twhile(ctr[y]!=0)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(y==0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tctr[x]=0;\n\t\t\t\t\t\t\tt=1;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\ty--;\n\t\t\t\t\t}\n\t\t\t\t\tif(t==0)\n\t\t\t\t\t{\n\t\t\t\t\t\tctr[y]++;\n\t\t\t\t\t\tctr[x]--;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\tbreak;*/\n\t\t\t\t\tindex--;\n\t\t\t\t\tif(index==0)\n\t\t\t\t\t{\n\t\t\t\t\t\tctr[x]=0;\n\t\t\t\t\t\tt=1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif(ctr[index]==0)\n\t\t\t\t\t{\n\t\t\t\t\t\tctr[index]++;\n\t\t\t\t\t\tctr[x]--;\n\t\t\t\t\t\tans++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tout.println(ans);\n\t\tout.close();\n\t\t//---------------The End\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\n\t}\n\tstatic class InputReader {\n\t\tpublic BufferedReader reader;\n\t\tpublic StringTokenizer tokenizer;\n\n\t\tpublic InputReader(InputStream inputstream) {\n\t\t\treader = new BufferedReader(new InputStreamReader(inputstream));\n\t\t\ttokenizer = null;\n\t\t}\n\n\t\tpublic String nextLine(){\n\t\t\tString fullLine=null;\n\t\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\tfullLine=reader.readLine();\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}\n\t\t\t\treturn fullLine;\n\t\t\t}\n\t\t\treturn fullLine;\n\t\t}\n\t\tpublic String next() {\n\t\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn tokenizer.nextToken();\n\t\t}\n\t\tpublic long nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\t\tpublic int nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "a2551d054bd5d133378b1e5099d740f1", "src_uid": "3c4b2d1c9440515bc3002eddd2b89f6f", "apr_id": "1615c4fbf35372c6bcf1e4c9d8d03129", "difficulty": 1100, "tags": ["greedy", "sortings"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9794303797468354, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n sc.close();\n\n String s = Integer.toString(n);\n int l = 0, r = s.length()-1;\n while (l < s.length()-1 && s.charAt(l) == '0') {\n l++;\n }\n while (r >= 0 && s.charAt(r) == '0') {\n r--;\n }\n\n while (l < r) {\n if (s.charAt(l++) != s.charAt(r--)) {\n System.out.println(\"NO\");\n return;\n }\n }\n System.out.println(\"YES\");\n return;\n }\n}", "lang": "Java 8", "bug_code_uid": "30c45354c8186b39a1eaaf09e3db9430", "src_uid": "d82278932881e3aa997086c909f29051", "apr_id": "e004d9e92a41c0fe9d7619ecec7c4130", "difficulty": 900, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9670510708401977, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.lang.*;\nimport java.util.*;\nimport java.io.*;\n\npublic class Solution{\n\tpublic static String reducedNumber(int number){\n\t\twhile((number%10)==0){\n\t\t\tnumber = number/10;\n\t\t}\n\t\treturn number.toString();\n\t}\n\tpublic static void quasiPalindrome(String s){\n\t\tString rev_s = new StringBuilder(s).reverse().toString();\n\t\tif(s.equals(rev_s))\n\t\t\tSystem.out.println(\"YES\");\n\t\telse\n\t\t\tSystem.out.println(\"NO\");\n\t}\n\tpublic static void main(String args[]){\n\t\tint x;\n\t\tString temp;\n\t\tScanner s = new Scanner(System.in);\n\t\tx = s.nextInt();\n\t\ts.close();\n\t\ttemp = reducedNumber(x);\n\t\tquasiPalindrome(temp);\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "9a41fa99c151ce27f82e43d5cae9bc0c", "src_uid": "d82278932881e3aa997086c909f29051", "apr_id": "d283738a312f9fb64065f7e49b60a315", "difficulty": 900, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9996758508914101, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*;\nimport java.math.*;\nimport java.util.*;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tPrintWriter out = new PrintWriter(System.out);\n\n\t\tTask solver = new Task();\n\t\tsolver.solve(in, out);\n\t\tout.close();\n\t}\n}\n\nclass Task {\n\tfinal static int MAXN = 211111;\n\tfinal static long MD = 1000000007;\n\tlong[] inv, fact, factInv;\n\n\tlong pow(int x, int y) {\n\t\tlong ret = 1, tmp = x;\n\t\tfor (; y > 0; y >>= 1) {\n\t\t\tif ((y & 1) == 1)\n\t\t\t\tret = ret * tmp % MD;\n\t\t\ttmp = tmp * tmp % MD;\n\t\t}\n\t\treturn ret;\n\t}\n\n\tlong perm(int n, int m) {\n\t\treturn n < m ? 0 : fact[n] * factInv[n - m] % MD;\n\t}\n\n\tvoid solve(Scanner in, PrintWriter out) {\n\t\tint k = in.nextInt(), w = in.nextInt();\n\t\tinv = new long[MAXN];\n\t\tfact = new long[MAXN];\n\t\tfactInv = new long[MAXN];\n\t\tinv[1] = 1;\n\t\tfor (int i = 2; i < MAXN; ++i)\n\t\t\tinv[i] = (MD - MD / i * inv[(int)MD % i] % MD) % MD;\n\n\t\tfact[0] = factInv[0] = 1;\n\t\tfor (int i = 1; i < MAXN; ++i) {\n\t\t\tfact[i] = fact[i - 1] * i % MD;\n\t\t\tfactInv[i] = factInv[i - 1] * inv[i] % MD;\n\t\t}\n\n\t\tlong ans = 0;\n\t\tfor (int t = 1; t <= k; ++t) {\n\t\t\tif (w - 1 >= t)\n\t\t\t\tans = (ans + perm(k, t) * perm(k, t) % MD * t % MD * pow(k, w - 1 - t) % MD) % MD;\n\t\t\telse\n\t\t\t\tans = (ans + perm(k, t) * perm(k - t + w - 1, w - 1) % MD * w % MD) % MD;\n\t\t\tif (w - 1 >= t + 1)\n\t\t\t\tans = (ans + perm(k, t) * perm(k, t + 1) % MD * t % MD * pow(k, w - 2 - t) % MD) % MD;\n\t\t\telse\n\t\t\t\tans = (ans + perm(k, t) * perm(k - 2 - t + w, w - 1) % MD * (w - 1) % MD) % MD;\n\t\t}\n\n\t\tout.println(ans);\n\t}\n}\n", "lang": "Java 6", "bug_code_uid": "ad3f2ea6b4014347577bcdd90331fcdb", "src_uid": "b715f0fdc83ec539eb3ae2b0371ee130", "apr_id": "dbab006a0de672b26b594863731edb92", "difficulty": 3000, "tags": ["combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7359954036196495, "equal_cnt": 19, "replace_cnt": 10, "delete_cnt": 3, "insert_cnt": 5, "fix_ops_cnt": 18, "bug_source_code": "import java.util.*;\nimport java.io.*;\n\npublic class Main\n{\n static int MOD = 1000000007;\n static long dfac[],fac[];\n \n public static int A(int n,int r)\n {\n return (int)((long)fac[n] * quickPow((int)fac[n-r],MOD-2) % MOD);\n }\n \n public static int quickPow(int x,int n)\n {\n long ans = 1;\n for (;n != 0;n >>= 1)\n {\n if ((n & 1) != 0) ans = ans * x % MOD;\n x = (int)((long) x * (long) x % MOD);\n }\n return (int)ans;\n }\n \n public static int eat(int len,int k,int w)\n {\n long ret = A(k,len);\n int delta = len - (w - 1);\n if (delta >= 0)\n {\n ret = ret * A(k-delta,len-delta) % MOD;\n }\n else\n {\n ret = ret * A(k,len) % MOD;\n ret = ret * quickPow(k,w-1-len) % MOD;\n }\n return (int)ret;\n }\n \n public static int fuck(int k,int w,boolean inclusive)\n {\n long ret = 0;\n for (int i = inclusive ? 1 : 2;i <= k;++i)\n ret = (ret + eat(i,k,w)) % MOD;\n return (int)ret;\n }\n \n public static int gao(int k,int w)\n {\n fac = new long[k+1];\n fac[0] = 1;\n for (int i = 1;i <= k;++i)\n fac[i] = fac[i-1] * i % MOD;\n return ( (fuck(k,w+1,true) - fuck(k,w,false) ) % MOD + MOD) % MOD;\n }\n \n public static void main(String args[])\n {\n Scanner cin = new Scanner(System.in);\n int k = cin.nextInt(), w = cin.nextInt();\n System.out.println(gao(k,w));\n }\n}", "lang": "Java 6", "bug_code_uid": "15591d1f61e6aa9b8724dbf236bfe799", "src_uid": "b715f0fdc83ec539eb3ae2b0371ee130", "apr_id": "1a323b090c1e8f430824347940c2b366", "difficulty": 3000, "tags": ["combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9894620077648364, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "//package round97;\nimport java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\n\npublic class E2 {\n\tInputStream is;\n\tPrintWriter out;\n\tString INPUT = \"\";\n//\tString INPUT = \"2 139\";\n//\tString INPUT = \"2 139\";\n\tint mod = 1000000007;\n\t\n\tlong[] PS = new long[1000001];\n\tlong[] IPS = new long[1000001];\n\tlong[] KE = new long[1000002];\n\tlong[] KE2 = new long[1000020];\n\t\n\tvoid solve()\n\t{\n\t\tint k = ni(), w = ni();\n\t\tlong sum = 0;\n\t\tPS[0] = 1;\n\t\tIPS[0] = 1;\n\t\tKE[0] = modpow(k, w, mod);\n\t\tKE2[0] = modpow(k, w+4, mod);\n\t\tlong ik = inv(k, mod);\n\t\tfor(int i = 1;i <= k;i++){\n\t\t\tPS[i] = PS[i-1]*(k-i+1)%mod;\n\t\t\tIPS[i] = IPS[i-1]*inv(k-i+1, mod)%mod;\n\t\t\tKE[i] = KE[i-1] * k % mod;\n\t\t}\n\t\tfor(int i = 1;i <= k+19;i++){\n\t\t\tKE2[i] = KE2[i-1] * ik % mod;\n\t\t}\n\t\tgw = w;\n\t\tfor(int l = w+1;l <= w+k;l++){\n\t\t\tlong v = (val(k, w, l) - val(k, w+1, l)) % mod;\n\t\t\tsum += v;\n//\t\t\ttr(l, v);\n\t\t}\n\t\tout.println((sum%mod+mod)%mod);\n\t}\n\t\n\tpublic static long inv(long a, int p)\n\t{\n\t\tlong ret = 1;\n\t\tlong mul = a;\n\t\tfor(long n = p-2;n > 0;n >>>= 1){\n\t\t\tif((n&1)==1)ret = ret * mul % p;\n\t\t\tmul = mul * mul % p;\n\t\t}\n\t\treturn ret;\n\t}\n\t\n\tint gw;\n\t\n\t// k=2,W=2,L=3\n\t// 8\n\t\n\tint gct = 0;\n\t// \n\t// OXO\n\tlong val(long k, long W, long L)\n\t{\n\t\tif(W >= L)return 0;\n\t\t// head\u3067\u542b\u3080\n\t\t// tail\u3067\u542b\u3080\n\t\t// 2W-L+2=W+2-(L-W)\n\t\tlong ret;\n\t\tif(W > L+1-W){\n//\t\t\tret = modpow(k, L, mod) - modpow(k, L-2*(L-W+1), mod) * modpow(P(k, L-W+1), 2, mod)%mod;\n\t\t\tret = KE[(int)(L-gw)] - KE2[(int)(gw+4-(L-2*(L-W+1)))] * modpow(P(k, L-W+1), 2, mod)%mod;\n\t\t}else{\n//\t\t\tlong p = k-(L-2*(W-1)) < W-1 ? 0 : P(k, W-1)*inv(P(k, L-2*(W-1)), mod)%mod;\n\t\t\tlong p = k-(L-2*(W-1)) < W-1 ? 0 : P(k, W-1)*invP(k, L-2*(W-1))%mod;\n//\t\t\tret = modpow(k, L, mod) - P(k,L-2*(W-1))*modpow(p, 2, mod)%mod;\n\t\t\tret = KE[(int)(L-gw)] - P(k,L-2*(W-1))*modpow(p, 2, mod)%mod;\n\t\t}\n\t\t\n\t\treturn (int)((ret%mod+mod)%mod);\n\t}\n\t\n\tlong P(long n, long r)\n\t{\n\t\tif(r > n)return 0;\n\t\treturn PS[(int)r];\n\t}\n\t\n\tlong invP(long n, long r)\n\t{\n\t\tif(r > n)return 0;\n\t\treturn IPS[(int)r];\n\t}\n\t\n\tpublic static long modpow(long a, long n, long mod)\n\t{\n\t\tlong ret = 1;\n\t\tlong mul = a;\n\t\tfor(;n > 0;n >>>= 1){\n\t\t\tif((n&1)==1){\n\t\t\t\tret = (ret * mul) % mod;\n\t\t\t}\n\t\t\tmul = (mul * mul) % mod;\n\t\t}\n\t\treturn ret;\n\t}\n\t\n\tvoid run() throws Exception\n\t{\n\t\tis = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n\t\tout = new PrintWriter(System.out);\n\t\t\n\t\tlong s = System.currentTimeMillis();\n\t\tsolve();\n\t\tout.flush();\n\t\ttr(System.currentTimeMillis()-s+\"ms\");\n\t}\n\t\n\tpublic static void main(String[] args) throws Exception\n\t{\n\t\tnew E2().run();\n\t}\n\t\n\tpublic int ni()\n\t{\n\t\ttry {\n\t\t\tint num = 0;\n\t\t\tboolean minus = false;\n\t\t\twhile((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));\n\t\t\tif(num == '-'){\n\t\t\t\tnum = 0;\n\t\t\t\tminus = true;\n\t\t\t}else{\n\t\t\t\tnum -= '0';\n\t\t\t}\n\t\t\t\n\t\t\twhile(true){\n\t\t\t\tint b = is.read();\n\t\t\t\tif(b >= '0' && b <= '9'){\n\t\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t\t}else{\n\t\t\t\t\treturn minus ? -num : num;\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t}\n\t\treturn -1;\n\t}\n\t\n\tpublic long nl()\n\t{\n\t\ttry {\n\t\t\tlong num = 0;\n\t\t\tboolean minus = false;\n\t\t\twhile((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));\n\t\t\tif(num == '-'){\n\t\t\t\tnum = 0;\n\t\t\t\tminus = true;\n\t\t\t}else{\n\t\t\t\tnum -= '0';\n\t\t\t}\n\t\t\t\n\t\t\twhile(true){\n\t\t\t\tint b = is.read();\n\t\t\t\tif(b >= '0' && b <= '9'){\n\t\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t\t}else{\n\t\t\t\t\treturn minus ? -num : num;\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t}\n\t\treturn -1;\n\t}\n\t\n\tpublic String ns()\n\t{\n\t\ttry{\n\t\t\tint b = 0;\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\twhile((b = is.read()) != -1 && (b == '\\r' || b == '\\n' || b == ' '));\n\t\t\tif(b == -1)return \"\";\n\t\t\tsb.append((char)b);\n\t\t\twhile(true){\n\t\t\t\tb = is.read();\n\t\t\t\tif(b == -1)return sb.toString();\n\t\t\t\tif(b == '\\r' || b == '\\n' || b == ' ')return sb.toString();\n\t\t\t\tsb.append((char)b);\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t}\n\t\treturn \"\";\n\t}\n\t\n\tpublic char[] ns(int n)\n\t{\n\t\tchar[] buf = new char[n];\n\t\ttry{\n\t\t\tint b = 0, p = 0;\n\t\t\twhile((b = is.read()) != -1 && (b == ' ' || b == '\\r' || b == '\\n'));\n\t\t\tif(b == -1)return null;\n\t\t\tbuf[p++] = (char)b;\n\t\t\twhile(p < n){\n\t\t\t\tb = is.read();\n\t\t\t\tif(b == -1 || b == ' ' || b == '\\r' || b == '\\n')break;\n\t\t\t\tbuf[p++] = (char)b;\n\t\t\t}\n\t\t\treturn Arrays.copyOf(buf, p);\n\t\t} catch (IOException e) {\n\t\t}\n\t\treturn null;\n\t}\n\t\n\t\n\tdouble nd() { return Double.parseDouble(ns()); }\n\tboolean oj = System.getProperty(\"ONLINE_JUDGE\") != null;\n\tvoid tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }\n}\n", "lang": "Java 6", "bug_code_uid": "f17208a05db28516656271c48fa62120", "src_uid": "b715f0fdc83ec539eb3ae2b0371ee130", "apr_id": "40c040a5f57019ee67d4a8a7b1a72f9f", "difficulty": 3000, "tags": ["combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9992360580595875, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\npublic class asd\n{\n public static void main(String args[])throws Exception\n {\n Scanner s=new Scanner(System.in);\n int n=s.nextInt();\n String str=s.next();int count=0;\n for(int i=2;i0)\n {\n c= scan.next().charAt(0);\n s1=s1+c;\n n--;\n }\n for(int i=0;i d)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (d % primes[p] == 0)\n\t\t\t\t{\n\t\t\t\t\tis_prime = false;\n\t\t\t\t\twhile (d % primes[p] == 0)\n\t\t\t\t\t{ \n\t\t\t\t\t\td /= primes[p];\n\t\t\t\t\t}\n\t\t\t\t\tif (d==1)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (!p_used[(int)primes[p]])\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tuse_primes[use_p_count++] = primes[p];\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\t\n\t\t\tif (is_prime)\n\t\t\t{\n\t\t\t\tif ((d > 1000000) || !p_used[(int)d])\n\t\t\t\t{\n\t\t\t\t\tuse_primes[use_p_count++] = d;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tlogWrite(\"use_p_count = %d\\n\", use_p_count);\n\t\t\n\t\tlong[] D = new long[d_count];\n\t\tArrays.fill(D, 0);\n\t\tD[0] = 1;\n\t\t\n\t\tfor (p=0; p d)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (d % primes[p] == 0)\n\t\t\t\t{\n\t\t\t\t\tis_prime = false;\n\t\t\t\t\twhile (d % primes[p] == 0)\n\t\t\t\t\t{ \n\t\t\t\t\t\td /= primes[p];\n\t\t\t\t\t}\n\t\t\t\t\tif (d==1)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (!p_used[(int)primes[p]])\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tp_used[(int)primes[p]] = true;\n\t\t\t\t\t\t\tuse_primes[use_p_count++] = primes[p];\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\t\n\t\t\tif (is_prime)\n\t\t\t{\n\t\t\t\tif ((d > 1000000) || !p_used[(int)d])\n\t\t\t\t{\n\t\t\t\t\tif (d<1000000)\n\t\t\t\t\t{\n\t\t\t\t\t\tp_used[(int)d] = true;\n\t\t\t\t\t}\n\t\t\t\t\tuse_primes[use_p_count++] = d;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tlogWrite(\"use_p_count = %d\\n\", use_p_count);\n\t\t\n\t\tlong[] D = new long[d_count];\n\t\tlong[] D1 = new long[d_count];\n\t\t\n\t\tArrays.fill(D, 0);\n\t\tD[0] = 1;\n\t\t\n\t\tfor (p=0; p0){\n hp_m-=Math.max(0,(atk_y-DEF_m));\n hp_y-=Math.max(0,ATK_m-def_y);\n }\n\n cost=i*a+j*d;\n if(hp_y<=0){\n //pn(\"monster vs yang \"+hp_m+\" \"+hp_y);\n //res=Math.min(res, k*h+i*a+j*d);//k->hp i->attack j->defence\n cost+=((-hp_y+1)*h);\n }\n\n res=Math.min(cost, res);\n // }\n }\n }\n\n pn(res);\n }\n\n\n static AnotherReader sc;\n static PrintWriter out;\n public static void main(String[]args)throws IOException\n {\n out = new PrintWriter(System.out);\n sc=new AnotherReader();\n boolean oj = true;\n\n oj = System.getProperty(\"ONLINE_JUDGE\") != null;\n if(!oj) sc=new AnotherReader(100);\n\n long s = System.currentTimeMillis();\n int t=1;\n //t=ni();\n while(t-->0)\n process();\n out.flush();\n if(!oj)\n System.out.println(System.currentTimeMillis()-s+\"ms\");\n System.out.close(); \n }\n \n \n static void pn(Object o){out.println(o);}\n static void p(Object o){out.print(o);}\n static void pni(Object o){out.println(o);System.out.flush();}\n static int ni()throws IOException{return sc.nextInt();}\n static long nl()throws IOException{return sc.nextLong();}\n static double nd()throws IOException{return sc.nextDouble();}\n static String nln()throws IOException{return sc.nextLine();}\n static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}\n static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}\n static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}\n static boolean multipleTC=false;\n static long mod=(long)1e9+7l;\n\n static void r_sort(int arr[],int n){\n Random r = new Random(); \n for (int i = n-1; i > 0; i--){ \n int j = r.nextInt(i+1); \n \n int temp = arr[i]; \n arr[i] = arr[j]; \n arr[j] = temp; \n } \n Arrays.sort(arr); \n }\n\n static long mpow(long x, long n) {\n if(n == 0)\n return 1;\n if(n % 2 == 0) {\n long root = mpow(x, n / 2);\n return root * root % mod;\n }else {\n return x * mpow(x, n - 1) % mod;\n }\n }\n \n static long mcomb(long a, long b) {\n if(b > a - b)\n return mcomb(a, a - b);\n long m = 1;\n long d = 1;\n long i;\n for(i = 0; i < b; i++) {\n m *= (a - i);\n m %= mod;\n d *= (i + 1);\n d %= mod;\n }\n long ans = m * mpow(d, mod - 2) % mod;\n return ans;\n }\n/////////////////////////////////////////////////////////////////////////////////////////////////////////\n\n static class AnotherReader{BufferedReader br; StringTokenizer st;\n AnotherReader()throws FileNotFoundException{\n br=new BufferedReader(new InputStreamReader(System.in));}\n AnotherReader(int a)throws FileNotFoundException{\n br = new BufferedReader(new FileReader(\"input.txt\"));}\n String next()throws IOException{\n while (st == null || !st.hasMoreElements()) {try{\n st = new StringTokenizer(br.readLine());}\n catch (IOException e){ e.printStackTrace(); }}\n return st.nextToken(); } int nextInt() throws IOException{\n return Integer.parseInt(next());}\n long nextLong() throws IOException\n {return Long.parseLong(next());}\n double nextDouble()throws IOException { return Double.parseDouble(next()); }\n String nextLine() throws IOException{ String str = \"\"; try{\n str = br.readLine();} catch (IOException e){\n e.printStackTrace();} return str;}}\n/////////////////////////////////////////////////////////////////////////////////////////////////////////////\n}", "lang": "Java 11", "bug_code_uid": "aa5a20bc693e0ff5586c5d1b679d0379", "src_uid": "bf8a133154745e64a547de6f31ddc884", "apr_id": "01590cad97f4cd1f8dd7a3e40dcae18e", "difficulty": 1800, "tags": ["brute force", "implementation", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9987368421052631, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.math.*;\nimport java.lang.*;\n \nimport static java.lang.Math.*;\n\npublic class Cf86 implements Runnable \n{\n\tstatic class InputReader \n\t{\n\t\tprivate InputStream stream;\n\t\tprivate byte[] buf = new byte[1024];\n\t\tprivate int curChar;\n\t\tprivate int numChars;\n\t\tprivate SpaceCharFilter filter;\n\t\tprivate BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tpublic InputReader(InputStream stream) \n\t\t{\n\t\t\tthis.stream = stream;\n\t\t}\n \n\t\tpublic int read()\n\t\t{\n\t\tif (numChars==-1) \n\t\t\tthrow new InputMismatchException();\n \n\t\tif (curChar >= numChars) \n\t\t{\n\t\t\tcurChar = 0;\n\t\t\ttry\n\t\t\t{\n\t\t\t\tnumChars = stream.read(buf);\n\t\t\t}\n\t\t\tcatch (IOException e)\n\t\t\t{\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t\t\n\t\t\tif(numChars <= 0) \n\t\t\t\treturn -1;\n\t\t}\n\t\treturn buf[curChar++];\n\t}\n \n public String nextLine()\n {\n\t\tString str = \"\";\n\t\ttry\n\t\t{\n\t\t\tstr = br.readLine();\n\t\t}\n\t\tcatch (IOException e)\n\t\t{\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn str;\n\t}\n public int nextInt() \n {\n\t\tint c = read();\n\t\t\n\t\twhile(isSpaceChar(c)) \n\t\t\tc = read();\n \n\t\tint sgn = 1;\n \n\t\tif (c == '-') \n\t\t{\n\t\t\tsgn = -1;\n\t\t\tc = read();\n\t\t}\n \n\t\tint res = 0;\n\t\tdo\n\t\t{\n\t\t\tif(c<'0'||c>'9') \n\t\t\t\tthrow new InputMismatchException();\n\t\t\tres *= 10;\n\t\t\tres += c - '0';\n\t\t\tc = read();\n\t\t}\n\t\twhile (!isSpaceChar(c)); \n \n\t\treturn res * sgn;\n\t}\n \n public long nextLong() \n {\n\t\tint c = read();\n\t\twhile (isSpaceChar(c))\n\t\t\tc = read();\n\t\tint sgn = 1;\n\t\tif (c == '-')\n\t\t{\n\t\t\tsgn = -1;\n\t\t\tc = read();\n\t\t}\n\t\tlong res = 0;\n \n\t\tdo \n\t\t{\n\t\t\tif (c < '0' || c > '9')\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tres *= 10;\n\t\t\tres += c - '0';\n\t\t\tc = read();\n\t\t}\n\t\twhile (!isSpaceChar(c));\n\t\t\treturn res * sgn;\n }\n \n public double nextDouble() \n {\n\t\tint c = read();\n\t\twhile (isSpaceChar(c))\n\t\t\tc = read();\n\t\tint sgn = 1;\n\t\tif (c == '-')\n\t\t{\n\t\t\tsgn = -1;\n\t\t\tc = read();\n\t\t}\n\t\tdouble res = 0;\n\t\twhile (!isSpaceChar(c) && c != '.') \n\t\t{\n\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\treturn res * Math.pow(10, nextInt());\n\t\t\tif (c < '0' || c > '9')\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tres *= 10;\n\t\t\tres += c - '0';\n\t\t\tc = read();\n\t\t}\n\t\tif (c == '.') \n\t\t{\n\t\t\tc = read();\n\t\t\tdouble m = 1;\n\t\t\twhile (!isSpaceChar(c))\n\t\t\t{\n\t\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\t\treturn res * Math.pow(10, nextInt());\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tm /= 10;\n\t\t\t\tres += (c - '0') * m;\n\t\t\t\tc = read();\n\t\t\t}\n\t\t}\n\t\treturn res * sgn;\n }\n \n public String readString() \n {\n\t\tint c = read();\n\t\twhile (isSpaceChar(c))\n\t\t\tc = read();\n\t\tStringBuilder res = new StringBuilder();\n\t\tdo \n\t\t{\n\t\t\tres.appendCodePoint(c);\n\t\t\tc = read();\n\t\t} \n\t\twhile (!isSpaceChar(c));\n \n\t\treturn res.toString();\n }\n \n\tpublic boolean isSpaceChar(int c) \n\t{\n\t\tif (filter != null)\n\t\t\treturn filter.isSpaceChar(c);\n\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t}\n\tpublic String next()\n\t{\n\t\treturn readString();\n\t}\n \n\tpublic interface SpaceCharFilter\n\t{\n\t\tpublic boolean isSpaceChar(int ch);\n\t}\n\t}\n\tpublic static void main(String args[]) throws Exception \n\t{\n\t\tnew Thread(null, new Cf86(),\"Main\",1<<27).start();\n\t}\n\tpublic void run()\n\t{\n\t\tInputReader in = new InputReader(System.in);\n\t\tPrintWriter w = new PrintWriter(System.out);\n\t\tint n=in.nextInt();\n\t\tint sum=0;\n\t\tfor(i=2;i flightstoS)\n\t\t\tSystem.out.println(\"YES\");\n\t\telse\n\t\t\tSystem.out.print(\"NO\");\n\t\t\n\n\t}\n\n}\n", "lang": "Java 11", "bug_code_uid": "e0b3493f4b841585025dfab86c76ed2a", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "apr_id": "c791c36dec06e8399a62ffcc6c193ba8", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8850423330197554, "equal_cnt": 12, "replace_cnt": 11, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 11, "bug_source_code": "import java.util.*;\nimport java.io.*;\nimport java.math.*;\n\npublic class Main{\n /*\n .\n .\n .\n .\n .\n .\n .\n some constants\n .\n */\n /*\n .\n .\n .\n if any\n .\n .\n */\n public static void main(String[] args) throws IOException{\n\t\t/*\n\t\t.\n\t\t.\n\t\t.\n\t\t.\n\t\t.\n\t\t.\n */\n int n=ni();\n int m=ni();\n int one=Integer.MAX_VALUE;\n int two=Integer.MAX_VALUE;\n for(int i=0;i=m)\n\t\t\treturn j-m;\n\n\t\t\treturn j;\n\t}\n\tstatic final int mod=1000000007;\n\tstatic final double eps=1e-8;\n\tstatic final long inf=100000000000000000L;\n\tstatic final boolean debug=true;\n\tstatic Reader in=new Reader();\n\tstatic StringBuilder ans=new StringBuilder();\n\tstatic long powm(long a,long b,long m){\n\t\tlong an=1;\n\t\tlong c=a;\n\t\twhile(b>0){\n\t\t\tif(b%2==1)\n\t\t\t\tan=(an*c)%m;\n\t\t\tc=(c*c)%m;\n\t\t\tb>>=1;\n\t\t}\n\t\treturn an;\n\t}\n\tstatic Random rn=new Random();\n\tstatic void sop(Object a){System.out.println(a);}\n\tstatic int ni(){return in.nextInt();}\n\tstatic int[] nia(int n){int a[]=new int[n];for(int i=0;i -1 && Arrays.binarySearch(b, ans) > - 1) {\n out.println(ans);\n return;\n }\n ++ans;\n }\n }\n}\n\n\nclass InputReader {\n BufferedReader br;\n StringTokenizer st;\n\n public InputReader()\n {\n br = new BufferedReader(new\n InputStreamReader(System.in));\n }\n\n String next()\n {\n while (st == null || !st.hasMoreElements())\n {\n try\n {\n st = new StringTokenizer(br.readLine());\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n int nextInt()\n {\n return Integer.parseInt(next());\n }\n\n long nextLong()\n {\n return Long.parseLong(next());\n }\n\n double nextDouble()\n {\n return Double.parseDouble(next());\n }\n\n String nextLine()\n {\n String str = \"\";\n try\n {\n str = br.readLine();\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n return str;\n }\n}", "lang": "Java 8", "bug_code_uid": "ddfa8b0be915ca26dab9c93728e6a12c", "src_uid": "3a0c1b6d710fd8f0b6daf420255d76ee", "apr_id": "1103bf7f36bcc42ffb2f298cef1f76ea", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6369119420989143, "equal_cnt": 19, "replace_cnt": 13, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 18, "bug_source_code": "import java.util.*;\nimport java.lang.*;\nimport java.io.*;\n public class Main{\npublic static void main(String args[]) throws IOException\n{\n Scanner ravi=new Scanner(System.in);\n\n int a=ravi.nextInt();\n int b=ravi.nextInt();\n PriorityQueue q=new PriorityQueue<>();\n PriorityQueue qh=new PriorityQueue<>();\n for(int i=0;i> i) & 1);\n\t\t\tb[i] = (int) ((q >> i) & 1);\n\t\t}\n\t\tlong ans = dp(0, 0);\n\t\tif(p == q) ans -= 2;\n\t\tSystem.out.println(ans);\n\t}\n\tstatic class Reader {\n\t\tBufferedReader a;\n\t\tStringTokenizer b;\n\t\tReader () {\n\t\t\ta = new BufferedReader (new InputStreamReader (System.in));\n\t\t}\n\t\tString next () {\n\t\t\twhile(b == null || !b.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\tb = new StringTokenizer (a.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace ();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn b.nextToken ();\n\t\t}\n\t\tint nextInt () {\n\t\t\treturn Integer.parseInt(this.next());\n\t\t}\n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(this.next());\n\t\t}\n\t}\n}", "lang": "Java 8", "bug_code_uid": "3308794b3b509860e88b3072a67b5007", "src_uid": "18410980789b14c128dd6adfa501aea5", "apr_id": "ce4807da20a8cfe34ab2a44a9b0490ef", "difficulty": 1700, "tags": ["dp", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6797422247128047, "equal_cnt": 32, "replace_cnt": 22, "delete_cnt": 4, "insert_cnt": 5, "fix_ops_cnt": 31, "bug_source_code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.io.BufferedWriter;\nimport java.io.Writer;\nimport java.io.OutputStreamWriter;\nimport java.util.InputMismatchException;\nimport java.io.IOException;\nimport java.util.HashMap;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author Alex\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n OutputWriter out = new OutputWriter(outputStream);\n TaskC solver = new TaskC();\n solver.solve(1, in, out);\n out.close();\n }\n static class TaskC {\n int MAXINDEX = 40;\n long wantsum;\n long wantxor;\n HashMap goodmem = new HashMap<>();\n\n long toval(int index, long sum, boolean anonzero, boolean bnonzero) {\n long res = (sum << 8);\n res += index;\n res <<= 1;\n res += (anonzero ? 1 : 0);\n res <<= 1;\n res += (bnonzero ? 1 : 0);\n return res;\n }\n\n long dp(int index, long sum, boolean anonzero, boolean bnonzero) {\n if(sum > wantsum) return 0;\n if(index >= MAXINDEX) {\n return (anonzero && bnonzero && sum == wantsum) ? 1 : 0;\n }\n// if (index >= MAXINDEX - 1 && sum == wantsum) ;\n if(sum != wantsum && sum + (1L << index) > wantsum) return 0;\n long memval = toval(index, sum, anonzero, bnonzero);\n// HashMap memref = mem[index][anonzero ? 1 : 0][bnonzero ? 1 : 0];\n// if (memref == null) mem[index][anonzero ? 1 : 0][bnonzero ? 1 : 0] = new HashMap<>();\n// memref = mem[index][anonzero ? 1 : 0][bnonzero ? 1 : 0];\n// if (memref.containsKey(sum)) return memref.get(sum);\n if(goodmem.containsKey(memval)) return goodmem.get(memval);\n int bitatindex = (int) ((wantxor >> index) & 1);\n long res = 0;\n\n if(sum == wantsum && bitatindex == 0) res = dp(index + 1, sum, anonzero, bnonzero);\n else {\n for(int bita = 0; bita < 2; bita++) {\n for(int bitb = 0; bitb < 2; bitb++) {\n int bitval = bita ^ bitb;\n if(bitval != bitatindex) continue;\n long moar = 0;\n if(bita == 1) moar += (1L << index);\n if(bitb == 1) moar += (1L << index);\n res += dp(index + 1, sum + moar, anonzero ? anonzero : bita == 1, bnonzero ? bnonzero : bitb == 1);\n }\n }\n }\n goodmem.put(memval, res);\n return res;\n }\n\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n long s = in.readLong(), x = in.readLong(), res = 0;\n wantsum = s;\n wantxor = x;\n long otherres = dp(0, 0, false, false);\n out.printLine(otherres);\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if(numChars == -1)\n throw new InputMismatchException();\n if(curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch(IOException e) {\n throw new InputMismatchException();\n }\n if(numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public long readLong() {\n int c = read();\n while(isSpaceChar(c))\n c = read();\n int sgn = 1;\n if(c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n if(c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n } while(!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if(filter != null)\n return filter.isSpaceChar(c);\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n\n static class OutputWriter {\n private final PrintWriter writer;\n\n public OutputWriter(OutputStream outputStream) {\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }\n\n public OutputWriter(Writer writer) {\n this.writer = new PrintWriter(writer);\n }\n\n public void close() {\n writer.close();\n }\n\n public void printLine(long i) {\n writer.println(i);\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "5d3347fe6cbd8aebcbdfe60c3cb0bb25", "src_uid": "18410980789b14c128dd6adfa501aea5", "apr_id": "02593fe7c1236c0197bdf6fe60741e9f", "difficulty": 1700, "tags": ["dp", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.17027632561613143, "equal_cnt": 19, "replace_cnt": 15, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 20, "bug_source_code": "import java.util.*;\nimport java.io.*;\npublic class Xor1\n{\n public void fun()\n {\n Scanner in= new Scanner(System.in);\n\tlong s = in.nextLong();\n\tlong s1=s;\n\tlong x = in.nextLong();\n\tif(x==0)\n\t{\n\t System.out.println(\"1\");\n\t return;\n\t } \n\tlong c=0;\n\tfor(long i=1;i<=s;i++)\n\t{\n\t for(long j=i+1;j<=s;j++)\n\t {\n\t if(((i+j)==s1)&&((i^j)==x))\n\t {\n\t c=c+2;\n\t }\n }\n }\n System.out.println(c);\t\n \n }\n public static void main(String args[])\n {\n new Xor1().fun();\n }\n} \n\t\n\t\n\t", "lang": "Java 8", "bug_code_uid": "d93ab57140e73481c06a06cc0a228c3b", "src_uid": "18410980789b14c128dd6adfa501aea5", "apr_id": "18a6606324baeca3b8f73476fc23fdc4", "difficulty": 1700, "tags": ["dp", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.05200433369447454, "equal_cnt": 55, "replace_cnt": 45, "delete_cnt": 6, "insert_cnt": 4, "fix_ops_cnt": 55, "bug_source_code": "import java.io.*;\nimport java.util.*;\npublic class sonu\n{\n\n static int count(long n){\n\n int c=0;\n while(n>0)\n { c++;n=n/2;}\n return(c);\n }\n static class pair{\n long x,y;\n pair(long a,long b){\n x=a;\n y=b;\n }\n \n public boolean equals(Object obj) {\n if (this == obj)\n return true;\n if (obj == null)\n return false;\n if (getClass() != obj.getClass())\n return false;\n pair other = (pair) obj;\n if (x != other.x)\n return false;\n if (y != other.y)\n return false;\n return true;\n }\n @Override\n public int hashCode() {\n return((int)(x-y));\n } \n }\n public static void main(String[] args) throws IOException {\n Scanner sc = new Scanner(System.in);\n \n long s = sc.nextLong();\n long x = sc.nextLong();\n int c = count(x);\n long a=0,b=0;\n if(c==0){\n if(s%2==0)\n System.out.println(\"1\");\n else\n System.out.println(\"0\");\n }\n else{\n HashSet arr[] = new HashSet[c];\n for(int i=0;i=0;i--){\n x1 = (1<<(i));\n if((x&x1)!=0){\n \n for(pair p : arr[i+1]){\n a = p.x; b=p.y;\n p1 = new pair(a+x1,b);\n arr[i].add(p1);\n p1 = new pair(a,b+x1);\n arr[i].add(p1);\n }\n }\n else{\n for(pair p : arr[i+1]){\n a = p.x; b = p.y;\n p1 = new pair(a,b);\n arr[i].add(p1);\n if((a+b+2*x1)<=s){\n p1 = new pair(a+x1,b+x1); \n arr[i].add(p1);\n }\n }\n }\n }\n long ans=0;\n for(pair p : arr[0])\n if((p.x+p.y)==s&&p.x!=0&&p.y!=0)\n ans++;\n System.out.println(ans);\n }\n }\n static class Reader \n { \n final private int BUFFER_SIZE = 1 << 16; \n private DataInputStream din; \n private byte[] buffer; \n private int bufferPointer, bytesRead; \n \n public Reader() \n { \n din = new DataInputStream(System.in); \n buffer = new byte[BUFFER_SIZE]; \n bufferPointer = bytesRead = 0; \n } \n \n public Reader(String file_name) throws IOException \n { \n din = new DataInputStream(new FileInputStream(file_name)); \n buffer = new byte[BUFFER_SIZE]; \n bufferPointer = bytesRead = 0; \n } \n \n public String readLine() throws IOException \n { \n byte[] buf = new byte[64]; // line length \n int cnt = 0, c; \n while ((c = read()) != -1) \n { \n if (c == '\\n') \n break; \n buf[cnt++] = (byte) c; \n } \n return new String(buf, 0, cnt); \n } \n \n public int nextInt() throws IOException \n { \n int ret = 0; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n do\n { \n ret = ret * 10 + c - '0'; \n } while ((c = read()) >= '0' && c <= '9'); \n \n if (neg) \n return -ret; \n return ret; \n } \n \n public long nextLong() throws IOException \n { \n long ret = 0; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n do { \n ret = ret * 10 + c - '0'; \n } \n while ((c = read()) >= '0' && c <= '9'); \n if (neg) \n return -ret; \n return ret; \n } \n \n public double nextDouble() throws IOException \n { \n double ret = 0, div = 1; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n \n do { \n ret = ret * 10 + c - '0'; \n } \n while ((c = read()) >= '0' && c <= '9'); \n \n if (c == '.') \n { \n while ((c = read()) >= '0' && c <= '9') \n { \n ret += (c - '0') / (div *= 10); \n } \n } \n \n if (neg) \n return -ret; \n return ret; \n } \n \n private void fillBuffer() throws IOException \n { \n bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); \n if (bytesRead == -1) \n buffer[0] = -1; \n } \n \n private byte read() throws IOException \n { \n if (bufferPointer == bytesRead) \n fillBuffer(); \n return buffer[bufferPointer++]; \n } \n public void close() throws IOException \n { \n if (din == null) \n return; \n din.close(); \n } \n }\n} ", "lang": "Java 8", "bug_code_uid": "ad84f6e0b52c0026d72ed1be0573a2bd", "src_uid": "18410980789b14c128dd6adfa501aea5", "apr_id": "4cdbe060c42674aee19c5b0bdfeac292", "difficulty": 1700, "tags": ["dp", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.0683540222472997, "equal_cnt": 52, "replace_cnt": 42, "delete_cnt": 6, "insert_cnt": 4, "fix_ops_cnt": 52, "bug_source_code": "import java.io.*;\nimport java.util.*;\npublic class sonu\n{\n\n static int count(long n){\n int c=0;\n while(n>0)\n { c++; n=n/2; }\n return(c);\n }\n public static void main(String[] args) throws IOException {\n Scanner sc = new Scanner(System.in);\n \n long s = sc.nextLong();\n long x = sc.nextLong();\n long ans=0;\n if((s-x)%2==1||(s-x)%2==-1)\n ans=0;\n else\n { \n long and = (s-x)/2;\n if(x==0)\n ans=1;\n int c = count(x);\n for(int i=0;i0)\n ans=ans-2;\n }\n System.out.println(ans);\n }\n static class Reader \n { \n final private int BUFFER_SIZE = 1 << 16; \n private DataInputStream din; \n private byte[] buffer; \n private int bufferPointer, bytesRead; \n \n public Reader() \n { \n din = new DataInputStream(System.in); \n buffer = new byte[BUFFER_SIZE]; \n bufferPointer = bytesRead = 0; \n } \n \n public Reader(String file_name) throws IOException \n { \n din = new DataInputStream(new FileInputStream(file_name)); \n buffer = new byte[BUFFER_SIZE]; \n bufferPointer = bytesRead = 0; \n } \n \n public String readLine() throws IOException \n { \n byte[] buf = new byte[64]; // line length \n int cnt = 0, c; \n while ((c = read()) != -1) \n { \n if (c == '\\n') \n break; \n buf[cnt++] = (byte) c; \n } \n return new String(buf, 0, cnt); \n } \n \n public int nextInt() throws IOException \n { \n int ret = 0; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n do\n { \n ret = ret * 10 + c - '0'; \n } while ((c = read()) >= '0' && c <= '9'); \n \n if (neg) \n return -ret; \n return ret; \n } \n \n public long nextLong() throws IOException \n { \n long ret = 0; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n do { \n ret = ret * 10 + c - '0'; \n } \n while ((c = read()) >= '0' && c <= '9'); \n if (neg) \n return -ret; \n return ret; \n } \n \n public double nextDouble() throws IOException \n { \n double ret = 0, div = 1; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n \n do { \n ret = ret * 10 + c - '0'; \n } \n while ((c = read()) >= '0' && c <= '9'); \n \n if (c == '.') \n { \n while ((c = read()) >= '0' && c <= '9') \n { \n ret += (c - '0') / (div *= 10); \n } \n } \n \n if (neg) \n return -ret; \n return ret; \n } \n \n private void fillBuffer() throws IOException \n { \n bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); \n if (bytesRead == -1) \n buffer[0] = -1; \n } \n \n private byte read() throws IOException \n { \n if (bufferPointer == bytesRead) \n fillBuffer(); \n return buffer[bufferPointer++]; \n } \n public void close() throws IOException \n { \n if (din == null) \n return; \n din.close(); \n } \n }\n} ", "lang": "Java 8", "bug_code_uid": "d8f7fa290c5058ba690363ec6a6fa238", "src_uid": "18410980789b14c128dd6adfa501aea5", "apr_id": "4cdbe060c42674aee19c5b0bdfeac292", "difficulty": 1700, "tags": ["dp", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9011527377521614, "equal_cnt": 11, "replace_cnt": 10, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 10, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class nines { \n public static void main(String[] args) { \n InputStream input = System.in;\n OutputStream output = System.out;\n InputReader2 in = new InputReader2(input);\n PrintWriter out = new PrintWriter(output);\n Solution s = new Solution();\n s.solve(1, in, out);\n out.close();\n }\n\n static class Solution { \n \n double EPS = 0.0000001;\n public void solve(int cs, InputReader2 in, PrintWriter out) {\n String s = in.next();\n long p = Long.parseLong(s), k = in.nextLong();\n long d = p - p % (long)(Math.pow(10, s.length()-1)) - 1;\n while (p-d > k) {\n for (int n = s.length()-1; n > 0; --n) {\n long pow = (long)(Math.pow(10, n));\n while (d+pow < p) {\n d+=pow;\n }\n }\n }\n out.println(d);\n }\n }\n\n static class InputReader2 {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n\n public InputReader2(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new RuntimeException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public long nextLong() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0; // long or int\n do {\n if (c < '0' || c > '9') {\n throw new RuntimeException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public double nextDouble() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n double res = 0, div = 1;\n do {\n res *= 10;\n res += c - '0';\n c = read();\n } while (c >= '0' && c <= '9');\n if (c == '.') {\n while ((c = read()) >= '0' && c <= '9') {\n res += (c - '0') / (div *= 10);\n }\n }\n return res * sgn;\n }\n public String next() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n return res.toString();\n } \n public boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n }\n}\n\n\n\n", "lang": "Java 8", "bug_code_uid": "d8e4991bbac5e07167a633199a09c0e3", "src_uid": "c706cfcd4c37fbc1b1631aeeb2c02b6a", "apr_id": "e1fa312eaf9d48b0434967e7567d9506", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.4979020979020979, "equal_cnt": 13, "replace_cnt": 11, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 13, "bug_source_code": "import java.util.HashSet;\nimport java.util.*; \nimport java.util.Scanner;\nimport java.util.Set;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.text.DecimalFormat;\nimport java.lang.Math;\npublic class Lo {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n long n = sc.nextLong();\n long k = sc.nextLong();\n int digits = 0;\n long temp = n;\n long t = temp%10;\n while(temp>0){\n digits++;\n temp /= 10;\n }\n long max = n;\n if(t+1 <= k){\n max = n-(t+1);\n }\n long d = (long)Math.pow(10, digits-1)-1;\n int p = 2;\n for(long i = n; i >= Math.max(d, n-k); i = i-10){\n if((i-(t+1))%(long)Math.pow(10,p) == (long)Math.pow(10,p)-1 && i-(t+1)>=(n-k)){\n max = i-(t+1);\n p++;\n }\n }\n if(k==0){\n System.out.println(n);\n }\n else{\n System.out.println(max);\n }\n }\n} ", "lang": "Java 8", "bug_code_uid": "234a142b97f849d6b6c91c89aba395e3", "src_uid": "c706cfcd4c37fbc1b1631aeeb2c02b6a", "apr_id": "21b9a84bf67603b992ea5a7ba5847bca", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.2111215834118756, "equal_cnt": 13, "replace_cnt": 8, "delete_cnt": 5, "insert_cnt": 1, "fix_ops_cnt": 14, "bug_source_code": "\nimport java.util.Scanner;\n\npublic class SuperPriceBourles {\n public static void main(String asd[])throws Exception\n {\n Scanner in=new Scanner(System.in);\n long n=in.nextLong();\n long d=in.nextLong();\n int k=1;\n while((n-(n - n % (int)Math.pow(10,k) - 1))<=d && n - n % (int)Math.pow(10,k) - 1!=-1)\n {\n n=n - n % (int)Math.pow(10,k) - 1;\n k++;\n }\n System.out.println(n);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "20d1ce65362b616634169a62ecadbdf0", "src_uid": "c706cfcd4c37fbc1b1631aeeb2c02b6a", "apr_id": "635f07ce0763fffdce340fa99a968830", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.4104627766599598, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 9, "bug_source_code": "\nimport java.math.BigInteger;\nimport java.util.Scanner;\n\n/**\n *\n * @author kreed96\n */\npublic class Test1 {\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int a = in.nextInt();\n int b = in.nextInt();\n BigInteger res;\n BigInteger factA = factorial(a);\n BigInteger factB = factorial(b);\n boolean trig = true;\n BigInteger nod;\n if(factA.longValue() > factB.longValue()) nod = factA;\n else if (factA.longValue() < factB.longValue()) nod = factB;\n else nod = factA;\n while(trig){\n if(nod == BigInteger.valueOf(0)) trig = false;\n else if(factA.divideAndRemainder(nod)[1] == BigInteger.valueOf(0) && factB.divideAndRemainder(nod)[1] == BigInteger.valueOf(0) ) trig = false;\n else nod = nod.subtract(BigInteger.valueOf(1));\n }\n res = nod;\n System.out.println(res);\n }\n \n public static BigInteger factorial(int n)\n {\n if (n == 0) return BigInteger.ONE;\n return BigInteger.valueOf(n).multiply(factorial(n-1));\n }\n\n}\n", "lang": "Java 8", "bug_code_uid": "d20fe2cdd06b3d3a2d4bafdd7abd3bef", "src_uid": "7bf30ceb24b66d91382e97767f9feeb6", "apr_id": "35d17c30fb0d522594c63fbec472342b", "difficulty": 800, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5461254612546126, "equal_cnt": 11, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "import java.util.Scanner;\n\npublic class GCDOfFactorials {\n\n\tpublic static void main(String[] args) {\n\t\t\n\t\tScanner in = new Scanner(System.in);\n int num1 = in.nextInt();\n int num2 = in.nextInt();\n \n\t\tint fact[] = null;\n\t\tif(num1 > num2) {\n\t\t\tfact = factorial(num1);\n\t\t}\n\t\telse {\n\t\t\tfact = factorial(num2);\n\t\t}\n\t\tint fact1 = fact[num1];\n\t\tint fact2 = fact[num2];\n\t\n\t\tSystem.out.println(gcd(fact1, fact2));\n\t}\n\t\n\tprivate static int gcd(int a , int b) {\n\t\tif(a == 0) {\n\t\t\treturn b;\n\t\t}\n\t\treturn gcd(b%a,a);\n\t}\n\t\n\tprivate static int[] factorial(int num) {\n\t\tint[] arr = new int[num+1];\n\t\tarr[0] = 1;\n\t\tfor(int i=1;i<=num;i++) {\n\t\t\tarr[i] = arr[i-1] * i;\n\t\t}\n\t\treturn arr;\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "3f7252a83e0b96bae9351adb5c21c235", "src_uid": "7bf30ceb24b66d91382e97767f9feeb6", "apr_id": "300e8c0f288c49f17c77eaa329ed42e5", "difficulty": 800, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9623824451410659, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Scanner;\n\npublic class New {\n\n\tpublic static void main(String args[]) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tString S = sc.next() ;\n\t\t\n\n\t\tif (S.charAt(0) == 'S' && S.charAt(-1)=='F'){\n\t\t\tSystem.out.println(\"YES\");\n\n\t\t} else {\n\t\t\tSystem.out.println(\"NO\");\n\t\t}\n\t}\n\n}", "lang": "Java 8", "bug_code_uid": "915d84ce00ce0b5826525f6553a198f5", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "apr_id": "bb8b827749c0d3c8be454432431a650a", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8194701170671596, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 8, "bug_source_code": "import java.util.Scanner;\n\npublic class Main\n{\n\tpublic static void main(String[] args)\n\t{\n\t Scanner sc = new Scanner(System.in);\n\t int n = sc.nextInt();\n\t sc.nextLine();\n String vuelos = sc.nextLine();\n int S=0, F=0, C=0;\n for(int i=0; iF)\n System.out.print(\"YES\");\n else if(F>=S)\n System.out.print(\"NO\");\n\n\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "562f6f756e40ed4940f14be67566eeaa", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "apr_id": "67e2b72caaf5743d08b8ffeadb7d54ea", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9518652226233454, "equal_cnt": 8, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 8, "bug_source_code": "\npackage com.test;\n\nimport java.util.Scanner;\n\npublic class Problem {\n\n\n public static void main(String [] args) {\n\n Scanner scanner = new Scanner(System.in);\n\n StringBuilder sb1 = new StringBuilder(scanner.nextLine());\n StringBuilder sb2 = new StringBuilder(scanner.nextLine());\n int StoF = 0;\n int FtoS = 0;\n\n for(int i = 2 ; i < Integer.valueOf(sb1.toString()) ; i++)\n {\n if(sb2.substring(i-2,i).equals(\"SF\"))\n {\n StoF++;\n }\n if(sb2.substring(i-2,i).equals(\"FS\"))\n {\n FtoS++;\n }\n }\n if(StoF>FtoS)\n {\n System.out.println(\"YES\");\n }\n else\n {\n System.out.println(\"NO\"); \n }\n \n scanner.close();\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "58682cf5e314ea86c0898823f07da649", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "apr_id": "83e3a90d316cf84b8d2ac33c8caacfb9", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9983834464920789, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import static java.lang.Double.parseDouble;\nimport static java.lang.Integer.parseInt;\nimport static java.lang.Long.parseLong;\nimport static java.lang.Math.min;\nimport static java.lang.System.exit;\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\npublic class Main{\n static BufferedReader in;\n static PrintWriter out;\n static StringTokenizer tok;\n static void solve() throws IOException{\n int r=Int();\n int x=Int();\n int y=Int();\n int x1=Int();\n int y1=Int();\n double dist=(int)Math.sqrt((long)Math.abs((long)(x1-x)*(x1-x))+(long)Math.abs((long)(y1-y)*(y1-y)));\n // int t=r*2;\n \n out.println((int)Math.ceil(dist/(2*r)));\n }\n static int Int() throws IOException{\n return parseInt(next());\n }\n static String next() throws IOException{\n while(tok==null || !tok.hasMoreTokens()){\n tok=new StringTokenizer(in.readLine());\n }\n return tok.nextToken();\n }\n public static void main(String args[]){\n try{\n in=new BufferedReader(new InputStreamReader(System.in));\n out=new PrintWriter(new OutputStreamWriter(System.out));\n solve();\n in.close();\n out.close();\n }catch(Throwable e){\n e.printStackTrace();\n exit(1);\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "f9a89ebb0a465eb0ff9f3b70af9f90b4", "src_uid": "698da80c7d24252b57cca4e4f0ca7031", "apr_id": "a7af043462b9003836058321aec388fb", "difficulty": 1400, "tags": ["geometry", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9955366631243359, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.BufferedReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.io.IOException;\nimport java.util.StringTokenizer;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n * @author Hieu Le\n */\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tInputReader in = new InputReader(inputStream);\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\tTaskD solver = new TaskD();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass TaskD {\n private final int MAX = 50;\n private long[] fib;\n\n public TaskD() {\n fib = new long[MAX + 1];\n fib[0] = 1;\n fib[1] = 1;\n for (int i = 2; i <= MAX; i++) fib[i] = fib[i - 1] + fib[i - 2];\n }\n\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n long k = in.nextLong();\n int[] res = new int[n + 1];\n fill(res, k, 1);\n for (int i = 1; i <= n; i++) out.print(res[i] + \" \");\n out.println();\n }\n\n private void fill(int[] res, long rank, int pos) {\n if (pos == res.length) return;\n if (pos == res.length - 1) {\n res[pos] = pos;\n return;\n }\n int cnt = res.length - pos;\n if (rank < fib[cnt]) {\n res[pos] = pos;\n fill(res, rank, pos + 1);\n } else {\n res[pos] = pos + 1;\n res[pos + 1] = pos;\n fill(res, rank - fib[cnt], pos + 2);\n }\n }\n}\n\nclass InputReader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n}\n\n", "lang": "Java 7", "bug_code_uid": "74631450e1a362c47c83b317c4d73a8f", "src_uid": "e03c6d3bb8cf9119530668765691a346", "apr_id": "3c1ec4afecff29465f5dda640d79f1b0", "difficulty": 1900, "tags": ["combinatorics", "greedy", "math", "implementation", "constructive algorithms", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9956115245182218, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "\nimport java.util.*;\nimport java.math.*;\nimport java.io.*;\n\npublic class B\n{\n public static void main(String[] args)\n {\n PrintWriter out = new PrintWriter(System.out);\n new B(new FastScanner(), out);\n out.close();\n }\n\n long MAX = 1000000000000000008L;\n public B(FastScanner in, PrintWriter out)\n {\n int N = in.nextInt();\n long K = in.nextLong()-1;\n long[] ways = new long[N+1];\n ways[0] = 1L;\n for (int i=0; i=pos; j--)\n {\n out.print(j+1);\n out.print(' ');\n }\n pos = i+1;\n break; \n }\n K -= ways[numLeft];\n }\n }\n out.println();\n\n }\n}\n\n\nclass FastScanner{\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n\n public FastScanner()\n {\n stream = System.in;\n }\n\n int read()\n {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars){\n curChar = 0;\n try{\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n boolean isSpaceChar(int c)\n {\n return c==' '||c=='\\n'||c=='\\r'||c=='\\t'||c==-1;\n }\n \n boolean isEndline(int c)\n {\n return c=='\\n'||c=='\\r'||c==-1;\n }\n\n int nextInt()\n {\n return Integer.parseInt(next());\n }\n \n long nextLong()\n {\n return Long.parseLong(next());\n }\n\n double nextDouble()\n {\n return Double.parseDouble(next());\n }\n\n String next(){\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do{\n res.appendCodePoint(c);\n c = read();\n }while(!isSpaceChar(c));\n return res.toString();\n }\n \n String nextLine(){\n int c = read();\n while (isEndline(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do{\n res.appendCodePoint(c);\n c = read();\n }while(!isEndline(c));\n return res.toString();\n }\n}\n", "lang": "Java 7", "bug_code_uid": "5448bf7230bbe8e1c7638467951ec1db", "src_uid": "e03c6d3bb8cf9119530668765691a346", "apr_id": "e705d121590825fdf9586af9bdba6a99", "difficulty": 1900, "tags": ["combinatorics", "greedy", "math", "implementation", "constructive algorithms", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9433650268706076, "equal_cnt": 14, "replace_cnt": 5, "delete_cnt": 3, "insert_cnt": 5, "fix_ops_cnt": 13, "bug_source_code": "import java.util.InputMismatchException;\nimport java.io.InputStream;\nimport java.math.BigInteger;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.io.IOException;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n * @author George Marcus\n */\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tInputReader in = new InputReader(inputStream);\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\tTaskB solver = new TaskB();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass TaskB {\n private static final long MAX = 1000000000000000000L;\n private static final BigInteger LIM = BigInteger.valueOf(MAX);\n\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int N = in.nextInt();\n long K = in.nextLong();\n\n BigInteger[] fact = new BigInteger[N + 1];\n fact[0] = BigInteger.ONE;\n for (int i = 1; i <= N; i++) {\n fact[i] = fact[i - 1].multiply(BigInteger.valueOf(i));\n fact[i] = fact[i].min(LIM);\n }\n\n BigInteger[] dp2 = new BigInteger[N + 1];\n dp2[0] = BigInteger.ONE;\n for (int i = 1; i <= N; i++) {\n dp2[i] = BigInteger.ZERO;\n }\n for (int i = 0; i < N; i++) {\n for (int j = i; j < N; j++) {\n dp2[j + 1] = dp2[j + 1].add(dp2[i].multiply(fact[j - i]));\n dp2[j + 1] = dp2[j + 1].min(LIM);\n }\n }\n long[] dp = new long[N + 1];\n for (int i = 0; i <= N; i++) {\n dp[i] = Long.parseLong(dp2[i].toString());\n }\n if (dp[N] < K) {\n throw new RuntimeException();\n }\n\n int[] P = new int[N];\n boolean[] used = new boolean[N];\n for (int i = 0; i < N; i++) {\n for (int j = 0; j < N; j++) {\n if (used[j]) continue;\n if (dp[N - i - 1] < K) {\n K -= dp[N - i - 1];\n } else {\n P[i] = j;\n used[j] = true;\n break;\n }\n }\n }\n\n for (int i = 0; i < N; i++) {\n if (i > 0) {\n out.print(\" \");\n }\n out.print(P[i] + 1);\n }\n out.println();\n }\n}\n\nclass InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n return Integer.parseInt(nextString());\n }\n\n public long nextLong() {\n return Long.parseLong(nextString());\n }\n\n public String nextString() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuffer res = new StringBuffer();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n\n return res.toString();\n }\n\n private boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n}\n\n", "lang": "Java 7", "bug_code_uid": "ad419bb01b207e819bd0b1056e459bab", "src_uid": "e03c6d3bb8cf9119530668765691a346", "apr_id": "60f98b6c578f036914a0790e81a46f10", "difficulty": 1900, "tags": ["combinatorics", "greedy", "math", "implementation", "constructive algorithms", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9524895477004941, "equal_cnt": 10, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 10, "bug_source_code": "\nimport java.util.*;\npublic class GFG {\n\tpublic static void main (String[] args) \n\t{\n\t Scanner sc=new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tString s=sc.next();int a[]=new int[26];int s1=0;\n\t\tif (n==1) {System.out.println(0);return;}\n\t\tfor (int i=0;i=1;i--)\n\t\t{\n\t\t char c=(char)('a'+i);\n\t\t for (int j=0;j 0 && b > 0 && c > 0) {\n\t\t\tif (a - 1 < 0 || b - 2 < 0 || c - 4 < 0)\n\t\t\t\tbreak;\n\t\t\tif (a - 1 >= 0) {\n\t\t\t\ta--;\n\t\t\t\t++count;\n\t\t\t}\n\n\t\t\tif (b - 2 >= 0) {\n\t\t\t\tb -= 2;\n\t\t\t\tcount += 2;\n\t\t\t}\n\n\t\t\tif (c - 4 >= 0) {\n\t\t\t\tc -= 4;\n\t\t\t\tcount += 4;\n\t\t\t}\n\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\n}\nimport java.util.Scanner;\n\npublic class R386A {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint a = scan.nextInt(), b = scan.nextInt(), c = scan.nextInt();\n\t\tint count = 0;\n\t\twhile (a > 0 && b > 0 && c > 0) {\n\t\t\tif (a - 1 < 0 || b - 2 < 0 || c - 4 < 0)\n\t\t\t\tbreak;\n\t\t\tif (a - 1 >= 0) {\n\t\t\t\ta--;\n\t\t\t\t++count;\n\t\t\t}\n\n\t\t\tif (b - 2 >= 0) {\n\t\t\t\tb -= 2;\n\t\t\t\tcount += 2;\n\t\t\t}\n\n\t\t\tif (c - 4 >= 0) {\n\t\t\t\tc -= 4;\n\t\t\t\tcount += 4;\n\t\t\t}\n\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "4fc33944d2d1138de0d8371ee87b8091", "src_uid": "82a4a60eac90765fb62f2a77d2305c01", "apr_id": "7b88e850664b60d464c69c2cf3bf46ff", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8936802973977696, "equal_cnt": 3, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "public class JavaApplication1 {\n\n /**\n * @param args the command line arguments\n */\n public static void main(String[] args) {\n // TODO code application logic here\n Scanner scanner=new Scanner(System.in);\n int lemon = scanner.nextInt();\n int apple = scanner.nextInt();\n int pear = scanner.nextInt();\n \n int result=0;\n \n for(int i=lemon;i>0;i--){\n if(2*i<=apple&&4*i<=pear){\n result=i+(2*i)+(4*i);\n System.out.println(result+\"\");\n return;\n }\n \n }\n\n }\n ", "lang": "Java 8", "bug_code_uid": "ef9049e515eac21a57cce0c2fef92beb", "src_uid": "82a4a60eac90765fb62f2a77d2305c01", "apr_id": "166c64c65b7c9cc9ec532c80dd890776", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8090614886731392, "equal_cnt": 12, "replace_cnt": 4, "delete_cnt": 4, "insert_cnt": 4, "fix_ops_cnt": 12, "bug_source_code": "import java.util.*;\npublic class A746\n{\n public static void main(String...arg)\n \n {\n int i,j,x,y,z,c=0;\n Scanner sc=new Scanner(System.in);\n x=sc.nextint();\n y=sc.nextint();\n z=sc.nextint();\n for(i=x;i>=0;i--)\n {\n c=0;\n if(y/2/i==0)\n c=1;\n if(z/4/i==0)\n c=1;\n if(c==0&&i!=0)\n {\n System.out.println(7*i);\n break;\n }\n if(i==0)\n {\n System.out.println(\"0\");\n }\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "1b0ca44584baf353456260478cd08473", "src_uid": "82a4a60eac90765fb62f2a77d2305c01", "apr_id": "5f077e59296608c1a0fb8ebd1f97c3d0", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9995189995189995, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Collections;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Scanner;\nimport java.util.LinkedList;\nimport java.util.TreeMap;\npublic class Main {\n\tpublic static Scanner in=new Scanner(System.in);\n\tpublic static int num;\n\tpublic static int time[][]=new int[25][61];\n\tpublic static void main(String[] args){\n\t\tint a;\n\t\tint ta;\n\t\tint b;\n\t\tint tb;\n\t\tString s=in.nextLine();\n\t\tint z=0;\n\t\tint count=0;\n\t\twhile(s.charAt(z)!=' ')z++;\n\t\ta=Integer.parseInt(s.substring(0, z));\n\t\tta=Integer.parseInt(s.substring(z+1, s.length()));\n\t\ts=in.nextLine();\n\t\tz=0;\n\t\twhile(s.charAt(z)!=' ')z++;\n\t\tb=Integer.parseInt(s.substring(0, z));\n\t\ttb=Integer.parseInt(s.substring(z+1, s.length()));\n\t\ts=in.nextLine();\n\t\tint starth=Integer.parseInt(s.substring(0, 2));\n\t\tint startm=Integer.parseInt(s.substring(3, 5));\n\t\tint hs=starth*60+startm;\n\t\tint he=hs+ta;\n\t\tint j=b;\n\t\tfor(int i=300;i<24*60;i++){\n\t\t\tif(j==b){\n\t\t\t\tif(i>=(hs-tb)&&i 10000)\n\t\t\t\tbreak;\n\t\t\tif (h1 < H2 || h1==H2 && m1 < M2) {\n\t\t\t\tif (H1 < h2 || H1==h2 && M1 < m2) {\n\t\t\t\t\tans++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tM1 += b;\n\t\t\tH1 += M1 / 60;\n\t\t\tM1 %= 60;\n\t\t}\n\t\tSystem.out.println(ans);\n\t\tpw.close();\n\t}\n\tprivate static int nextInt() throws IOException {\n\t\treturn Integer.parseInt(next());\n\t}\n\tprivate static long nextLong() throws IOException {\n\t\treturn Long.parseLong(next());\n\t}\n\tprivate static double nextDouble() throws IOException {\n\t\treturn Double.parseDouble(next());\n\t}\n\tprivate static String next() throws IOException {\n\t\twhile (st==null || !st.hasMoreTokens())\n\t\t\tst = new StringTokenizer(br.readLine());\n\t\treturn st.nextToken();\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "bdf31f2584b4565f0c747fbab85e6279", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "apr_id": "ebb7f3ac1f67a000f27369b5e83fd4df", "difficulty": 1600, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9998083189572551, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedOutputStream;\nimport java.io.BufferedReader;\nimport java.io.File;\nimport java.io.FileNotFoundException;\nimport java.io.FileOutputStream;\nimport java.io.FileReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.OutputStream;\nimport java.io.PrintStream;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.StringTokenizer;\n\npublic class Bus {\n\n private static Scanner in;\n private static Output out;\n static boolean isFile = false;\n\n public static void solve() throws Exception {\n\n int t1 = in.nextInt();\n int s1 = in.nextInt();\n\n int t2 = in.nextInt();\n int s2 = in.nextInt();\n String[] startFirst = in.nextLine().split(\":\");\n\n int totalEnd = 24 * 60;\n int semenStart = Integer.parseInt(startFirst[0]) * 60 + Integer.parseInt(startFirst[1]);\n int startBus = 5 * 60;\n\n B a = new B(semenStart, semenStart + s1);\n\n List bs = new ArrayList<>();\n int currentTime = startBus;\n bs.add(new B(currentTime, currentTime + s2));\n currentTime += t2;\n while (currentTime <= totalEnd) {\n bs.add(new B(currentTime, currentTime + s2));\n currentTime += t2;\n }\n\n int counter = 0;\n for (int i = 0; i < bs.size(); i++) {\n B b = bs.get(i);\n if (b.start >= a.end) {\n continue;\n }\n if (b.end <= a.start) {\n continue;\n }\n counter++;\n// if (b.start < a.end) {\n//\n// continue;\n// }\n\n }\n\n out.println(counter);\n }\n\n private static class B {\n public int start;\n public int end;\n\n public B(int start, int end) {\n this.start = start;\n this.end = end;\n }\n\n @Override\n public String toString() {\n return \"B{\" +\n \"start=\" + start +\n \", end=\" + end +\n '}';\n }\n }\n\n static Exception exception;\n\n public static void main(String[] args) throws Exception {\n Thread thread = new Thread(null, new Runnable() {\n @Override\n public void run() {\n try {\n initReaderWriter();\n solve();\n out.close();\n } catch (Exception ex) {\n exception = ex;\n }\n }\n }, \"\", 1 << 26);\n thread.start();\n thread.join();\n\n if (exception != null) {\n throw exception;\n }\n }\n\n private static void initReaderWriter() throws Exception {\n if (isFile) {\n in = new Scanner(\"input.txt\");\n out = new Output(new File(\"output.txt\"));\n } else {\n in = new Scanner();\n out = new Output(System.out);\n }\n }\n\n private static boolean log = false;\n\n public static void log(String msg) {\n if (log) {\n out.println(msg);\n out.flush();\n }\n }\n\n private static class Scanner {\n\n StringTokenizer st = null;\n BufferedReader bf;\n\n public Scanner() {\n bf = new BufferedReader(new InputStreamReader(System.in));\n }\n\n public Scanner(String fileName) throws FileNotFoundException {\n bf = new BufferedReader(new FileReader(fileName));\n }\n\n public String next() throws IOException {\n while (st == null || !st.hasMoreTokens())\n st = new StringTokenizer(bf.readLine());\n return st.nextToken();\n }\n\n public String nextLine() throws IOException {\n return bf.readLine();\n }\n\n public int nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n\n public long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n\n public double nextDouble() throws IOException {\n return Double.parseDouble(next());\n }\n }\n\n private static class Output extends PrintStream {\n\n public Output(OutputStream out) {\n super(new BufferedOutputStream(out));\n }\n\n public Output(File file) throws FileNotFoundException {\n super(new BufferedOutputStream(new FileOutputStream(file)));\n }\n }\n\n private static void printMemory() {\n Runtime runtime = Runtime.getRuntime();\n\n long maxMemory = runtime.maxMemory();\n long allocatedMemory = runtime.totalMemory();\n long freeMemory = runtime.freeMemory();\n\n long div = 1L * 1024 * 1024;\n // long div = 1L ;\n\n System.out.println(\"used memory[mgb]: \" + (runtime.totalMemory() - runtime.freeMemory()) / div);\n\n System.out.println();\n }\n\n static long appCurrentTime = System.currentTimeMillis();\n static long appCurrentTimeNano = System.nanoTime();\n\n private static void printCurrentTime() {\n out.flush();\n System.out.println(\"Time: \" + (System.currentTimeMillis() - appCurrentTime));\n System.out.println(\"Time Nano: \" + (System.nanoTime() - appCurrentTimeNano));\n }\n}\n", "lang": "Java 7", "bug_code_uid": "ef0eea6f0eb85c8605c3294b71ef814c", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "apr_id": "9af7190231115124bc938198630910c6", "difficulty": 1600, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9374130737134909, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.StringTokenizer;\n\n/*\n * To change this template, choose Tools | Templates\n * and open the template in the editor.\n */\n/**\n *\n * @author J\n */\npublic class code4 {\n public static void main(String[] args){\n InputScanner sc = new InputScanner();\n \n int[] xSet = new int[8];\n int[] ySet = new int[8];\n \n ArrayList xSide = new ArrayList();\n ArrayList ySide = new ArrayList(); \n \n for(int i = 0 ; i < 8 ; i++){\n \n String line = sc.nextLine();\n String[] chars = line.split(\" \");\n int x = Integer.parseInt(chars[0]);\n int y = Integer.parseInt(chars[1]);\n xSet[i] = x;\n ySet[i] = y;\n if(!xSide.contains(x)){\n \n xSide.add(x);\n \n }\n if(!ySide.contains(y)){\n \n ySide.add(y);\n \n }\n if(ySide.size() > 3 || xSide.size() > 3){\n \n System.out.println(\"ugly\");\n return;\n }\n }\n Collections.sort(xSide);\n Collections.sort(ySide);\n \n for(int i = 0 ; i < 8 ; i++){\n \n if(xSet[i] == xSide.get(1) && ySet[i] == ySide.get(1)){\n \n System.out.println(\"ugly\");\n return;\n \n }\n \n }\n System.out.println(\"respectable\");\n }\n static class InputScanner {\n\n BufferedReader br;\n StringTokenizer st;\n\n public InputScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n }\n}\n", "lang": "Java 7", "bug_code_uid": "9fb499bbff91d77ad5525bae22397f1e", "src_uid": "f3c96123334534056f26b96f90886807", "apr_id": "67375980b450b4b0b25bbae00e1e046a", "difficulty": 1400, "tags": ["sortings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9256410256410257, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "import java.util.*;\n\npublic class susbus{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n String s = sc.next();\n int count=0;\n int remove=0;\n for (int i=0;i=2){\n remove+=count-2;\n }\n count=0;\n }\n }\n System.out.println(remove);\n }\n}", "lang": "Java 8", "bug_code_uid": "22d7fca232ed361510fc3329bf596d09", "src_uid": "8de14db41d0acee116bd5d8079cb2b02", "apr_id": "9a1f11f958a0bf78905d8de226c311db", "difficulty": 800, "tags": ["strings", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9748911951791095, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "\nimport java.io.FileNotFoundException;\nimport java.math.BigInteger;\nimport java.util.Scanner;\n\n\n\npublic class Main\n{\n static String s;\n static int len;\n static BigInteger ten = new BigInteger(\"10\");\n static BigInteger nine = new BigInteger(\"9\");\n static boolean []occ = new boolean [100005];\n static int letterEnc;\n \n static BigInteger solve( int i )\n {\n if( i == len )\n return new BigInteger(\"1\");\n \n char c = s.charAt(i);\n\n if( c >= '0' && c <= '9' )\n return solve(i+1);\n\n if( c == '?' )\n {\n if( i != 0 )\n return solve(i+1).multiply(ten);\n return solve(i+1).multiply(nine);\n }\n\n if( i != 0 )\n {\n if( occ[c] )\n return solve(i+1);\n occ[c] = true;\n letterEnc++;\n return solve(i+1).multiply(new BigInteger(String.format(\"%d\",Math.max( 1 , 11 - letterEnc ))));\n \n }\n\n letterEnc = 1;\n occ[c] = true;\n return solve(i+1).multiply(nine);\n }\n \n public static void main( String[] args ) throws FileNotFoundException\n {\n String s = new Scanner(System.in).nextLine();\n// s = new Scanner(new File(\"c:\\\\a.txt\")).nextLine();\n \n len = s.length();\n \n for( int i = 0 ; i < len ; i++ )\n occ[i] = false;\n \n letterEnc = 0;\n\n System.out.println(solve(0));\n }\n}", "lang": "Java 7", "bug_code_uid": "fcd68f7eceafcaeeadb4107ad529119b", "src_uid": "d3c10d1b1a17ad018359e2dab80d2b82", "apr_id": "47467ee304fb1b708a4b3c723ff31a55", "difficulty": 1100, "tags": ["greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9993939393939394, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import static java.lang.Integer.parseInt;\nimport static java.lang.Double.parseDouble;\nimport static java.lang.Long.parseLong;\nimport static java.lang.Math.*;\n\nimport java.io.*;\nimport java.util.*;\nimport java.text.*;\nimport java.math.*;\n\n\npublic class Main {\n\n\tBufferedReader in;\n\tPrintWriter out;\n\tStringTokenizer stk;\n\tvoid Do() throws IOException\n\t{\n\t\tSystem.setIn(new FileInputStream(new File(\"input.txt\")));\n\t\tin=new BufferedReader(new InputStreamReader(System.in));\n\t\tout=new PrintWriter(new OutputStreamWriter(System.out));\n\t\tsolve();\n\t\tin.close();\n\t\tout.close();\n\t}\n\tprivate void solve() throws IOException{\n\t\tString s=next();\n\t\tboolean[] zimu=new boolean[26];\n\t\tint zimucnt=10;\n\t\tBigInteger ans=BigInteger.ONE;\n\t\tfor(int i=0;i='A' && !zimu[c-'A'])\n\t\t\t{\n\t\t\t\tzimu[c-'A']=true;\n\t\t\t\tif(zimucnt==0)\n\t\t\t\t{\n\t\t\t\t\tans=BigInteger.ZERO;\n\t\t\t\t\tbreak;\n\t\t\t\t}\t\t\t\t\n\t\t\t\tif(i==0) ans=ans.multiply(new BigInteger(\"9\"));\n\t\t\t\telse ans=ans.multiply(new BigInteger(\"\"+zimucnt));\n\t\t\t\tzimucnt--;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\tString next() throws IOException\n\t{\n\t\twhile(stk==null || !stk.hasMoreTokens())\n\t\t\tstk=new StringTokenizer(in.readLine());\n\t\treturn stk.nextToken();\n\t}\n\tint nextInt() throws IOException\n\t{\n\t\treturn parseInt(next());\n\t}\n\tlong nextLong() throws IOException\n\t{\n\t\treturn parseLong(next());\n\t}\n\tdouble nextDouble() throws IOException\n\t{\n\t\treturn parseDouble(next());\n\t}\n\tpublic static void main(String[] args) throws IOException{\n\t\tnew Main().Do();\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "a9014ddab158be7f53b6fe06f773f32d", "src_uid": "d3c10d1b1a17ad018359e2dab80d2b82", "apr_id": "6ad2b2d8e4cd278d34b4bf9331e8274f", "difficulty": 1100, "tags": ["greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9858823529411764, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.math.*;\npublic class Main {\n static Scanner in = new Scanner(System.in);\n static String cad = in.next();\n static int l = cad.length();\n static BigInteger res = new BigInteger(\"1\");\n static int arr[] = new int[10];\n static int cont = 0;\n static int start = 10;\n public static void main(String[] args) {\n for(int i = 1; i < l; i++){\n if(cad.charAt(i) == '?')\n res = res.multiply(new BigInteger(\"10\"));\n else{\n if(cad.charAt(i) > '9')\n arr[cad.charAt(i) - 'A']++;\n }\n }\n if(cad.charAt(0) > '9')\n arr[cad.charAt(0) - 'A']++;\n for(int i = 0; i < 10; i++)\n if(arr[i] > 0) cont++; \n if(cad.charAt(0) == '?'){\n res = res.multiply(new BigInteger(\"9\"));\n }\n else{\n if(cad.charAt(0) >= 'A'){\n start--;\n cont--;\n res = res.multiply(new BigInteger(\"9\"));\n } \n }\n while(cont > 0){\n res = res.multiply(new BigInteger(Integer.toString(start)));\n start--;\n cont--; \n }\n System.out.println(res);\n }\n}", "lang": "Java 7", "bug_code_uid": "e45c8678b162924a897fe2f46eff30f5", "src_uid": "d3c10d1b1a17ad018359e2dab80d2b82", "apr_id": "8990256a6d3c0ef4989afeca7fa9b12f", "difficulty": 1100, "tags": ["greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.997093023255814, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Scanner;\npublic class A{\n public static void main(String args[]) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int m = in.nextInt();\n int r = in.nextInt();\n int min;\n int a;\n for (int i =0; imax)max =a;\n }\n int ko=r/min;\n int r1=ko*max + r%min;\n if (r>= r1) System.out.println(r);\n else System.out.println(r1);\n }\n}", "lang": "Java 8", "bug_code_uid": "40010e30132f40677f3644bd18d54642", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "apr_id": "20cb0be5925d14a098c6db410f8ed917", "difficulty": 800, "tags": ["greedy", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9990592662276576, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import javax.annotation.processing.SupportedSourceVersion;\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.lang.management.BufferPoolMXBean;\nimport java.nio.Buffer;\nimport java.util.Arrays;\nimport java.util.Scanner;\npublic class Chess {\n public static void main(String[] args)\n {\n Scanner input = new Scanner(System.in);\n int[] k = new int[3];\n for(int i = 0; i < 3; i++)\n {\n k[i] = input.nextInt();\n }\n int[] m = new int[k[0]];\n for(int i = 0; i n[k[1] -1])\n {\n System.out.println(k[2]);\n }\n else\n {\n int l;\n l = (int) Math.floor(k[2] / m[0]);\n l = l * n[k[1] - 1] + (k[2] - l * m[0]);\n System.out.println(l);\n }\n }", "lang": "Java 8", "bug_code_uid": "f796f70c5de16690d497b15ef727c3ee", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "apr_id": "c6a6ccbc35c02b2b51d2154eefa32e05", "difficulty": 800, "tags": ["greedy", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9995435874030123, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "\nimport java.io.BufferedOutputStream;\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.math.BigDecimal;\nimport java.util.*;\n\n\npublic class ForcesC {\n\n\t\n\tpublic static class FastReader {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\t\t//it reads the data about the specified point and divide the data about it ,it is quite fast\n\t\t//than using direct \n\n\t\tpublic FastReader() {\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t}\n\n\t\tString next() {\n\t\t\twhile (st == null || !st.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (Exception r) {\n\t\t\t\t\tr.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tint nextInt() {\n\t\t\treturn Integer.parseInt(next());//converts string to integer\n\t\t}\n\n\t\tdouble nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tString nextLine() {\n\t\t\tString str = \"\";\n\t\t\ttry {\n\t\t\t\tstr = br.readLine();\n\t\t\t} catch (Exception r) {\n\t\t\t\tr.printStackTrace();\n\t\t\t}\n\t\t\treturn str;\n\t\t}\n\t}\n\n\n\tpublic static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));\n\tstatic long mod = (long)(1e9+7);\n\tstatic FastReader sc = new FastReader();\n static List[] edge ;\n\tpublic static void main(String[] args) {\n\t\t\n\t\t int n = sc.nextInt();\n\t int m = sc.nextInt();\n\t int r = sc.nextInt();\n\t int minn = Integer.MAX_VALUE,maxm = Integer.MIN_VALUE;\n\t for(int i=0;i map, int i) {\n\t\t// TODO Auto-generated method stub\n\t\tif(map.containsKey(i)) map.put(i, map.get(i)+1);\n\t\telse map.put(i, 1);\n\t\t\n\t}\n\tprivate static void delete(TreeMap map, int i) {\n\t\tif(map.containsKey(i)) {\n\t\t\tif(map.get(i) == 1) map.remove(i);\n\t\t\telse map.put(i, map.get(i)-1);\n\t\t}\n\t\t\n\t}\n\t}", "lang": "Java 8", "bug_code_uid": "4f4e8898bfc107ede81a516e40508940", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "apr_id": "0941293799ab3035acc2a9a71303364d", "difficulty": 800, "tags": ["greedy", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9546218487394958, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "public class VasyaAndChess\n{\n\tpublic static void main(String[] args)\n\t{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tif(n%2 != 0)\n\t\t\tSystem.out.println(\"black\");\n\t\telse\n\t\t{\n\t\t\tSystem.out.println(\"white\");\n\t\t\tSystem.out.println(1 + \" \" + 2);\n\t\t}\n\t\tsc.close();\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "ba93c5e56078a140250dcb99144c222d", "src_uid": "52e07d176aa1d370788f94ee2e61df93", "apr_id": "5865dfda92e01eb3987b48df86e1613c", "difficulty": 1700, "tags": ["math", "games", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9549712904200665, "equal_cnt": 19, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 12, "fix_ops_cnt": 18, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.FileNotFoundException;\nimport java.io.FileReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\n\npublic class Solve7 {\n\n public static void main(String[] args) throws IOException {\n PrintWriter pw = new PrintWriter(System.out);\n new Solve7().solve(pw);\n pw.flush();\n pw.close();\n }\n\n public void solve(PrintWriter pw) throws IOException {\n FastReader sc = new FastReader();\n int n = sc.nextInt();\n String s = sc.next();\n int k = 0;\n for (char i = 'z'; i > 'a'; i--) {\n n = s.length();\n for (int j = 0; j < n; j++) {\n StringBuilder sb = new StringBuilder(s);\n for (int l = 0; l < sb.length(); l++) {\n if (sb.charAt(l) == i) {\n if (l == 0 && l + 1 < sb.length() && sb.charAt(l + 1) == i - 1) {\n sb.deleteCharAt(l);\n ++k;\n break;\n } else if (l == sb.length() - 1 && sb.length() > 1 && sb.charAt(l - 1) == i - 1) {\n sb.deleteCharAt(l);\n ++k;\n break;\n } else {\n if (sb.charAt(l - 1) == i - 1 || sb.charAt(l + 1) == i - 1) {\n sb.deleteCharAt(l);\n ++k;\n break;\n }\n }\n }\n }\n s = sb.toString();\n }\n }\n pw.println(k);\n }\n\n static class FastReader {\n\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n public FastReader(String s) {\n try {\n br = new BufferedReader(new FileReader(s));\n } catch (FileNotFoundException e) {\n }\n }\n\n public String next() {\n if (st == null || !st.hasMoreTokens()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (Exception e) {\n }\n }\n return st.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public String nextLine() {\n try {\n return br.readLine();\n } catch (Exception e) {\n }\n return null;\n }\n\n public boolean hasNext() throws IOException {\n if (st != null && st.hasMoreTokens()) {\n return true;\n }\n String s = br.readLine();\n if (s == null || s.isEmpty()) {\n return false;\n }\n st = new StringTokenizer(s);\n return true;\n }\n }\n}\n", "lang": "Java 11", "bug_code_uid": "257aa584cbeb339b36953189f099e1cf", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "apr_id": "56eeceb875435a9a718ede4ac66ec820", "difficulty": 1600, "tags": ["strings", "brute force", "greedy", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.37254901960784315, "equal_cnt": 12, "replace_cnt": 8, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "import java.util.*;\nimport java.io.*;\npublic class shell\n{\n public static void main(String args[]) throws java.lang.Exception\n {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n int n=Integer.parseInt(br.readLine());\n int x=Integer.parseInt(br.readLine());\n if(x<0||x>2)\n System.exit(0);\n int arr[]=new int[3];\n arr[x]=1;\n int temp=0;\n while(n!=0)\n {\n if(n%2==0)\n {\n temp=arr[1];\n arr[1]=arr[2];\n arr[2]=temp;\n }\n else\n {\n temp=arr[1];\n arr[1]=arr[0];\n arr[0]=temp; \n }\n n=n-1;\n }\n for(int i=0;i<3;i++)\n {\n if(arr[i]==1)\n System.out.println(i);\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "69f4ea323366fdf591c5d10937e9b88e", "src_uid": "7853e03d520cd71571a6079cdfc4c4b0", "apr_id": "13f94ca6a382b77a49ff17bb5f610913", "difficulty": 1000, "tags": ["math", "constructive algorithms", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7699050401753105, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import java.util.Scanner;\n\npublic class Contests {\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\tint x = in.nextInt();\n\t\tint[][] matrix = new int[3][n];\n\t\tmatrix[0][0] = 0;\n\t\tmatrix[1][0] = 1;\n\t\tmatrix[2][0] = 2;\n\t\tif (x == 0 && n % 2 == 1) {\n\t\t\tn = n % 5;\n\t\t\tif (n == 1)\n\t\t\t\tx = 1;\n\t\t\telse if (n == 2)\n\t\t\t\tx = 2;\n\t\t\telse if (n == 3)\n\t\t\t\tx = 2;\n\t\t\telse if (n == 4)\n\t\t\t\tx = 1;\n\n\t\t} else if (x == 1 && n % 2 == 1) {\n\t\t\tn = n % 6;\n\t\t\tif (n == 1)\n\t\t\t\tx = 0;\n\t\t\telse if (n == 2)\n\t\t\t\tx = 0;\n\t\t\telse if (n == 3)\n\t\t\t\tx = 1;\n\t\t\telse if (n == 4)\n\t\t\t\tx = 2;\n\t\t\telse if (n == 5)\n\t\t\t\tx = 2;\n\t\t} else if (x == 2 && n % 2 == 1) {\n\t\t\tn = n % 6;\n\t\t\tif (n == 2)\n\t\t\t\tx = 1;\n\t\t\telse if (n == 3)\n\t\t\t\tx = 0;\n\t\t\telse if (n == 4)\n\t\t\t\tx = 0;\n\t\t\telse if (n == 5)\n\t\t\t\tx = 1;\n\n\t\t} else if (x == 0 && n % 2 == 0) {\n\t\t\tn = n % 6;\n\t\t\tif (n == 2)\n\t\t\t\tx = 1;\n\t\t\telse if (n == 3)\n\t\t\t\tx = 2;\n\t\t\telse if (n == 4)\n\t\t\t\tx = 2;\n\t\t\telse if (n == 5)\n\t\t\t\tx = 1;\n\n\t\t} else if (x == 1 && n % 2 == 0) {\n\t\t\tn = n % 6;\n\t\t\tif (n == 1)\n\t\t\t\tx = 2;\n\t\t\telse if (n == 2)\n\t\t\t\tx = 2;\n\t\t\telse if (n == 3)\n\t\t\t\tx = 1;\n\t\t\telse if (n == 4)\n\t\t\t\tx = 0;\n\t\t\telse if (n == 5)\n\t\t\t\tx = 0;\n\t\t} else if (x == 2 && n % 2 == 0) {\n\t\t\tn = n % 5;\n\t\t\tif (n == 1)\n\t\t\t\tx = 1;\n\t\t\telse if (n == 2)\n\t\t\t\tx = 0;\n\t\t\telse if (n == 3)\n\t\t\t\tx = 0;\n\t\t\telse if (n == 4)\n\t\t\t\tx = 1;\n\t\t}\n\t\tSystem.out.println(x);\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "9b3545d6ca63ed6b101aef9decf09953", "src_uid": "7853e03d520cd71571a6079cdfc4c4b0", "apr_id": "992cb646ab59fd265b2967c354d02571", "difficulty": 1000, "tags": ["math", "constructive algorithms", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.36201438848920864, "equal_cnt": 59, "replace_cnt": 53, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 58, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.math.BigInteger;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Deque;\nimport java.util.Iterator;\nimport java.util.LinkedList;\nimport java.util.Map;\nimport java.util.PriorityQueue;\nimport java.util.Queue;\nimport java.util.StringTokenizer;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\n\npublic class Main {\n\t\n\tstatic int n;\n\tstatic ArrayList bad [][][];\n\tstatic char a [][], b [];\n\tstatic int res [];\n\tstatic int tmp [];\n\tstatic boolean visited[];\n\t\n\tstatic boolean ok (int node, int col) {\n\t\tvisited[node] = true;\n\t\ttmp[node] = col;\n\t\tboolean can = true;\n\t\t\n\t\tfor (int child : bad[node][col][0]) {\n\t\t\tif (visited[child]) {\n\t\t\t\tcan &= tmp[child] == 1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcan &= ok (child, 1);\n\t\t\t}\n\t\t}\n\t\tfor (int child : bad[node][col][1]) {\n\t\t\tif (visited[child]) {\n\t\t\t\tcan &= tmp[child] == 0;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcan &= ok (child, 0);\n\t\t\t}\n\t\t}\n\t\tvisited[node] = false;\n\t\treturn can;\n\t}\n\t\n\tstatic void fill (int node, int col) {\n\t\tvisited[node] = true;\n\t\tres[node] = col;\n\t\t\n\t\tfor (int child : bad[node][col][0]) {\n\t\t\tif (!visited[child]) {\n\t\t\t\tfill(child, 1);\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor (int child : bad[node][col][1]) {\n\t\t\tif (!visited[child]) {\n\t\t\t\tfill(child, 0);\n\t\t\t}\n\t\t}\n\t}\n\tpublic static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\t\n\t\tn = sc.nextInt();\n\t\tbad = new ArrayList[n][2][2];\n\t\tvisited = new boolean[n];\n\t\tres = new int[n];\n\t\ta = new char[n][];\n\t\tb = new char[n];\n\t\ttmp = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tbad[i][0][0] = new ArrayList<>();\n\t\t\tbad[i][0][1] = new ArrayList<>();\n\t\t\tbad[i][1][0] = new ArrayList<>();\n\t\t\tbad[i][1][1] = new ArrayList<>();\n\t\t\ta [i] = sc.next().toCharArray();\n\t\t\tb [i] = sc.next().charAt(0);\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tString f = a[i][0] + \"\" + a[i][1] + \"\" + a[i][2];\n\t\t\tString s = a[i][0] + \"\" + a[i][1] + \"\" + b[i];\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\tif (i != j) {\n\t\t\t\t\tString ff = a[j][0] + \"\" + a[j][1] + \"\" + a[j][2];\n\t\t\t\t\tString ss = a[j][0] + \"\" + a[j][1] + \"\" + b[j];\n\t\t\t\t\tif (f.equals(ff)) {\n\t\t\t\t\t\tbad[i][0][0].add(j);\n\t\t\t\t\t\tbad[i][1][0].add(j);\n\t\t\t\t\t}\n\t\t\t\t\tif(s.equals(ss)) bad[i][1][1].add(j);\n\t\t\t\t\tif (f.equals(ss)) bad[i][0][1].add(j);\n\t\t\t\t\tif (s.equals(ff)) bad[i][1][0].add(j);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tboolean can = true;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (!visited[i]) {\n\t\t\t\tif (!ok(i, 0)) {\n\t\t\t\t\tif (!ok(i, 1)) {\n\t\t\t\t\t\tcan = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse fill (i, 1);\n\t\t\t\t}\n\t\t\t\telse fill(i, 0);\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (can) {\n\t\t\tout.println(\"YES\");\n\t\t\tfor (int i = 0; i < n; i++) \n\t\t\t\tif (res[i] == 0) out.println(a[i][0] + \"\" + a[i][1] + \"\" + a[i][2]);\n\t\t\t\telse out.println(a[i][0] + \"\" + a[i][1] + \"\" + b[i]);\n\t\t}\n\t\telse out.println(\"NO\");\n\t\tout.flush();\n\t\tout.close();\n\t}\n\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\tstatic class Scanner {\n\t\tStringTokenizer st;\n\t\tBufferedReader br;\n\n\t\tpublic Scanner(InputStream s) {\n\t\t\tbr = new BufferedReader(new InputStreamReader(s));\n\t\t}\n\n\t\tpublic String next() throws IOException {\n\t\t\twhile (st == null || !st.hasMoreTokens())\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic int nextInt() throws IOException {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic long nextLong() throws IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic String nextLine() throws IOException {\n\t\t\treturn br.readLine();\n\t\t}\n\n\t\tpublic double nextDouble() throws IOException {\n\t\t\tString x = next();\n\t\t\tStringBuilder sb = new StringBuilder(\"0\");\n\t\t\tdouble res = 0, f = 1;\n\t\t\tboolean dec = false, neg = false;\n\t\t\tint start = 0;\n\t\t\tif (x.charAt(0) == '-') {\n\t\t\t\tneg = true;\n\t\t\t\tstart++;\n\t\t\t}\n\t\t\tfor (int i = start; i < x.length(); i++)\n\t\t\t\tif (x.charAt(i) == '.') {\n\t\t\t\t\tres = Long.parseLong(sb.toString());\n\t\t\t\t\tsb = new StringBuilder(\"0\");\n\t\t\t\t\tdec = true;\n\t\t\t\t} else {\n\t\t\t\t\tsb.append(x.charAt(i));\n\t\t\t\t\tif (dec)\n\t\t\t\t\t\tf *= 10;\n\t\t\t\t}\n\t\t\tres += Long.parseLong(sb.toString()) / f;\n\t\t\treturn res * (neg ? -1 : 1);\n\t\t}\n\n\t\tpublic boolean ready() throws IOException {\n\t\t\treturn br.ready();\n\t\t}\n\t\t\n\t\tpublic boolean nextEmpty() throws IOException\n\t\t{\n\t\t\tString s = nextLine();\n\t\t\tst = new StringTokenizer(s);\n\t\t\treturn s.isEmpty();\n\t\t}\n\t}\n}", "lang": "Java 8", "bug_code_uid": "48e13cb3b7ace1ca0e019043871bdfe6", "src_uid": "7853e03d520cd71571a6079cdfc4c4b0", "apr_id": "b127f861dd7dac84efd2227e09b88bad", "difficulty": 1000, "tags": ["math", "constructive algorithms", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9877149877149877, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String arg[])\n\t{\n\t\tScanner scanf=new Scanner(System.in);\n\t\tint n,x,t = 0;\n\t\tint[] num=new int[4];\n\t\twhile(scanf.hasNext())\n\t\t{\n\t\t\tn=scanf.nextInt();\n\t\t\tfor(int z=0;z<4;z++)\n\t\t\t{\n\t\t\t\tnum[z]=0;\n\t\t\t}\n\t\t\tx=scanf.nextInt();\n\t\t\tnum[x]=1;\n\t\t\tn=n%6;\n\t\t\tfor(int z=n;z>0;z--)\n\t\t\t{\n\t\t\t\tif(z%2==0)\n\t\t\t\t{\n\t\t\t\t\tt=num[1];\n\t\t\t\t\tnum[1]=num[2];\n\t\t\t\t\tnum[2]=t;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tt=num[0];\n\t\t\t\t\tnum[0]=num[1];\n\t\t\t\t\tnum[1]=t;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(int z=0;z<3;z++)\n\t\t\t{\n\t\t\t\tif(num[z]==1)\n\t\t\t\t\tt=z;\n\t\t\t}\n\t\t\tSystem.out.println(t);\n\t\t\tscanf.close();\n\t\t}\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "f9d5cf0d7b3871064c34e9a09bfbb82b", "src_uid": "7853e03d520cd71571a6079cdfc4c4b0", "apr_id": "b5e9fcb00ac5c1055a9fb428691f7b00", "difficulty": 1000, "tags": ["math", "constructive algorithms", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9687002652519894, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Main\n{\n\tstatic final boolean _DEBUG = false;\n\n\tprivate static class MyScanner {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tpublic MyScanner(BufferedReader _br) {\n\t\t\tbr = _br;\n\t\t}\n\n\t\tString next() {\n\t\t\twhile (st == null || !st.hasMoreElements()) {\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t\treturn \"\";\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tint nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tdouble nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tString nextLine() {\n\t\t\tString str = \"\";\n\t\t\ttry {\n\t\t\t\tstr = br.readLine();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn str;\n\t\t}\n\n\t}\n\n\tstatic MyScanner scan;\n\tstatic PrintWriter out;\n\n\tstatic int debugCount = 0;\n\tstatic void debug(String msg) {\n\t\tif (_DEBUG && debugCount < 200) {\n\t\t\tout.println(msg);\n\t\t\tout.flush();\n\t\t\tdebugCount++;\n\t\t}\n\t}\n\t\n public static void main (String args[]) throws IOException {\n// \tscan = new MyScanner(new BufferedReader(new FileReader(\"test.in\")));\n \tscan = new MyScanner(new BufferedReader(new InputStreamReader(System.in)));\n \tout = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n Main inst = new Main();\n inst.execute();\n out.close();\n }\n \n int N, M, pow;\n int[] counts;\n int[][][] dp;\n \n void execute() {\n \tN = scan.nextInt();\n \tM = scan.nextInt();\n \tif (N < M) {\n \t\tint temp = N;\n \t\tN = M;\n \t\tM = temp;\n \t}\n \tpow = 1<>1))&(pow-1))==(pow-1)) {\n \t\tdp[0][i][0] = counts[i];\n \t\t}\n \t}\n \tint spiders = Integer.MAX_VALUE;\n \tfor (int y = 0; y < N-1; y++) {\n \t\tfor (int i = 0; i < pow; i++) {\n \t\t\tfor (int j = 0; j < pow; j++) {\n \t\t\t\tif (dp[y][i][j] == -1) {\n \t\t\t\t\tcontinue;\n \t\t\t\t}\n \t\t\t\tfor (int k = 0; k < pow; k++) {\n \t\t\t\t\tif (((i|(i<<1)|(i>>1)|j|k)&(pow-1))==(pow-1)) {\n \t\t\t\t\t\tint value = dp[y][i][j] + counts[k];\n \t\t\t\t\t\tif (dp[y+1][k][i] == -1 || dp[y+1][k][i] > value) {\n \t\t\t\t\t\t\tdp[y+1][k][i] = value;\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// \tSystem.out.println(Arrays.deepToString(dp));\n \tfor (int i = 0; i < pow; i++) {\n \t\tfor (int j = 0; j < pow; j++) {\n \t\t\tif (dp[N-1][i][j] != -1 && ((i|(i<<1)|(i>>1)|j)&(pow-1))==(pow-1)) {\n \t\t\t\tspiders = Math.min(spiders, dp[N-1][i][j]);\n \t\t\t}\n \t\t}\n \t}\n \tout.println((N*M)-spiders);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "b9cb8095a742f6803c969deb1a3d75bf", "src_uid": "097674b4dd696b30e102938f71dd39b9", "apr_id": "307f02b51ab46c3fc1ffe5ee429bcaf3", "difficulty": 2100, "tags": ["dp", "bitmasks", "dsu"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5093396474611944, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "import java.util.Scanner;\n\n\npublic class Main {\n public static void main(String[] args) {\n Scanner r = new Scanner(System.in);\n \n int n = r.nextInt();\n int m = r.nextInt(import java.util.Arrays;\nimport java.util.Scanner;\n\n\npublic class Main {\n public static void main(String[] args) {\n Scanner r = new Scanner(System.in);\n \n int n = r.nextInt();\n int m = r.nextInt();\n \n if(n > m){int t = n; n = m; m = t;}\n \n dp = new int[m+1][1 << 7][1 << 7];\n for(int[][] i : dp)\n for(int[] j : i)\n Arrays.fill(j, -1);\n int min = go(m, 0, (1<> 1);\n int next = ~(now) & ((1 << n)-1);\n int current = Integer.bitCount(now) + go(rem-1, after ,next, n, m);\n min = Math.min(min, current);\n }\n return dp[rem][prev][need] = min;\n }\n}\n);\n \n if(n > m){int t = n; n = m; m = t;}\n \n dp = new int[m+1][1 << 7][1 << 7];\n int min = go(m, 0, (1<> 1);\n int next = ~(now) & ((1 << n)-1);\n \n int current = Integer.bitCount(now) + go(rem-1, after ,next, n, m);\n min = Math.min(min, current);\n }\n return dp[rem][prev][need] = min;\n }\n}\n", "lang": "Java 6", "bug_code_uid": "5103b8f8cd0d3c29384f7d6d224c410e", "src_uid": "097674b4dd696b30e102938f71dd39b9", "apr_id": "356bf5b35bdc3628a855261175e99b63", "difficulty": 2100, "tags": ["dp", "bitmasks", "dsu"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9977761304670126, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import static java.lang.Math.*;\nimport static java.lang.System.currentTimeMillis;\nimport static java.lang.System.exit;\nimport static java.lang.System.arraycopy;\nimport static java.util.Arrays.sort;\nimport static java.util.Arrays.binarySearch;\nimport static java.util.Arrays.fill;\nimport java.util.*;\nimport java.io.*;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\ttry {\n\t\t\tif (new File(\"input.txt\").exists())\n\t\t\t\tSystem.setIn(new FileInputStream(\"input.txt\"));\n\t\t} catch (SecurityException e) {\n\t\t}\n\t\tnew Thread(null, new Runnable() {\n\t\t\tpublic void run() {\n\t\t\t\ttry {\n\t\t\t\t\tnew Main().run();\n\t\t\t\t} catch (Throwable e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t\texit(999);\n\t\t\t\t}\n\t\t\t}\n\t\t}, \"1\", 1 << 23).start();\n\t}\n\n\tBufferedReader in;\n\tPrintWriter out;\n\tStringTokenizer st = new StringTokenizer(\"\");\n\n\tint n, m;\n\tint dp[][][];\n\tint MV = Integer.MAX_VALUE >> 1;\n\tint ans = MV;\n\t\n\tprivate void run() throws IOException {\n\t\tin = new BufferedReader(new InputStreamReader(System.in));\n\t\tout = new PrintWriter(System.out);\n\n\t\tn = nextInt();\n\t\tm = nextInt();\n\t\tif(n < m){ int d = n; n = m; m = d; }\n\t\tint M = 1 << m;\n\t\tdp = new int[n][m << 1][ m << 1];\n\t\tfor(int a[][] : dp)\n\t\t\tfor(int b[] : a)\n\t\t\t\tfill(b, MV);\n\t\t\n//\t\tfor(int i = 0 ; i < M; i++){\n//\t\t\tint next = (( i | (i << 1) | (i >> 1) ) & (M - 1));\n//\t\t\tif( next!= (M -1))\n//\t\t\t\tcontinue;\n//\t\t\tif(n > 1)\n//\t\t\t\tdp[0][next][0] = Integer.bitCount(i);\n//\t\t\telse\n//\t\t\t\tans = min(ans, Integer.bitCount(i));\n//\t\t}\n\t\tdp[0][0][0] = 0;\n\t\t\n\t\tfor(int i = 0; i < n; i++)\n\t\t\tfor(int m1 = 0; m1 < M; m1++)\n\t\t\t\tfor(int m2 = 0; m2 < M; m2++){\n\t\t\t\t\tif(dp[i][m1][m2] == MV)\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tfor(int nm1 = 0; nm1 < M; nm1++)\n\t\t\t\t\t\tfor(int nm2 = 0; nm2 < M; nm2++){\n\t\t\t\t\t\t\tint res1 = m1 | (nm1) | (nm1 << 1) | (nm1 >> 1) | (nm2);\n\t\t\t\t\t\t\tres1 &= (M - 1);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif(res1 != (M - 1))\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tint res2 = m2 | (nm1) | (nm2 << 1) | (nm2 >> 1) | (nm2);\n\t\t\t\t\t\t\tres2 &= (M - 1);\n\t\t\t\t\t\t\t\n//\t\t\t\t\t\t\tif(i == 2 && m1 == 3 && m2 == 2 && nm1 == 0 && nm2 == 0){\n//\t\t\t\t\t\t\t\tSystem.err.println(\"kek\");\n//\t\t\t\t\t\t\t\tSystem.err.println(dp[i][m1][m2]);\n//\t\t\t\t\t\t\t\tSystem.err.println(res1 + \" | \" + res2);\n//\t\t\t\t\t\t\t\tSystem.err.println(M);\n//\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tint next1 = res2 & (M - 1);\n\t\t\t\t\t\t\tint next2 = nm2 & ( M - 1);\n\t\t\t\t\t\t\tint over = Integer.bitCount(nm1) + Integer.bitCount(nm2);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif(i < n - 1)\n\t\t\t\t\t\t\t\tdp[i+1][next1][next2] = min(dp[i + 1][next1][next2], dp[i][m1][m2] + over);\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tif((res1 & (M - 1)) == (M - 1)){\n\t\t\t\t\t\t\t\t\tans = min(dp[i][m1][m2] + over, ans);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n//\t\tSystem.err.println(ans);\n\t\tout.println(n * m - ans);\n\t\t\n\t\tin.close();\n\t\tout.close();\n\t}\n\tString nextToken() throws IOException {\n\t\twhile (!st.hasMoreTokens())\n\t\t\tst = new StringTokenizer(in.readLine());\n\t\treturn st.nextToken();\n\t}\n\tint nextInt() throws IOException {\n\t\treturn Integer.parseInt(nextToken());\n\t}\n\tlong nextLong() throws IOException {\n\t\treturn Long.parseLong(nextToken());\n\t}\n\tdouble nextDouble() throws IOException {\n\t\treturn Double.parseDouble(nextToken());\n\t}\n\tString nextLine() throws IOException {\n\t\tst = new StringTokenizer(\"\");\n\t\treturn in.readLine();\n\t}\n\tboolean EOF() throws IOException {\n\t\twhile (!st.hasMoreTokens()) {\n\t\t\tString s = in.readLine();\n\t\t\tif (s == null)\n\t\t\t\treturn true;\n\t\t\tst = new StringTokenizer(s);\n\t\t}\n\t\treturn false;\n\t}\n}\n", "lang": "Java 6", "bug_code_uid": "fe4057539fce63d3d538816c21a34081", "src_uid": "097674b4dd696b30e102938f71dd39b9", "apr_id": "2b156f08f1f9d093fd2ff01a6274a9ec", "difficulty": 2100, "tags": ["dp", "bitmasks", "dsu"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9073430149314788, "equal_cnt": 9, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 8, "bug_source_code": "import java.util.*;\nimport java.lang.*;\nimport java.math.*;\nimport java.io.*;\nimport static java.lang.Math.*;\nimport static java.util.Arrays.*;\nimport static java.util.Collections.*;\n\npublic class P111C{\n\tScanner sc=new Scanner(System.in);\n\n\tint INF=1<<28;\n\tdouble EPS=1e-9;\n\n\tint h, w;\n\n\tvoid run(){\n\t\th=sc.nextInt();\n\t\tw=sc.nextInt();\n\t\tsolve();\n\t}\n\n\tvoid solve(){\n\t\tn=w*h;\n\t\tg=new long[n];\n\t\tint[] dx={0, 0, -1, 1};\n\t\tint[] dy={-1, 1, 0, 0};\n\t\tfor(int y=0; y=0&&x2=0&&y2=Long.bitCount(mds))\n\t\t\treturn;\n\t\tif(covered==((1L<>>i&1)==1){\n\t\t\t\tif(Long.bitCount(g[i]&~covered)==0){\n\t\t\t\t\tmds(choosed, removed|(1L<Long.bitCount(g[k]&~covered))\n\t\t\t\tk=i;\n\t\t}\n\t\tif(k==-1)\n\t\t\treturn;\n\n\t\tmds(choosed|(1L< monsDies) {\n int cost = (h - Hy) * costH + (a - Ay) * costA + (d - Dy) * costD;\n best = Math.min(best, cost);\n }\n }\n }\n }\n System.out.println(best);\n }\n \n public static int turnsToKill(int myHP, int enemyAtk, int myDef) {\n int dmg = enemyAtk - myDef;\n if (dmg <= 0) {\n return Integer.MAX_VALUE;\n }\n \n return (myHP + dmg - 1) / dmg;\n }\n\n public static class MyScanner {\n BufferedReader br;\n StringTokenizer st;\n\n public MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n String nextLine() {\n String str = \"\";\n try { str = br.readLine(); }\n catch (IOException e) { e.printStackTrace(); }\n return str;\n }\n }\n}", "lang": "Java 7", "bug_code_uid": "e9414eba6e46d7d56bc7996bbb6c0cdc", "src_uid": "bf8a133154745e64a547de6f31ddc884", "apr_id": "3fec4d8e2fd30ce9288d074f1fbfc900", "difficulty": 1800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9303733602421796, "equal_cnt": 10, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 7, "fix_ops_cnt": 9, "bug_source_code": "import java.util.*;\npublic class withouttest {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner sc = new Scanner (System.in);\n//\t\tint len = sc.nextInt();\n//\t\tsc.nextLine();\n\t\tString sa = sc.nextLine();\n\t\tint len = sa.length();\n//\t\tString s = sc.nextLine();\n\t\tchar s1[] = sa.toCharArray();\n//\t\tString s2 = s.toLowerCase();\n//\t\tSystem.out.print(s2);\n//\t\tList given = new ArrayList();\n\t\tboolean visited[] = new boolean[5];\n\t\tchar s2[] = {'h','e','l','l','o'};\n\t\tint cnt=0;\n\t\tint i=0,j=0,p=2,k=0;\n\t\twhile(i<5)\n\t\t{\n\t\twhile(i<5 && j1){\n System.out.println(\"NO\");\n break;\n }\n x = k;\n if(i==n-1) System.out.println(\"YES\");\n }\n }\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "lang": "Java 8", "bug_code_uid": "f1c53446d16d29c57fc8cd42e85600ed", "src_uid": "704d0ae50bccaa8bc49319812ae0be45", "apr_id": "b24e194a0e1055ec70a37e9505e7c630", "difficulty": 1600, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.963620230700976, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "import java.util.*;\npublic class Main{\n public static void main(String[] args){\n Scanner s = new Scanner(System.in);\n int n = s.nextInt();\n int[] a = new int[n];\n for(int i=0;i=2){\n System.out.println(\"NO\");\n flag = true;\n break\n }\n if(!flag){\n System.out.println(\"YES\");\n }\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "b5fce5038cfb82a53c185a5c2014e1bd", "src_uid": "704d0ae50bccaa8bc49319812ae0be45", "apr_id": "e9d80b0c8150f7101c4878aea805537c", "difficulty": 1600, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.6258755665430573, "equal_cnt": 23, "replace_cnt": 18, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 22, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.*;\n\npublic class Main {\n\n\n public static void main(String[] args) {\n MyScanner in = new MyScanner();\n int n = in.nextInt();\n int m = in.nextInt();\n int[] arr = new int[m];\n\n int max = 0;\n for (int i = 1; i <= n; i++) {\n int v = in.nextInt() % m;\n max = Math.max(v, max);\n for (int j = 1; j < m; j++) {\n if (arr[j] == 0 || arr[j] == i) continue;\n int v2 = (j + v) % m;\n max = Math.max(v2, max);\n arr[v2] = i;\n }\n\n arr[v] = i;\n }\n\n System.out.println(max);\n }\n\n public static int gcd(int a, int b) {\n int t;\n while (b != 0) {\n t = b;\n b = a % b;\n a = t;\n }\n return a;\n }\n\n public static void pa(List objs) {\n String str = \"\";\n for (Object obj : objs) {\n str += obj.toString() + \" \";\n }\n p(str);\n }\n\n public static void pa(int[] objs) {\n String str = \"\";\n for (int i = 0; i < objs.length; i++) {\n str += objs[i] + \" \";\n }\n p(str);\n }\n\n static void p(Object str) {\n System.out.println(str);\n }\n\n static class MyScanner {\n BufferedReader br;\n StringTokenizer st;\n\n public MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "177f01624ff6df70e0608c0071afd396", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "apr_id": "86c281265b2c5308fd17905ec87b92c2", "difficulty": 1800, "tags": ["divide and conquer", "meet-in-the-middle", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.735656836461126, "equal_cnt": 12, "replace_cnt": 7, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.*;\n\npublic class Main {\n\n\n public static void main(String[] args) {\n MyScanner in = new MyScanner();\n int n = in.nextInt();\n int m = in.nextInt();\n int divider = 2;\n Set[] parts = new HashSet[divider];\n for (int i = 0; i < divider; i++) {\n parts[i] = new HashSet<>();\n }\n\n int max = 0;\n for (int i = 0; i < n; i++) {\n Set set = parts[i % divider];\n int v = in.nextInt() % m;\n max = Math.max(v, max);\n Iterator iterator = set.iterator();\n List list = new ArrayList<>();\n list.add(v);\n while (iterator.hasNext()) {\n int v2 = (iterator.next() + v) % m;\n if (set.contains(v2)) continue;\n list.add(v2);\n max = Math.max(v2, max);\n }\n set.addAll(list);\n if (max == m - 1) {\n break;\n }\n }\n\n Set set1 = parts[0];\n Set set2 = parts[1];\n\n Iterator it1 = set1.iterator();\n\n while (it1.hasNext()) {\n int it = it1.next();\n Iterator it2 = set2.iterator();\n while (it2.hasNext()) {\n max = Math.max(max, (it + it2.next()) % m);\n }\n }\n\n System.out.println(max);\n }\n\n public static int gcd(int a, int b) {\n int t;\n while (b != 0) {\n t = b;\n b = a % b;\n a = t;\n }\n return a;\n }\n\n public static void pa(List objs) {\n String str = \"\";\n for (Object obj : objs) {\n str += obj.toString() + \" \";\n }\n p(str);\n }\n\n public static void pa(int[] objs) {\n String str = \"\";\n for (int i = 0; i < objs.length; i++) {\n str += objs[i] + \" \";\n }\n p(str);\n }\n\n static void p(Object str) {\n System.out.println(str);\n }\n\n static class MyScanner {\n BufferedReader br;\n StringTokenizer st;\n\n public MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "feea646c9acd0fe1e6a39fc7a0551bf0", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "apr_id": "86c281265b2c5308fd17905ec87b92c2", "difficulty": 1800, "tags": ["divide and conquer", "meet-in-the-middle", "bitmasks"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9959839357429718, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "\nimport java.util.*;\nimport java.io.*;\n\npublic class EC32P5\n{\n private static long[] arr;\n \n public static void main(String args[])\n {\n Scanner in = new Scanner(System.in);\n \n int n = in.nextInt();\n int m = in.nextInt();\n \n int[] arr1 = new int[n/2];\n int[] arr2 = new int[n - n/2];\n \n for(int i=0; i counter)\n {\n counter = sum;\n }\n \n \n }\n \n System.out.println(counter);\n }\n \n public static int[] sums_on_subarray(int[] a, int size, int from, int m) {\n int[] sums = new int[1 << size];\n for (int i = 0; i < 1 << size; i++) {\n int sum = 0;\n for (int j = 0; j < size; j++) {\n if ((i & 1 << j) > 0) {\n sum = (sum + a[j + from]) % m;\n }\n }\n\n sums[i] = sum;\n }\n\n return sums;\n }\n\n}", "lang": "Java 8", "bug_code_uid": "44cd21b2fbb72e8a9c3a92bcdf5e79bf", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "apr_id": "6d749d64293390012957fed37852143a", "difficulty": 1800, "tags": ["divide and conquer", "meet-in-the-middle", "bitmasks"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9556071909013085, "equal_cnt": 14, "replace_cnt": 3, "delete_cnt": 8, "insert_cnt": 2, "fix_ops_cnt": 13, "bug_source_code": "import java.math.BigInteger;\nimport java.text.DecimalFormat;\nimport java.util.*;\nimport java.io.*;\n\n\n\npublic class Main {\n private static int [] A ;\n private static int n;\n\n public static void main(String[] args) throws Exception {\n IO io ;\n try {\n io = new IO(\"in.in\", null);\n } catch (IOException e) {\n io = new IO(null, null);\n }\n n = io.getNextInt();\n int mod = io.getNextInt();\n A = new int[n];\n for (int i = 0;i < n;i++)\n A[i] = io.getNextInt();\n\n int m = n/2,ans = 0;\n ArrayList AS = new ArrayList<>(1 << m);\n for (int msk = 0;msk < (1 << m);msk++) {\n int s = 0;\n for (int i = 0;i < m;i++) {\n int v = A[i];\n if ((msk & (1 << i)) != 0)\n s = (s + v)%mod;\n if (s > ans) ans = s;\n AS.add(s);\n }\n }\n ArrayList AS2 = new ArrayList<>(1 << (n-m));\n int j = -1;\n for (int msk = 0,L = n - m;msk < (1 << L);msk++) {\n int s = 0;\n for (int i = 0;i < L;i++) {\n int v = A[i+m];\n if ((msk & (1 << i)) != 0)\n s = (s + v)%mod;\n if (s > ans) ans = s;\n AS2.add(s);\n }\n }\n Collections.sort(AS);\n Collections.sort(AS2);\n Collections.reverse(AS2);\n// System.err.println(AS);\n// System.err.println(AS2);\n for (int s : AS2) {\n int target = mod - 1 - s;\n while (j+1 < AS.size() && AS.get(j+1) <= target)\n j++;\n// System.err.println(s + \": \");\n if (j != -1) {\n// System.err.println(AS.get(j));\n int tmp = (s + AS.get(j))%mod;\n if (tmp > ans)\n ans = tmp;\n }\n// else System.err.println(\"\");\n }\n io.println(ans);\n io.close();\n }\n private static final int onebillion7 = 1000000007;\n}\n\n\n\nclass IO{\n private BufferedReader br;\n private StringTokenizer st;\n private PrintWriter writer;\n private String inputFile,outputFile;\n\n public boolean hasMore() throws IOException{\n if(st != null && st.hasMoreTokens()) return true;\n if(br != null && br.ready()) return true;\n return false;\n }\n\n public String getNext() throws FileNotFoundException, IOException{\n while(st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());\n return st.nextToken();\n }\n\n public String getNextLine() throws FileNotFoundException, IOException{\n return br.readLine().trim();\n }\n\n public int getNextInt() throws FileNotFoundException, IOException{\n return Integer.parseInt(getNext());\n }\n public long getNextLong() throws FileNotFoundException, IOException{\n return Long.parseLong(getNext());\n }\n\n public void print(double x,int num_digits) throws IOException{\n writer.printf(\"%.\" + num_digits + \"f\" ,x);\n }\n public void println(double x,int num_digits) throws IOException{\n writer.printf(\"%.\" + num_digits + \"f\\n\" ,x);\n }\n public void print(Object o) throws IOException{\n writer.print(o.toString());\n }\n\n public void println(Object o) throws IOException{\n writer.println(o.toString());\n }\n public IO(String x,String y) throws FileNotFoundException, IOException{\n inputFile = x;\n outputFile = y;\n if(x != null) br = new BufferedReader(new FileReader(inputFile));\n else br = new BufferedReader(new InputStreamReader(System.in));\n if(y != null) writer = new PrintWriter(new BufferedWriter(new FileWriter(outputFile)));\n else writer = new PrintWriter(new OutputStreamWriter(System.out));\n }\n\n protected void close() throws IOException{\n br.close();\n writer.close();\n }\n public void outputArr(Object [] A) throws IOException{\n int L = A.length;\n for (int i = 0;i < L;i++) {\n if(i > 0) writer.print(\" \");\n writer.print(A[i]);\n }\n writer.print(\"\\n\");\n }\n}", "lang": "Java 8", "bug_code_uid": "b9f8c2eea568f7a968a5249afc8bc078", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "apr_id": "13f8c36bceb6feded3cd5ca06c721188", "difficulty": 1800, "tags": ["divide and conquer", "meet-in-the-middle", "bitmasks"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.5505248315838948, "equal_cnt": 26, "replace_cnt": 16, "delete_cnt": 3, "insert_cnt": 6, "fix_ops_cnt": 25, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.Closeable;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\nimport java.io.BufferedReader;\nimport java.io.Closeable;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.StringTokenizer;\n\npublic class E {\n\t\n\tpublic static long solve_naive(int n, long[] as, long m){\n\t\tlong ret = 0;\n\t\t\n\t\tfor(int bit = 0; bit < (1 << n); bit++){\n\t\t\tlong curr = 0;\n\t\t\t\n\t\t\tfor(int i = 0; i < n; i++){\n\t\t\t\tif((bit & (1 << i)) == 0){ continue; }\n\t\t\t\t\n\t\t\t\tcurr += as[i];\n\t\t\t\tcurr %= m;\n\t\t\t}\n\t\t\t\n\t\t\tret = Math.max(ret, curr);\n\t\t}\n\t\t\n\t\treturn ret;\n\t}\n\t\n\tpublic static ArrayList> solve_smart(int begin, int end, long[] as, long m){\n\t\tfinal int n = end - begin;\n\t\t\n\t\tArrayList> ret = new ArrayList>();\n\t\tfor(int i = 0; i <= n; i++){ ret.add(new HashSet()); }\n\t\t\n\t\tfor(int bit = 0; bit < (1 << n); bit++){\n\t\t\tfinal int bit_count = Integer.bitCount(bit);\n\t\t\t\t\t\n\t\t\tlong curr = 0;\t\n\t\t\tfor(int i = 0; i < n; i++){\n\t\t\t\tfinal int index = begin + i;\n\t\t\t\tif((bit & (1 << index)) == 0){ continue; }\n\t\t\t\t\n\t\t\t\tcurr += as[index];\n\t\t\t\tcurr %= m;\n\t\t\t}\n\t\t\t\n\t\t\tret.get(bit_count).add(curr);\n\t\t}\n\t\t\n\t\treturn ret;\n\t}\n\t\n\t\n\t\n\tpublic static void main(String[] args) {\n\t\ttry (final Scanner sc = new Scanner(System.in)) {\n\t\t\tfinal int n = sc.nextInt();\n\t\t\tfinal int m = sc.nextInt();\n\t\t\t\n\t\t\tlong[] as = new long[n];\n\t\t\tfor(int i = 0; i < n; i++){\n\t\t\t\tas[i] = sc.nextLong() % m;\n\t\t\t}\n\t\t\t\n\t\t\tSystem.out.println(solve_naive(n, as, m));\n\t\t\t\n\t\t\t/*\n\t\t\tfinal int fst_size = n / 2;\n\t\t\tfinal int snd_size = n - n / 2;\n\t\t\t\n\t\t\t//System.out.println(0 + \" \" + fst_size + \" , \" + fst_size + \" \" + snd_size) ;\n\t\t\tArrayList> fst_part = solve_smart(0, fst_size, as, m);\n\t\t\tArrayList> snd_part = solve_smart(fst_size, n, as, m);\n\t\t\t\n\t\t\tlong max = 0;\n\t\t\tfor(int fst_count = 0; fst_count <= fst_size; fst_count++){\n\t\t\t\tfor(final long fst_value : fst_part.get(fst_count)){\n\t\t\t\t\t\n\t\t\t\t\tfor(int snd_count = 0; snd_count <= snd_size; snd_count++){\n\t\t\t\t\t\tfor(final long snd_value : snd_part.get(snd_count)){\n\t\t\t\t\t\t\tmax = Math.max(max, (fst_value + snd_value) % m);\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\t\n\t\t\t\n\t\t\tSystem.out.println(max);\n\t\t\t*/\n\t\t}\n\t}\n\t\t\n\tpublic static class Scanner implements Closeable {\n\t\tprivate BufferedReader br;\n\t\tprivate StringTokenizer tok;\n\n\t\tpublic Scanner(InputStream is) {\n\t\t\tbr = new BufferedReader(new InputStreamReader(is));\n\t\t}\n\n\t\tprivate void getLine() {\n\t\t\ttry {\n\t\t\t\twhile (!hasNext()) {\n\t\t\t\t\ttok = new StringTokenizer(br.readLine());\n\t\t\t\t}\n\t\t\t} catch (IOException e) { /* ignore */\n\t\t\t}\n\t\t}\n\n\t\tprivate boolean hasNext() {\n\t\t\treturn tok != null && tok.hasMoreTokens();\n\t\t}\n\n\t\tpublic String next() {\n\t\t\tgetLine();\n\t\t\treturn tok.nextToken();\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\t\t\n\t\tpublic long nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic void close() {\n\t\t\ttry {\n\t\t\t\tbr.close();\n\t\t\t} catch (IOException e) { /* ignore */\n\t\t\t}\n\t\t}\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "97bab81c2303f82b08ccd2ac626ec056", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "apr_id": "26ef42c34e605665cce739b071f5abff", "difficulty": 1800, "tags": ["divide and conquer", "meet-in-the-middle", "bitmasks"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9478876455811829, "equal_cnt": 33, "replace_cnt": 16, "delete_cnt": 5, "insert_cnt": 11, "fix_ops_cnt": 32, "bug_source_code": "import java.util.*;\nimport java.io.*;\nimport java.math.*;\n \n public class Sample implements Runnable\n { \n static int[] X=new int[2000005];\n static int[] Y=new int[2000005];\n public static int[] a=new int[2000005];\n static int n,m;\n\n public static void solve()\n {\n \n n=i();\n m=i();\n \n for(int i=0;i=1)\n { //out.println(i+\" \"+(j+c)+\" \" );\n ans+=a[j+c];\n } \n }\n \n AA[i]=ans%m;\n }\n \n\n }\n \n public void run()\n { \n solve();\n out.close();\n }\n\n public static void main(String[] args) throws IOException\n { \n new Thread(null, new Sample(), \"whatever\", 1<<26).start();\n }\n static class Pair implements Comparable\n {\n long a;\n int b;\n Pair(){}\n Pair(long a,int b)\n {\n this.a=a;\n this.b=b;\n }\n \n public int compareTo(Pair x)\n {\n return Long.compare(x.a,this.a);\n }\n }\n \n \n \n ////////////////////////////////////////////////////// Merge Sort ////////////////////////////////////////////////////////////////////////\n \n static class Merge \n {\n\n public static void sort(long inputArr[]) \n {\n int length = inputArr.length;\n doMergeSort(inputArr,0, length - 1);\n }\n\n private static void doMergeSort(long[] arr,int lowerIndex, int higherIndex) \n { \n if (lowerIndex < higherIndex) {\n int middle = lowerIndex + (higherIndex - lowerIndex) / 2;\n doMergeSort(arr,lowerIndex, middle);\n doMergeSort(arr,middle + 1, higherIndex);\n mergeParts(arr,lowerIndex, middle, higherIndex);\n }\n }\n\n private static void mergeParts(long[]array,int lowerIndex, int middle, int higherIndex) \n {\n long[] temp=new long[higherIndex-lowerIndex+1];\n for (int i = lowerIndex; i <= higherIndex; i++) \n {\n temp[i-lowerIndex] = array[i];\n }\n int i = lowerIndex;\n int j = middle + 1;\n int k = lowerIndex;\n while (i <= middle && j <= higherIndex) \n {\n if (temp[i-lowerIndex] < temp[j-lowerIndex]) \n {\n array[k] = temp[i-lowerIndex];\n i++;\n } else {\n array[k] = temp[j-lowerIndex];\n j++;\n }\n k++;\n }\n while (i <= middle) \n {\n array[k] = temp[i-lowerIndex];\n k++;\n i++;\n }\n while(j<=higherIndex)\n {\n array[k]=temp[j-lowerIndex];\n k++;\n j++;\n }\n }\n\n }\n \n \n /////////////////////////////////////////////////////////// Methods ////////////////////////////////////////////////////////////////////////\n\n\n static boolean isPal(String s)\n {\n for(int i=0, j=s.length()-1;i<=j;i++,j--)\n {\n if(s.charAt(i)!=s.charAt(j)) return false;\n }\n return true;\n }\n static String rev(String s)\n {\n StringBuilder sb=new StringBuilder(s);\n sb.reverse();\n return sb.toString();\n }\n static int gcd(int a,int b){return (a==0)?b:gcd(b%a,a);}\n static long gcdExtended(long a,long b,long[] x)\n {\n\n if(a==0){\n x[0]=0;\n x[1]=1;\n return b;\n }\n long[] y=new long[2];\n long gcd=gcdExtended(b%a, a, y);\n\n x[0]=y[1]-(b/a)*y[0];\n x[1]=y[0];\n\n return gcd;\n }\n\n boolean findSum(int set[], int n, long sum)\n {\n if (sum == 0)\n return true;\n if (n == 0 && sum != 0)\n return false;\n if (set[n-1] > sum)\n return findSum(set, n-1, sum);\n return findSum(set, n-1, sum) ||findSum(set, n-1, sum-set[n-1]);\n }\n \n public static long modPow(long base, long exp, long mod)\n {\n base = base % mod;\n long result = 1;\n while (exp > 0)\n {\n if (exp % 2 == 1) \n {\n result = (result * base) % mod;\n }\n base = (base * base) % mod;\n exp = exp >> 1;\n }\n return result;\n }\n \n static long[] fac;\n static long[] inv;\n static long mod=(long)1e9+7;\n public static void cal() \n {\n fac = new long[1000005];\n inv = new long[1000005];\n fac[0] = 1;\n inv[0] = 1;\n for (int i = 1; i <= 1000000; i++)\n {\n fac[i] = (fac[i - 1] * i) % mod;\n inv[i] = (inv[i - 1] * modPow(i, mod - 2, mod)) % mod;\n }\n }\n \n public static long ncr(int n, int r) \n {\n return (((fac[n] * inv[r]) % mod) * inv[n - r]) % mod;\n }\n\n \n////////////////////////////////////////// Input Reader ////////////////////////////////////////////////////////////////////////////////////////////////////\n \n static InputReader sc = new InputReader(System.in);\n static PrintWriter out= new PrintWriter(System.out); \n \n static class InputReader {\n\n private final InputStream stream;\n private final byte[] buf = new byte[8192];\n private int curChar, snumChars;\n private SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int snext()\n {\n if (snumChars == -1)\n throw new InputMismatchException();\n if (curChar >= snumChars) {\n curChar = 0;\n try {\n snumChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (snumChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int nextInt()\n {\n int c = snext();\n while (isSpaceChar(c)) \n {\n c = snext();\n }\n int sgn = 1;\n if (c == '-')\n {\n sgn = -1;\n c = snext();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = snext();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long nextLong() \n {\n int c = snext();\n while (isSpaceChar(c)) \n {\n c = snext();\n }\n int sgn = 1;\n if (c == '-') \n {\n sgn = -1;\n c = snext();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = snext();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public int[] nextIntArray(int n)\n {\n int a[] = new int[n];\n for (int i = 0; i < n; i++) \n {\n a[i] = nextInt();\n }\n return a;\n }\n\n public long[] nextLongArray(int n)\n {\n long a[] = new long[n];\n for (int i = 0; i < n; i++) \n {\n a[i] = nextLong();\n }\n return a;\n }\n\n \n public String nextLine()\n {\n int c = snext();\n while (isSpaceChar(c))\n c = snext();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = snext();\n } while (!isEndOfLine(c));\n return res.toString();\n }\n\n public boolean isSpaceChar(int c) \n {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n private boolean isEndOfLine(int c) \n {\n return c == '\\n' || c == '\\r' || c == -1;\n }\n\n public interface SpaceCharFilter \n {\n public boolean isSpaceChar(int ch);\n }\n\n }\n\n static int i()\n {\n return sc.nextInt();\n }\n static long l(){\n return sc.nextLong();\n }\n static int[] iarr(int n)\n {\n return sc.nextIntArray(n);\n }\n static long[] larr(int n)\n {\n return sc.nextLongArray(n);\n }\n static String s(){\n return sc.nextLine();\n }\n \n \n } ", "lang": "Java 8", "bug_code_uid": "fb3a031c6ce1b63dd42d5027f56c43c3", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "apr_id": "6b57188ece31ffbf1583276006341dd1", "difficulty": 1800, "tags": ["divide and conquer", "meet-in-the-middle", "bitmasks"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8496993987975952, "equal_cnt": 28, "replace_cnt": 20, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 27, "bug_source_code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.util.HashSet;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.List;\nimport java.io.BufferedWriter;\nimport java.io.Writer;\nimport java.io.OutputStreamWriter;\nimport java.util.InputMismatchException;\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author Fedor Poschmann (fedor.poschmann@gmail.com)\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n OutputWriter out = new OutputWriter(outputStream);\n TaskE solver = new TaskE();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class TaskE {\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n int n = in.readInt(); // 1 <= 35\n int mod = in.readInt(); //\n int[] ar = new int[n];\n for (int i = 0; i < n; i++) {\n ar[i] = in.readInt() % mod;\n }\n HashSet sums = new HashSet<>();\n for (int i : ar) {\n List list = new ArrayList<>(sums);\n sums.add(i);\n for (Integer integer : list) {\n sums.add((integer + i) % mod);\n }\n }\n int max = 0;\n for (Integer sum : sums) {\n if (sum > max) max = sum;\n }\n out.printLine(max);\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int readInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n\n static class OutputWriter {\n private final PrintWriter writer;\n\n public OutputWriter(OutputStream outputStream) {\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }\n\n public OutputWriter(Writer writer) {\n this.writer = new PrintWriter(writer);\n }\n\n public void close() {\n writer.close();\n }\n\n public void printLine(int i) {\n writer.println(i);\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "d4a36e7e90d753a31d2ba8fb4f058b07", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "apr_id": "89cb42fb72f22fd1a68e5b75ab300592", "difficulty": 1800, "tags": ["divide and conquer", "meet-in-the-middle", "bitmasks"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8302106365646457, "equal_cnt": 10, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 9, "bug_source_code": "import java.math.*;\nimport java.util.*;\nimport java.io.*;\n\npublic class Main{\nclass Node {\n int id;\n long mask;\n public Node(int id,long mask){\n this.id=id;\n this.mask=mask;\n\n }\n @Override\n public boolean equals(Object o){\n Node c=(Node)o;\n return id==c.id && mask==c.mask;\n\n }\n}\n void solve() {\n int n=ni();\n M=nl();\n a=new long[n+1];\n for(int i=1;i<=n;i++) a[i]=nl()%M;\n pow=new long[n+1];\n pow[0]=1;\n for(int i=1;i<=n;i++) pow[i]=(pow[i-1]*2);\n long ans=go(1,0,0,n);\n pw.println(ans);\n }\n long a[];\n long pow[];\n HashMap mp=new HashMap<>();\n long go(int i,long mask,long sm,int n){\n if(i>n){\n return sm;\n }\n if(mp.containsKey(new Node(i,mask))) return mp.get(new Node(i,mask));\n\n long cc=go(i+1,mask,sm,n);\n\n cc=Math.max(cc,go(i+1,mask+pow[i-1],(sm+a[i])%M,n) );\n\n mp.put(new Node(i,mask),cc);\n return cc;\n }\n\n\n long M=(long)1e9+7;\n InputStream is;\n PrintWriter pw;\n String INPUT = \"\";\n void run() throws Exception {\n is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n pw = new PrintWriter(System.out);\n long s = System.currentTimeMillis();\n solve();\n pw.flush();\n if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+\"ms\");\n }\n\n public static void main(String[] args) throws Exception { new Main().run(); }\n\n private byte[] inbuf = new byte[1024];\n public int lenbuf = 0, ptrbuf = 0;\n\n private int readByte() {\n if(lenbuf == -1)throw new InputMismatchException();\n if(ptrbuf >= lenbuf){\n ptrbuf = 0;\n try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }\n if(lenbuf <= 0)return -1;\n }\n return inbuf[ptrbuf++];\n }\n\n private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }\n private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }\n\n private double nd() { return Double.parseDouble(ns()); }\n private char nc() { return (char)skip(); }\n\n private String ns() {\n int b = skip();\n StringBuilder sb = new StringBuilder();\n while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n private char[] ns(int n) {\n char[] buf = new char[n];\n int b = skip(), p = 0;\n while(p < n && !(isSpaceChar(b))){\n buf[p++] = (char)b;\n b = readByte();\n }\n return n == p ? buf : Arrays.copyOf(buf, p);\n }\n\n private char[][] nm(int n, int m) {\n char[][] map = new char[n][];\n for(int i = 0;i < n;i++)map[i] = ns(m);\n return map;\n }\n\n private int[] na(int n) {\n int[] a = new int[n];\n for(int i = 0;i < n;i++)a[i] = ni();\n return a;\n }\n\n private int ni() {\n int num = 0, b;\n boolean minus = false;\n while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));\n if(b == '-'){\n minus = true;\n b = readByte();\n }\n\n while(true){\n if(b >= '0' && b <= '9'){\n num = num * 10 + (b - '0');\n }else{\n return minus ? -num : num;\n }\n b = readByte();\n }\n }\n\n private long nl() {\n long num = 0;\n int b;\n boolean minus = false;\n while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));\n if(b == '-'){\n minus = true;\n b = readByte();\n }\n\n while(true){\n if(b >= '0' && b <= '9'){\n num = num * 10 + (b - '0');\n }else{\n return minus ? -num : num;\n }\n b = readByte();\n }\n }\n\n private void tr(Object... o) { if(INPUT.length() > 0)System.out.println(Arrays.deepToString(o)); }\n}", "lang": "Java 8", "bug_code_uid": "6e7ad11a587a243b7cf25cfd0b72306d", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "apr_id": "ced7cb4aa90f476310e0c5fc6babe2ce", "difficulty": 1800, "tags": ["divide and conquer", "meet-in-the-middle", "bitmasks"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8910398230088495, "equal_cnt": 14, "replace_cnt": 3, "delete_cnt": 3, "insert_cnt": 8, "fix_ops_cnt": 14, "bug_source_code": "import java.util.Scanner;\nimport java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.PrintWriter;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n TaskD solver = new TaskD();\n solver.solve(1, in, out);\n out.close();\n }\n}\n\nclass TaskD {\n\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n String s1 = in.next();\n char[] c1 = s1.toCharArray();\n String s2 = in.next();\n char[] c2 = s2.toCharArray();\n String virus = in.next();\n int[][] next = new int[virus.length() + 1][128];\n int n = c1.length;\n int m = c2.length;\n\n int l = virus.length();\n for (int i = 0; i < l; ++i)\n for (char j = 'A'; j <= 'Z'; ++j) {\n if (j == virus.charAt(i)) next[i][j] = i + 1;\n else {\n String suffix = virus.substring(0, i) + j;\n for (int from = 0; from < suffix.length(); ++from) if(virus.startsWith(suffix.substring(from))) {\n next[i][j] = suffix.length() - from;\n break;\n }\n }\n }\n int[][][] dp = new int[n + 1][m + 1][l + 1];\n for (int i = 0; i < n; ++i)\n for (int j = 0; j < m; ++j)\n for (int k = 0; k < l; ++k) {\n if (c1[i] == c2[j]) {\n int nextState = next[k][c1[i]];\n if (nextState != l)\n dp[i + 1][j + 1][nextState] = Math.max(dp[i][j][k] + 1, dp[i + 1][j + 1][nextState]);\n }\n else\n dp[i + 1][j + 1][k] = Math.max(dp[i][j + 1][k], dp[i + 1][j][k]);\n }\n\n StringBuffer ret = new StringBuffer(\"\");\n// for (int i = n, j = m; i > 0 && j > 0;) {\n// if (c1[i - 1] == c2[j - 1]) {//dp[i][j] == dp[i - 1][j - 1] + 1) {\n// ret.append(c1[i - 1]);\n// --i; --j;\n// } else if (dp[i][j] == dp[i - 1][j]) {\n// --i;\n// } else if (dp[i][j] == dp[i][j - 1]) {\n// --j;\n// }\n// }\n int maxLen = 0;\n for (int i = 0, max = Integer.MIN_VALUE; i < virus.length(); ++i) {\n if (dp[n][m][i] > max) {max = dp[n][m][i]; maxLen = i;}\n }\n for (int i = n, j = m, curState = maxLen; i > 0 && j > 0;) {\n if (c1[i - 1] == c2[j - 1]) {\n boolean find = false;\n for (int k = 0; k < l; ++k) {\n int nextState = next[k][c1[i - 1]];\n if (curState == nextState && dp[i][j][curState] == dp[i - 1][j - 1][k] + 1) {\n find = true;\n ret.append(c1[i - 1]);\n --i; --j; curState = k;\n break;\n }\n }\n if (!find) {--i; --j;}\n } else if (dp[i][j][curState] == dp[i - 1][j][curState]) {\n --i;\n } else if (dp[i][j][curState] == dp[i][j - 1][curState]) {\n --j;\n }\n }\n if (ret.length() == 0) out.println(0);\n else out.println(ret.reverse());\n }\n}\n", "lang": "Java 7", "bug_code_uid": "e0fef36ccbc0ccfce32a34f9acfa9684", "src_uid": "391c2abbe862139733fcb997ba1629b8", "apr_id": "1e7a9e66b7e2e3bd73258a70963c9e88", "difficulty": 2000, "tags": ["dp", "strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9382799325463743, "equal_cnt": 10, "replace_cnt": 3, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 9, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.math.BigInteger;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.StringTokenizer;\n\npublic class SolutionC {\n\n private static BigInteger mod = new BigInteger(String.valueOf(1000000007));\n\n private static BigInteger res = BigInteger.ONE;\n\n public static void main(String[] args) throws IOException {\n Reader reader = new Reader();\n StringTokenizer st = reader.getStringTokenizer();\n long x = reader.getNextLong(st);\n long n = reader.getNextLong(st);\n\n List primes = new ArrayList<>();\n long xCopy = x;\n for (int i = 2; i <= xCopy; ) {\n if (xCopy % i == 0) {\n if (primes.size() == 0 || primes.get(primes.size() - 1) != i) {\n primes.add(i);\n }\n xCopy /= i;\n } else {\n i++;\n }\n }\n\n count(primes, BigInteger.valueOf(n));\n System.out.print(res.mod(mod));\n }\n\n private static void count(List primes, BigInteger n) {\n for (int i = 0; i < primes.size(); i++) {\n int prime = primes.get(i);\n BigInteger primePow = new BigInteger(String.valueOf(prime));\n long counts = 0;\n while (primePow.compareTo(n) <= 0) {\n long c = n.longValue() / primePow.longValue();\n counts += c;\n primePow = primePow.multiply(BigInteger.valueOf(prime));\n }\n BigInteger currValue = BigInteger.valueOf(binpow(prime, counts));\n res = res.multiply(currValue);\n }\n\n }\n\n// private BigInteger raiseToPower(long power, int prime) {\n// long initPrime = prime;\n// long powerRemainder = 0;\n// BigInteger powerRes = BigInteger.valueOf(prime);\n// while (power > 1000000) {\n// powerRes = powerRes.pow(2);\n// powerRemainder += (power % 2);\n// power /= 2;\n// }\n//\n//\n// }\n\n static long binpow(int a, long n) {\n if (n == 0) {\n return 1;\n }\n if (n % 2 == 1) {\n return (binpow(a, n - 1) * a) % 1000000007l;\n } else {\n long b = binpow(a, n / 2) ;\n return (b * b) % 1000000007l;\n }\n }\n\n\n}\n\n\nclass Reader {\n\n BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));\n\n public StringTokenizer getStringTokenizer() throws IOException {\n String line = bufferedReader.readLine().replaceAll(\"\\\\s+$\", \"\");\n return new StringTokenizer(line, \" \");\n }\n\n public int getNextInt(StringTokenizer stringTokenizer) {\n while (stringTokenizer.hasMoreTokens()) {\n return Integer.parseInt(stringTokenizer.nextToken());\n }\n throw new RuntimeException(\"no more tokens in string\");\n }\n\n public long getNextLong(StringTokenizer stringTokenizer) {\n while (stringTokenizer.hasMoreTokens()) {\n return Long.parseLong(stringTokenizer.nextToken());\n }\n throw new RuntimeException(\"no more tokens in string\");\n }\n\n public String getNextString(StringTokenizer stringTokenizer) {\n while (stringTokenizer.hasMoreTokens()) {\n return stringTokenizer.nextToken();\n }\n throw new RuntimeException(\"no more tokens in string\");\n }\n\n\n public String readStringValue() throws IOException {\n return bufferedReader.readLine().replaceAll(\"\\\\s+$\", \"\");\n }\n\n public int readIntValue() throws IOException {\n String line = bufferedReader.readLine().replaceAll(\"\\\\s+$\", \"\");\n int parsedToInt = Integer.parseInt(line);\n return parsedToInt;\n }\n\n public int[] readIntNumbers() throws IOException {\n String[] line = bufferedReader.readLine().replaceAll(\"\\\\s+$\", \"\").split(\" \");\n int[] parsedToInt = Arrays.stream(line).mapToInt(Integer::parseInt).toArray();\n return parsedToInt;\n }\n\n public long readLongValue() throws IOException {\n String line = bufferedReader.readLine().replaceAll(\"\\\\s+$\", \"\");\n long parsedToLong = Long.parseLong(line);\n return parsedToLong;\n }\n\n public long[] readLongNumbers() throws IOException {\n String[] line = bufferedReader.readLine().replaceAll(\"\\\\s+$\", \"\").split(\" \");\n long[] parsedToLong = Arrays.stream(line).mapToLong(Long::parseLong).toArray();\n return parsedToLong;\n }\n\n\n}", "lang": "Java 8", "bug_code_uid": "f0292a8f105936b814cd130aa7ed685d", "src_uid": "04610fbaa746c083dda30e21fa6e1a0c", "apr_id": "a57d906cf5c859b554b28ed039a7d8ff", "difficulty": 1700, "tags": ["math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.41180036370984036, "equal_cnt": 20, "replace_cnt": 15, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 20, "bug_source_code": "import java.io.*;\nimport java.math.BigInteger;\nimport java.nio.IntBuffer;\nimport java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) throws IOException {\n new Main().solve();\n }\n static FastScanner in;\n static PrintWriter out;\n static int h,w;\n static int r[];\n static int c[];\n void read() throws IOException {\n in = new FastScanner(System.in);\n int t = 1;\n while (t-- > 0){\n h = in.nextInt();\n w = in.nextInt();\n r = new int[h];\n c = new int[w];\n for (int i = 0; i < h; i++) {\n r[i] = in.nextInt();\n }\n for (int i = 0; i < w; i++) {\n c[i] = in.nextInt();\n }\n }\n }\n static long mod = 1_000_000_007;\n void solve() throws IOException {\n read();\n int can[][] = new int[h][w];\n for (int i = 0; i < h; i++) {\n for (int j = 0; j < w; j++) {\n can[i][j] = 228;\n }\n }\n for (int i = 0; i < h; i++) {\n for (int j = 0; j < r[i]; j++) {\n can[i][j] = 0;\n }\n if(r[i] != w)can[i][r[i]] = 1337;\n }\n for (int i = 0; i < w; i++) {\n for (int j = 0; j < c[i]; j++) {\n if(can[j][i] == 1337){\n System.out.println(0);\n return;\n }\n can[j][i] = 0;\n }\n if(c[i] != h){\n if(can[c[i]][i] == 1337){\n System.out.println(0);\n return;\n }\n can[c[i]][i] = 1337;\n }\n }\n long cann = 0;\n for (int i = 0; i < h; i++) {\n for (int j = 0; j < w; j++) {\n if(can[i][j] == 228)cann++;\n }\n }\n long cur = 1;\n for (int i = 1; i <= cann; i++) {\n cur<<=1;\n cur%=mod;\n }\n System.out.println(cur == 1 ? 0 : cur);\n }\n\n}\nclass FastScanner {\n BufferedReader br;\n StringTokenizer st = new StringTokenizer(\"\");\n\n FastScanner(InputStream f) throws FileNotFoundException {\n br = new BufferedReader(new InputStreamReader(f));\n }\n\n String next() throws IOException {\n while (!st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return st.nextToken();\n }\n\n int nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n}", "lang": "Java 8", "bug_code_uid": "d33319a8fd4407e49eb9e2e1d8327af0", "src_uid": "04610fbaa746c083dda30e21fa6e1a0c", "apr_id": "1894509ad9165bf3317dfda6ccd43224", "difficulty": 1700, "tags": ["math", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9996328254084818, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*;\nimport java.math.BigInteger;\nimport java.util.*;\npublic class Main {\n public static void main(String[] args) throws Exception {\n new Main().run();}\n\n static int groups = 0;\n static int[] fa;\n static int[] sz;\n\n static void init1(int n) {\n groups = n;\n fa = new int[n];\n for (int i = 1; i < n; ++i) {\n fa[i] = i;\n }\n sz = new int[n];\n Arrays.fill(sz, 1);\n }\n\n static int root(int p) {\n while (p != fa[p]) {\n fa[p] = fa[fa[p]];\n p = fa[p];\n }\n return p;\n }\n\n static void combine(int p, int q) {\n int i = root(p);\n int j = root(q);\n if (i == j) {\n return;\n }\n fa[i] = j;\n if (sz[i] < sz[j]) {\n fa[i] = j;\n sz[j] += sz[i];\n } else {\n fa[j] = i;\n sz[i] += sz[j];\n }\n groups--;\n }\n\n\n public static String roundS(double result, int scale){\n String fmt = String.format(\"%%.%df\", scale);\n return String.format(fmt, result);\n }\n\n int[] unique(int a[]){\n int p = 1;\n for(int i=1;i>> 1;\n if (a[mid] > key) {\n hi = mid;\n }else {\n lo = mid+1;\n }\n }\n return lo;\n }\n\n\n static int h[];\n static int to[];\n static int ne[];\n static int m = 0;\n\n public static void addEdge(int u, int v, int w) {\n to[++m] = v; ne[m] = h[u]; h[u] = m;\n }\n\n\n\n int w[];\n\n int cc = 0;\n\n void add(int u,int v,int ww) {\n to[++cc] = u;\n w[cc] = ww;\n ne[cc] = h[v];\n h[v] = cc;\n\n to[++cc] = v;\n w[cc] = ww;\n ne[cc] = h[u];\n h[u] = cc;\n }\n\n\n// List li = new ArrayList<>();\n//\n// void go(int j){\n// d[j] = l[j] = ++N;\n// int cd = 0;\n// for(int i=h[j];i!=0;i= ne[i]){\n// int v= to[i];\n// if(d[v]==0){\n// fa[v] = j;\n// cd++;\n// go(v);\n// l[j] = Math.min(l[j],l[v]);\n// if(d[j]<=l[v]){\n// cut[j] = true;\n// }\n// if(d[j]0){\n// mk[stk[p-1]] = id;\n// }\n// id++;\n// }\n// }\n// int mk[];\n// int id= 0;\n// int l[];\n// boolean cut[];\n// int p = 0;\n// int d[];int N = 0;\n// int stk[];\n\n\n static class S{\n int l = 0;\n int r = 0 ;\n int miss = 0;\n int cnt = 0;\n int c = 0;\n\n public S(int l,int r) {\n this.l = l;\n this.r = r;\n }\n }\n\n static S a[];\n static int[] o;\n\n static void init11(int[] f){\n o = f;\n int len = o.length;\n a = new S[len*4];\n build1(1,0,len-1);\n }\n\n static void build1(int num,int l,int r){\n S cur = new S(l,r);\n if(l==r){\n cur.c = o[l];\n a[num] = cur;\n return;\n }else{\n int m = (l+r)>>1;\n int le = num<<1;\n int ri = le|1;\n build1(le, l,m);\n build1(ri, m+1,r);\n a[num] = cur;\n pushup(num, le, ri);\n }\n }\n\n static int query1(int num,int l,int r){\n if(a[num].l>=l&&a[num].r<=r){\n return a[num].c;\n }else{\n int m = (a[num].l+a[num].r)>>1;\n int le = num<<1;\n int ri = le|1;\n\n int mi = -1;\n\n if(r>m){\n int res = query1(ri, l,r);\n mi = Math.max(mi,res);\n }\n\n if(l<=m) {\n int res = query1(le, l, r);\n mi = Math.max(mi,res);\n }\n\n return mi;\n }\n }\n\n static void pushup(int num,int le,int ri){\n a[num].c = Math.max(a[le].c,a[ri].c);\n\n }\n\n int root[] = new int[10000];\n\n void dfs(int j){\n\n clr[j] = 1;\n\n for(int i=h[j];i!=0;i=ne[i]){\n int v = to[i];\n dfs(v);\n }\n for(Object go:qr[j]){\n int g = (int) go;\n int id1 = qs[g][0];\n int id2 = qs[g][1];\n int ck;\n if(id1==j){\n ck = id2;\n }else{\n ck = id1;\n }\n\n if(clr[ck]==0){\n continue;\n }else if(clr[ck]==1){\n qs[g][2] = ck;\n }else{\n qs[g][2] = root(ck);\n }\n }\n root[j] = fa[j];\n\n clr[j] = 2;\n }\n\n\n int clr[];\n List[] qr;\n int qs[][];\n\n\n\n\n void solve() {\n// int n = ni();\n// for(int i=0;i1){\n p[f++] = x;\n }\n BigInteger s =BigInteger.ONE;\n BigInteger zz = new BigInteger(\"1000000007\");\n for(int i=0;i mp = new HashMap<>();\n// Map nmp = new HashMap<>();\n//\n// for(int i=0;i= lenbuf) {\n ptrbuf = 0;\n try {lenbuf = is.read(inbuf);} catch (IOException e) {throw new InputMismatchException();}\n if (lenbuf <= 0) return -1;\n }\n return inbuf[ptrbuf++];}\n private boolean isSpaceChar(int c) {return !(c >= 33 && c <= 126);}\n private int skip() {int b;while((b = readByte()) != -1 && isSpaceChar(b));return b;}\n private double nd() {return Double.parseDouble(ns());}\n private char nc() {return (char) skip();}\n private char ncc() {int b;while((b = readByte()) != -1 && !(b >= 32 && b <= 126));return (char)b;}\n private String ns() {int b = skip();StringBuilder sb = new StringBuilder();\n while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')\n sb.appendCodePoint(b);b = readByte(); }\n return sb.toString();}\n private char[] ns(int n) {char[] buf = new char[n];int b = skip(), p = 0;\n while (p < n && !(isSpaceChar(b))) { buf[p++] = (char) b;b = readByte(); }\n return n == p ? buf : Arrays.copyOf(buf, p);}\n private String nline() {int b = skip();StringBuilder sb = new StringBuilder();\n while (!isSpaceChar(b) || b == ' ') { sb.appendCodePoint(b);b = readByte(); }\n return sb.toString();}\n private char[][] nm(int n, int m) {char[][] a = new char[n][];for (int i = 0; i < n; i++) a[i] = ns(m);return a;}\n private int[] na(int n) {int[] a = new int[n];for (int i = 0; i < n; i++) a[i] = ni();return a;}\n private long[] nal(int n) { long[] a = new long[n];for (int i = 0; i < n; i++) a[i] = nl();return a;}\n private int ni() { int num = 0, b; boolean minus = false;\n while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')){};\n if (b == '-') { minus = true; b = readByte(); }\n while (true) {\n if (b >= '0' && b <= '9') num = (num << 3) + (num << 1) + (b - '0');\n else return minus ? -num : num;\n b = readByte();}}\n private long nl() { long num = 0; int b;\n boolean minus = false;\n while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')){};\n if (b == '-') { minus = true; b = readByte(); }\n while (true) {\n if (b >= '0' && b <= '9') num = num * 10 + (b - '0');\n else return minus ? -num : num;\n b = readByte();}}\n void print(Object obj){out.print(obj);}\n void println(Object obj){out.println(obj);}\n void println(){out.println();}\n}", "lang": "Java 8", "bug_code_uid": "a8c70c312fdb6cad7b3b89afbfed631d", "src_uid": "04610fbaa746c083dda30e21fa6e1a0c", "apr_id": "cc0aadd00051a2be44bb050a843773ac", "difficulty": 1700, "tags": ["math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7150837988826816, "equal_cnt": 55, "replace_cnt": 20, "delete_cnt": 31, "insert_cnt": 4, "fix_ops_cnt": 55, "bug_source_code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.io.BufferedWriter;\nimport java.util.InputMismatchException;\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.io.Writer;\nimport java.io.OutputStreamWriter;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author dmytro.prytula prituladima@gmail.com\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n OutputWriter out = new OutputWriter(outputStream);\n CPrimesAndMultiplication solver = new CPrimesAndMultiplication();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class CPrimesAndMultiplication {\n int MODULO = (int) 1e9 + 7;\n\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n\n long x = in.nextLong();\n long n = in.nextLong();\n\n long ans = 1;\n\n List primeFactors = Main.factorize(x);\n for (Main.LongIntPair primeFactor : primeFactors) {\n long pow = 0;\n long p = primeFactor.first;\n long prime = primeFactor.first;\n for (int i = 0; i <= 63; i++) {\n long d = n / p;\n if (d <= 0) break;\n pow += d;\n\n long overflowCheck = p;\n p *= prime;//check for overflow\n if (p / overflowCheck != prime) {\n break;\n }\n }\n\n ans *= Main.power_mod(prime, pow, MODULO);\n ans %= MODULO;\n\n }\n\n\n out.println(ans);\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n private int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public long nextLong() {\n return Long.parseLong(this.nextToken(), 10);\n }\n\n public String nextToken() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n StringBuilder res = new StringBuilder();\n do {\n if (Character.isValidCodePoint(c)) {\n res.appendCodePoint(c);\n }\n c = read();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n\n private boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n private static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n\n static class OutputWriter {\n private final PrintWriter writer;\n\n public OutputWriter(OutputStream outputStream) {\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }\n\n public OutputWriter(Writer writer) {\n this.writer = new PrintWriter(writer);\n }\n\n public void close() {\n writer.close();\n }\n\n public OutputWriter println(long i) {\n writer.println(i);\n return this;\n }\n\n }\n\n static final class Main {\n public static List factorize(long number) {\n List result = new ArrayList<>();\n for (long i = 2; i * i <= number; i++) {\n if (number % i == 0) {\n int power = 0;\n do {\n power++;\n number /= i;\n } while (number % i == 0);\n result.add(Main.LongIntPair.makePair(i, power));\n }\n }\n if (number != 1) {\n result.add(Main.LongIntPair.makePair(number, 1));\n }\n return result;\n }\n\n static long power_mod(long a, long pow, long mod) {\n long res = 1;\n a = a % mod;\n while (pow > 0) {\n if ((pow & 1) == 1)\n res = (res * a) % mod;\n pow = pow >> 1;\n a = (a * a) % mod;\n }\n return res;\n }\n\n public static class LongIntPair implements Comparable {\n public final long first;\n public final int second;\n\n public static Main.LongIntPair makePair(long first, int second) {\n return new Main.LongIntPair(first, second);\n }\n\n public LongIntPair(long first, int second) {\n this.first = first;\n this.second = second;\n }\n\n public boolean equals(Object o) {\n if (this == o) {\n return true;\n }\n if (o == null || getClass() != o.getClass()) {\n return false;\n }\n\n Main.LongIntPair pair = (Main.LongIntPair) o;\n\n return first == pair.first && second == pair.second;\n }\n\n public int hashCode() {\n int result = Long.hashCode(first);\n result = 31 * result + Integer.hashCode(second);\n return result;\n }\n\n public String toString() {\n return \"(\" + first + \",\" + second + \")\";\n }\n\n public int compareTo(Main.LongIntPair o) {\n int value = Long.compare(first, o.first);\n if (value != 0) {\n return value;\n }\n return Integer.compare(second, o.second);\n }\n\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "3153d938cccc84770dce113203712d9a", "src_uid": "04610fbaa746c083dda30e21fa6e1a0c", "apr_id": "d2a212c613ba53cf5e65c253647d1a02", "difficulty": 1700, "tags": ["math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9911717495987159, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.FileReader;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.StringTokenizer;\n\npublic class C {\n\tstatic InputReader in = new InputReader(\"\");\n\n\tpublic static void main(String[] args) {\n\t\tStringBuilder sb = new StringBuilder();\n\n\t\tlong x = in.nextLong(), n = in.nextLong();\n\t\tArrayList primes = new ArrayList<>();\n\t\tfor (long i = 2; x > 1; i++) {\n\t\t\tif (x % i != 0)\n\t\t\t\tcontinue;\n\t\t\tprimes.add(i);\n\t\t\twhile (x % i == 0)\n\t\t\t\tx /= i;\n\t\t}\n\t\tlong ans = 1, MOD = 1_000_000_007;\n\t\tfor (long p : primes) {\n\t\t\tlong val;\n\t\t\tfor (val = 1; val <= n / p; val *= p);\n\t\t\tlong cur = 0, prev = 0;\n\t\t\twhile (val > 1) {\n\t\t\t\tcur = (n / val) - prev;\n\t\t\t\tcur = pow(val % MOD, cur, MOD);\n\t\t\t\tans = (ans * cur) % MOD;\n\t\t\t\tprev = n / val;\n\t\t\t\tval /= p;\n\t\t\t}\n\t\t}\n\t\tsb.append(ans);\n\t\t\n\t\tSystem.out.println(sb.toString().trim());\n\t}\n\n\tstatic long pow(long a, long b, long MOD) {\n\t\tif (b <= 0)\n\t\t\treturn 1;\n\t\tlong res = pow(a, b / 2, MOD);\n\t\tres = (res * res) % MOD;\n\t\tif (b % 2 != 0)\n\t\t\tres = (res * a) % MOD;\n\t\treturn res;\n\t}\n\t\n\t\n\tstatic class InputReader {\n\t\tprivate BufferedReader reader;\n\t\tprivate StringTokenizer tokenizer;\n\n\t\tpublic InputReader(String filename) {\n\t\t\ttry {\n\t\t\t\tif (filename.length() == 0)\n\t\t\t\t\treader = new BufferedReader(new InputStreamReader(System.in));\n\t\t\t\telse\n\t\t\t\t\treader = new BufferedReader(new FileReader(filename));\n\t\t\t} catch (Exception e) {\n\t\t\t}\n\t\t}\n\n\t\tpublic String nextLine() {\n\t\t\ttry {\n\t\t\t\treturn reader.readLine();\n\t\t\t} catch (Exception e) {\n\t\t\t\treturn tokenizer.nextToken();\n\t\t\t}\n\t\t}\n\n\t\tpublic String next() {\n\t\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn tokenizer.nextToken();\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic double nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic int[] nextIntArray(int n) {\n\t\t\tint[] array = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tarray[i] = nextInt();\n\t\t\treturn array;\n\t\t}\n\n\t\tpublic double[] nextDoubleArray(int n) {\n\t\t\tdouble[] array = new double[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tarray[i] = nextDouble();\n\t\t\treturn array;\n\t\t}\n\n\t\tpublic long[] nextLongArray(int n) {\n\t\t\tlong[] array = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tarray[i] = nextLong();\n\t\t\treturn array;\n\t\t}\n\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "c857faeb5fe085819b4d176d95370add", "src_uid": "04610fbaa746c083dda30e21fa6e1a0c", "apr_id": "7ceaa4f29d0cec126fe3226dcfafbe37", "difficulty": 1700, "tags": ["math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.13141683778234087, "equal_cnt": 10, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "import java.util.*;\n\npublic class Soln{\n\tpublic static void main(String[]args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint input = sc.nextInt();\n\t\tlong a = 1;\n\t\tfor(int z=0;z Solution starts here!!\n @SuppressWarnings(\"Main Logic\")\n void solve() {\n long l = il(), r = il();\n int gcd = ii(), lcm = ii();\n int num = lcm / gcd;\n int primes[] = sieveEratosthenes(num + 1);\n long fac[] = new long[20];\n int ans = 0, index = 0;\n for (int p : primes) {\n int a = num;\n long c = gcd;\n while (a % p == 0) {\n a /= p;\n c *= p;\n if(c>r){\n out.println(0);\n return;\n }\n }\n if (c != gcd)\n fac[index++] = c/gcd;\n }\n for (int counter = 0; counter < (1 << index); counter++) {\n long a = 1;\n for (int j = 0; j < index; j++) {\n if ((counter & (1 << j)) > 0) {\n // include c[j]\n a*=fac[j];\n }\n }\n long b = lcm/a;\n a*=gcd;\n b*=gcd;\n if(l<=a && a<=r && l<=b && b<=r)ans++;\n }\n out.println(ans);\n }\n\n public static int[] sieveEratosthenes(int n) {\n /* Code picked up from \"uwi\" submissions */\n if (n <= 32) {\n int[] primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31};\n for (int i = 0; i < primes.length; i++) {\n if (n < primes[i]) {\n return Arrays.copyOf(primes, i);\n }\n }\n return primes;\n }\n int u = n + 32;\n double lu = Math.log(u);\n int[] ret = new int[(int) (u / lu + u / lu / lu * 1.5)];\n ret[0] = 2;\n int pos = 1;\n int[] isnp = new int[(n + 1) / 32 / 2 + 1];\n int sup = (n + 1) / 32 / 2 + 1;\n int[] tprimes = {3, 5, 7, 11, 13, 17, 19, 23, 29, 31};\n for (int tp : tprimes) {\n ret[pos++] = tp;\n int[] ptn = new int[tp];\n for (int i = (tp - 3) / 2; i < tp << 5; i += tp)\n ptn[i >> 5] |= 1 << (i & 31);\n for (int j = 0; j < sup; j += tp) {\n for (int i = 0; i < tp && i + j < sup; i++) {\n isnp[j + i] |= ptn[i];\n }\n }\n }\n int[] magic = {0, 1, 23, 2, 29, 24, 19, 3, 30, 27, 25, 11, 20, 8, 4,\n 13, 31, 22, 28, 18, 26, 10, 7, 12, 21, 17, 9, 6, 16, 5, 15, 14};\n int h = n / 2;\n for (int i = 0; i < sup; i++) {\n for (int j = ~isnp[i]; j != 0; j &= j - 1) {\n int pp = i << 5 | magic[(j & -j) * 0x76be629 >>> 27];\n int p = 2 * pp + 3;\n if (p > n)\n break;\n ret[pos++] = p;\n if ((long) p * p > n)\n continue;\n for (int q = (p * p - 3) / 2; q <= h; q += p)\n isnp[q >> 5] |= 1 << q;\n }\n }\n return Arrays.copyOf(ret, pos);\n }\n\n //------------> Solution ends here!!\n InputStream obj;\n PrintWriter out;\n String check = \"\";\n\n public static void main(String[] args) throws IOException {\n new Thread(null, new Runnable() {\n public void run() {\n try {\n new ProbB().main1();\n } catch (IOException e) {\n e.printStackTrace();\n } catch (StackOverflowError e) {\n System.out.println(\"RTE\");\n }\n }\n }, \"1\", 1 << 26).start();\n }\n\n void main1() throws IOException {\n out = new PrintWriter(System.out);\n obj = check.isEmpty() ? System.in : new ByteArrayInputStream(check.getBytes());\n // obj=check.isEmpty() ? new FileInputStream(\"/home/ankurverma1994/input.txt\") : new ByteArrayInputStream(check.getBytes());\n solve();\n out.flush();\n out.close();\n }\n\n byte inbuffer[] = new byte[1024];\n int lenbuffer = 0, ptrbuffer = 0;\n\n int readByte() {\n if (lenbuffer == -1) throw new InputMismatchException();\n if (ptrbuffer >= lenbuffer) {\n ptrbuffer = 0;\n try {\n lenbuffer = obj.read(inbuffer);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n }\n if (lenbuffer <= 0) return -1;\n return inbuffer[ptrbuffer++];\n }\n\n String is() {\n int b = skip();\n StringBuilder sb = new StringBuilder();\n while (!(isSpaceChar(b))) // when nextLine, (isSpaceChar(b) && b!=' ')\n {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n int ii() {\n int num = 0, b;\n boolean minus = false;\n while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n while (true) {\n if (b >= '0' && b <= '9') {\n num = num * 10 + (b - '0');\n } else {\n return minus ? -num : num;\n }\n b = readByte();\n }\n }\n\n long il() {\n long num = 0;\n int b;\n boolean minus = false;\n while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n while (true) {\n if (b >= '0' && b <= '9') {\n num = num * 10 + (b - '0');\n } else {\n return minus ? -num : num;\n }\n b = readByte();\n }\n }\n\n boolean isSpaceChar(int c) {\n return (!(c >= 33 && c <= 126));\n }\n\n int skip() {\n int b;\n while ((b = readByte()) != -1 && isSpaceChar(b)) ;\n return b;\n }\n\n float nf() {\n return Float.parseFloat(is());\n }\n\n double id() {\n return Double.parseDouble(is());\n }\n\n char ic() {\n return (char) skip();\n }\n\n int[] iia(int n) {\n int a[] = new int[n];\n for (int i = 0; i < n; i++) a[i] = ii();\n return a;\n }\n\n long[] ila(int n) {\n long a[] = new long[n];\n for (int i = 0; i < n; i++) a[i] = il();\n return a;\n }\n\n String[] isa(int n) {\n String a[] = new String[n];\n for (int i = 0; i < n; i++) a[i] = is();\n return a;\n }\n\n double[][] idm(int n, int m) {\n double a[][] = new double[n][m];\n for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) a[i][j] = id();\n return a;\n }\n\n int[][] iim(int n, int m) {\n int a[][] = new int[n][m];\n for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) a[i][j] = ii();\n return a;\n }\n}\n", "lang": "Java 8", "bug_code_uid": "1507801f6ac5ef91eaa5b15bd8925de6", "src_uid": "d37dde5841116352c9b37538631d0b15", "apr_id": "029be34dd5e7c22fd550f9076908aabe", "difficulty": 1600, "tags": ["math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8689407540394973, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "import java.util.*;\n\npublic class EightPointSets {\n\n private static final List X = new ArrayList<>(8);\n private static final List Y = new ArrayList<>(8);\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n for (int i = 0; i < 8; i++) {\n X.add(in.nextInt());\n Y.add(in.nextInt());\n in.nextLine();\n }\n SortedSet setX = new TreeSet<>(X);\n if (setX.size() > 3) {\n System.out.println(\"ugly\");\n return;\n }\n SortedSet setY = new TreeSet<>(Y);\n if (setY.size() > 3) {\n System.out.println(\"ugly\");\n return;\n }\n int firstX = setX.first();\n int secondX = setX.tailSet(firstX + 1).first();\n int thirdX = setX.last();\n int firstY = setY.first();\n int secondY = setY.tailSet(firstY + 1).first();\n int thirdY = setY.last();\n\n if (pointExists(firstX, firstY) && pointExists(firstX, secondY) && pointExists(firstX, thirdY) &&\n pointExists(secondX, firstY) && !pointExists(secondX, secondY) && pointExists(secondX, thirdY) &&\n pointExists(thirdX, firstY) && pointExists(thirdX, secondY) && pointExists(thirdX, thirdY)) {\n System.out.println(\"respectable\");\n } else {\n System.out.println(\"ugly\");\n }\n }\n\n private static boolean pointExists(int x, int y) {\n for (int i = 0; i < 8; i++) {\n if (X.get(i) == x && Y.get(i) == y) {\n return true;\n }\n }\n return false;\n }\n}\n", "lang": "Java 7", "bug_code_uid": "21d206a855bc9f93cb5781bb901f60e4", "src_uid": "f3c96123334534056f26b96f90886807", "apr_id": "c5734c08d7a3b4e476a0f2d1056cb772", "difficulty": 1400, "tags": ["sortings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.79296, "equal_cnt": 12, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "import static java.lang.System.in;\nimport static java.lang.System.out;\n\nimport java.io.*;\nimport java.util.*;\n\npublic class A316 {\n\tstatic final double EPS = 1e-10;\n\tstatic final double INF = 1 << 31;\n\tstatic final double PI = Math.PI;\n\n\tpublic static Scanner sc = new Scanner(in);\n\tStringBuilder sb = new StringBuilder();\n\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\tpublic void run() throws IOException {\n\t\tString input;\n\t\tinput = br.readLine();\n\t\tint ans =1;\n\t\tint[] count = new int [10];\n\n\t\tint zeros=0;\n\t\tfor (int i=0; i=input.charAt(0)) {\n\t\t\tans =9;\n\t\t\tfor (int i=1; i1){\n\t\t\tans*=9;\n\t\t\tzeros--;\n\t\t}\n\t\tsb.append(ans);\n\t\tfor (int i=0; i0){\n\t\t\t\t\tans++;\n\t\t\t\t}\n\t\t\t}else if (input.length()==4){\n//\t\t\t\tHashSet s = new HashSet();\n\t\t\t\tfor (int i=0; i<1000; i++){\n\t\t\t\t\tinput=input.concat(input);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tnew A316().run();\n\t}\n\tpublic static void ln(Object obj) {\n\t\tout.println(obj);\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "0dd209a55491160f4464319fa58e9ac7", "src_uid": "d3c10d1b1a17ad018359e2dab80d2b82", "apr_id": "300833144470a5cda8732fd865921823", "difficulty": 1100, "tags": ["greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7963975554840785, "equal_cnt": 12, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "import static java.lang.System.in;\nimport static java.lang.System.out;\n\nimport java.io.*;\nimport java.util.*;\n\npublic class A316 {\n\tstatic final double EPS = 1e-10;\n\tstatic final double INF = 1 << 31;\n\tstatic final double PI = Math.PI;\n\n\tpublic static Scanner sc = new Scanner(in);\n\tStringBuilder sb = new StringBuilder();\n\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\tpublic void run() throws IOException {\n\t\tString input;\n\t\tinput = br.readLine();\n\t\tint ans =1;\n\t\tint[] count = new int [10];\n\n\t\tint zeros=0;\n\t\tfor (int i=0; i=input.charAt(0)) {\n\t\t\tans =9;\n\t\t\tfor (int i=1; i1){\n\t\t\tans*=9;\n\t\t\tzeros--;\n\t\t}\n\t\tsb.append(ans);\n\t\tfor (int i=0; i0){\n\t\t\t\t\tans++;\n\t\t\t\t}\n\t\t\t}else if (input.length()==4){\n//\t\t\t\tHashSet s = new HashSet();\n\t\t\t\tfor (int i=0; i<1000; i++){\n\t\t\t\t\tinput=input.concat(input);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tnew A316().run();\n\t}\n\tpublic static void ln(Object obj) {\n\t\tout.println(obj);\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "1193bc243a4dca061bb03fb6391f0230", "src_uid": "d3c10d1b1a17ad018359e2dab80d2b82", "apr_id": "300833144470a5cda8732fd865921823", "difficulty": 1100, "tags": ["greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9999653439611852, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\nimport java.lang.*;\nimport java.io.*;\nimport java.awt.Point;\n\n// SHIVAM GUPTA :\n//NSIT\n//decoder_1671\n//BEING PERFECTIONIST IS NOT AN OPTION.\n// STOP NOT TILL IT IS DONE OR U DIE .\n//EITHER MAKE IT OR BREAK IT.\n//NEVER UNDERESTIMATE URSELF.\n// U KNOW THAT IF THIS DAY WILL BE URS THEN NO ONE CAN DEFEAT U HERE................\n// REST ..HAVE FAITH ON DESTINY\n//MIRACLE HAPPENS RARELY .....BUT IT HAPPENS ...\n\n\n// ASCII = 48 + i ;\n\n\n// 2^28 = 268,435,456 > 2* 10^8 \n\n// log 10 base 2 = 3.3219 \n\n// odd:: (x^2+1)/2 , (x^2-1)/2 ; x>=3\n\n// even:: (x^2/4)+1 ,(x^2/4)-1 x >=4 \n\n// FOR ANY ODD NO N : N,N-1,N-2\n//ALL ARE PAIRWISE COPRIME \n//THEIR COMBINED LCM IS PRODUCT OF ALL THESE NOS\n\n// two consecutive odds are always coprime to each other\n\n// two consecutive even have always gcd = 2 ;\n\n\n/* Name of the class has to be \"Main\" only if the class is public. */\n\n\n\npublic class Main\n{\n \n // static int[] arr = new int[100002] ; \n // static int[] dp = new int[100002] ; \n \n static PrintWriter out;\n \n\tstatic class FastReader{\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\t\tpublic FastReader(){\n\t\t\tbr=new BufferedReader(new InputStreamReader(System.in));\n\t\t\tout=new PrintWriter(System.out);\n\t\t}\n\t\tString next(){\n\t\t\twhile(st==null || !st.hasMoreElements()){\n\t\t\t\ttry{\n\t\t\t\t\tst= new StringTokenizer(br.readLine());\n\t\t\t\t}\n\t\t\t\tcatch (IOException e){\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\t\tint nextInt(){\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\t\tlong nextLong(){\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\t\tdouble nextDouble(){\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\t\tString nextLine(){\n\t\t\tString str = \"\";\n\t\t\ttry{\n\t\t\t\tstr=br.readLine();\n\t\t\t}\n\t\t\tcatch(IOException e){\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn str;\n\t\t}\n\t}\n\t\n\n\n////////////////////////////////////////////////////////////////////////////////////\n public static int countDigit(long n) \n { \n return (int)Math.floor(Math.log10(n) + 1); \n } \n\n///////////////////////////////////////////////////////////////////////////////////////// \n \n public static int sumOfDigits(long n)\n {\n \n if( n< 0)return -1 ;\n \n int sum = 0;\n \n while( n > 0)\n {\n sum = sum + (int)( n %10) ;\n \n n /= 10 ;\n }\n \n return sum ; \n \n \n \n }\n \n //////////////////////////////////////////////////////////////////////////////////////////////////\n\npublic static long arraySum(int[] arr , int start , int end)\n{\n long ans = 0 ;\n \n for(int i = start ; i <= end ; i++)ans += arr[i] ;\n \n return ans ;\n}\n\n/////////////////////////////////////////////////////////////////////////////////\n\npublic static int mod(int x)\n{\n if(x <0)return -1*x ;\n else return x ;\n}\npublic static long mod(long x)\n{\n if(x <0)return -1*x ;\n else return x ;\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\npublic static void swapArray(int[] arr , int start , int end)\n{\n while(start < end)\n {\n int temp = arr[start] ;\n arr[start] = arr[end];\n arr[end] = temp;\n start++ ;end-- ;\n }\n}\n\n\n//////////////////////////////////////////////////////////////////////////////////\n\n\npublic static int[][] rotate(int[][] input){\n\nint n =input.length;\nint m = input[0].length ;\nint[][] output = new int [m][n];\n\nfor (int i=0; i> (1L) ;\n } \n \n return count; \n \n } \n/////////////////////////////////////////// //////////////////////////////////////////////// \n\npublic static boolean isPowerOfTwo(long n) \n{ \n if(n==0) \n return false; \n \nif(((n ) & (n-1)) == 0 ) return true ;\nelse return false ;\n\n} \n\n/////////////////////////////////////////////////////////////////////////////////////\n\npublic static int min(int a ,int b , int c, int d)\n{\n int[] arr = new int[4] ;\n arr[0] = a;arr[1] = b ;arr[2] = c;arr[3] = d;Arrays.sort(arr) ;\n \n return arr[0];\n}\n /////////////////////////////////////////////////////////////////////////////\npublic static int max(int a ,int b , int c, int d)\n{\n int[] arr = new int[4] ;\n arr[0] = a;arr[1] = b ;arr[2] = c;arr[3] = d;Arrays.sort(arr) ;\n \n return arr[3];\n}\n \n/////////////////////////////////////////////////////////////////////////////////// \n\npublic static String reverse(String input)\n{\n StringBuilder str = new StringBuilder(\"\") ;\n \n for(int i =input.length()-1 ; i >= 0 ; i-- )\n {\n str.append(input.charAt(i));\n }\n \nreturn str.toString() ;\n}\n///////////////////////////////////////////////////////////////////////////////////////////\n\npublic static boolean sameParity(long a ,long b )\n{\n long x = a% 2L; long y = b%2L ;\n if(x==y)return true ;\n else return false ;\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\npublic static boolean isPossibleTriangle(int a ,int b , int c)\n{\n if( a + b > c && c+b > a && a +c > b)return true ;\n else return false ;\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////\n\npublic static int gcd(int a, int b )\n{\n\nif(b==0)return a ;\n\nelse return gcd(b,a%b) ; \n\n}\n\n\npublic static long gcd(long a, long b )\n{\n\nif(b==0)return a ;\n\nelse return gcd(b,a%b) ; \n\n}\n\n////////////////////////////////////////////////////////////////////////////////////\n\npublic static int lcm(int a, int b ,int c , int d )\n{\n\nint temp = lcm(a,b , c) ;\n\n\n \n int ans = lcm(temp ,d ) ;\n\nreturn ans ;\n\n\n}\n\n///////////////////////////////////////////////////////////////////////////////////////////\n\npublic static int lcm(int a, int b ,int c )\n{\n\nint temp = lcm(a,b) ;\n\nint ans = lcm(temp ,c) ;\n\nreturn ans ;\n\n\n}\n\n////////////////////////////////////////////////////////////////////////////////////////\n \npublic static int lcm(int a , int b )\n{\n\nint gc = gcd(a,b);\n\nreturn (a*b)/gc ;\n}\n\n///////////////////////////////////////////////////////////////////////////////////////////\nstatic boolean isPrime(long n)\n{\n if(n==1)\n {\n return false ;\n }\n \n boolean ans = true ;\n \n for(long i = 2L; i*i <= n ;i++)\n {\n if(n% i ==0)\n {\n ans = false ;break ;\n }\n }\n \n \n return ans ;\n} \n///////////////////////////////////////////////////////////////////////////\n\nstatic int sieve = 1000000 ;\n\n \nstatic boolean[] prime = new boolean[sieve + 1] ;\n\npublic static void sieveOfEratosthenes() \n { \n // FALSE == prime\n \n // TRUE == COMPOSITE\n \n // FALSE== 1\n \n \n // time complexity = 0(NlogLogN)== o(N)\n \n // gives prime nos bw 1 to N\n \n for(int i = 4; i<= sieve ; i++)\n {\n prime[i] = true ;\n i++ ;\n }\n \n for(int p = 3; p*p <= sieve; p++) \n { \n \n if(prime[p] == false) \n { \n \n for(int i = p*p; i <= sieve; i += p) \n prime[i] = true; \n } \n \n p++ ;\n } \n \n \n \n \n } \n \n///////////////////////////////////////////////////////////////////////////////////\n\n\npublic static void sortD(int[] arr , int s , int e)\n{\n sort(arr ,s , e) ;\n \n int i =s ; int j = e ;\n \n while( i < j)\n {\n int temp = arr[i] ;\n arr[i] =arr[j] ;\n arr[j] = temp ;\n i++ ; j-- ;\n }\n \n \n \n return ;\n}\n\n\n/////////////////////////////////////////////////////////////////////////////////////////\n\npublic static long countSubarraysSumToK(long[] arr ,long sum )\n {\n HashMap map = new HashMap<>() ;\n \n int n = arr.length ;\n \n long prefixsum = 0 ;\n \n long count = 0L ;\n for(int i = 0; i < n ; i++)\n {\n prefixsum = prefixsum + arr[i] ;\n \n if(sum == prefixsum)count = count+1 ;\n \n if(map.containsKey(prefixsum -sum))\n {\n count = count + map.get(prefixsum -sum) ;\n }\n \n \n if(map.containsKey(prefixsum ))\n {\n map.put(prefixsum , map.get(prefixsum) +1 );\n }\n \n else{\n map.put(prefixsum , 1L );\n }\n \n \n }\n \n \n \n return count ; \n \n }\n\n///////////////////////////////////////////////////////////////////////////////////////////////\n\n\n// KMP ALGORITHM : TIME COMPL:O(N+M) \n// FINDS THE OCCURENCES OF PATTERN AS A SUBSTRING IN STRING\n//RETURN THE ARRAYLIST OF INDEXES \n// IF SIZE OF LIST IS ZERO MEANS PATTERN IS NOT PRESENT IN STRING\n\n\npublic static ArrayList kmpAlgorithm(String str , String pat)\n {\n ArrayList list =new ArrayList<>();\n \n int n = str.length() ;\n int m = pat.length() ;\n \n String q = pat + \"#\" + str ;\n \n int[] lps =new int[n+m+1] ;\n \n longestPefixSuffix(lps, q,(n+m+1)) ;\n \n \n for(int i =m+1 ; i < (n+m+1) ; i++ )\n {\n if(lps[i] == m)\n {\n list.add(i-2*m) ;\n }\n }\n \n return list ; \n \n \n }\n \n\npublic static void longestPefixSuffix(int[] lps ,String str , int n)\n {\n lps[0] = 0 ;\n \n for(int i = 1 ; i<= n-1; i++)\n {\n int l = lps[i-1] ;\n \n while( l > 0 && str.charAt(i) != str.charAt(l))\n {\n l = lps[l-1] ;\n }\n \n if(str.charAt(i) == str.charAt(l))\n {\n l++ ;\n }\n \n \n lps[i] = l ; \n }\n \n }\n \n \n\n///////////////////////////////////////////////////////////////////////////////////////////////////\n///////////////////////////////////////////////////////////////////////////////////////////////////\n\n // CALCULATE TOTIENT Fn FOR ALL VALUES FROM 1 TO n\n // TOTIENT(N) = count of nos less than n and grater than 1 whose gcd with n is 1 \n // or n and the no will be coprime in nature\n //time : O(n*(log(logn)))\n \n public static void eulerTotientFunction(int[] arr ,int n )\n {\n \n for(int i = 1; i <= n ;i++)arr[i] =i ;\n \n \n for(int i= 2 ; i<= n ;i++)\n {\n if(arr[i] == i)\n {\n arr[i] =i-1 ;\n \n for(int j =2*i ; j<= n ; j+= i )\n {\n arr[j] = (arr[j]*(i-1))/i ;\n }\n \n }\n }\n \n return ; \n \n }\n\t\n/////////////////////////////////////////////////////////////////////////////////////////////\npublic static long nCr(int n,int k)\n{\n long ans=1;\n k=k>n-k?n-k:k;\n int j=1;\n for(;j<=k;j++,n--)\n {\n if(n%j==0)\n {\n ans*=n/j;\n }else\n if(ans%j==0)\n {\n ans=ans/j*n;\n }else\n {\n ans=(ans*n)/j;\n }\n }\n return ans;\n}\n\n///////////////////////////////////////////////////////////////////////////////////////////\n\npublic static ArrayList allFactors(int n)\n{ \n ArrayList list = new ArrayList<>() ;\n \n for(int i = 1; i*i <= n ;i++)\n {\n if( n % i == 0)\n {\n if(i*i == n)\n {\n list.add(i) ;\n }\n else{\n list.add(i) ;\n list.add(n/i) ;\n \n }\n }\n }\n \n return list ; \n \n \n}\n\n\npublic static ArrayList allFactors(long n)\n{ \n ArrayList list = new ArrayList<>() ;\n \n for(long i = 1L; i*i <= n ;i++)\n {\n if( n % i == 0)\n {\n if(i*i == n)\n {\n list.add(i) ;\n }\n else{\n list.add(i) ;\n list.add(n/i) ;\n \n }\n }\n }\n \n return list ; \n \n \n}\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n static final int MAXN = 10000001; \n \n \n static int spf[] = new int[MAXN]; \n \n static void sieve() \n { \n spf[1] = 1; \n for (int i=2; i getFactorization(int x) \n { \n Vector ret = new Vector<>(); \n while (x != 1) \n { \n ret.add(spf[x]); \n x = x / spf[x]; \n } \n return ret; \n } \n \n //////////////////////////////////////////////////////////////////////////////////////////////////\n //////////////////////////////////////////////////////////////////////////////////////////////////\n \npublic static void merge(int arr[], int l, int m, int r)\n {\n // Find sizes of two subarrays to be merged\n int n1 = m - l + 1;\n int n2 = r - m;\n \n /* Create temp arrays */\n int L[] = new int[n1];\n int R[] = new int[n2];\n \n /*Copy data to temp arrays*/\n for (int i=0; i= weight[i]; j--) \n dp[j] = Math.max(dp[j] , value[i] + dp[j - weight[i]]); \n \n /*above line finds out maximum of dp[j](excluding ith element value) \n and val[i] + dp[j-wt[i]] (including ith element value and the \n profit with \"KnapSack capacity - ith element weight\") */\n return dp[maxWeight]; \n\t}\n\n///////////////////////////////////////////////////////////////////////////////////////////\n//////////////////////////////////////////////////////////////////////////////////////////\n\n\n// to return max sum of any subarray in given array\npublic static long kadanesAlgorithm(long[] arr)\n{\n long[] dp = new long[arr.length] ;\n \n dp[0] = arr[0] ;\n long max = dp[0] ;\n \n \n for(int i = 1; i < arr.length ; i++)\n {\n if(dp[i-1] > 0)\n {\n dp[i] = dp[i-1] + arr[i] ;\n }\n else{\n dp[i] = arr[i] ;\n }\n \n if(dp[i] > max)max = dp[i] ;\n \n }\n \n return max ;\n \n}\n/////////////////////////////////////////////////////////////////////////////////////////////\npublic static long kadanesAlgorithm(int[] arr)\n{\n long[] dp = new long[arr.length] ;\n \n dp[0] = arr[0] ;\n long max = dp[0] ;\n \n \n for(int i = 1; i < arr.length ; i++)\n {\n if(dp[i-1] > 0)\n {\n dp[i] = dp[i-1] + arr[i] ;\n }\n else{\n dp[i] = arr[i] ;\n }\n \n if(dp[i] > max)max = dp[i] ;\n \n }\n \n return max ;\n \n}\n\n \n///////////////////////////////////////////////////////////////////////////////////////\n\n// Arrays.sort(arr, new Comparator() {\n// \t\t\t@Override\n// \t\t\tpublic int compare(Pair first, Pa second) {\n// \t\t\t\tif (first.getAge() != second.getAge()) {\n// \t\t\t\t\treturn first.getAge() - second.getAge();\n// \t\t\t\t}\n// \t\t\t\treturn first.getName().compareTo(second.getName());\n// \t\t\t}\n// \t\t});\n\n/////////////////////////////////////////////////////////////////////////////////////////\n\npublic static long binarySerachGreater(int[] arr , int start , int end , int val)\n{\n \n // fing total no of elements strictly grater than val in sorted array arr \n \n \n if(start > end)return 0 ; //Base case\n \n \n int mid = (start + end)/2 ;\n \n if(arr[mid] <=val)\n {\n return binarySerachGreater(arr,mid+1, end ,val) ; \n \n }\n else{\n \n return binarySerachGreater(arr,start , mid -1,val) + end-mid+1 ; \n \n }\n \n \n}\n\n//////////////////////////////////////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////////////\n\n//TO GENERATE ALL(DUPLICATE ALSO EXIST) PERMUTATIONS OF A STRING\n\n\n// JUST CALL generatePermutation( str, start, end) start :inclusive ,end : exclusive \n\n//Function for swapping the characters at position I with character at position j \n public static String swapString(String a, int i, int j) { \n char[] b =a.toCharArray(); \n char ch; \n ch = b[i]; \n b[i] = b[j]; \n b[j] = ch; \n return String.valueOf(b); \n } \n \n//Function for generating different permutations of the string \n public static void generatePermutation(String str, int start, int end) \n { \n //Prints the permutations \n if (start == end-1) \n System.out.println(str); \n else \n { \n for (int i = start; i < end; i++) \n { \n //Swapping the string by fixing a character \n str = swapString(str,start,i); \n //Recursively calling function generatePermutation() for rest of the characters \n generatePermutation(str,start+1,end); \n //Backtracking and swapping the characters again. \n str = swapString(str,start,i); \n } \n } \n } \n\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////////////////////////////////////////////////////////////////////////////////////////\n\npublic static long factMod(long n, long mod) {\n if (n <= 1) return 1;\n long ans = 1;\n for (int i = 1; i <= n; i++) {\n ans = (ans * i) % mod;\n }\n return ans;\n }\n\n\n/////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////////////////////////////////////////////////////////////////////////////////////\n\npublic static long power(int x ,int n)\n {\n //time comp : o(logn) \n \n if(n==0)return 1 ;\n if(n==1)return x;\n \n long ans =1L ;\n \n while(n>0)\n {\n if(n % 2 ==1)\n {\n ans = ans *x ;\n }\n \n n /= 2 ;\n \n x = x*x ;\n \n }\n \n return ans ;\n }\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\npublic static long powerMod(long x, long n, long mod) {\n //time comp : o(logn)\n \n if(n==0)return 1L ;\n if(n==1)return x;\n \n \n long ans = 1;\n while (n > 0) {\n if (n % 2 == 1) ans = (ans * x) % mod;\n x = (x * x) % mod;\n n /= 2;\n }\n return ans;\n }\n \n//////////////////////////////////////////////////////////////////////////////////\n\n/////////////////////////////////////////////////////////////////////////////////\n\n/*\nlowerBound - finds largest element equal or less than value paased\nupperBound - finds smallest element equal or more than value passed\n\nif not present return -1;\n\n*/\n\npublic static long lowerBound(long[] arr,long k)\n\t{\n\t\tlong ans=-1;\n\t\t\n\t\tint start=0;\n\t\tint end=arr.length-1;\n\t\t\n\t\twhile(start<=end)\n\t\t{\n\t\t\tint mid=(start+end)/2;\n\t\t\t\n\t\t\tif(arr[mid]<=k)\n\t\t\t{\n\t\t\t\tans=arr[mid];\n\t\t\t\tstart=mid+1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tend=mid-1;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\treturn ans;\n\t\t\n\t}\n\t\n\tpublic static int lowerBound(int[] arr,int k)\n\t{\n\t\tint ans=-1;\n\t\t\n\t\tint start=0;\n\t\tint end=arr.length-1;\n\t\t\n\t\twhile(start<=end)\n\t\t{\n\t\t\tint mid=(start+end)/2;\n\t\t\t\n\t\t\tif(arr[mid]<=k)\n\t\t\t{\n\t\t\t\tans=arr[mid];\n\t\t\t\tstart=mid+1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tend=mid-1;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\treturn ans;\n\t\t\n\t}\n\t\n\t\n\tpublic static long upperBound(long[] arr,long k)\n\t{\n\t\tlong ans=-1;\n\t\t\n\t\tint start=0;\n\t\tint end=arr.length-1;\n\t\t\n\t\twhile(start<=end)\n\t\t{\n\t\t\tint mid=(start+end)/2;\n\t\t\t\n\t\t\tif(arr[mid]>=k)\n\t\t\t{\n\t\t\t\tans=arr[mid];\n\t\t\t\tend=mid-1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tstart=mid+1;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\treturn ans;\n\t}\n\t\n\t\n\tpublic static int upperBound(int[] arr,int k)\n\t{\n\t\tint ans=-1;\n\t\t\n\t\tint start=0;\n\t\tint end=arr.length-1;\n\t\t\n\t\twhile(start<=end)\n\t\t{\n\t\t\tint mid=(start+end)/2;\n\t\t\t\n\t\t\tif(arr[mid]>=k)\n\t\t\t{\n\t\t\t\tans=arr[mid];\n\t\t\t\tend=mid-1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tstart=mid+1;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\treturn ans;\n\t}\n\t\n\n//////////////////////////////////////////////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////////////////////\n\nstatic ArrayList[] tree ;\nstatic long[] child;\nstatic int mod= 1000000007 ;\n\n//program to calculate noof nodes in subtree for every vertex including itself \n\n// static void dfs(int sv)\n// {\n// child[sv] = 1L; \n \n \n// for(Integer x : tree[sv])\n// {\n// if(child[x] == 0)\n// {\n \n// dfs(x) ;\n \n// child[sv] += child[x] ;\n// }\n// }\n// }\n\n\n/////////////////////////////////////////////////////////////////////////////////////////////////\n/////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////////////////////////////////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////////////////////\n\npublic static void solve()\n{\nFastReader scn = new FastReader() ;\n\n//int[] store = {2 ,3, 5 , 7 ,11 , 13 , 17 , 19 , 23 , 29 , 31 , 37 } ;\n\n// product of first 11 prime nos is gre ater than 10 ^ 12;\n\nArrayList list = new ArrayList<>() ;\nArrayList listl = new ArrayList<>() ;\n//ArrayList lista = new ArrayList<>() ;\n//ArrayList listb = new ArrayList<>() ;\n//ArrayList lists = new ArrayList<>() ;\n\nHashMap map = new HashMap<>() ;\n//HashMap map = new HashMap<>() ;\nHashMap map1 = new HashMap<>() ;\nHashMap map2 = new HashMap<>() ;\n//HashMap maps = new HashMap<>() ;\n//HashMap mapb = new HashMap<>() ;\n//HashMap point = new HashMap<>() ; \n\n Set set = new HashSet<>() ;\n Set setx = new HashSet<>() ;\n Set sety = new HashSet<>() ;\n\nStringBuilder sb =new StringBuilder(\"\") ;\n\n//Collections.sort(list);\n\n//if(map.containsKey(arr[i]))map.put(arr[i] , map.get(arr[i]) +1 ) ;\n//else map.put(arr[i],1) ;\n\n// if(map.containsKey(temp))map.put(temp , map.get(temp) +1 ) ;\n// else map.put(temp,1) ;\n\n//int bit =Integer.bitCount(n);\n// gives total no of set bits in n;\n\nint t = 1; \n\n t = scn.nextInt() ;\n\nwhile(t-- > 0)\n{\n \n// tree = new ArrayList[n] ;\n\n// child = new long[n] ;\n\n// for(int i = 0; i< n; i++)\n// {\n// tree[i] = new ArrayList();\n// }\n\n\n int a = scn.nextInt() ;int b = scn.nextInt() ;int c = scn.nextInt() ;\n\n\nif((a+b+c) % 2 != 0)\n{\n out.println(\"Impossible\");\n}\n\n else{\n \n int x = (a+b+c)/2 -c ;\n int y = (a+b+c)/2 -a ;\n int z = (a+b+c)/2 -b ;\n \n int pos = 0 ; \n \n \n if(x > 0)pos++ ;\n \n if(y > 0)pos++ ;\n \n if(z > 0)pos++ ;\n \n \n \n \n if(pos >= 2 && (x >= 0 && y >= 0 && z>= 0))\n {\n out.println(x+\" \" + y +\" \" +z) ; \n }\n \n \n else{\n out.println(\"Impossible\") ;\n }\n \n \n }\n \n \n \n \n//out.println(ans) ;\n\n//out.println() ;\n\n//for(int i = 0; i < n; i++)out.print(arr[i]+ \" \") ;\n\n// for(int i = 0; i < arr.length ; i++)\n// {\n// for(int j = 0; j < arr[0].length ; j ++)\n// {\n// out.print(arr[i][j] +\" \");\n// }\n// out.println() ;\n// }\n\n\n\nsb.delete(0 , sb.length()) ;\nlist.clear() ;\nmap.clear() ;\nmap1.clear() ;\nmap2.clear() ;\nset.clear() ;\n\n} // test case end loop\n\n\nout.flush() ; \n} // solve fn ends\n\n\npublic static void main (String[] args) throws java.lang.Exception\n{\n \n\nsolve() ;\n \n}\n\n\n}\n \n class Pair \n{\n int first ;\n \n int second ;\n \n@Override\n\tpublic String toString() {\n\t\n\tString ans = \"\" ;\n\tans += this.first ;\n\tans += \" \";\n\tans += this.second ;\n\t\n\treturn ans ;\n\t}\n\n\n\n}\n\n\n\n ", "lang": "Java 11", "bug_code_uid": "098e4bbfe3f92961caacd43866a7153a", "src_uid": "b3b986fddc3770fed64b878fa42ab1bc", "apr_id": "76c6a847122054e802b10a0a37f39e02", "difficulty": 1200, "tags": ["graphs", "math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.36736958934517205, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "import java.util.Scanner;\n\n/**\n *\n * @author Solo\n */\npublic class Burleys {\n private static int get9numb(long f){\n int num=0;\n while(f%10==0){\n num++;\n f/=10;\n }\n //System.out.println(num);\n return num;\n }\n \n \n public static void main(String[] args) {\n long startPrice,maxDev,finalVal,max9=0,tec9;\n Scanner sc = new Scanner(System.in);\n startPrice=sc.nextLong();\n maxDev=sc.nextLong();\n int a=1;\n finalVal=startPrice;\n for(long i=(startPrice-maxDev);i=max9){\n max9=tec9;\n finalVal=i;\n }\n }\n }\n System.out.println(finalVal);\n }\n}\n", "lang": "Java 7", "bug_code_uid": "a7fcd0b164614ace83b7944939c27ffe", "src_uid": "c706cfcd4c37fbc1b1631aeeb2c02b6a", "apr_id": "44236dcebd4be7d53259723c2d14c00d", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.47992616520535303, "equal_cnt": 16, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 15, "bug_source_code": "import java.io.*;\nimport java.util.StringTokenizer;\n\npublic class SpecialOfferSuperPrice999Bourles {\n \n public static void main(String[] args) throws Exception {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n \n StringTokenizer st = new StringTokenizer(br.readLine());\n long num = Long.parseLong(st.nextToken());\n long des = Long.parseLong(st.nextToken()); \n \n long max9 = 0;\n long result = 0;\n for (long i = num; i >= num-des; i--) {\n long count = 0;\n long n = i;\n while(n%10==9){\n count++;\n n/=10;\n }\n if(max9 < count){\n max9 = count;\n result = i;\n }\n }\n if(result!=0)\n while(result%10==0)\n result/=10;\n System.out.println(result==0?num:result);\n }\n}", "lang": "Java 7", "bug_code_uid": "95919ed9c4d99daedf238cfe82c0fa38", "src_uid": "c706cfcd4c37fbc1b1631aeeb2c02b6a", "apr_id": "870d0805428cc7c2092ca4d75cac39d6", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8580441640378549, "equal_cnt": 8, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 7, "bug_source_code": "import java.io.*;\nimport java.lang.Math;\nimport java.util.*;\n\npublic class Main\n{\t\n\tpublic BufferedReader in;\n\tpublic PrintStream out;\n\t\n\tpublic boolean log_enabled = false;\n\t\n\tint n;\n\tint[] adj_count;\n\tint[][] adj_list;\n\t\n\tlong[] X, Y, Z;\n\tboolean[] V;\n\t\n\tlong M = 998244353;\n\t\n\tpublic long modInverse(long a, long n) {\n\t long i = n, v = 0, d = 1;\n\t while (a>0) {\n\t long t = i/a, x = a;\n\t a = i % x;\n\t i = x;\n\t x = d;\n\t d = v - t*x;\n\t v = x;\n\t }\n\t v %= n;\n\t if (v<0) v = (v+n)%n;\n\t return v;\n\t}\n\t\n\tpublic void test()\n\t{\n\t\tn = readInt();\n\t\tint[] pars = readIntArray(2*n-2);\n\t\t\n\t\tint i,j;\n\t\t\n\t\tadj_count = new int[n];\t\t\n\t\tadj_list = new int[n][];\n\t\t\n\t\tArrays.fill(adj_count, 0);\n\t\tfor (i=0; i'a';c--){\n for(int i=0;i s = new Stack();\n int cur = 1;// what should be poped\n int err = 0;\n int res = 0;\n int max = 0;\n for (int i = 0; i < 2 * n; i++) {\n String c = in.nextString();\n if (c.startsWith(\"add\")) {\n if (err == 1) {\n err = 0;\n res++;\n s.clear();\n cur = max + 1;\n }\n int q = in.nextInt();\n s.push(q);\n } else {\n int t = s.peek();\n if (t == cur && err == 0) {\n s.pop();\n cur++;\n } else if (err == 1) {\n err = 1;\n } else {\n err = 1;\n if (t > max) {\n max = t;\n }\n }\n }\n }\n if (err == 1)\n res++;\n out.println(res);\n }\n\n }\n\n static class FastInput {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private FastInput.SpaceCharFilter filter;\n\n public FastInput(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public String nextString() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n StringBuilder res = new StringBuilder();\n do {\n if (Character.isValidCodePoint(c)) {\n res.appendCodePoint(c);\n }\n c = read();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n\n static class FastOutput {\n private final PrintWriter writer;\n\n public FastOutput(OutputStream outputStream) {\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }\n\n public FastOutput(Writer writer) {\n this.writer = new PrintWriter(writer);\n }\n\n public void close() {\n writer.close();\n }\n\n public void println(int i) {\n writer.println(i);\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "5be82f508c301725c85694bc6801179b", "src_uid": "9300f1c07dd36e0cf7e6cb7911df4cf2", "apr_id": "435bb7ffe3cefd5044d457d3c2a26207", "difficulty": 1300, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9638157894736842, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Scanner;\n\n\npublic class AA {\n\n\t/**\n\t * @param args\n\t */\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner sc= new Scanner(System.in);\n\t\tint a = sc.nextInt();\n\t\tint b= sc.nextInt();\n\t\tint c= sc.nextInt();\n\t\tSystem.out.println(2*(a+b+c));\n\t}\n\n}\n", "lang": "Java 6", "bug_code_uid": "b5971ef39a3ec196f2063b1726cd33e2", "src_uid": "8ab25ed4955d978fe20f6872cb94b0da", "apr_id": "315680d6611e0df02b4baaa7e64168e8", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9840488715425081, "equal_cnt": 7, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "\nimport java.io.BufferedReader;\nimport java.io.FileNotFoundException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\n\npublic class A {\n\n public static void main(String[] args) throws FileNotFoundException {\n Scanner in = new Scanner();\n PrintWriter out = new PrintWriter(System.out);\n // PrintWriter out = new PrintWriter(new FileOutputStream(new File(\"output.txt\")));\n int a = in.nextInt();\n int b = in.nextInt();\n int c = in.nextInt();\n int result = 0;\n while(a > 0 && b > 0 && c > 0){\n result += 2*(a + b + c);\n result -=6;\n a--;\n b--;\n c--;\n }\n out.println(result);\n out.close();\n }\n\n static class Dragon implements Comparable {\n\n int x, y;\n\n public Dragon(int x, int y) {\n this.x = x;\n this.y = y;\n }\n\n @Override\n public int compareTo(Dragon o) {\n if (x != o.x) {\n return x - o.x;\n } else {\n return o.y - y;\n }\n }\n }\n\n static double dist(Point a, Point b) {\n long total = (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);\n return Math.sqrt(total);\n }\n\n static class Point {\n\n int x, y;\n\n public Point(int x, int y) {\n this.x = x;\n this.y = y;\n\n }\n }\n\n public static boolean nextPer(int[] data) {\n int i = data.length - 1;\n while (i > 0 && data[i] < data[i - 1]) {\n i--;\n }\n if (i == 0) {\n return false;\n }\n int j = data.length - 1;\n while (data[j] < data[i - 1]) {\n j--;\n }\n int temp = data[i - 1];\n data[i - 1] = data[j];\n data[j] = temp;\n Arrays.sort(data, i, data.length);\n return true;\n }\n\n static class FT {\n\n int[] data;\n\n FT(int n) {\n data = new int[n];\n }\n\n void update(int index, int val) {\n // System.out.println(\"UPDATE INDEX \" + index);\n while (index < data.length) {\n data[index] += val;\n index += index & (-index);\n\n // System.out.println(\"NEXT \" +index);\n }\n }\n\n int get(int index) {\n // System.out.println(\"GET INDEX \" + index);\n int result = 0;\n while (index > 0) {\n result += data[index];\n index -= index & (-index);\n // System.out.println(\"BACK \" + index);\n }\n return result;\n }\n }\n\n static int gcd(int a, int b) {\n if (b == 0) {\n return a;\n } else {\n return gcd(b, a % b);\n }\n }\n\n static int pow(int a, int b) {\n if (b == 0) {\n return 1;\n }\n if (b == 1) {\n return a;\n }\n int val = pow(a, b / 2);\n if (b % 2 == 0) {\n\n return val * val;\n } else {\n return val * val * a;\n }\n }\n\n// static Point intersect(Point a, Point b, Point c) {\n// double D = cross(a, b);\n// if (D != 0) {\n// return new Point(cross(c, b) / D, cross(a, c) / D);\n// }\n// return null;\n// }\n//\n// static Point convert(Point a, double angle) {\n// double x = a.x * cos(angle) - a.y * sin(angle);\n// double y = a.x * sin(angle) + a.y * cos(angle);\n// return new Point(x, y);\n// }\n// static Point minus(Point a, Point b) {\n// return new Point(a.x - b.x, a.y - b.y);\n// }\n//\n// static Point add(Point a, Point b) {\n// return new Point(a.x + b.x, a.y + b.y);\n// }\n//\n// static double cross(Point a, Point b) {\n// return a.x * b.y - a.y * b.x;\n//\n//\n// }\n//\n// static class Point {\n//\n// int x, y;\n//\n// Point(int x, int y) {\n// this.x = x;\n// this.y = y;\n// }\n//\n// @Override\n// public String toString() {\n// return \"Point: \" + x + \" \" + y;\n// }\n// }\n static class Scanner {\n\n BufferedReader br;\n StringTokenizer st;\n\n public Scanner() throws FileNotFoundException {\n //System.setOut(new PrintStream(new BufferedOutputStream(System.out), true));\n br = new BufferedReader(new InputStreamReader(System.in));\n // br = new BufferedReader(new FileReader(new File(\"input.txt\")));\n }\n\n public String next() {\n\n\n while (st == null || !st.hasMoreTokens()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (Exception e) {\n throw new RuntimeException();\n }\n }\n return st.nextToken();\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public String nextLine() {\n st = null;\n try {\n return br.readLine();\n } catch (Exception e) {\n throw new RuntimeException();\n }\n }\n\n public boolean endLine() {\n try {\n String next = br.readLine();\n while (next != null && next.trim().isEmpty()) {\n next = br.readLine();\n }\n if (next == null) {\n return true;\n }\n st = new StringTokenizer(next);\n return st.hasMoreTokens();\n } catch (Exception e) {\n throw new RuntimeException();\n }\n }\n }\n}\n", "lang": "Java 6", "bug_code_uid": "c21bbb297da0804bdd80333a8df63a03", "src_uid": "8ab25ed4955d978fe20f6872cb94b0da", "apr_id": "fd4ac87245bb5afbd0c9b92e6c9ce1ab", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9996216420734014, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\nimport java.io.IOException;\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author toshif\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n MyReader in = new MyReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n TaskA solver = new TaskA();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class TaskA {\n private int n;\n private int c1;\n private int c2;\n\n public void solve(int testNumber, MyReader in, PrintWriter out) {\n n = in.nextInt();\n c1 = in.nextInt();\n c2 = in.nextInt();\n\n String s = in.next();\n int parent = 0;\n for (int i = 0; i < s.length(); i++) {\n if (s.charAt(i) == '1') {\n parent++;\n }\n }\n\n // ternary search\n long lo = 1, hi = parent;\n while (hi - lo > 1) {\n long mid = (lo + hi) / 2;\n if (f(mid) > f(mid + 1)) {\n hi = mid;\n } else {\n lo = mid;\n }\n }\n if (f(lo) < f(hi)) {\n out.println(f(lo));\n } else {\n out.println(f(hi));\n }\n\n }\n\n long f(long v) {\n long p1 = n / v;\n\n long sum = c1 * v;\n sum += (n % v) * c2 * (p1) * (p1);\n sum += (v - (n % v)) * c2 * (p1 - 1) * (p1 - 1);\n\n return sum;\n }\n\n }\n\n static class MyReader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public MyReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "695dd5e375f527e7f6ec8c914587fe0f", "src_uid": "78d013b01497053b8e321fe7b6ce3760", "apr_id": "d366617161aa6875d9b5c1b6ddc7a079", "difficulty": 2100, "tags": ["ternary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8029294274300932, "equal_cnt": 22, "replace_cnt": 8, "delete_cnt": 4, "insert_cnt": 9, "fix_ops_cnt": 21, "bug_source_code": "\n\n\nimport static java.lang.System.out;\nimport java.util.Scanner;\n\n// 795A\n// n people, some pupil, some adult. separate into groups. a group must have 1 adult\n// if a group has x people, cost of tickets=c1+c2(x-1)^2\n// find minimal price\npublic class AmusementPark {\n \n int adult;\n int pupil;\n int n; // 1\u2009\u2264\u2009n\u2009\u2264\u2009200\u2009000\n long c1; // 1\u2009\u2264\u2009c1,\u2009c2\u2009\u2264\u200910^7\n long c2;\n long minCost=0;\n \n long formula(int x)\n {\n return c1+c2*(x-1)*(x-1);\n }\n long calc(int group)\n {\n if (group==1)\n {\n return formula(n);\n }\n int avg = n/group;\n int rem = n%group;\n long cost = formula(avg);\n if ( rem>0 ) {\n cost *= (group-rem);\n return cost + rem*formula(avg+1);\n }\n else \n return cost *group;\n }\n long cost(int lo, int hi, long lowCost, long hiCost)\n {\n if (lo-hi<=1 && lo-hi>=-1) {\n return lowCost;\n }\n int mid = (lo+hi)/2;\n long midCost = calc(mid);\n //out.println(\"first \"+lo+\" second \"+hi+ \" mid cost \"+midCost+\" low clost \"+lowCost+\" hi cost \"+hiCost);\n if (midCostcost2)\n out.println(cost(a, 1, cost2, cost1));\n else if (cost1 b)\n\t\t min = b;\n\t\tint total=a+b;\n\t\tint rem=total-min;\n\t\tSystem.out.println(min+\" \"+rem/2);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "31c7833ef89e128488e5d1d1e4a419f3", "src_uid": "775766790e91e539c1cfaa5030e5b955", "apr_id": "dfce92af1b60c249a0211820d36a5aca", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9052453468697124, "equal_cnt": 9, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 7, "fix_ops_cnt": 10, "bug_source_code": "public class VasyatheHipster{\npublic static int Diferentes(int a, int b)\n {\n if (a<=b)\n return a;\n else\n return b;\n \n }\n public static int Iguales(int a, int b)\n {\n int Aux=a-b;\n return Aux/2;\n }\n public static void main(String[] args) {\n // TODO code application logic here\n Scanner a=new Scanner(System.in);\n int b=a.nextInt();\n int c=a.nextInt();\n System.out.print(Diferentes(b, c));\n System.out.print(\" \"+Iguales(b, c));\n }\n}", "lang": "Java 8", "bug_code_uid": "54ef7f2f5300efdc4e2b07530734917f", "src_uid": "775766790e91e539c1cfaa5030e5b955", "apr_id": "7e59c77848837d0c09035a01bf1d6cb8", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9622950819672131, "equal_cnt": 7, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "import java.util.*;\n\npublic class MainB {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString line = sc.nextLine();\n\t\tint row = Integer.parseInt(line.substring(0, line.length() - 1));\n\t\tchar column = line.charAt(line.length() - 1);\n\n\t\tint n = row / 4;\n\t\tint c = row % 4;\n\n\t\tint time = 0;\n\n\t\tif (c == 0) {\n\t\t\ttime += (n - 1) * 16;\n\t\t\tc = 4;\n\t\t} else {\n\t\t\ttime += n * 16;\n\t\t}\n\n\t\tif (c == 2 || c == 4) {\n\t\t\ttime += 7;\n\t\t}\n\n\t\tif (column >= 'd' && column <= 'f') {\n\t\t\ttime += 'f' - column + 1;\n\t\t} else {\n\t\t\ttime += 3 + column - 'a' + 1;\n\t\t}\n\n\t\tSystem.out.println(time);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "691b82bf28085db1a73cb003515877dc", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "apr_id": "98809585740e965182a7dbcd9a842acf", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8241796806457273, "equal_cnt": 28, "replace_cnt": 17, "delete_cnt": 3, "insert_cnt": 8, "fix_ops_cnt": 28, "bug_source_code": "import static java.util.Arrays.*;\n\nimport java.math.*;\n\npublic class E {\n\n\tpublic Object solve () {\n\t\tint N = sc.nextInt() - 1, S = sc.nextInt(), R = sc.nextInt();\n\n\t\tif (N == 0)\n\t\t\treturn exit(1);\n\t\tif (R == 0)\n\t\t\tif (S == 0)\n\t\t\t\treturn exit(modInv(N+1));\n\t\t\telse\n\t\t\t\treturn 0;\n\n\t\tlong [][] C = modBin(N, N);\n\n\t\tlong P = 0;\n\t\tfor (int b = S; b >= R; --b) {\n\t\t\tif (b * N < S - b)\n\t\t\t\tbreak;\n\n\t\t\tlong [][] F = new long [N+1][S+1]; fill(F[0], 1);\n\t\t\tfor (int k = 1; k <= N; ++k) {\n\t\t\t\tF[k][0] = 1;\n\t\t\t\tfor (int x = 1; x <= S; ++x) {\n\t\t\t\t\tF[k][x] = (F[k][x-1] + F[k-1][x]) % MOD;\n\t\t\t\t\tif (x >= b)\n\t\t\t\t\t\tF[k][x] = (F[k][x] + MOD - F[k-1][x-b]) % MOD;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (int j = 0; j <= N; ++j) {\n\t\t\t\tint T = S - b * (j+1);\n\t\t\t\tif (T >= 0) {\n\t\t\t\t\tlong D = F[N-j][T];\n\t\t\t\t\tif (T > 0)\n\t\t\t\t\t\tD = (D + MOD - F[N-j][T-1]) % MOD;\n\t\t\t\t\tlong Z = (C[N][j] * D) % MOD;\n\t\t\t\t\tP = (P + Z * modInv(j+1)) % MOD;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tlong Q = 0;\n\t\tlong [][] F = new long [N+1][S+1]; fill(F[0], 1);\n\t\tfor (int k = 1; k <= N; ++k) {\n\t\t\tF[k][0] = 1;\n\t\t\tfor (int x = 1; x <= S; ++x)\n\t\t\t\tF[k][x] = (F[k][x-1] + F[k-1][x]) % MOD;\n\t\t}\n\t\tQ = F[N][S-R];\n\n\t\tlong res = (P * modInv(Q)) % MOD;\n\t\treturn exit(res);\n\t}\n\n\tprivate static final boolean ONE_TEST_CASE = true;\n\n\tprivate static void init () {\n\t}\n\n\tprivate static final int MOD = 998244353;\n\tprivate static long mod (long x) { return mod(x, MOD); }\n\tprivate static long mod (long x, long mod) { return ((x % mod) + mod) % mod; }\n\tprivate static long [][] modBin (int N, int K) {\n\t\tlong [][] res = new long [N+1][K+1];\n\t\tfor (int n = 0; n <= N; ++n) {\n\t\t\tres[n][0] = 1;\n\t\t\tfor (int k = 1; k <= K && k <= n; ++k)\n\t\t\t\tres[n][k] = mod(res[n-1][k] + res[n-1][k-1]);\n\t\t}\n\t\treturn res;\n\t}\n\tprivate static long modInv(long x) { return modInv(x, MOD); }\n\tprivate static long modInv(long x, int mod) { return BigInteger.valueOf(x).modInverse(BigInteger.valueOf(mod)).longValue(); }\n\t//////////////////////////////////////////////////////////////////////////////////// OFF\n\tprivate static IOUtils.MyScanner sc = new IOUtils.MyScanner();\n\tprivate static Object print (Object o, Object ... A) { IOUtils.print(o, A); return null; }\n\tprivate static Object exit (Object o, Object ... A) { print(o, A); IOUtils.exit(); return null; }\n\tprivate static class IOUtils {\n\t\tpublic static class MyScanner {\n\t\t\tpublic String next () { newLine(); return line[index++]; }\n\t\t\tpublic int nextInt () { return Integer.parseInt(next()); }\n\t\t\t//////////////////////////////////////////////\n\t\t\tprivate boolean eol () { return index == line.length; }\n\t\t\tprivate String readLine () {\n\t\t\t\ttry {\n\t\t\t\t\treturn r.readLine();\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tthrow new Error (e);\n\t\t\t\t}\n\t\t\t}\n\t\t\tprivate final java.io.BufferedReader r;\n\t\t\tprivate MyScanner () { this(new java.io.BufferedReader(new java.io.InputStreamReader(System.in))); }\n\t\t\tprivate MyScanner (java.io.BufferedReader r) {\n\t\t\t\ttry {\n\t\t\t\t\tthis.r = r;\n\t\t\t\t\twhile (!r.ready())\n\t\t\t\t\t\tThread.sleep(1);\n\t\t\t\t\tstart();\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tthrow new Error(e);\n\t\t\t\t}\n\t\t\t}\n\t\t\tprivate String [] line;\n\t\t\tprivate int index;\n\t\t\tprivate void newLine () {\n\t\t\t\tif (line == null || eol()) {\n\t\t\t\t\tline = split(readLine());\n\t\t\t\t\tindex = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tprivate String [] split (String s) { return s.length() > 0 ? s.split(\" \") : new String [0]; }\n\t\t}\n\t\tprivate static String build (Object o, Object ... A) { return buildDelim(\" \", o, A); }\n\t\tprivate static String buildDelim (String delim, Object o, Object ... A) {\n\t\t\tStringBuilder b = new StringBuilder();\n\t\t\tappend(b, o, delim);\n\t\t\tfor (Object p : A)\n\t\t\t\tappend(b, p, delim);\n\t\t\treturn b.substring(delim.length());\n\t\t}\n\t\t//////////////////////////////////////////////////////////////////////////////////\n\t\tprivate static final java.text.DecimalFormat formatter = new java.text.DecimalFormat(\"#.#########\");\n\t\tprivate static void start () { if (t == 0) t = millis(); }\n\t\tprivate static void append (java.util.function.Consumer f, java.util.function.Consumer g, final Object o) {\n\t\t\tif (o.getClass().isArray()) {\n\t\t\t\tint len = java.lang.reflect.Array.getLength(o);\n\t\t\t\tfor (int i = 0; i < len; ++i)\n\t\t\t\t\tf.accept(java.lang.reflect.Array.get(o, i));\n\t\t\t}\n\t\t\telse if (o instanceof Iterable)\n\t\t\t\t((Iterable)o).forEach(f::accept);\n\t\t\telse\n\t\t\t\tg.accept(o instanceof Double ? formatter.format(o) : o);\n\t\t}\n\t\tprivate static void append (final StringBuilder b, Object o, final String delim) {\n\t\t\tappend(x -> { append(b, x, delim); }, x -> b.append(delim).append(x), o);\n\t\t}\n\t\tprivate static java.io.PrintWriter pw = new java.io.PrintWriter(System.out);\n\t\tprivate static void print (Object o, Object ... A) {\n\t\t\tpw.println(build(o, A));\n\t\t\tif (DEBUG)\n\t\t\t\tpw.flush();\n\t\t}\n\t\tprivate static void err (Object o, Object ... A) { System.err.println(build(o, A)); }\n\t\tprivate static boolean DEBUG;\n\t\tprivate static void write (Object o) {\n\t\t\terr(o, '(', time(), ')');\n\t\t\tif (!DEBUG)\n\t\t\t\tpw.println(o);\n\t\t}\n\t\tprivate static void exit () {\n\t\t\tIOUtils.pw.close();\n\t\t\tSystem.out.flush();\n\t\t\terr(\"------------------\");\n\t\t\terr(time());\n\t\t\tSystem.exit(0);\n\t\t}\n\t\tprivate static long t;\n\t\tprivate static long millis () { return System.currentTimeMillis(); }\n\t\tprivate static String time () { return \"Time: \" + (millis() - t) / 1000.0; }\n\t\tprivate static void run (int N) {\n\t\t\ttry { DEBUG = System.getProperties().containsKey(\"DEBUG\"); }\n\t\t\tcatch (Throwable t) {}\n\n\t\t\tfor (int n = 1; n <= N; ++n) {\n\t\t\t\tObject res = new E().solve();\n\t\t\t\tif (res != null)\n\t\t\t\t\twrite(\"Case #\" + n + \": \" + build(res));\n\t\t\t}\n\t\t\texit();\n\t\t}\n\t}\n\t////////////////////////////////////////////////////////////////////////////////////\n\tpublic static void main (String[] args) {\n\t\tinit();\n\t\tint N = ONE_TEST_CASE ? 1 : sc.nextInt();\n\t\tIOUtils.run(N);\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "30313ca73d7b846904ad743a4329200e", "src_uid": "609195ef4a970c62a8210dafe118580e", "apr_id": "26591e45a841b2ddf5a9015db3fc1763", "difficulty": 2500, "tags": ["dp", "math", "combinatorics", "probabilities"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8580662066556031, "equal_cnt": 32, "replace_cnt": 17, "delete_cnt": 7, "insert_cnt": 7, "fix_ops_cnt": 31, "bug_source_code": "import java.math.*;\nimport java.util.*;\n\npublic class E {\n\n\tpublic Object solve () {\n\t\tint N = sc.nextInt() - 1, S = sc.nextInt(), R = sc.nextInt();\n\n\t\tif (N == 0)\n\t\t\treturn exit(1);\n\t\tif (S == 0)\n\t\t\treturn exit(modInv(N+1));\n\n\t\tC = modBin(N, N);\n\t\tlong [] V = modInvs(N+1);\n\n\t\tlong P = 0;\n\t\tfor (int B = R; B <= S; ++B) {\n\t\t\tif (B * (N+1) < S)\n\t\t\t\tcontinue;\n\t\t\tfor (int j = 0; j <= N; ++j) {\n\t\t\t\tint T = S - B * (j+1);\n\t\t\t\tif (T >= 0) {\n\t\t\t\t\tlong D = F(B, N-j, T);\n\t\t\t\t\tif (T > 0)\n\t\t\t\t\t\tD = (D + MOD - F(B, N-j, T-1)) % MOD;\n\t\t\t\t\tlong Z = (C[N][j] * D) % MOD;\n\t\t\t\t\tP = (P + Z * V[j+1]) % MOD;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tlong Q = F(S-R+1, N, S-R);\n\n\t\tlong res = (P * modInv(Q)) % MOD;\n\t\treturn exit(res);\n\t}\n\n\tlong [][] C;\n\n\tint F(int B, int K, int X) {\n\t\tif (B == 0) return K == 0 ? 1 : 0;\n\n\t\tlong Q = 6000L * (6000 * B + X) + K;\n\t\tInteger R = H.get(Q);\n\t\tif (R != null)\n\t\t\treturn R;\n\n\t\tlong res = 0;\n\t\tfor (int j = 0; j <= K && j * (B-1) <= X; ++j)\n\t\t\tres = (res + C[K][j] * F(B-1, K-j, X - j * (B-1))) % MOD;\n\t\tH.put(Q, (int)res);\n\t\treturn (int)res;\n\t}\n\n\tMap H = new HashMap<>();\n\n\tprivate static final boolean ONE_TEST_CASE = true;\n\n\tprivate static void init () {\n\t}\n\n\tprivate static final int MOD = 998244353;\n\tprivate static long mod (long x) { return mod(x, MOD); }\n\tprivate static long mod (long x, long mod) { return ((x % mod) + mod) % mod; }\n\tprivate static long [][] modBin (int N, int K) {\n\t\tlong [][] res = new long [N+1][K+1];\n\t\tfor (int n = 0; n <= N; ++n) {\n\t\t\tres[n][0] = 1;\n\t\t\tfor (int k = 1; k <= K && k <= n; ++k)\n\t\t\t\tres[n][k] = mod(res[n-1][k] + res[n-1][k-1]);\n\t\t}\n\t\treturn res;\n\t}\n\tprivate static long modInv(long x) { return modInv(x, MOD); }\n\tprivate static long modInv(long x, int mod) { return BigInteger.valueOf(x).modInverse(BigInteger.valueOf(mod)).longValue(); }\n\tprivate static long [] modInvs(int N) {\n\t\tlong [] res = new long [N+1];\n\t\tfor (int i = 1; i <= N; ++i)\n\t\t\tres[i] = modInv(i);\n\t\treturn res;\n\t}\n\t//////////////////////////////////////////////////////////////////////////////////// OFF\n\tprivate static IOUtils.MyScanner sc = new IOUtils.MyScanner();\n\tprivate static Object print (Object o, Object ... A) { IOUtils.print(o, A); return null; }\n\tprivate static Object exit (Object o, Object ... A) { print(o, A); IOUtils.exit(); return null; }\n\tprivate static class IOUtils {\n\t\tpublic static class MyScanner {\n\t\t\tpublic String next () { newLine(); return line[index++]; }\n\t\t\tpublic int nextInt () { return Integer.parseInt(next()); }\n\t\t\t//////////////////////////////////////////////\n\t\t\tprivate boolean eol () { return index == line.length; }\n\t\t\tprivate String readLine () {\n\t\t\t\ttry {\n\t\t\t\t\treturn r.readLine();\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tthrow new Error (e);\n\t\t\t\t}\n\t\t\t}\n\t\t\tprivate final java.io.BufferedReader r;\n\t\t\tprivate MyScanner () { this(new java.io.BufferedReader(new java.io.InputStreamReader(System.in))); }\n\t\t\tprivate MyScanner (java.io.BufferedReader r) {\n\t\t\t\ttry {\n\t\t\t\t\tthis.r = r;\n\t\t\t\t\twhile (!r.ready())\n\t\t\t\t\t\tThread.sleep(1);\n\t\t\t\t\tstart();\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tthrow new Error(e);\n\t\t\t\t}\n\t\t\t}\n\t\t\tprivate String [] line;\n\t\t\tprivate int index;\n\t\t\tprivate void newLine () {\n\t\t\t\tif (line == null || eol()) {\n\t\t\t\t\tline = split(readLine());\n\t\t\t\t\tindex = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tprivate String [] split (String s) { return s.length() > 0 ? s.split(\" \") : new String [0]; }\n\t\t}\n\t\tprivate static String build (Object o, Object ... A) { return buildDelim(\" \", o, A); }\n\t\tprivate static String buildDelim (String delim, Object o, Object ... A) {\n\t\t\tStringBuilder b = new StringBuilder();\n\t\t\tappend(b, o, delim);\n\t\t\tfor (Object p : A)\n\t\t\t\tappend(b, p, delim);\n\t\t\treturn b.substring(delim.length());\n\t\t}\n\t\t//////////////////////////////////////////////////////////////////////////////////\n\t\tprivate static final java.text.DecimalFormat formatter = new java.text.DecimalFormat(\"#.#########\");\n\t\tprivate static void start () { if (t == 0) t = millis(); }\n\t\tprivate static void append (java.util.function.Consumer f, java.util.function.Consumer g, final Object o) {\n\t\t\tif (o.getClass().isArray()) {\n\t\t\t\tint len = java.lang.reflect.Array.getLength(o);\n\t\t\t\tfor (int i = 0; i < len; ++i)\n\t\t\t\t\tf.accept(java.lang.reflect.Array.get(o, i));\n\t\t\t}\n\t\t\telse if (o instanceof Iterable)\n\t\t\t\t((Iterable)o).forEach(f::accept);\n\t\t\telse\n\t\t\t\tg.accept(o instanceof Double ? formatter.format(o) : o);\n\t\t}\n\t\tprivate static void append (final StringBuilder b, Object o, final String delim) {\n\t\t\tappend(x -> { append(b, x, delim); }, x -> b.append(delim).append(x), o);\n\t\t}\n\t\tprivate static java.io.PrintWriter pw = new java.io.PrintWriter(System.out);\n\t\tprivate static void print (Object o, Object ... A) {\n\t\t\tpw.println(build(o, A));\n\t\t\tif (DEBUG)\n\t\t\t\tpw.flush();\n\t\t}\n\t\tprivate static void err (Object o, Object ... A) { System.err.println(build(o, A)); }\n\t\tprivate static boolean DEBUG;\n\t\tprivate static void write (Object o) {\n\t\t\terr(o, '(', time(), ')');\n\t\t\tif (!DEBUG)\n\t\t\t\tpw.println(o);\n\t\t}\n\t\tprivate static void exit () {\n\t\t\tIOUtils.pw.close();\n\t\t\tSystem.out.flush();\n\t\t\terr(\"------------------\");\n\t\t\terr(time());\n\t\t\tSystem.exit(0);\n\t\t}\n\t\tprivate static long t;\n\t\tprivate static long millis () { return System.currentTimeMillis(); }\n\t\tprivate static String time () { return \"Time: \" + (millis() - t) / 1000.0; }\n\t\tprivate static void run (int N) {\n\t\t\ttry { DEBUG = System.getProperties().containsKey(\"DEBUG\"); }\n\t\t\tcatch (Throwable t) {}\n\n\t\t\tfor (int n = 1; n <= N; ++n) {\n\t\t\t\tObject res = new E().solve();\n\t\t\t\tif (res != null)\n\t\t\t\t\twrite(\"Case #\" + n + \": \" + build(res));\n\t\t\t}\n\t\t\texit();\n\t\t}\n\t}\n\t////////////////////////////////////////////////////////////////////////////////////\n\tpublic static void main (String[] args) {\n\t\tinit();\n\t\tint N = ONE_TEST_CASE ? 1 : sc.nextInt();\n\t\tIOUtils.run(N);\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "652f4ae704cfea51e8a3fe1618699637", "src_uid": "609195ef4a970c62a8210dafe118580e", "apr_id": "26591e45a841b2ddf5a9015db3fc1763", "difficulty": 2500, "tags": ["dp", "math", "combinatorics", "probabilities"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9222113502935421, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*;\nimport java.io.*;\nimport java.lang.*;\nimport java.math.*;\npublic class E {\n public static int mod = 998244353;\n public static int[] fact;\n public static void main(String[] args) throws Exception {\n BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n // Scanner scan = new Scanner(System.in);\n PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));\n // int n = Integer.parseInt(bf.readLine());\n StringTokenizer st = new StringTokenizer(bf.readLine());\n // int[] a = new int[n]; for(int i=0; i= r;\n int sign = 1;\n fact = new int[6001];\n fact[0] = 1;\n for(int i=1; i<=6000; i++) {\n fact[i] = (int)(1L*fact[i-1]*i % mod);\n }\n for(int i=1; i<=p; i++) {\n\n if(i < p) PIE += sign*(1L*choose(p, i)*choose(s - i*r + p-i-1, p-i-1) % mod);\n else PIE += sign*1;\n PIE += mod;\n PIE %= mod;\n\n\n sign = -1*sign;\n }\n\n long ways_first = choose(s-r+p-2, p-2) % mod;\n long ans = frac((int)PIE, (int)((1L * ways_first * p) % mod));\n out.println(ans);\n\n // int n = scan.nextInt();\n\n out.close(); System.exit(0);\n }\n public static int exp(int base, int e) {\n if(e == 0) return 1;\n if(e == 1) return base;\n int val = exp(base, e/2);\n int ans = (int)(1L*val*val % mod);\n if(e % 2 == 1)\n ans = (int)(1L*ans*base % mod);\n return ans;\n }\n public static int inv(int base) {\n return exp(base, mod-2);\n }\n public static long frac(int p, int q) {\n return (1L*p*inv(q) % mod);\n }\n public static long choose(int a, int b) {\n if(a= 0 && S - x - l * x >= 0; l++) {\n int players = P - 1 - l;\n int balls = S - x - l * x;\n// System.out.println(\"Forced \" + l + \" other players to have exactly \" + x + \" balls\");\n// System.out.println(\"Remaining: players = \" + players + \" balls = \" + balls);\n long prob = (choose(P - 1, l) * f(players, balls, x)) % mod;\n // prob of having this number of x's for players, then given\n // that, the probability of winning is uniform among all x players\n long contrib = (inv(l + 1) * prob) % mod;\n wins = (wins + contrib) % mod;\n// System.out.println(\"Prob: \" + prob + \" Contrib: \" + contrib);\n// System.out.println();\n }\n long ways = choose(S - x + P - 2, P - 2);\n// System.out.println(\"Ways for x = \" + x + \" = \" + ways);\n// System.out.println(\"----------\");\n total = (total + ways) % mod;\n }\n // we have now counted the number of winning states (scaling\n // with the f function). The probability is this divided by total\n // states.\n long prob = (wins * inv(total)) % mod;\n out.println(prob);\n }\n out.close();\n }\n\n // todo SET THE MOD\n static long mod = 998244353;\n static long[] fact, invFact;\n\n // f returns probability that with these parameters, we get an assignment\n // where all have < x balls.\n static long f(int players, int balls, int x) {\n // if there are no players, there MUST BE only 1 way.\n if (players == 0) {\n ASSERT(balls <= x, \"Gave impossible amt\");\n return (balls <= x) ? 1 : 0;\n }\n long total = choose(balls + players - 1, players - 1);\n long complement = 0;\n int sign = 1;\n for (int k = 1; k <= players && balls - k * x >= 0; k++) {\n long amt = (choose(players, k) * choose(balls - k * x + players - 1, players - 1)) % mod;\n complement = (complement + sign * amt) % mod;\n sign *= -1;\n }\n// System.out.println(\"Ways for (players, balls) = \" + players + \" \" + balls + \": Total \" + total + \", Complement: \" + complement);\n long ans = (total - complement + mod) % mod;\n// ans = (ans * inv(total)) % mod; // probability\n return ans;\n }\n\n static long choose(int n, int k) {\n ASSERT(k <= n, \"Invalid choose\");\n long ans = (fact[n] * invFact[n - k]) % mod;\n return (ans * invFact[k]) % mod;\n }\n\n static long inv(long x) {\n return fastExpo(x, mod - 2);\n }\n\n static long fastExpo(long x, long k) {\n long ans = 1;\n long bit = x;\n while (k > 0) {\n if (k % 2 == 1) {\n ans = (bit * ans) % mod;\n }\n bit = (bit * bit) % mod;\n k /= 2;\n }\n return ans;\n }\n\n static class FastScanner {\n private int BS = 1 << 16;\n private char NC = (char) 0;\n private byte[] buf = new byte[BS];\n private int bId = 0, size = 0;\n private char c = NC;\n private double cnt = 1;\n private BufferedInputStream in;\n\n public FastScanner() {\n in = new BufferedInputStream(System.in, BS);\n }\n\n public FastScanner(String s) {\n try {\n in = new BufferedInputStream(new FileInputStream(new File(s)), BS);\n } catch (Exception e) {\n in = new BufferedInputStream(System.in, BS);\n }\n }\n\n private char getChar() {\n while (bId == size) {\n try {\n size = in.read(buf);\n } catch (Exception e) {\n return NC;\n }\n if (size == -1) return NC;\n bId = 0;\n }\n return (char) buf[bId++];\n }\n\n public int nextInt() {\n return (int) nextLong();\n }\n\n public int[] nextInts(int N) {\n int[] res = new int[N];\n for (int i = 0; i < N; i++) {\n res[i] = (int) nextLong();\n }\n return res;\n }\n\n public long[] nextLongs(int N) {\n long[] res = new long[N];\n for (int i = 0; i < N; i++) {\n res[i] = nextLong();\n }\n return res;\n }\n\n public long nextLong() {\n cnt = 1;\n boolean neg = false;\n if (c == NC) c = getChar();\n for (; (c < '0' || c > '9'); c = getChar()) {\n if (c == '-') neg = true;\n }\n long res = 0;\n for (; c >= '0' && c <= '9'; c = getChar()) {\n res = (res << 3) + (res << 1) + c - '0';\n cnt *= 10;\n }\n return neg ? -res : res;\n }\n\n public double nextDouble() {\n double cur = nextLong();\n return c != '.' ? cur : cur + nextLong() / cnt;\n }\n\n public double[] nextDoubles(int N) {\n double[] res = new double[N];\n for (int i = 0; i < N; i++) {\n res[i] = nextDouble();\n }\n return res;\n }\n\n public String next() {\n StringBuilder res = new StringBuilder();\n while (c <= 32) c = getChar();\n while (c > 32) {\n res.append(c);\n c = getChar();\n }\n return res.toString();\n }\n\n public String nextLine() {\n StringBuilder res = new StringBuilder();\n while (c <= 32) c = getChar();\n while (c != '\\n') {\n res.append(c);\n c = getChar();\n }\n return res.toString();\n }\n\n public boolean hasNext() {\n if (c > 32) return true;\n while (true) {\n c = getChar();\n if (c == NC) return false;\n else if (c > 32) return true;\n }\n }\n }\n\n static void ASSERT(boolean assertion, String message) {\n if (!assertion) throw new AssertionError(message);\n }\n}", "lang": "Java 8", "bug_code_uid": "99bf7046cfe1f5e935d8d49f15a1d797", "src_uid": "609195ef4a970c62a8210dafe118580e", "apr_id": "b9553ebfe3320ed6451812daf3a478fa", "difficulty": 2500, "tags": ["dp", "math", "combinatorics", "probabilities"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.981548335338949, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "/**\n * @author derrick20\n */\n\nimport java.io.*;\nimport java.util.*;\n\npublic class TopScorer {\n public static void main(String[] args) throws Exception {\n FastScanner sc = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n\n int P = sc.nextInt();\n int S = sc.nextInt();\n int R = sc.nextInt();\n // it should go up to s + p - 1, 5099, but let's be safe\n int MAX = (int) 1e5; // todo change this!\n fact = new long[MAX + 1];\n invFact = new long[MAX + 1];\n fact[0] = 1;\n invFact[0] = 1;\n for (int i = 1; i <= MAX; i++) {\n fact[i] = ((long) i * fact[i - 1]) % mod;\n invFact[i] = inv(fact[i]);\n }\n\n if (P == 1) {\n out.println(1);\n } else {\n // O(SP^2) = 5*10^7\n long wins = 0;\n long total = 0;\n for (int x = R; x <= S; x++) {\n // l = group that gets x\n // the remaining players P - 1 - l must get < x.\n for (int l = 0; P - 1 - l >= 0 && S - x - l * x >= 0; l++) {\n int players = P - 1 - l;\n int balls = S - x - l * x;\n// System.out.println(\"Forced \" + l + \" other players to have exactly \" + x + \" balls\");\n// System.out.println(\"Remaining: players = \" + players + \" balls = \" + balls);\n long prob = (choose(P - 1, l) * f(players, balls, x)) % mod;\n // prob of having this number of x's for players, then given\n // that, the probability of winning is uniform among all x players\n long contrib = (inv(l + 1) * prob) % mod;\n wins = (wins + contrib) % mod;\n// System.out.println(\"Prob: \" + prob + \" Contrib: \" + contrib);\n// System.out.println();\n }\n long ways = choose(S - x + P - 2, P - 2);\n// System.out.println(\"Ways for x = \" + x + \" = \" + ways);\n// System.out.println(\"----------\");\n total = (total + ways) % mod;\n }\n // we have now counted the number of winning states (scaling\n // with the f function). The probability is this divided by total\n // states.\n long prob = (wins * inv(total)) % mod;\n out.println(prob);\n }\n out.close();\n }\n\n // todo SET THE MOD\n static long mod = 998244353;\n static long[] fact, invFact;\n\n // f returns probability that with these parameters, we get an assignment\n // where all have < x balls.\n static long f(int players, int balls, int x) {\n // if there are no players, there MUST BE only 1 way.\n if (players == 0) {\n// ASSERT(balls <= x, \"Gave impossible amt\");\n return (balls <= x) ? 1 : 0;\n }\n long total = choose(balls + players - 1, players - 1);\n long complement = 0;\n int sign = 1;\n for (int k = 1; k <= players && balls - k * x >= 0; k++) {\n long amt = (choose(players, k) * choose(balls - k * x + players - 1, players - 1)) % mod;\n complement = (complement + sign * amt) % mod;\n sign *= -1;\n }\n// System.out.println(\"Ways for (players, balls) = \" + players + \" \" + balls + \": Total \" + total + \", Complement: \" + complement);\n long ans = (total - complement + mod) % mod;\n// ans = (ans * inv(total)) % mod; // probability\n return ans;\n }\n\n static long choose(int n, int k) {\n ASSERT(k <= n, \"Invalid choose\");\n long ans = (fact[n] * invFact[n - k]) % mod;\n return (ans * invFact[k]) % mod;\n }\n\n static long inv(long x) {\n return fastExpo(x, mod - 2);\n }\n\n static long fastExpo(long x, long k) {\n long ans = 1;\n long bit = x;\n while (k > 0) {\n if (k % 2 == 1) {\n ans = (bit * ans) % mod;\n }\n bit = (bit * bit) % mod;\n k /= 2;\n }\n return ans;\n }\n\n static class FastScanner {\n private int BS = 1 << 16;\n private char NC = (char) 0;\n private byte[] buf = new byte[BS];\n private int bId = 0, size = 0;\n private char c = NC;\n private double cnt = 1;\n private BufferedInputStream in;\n\n public FastScanner() {\n in = new BufferedInputStream(System.in, BS);\n }\n\n public FastScanner(String s) {\n try {\n in = new BufferedInputStream(new FileInputStream(new File(s)), BS);\n } catch (Exception e) {\n in = new BufferedInputStream(System.in, BS);\n }\n }\n\n private char getChar() {\n while (bId == size) {\n try {\n size = in.read(buf);\n } catch (Exception e) {\n return NC;\n }\n if (size == -1) return NC;\n bId = 0;\n }\n return (char) buf[bId++];\n }\n\n public int nextInt() {\n return (int) nextLong();\n }\n\n public int[] nextInts(int N) {\n int[] res = new int[N];\n for (int i = 0; i < N; i++) {\n res[i] = (int) nextLong();\n }\n return res;\n }\n\n public long[] nextLongs(int N) {\n long[] res = new long[N];\n for (int i = 0; i < N; i++) {\n res[i] = nextLong();\n }\n return res;\n }\n\n public long nextLong() {\n cnt = 1;\n boolean neg = false;\n if (c == NC) c = getChar();\n for (; (c < '0' || c > '9'); c = getChar()) {\n if (c == '-') neg = true;\n }\n long res = 0;\n for (; c >= '0' && c <= '9'; c = getChar()) {\n res = (res << 3) + (res << 1) + c - '0';\n cnt *= 10;\n }\n return neg ? -res : res;\n }\n\n public double nextDouble() {\n double cur = nextLong();\n return c != '.' ? cur : cur + nextLong() / cnt;\n }\n\n public double[] nextDoubles(int N) {\n double[] res = new double[N];\n for (int i = 0; i < N; i++) {\n res[i] = nextDouble();\n }\n return res;\n }\n\n public String next() {\n StringBuilder res = new StringBuilder();\n while (c <= 32) c = getChar();\n while (c > 32) {\n res.append(c);\n c = getChar();\n }\n return res.toString();\n }\n\n public String nextLine() {\n StringBuilder res = new StringBuilder();\n while (c <= 32) c = getChar();\n while (c != '\\n') {\n res.append(c);\n c = getChar();\n }\n return res.toString();\n }\n\n public boolean hasNext() {\n if (c > 32) return true;\n while (true) {\n c = getChar();\n if (c == NC) return false;\n else if (c > 32) return true;\n }\n }\n }\n\n static void ASSERT(boolean assertion, String message) {\n if (!assertion) throw new AssertionError(message);\n }\n}", "lang": "Java 8", "bug_code_uid": "520dcef09ceefef77219f0d18d50ee33", "src_uid": "609195ef4a970c62a8210dafe118580e", "apr_id": "b9553ebfe3320ed6451812daf3a478fa", "difficulty": 2500, "tags": ["dp", "math", "combinatorics", "probabilities"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9874010079193665, "equal_cnt": 10, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 9, "bug_source_code": "import java.lang.*;\nimport java.math.*;\nimport java.util.*;\nimport java.io.*;\n\npublic class Main {\n\n void solve() {\n int p=ni(),s=ni(),r=ni();\n precompute(1000000);\n long ans=0;\n for(int i=r;i<=s;i++){\n for(int j=1;j<=p && i*1L*j<=s;j++){\n long d=mul(C[p-1][j-1],mul(inv[j],go(p-j,s-i*j,i)));\n // pw.println(C[p-1][j-1]+\" \"+inv[j]+\" \"+go(p-j,s-i*j,i));\n ans=add(ans,d);\n }\n }\n ans=mul(ans,fact[p-1]);\n ans=mul(ans,fact[s-r]);\n ans=mul(ans,modInverse(fact[s-r+p-1],M));\n pw.println(ans);\n\n\n\n\n\n }\n\n long go(int n,int m,int s){\n if(n==0) {\n if(m>0) return 0;\n else return 1;\n }\n if((s-1)*1L*n=0;i--) inv[i]=mul(inv[i+1],i+1);\n inv[1]=1;\n for(int i=2;i<=n;i++){\n inv[i]=mul(inv[i],fact[i-1]);\n }\n\n\n\n }\n\n\n long modpow(long a, long b)\n {\n long r=1;\n while(b>0)\n {\n if((b&1)>0) r=mul(r,a);\n a=mul(a,a);\n b>>=1;\n }\n return r;\n }\n long mul(long x,long y){\n x*=y;\n if(x>=M) x%=M;\n return x;\n }\n long add(long x,long y){\n x+=y;\n if(x>=M) x-=M;\n if(x<0) x+=M;\n return x;\n }\n long sub(long x,long y){\n x-=y;\n if(x<0) x+=M;\n return x;\n }\n long modInverse(long A, long M)\n {\n\n return modpow(A,M-2);\n }\n\n\n\n long M = 998244353;\n InputStream is;\n PrintWriter pw;\n String INPUT = \"\";\n\n void run() throws Exception {\n is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n pw = new PrintWriter(System.out);\n long s = System.currentTimeMillis();\n solve();\n pw.flush();\n if (!INPUT.isEmpty()) tr(System.currentTimeMillis() - s + \"ms\");\n\n }\n\n public static void main(String[] args) throws Exception {\n new Main().run();\n }\n\n private byte[] inbuf = new byte[1024];\n public int lenbuf = 0, ptrbuf = 0;\n\n private int readByte() {\n if (lenbuf == -1) throw new InputMismatchException();\n if (ptrbuf >= lenbuf) {\n ptrbuf = 0;\n try {\n lenbuf = is.read(inbuf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (lenbuf <= 0) return -1;\n }\n return inbuf[ptrbuf++];\n }\n\n private boolean isSpaceChar(int c) {\n return !(c >= 33 && c <= 126);\n }\n\n private int skip() {\n int b;\n while ((b = readByte()) != -1 && isSpaceChar(b)) ;\n return b;\n }\n\n private double nd() {\n return Double.parseDouble(ns());\n }\n\n private char nc() {\n return (char) skip();\n }\n\n private String ns() {\n int b = skip();\n StringBuilder sb = new StringBuilder();\n while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n private char[] ns(int n) {\n char[] buf = new char[n];\n int b = skip(), p = 0;\n while (p < n && !(isSpaceChar(b))) {\n buf[p++] = (char) b;\n b = readByte();\n }\n return n == p ? buf : Arrays.copyOf(buf, p);\n }\n\n private char[][] nm(int n, int m) {\n char[][] map = new char[n][];\n for (int i = 0; i < n; i++) map[i] = ns(m);\n return map;\n }\n\n private int[] na(int n) {\n int[] a = new int[n];\n for (int i = 0; i < n; i++) a[i] = ni();\n return a;\n }\n\n private int ni() {\n int num = 0, b;\n boolean minus = false;\n while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n\n while (true) {\n if (b >= '0' && b <= '9') {\n num = num * 10 + (b - '0');\n } else {\n return minus ? -num : num;\n }\n b = readByte();\n }\n }\n\n private long nl() {\n long num = 0;\n int b;\n boolean minus = false;\n while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n\n while (true) {\n if (b >= '0' && b <= '9') {\n num = num * 10 + (b - '0');\n } else {\n return minus ? -num : num;\n }\n b = readByte();\n }\n }\n\n private boolean oj = System.getProperty(\"ONLINE_JUDGE\") != null;\n\n private void tr(Object... o) {\n if (INPUT.length() > 0) System.out.println(Arrays.deepToString(o));\n }\n\n}", "lang": "Java 8", "bug_code_uid": "efe54e253f50aa0cbf3c4f9a859df9ce", "src_uid": "609195ef4a970c62a8210dafe118580e", "apr_id": "a98ec9a7cadcbaef3f4f381b9a01882c", "difficulty": 2500, "tags": ["dp", "math", "combinatorics", "probabilities"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9933861353800931, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.File;\nimport java.io.FileInputStream;\nimport java.io.FileNotFoundException;\nimport java.io.FileOutputStream;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.PriorityQueue;\nimport java.util.Random;\nimport java.util.Scanner;\nimport java.util.Stack;\nimport java.util.StringTokenizer;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\nimport java.lang.Long;\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\n\n/**\n * Problem statement: http://codeforces.com/problemset/problem/431/D\n * \n * @author thepham\n * \n */\n\npublic class C_Round_91_Div1 {\n\tstatic long Mod = 1000000007;\n\n\tpublic static void main(String[] args) throws FileNotFoundException {\n\t\t// PrintWriter out = new PrintWriter(new FileOutputStream(new File(\n\t\t// \"output.txt\")));\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tScanner in = new Scanner();\n\t\tint n = in.nextInt();\n\t\tint[]data = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tdata[i] = i + 1;\n\t\t}\n\t\tint k = in.nextInt();\n\t\tboolean ok = true;\n\t\tif (n <= 14) {\n\t\t\tlong max = 1;\n\t\t\tfor (int i = 1; i <= n; i++) {\n\t\t\t\tmax *= i;\n\t\t\t}\n\t\t\tif (max < k) {\n\t\t\t\tok = false;\n\t\t\t\tout.println(-1);\n\t\t\t}\n\t\t}\n\t\tif (ok) {\n\t\t\tPriorityQueue q = new PriorityQueue();\n\t\t\tTreeSet set = new TreeSet();\n\t\t\tq.add(4L);\n\t\t\tq.add(7L);\n\t\t\t\n\t\t\twhile (!q.isEmpty()) {\n\t\t\t\tlong v = q.poll();\n\t\t\t\tif (v > n) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tset.add((int)v);\n\t\t\t\tq.add(v * 10 + 4);\n\t\t\t\tq.add(v * 10 + 7);\n\t\t\t}\n\t\t\t//out.println(set);\n\t\t\tint left = 0;\n\t\t\tlong cur = 1;\n\t\t\tfor(int i = 1; i <= 14 ; i++){\n\t\t\t\tcur *= i;\n\t\t\t\tif(cur >= k){\n\t\t\t\t\tleft = i ;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tint other = n - left;\n\t\t\tint result = set.headSet(other, true).size();\n\t\t\tint start = other + 1;\n\t\t\tArrayList list = new ArrayList();\n\t\t\tfor(int i = 0; i < left; i++){\n\t\t\t\tlist.add(start + i);\n\t\t\t}\n\t\t\tfor(int i = 0; i < left; i++){\n\t\t\t\tint min = 0;\n\t\t\t\tint max = list.size() - 1;\n\t\t\t\tlong re= -1;\n\t\t\t\tint id = -1;\n\t\t\t\twhile(min <= max){\n\t\t\t\t\tint mid = (min + max)/2;\n\t\t\t\t\tlong large = mid;\n\t\t\t\t\tfor(int j = 1; j < left - i; j++ ){\n\t\t\t\t\t\tlarge *= j;\n\t\t\t\t\t}\n\t\t\t\t\tif(large < k){\n\t\t\t\t\t\tif(large > re){\n\t\t\t\t\t\t\tre = large;\n\t\t\t\t\t\t\tid = mid;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmin = mid + 1;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tmax = mid - 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tk -= re;\n\t\t\t\tint v = list.remove((int)id);\n\t\t\t\t//System.out.println(v + \" \" + id + \" \" + start + \" \" + re);\n\t\t\t\tif(set.contains(v) && set.contains(start)){\n\t\t\t\t\tresult++;\n\t\t\t\t}\n\t\t\t\tstart++;\n\t\t\t}\n\t\t\tout.println(result);\n\t\t}\n\t\tout.close();\n\t}\n\n\t\n\t\n\tstatic class Segment implements Comparable {\n\t\tint x, y;\n\n\t\tpublic Segment(int x, int y) {\n\t\t\tsuper();\n\t\t\tthis.x = x;\n\t\t\tthis.y = y;\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\treturn x + \" \" + y;\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(Segment o) {\n\t\t\tif (x != o.x) {\n\t\t\t\treturn x - o.x;\n\t\t\t}\n\t\t\treturn o.y - y;\n\t\t}\n\t}\n\n\tpublic static int[] buildKMP(String val) {\n\t\tint[] data = new int[val.length() + 1];\n\t\tint i = 0;\n\t\tint j = -1;\n\t\tdata[0] = -1;\n\t\twhile (i < val.length()) {\n\t\t\twhile (j >= 0 && val.charAt(i) != val.charAt(j)) {\n\t\t\t\tj = data[j];\n\t\t\t}\n\t\t\ti++;\n\t\t\tj++;\n\n\t\t\tdata[i] = j;\n\t\t\t// System.out.println(val + \" \" + i + \" \" + data[i]);\n\t\t}\n\t\treturn data;\n\t}\n\n\tstatic int find(int index, int[] u) {\n\t\tif (u[index] != index) {\n\t\t\treturn u[index] = find(u[index], u);\n\t\t}\n\t\treturn index;\n\t}\n\n\tstatic int crossProduct(Point a, Point b) {\n\t\treturn a.x * b.y + a.y * b.x;\n\t}\n\n\tstatic long squareDist(Point a) {\n\t\tlong x = a.x;\n\t\tlong y = a.y;\n\t\treturn x * x + y * y;\n\t}\n\n\tstatic Point minus(Point a, Point b) {\n\t\treturn new Point(a.x - b.x, a.y - b.y);\n\t}\n\n\tpublic static boolean nextPer(int[] data) {\n\t\tint i = data.length - 1;\n\t\twhile (i > 0 && data[i] < data[i - 1]) {\n\t\t\ti--;\n\t\t}\n\t\tif (i == 0) {\n\t\t\treturn false;\n\t\t}\n\t\tint j = data.length - 1;\n\t\twhile (data[j] < data[i - 1]) {\n\t\t\tj--;\n\t\t}\n\t\tint temp = data[i - 1];\n\t\tdata[i - 1] = data[j];\n\t\tdata[j] = temp;\n\t\tArrays.sort(data, i, data.length);\n\t\treturn true;\n\t}\n\n\tstatic class Point {\n\t\tint x, y;\n\n\t\tpublic Point(int x, int y) {\n\t\t\tsuper();\n\t\t\tthis.x = x;\n\t\t\tthis.y = y;\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\treturn \"{\" + x + \" \" + y + \"}\";\n\t\t}\n\n\t}\n\n\tstatic long gcd(long a, long b) {\n\t\tif (b == 0) {\n\t\t\treturn a;\n\t\t}\n\t\treturn gcd(b, a % b);\n\t}\n\n\tpublic static class FT {\n\n\t\tint[] data;\n\n\t\tFT(int n) {\n\t\t\tdata = new int[n];\n\t\t}\n\n\t\tpublic void update(int index, int value) {\n\t\t\twhile (index < data.length) {\n\t\t\t\tdata[index] += value;\n\t\t\t\tindex += (index & (-index));\n\t\t\t}\n\t\t}\n\n\t\tpublic int get(int index) {\n\t\t\tint result = 0;\n\t\t\twhile (index > 0) {\n\t\t\t\tresult += data[index];\n\t\t\t\tindex -= (index & (-index));\n\t\t\t}\n\t\t\treturn result;\n\n\t\t}\n\t}\n\n\tstatic class Scanner {\n\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tpublic Scanner() throws FileNotFoundException {\n\t\t\t// System.setOut(new PrintStream(new\n\t\t\t// BufferedOutputStream(System.out), true));\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t\t// br = new BufferedReader(new InputStreamReader(new\n\t\t\t// FileInputStream(\n\t\t\t// new File(\"input.txt\"))));\n\t\t}\n\n\t\tpublic String next() {\n\n\t\t\twhile (st == null || !st.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tthrow new RuntimeException();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic double nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tpublic String nextLine() {\n\t\t\tst = null;\n\t\t\ttry {\n\t\t\t\treturn br.readLine();\n\t\t\t} catch (Exception e) {\n\t\t\t\tthrow new RuntimeException();\n\t\t\t}\n\t\t}\n\n\t\tpublic boolean endLine() {\n\t\t\ttry {\n\t\t\t\tString next = br.readLine();\n\t\t\t\twhile (next != null && next.trim().isEmpty()) {\n\t\t\t\t\tnext = br.readLine();\n\t\t\t\t}\n\t\t\t\tif (next == null) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tst = new StringTokenizer(next);\n\t\t\t\treturn st.hasMoreTokens();\n\t\t\t} catch (Exception e) {\n\t\t\t\tthrow new RuntimeException();\n\t\t\t}\n\t\t}\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "59af1e3dcc173a3fbc5235a4da6e961f", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "apr_id": "a91f485399a25059484470ba25d36fec", "difficulty": 1900, "tags": ["brute force", "combinatorics", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9918391139609444, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.math.BigInteger;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\n\npublic class CF725B {\n\n\tpublic static void main(String args[]){\n\t\tInputReader in = new InputReader(System.in);\n\t\t//OutputStream outputStream = System.out;\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tString s=in.nextLine();\n int len=s.length()-1;\n long i=Long.parseLong(s.substring(0,len));\n //System.out.println(i);\n char ca=s.charAt(len);\n long x=1;\n long y=3;\n long c=0;\n long cc=0;\n long j=0;\n if(x<=i-4&&y<=i-4)\n {\n \tlong d=i/4;\n \tx=x+(long)4*d;\n \ty=y+(long)4*d;\n \tc=c+(long)4*d;\n \tcc=cc+(long)12*d;\n }\n while(x!=i&&y!=i)\n {\n \tif(j%2==0)\n \t{\n \t\tx=x+1;\n \t\t\ty=y+1;\n \t\t\tc=c+1;\n \t\t}\n \telse\n \t{\n \t\tx=x+3;\n \t\t\ty=y+3;\n \t\t\tc=c+3;\n \t}\n \tcc=cc+6;\n \tj++;\n }\n int a=0;\n if(ca=='f')\n \ta=1;\n if(ca=='e')\n \ta=2;\n if(ca=='d')\n \ta=3;\n if(ca=='a')\n \ta=4;\n if(ca=='b')\n \ta=5;\n if(ca=='c')\n \ta=6;\n long ans=c+cc+(long)a;\n System.out.println(ans);\n\t\tout.close();\n\t\t\n}\nstatic class Pair implements Comparable {\n\tint u;\n\tint v;\n\tBigInteger bi;\n\tpublic Pair(int u, int v) {\n\t\tthis.u = u;\n\t\tthis.v = v;\n\t}\n\n\tpublic int hashCode() {\n\t\tint hu = (int) (u ^ (u >>> 32));\n\t\tint hv = (int) (v ^ (v >>> 32));\n\t\treturn 31 * hu + hv;\n\t}\n\n\tpublic boolean equals(Object o) {\n\t\tPair other = (Pair) o;\n\t\treturn u == other.u && v == other.v;\n\t}\n\n\tpublic int compareTo(Pair other) {\n\t\treturn Long.compare(u, other.u) != 0 ? Long.compare(u, other.u) : Long.compare(v, other.v);\n\t}\n\n\tpublic String toString() {\n\t\treturn \"[u=\" + u + \", v=\" + v + \"]\";\n\t}\n}\npublic static void debug(Object... o) {\n\tSystem.out.println(Arrays.deepToString(o));\n}\nstatic long modulo(long a,long b,long c) {\n\tlong x=1;\n\tlong y=a;\n\twhile(b > 0){\n\t\tif(b%2 == 1){\n\t\t\tx=(x*y)%c;\n\t\t}\n\t\ty = (y*y)%c; // squaring the base\n\t\tb /= 2;\n\t}\n\treturn x%c;\n}\nstatic long gcd(long x, long y)\n{\n\tif(x==0)\n\t\treturn y;\n\tif(y==0)\n\t\treturn x;\n\tlong r=0, a, b;\n\ta = (x > y) ? x : y; // a is greater number\n\tb = (x < y) ? x : y; // b is smaller number\n\tr = b;\n\twhile(a % b != 0)\n\t{\n\t\tr = a % b;\n\t\ta = b;\n\t\tb = r;\n\t}\n\treturn r;\n}\nstatic class InputReader {\n\tpublic BufferedReader reader;\n\tpublic StringTokenizer tokenizer;\n\n\tpublic InputReader(InputStream inputstream) {\n\t\treader = new BufferedReader(new InputStreamReader(inputstream));\n\t\ttokenizer = null;\n\t}\n\n\tpublic String nextLine(){\n\t\tString fullLine=null;\n\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\ttry {\n\t\t\t\tfullLine=reader.readLine();\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t\treturn fullLine;\n\t\t}\n\t\treturn fullLine;\n\t}\n\tpublic String next() {\n\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\ttry {\n\t\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t}\n\t\treturn tokenizer.nextToken();\n\t}\n\tpublic long nextLong() {\n\t\treturn Long.parseLong(next());\n\t}\n\tpublic int nextInt() {\n\t\treturn Integer.parseInt(next());\n\t}\n}\n}\n", "lang": "Java 8", "bug_code_uid": "29eee6889c2e70761fc78792b57ccb5e", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "apr_id": "929b8404831e2738876088897d8bf14b", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.7969043151969981, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n static FastScanner in;\n static long n, ans = 0, c1, c2;\n static char s;\n\n public static void main(String[] args) throws IOException {\n // in = new FastScanner(\"input.txt\");\n in = new FastScanner(System.in);\n String inp = in.next();\n s = inp.charAt(inp.length() - 1);\n n = Long.parseLong(inp.substring(0, inp.length() - 1));\n c1 = 1;\n c2 = 3;\n if (n % 4 == 1 || n % 4 == 2) {\n while (c1 < n) {\n if (c1 % 4 == 1) {\n ans += 7;\n c1++;\n } else if (c1 % 4 == 2) {\n ans += 9;\n c1 += 3;\n }\n }\n } else {\n while (c2 < n) {\n if (c2 % 4 == 3) {\n ans += 7;\n c2++;\n } else if (c2 % 4 == 0) {\n ans += 9;\n c2 += 3;\n }\n }\n }\n if (s == 'f')\n ans += 1;\n else if (s == 'e')\n ans += 2;\n else if (s == 'd')\n ans += 3;\n else if (s == 'a')\n ans += 4;\n else if (s == 'b')\n ans += 5;\n else if (s == 'c')\n ans += 6;\n System.out.println(ans);\n }\n}\n\nclass FastScanner {\n\n BufferedReader br;\n StringTokenizer tokenizer;\n\n FastScanner(String fileName) throws FileNotFoundException {\n this(new FileInputStream(new File(fileName)));\n }\n\n FastScanner(InputStream is) {\n br = new BufferedReader(new InputStreamReader(is));\n }\n\n String nextLine() throws IOException {\n tokenizer = null;\n return br.readLine();\n }\n\n String next() throws IOException {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n String line = br.readLine();\n if (line == null) {\n return null;\n }\n tokenizer = new StringTokenizer(line);\n }\n return tokenizer.nextToken();\n }\n\n int nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n\n long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n}", "lang": "Java 8", "bug_code_uid": "8a022a68ad5ee146b3d00b95c475a77c", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "apr_id": "583859133ff2a3665fe21302f8794b2d", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8584214808787632, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "import java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class Prob1 {\n\n\tpublic static void main(String[] args) {\n\t\t\n\t\tScanner input = new Scanner(System.in);\n\t\tString place = input.next();\n\t\tchar seat = place.charAt(place.length()-1);\n\t\t\n\t\tlong row = Long.parseLong(place.substring(0 , place.length()-1));\n\t\t\n\t\tlong seatN = getSeat(seat);\n\t\tlong c = getC(row);\n\t\t\n\t\tlong f ;\n\t\t\n\t\tif(c%2 == 0)\n\t\t{\n\t\t\tf =c*6 + c*2 + seatN;\n\t\t}\n\t\telse\n\t\t\tf = c*6 + c + seatN;\n\t\t\n\t\tSystem.out.println(f);\n\t\t\n\t\t\n\t\t\n\t\t\n\t}\n\t\n\tpublic static long getSeat(char seat)\n\t{\n\t\tif(seat == 'a')\n\t\t\treturn 4;\n\t\tif(seat == 'b')\n\t\t\treturn 5;\n\t\tif(seat == 'c')\n\t\t\treturn 6;\n\t\t\n\t\tif(seat == 'd')\n\t\t\treturn 3;\n\t\tif(seat == 'e')\n\t\t\treturn 2;\n\t\tif(seat == 'f')\n\t\t\treturn 1;\n\t\t\n\t\treturn -1;\n\t}\n\t\n\tpublic static long getC(long row)\n\t{\n\t\tif(row%2 == 1)\n\t\t{\n\t\t\tlong count = 0;\n\t\t\tlong a = 1 ;\n\t\t\tlong b = 3;\n\t\t\t\n\t\t\twhile(a != row && b!= row)\n\t\t\t{\n\t\t\t\ta = b+2;\n\t\t\t\tb = a+2;\n\t\t\t\tcount+=2;\n\t\t\t}\n\t\t\t\n\t\t\treturn count;\n\t\t}\n\t\t\n\t\tlong count = 1;\n\t\tlong a = 2;\n\t\tlong b = 4;\n\t\t\n\t\twhile(a != row && b!= row)\n\t\t{\n\t\t\ta = b+2;\n\t\t\tb = a+2;\n\t\t\tcount+=2;\n\t\t}\n\t\t\n\t\treturn count;\n\t\t\n\t}\n\t\n\n}\n", "lang": "Java 8", "bug_code_uid": "c788211fa1dea76d1b49ef868c2a18e6", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "apr_id": "79e41f0f09272716ac7c487a790135d5", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6477187733732236, "equal_cnt": 11, "replace_cnt": 7, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "\nimport java.util.ArrayList;\nimport java.util.LinkedList;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner inScanner = new Scanner(System.in);\n\n\t\t \t int a = inScanner.nextInt();\n\t\t \t int b = inScanner.nextInt();\n\t\t \t \n\t\t \t int fac_a[] = new int[a];\n\t\t \t int fac_b[] = new int[b];\n\t\t \t \n\t\t \tint commman[] = new int[Math.min(a, b)];\n\t\t \t \n\t\t \t for (int i = 1; i <= fac_a.length; i++) {\n\t\t\t\tfac_a[i-1] = i;\n\t\t\t}\n\t\t \tfor (int i = 1; i <= fac_b.length; i++) {\n\t\t\t\tfac_b[i-1] = i;\n\t\t\t}\n\t\t \tfor (int i = 0; i < Math.min(a, b); i++) {\n\t\t\t\t\n\t\t \t\tif (fac_a[i]==fac_b[i]) {\n\t\t\t\t\t commman[i] = fac_a[i];\n\t\t\t\t}\n\t\t \t\t\n\t\t\t}\n\t\t \t\n\t\t int produ =1;\n\t\t \n\t\t for (int i = 0; i < commman.length; i++) {\n\t\t\tprodu*=commman[i];\n\t\t}\n\t\t System.out.println(produ);\n\t\t \n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "42fd7b829d8ebbafbf7123719e0c2934", "src_uid": "7bf30ceb24b66d91382e97767f9feeb6", "apr_id": "473069efb48b02169af311fbef588c36", "difficulty": 800, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7012195121951219, "equal_cnt": 16, "replace_cnt": 8, "delete_cnt": 7, "insert_cnt": 1, "fix_ops_cnt": 16, "bug_source_code": "import java.util.*;\n import java.io.IOException;\n import java.util.ArrayList;\n\n\n\npublic class Begin {\n public static void main(String[] args) throws IOException {\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n\n int m = scan.nextInt();\n\n int min = 0, max = 0, index = 1;\n if(n>m){\n max = n;\n min = m;\n }\n else if(n= 0; j--) {\n cur[j] = cur[j] * poly[0] + (j - 1 >= 0 ? cur[j - 1] * poly[1] : 0);\n cur[j] = MathUtils.mod(cur[j], MOD);\n cur[j + 1] = cur[j];\n cur[j] = 0;\n }\n }\n long comb = 1;\n for (int i = N; i >= K; i--) {\n long now = 0;\n for (int j = 0; j < cur.length; j++) {\n now += ((pow[j + 1] * inv[j + 1]) % MOD) * cur[j];\n now = MathUtils.mod(now, MOD);\n }\n now *= MathUtils.binPow(2, i, MOD);\n now %= MOD;\n now *= comb;\n now %= MOD;\n res += now;\n if (res >= MOD) {\n res -= MOD;\n }\n for (int j = cur.length - 1; j >= 0; j--) {\n cur[j] = cur[j] * other[0];\n for (int k = 1; k <= 2; k++) {\n if (j - k >= 0) {\n cur[j] += cur[j - k] * other[k];\n }\n }\n cur[j] = MathUtils.mod(cur[j], MOD);\n }\n long val = cur[cur.length - 1];\n for (int j = cur.length - 1; j >= 1; j--) {\n cur[j] = -val;\n val = cur[j - 1] + l * val;\n val = MathUtils.mod(val, MOD);\n }\n for (int j = 0; j < cur.length - 1; j++) {\n if (j + 2 >= cur.length) {\n cur[j] = 0;\n } else {\n cur[j] = cur[j + 2];\n }\n }\n comb *= inv[N - i + 1];\n comb %= MOD;\n comb *= i;\n comb %= MOD;\n }\n res *= MathUtils.binPow(invL2, N, MOD);\n res %= MOD;\n out.println(res);\n }\n\n }\n\n static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n }\n\n static class MathUtils {\n public static long inverse(long a, long mod) {\n long[] inv = extended_gcd(a, mod);\n if (inv[0] != 1) {\n return 0;\n } else {\n return (inv[1] + 2 * mod) % mod;\n }\n }\n\n public static long[] extended_gcd(long a, long b) {\n //three numbers, first is gcd, second is x, third is y\n if (a == 0) {\n return new long[]{b, 0, 1};\n }\n long[] next = extended_gcd(b % a, a);\n long tempX = next[1];\n next[1] = next[2] - (b / a) * next[1];\n next[2] = tempX;\n return next;\n }\n\n public static long binPow(long b, long p, long mod) {\n long res = 1;\n while (p > 0) {\n if ((p & 1) == 1) {\n res *= b;\n res %= mod;\n }\n b = b * b;\n p >>= 1;\n b %= mod;\n }\n return res;\n }\n\n public static long mod(long a, long mod) {\n return (a + (Math.abs(a) + mod - 1) / mod * mod) % mod;\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "60515421ac07a5bbcbd56a0093ca4f10", "src_uid": "c9e79e83928d5d034123ebc3b2f5e064", "apr_id": "ffdc7d05caadae40b488018f9b69f0f1", "difficulty": 2600, "tags": ["dp", "math", "combinatorics", "probabilities"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9696838725611262, "equal_cnt": 27, "replace_cnt": 0, "delete_cnt": 13, "insert_cnt": 13, "fix_ops_cnt": 26, "bug_source_code": "\n\nimport java.io.FileInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.nio.charset.Charset;\nimport java.util.Arrays;\n\npublic class CF1153F {\n public static void main(String[] args) throws Exception {\n boolean local = System.getProperty(\"ONLINE_JUDGE\") == null;\n boolean async = false;\n\n Charset charset = Charset.forName(\"ascii\");\n\n FastIO io = local ? new FastIO(new FileInputStream(\"D:\\\\DATABASE\\\\TESTCASE\\\\Code.in\"), System.out, charset) : new FastIO(System.in, System.out, charset);\n Task task = new Task(io, new Debug(local));\n\n if (async) {\n Thread t = new Thread(null, task, \"dalt\", 1 << 27);\n t.setPriority(Thread.MAX_PRIORITY);\n t.start();\n t.join();\n } else {\n task.run();\n }\n\n if (local) {\n io.cache.append(\"\\n\\n--memory -- \\n\" + ((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) >> 20) + \"M\");\n }\n\n io.flush();\n }\n\n public static class Task implements Runnable {\n final FastIO io;\n final Debug debug;\n int inf = (int) 1e8;\n int mod = 998244353;\n int[][][] mem;\n boolean[][][] visit;\n int l1;\n int l2;\n int l3;\n int n;\n int k;\n int time;\n\n public Task(FastIO io, Debug debug) {\n this.io = io;\n this.debug = debug;\n }\n\n @Override\n public void run() {\n solve();\n }\n\n public void solve() {\n n = io.readInt();\n k = io.readInt();\n int l = io.readInt();\n mem = new int[n + 1][n + 1][2];\n visit = new boolean[n + 1][n + 1][2];\n int meetCount = find(n, n, 1);\n\n int factorial = 1;\n for (int i = 2, until = 2 * n + 1; i <= until; i++) {\n factorial = mul(factorial, i);\n }\n int total = mul(factorial, Mathematics.inverse(Mathematics.pow(2, n, mod), mod));\n int probability = mul(meetCount, Mathematics.inverse(total, mod));\n int expectLength = mul(l, probability);\n io.cache.append(expectLength);\n }\n\n public int add(int a, int b) {\n return (a + b) % mod;\n }\n\n public int sub(int a, int b) {\n if (a >= b) {\n return a - b;\n }\n return a - b + mod;\n }\n\n public int mul(int a, int b) {\n return (int) (((long) a * b) % mod);\n }\n\n public int find(int i, int j, int x) {\n time++;\n if (i < 0 || i > n || j < 0 || j > n) {\n return 0;\n }\n if (i == 0 && j == 0 && x == 0) {\n return 1;\n }\n if (visit[i][j][x]) {\n return mem[i][j][x];\n }\n visit[i][j][x] = true;\n mem[i][j][x] = 0;\n if (i < j) {\n return 0;\n }\n if (x == 1) {\n mem[i][j][x] = (mem[i][j][x] + find(i, j, 0) * (i - j >= k ? 1 : 0)) % mod;\n }\n mem[i][j][x] = (int) ((mem[i][j][x] + (long) (n - i + 1) * find(i - 1, j, x)) % mod);\n mem[i][j][x] = (int)((mem[i][j][x] + (long)(i - j + 1) * find(i, j - 1, x)) % mod);\n return mem[i][j][x];\n }\n }\n\n public static class Mathematics {\n\n public static int ceilPowerOf2(int x) {\n return 32 - Integer.numberOfLeadingZeros(x - 1);\n }\n\n public static int floorPowerOf2(int x) {\n return 31 - Integer.numberOfLeadingZeros(x);\n }\n\n public static long modmul(long a, long b, long mod) {\n return b == 0 ? 0 : ((modmul(a, b >> 1, mod) << 1) % mod + a * (b & 1)) % mod;\n }\n\n /**\n * Get the greatest common divisor of a and b\n */\n public static int gcd(int a, int b) {\n return a >= b ? gcd0(a, b) : gcd0(b, a);\n }\n\n private static int gcd0(int a, int b) {\n return b == 0 ? a : gcd0(b, a % b);\n }\n\n public static int extgcd(int a, int b, int[] coe) {\n if (a >= b) {\n return extgcd0(a, b, coe);\n } else {\n int g = extgcd0(b, a, coe);\n int tmp = coe[0];\n coe[0] = coe[1];\n coe[1] = tmp;\n return g;\n }\n }\n\n private static int extgcd0(int a, int b, int[] coe) {\n if (b == 0) {\n coe[0] = 1;\n coe[1] = 0;\n return a;\n }\n int g = extgcd0(b, a % b, coe);\n int n = coe[0];\n int m = coe[1];\n coe[0] = m;\n coe[1] = n - m * (a / b);\n return g;\n }\n\n /**\n * Get the greatest common divisor of a and b\n */\n public static long gcd(long a, long b) {\n return a >= b ? gcd0(a, b) : gcd0(b, a);\n }\n\n private static long gcd0(long a, long b) {\n return b == 0 ? a : gcd0(b, a % b);\n }\n\n public static long extgcd(long a, long b, long[] coe) {\n if (a >= b) {\n return extgcd0(a, b, coe);\n } else {\n long g = extgcd0(b, a, coe);\n long tmp = coe[0];\n coe[0] = coe[1];\n coe[1] = tmp;\n return g;\n }\n }\n\n private static long extgcd0(long a, long b, long[] coe) {\n if (b == 0) {\n coe[0] = 1;\n coe[1] = 0;\n return a;\n }\n long g = extgcd0(b, a % b, coe);\n long n = coe[0];\n long m = coe[1];\n coe[0] = m;\n coe[1] = n - m * (a / b);\n return g;\n }\n\n /**\n * Get y where x * y = 1 (% mod)\n */\n public static int inverse(int x, int mod) {\n return pow(x, mod - 2, mod);\n }\n\n /**\n * Get x^n(% mod)\n */\n public static int pow(int x, int n, int mod) {\n n = mod(n, mod - 1);\n x = mod(x, mod);\n int bit = 31 - Integer.numberOfLeadingZeros(n);\n long product = 1;\n for (; bit >= 0; bit--) {\n product = product * product % mod;\n if (((1 << bit) & n) != 0) {\n product = product * x % mod;\n }\n }\n return (int) product;\n }\n\n public static long longpow(long x, long n, long mod) {\n if (n == 0) {\n return 1;\n }\n long prod = longpow(x, n >> 1, mod);\n prod = modmul(prod, prod, mod);\n if ((n & 1) == 1) {\n prod = modmul(prod, x, mod);\n }\n return prod;\n }\n\n /**\n * Get x % mod\n */\n public static int mod(int x, int mod) {\n return x >= 0 ? x % mod : (((x % mod) + mod) % mod);\n }\n\n /**\n * Get n!/(n-m)!\n */\n public static long permute(int n, int m) {\n return m == 0 ? 1 : n * permute(n - 1, m - 1);\n }\n\n /**\n * Put all primes less or equal to limit into primes after offset\n */\n public static int eulerSieve(int limit, int[] primes, int offset) {\n boolean[] isComp = new boolean[limit + 1];\n int wpos = offset;\n for (int i = 2; i <= limit; i++) {\n if (!isComp[i]) {\n primes[wpos++] = i;\n }\n for (int j = offset, until = limit / i; j < wpos && primes[j] <= until; j++) {\n int pi = primes[j] * i;\n isComp[pi] = true;\n if (i % primes[j] == 0) {\n break;\n }\n }\n }\n return wpos - offset;\n }\n\n /**\n * Round x into integer\n */\n public static int intRound(double x) {\n if (x < 0) {\n return -(int) (-x + 0.5);\n }\n return (int) (x + 0.5);\n }\n\n /**\n * Round x into long\n */\n public static long longRound(double x) {\n if (x < 0) {\n return -(long) (-x + 0.5);\n }\n return (long) (x + 0.5);\n }\n }\n\n public static class FastIO {\n public final StringBuilder cache = new StringBuilder();\n private final InputStream is;\n private final OutputStream os;\n private final Charset charset;\n private StringBuilder defaultStringBuf = new StringBuilder(1 << 8);\n private byte[] buf = new byte[1 << 13];\n private int bufLen;\n private int bufOffset;\n private int next;\n\n public FastIO(InputStream is, OutputStream os, Charset charset) {\n this.is = is;\n this.os = os;\n this.charset = charset;\n }\n\n public FastIO(InputStream is, OutputStream os) {\n this(is, os, Charset.forName(\"ascii\"));\n }\n\n private int read() {\n while (bufLen == bufOffset) {\n bufOffset = 0;\n try {\n bufLen = is.read(buf);\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n if (bufLen == -1) {\n return -1;\n }\n }\n return buf[bufOffset++];\n }\n\n public void skipBlank() {\n while (next >= 0 && next <= 32) {\n next = read();\n }\n }\n\n public int readInt() {\n int sign = 1;\n\n skipBlank();\n if (next == '+' || next == '-') {\n sign = next == '+' ? 1 : -1;\n next = read();\n }\n\n int val = 0;\n if (sign == 1) {\n while (next >= '0' && next <= '9') {\n val = val * 10 + next - '0';\n next = read();\n }\n } else {\n while (next >= '0' && next <= '9') {\n val = val * 10 - next + '0';\n next = read();\n }\n }\n\n return val;\n }\n\n public long readLong() {\n int sign = 1;\n\n skipBlank();\n if (next == '+' || next == '-') {\n sign = next == '+' ? 1 : -1;\n next = read();\n }\n\n long val = 0;\n if (sign == 1) {\n while (next >= '0' && next <= '9') {\n val = val * 10 + next - '0';\n next = read();\n }\n } else {\n while (next >= '0' && next <= '9') {\n val = val * 10 - next + '0';\n next = read();\n }\n }\n\n return val;\n }\n\n public double readDouble() {\n boolean sign = true;\n skipBlank();\n if (next == '+' || next == '-') {\n sign = next == '+';\n next = read();\n }\n\n long val = 0;\n while (next >= '0' && next <= '9') {\n val = val * 10 + next - '0';\n next = read();\n }\n if (next != '.') {\n return sign ? val : -val;\n }\n next = read();\n long radix = 1;\n long point = 0;\n while (next >= '0' && next <= '9') {\n point = point * 10 + next - '0';\n radix = radix * 10;\n next = read();\n }\n double result = val + (double) point / radix;\n return sign ? result : -result;\n }\n\n public String readString(StringBuilder builder) {\n skipBlank();\n\n while (next > 32) {\n builder.append((char) next);\n next = read();\n }\n\n return builder.toString();\n }\n\n public String readString() {\n defaultStringBuf.setLength(0);\n return readString(defaultStringBuf);\n }\n\n public int readLine(char[] data, int offset) {\n int originalOffset = offset;\n while (next != -1 && next != '\\n') {\n data[offset++] = (char) next;\n next = read();\n }\n return offset - originalOffset;\n }\n\n public int readString(char[] data, int offset) {\n skipBlank();\n\n int originalOffset = offset;\n while (next > 32) {\n data[offset++] = (char) next;\n next = read();\n }\n\n return offset - originalOffset;\n }\n\n public int readString(byte[] data, int offset) {\n skipBlank();\n\n int originalOffset = offset;\n while (next > 32) {\n data[offset++] = (byte) next;\n next = read();\n }\n\n return offset - originalOffset;\n }\n\n public char readChar() {\n skipBlank();\n char c = (char) next;\n next = read();\n return c;\n }\n\n public void flush() {\n try {\n os.write(cache.toString().getBytes(charset));\n os.flush();\n cache.setLength(0);\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n\n public boolean hasMore() {\n skipBlank();\n return next != -1;\n }\n }\n\n public static class Debug {\n private boolean allowDebug;\n\n public Debug(boolean allowDebug) {\n this.allowDebug = allowDebug;\n }\n\n public void assertTrue(boolean flag) {\n if (!allowDebug) {\n return;\n }\n if (!flag) {\n fail();\n }\n }\n\n public void fail() {\n throw new RuntimeException();\n }\n\n public void assertFalse(boolean flag) {\n if (!allowDebug) {\n return;\n }\n if (flag) {\n fail();\n }\n }\n\n private void outputName(String name) {\n System.out.print(name + \" = \");\n }\n\n public void debug(String name, int x) {\n if (!allowDebug) {\n return;\n }\n\n outputName(name);\n System.out.println(\"\" + x);\n }\n\n public void debug(String name, long x) {\n if (!allowDebug) {\n return;\n }\n outputName(name);\n System.out.println(\"\" + x);\n }\n\n public void debug(String name, double x) {\n if (!allowDebug) {\n return;\n }\n outputName(name);\n System.out.println(\"\" + x);\n }\n\n public void debug(String name, int[] x) {\n if (!allowDebug) {\n return;\n }\n outputName(name);\n System.out.println(Arrays.toString(x));\n }\n\n public void debug(String name, long[] x) {\n if (!allowDebug) {\n return;\n }\n outputName(name);\n System.out.println(Arrays.toString(x));\n }\n\n public void debug(String name, double[] x) {\n if (!allowDebug) {\n return;\n }\n outputName(name);\n System.out.println(Arrays.toString(x));\n }\n\n public void debug(String name, Object x) {\n if (!allowDebug) {\n return;\n }\n outputName(name);\n System.out.println(\"\" + x);\n }\n\n public void debug(String name, Object... x) {\n if (!allowDebug) {\n return;\n }\n outputName(name);\n System.out.println(Arrays.deepToString(x));\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "88b3f28bfbd3c1d983cc43ac7582b393", "src_uid": "c9e79e83928d5d034123ebc3b2f5e064", "apr_id": "c50ad98e6cba06794bda76dd1355f6bc", "difficulty": 2600, "tags": ["dp", "math", "combinatorics", "probabilities"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8905972797161443, "equal_cnt": 22, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 12, "fix_ops_cnt": 21, "bug_source_code": "//package Contest551;\n\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class mainF {\n public static Scanner enter = new Scanner(System.in);\n public static PrintWriter out = new PrintWriter(System.out);\n public static long mod=998244353;\n public static long cnk[][]=new long[(int)2e3+1][(int)2e3+1];\n public static long fact[]=new long[2*(int)2e3+1];\n public static long reverse[]=new long[2*(int)2e3+1];\n public static long deg_2[]=new long[(int)2e3+1];\n public static void main(String[] args) {\n long t=System.currentTimeMillis();\n cnk[0][0]=1;\n for (int i = 1; i >=1;\n }\n return ans;\n }\n}\n", "lang": "Java 8", "bug_code_uid": "a649b301b910954b5611444335dffdae", "src_uid": "c9e79e83928d5d034123ebc3b2f5e064", "apr_id": "e1cb9a29dea6af3dbb3280019ec64f3a", "difficulty": 2600, "tags": ["dp", "math", "combinatorics", "probabilities"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9956490210297317, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "//package Contest551;\n\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class mainF {\n public static Scanner enter = new Scanner(System.in);\n public static PrintWriter out = new PrintWriter(System.out);\n public static long mod=998244353;\n public static long cnk[][]=new long[(int)2e3+1][(int)2e3+1];\n public static long fact[]=new long[2*(int)2e3+1];\n public static long reverse[]=new long[2*(int)2e3+1];\n public static long deg_2[]=new long[(int)2e3+1];\n public static void main(String[] args) {\n long t=System.currentTimeMillis();\n cnk[0][0]=1;\n for (int i = 1; i >=1;\n }\n return ans;\n }\n}\n", "lang": "Java 8", "bug_code_uid": "abffcbb5ddb57bf35d80b66938f23443", "src_uid": "c9e79e83928d5d034123ebc3b2f5e064", "apr_id": "e1cb9a29dea6af3dbb3280019ec64f3a", "difficulty": 2600, "tags": ["dp", "math", "combinatorics", "probabilities"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9834625322997416, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "\nimport java.io.*;\nimport java.util.*;\n\npublic class E890 {\n\n\tlong mod = 1000000000L+7L;\n\tlong[] fac;\n\tlong[] f;\n\t\n\t\n\tprivate void solve() throws Exception {\n\t\tint n = nextInt();\n\t\tint k = nextInt();\n\t\tfac = new long[n+1];\n\t\tfac[0] = 1;\n\t\tfor(int i = 1; i <= n; i++) fac[i] = (fac[i-1]*i)%mod;\n\t\tf = new long[n+1];\n\t\tfor(int i = 0; i <= Math.min(k,n); i++) f[i] = fac[i];\t\t\n\t\tfor(int i = k; i < n; i++) f[i+1] = (((i+1)*f[i])%mod - ((fac[i] * f[i-k])%mod * inverse(fac[i-k]))%mod + mod)%mod;\n\t\tlong res = 0;\n\t\tfor(int i = 0; i < n; i++) res = (res+(f[n-i-1]*(fac[n-1]*inverse(fac[n-1-i]))%mod)%mod)%mod;\n\t\tout.println((fac[n]-res+mod)%mod);\n\t}\n\t\n\tlong inverse(long n) {\n long i = mod, v = 0, d = 1;\n while (n>0) {\n long t = i/n, x = n;\n n = i % x;\n i = x;\n x = d;\n d = v - t*x;\n v = x;\n }\n v %= mod;\n return (v+mod)%mod;\n }\n\n\tpublic static void main(String[] args) {\n\t\tnew E890().run();\n\t}\n\n\tprivate BufferedReader in;\n\tprivate PrintWriter out;\n\tprivate StringTokenizer tokenizer;\n\n\tpublic void run() {\n\t\ttry {\n\t\t\tin = new BufferedReader(new InputStreamReader(System.in));\n\t\t\ttokenizer = null;\n\t\t\tout = new PrintWriter(System.out);\n\t\t\tsolve();\n\t\t\tin.close();\n\t\t\tout.close();\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t\tSystem.exit(1);\n\t\t}\n\t}\n\n\tprivate int nextInt() throws IOException {\n\t\treturn Integer.parseInt(nextToken());\n\t}\n\n\tprivate long nextLong() throws IOException {\n\t\treturn Long.parseLong(nextToken());\n\t}\n\n\tprivate float nextFloat() throws IOException {\n\t\treturn Float.parseFloat(nextToken());\n\t}\n\n\tprivate String nextLine() throws IOException {\n\t\treturn new String(in.readLine());\n\t}\n\n\tprivate String nextToken() throws IOException {\n\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\ttokenizer = new StringTokenizer(in.readLine());\n\t\t}\n\t\treturn tokenizer.nextToken();\n\t}\n\n\n}\n\n", "lang": "Java 8", "bug_code_uid": "36d558bf812b1649020a904cc7a3cec5", "src_uid": "0644605611a2cd10ab3a9f12f18d7ae4", "apr_id": "ede9730ce50fe300056b66ee884ff960", "difficulty": 2400, "tags": ["dp", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9964028776978417, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\npublic class HelloWorld{\n\n public static void main(String []args){\n Scanner sc=new Scanner(System.in);\n int a=sc.nextInt(),b=sc.nextInt(),c=sc.nextInt(),int cnt=0;\n if((a+b)>c && (b+c)>a && (a+c)>b )\n {\n System.out.println(\"0\");\n return;\n }\n else{\n if((a+b)<=c)\n cnt+=(c-(a+b)+1);\n if((c+b)<=a)\n cnt+=(a-(c+b)+1);\n if((a+c)<=b)\n cnt+=(b-(a+c)+1);\n System.out.println(cnt);\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "594bbedb8c226800e3be7948e721d900", "src_uid": "3dc56bc08606a39dd9ca40a43c452f09", "apr_id": "c389f936ea032c17fc631543d856500e", "difficulty": 800, "tags": ["geometry", "math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.7067137809187279, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 5, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "public class GFG {\n\tpublic static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n int b = sc.nextInt();\n int c = sc.nextInt();\n \n int[] p = new int[3];\n p[0] = a;\n p[1] = b;\n p[2] = c;\n Arrays.sort(p);\n \n if((p[0] + p[1] > p[2]) && (p[0] + p[2] > p[1]) && (p[1] + p[2] > p[0])){\n System.out.println(\"0\");\n }\n else{\n if((p[0] + p[1] <= p[2])){\n System.out.println(p[2] - (p[0] + p[1]) + 1);\n }\n if((p[0] + p[2] <= p[1])){\n System.out.println(p[1] - (p[0] + p[2]) + 1);\n }\n if((p[1] + p[2] <= p[0])){\n System.out.println(p[0] - (p[1] + p[2]) + 1);\n }\n }\n \n \n \n }\n}", "lang": "Java 8", "bug_code_uid": "34967d46c23ac3862773549a1e86c655", "src_uid": "3dc56bc08606a39dd9ca40a43c452f09", "apr_id": "fc089bc683d0f81561e4b55df8494dac", "difficulty": 800, "tags": ["geometry", "math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9921809214483339, "equal_cnt": 8, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 7, "bug_source_code": "\nimport java.io.*;\nimport java.util.*;\nimport java.math.*;\n\npublic class Main { \n \n public static void main(String[] args) throws java.lang.Exception { \n Reader pm =new Reader(); \n //Scanner pm = new Scanner(new BufferedReader(new InputStreamReader(System.in)));\n int n = pm.nextInt();\n int[] a = new int[n];\n for(int i=0;i book = new HashSet<>();\n for(int i=0;i=0){\n a[i]--;\n }\n book.add(a[i]);\n while(a[i]-- > 0)\n sb.append(c);\n \n }\n //System.out.println(sb);\n System.out.println(sb.length());\n }\n \n static class Reader { \n final private int BUFFER_SIZE = 1 << 16; \n private DataInputStream din; \n private byte[] buffer; \n private int bufferPointer, bytesRead; \n \n public Reader() \n { \n din = new DataInputStream(System.in); \n buffer = new byte[BUFFER_SIZE]; \n bufferPointer = bytesRead = 0; \n } \n \n public Reader(String file_name) throws IOException \n { \n din = new DataInputStream(new FileInputStream(file_name)); \n buffer = new byte[BUFFER_SIZE]; \n bufferPointer = bytesRead = 0; \n } \n \n public String readLine() throws IOException \n { \n byte[] buf = new byte[64]; // line length \n int cnt = 0, c; \n while ((c = read()) != -1) \n { \n if (c == '\\n') \n break; \n buf[cnt++] = (byte) c; \n } \n return new String(buf, 0, cnt); \n } \n \n public int nextInt() throws IOException \n { \n int ret = 0; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n do\n { \n ret = ret * 10 + c - '0'; \n } while ((c = read()) >= '0' && c <= '9'); \n \n if (neg) \n return -ret; \n return ret; \n } \n \n public long nextLong() throws IOException \n { \n long ret = 0; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n do { \n ret = ret * 10 + c - '0'; \n } \n while ((c = read()) >= '0' && c <= '9'); \n if (neg) \n return -ret; \n return ret; \n } \n \n public double nextDouble() throws IOException \n { \n double ret = 0, div = 1; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n \n do { \n ret = ret * 10 + c - '0'; \n } \n while ((c = read()) >= '0' && c <= '9'); \n \n if (c == '.') \n { \n while ((c = read()) >= '0' && c <= '9') \n { \n ret += (c - '0') / (div *= 10); \n } \n } \n \n if (neg) \n return -ret; \n return ret; \n } \n \n private void fillBuffer() throws IOException \n { \n bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); \n if (bytesRead == -1) \n buffer[0] = -1; \n } \n \n private byte read() throws IOException \n { \n if (bufferPointer == bytesRead) \n fillBuffer(); \n return buffer[bufferPointer++]; \n } \n \n public void close() throws IOException \n { \n if (din == null) \n return; \n din.close(); \n } \n }\n} ", "lang": "Java 8", "bug_code_uid": "a1b5bedd103aafb7cd24640125df0357", "src_uid": "3c4b2d1c9440515bc3002eddd2b89f6f", "apr_id": "b175314fe991c61fa227a7e8a63508cd", "difficulty": 1100, "tags": ["greedy", "sortings"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9986463890437137, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\nimport static java.lang.Math.*;\nimport static java.util.Arrays.*;\n\npublic class CF327A {\n static BufferedReader __in;\n static PrintWriter __out;\n static StringTokenizer input;\n\n public static void main(String[] args) throws IOException {\n __in = new BufferedReader(new InputStreamReader(System.in));\n __out = new PrintWriter(new OutputStreamWriter(System.out));\n\n int n = ri();\n int[] a = ria(n);\n int cnt_1 = 0, flip_0 = 0, flip_max = -1;\n for(int i = 0; i < n; ++i) {\n if(a[i] == 1) {\n ++cnt_1;\n flip_0 = 0;\n }\n else {\n ++flip_0;\n flip_max = max(flip_max, flip_0);\n }\n }\n prln(cnt_1 + flip_max);\n\n close();\n }\n\n // references\n // IBIG = 1e9 + 7\n // IRAND ~= 3e8\n // IMAX ~= 2e10\n // LMAX ~= 9e18\n // constants\n static final int IBIG = 1000000007;\n static final int IRAND = 327859546;\n static final int IMAX = 2147483647;\n static final int IMIN = -2147483648;\n static final long LMAX = 9223372036854775807L;\n static final long LMIN = -9223372036854775808L;\n // util\n static int minof(int a, int b, int c) {return min(a, min(b, c));}\n static int minof(int... x) {return x.length == 1 ? x[0] : x.length == 2 ? min(x[0], x[1]) : min(x[0], minstarting(1, x));}\n static int minstarting(int offset, int... x) {assert x.length > 2; return offset == x.length - 2 ? min(x[offset], x[offset + 1]) : min(x[offset], minstarting(offset + 1, x));}\n static long minof(long a, long b, long c) {return min(a, min(b, c));}\n static long minof(long... x) {return x.length == 1 ? x[0] : x.length == 2 ? min(x[0], x[1]) : min(x[0], minstarting(1, x));}\n static long minstarting(int offset, long... x) {assert x.length > 2; return offset == x.length - 2 ? min(x[offset], x[offset + 1]) : min(x[offset], minstarting(offset + 1, x));}\n static int maxof(int a, int b, int c) {return max(a, max(b, c));}\n static int maxof(int... x) {return x.length == 1 ? x[0] : x.length == 2 ? max(x[0], x[1]) : max(x[0], maxstarting(1, x));}\n static int maxstarting(int offset, int... x) {assert x.length > 2; return offset == x.length - 2 ? max(x[offset], x[offset + 1]) : max(x[offset], maxstarting(offset + 1, x));}\n static long maxof(long a, long b, long c) {return max(a, max(b, c));}\n static long maxof(long... x) {return x.length == 1 ? x[0] : x.length == 2 ? max(x[0], x[1]) : max(x[0], maxstarting(1, x));}\n static long maxstarting(int offset, long... x) {assert x.length > 2; return offset == x.length - 2 ? max(x[offset], x[offset + 1]) : max(x[offset], maxstarting(offset + 1, x));}\n static int powi(int a, int b) {if(a == 0) return 0; int ans = 1; while(b > 0) {if((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}\n static long powl(long a, int b) {if(a == 0) return 0; long ans = 1; while(b > 0) {if((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}\n static int floori(double d) {return (int)d;}\n static int ceili(double d) {return (int)ceil(d);}\n static long floorl(double d) {return (long)d;}\n static long ceill(double d) {return (long)ceil(d);}\n // input\n static void r() throws IOException {input = new StringTokenizer(__in.readLine());}\n static int ri() throws IOException {return Integer.parseInt(__in.readLine());}\n static long rl() throws IOException {return Long.parseLong(__in.readLine());}\n static int[] ria(int n) throws IOException {int[] a = new int[n]; input = new StringTokenizer(__in.readLine()); for(int i = 0; i < n; ++i) a[i] = Integer.parseInt(input.nextToken()); return a;}\n static long[] rla(int n) throws IOException {long[] a = new long[n]; input = new StringTokenizer(__in.readLine()); for(int i = 0; i < n; ++i) a[i] = Long.parseLong(input.nextToken()); return a;}\n static char[] rcha() throws IOException {return __in.readLine().toCharArray();}\n static String rline() throws IOException {return __in.readLine();}\n static int rni() throws IOException {input = new StringTokenizer(__in.readLine()); return Integer.parseInt(input.nextToken());}\n static int ni() {return Integer.parseInt(input.nextToken());}\n static long rnl() throws IOException {input = new StringTokenizer(__in.readLine()); return Long.parseLong(input.nextToken());}\n static long nl() {return Long.parseLong(input.nextToken());}\n // output\n static void pr(int i) {__out.print(i);}\n static void prln(int i) {__out.println(i);}\n static void pr(long l) {__out.print(l);}\n static void prln(long l) {__out.println(l);}\n static void pr(double d) {__out.print(d);}\n static void prln(double d) {__out.println(d);}\n static void pr(char c) {__out.print(c);}\n static void prln(char c) {__out.println(c);}\n static void pr(char[] s) {__out.print(new String(s));}\n static void prln(char[] s) {__out.println(new String(s));}\n static void pr(String s) {__out.print(s);}\n static void prln(String s) {__out.println(s);}\n static void pr(Object o) {__out.print(o);}\n static void prln(Object o) {__out.println(o);}\n static void prln() {__out.println();}\n static void pryes() {__out.println(\"yes\");}\n static void pry() {__out.println(\"Yes\");}\n static void prY() {__out.println(\"YES\");}\n static void prno() {__out.println(\"no\");}\n static void prn() {__out.println(\"No\");}\n static void prN() {__out.println(\"NO\");}\n static void pryesno(boolean b) {__out.println(b ? \"yes\" : \"no\");}\n static void pryn(boolean b) {__out.println(b ? \"Yes\" : \"No\");}\n static void prYN(boolean b) {__out.println(b ? \"YES\" : \"NO\");}\n static void prln(int... a) {for(int i = 0, len = a.length - 1; i < len; __out.print(a[i]), __out.print(' '), ++i); __out.println(a[a.length - 1]);}\n static void prln(long... a) {for(int i = 0, len = a.length - 1; i < len; __out.print(a[i]), __out.print(' '), ++i); __out.println(a[a.length - 1]);}\n static void prln(Collection c) {int n = c.size() - 1; Iterator iter = c.iterator(); for(int i = 0; i < n; __out.print(iter.next()), __out.print(' '), ++i); __out.println(iter.next());}\n static void flush() {__out.flush();}\n static void close() {__out.close();}}", "lang": "Java 11", "bug_code_uid": "610e87d8630299db07e66edc20080949", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "apr_id": "207a713a0a0b4b4a24dc828a64ea7f94", "difficulty": 1200, "tags": ["dp", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.989100817438692, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner; // this is a way we use to get an input from the user .. we import a scanner that is already built in java .. and we write it before our class.\npublic class main {\n \n public static void main(String args[]){ //method header\n \n \n //System.out.println(\"hello world !!\"); //method type ... the both create the method we need .\n\n Scanner haha=new Scanner(System.in);\n int h, g;\n h=haha.nextInt();\n g=haha.nextInt();\n int a=0 , b=0;\n if(h>g){\n \n b=(h-g)/2;\n a=g;}\n else{\n b=(g-h)/2;\n a=h;}\n System.out.print(a);\n System.out.print(\" \");\n System.out.print(b);\n", "lang": "Java 7", "bug_code_uid": "094d6d9e72e59eec3ab77f61378051a3", "src_uid": "775766790e91e539c1cfaa5030e5b955", "apr_id": "c3a96ba81ccc39de9229c62568643281", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9975429975429976, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*;\n//import java.util.*;\n\npublic class A581 {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n PrintWriter out = new PrintWriter(System.out);\n int a = in.nextInt();\n int b = in.nextInt();\n int c;\n if (a < b) {\n out.println(a+\" \"+((b-a)/2));\n } else {\n out.println(b+\" \"+((a-b)/2));\n } \n out.close();\n }\n} \n \n ", "lang": "Java 7", "bug_code_uid": "81754ce1b8250b04bfe462f7d52606e0", "src_uid": "775766790e91e539c1cfaa5030e5b955", "apr_id": "c29b5016432ba2fb3f92fc0546276acf", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9881141045958796, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 4, "bug_source_code": "/*\n * To change this template, choose Tools | Templates\n * and open the template in the editor.\n */\n\nimport java.util.Scanner;\n\n/**\n *\n * @author tino\n */\npublic class SpecialTask {\n\n /**\n * @param args the command line arguments\n */\n public static void main(String[] args) {\n Scanner input = new Scanner(System.in);\n String x = input.next();\n boolean bol[] = new boolean[10];\n int s;\n int total = 1;\n if ( x.charAt(0)-48< 10 ) \n s = 10;\n else \n s = 9;\n \n for (int i = 0; i < x.length(); i++) {\n int value = x.charAt(i);\n if (i == 0 && s == 9) {\n total = total * 9;\n bol[value-65] = true;\n } else {\n if (65 <= value && 75 >= value && bol[value-65] == false) {\n bol[value - 65] = true;\n total = total * s;\n s--;\n } \n else if (value == '?' && i>0) {\n total = total * 10;\n }\n else if(value == '?' && i==0)\n total= total*9; \n }\n }\n System.out.println(total);\n\n }\n }\n", "lang": "Java 7", "bug_code_uid": "ed9828a4137c8e71ef83faf0804b9aa8", "src_uid": "d3c10d1b1a17ad018359e2dab80d2b82", "apr_id": "fbd36a74092b956909fe110f0d21b8c9", "difficulty": 1100, "tags": ["greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6197558580047706, "equal_cnt": 27, "replace_cnt": 19, "delete_cnt": 1, "insert_cnt": 6, "fix_ops_cnt": 26, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.File;\nimport java.io.FileInputStream;\nimport java.io.FileNotFoundException;\nimport java.io.FileOutputStream;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.math.BigInteger;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.BitSet;\nimport java.util.Calendar;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.LinkedList;\nimport java.util.PriorityQueue;\nimport java.util.SortedSet;\nimport java.util.Stack;\nimport java.util.StringTokenizer;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\n\n/**\n * #\n * \n * @author pttrung\n */\npublic class D_Round_51 {\n\n\tpublic static long MOD = 1000000007;\n\n\tpublic static void main(String[] args) throws FileNotFoundException {\n\t\t// PrintWriter out = new PrintWriter(new FileOutputStream(new File(\n\t\t// \"output.txt\")));\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tScanner in = new Scanner();\n\t\tint t = in.nextInt();\n\t\tlong[][][][][] dp = new long[2][2][2][2521][(1 << 10)];\n\t\tint[][][][] check = new int[2][2][2521][(1<<10)];\n\t\tint cached = 0;\n\t\tfor (int z = 0; z < t; z++) {\n\t\t\tlong l = in.nextLong();\n\t\t\tlong r = in.nextLong();\n\t\t\tlong result = 0;\n\t\t\tfor (int i = 0; i < (1 << 10); i++) {\n\t\t\t\tint lcm = 1;\n\t\t\t\tfor (int j = 1; j < 10; j++) {\n\t\t\t\t\tif (((1 << j) & i) != 0) {\n\t\t\t\t\t\tlcm = (int) (lcm * j / gcd(lcm, j));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//System.out.println(lcm);\n\n\t\t\t\tdp[0][0][0][0][0] = 1;\n\t\t\t\tLinkedList q = new LinkedList();\n\t\t\t\tq.add(new State(0, 0, 0, 0));\n\n\t\t\t\tint cur = 1;\n\t\t\t\tfor (int j = 19; j >= 0; j--) {\n\t\t\t\t\tcached++;\n\t\t\t\t\tLinkedList nxt = new LinkedList();\n\n\t\t\t\t\tint a = get(j, l);\n\t\t\t\t\tint b = get(j, r);\n\t\t\t\t\twhile (!q.isEmpty()) {\n\t\t\t\t\t\tState s = q.poll();\n\t\t\t\t\t\tfor (int k = 0; k < 10; k++) {\n\t\t\t\t\t\t\tif (((1 << k) & i) != 0) {\n\t\t\t\t\t\t\t\tif (k >= a || s.l == 1) {\n\t\t\t\t\t\t\t\t\tif (k <= b || s.s == 1) {\n\t\t\t\t\t\t\t\t\t\tint tmp = (s.mod*10 + k) % lcm;\n\t\t\t\t\t\t\t\t\t\tint y = k > a ? 1 : s.l;\n\t\t\t\t\t\t\t\t\t\tint x = k < b ? 1 : s.s;\n\t\t\t\t\t\t\t\t\t\tint u = (1 << k) | s.u;\n\t\t\t\t\t\t\t\t\t\tif (check[x][y][tmp][u] != cached) {\n\t\t\t\t\t\t\t\t\t\t\tcheck[x][y][tmp][u] = cached;\n\t\t\t\t\t\t\t\t\t\t\tdp[cur][x][y][tmp][u] = 0;\n\t\t\t\t\t\t\t\t\t\t\tnxt.add(new State(x, y, tmp, u));\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tdp[cur][x][y][tmp][u] += dp[1 - cur][s.s][s.l][s.mod][s.u];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tq = nxt;\n\t\t\t\t\tif (j == 0) {\n\t\t\t\t\t\tfor (State v : q) {\n\t\t\t\t\t\t\tif (v.mod == 0 && v.u == i) {\n\t\t\t\t\t\t\t\tresult += dp[cur][v.s][v.l][v.mod][v.u];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcur = 1 - cur;\n\t\t\t\t}\n\t\t\t}\n\t\t\tout.println(result);\n\t\t}\n\t\tout.close();\n\t}\n\n\tstatic class State {\n\t\tint s, l, mod, u;\n\n\t\tpublic State(int s, int l, int mod, int u) {\n\t\t\tsuper();\n\t\t\tthis.s = s;\n\t\t\tthis.l = l;\n\t\t\tthis.mod = mod;\n\t\t\tthis.u = u;\n\t\t}\n\n\t}\n\n\tpublic static int get(int digit, long v) {\n\t\tfor (int i = 0; i < digit; i++) {\n\t\t\tv /= 10;\n\t\t}\n\t\treturn (int) v % 10;\n\t}\n\n\tpublic static int[] KMP(String val) {\n\t\tint i = 0;\n\t\tint j = -1;\n\t\tint[] result = new int[val.length() + 1];\n\t\tresult[0] = -1;\n\t\twhile (i < val.length()) {\n\t\t\twhile (j >= 0 && val.charAt(j) != val.charAt(i)) {\n\t\t\t\tj = result[j];\n\t\t\t}\n\t\t\tj++;\n\t\t\ti++;\n\t\t\tresult[i] = j;\n\t\t}\n\t\treturn result;\n\n\t}\n\n\tpublic static boolean nextPer(int[] data) {\n\t\tint i = data.length - 1;\n\t\twhile (i > 0 && data[i] < data[i - 1]) {\n\t\t\ti--;\n\t\t}\n\t\tif (i == 0) {\n\t\t\treturn false;\n\t\t}\n\t\tint j = data.length - 1;\n\t\twhile (data[j] < data[i - 1]) {\n\t\t\tj--;\n\t\t}\n\t\tint temp = data[i - 1];\n\t\tdata[i - 1] = data[j];\n\t\tdata[j] = temp;\n\t\tArrays.sort(data, i, data.length);\n\t\treturn true;\n\t}\n\n\tpublic static int digit(long n) {\n\t\tint result = 0;\n\t\twhile (n > 0) {\n\t\t\tn /= 10;\n\t\t\tresult++;\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic static double dist(long a, long b, long x, long y) {\n\t\tdouble val = (b - a) * (b - a) + (x - y) * (x - y);\n\t\tval = Math.sqrt(val);\n\t\tdouble other = x * x + a * a;\n\t\tother = Math.sqrt(other);\n\t\treturn val + other;\n\n\t}\n\n\tpublic static class Point implements Comparable {\n\n\t\tint x, y;\n\n\t\tpublic Point(int start, int end) {\n\t\t\tthis.x = start;\n\t\t\tthis.y = end;\n\t\t}\n\n\t\t@Override\n\t\tpublic int hashCode() {\n\t\t\tint hash = 5;\n\t\t\thash = 47 * hash + this.x;\n\t\t\thash = 47 * hash + this.y;\n\t\t\treturn hash;\n\t\t}\n\n\t\t@Override\n\t\tpublic boolean equals(Object obj) {\n\t\t\tif (obj == null) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (getClass() != obj.getClass()) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tfinal Point other = (Point) obj;\n\t\t\tif (this.x != other.x) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (this.y != other.y) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(Point o) {\n\t\t\treturn x - o.x;\n\t\t}\n\t}\n\n\tpublic static class FT {\n\n\t\tlong[] data;\n\n\t\tFT(int n) {\n\t\t\tdata = new long[n];\n\t\t}\n\n\t\tpublic void update(int index, long value) {\n\t\t\twhile (index < data.length) {\n\t\t\t\tdata[index] += value;\n\t\t\t\tindex += (index & (-index));\n\t\t\t}\n\t\t}\n\n\t\tpublic long get(int index) {\n\t\t\tlong result = 0;\n\t\t\twhile (index > 0) {\n\t\t\t\tresult += data[index];\n\t\t\t\tindex -= (index & (-index));\n\t\t\t}\n\t\t\treturn result;\n\n\t\t}\n\t}\n\n\tpublic static long gcd(long a, long b) {\n\t\tif (b == 0) {\n\t\t\treturn a;\n\t\t}\n\t\treturn gcd(b, a % b);\n\t}\n\n\tpublic static long pow(long a, long b) {\n\t\tif (b == 0) {\n\t\t\treturn 1;\n\t\t}\n\t\tif (b == 1) {\n\t\t\treturn a;\n\t\t}\n\t\tlong val = pow(a, b / 2);\n\t\tif (b % 2 == 0) {\n\t\t\treturn val * val % MOD;\n\t\t} else {\n\t\t\treturn val * (val * a % MOD) % MOD;\n\n\t\t}\n\t}\n\n\tstatic class Scanner {\n\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tpublic Scanner() throws FileNotFoundException {\n\t\t\t// System.setOut(new PrintStream(new\n\t\t\t// BufferedOutputStream(System.out), true));\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t\t// br = new BufferedReader(new InputStreamReader(new\n\t\t\t// FileInputStream(new File(\"input.txt\"))));\n\t\t}\n\n\t\tpublic String next() {\n\n\t\t\twhile (st == null || !st.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tthrow new RuntimeException();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic double nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tpublic String nextLine() {\n\t\t\tst = null;\n\t\t\ttry {\n\t\t\t\treturn br.readLine();\n\t\t\t} catch (Exception e) {\n\t\t\t\tthrow new RuntimeException();\n\t\t\t}\n\t\t}\n\n\t\tpublic boolean endLine() {\n\t\t\ttry {\n\t\t\t\tString next = br.readLine();\n\t\t\t\twhile (next != null && next.trim().isEmpty()) {\n\t\t\t\t\tnext = br.readLine();\n\t\t\t\t}\n\t\t\t\tif (next == null) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tst = new StringTokenizer(next);\n\t\t\t\treturn st.hasMoreTokens();\n\t\t\t} catch (Exception e) {\n\t\t\t\tthrow new RuntimeException();\n\t\t\t}\n\t\t}\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "eedc723a48d0e4b464f7f21a1c1781ce", "src_uid": "37feadce373f728ba2a560b198ca4bc9", "apr_id": "e0aba2544ee26bf22e4961451bb72f7a", "difficulty": 2500, "tags": ["dp", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9984149906660561, "equal_cnt": 10, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 9, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.lang.reflect.Array;\nimport java.math.BigInteger;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.BitSet;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.LinkedHashSet;\nimport java.util.LinkedList;\nimport java.util.Map.Entry;\nimport java.util.PriorityQueue;\nimport java.util.Queue;\nimport java.util.Random;\nimport java.util.Stack;\nimport java.util.StringTokenizer;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\n\n// WeekOfCode21\n\npublic class Solution {\n\tpublic static InputReader in;\n\tpublic static PrintWriter out;\n\tpublic static Random ra = new Random(0);\n\n\tpublic static void main(String[] args) {\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tin = new InputReader(inputStream);\n//\t\tout = new PrintWriter(outputStream, true);\n\t\tout = new PrintWriter(outputStream, false); // enable this for ludicrous speed\n\n\t\tbeautifulNumbers();\n//\t\ttestBM();\n//\t\tborrowingMoney();\n//\t\tlazySorting();\n//\t\ttestLazySorting();\n//\t\tluckBalance();\n//\t\tkangaroo();\n\n\t\tout.close();\n\t}\n\n\tstatic void beautifulNumbers() {\n\t\tint cnt = 0;\n\t\tfor(int i=1; i<=MOD; i++)\n\t\t\tif(MOD%i == 0)\n\t\t\t\tHash[i] = cnt++;\n\n\t\tfor(int i=0; i < dp.length; i++) {\n\t\t\tfor(int j=0; j < dp[0].length; j++) {\n\t\t\t\tArrays.fill(dp[i][j], -1);\n\t\t\t}\n\t\t}\n\n\t\tint ts = in.nextInt();\n\t\tfor (int t = 0; t < ts; t++) {\n\t\t\tlong a = in.nextInt();\n\t\t\tlong b = in.nextInt();\n\t\t\tSystem.out.println((solve(b) - solve(a-1)));\n\t\t}\n\t}\n\n\tstatic final int MOD = 2520;\n\tstatic long[][][] dp = new long[20][50][2550];\n\tstatic int[] dis = new int[20];\n\tstatic int[] Hash = new int[2550];\n\n\tstatic long gcd(long a, long b) {\n\t\treturn b != 0 ? gcd(b,a%b) : a;\n\t}\n\n\tstatic long dfs(int len, int num, int lcm, boolean flag) {\n\t\tif(-1==len) return (num%lcm == 0) ? 1: 0;\n\t\tif(!flag && -1!=dp[len][Hash[lcm]][num]) {\n\t\t\treturn dp[len][Hash[lcm]][num];\n\t\t}\n\t\tlong ans = 0;\n\t\tint end = flag?dis[len]:9;\n\t\tfor(int i=0; i<=end; i++)\n\t\t\tans += dfs(len-1, (num*10+i)%MOD, (int)(i > 0 ? lcm*i/gcd(lcm,i) : lcm), flag && i==end);\n\t\tif(!flag) dp[len][Hash[lcm]][num] = ans;\n\t\treturn ans;\n\t}\n\n\tstatic long solve(long n) {\n\t\tint pos = 0;\n\t\twhile(n > 0) {\n\t\t\tdis[pos++] = (int)n%10;\n\t\t\tn /= 10;\n\t\t}\n\t\treturn dfs(pos-1, 0, 1, true);\n\t}\n\n\tpublic static void testBM() {\n\t\tlong t1 = System.currentTimeMillis();\n\t\tfor (int test = 0; test < 1000000; test++) {\n\t\t\tint N = ra.nextInt(10)+1;\n\t\t\tint M = ra.nextInt(N*(N-1)/2 +1);\n\t\t\tboolean[][] g = new boolean[N][N];\n\t\t\tint[] cost = new int[N];\n\t\t\tfor (int i = 0; i < cost.length; i++) {\n\t\t\t\tcost[i] = ra.nextInt(100);\n\t\t\t}\n\t\t\tfor (int i = 0; i < M && N > 1; i++) {\n\t\t\t\tint a = ra.nextInt(N);\n\t\t\t\tint b = ra.nextInt(N);\n\t\t\t\twhile (a == b) {\n\t\t\t\t\ta = ra.nextInt(N);\n\t\t\t\t\tb = ra.nextInt(N);\n\t\t\t\t}\n\t\t\t\tg[a][b] = true;\n\t\t\t\tg[b][a] = true;\n\t\t\t}\n\t\t\tString r1 = borrowingMoneySlow(N, g, cost);\n\t\t\tString r2 = borrowingMoney(N, g, cost);\n\t\t\tif (!r1.equals(r2)) {\n\t\t\t\tSystem.out.println(\"fail\");\n\t\t\t\tborrowingMoneySlow(N, g, cost);\n\t\t\t\tborrowingMoney(N, g, cost);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(System.currentTimeMillis() - t1);\n\t}\n\n\tpublic static void borrowingMoney() {\n\t\tint N = 0;\n\t\tboolean[][] g;\n\t\tint[] cost;\n\n\t\tN = in.nextInt();\n\t\tint m = in.nextInt();\n\t\tcost = in.nextIntArray(N);\n\t\tg = new boolean[N][N];\n\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tint a = in.nextInt()-1;\n\t\t\tint b = in.nextInt()-1;\n\t\t\tg[a][b] = true;\n\t\t\tg[b][a] = true;\n\t\t}\n\n\t\tSystem.out.println(borrowingMoney(N, g, cost));\n//\t\tSystem.out.println(borrowingMoneySlow(N, g, cost));\n\n\t}\n\n\tpublic static String borrowingMoneySlow(int ns, boolean[][] g, int[] cost) {\n\t\tint len = ns;\n\t\tint N = 1 << len;\n\t\tint[] costF = new int[100*35 +1];\n\t\tfor (int n = 0; n < N; n++) {\n\t\t\tboolean[] active = new boolean[len];\n\t\t\tfor (int i = 0; i < len; i++) {\n\t\t\t\tif (((1 << i) & n) != 0) {\n\t\t\t\t\tactive[i] = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tint sum = 0;\n\t\t\tboolean v = true;\n\t\t\tfor (int i = 0; i < ns; i++) {\n\t\t\t\tif (!active[i]) {\n\t\t\t\t\tfor (int j = 0; j < ns; j++) {\n\t\t\t\t\t\tif (g[i][j] && !active[j]) {\n\t\t\t\t\t\t\tv = false;\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\tsum += cost[i];\n\t\t\t\t}\n\t\t\t\tif (!v) {\n\t\t\t\t\tif (i >= 1) {\n\t\t\t\t\t\tSystem.currentTimeMillis();\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (v) {\n\t\t\t\tcostF[sum]++;\n\t\t\t}\n\t\t}\n\t\tfor (int i = costF.length-1; i >= 0; i--) {\n\t\t\tif (costF[i] > 0) {\n\t\t\t\treturn i + \" \" + costF[i];\n\t\t\t}\n\t\t}\n\t\treturn \"\";\n\t}\n\n\tpublic static String borrowingMoney(int N, boolean[][] g, int[] cost) {\n\t\tboolean[] visit;\n\t\tvisit = new boolean[N];\n\t\tHashMap F;\n\t\tF = new HashMap<>();\n\n\t\tlong mx = 0;\n\t\tlong tw = 1;\n\t\tfor (int p = 0; p < visit.length; p++) {\n\t\t\tif (!visit[p]) {\n\t\t\t\tF = new HashMap<>();\n\n\t\t\t\tQueue q = new LinkedList<>();\n\t\t\t\tq.add(p);\n\t\t\t\tboolean start = true;\n\n\t\t\t\twhile (!q.isEmpty()) {\n\t\t\t\t\tint top = q.poll();\n\n\t\t\t\t\tif (!visit[top]) {\n\t\t\t\t\t\tvisit[top] = true;\n\t\t\t\t\t\tHashMap current = F;\n\t\t\t\t\t\tHashMap oldF = new HashMap<>();\n\t\t\t\t\t\tfor (Entry e: current.entrySet()) {\n\t\t\t\t\t\t\toldF.put(e.getKey(), e.getValue());\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (start) {\n\t\t\t\t\t\t\tstart = false;\n\n\t\t\t\t\t\t\t// do nothing\n\t\t\t\t\t\t\tcurrent.put(0L, 0L);\n\n\t\t\t\t\t\t\t// steal here\n\t\t\t\t\t\t\tcurrent.put(1L << top, (long)cost[top]);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// steal here\n\n\t\t\t\t\t\t\tfor (Entry e: oldF.entrySet()) {\n\t\t\t\t\t\t\t\tif (!getBit(e.getKey(), top)) {\n\t\t\t\t\t\t\t\t\tboolean stillHere = true;\n\t\t\t\t\t\t\t\t\tfor (int i = 0; i < N; i++) {\n\t\t\t\t\t\t\t\t\t\t// top will have left if someone robbed next door\n\t\t\t\t\t\t\t\t\t\tif (g[top][i] && getBit(e.getKey(), i)) {\n\t\t\t\t\t\t\t\t\t\t\tstillHere = false;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (stillHere) {\n\t\t\t\t\t\t\t\t\t\tlong max = e.getValue();\n\t\t\t\t\t\t\t\t\t\tlong fmask = e.getKey() | 1L << top;\n\n\t\t\t\t\t\t\t\t\t\tif (max > -1) {\n\t\t\t\t\t\t\t\t\t\t\tmax += cost[top];\n\t\t\t\t\t\t\t\t\t\t\tif (!current.containsKey(fmask) || current.get(fmask) < max) {\n\t\t\t\t\t\t\t\t\t\t\t\tcurrent.put(fmask, max);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor (int i = 0; i < N; i++) {\n\t\t\t\t\t\t\tif (g[top][i]) {\n\t\t\t\t\t\t\t\tq.add(i);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// If all of a edge's neighbours have been visited, it's removed from the searchable set\n\t\t\t\t\t\t// and the maximum of all of them are added back because they cannot influence future\n\t\t\t\t\t\t// events.\n\n\t\t\t\t\t\tfor (Entry e: oldF.entrySet()) {\n\t\t\t\t\t\t\tif (!getBit(e.getKey(), top)) {\n\t\t\t\t\t\t\t\tboolean stillHere = true;\n\t\t\t\t\t\t\t\tfor (int i = 0; i < N; i++) {\n\t\t\t\t\t\t\t\t\t// top will have left if someone robbed next door\n\t\t\t\t\t\t\t\t\tif (g[top][i] && getBit(e.getKey(), i)) {\n\t\t\t\t\t\t\t\t\t\tstillHere = false;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (stillHere) {\n\t\t\t\t\t\t\t\t\tlong max = e.getValue();\n\t\t\t\t\t\t\t\t\tlong fmask = e.getKey() | 1L << top;\n\n\t\t\t\t\t\t\t\t\tif (max > -1) {\n\t\t\t\t\t\t\t\t\t\tmax += cost[top];\n\t\t\t\t\t\t\t\t\t\tif (!current.containsKey(fmask) || current.get(fmask) < max) {\n\t\t\t\t\t\t\t\t\t\t\tcurrent.put(fmask, max);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlong max = -1;\n\t\t\t\tfor (Entry e: F.entrySet()) {\n\t\t\t\t\tif (e.getValue() > max) {\n\t\t\t\t\t\tmax = e.getValue();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tlong ways = 0;\n\t\t\t\tfor (Entry e: F.entrySet()) {\n\t\t\t\t\tif (e.getValue() == max) {\n\t\t\t\t\t\tways++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmx += max;\n\t\t\t\ttw *= ways;\n\t\t\t}\n\t\t}\n\n\n\n\t\t//System.out.println(max + \" \" + ways + \" \" + Long.toBinaryString(fmask));\n\n\t\treturn (mx + \" \" + tw);\n\t}\n\n\tpublic static String borrowingMoney2(int N, boolean[][] g, int[] cost) {\n\t\tboolean[] visit;\n\t\tvisit = new boolean[N];\n\t\tHashMap F;\n\t\tF = new HashMap<>();\n\n\t\tlong mx = 0;\n\t\tlong tw = 1;\n\t\tfor (int i = 0; i < visit.length; i++) {\n\t\t\tif (!visit[i]) {\n\t\t\t\tF = new HashMap<>();\n\n\t\t\t\tdfs(true, i, N, g, visit, cost, F);\n\n\t\t\t\tlong max = -1;\n\t\t\t\tlong fmask = 0;\n\t\t\t\tfor (Entry e: F.entrySet()) {\n\t\t\t\t\tif (e.getValue() > max) {\n\t\t\t\t\t\tmax = e.getValue();\n\t\t\t\t\t\tfmask = e.getKey();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tlong ways = 0;\n\t\t\t\tfor (Entry e: F.entrySet()) {\n\t\t\t\t\tif (e.getValue() == max) {\n\t\t\t\t\t\tways++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmx += max;\n\t\t\t\ttw *= ways;\n\t\t\t}\n\t\t}\n\n\n\n\t\t//System.out.println(max + \" \" + ways + \" \" + Long.toBinaryString(fmask));\n\n\t\treturn (mx + \" \" + tw);\n\t}\n\n\n\tpublic static void dfs(boolean start, int top, int N, boolean[][] g, boolean[] visit, int[] cost, HashMap F) {\n\t\tif (!visit[top]) {\n\t\t\tvisit[top] = true;\n\t\t\tHashMap current = F;\n\t\t\tHashMap oldF = new HashMap<>();\n\t\t\tfor (Entry e: current.entrySet()) {\n\t\t\t\toldF.put(e.getKey(), e.getValue());\n\t\t\t}\n\t\t\tif (start) {\n\n\t\t\t\t// do nothing\n\t\t\t\tcurrent.put(0L, 0L);\n\n\t\t\t\t// steal here\n\t\t\t\tlong fmask = 0;\n\t\t\t\tfor (int i = 0; i < N; i++) {\n\t\t\t\t\tif (g[top][i]) {\n\t\t\t\t\t\tfmask |= 1L << i;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcurrent.put(fmask, (long)cost[top]);\n\t\t\t} else {\n\t\t\t\t// steal here\n\n\t\t\t\tfor (Entry e: oldF.entrySet()) {\n\t\t\t\t\tif (!getBit(e.getKey(), top)) {\n\t\t\t\t\t\tlong max = e.getValue();\n\t\t\t\t\t\tlong fmask = e.getKey();\n\n\t\t\t\t\t\tfor (int i = 0; i < N; i++) {\n\t\t\t\t\t\t\tif (g[top][i]) {\n\t\t\t\t\t\t\t\tfmask |= 1L << i;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (max > -1) {\n\t\t\t\t\t\t\tmax += cost[top];\n\t\t\t\t\t\t\tif (!current.containsKey(fmask) || current.get(fmask) < max) {\n\t\t\t\t\t\t\t\tcurrent.put(fmask, max);\n\t\t\t\t\t\t\t}\n//\t\t\t\t\t\t\tif (current.get(fmask) == max) {\n//\t\t\t\t\t\t\t\tcurrent.put(fmask, max);\n//\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (int i = 0; i < N; i++) {\n\t\t\t\tif (g[top][i]) {\n\t\t\t\t\tdfs(false, i, N, g, visit, cost, F);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static int clearBit(int x, int i) {\n\t\treturn (x & ~(1 << i));\n\t}\n\n\tpublic static int setBit(int x, int i) {\n\t\treturn (x | (1 << i));\n\t}\n\n\tpublic static boolean getBit(long x, int i) {\n\t\treturn (x & (1L << i)) != 0;\n\t}\n\n\tpublic static void testLazySorting() {\n\t\tint[] a = new int[4];\n\t\tfor (int i = 0; i < 10; i++) {\n\t\t\tfor (int j = 0; j < a.length; j++) {\n\t\t\t\ta[j] = ra.nextInt(10);\n\t\t\t}\n\t\t\tdouble r1 = slowLazySorting(a.length, a);\n\t\t\tdouble r2 = lazySorting(a.length, a);\n\t\t\tint t = 0;\n\t\t\twhile (Math.abs(r1 - r2) > 0.1 && t < 10) {\n\t\t\t\tt++;\n\t\t\t\tr1 = slowLazySorting(a.length, a);\n\t\t\t\tr2 = lazySorting(a.length, a);\n\t\t\t}\n\t\t\tif (t == 10) {\n\t\t\t\tSystem.out.println(\"fail\");\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static void lazySorting() {\n\t\tint n = in.nextInt();\n\t\tint[] a = in.nextIntArray(n);\n\t\tSystem.out.println(String.format(\"%.6f\", lazySorting(n, a)));\n//\t\tSystem.out.println(String.format(\"%.6f\", slowLazySorting(n, a)));\n\t}\n\n\tpublic static double slowLazySorting(int n, int[] a) {\n\t\tArrayList b = new ArrayList<>();\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\tb.add(a[i]);\n\t\t}\n\t\tArrays.sort(a);\n\t\tint sum = 0;\n\t\tint games = 1000000;\n\t\tfor (int i = 0; i < games; i++) {\n\t\t\tboolean wrong = false;\n\t\t\tint time = 0;\n\n\t\t\tfor (int j = 0; j < a.length; j++) {\n\t\t\t\tif (a[j] != b.get(j)) {\n\t\t\t\t\twrong = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\twhile (wrong) {\n\t\t\t\twrong = false;\n\t\t\t\ttime++;\n\t\t\t\tCollections.shuffle(b);\n\t\t\t\tfor (int j = 0; j < a.length; j++) {\n\t\t\t\t\tif (a[j] != b.get(j)) {\n\t\t\t\t\t\twrong = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!wrong) {\n\t\t\t\t\tsum += time;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn sum / (double)games;\n\t}\n\n\n\tpublic static double lazySorting(int n, int[] a) {\n\t\tint[] f = new int[101];\n\t\tint[] b = a.clone();\n\t\tArrays.sort(b);\n\t\tif (Arrays.equals(a, b)) {\n\t\t\treturn 0;\n\t\t}\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\tf[a[i]]++;\n\t\t}\n\t\tlong c = 1;\n\t\tfor (int i = 1; i <= n; i++) {\n\t\t\tc *= i;\n\t\t}\n\t\tfor (int i = 0; i < f.length; i++) {\n\t\t\twhile (f[i] > 0) {\n\t\t\t\tc /= f[i];\n\t\t\t\tf[i]--;\n\t\t\t}\n\t\t}\n\t\tdouble p = 1.0/c;\n\t\treturn 1/p;\n\t}\n\n\tpublic static void luckBalance() {\n\t\tint n = in.nextInt();\n\t\tint k = in.nextInt();\n\t\tint[] luck = new int[n];\n\t\tint[] imp = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tluck[i] = in.nextInt();\n\t\t\timp[i] = in.nextInt();\n\t\t}\n\t\tSystem.out.println(luckBalance(n, k, luck, imp));\n\t}\n\n\tpublic static long luckBalance(int n, int k, int[] luck, int[] imp) {\n\t\tArrayList important = new ArrayList<>();\n\t\tlong balance = 0;\n\t\tfor (int i = 0; i < imp.length; i++) {\n\t\t\tif (imp[i] == 1) {\n\t\t\t\timportant.add(luck[i]);\n\t\t\t} else {\n\t\t\t\tbalance += luck[i];\n\t\t\t}\n\t\t}\n\t\tCollections.sort(important);\n\t\tCollections.reverse(important);\n\t\tfor (int i = 0; i < important.size(); i++) {\n\t\t\tif (i < k) {\n\t\t\t\tbalance += important.get(i);\n\t\t\t} else {\n\t\t\t\tbalance -= important.get(i);\n\t\t\t}\n\t\t}\n\t\treturn balance;\n\t}\n\n\tpublic static void kangaroo() {\n\t\tint x1 = in.nextInt();\n\t\tint v1 = in.nextInt();\n\t\tint x2 = in.nextInt();\n\t\tint v2 = in.nextInt();\n\t\tif (kangaroo(x1, v1, x2, v2)) {\n\t\t\tSystem.out.println(\"YES\");\n\t\t} else {\n\t\t\tSystem.out.println(\"NO\");\n\t\t}\n\t}\n\n\tpublic static boolean kangaroo(int x1, int v1, int x2, int v2) {\n\t\tint dx = x1-x2;\n\t\tint dv = v2-v1;\n\t\tif (dv == 0) {\n\t\t\treturn dx == 0;\n\t\t}\n\t\tif (((Math.abs(dx) % Math.abs(dv)) == 0) && dx / (double)dv > 0) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t@SuppressWarnings(\"serial\")\n\tpublic static class Counter extends HashMap {\n\t\tpublic Counter() {\n\t\t\tsuper();\n\t\t}\n\t\tpublic void add(T key) {\n\t\t\tthis.add(key, 1);\n\t\t}\n\t\tpublic void add(T key, int count) {\n\t\t\tInteger i = this.get(key);\n\t\t\tif (i == null) {\n\t\t\t\tthis.put(key, count);\n\t\t\t} else {\n\t\t\t\tthis.put(key, i+count);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static class InputReader {\n\t\tpublic BufferedReader reader;\n\t\tpublic StringTokenizer tokenizer;\n\n\t\tpublic InputReader(InputStream stream) {\n\t\t\treader = new BufferedReader(new InputStreamReader(stream), 32768);\n\t\t\ttokenizer = null;\n\t\t}\n\n\t\tpublic String next() {\n\t\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn tokenizer.nextToken();\n\t\t}\n\n\t\tpublic int nextInt() {return Integer.parseInt(next());}\n\t\tpublic long nextLong() {return Long.parseLong(next());}\n\t\tpublic double nextDouble() {return Double.parseDouble(next());}\n\t\tpublic long[] nextLongArray(int n) {\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < a.length; i++) a[i] = this.nextLong();\n\t\t\treturn a;\n\t\t}\n\t\tpublic int[] nextIntArray(int n) {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < a.length; i++) a[i] = this.nextInt();\n\t\t\treturn a;\n\t\t}\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "5a437e43ae9097323af9615398dc5e46", "src_uid": "37feadce373f728ba2a560b198ca4bc9", "apr_id": "3f25aad709c86fcaa56e2d1216e0b156", "difficulty": 2500, "tags": ["dp", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9965005832361273, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\nimport java.io.BufferedReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n * @author Zyflair Griffane\n */\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tPandaScanner in = new PandaScanner(inputStream);\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\tD solver = new D();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass D {\n final int MAX = 2520;\n long[][][] memo = new long[19][48][MAX];\n int[] idx = new int[MAX + 1];\n int[] digit = new int[19];\n public void solve(int testNumber, PandaScanner in, PrintWriter out) {\n\n for (int i = 0; i < 19; i++) {\n for (int j = 0; j < 48; j++) {\n Arrays.fill(memo[i][j], -1);\n }\n }\n for (int i = 1; i < MAX + 1; i++) {\n idx[i] = idx[i - 1] + (MAX % i == 0 ? 1 : 0);\n }\n\n int t = in.nextInt();\n for (int i = 0; i < t; i++) {\n long l = in.nextLong();\n long r = in.nextLong();\n out.println(getBeautiful(r) - getBeautiful(l - 1));\n }\n }\n\n public long getBeautiful(long x) {\n int length = 0;\n for (; x > 0; length++) {\n digit[length] = (int) (x % 10);\n x /= 10;\n }\n return recurse(length - 1, 1, 0, false);\n }\n\n public long recurse(int pow, int lcm, int mod, boolean under) {\n if (pow == -1) {\n return mod % lcm == 0 ? 1 : 0;\n }\n if (under && memo[pow][idx[lcm]][mod] > -1) {\n return memo[pow][idx[lcm]][mod];\n }\n int limit = under ? 9 : digit[pow];\n long res = 0;\n for (int i = 0; i <= limit; i++) {\n res += recurse(pow - 1, i < 2 ? lcm : (i * lcm / gcd(i, lcm)), (mod * 10 + i) % MAX, under || i < limit);\n }\n return under ? memo[pow][idx[lcm]][mod] = res : res;\n }\n\n public int gcd(int a, int b) {\n return b == 0 ? a : gcd(b, a % b);\n }\n}\n\nclass PandaScanner {\n public BufferedReader br;\n public StringTokenizer st;\n public InputStream in;\n\n public PandaScanner(InputStream in) {\n br = new BufferedReader(new InputStreamReader(this.in = in));\n }\n\n public String nextLine() {\n try {\n return br.readLine();\n }\n catch (Exception e) {\n return null;\n }\n }\n\n public String next() {\n if (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(nextLine().trim());\n return next();\n }\n return st.nextToken();\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n }\n\n", "lang": "Java 6", "bug_code_uid": "b9f51e581d3949a1a8b4db804c5653da", "src_uid": "37feadce373f728ba2a560b198ca4bc9", "apr_id": "4af504350ae94800b0175c49bf18f2dc", "difficulty": 2500, "tags": ["dp", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.4597489346999885, "equal_cnt": 42, "replace_cnt": 34, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 41, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport static java.lang.Math.*;\nimport static java.util.Arrays.fill;\nimport static java.util.Arrays.binarySearch;\nimport static java.util.Arrays.sort;\n\npublic class Main {\n\tpublic static void main(String[] args) throws IOException {\n\t\tnew Thread(null, new Runnable() {\n\t\t\tpublic void run() {\n\t\t\t\ttry {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (new File(\"input.txt\").exists())\n\t\t\t\t\t\t\tSystem.setIn(new FileInputStream(\"input.txt\"));\n\t\t\t\t\t} catch (SecurityException e) {}\n\t\t\t\t\tnew Main().run();\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t}, \"1\", 1L << 24).start(); \n\t}\n\n\tBufferedReader in;\n\tPrintWriter out;\n\tStringTokenizer st = new StringTokenizer(\"\");\n\t\n\tint LCM = 5 * 7 * 8 * 9;\n\tint MAXL = 18;\n\tint MAXM = 1 << 8;\n\tlong[] pow10 = new long [MAXL + 1];\n\tint[] lcm = new int [MAXM];\n\tlong[][][] dp = new long [MAXL + 1][LCM][MAXM];\n\tlong[] count = new long [MAXL + 1];\n\tlong[][] cnt = new long [10][MAXL + 1];\n\t\n\tvoid run() throws IOException {\n\t\tpow10[0] = 1L;\n\t\tfor (int l = 1; l < MAXL; l++)\n\t\t\tpow10[l] = pow10[l - 1] * 10L;\n\t\tfor (int i = 0; i < MAXM; i++)\n\t\t\tlcm[i] = lcm(i);\n\t\tdp[0][0][0] = 1L;\n\t\tfor (int l = 0; l < MAXL; l++)\n\t\t\tfor (int r = 0; r < LCM; r++)\n\t\t\t\tfor (int m = 0; m < MAXM; m++) {\n\t\t\t\t\tif (dp[l][r][m] == 0L)\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tfor (int d = 0; d < 10; d++) {\n\t\t\t\t\t\tif (d == 0) {\n\t\t\t\t\t\t\tdp[l + 1][r][m] += dp[l][r][m];\n\t\t\t\t\t\t\tif (m == 0 || r % lcm[m] == 0)\n\t\t\t\t\t\t\t\tcnt[d][l] += dp[l][r][m];\n\t\t\t\t\t\t} else if (d == 1) {\n\t\t\t\t\t\t\tint nr = (int) ((pow10[l] * d + r) % LCM);\n\t\t\t\t\t\t\tdp[l + 1][nr][m] += dp[l][r][m];\n\t\t\t\t\t\t\tif (m == 0 || nr % lcm[m] == 0)\n\t\t\t\t\t\t\t\tcnt[d][l] += dp[l][r][m];\n\t\t\t\t\t\t}else {\n\t\t\t\t\t\t\tint nr = (int) ((pow10[l] * d + r) % LCM);\n\t\t\t\t\t\t\tint nm = m | (1 << (d - 2));\n\t\t\t\t\t\t\tdp[l + 1][nr][nm] += dp[l][r][m];\n\t\t\t\t\t\t\tif (nm == 0 || nr % lcm[nm] == 0)\n\t\t\t\t\t\t\t\tcnt[d][l] += dp[l][r][m];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\tfor (int l = 0; l <= MAXL; l++)\n\t\t\tfor (int r = 0; r < LCM; r++)\n\t\t\t\tfor (int m = 0; m < MAXM; m++)\n\t\t\t\t\tif (m == 0 || r % lcm[m] == 0)\n\t\t\t\t\t\tcount[l] += dp[l][r][m];\n//\t\tSystem.out.println(Arrays.toString(count));\n\t\t\n\t\tin = new BufferedReader(new InputStreamReader(System.in));\n\t\tout = new PrintWriter(System.out);\n\t\t\n\t\tfor (int T = nextInt(); T --> 0; )\n\t\t\tout.println(solve(nextLong(), nextLong()));\n\t\t\n\t\tout.close();\n\t}\n\t\n\tlong solve(long l, long r) {\n\t\treturn count(r) - count(l - 1);\n\t}\n\n\tlong[][][] cdp = new long [MAXL + 1][LCM][MAXM];\n\t\n\tlong count(long x) {\n\t\tfor (long[][] a : cdp)\n\t\t\tfor (long[] b : a)\n\t\t\t\tfill(b, 0);\n\t\tcdp[0][0][0] = 1L;\n\t\tlong t = x;\n\t\tfor (int l = 0; t > 0L; l++, t /= 10L) {\n\t\t\tint cd = (int) (t % 10L);\n\t\t\tfor (int r = 0; r < LCM; r++)\n\t\t\t\tfor (int m = 0; m < MAXM; m++) {\n\t\t\t\t\tif (cdp[l][r][m] == 0L && dp[l][r][m] == 0L)\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tfor (int d = 0; d < cd; d++) {\n\t\t\t\t\t\tif (d == 0) {\n\t\t\t\t\t\t\tcdp[l + 1][r][m] += dp[l][r][m];\n\t\t\t\t\t\t} else if (d == 1) {\n\t\t\t\t\t\t\tint nr = (int) ((pow10[l] * d + r) % LCM);\n\t\t\t\t\t\t\tcdp[l + 1][nr][m] += dp[l][r][m];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tint nr = (int) ((pow10[l] * d + r) % LCM);\n\t\t\t\t\t\t\tint nm = m | (1 << (d - 2));\n\t\t\t\t\t\t\tcdp[l + 1][nr][nm] += dp[l][r][m];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (cd == 0) {\n\t\t\t\t\t\tcdp[l + 1][r][m] += cdp[l][r][m];\n\t\t\t\t\t} else if (cd == 1) {\n\t\t\t\t\t\tint nr = (int) ((pow10[l] * cd + r) % LCM);\n\t\t\t\t\t\tcdp[l + 1][nr][m] += cdp[l][r][m];\n\t\t\t\t\t} else {\n\t\t\t\t\t\tint nr = (int) ((pow10[l] * cd + r) % LCM);\n\t\t\t\t\t\tint nm = m | (1 << (cd - 2));\n\t\t\t\t\t\tcdp[l + 1][nr][nm] += cdp[l][r][m];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t}\n\t\tlong ret = 0L;\n\t\tint len = len(x);\n\t\tfor (int r = 0; r < LCM; r++)\n\t\t\tfor (int m = 0; m < MAXM; m++)\n\t\t\t\tif (m == 0 || r % lcm[m] == 0)\n\t\t\t\t\tret += cdp[len][r][m];\n\t\treturn ret;\n\t}\n\n\tint len(long x) {\n\t\tint ret = 0;\n\t\twhile (x > 0L) {\n\t\t\tret++;\n\t\t\tx /= 10L;\n\t\t}\n\t\treturn ret;\n\t}\n\n\tint[] lst = new int [10];\n\tint lcm(int mask) {\n\t\tint sz = 0;\n\t\tfor (int i = 0; i < 8; i++)\n\t\t\tif ((mask | (1 << i)) == mask)\n\t\t\t\tlst[sz++] = i + 2;\n\t\tif (sz == 0)\n\t\t\treturn 0;\n\t\tint lcm = lst[0];\n\t\tfor (int i = 1; i < sz; i++)\n\t\t\tlcm = lcm(lcm, lst[i]);\n\t\treturn lcm;\n\t}\n\n\tint lcm(int a, int b) {\n\t\treturn a / gcd(a, b) * b;\n\t}\n\n\tint gcd(int a, int b) {\n\t\twhile (a > 0 && b > 0)\n\t\t\tif (a > b)\n\t\t\t\ta %= b;\n\t\t\telse\n\t\t\t\tb %= a;\n\t\treturn a + b;\n\t}\n\n\tString nextToken() throws IOException {\n\t\twhile (!st.hasMoreTokens()) {\n\t\t\tst = new StringTokenizer(in.readLine());\n\t\t}\n\t\t\n\t\treturn st.nextToken();\n\t}\n\t\n\tint nextInt() throws IOException {\n\t\treturn Integer.parseInt(nextToken());\n\t}\n\t\n\tlong nextLong() throws IOException {\n\t\treturn Long.parseLong(nextToken());\n\t}\n}\n", "lang": "Java 6", "bug_code_uid": "28e766c9cb0fbad1f3a677d4caf0a2e6", "src_uid": "37feadce373f728ba2a560b198ca4bc9", "apr_id": "9e076d018d8777e73f84724c884ff78d", "difficulty": 2500, "tags": ["dp", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9816715542521994, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\nimport java.io.*;\npublic class Problem {\n\tpublic static void main(String[] args) throws IOException{\n\t\tBufferedReader in= new BufferedReader(new InputStreamReader(System.in));\n\t\tPrintWriter out= new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n\t\t\n\t\tint s=Integer.parseInt(in.readLine());\n\t\tString st=in.readLine();\n\t\tList lista=new ArrayList<>();\n\t\tint i;\n\t\tchar mayor='a';\n\t\tfor(i=0;imayor)\n\t\t\t\tmayor=aux;\n\t\t}\n\t\tif(s==1)\n\t\t\tout.append(\"0\\n\");\n\t\telse {\n\t\t\tint ans=0;\n\t\t\tproceso:while(true){\n\t\t\t\tfor(i=0;i= 0 && c <= 32;\n }\n\n public int nextInt() {\n int c = read();\n while (isWhiteSpace(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int ret = 0;\n while (c >= 0 && !isWhiteSpace(c)) {\n if (c < '0' || c > '9') {\n throw new NumberFormatException(\"digit expected \" + (char) c\n + \" found\");\n }\n ret = ret * 10 + c - '0';\n c = read();\n }\n return ret * sgn;\n }\n\n public String readLine() {\n try {\n return super.readLine();\n } catch (IOException e) {\n return null;\n }\n }\n\n}\n\nclass FastPrinter extends PrintWriter {\n\n public FastPrinter(OutputStream out) {\n super(out);\n }\n\n public FastPrinter(Writer out) {\n super(out);\n }\n\n\n}\n\nclass MathUtils {\n\n\n public static boolean[] genPrimesBoolean(int n) {\n boolean[] isPrime = new boolean[n];\n Arrays.fill(isPrime, true);\n isPrime[0] = isPrime[1] = false;\n for (int i = 2; i * i < n; i++) {\n if (!isPrime[i]) {\n continue;\n }\n for (int j = i * i; j < n; j += i) {\n isPrime[j] = false;\n }\n }\n return isPrime;\n }\n\n}\n\n", "lang": "Java 7", "bug_code_uid": "bf6ba09ccd9a61c1171515d486c56b71", "src_uid": "7bd5521531950e2de9a7b0904353184d", "apr_id": "8497cc557cff93361a9174e2efba2110", "difficulty": 1000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9339513325608343, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.math.BigInteger;\nimport java.util.Scanner;\n\npublic class foodOnThePlane {\n\t\n\tpublic static void calctime(String str) {\n\t\t\n\t\tString temp=str.substring(0,str.length()-1);\n\t\tlong n=Long.parseLong(temp);\n\t\t\n\t\tlong flag=0;\n\t\tfor( int i=0; ;i++)\n\t\t{\n\t\t\tif(4*i>=n)\n\t\t\t{\n\t\t\t\tflag=i-1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\n\t\tlong k=n-(4*flag);\n\t\t\n\t\tlong time=flag*16;\n\t\tif(k==2 || k==4)\n\t\t{\n\t\t\ttime=time+7;\n\t\t}\n\t\n\t\tCharacter ch=str.charAt(str.length()-1);\n\t\t\n\t\tif(ch=='f')\n\t\t\ttime=time+1;\n\t\t\n\t\telse if(ch=='e')\n\t\t\ttime=time+2;\n\t\t\n\t\telse if(ch=='d')\n\t\t\ttime=time+3;\n\t\t\n\t\telse if(ch=='a')\n\t\t\ttime=time+4;\n\t\t\n\t\telse if(ch=='b')\n\t\t\ttime=time+5;\n\t\t\n\t\telse if(ch=='c')\n\t\t\ttime=time+6;\n\t\t\n\n\t\tSystem.out.println(time);\n\n\t\t\n\t}\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\t\n\t\tScanner s=new Scanner(System.in);\n\t\t\n\t\tString str=s.next();\n\t\tcalctime(str);\n\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "3b989fb47b70b2a2fe53664b23fe55a3", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "apr_id": "7343240cb67362a2e0ee5f5116ffd715", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8133333333333334, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Scanner;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n * @author creativitRy\n */\npublic class Main\n{\n\tpublic static void main(String[] args)\n\t{\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tScanner in = new Scanner(inputStream);\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\tTaskB solver = new TaskB();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n\n\tstatic class TaskB\n\t{\n\t\tpublic void solve(int testNumber, Scanner in, PrintWriter out)\n\t\t{\n\t\t\tString temp = in.next();\n\t\t\tlong num = Long.parseLong(temp.substring(0, temp.length() - 1));\n\t\t\tchar pos = temp.charAt(temp.length() - 1);\n\n\t\t\tlong temp2 = 1;\n\t\t\tlong temp3 = 0;\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (temp2 == num || temp2 + 2 == num)\n\t\t\t\t\tbreak;\n\n\t\t\t\tif ((temp2 & 1) == 0)\n\t\t\t\t{\n\t\t\t\t\ttemp2 += 3;\n\t\t\t\t\ttemp3 += 9;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\ttemp2++;\n\t\t\t\t\ttemp3 += 7;\n\t\t\t\t}\n\n\n\t\t\t}\n\n\t\t\tout.println(temp3 + change(pos));\n\t\t}\n\n\t\tpublic int change(char c)\n\t\t{\n\t\t\tif (c == 'a')\n\t\t\t\treturn 4;\n\t\t\telse if (c == 'b')\n\t\t\t\treturn 5;\n\t\t\telse if (c == 'c')\n\t\t\t\treturn 6;\n\t\t\telse if (c == 'd')\n\t\t\t\treturn 3;\n\t\t\telse if (c == 'e')\n\t\t\t\treturn 2;\n\t\t\treturn 1;\n\t\t}\n\n\t}\n}\n\n", "lang": "Java 8", "bug_code_uid": "5eeaa66f31253600179571e25dcd719e", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "apr_id": "104dc58a703c7820b3da5e6b200c689e", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7457691576345313, "equal_cnt": 7, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 7, "fix_ops_cnt": 7, "bug_source_code": "import static java.lang.System.in;\nimport static java.lang.System.out;\n\nimport java.io.*;\nimport java.util.*;\n\npublic class C351brackets {\n\tstatic final double EPS = 1e-10;\n\tstatic final int INF = 1 << 28;\n\tstatic final double PI = Math.PI;\n\n\tpublic static Scanner sc = new Scanner(in);\n\tStringBuilder sb = new StringBuilder();\n\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\tpublic void run() throws IOException {\n\t\tString input;\n\t\tString[] inputArray;\n\t\tinput = br.readLine();\n\t\tinputArray = input.split(\" \");\n\n\t\tint n = Integer.valueOf(inputArray[0]);\n\t\tint m = Integer.valueOf(inputArray[1]);\n\t\tint [] a = new int[n];\n\t\tint [] b = new int[n];\n\t\tinput = br.readLine();\n\t\tinputArray = input.split(\" \");\n\t\tfor (int i=0; i>=1)\n\t\t\t\tif (k%2==0) { //closed\n\t\t\t\t\ttotal--;\n\t\t\t\t\tclose = Math.min(close,total);\n\t\t\t\t\tvalue+=b[j];\n\t\t\t\t} else {\n\t\t\t\t\ttotal++;//opened\n\t\t\t\t\tvalue+=a[j];\n\t\t\t\t}\n\t\t\topt[-close][total+n]=Math.min(opt[-close][total+n], value);\n\t\t}\n\t\t*/\n\t\tint [] dp = new int[2*n+1];\n\t\tint [] t = new int[2*n+1];\n\t\tdp[0]=0;\n\t\tfor (int j=1; j<=2*n; j++)\n\t\t\tdp[j] = INF;\n\t\tint x,y;\n\t\tfor (int i=0; i 0)\n break;\n long da = dd.longValue();\n t = ((long)(p / da)) * da - 1;\n if (p - t >= d)\n break;\n res = t;\n }\n out.println(res);\n }\n\n\n public static void main(String[] args) throws IOException {\n if (ONLINE_JUDGE){\n in = new BufferedReader(new InputStreamReader(System.in));\n out = new PrintWriter(System.out);\n }else{\n in = new BufferedReader(new FileReader(\"input.txt\"));\n out = new PrintWriter(\"output.txt\");\n }\n new CodeForces().runIt();\n out.flush();\n out.close();\n return;\n }\n\n static BufferedReader in;\n private StringTokenizer st;\n static PrintWriter out;\n\n String next() throws IOException {\n while (!st.hasMoreTokens()) {\n String line = in.readLine();\n if (line == null) {\n return null;\n }\n st = new StringTokenizer(line, \" \");\n }\n return st.nextToken();\n }\n\n int nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n\n double nextDouble() throws IOException {\n return Double.parseDouble(next());\n }\n\n long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n\n\n void runIt() throws IOException {\n st = new StringTokenizer(\"\");\n\n// int N = nextInt();\n// for (int i = 0; i < N; i++) {\n// runCase(i + 1);\n// }\n runCase(0);\n\n out.flush();\n }\n\n}\n", "lang": "Java 7", "bug_code_uid": "696ab782138e7f02f2d9072b0f932416", "src_uid": "c706cfcd4c37fbc1b1631aeeb2c02b6a", "apr_id": "fd0090bce713c9aa261db7497e70d500", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9593519882179676, "equal_cnt": 12, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 7, "fix_ops_cnt": 11, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.math.BigInteger;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.Iterator;\nimport java.util.Map;\nimport java.util.Map.Entry;\n\n\npublic class H2019D {\n\t\n\tstatic long cons = 1000000007;\n\t\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\t\n\t\tBufferedReader sc = new BufferedReader(new InputStreamReader(System.in));\n\t\n\t\tString[] dir = sc.readLine().split(\" \");\n\t\tlong n = Long.parseLong(dir[0]);\n\t\tlong k = Long.parseLong(dir[1]);\n\t\t\n\t\tlong finalans = 1;\n\t\t\n\t\t\n\t\tArrayList factors = primeFactors(n);\n\t\t\n\t\tMap map = new HashMap();\n\t\t\n\t\tfor(long f:factors) {\n\t\t\tif(map.get(f) == null) {\n\t\t\t\tmap.put(f,1l);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tmap.put(f, map.get(f) + 1);\n\t\t\t}\n\t\t}\n\t\t\n\t\tlong i = 0;\n\t\tIterator> it = map.entrySet().iterator();\n\t\twhile (it.hasNext()) {\n\t\t Entry pair = it.next();\n\t\t long factor = pair.getKey();\n\t\t long count = pair.getValue();\n\t\t \n\t\t long ans = expected(factor, count, k);\n\t\t finalans *= ans;\n\t\t finalans %= cons;\n\t\t}\n\t\t\n\t\tSystem.out.print(finalans);\n\t}\n\t\n\tpublic static long expected(long factor, long count, long k) {\n\t\tlong[] odds = new long[(int) count+1];\n\t\tlong[] vals = new long[(int) count+1];\n\t\tlong mult = 1;\n\t\todds[odds.length - 1] = 1l;\n\t\tvals[0] = 1l;\n\t\tlong sum = 1;\n\t\tfor(int i=1; i<=count; i++) {\n\t\t\tmult *= (factor)%cons;\n\t\t\t//sum += mult;sum%=cons;\n\t\t\tvals[i] = mult;\n\t\t\t//odds[i] = (sum * inv(i+1))%cons;\n\t\t}\n\t\t\n\t\t//System.out.println(Arrays.toString(vals));\n\t\t\n\t\tfor(int j=0; j primeFactors(long n) {\n\t\tArrayList list = new ArrayList();\n while (n%2==0) \n { \n list.add(2l);\n n /= 2; \n } \n for (int i = 3; i <= Math.sqrt(n); i+= 2) \n { \n while (n%i == 0) \n { \n \tlist.add((long)i);\n n /= i; \n } \n } \n if (n > 2) \n \tlist.add(n);\n \n return list;\n } \n\t\n\tpublic static long inv(long n) {\n\t\treturn BigInteger.valueOf(n).modInverse(BigInteger.valueOf(1000000007)).longValue();\n\t}\n}\n\n\n\n/* \nBufferedReader sc = new BufferedReader(new InputStreamReader(System.in));\nint n = Integer.parseInt(sc.readLine());\nString[] t = sc.readLine().split(\" \");\nint[] list = new int[n];\nfor(int x=0; x derp = doit(x);\n long ans = 1;\n for (int i = 0; i < derp.size(); i+=2){\n ans *= get(derp.get(i), derp.get(i + 1), iter);\n ans %= mod;\n }\n System.out.println(ans);\n }\n\n public static ArrayList doit(long x)\n {\n ArrayList ret = new ArrayList();\n for (int i = 2; i * i <= x; i++)\n {\n long p = 0;\n while (x % i == 0)\n {\n p++;\n x /= i;\n }\n if (p != 0){\n ret.add((long)i);\n ret.add(p);\n }\n }\n if (x != 1){\n ret.add(x);\n ret.add(1l);\n }\n return ret;\n }\n\n public static long get(long p, long pow, int iter)\n {\n pow++;\n int n = (int)pow;\n long[] vs = new long[n];\n vs[0] = 1;\n for (int i = 1; i < n; i++)\n vs[i] = vs[i - 1] * p; \n\n long[] newtab = new long[n];\n \n long[][] mat = new long[n][n];\n for (int j = 0; j < n; j++)\n for (int k = 0; k <= j; k++)\n mat[j][k] = invs[j + 1];\n\n mat = matExpo(mat, iter, mod);\n\n //System.out.println(Arrays.deepToString(mat));\n // System.out.println(Arrays.toString(vs));\n\n for (int i = 0; i < 1; i++)\n for (int k = 0; k < n; k++)\n newtab[k] += mat[n - 1][k];\n\n long ans = 0;\n for (int i = 0; i < n; i++)\n {\n ans += (vs[i] % mod) * newtab[i];\n ans %= mod;\n }\n return ans;\n }\n\n public static long[][] matExpo(long[][] mat, long pow, long mod)\n {\n int n = mat.length;\n if (pow == 0)\n {\n long[][] ret = new long[n][n];\n for (int i = 0; i < n; i++)\n {\n ret[i][i] = 1 % mod; \n }\n return ret;\n }\n if (pow == 1)\n {\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n mat[i][j] %= mod;\n return mat;\n }\n\n long[][] tmp = matExpo(mat, pow / 2, mod);\n tmp = mult(tmp, tmp, mod);\n if (pow % 2 == 1)\n tmp = mult(tmp, mat, mod);\n return tmp;\n }\n\n public static long[][] mult(long[][] a, long[][] b, long mod)\n {\n int n = a.length;\n long[][] ret = new long[n][n];\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 ret[i][j] += a[i][k] * b[k][j];\n ret[i][j] %= mod;\n }\n return ret;\n }\n\n public static ArrayList getDiv(long x){\n ArrayList ret = new ArrayList();\n for (long y = 1; y * y <= x; y++)\n {\n if (x % y == 0)\n {\n ret.add(y);\n if (y != x / y)\n ret.add(x / y);\n }\n }\n\n return ret;\n }\n\n public static long modInv(long x, long mod)\n {\n return modExpo(x, mod - 2, mod);\n }\n\n public static long modExpo(long base, long exp, long mod)\n {\n if (exp == 0)\n return 1 % mod;\n if (exp == 1)\n return base % mod;\n\n long tmp = modExpo(base, exp / 2, mod);\n tmp = tmp * tmp;\n tmp %= mod;\n if (exp % 2 == 1){\n tmp *= base;\n tmp %= mod;\n }\n return tmp;\n }\n}\n", "lang": "Java 8", "bug_code_uid": "18745118350ad55ca3e98c9837594e95", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "apr_id": "bef56150e6af8b5f25e1025981231892", "difficulty": 2200, "tags": ["dp", "math", "probabilities", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7756943036691668, "equal_cnt": 55, "replace_cnt": 32, "delete_cnt": 9, "insert_cnt": 13, "fix_ops_cnt": 54, "bug_source_code": "\n// Imports\nimport java.util.*;\nimport java.io.*;\n\npublic class blackboard {\n \n static HashMap primes = new HashMap<>();\n\n static long modInverse(long a, long m) \n { \n long m0 = m; \n long y = 0, x = 1; \n \n if (m == 1) \n return 0; \n \n while (a > 1) \n { \n // q is quotient \n long q = a / m; \n \n long t = m; \n \n // m is remainder now, process \n // same as Euclid's algo \n m = a % m; \n a = t; \n t = y; \n \n // Update x and y \n y = x - q * y; \n x = t; \n } \n \n // Make x positive \n if (x < 0) \n x += m0; \n \n return x; \n } \n \n static class Fraction {\n public long numerator;\n public long denominator;\n \n static long gcd(long a, long b) {\n if(a < 0 || b < 0) {\n System.out.println(\"!!!\" + a + \" \" + b);\n }\n \n if(a == 0) {\n return b;\n }\n if(b == 0) {\n return a;\n }\n \n // Everything divides 0 \n while (a != b) {\n \n if (a > b) { \n a = a - b;\n }\n else {\n b = b - a; \n }\n \n } \n return a;\n } \n \n public Fraction(long n, long d) {\n numerator = n;\n denominator = d;\n }\n \n public void simplify() {\n long divisor = gcd(numerator, denominator);\n numerator /= divisor;\n denominator /= divisor;\n }\n \n public Fraction multiply(Fraction other) {\n long n = this.numerator * other.numerator;\n long d = this.denominator * other.denominator;\n long divisor = gcd(n, d);\n n /= divisor;\n d /= divisor;\n \n return new Fraction(n, d);\n }\n \n public Fraction add(Fraction other) {\n long n = Math.abs(this.numerator * other.denominator + other.numerator * this.denominator);\n long d = this.denominator * other.denominator;\n long divisor = gcd(n, d);\n n /= divisor;\n d /= divisor;\n \n return new Fraction(n, d);\n }\n \n public Fraction divide(long div) {\n long gcf = gcd(div, this.numerator);\n \n return new Fraction(this.numerator/gcf, this.denominator*(div/gcf));\n }\n \n @Override\n public String toString() {\n return this.numerator + \"/\" + this.denominator;\n }\n \n }\n \n \n // method to print the divisors \n public static List getDivisors(long n) \n { \n List divisors = new ArrayList();\n \n // Note that this loop runs till square root \n for (long i = 1; i <= Math.sqrt(n); i++) \n { \n if (n%i==0) \n { \n // If divisors are equal, print only one \n if (n/i == i) { \n divisors.add(i); \n }\n else {\n divisors.add(n/i);\n divisors.add(i);\n }\n } \n } \n \n return divisors;\n } \n \n public static void loadPrimeFactorization(long n) {\n if(n%2 == 0) {\n if(primes.containsKey((long)2)) {\n primes.put((long)2, primes.get((long)2) + 1);\n loadPrimeFactorization(n/2);\n }\n else {\n primes.put((long)2, 1);\n loadPrimeFactorization(n/2);\n }\n }\n else {\n for(long i = 3; i <= Math.sqrt(n); i++) {\n if(n%i == 0) {\n if(primes.containsKey(i)) {\n primes.put(i, primes.get(i) + 1);\n loadPrimeFactorization(n/i);\n return;\n }\n else {\n primes.put(i, 1);\n loadPrimeFactorization(n/i);\n return;\n }\n }\n }\n \n if(n != 1) {\n if(primes.containsKey(n)) {\n primes.put(n, primes.get(n) + 1);\n }\n else {\n primes.put(n, 1);\n }\n }\n }\n }\n \n \n \n /**\n * @param args the command line arguments\n * @throws IOException, FileNotFoundException \n */\n public static void main(String[] args) throws IOException, FileNotFoundException {\n \n final long MOD = (long) 1E9 + 7;\n \n // TODO UNCOMMENT WHEN ALGORITHM CORRECT\n BufferedReader f = new BufferedReader(new InputStreamReader(System.in));\n \n // BufferedReader f = new BufferedReader(new StringReader(\"60 5\"));\n \n // TODO code application logic here\n StringTokenizer st = new StringTokenizer(f.readLine());\n long n = Long.parseLong(st.nextToken());\n int d = Integer.parseInt(st.nextToken());\n \n primes = new HashMap<>();\n loadPrimeFactorization(n);\n \n // System.out.println(primes);\n \n Fraction totalExpect = new Fraction(1, 1);\n \n for(long i : primes.keySet()) {\n // Probability after i steps the number is p^j\n Fraction[][] dp = new Fraction[d + 1][primes.get(i) + 1];\n dp[0][primes.get(i)] = new Fraction(1, 1);\n for(int j = 0; j < primes.get(i); j++) {\n dp[0][j] = new Fraction(0, 1);\n }\n \n // System.out.println(Arrays.toString(dp[0]));\n \n for(int j = 1; j < dp.length; j++) {\n for(int k = dp[0].length - 1; k >= 0; k--) {\n // f(i, j) = f(i, j+1) + f(i - 1, j)/(j + 1)\n if(k + 1 == dp[0].length) {\n dp[j][k] = dp[j - 1][k].divide(k + 1);\n }\n else {\n // System.out.println(dp[j - 1][k]);\n // System.out.println(dp[j - 1][k].divide(j + 1));\n dp[j][k] = dp[j][k + 1].add(dp[j - 1][k].divide(k + 1));\n }\n // System.out.println(dp[j][k] + \" \" + k + \" \" + dp[0].length);\n }\n }\n \n // System.out.println(Arrays.deepToString(dp));\n \n // System.out.println(\"done!\");\n \n // Compute expected value\n Fraction expected = new Fraction(0, 1);\n for(int j = 0; j < dp[0].length; j++) {\n // System.out.println(Math.pow(i, j));\n expected = expected.add(dp[d][j].multiply(new Fraction((long)Math.pow(i, j), 1)));\n }\n \n // System.out.println(expected);\n \n totalExpect = totalExpect.multiply(expected);\n totalExpect.simplify();\n }\n \n /* \n List divisors = getDivisors(n);\n Collections.sort(divisors);\n \n SortedMap> hm = new TreeMap<>();\n \n for(long i : divisors) {\n List div = getDivisors(i);\n hm.put(i, div);\n }\n \n // System.out.println(hm);\n \n // int[][] dp = new int[]\n // DP[i][j] i = divisor, j = lenght\n System.out.println(divisors.size() + \" \" + d);\n Fraction[][] dp = new Fraction[divisors.size()][d];\n for(int i = 0; i < dp.length; i++) {\n dp[i][0] = new Fraction(0, 1);\n long current = divisors.get(i);\n for(long j : hm.get(current)) {\n dp[i][0].add(new Fraction(j, 1));\n }\n // System.out.println(dp[i][0] + \" \" + hm.get(current).size());\n dp[i][0].divide(hm.get(current).size());\n // System.out.println(dp[i][0]);\n dp[i][0].simplify();\n \n for(int j = 1; j < dp[0].length; j++) {\n dp[i][j] = new Fraction(0, 1);\n for(long k : hm.get(current)) {\n dp[i][j].add(dp[divisors.indexOf(k)][j - 1]);\n }\n // System.out.println(dp[i][j]);\n dp[i][j].divide(hm.get(current).size());\n dp[i][j].simplify();\n }\n // System.out.println(Arrays.toString(dp[i]));\n }\n \n // System.out.println(Arrays.deepToString(dp));\n \n // System.out.println(dp[divisors.size() - 1][d - 1].numerator + \"/\" + dp[divisors.size() - 1][d - 1].denominator);\n \n // denominator inverse ax congruent 1 (mod 1000000007)\n long inverse = modInverse(dp[divisors.size()-1][d - 1].denominator, MOD);\n // System.out.println(inverse);\n \n System.out.println((inverse*dp[divisors.size()-1][d-1].numerator)%MOD);\n\n */\n \n // Prime factorize the number\n \n // denominator inverse ax congruent 1 (mod 1000000007)\n long inverse = modInverse(totalExpect.denominator, MOD);\n // System.out.println(inverse);\n \n System.out.println((inverse*totalExpect.numerator)%MOD);\n }\n\n}\n", "lang": "Java 8", "bug_code_uid": "8b6a49b755c63e913fdda7411c8eed9b", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "apr_id": "4aaf9fda52a023faa7af44ec14a5a654", "difficulty": 2200, "tags": ["dp", "math", "probabilities", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9993629012496937, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "\n// Imports\nimport java.util.*;\nimport java.io.*;\nimport java.math.BigInteger;\n\npublic class blackboardbackup {\n \n static HashMap primes = new HashMap<>();\n\n static long modInverse(long a, long m) \n { \n long m0 = m; \n long y = 0, x = 1; \n \n if (m == 1) \n return 0; \n \n while (a > 1) \n { \n // q is quotient \n long q = a / m; \n \n long t = m; \n \n // m is remainder now, process \n // same as Euclid's algo \n m = a % m; \n a = t; \n t = y; \n \n // Update x and y \n y = x - q * y; \n x = t; \n } \n \n // Make x positive \n if (x < 0) \n x += m0; \n \n return x; \n } \n \n static class Fraction {\n public long numerator;\n public long denominator;\n \n static long gcd(long a, long b) {\n if(a < 0 || b < 0) {\n System.out.println(\"!!!\" + a + \" \" + b);\n }\n \n \n // Everything divides 0 \n while (a != b) {\n \n if(a == 0) {\n return b;\n }\n if(b == 0) {\n return a;\n }\n \n if (a > b) { \n long floor = a/b;\n a = a - (b*floor);\n }\n else {\n long floor = b/a;\n b = b - (a*floor); \n }\n \n } \n return a;\n } \n \n public Fraction(long n, long d) {\n numerator = n;\n denominator = d;\n }\n \n public void simplify() {\n long divisor = gcd(numerator, denominator);\n numerator /= divisor;\n denominator /= divisor;\n }\n \n public Fraction multiply(Fraction other) {\n this.simplify();\n other.simplify();\n\n long div = gcd(this.numerator, other.denominator);\n long div2 = gcd(this.denominator, other.numerator);\n long n1 = this.numerator / div;\n long n2 = other.numerator / div2;\n long d1 = other.denominator / div;\n long d2 = this.denominator / div2;\n \n long n = n1 * n2;\n long d = d1 * d2;\n long divisor = gcd(n, d);\n n /= divisor;\n d /= divisor;\n \n return new Fraction(n, d);\n }\n \n public Fraction add(Fraction other) {\n this.simplify();\n other.simplify();\n \n // long time = System.currentTimeMillis();\n long dengcd = gcd(this.denominator, other.denominator);\n // System.out.println(\"TIME GCD: \" + (System.currentTimeMillis() - time));\n long lcm = this.denominator / dengcd;\n lcm *= other.denominator;\n \n long currden = lcm / this.denominator;\n long otherden = lcm / other.denominator;\n \n long n = otherden * other.numerator + currden * this.numerator;\n \n Fraction ret = new Fraction(n, lcm);\n ret.simplify();\n \n return ret;\n }\n \n public Fraction divide(long div) {\n long time = System.currentTimeMillis();\n long gcf = gcd(div, this.numerator);\n System.out.println(\"TIME GCD: \" + (System.currentTimeMillis() - time));\n \n return new Fraction(this.numerator/gcf, this.denominator*(div/gcf));\n }\n \n @Override\n public String toString() {\n return this.numerator + \"/\" + this.denominator;\n }\n \n }\n \n \n // method to print the divisors \n public static List getDivisors(long n) \n { \n List divisors = new ArrayList();\n \n // Note that this loop runs till square root \n for (long i = 1; i <= Math.sqrt(n); i++) \n { \n if (n%i==0) \n { \n // If divisors are equal, print only one \n if (n/i == i) { \n divisors.add(i); \n }\n else {\n divisors.add(n/i);\n divisors.add(i);\n }\n } \n } \n \n return divisors;\n } \n \n public static void loadPrimeFactorization(long n) {\n if(n%2 == 0) {\n if(primes.containsKey((long)2)) {\n primes.put((long)2, primes.get((long)2) + 1);\n loadPrimeFactorization(n/2);\n }\n else {\n primes.put((long)2, 1);\n loadPrimeFactorization(n/2);\n }\n }\n else {\n for(long i = 3; i <= Math.sqrt(n); i++) {\n if(n%i == 0) {\n if(primes.containsKey(i)) {\n primes.put(i, primes.get(i) + 1);\n loadPrimeFactorization(n/i);\n return;\n }\n else {\n primes.put(i, 1);\n loadPrimeFactorization(n/i);\n return;\n }\n }\n }\n \n if(n != 1) {\n if(primes.containsKey(n)) {\n primes.put(n, primes.get(n) + 1);\n }\n else {\n primes.put(n, 1);\n }\n }\n }\n }\n \n \n \n /**\n * @param args the command line arguments\n * @throws IOException, FileNotFoundException \n */\n public static void main(String[] args) throws IOException, FileNotFoundException {\n \n final long MOD = (long) 1E9 + 7;\n \n // TODO UNCOMMENT WHEN ALGORITHM CORRECT\n BufferedReader f = new BufferedReader(new InputStreamReader(System.in));\n \n // BufferedReader f = new BufferedReader(new StringReader(\"60 5\"));\n \n // TODO code application logic here\n StringTokenizer st = new StringTokenizer(f.readLine());\n long n = Long.parseLong(st.nextToken());\n int d = Integer.parseInt(st.nextToken());\n \n primes = new HashMap<>();\n loadPrimeFactorization(n);\n \n System.out.println(primes);\n \n long ans = 1;\n \n // 2 times\n for(long i : primes.keySet()) {\n // Probability after i steps the number is p^j\n long[][] dp = new long[d + 1][primes.get(i) + 1];\n // System.out.println(dp.length + \" \" + dp[0].length);\n \n dp[0][primes.get(i)] = 1;\n for(int j = 0; j < primes.get(i); j++) {\n dp[0][j] = 0;\n }\n \n // System.out.println(Arrays.toString(dp[0]));\n \n for(int j = 1; j < dp.length; j++) {\n long sum = 0;\n for(int k = dp[0].length - 1; k >= 0; k--) {\n long inverse = modInverse((long)(k + 1), MOD);\n inverse = (inverse * dp[j][k])%MOD;\n sum += inverse;\n sum %= MOD;\n dp[j+1][k] = sum;\n dp[j+1][k] %= MOD;\n }\n }\n \n // System.out.println(Arrays.deepToString(dp));\n \n // System.out.println(\"done!\");\n \n // Compute expected value\n long expected = 0;\n long current = 1;\n for(int j = 0; j < dp[0].length; j++) {\n // System.out.println(Math.pow(i, j));\n expected += (current*dp[d][j]) % MOD;\n expected %= MOD;\n current *= i;\n current %= MOD;\n }\n \n // System.out.println(expected);\n ans *= expected;\n ans %= MOD;\n }\n \n /* \n List divisors = getDivisors(n);\n Collections.sort(divisors);\n \n SortedMap> hm = new TreeMap<>();\n \n for(long i : divisors) {\n List div = getDivisors(i);\n hm.put(i, div);\n }\n \n // System.out.println(hm);\n \n // int[][] dp = new int[]\n // DP[i][j] i = divisor, j = lenght\n System.out.println(divisors.size() + \" \" + d);\n Fraction[][] dp = new Fraction[divisors.size()][d];\n for(int i = 0; i < dp.length; i++) {\n dp[i][0] = new Fraction(0, 1);\n long current = divisors.get(i);\n for(long j : hm.get(current)) {\n dp[i][0].add(new Fraction(j, 1));\n }\n // System.out.println(dp[i][0] + \" \" + hm.get(current).size());\n dp[i][0].divide(hm.get(current).size());\n // System.out.println(dp[i][0]);\n dp[i][0].simplify();\n \n for(int j = 1; j < dp[0].length; j++) {\n dp[i][j] = new Fraction(0, 1);\n for(long k : hm.get(current)) {\n dp[i][j].add(dp[divisors.indexOf(k)][j - 1]);\n }\n // System.out.println(dp[i][j]);\n dp[i][j].divide(hm.get(current).size());\n dp[i][j].simplify();\n }\n // System.out.println(Arrays.toString(dp[i]));\n }\n \n // System.out.println(Arrays.deepToString(dp));\n \n // System.out.println(dp[divisors.size() - 1][d - 1].numerator + \"/\" + dp[divisors.size() - 1][d - 1].denominator);\n \n // denominator inverse ax congruent 1 (mod 1000000007)\n long inverse = modInverse(dp[divisors.size()-1][d - 1].denominator, MOD);\n // System.out.println(inverse);\n \n System.out.println((inverse*dp[divisors.size()-1][d-1].numerator)%MOD);\n\n */\n \n // Prime factorize the number\n \n // denominator inverse ax congruent 1 (mod 1000000007)\n System.out.println(ans);\n }\n\n}\n", "lang": "Java 8", "bug_code_uid": "999a3e65c0b49ff0eb5b21654e3bc438", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "apr_id": "4aaf9fda52a023faa7af44ec14a5a654", "difficulty": 2200, "tags": ["dp", "math", "probabilities", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.4646244412951052, "equal_cnt": 59, "replace_cnt": 42, "delete_cnt": 8, "insert_cnt": 8, "fix_ops_cnt": 58, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.LinkedList;\nimport java.util.Queue;\nimport java.util.StringTokenizer;\n\npublic class c {\n\t\n\tpublic static class Prob\n\t{\n\t\tlong num, den;\n\t\tProb(long num, long den)\n\t\t{\n\t\t\tlong gcd = gcd(Math.max(num, den), Math.min(num, den));\n\t\t\tthis.num = num/gcd;\n\t\t\tthis.den = den/gcd;\n\t\t}\n\t}\n\t\n\tpublic static class Number\n\t{\n\t\tlong val;\n\t\tProb p;\n\t\tint level;\n\t\tNumber(long val, long num, long den,int level)\n\t\t{\n\t\t\tthis.val = val;\n\t\t\tthis.p = new Prob(num, den);\n\t\t\tthis.level = level;\n\t\t}\n\t}\n\t\n\t\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\n\t\tlong mod = 1000000007;\n\t\t//System.out.println(inverse(4, 19));\n\t\tFastReader s = new FastReader();\n\t\tlong N = s.nextLong();\n\t\tint k =s .nextInt();\n\t\t\n\t\tNumber num = new Number(N, 1, 1, 0);\n\t\tQueue queue = new LinkedList<>();\n\t\t\n\t\tqueue.add(num);\n\t\tHashMap> factors = new HashMap<>();\n\t\t\n\t\tProb ans = new Prob(0,1);\n\t\twhile(!queue.isEmpty())\n\t\t{\n\t\t\tNumber temp = queue.remove();\n\t\t\tif(temp.level == k)\n\t\t\t{\n\t\t\t\tans = addProb(ans,multiply(temp.p, temp.val));\n\t\t\t}\n\t\t\t\n\t\t\telse\n\t\t\t{\n\t\t\t\tArrayList fac_list;\n\t\t\t\tif(factors.containsKey(temp.val))\n\t\t\t\t\tfac_list = factors.get(temp.val);\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tfac_list = getFactors(temp.val);\n\t\t\t\t\tfactors.put(temp.val, fac_list);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t//System.out.println(fac_list+\" \"+temp.val);\n\t\t\t\tfor(int i=0;i 0)\n\t\t{\n\t\t\tlong q = r1/r2;\n\t\t\tlong r = r1%r2;\n\t\t\tr1 = r2;\n\t\t\tr2 = r;\n\t\t\t\n\t\t\tlong t = t1 - q *t2;\n\t\t\tt1 = t2;\n\t\t\tt2 = t;\n\t\t}\n\t\t\n\t\treturn (t1 + mod)%mod;\n\t}\n\t\n\tpublic static Prob multiply( Prob p, long num)\n\t{\n\t\tlong n = p.num * num;\n\t\treturn new Prob(n/gcd(Math.max(n, p.den), Math.min(n, p.den)),p.den/gcd(Math.max(n, p.den), Math.min(n, p.den)));\n\t}\n\tpublic static ArrayList getFactors(long num)\n\t{\n\t\t//System.out.println(\"called for\"+num);\n\t\tArrayList factors = new ArrayList<>();\n\t\t\n\t\tfor(long val = 1;val*val <= num;val++)\n\t\t{\n\t\t\tif(num%val == 0)\n\t\t\t{\n\t\t\t\tfactors.add(val);\n\t\t\t\tif(num/val != val)\n\t\t\t\tfactors.add(num/val);\n\t\t\t}\n\t\t}\n\t\t\n\t\t//System.out.println(factors);\n\t\treturn factors;\n\t\t\t\n\t}\n\t\n\tpublic static Prob addProb(Prob p1, Prob p2)\n\t{\n\t\tlong base = lcm(p1.den, p2.den);\n\t\tlong num = p1.num*(base/p1.den)+ p2.num * (base/p2.den);\n\t\tlong gcd = gcd(Math.max(num, base), Math.min(num, base));\n\t\t\n\t\treturn new Prob(num/gcd, base/gcd);\n\t}\n\t\n\tpublic static long lcm(long val1, long val2)\n\t{\n\t\treturn val1 * val2 /(gcd(Math.max(val1, val2),Math.min(val1, val2)));\n\t}\n\t\n\tpublic static long gcd(long val1, long val2)\n\t{\n\t if(val2 == 0)\n\t \treturn val1;\n\t else\n\t \treturn gcd(val2, val1%val2);\n\t}\n\t\n\t\tstatic class FastReader\n {\n BufferedReader br;\n StringTokenizer st;\n \n public FastReader()\n {\n br = new BufferedReader(new\n InputStreamReader(System.in));\n }\n \n String next()\n {\n while (st == null || !st.hasMoreElements())\n {\n try\n {\n st = new StringTokenizer(br.readLine());\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n \n int nextInt()\n {\n return Integer.parseInt(next());\n }\n \n long nextLong()\n {\n return Long.parseLong(next());\n }\n \n double nextDouble()\n {\n return Double.parseDouble(next());\n }\n \n String nextLine()\n {\n String str = \"\";\n try\n {\n str = br.readLine();\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n return str;\n }\n }\n\n\n}", "lang": "Java 8", "bug_code_uid": "423bfbb4071a94bb1f30a1207a154d1a", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "apr_id": "fb5073259d9229566cb6b09eabfb9b5a", "difficulty": 2200, "tags": ["dp", "math", "probabilities", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.4035336803912289, "equal_cnt": 38, "replace_cnt": 26, "delete_cnt": 6, "insert_cnt": 6, "fix_ops_cnt": 38, "bug_source_code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.io.OutputStream;\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.File;\nimport java.io.FileNotFoundException;\nimport java.util.StringTokenizer;\nimport java.util.Map;\nimport java.util.Map.Entry;\nimport java.io.Writer;\nimport java.io.BufferedReader;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author kessido\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n OutputWriter out = new OutputWriter(outputStream);\n DMakotoAndABlackboard solver = new DMakotoAndABlackboard();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class DMakotoAndABlackboard {\n final static long MOD = MathExtensions.DEFAULT_MOD;\n long[] factorial;\n long[] invFactorial;\n\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n final long n = in.NextInt();\n final int k = in.NextInt();\n\n long[][] fifi = MathExtensions.Factorials.getFactorialAndInverseFactorialsAndInverse_O_N(k + 1, MOD);\n factorial = fifi[0];\n invFactorial = fifi[1];\n\n HashMap divisors = getAllDivisors(n);\n long res = 1;\n for (Map.Entry e : divisors.entrySet()) {\n final long p = e.getKey();\n long newRes = 0;\n final int repeats = e.getValue();\n final long[] probabilityOfCount = getProbability(repeats, k);\n for (int count = 0; count <= repeats; count++) {\n// final long probabilityOfSingleInstanceToBePresented = MathExtensions.powerMod(MathExtensions.modInverse_For_M_Prime(2, MOD), k, MOD);\n// final long probabilityOfSingleInstanceToNotBePresented = (1 - probabilityOfSingleInstanceToBePresented + MOD) % MOD;\n// final long probabilityOfSingleInstanceOfCount = (\n// MathExtensions.powerMod(probabilityOfSingleInstanceToBePresented, count, MOD) *\n// MathExtensions.powerMod(probabilityOfSingleInstanceToNotBePresented, repeats - count, MOD)) % MOD;\n// final long probabilityOfCount = probabilityOfSingleInstanceOfCount * nChooseK(repeats, count) % MOD;\n\n\n final long currentInfluence = MathExtensions.powerMod(p, count, MOD);\n newRes += (currentInfluence % MOD) * probabilityOfCount[count] % MOD;\n newRes %= MOD;\n if (newRes < 0) newRes += MOD;\n }\n res = res * newRes % MOD;\n }\n out.println(res);\n }\n\n private long[] getProbability(int start, int k) {\n long[][] probability = new long[2][start + 1];\n int p = 0;\n probability[p][start] = 1;\n while (k-- > 0) {\n p ^= 1;\n long[] cur = probability[p];\n long[] last = probability[p ^ 1];\n Arrays.fill(cur, 0);\n for (int j = 0; j <= start; j++) {\n long currentProb = last[j] * MathExtensions.modInverse_For_M_Prime(j + 1, MOD) % MOD;\n for (int i = 0; i <= j; i++) {\n cur[i] += currentProb;\n cur[i] %= MOD;\n }\n }\n }\n return probability[p];\n }\n\n private HashMap getAllDivisors(long n) {\n HashMap res = new HashMap<>();\n int p = 2;\n n = handle(p, res, n);\n p = 3;\n while (p <= n) {\n n = handle(p, res, n);\n p += 2;\n }\n return res;\n }\n\n private long handle(int p, HashMap res, long n) {\n int count = 0;\n while (n % p == 0) {\n n /= p;\n count++;\n }\n if (count != 0) res.put(p, count);\n\n return n;\n }\n\n }\n\n static class InputReader {\n BufferedReader reader;\n StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine(), \" \\t\\n\\r\\f,\");\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int NextInt() {\n return Integer.parseInt(next());\n }\n\n }\n\n static class OutputWriter extends PrintWriter {\n public OutputWriter(Writer out) {\n super(out);\n }\n\n public OutputWriter(File file) throws FileNotFoundException {\n super(file);\n }\n\n public OutputWriter(OutputStream out) {\n super(out);\n }\n\n }\n\n static class MathExtensions {\n public static final long DEFAULT_MOD = 1_000_000_007L;\n\n public static long modInverse_For_M_Prime(final long a, final long m) {\n return powerMod(a, m - 2, m);\n }\n\n public static long powerMod(final long x, final long y, final long m) {\n if (y == 0)\n return 1;\n\n long p = powerMod(x, y / 2, m) % m;\n p = (p * p) % m;\n\n if (y % 2 == 0)\n return p;\n else\n return (x * p) % m;\n }\n\n public static class InverseModulo {\n public static long[] getInverseModulo(final int max, final long MOD) {\n // Why is it workingggg!?!?!? need to read about this!\n long[] inv = new long[max + 1];\n if (max == 0) return inv;\n inv[1] = 1;\n for (int i = 2; i <= max; i++) {\n inv[i] = (MOD - MOD / i) * inv[(int) (MOD % i)] % MOD;\n }\n return inv;\n }\n\n }\n\n public static class Factorials {\n public static long[][] getFactorialAndInverseFactorialsAndInverse_O_N(int max, long MOD) {\n assert max >= 0;\n long[] fact = new long[max + 1];\n long[] ifact = new long[max + 1];\n long[] inv = MathExtensions.InverseModulo.getInverseModulo(max, MOD);\n fact[0] = 1;\n ifact[0] = 1;\n for (int i = 1; i <= max; i++) {\n fact[i] = fact[i - 1] * i % MOD;\n ifact[i] = ifact[i - 1] * inv[i] % MOD;\n }\n return new long[][]{fact, ifact, inv};\n }\n\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "8bb7c1a021556509ad379f2b6d49b8bc", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "apr_id": "c852eb533bc26f635b06d44b53d727d1", "difficulty": 2200, "tags": ["dp", "math", "probabilities", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9993569131832798, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.io.OutputStream;\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.File;\nimport java.io.FileNotFoundException;\nimport java.util.StringTokenizer;\nimport java.util.Map;\nimport java.util.Map.Entry;\nimport java.io.Writer;\nimport java.io.BufferedReader;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author kessido\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n OutputWriter out = new OutputWriter(outputStream);\n DMakotoAndABlackboard solver = new DMakotoAndABlackboard();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class DMakotoAndABlackboard {\n final static long MOD = MathExtensions.DEFAULT_MOD;\n long[] inv;\n\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n final long n = in.NextLong();\n final int k = in.NextInt();\n inv = new long[70];\n for (int i = 1; i < 70; i++) {\n inv[i] = MathExtensions.modInverse_For_M_Prime(i, MOD);\n }\n\n HashMap divisors = getAllDivisors(n);\n long res = 1;\n for (Map.Entry e : divisors.entrySet()) {\n final long p = e.getKey() % MOD;\n long newRes = 0;\n final int repeats = e.getValue();\n final long[] probabilityOfCount = getProbability(repeats, k);\n long currentInfluence = 1;\n for (int count = 0; count <= repeats; count++) {\n newRes += (currentInfluence % MOD) * probabilityOfCount[count] % MOD;\n newRes %= MOD;\n if (newRes < 0) newRes += MOD;\n currentInfluence = currentInfluence * p % MOD;\n }\n res = res * newRes % MOD;\n }\n out.println(res);\n }\n\n private long[] getProbability(int start, int k) {\n long[][] probability = new long[2][start + 1];\n int p = 0;\n probability[p][start] = 1;\n while (k-- > 0) {\n p ^= 1;\n long[] cur = probability[p];\n long[] last = probability[p ^ 1];\n Arrays.fill(cur, 0);\n for (int j = 0; j <= start; j++) {\n long currentProb = last[j] * inv[j + 1] % MOD;\n if (currentProb == 0) continue;\n for (int i = 0; i <= j; i++) {\n cur[i] += currentProb;\n cur[i] %= MOD;\n }\n }\n }\n return probability[p];\n }\n\n private HashMap getAllDivisors(long n) {\n HashMap res = new HashMap<>();\n int p = 2;\n n = handle(p, res, n);\n p = 3;\n while (p <= n && p * p <= n) {\n n = handle(p, res, n);\n p += 2;\n }\n if (n != 1) n = handle(n, res, n);\n return res;\n }\n\n private long handle(long p, HashMap res, long n) {\n int count = 0;\n while (n % p == 0) {\n n /= p;\n count++;\n }\n if (count != 0) res.put(p, count);\n\n return n;\n }\n\n }\n\n static class OutputWriter extends PrintWriter {\n public OutputWriter(Writer out) {\n super(out);\n }\n\n public OutputWriter(File file) throws FileNotFoundException {\n super(file);\n }\n\n public OutputWriter(OutputStream out) {\n super(out);\n }\n\n }\n\n static class MathExtensions {\n public static final long DEFAULT_MOD = 1_000_000_007L;\n\n public static long modInverse_For_M_Prime(final long a, final long m) {\n return powerMod(a, m - 2, m);\n }\n\n public static long powerMod(final long x, final long y, final long m) {\n if (y == 0)\n return 1;\n\n long p = powerMod(x, y / 2, m) % m;\n p = (p * p) % m;\n\n if (y % 2 == 0)\n return p;\n else\n return (x * p) % m;\n }\n\n }\n\n static class InputReader {\n BufferedReader reader;\n StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine(), \" \\t\\n\\r\\f,\");\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int NextInt() {\n return Integer.parseInt(next());\n }\n\n public long NextLong() {\n return Long.parseLong(next());\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "60e015cbd3952207ef1aad072ad55aed", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "apr_id": "c852eb533bc26f635b06d44b53d727d1", "difficulty": 2200, "tags": ["dp", "math", "probabilities", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.38910868047474984, "equal_cnt": 30, "replace_cnt": 20, "delete_cnt": 5, "insert_cnt": 4, "fix_ops_cnt": 29, "bug_source_code": "import java.util.*;\npublic class D {\n public static final long MOD = 1000000007;\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n long N = scanner.nextLong();\n int K = scanner.nextInt();\n int mFact = 2*(int)Math.ceil(Math.sqrt(N));\n long[] inv = new long[mFact];\n for(int i = 0; i < mFact; i++) {\n inv[i] = modInverse(i);\n }\n ArrayDeque factorQ = new ArrayDeque<>();\n factorQ.add(N);\n int nextNode = 0;\n ArrayList> factorsList = new ArrayList<>();\n HashMap parsed = new HashMap<>();\n parsed.put(N, nextNode++);\n while(!factorQ.isEmpty()) {\n long next = factorQ.poll();\n ArrayList f = new ArrayList<>();\n for(long i = 1; i*i<=next; i++) {\n if (next%i==0) {\n f.add(i);\n if (next/i!=i) f.add(next/i);\n if (!parsed.containsKey(i)) {\n parsed.put(i, nextNode++);\n factorQ.add(i);\n if (next / i != i && !parsed.containsKey(next / i)) {\n parsed.put(next / i, nextNode++);\n factorQ.add(next / i);\n }\n }\n }\n }\n factorsList.add(f);\n }\n Set set = parsed.keySet();\n long[][] dp = new long[K+1][nextNode];\n for( long n: set) {\n dp[0][parsed.get(n)]=((n%MOD)*inv[factorsList.get(0).size()])%MOD;\n }\n for(int i = 1; i < K; i++) {\n for(int n = 0; n < nextNode; n++) {\n for(long ff: factorsList.get(n)) {\n dp[i][n] = (dp[i][n] + dp[i-1][parsed.get(ff)])%MOD;\n }\n dp[i][n] = (dp[i][n] * inv[factorsList.get(n).size()])%MOD;\n }\n }\n long out = 0;\n for(int i = 0; i < nextNode; i++) {\n out = (out + dp[K-1][i])%MOD;\n }\n System.out.println(out);\n }\n// public static class Prob {\n// long num;\n// long curProb;\n// ArrayList factors;\n// public Prob (long nn, long cc, ArrayList ff) {\n// factors = ff;\n// num = nn;\n// curProb = cc;\n// }\n// }\n public static long modInverse(long x)\n {\n return modPow(x, MOD-2);\n }\n public static long modPow(long x, long y) {\n if (y == 0) return 1;\n long p = modPow(x, y / 2) %MOD;\n p = (p * p) % MOD;\n if (y % 2 == 0) return p;\n else return (x * p) % MOD;\n }\n}", "lang": "Java 8", "bug_code_uid": "a27ad7ccf97d756e59ca93d248e9dfd3", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "apr_id": "f24816a1078c247f5ee95787a9474291", "difficulty": 2200, "tags": ["dp", "math", "probabilities", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.36574952561669827, "equal_cnt": 31, "replace_cnt": 24, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 30, "bug_source_code": "import java.util.*;\npublic class D {\n public static final long MOD = 1000000007;\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n long N = scanner.nextLong();\n int K = scanner.nextInt();\n ArrayDeque factorQ = new ArrayDeque<>();\n factorQ.add(N);\n int nextNode = 0;\n ArrayList> factorsList = new ArrayList<>();\n HashMap parsed = new HashMap<>();\n parsed.put(N, nextNode++);\n int maxSize = 0;\n while(!factorQ.isEmpty()) {\n long next = factorQ.poll();\n ArrayList f = new ArrayList<>();\n for(long i = 1; i*i<=next; i++) {\n if (next%i==0) {\n f.add(i);\n if (next/i!=i) f.add(next/i);\n if (!parsed.containsKey(i)) {\n parsed.put(i, nextNode++);\n factorQ.add(i);\n if (next / i != i && !parsed.containsKey(next / i)) {\n parsed.put(next / i, nextNode++);\n factorQ.add(next / i);\n }\n }\n }\n }\n maxSize = Math.max(maxSize, f.size());\n factorsList.add(f);\n }\n long[] inv = new long[maxSize+1];\n for(int i = 0; i <= maxSize; i++) {\n inv[i] = modInverse(i);\n }\n Set set = parsed.keySet();\n long[] dpPrev = new long[nextNode];\n long[] dpNext = new long[nextNode];\n //long[][] dp = new long[K+1][nextNode];\n for( long n: set) {\n dpPrev[parsed.get(n)]=((n%MOD)*inv[factorsList.get(0).size()])%MOD;\n }\n for(int i = 1; i < K; i++) {\n for(int n = 0; n < nextNode; n++) {\n for(long ff: factorsList.get(n)) {\n dpNext[n] = (dpNext[n] + dpPrev[parsed.get(ff)])%MOD;\n }\n dpNext[n] = (dpNext[n] * inv[factorsList.get(n).size()])%MOD;\n }\n dpPrev = dpNext;\n dpNext = new long[nextNode];\n }\n long out = 0;\n for(int i = 0; i < nextNode; i++) {\n out = (out + dpPrev[i])%MOD;\n }\n System.out.println(out);\n }\n public static long modInverse(long x)\n {\n return modPow(x, MOD-2);\n }\n public static long modPow(long x, long y) {\n if (y == 0) return 1;\n long p = modPow(x, y / 2) %MOD;\n p = (p * p) % MOD;\n if (y % 2 == 0) return p;\n else return (x * p) % MOD;\n }\n}", "lang": "Java 8", "bug_code_uid": "aaf89340a93adaa6f571a97c10e7f30c", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "apr_id": "f24816a1078c247f5ee95787a9474291", "difficulty": 2200, "tags": ["dp", "math", "probabilities", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.4411452810180276, "equal_cnt": 48, "replace_cnt": 32, "delete_cnt": 6, "insert_cnt": 9, "fix_ops_cnt": 47, "bug_source_code": "import java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.Scanner;\nimport java.util.TreeSet;\npublic class DHello2019 {\n\n\tpublic static final long p = 1_000_000_007;\n\t\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tlong N = in.nextLong();\n\t\tint K = in.nextInt();\n\t\t\n\t\tArrayList nFactors = getFactors(N);\n\t\tint M = nFactors.size();\n\t\t\n\t\tlong[][] markovA = setMarkovChain(nFactors, M);\n\t\t\n\t\tlong[][] ApowK = exponentiate(markovA, K);\n\t\t\n\t\tlong[][] B = new long[M][1];\n\t\tfor(int i = 0; i < B.length; i++)\n\t\t\tB[i][0] = nFactors.get(i) % p;\n\t\t\n\t\tlong[][] finalProduct = multiply(ApowK, B);\n\t\t\n\t\tlong result = finalProduct[M-1][0];\n\t\tSystem.out.println(result);\n\t\tin.close();\n\t}\n\t\n\tpublic static long[][] exponentiate(long[][] A, int pow) {\n\t\tString binary = Integer.toBinaryString(pow);\n\t\tlong[][][] powers = new long[binary.length()][A.length][A.length];\n\t\tpowers[powers.length-1] = A;\n\t\tfor(int i = powers.length-2; i >= 0; i--)\n\t\t\tpowers[i] = multiply(powers[i+1], powers[i+1]);\n\t\t\n\t\tlong[][] product = powers[0];\n\t\tfor(int i = 1; i < powers.length; i++)\n\t\t\tif(binary.charAt(i) == '1')\n\t\t\t\tproduct = multiply(product, powers[i]);\n\t\t\n\t\treturn product;\n\t}\n\t\n\tpublic static long[][] multiply(long[][] A, long[][] B) {\n\t\tlong[][] C = new long[A.length][B[0].length];\n\t\tfor(int i = 0; i < A.length; i++)\n\t\t\tfor(int j = 0; j < B[0].length; j++)\n\t\t\t\tfor(int k = 0; k < A[0].length; k++)\n\t\t\t\t\tC[i][j] = (C[i][j] + A[i][k] * B[k][j]) % p;\n\t\t\n\t\treturn C;\n\t}\n\t\n\tpublic static ArrayList getFactors(long N) {\n\t\tTreeSet set = new TreeSet<>();\n\t\tfor(long i = 1; i <= Math.sqrt(N); i++) {\n\t\t\tif(N % i == 0) {\n\t\t\t\tset.add(i);\n\t\t\t\tset.add(N/i);\n\t\t\t}\n\t\t}\n\t\t\n\t\tArrayList factors= new ArrayList<>();\n\t\tfor(long i : set)\n\t\t\tfactors.add(i);\n\t\t\n\t\treturn factors;\n\t}\n\t\n\t/**\n\t * Extended Euclidean algorithm find x such that ax = 1 (mod m)\n\t * @param a \n\t * @param m\n\t * @return modular inverse of a mod m\n\t */\n\tpublic static long modInverse(long a, long m) {\t\n\t\tlong[] a1 = {a, 1, 0};\n\t\tlong[] b1 = {m, 0, 1};\n\t\twhile(b1[0] != 0) {\n\t\t\tlong[] c1 = new long[3];\n\t\t\tlong q = a1[0] / b1[0];\n\t\t\tc1[0] = a1[0] - q * b1[0];\n\t\t\tc1[1] = a1[1] - q * b1[1];\n\t\t\tc1[2] = a1[2] - q * b1[2];\n\t\t\ta1 = b1;\n\t\t\tb1 = c1;\n\t\t}\n\t\t\n\t\tif(a1[1] < 0) a1[1] += m;\n\t\treturn a1[1];\n\t}\n\t\n\tpublic static long[][] setMarkovChain(ArrayList nFactors, int M) {\n\t\tint index = 0;\n\t\tHashMap mapIndex = new HashMap<>();\n\t\tfor(long i : nFactors)\n\t\t\tmapIndex.put(i, index++);\n\t\t\n\t\tboolean[][] factors = new boolean[M][M];\n\t\t\n\t\tfor(int col = 0; col < M; col++) {\n\t\t\tlong divisor = nFactors.get(col);\n\t\t\tfor(int row = 0; row < M; row++)\n\t\t\t\tif(nFactors.get(row) % divisor == 0)\n\t\t\t\t\tfactors[row][col] = true;\n\t\t}\n\t\t\n\t\tint[] sumRows = new int[M];\n\t\tfor(int i = 0; i < M; i++)\n\t\t\tfor(int j = 0; j < M; j++)\n\t\t\t\tif(factors[i][j])\n\t\t\t\t\tsumRows[i]++;\n\t\t\n\t\tlong[] inverses = new long[M];\n\t\tfor(int i = 0; i < M; i++)\n\t\t\tinverses[i] = modInverse(sumRows[i], p);\n\t\t\n\t\tlong[][] markovA = new long[M][M];\n\t\tfor(int i = 0; i < M; i++)\n\t\t\tfor(int j = 0; j < M; j++)\n\t\t\t\tif(factors[i][j])\n\t\t\t\t\tmarkovA[i][j] = inverses[i];\n\t\t\n\t\treturn markovA;\n\t}\n\t\n\tpublic static void print(boolean[][] a) {\n\t\tfor(int i = 0; i < a.length; i++) {\n\t\t\tfor(int j = 0; j < a[i].length; j++)\n\t\t\t\tSystem.out.print(a[i][j] ? 1 : 0);\n\t\t\tSystem.out.println();\n\t\t}\n\t\tSystem.out.println();\n\t}\n\t\n\tpublic static void print(long[][] a) {\n\t\tfor(int i = 0; i < a.length; i++) {\n\t\t\tfor(int j = 0; j < a[i].length; j++)\n\t\t\t\tSystem.out.print(a[i][j] + \" \");\n\t\t\tSystem.out.println();\n\t\t}\n\t\tSystem.out.println();\n\t}\n\n}\n/*\n6 1\noutputCopy\n3\ninputCopy\n6 2\noutputCopy\n875000008\ninputCopy\n60 5\noutputCopy\n237178099\n\n1000000000000 100\n976589177\n\n100000000 100\n141584224\n\n1000000000000000 10000\n215514159\n*/", "lang": "Java 8", "bug_code_uid": "6f5e3b588133b6b0aa8908c074e2ddb0", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "apr_id": "d87e91735572e9126a9c3732b4ce6724", "difficulty": 2200, "tags": ["dp", "math", "probabilities", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.20989353226624177, "equal_cnt": 52, "replace_cnt": 37, "delete_cnt": 9, "insert_cnt": 5, "fix_ops_cnt": 51, "bug_source_code": "import java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.Scanner;\nimport java.util.TreeSet;\npublic class DHello2019 {\n\n\tpublic static final long p = 1_000_000_007;\n\tpublic static int countCall = 0;\n\tpublic static long start;\n\t\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tlong N = in.nextLong();\n\t\tint K = in.nextInt();\n\t\t\n\t\tstart = System.currentTimeMillis();\n\t\t\n\t\tArrayList nFactors = getFactors2(N);\n\t\tint M = nFactors.size();\n\t\t\n//\t\tSystem.out.println(\"M = \" + M);\n//\t\tSystem.out.println(\"Stage 1: \" + (System.currentTimeMillis() - start) + \" milliseconds\");\n\t\t\n\t\tlong[][] markovA = setMarkovChain(nFactors, M);\n\t\t\n//\t\tSystem.out.println(\"Stage 2: \" + (System.currentTimeMillis() - start) + \" milliseconds\");\n\t\t\n\t\tlong[][] B = new long[M][1];\n\t\tfor(int i = 0; i < B.length; i++)\n\t\t\tB[i][0] = nFactors.get(i) % p;\n\t\t\n//\t\tSystem.out.println(\"Stage 3: \" + (System.currentTimeMillis() - start) + \" milliseconds\");\n\t\t\n\t\t//long[][] ApowK = exponentiate5(markovA, K);\n\t\tlong[][] ApowK = exponentiate4(markovA, K, B);\n\t\t\n//\t\tSystem.out.println(\"Stage 4: \" + (System.currentTimeMillis() - start) + \" milliseconds\");\n\t\t\n\t\tlong[][] finalProduct = multiply(ApowK, B);\n\t\t\n//\t\tSystem.out.println(\"Stage 5: \" + (System.currentTimeMillis() - start) + \" milliseconds\");\n\t\t\n\t\tlong result = finalProduct[M-1][0];\n//\t\tif(result < 0) result += p;\n\t\tSystem.out.println(result);\n//\t\tSystem.out.println(\"Took \" + (System.currentTimeMillis() - start) + \" milliseconds\");\n\t\tin.close();\n\t}\n\t\n\tpublic static long[][] exponentiate(long[][] A, int pow) {\n\t\tString binary = Integer.toBinaryString(pow);\n\t\tlong[][][] powers = new long[binary.length()][A.length][A.length];\n\t\tpowers[powers.length-1] = A;\n\t\tfor(int i = powers.length-2; i >= 0; i--)\n\t\t\tpowers[i] = multiply(powers[i+1], powers[i+1]);\n\t\t\n\t\tlong[][] product = powers[0];\n\t\tfor(int i = 1; i < powers.length; i++)\n\t\t\tif(binary.charAt(i) == '1')\n\t\t\t\tproduct = multiply(product, powers[i]);\n\t\t\n\t\treturn product;\n\t}\n\t\n\tpublic static long[][] exponentiate2(long[][] A, int pow) {\n\t\tString binary = Integer.toBinaryString(pow);\n\t\tlong[][][] powers = new long[binary.length()][A.length][A.length];\n\t\tpowers[powers.length-1] = A;\n\t\tfor(int i = powers.length-2; i >= 0; i--)\n\t\t\tstrassen(powers[i+1], powers[i+1], powers[i]);\n\t\t\n\t\tlong[][] product = powers[0];\n\t\tfor(int i = 1; i < powers.length; i++) {\n\t\t\tif(binary.charAt(i) == '1') {\n\t\t\t\tlong[][] temp = new long[A.length][A.length];\n\t\t\t\tstrassen(product, powers[i], temp);\n\t\t\t\tproduct = temp;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn product;\n\t}\n\t\n\tpublic static long[][] exponentiate3(long[][] A, int pow, long[][] B) {\n\t\tlong[][] product = B;\n\t\tfor(int i = 0; i < pow; i++) {\n\t\t\tproduct = multiply(A, product);\n\t\t}\n\t\t\n\t\treturn product;\n\t}\n\t\n\tpublic static long[][] exponentiate4(long[][] A, int pow, long[][] B) {\n\t\tString binary = Integer.toBinaryString(pow);\n\t\tlong[][][] powers = new long[binary.length()][A.length][A.length];\n\t\tpowers[powers.length-1] = A;\n\t\tfor(int i = powers.length-2; i >= 0; i--)\n\t\t\tpowers[i] = multiplyLowerTriangular(powers[i+1], powers[i+1]);\n\t\t\n\t\tlong[][] product = powers[0];\n\t\tint stop = 7;\n\t\tfor(int i = 1; i < Math.min(stop, binary.length()); i++)\n\t\t\tif(binary.charAt(i) == '1')\n\t\t\t\tproduct = multiplyLowerTriangular(product, powers[i]);\n\t\t\n\t\tint totalDone = 0;\n\t\tfor(int i = 0; i < Math.min(stop, binary.length()); i++) {\n\t\t\tif(binary.charAt(i) == '1')\n\t\t\t\ttotalDone += (1 << (binary.length()-i-1));\n\t\t}\n\t\t\n//\t\tSystem.out.println(\"HALFWAY: \" + (System.currentTimeMillis() - start) + \" milliseconds\");\n\t\t\n\t\tproduct = multiply(product, B);\n\t\tint rest = pow - totalDone;\n\t\tfor(int i = 0; i < rest; i++)\n\t\t\tproduct = multiply(A, product);\n\t\t\n\t\treturn product;\n\t}\n\t\n\tpublic static long[][] exponentiate5(long[][] A, int pow) {\n\t\tString binary = Integer.toBinaryString(pow);\n\t\tlong[][][] powers = new long[binary.length()][A.length][A.length];\n\t\tpowers[powers.length-1] = A;\n\t\tfor(int i = powers.length-2; i >= 0; i--)\n\t\t\tpowers[i] = multiplyLowerTriangular(powers[i+1], powers[i+1]);\n\t\t\n\t\tlong[][] product = powers[0];\n\t\tfor(int i = 1; i < powers.length; i++)\n\t\t\tif(binary.charAt(i) == '1')\n\t\t\t\tproduct = multiplyLowerTriangular(product, powers[i]);\n\t\t\n\t\treturn product;\n\t}\n\t\n\tpublic static long[][] multiply(long[][] A, long[][] B) {\n\t\tcountCall++;\n\t\t\n\t\tlong[][] C = new long[A.length][B[0].length];\n\t\tfor(int i = 0; i < A.length; i++)\n\t\t\tfor(int j = 0; j < B[0].length; j++)\n\t\t\t\tfor(int k = 0; k < A[0].length; k++)\n\t\t\t\t\tC[i][j] = (C[i][j] + A[i][k] * B[k][j]) % p;\n\t\t\n\t\treturn C;\n\t}\n\t\n\tpublic static long[][] multiplyLowerTriangular(long[][] A, long[][] B) {\n\t\tcountCall++;\n\t\t\n\t\tlong[][] C = new long[A.length][B[0].length];\n\t\tfor(int i = 0; i < A.length; i++)\n\t\t\tfor(int j = 0; j <= i; j++)\n\t\t\t\tfor(int k = 0; k < i-j+1; k++)\n\t\t\t\t\tC[i][j] = (C[i][j] + A[i][k+j] * B[k+j][j]) % p;\n\t\t\n\t\treturn C;\n\t}\n\t\n\tpublic static void naiveMultiply(long[][] A, long[][] B, long[][] C) {\n\t\tfor(int i = 0; i < A.length; i++)\n\t\t\tfor(int j = 0; j < B[0].length; j++)\n\t\t\t\tfor(int k = 0; k < A[0].length; k++)\n\t\t\t\t\tC[i][j] = (C[i][j] + A[i][k] * B[k][j]) % p;\n\t}\n\t\n\tpublic static void strassen(long[][] a1, long[][] b1, long[][] c) {\n\t\tint N = a1.length + (((a1.length & 1) == 1) ? 1 : 0);\n\t\t\n\t\tif(N <= 10) {\n\t\t\tnaiveMultiply(a1, b1, c);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tlong[][] a = new long[N][N];\n\t\tlong[][] b = new long[N][N];\n\t\tfor(int i = 0; i < a1.length; i++) {\n\t\t\tfor(int j = 0; j < a1[i].length; j++) {\n\t\t\t\ta[i][j] = a1[i][j];\n\t\t\t\tb[i][j] = b1[i][j];\n\t\t\t}\n\t\t}\n\t\t\n\t\tint half = N >> 1;\n\t\tlong[][][] sums = new long[14][half][half];\n\t\tfor(int i = 0; i < half; i++) {\n\t\t\tfor(int j = 0; j < half; j++) {\n\t\t\t\tsums[0][i][j] = (a[i][j] + a[i+half][j+half]) % p;\t\t//a11 + a22\n\t\t\t\tsums[1][i][j] = (b[i][j] + b[i+half][j+half]) % p;\t\t//b11 + b22\n\t\t\t\tsums[2][i][j] = (a[i+half][j] + a[i+half][j+half]) % p;\t//a21 + a22\n\t\t\t\tsums[3][i][j] = (b[i][j+half] - b[i+half][j+half]) % p;\t//b12 - b22\n\t\t\t\tsums[4][i][j] = (b[i+half][j] - b[i][j]) % p;\t\t\t\t//b21 - b11\n\t\t\t\tsums[5][i][j] = (a[i][j] + a[i][j+half]) % p;\t\t\t\t//a11 + a12\n\t\t\t\tsums[6][i][j] = (a[i+half][j] - a[i][j]) % p;\t\t\t\t//a21 - a11\n\t\t\t\tsums[7][i][j] = (b[i][j] + b[i][j+half]) % p;\t\t\t\t//b11 + b12\n\t\t\t\tsums[8][i][j] = (a[i][j+half] - a[i+half][j+half]) % p;\t//a12 - a22\n\t\t\t\tsums[9][i][j] = (b[i+half][j] + b[i+half][j+half]) % p;\t//b21 + b22\n\t\t\t\tsums[10][i][j] = a[i][j];\t\t\t\t\t\t\t//a11\n\t\t\t\tsums[11][i][j] = a[i+half][j+half];\t\t\t\t\t//a22\n\t\t\t\tsums[12][i][j] = b[i][j];\t\t\t\t\t\t\t//b11\n\t\t\t\tsums[13][i][j] = b[i+half][j+half];\t\t\t\t\t//b22\n\t\t\t}\n\t\t}\n\t\t\n\t\tlong[][][] Ms = new long[7][half][half];\n\t\t\n\t\tstrassen(sums[0], sums[1], Ms[0]);\n\t\tstrassen(sums[2], sums[12], Ms[1]);\n\t\tstrassen(sums[10], sums[3], Ms[2]);\n\t\tstrassen(sums[11], sums[4], Ms[3]);\n\t\tstrassen(sums[5], sums[13], Ms[4]);\n\t\tstrassen(sums[6], sums[7], Ms[5]);\n\t\tstrassen(sums[8], sums[9], Ms[6]);\n\t\t\n\t\tfor(int i = 0; i < half; i++)\n\t\t\tfor(int j = 0; j < half; j++)\n\t\t\t\tc[i][j] = (Ms[0][i][j] + Ms[3][i][j] - Ms[4][i][j] + Ms[6][i][j]) % p;\n\t\t\n\t\tfor(int i = 0; i < half; i++)\n\t\t\tfor(int j = 0; j+half < c[i].length; j++)\n\t\t\t\tc[i][j+half] = (Ms[2][i][j] + Ms[4][i][j]) % p;\n\t\t\n\t\tfor(int i = 0; i+half < c.length; i++)\n\t\t\tfor(int j = 0; j < half; j++)\n\t\t\t\tc[i+half][j] = (Ms[1][i][j] + Ms[3][i][j]) % p;\n\t\t\n\t\tfor(int i = 0; i+half < c.length; i++)\n\t\t\tfor(int j = 0; j+half < c[i].length; j++)\n\t\t\t\tc[i+half][j+half] = (Ms[0][i][j] - Ms[1][i][j] + Ms[2][i][j] + Ms[5][i][j]) % p;\n\t\t\n\t}\n\t\n\tpublic static ArrayList getFactors2(long N) {\n\t\tTreeSet set = new TreeSet<>();\n\t\tlong n = N;\n\t\tif(n % 2 == 0) {\n\t\t\tset.add(2L);\n\t\t\twhile(n % 2 == 0) {\n\t\t\t\tn >>= 1;\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(long i = 3; i <= Math.sqrt(n) && n > 1; i += 2) {\n\t\t\tif(n % i == 0) {\n\t\t\t\tset.add(i);\n\t\t\t\twhile(n % i == 0)\n\t\t\t\t\tn /= i;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(n > 1)\n\t\t\tset.add(n);\n\t\t\n\t\tArrayList primes = new ArrayList<>();\n\t\tfor(long i : set)\n\t\t\tprimes.add(i);\n\t\t\n\t\tArrayList> listFactors = new ArrayList<>();\n\t\tfor(int i = 0; i < set.size(); i++)\n\t\t\tlistFactors.add(new ArrayList());\n\t\t\n\t\tfor(int i = 0; i < listFactors.size(); i++) {\n\t\t\tArrayList temp = listFactors.get(i);\n\t\t\tlong p = primes.get(i);\n\t\t\tlong curr = 1;\n\t\t\twhile(N % curr == 0) {\n\t\t\t\ttemp.add(curr);\n\t\t\t\tcurr *= p;\n\t\t\t}\n\t\t}\n\t\t\n\t\tArrayList factors = new ArrayList();\n\t\trecurse(factors, listFactors, 1, 0);\n\t\tCollections.sort(factors);\n\t\t\n\t\treturn factors;\n\t}\n\t\n\tpublic static void recurse(ArrayList factors, ArrayList> listFactors, long curr, int index) {\n\t\tif(index == listFactors.size()) {\n\t\t\tfactors.add(curr);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tArrayList temp = listFactors.get(index);\n\t\tfor(long i : temp) {\n\t\t\trecurse(factors, listFactors, curr * i, index + 1);\n\t\t}\n\t}\n\t\n\tpublic static ArrayList getFactors(long N) {\n\t\tTreeSet set = new TreeSet<>();\n\t\tfor(long i = 1; i <= Math.sqrt(N); i++) {\n\t\t\tif(N % i == 0) {\n\t\t\t\tset.add(i);\n\t\t\t\tset.add(N/i);\n\t\t\t}\n\t\t}\n\t\t\n\t\tArrayList factors= new ArrayList<>();\n\t\tfor(long i : set)\n\t\t\tfactors.add(i);\n\t\t\n\t\treturn factors;\n\t}\n\t\n\t/**\n\t * Extended Euclidean algorithm find x such that ax = 1 (mod m)\n\t * @param a \n\t * @param m\n\t * @return modular inverse of a mod m\n\t */\n\tpublic static long modInverse(long a, long m) {\t\n\t\tlong[] a1 = {a, 1, 0};\n\t\tlong[] b1 = {m, 0, 1};\n\t\twhile(b1[0] != 0) {\n\t\t\tlong[] c1 = new long[3];\n\t\t\tlong q = a1[0] / b1[0];\n\t\t\tc1[0] = a1[0] - q * b1[0];\n\t\t\tc1[1] = a1[1] - q * b1[1];\n\t\t\tc1[2] = a1[2] - q * b1[2];\n\t\t\ta1 = b1;\n\t\t\tb1 = c1;\n\t\t}\n\t\t\n\t\tif(a1[1] < 0) a1[1] += m;\n\t\treturn a1[1];\n\t}\n\t\n\tpublic static long[][] setMarkovChain(ArrayList nFactors, int M) {\n\t\tint index = 0;\n\t\tHashMap mapIndex = new HashMap<>();\n\t\tfor(long i : nFactors)\n\t\t\tmapIndex.put(i, index++);\n\t\t\n\t\tboolean[][] factors = new boolean[M][M];\n\t\t\n\t\tfor(int col = 0; col < M; col++) {\n\t\t\tlong divisor = nFactors.get(col);\n\t\t\tfor(int row = 0; row < M; row++)\n\t\t\t\tif(nFactors.get(row) % divisor == 0)\n\t\t\t\t\tfactors[row][col] = true;\n\t\t}\n\t\t\n\t\tint[] sumRows = new int[M];\n\t\tfor(int i = 0; i < M; i++)\n\t\t\tfor(int j = 0; j < M; j++)\n\t\t\t\tif(factors[i][j])\n\t\t\t\t\tsumRows[i]++;\n\t\t\n\t\tlong[] inverses = new long[M];\n\t\tfor(int i = 0; i < M; i++)\n\t\t\tinverses[i] = modInverse(sumRows[i], p);\n\t\t\n\t\tlong[][] markovA = new long[M][M];\n\t\tfor(int i = 0; i < M; i++)\n\t\t\tfor(int j = 0; j < M; j++)\n\t\t\t\tif(factors[i][j])\n\t\t\t\t\tmarkovA[i][j] = inverses[i];\n\t\t\n\t\treturn markovA;\n\t}\n\t\n\tpublic static void print(boolean[][] a) {\n\t\tfor(int i = 0; i < a.length; i++) {\n\t\t\tfor(int j = 0; j < a[i].length; j++)\n\t\t\t\tSystem.out.print(a[i][j] ? 1 : 0);\n\t\t\tSystem.out.println();\n\t\t}\n\t\tSystem.out.println();\n\t}\n\t\n\tpublic static void print(long[][] a) {\n\t\tfor(int i = 0; i < a.length; i++) {\n\t\t\tfor(int j = 0; j < a[i].length; j++)\n\t\t\t\tSystem.out.print(a[i][j] + \" \");\n\t\t\tSystem.out.println();\n\t\t}\n\t\tSystem.out.println();\n\t}\n\n}\n/*\n6 1\noutputCopy\n3\ninputCopy\n6 2\noutputCopy\n875000008\ninputCopy\n60 5\noutputCopy\n237178099\n\n1000000000000 100\n976589177\n\n100000000 100\n141584224\n\n1000000000000000 10000\n215514159\n*/", "lang": "Java 8", "bug_code_uid": "25f682ae6bc54a0e52921820981084c1", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "apr_id": "d87e91735572e9126a9c3732b4ce6724", "difficulty": 2200, "tags": ["dp", "math", "probabilities", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.999378753365086, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\nimport java.io.*;\nimport java.lang.*;\nimport java.math.*;\npublic class D {\n public static int mod = 1000000007;\n public static void main(String[] args) throws Exception {\n BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n // Scanner scan = new Scanner(System.in);\n PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));\n // int n = Integer.parseInt(bf.readLine());\n StringTokenizer st = new StringTokenizer(bf.readLine());\n // int[] a = new int[n]; for(int i=0; i factorization = new HashMap();\n if(n % 2 == 0) {\n int count = 0;\n while(n % 2 == 0) {\n n /= 2;\n count++;\n }\n factorization.put(2L, count);\n }\n for(int i=3; i*i<=n; i+=2) {\n if(n % i == 0) {\n int count = 0;\n while(n % i == 0) {\n n /= i;\n count++;\n }\n factorization.put(i+0L, count);\n }\n }\n if(n > 1) {\n factorization.put(n+0L, 1);\n }\n\n long ans = 1;\n\n for(long p : factorization.keySet()) {\n int exp = factorization.get(p);\n // out.println(p + \" \" + exp);\n long[][] dp = new long[exp+1][k+1];\n dp[0][0] = 1L;\n for(int i=1; i<=exp; i++) dp[i][0] = (dp[i-1][0] * p) % mod;\n for(int j=0; j<=k; j++) dp[0][j] = 1L;\n for(int i=1; i<=exp; i++) {\n for(int j=1; j<=k; j++) {\n dp[i][j] = 1L*inv(i+1) * ((dp[i][j-1] + 1L*i*dp[i-1][j]) % mod) % mod;\n }\n }\n // out.println(dp[exp][k]);\n\n ans = (ans * dp[exp][k]) % mod;\n }\n\n out.println((ans % mod));\n\n\n\n // int n = scan.nextInt();\n\n out.close(); System.exit(0);\n }\n\n\n // Exponentation\n public static int exp(int base, int e) {\n if(e == 0) return 1;\n if(e == 1) return base;\n int val = exp(base, e/2);\n int ans = (int)(1L*val*val % mod);\n if(e % 2 == 1)\n ans = (int)(1L*ans*base % mod);\n return ans;\n }\n\n // Exponentation\n public static int inv(int base) {\n return exp(base, mod-2);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "ba5a65ed09b87b34572609ea31944542", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "apr_id": "42e8ebd247e8ada2523a0fb13e8c7aa8", "difficulty": 2200, "tags": ["dp", "math", "probabilities", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.19110378912685339, "equal_cnt": 24, "replace_cnt": 17, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 24, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.math.BigInteger;\npublic class Hello2019D {\n\t\n\tBufferedReader in;\n\tStringTokenizer st;\n\tPrintWriter ob;\n\t\n\tlong mod = (long)1e9+7;\n\t\n\tpublic static void main( String args[] ) throws IOException {\n\t\tnew Hello2019D().run();\n\t}\n\tvoid run() throws IOException {\n\t\tin = new BufferedReader ( new InputStreamReader( System.in ) );\n\t\tob = new PrintWriter( System.out );\n\t\tsolve();\n\t\tob.flush();\n\t}\n\tvoid solve() throws IOException {\n\t\tlong n = nl();\n\t\tint k = ni();\n\t\t\n\t\tlong result = 1;\n\t\tfor(int prime = 2 ; prime*prime<=n ; prime++) {\n\t\t\t\n\t\t\tint power = 0 ;\n\t\t\twhile( n%prime == 0 ) {\n\t\t\t\tpower++;\n\t\t\t\tn/=prime;\n\t\t\t}\n\t\t\t\n\t\t\tif( power > 0 ) {\n\t\t\t\tresult = result * solvePrime( (long)prime , power , k );\n\t\t\t\tresult = result % mod;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif( n>1 ) {\n\t\t\tresult *= solvePrime( n , 1 , k );\n\t\t\tresult %= mod;\n\t\t}\n\t\t\t\n\t\tob.println( result );\n\t}\n\t\n\tlong solvePrime( long prime , int power , int k ) \n\t{\n\t\tif( k==1 ) {\n\t\t\tlong numerator = (long)Math.pow( prime , power + 1 ) - 1;\n\t\t\tlong denominator = prime - 1; \n\t\t\tnumerator /= denominator;\n\t\t\t\n\t\t\treturn (( numerator * inverse( power+1 ) )%mod);\n\t\t}\n\t\t\n\t\tlong expectation = 1 ;\n\t\tfor( int i=1 ; i<=power ; i++ ) {\n\t\t\texpectation += solvePrime( prime , i , k-1 );\n\t\t\texpectation %= mod;\n\t\t}\n\t\treturn ((expectation * inverse( power+1 )) % mod);\n\t}\n\t\n\tlong inverse( long n ) {\n\t\treturn (new BigInteger(\"\"+n).modInverse( new BigInteger(\"\"+mod))).longValue(); \n\t}\n\t\n\tlong nl() throws IOException {\n\t\treturn Long.parseLong( nextToken() );\n\t}\n\tint ni() throws IOException {\n\t\treturn Integer.parseInt( nextToken() );\n\t}\n\tString nextToken() throws IOException {\n\t\tif( st == null || !st.hasMoreTokens() )\n\t\t\tst = new StringTokenizer( in.readLine() );\n\t\treturn st.nextToken();\n\t}\n}", "lang": "Java 8", "bug_code_uid": "11de910b241601b7c2d717a5f85c1815", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "apr_id": "8f0866c825b8c91bbf4759d03944128c", "difficulty": 2200, "tags": ["dp", "math", "probabilities", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8195462478184992, "equal_cnt": 14, "replace_cnt": 4, "delete_cnt": 7, "insert_cnt": 3, "fix_ops_cnt": 14, "bug_source_code": "\nimport java.lang.reflect.Array;\nimport java.util.ArrayDeque;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class D {\n static long mod = 1000000007;\n static long pow(long a, long b) {\n if (b == 0) {\n return 1;\n }\n if (b % 2 == 0) {\n return pow(a * a % mod, b / 2);\n } else {\n return pow(a * a % mod, b / 2) % mod * a % mod;\n }\n }\n\n\n\n static long res = 0;\n static long work(long[] f, int[] f2, long[][] ans, int idx, int c, long num, long pro) {\n if (c == idx) {\n// System.out.println(\"final \" + num + \" \" + pro);\n res += num * pro;\n res %= mod;\n\n return 0;\n }\n\n\n long sum = 0;\n\n\n for (int i = 0; i <= f2[c]; i++) {\n long[] ans_ = new long[2];\n ans_[0] =\n\n work(f, f2, ans, idx, c + 1, num * pow(f[c], i) % mod, pro * ans[c][i] % mod);\n\n //sum += ans_ [0] * ans_ [1];\n //sum %= mod;\n\n\n }\n\n return 0;\n }\n\n public static void main(String[] aaaa) {\n Scanner scanner = new Scanner(System.in);\n\n\n\n long n = scanner.nextLong();\n int k = scanner.nextInt();\n\n long[] f = new long[100];\n int[] f2 = new int[100];\n long[][] dp = new long[10005][105];\n long[][] ans = new long[105][105];\n int idx = 0;\n\n long nn = n;\n for (long i = 2; i * i < n; i++) {\n if (nn == 1) {\n break;\n }\n if (nn % i == 0) {\n //System.out.println(i);\n f[idx] = i;\n while (nn % i == 0) {\n nn /= i;\n f2[idx]++;\n }\n\n idx++;\n\n }\n }\n if (nn > 1) {\n f[idx] = nn;\n f2[idx]++;\n idx++;\n }\n// for (int i = 0; i < idx; i++) {\n// System.out.println(f[i] + \" \" + f2[i]);\n// }\n\n for (int i = 0; i < idx; i++) {\n Arrays.fill(dp[0], 0);\n dp[0][f2[i]] = 1;\n for (int j = 1; j <= k; j++) {\n// long sum = 0;\n for (int l = f2[i]; l >= 0; l--) {\n\n//\n// sum += dp[j - 1][l];\n// sum %= mod;\n long sum = 0;\n for (int m = f2[i]; m >= l; m--) {\n sum += (dp[j - 1][m] * pow(m + 1, mod - 2));\n sum %= mod;\n }\n\n dp[j][l] = sum;\n\n// System.out.println(j + \" \" + l + \" \" + dp[j][l]);\n }\n }\n\n for (int j = 0; j <= f2[i]; j++) {\n ans[i][j] = dp[k][j];\n }\n\n }\n\n work(f, f2, ans, idx, 0, 1, 1);\n System.out.println(res);\n\n\n\n\n\n }\n}\n", "lang": "Java 8", "bug_code_uid": "da46465de13cde230c905c022ae9b632", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "apr_id": "938b7cca99412126a1509ff8f037d815", "difficulty": 2200, "tags": ["dp", "math", "probabilities", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9663436123348018, "equal_cnt": 9, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 8, "bug_source_code": "import java.util.*;\nimport java.io.*;\n\npublic class MakotoAndBlackboard {\n public static long MOD = 1000000007;\n public static void main(String[] args) throws IOException {\n BufferedReader f = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));\n StringTokenizer st = new StringTokenizer(f.readLine());\n long n = Long.parseLong(st.nextToken());\n int k = Integer.parseInt(st.nextToken());\n ArrayList primes = getFacs(n);\n long ans = 1;\n for (int q = 0; q < primes.size(); q += 2) {\n long tnn = primes.get(q);\n int ct = primes.get(q + 1).intValue();\n long[][] dp = new long[k + 1][ct + 1];\n dp[0][ct] = 1L;\n for (int i = 0; i < k; i++) {\n for (int j = ct; j >= 0; j--) {\n for(int jj = j; jj >= 0; jj--){\n dp[i+1][jj] += (dp[i][j]*modInverse(j+1, MOD)) % MOD;\n dp[i+1][jj] %= MOD;\n }\n }\n }\n long val = 1;\n long expval = 0;\n for(int j = 0; j <= ct; j++){\n expval += (val*dp[k][j]) % MOD;\n expval %= MOD;\n val*=tnn;\n val%=MOD;\n }\n ans*=expval;\n ans%=MOD;\n }\n out.println(ans);\n out.close();\n\n }\n public static ArrayList getFacs(long n){\n ArrayList facs = new ArrayList();\n int ctt = 0;\n while(n % 2 == 0){\n n/=2;\n ctt++;\n }\n facs.add(2L);\n facs.add((long)ctt);\n for(long i = 3; i <= Math.sqrt(n)+0.000001; i+=2){\n if(n % i == 0){\n int ct = 0;\n while(n % i == 0){\n n/=i;\n ct++;\n }\n facs.add(i);\n facs.add((long)ct);\n }\n }\n if(n > 2){\n facs.add(n);\n facs.add(1L);\n }\n return facs;\n }\n\n public static long modInverse(long a, long m)\n {\n return power(a, m-2, m);\n }\n\n // To compute x^y under modulo m\n\n public static long power(long x, long y, long p)\n {\n // Initialize result\n long res = 1;\n\n // Update x if it is more\n // than or equal to p\n x = x % p;\n\n if (x == 0L) return 0L; // In case x is divisible by p;\n\n while (y > 0)\n {\n // If y is odd, multiply x\n // with result\n if((y & 1)==1)\n res = (res * x) % p;\n\n // y must be even now\n // y = y / 2\n y = y >> 1;\n x = (x * x) % p;\n }\n return res;\n }\n}\n", "lang": "Java 8", "bug_code_uid": "e1f84d00df37ac5ce273fe85b3e15993", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "apr_id": "252bee3e3d60ef17f010c98c14191f22", "difficulty": 2200, "tags": ["dp", "math", "probabilities", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.918918918918919, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*;\n\npublic class Main{\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int m = scanner.nextInt();\n int a = scanner.nextInt();\n int b = scnaner.nextInt();\n int amount = 0;\n if (m * a >= b) {\n amount = ((n / m) * b) + ((n % m) * a); \n } else {\n amount = n * a;\n }\n \n System.out.print(amount);\n }\n}", "lang": "Java 11", "bug_code_uid": "b6949fa0116c8d1e3006878dbae13433", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "apr_id": "bad4362e966f13e1782f86f04adfb7fb", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8409818569903948, "equal_cnt": 8, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 8, "bug_source_code": "import java.util.*;\n\npublic class Main\n{\n\n public static void main(String args[])\n {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int m = sc.nextInt();\n double a = sc.nextInt();\n double b = sc.nextInt();\n if(a<=(b/m))\n System.out.print((int)(n*a));\n else\n System.out.print((int)((n/m)*b + (n%m * a));\n }\n}", "lang": "Java 11", "bug_code_uid": "6b29a4e1ee64df63a446c2e946867a5e", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "apr_id": "c0c229d72d2184d694e644b24d0b654f", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9782923299565847, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*;\nimport java.lang.*;\nimport java.io.*;\npublic class VasyaAndSocks\n{\n public static void main(String args[]) \n {\n Scanner sc=new Scanner(System.in);\n int n=sc.nextInt();\n int m=sc.nextInt();\n int a=sc.nextInt();\n int b=sc.nextInt();\n int min=100000000;\n int maxM=n/m;\n for (int i=0; i<=maxM+1; i++)\n {\n if (i=maxM+1)\n {\n int c=(i*b);\n }\n else\n {\n int c=(i*b)+((n-(m*i))*a);\n }\n if (cb)\n\t\t\t\tpm=pm+nm.charAt(i);\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif(nm.charAt(i)=='0')\n\t\t\t\t\tpm=pm+\"1\";\n\t\t\t\t\telse\n\t\t\t\t\tpm=pm+\"0\";\n\t\t\t\t}\n\t\t\t\tif(pm.charAt(i)=='1')\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\tif(no rets = new ArrayList();\n\t for(int i = 0; i < digits; i++){\n\t \tnums[i] = Integer.parseInt(\"\"+val.charAt(i));\n\t \tif(nums[i] == 0)\n\t \t\tcontinue;\n\t \telse if(nums[i] == 2){\n\t \t\trets.add(2);\n\t \t}\n\t \telse if(nums[i] == 3){\n\t \t\trets.add(3);\n\t \t}\n\t \telse if(nums[i] == 4){\n\t \t\trets.add(3);\n\t \t\trets.add(2);\n\t \t\trets.add(2);\n\t \t}\n\t \telse if(nums[i] == 5){\n\t \t\trets.add(5);\n\t \t}\n\t \telse if(nums[i] == 6){\n\t \t\trets.add(5);\n\t \t\trets.add(3);\n\t \t}\n\t \telse if(nums[i] == 7){\n\t \t\trets.add(7);\n\t \t}\n\t \telse if(nums[i] == 8){\n\t \t\trets.add(7);\n\t \t\trets.add(2);\n\t \t\trets.add(2);\n\t \t\trets.add(2);\n\t \t}\n\t \telse if(nums[i] == 9){\n\t \t\trets.add(7);\n\t \t\trets.add(3);\n\t \t\trets.add(3);\n\t \t\trets.add(2);\n\t \t}\n\t }\n\t Collections.sort(rets);\n \tfor(int x = rets.size() - 1; x >= 0; x--)\n \t\tSystem.out.print(rets.get(x));\n \n\t /*\n\t int n = sc.nextInt(); // read input as integer\n\t long k = sc.nextLong(); // read input as long\n\t double d = sc.nextDouble(); // read input as double\n\t String str = sc.next(); // read input as String\n\t String s = sc.nextLine(); // read whole line as String\n\t */\n\t }\n}\n", "lang": "Java 8", "bug_code_uid": "f578d9abe9a67c128b753cd8bb5c4ef0", "src_uid": "7853e03d520cd71571a6079cdfc4c4b0", "apr_id": "a92539a1641a677090e2fc01709c9936", "difficulty": 1000, "tags": ["math", "constructive algorithms", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9834477190149374, "equal_cnt": 9, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 8, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\npublic class F {\nstatic int mod;\npublic static int sumOfSubsequence(int []a,int msk)\n{\n\tint max=1<k)\n\t\t\thi=mid-1;\n\t\telse\n\t\t{\n\t\t\tans=a[mid];\n\t\t\tlo=mid+1;\n\t\t}\n\t}\n\treturn ans;\n}\n\tpublic static void main(String[] args) throws IOException {\n\t\tScanner sc=new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tint n1=n/2;int n2=n-n1;\n\t\tmod=sc.nextInt();\n\t\tint []a1=new int[n1];int []a2=new int [n2]; \n\t\tfor(int i=0;i a = new ArrayList<>();\n\t\tlong sum = 0;\n\t\t\n\t\tfor (int i = 0; i < n; ++i) {\n\t\t\ta.add(rL());\n\t\t\tsum = (sum + a.get(i)) % m;\n\t\t\t;\n\t\t}\n\t\tlong ans = 0;\n\t\t\n\t\tfor(int j=0;j<7;++j){\n\t\t\tCollections.shuffle(a);\n\t\t\t\n\t\t\tfor (int i = 1; i <= (int) Math.pow(2, Math.min(18, n)); ++i) {\n\t\t\t\tlong curAns = 0;\n\t\t\t\tfor (int bit = 0; bit < Math.min(18, n); ++bit) {\n\t\t\t\t\tif (checkBit(i, bit) == 1) {\n\t\t\t\t\t\tcurAns = (curAns + a.get(bit)) % m;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tans = Math.max(curAns, ans);\n\t\t\t}\n\t\t\tCollections.shuffle(a);\n\t\t\tfor (int i = 1; i <= (int) Math.pow(2, Math.min(18, n)); ++i) {\n\t\t\t\tlong curAns = sum;\n\t\t\t\tfor (int bit = 0; bit < Math.min(20, n); ++bit) {\n\t\t\t\t\tif (checkBit(i, bit) == 1) {\n\t\t\t\t\t\tcurAns = (curAns - a.get(bit) % m + m) % m;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tans = Math.max(curAns, ans);\n\t\t\t}\n\t\t}\n\t\t\n\n\t\tout.println(ans);\n\t}\n\n\tclass SegmentTree {\n\t\tint[] t;\n\n\t\tSegmentTree(int[] a, int n) {\n\t\t\tt = new int[4 * n];\n\t\t\tbuild(a, 1, 1, n);\n\t\t}\n\n\t\tvoid build(int[] a, int v, int tl, int tr) {\n\t\t\tif (tl == tr) {\n\t\t\t\tt[v] = a[tl];\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tint tm = (tl + tr) / 2;\n\t\t\tbuild(a, 2 * v, tl, tm);\n\t\t\tbuild(a, 2 * v + 1, tm + 1, tr);\n\t\t\tt[v] = Math.min(t[2 * v], t[2 * v + 1]);\n\t\t}\n\n\t\tvoid update(int v, int tl, int tr, int pos, int value) {\n\t\t\tif (tl == tr) {\n\t\t\t\tt[v] = value;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tint tm = (tl + tr) / 2;\n\t\t\tif (pos <= tm) {\n\t\t\t\tupdate(2 * v, tl, tm, pos, value);\n\t\t\t} else {\n\t\t\t\tupdate(2 * v + 1, tm + 1, tr, pos, value);\n\t\t\t}\n\n\t\t\tt[v] = Math.min(t[2 * v], t[2 * v + 1]);\n\t\t}\n\n\t\tint getMin(int v, int tl, int tr, int l, int r) {\n\t\t\tif (l > r) {\n\t\t\t\treturn INF;\n\t\t\t}\n\t\t\tif (tl == l && tr == r) {\n\t\t\t\treturn t[v];\n\t\t\t}\n\n\t\t\tint tm = (tl + tr) / 2;\n\n\t\t\tint min1 = getMin(2 * v, tl, tm, l, Math.min(tm, r));\n\t\t\tint min2 = getMin(2 * v + 1, tm + 1, tr, Math.max(l, tm + 1), r);\n\n\t\t\treturn Math.min(min1, min2);\n\t\t}\n\t}\n\n\tint checkBit(int mask, int bit) {\n\t\treturn (mask >> bit) & 1;\n\t}\n\n\tpublic static void main(String[] args) throws IOException {\n\n\t\tnew Problem().run();\n\t}\n\n\tboolean isLower(char a) {\n\t\treturn ((int) a) >= 97 ? true : false;\n\t}\n\n\tint INF = Integer.MAX_VALUE - 12345;\n\n\tint[][] STEPS = { { 0, 1 }, { 1, 0 }, { -1, 0 }, { 0, -1 } };\n\n\tBufferedReader in;\n\tPrintWriter out;\n\tStringTokenizer tok;\n\tRandom rnd = new Random();\n\tstatic final boolean ONLINE_JUDGE = System.getProperty(\"ONLINE_JUDGE\") != null;\n\n\tProblem() throws FileNotFoundException {\n\n\t\ttry {\n\t\t\tin = new BufferedReader(new FileReader(\"input.txt\"));\n\t\t\tout = new PrintWriter(\"output.txt\");\n\t\t} catch (Exception e) {\n\t\t\tin = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tout = new PrintWriter(System.out);\n\t\t}\n\n\t\ttok = new StringTokenizer(\"\");\n\t}\n\n\tlong checkBit(long mask, int bit) {\n\t\treturn (mask >> bit) & 1;\n\t}\n\n\t// ======================================================\n\n\t// ======================================================\n\tvoid run() throws IOException {\n\t\tsolve();\n\t\tout.close();\n\t}\n\n\tchar[] reverseCharArray(char[] arr) {\n\t\tchar[] ans = new char[arr.length];\n\t\tfor (int i = 0; i < arr.length; ++i) {\n\t\t\tans[i] = arr[arr.length - i - 1];\n\t\t}\n\t\treturn ans;\n\t}\n\n\tint sqrt(double m) {\n\t\tint l = 0;\n\t\tint r = 1000000000 + 9;\n\t\tint i = 1000;\n\t\twhile (r - l > 1) {\n\t\t\tint mid = (r + l) / 2;\n\t\t\tif (mid * mid > m) {\n\t\t\t\tr = mid;\n\t\t\t} else {\n\t\t\t\tl = mid;\n\t\t\t}\n\t\t}\n\t\treturn l;\n\t}\n\n\tint countPow(int m, int n) {\n\t\tint ans = 0;\n\t\twhile (m % n == 0 && m > 0) {\n\t\t\tans++;\n\t\t\tm /= n;\n\t\t}\n\t\treturn ans;\n\t}\n\n\tlong binPow(long a, long b) {\n\t\tif (b == 0) {\n\t\t\treturn 1;\n\t\t}\n\t\tif (b % 2 == 1) {\n\t\t\treturn a * binPow(a, b - 1);\n\t\t} else {\n\t\t\tlong c = binPow(a, b / 2);\n\t\t\treturn c * c;\n\t\t}\n\n\t}\n\n\tint gcd(int a, int b) {\n\t\treturn b == 0 ? a : gcd(b, a % b);\n\t}\n\n\tlong pow(long x, long k) {\n\t\tlong ans = 1;\n\t\tfor (int i = 0; i < k; ++i) {\n\t\t\tans *= x;\n\t\t}\n\t\treturn ans;\n\t}\n\n\tclass Fenwik {\n\t\tprivate long[] t;\n\t\tprivate int length;\n\n\t\tFenwik(int[] a) {\n\t\t\tthis.length = a.length + 100;\n\t\t\tthis.t = new long[length];\n\t\t\tfor (int i = 0; i < a.length; ++i) {\n\t\t\t\tthis.inc(i, a[i]);\n\t\t\t}\n\t\t}\n\n\t\tvoid inc(int i, int delta) {\n\t\t\tfor (; i < this.length; i = i | (i + 1)) {\n\t\t\t\tthis.t[i] += delta;\n\t\t\t}\n\t\t}\n\n\t\tlong getSum(int r) {\n\t\t\tlong sum = 0;\n\n\t\t\tfor (; r >= 0; r = (r & (r + 1)) - 1) {\n\t\t\t\tsum += this.t[r];\n\t\t\t}\n\n\t\t\treturn sum;\n\t\t}\n\t}\n\n\t// ////////////////////////////////////////////////////////////////////\n\n\tString delimiter = \" \";\n\n\tString readLine() throws IOException {\n\t\treturn in.readLine();\n\t}\n\n\tString rS() throws IOException {\n\t\twhile (!tok.hasMoreTokens()) {\n\t\t\tString nextLine = readLine();\n\t\t\tif (null == nextLine)\n\t\t\t\treturn null;\n\n\t\t\ttok = new StringTokenizer(nextLine);\n\t\t}\n\n\t\treturn tok.nextToken(delimiter);\n\t}\n\n\tint rI() throws IOException {\n\t\treturn Integer.parseInt(rS());\n\t}\n\n\tlong rL() throws IOException {\n\t\treturn Long.parseLong(rS());\n\t}\n\n\tdouble rD() throws IOException {\n\t\treturn Double.parseDouble(rS());\n\t}\n\n\tint[] rA(int b) {\n\t\tint a[] = new int[b];\n\t\tfor (int i = 0; i < b; i++) {\n\t\t\ttry {\n\t\t\t\ta[i] = rI();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t\treturn a;\n\t}\n\n\tint[] readSortedIntArray(int size) throws IOException {\n\t\tInteger[] array = new Integer[size];\n\n\t\tfor (int index = 0; index < size; ++index) {\n\t\t\tarray[index] = rI();\n\t\t}\n\t\tArrays.sort(array);\n\n\t\tint[] sortedArray = new int[size];\n\t\tfor (int index = 0; index < size; ++index) {\n\t\t\tsortedArray[index] = array[index];\n\t\t}\n\n\t\treturn sortedArray;\n\t}\n\n\tint[] sortedIntArray(int size, int[] array) throws IOException {\n\t\tfor (int index = 0; index < size; ++index) {\n\t\t\tarray[index] = rI();\n\t\t}\n\t\tArrays.sort(array);\n\n\t\tint[] sortedArray = new int[size];\n\t\tfor (int index = 0; index < size; ++index) {\n\t\t\tsortedArray[index] = array[index];\n\t\t}\n\n\t\treturn sortedArray;\n\t}\n}", "lang": "Java 8", "bug_code_uid": "5a06b8ac122086198a3d038195f5593c", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "apr_id": "7a2fa16aaf57aed05b8338bf56d82cdb", "difficulty": 1800, "tags": ["divide and conquer", "meet-in-the-middle", "bitmasks"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5837372105546581, "equal_cnt": 14, "replace_cnt": 5, "delete_cnt": 3, "insert_cnt": 6, "fix_ops_cnt": 14, "bug_source_code": "import java.util.HashSet;\nimport java.util.Iterator;\nimport java.util.Scanner;\nimport java.util.Set;\n\npublic class MaxSubSeq {\npublic static void main(String[] args) {\n\tScanner s = new Scanner(System.in);\n\tint n = s.nextInt();\n\tint m = s.nextInt();\n\tint[] a = new int[n];\n\tfor (int i = 0; i < a.length; i++) {\n\t\ta[i] = s.nextInt();\n\t}\n\ts.close();\n\tSet obtained = new HashSet<>();\n\tobtained.add(0);\n\tfor (int i = 0; i it = obtained.iterator();\n\twhile(it.hasNext()) {\n\t\tmax = Math.max(it.next(), max);\n\t}\n\tSystem.out.println(max);\n\t\n}\n}\n", "lang": "Java 8", "bug_code_uid": "7536040ed768fd6dbbdee794070e8934", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "apr_id": "191c3472f1fa6c76bc670f851e17d3d4", "difficulty": 1800, "tags": ["divide and conquer", "meet-in-the-middle", "bitmasks"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.34882856080327257, "equal_cnt": 26, "replace_cnt": 18, "delete_cnt": 1, "insert_cnt": 6, "fix_ops_cnt": 25, "bug_source_code": "//package Round;\n\nimport java.util.ArrayList;\nimport java.util.HashSet;\nimport java.util.Iterator;\nimport java.util.Scanner;\n\npublic class E {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int m = scanner.nextInt();\n\n HashSet set = new HashSet<>((int) (n / 0.75 + 2));\n\n for (int i = 0; i < n; i++) {\n int e = scanner.nextInt() % m;\n\n ArrayList a = new ArrayList<>(set.size());\n Iterator iterator = set.iterator();\n\n while (iterator.hasNext()) {\n a.add((iterator.next() + e) % m);\n }\n\n set.addAll(a);\n set.add(e);\n }\n\n int max_value = Integer.MIN_VALUE;\n Iterator iterator = set.iterator();\n\n while (iterator.hasNext()) {\n max_value = max(iterator.next(), max_value);\n }\n\n System.out.println(max_value);\n }\n\n private static int max(int a, int b) {\n return (a > b) ? a : b;\n }\n}\n", "lang": "Java 8", "bug_code_uid": "afe7d6a49bda47586049d4c5bd1c0377", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "apr_id": "0b473caf9479f80ac35b59a03a7a5250", "difficulty": 1800, "tags": ["divide and conquer", "meet-in-the-middle", "bitmasks"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8821477324435006, "equal_cnt": 15, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 14, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.IOException;\nimport java.io.PrintWriter;\nimport java.math.BigDecimal;\nimport java.util.Arrays;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.PriorityQueue;\nimport java.util.Random;\nimport java.util.StringTokenizer;\nimport java.util.TreeSet;\nimport java.util.TreeMap;\n\nimport static java.lang.Math.*;\nimport static java.util.Arrays.copyOf;\nimport static java.util.Arrays.fill;\nimport static java.util.Arrays.sort;\nimport static java.util.Collections.reverse;\nimport static java.util.Collections.reverseOrder;\nimport static java.util.Collections.sort;\n\npublic class Main {\n private FastScanner in;\n private PrintWriter out;\n\n private void solve() throws IOException {\n long n = in.nextLong(), m = in.nextLong();\n long[] a = new long[(int) n];\n for (int i = 0; i < n; i++) {\n a[i] = in.nextLong();\n }\n long ans = 0, sum, k = (long) 1 << n;\n int j;\n for (long i = 1, c; i < k; i++) {\n sum = 0;\n for (j = 0, c = i; j < n; j++, c /= 2) {\n if (c % 2 == 1)\n sum += a[j];\n }\n ans = max(ans, sum % m);\n }\n out.println(ans);\n }\n\n private void solveA() throws IOException {\n\n }\n\n private void solveB() throws IOException {\n\n }\n\n private void solveC() throws IOException {\n\n }\n\n private void solveD() throws IOException {\n\n }\n\n private void solveE() throws IOException {\n\n }\n\n class FastScanner {\n StringTokenizer st;\n BufferedReader br;\n\n FastScanner(InputStream s) {\n br = new BufferedReader(new InputStreamReader(s));\n }\n\n String next() throws IOException {\n while (st == null || !st.hasMoreTokens())\n st = new StringTokenizer(br.readLine());\n return st.nextToken();\n }\n\n boolean hasNext() throws IOException {\n return br.ready() || (st != null && st.hasMoreTokens());\n }\n\n int nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n\n long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n\n double nextDouble() throws IOException {\n return Double.parseDouble(next());\n }\n\n String nextLine() throws IOException {\n return br.readLine();\n }\n\n boolean hasNextLine() throws IOException {\n return br.ready();\n }\n }\n\n private void run() throws IOException {\n in = new FastScanner(System.in); // new FastScanner(new FileInputStream(\".in\"));\n out = new PrintWriter(System.out); // new PrintWriter(new FileOutputStream(\".out\"));\n\n solve();\n\n out.flush();\n out.close();\n }\n\n public static void main(String[] args) throws IOException {\n new Main().run();\n }\n}\n", "lang": "Java 8", "bug_code_uid": "25a1cfc43e58702a0bf9ac6b0ed2c6b6", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "apr_id": "e6865cdf3a736408bbd6cd78a707c437", "difficulty": 1800, "tags": ["divide and conquer", "meet-in-the-middle", "bitmasks"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6403508771929824, "equal_cnt": 19, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 10, "fix_ops_cnt": 18, "bug_source_code": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class SaveLuke {\n\n\tpublic static void main(String[] args) {\n\t\t\n\t\n\tScanner sc = new Scanner(System.in);\n\tint n = sc.nextInt();\n\tint [] a = new int[n];\n\tboolean occ [] = new boolean[(int)1e9 + 1];\n\tfor (int i = 0; i < n; i++) {\n\t\ta[i] = sc.nextInt();\n\t}\n\tArrays.sort(a);\n\tlong sum = 0;\n\tfor (int i = 0; i < n; i++) {\n\t\tif(!occ[a[i]])\n\t\tsum += a[i];\n\t\telse\n\t\t{\n\t\t\ta[i]--;\n\t\t\tsum+= a[i];\n\t\t}\n\t\tocc[a[i]] = true;\n\t}\n\tSystem.out.println(sum);\n\t\n}\n}\n", "lang": "Java 8", "bug_code_uid": "88ff333e182d04a1bbf2741fa0500cc9", "src_uid": "3c4b2d1c9440515bc3002eddd2b89f6f", "apr_id": "812b6b7772854fd4f9035da90dd43cfa", "difficulty": 1100, "tags": ["greedy", "sortings"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9978632478632479, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\npublic class Practice {\n public static void main(String args[])\n {\n Scanner in = new Scanner(System.in);\n int N = in.nextInt();\n String s = in.next();\n \n int countSF = 0;\n int countFS = 0;\n for (int i = 0; i < s.length() - 1; i++)\n {\n if (s.charAt(i) == 'S' && s.charAt(i + 1) == 'F')\n {\n countSF++;\n }\n if (s.charAt(i) == 'S' && s.charAt(i - 1) == 'S')\n {\n countFS++;\n }\n }\n if (countSF > countFS)\n {\n System.out.println(\"YES\");\n } else\n {\n System.out.println(\"NO\");\n }\n }\n }", "lang": "Java 8", "bug_code_uid": "570beb8ed32b5b2dd296047a048814a8", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "apr_id": "750f98bd529c675ec399e1d2db135adc", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.3090802118062365, "equal_cnt": 21, "replace_cnt": 15, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 21, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.math.BigInteger;\nimport java.util.Arrays;\nimport java.util.Comparator;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Queue;\n\n\npublic class CF515C {\n\n\tstatic long[] memo;\n\tstatic int[] candidates = new int[]{2,3,4,5,6,7,8,9};\n\tstatic BigInteger fNum, max = BigInteger.ZERO;\n\tpublic static void main(String[] args) throws Exception {\n\t\tmemo = new long[10];\n\t\tmemo[0]=1;\n\t\tmemo[1]=1;\n\t\tfor(int i=2;i c = new LinkedList();\n\t\t\tfor(int i=0;i0){\n\t\t\t\t\tres = actual;\n\t\t\t\t\tencontre=true;\n\t\t\t\t}else{\n\t\t\t\t\tif(valuF.compareTo(fNum)<0){\n\t\t\t\t\t\tfor(int i=0;i() {\n\t\t\t\tpublic int compare(Integer o1, Integer o2) {\n\t\t\t\t\treturn o2.intValue()-o1.intValue();\n\t\t\t\t}\n\t\t\t});\n\t\t\t\n\t\t\tfor(int i=0;i list){\n\t\tString x = \"\";\n\t\tfor(int xx: list){\n\t\t\tx= x+xx;\n\t\t}\n\t\treturn f(x);\n\t}\n\t\n\tstatic BigInteger f(String n ){\n\t\tBigInteger x = BigInteger.ONE;\n\t\tfor(int i=0;i B) {\n \n for (int i = 0; i < B.size(); i++) {\n v[B.get(i).intValue()]=1;\n }\n int as=0;\n Collections.sort(B);\n int ans = 0;\n for (int i = 0; i < B.size(); i++) {\n if(!(i+1 A.charAt(j))\n // c++;\n // }\n // Vector v = new Vector(52);\n // for (int ii = 0; ii < 52; ii++) {\n // v.add(0L);\n // }\n // for (int j = i; j < A.length(); j++) {\n // int index;\n // if (A.charAt(j) >= 'A' && A.charAt(j) <= 'Z') {\n // index = (int) (A.charAt(j) - 'A');\n // } else {\n // index = (int) (A.charAt(j) - 'a' + 26);\n // }\n // Long obj = v.get(index);\n // obj++;\n // v.setElementAt(obj, index);\n // }\n // long d_fac = 1;\n // for (int ii = 0; ii < 52; ii++) {\n // long n4 = v.get(ii);\n // d_fac *= factorial(n4);\n // }\n // d_fac = po(d_fac, mod - 2L, mod);\n // if (c <= 0)\n // continue;\n // long n = A.length() - 1 - i;\n // long n1 = c * factorial(n) % mod;\n // ans += (n1 * d_fac) % mod;\n // }\n // return (int) ((ans + 1) % mod); \n // }\n\n static long factorial(long n) {\n\n // single line to find factorial\n return (n == 1L || n == 0L) ? 1L : n * factorial(n - 1) % 1000003L;\n\n }\n public static int[] int2Array(int num) {\n return Integer.toString(num).chars().map(c -> c-'0').toArray(); \n }\n \n static long modexp(long x, long y, long p) {\n long res = 1;\n x = x % p;\n while (y > 0) {\n if ((y & 1) == 1)\n res = (res * x) % p;\n y = y >> 1;\n x = (x * x) % p;\n }\n return res;\n }\n \n public static ArrayList arr2arrlist(int arr[]) {\n ArrayList array_list = new ArrayList();\n\n // Using add() method to add elements in array_list\n for (int i = 0; i < arr.length; i++)\n array_list.add(new Integer(arr[i]));\n return array_list;\n }\n \n}", "lang": "Java 8", "bug_code_uid": "e5301afd7223e55f1cf694176ee2d4cb", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "apr_id": "90e225fc3ebd0216e3cd240988cb08ff", "difficulty": 1200, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9421487603305785, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*;\nimport java.util.*;\npublic class HeidiLearnsHashing \n{\n\tpublic static void main(String[] s)\n\t{\n\t\tint j,count=0;\n\t\tlong r,x=0,y=0;\n\t\tScanner sc=new Scanner(System.in);\n\t\tr=sc.nextLong();\n\t\tr--;\n\t\tif(r!=0)\n\t\t{\t\n\t\tfor(j=1;j<=(1000000);j++)\n\t\t{\n\t\t\tif(count==1)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\tif(r%j==0)\n\t\t\t{\n\t\t\t\tif(((r/j)-(j+1))>0 && ((r/j)-(j+1))%2==0)\n\t\t\t\t{\n\t\t\t\t\tcount=1;\n\t\t\t\t\tx=j;\n\t\t\t\t\ty=(((r/j)-(j+1))/2);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tcount==1;\n\t\t\tx=0;\n\t\t\ty=0;\n\t\t}\n\t\tif(count==1)\n\t\tSystem.out.println(x+\" \"+y);\n\t\telse\n System.out.println(\"NO\");\t\t\n\t}\n}", "lang": "Java 8", "bug_code_uid": "7726d7995eaeeb1e99342ce8ab2a0885", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "apr_id": "ff08d45b5808f749d073ef097fb76e51", "difficulty": 1200, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.996078431372549, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\n/**\n *\n * @author revo\n */\npublic class Proj1 {\n\n /**\n * @param args the command line arguments\n */\n public static void main(String[] args) throws IOException {\n BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n int k = Integer.parseInt(in.readLine()) * 2;\n int [] IntArray= new int[10];\n String line=\"\";\n for(int i=0; i< 4 ; i++){\n line += in.readLine();\n }\n boolean valid=true;\n for(int i=0; i<16 ;i++){\n if(Character.isDigit(line.charAt(i))){\n int index = Character.digit(line.charAt(i), 10);\n \n IntArray[index]++;\n if(k < IntArray[index]) valid=false; \n }\n }\n \n if(valid){\n System.out.println(\"YES\");\n }else{\n System.out.println(\"NO\");\n }\n \n \n \n \n }", "lang": "Java 8", "bug_code_uid": "5c3af69be6fe1413b480e1e08c3600bc", "src_uid": "5fdaf8ee7763cb5815f49c0c38398f16", "apr_id": "5ba1cbe39c4fcafa4c5d6e5cfcdf027c", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9443651925820257, "equal_cnt": 1, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args){\n Scanner scn = new Scanner(System.in);\n int n = scn.nextInt()*2;\n String res =\"YES\";\n\n String f = \"\";\n int[] s = new int[10];\n for(int i = 0;i<4;i++){\n f = scn.next();\n for(int k = 0;k<4;k++){\n for(int j =1;j<10;j++){\n if((f.charAt(k)+\"\").equals(j+\"\")){\n s[j]+=1;\n }\n }\n }\n }\n\n for(int i=1;i=0)System.out.println(\"YES\");\n else\n System.out.println(\"NO\");\n }\n}", "lang": "Java 8", "bug_code_uid": "13be565e648dc0129348314b553562c1", "src_uid": "5fdaf8ee7763cb5815f49c0c38398f16", "apr_id": "1b6c68dfea693638aed1effb04dc8876", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9203539823008849, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int weight = scanner.nextInt();\n if(weight%2==0){\n System.out.println(\"YES\");\n } else {\n System.out.println(\"NO\");\n } while (true){\n \n }\n }\n\n}", "lang": "Java 11", "bug_code_uid": "99a4baa57a5fc88bd3d9981d1dabfed8", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "apr_id": "37058b706b09dc9388c36f67e7e06aad", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9848812095032398, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "//package contest;\n\nimport java.util.*;\n\npublic class test {\n public static String num;\n\n public static void main(String[] args) {\n // Scanner sc = new Scanner(System.in);\n // String line = sc.nextLine();\n // String[] str = line.split(\" \");\n // num = str[0];\n // int []sorted = new int[num.length()];\n // Arrays.sort(sorted);\n // int swaps = Integer.parseInt(str[1]);\n\n // int nextMax;\n // while (swaps != 0) {\n // int max =0;\n // int maxPos=0;\n // int start=0;\n // for (int i = start; i < num.length() && i < swaps; i++) {\n // int current = Integer.parseInt(num.charAt(i) + \"\");\n // if(current > max){\n // max = current;\n // maxPos=i;\n // }\n // }//end for.\n // int newSwaps = swap(maxPos,swaps);\n // int diff= swaps -newSwaps;\n // swaps = newSwaps;\n // start = maxPos-diff+1;\n // System.out.println(start);\n // }//end while.\n // System.out.println(num);\n\n // num =\"12345678\";\n // swap(7,8);\n // System.out.println(num);\n\n Scanner sc = new Scanner(System.in);\n String line = sc.nextLine();\n String[] str = line.split(\" \");\n num = str[0];\n // int []sorted = new int[num.length()];\n // Arrays.sort(sorted);\n int swaps = Integer.parseInt(str[1]);\n Queue pq = new LinkedList();\n\n // int loopNum=9;\n // while(loopNum>0){\n // for(int i=0;i 0) {\n // System.out.println(\"swaps = \"+swaps);\n int loopNum = 9;\n pq = new LinkedList();\n while (loopNum >= 0) {\n for (int i = start; i < num.length()\n && i <= (swaps + start); i++) {\n // System.out.println(i+\" /////////////////////\");\n int number = Integer.parseInt(num.charAt(i) + \"\");\n if (number == loopNum) {\n // System.out.println(num.charAt(i)+\" , \"+i);\n pq.add(i);\n }\n }\n loopNum--;\n // System.out.println(loopNum+\"--------------------------\");\n }// end while\n\n int next = pq.poll();\n // System.out.println(next);\n int newSwaps = swap(next, swaps);\n int diff = swaps - newSwaps;\n swaps = newSwaps;\n start = next - diff + 1;\n // System.out.println(\"start = \"+start);\n }\n System.out.println(num);\n }\n }// end main\n\n public static int swap(int pos, int swaps) {\n // System.out.println(pos +\" , \"+swaps );\n int number = Integer.parseInt(num.charAt(pos) + \"\");\n int newPos = pos - 1;\n while ((newPos >= 0)\n && Integer.parseInt(num.charAt(newPos) + \"\") < number\n && swaps > 0) {\n swaps--;\n newPos--;\n\n }\n String newNum = \"\";\n for (int j = 0; j <= newPos; j++) {\n newNum += num.charAt(j);\n }\n newNum += number;\n for (int j = newPos + 1; j < pos; j++) {\n newNum += num.charAt(j);\n }\n for (int j = pos + 1; j < num.length(); j++) {\n newNum += num.charAt(j);\n }\n num = newNum;\n return swaps;\n }\n}// end class\n// 9090000078001234 6", "lang": "Java 7", "bug_code_uid": "4983c10754d3a5184d568e1a2f5cb170", "src_uid": "e56f6c343167745821f0b18dcf0d0cde", "apr_id": "6d61ff8b185563b2ad9d6152caf7ec94", "difficulty": 1400, "tags": ["greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9472108843537415, "equal_cnt": 16, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 13, "fix_ops_cnt": 15, "bug_source_code": "//package contest;\n\nimport java.util.*;\n\npublic class test {\n public static String num;\n\n public static void main(String[] args) {\n // Scanner sc = new Scanner(System.in);\n // String line = sc.nextLine();\n // String[] str = line.split(\" \");\n // num = str[0];\n // int []sorted = new int[num.length()];\n // Arrays.sort(sorted);\n // int swaps = Integer.parseInt(str[1]);\n\n // int nextMax;\n // while (swaps != 0) {\n // int max =0;\n // int maxPos=0;\n // int start=0;\n // for (int i = start; i < num.length() && i < swaps; i++) {\n // int current = Integer.parseInt(num.charAt(i) + \"\");\n // if(current > max){\n // max = current;\n // maxPos=i;\n // }\n // }//end for.\n // int newSwaps = swap(maxPos,swaps);\n // int diff= swaps -newSwaps;\n // swaps = newSwaps;\n // start = maxPos-diff+1;\n // System.out.println(start);\n // }//end while.\n // System.out.println(num);\n\n // num =\"12345678\";\n // swap(7,8);\n // System.out.println(num);\n\n Scanner sc = new Scanner(System.in);\n String line = sc.nextLine();\n String[] str = line.split(\" \");\n num = str[0];\n int swaps = Integer.parseInt(str[1]);\n int biggestNumInRange ;\n\n \n if (num.length() == 1) {\n //special case.\n System.out.println(num);\n } else {\n int start = 0;\n while (swaps > 0 &&start!=(num.length()-1)) {\n// System.out.println(\"swaps = \"+swaps);\n \n biggestNumInRange=getBiggestNumInRange(start,swaps);\n // System.out.println(next);\n int newSwaps = swap(biggestNumInRange, swaps);\n int diff = swaps - newSwaps;\n swaps = newSwaps;\n start = biggestNumInRange - diff + 1;\n // System.out.println(\"start = \"+start);\n }\n System.out.println(num);\n }//end if special case.\n }// end main\n\n public static int swap(int pos, int swaps) {\n // System.out.println(pos +\" , \"+swaps );\n int number = Integer.parseInt(num.charAt(pos) + \"\");\n int newPos = pos - 1;\n while ((newPos >= 0)\n && Integer.parseInt(num.charAt(newPos) + \"\") < number\n && swaps > 0) {\n swaps--;\n newPos--;\n\n }\n String newNum = \"\";\n for (int j = 0; j <= newPos; j++) {\n newNum += num.charAt(j);\n }\n newNum += number;\n for (int j = newPos + 1; j < pos; j++) {\n newNum += num.charAt(j);\n }\n for (int j = pos + 1; j < num.length(); j++) {\n newNum += num.charAt(j);\n }\n num = newNum;\n return swaps;\n }//end method.\n \n public static int getBiggestNumInRange(int start , int limit){\n int biggestNumInRange=0;\n int loopNum = 9;\n while (loopNum >= 0) {\n for (int i = start; i < num.length()\n && i <= (limit + start); i++) {\n // System.out.println(i+\" /////////////////////\");\n int number = Integer.parseInt(num.charAt(i) + \"\");\n if (number == loopNum) {\n// System.out.println(num.charAt(i)+\" , \"+i);\n biggestNumInRange=i;\n }\n }\n loopNum--;\n }// end while\n return biggetNumInRange\n }//end method.\n}// end class\n", "lang": "Java 7", "bug_code_uid": "623470138e3083d0072db0ddc25452c8", "src_uid": "e56f6c343167745821f0b18dcf0d0cde", "apr_id": "6d61ff8b185563b2ad9d6152caf7ec94", "difficulty": 1400, "tags": ["greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9100050276520865, "equal_cnt": 8, "replace_cnt": 3, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "import java.util.Scanner;\n\npublic class PashaMaximizes {\n\tstatic Scanner sc;\n\tstatic int n , k , m , b;\n\tstatic int mas[];\n\tstatic StringBuilder s;\n\n\tstatic void swap(int indexFirst,int indexSecond){\n\t\tchar first = s.charAt(indexFirst);\n\t\tchar second = s.charAt(indexSecond);\n\t\t/*s.setCharAt(indexFirst, second);\n\t\ts.setCharAt(indexSecond, first);*/\n\t\ts.deleteCharAt(indexSecond);\n\t\ts.insert(indexFirst, second);\n\t}\n\n\tpublic static void main(String[] args){\n\t\tsc = new Scanner(System.in);\n\t\ts = new StringBuilder(sc.next());\n\t\tk = sc.nextInt();\n\t\tchar max;\n\t\tint start = 0;\n\t\tint index = 0;\n\t\twhile ((k > 0) && (start < s.length())) {\n\t\t\tmax = s.charAt(start);\n\t\t\tindex = start;\n\t\t\tfor (int i = start; i < Math.min(s.length(), start + k + 1); i++) {\n\t\t\t\tif (s.charAt(i) > max) {\n\t\t\t\t\tmax = s.charAt(i);\n\t\t\t\t\tindex = i;\n\t\t\t\t}\n\t\t\t\tif (max == '9') {\n\t\t\t\t\tindex = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (index != start) {\n\t\t\t\tk = k - (index - start);\n\t\t\t\tswap(start, index);\n\t\t\t\tstart++;\n\t\t\t} else {\n\t\t\t\tstart++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(s.toString());\n\t}", "lang": "Java 7", "bug_code_uid": "a5e801ed095fe18650ea5f531df69093", "src_uid": "e56f6c343167745821f0b18dcf0d0cde", "apr_id": "707f570847c2e4ae2f11ba35d7526f72", "difficulty": 1400, "tags": ["greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5619372865569698, "equal_cnt": 13, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 12, "bug_source_code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Scanner;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main( String[] args ) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner( inputStream );\n PrintWriter out = new PrintWriter( outputStream );\n TaskC solver = new TaskC();\n solver.solve( 1, in, out );\n out.close();\n }\n\n static class TaskC {\n public void solve( int testNumber, Scanner in, PrintWriter out ) {\n long sum = in.nextLong();\n long xor = in.nextLong();\n\n long result = 0;\n\n for( long i = 1; i < sum; i++ ) {\n if( ( i ^ ( sum - i ) ) == xor ) {\n result++;\n }\n }\n\n out.println( result );\n\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "aeac39a835b701307cd233b056b1cbe8", "src_uid": "18410980789b14c128dd6adfa501aea5", "apr_id": "a7d2665ec0615d79b077644e1c26b661", "difficulty": 1700, "tags": ["dp", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7721618642733428, "equal_cnt": 20, "replace_cnt": 10, "delete_cnt": 6, "insert_cnt": 4, "fix_ops_cnt": 20, "bug_source_code": "import javax.swing.plaf.synth.SynthLookAndFeel;\nimport java.io.*;\nimport java.util.Arrays;\nimport java.util.Scanner;\nimport java.util.StringTokenizer;\npublic class CP {\n static Scanner sc = new Scanner(System.in);\n static class FastReader{\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader()\n {\n br = new BufferedReader(new\n InputStreamReader(System.in));\n }\n\n String next()\n\n\n\n\n {\n while (st == null || !st.hasMoreElements())\n {\n try\n {\n st = new StringTokenizer(br.readLine());\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n int nextInt()\n {\n return Integer.parseInt(next());\n }\n\n long nextLong()\n {\n return Long.parseLong(next());\n }\n\n double nextDouble()\n {\n return Double.parseDouble(next());\n }\n\n String nextLine()\n {\n String str = \"\";\n try\n {\n str = br.readLine();\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n return str;\n }\n }\n public static int lowerBound\n (Integer[] array, int length, int value) {\n int l = 0;\n int r = length;\n while (l < r) {\n int mid = (l + r) / 2;\n if (value < array[mid]) {\n r = mid;\n } else {\n l = mid + 1;\n }\n }\n return l;\n }\n public static long gcd(long a, long b){\n if (b == 0)\n return a;\n else return gcd(b, a % b);\n }\n public static void main(String [] args) {\n // int T = sc.nextInt();while (T--!=0)\n {\n solve();\n }\n }\n static long n,k;\n static long sum(long x ){\n return x*(x+1)/2;\n }\n static long subsum(long ans){\n return sum(k)-sum(ans)+1;\n }\n public static void solve(){\n///////////////////////////////////////////////////////////////////////////////////////////\n n=sc.nextInt();k=sc.nextInt();\n n--; k--;\n if(sum(k)n){\n hi = mid-1;\n }\n else if(subsum(mid) a = new ArrayList<>();\n double greatest = 0;\n int count = 0;\n\n for (int i = 0; i < 8; i++) {\n int list = Integer.valueOf(scan.nextInt());\n a.add(list);\n }\n int ml = (a.get(1) * a.get(2)) / a.get(6);\n int lime = a.get(3) * a.get(4);\n\n double salt = Math.floor((double)a.get(5) / a.get(7));\n\n double mldiv = Math.floor((double)ml / a.get(0));\n double saltdiv = Math.floor(salt / a.get(0));\n double limediv = Math.floor(lime / a.get(0))\n\n for (int i = 0; i < 3; i++) {\n if (mldiv > limediv && mldiv > saltdiv) {\n greatest = mldiv;\n }\n if (limediv > mldiv && limediv > saltdiv) {\n greatest = limediv;\n }\n if (saltdiv > limediv && saltdiv > mldiv) {\n greatest = saltdiv;\n }\n }\n\n for (int i = 0; i < greatest; i++) {\n if (mldiv != 0 && limediv != 0 && saltdiv != 0) {\n count++;\n mldiv--;\n limediv--;\n saltdiv--;\n\n }\n }\n System.out.println(count);\n\n\n\n\n\n\n\n }\n}", "lang": "Java 11", "bug_code_uid": "2b10cf46e62aee7f098fcf2115008236", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "apr_id": "09ace9a75baaed9a784d0b79aa966262", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9610349607269367, "equal_cnt": 11, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 8, "fix_ops_cnt": 10, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.FileReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.Iterator;\n\nimport java.util.StringTokenizer;\n\n public class Test\n {\n static PrintWriter pw = new PrintWriter(System.out);\n static ArrayList list = new ArrayList();\n \n public static void main(String[] args)throws Exception\n {\n Reader.init(System.in);\n long x = Reader.nextLong();\n long y = Reader.nextLong();\n long L = Reader.nextLong();\n long R = Reader.nextLong();\n \n ArrayList ar1 = new ArrayList();\n ArrayList ar2 = new ArrayList();\n long num = 1;\n \n while(num <= 1e18)\n {\n ar1.add(num);\n num *= x;\n }\n \n num = 1;\n \n while(num <= 1e18)\n {\n ar2.add(num);\n num *= y;\n }\n \n for(int i = 0 ; i= L && z<=R)\n list.add(z);\n }\n \n Collections.sort(list);\n long res = 0;\n if(list.get(0) - L > res)\n {\n res = list.get(0) - L;\n\n }\n \n if(R - list.get(list.size() - 1) > res)\n {\n res = R - list.get(list.size() - 1);\n\n }\n \n for(int i = 0 ; i res)\n res = b - a - 1;\n }\n \n pw.print(res);\n pw.close();\n \n }\n \n}\n\nclass Reader {\n\n static BufferedReader reader;\n static StringTokenizer tokenizer;\n\n public static int pars(String x) {\n int num = 0;\n int i = 0;\n if (x.charAt(0) == '-') {\n i = 1;\n }\n for (; i < x.length(); i++) {\n num = num * 10 + (x.charAt(i) - '0');\n }\n\n if (x.charAt(0) == '-') {\n return -num;\n }\n\n return num;\n }\n\n static void init(InputStream input) {\n reader = new BufferedReader(\n new InputStreamReader(input));\n tokenizer = new StringTokenizer(\"\");\n }\n\n static void init(FileReader input) {\n reader = new BufferedReader(input);\n tokenizer = new StringTokenizer(\"\");\n }\n\n static String next() throws IOException {\n while (!tokenizer.hasMoreTokens()) {\n tokenizer = new StringTokenizer(\n reader.readLine());\n }\n return tokenizer.nextToken();\n }\n\n static int nextInt() throws IOException {\n return pars(next());\n }\n\n static long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n\n static double nextDouble() throws IOException {\n return Double.parseDouble(next());\n }\n}", "lang": "Java 8", "bug_code_uid": "d407fdb7032aee2da922d869d64116b0", "src_uid": "68ca8a8730db27ac2230f9fe9b120f5f", "apr_id": "39fc39c6fb94af021b233b4e55b75366", "difficulty": 1800, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.39265413205072147, "equal_cnt": 16, "replace_cnt": 11, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 17, "bug_source_code": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n\n long x = in.nextInt();\n long y = in.nextInt();\n long l = in.nextInt();\n long r = in.nextInt();\n\n TreeSet unhappyYears = new TreeSet<>();\n\n for (long a = 0; (long) (Math.pow(x, a)) <= r; ++a)\n for (long b = 0; (long) (Math.pow(x, a) + Math.pow(y, b)) <= r; ++b)\n unhappyYears.add((long) (Math.pow(x, a) + Math.pow(y, b)));\n\n //unhappyYears.forEach(System.out::println);\n\n long prevUnh = l - 1;\n long maxLength = 0;\n\n for (Long unh : unhappyYears) {\n if (unh < l) {\n continue;\n } else if (unh > r) {\n break;\n }\n\n long length = unh - prevUnh - 1;\n if (maxLength < length)\n maxLength = length;\n\n prevUnh = unh;\n }\n\n long length = r - prevUnh;\n if (maxLength < length)\n maxLength = length;\n\n System.out.println(maxLength);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "4f714bb8544f5e6ff55c7cc02524e6cc", "src_uid": "68ca8a8730db27ac2230f9fe9b120f5f", "apr_id": "274b24b488026f8a4be1535170d337e4", "difficulty": 1800, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9101868595539482, "equal_cnt": 11, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 10, "bug_source_code": "import java.util.*;\n\npublic class Solution {\n public void solve() {\n Scanner cin = new Scanner(System.in);\n int m = cin.nextInt();\n int b = cin.nextInt();\n System.out.println(this.maxRec(m,b));\n }\n \n public int maxRec(int m, int b) {\n int y = b;\n int x = 0;\n int ans = (x+y) * (1 + x) * (1 + y) / 2;\n int ret = 0;\n do {\n x += m;\n y = b - x/m;\n ret = (x+y) * (1 + x) * (1 + y) / 2;\n if (ret > ans) {\n ans = ret;\n }\n// System.out.println(\"x \" + x + \" y \" + y + \" = \" + ret);\n } while (y > 0);\n return ans;\n }\n \n// public static void main(String[] args) {\n// Solution sol = new Solution();\n// int ans = sol.maxRec(1, 5);\n// System.out.println(ans);\n// }\n}", "lang": "Java 8", "bug_code_uid": "79d340015639e4f6e7acc5c51eb17c65", "src_uid": "9300f1c07dd36e0cf7e6cb7911df4cf2", "apr_id": "d3a36610c434a2a88377d1e6aa533f01", "difficulty": 1300, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9966273187183811, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\nimport java.io.*;\n\n\npublic class Main {\n\tpublic static void main(String args[]) {\n\t\tScanner s = new Scanner(System.in);\n\t\tint n = s.nextInt();\n\t\tint[] dirs = new int[4]; //0 L 1 R 2 D 3 U\n\t\tString inp = s.nextLine();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (inp.charAt(i) == 'L') {\n\t\t\t\tdirs[0]++;\n\t\t\t} else if (inp.charAt(i) == 'R') {\n\t\t\t\tdirs[1]++;\n\t\t\t} else if (inp.charAt(i) == 'D') {\n\t\t\t\tdirs[2]++;\n\t\t\t} else if (inp.charAt(i) == 'U') {\n\t\t\t\tdirs[3]++;\n\t\t\t}\n\t\t}\n\t\tint ans = (Math.min(dirs[0], dirs[1]) * 2) + (Math.min(dirs[2], dirs[3]) * 2);\n\t\tSystem.out.println(ans);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "7c27062e0533f80be788881ceefa2e5e", "src_uid": "b9fa2bb8001bd064ede531a5281cfd8a", "apr_id": "ddffa6a0e16fb6dbbe1facf6d546a7c2", "difficulty": 1000, "tags": ["greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.2983050847457627, "equal_cnt": 22, "replace_cnt": 15, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 22, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.lang.*;\npublic class Solution\n{\n public static void main(String args[])throws IOException\n {\n Scanner ob=new Scanner(System.in);\n int n=ob.nextInt();\n String s=ob.next();\n \n int u=0;\n int l=0;\n int r=0;\n int d=0;\n for(int i=0;i=leave)\n\t\t\treturn dp[i][x][y]=take+1;\n\t\telse\n\t\t\treturn dp[i][x][y]=leave;\n\t}\n\tpublic static void main(String[] args) throws IOException {\n\t\tScanner sc = new Scanner();\n\t\tPrintWriter pw = new PrintWriter(System.out);\n\t\tn=sc.nextInt();\n\t\tc=sc.nextLine().toCharArray();\n\t\tdp=new int[n][301][301];\n\t\tfor(int i=0;i 2) {\n map[0] = scanner.nextInt();\n map[1] = scanner.nextInt();\n for (int i = 1; i < n-1; i++) {\n map[i+1] = scanner.nextInt();\n if (map[i] > map[i-1] && map[i] > map[i+1]) ans++;\n if (map[i] < map[i-1] && map[i] < map[i+1]) ans++;\n }\n }\n System.out.println(ans);\n }\n\n public static class FastScanner {\n BufferedReader br;\n StringTokenizer st;\n\n public FastScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n public String nextToken() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(nextToken());\n }\n\n }\n}\n", "lang": "Java 8", "bug_code_uid": "5d78748c2a5aed21b2b78e3d034d7518", "src_uid": "b9fa2bb8001bd064ede531a5281cfd8a", "apr_id": "a8ea5974786d1f16e60d597698904dc1", "difficulty": 1000, "tags": ["greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.3127853881278539, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString in = sc.nextLine();\n\t\tint count = 0;\n\t\tfor (int i = 0; i < in.length() - 1; i++) {\n\t\t\tfor (int j = i + 1; j < in.length(); j++) {\n\t\t\t\tif (in.charAt(i) == in.charAt(j)) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(in.length()-count);\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "73580f6d3443958a85688a77eec6dafa", "src_uid": "8909ac99ed4ab2ee4d681ec864c7831e", "apr_id": "022fcd4efa87c4052a6c627eefdf69af", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9676646706586827, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner (System.in);\n String in = sc.nextLine();\n int ans = in.length();\n char a[][]= new char [ans][ans];\n \n for (int i = 0; i < ans; i++) {\n a[0][i]=in.charAt(i);\n }\n \n for (int i = 1; i < ans; i++) {\n for (int j = 0; j < ans; j++) {\n a[i][j]=a[0][(j+i)%ans];\n }\n\n }\n // for (int i = 0; i < ans; i++) {\n // System.out.println(Arrays.toString(a[i]));\n // }\n int g=ans;\n for (int i = 0; i < g-1; i++) {\n if (a[i][0]!='-') {\n for (int j = i+1; j < g; j++) {\n if (a[i][0]==a[j][0]) {\n boolean eq=true;\n for (int k = 1; k < g; k++) {\n if (a[i][k]!=a[j][k]) {\n eq=false;\n break;\n }\n }\n if (eq) {\n a[j][0]='-';\n ans--;\n }\n }}\n }\n }\n System.out.println(ans);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "1daa2c9b46b5860c09110e2c254698ab", "src_uid": "8909ac99ed4ab2ee4d681ec864c7831e", "apr_id": "344cc18572a4dee235672e221f8451e2", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9985401459854014, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner;\nimport java.util.HashSet;\n\npublic class Hongcow{\n public static void main(String args[]){\n Scanner scan = new Scanner(System.in);\n HashSet words = new HashSet<>();\n char[] newWord = scan.next().toCharArray();\n \n words.add(new String(newWord));\n \n for(int i=0;i h = new HashSet();\t\n\t\t\tString c = s.nextLine();\n\t\t\tString b = \"\";\n\t\t\tint count = 1;\n\t\t\th.add(c);\n\t\t\tfor(int i = 0; i< c.length(); i++){\n\t\t\t\tb = c.substring(1, c.length()) + c.charAt(0);\n\t\t\t\tif(!bbbh.contains(b)){\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\tc = b;\n\t\t\t\th.add(c);\n\t\t\t}\n\t\t\tSystem.out.println(count);\n\t\t}\n\t\t\n\t\t\n\t\t\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "19460778e3447e20ccdfa2f3c68e4b10", "src_uid": "8909ac99ed4ab2ee4d681ec864c7831e", "apr_id": "2700ec0a1cb74cf3cc42d6cc61ca992a", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8149171270718232, "equal_cnt": 15, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 10, "fix_ops_cnt": 15, "bug_source_code": "import java.util.scanner;\npublic class Horses {\n//Problem Code: HORSES\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\t\n\t\tint arr[]=new int[3];\n\t\tfor(int i=0;i<3;i++) {\n\t\t\tarr[i]=in.nextInt();\n\t\t}\n\t\tArrays.sort(arr);\n\t\tSystem.out.println((arr[1]-arr[0])+arr[2]-arr[1]);\n\t\tin.close();\n\t}\n \n}", "lang": "Java 11", "bug_code_uid": "05d1d966a9f0dfcf331cccb3376a9671", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "apr_id": "25444c737e9f8f023339f81040c94676", "difficulty": 800, "tags": ["math", "sortings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7162506367804381, "equal_cnt": 23, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 12, "fix_ops_cnt": 22, "bug_source_code": "/*\n * To change this license header, choose License Headers in Project Properties.\n * To change this template file, choose Tools | Templates\n * and open the template in the editor.\n */\npackage Contest;\n\nimport java.util.Scanner;\n\n/**\n *\n * @author asus\n */\npublic class sizemonitor {\n public static void main(String args[]){\n Scanner in =new Scanner(System.in);\n int size = in.nextInt();\n int width = Integer.MAX_VALUE;\n int height = Integer.MAX_VALUE;\n int raznica = Integer.MAX_VALUE;\n for(int i=1;i<=size;i++){\n for(int j=1;j<=size;j++){\n if(size==i*j){\n int temp = raznica;\n raznica = Math.min(raznica, Math.abs(i-j));\n if(temp!=raznica){\n height=Math.min(i,j);\n width=Math.max(i,j);\n \n }\n }\n }\n }\n System.out.println(height+\" \"+width);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "678a826ec097f3056f39322a716be9e9", "src_uid": "f52af273954798a4ae38a1378bfbf77a", "apr_id": "580453f13b4edbfcd281106c09bdedea", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9578820697954272, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "/*\n * To change this license header, choose License Headers in Project Properties.\n * To change this template file, choose Tools | Templates\n * and open the template in the editor.\n */\n//package acm;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.Scanner;\n\n/**\n *\n * @author mohamadAli\n */\npublic class Main {\n\n /**\n * @param args the command line arguments\n */\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n //int n = in.nextInt();\n \n int n = in.nextInt();\n int a = 2;\n int b = 0;\n \n \n while(a<= Math.sqrt(n)){\n if(n%a==0)b=n/a;\n a++;\n }\n System.out.println(n/b+\" \"+b);\n \n \n \n }\n\n \n}\n", "lang": "Java 8", "bug_code_uid": "01b65f20ad7bb74edbb70cc86a13c757", "src_uid": "f52af273954798a4ae38a1378bfbf77a", "apr_id": "b3140ca72f487d869bb54a8843e50836", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9996654399464704, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.util.InputMismatchException;\n\n\npublic class DisplaySize {\n\tpublic static void main(String[] args) {\n\t\tInputReader in = new StreamInputReader(System.in);\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\trun(in, out);\n\t}\n\n\tpublic static void run(InputReader in, PrintWriter out) {\n\t\tSolver solver = new TaskB();\n\t\tsolver.solve(1, in, out);\n\t\tExit.exit(in, out);\n\t}\n}\n\nabstract class InputReader {\n\t@SuppressWarnings(\"unused\")\n\tprivate boolean finished = false;\n\n\tpublic abstract int read();\n\n\tpublic int readInt() {\n\t\tint c = read();\n\t\twhile (isSpaceChar(c))\n\t\t\tc = read();\n\t\tint sgn = 1;\n\t\tif (c == '-') {\n\t\t\tsgn = -1;\n\t\t\tc = read();\n\t\t}\n\t\tint res = 0;\n\t\tdo {\n\t\t\tif (c < '0' || c > '9')\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tres *= 10;\n\t\t\tres += c - '0';\n\t\t\tc = read();\n\t\t} while (!isSpaceChar(c));\n\t\treturn res * sgn;\n\t}\n\n\tpublic String readString() {\n\t\tint c = read();\n\t\twhile (isSpaceChar(c))\n\t\t\tc = read();\n\t\tStringBuffer res = new StringBuffer();\n\t\tdo {\n\t\t\tres.appendCodePoint(c);\n\t\t\tc = read();\n\t\t} while (!isSpaceChar(c));\n\t\treturn res.toString();\n\t}\n\n\tprivate boolean isSpaceChar(int c) {\n\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t}\n\n\tpublic void setFinished(boolean finished) {\n\t\tthis.finished = finished;\n\t}\n\n\tpublic abstract void close();\n}\n\nclass StreamInputReader extends InputReader {\n\tprivate InputStream stream;\n\tprivate byte[] buf = new byte[1024];\n\tprivate int curChar, numChars;\n\n\tpublic StreamInputReader(InputStream stream) {\n\t\tthis.stream = stream;\n\t}\n\n\tpublic int read() {\n\t\tif (numChars == -1)\n\t\t\tthrow new InputMismatchException();\n\t\tif (curChar >= numChars) {\n\t\t\tcurChar = 0;\n\t\t\ttry {\n\t\t\t\tnumChars = stream.read(buf);\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t\tif (numChars <= 0)\n\t\t\t\treturn -1;\n\t\t}\n\t\treturn buf[curChar++];\n\t}\n\n\tpublic void close() {\n\t\ttry {\n\t\t\tstream.close();\n\t\t} catch (IOException ignored) {\n\t\t}\n\t}\n}\n\nclass Exit {\n\tprivate Exit() {\n\t}\n\n\tpublic static void exit(InputReader in, PrintWriter out) {\n\t\tin.setFinished(true);\n\t\tin.close();\n\t\tout.close();\n\t}\n}\n\ninterface Solver {\n\tpublic void solve(int testNumber, InputReader in, PrintWriter out);\n}\n\nclass GeometryUtils {\n\tpublic static double epsilon = 1e-8;\n\n\t}\n\nclass TaskB implements Solver {\n\t\n\tstatic int N = 1_000_000; \n\t\n\tpublic void solve(int testNumber, InputReader in, PrintWriter out) {\n\t\t\n\t\tint[] f = new int[N];\n\t\tfor(int i=2; i fact = new ArrayList<>(N);\n\t\tList divs = new ArrayList<>(N);\n\t\tint t = in.readInt();\n\t\tif(t==1) {out.print(\"1 1\"); return;}\n\t\twhile(f[t]!=0){\n\t\t\tfact.add(f[t]);\n\t\t\tt /= f[t];\n\t\t}\n\t\t\n\t\tdivs.add(1);\n\t\tfor(int n:fact){\n\t\t\tint s = divs.size();\n\t\t\tfor(int k=0; k A = new ArrayList();\n\t\tArrayList check = new ArrayList();\n\t\tA.add('h');\n\t\tA.add('e');\n\t\tA.add('l');\n\t\tA.add('l');\n\t\tA.add('o');\n\t\t\n\t\tString s = sc.nextLine();\n\t\twhile(A.size()!=0){\n\t\t int i = 0;\n\t\t while(i < s.length()){\n\t\t if(s.charAt(i)==A.get(0)){\n\t\t check.add(i);\n\t\t A.remove(0);\n\t\t }\n\t\t }\n\t\t}\n\t\tArrayList check1 = new ArrayList(check);\n\t\tCollections.sort(check);\n\t\tif(check.equals(check1)){\n\t\t System.out.println(\"YES\");\n\t\t}\n\t\telse{\n\t\t System.out.println(\"NO\");\n\t\t}\n\n\t}\n}", "lang": "Java 8", "bug_code_uid": "0724d95e6bcbb1a4dce22f9452b2ddd8", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "apr_id": "b5a0e920dcd7ec2a96c48576b57448b7", "difficulty": 1000, "tags": ["strings", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8618433352028416, "equal_cnt": 15, "replace_cnt": 11, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 14, "bug_source_code": "\nimport java.lang.*;\nimport java.util.*;\nimport java.io.*;\n\npublic class CodeforcesB {\n static long printNcR(int n, int r) {\n long p = 1, k = 1;\n if (n - r < r) {\n r = n - r;\n }\n\n if (r != 0) {\n while (r > 0) {\n p *= n;\n k *= r;\n long m = __gcd(p, k);\n p /= m;\n k /= m;\n\n n--;\n r--;\n }\n } else {\n p = 1;\n }\n return p;\n }\n\n static long __gcd(long n1, long n2) {\n long gcd = 1;\n for (int i = 1; i <= n1 && i <= n2; ++i) {\n if (n1 % i == 0 && n2 % i == 0) {\n gcd = i;\n }\n }\n return gcd;\n }\n\n public void solve()throws IOException{\n FastScanner fs = new FastScanner();\n StringBuilder ans = new StringBuilder(\"\");\n int n = fs.nextInt();\n int t = fs.nextInt();\n if( n < 2*t+1 ){\n ans.append(\"0\\n\");\n }else{\n ans.append(printNcR(n,t)).append(\"\\n\");\n }\n System.out.println(ans);\n }\n public static void main(String[]args)throws IOException{\n try {\n new CodeforcesB().solve();\n }catch (Exception e){\n e.printStackTrace();\n\n }\n }\n static class FastScanner {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st=new StringTokenizer(\"\");\n String next() {\n while (!st.hasMoreTokens())\n try {\n st=new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n return st.nextToken();\n }\n String nextLine()\n {\n String str = \"\";\n try\n {\n str = br.readLine();\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n return str;\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n int[] readArray(int n) {\n int[] a=new int[n];\n for (int i=0; i-1)\n\t\t\treturn memo[at][h][v][prev][dir];\n\t\t\n\t\tint res=0;\n\t\t\n\t\tif (at==2)\n\t\t{\n\t\t\tfor (int i=1; i<=4; ++i)\n\t\t\t\tif (i>prev)\n\t\t\t\t\tres+=go(at+1,h,v,i,0);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfor (int i=1; i<=4; ++i)\n\t\t\t\tif (i!=prev)\n\t\t\t\t{\n\t\t\t\t\tif (i>prev && dir==0)\n\t\t\t\t\t\tres+=go(at+1,h,v,i,0);\n\t\t\t\t\telse if (i>prev && dir==1)\n\t\t\t\t\t\tres+=go(at+1,h,v+1,i,0);\n\t\t\t\t\telse if (i 0; t--) {\n\t\t\tn = nextInt();\n\t\t\tk = nextInt();\n\t\t\t\n\t\t\tlong ans = 0;\n\t\t\tfor (int a = 0; a < 4; a++)\n\t\t\t\tfor (int b = 0; b < 4; b++)\n\t\t\t\t\tif (a != b)\n\t\t\t\t\t\tans += solve(n-2, k, k-1, a, b);\n\t\t\t\n\t\t\tout.println(ans);\n\t\t}\n\t\t\n\t\tout.flush();\n\t}\n\n\tstatic int n, k;\n\tstatic long[][][][][] memo = new long[20][11][11][4][4];\n\tstatic {\n\t\tfor (long[][][][] a : memo)\n\t\t\tfor (long[][][] b : a)\n\t\t\t\tfor (long[][] c : b)\n\t\t\t\t\tfor (long[] d : c)\n\t\t\t\t\t\tArrays.fill(d, -1);\n\t}\n\t\n\tstatic long solve(int x, int q, int p, int a, int b) {\n\t\tif (x == 0) return q == 0 && p == 0 ? 1 : 0;\n\t\tif (q < 0 || p < 0) return 0;\n\t\tif (memo[x][q][p][a][b] != -1) return memo[x][q][p][a][b];\n\t\t\n\t\tint res = 0;\n\t\tfor (int i = 0; i < 4; i++)\n\t\t\tif (i < a && a > b) res += solve(x-1, q-1, p, i, a);\n\t\t\telse if (i > a && a < b) res += solve(x-1, q, p-1, i, a);\n\t\t\telse if (i != a) res += solve(x-1, q, p, i, a);\n\t\t\n\t\treturn memo[x][q][p][a][b] = res;\n\t}\n}\n", "lang": "Java 6", "bug_code_uid": "54b92a536882ecb375f3275569411109", "src_uid": "6d67559744583229455c5eafe68f7952", "apr_id": "525a185ea77cf42c89a8031d61ae3513", "difficulty": 1900, "tags": ["dp"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.44062261891803634, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import java.io.*;\nimport java.util.Arrays;\n\n\npublic class E {\n static int n;\n static int t;\n static int[][][][][] visited;\n public static int work(int index , int humps , int prev , int now , int bel) {\n //System.out.println(s + \" \"+humps + \" \" + bel);\n if(index == n-1) {\n if(humps == t && bel == t-1) {\n //System.out.println(s + \" \"+humps + \" \" + bel + \" hi\");\n return 1;\n }\n else return 0;\n }\n if(bel >t-1 || humps >t)\n return 0;\n \n if(visited[index][humps][prev][now][bel] !=-1) {\n \n return visited[index][humps][prev][now][bel];\n }\n \n int result = 0;\n \n \n for(int i = 1 ; i<=4 ; i++) {\n if(now == i)\n continue;\n result += work(index +1 , (now>prev && now >i && prev !=0? humps+1:humps) , now , i , (nowt-1 || humps >t)\n return 0;\n \n if(visited[index][humps][prev][now][bel] !=-1) {\n \n return visited[index][humps][prev][now][bel];\n }\n \n int result = 0;\n \n \n for(int i = 1 ; i<=4 ; i++) {\n if(now == i)\n continue;\n result += work(index +1 , (now>prev && now >i && prev !=0? humps+1:humps) , now , i , (now ' ');\n if (neg) return -ret;\n return ret;\n }\n\n private void fillBuffer() throws Exception\n {\n bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);\n if (bytesRead == -1) buffer[0] = -1;\n }\n\n private byte read() throws Exception\n {\n if (bufferPointer == bytesRead) fillBuffer();\n return buffer[bufferPointer++];\n }\n}\n", "lang": "Java 6", "bug_code_uid": "eacec0852201087a7de8883be8a295d0", "src_uid": "6d67559744583229455c5eafe68f7952", "apr_id": "9dd4405caa76f982f044a55d60f0ac66", "difficulty": 1900, "tags": ["dp"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9111202976436544, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "public class PrimeAndMultiplication \n{\n\tstatic LinkedList primes=new LinkedList<>();\n\tstatic int MOD=(int)1e9+7;\n\n\tpublic static void main(String[] args) \n\t{\n\t\t\n\t\tInputStream is=System.in;\n\t\tOutputStream out=System.out;\n\t\t\n\t\tFastScanner input=new FastScanner(is);\n\t\tFastPrinter output=new FastPrinter(out);\n\t\tint x=input.nextInt();\n\t\tlong n=input.nextLong();\n\t\tprime(x );\n output.println(f(n));\n output.flush();\n\t}\n\n\t\n\tstatic long f(long n) \n\t {\n\t\tlong ans=1;\n\t\t\t\tfor(int off:primes)\n\t\t\t\t{\n\t\t\t\t long pow=0;\n\t\t\t\t long primeFactor=off;\n\t\t\t\t while(true) \n\t\t\t\t {\n\t\t\t\t\t pow+=(n/primeFactor);\n\t\t\t\t\t if((n/primeFactor)0) \n\t\t{\n\t\t\tif((k&1)==1) \n\t\t\t{\n\t\t\t\tres=(res*p)%MOD;\n\t\t\t}\n\t\t\tp=(p*p)%MOD;\n\t\t\tk>>=1;\n\t\t}\n\t\treturn res;\n\t }\n\t\n\t\n\tstatic void prime(int x) \n\t {\n\t\tfor(int i=2;i*i<=x;i++) \n\t\t{\n\t\t\tif(x%i==0) \n\t\t\t{\n\t\t\t\tprimes.add(i);\n\t\t\t\twhile(x%i==0) \n\t\t\t\t{\n\t\t\t\t\tx/=i;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(x>1) \n\t\t{\n\t\t\tprimes.add(x);\n\t\t}\n\t }\n}\n\nclass FastPrinter extends PrintWriter\n {\n\t public FastPrinter(OutputStream out) \n\t {\n\t\tsuper(out);\n\t }\n\t public FastPrinter(Writer out) \n\t {\n\t\tsuper(out);\n\t }\n }\n\nclass FastScanner\n{\n\tBufferedReader br;\n\tStringTokenizer st;\n public FastScanner(InputStream is) \n {\n\t br=new BufferedReader(new InputStreamReader(is)); \n }\n \n public FastScanner(File f) \n {\n\t try \n\t {\n\t\t br=new BufferedReader(new FileReader(f));\n \t} \n\t catch (FileNotFoundException e) \n\t {\n \t\te.printStackTrace();\n\t }\n }\n \n public String next()\n {\n\t while(st==null||!st.hasMoreElements()) \n\t {\n\t\t String s=null;\n\t\t try \n\t\t {\n\t\t s=br.readLine();\n\t\t }\n\t\t catch(IOException e) \n\t\t {\n\t\t\t e.printStackTrace();\n\t\t }\n\t\t if(s==null) \n\t\t {\n\t\t\t return null;\n\t\t }\n\t\t st=new StringTokenizer(s);\n\t } \n\t return st.nextToken();\n }\n \n public int nextInt() \n {\n\treturn Integer.parseInt(next()); \n }\n public long nextLong() \n {\n\t return Long.parseLong(next());\n }\n}\n", "lang": "Java 11", "bug_code_uid": "24ffcdbbeebd7ffec5a5de8a6f1a2190", "src_uid": "04610fbaa746c083dda30e21fa6e1a0c", "apr_id": "3c1bd8d9bb5055e35d864f6970151973", "difficulty": 1700, "tags": ["math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.7574221578566256, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "package Main;\nimport java.util.*;\npublic class akram {\npublic static void main(String[]args) {\n\tScanner ak=new Scanner(System.in);\n\tint n=ak.nextInt();\n\tint c=0;\n\tString b=\"\";\n //int[] a=new int[n+1];\n\tfor(int i=1;i<=n;i++) {\n\t\tfor(int j=1;j<=n;j++) {\n\t\t\tif((i^j)>0 && (i^j)<=n && i+j>(i^j) && i+(i^j)>j && j+(i^j)>i && !(b.contains(\"\"+i+j+(i^j))))\n\t\t\t\t{c++;\n\t\t\t\tb+=\"\"+i+j+(i^j)+j+i+(i^j)+i+(i^j)+j+j+(i^j)+i+(i^j)+i+j+(i^j)+j+i;\n//\t\t\t\ta[i]++;\n//\t\t\t\ta[j]++;\n//\t\t\t\ta[(i^j)]++;\n\t\t\t\t}\n\t\t}\n\t}\n\tSystem.out.println(c);\n}\npublic static boolean aaa(int x,int y) {\n\tif(y-1>x)\n\t\treturn false;\n\tif(y==1 && x>0)\n\t\treturn false;\n\tx=x-y+1;\n\tif(x%2==0)\n\t\treturn true;\n\telse\n\t\treturn false;\n}\n}\n", "lang": "Java 8", "bug_code_uid": "b227f588597306527330278f825afaff", "src_uid": "838f2e75fdff0f13f002c0dfff0b2e8d", "apr_id": "80e94fd817f6a13392ed7b85ebafd494", "difficulty": 1300, "tags": ["brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8576771244546021, "equal_cnt": 16, "replace_cnt": 13, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 15, "bug_source_code": "/**\n * Created by Khoi on 22/10/2017\n * For learning purpose\n */\n\nimport java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.InputMismatchException;\n\n\npublic class main {\n InputStream is;\n PrintWriter out;\n String INPUT;\n\n void solve() {\n int n = ni() - 1;\n int k = ni();\n int count = 0;\n boolean[] arr = new boolean[k+1];\n\n while (n >= k && k >= 2 && n >= 0) {\n n = n - k + 1;\n count += 1;\n k -= 1;\n }\n\n if (n == 0)\n out.print(count);\n else if (n < k)\n out.print(count + 1);\n else\n out.print(-1);\n }\n\n void run() throws Exception {\n is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n out = new PrintWriter(System.out);\n\n long s = System.currentTimeMillis();\n solve();\n out.flush();\n tr(System.currentTimeMillis() - s + \"ms\");\n }\n\n public static void main(String[] args) throws Exception {\n new main().run();\n }\n\n private byte[] inbuf = new byte[1024];\n public int lenbuf = 0, ptrbuf = 0;\n\n private int readByte() {\n if (lenbuf == -1) throw new InputMismatchException();\n if (ptrbuf >= lenbuf) {\n ptrbuf = 0;\n try {\n lenbuf = is.read(inbuf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (lenbuf <= 0) return -1;\n }\n return inbuf[ptrbuf++];\n }\n\n\n private boolean isSpaceChar(int c) {\n return !(c >= 33 && c <= 126);\n }\n\n private boolean isEndLine(int c) {\n return c < 32;\n }\n\n private int skip() {\n int b;\n while ((b = readByte()) != -1 && isSpaceChar(b)) ;\n return b;\n }\n\n private double nd() {\n return Double.parseDouble(ns());\n }\n\n private char nc() {\n return (char) skip();\n }\n\n private String nsl() {\n int b = skip();\n StringBuilder sb = new StringBuilder();\n while (!(isEndLine(b))) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n private String ns() {\n int b = skip();\n StringBuilder sb = new StringBuilder();\n while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n private char[] ns(int n) {\n char[] buf = new char[n];\n int b = skip(), p = 0;\n while (p < n && !(isSpaceChar(b))) {\n buf[p++] = (char) b;\n b = readByte();\n }\n return n == p ? buf : Arrays.copyOf(buf, p);\n }\n\n private char[][] nm(int n, int m) {\n char[][] map = new char[n][];\n for (int i = 0; i < n; i++) map[i] = ns(m);\n return map;\n }\n\n private int[] na(int n) {\n int[] a = new int[n];\n for (int i = 0; i < n; i++) a[i] = ni();\n return a;\n }\n\n private int ni() {\n int num = 0, b;\n boolean minus = false;\n while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n\n while (true) {\n if (b >= '0' && b <= '9') {\n num = num * 10 + (b - '0');\n } else {\n return minus ? -num : num;\n }\n b = readByte();\n }\n }\n\n private long nl() {\n long num = 0;\n int b;\n boolean minus = false;\n while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n\n while (true) {\n if (b >= '0' && b <= '9') {\n num = num * 10 + (b - '0');\n } else {\n return minus ? -num : num;\n }\n b = readByte();\n }\n }\n\n // private boolean oj = System.getProperty(\"ONLINE_JUDGE\") != null;\n private boolean oj = true;\n\n private void tr(Object... o) {\n if (!oj) System.out.println(Arrays.deepToString(o));\n }\n}", "lang": "Java 8", "bug_code_uid": "fd0d0392fcd1343e4227befa8890b29f", "src_uid": "83bcfe32db302fbae18e8a95d89cf411", "apr_id": "d8fd7cc81f1ae57b926fbf172a315c6b", "difficulty": 1700, "tags": ["math", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9988590986879635, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedInputStream;\nimport java.io.BufferedOutputStream;\nimport java.io.PrintWriter;\nimport java.math.BigInteger;\nimport java.util.Arrays;\nimport java.util.Scanner;\nimport java.util.Set;\nimport java.util.TreeSet;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tnew CF_55D().run();\n\t}\n}\n\nclass CF_55D {\n\n\tvoid run() {\n\t\tScanner cin = new Scanner(new BufferedInputStream(System.in));\n\t\tPrintWriter cout = new PrintWriter(new BufferedOutputStream(System.out));\n\t\tint t = cin.nextInt() ;\n\t\twhile(t-- > 0){\n\t\t\tlong l = cin.nextLong() , r = cin.nextLong() ;\n\t\t\tcout.println(calculation(r) - calculation(l - 1));\n\t\t}\n cout.flush();\n\t}\n\t\n\tlong calculation(long val){\n\t\tint bit = 0 ;\n\t\twhile(val > 0){\n\t\t\tdight[bit++] = (int) (val % 10) ;\n\t\t\tval /= 10 ;\n\t\t}\n\t\treturn dfs(bit-1, 0, 1, true) ;\n\t}\n\n\tlong dfs(int pos, int sum, int lcm, Boolean isEnd) {\n\t\tif (pos < 0)\n\t\t\treturn sum % lcm == 0 ? 1L : 0L;\n\t\tif (!isEnd && dp[pos][sum][hash[lcm]] != -1)\n\t\t\treturn dp[pos][sum][hash[lcm]];\n\t\tint end = isEnd ? dight[pos] : 9;\n\t\tlong res = 0L;\n\t\tfor (int i = 0; i <= end; i++) {\n\t\t\tres += dfs(pos - 1, (sum * 10 + i) % N, lcm(lcm, i), isEnd && i == end);\n\t\t}\n if(! isEnd) dp[pos][sum][hash[lcm]] = res ;\n return res ;\n\t}\n\n\tfinal int N = 2520;\n\tlong[][][] dp = new long[18][N][48];\n\tint[] dight = new int[18];\n\t\n\tint[] hash = new int[N + 8];\n\t{\n\t\tint cnt = 0;\n\t\tfor (int i = 1; i <= N; i++) {\n\t\t\tif (N % i == 0)\n\t\t\t\thash[i] = cnt++;\n\t\t}\n\t\tfor(int i = 0 ; i < 18 ; i++){\n\t\t\tfor(int j = 0 ; j < N ; j++)\n\t\t\t\tArrays.fill(dp[i][j], -1) ;\n\t\t}\n\t}\n\n\n\n\tint gcd(int x, int y) {\n\t\treturn y == 0 ? x : gcd(y, x % y);\n\t}\n\n\tint lcm(int x, int y) {\n\t\tif(x == 0) return y ;\n\t\tif(y == 0) return x ;\n\t\treturn x / gcd(x, y) * y;\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "5ea19461ceb51b4878b1df69911de0b5", "src_uid": "37feadce373f728ba2a560b198ca4bc9", "apr_id": "6a219a90bb153999a7e57bd2d1df2e68", "difficulty": 2500, "tags": ["dp", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9990800367985281, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.Map;\nimport java.util.Scanner;\nimport java.util.HashMap;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author heifrank\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n TaskD solver = new TaskD();\n int testCount = Integer.parseInt(in.next());\n for (int i = 1; i <= testCount; i++)\n solver.solve(i, in, out);\n out.close();\n }\n\n static class TaskD {\n long[][][] dp = new long[20][50][3005];\n int[] bits = new int[20];\n Map ds = new HashMap<>();\n int cnt = 0;\n final int MOD = 2520;\n\n int gcd(int a, int b) {\n return b == 0 ? a : gcd(b, a % b);\n }\n\n void dfs2(int p, int pren) {\n if (p == 0) {\n if (!ds.containsKey(pren)) {\n ds.put(pren, ++cnt);\n }\n return;\n }\n dfs2(p - 1, pren * p / gcd(pren, p));\n dfs2(p - 1, pren);\n }\n\n public TaskD() {\n for (int i = 0; i < dp.length; i++)\n for (int j = 0; j < dp[0].length; j++) {\n Arrays.fill(dp[i][j], -1);\n }\n dfs2(9, 1);\n }\n\n public long dfs(int p, int lcm, int mod, boolean limit) {\n if (p == -1) {\n return mod % lcm == 0 ? 1 : 0;\n }\n int id = ds.get(lcm);\n if (!limit && dp[p][id][mod] != -1) {\n return dp[p][id][mod];\n }\n long ans = 0;\n int end = limit ? bits[p] : 9;\n for (int i = 0; i <= end; i++) {\n ans += dfs(p - 1, i == 0 ? lcm : lcm * i / gcd(lcm, i), (mod * 10 + i) % MOD, limit && i == end);\n }\n if (!limit) {\n dp[p][lcm][mod] = ans;\n }\n return ans;\n }\n\n public long calc(long n) {\n int len = 0;\n while (n > 0) {\n Long t = n % 10;\n bits[len++] = t.intValue();\n n /= 10;\n }\n return dfs(len - 1, 1, 0, true);\n }\n\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n long x = in.nextLong();\n long y = in.nextLong();\n out.println(calc(y) - calc(x - 1));\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "bc95cf99ca2fcdde14ca7dc8fb93a134", "src_uid": "37feadce373f728ba2a560b198ca4bc9", "apr_id": "17d34aed1808e6d3d9df872c83ae7f38", "difficulty": 2500, "tags": ["dp", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7272727272727273, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "import java.util.*;\nimport java.lang.*;\nimport java.io.*;\n \n/* Name of the class has to be \"Main\" only if the class is public. */\npublic class code{\n\tpublic static void main (String[] args) throws java.lang.Exception\n\t{\n\t Scanner obj = new Scanner(System.in);\n\t String s = obj.next();\n\t String t = \"hello\";\n\t Vector arr = new Vector();\n\t for(int i=0;i= 2)\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (c >= 2) {\n\t\t\t\tSystem.out.println(\"YES\");\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (i == n - 1 && c1 == 0 && c2 == 0)\n\t\t\t\tSystem.out.println(\"NO\");\n\n\t\t}\n\n\t}\n}", "lang": "Java 8", "bug_code_uid": "e0efba655d89bbb858f0c1b557b5bc4d", "src_uid": "d6c876a84c7b92141710be5d76536eab", "apr_id": "f8abcfd7edebfdea10842c1c69ccf106", "difficulty": 900, "tags": ["brute force", "sortings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.845355037889419, "equal_cnt": 24, "replace_cnt": 11, "delete_cnt": 0, "insert_cnt": 12, "fix_ops_cnt": 23, "bug_source_code": "import java.util.*;\n\npublic class CodeForces_1321C_L1600_FucksGiven {\n static Scanner sc = new Scanner(System.in);\n public static void main(String[] args){\n int Size = sc.nextInt();\n sc.nextLine();\n String line = sc.nextLine();\n int biggestChar = 'a';\n for (int i = 0; i < line.length(); i++) {\n char currentChar = line.charAt(i);\n if(currentChar > biggestChar){\n biggestChar = currentChar;\n }\n }\n int FucksGiven = 0;\n for (int i = biggestChar; i > 'a' ; i--) {\n for (int j = 0; j < line.length(); j++) {\n if(line.charAt(j) == i){\n if(j == 0){\n if(line.charAt(1) == i-1){\n line = line.substring(j+1);\n j--;\n FucksGiven++;\n }\n }\n else if(j == line.length()-1){\n if(line.charAt(j-1) == i-1){\n line = line.substring(0,j);\n j-=2;\n FucksGiven++;\n }\n }\n else if(line.charAt(j-1) == i-1 || line.charAt(j+1) == i-1 ){\n line = line.substring(0,j)+line.substring(j+1);\n j-=2;\n FucksGiven++;\n }\n\n }\n }\n }\n System.out.println(FucksGiven);\n\n\n }\n\n\n\n}", "lang": "Java 11", "bug_code_uid": "29edbe83b112012e0d80f58dc0733873", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "apr_id": "f0cf84a2521d0f6e5371b06c99a127ae", "difficulty": 1600, "tags": ["strings", "brute force", "greedy", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8584758942457231, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "/* package whatever; // don't place package name! */\n\nimport java.util.*;\nimport java.lang.*;\nimport java.io.*;\n\n/* Name of the class has to be \"Main\" only if the class is public. */\npublic class Ideone\n{\n public static void main (String[] args) throws java.lang.Exception\n {\n Scanner sc = new Scanner(System.in);\n long r = sc.nextLong();\n long x = sc.nextLong();\n long y = sc.nextLong();\n long xx = sc.nextLong();\n long yy = sc.nextLong();\n long d = (x-xx)*(x-xx)+(y-yy)*(y-yy);\n int k = 0;\n while(4*k*k*r*r prime(int n) {\n\t\t\tSet s = new HashSet<>();\n\t\t\tfor (int i = 2; i <= n; i++) {\n\t\t\t\tif (n % i == 0) {\n\t\t\t\t\ts.add(i);\n\t\t\t\t\twhile (n > 0 && n % i == 0) {\n\t\t\t\t\t\tn = n / i;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn s;\n\t\t}\n\n\t\tpublic void solve(int testNumber, InputReader in, PrintWriter out) {\n\t\t\tint x = in.nextInt();\n\t\t\tlong n = in.nextLong();\n\t\t\tSet fac = prime(x);\n\t\t\tlong ans = 1;\n\t\t\tlong mod = 1000000007;\n\t\t\tfor (Integer f : fac) {\n\t\t\t\tlong t = n;\n\t\t\t\tlong div = t / f;\n\t\t\t\twhile (div > 0) {\n\t\t\t\t\tans = (ans * (power(f, div)) % mod) % mod;\n\t\t\t\t\tt /= f;\n\t\t\t\t\tdiv = t / f;\n\t\t\t\t}\n\t\t\t}\n\t\t\tout.println(ans);\n\t\t}\n\n\t\tprivate long power(long x, long y) {\n\t\t\tlong res = 1;\n\t\t\tlong mod = 1000000007;\n\t\t\twhile (y > 0) {\n\t\t\t\tif (y % 2 == 1)\n\t\t\t\t\tres = (res * x) % mod;\n\t\t\t\ty = y >> 1;\n\t\t\t\tx = (x * x) % mod;\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t}\n\n\tstatic class InputReader {\n\t\tpublic BufferedReader reader;\n\t\tpublic StringTokenizer tokenizer;\n\n\t\tpublic InputReader(InputStream stream) {\n\t\t\treader = new BufferedReader(new InputStreamReader(stream), 32768);\n\t\t\ttokenizer = null;\n\t\t}\n\n\t\tpublic String next() {\n\t\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn tokenizer.nextToken();\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\t}\n}", "lang": "Java 8", "bug_code_uid": "003ca4f2cb1a19e8ccccd363e2a70bc2", "src_uid": "04610fbaa746c083dda30e21fa6e1a0c", "apr_id": "2ec841fb97988d5c04c79a508dadc740", "difficulty": 1700, "tags": ["math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9976232917409388, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class CodeforcesC {\n static long M = 1000000007;\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int x = scanner.nextInt();\n long n = scanner.nextLong();\n List primes = getPrimes(x);\n long result = 1;\n for (Integer p : primes) {\n long power = 0;\n long nn=n;\n while (nn > 1) {\n power += nn / p;\n nn /= p;\n }\n long pwr = p;\n while (power > 0) {\n if ((power & 1) != 0) {\n result = result * pwr % M;\n }\n pwr = pwr * pwr % M;\n power /= 2;\n }\n }\n System.out.println(result);\n }\n\n private static List getPrimes(int x) {\n List primes = new ArrayList<>();\n List result = new ArrayList<>();\n primes.add(2);\n if (x % 2 == 0) {\n result.add(2);\n while (x % 2 == 0) x /= 2;\n }\n for (int i = 3; i * i < x; i += 2) {\n boolean isPrime = true;\n for (Integer p : primes) {\n if (i % p == 0) {\n isPrime = false;\n break;\n }\n }\n if (isPrime) {\n primes.add(i);\n if (x % i == 0) {\n result.add(i);\n while (x % i == 0) x /= i;\n }\n }\n }\n if (!result.contains(x)) result.add(x);\n return result;\n }\n}\n", "lang": "Java 8", "bug_code_uid": "727c8c770ba550a4ef77dcd1b62f2b16", "src_uid": "04610fbaa746c083dda30e21fa6e1a0c", "apr_id": "b69841d248a964f8de2c16ff95d623e6", "difficulty": 1700, "tags": ["math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.99949841163685, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] num = get(n);\n\n // dp[i][j][m][k] i means the ith ,and j mean the have the one number or\n // two number,k means equals num or not\n int[][][][] dp = new int[10][10][10][2];\n for (int i = 0; i < num[0]; i++)\n dp[1][i][i][0]++;\n dp[1][num[0]][num[0]][1]++;\n\n for (int i = 2; i <= num.length; i++) {\n for (int j = 0; j < 10; j++)\n for (int k = 0; k < 10; k++) {\n if (dp[i - 1][j][k][0] > 0) {\n if (j == k) {\n for (int p = 0; p < 10; p++) {\n if (j == 0)\n dp[i][p][p][0] += dp[i - 1][j][k][0];\n else {\n dp[i][p][j][0] += dp[i - 1][j][k][0];\n }\n }\n } else {\n dp[i][j][k][0] += 2 * dp[i - 1][j][k][0];\n }\n }\n\n if (dp[i - 1][j][k][1] > 0) {\n if (j == k) {\n if (j == 0)\n dp[i][num[i - 1]][num[i - 1]][1] += dp[i - 1][j][k][1];\n else\n dp[i][j][num[i - 1]][1] += dp[i - 1][j][k][1];\n for (int p = 0; p < num[i - 1]; p++) {\n if (j == 0)\n dp[i][p][p][0] += dp[i - 1][j][k][1];\n else {\n dp[i][j][p][0] += dp[i - 1][j][k][1];\n }\n }\n } else {\n if (num[i - 1] == j || num[i - 1] == k)\n dp[i][j][k][1] += dp[i - 1][j][k][1];\n if (j < num[i - 1])\n dp[i][j][k][0] += dp[i - 1][j][k][1];\n if (k < num[i - 1])\n dp[i][j][k][0] += dp[i - 1][j][k][1];\n }\n }\n }\n }\n\n int sum = 0;\n for (int j = 0; j < 10; j++)\n for (int k = 0; k < 10; k++) {\n sum += dp[num.length][j][k][0] + dp[num.length][j][k][1];\n }\n\n System.out.println((sum - 1));\n }\n\n static int[] get(int n) {\n int[] ans = new int[20];\n int len = 0;\n while (n / 10 != 0) {\n ans[len++] = n % 10;\n n = n / 10;\n }\n\n ans[len++] = n;\n\n int[] rev = new int[len];\n for (int i = 0; i < len; i++) {\n rev[i] = ans[len - i - 1];\n }\n\n return rev;\n }\n}", "lang": "Java 6", "bug_code_uid": "3d91805fe870cfdf2654e50ac76e7c36", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "apr_id": "157f791f4a31d9864d4ebe320bd2ee64", "difficulty": 1600, "tags": ["dfs and similar", "brute force", "bitmasks"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7346595685065844, "equal_cnt": 25, "replace_cnt": 12, "delete_cnt": 2, "insert_cnt": 10, "fix_ops_cnt": 24, "bug_source_code": "import java.util.Hashtable;\nimport java.util.Scanner;\n\npublic class B {\n\n static Hashtable ht = new Hashtable();\n\n public static StringBuilder fit(String s, int n) {\n String s1 = s;\n int l = s1.length();\n for (int i = 0; i < n - l; i++) {\n s1 = \"0\" + s1;\n }\n return new StringBuilder(s1);\n }\n\n public static int test(int n, int x, int y, long max) {\n int count = 0;\n for (int i = 0; i < 2 << n; i++) {\n StringBuilder s = fit(Integer.toBinaryString(i), n);\n StringBuilder s2 = new StringBuilder(\"\");\n for (int j = 0; j < s.length(); j++) {\n if (s.charAt(j) - '0' == 0)\n s2.append(x);\n else\n s2.append(y);\n }\n int num = Integer.parseInt(s2.toString());\n if (!ht.containsKey(num) && num <= max&&num!=0) {\n count++;\n ht.put(num, num);\n// System.out.println(num);\n }\n }\n return count;\n }\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n // int count=0;\n // for(int i=1000;i<10001;i++){\n // if(i%10!=0){\n // String s=i+\"\";\n // int c=0;\n // boolean []a=new boolean[10];\n // for(int j=0;j2)\n // break;\n // }\n // if(c<=2)\n // count++;\n // }\n // }\n // System.out.println(count);\n int n = in.nextInt();\n String s = Integer.toString(n);\n int res = 0;\n for (int i = 0; i < 10; i++) {\n for (int j = i + 1; j < 10; j++) {\n for (int k = 1; k < s.length()+1; k++) {\n res += test(k, i, j, n);\n }\n }\n }\n System.out.println(res);\n }\n\n}\n", "lang": "Java 6", "bug_code_uid": "1eb1ed65b8f8f62a17a12fe032ac7f2e", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "apr_id": "95759f60fc104a6164746032bcf35943", "difficulty": 1600, "tags": ["dfs and similar", "brute force", "bitmasks"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5944744363289933, "equal_cnt": 57, "replace_cnt": 56, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 57, "bug_source_code": "package LIS;\n\nimport java.util.LinkedList;\nimport java.util.Queue;\nimport java.util.Scanner;\n\npublic class A {\n\n\t\n\tstatic int BFS(long n){\n\t\tQueue Q = new LinkedList();\n\t\tint cont = 0;\n\t\t\n\t\tfor(int i=1;i<=9;i++) {\n\t\t\tif(i<=n) {\n\t\t\t\tQ.add((long)i);\n\t\t\t\tcont++;\n\t\t\t}\n\t\t}\n\t\t\n\t\twhile(!Q.isEmpty()){\n\t\t\tlong now = Q.remove();\t\t\t\n\t\t\tfor(int i=0;i<=9;i++){\n\t\t\t\t\n\t\t\t\tif(now*10+i<=n) {\n\t\t\t\t\tQ.add(now*10+i);\n\t\t\t\t\tQ.add(now);\n\t\t\t\t\tif(i==now){\n\t\t\t\t\t\tQ.add((long)(-1));\n\t\t\t\t\t}\n\t\t\t\t\telse Q.add((long)i);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif(now==9) break;\n\t\t}\n\t\t\n\t\t\t\t\n\t\twhile(!Q.isEmpty()){\n\t\t\tlong now = Q.remove();\n\t\t\tlong uno = Q.remove();\n\t\t\tlong dos = Q.remove();\n\t\t\t\n\t\t\n\t\t\tif(now>n) continue;\t\t\n\t\t\t\n\t\t\tcont++;\n\t\t\t\n\t\t\tif(dos==-1) {\n\t\t\t\tfor(int i=0;i<=9;i++){\n\t\t\t\t\tif(now*10+i<=n){\n\t\t\t\t\t\tQ.add(now*10+i);\n\t\t\t\t\t\tQ.add(uno);\n\t\t\t\t\t\tif(i==uno){\n\t\t\t\t\t\t\tQ.add((long)(-1));\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse Q.add((long)i);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\n\t\t\t\tQ.add(now*10+uno);\n\t\t\t\tQ.add(uno);\n\t\t\t\tQ.add(dos);\n\n\t\t\t\tQ.add(now*10+dos);\n\t\t\t\tQ.add(uno);\n\t\t\t\tQ.add(dos);\n\t\t\t}\n\t\t\t\n\t\t\t\t\t\n\t\t}\n\t\t\n\t\treturn cont;\n\t\t\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tlong n = in.nextLong();\n\t\tSystem.out.println(BFS(n));\n\t}\n\n}\n", "lang": "Java 6", "bug_code_uid": "b843feaddf955ee32b9958828b5bb74b", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "apr_id": "87ac6b9212ef0df45328c4b1bbfd6eb9", "difficulty": 1600, "tags": ["dfs and similar", "brute force", "bitmasks"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9911546736791776, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "\n\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Scanner;\n\n/**\n *\n * @author Hidayat\n */\npublic class B245 {\n\n public static void main(String args[]) {\n\n Scanner in = new Scanner(System.in);\n int n = in.nextInt(), k = in.nextInt(), x = in.nextInt();\n\n List a = new LinkedList();\n int b[] = new int[101];\n for (int i = 1; i <= n; i++) {\n int col = in.nextInt();\n a.add(col);\n b[i - 1] = col;\n }\n\n int result = 0;\n\n for (int i = 1; i <= n - 1; i++) {\n\n a = new LinkedList();\n for (int idx = 0; idx < n; idx++) {\n a.add(b[idx]);\n }\n a.add(i, x);\n boolean removed = false;\n\n\n do {\n if (a.size() < 3) {\n removed = false;\n } else {\n int countg = 1;\n int size = a.size();\n for (int j = 1; j < size; j++) {\n if (a.get(j) == a.get(j - 1)) {\n countg++;\n } else {\n if (countg >= 3) {\n\n for (int idx = j - 1; idx >= j - countg; idx--) {\n a.remove(idx);\n }\n removed = true;\n countg = 1;\n break;\n }\n countg = 1;\n }\n }\n if (countg >= 3) {\n int sz = a.size();\n for (int idx = sz - 1; idx >= sz - countg; idx--) {\n a.remove(idx);\n }\n }\n\n }\n\n } while (removed);\n if (a.size() < n) {\n result = Math.max(result, n - a.size());\n }\n }\n System.out.println(result);\n\n }\n}\n", "lang": "Java 7", "bug_code_uid": "94945698a48ae7aec9eb6a6930bd4222", "src_uid": "d73d9610e3800817a3109314b1e6f88c", "apr_id": "5b8a76cf99447318645401489c2d841d", "difficulty": 1400, "tags": ["brute force", "two pointers"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9564556962025317, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 8, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class BallsGame {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tBallsGame main = new BallsGame();\n\t\tmain.solve();\n\t}\n\n\tvoid solve() throws IOException {\n\t\tReaderBallsGame reader = new ReaderBallsGame();\n\t\treader.Init(System.in);\n\t\tint n = reader.NextInt();\n\t\tint k = reader.NextInt();\n\t\tint x = reader.NextInt();\n\t\tint[] balls = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tballs[i] = reader.NextInt();\n\t\t}\n\t\tint res = 0;\n\t\tint max = Integer.MIN_VALUE;\n\t\tint temp = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (balls[i] == x) {\n\t\t\t\tres = 0;\n\t\t\t\ttemp++;\n\t\t\t\tint j = i;\n\t\t\t\tint l = i - 1;\n\t\t\t\tdo {\n\t\t\t\t\tif (temp >= 3) {\n\t\t\t\t\t\tres += temp;\n\t\t\t\t\t\ttemp = 0;\n\t\t\t\t\t}\n\t\t\t\t\tfor (; j < n; j++) {\n\t\t\t\t\t\tif (balls[j] == x) {\n\t\t\t\t\t\t\ttemp++;\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t\tfor (; l >= 0; l--) {\n\t\t\t\t\t\tif (balls[l] == x) {\n\t\t\t\t\t\t\ttemp++;\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (l >= 0 && j < n) {\n\t\t\t\t\t\tx = balls[j];\n\t\t\t\t\t}\n\t\t\t\t} while (temp >= 3);\n\t\t\t\tif (res - 1 > max) {\n\t\t\t\t\tmax = res-1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(max == -1 )\n\t\t{\n\t\t\tmax =0;\n\t\t}\n\t\tSystem.out.print(max);\n\t}\n}\n\nclass ReaderBallsGame {\n\tstatic BufferedReader reader;\n\tstatic StringTokenizer tokenizer;\n\n\tstatic void Init(InputStream input) {\n\t\treader = new BufferedReader(new InputStreamReader(input));\n\t\ttokenizer = new StringTokenizer(\"\");\n\t}\n\n\tstatic String Next() throws IOException {\n\t\twhile (!tokenizer.hasMoreTokens()) {\n\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t}\n\t\treturn tokenizer.nextToken();\n\t}\n\n\tstatic int NextInt() throws IOException {\n\t\treturn Integer.parseInt(Next());\n\t}\n\n\tstatic long NextLong() throws IOException {\n\t\treturn Long.parseLong(Next());\n\t}\n\n\tstatic Double NextDouble() throws IOException {\n\t\treturn Double.parseDouble(Next());\n\t}\n}", "lang": "Java 7", "bug_code_uid": "ebd559048c4beea58c7f7cd1d6d8a883", "src_uid": "d73d9610e3800817a3109314b1e6f88c", "apr_id": "da047f6fb0515c8cba16a4ff9ddab6aa", "difficulty": 1400, "tags": ["brute force", "two pointers"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9777777777777777, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.File;\nimport java.io.FileNotFoundException;\nimport java.io.FileReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class CF_245B {\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner(System.in);\n int n = sc.nextInt();\n int k = sc.nextInt();\n int x = sc.nextInt();\n \n int[] b = new int[n];\n for(int i=0; i=0 && r0 && b[l-1]==b[l]){\n l--;\n act++;\n }\n while(r=3) {\n count+=act;\n act = 2;\n }\n l--;\n r++;\n \n } \n } else continue;\n max = Math.max(max,count-1); \n }\n \n System.out.println(max);\n\n }\n \n static class FastScanner {\n BufferedReader br;\n StringTokenizer st;\n\n public FastScanner(File f) {\n try {\n br = new BufferedReader(new FileReader(f));\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n }\n\n public FastScanner(InputStream f) {\n br = new BufferedReader(new InputStreamReader(f));\n }\n\n String next() {\n while (st == null || !st.hasMoreTokens()) {\n String s = null;\n try {\n s = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (s == null)\n return null;\n st = new StringTokenizer(s);\n }\n return st.nextToken();\n }\n\n boolean hasMoreTokens() {\n while (st == null || !st.hasMoreTokens()) {\n String s = null;\n try {\n s = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (s == null)\n return false;\n st = new StringTokenizer(s);\n }\n return true;\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n \n double nextDouble(){\n return Double.parseDouble(next());\n }\n }\n\n}\n", "lang": "Java 7", "bug_code_uid": "0af92d7c6c3559d871c21be63e592096", "src_uid": "d73d9610e3800817a3109314b1e6f88c", "apr_id": "d4f34040aa0079869eeb6c28b5649275", "difficulty": 1400, "tags": ["brute force", "two pointers"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9209662288930581, "equal_cnt": 10, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.io.IOException;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n TaskD solver = new TaskD();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class TaskD {\n private final int MOD = (int) 1e9 + 7;\n\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt(), m = in.nextInt();\n\n long ans = 0;\n for (int i = 0; i <= n; ++i) {\n for (int j = 0; j <= m; ++j) {\n int eveni = n % 2 == 1 ? (n + 1) / 2 : n / 2 + (i + 1) % 2;\n int evenj = m % 2 == 1 ? (m + 1) / 2 : m / 2 + (j + 1) % 2;\n\n int oddi = n - eveni + 1;\n int oddj = m - evenj + 1;\n\n int odd = oddi * oddj;\n int all = (n + 1) * (m + 1);\n int even = all - odd;\n\n ans += (long) even * even % MOD;\n ans += (long) odd * odd % MOD;\n ans %= MOD;\n }\n }\n\n int[] dp;\n dp = new int[n + 1];\n for (int i = 1; i <= n; ++i) {\n dp[i] = dp[i - 1] + i;\n ans = (ans - 6L * (m + 1) * dp[i]) % MOD;\n }\n dp = new int[m + 1];\n for (int i = 1; i <= m; ++i) {\n dp[i] = dp[i - 1] + i;\n ans = (ans - 6L * (n + 1) * dp[i]) % MOD;\n }\n\n dp = new int[m + 1];\n\n for (int i = 1; i <= n; ++i) {\n int[] ndp = new int[m + 1];\n //ndp[0] = dp[0] + i;\n //ans = (ans - 6L * ndp[0]) % MOD;\n for (int j = 1; j <= m; ++j) {\n ndp[j] = (dp[j] + ndp[j - 1]) % MOD;\n ndp[j] = (ndp[j] - dp[j - 1]) % MOD;\n ndp[j] = (ndp[j] + gcd(i, j)) % MOD;\n ans = (ans - 12L * ndp[j]) % MOD;\n\n //int sub = (i + 1) * (j + 1) - 1;\n //ans = (ans - 6L * sub) % MOD;\n }\n dp = ndp;\n }\n\n ans -= (n + 1) * (m + 1);\n ans %= MOD;\n if (ans < 0) ans += MOD;\n\n out.println(ans);\n }\n\n private int gcd(int a, int b) {\n int c;\n while (b != 0) {\n c = a % b;\n a = b;\n b = c;\n }\n return a;\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1)\n throw new UnknownError();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new UnknownError();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public String next() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuffer res = new StringBuffer();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n\n return res.toString();\n }\n\n private boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "5c07a0eb6f4547076aeb312f19e95f9d", "src_uid": "984788e4b4925c15c9c6f31e42f2f8fa", "apr_id": "c6ab997df7e4b8f641eb06161e05aabf", "difficulty": 2500, "tags": ["geometry", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6343346603932923, "equal_cnt": 11, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 10, "bug_source_code": "\n\nimport java.io.*;\nimport java.math.BigInteger;\nimport static java.math.BigInteger.*;\n\n\nimport java.util.*;\n\npublic class Solution{\n\n long mod=1000000007;\n void solve()throws Exception\n {\n long res=0;\n int w=nextInt();\n int h=nextInt();\n for(int x1=0;x1<2;x1++)\n for(int x2=0;x2<2;x2++)\n for(int x3=0;x3<2;x3++)\n for(int y1=0;y1<2;y1++)\n for(int y2=0;y2<2;y2++)\n for(int y3=0;y3<2;y3++)\n {\n int[]x=new int[]{x1,x2,x3};\n int rem=Math.abs((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1));\n if(rem%2!=0)\n continue;\n long a=count(x,w);\n long b=count(new int[]{y1,y2,y3},h);\n res+=a*b;\n res%=mod;\n }\n int[][][]a1=get(w);\n int[][][]a2=get(h);\n for(int i=0;i<2;i++)\n for(int a=0;a<=w && a<=h;a++)\n for(int b=0;b<=w&& b<=h;b++)\n {\n res-=(long)a1[i][a][b]*a2[i][a][b];\n res%=mod;\n if(res<0)\n res+=mod;\n }\n for(int x1=0;x1<=w;x1++)\n for(int y1=0;y1<=h;y1++)\n {\n long cur=h+1+w+1-1;\n res-=cur*cur;\n res%=mod;\n if(res<0)\n res+=mod;\n }\n System.out.println(res);\n\n\n\n\n }\n\n private int[][][] get(int n) {\n int[][]gcd=new int[n+1][n+1];\n int[][][]res=new int[2][n+1][n+1];\n for(int i=0;i<=n;i++)\n for(int j=0;j<=n;j++)\n {\n if(i==0 || j==0)\n gcd[i][j]=i+j;\n else if(i>=j)\n gcd[i][j]=gcd[i-j][j];\n else\n gcd[i][j]=gcd[i][j-i];\n }\n for(int a=-n;a<=n;a++)\n for(int b=-n;b<=n;b++)\n {\n if(a==0 || b==0)\n continue;\n int g=gcd[Math.abs(a)][Math.abs(b)];\n int[]x1=getRange(a,n);\n int[]x2=getRange(b,n);\n int com=getCom(x1,x2);\n int A=a;\n int B=b;\n A/=g;\n B/=g;\n if(A*B<0)\n {\n A=Math.abs(A);\n B=Math.abs(B);\n res[1][A][B]+=com;\n }\n else\n {\n A=Math.abs(A);\n B=Math.abs(B);\n res[0][A][B]+=com;\n }\n\n }\n return res;\n }\n\n\n private int getCom(int[] x1, int[] x2) {\n Arrays.sort(x1);\n Arrays.sort(x2);\n if(x1[0]>x2[1])\n return 0;\n if(x2[0]>x1[1])\n return 0;\n return Math.min(x2[1],x1[1])-Math.max(x1[0],x2[0])+1;\n }\n\n private int[] getRange(int a, int n) {\n if(a>=0)\n return new int[]{0,n-a};\n else\n {\n return new int[]{-a,n};\n }\n }\n\n private long count(int[] x, int w) {\n long res=1;\n long[]num=new long[2];\n num[0]=1+w/2;\n num[1]=w+1-num[0];\n for(int X: x)\n {\n res*=num[X];\n res%=mod;\n }\n return res;\n\n }\n\n\n ////////////\n BufferedReader reader;\n PrintWriter writer;\n StringTokenizer stk;\n void run()throws Exception\n {\n\n reader=new BufferedReader(new InputStreamReader(System.in));\n // reader=new BufferedReader(new FileReader(\"input.txt\"));\n stk=null;\n writer=new PrintWriter(new PrintWriter(System.out));\n //writer=new PrintWriter(new FileWriter(\"output.txt\"));\n solve();\n reader.close();\n writer.close();\n }\n int nextInt()throws Exception\n {\n return Integer.parseInt(nextToken());\n }\n\n long nextLong()throws Exception\n {\n return Long.parseLong(nextToken());\n\n }\n double nextDouble()throws Exception\n {\n return Double.parseDouble(nextToken());\n\n\n }\n\n String nextString()throws Exception\n {\n return nextToken();\n }\n String nextLine()throws Exception\n {\n return reader.readLine();\n }\n String nextToken()throws Exception\n {\n if(stk==null || !stk.hasMoreTokens())\n {\n stk=new StringTokenizer(nextLine());\n return nextToken();\n\n }\n return stk.nextToken();\n }\n\n public static void main(String[]args) throws Exception\n {\n new Solution().run();\n }\n\n\n\n\n\n\n\n\n}", "lang": "Java 6", "bug_code_uid": "71c3e11df4225b829ca0cdd850c7cfd3", "src_uid": "984788e4b4925c15c9c6f31e42f2f8fa", "apr_id": "cc84f03dfcd7e9de91dd761f2b4775b5", "difficulty": 2500, "tags": ["geometry", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9787955894826124, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "import java.io.InputStreamReader;\nimport java.io.IOException;\nimport java.io.BufferedReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n TaskD solver = new TaskD();\n solver.solve(1, in, out);\n out.close();\n }\n}\n\nclass TaskD {\n int n;\n int m;\n final int M = 1000000007;\n\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n n = in.nextInt();\n m = in.nextInt();\n int ans = 0;\n for (int y = 0; y <= n; y++)\n for (int x = 0; x <= m; x++) {\n ans += calculateFitTriples(x, y);\n if (ans >= M)\n ans -= M;\n }\n ans -= calculateBadTriples();\n if (ans < 0)\n ans += M;\n // Fix a strange bug :)\n ans += (n + 1) * (m + 1);\n if (ans >= M)\n ans -= M;\n out.println(ans);\n }\n\n int calculateFitTriples(int x, int y) {\n int ret = 0;\n int x0 = x % 2, y0 = y % 2;\n for (int x1 = 0; x1 <= 1; x1++)\n for (int y1 = 0; y1 <= 1; y1++)\n for (int x2 = 0; x2 <= 1; x2++)\n for (int y2 = 0; y2 <= 1; y2++) {\n int ax = (2 + x1 - x0) % 2;\n int ay = (2 + y1 - y0) % 2;\n int bx = (2 + x2 - x0) % 2;\n int by = (2 + y2 - y0) % 2;\n int areaMod2 = (2 + ax * by - ay * bx) % 2;\n if (areaMod2 != 0) continue;\n long X1 = getPointsOnSegmentWithParity(m, x1);\n long Y1 = getPointsOnSegmentWithParity(n, y1);\n long X2 = getPointsOnSegmentWithParity(m, x2);\n long Y2 = getPointsOnSegmentWithParity(n, y2);\n ret += (((((X1 * Y1) % M) * X2) % M) * Y2) % M;\n if (ret >= M)\n ret -= M;\n }\n return ret;\n }\n\n int getPointsOnSegmentWithParity(int len, int par) {\n if (par == 0)\n return (len / 2) + 1;\n else\n return (len + 1) / 2;\n }\n\n int calculateBadTriples() {\n int ret = 0;\n for (int dn = 0; dn <= n; dn++)\n for (int dm = 0; dm <= m; dm++) {\n if (dn == 0 && dm == 0) {\n ret += (n + 1) * (m + 1) * 2;\n if (ret >= M)\n ret -= M;\n continue;\n }\n int times = (n - dn + 1) * (m - dm + 1);\n int innerPoints = gcd(dn, dm) - 1;\n int permutations = 6 * innerPoints + 6;\n long add = (long) permutations * times;\n if (dn != 0 && dm != 0)\n add *= 2;\n ret += add % M;\n if (ret >= M)\n ret -= M;\n }\n return ret;\n }\n\n int gcd(int a, int b) {\n return b != 0 ? gcd(b, a % b) : a;\n }\n}\n\nclass InputReader {\n private BufferedReader reader;\n private StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream));\n tokenizer = null;\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n}\n", "lang": "Java 6", "bug_code_uid": "007efe788188bbe04abf1535cafc359a", "src_uid": "984788e4b4925c15c9c6f31e42f2f8fa", "apr_id": "00cc897b6a5c15a243e853754a508a0e", "difficulty": 2500, "tags": ["geometry", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9998737214294734, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\nimport java.io.*;\n\npublic class A {\n\tpublic static void main(String[] args) throws IOException {\n\t\tst = new StringTokenizer(rd.readLine());\n\t\tM = Integer.parseInt(st.nextToken());\n\t\tN = Integer.parseInt(st.nextToken());\n\t\tF[0] = 1;\n\t//\tfor(int i=0; i<=4000; i++) for(int j=0; j<=4000; j++) g[i][j] = gcd(i, j);\n\t\tfor(int i=1; i0? ((X[i]*X[j])%Q)*(X[i]-1): 0))%Q;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(i!=j && j==k && i!=k){\n\t\t\t\t\t\t\tres = (res + (X[j]>0? ((X[i]*X[j])%Q)*(X[j]-1): 0))%Q;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(i!=j && j==k && i==k){\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(i==j && j!=k && i!=k){\n\t\t\t\t\t\t\tres = (res + (X[i]>0? ((X[i]*(X[i]-1))%Q)*X[k]: 0))%Q;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(i==j && j!=k && i==k){\n\t\t\t\t\t\t\t//\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(i==j && j==k && i!=k){\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(i==j && j==k && i==k){\n\t\t\t\t\t\t\tres = (res + (X[i]>1? ((X[i]*(X[i]-1))%Q)*(X[i]-2): 0))%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\tpw.println((res-numOnLine()+Q)%Q);\n\t\tint r = 0;\n\t\tpw.flush();\n\t\tif(r==0) return;\n\t\tfor(int x1=0; x1<=M; x1++){\n\t\t\tfor(int x2=0; x2<=M; x2++){\n\t\t\t\tfor(int x3=0; x3<=M; x3++){\n\t\t\t\t\tfor(int y1=0; y1<=N; y1++){\n\t\t\t\t\t\tfor(int y2=0; y2<=N; y2++){\n\t\t\t\t\t\t\tfor(int y3=0; y3<=N; y3++){\n\t\t\t\t\t\t\t\tint s = Math.abs(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2));\n\t\t\t\t\t\t\t\tif(s!=0 && s%2==0) r++;\n\t\t\t\t\t\t\t}\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\tSystem.out.println(r);\n\t}\n\t\n\tstatic int numOnLine(){\n\t\tlong res = 0;\n\t\tfor(int m=0; m<=M; m++){\n\t\t\tfor(int n=0; n<=N; n++){\n\t\t\t\tlong mult = (M-m+1)*(N-n+1);\n\t\t\t\tif(m==0 || n==0){\n\t\t\t\t\tint s = m+n;\n\t\t\t\t\tif(s>=2){\n\t\t\t\t\t\tres = (res + mult*(s-1)*6)%Q;\n\t\t//\t\t\t\tSystem.out.println(\"XAZI\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tint d = gcd(m, n);\n\t\t\t\t\tint t = n/d;\n\t\t\t\t\tint num = n/t+1;\n\t\t\t\t\tif(num>=3){\n\t\t\t\t//\t\tif(m<2 && n<2) System.out.println(\"TY\");\n\t\t//\t\t\t\tSystem.out.println(\"diagonali\");\n\t\t\t\t\t\tres = (res + mult*(num-2)*12)%Q;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn (int) res;\n\t}\n\t\n\tstatic int gcd1(int x, int y){\n\t\tif(x==0 || y==0) return x+y;\n\t\tif(x==1 || y==1) return 1;\n\t\tif(x>y) return gcd1(x%y, y);\n\t\treturn gcd1(x, y%x);\n\t}\n\t\n\tstatic long getA(int x, int y){\n\t\treturn F[x]*IF[x-y];\n\t}\n\t\n\tstatic long[] F = new long[4001], IF = new long[4001];\n\t\n\tstatic long pow(long x, long y){\n\t\tif(y==0) return 1;\n\t\tif(y==1) return x%Q;\n\t\tlong sq = pow(x, y>>1);\n\t\treturn y%2==0? (sq*sq)%Q: (((sq*sq)%Q)*x)%Q;\n\t}\n\t\n\tstatic int gcd(int x, int y){\n\t\tif(x>y) return gcd(y, x);\n\t\tif(x==0 || y==0) return x+y;\n\t\tif(x==1 || y==1) return 1;\n\t\tif((x&1)==0 && (y&1)==0) return 2*gcd(x>>1, y>>1);\n\t\tif((x&1)==0) return gcd(x>>1, y);\n\t\tif((y&1)==0) return gcd(x, y>>1);\n\t\treturn gcd(x, (y-x)>>1);\n\t}\n\t\n\tstatic int[][] g = new int[4001][4001];\n\t\n\tstatic int Q = 1000000007;\n\t\n\tstatic Point[] P;\n\t\n\tstatic boolean isOk(int i, int j, int k){\n\t\tPoint a = new Point(P[i].x, P[i].y), b = new Point(P[j].x, P[j].y), c = new Point(P[k].x, P[k].y);\n\t\tint mult = a.x*(b.y-c.y)+b.x*(c.y-a.y)+c.x*(a.y-b.y)+1000;\n\t\treturn mult%2==0;\n\t}\n\t\n\tstatic int M, N;\n\t\n\tstatic BufferedReader rd = new BufferedReader(new InputStreamReader(System.in));\n\tstatic PrintWriter pw = new PrintWriter(System.out);\n\tstatic StringTokenizer st;\n\t\n}\n\nclass Point{\n\tpublic Point(int x, int y){\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t}\n\t\n\tpublic int x, y;\n\t\n\t\n\t\n}\n", "lang": "Java 6", "bug_code_uid": "ac7b8b72675895e36e5729584a5829c3", "src_uid": "984788e4b4925c15c9c6f31e42f2f8fa", "apr_id": "4b6ab16c1071883545a1caddb0266507", "difficulty": 2500, "tags": ["geometry", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9704726904067925, "equal_cnt": 13, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 9, "fix_ops_cnt": 12, "bug_source_code": "import java.util.*;\nimport java.io.*;\n\npublic class A {\n\tpublic static void main(String[] args) throws IOException {\n\t\tst = new StringTokenizer(rd.readLine());\n\t\tM = Integer.parseInt(st.nextToken());\n\t\tN = Integer.parseInt(st.nextToken());\n\t\tF[0] = 1;\n\t//\tfor(int i=0; i<=4000; i++) for(int j=0; j<=4000; j++) g[i][j] = gcd(i, j);\n\t\tfor(int i=1; i0? X[i]*X[j]*(X[i]-1): 0))%Q;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(i!=j && j==k && i!=k){\n\t\t\t\t\t\t\tres = (res + (X[j]>0? X[i]*(X[j])*(X[j]-1): 0))%Q;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(i!=j && j==k && i==k){\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(i==j && j!=k && i!=k){\n\t\t\t\t\t\t\tres = (res + (X[i]>0? X[i]*(X[i]-1)*X[k]: 0))%Q;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(i==j && j!=k && i==k){\n\t\t\t\t\t\t\t//\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(i==j && j==k && i!=k){\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(i==j && j==k && i==k){\n\t\t\t\t\t\t\tres = (res + (X[i]>1? X[i]*(X[i]-1)*(X[i]-2): 0))%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\tpw.println((res-numOnLine()+Q)%Q);\n\t\tint r = 0;\n\t\tpw.flush();\n\t\tif(r==0) return;\n\t\tfor(int x1=0; x1<=M; x1++){\n\t\t\tfor(int x2=0; x2<=M; x2++){\n\t\t\t\tfor(int x3=0; x3<=M; x3++){\n\t\t\t\t\tfor(int y1=0; y1<=N; y1++){\n\t\t\t\t\t\tfor(int y2=0; y2<=N; y2++){\n\t\t\t\t\t\t\tfor(int y3=0; y3<=N; y3++){\n\t\t\t\t\t\t\t\tint s = Math.abs(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2));\n\t\t\t\t\t\t\t\tif(s!=0 && s%2==0) r++;\n\t\t\t\t\t\t\t}\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\tSystem.out.println(r);\n\t}\n\t\n\tstatic int numOnLine(){\n\t\tlong res = 0;\n\t\tfor(int m=0; m<=M; m++){\n\t\t\tfor(int n=0; n<=N; n++){\n\t\t\t\tlong mult = (M-m+1)*(N-n+1);\n\t\t\t\tif(m==0 || n==0){\n\t\t\t\t\tint s = m+n;\n\t\t\t\t\tif(s>=2){\n\t\t\t\t\t\tres = (res + mult*(s-1)*6)%Q;\n\t\t//\t\t\t\tSystem.out.println(\"XAZI\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tint d = gcd(m, n);\n\t\t\t\t\tint t = n/d;\n\t\t\t\t\tint num = n/t+1;\n\t\t\t\t\tif(num>=3){\n\t\t\t\t//\t\tif(m<2 && n<2) System.out.println(\"TY\");\n\t\t//\t\t\t\tSystem.out.println(\"diagonali\");\n\t\t\t\t\t\tres = (res + mult*(num-2)*12)%Q;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn (int) res;\n\t}\n\t\n\tstatic int gcd1(int x, int y){\n\t\tif(x==0 || y==0) return x+y;\n\t\tif(x==1 || y==1) return 1;\n\t\tif(x>y) return gcd1(x%y, y);\n\t\treturn gcd1(x, y%x);\n\t}\n\t\n\tstatic long getA(int x, int y){\n\t\treturn F[x]*IF[x-y];\n\t}\n\t\n\tstatic long[] F = new long[4001], IF = new long[4001];\n\t\n\tstatic long pow(long x, long y){\n\t\tif(y==0) return 1;\n\t\tif(y==1) return x%Q;\n\t\tlong sq = pow(x, y>>1);\n\t\treturn y%2==0? (sq*sq)%Q: (((sq*sq)%Q)*x)%Q;\n\t}\n\t\n\tstatic int gcd(int x, int y){\n\t\tif(x>y) return gcd(y, x);\n\t\tif(x==0 || y==0) return x+y;\n\t\tif(x==1 || y==1) return 1;\n\t\tif((x&1)==0 && (y&1)==0) return 2*gcd(x>>1, y>>1);\n\t\tif((x&1)==0) return gcd(x>>1, y);\n\t\tif((y&1)==0) return gcd(x, y>>1);\n\t\treturn gcd(x, (y-x)>>1);\n\t}\n\t\n\tstatic int[][] g = new int[4001][4001];\n\t\n\tstatic int Q = 1000000007;\n\t\n\tstatic Point[] P;\n\t\n\tstatic boolean isOk(int i, int j, int k){\n\t\tPoint a = new Point(P[i].x, P[i].y), b = new Point(P[j].x, P[j].y), c = new Point(P[k].x, P[k].y);\n\t\tint mult = a.x*(b.y-c.y)+b.x*(c.y-a.y)+c.x*(a.y-b.y)+1000;\n\t\treturn mult%2==0;\n\t}\n\t\n\tstatic int M, N;\n\t\n\tstatic BufferedReader rd = new BufferedReader(new InputStreamReader(System.in));\n\tstatic PrintWriter pw = new PrintWriter(System.out);\n\tstatic StringTokenizer st;\n\t\n}\n\nclass Point{\n\tpublic Point(int x, int y){\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t}\n\t\n\tpublic int x, y;\n\t\n\t\n\t\n}\n", "lang": "Java 6", "bug_code_uid": "e5b417f338a8119fdba566eee484420a", "src_uid": "984788e4b4925c15c9c6f31e42f2f8fa", "apr_id": "4b6ab16c1071883545a1caddb0266507", "difficulty": 2500, "tags": ["geometry", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.41034288926363127, "equal_cnt": 9, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "java.util.Scanner;\n\n/**\n *\n * @author Mohamed Khafaga\n */\npublic class TheNewYear {\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int[] points = new int[3];\n //double avg = 0;\n int avg = 0;\n int distance = 0;\n for (int i = 0; i < 3; i++) {\n points[i] = in.nextInt();\n avg += points[i];\n\n }\n if (points[0] == points[1] && points[1] == points[2]) {\n System.out.println(0);\n } else if (points[0] == points[1] || points[1] == points[2] || points[2] == points[0]) {\n System.out.println(Math.max(Math.max(points[0], points[1]), points[2]) -Math.min(Math.min(points[0], points[1]), points[2]));\n } else {\n avg /= 3.0;\n //avg = ((avg-(int)avg)>0.5)? (int)avg+1: (int)avg;\n //avg = Math.ceil(avg);\n for (int i = 0; i < 3; i++) {\n distance += Math.abs(avg - points[i]);\n }\n System.out.println(distance);\n }\n\n }\n}\n", "lang": "Java 8", "bug_code_uid": "09f856eaf0b5ee45f9da45ce6b8e6906", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "apr_id": "7724f527d4105c47866eb0a177d27480", "difficulty": 800, "tags": ["math", "sortings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6481257557436517, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "public class R266A {\n public static void main (String[] args){\n Scanner t=new Scanner(System.in);\n int n=t.nextInt();\n int m=t.nextInt();\n int a=t.nextInt();\n int b=t.nextInt();\n if ((double)m/b adj[]; //Adjacency Lists\n static int V; // No. of vertices\n // Constructor\n static void Graph(int v){\n V = v;\n adj=new boolean[v][v];\n// adj = new ArrayList[v];\n// for (int i=0; i0){\n \t\t\t\tfor(int k=0;k0&&adj[j][k]){\n \t\t\t\t\t\tdp[j][mask]=Math.max(1+dp[k][mask^(1< queue=new LinkedList();\n// \tqueue.add(s);\n// \tvisited[s]=true;\n// \twhile(!queue.isEmpty()){\n// \t\tint num=queue.pop();\n//// \t\tSystem.out.println(ans.toString());\n// \t\tfor(int i=0;i 0) {\n\t if (exponent % 2L == 1L)\n\t result = (result * base) % modulus;\n\t exponent = exponent >> 1;\n\t base = (base * base) % modulus;\n\t }\n\t return result;\n\t}\n static HashMap primeFactors(long n){\n HashMap ans=new HashMap();\n \t// Print the number of 2s that divide n\n while (n%2L==0L)\n {\n if(ans.containsKey(2L)){\n \tans.put(2L,ans.get(2L)+1L);\n }else{\n \tans.put(2L,1L);\n }\n n /= 2L;\n }\n \n // n must be odd at this point. So we can\n // skip one element (Note i = i +2)\n for (long i = 3; i <= Math.sqrt(n); i+= 2L)\n {\n // While i divides n, print i and divide n\n while (n%i == 0)\n {\n \tif(ans.containsKey(i)){\n \tans.put(i,ans.get(i)+1L);\n }else{\n \tans.put(i,1L);\n }\n n /= i;\n }\n }\n \n // This condition is to handle the case whien\n // n is a prime number greater than 2\n if (n > 2)\n ans.put(n,1L);\n return ans;\n }\n////for marking all prime numbers greater than 1 and less than equal to N\n\tstatic void sieve(int N) {\n\t boolean isPrime[]=new boolean[N+1];\n\t isPrime[0] = true;\n\t isPrime[1] = true;\n\t for(int i = 2; i * i <= N; ++i) {\n\t if(isPrime[i] == false) {//Mark all the multiples of i as composite numbers\n\t for(int j = i * i; j <= N ;j += i)\n\t isPrime[j] = true;\n\t }\n\t }\n\t}\n// //if str2 (pattern) is subsequence of str1 (Text) or not\n//\tstatic boolean function(String str1,String str2){\n//\t str2 = str2.replace(\"\", \".*\"); //returns .*a.*n.*n.*a.\n//\t return (str1.matches(str2)); // returns true\n//\t}\n static int Arr[];\n static long size[];\n //modified initialize function:\n static void initialize(int N){\n \tArr=new int[N];\n \tsize=new long[N];\n for(int i = 0;i level;;\n//\tstatic HashMap parent;\n\tstatic int maxlevel=0;\n\t\n//\tstatic boolean T[][][];\n//\tstatic void subsetSum(int input[], int total, int count) {\n// T = new boolean[input.length + 1][total + 1][count+1];\n// for (int i = 0; i <= input.length; i++) {\n// \tT[i][0][0] = true;\n// \tfor(int j = 1; j<=count; j++){\n// \t\tT[i][0][j] = false;\n// \t}\n// }\n// int sum[]=new int[input.length+1];\n// for(int i=1;i<=input.length;i++){\n// sum[i]=sum[i-1]+input[i-1];\n// }\n// for (int i = 1; i <= input.length; i++) {\n// for (int j = 1; j <= (int)Math.min(total,sum[i]); j++) {\n// \tfor (int k = 1; k <= (int)Math.min(i,count); k++){\n// \t\t if (j >= input[i - 1]) {//Exclude and Include\n// T[i][j][k] = T[i - 1][j][k] || T[i - 1][j - input[i - 1]][k-1];\n// } else {\n// T[i][j][k] = T[i-1][j][k];\n// }\n// \t}\n// }\n// }\n// }\n//\tstatic >\n//\tSortedSet> entriesSortedByValues(Map map) {\n//\t SortedSet> sortedEntries = new TreeSet>(\n//\t new Comparator>() {\n//\t @Override public int compare(Map.Entry e1, Map.Entry e2) {\n//\t int res = e2.getValue().compareTo(e1.getValue());\n//\t return res != 0 ? res : 1;\n//\t }\n//\t }\n//\t );\n//\t sortedEntries.addAll(map.entrySet());\n//\t return sortedEntries;\n//\t}\n\t\n \n\t \n\t//minimum prime factor of all the numbers less than n\n static int minPrime[];\n\tstatic void minimumPrime(int n){\n\t\tminPrime=new int[n+1];\n\t\tminPrime[1]=1;\n for (int i = 2; i * i <= n; ++i) {\n if (minPrime[i] == 0) { //If i is prime\n for (int j = i * i; j <= n; j += i) {\n if (minPrime[j] == 0) {\n minPrime[j] = i;\n }\n }\n }\n }\n for (int i = 2; i <= n; ++i) {\n if (minPrime[i] == 0) {\n minPrime[i] = i;\n }\n }\n\t}\n\tstatic long modInverse(long A, long M)\n\t{\n\t\tlong x=extendedEuclid(A,M)[0];\n\t\treturn (x%M+M)%M; //x may be negative\n\t}\n\tstatic long[] extendedEuclid(long A, long B) {\n\t\tif(B == 0) {\n\t\t\tlong d = A;\n\t\t\tlong x = 1;\n\t\t\tlong y = 0;\n\t\t\treturn new long[]{x,y,d};\n\t\t}\n\t\telse {\n\t\t\tlong arr[]=extendedEuclid(B, A%B);\n\t\t\tlong temp = arr[0];\n\t\t\tarr[0] = arr[1];\n\t\t\tarr[1] = temp - (A/B)*arr[1];\n\t\t\treturn arr;\n\t\t}\n\t}\n \n\tstatic class InputReader {\n private final InputStream stream;\n private final byte[] buf = new byte[8192];\n private int curChar, numChars;\n private SpaceCharFilter filter;\n \n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n \n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n \n public String nextLine() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isEndOfLine(c));\n return res.toString();\n }\n \n public String readString() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n \n public long nextLong() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n \n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n \n public int[] nextIntArray(int n) {\n int[] arr = new int[n];\n for (int i = 0; i < n; i++) {\n arr[i] = nextInt();\n }\n return arr;\n }\n \n public long[] nextLongArray(int n) {\n long[] arr = new long[n];\n for (int i = 0; i < n; i++) {\n arr[i] = nextLong();\n }\n return arr;\n }\n \n public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n \n private boolean isEndOfLine(int c) {\n return c == '\\n' || c == '\\r' || c == -1;\n }\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n\t}\n}", "lang": "Java 8", "bug_code_uid": "95325915222dcda6eff186e582417b89", "src_uid": "1c80040104e06c9f24abfcfe654a851f", "apr_id": "2e68954551a40c7ff0a35dbd3263359f", "difficulty": 1200, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9501226492232215, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Scanner;\nimport java.io.File;\n public class 817A{\n\tpublic static void main (String args[]){\n\t\tFile file1= new File(\"in.inp\");\n\t\tFile file2= new File(\"ou.out\");\n\t\tScanner inp= new Scanner(System.in);\n\t\tint x1=inp.nextInt();\n\t\tint y1=inp.nextInt();\n\t\tint x2=inp.nextInt();\n\t\tint y2=inp.nextInt();\n\t\tint a=inp.nextInt();\n\t\tint b=inp.nextInt();\n\t\tinp.close();\n\t\tx1=Math.abs(x2-x1);\n\t\ty1=Math.abs(y2-y1);\n\t\tif(x1%a!=0) System.out.print(\"NO\");\n\t\telse if(y1 % b != 0) System.out.print(\"NO\");\n\t\telse if(Math.abs((x1 / a) - (y1 / b)) % 2 != 0) System.out.print(\"NO\");\n\t\telse System.out.print(\"YES\");\n\t}\n }", "lang": "Java 8", "bug_code_uid": "37f49bbd2b5e9dd4fd33171d7b3274e0", "src_uid": "1c80040104e06c9f24abfcfe654a851f", "apr_id": "39a87564edf5513ae5305e32a1ddfee0", "difficulty": 1200, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9992348890589136, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "/*\n * To change this license header, choose License Headers in Project Properties.\n * To change this template file, choose Tools | Templates\n * and open the template in the editor.\n */\npackage main;\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Scanner;\nimport java.util.Set;\n\n/**\n *\n * @author george150485\n */\npublic class Main {\n\n /**\n * @param args the command line arguments\n */\n public static void main(String[] args) throws IOException {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n Scanner sc=new Scanner(System.in);\n String []nn=br.readLine().split(\" \");\n int n=Integer.parseInt(nn[0]);\n long ans=0;\n int k;\n //SetS=new HashSet<>();\n double p;\n for (int i = n; i >0; --i) {\n for (int j = i-1; j >0; --j) {\n k=(i^j);\n if(k0){\n //the average of them are > max of them\n p=((double)(k+i+j)/(double)2);\n if(p>(Math.max(i, Math.max(j, k))))++ans;\n }\n \n }\n }\n System.out.println(ans);\n }\n \n}\n", "lang": "Java 8", "bug_code_uid": "dcfe6e5b206a3da7741b143ffe079085", "src_uid": "838f2e75fdff0f13f002c0dfff0b2e8d", "apr_id": "6d78069f03be7fa350901d366510cd12", "difficulty": 1300, "tags": ["brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.629950495049505, "equal_cnt": 16, "replace_cnt": 13, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 15, "bug_source_code": "import java.io.*;\nimport java.util.*;\npublic class D {\n\tprivate static void solve() throws IOException {\n\t\tn = nextInt();\n\t\tm = nextInt();\n\t\tf = new int[n+1];\n\t\tboolean[] visF = new boolean[n+1];\n\t\tboolean[] visE = new boolean[n+1];\n\t\tQueue starts = new LinkedList(); //all the locations of starts\n\t\tQueue ends = new LinkedList(); //all the locations of ends\n\t\tfor(int i = 1; i < n+1; i++) {\n\t\t\tf[i] = nextInt();\n\t\t\tif(f[i] == 1)\n\t\t\t\tstarts.add(i);\n\t\t\telse if(f[i] == 2)\n\t\t\t\tends.add(i);\n\t\t}\n\t\tadj = new ArrayList>(m);\n\t\tback = new ArrayList>(m);\n\t\tfor(int i = 0; i < n+1; i++) {\n\t\t\tadj.add(new LinkedList());\n\t\t\tback.add(new LinkedList());\n\t\t}\n\t\tfor(int i = 0; i < m; i++) {\n\t\t\tint f = nextInt();\n\t\t\tint s = nextInt();\n\t\t\tadj.get(f).add(s);\n\t\t\tback.get(s).add(f);\n\t\t}\n\t\t//see if can be found from a 1\n\t\twhile(!starts.isEmpty()) {\n\t\t\tint cur = starts.poll();\n\t\t\tif(visF[cur])\n\t\t\t\tcontinue;\n\t\t\tvisF[cur] = true;\n\t\t\tLinkedList temp = adj.get(cur);\n\t\t\tfor(int i = 0; i < temp.size(); i++) {\n\t\t\t\tstarts.add(temp.get(i));\n\t\t\t}\n\t\t}\n\t\twhile(!ends.isEmpty()) {\n\t\t\tint cur = ends.poll();\n\t\t\tif(visE[cur])\n\t\t\t\tcontinue;\n\t\t\tvisE[cur] = true;\n\t\t\tif(f[cur] == 1)\n\t\t\t\tcontinue;\n\t\t\tLinkedList temp = back.get(cur);\n\t\t\tfor(int i = 0; i < temp.size(); i++) {\n\t\t\t\tends.add(temp.get(i));\n\t\t\t}\n\t\t}\n\t\tfor(int i = 1; i < visF.length; i++) {\n\t\t\tif(visF[i] && visE[i])\n\t\t\t\tout.println(1);\n\t\t\telse\n\t\t\t\tout.println(0);\n\t\t}\n\t}\n\tstatic int b, n, m, k, l;\n\tstatic int[] a, f;\n\tstatic ArrayList> adj, back;\n\t\n\tpublic static void main(String[] args) {\n\t\ttry {\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tout = new PrintWriter(System.out);\n\t\t\tsolve();\n\t\t\tout.close();\n\t\t} catch (Throwable e) {\n\t\t\te.printStackTrace();\n\t\t\tSystem.exit(239);\n\t\t}\n\t}\n\n\tstatic BufferedReader br;\n\tstatic StringTokenizer st;\n\tstatic PrintWriter out;\n\n\tstatic String nextToken() throws IOException {\n\t\twhile (st == null || !st.hasMoreTokens()) {\n\t\t\tString line = br.readLine();\n\t\t\tif (line == null) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tst = new StringTokenizer(line);\n\t\t}\n\t\treturn st.nextToken();\n\t}\n\n\tstatic int nextInt() throws IOException {\n\t\treturn Integer.parseInt(nextToken());\n\t}\n\n\tstatic long nextLong() throws IOException {\n\t\treturn Long.parseLong(nextToken());\n\t}\n\n\tstatic double nextDouble() throws IOException {\n\t\treturn Double.parseDouble(nextToken());\n\t}\n}\n", "lang": "Java 6", "bug_code_uid": "0f922b1eea26890c2a5c904bfb4b790a", "src_uid": "87d869a0fd4a510c5e7e310886b86a57", "apr_id": "cee496acfe2e89399f8c371c90b764f6", "difficulty": 1700, "tags": ["graphs"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9917738873655347, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*;\nimport java.util.*;\npublic class D {\n\tprivate static void solve() throws IOException {\n\t\tn = nextInt();\n\t\tm = nextInt();\n\t\tf = new int[n+1];\n\t\tboolean[] visF = new boolean[n+1];\n\t\tboolean[] visE = new boolean[n+1];\n\t\tQueue starts = new LinkedList(); //all the locations of starts\n\t\tQueue ends = new LinkedList(); //all the locations of ends\n\t\tfor(int i = 1; i < n+1; i++) {\n\t\t\tf[i] = nextInt();\n\t\t\tif(f[i] == 1)\n\t\t\t\tstarts.add(i);\n\t\t\telse if(f[i] == 2)\n\t\t\t\tends.add(i);\n\t\t}\n\t\tadj = new ArrayList[n+1];\n\t\tback = new ArrayList[n+1];\n\t\tfor(int i = 0; i < n+1; i++) {\n\t\t\tadj[i] = new ArrayList();\n\t\t}\n\t\tfor(int i = 0; i < m; i++) {\n\t\t\tint f = nextInt();\n\t\t\tint s = nextInt();\n\t\t\tadj[f].add(s);\n\t\t\tback[s].add(f);\n\t\t}\n\t\t//see if can be found from a 1\n\t\twhile(!starts.isEmpty()) {\n\t\t\tint cur = starts.poll();\n\t\t\tif(visF[cur])\n\t\t\t\tcontinue;\n\t\t\tvisF[cur] = true;\n\t\t\tArrayList temp = adj[cur];\n\t\t\tfor(int i = 0; i < temp.size(); i++) {\n\t\t\t\tstarts.add(temp.get(i));\n\t\t\t}\n\t\t}\n\t\twhile(!ends.isEmpty()) {\n\t\t\tint cur = ends.poll();\n\t\t\tif(visE[cur])\n\t\t\t\tcontinue;\n\t\t\tvisE[cur] = true;\n\t\t\tif(f[cur] == 1)\n\t\t\t\tcontinue;\n\t\t\tArrayList temp = back[cur];\n\t\t\tfor(int i = 0; i < temp.size(); i++) {\n\t\t\t\tends.add(temp.get(i));\n\t\t\t}\n\t\t}\n\t\tfor(int i = 1; i < visF.length; i++) {\n\t\t\tif(visF[i] && visE[i])\n\t\t\t\tout.println(1);\n\t\t\telse\n\t\t\t\tout.println(0);\n\t\t}\n\t}\n\tstatic int b, n, m, k, l;\n\tstatic int[] a, f;\n\tstatic ArrayList[] adj, back;\n\t\n\tpublic static void main(String[] args) {\n\t\ttry {\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tout = new PrintWriter(System.out);\n\t\t\tsolve();\n\t\t\tout.close();\n\t\t} catch (Throwable e) {\n\t\t\te.printStackTrace();\n\t\t\tSystem.exit(239);\n\t\t}\n\t}\n\n\tstatic BufferedReader br;\n\tstatic StringTokenizer st;\n\tstatic PrintWriter out;\n\n\tstatic String nextToken() throws IOException {\n\t\twhile (st == null || !st.hasMoreTokens()) {\n\t\t\tString line = br.readLine();\n\t\t\tif (line == null) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tst = new StringTokenizer(line);\n\t\t}\n\t\treturn st.nextToken();\n\t}\n\n\tstatic int nextInt() throws IOException {\n\t\treturn Integer.parseInt(nextToken());\n\t}\n\n\tstatic long nextLong() throws IOException {\n\t\treturn Long.parseLong(nextToken());\n\t}\n\n\tstatic double nextDouble() throws IOException {\n\t\treturn Double.parseDouble(nextToken());\n\t}\n}\n", "lang": "Java 6", "bug_code_uid": "3e058dc916db45562fe4721ec0e375a1", "src_uid": "87d869a0fd4a510c5e7e310886b86a57", "apr_id": "cee496acfe2e89399f8c371c90b764f6", "difficulty": 1700, "tags": ["graphs"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7718606180144642, "equal_cnt": 31, "replace_cnt": 13, "delete_cnt": 10, "insert_cnt": 8, "fix_ops_cnt": 31, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.BufferedWriter;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.StringTokenizer;\n\n\npublic class D {\n \n static StringTokenizer st;\n static BufferedReader in;\n static int[]f, p, ans;\n static ArrayList[]ages;\n static boolean[]used, assigned;\n public static void main(String[] args) throws IOException {\n in = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n int n = nextInt();\n int m = nextInt();\n f = new int[n+1];\n for (int i = 1; i <= n; i++) {\n f[i] = nextInt();\n }\n ages = new ArrayList[n+1];\n for (int i = 1; i <= n; i++) {\n ages[i] = new ArrayList();\n }\n for (int i = 1; i <= m; i++) {\n int v1 = nextInt();\n int v2 = nextInt();\n ages[v1].add(v2);\n }\n used = new boolean[n+1];\n p = new int[n+1];\n ans = new int[n+1];\n assigned = new boolean[n+1];\n for (int i = 1; i <= n; i++) {\n if (!used[i] && f[i]==1)\n dfs(i);\n }\n for (int i = 1; i <= n; i++) {\n pw.println(ans[i]);\n }\n pw.close();\n }\n private static void dfs(int v) {\n used[v] = true;\n for (int to : ages[v]) {\n if (to==p[v] || used[to])\n continue;\n p[to] = v;\n if (f[to]==2) {\n int cur = to;\n while (cur != 0 && !assigned[cur]) {\n assigned[cur] = true;\n ans[cur] = 1;\n cur = p[cur];\n }\n }\n dfs(to);\n }\n }\n private static int nextInt() throws IOException{\n return Integer.parseInt(next());\n }\n \n private static String next() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(in.readLine());\n }\n return st.nextToken();\n }\n}\n", "lang": "Java 6", "bug_code_uid": "56aaa28aab52dd3007e6521ae9e569fa", "src_uid": "87d869a0fd4a510c5e7e310886b86a57", "apr_id": "982fd8260762b2378f74663d23fc9e81", "difficulty": 1700, "tags": ["graphs"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9985096870342772, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "import java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Scanner;\nimport java.util.Stack;\n\n\npublic class CF_164D {\n\n\tpublic static void main(String[] args) {\n\t\tnew CF_164D().solve();\n\t}\n\t\n\tprivate void solve() {\n\t\tScanner in = new Scanner(System.in);\n\t\tint numNodes = in.nextInt();\n\t\tint numEdges = in.nextInt();\n\t\t\n\t\tboolean[] rfs = new boolean[numNodes];\n\t\tboolean[] rfe = new boolean[numNodes];\n\t\tint[] type = new int[numNodes];\n\t\t\n\t\tHashMap> fwdEdges = new HashMap>();\n\t\tHashMap> revEdges = new HashMap>();\n\n\t\tStack startNodes = new Stack();\n\t\tStack endNodes = new Stack();\n\t\t\n\t\t// read nodes\n\t\tfor(int i = 0; i < numNodes; i++) {\n\t\t\ttype[i] = in.nextInt();\n\t\t\tfwdEdges.put(i, new ArrayList());\n\t\t\trevEdges.put(i, new ArrayList());\n\n\t\t\tif(type[i] == 1) {\n\t\t\t\tstartNodes.push(i);\n\t\t\t} else if (type[i] == 2) {\n\t\t\t\tendNodes.push(i);\n\t\t\t}\n\t\t}\n\t\t\n\t\t// read edges\n\t\tfor(int i = 0; i < numEdges; i++) {\n\t\t\tint a = in.nextInt() - 1;\n\t\t\tint b = in.nextInt() - 1;\n\t\t\tfwdEdges.get(a).add(b);\n\t\t\trevEdges.get(b).add(a);\n\t\t}\n\t\t\n\t\t// find all nodes reachable from start nodes without visiting an end node\n\t\t// (traverse forward edges)\n\t\twhile(!startNodes.empty()) {\n\t\t\tint node = startNodes.pop();\n\t\t\tif(rfs[node]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t\trfs[node] = true;\n\t\t\tif(type[node] == 2) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfor(int next : fwdEdges.get(node)) {\n\t\t\t\tstartNodes.push(next);\n\t\t\t}\n\t\t}\n\t\t\n\t\t// find all nodes reachable from end nodes without visiting a start node\n\t\t// (traverse reverse edges)\n\t\twhile(!endNodes.empty()) {\n\t\t\tint node = endNodes.pop();\n\t\t\tif(rfe[node]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t\trfe[node] = true;\n\t\t\tif(type[node] == 1) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfor(int next : revEdges.get(node)) {\n\t\t\t\tendNodes.push(next);\n\t\t\t}\n\t\t}\t\t\n\t\t\n\t\tfor(int i = 0; i < numNodes; i++) {\n\t\t\tSystem.out.println(rfs[i] && rfe[i] ? \"1\" : \"0\");\n\t\t}\n\t}\n}\n", "lang": "Java 6", "bug_code_uid": "a5e0338b9d2f2c7be27897170e20ced1", "src_uid": "87d869a0fd4a510c5e7e310886b86a57", "apr_id": "8701f69cb7f62dd9aadb8c209b1ca40e", "difficulty": 1700, "tags": ["graphs"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.5013477088948787, "equal_cnt": 14, "replace_cnt": 11, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 14, "bug_source_code": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Code624B {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\t\n\t\tint n = scanner.nextInt();\n\t\tint[] a = new int[n];\n\t\tboolean[] f = new boolean[(int) (Math.pow(10, 9) + 1)];\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = scanner.nextInt();\n\t\t\t\n\t\t\tif(f[a[i]]) {\n\t\t\t\tfor(int j = a[i] - 1; j >= 0; j--) {\n\t\t\t\t\tif(!f[j]) {\n\t\t\t\t\t\ta[i] = j;\n\t\t\t\t\t\tf[j] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else\n\t\t\t\tf[a[i]] = true;\n\t\t}\n\t\t\n\t\tArrays.sort(a);\n\t\t\n\t\tlong count = 0;\n\t\t\n\t\tfor (int i : a) {\n\t\t\tcount += i;\n\t\t}\n\t\t\n\t\tSystem.out.println(count);\n\t\t\n\t\tscanner.close();\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "6f63d79c9ebf4d1ca61560c8ff7bce8f", "src_uid": "3c4b2d1c9440515bc3002eddd2b89f6f", "apr_id": "934c760859387b33d60aa76a94b5bef9", "difficulty": 1100, "tags": ["greedy", "sortings"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7229161356105022, "equal_cnt": 53, "replace_cnt": 9, "delete_cnt": 3, "insert_cnt": 41, "fix_ops_cnt": 53, "bug_source_code": "import java.util.*;\n \n// import javax.swing.text.DefaultStyledDocument.ElementSpec;\n \nimport java.io.*;\n \npublic class C{\n static int MOD = 1000000007;\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n PrintWriter out = new PrintWriter(System.out);\n int n = sc.nextInt();\n int x = sc.nextInt();\n int pos = sc.nextInt();\n int smaller = x-1;\n int larger = n-x;\n int left = 0;\n int right = n;\n long ans = 1;\n int noOfElementLeft = n-1;\n boolean zero = false;\n while(left=pos){\n if(larger==0){\n zero=true;\n break;\n }\n right = mid;\n ans = (ans*larger)%MOD;\n // ans = ans%MOD;\n larger--;\n noOfElementLeft--;\n }\n else{\n if(smaller==0){\n zero=true;\n break;\n }\n left = mid+1;\n ans = (ans*smaller)%MOD;\n smaller--;\n noOfElementLeft--;\n }\n \n \n }\n \n if(zero)out.println(0);\n else{\n out.println(ans);\n }\n \n out.close();\n sc.close();\n \n }\n public static long fact (int no){\n long ans = 1;\n while(no>0){\n ans = (ans*no)%MOD;\n no--;\n }\n return ans;\n }\n}", "lang": "Java 11", "bug_code_uid": "5cb884126d68bccd86dac7a8344c9ced", "src_uid": "24e2f10463f440affccc2755f4462d8a", "apr_id": "18f8600d4e103f2e690fe6b1d2adb278", "difficulty": 1500, "tags": ["combinatorics", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9808718861209964, "equal_cnt": 10, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 9, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class Solution2 {\n public static void main(String[] args) throws IOException {\n MyScanner.init(System.in);\n String in = MyScanner.nextLine();\n int row = Integer.parseInt(String.valueOf(in.substring(0, in.length() - 1)));\n \n int count = 0;\n int blocks = (row-1)/4;\n count += blocks*16;\n int num = row%4;\n count += getServeTime(num);\n char c = in.charAt(in.length()-1);\n int seat = getSeat(c);\n count += seat;\n System.out.println(count);\n }\n\n private static int getServeTime(int num) {\n if(num %2 == 1){\n return 0;\n } else {\n return 7;\n }\n }\n\n private static int getSeat(char c) {\n if (c == 'f') {\n return 1;\n } else if (c == 'e') {\n return 2;\n } else if (c == 'd') {\n return 3;\n } else if (c == 'a') {\n return 4;\n } else if (c == 'b') {\n return 5;\n } else {\n return 6;\n }\n }\n\n static class MyScanner {\n static BufferedReader reader;\n static StringTokenizer tokenizer;\n\n static void init(InputStream input) {\n reader = new BufferedReader(new InputStreamReader(input));\n tokenizer = new StringTokenizer(\"\");\n }\n\n public static String next() throws IOException {\n while (!tokenizer.hasMoreTokens()) {\n // TODO add check for eof if necessary\n tokenizer = new StringTokenizer(reader.readLine());\n }\n return tokenizer.nextToken();\n }\n\n static String nextLine() throws IOException {\n return reader.readLine();\n }\n\n public static int nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n\n public static double nextDouble() throws IOException {\n return Double.parseDouble(next());\n }\n\n public static long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "283e6ebdb21a636967cd7abea6a68f60", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "apr_id": "b92a9440f3b154f5eaca570deee3eb10", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9019073569482289, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*;\n\npublic class p735c{\n\n\tpublic static void main(String args[]){\n\tScanner in=new Scanner(System.in);\n\tint fib[]=new int[100000000];\n\tfib[0]=1;fib[1]=1;\n\tlong n=in.nextLong();\n\tlong i,m=n-1;\n\tfor(i=0;;)\n\t{\n\t\tif(i>=2)\n\t\tfib[(int)i]=fib[(int)i-1]+fib[(int)i-2];\n\t\tm=m-fib[(int)i];\n\t\tif(m>=0)\n\t\t\ti++;\n\t\telse break;\n\t}\n\tSystem.out.println(i);\n}\n\n\n}\n", "lang": "Java 8", "bug_code_uid": "2fd347046991df2689e46d24ae83dff8", "src_uid": "3d3432b4f7c6a3b901161fa24b415b14", "apr_id": "b1e78beacad6bfd84448c331a2abdc91", "difficulty": 1600, "tags": ["math", "combinatorics", "greedy", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9982332155477032, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*;\nimport java.lang.reflect.Array;\nimport java.util.*;\nimport java.text.*;\nimport java.math.*;\nimport java.util.regex.*;\n\npublic class PC {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n long n = scanner.nextLong();\n long[] dp = new long[50000000];\n dp[0] = 0;\n dp[1] = 1;\n int i = 1;\n while (true){\n dp[i+1] = dp[i] + dp[i-1] + 1;\n if(dp[i+1] > n-1) break;\n i++;\n }\n System.out.println(i);\n\n\n\n\n\n\n\n }\n\n\n\n\n\n}", "lang": "Java 8", "bug_code_uid": "d99f67e46318e5876dc5a2dc6ab0228c", "src_uid": "3d3432b4f7c6a3b901161fa24b415b14", "apr_id": "d7a68357f8757f95ada3dc7d0ca3c8ca", "difficulty": 1600, "tags": ["math", "combinatorics", "greedy", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9881575323602313, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\nimport java.io.IOException;\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n TaskC solver = new TaskC();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class TaskC {\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n long n = in.ni();\n long[] dp = new long[100000];\n dp[0] = 1;\n dp[1] = 2;\n for (int i = 1; ; ++i) {\n dp[i + 1] = dp[i] + dp[i - 1];\n if (dp[i + 1] > n) {\n out.println(i);\n return;\n }\n }\n }\n\n }\n\n static class InputReader {\n BufferedReader br;\n StringTokenizer st;\n\n public InputReader(InputStream inputStream) {\n br = new BufferedReader(new InputStreamReader(inputStream));\n }\n\n public String n() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException();\n }\n }\n return st.nextToken();\n }\n\n public int ni() {\n return Integer.parseInt(n());\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "9e7dd3caa326484ce9d837ba8560d8e0", "src_uid": "3d3432b4f7c6a3b901161fa24b415b14", "apr_id": "1eee34e7bb36c3c49d60c0a2574bfe34", "difficulty": 1600, "tags": ["math", "combinatorics", "greedy", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9974180734856007, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.*;\npublic class BOOL {\nprivate static FastReader in =new FastReader();\n static String S,Sc;\n static int n,m=1,l=0;\n static long z=1,x,c;\n public static void main(String[] args) {\n x=in.nextLong();\n ArrayList A=new ArrayList();\n A.add(2);\n A.add(3);\n for(int i=2;A.get(A.size()-1)<=x;i++){\n A.add(A.get(i-2)+A.get(i-1));\n \n }\n for(int i=0;;i++){\n if(A.get(i)<=x){c++;}\n else \n break;\n }\n System.out.println(c);\n }\n\n\n\n\n\n\n\n\n\n\n\nstatic void shuffle(int[] a) {\n\t\tRandom r = new Random();\n\t\tfor(int i = a.length - 1; i > 0; --i) {\n\t\t\tint si = r.nextInt(i);\n\t\t\tint t = a[si];\n\t\t\ta[si] = a[i];\n\t\t\ta[i] = t;\n\t\t}\n\t}\n\t\n\tstatic int lower_bound(int[] a, int n, int k) {\n\t\tint s = 0;\n\t\tint e = n;\n\t\tint m;\n\t\twhile (e - s > 0) {\n\t\t\tm = (s + e) / 2;\n\t\t\tif (a[m] < k)\n\t\t\t\ts = m + 1;\n\t\t\telse\n\t\t\t\te = m;\n\t\t}\n\t\treturn e;\n\t}\n\tstatic int lower_bound(long[] a, int n, long k) {\n\t\tint s = 0;\n\t\tint e = n;\n\t\tint m;\n\t\twhile (e - s > 0) {\n\t\t\tm = (s + e) / 2;\n\t\t\tif (a[m] < k)\n\t\t\t\ts = m + 1;\n\t\t\telse\n\t\t\t\te = m;\n\t\t}\n\t\treturn e;\n\t}\n\t\n\tstatic int gcd(int a, int b) {\n\t\treturn b == 0 ? a : gcd(b, a % b);\n\t}\n\tstatic long gcd(long a, long b) {\n\t\treturn b == 0 ? a : gcd(b, a % b);\n\t}\n\n\n\n\n}\nclass FastReader\n {\n BufferedReader br;\n StringTokenizer st;\n \n public FastReader()\n {\n br = new BufferedReader(new\n InputStreamReader(System.in));\n }\n \n String next()\n {\n while (st == null || !st.hasMoreElements())\n {\n try\n {\n st = new StringTokenizer(br.readLine());\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n \n int nextInt()\n {\n return Integer.parseInt(next());\n }\n \n long nextLong()\n {\n return Long.parseLong(next());\n }\n \n double nextDouble()\n {\n return Double.parseDouble(next());\n }\n \n String nextLine()\n {\n String str = \"\";\n try\n {\n str = br.readLine();\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n return str;\n }\n}\n", "lang": "Java 8", "bug_code_uid": "6846e2cb370e51266a91fca1745cceec", "src_uid": "3d3432b4f7c6a3b901161fa24b415b14", "apr_id": "ba2fab920e9bb5793c9d6f1435958bb2", "difficulty": 1600, "tags": ["math", "combinatorics", "greedy", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9999062880704713, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\t\npublic\t class template\n\t{\n\t\tprivate InputStream is;\n\t\tprivate PrintWriter pw;\n\t\tstatic char[][] ch;\n\t\tstatic int x1,x2,y1,y2,n,m,h,k;\n\t\tstatic long dist[][];\n\t\tstatic boolean boo[][];\n\t\t\n\t\tvoid soln()\n\t\t{\n\t\t\tis = System.in;\n\t\t\tpw = new PrintWriter(System.out);\n\t\t\tlong s = System.currentTimeMillis();\n\t\t\tsolve();\n\t\t\tpw.close();\n\t\t\tpw.flush();\n\t\t\t// tr(System.currentTimeMillis() - s + \"ms\");\n\t\t}\n\t\n\t\tpublic static void main(String[] args) throws Exception \n\t\t{\n\t\t\tnew Thread(null, new Runnable() \n\t\t\t{\n\t\t\t\tpublic void run() \n\t\t\t\t{\n\t\t\t\t\ttry\n\t\t\t\t\t{\n\t\t\t\t\t\t// new CODEFORCES().soln();\n\t\t\t\t\t} catch (Exception e)\n\t\t\t\t\t{\n\t\t\t\t\t\tSystem.out.println(e);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}, \"1\", 1 << 26).start();\n\t\t\tnew template().soln();\n\t\t}\n\t\n\t\tvoid solve() \n\t\t{\n\t\t\tlong l = ni(), r = ni(), x = ni(), y = ni();\n\t\t\tlong mul = x*y;\n\t\t\tint cnt = 0;\n\t\t\tif(x==y && x>=l && x<=r) {pw.println(1);return;}\n\t\t\tlong temp = Math.max(l,mul/r);\n\t\t\ttemp += (((temp%x)==0)?0:x-(temp%x))\n\t\t\tfor(long i = temp; i*i<=mul && i<= Math.min(r,mul/l);i+=x){\n\t\t\t\t//pw.println(i);\n\t\t\t\tif(mul%i==0 && gcd(i,mul/i)==x){\n\t\t\t\t\t//pw.println(i);\n\t\t\t\t\tif(mul/i != i) cnt+=2;\n\t\t\t\t\telse cnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tpw.println(cnt);\n\t\t\tpw.close();\t\n\t\t}\n\t\tlong gcd(long a, long b){\n\t\t\tif(b==0) return a;\n\t\t\treturn gcd(b,a%b);\n\t\t}\n\t\tvoid printArray(long[] arr) {\n\t\t\tfor(long i : arr) pw.print(i +\" \");\n\t\t\tpw.println();\n\t\t}\n\tstatic long min(long x, long y){\n\t\treturn (x{\n\t\tlong val;\n\t\tint x, y;\n\t\tPair(long v, int a, int b){\n\t\t\tval = v; x = a; y = b;\n\t\t}\n\t\tpublic int compareTo(Pair p){\n\t\t\treturn Long.compare(this.val,p.val);\n\t\t}\n\t}\n\tprivate static class Queue{\n\t\tint st = 0;\n\t\tint et = 0;\n\t\tPair[] arr;\n\t\tpublic Queue(int len) {\n\t\t\tarr = new Pair[len];\n\t\t}\n\t\tpublic boolean isEmpty() {\n\t\t\treturn st==et;\n\t\t}\n\t\tpublic void add(Pair x) {\n\t\t\tarr[et++] = x;\n\t\t}\n\t\tpublic Pair poll() {\n\t\t\treturn arr[st++];\n\t\t}\n\t\tpublic void clear() {\n\t\t\tst = et = 0;\n\t\t}\n\t}\n\t\t/*void bfs(int k) {\n\t\t\twhile(!q.isEmpty()) {\n\t\t\t\tint y = q.poll();\n\t\t\t\tfor(long i : amp[y]) {\n\t\t\t\t\tif(!b[i]) {\n\t\t\t\t\t\tD[i][k] = D[y][k]+1;\n\t\t\t\t\t\tq.add(i);\n\t\t\t\t\t\tb[i] = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t*/\n\t\t/*\n\t\tint dfs(int x) {\n\t\t\tb[x] = true;\n\t\t\t//start[x] = time++;\n\t\t\tint ans = 1;\n\t\t\tfor(int i : amp[x]) {\n\t\t\t\tif(!b[i]) {\n\t\t\t\t\tans += dfs(i);\n\t\t\t\t}\n\t\t\t}\n\t\t\t//end[x] = time;\n\t\t\tif(x!= 0 && ans%2==0 && (N-ans)%2==0) cost++;\n\t\t\t\t\n\t\t\treturn ans;\n\t\t}*/\n\t\t\n\t\t/*void buildGraph(int n) \n\t\t{\n\t\t\tfor (int i = 0; i < n; i++) \n\t\t\t{\n\t\t\t\tint x1 = ni() - 1, y1 = ni() - 1;\n\t\t\t\tamp[x1].add(y1);\n\t\t\t\tamp[y1].add(x1);\n\t\t\t}\n\t\t}*/\n\t\tpublic static int[] shuffle(int[] a, Random gen)\n\t\t{\n\t\t\tfor (int i = 0, n = a.length; i < n; i++)\n\t\t\t{\n\t\t\t\tint ind = gen.nextInt(n - i) + i;\n\t\t\t\tint d = a[i];\n\t\t\t\ta[i] = a[ind];\n\t\t\t\ta[ind] = d;\n\t\t\t}\n\t\t\treturn a;\n\t\t}\n\t\t// To Get Input\n\t\t// Some Buffer Methods\n\t\tprivate byte[] inbuf = new byte[1024];\n\t\tpublic int lenbuf = 0, ptrbuf = 0;\n\t\n\t\tprivate int readByte()\n\t\t{\n\t\t\tif (lenbuf == -1)\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tif (ptrbuf >= lenbuf) \n\t\t\t{\n\t\t\t\tptrbuf = 0;\n\t\t\t\ttry \n\t\t\t\t{\n\t\t\t\t\tlenbuf = is.read(inbuf);\n\t\t\t\t} catch (IOException e)\n\t\t\t\t{\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\tif (lenbuf <= 0)\n\t\t\t\t\treturn -1;\n\t\t\t}\n\t\t\treturn inbuf[ptrbuf++];\n\t\t}\n\t\n\t\tprivate boolean isSpaceChar(int c) \n\t\t{\n\t\t\treturn !(c >= 33 && c <= 126);\n\t\t}\n\t\n\t\tprivate int skip() \n\t\t{\n\t\t\tint b;\n\t\t\twhile ((b = readByte()) != -1 && isSpaceChar(b))\n\t\t\t\t;\n\t\t\treturn b;\n\t\t}\n\t\n\t\tprivate double nd() \n\t\t{\n\t\t\treturn Double.parseDouble(ns());\n\t\t}\n\t\n\t\tprivate char nc() \n\t\t{\n\t\t\treturn (char) skip();\n\t\t}\n\t\n\t\tprivate String ns()\n\t\t{\n\t\t\tint b = skip();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\twhile (!(isSpaceChar(b)))\n\t\t\t{ // when nextLine, (isSpaceChar(b) && b != '\n\t\t\t\t\t\t\t\t\t\t// ')\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}\n\t\n\t\tprivate char[] ns(int n) \n\t\t{\n\t\t\tchar[] buf = new char[n];\n\t\t\tint b = skip(), p = 0;\n\t\t\twhile (p < n && !(isSpaceChar(b)))\n\t\t\t{\n\t\t\t\tbuf[p++] = (char) b;\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn n == p ? buf : Arrays.copyOf(buf, p);\n\t\t}\n\t\n\t\tprivate char[][] nm(int n, int m)\n\t\t{\n\t\t\tchar[][] map = new char[n][];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tmap[i] = ns(m);\n\t\t\treturn map;\n\t\t}\n\t\n\t\tprivate int[] na(int n)\n\t\t{\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = ni();\n\t\t\treturn a;\n\t\t}\n\t\n\t\tprivate int ni() \n\t\t{\n\t\t\tint num = 0, b;\n\t\t\tboolean minus = false;\n\t\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t\t;\n\t\t\tif (b == '-')\n\t\t\t{\n\t\t\t\tminus = true;\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\n\t\t\twhile (true) \n\t\t\t{\n\t\t\t\tif (b >= '0' && b <= '9') \n\t\t\t\t{\n\t\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t\t} else \n\t\t\t\t{\n\t\t\t\t\treturn minus ? -num : num;\n\t\t\t\t}\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t}\n\t\n\t\tprivate long nl() \n\t\t{\n\t\t\tlong num = 0;\n\t\t\tint b;\n\t\t\tboolean minus = false;\n\t\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t\t;\n\t\t\tif (b == '-') \n\t\t\t{\n\t\t\t\tminus = true;\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\n\t\t\twhile (true) \n\t\t\t{\n\t\t\t\tif (b >= '0' && b <= '9') \n\t\t\t\t{\n\t\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t\t} else \n\t\t\t\t{\n\t\t\t\t\treturn minus ? -num : num;\n\t\t\t\t}\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t}\n\t\n\t\tprivate boolean oj = System.getProperty(\"ONLINE_JUDGE\") != null;\n\t\n\t\tprivate void tr(Object... o) \n\t\t{\n\t\t\tif (!oj)\n\t\t\t\tSystem.out.println(Arrays.deepToString(o));\n\t\t}\n\t}", "lang": "Java 8", "bug_code_uid": "422acda46beecc073937547ddeb260ee", "src_uid": "d37dde5841116352c9b37538631d0b15", "apr_id": "480600980ce1311e1b9a0c8a0b0eed2a", "difficulty": 1600, "tags": ["math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9585028478437754, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "import java.util.*;\npublic class prob1\n{\n\tpublic static int gcd(int a,int b){\n\t\twhile(b!=0){\n\t\t\tint p = a%b;\n\t\t\ta=b;\n\t\t\tb=p;\n\t\t}\n\t\treturn a;\n\t}\t\n\t\t\t\n\tpublic static void main (String[] args) throws java.lang.Exception\n\t{\n\t\tScanner scan = new Scanner(System.in);\n\t\tint l = scan.nextInt();\n\t\tint r = scan.nextInt();\n\t\tint x = scan.nextInt();\n\t\tint y = scan.nextInt();\n\t\tint v =0;\n\t\tif(y%x==0){\n\t\ty = y/x;\n\t\tint v =0;\n\t\tfor(int i=1;i<=Math.sqrt(y);i++){\n\t\t\tint p=y/i;\n\t\t\tif(y%i==0&&gcd(p,i)==1&&i>=l&&i<=r&&p>=l&&p<=r){\n\t\t\t\tif(p!=i){\n\t\t\t\t\tv=v+2;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tv++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t}\n\t\tSystem.out.println(v);\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "0b3fcaed1377f609ad99abd382536ce9", "src_uid": "d37dde5841116352c9b37538631d0b15", "apr_id": "47156b7f493df08ade7795f39af80b5d", "difficulty": 1600, "tags": ["math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.864963503649635, "equal_cnt": 18, "replace_cnt": 14, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 17, "bug_source_code": "import java.util.*;\nimport java.lang.*;\nimport java.io.*;\npublic class B489{\n\tpublic static void main(String[] args) {\n\t\tInputReader fi=new InputReader(System.in);\n\t\tPrintWriter pr=new PrintWriter(System.out);\n\t\tlong l=fi.nextLong();\n\t\tlong r=fi.nextLong();\n\t\tlong x=fi.nextLong();\n\t\tlong y=fi.nextLong();\n\t\tlong num=x*y;\n\t\tint cnt=0;\n\t\tfor (int i=1; i<=Math.sqrt(num); i=i+x)\n\t\t{\n\t\t\tif (num%i==0)\n\t\t\t{\n\t\t\t\tif (num/i == i)\n\t\t\t\t{\n\t\t\t\t\tlong m=i;\n\t\t\t\t\tif(l<=m&&m<=r&&m==x&&(m*m)==y){\n\t\t\t\t\t\t//pr.printf(\"%d %d\\n\",m,m);\n\t\t\t\t\t\tcnt++;\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\tlong m=i;\n\t\t\t\t\tlong n=num/i;\n\t\t\t\t\tlong gcdvalue=0;\n\t\t\t\t\tif(m= snumChars) {\n\t\t\tcurChar = 0;\n\t\t\ttry {\n\t\t\t\tsnumChars = stream.read(buf);\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t\tif (snumChars <= 0)\n\t\t\t\treturn -1;\n\t\t}\n\t\treturn buf[curChar++];\n\t}\n\n\tpublic int nextInt() {\n\t\tint c = snext();\n\t\twhile (isSpaceChar(c))\n\t\t\tc = snext();\n\t\tint sgn = 1;\n\t\tif (c == '-') {\n\t\t\tsgn = -1;\n\t\t\tc = snext();\n\t\t}\n\t\tint res = 0;\n\t\tdo {\n\t\t\tif (c < '0' || c > '9')\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tres *= 10;\n\t\t\tres += c - '0';\n\t\t\tc = snext();\n\t\t} while (!isSpaceChar(c));\n\t\treturn res * sgn;\n\t}\n\n\tpublic long nextLong() {\n\t\tint c = snext();\n\t\twhile (isSpaceChar(c))\n\t\t\tc = snext();\n\t\tint sgn = 1;\n\t\tif (c == '-') {\n\t\t\tsgn = -1;\n\t\t\tc = snext();\n\t\t}\n\t\tlong res = 0;\n\t\tdo {\n\t\t\tif (c < '0' || c > '9')\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tres *= 10;\n\t\t\tres += c - '0';\n\t\t\tc = snext();\n\t\t} while (!isSpaceChar(c));\n\t\treturn res * sgn;\n\t}\n\n\tpublic int[] nextIntArray(int n) {\n\t\tint a[] = new int[n+1];\n\t\tfor (int i = 1; i <= n; i++)\n\t\t\ta[i] = nextInt();\n\t\treturn a;\n\t}\n\n\tpublic String readString() {\n\t\tint c = snext();\n\t\twhile (isSpaceChar(c))\n\t\t\tc = snext();\n\t\tStringBuilder res = new StringBuilder();\n\t\tdo {\n\t\t\tres.appendCodePoint(c);\n\t\t\tc = snext();\n\t\t} while (!isSpaceChar(c));\n\t\treturn res.toString();\n\t}\n\n\tpublic boolean isSpaceChar(int c) {\n\t\tif (filter != null)\n\t\t\treturn filter.isSpaceChar(c);\n\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t}\n\n\tpublic interface SpaceCharFilter {\n\t\tpublic boolean isSpaceChar(int ch);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "0f177a90f19d93a2cea2fc42989b87f1", "src_uid": "d37dde5841116352c9b37538631d0b15", "apr_id": "0f2e541ed2d7b23172fba8473ed1e75d", "difficulty": 1600, "tags": ["math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9503437738731857, "equal_cnt": 8, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "import java.util.*;\nimport java.io.*;\nimport java.lang.*;\nimport java.math.*;\npublic class C {\n public static int mod = 1000000007;\n public static void main(String[] args) throws Exception {\n BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));\n // int n = Integer.parseInt(bf.readLine());\n StringTokenizer st = new StringTokenizer(bf.readLine());\n // int[] a = new int[n]; for(int i=0; i=n) k = n-1;\n long[] g = new long[n+1];\n for(int i=1; i<=k; i++) g[i] = 1;\n long sum = k;\n for(int i=k+1; i<=n; i++) {\n g[i] = sum * inv(i) % mod;\n sum += g[i];\n sum -= g[i-k];\n sum += mod;\n sum %= mod;\n }\n long[] nm = new long[n+1];\n nm[0] = 1;\n long[] fact = new long[n+1];\n fact[0] = 1;\n for(int i=1; i<=n; i++) {\n fact[i] = fact[i-1] * i % mod;\n }\n for(int i=1; i<=n; i++) {\n nm[i] = g[i] * fact[i] % mod;\n }\n //out.println(Arrays.toString(nm));\n long ans = 0;\n for(int i=0; i= n - 1) {\n\t\t\tprinter.println(0);\n\t\t\tprinter.close();\n\t\t\treturn;\n\t\t}\n\n\t\tfact = new long[n + 1];\n\t\tfact[0] = 1;\n\t\tfor (int i = 1; i <= n; i++) {\n\t\t\tfact[i] = i * fact[i - 1] % MOD;\n\t\t}\n\n\t\tiFact = new long[n + 1];\n\n\t\tiFact[n] = pow(fact[n], MOD - 2);\n\t\tfor (int i = n - 1; i >= 1; i--) {\n\t\t\tiFact[i] = (i + 1) * iFact[i + 1] % MOD;\n\t\t}\n\n\t\tlong[] f = new long[n + 1];\n\t\tlong[] preG = new long[n + 1];\n\n\t\tfor (int i = k + 1; i <= n; i++) {\n\t\t\tf[i] = ((i - k - 1) * fact[i - 2]\n\t\t\t\t\t+ fact[i - 2] * (preG[i - 1] - (i - k - 1 >= 0 ? preG[i - k - 1] : 0) + MOD)) % MOD;\n\t\t\tpreG[i] = (preG[i - 1] + f[i] * iFact[i - 1]) % MOD;\n\t\t}\n\n\t\tlong ans = 0;\n\t\t// i is position where we put the greatest element\n\t\tfor (int i = 1; i <= n; i++) {\n\t\t\tans = (ans + f[i] * fact[n - 1] * iFact[i - 1]) % MOD;\n\t\t}\n\t\tprinter.println(ans);\n\t\tprinter.close();\n\t}\n\n\tstatic long pow(long base, long exp) {\n\t\tbase %= MOD;\n\t\tlong ans = 1;\n\t\twhile (exp > 0) {\n\t\t\tif ((exp & 1) == 1) {\n\t\t\t\tans = ans * base % MOD;\n\t\t\t}\n\t\t\tbase = base * base % MOD;\n\t\t\texp >>= 1;\n\t\t}\n\t\treturn ans;\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "942ad9200dc7e4e3035cbe33b85d1d61", "src_uid": "0644605611a2cd10ab3a9f12f18d7ae4", "apr_id": "86c59d307fb17fc0574cf7a2b5f617a0", "difficulty": 2400, "tags": ["dp", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9945934485317502, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 5, "bug_source_code": "import java.math.*;\nimport java.util.*;\nimport java.io.*;\n\npublic class Main{\n\n void solve() {\n int n=ni(),k=ni();\n pre(n);\n long pref[]=new long[n+1];\n long dp[]=new long[n+1];\n for(int i=k+1;i<=n;i++){\n dp[i]=i-k-1;\n dp[i]=add(dp[i],sub(pref[i-1],pref[i-k-1],M),M);\n dp[i]=mul(dp[i],fact[i-2],M);\n\n pref[i]=add(pref[i-1],mul(dp[i],inv[i-1],M),M);\n }\n long ans=0;\n for(int i=1;i<=n;i++){\n ans=add(ans,mul(dp[i],inv[i-1],M),M);\n }\n ans=mul(ans,fact[n-1],M);\n pw.println(ans);\n\n\n }\n long fact[];\n long inv[];\n long add(long x,long y,long M){\n x+=y;\n if(x>=M) x-=M;\n return x;\n }\n long sub(long x,long y,long M){\n x-=M;\n if(x<0) x+=M;\n return x;\n }\n\n long ncr(int n,int r){\n long ans=fact[n];\n ans=mul(ans,inv[n-r],M);\n ans=mul(ans,inv[r],M);\n return ans;\n }\n void pre(int n){\n fact=new long[n+1];\n inv=new long[n+1];\n fact[0]=1;\n for(int i=1;i<=n;i++) fact[i]=(fact[i-1]*i)%M;\n inv[n]=modInverse(fact[n],M);\n for(int i=n-1;i>=0;i--) inv[i]=(inv[i+1]*(i+1))%M;\n }\n long mul(long a, long b,long M)\n {\n return (a*1L*b)%M;\n }\n long modpow(long a, long b,long M)\n {\n long r=1;\n while(b>0)\n {\n if((b&1)>0) r=mul(r,a,M);\n a=mul(a,a,M);\n b>>=1;\n }\n return r;\n }\n\n long modInverse(long A, long M)\n {\n\n return modpow(A,M-2,M);\n }\n\n long M=(long)1e9+7;\n InputStream is;\n PrintWriter pw;\n String INPUT = \"\";\n void run() throws Exception {\n is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n pw = new PrintWriter(System.out);\n long s = System.currentTimeMillis();\n solve();\n pw.flush();\n if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+\"ms\");\n }\n\n public static void main(String[] args) throws Exception { new Main().run(); }\n\n private byte[] inbuf = new byte[1024];\n public int lenbuf = 0, ptrbuf = 0;\n\n private int readByte() {\n if(lenbuf == -1)throw new InputMismatchException();\n if(ptrbuf >= lenbuf){\n ptrbuf = 0;\n try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }\n if(lenbuf <= 0)return -1;\n }\n return inbuf[ptrbuf++];\n }\n\n private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }\n private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }\n\n private double nd() { return Double.parseDouble(ns()); }\n private char nc() { return (char)skip(); }\n\n private String ns() {\n int b = skip();\n StringBuilder sb = new StringBuilder();\n while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n private char[] ns(int n) {\n char[] buf = new char[n];\n int b = skip(), p = 0;\n while(p < n && !(isSpaceChar(b))){\n buf[p++] = (char)b;\n b = readByte();\n }\n return n == p ? buf : Arrays.copyOf(buf, p);\n }\n\n private char[][] nm(int n, int m) {\n char[][] map = new char[n][];\n for(int i = 0;i < n;i++)map[i] = ns(m);\n return map;\n }\n\n private int[] na(int n) {\n int[] a = new int[n];\n for(int i = 0;i < n;i++)a[i] = ni();\n return a;\n }\n\n private int ni() {\n int num = 0, b;\n boolean minus = false;\n while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));\n if(b == '-'){\n minus = true;\n b = readByte();\n }\n\n while(true){\n if(b >= '0' && b <= '9'){\n num = num * 10 + (b - '0');\n }else{\n return minus ? -num : num;\n }\n b = readByte();\n }\n }\n\n private long nl() {\n long num = 0;\n int b;\n boolean minus = false;\n while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));\n if(b == '-'){\n minus = true;\n b = readByte();\n }\n\n while(true){\n if(b >= '0' && b <= '9'){\n num = num * 10 + (b - '0');\n }else{\n return minus ? -num : num;\n }\n b = readByte();\n }\n }\n\n private void tr(Object... o) { if(INPUT.length() > 0)System.out.println(Arrays.deepToString(o)); }\n}", "lang": "Java 8", "bug_code_uid": "1f76a5d4c23fad840e871c840fde51ba", "src_uid": "0644605611a2cd10ab3a9f12f18d7ae4", "apr_id": "9cec3158c497800190b15be0c4943eee", "difficulty": 2400, "tags": ["dp", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8583830710797613, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "/*\n * To change this license header, choose License Headers in Project Properties.\n * To change this template file, choose Tools | Templates\n * and open the template in the editor.\n */\npackage codeforces;\nimport java.util.*;\n/**\n *\n * @author elbrh\n */\npublic class B344 {\n\n /**\n * @param args the command line arguments\n */\n public static void main(String[] args) {\n // TODO code application logic here\n Scanner sc = new Scanner(System.in);\n StringBuilder out = new StringBuilder();\n int a,b,c ;\n a = sc.nextInt();\n b= sc.nextInt();\n c = sc.nextInt();\n int res = a+b+c ;\n if(res%2 == 0){\n res /= 2 ;\n int x = res - c ;\n int z = res - b ;\n int y = res - a ;\n if(x >= 0 && y >= 0 && z >= 0){\n System.out.println(x +\" \"+y+\" \"+z);\n }\n else\n System.out.println(\"Impossible\");\n \n }\n }\n \n}\n", "lang": "Java 8", "bug_code_uid": "4c2ca8ed1f4467a4a97aa0aabc0f3e81", "src_uid": "b3b986fddc3770fed64b878fa42ab1bc", "apr_id": "f4e1a515c2c4a2bda88ca6f598d371aa", "difficulty": 1200, "tags": ["graphs", "math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.5710843373493976, "equal_cnt": 21, "replace_cnt": 15, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 20, "bug_source_code": "import java.io.*;\nimport java.util.StringTokenizer;\n\npublic class Main {\n public void solve() {\n int a = ni(), b = ni(), c = ni(), l = ni();\n int x, y ,z;\n if ((a > b) && (a > c)) {\n x = a;\n if (b > c) {\n y = b;\n z = c;\n } else {\n y = c;\n z = b;\n }\n } else if (b > c) {\n x = b;\n if (a > c) {\n y = a;\n z = c;\n } else {\n y = c;\n z = a;\n }\n } else {\n x = c;\n if (b > a) {\n y = b;\n z = a;\n } else {\n y = a;\n z = b;\n }\n }\n\n long ans = 0;\n for (int i = x; l - (i - x) - (Math.max(0, i - (y + z) + 1)) >= 0; i++) {\n for (int j = y; l - (i - x) - (j - y) - (Math.max(0, j - (i + z) + 1)) >= 0; j++) {\n// System.out.println(i + \" \" + j + \" \" + (l - (i - x) - (j - y)));\n int max = (i + j - 1);\n int min = Math.abs(i - j) + 1;\n// System.out.println(\"min: \" + min + \" max: \" + max);\n int steps = l - (i - x) - (j - y) - Math.max(0, min - z);\n min = Math.max(min, z);\n max = Math.min(max, min + steps);\n ans += Math.max(0, max - min + 1);\n// System.out.println(Math.max(0, max - min + 1));\n }\n }\n write(ans + \"\\n\");\n }\n\n\n\n\n\n public static void main(String[] args){\n Main m = new Main();\n m.solve();\n try {\n m.writer.close();\n } catch (IOException e) {};\n }\n BufferedReader reader;\n BufferedWriter writer;\n StringTokenizer tokenizer;\n public Main() {\n reader = new BufferedReader(new InputStreamReader(System.in));\n writer = new BufferedWriter(new OutputStreamWriter(System.out));\n }\n int ni() {\n return Integer.parseInt(n());\n }\n String n() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {}\n }\n return tokenizer.nextToken();\n }\n void write(String s) {\n try {\n writer.write(s);\n } catch(IOException e) {};\n }\n}", "lang": "Java 8", "bug_code_uid": "b830e2859055547a5417eedac0c9dfc8", "src_uid": "185ff90a8b0ae0e2b75605f772589410", "apr_id": "e4d06d6751a548548b75c18b05a8abc3", "difficulty": 2100, "tags": ["math", "combinatorics", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9988505747126437, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.math.BigDecimal;\nimport java.math.BigInteger;\nimport java.util.PriorityQueue;\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static long solve(long a,long b,long c,long lest) {\n\t\tif(a aa;\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\tint k = in.nextInt();\n\t\taa = new ArrayList(2500);\n\t\tdfs(7);\n\t\tdfs(4);\n\t\tint nn = n;\n\t\tif (n < 13 && k > fact(n))\n\t\t\tSystem.out.println(-1);\n\t\tint l = Math.min(13, n);\n\t\tint[] a = new int[l];\n\t\tboolean[] v = new boolean[l];\n\t\tfor (int i = 0; i < a.length; i++)\n\t\t\ta[i] = n - i;\n\t\tArrays.sort(a);\n\t\tint[] ans = new int[a.length];\n\t\tlong g;\n\t\tlong kk = k;\n\t\tlong f;\n\t\tboolean d;\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\tg = kk / (f = fact(n - 1)) + 1;\n\t\t\tif (kk % f == 0)\n\t\t\t\tg--;\n\t\t\tint cnt = 0, j;\n\t\t\tfor (j = 0; j < a.length; j++) {\n\t\t\t\tif (!v[j])\n\t\t\t\t\tcnt++;\n\t\t\t\tif (cnt == g)\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tv[j] = true;\n\t\t\tans[i] = a[j];\n\t\t\td = false;\n\t\t\tif (kk >= f)\n\t\t\t\td = true;\n\t\t\tkk %= f;\n\t\t\tif (d && kk == 0)\n\t\t\t\tkk += f;\n\t\t\tn--;\n\t\t}\n\t\tint ret = 0;\n\t\tfor (int i = 0; i < ans.length; i++)\n\t\t\tif (aa.contains(ans[i]) && aa.contains(i + nn - l + 1))\n\t\t\t\tret++;\n\t\tSystem.out.println(ret);\n\t}\n\n\tpublic static long fact(long n) {\n\t\tif (n == 1 || n == 0)\n\t\t\treturn 1;\n\t\treturn n * fact(n - 1);\n\t}\n\n\tpublic static void dfs(long n) {\n\t\tif (n > 1000000000)\n\t\t\treturn;\n\t\taa.add((int) n);\n\t\tdfs(n * 10 + 4);\n\t\tdfs(n * 10 + 7);\n\t}\n}", "lang": "Java 6", "bug_code_uid": "ae967ddb71d0a683663eb55ecf372a8b", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "apr_id": "03f2e66d5950cacc3afbb888aee45c60", "difficulty": 1900, "tags": ["brute force", "combinatorics", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8498081249172952, "equal_cnt": 63, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 53, "fix_ops_cnt": 62, "bug_source_code": "\n\nimport javax.sound.sampled.Line;\nimport java.awt.Point;\nimport java.awt.geom.Line2D;\nimport java.awt.geom.Point2D;\nimport java.io.*;\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\nimport static java.math.BigInteger.*;\n\nimport java.math.MathContext;\nimport java.util.*;\npublic class C{\n\n\n ArrayListall;\n void solve()throws Exception\n {\n\n all=new ArrayList();\n get(0,(long)7777777777L);\n Collections.sort(all);\n ArrayLista=new ArrayList();\n int n=nextInt();\n long k=nextInt();\n long z=1;\n for(int i=1;i<=n;i++)\n {\n z*=i;\n if(z>=k)\n break;\n }\n if(z0)\n {\n a.add(n);\n n--;\n }\n Collections.reverse(a);\n int res=0;\n for(Long x: all)\n if(x<=n)\n res++;\n long[]fact=new long[a.size()];\n for(int i=0;ifact[a.size()-1-at])\n {\n k-=fact[a.size()-1-at];\n who++;\n }\n\n int ans=-1;\n for(int i=0;i=0 && all.indexOf((long)(i+1+n))>=0)\n res++;\n }\n System.out.println(res);\n\n\n\n }\n void get(long cur,long max)\n {\n if(cur>max)\n return;\n if(cur!=0)\n all.add(cur);\n get(10*cur+4,max);\n get(10*cur+7,max);\n\n }\n\n ////////////\n BufferedReader reader;\n PrintWriter writer;\n StringTokenizer stk;\n void run()throws Exception\n {\n reader=new BufferedReader(new InputStreamReader(System.in));\n stk=null;\n writer=new PrintWriter(new PrintWriter(System.out));\n solve();\n reader.close();\n writer.close();\n }\n int nextInt()throws Exception\n {\n return Integer.parseInt(nextToken());\n }\n\n long nextLong()throws Exception\n {\n return Long.parseLong(nextToken());\n\n }\n double nextDouble()throws Exception\n {\n return Double.parseDouble(nextToken());\n\n\n }\n\n String nextString()throws Exception\n {\n return nextToken();\n }\n String nextLine()throws Exception\n {\n return reader.readLine();\n }\n String nextToken()throws Exception\n {\n if(stk==null || !stk.hasMoreTokens())\n {\n stk=new StringTokenizer(nextLine());\n return nextToken();\n\n }\n return stk.nextToken();\n }\n\n public static void main(String[]args) throws Exception\n {\n new C().run();\n }\n\n\n\n}", "lang": "Java 6", "bug_code_uid": "8265db3635174191580e40df2036c8fb", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "apr_id": "0726111f6b507b2ae521f75a24962d9e", "difficulty": 1900, "tags": ["brute force", "combinatorics", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7964779874213836, "equal_cnt": 14, "replace_cnt": 12, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 13, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.LinkedList;\nimport java.util.StringTokenizer;\nimport java.util.TreeSet;\n\n\npublic class LuckyPermutation {\n\t\n\tstatic class Scanner{\n\t\tBufferedReader br=null;\n\t\tStringTokenizer tk=null;\n\t\tpublic Scanner(){\n\t\t\tbr=new BufferedReader(new InputStreamReader(System.in));\n\t\t}\n\t\tpublic String next() throws IOException{\n\t\t\twhile(tk==null || !tk.hasMoreTokens())\n\t\t\t\ttk=new StringTokenizer(br.readLine());\n\t\t\treturn tk.nextToken();\n\t\t}\n\t\tpublic int nextInt() throws NumberFormatException, IOException{\n\t\t\treturn Integer.valueOf(next());\n\t\t}\n\t}\n\t\n\tstatic long[] fact = new long[14];\n\t\n\tstatic void init(){\n\t\tfact[0] = 1;\n\t\tfor(int i = 1; i <= 13; i++)\n\t\t\tfact[i] = fact[i - 1]*i;\n\t\treturn;\n\t}\n\t\n\tstatic boolean islucky(int num){\n\t\tchar[] n = (num+\"\").toCharArray();\n\t\tfor(int i = 0; i < n.length; i++)\n\t\t\tif (n[i]!='4' && n[i]!='7')\n\t\t\t\treturn false;\n\t\treturn true;\n\t}\n\t\n\tpublic static void main(String args[]) throws NumberFormatException, IOException{\n\t\tScanner sc = new Scanner();\n\t\tinit();\n\t\tint N = sc.nextInt();\n\t\tint K = sc.nextInt();\n\t\tLinkedList ans = new LinkedList();\n\t\tif (N <= 13 && fact[N] < K){\n\t\t\tSystem.out.println(\"-1\");\n\t\t\treturn;\n\t\t}\n\t\tfor(int i = 1; i <= N - 13; i++)\n\t\t\tans.add(i);\n\t\tTreeSet current = new TreeSet();\n\t\tfor(int i = Math.max(1, N - 12); i <= N; i++)\n\t\t\tcurrent.add(i);\n\t\tint limit = current.size();\n\t\tfor(int i = 0; i < limit; i++){\n\t\t\tint index = 1;\n\t\t\tfor(int e: current){\n\t\t\t\tif (fact[current.size() - 1]*index >= K){\n\t\t\t\t\tK -= fact[current.size() - 1] * (index - 1);\n\t\t\t\t\tcurrent.remove(e);\n\t\t\t\t\tans.add(e);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t}\n\t\t}\n\t\tint index = 1;\n\t\tint amount = 0;\n\t\tfor(int e: ans){\n\t\t\tif (islucky(index) && islucky(e))\n\t\t\t\tamount++;\n\t\t\tindex++;\n\t\t}\n\t\tSystem.out.println(amount);\n\t}\n\n}\n", "lang": "Java 6", "bug_code_uid": "923a9a123a148c71cf6ad8dc9cddabaf", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "apr_id": "fa92e057ab6716452bbb810d6ebecc6d", "difficulty": 1900, "tags": ["brute force", "combinatorics", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9879759519038076, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.lang.reflect.Array;\nimport java.math.*;\npublic class lucksum {\n\tpublic static long go(long m)\n\t{\n\t\tlong res=0;\n\t\tQueue l=new LinkedList();\n\t\tl.add(new Long(0));\n\t\tdo{\n\t\t\tLong t=l.remove();\n\t\t\tif(t.compareTo(new Long(m))<=0)\n\t\t\t{\n\t\t\t\tres++;\n\t\t\t\tl.add(t*10+4);\n\t\t\t\tl.add(t*10+7);\n\t\t\t\t}\n\t\t\telse\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t}while(true);\n\t\t\n\t\treturn res-1;\n\t}\n\tpublic static boolean isluck(long m)\n\t{\t\n\t\tboolean res=true;\n\t\twhile(m!=0)\n\t\t{\n\t\t\tlong t=m%10;\n\t\t\tif((t!=4)&&(t!=7))\n\t\t\t\treturn false;\n\t\t\tm/=10;\n\t\t}\n\t\treturn res;\n\t\t\n\t}\n\tpublic static void main(String[] args)\n\t{\n\n\t\t//try{\n\t\t\tScanner s=new Scanner(System.in);\n\t\t\tlong n=s.nextLong();\n\t\t\tlong k=s.nextLong();\n\t\t\tlong []p=new long[21];\n\t\t\tArrays.fill(p,Long.MAX_VALUE);\n\t\t\tlong start=1;\n\t\t\tlong mul=2;\n\t\t\tp[0]=1;\n\t\t\twhile(start<=k)\n\t\t\t{\n\t\t\t\tp[(int)mul-1]=start;\n\t\t\t\tstart*=mul;\n\t\t\t\tmul++;\n\t\t\t}\n\t\t\tif((n<20)&&(p[(int)n] left=new LinkedList();\n\t\t\tfor(int i=index-1;i>=0;i--)\n\t\t\t\tleft.add(n-i);\n\t\t\t\n\t\t\twhile(index>0)\n\t\t\t{\n\t\t\t\tLong[] mm=(Long[])left.toArray(new Long[left.size()]);\n\t\t\t\t\n\t\t\t\tlong t=k/p[index-1];\n\t\t\t\tif(k==1)\n\t\t\t\t\tt=0;\n\t\t\t\tlong h=mm[(int)t];\n\t\t\t\tif(isluck(h)&&isluck(n-index+1))\n\t\t\t\t\tres++;\n\t\t\t\tleft.remove((int)t);\n\t\t\t\tk%=p[index-1];\n\t\t\t\tindex--;\n\n\t\t\t}\n\t\t\tSystem.out.println(res);\n\t\t\n\t//\t}catch (Exception e1){\n\t\t\t\n\t\t//}\n\n\t}\n}\n\n\n", "lang": "Java 6", "bug_code_uid": "2799576af1448f6f34d53f7549794ae9", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "apr_id": "21c9018a8d81d982bc90a0af852ed52c", "difficulty": 1900, "tags": ["brute force", "combinatorics", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9984326018808778, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class C {\n static int e;\n static long count;\n\n public static void construct(int l, String cur) {\n if (l == 0) {\n if (Integer.parseInt(cur) <= e) {\n count++;\n }\n return;\n }\n construct(l - 1, cur + \"4\");\n construct(l - 1, cur + \"7\");\n }\n\n public static long getLuckCount(int end) {\n int length = (\"\" + end).length();\n long res = 0;\n for (int i = 1; i < length; i++) {\n res += (1 << i);\n }\n e = end;\n count = 0;\n construct(length, \"\");\n res += count;\n return res;\n }\n\n public static boolean isLucky(int numb) {\n while (numb > 0) {\n int mod = numb % 10;\n if (mod != 4 && mod != 7)\n return false;\n numb /= 10;\n }\n return true;\n }\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int k = sc.nextInt();\n int idx = n;\n long cur = 1L;\n while (true) {\n if (cur >= k) {\n break;\n }\n idx--;\n if (idx < 1) {\n break;\n }\n cur *= (n - idx + 1);\n }\n cur /= (n - idx + 1);\n if (idx < 1) {\n System.out.println(-1);\n }\n ArrayList list = new ArrayList();\n for (int i = idx; i <= n; i++) {\n list.add(i);\n }\n int tmpIdx=idx;\n int[] res = new int[n - idx + 1];\n int curSto = 0;\n while (list.size()>0) {\n long req = (long) Math.ceil((k*1.0) / cur);\n //System.out.println(k+\" \"+cur);\n res[curSto] = list.get((int) (req - 1));\n \n list.remove((int)(req-1));\n //System.out.println(Arrays.toString(res)+\" \"+list.size());\n curSto++;\n k = (int) (k % cur);\n if(k==0){\n k=(int) cur;\n }\n tmpIdx++;\n\n //System.out.println(k+\" \"+cur+\" \"+tmpIdx);\n if(n-tmpIdx+1!=0)\n cur=cur/(n-tmpIdx+1);\n }\n int print = 0;\n for (int i = 0, j = idx; i < res.length; i++, j++) {\n if (isLucky(j) && isLucky(res[i]))\n print++;\n }\n if (idx > 0)\n print += getLuckCount(idx - 1);\n System.out.println(print);\n }\n}\n", "lang": "Java 6", "bug_code_uid": "a503b92bc700340f97fc75e0ebb5a639", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "apr_id": "37d928f31eb2980a7b955df89195de90", "difficulty": 1900, "tags": ["brute force", "combinatorics", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.868561778778497, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "import java.util.*;\nimport java.io.*;\n\npublic class Main {\n\tpublic static void main ( String args[] ) throws Exception {\n\t\t(new Task23()).solve();\n\t}\n}\n\nclass Task23\n{\n\tScanner in;\n\t\n\tint[] getPermutation ( int[] a, long k )\n\t{\n\t\tboolean seen[] = new boolean[a.length];\n\t\tint r[] = new int[a.length];\n\t\tArrays.fill ( r, -1 );\n\t\tfor ( int i = 0; i < a.length; ++i )\n\t\t{\n\t\t\tlong fact = 1;\n\t\t\tfor ( int j = 1; j < a.length-i; ++j )\n\t\t\t\tfact *= j;\n\t\t\tlong id = (k-1) / fact;\n\t\t\tk -= id*fact;\n\t\t\tfor ( int j = 0; j < a.length; ++j )\n\t\t\t\tif ( !seen[j] )\n\t\t\t\t{\n\t\t\t\t\tif ( id == 0 ) {\n\t\t\t\t\t\tr[i] = a[j];\n\t\t\t\t\t\tseen[j] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tid--;\n\t\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\t\n\tboolean isLucky ( int n ) {\n\t\tfor ( ; n > 0; n /= 10 )\n\t\t\tif ( n%10 != 4 && n%10 != 7 )\n\t\t\t\treturn false;\n\t\treturn true;\n\t}\n\t\n\tpublic void solve ( ) throws Exception\n\t{\n\t\tin = new Scanner ( System.in );\n\t\tint n = in.nextInt();\n\t\tlong k = in.nextLong();\n\t\t\n\t\tif ( n <= 15 )\n\t\t{\n\t\t\tlong fact = 1;\n\t\t\tfor ( int i = 1; i <= n; ++i )\n\t\t\t\tfact *= i;\n\t\t\tif ( k > fact )\n\t\t\t{\n\t\t\t\tprintln ( \"-1\\n\" );\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\tint last[] = new int[Math.min(15,n)];\n\t\tfor ( int i = 0; i < last.length; ++i )\n\t\t\tlast[i] = n-last.length+i+1;\n\t\t\n\t\tlast = getPermutation ( last, k );\n\t\tint a[] = new int[n];\n\t\tfor ( int i = 0; i < n; ++i )\n\t\t\tif ( i+last.length >= n )\n\t\t\t\ta[i] = last[i-(n-last.length)];\n\t\t\telse\n\t\t\t\ta[i] = i+1;\n\n\t\tint ans = 0;\n\t\tfor ( int i = 0; i < n; ++i )\n\t\t\tif ( isLucky(i+1) && isLucky(a[i]) )\n\t\t\t\tans++;\n\t\tprintln ( ans );\n\t}\n\t\n\tpublic static void println ( Object o ) { System.out.println ( o ); }\n\tpublic static void print ( Object o ) { System.out.print ( o ); }\n\tpublic static void println ( ) { System.out.println ( ); }\n}\n", "lang": "Java 6", "bug_code_uid": "a893366ac2780b57c4039fbaffafe49e", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "apr_id": "38c8857fa7e21e045ba2d4a976d7cd2b", "difficulty": 1900, "tags": ["brute force", "combinatorics", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9912948857453754, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "// 327A\nimport java.util.Scanner;\n\n/*\n*To get max zeroes count,treat 0 as -1 and 1 as +1\n*now we have to get max contiguous sequence of zeroes(+1) having max +ve sum\n*Then it can be easily solved by Kadane's algorithm of max contiguous sum\n*/\n//-->YouTube link for KADANE ALGO\thttps://youtu.be/86CQq3pKSUw\n\npublic class FlippingGame_KADANEalgo {\n\tpublic static void main(String[] args) {\n\t\tint[] a;\n\t\tint current_max=0,global_max=0;\n\t\tint i,rev,t_ones=0;\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\ta=new int[n];\n\t\tfor(i=0;i -1 and 0 ==> 1\n\t\t\tcurrent_max = Math.max(rev,rev+current_max); //now get max contiguous sum in array using Kadane's Algo\n\t\t\tglobal_max=Math.max(global_max,current_max); //update 'global_max' only when it is LESS than 'current_max'\n\t\t}\n\t\tsc.close();\n\t\tSystem.out.println(t_ones+global_max);\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "4a300ab2c8e9dda12ebbe9cd17a4f8b2", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "apr_id": "be850556b3bd4d06608420774670617b", "difficulty": 1200, "tags": ["dp", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6571902392797915, "equal_cnt": 74, "replace_cnt": 26, "delete_cnt": 16, "insert_cnt": 33, "fix_ops_cnt": 75, "bug_source_code": "\npackage maraton;\n\nimport java.util.Scanner;\n\npublic class Binario \n{\n public static void main(String[] args) {\n Scanner sca=new Scanner(System.in);\n \n long a =sca.nextLong();\n long b =sca.nextLong();\n if (b= 0 && pivote <= b) \n {\n \n pivote = pivote + (long) (Math.pow(2, base));\n base--;\n \n if (pivote >= a && pivote<=b) \n { \n \n totales++;\n }\n \n \n \n }\n long pivote2 = 2;\n int niveles2=0,cont2=0;\n \n while (pivote2 <= b) \n {\n pivote2 = (pivote2 * 2) + 1;\n niveles2++;\n }\n pivote2 = (pivote2 - 1) / 2;\n base = niveles2 - 2;\n \n if (niveles2 > niveles) \n {\n while (pivote2 <= b && base>=0) \n {\n cont2++;\n if (pivote2 + Math.pow(2, base) <= b) \n {\n \n pivote2 = pivote2 + (int) Math.pow(2, base);\n base--;\n if (base==-1 && pivote2= awal) && (dec <= akhir) && (x.charAt(0) != '0')) {\n sum++;\n }\n }else {\n for (int j = 0; j < binerAkhir.length(); j++){\n if (j == (i-binerAwal.length())) x += \"0\"; else x+= \"1\";\n }\n int dec = Integer.parseInt(x,2);\n if ((dec >= awal) && (dec <= akhir) && (x.charAt(0) != '0')) {\n sum++;\n }\n }\n }\n System.out.println(sum);\n }\n \n}\n", "lang": "Java 7", "bug_code_uid": "8c11f19db74524d91d6cf3d888c095aa", "src_uid": "581f61b1f50313bf4c75833cefd4d022", "apr_id": "d01b1313293d354b58db201917b1d9aa", "difficulty": 1300, "tags": ["bitmasks", "brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9979591836734694, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*;\r\nimport java.util.ArrayList;\r\nimport java.util.Collections;\r\nimport java.util.StringTokenizer;\r\n\r\npublic class B {\r\n static BufferedReader r = new BufferedReader(new InputStreamReader(System.in));\r\n static PrintWriter pw = new PrintWriter(System.out);\r\n public static double func(double x, double n){\r\n\r\n return -n*(n*n-3*n-3*x*x+9*x-4)/(2*(x-2)*(x-1)*x);\r\n }\r\n public static void main(String[] args) throws IOException {\r\n StringTokenizer st = new StringTokenizer(r.readLine());\r\n ArrayList nums = new ArrayList<>();\r\n int x = Integer.parseInt(st.nextToken());\r\n double p = Double.parseDouble(st.nextToken());\r\n int ans = 1;\r\n for(int i = 1; i<=x; i++){\r\n if(func(x,i) >= p){\r\n ans = i;\r\n break;\r\n }\r\n }\r\n pw.print(ans);\r\n pw.close(); // make sure to include this line -- closes io and flushes the output\r\n }\r\n}", "lang": "Java 11", "bug_code_uid": "a4a9e6c0cbc6a03c0816a0644b0d9479", "src_uid": "788ed59a964264bd0e755e155a37e14d", "apr_id": "8623720407ce801655b05b046d6b36d8", "difficulty": 2000, "tags": ["probabilities", "math", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9998898799691663, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*;\r\nimport java.util.*;\r\n \r\npublic class I {\r\n \r\n public static boolean DEBUG = true;\r\n public static String name = \"I\";\r\n \r\n public static void main(String[] args) throws IOException {\r\n \tFastScanner scan;\r\n \tPrintWriter out;\r\n \tif (DEBUG) {\r\n \t\tscan = new FastScanner(System.in);\r\n \tout = new PrintWriter(System.out);\r\n \t}\r\n \telse {\r\n \tscan = new FastScanner(name + \".in\");\r\n \tout = new PrintWriter(new BufferedWriter(new FileWriter(name + \".out\")));\r\n \t}\r\n \r\n\t\tfloat N = Float.parseFloat(scan.nextString());\r\n\t\tfloat P = Float.parseFloat(scan.nextString());\r\n \r\n for(int i=0; i<=N; i+=1) {\r\n \r\n double val = i*(i-1)*(i-2)/6 + i*(i-1)*(N-i)/2 + *i*(N-i)*(N-i-1)/4;\r\n val = val / (N*(N-1)*(N-2)/6);\r\n \r\n if(val >= P) {\r\n out.println((int)i);\r\n break;\r\n }\r\n }\r\n \r\n \r\n out.close();\r\n }\r\n \r\n static class BIT {\r\n public int[] tree;\r\n \r\n public BIT(int len) {\r\n tree = new int[len+5];\r\n }\r\n \r\n // updates tree by adding val to index\r\n public void update(int index, int val) {\r\n index++;\r\n while(index < tree.length) {\r\n tree[index] ^= val;\r\n index += index & -index;\r\n }\r\n }\r\n \r\n public int query(int index) {\r\n int result = 0;\r\n index++;\r\n while(index > 0) {\r\n result ^= tree[index];\r\n index -= index & -index;\r\n }\r\n \r\n return result;\r\n }\r\n \r\n public int rangeSum(int low, int high) {\r\n return query(high) - query(low-1); \r\n }\r\n \r\n }\r\n \r\n /* BINARY LIFTING - Preprocess O(NlogN) - Query O(logN)*/\r\n static ArrayList[] adjList;\r\n static int[] tin, tout;\r\n static int[][] BL;\r\n static int ct;\r\n \r\n public static void preprocess(int root) {\r\n ct = 0;\r\n tin = new int[adjList.length];\r\n tout = new int[adjList.length];\r\n BL = new int[adjList.length][log2(adjList.length)+1];\r\n \r\n recur_bl(root,root);\r\n }\r\n \r\n public static void recur_bl(int v, int p) {\r\n tin[v] = ++ct;\r\n BL[v][0] = p;\r\n for (int i=1; i <= log2(adjList.length); ++i) BL[v][i] = BL[BL[v][i-1]][i-1];\r\n \r\n for (int i=0; i= tout[v];\r\n }\r\n \r\n public static int lca(int u, int v) {\r\n if(is_ancestor(u, v)) return u;\r\n if(is_ancestor(v, u)) return v;\r\n \r\n for(int i=log2(adjList.length); i >= 0; --i) if(!is_ancestor(BL[u][i], v)) u = BL[u][i];\r\n \r\n return BL[u][0];\r\n }\r\n \r\n public static int log2(int n) {\r\n return (int)Math.ceil(Math.log10(n)/Math.log10(2));\r\n }\r\n \r\n static class FastScanner {\r\n\t\t \r\n\t\t// Is your Fast I/O being bad?\r\n \r\n\t\tInputStream dis;\r\n\t\tbyte[] buffer = new byte[1 << 17];\r\n\t\tint pointer = 0;\r\n \r\n\t\tpublic FastScanner (String fileName) throws IOException {\r\n\t\t\tdis = new FileInputStream(fileName);\r\n\t\t}\r\n \r\n\t\tpublic FastScanner (InputStream is) throws IOException {\r\n\t\t\tdis = is;\r\n\t\t}\r\n \r\n\t\tint nextInt() throws IOException {\r\n\t\t\tint ret = 0;\r\n \r\n\t\t\tbyte b;\r\n\t\t\tdo {\r\n\t\t\t\tb = nextByte();\r\n\t\t\t} while (b <= ' ');\r\n\t\t\tboolean negative = false;\r\n\t\t\tif (b == '-') {\r\n\t\t\t\tnegative = true;\r\n\t\t\t\tb = nextByte();\r\n\t\t\t}\r\n\t\t\twhile (b >= '0' && b <= '9') {\r\n\t\t\t\tret = 10 * ret + b - '0';\r\n\t\t\t\tb = nextByte();\r\n\t\t\t}\r\n \r\n\t\t\treturn (negative) ? -ret : ret;\r\n\t\t}\r\n \r\n\t\tlong nextLong() throws IOException {\r\n\t\t\tlong ret = 0;\r\n \r\n\t\t\tbyte b;\r\n\t\t\tdo {\r\n\t\t\t\tb = nextByte();\r\n\t\t\t} while (b <= ' ');\r\n\t\t\tboolean negative = false;\r\n\t\t\tif (b == '-') {\r\n\t\t\t\tnegative = true;\r\n\t\t\t\tb = nextByte();\r\n\t\t\t}\r\n\t\t\twhile (b >= '0' && b <= '9') {\r\n\t\t\t\tret = 10 * ret + b - '0';\r\n\t\t\t\tb = nextByte();\r\n\t\t\t}\r\n \r\n\t\t\treturn (negative) ? -ret : ret;\r\n\t\t}\r\n \r\n\t\tbyte nextByte() throws IOException {\r\n\t\t\tif (pointer == buffer.length) {\r\n\t\t\t\tdis.read(buffer, 0, buffer.length);\r\n\t\t\t\tpointer = 0;\r\n\t\t\t}\r\n\t\t\treturn buffer[pointer++];\r\n\t\t}\r\n \r\n\t\tString nextString() throws IOException {\r\n\t\t\tStringBuffer ret = new StringBuffer();\r\n \r\n\t\t\tbyte b;\r\n\t\t\tdo {\r\n\t\t\t\tb = nextByte();\r\n\t\t\t} while (b <= ' ');\r\n\t\t\twhile (b > ' ') {\r\n\t\t\t\tret.appendCodePoint(b);\r\n\t\t\t\tb = nextByte();\r\n\t\t\t}\r\n \r\n\t\t\treturn ret.toString();\r\n\t\t}\r\n \r\n\t}\r\n}", "lang": "Java 11", "bug_code_uid": "2e357ca7cf2efedbcb4fa4a0d9df098f", "src_uid": "788ed59a964264bd0e755e155a37e14d", "apr_id": "8623720407ce801655b05b046d6b36d8", "difficulty": 2000, "tags": ["probabilities", "math", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9988938053097345, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Codeforces\r\n{\r\n public static void main(String args[])throws Exception\r\n {\r\n BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));\r\n StringBuilder sb=new StringBuilder();\r\n String s[]=bu.readLine().split(\" \");\r\n int n=Integer.parseInt(s[0]);\r\n int i; double p=Double.parseDouble(s[1]);\r\n\r\n for(i=1;i<=n;i++)\r\n if(probab(n,i)>=p) break;\r\n System.out.println(i);\r\n }\r\n\r\n static int ncr(int n,int r)\r\n {\r\n if(r>n) return 0;\r\n int ans=1,i;\r\n for(i=n;i>n-r;i--) ans*=i;\r\n for(i=2;i<=r;i++) ans/=i;\r\n return ans;\r\n }\r\n\r\n static double probab(int n,int x)\r\n {\r\n int a=ncr(x,3)*ncr(n-x,0);\r\n int b=ncr(x,2)*ncr(n-x,1);\r\n int c=ncr(x,1)*ncr(n-x,2);\r\n return 1.0*((3.0/6)*c+a+b)/ncr(n,3);\r\n }\r\n}", "lang": "Java 11", "bug_code_uid": "5b695db2c7ddbc8cff771754b6f674ec", "src_uid": "788ed59a964264bd0e755e155a37e14d", "apr_id": "2f33c71e80106a2323cb8079a9e1010b", "difficulty": 2000, "tags": ["probabilities", "math", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9831181727904668, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import java.util.Scanner;\r\n\r\npublic class I {\r\n public static void main(String[] args) {\r\n Scanner s = new Scanner(System.in);\r\n\r\n solve(s.nextInt(), (int)s.nextDouble() * 10000);\r\n }\r\n\r\n\r\n public static void solve(long n, long p) {\r\n long studied = 0;\r\n long notStudied = n;\r\n\r\n long zero;\r\n long one;\r\n long two;\r\n long three;\r\n\r\n long thisP;\r\n\r\n while (true) {\r\n zero = notStudied * (notStudied - 1) * (notStudied - 2) / 6;\r\n one = studied * notStudied * (notStudied - 1) / 2;\r\n two = studied * (studied - 1) * notStudied / 2;\r\n three = studied * (studied - 1) * (studied - 2) / 6;\r\n\r\n thisP = zero * 0 + one * 1 + two * 2 + three * 2;\r\n if (thisP * 5000 >= p * n * (n - 1) * (n - 2) / 6) {\r\n System.out.println(studied);\r\n return;\r\n }\r\n\r\n studied++;\r\n notStudied--;\r\n }\r\n }\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "67d6fa27c0c20402f528ed050d0b77f2", "src_uid": "788ed59a964264bd0e755e155a37e14d", "apr_id": "dba72a2dd53324fcaeecd652c41f08f7", "difficulty": 2000, "tags": ["probabilities", "math", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5935403726708075, "equal_cnt": 107, "replace_cnt": 53, "delete_cnt": 52, "insert_cnt": 2, "fix_ops_cnt": 107, "bug_source_code": "import java.util.*;\r\nimport java.io.*;\r\npublic class F {\r\n\r\n\tstatic long mod = 998244353; \r\n\tpublic static void main(String[] args) {\r\n\t\tScanner sc = new Scanner(System.in);\r\n\t\tint n = sc.nextInt();\r\n\t\tint m = sc.nextInt();\r\n\t\t\r\n\t\tString[] s = new String[n];\r\n\t\tfor(int i = 0; i < n; i++) {\r\n\t\t\ts[i] = sc.next();\r\n\t\t}\t\r\n\t\t\r\n\t\tHashSet prefs = new HashSet<>();\r\n\t\tfor(int i = 0; i < n; i++){\r\n\t\t\tfor(int j = 1; j < s[i].length(); j++){\r\n\t\t\t\tprefs.add(s[i].substring(j));\r\n\t\t\t}\r\n\t\t}\r\n\t\tprefs.add(\"\");\r\n\t\tHashSet nodes = new HashSet<>();\r\n\t\tfor(String a: prefs){\r\n\t\t\tfor(String b: prefs){\r\n\t\t\t\tif(isPref(a, b)) {\r\n\t\t\t\t\tnodes.add(new Pair(a, b));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tint N = nodes.size();\r\n\t\tHashMap code = new HashMap<>();\r\n\t\tPair[] decode = new Pair[N];\r\n\t\tint count = 0;\r\n\t\tfor(Pair p: nodes) {\r\n\t\t\tdecode[count] = p;\r\n\t\t\tcode.put(p, count++);\r\n\t\t}\r\n\t\tlong[][] aut = new long[N][N];\r\n\t\tPair p0 = new Pair(\"\",\"\");\r\n\t\tfor(String t: s) {\r\n\t\t\tfor(String u: s) {\r\n\t\t\t\tif(isPref(t, u)) {\r\n\t\t\t\t\tString a = t.substring(1);\r\n\t\t\t\t\tString b = u.substring(1);\r\n\t\t\t\t\tPair p = new Pair(a, b);\r\n\t\t\t\t\taut[code.get(p0)][code.get(p)]++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor(Pair p: nodes) {\r\n\t\t\tPair q = next(p);\r\n\t\t\tif(p.equals(p0)){\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\telse if(q != null) {\r\n\t\t\t\taut[code.get(p)][code.get(q)]++;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tfor(String t: s) {\r\n\t\t\t\t\tq = next(p, t);\r\n\t\t\t\t\tif(q != null && nodes.contains(q)) {\r\n\t\t\t\t\t\taut[code.get(p)][code.get(q)]++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tMatrix mat = new Matrix(aut);\r\n\t\tMatrix matp = pow(mat, m);\r\n\t\tSystem.out.println(matp.mat[code.get(p0)][code.get(p0)]);\r\n\t}\r\n\tstatic Pair next(Pair p, String s) {\r\n\t\tif(p.a.equals(\"\")) {\r\n\t\t\tif(isPref(s, p.b)) {\r\n\t\t\t\tString a = s.substring(1);\r\n\t\t\t\tString b = p.b.substring(1);\r\n\t\t\t\treturn new Pair(a, b);\r\n\t\t\t}\r\n\t\t\telse return null;\r\n\t\t}\r\n\t\telse if(p.b.equals(\"\")) {\r\n\t\t\tif(isPref(s, p.a)) {\r\n\t\t\t\tString a = p.a.substring(1);\r\n\t\t\t\tString b = s.substring(1);\r\n\t\t\t\treturn new Pair(a, b);\r\n\t\t\t}\r\n\t\t\telse return null;\r\n\t\t}\r\n\t\telse return null;\r\n\t}\r\n\tstatic Pair next(Pair p) {\r\n\t\tif(p.a.equals(\"\")) return null;\r\n\t\tif(p.b.equals(\"\")) return null;\r\n\t\tString a = p.a.substring(1);\r\n\t\tString b = p.b.substring(1);\r\n\t\treturn new Pair(a, b);\r\n\t}\r\n\tstatic boolean isPref(String a, String b) {\r\n\t\tif(a.length() == b.length()) {\r\n\t\t\treturn a.equals(b);\r\n\t\t}\r\n\t\telse if(a.length() > b.length()) {\r\n\t\t\treturn b.equals(a.substring(0, b.length()));\r\n\t\t}\r\n\t\telse {\r\n\t\t\treturn a.equals(b.substring(0, a.length()));\r\n\t\t}\r\n\t}\r\n\tstatic class Pair {\r\n\t\tString a, b;\r\n\t\tpublic Pair(String a, String b) {\r\n\t\t\tthis.a = a; this.b = b;\r\n\t\t}\r\n\t\t@Override\r\n\t\tpublic int hashCode() {\r\n\t\t\treturn a.hashCode() + b.hashCode();\r\n\t\t}\r\n\t\t@Override\r\n\t\tpublic boolean equals(Object o) {\r\n\t\t\tPair p = (Pair)o;\r\n\t\t\treturn a.equals(p.a) && b.equals(p.b);\r\n\t\t}\r\n\t\tpublic String toString() {\r\n\t\t\treturn \"'\"+a+\"' '\"+b;\r\n\t\t}\r\n\t}\r\n\t\r\n\tstatic Matrix pow(Matrix m, int exp) {\r\n\t\tMatrix res = new Matrix(m.n);\r\n\t\tMatrix mapow = m;\r\n\t\twhile(exp > 0) {\r\n\t\t\tif((exp & 1) == 1) {\r\n\t\t\t\tres = res.mult(mapow);\r\n\t\t\t}\r\n\t\t\tmapow = mapow.mult(mapow);\r\n\t\t\texp >>= 1;\r\n\t\t}\r\n\t\treturn res;\r\n\t}\r\n\tstatic class Matrix{\r\n\t\tlong[][] mat; int n;\r\n\t\tpublic Matrix(long[][] mat) {\r\n\t\t\tn = mat.length;\r\n\t\t\tthis.mat = mat;\r\n\t\t}\r\n\t\tpublic Matrix(int n) {\r\n\t\t\tmat = new long[n][n];\r\n\t\t\tthis.n = n;\r\n\t\t\tfor(int i = 0; i < n; i++) mat[i][i] = 1;\r\n\t\t}\r\n\t\tMatrix mult(Matrix m) {\r\n\t\t\tlong[][] res = new long[n][n];\r\n\t\t\tfor(int k = 0; k < n; k++) {\r\n\t\t\t\tfor(int i = 0; i < n; i++) {\r\n\t\t\t\t\tfor(int j = 0; j < n; j++) {\r\n\t\t\t\t\t\tres[i][j] += mat[i][k] * m.mat[k][j] % mod;\r\n\t\t\t\t\t\tres[i][j] %= mod;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn new Matrix(res);\r\n\t\t}\r\n\t\tpublic String toString(){\r\n\t\t\tStringBuilder sb = new StringBuilder();\r\n\t\t\tfor(int i = 0; i < n; i++) {\r\n\t\t\t\tsb.append(Arrays.toString(mat[i])+\"\\n\");\r\n\t\t\t}\r\n\t\t\treturn sb.toString();\r\n\t\t}\r\n\t\tlong[] mult(long[] vec) {\r\n\t\t\tlong[] res = new long[n];\r\n\t\t\tfor(int i = 0; i < n; i++) {\r\n\t\t\t\tfor(int j = 0; j < n; j++) {\r\n\t\t\t\t\tres[i] += vec[j] * mat[i][j] % mod;\r\n\t\t\t\t\tres[i] %= mod;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn res;\r\n\t\t}\r\n\t\tlong[] tmult(long[] vec) {\r\n\t\t\tlong[] res = new long[n];\r\n\t\t\tfor(int i = 0; i < n; i++) {\r\n\t\t\t\tfor(int j = 0; j < n; j++) {\r\n\t\t\t\t\tres[j] += vec[i] * mat[i][j] % mod;\r\n\t\t\t\t\tres[j] %= mod;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn res;\r\n\t\t}\r\n\t}\r\n\r\n}\r\n", "lang": "Java 8", "bug_code_uid": "d3ffea19246d97cf8cc81daa089f221b", "src_uid": "711d15e11016d0164fb2b0c3756e4857", "apr_id": "10e349d2e441c3d0a88f0af236aae6cf", "difficulty": 2700, "tags": ["dp", "matrices", "data structures", "string suffix structures", "brute force", "strings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9110779206586281, "equal_cnt": 50, "replace_cnt": 29, "delete_cnt": 10, "insert_cnt": 10, "fix_ops_cnt": 49, "bug_source_code": "//package ecr107;\r\n\r\nimport java.io.*;\r\nimport java.util.ArrayDeque;\r\nimport java.util.Arrays;\r\nimport java.util.InputMismatchException;\r\nimport java.util.Queue;\r\n\r\npublic class F {\r\n\tInputStream is;\r\n\tFastWriter out;\r\n\tString INPUT = \"\";\r\n\r\n\tvoid solve()\r\n\t{\r\n\t\tint n = ni(), m = ni();\r\n\t\tchar[][] ss = new char[n][];\r\n\t\tString[] oss = new String[n];\r\n\t\tfor(int i = 0;i < n;i++){\r\n\t\t\tss[i] = ns().toCharArray();\r\n\t\t\toss[i] = new String(ss[i]);\r\n\t\t}\r\n\t\tint[] offset = new int[n+1];\r\n\t\toffset[0] = 1;\r\n\t\tfor(int i = 0;i < n;i++){\r\n\t\t\toffset[i+1] = offset[i] + ss[i].length-1;\r\n\t\t}\r\n\t\tint U = offset[n]-1;\r\n\r\n\t\tfinal int D = 5;\r\n\t\tint[][] M = new int[(2*U+1)*D][(2*U+1)*D];\r\n//\t\ttr(offset);\r\n\t\tfor(int i = 0;i < 2*U+1;i++){\r\n\t\t\tint lb, of;\r\n\t\t\tif(i == 0) {\r\n\t\t\t\tlb = 0;\r\n\t\t\t\tof = 0;\r\n\t\t\t}else if(i < U+1) {\r\n\t\t\t\tlb = lowerBound(offset, i+1) - 1;\r\n\t\t\t\tof = i-offset[lb] + 1;\r\n\t\t\t}else {\r\n\t\t\t\tlb = lowerBound(offset, i-U + 1) - 1;\r\n\t\t\t\tof = i - U - offset[lb] + 1;\r\n\t\t\t}\r\n//\t\t\ttr(i, lb, of, U);\r\n\r\n\t\t\tif(i == 0){\r\n\t\t\t\tfor(int j = 0;j < n;j++){\r\n\t\t\t\t\tfor(int k = 0;k < n;k++){\r\n\t\t\t\t\t\tif(k != j && oss[k].startsWith(oss[j])){\r\n\t\t\t\t\t\t\tM[offset[k]+ss[j].length-1][0+(2*U+1)*(ss[j].length-1)] = 1;\r\n\t\t\t\t\t\t\tM[offset[k]+U+ss[j].length-1][0+(2*U+1)*(ss[j].length-1)] = 1;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tM[0][0+(2*U+1)*(ss[j].length-1)] += 1;\r\n\t\t\t\t}\r\n\t\t\t}else if(i < U+1){\r\n\t\t\t\t// r: 0 -> 0\r\n\t\t\t\tfor(int j = 0;j < n;j++){\r\n\t\t\t\t\tif(oss[lb].substring(of).equals(oss[j])){\r\n\t\t\t\t\t\tM[0][i+(2*U+1)*(oss[j].length()-1)] += 1;\r\n\t\t\t\t\t}else if(oss[lb].substring(of).startsWith(oss[j])){\r\n\t\t\t\t\t\tM[i+oss[j].length()][i+(2*U+1)*(oss[j].length()-1)] += 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t// l: -> 0\r\n\t\t\t\tString suf = oss[lb].substring(of);\r\n\t\t\t\tfor(int j = 0;j < n;j++){\r\n\t\t\t\t\tif(oss[j].startsWith(suf) && !oss[j].equals(suf)){\r\n\t\t\t\t\t\tM[U+offset[j]+suf.length()-1][i+(2*U+1)*(suf.length()-1)] += 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}else{\r\n\t\t\t\t// l: 0 -> 0\r\n\t\t\t\tfor(int j = 0;j < n;j++){\r\n\t\t\t\t\tif(oss[lb].substring(of).equals(oss[j])){\r\n\t\t\t\t\t\tM[0][i+(2*U+1)*(oss[j].length()-1)] += 1;\r\n\t\t\t\t\t}else if(oss[lb].substring(of).startsWith(oss[j])){\r\n\t\t\t\t\t\tM[i+oss[j].length()][i+(2*U+1)*(oss[j].length()-1)] += 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t// r: -> 0\r\n\t\t\t\tString suf = oss[lb].substring(of);\r\n\t\t\t\tfor(int j = 0;j < n;j++){\r\n\t\t\t\t\tif(oss[j].startsWith(suf) && !oss[j].equals(suf)){\r\n\t\t\t\t\t\tM[offset[j]+suf.length()-1][i+(2*U+1)*(suf.length()-1)] += 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor(int i = 0;i < 2*U+1;i++){\r\n\t\t\tfor(int j = 0;j < D-1;j++){\r\n\t\t\t\tM[i+(2*U+1)*(j+1)][i+(2*U+1)*j] = 1;\r\n\t\t\t}\r\n\t\t}\r\n\r\n//\t\tfor(int[] row : M){\r\n//\t\t\ttr(row);\r\n//\t\t}\r\n\r\n\t\tint[] v = new int[(2*U+1)*D];\r\n\t\tv[0] = 1;\r\n\t\tv = pow(M, v, m);\r\n//\t\tfor(int i = 1;i < U+1;i++){\r\n//\t\t\tif(v[i] != v[i+U]){\r\n//\t\t\t\ttr(\"diff\", i, i+U, v[i], v[i+U]);\r\n//\t\t\t}\r\n//\t\t}\r\n//\t\ttr(v);\r\n\t\tout.println(v[0]);\r\n\t}\r\n\r\n\t///////// begin\r\n\tpublic static final int mod = 998244353;\r\n\tpublic static final long m2 = (long)mod*mod;\r\n\tpublic static final long BIG = 8L*m2;\r\n\r\n\t// A^e*v\r\n\tpublic static int[] pow(int[][] A, int[] v, long e)\r\n\t{\r\n\t\tfor(int i = 0;i < v.length;i++){\r\n\t\t\tif(v[i] >= mod)v[i] %= mod;\r\n\t\t}\r\n\t\tint[][] MUL = A;\r\n\t\tfor(;e > 0;e>>>=1) {\r\n\t\t\tif((e&1)==1)v = mul(MUL, v);\r\n\t\t\tMUL = p2(MUL);\r\n\t\t}\r\n\t\treturn v;\r\n\t}\r\n\r\n\t// int matrix*int vector\r\n\tpublic static int[] mul(int[][] A, int[] v)\r\n\t{\r\n\t\tint m = A.length;\r\n\t\tint n = v.length;\r\n\t\tint[] w = new int[m];\r\n\t\tfor(int i = 0;i < m;i++){\r\n\t\t\tlong sum = 0;\r\n\t\t\tfor(int k = 0;k < n;k++){\r\n\t\t\t\tsum += (long)A[i][k] * v[k];\r\n\t\t\t\tif(sum >= BIG)sum -= BIG;\r\n\t\t\t}\r\n\t\t\tw[i] = (int)(sum % mod);\r\n\t\t}\r\n\t\treturn w;\r\n\t}\r\n\r\n\t// int matrix^2 (be careful about negative value)\r\n\tpublic static int[][] p2(int[][] A)\r\n\t{\r\n\t\tint n = A.length;\r\n\t\tint[][] C = new int[n][n];\r\n\t\tfor(int i = 0;i < n;i++){\r\n\t\t\tlong[] sum = new long[n];\r\n\t\t\tfor(int k = 0;k < n;k++){\r\n\t\t\t\tfor(int j = 0;j < n;j++){\r\n\t\t\t\t\tsum[j] += (long)A[i][k] * A[k][j];\r\n\t\t\t\t\tif(sum[j] >= BIG)sum[j] -= BIG;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tfor(int j = 0;j < n;j++){\r\n\t\t\t\tC[i][j] = (int)(sum[j] % mod);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn C;\r\n\t}\r\n\r\n\r\n\tpublic static int lowerBound(int[] a, int v){ return lowerBound(a, 0, a.length, v); }\r\n\tpublic static int lowerBound(int[] a, int l, int r, int v)\r\n\t{\r\n\t\tif(l > r || l < 0 || r > a.length)throw new IllegalArgumentException();\r\n\t\tint low = l-1, high = r;\r\n\t\twhile(high-low > 1){\r\n\t\t\tint h = high+low>>>1;\r\n\t\t\tif(a[h] >= v){\r\n\t\t\t\thigh = h;\r\n\t\t\t}else{\r\n\t\t\t\tlow = h;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn high;\r\n\t}\r\n\r\n\r\n\tvoid run() throws Exception\r\n\t{\r\n\t\tis = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());\r\n\t\tout = new FastWriter(System.out);\r\n\t\t\r\n\t\tlong s = System.currentTimeMillis();\r\n\t\tsolve();\r\n\t\tout.flush();\r\n\t\ttr(System.currentTimeMillis()-s+\"ms\");\r\n\t}\r\n\t\r\n\tpublic static void main(String[] args) throws Exception { new F().run(); }\r\n\t\r\n\tprivate byte[] inbuf = new byte[1024];\r\n\tpublic int lenbuf = 0, ptrbuf = 0;\r\n\t\r\n\tprivate int readByte()\r\n\t{\r\n\t\tif(lenbuf == -1)throw new InputMismatchException();\r\n\t\tif(ptrbuf >= lenbuf){\r\n\t\t\tptrbuf = 0;\r\n\t\t\ttry { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }\r\n\t\t\tif(lenbuf <= 0)return -1;\r\n\t\t}\r\n\t\treturn inbuf[ptrbuf++];\r\n\t}\r\n\t\r\n\tprivate boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }\r\n\tprivate int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }\r\n\t\r\n\tprivate double nd() { return Double.parseDouble(ns()); }\r\n\tprivate char nc() { return (char)skip(); }\r\n\t\r\n\tprivate String ns()\r\n\t{\r\n\t\tint b = skip();\r\n\t\tStringBuilder sb = new StringBuilder();\r\n\t\twhile(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')\r\n\t\t\tsb.appendCodePoint(b);\r\n\t\t\tb = readByte();\r\n\t\t}\r\n\t\treturn sb.toString();\r\n\t}\r\n\t\r\n\tprivate char[] ns(int n)\r\n\t{\r\n\t\tchar[] buf = new char[n];\r\n\t\tint b = skip(), p = 0;\r\n\t\twhile(p < n && !(isSpaceChar(b))){\r\n\t\t\tbuf[p++] = (char)b;\r\n\t\t\tb = readByte();\r\n\t\t}\r\n\t\treturn n == p ? buf : Arrays.copyOf(buf, p);\r\n\t}\r\n\r\n\tprivate int[] na(int n)\r\n\t{\r\n\t\tint[] a = new int[n];\r\n\t\tfor(int i = 0;i < n;i++)a[i] = ni();\r\n\t\treturn a;\r\n\t}\r\n\r\n\tprivate long[] nal(int n)\r\n\t{\r\n\t\tlong[] a = new long[n];\r\n\t\tfor(int i = 0;i < n;i++)a[i] = nl();\r\n\t\treturn a;\r\n\t}\r\n\r\n\tprivate char[][] nm(int n, int m) {\r\n\t\tchar[][] map = new char[n][];\r\n\t\tfor(int i = 0;i < n;i++)map[i] = ns(m);\r\n\t\treturn map;\r\n\t}\r\n\r\n\tprivate int[][] nmi(int n, int m) {\r\n\t\tint[][] map = new int[n][];\r\n\t\tfor(int i = 0;i < n;i++)map[i] = na(m);\r\n\t\treturn map;\r\n\t}\r\n\r\n\tprivate int ni() { return (int)nl(); }\r\n\r\n\tprivate long nl()\r\n\t{\r\n\t\tlong num = 0;\r\n\t\tint b;\r\n\t\tboolean minus = false;\r\n\t\twhile((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));\r\n\t\tif(b == '-'){\r\n\t\t\tminus = true;\r\n\t\t\tb = readByte();\r\n\t\t}\r\n\r\n\t\twhile(true){\r\n\t\t\tif(b >= '0' && b <= '9'){\r\n\t\t\t\tnum = num * 10 + (b - '0');\r\n\t\t\t}else{\r\n\t\t\t\treturn minus ? -num : num;\r\n\t\t\t}\r\n\t\t\tb = readByte();\r\n\t\t}\r\n\t}\r\n\r\n\tpublic static class FastWriter\r\n\t{\r\n\t\tprivate static final int BUF_SIZE = 1<<13;\r\n\t\tprivate final byte[] buf = new byte[BUF_SIZE];\r\n\t\tprivate final OutputStream out;\r\n\t\tprivate int ptr = 0;\r\n\r\n\t\tprivate FastWriter(){out = null;}\r\n\r\n\t\tpublic FastWriter(OutputStream os)\r\n\t\t{\r\n\t\t\tthis.out = os;\r\n\t\t}\r\n\r\n\t\tpublic FastWriter(String path)\r\n\t\t{\r\n\t\t\ttry {\r\n\t\t\t\tthis.out = new FileOutputStream(path);\r\n\t\t\t} catch (FileNotFoundException e) {\r\n\t\t\t\tthrow new RuntimeException(\"FastWriter\");\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tpublic FastWriter write(byte b)\r\n\t\t{\r\n\t\t\tbuf[ptr++] = b;\r\n\t\t\tif(ptr == BUF_SIZE)innerflush();\r\n\t\t\treturn this;\r\n\t\t}\r\n\r\n\t\tpublic FastWriter write(char c)\r\n\t\t{\r\n\t\t\treturn write((byte)c);\r\n\t\t}\r\n\r\n\t\tpublic FastWriter write(char[] s)\r\n\t\t{\r\n\t\t\tfor(char c : s){\r\n\t\t\t\tbuf[ptr++] = (byte)c;\r\n\t\t\t\tif(ptr == BUF_SIZE)innerflush();\r\n\t\t\t}\r\n\t\t\treturn this;\r\n\t\t}\r\n\r\n\t\tpublic FastWriter write(String s)\r\n\t\t{\r\n\t\t\ts.chars().forEach(c -> {\r\n\t\t\t\tbuf[ptr++] = (byte)c;\r\n\t\t\t\tif(ptr == BUF_SIZE)innerflush();\r\n\t\t\t});\r\n\t\t\treturn this;\r\n\t\t}\r\n\r\n\t\tprivate static int countDigits(int l) {\r\n\t\t\tif (l >= 1000000000) return 10;\r\n\t\t\tif (l >= 100000000) return 9;\r\n\t\t\tif (l >= 10000000) return 8;\r\n\t\t\tif (l >= 1000000) return 7;\r\n\t\t\tif (l >= 100000) return 6;\r\n\t\t\tif (l >= 10000) return 5;\r\n\t\t\tif (l >= 1000) return 4;\r\n\t\t\tif (l >= 100) return 3;\r\n\t\t\tif (l >= 10) return 2;\r\n\t\t\treturn 1;\r\n\t\t}\r\n\r\n\t\tpublic FastWriter write(int x)\r\n\t\t{\r\n\t\t\tif(x == Integer.MIN_VALUE){\r\n\t\t\t\treturn write((long)x);\r\n\t\t\t}\r\n\t\t\tif(ptr + 12 >= BUF_SIZE)innerflush();\r\n\t\t\tif(x < 0){\r\n\t\t\t\twrite((byte)'-');\r\n\t\t\t\tx = -x;\r\n\t\t\t}\r\n\t\t\tint d = countDigits(x);\r\n\t\t\tfor(int i = ptr + d - 1;i >= ptr;i--){\r\n\t\t\t\tbuf[i] = (byte)('0'+x%10);\r\n\t\t\t\tx /= 10;\r\n\t\t\t}\r\n\t\t\tptr += d;\r\n\t\t\treturn this;\r\n\t\t}\r\n\r\n\t\tprivate static int countDigits(long l) {\r\n\t\t\tif (l >= 1000000000000000000L) return 19;\r\n\t\t\tif (l >= 100000000000000000L) return 18;\r\n\t\t\tif (l >= 10000000000000000L) return 17;\r\n\t\t\tif (l >= 1000000000000000L) return 16;\r\n\t\t\tif (l >= 100000000000000L) return 15;\r\n\t\t\tif (l >= 10000000000000L) return 14;\r\n\t\t\tif (l >= 1000000000000L) return 13;\r\n\t\t\tif (l >= 100000000000L) return 12;\r\n\t\t\tif (l >= 10000000000L) return 11;\r\n\t\t\tif (l >= 1000000000L) return 10;\r\n\t\t\tif (l >= 100000000L) return 9;\r\n\t\t\tif (l >= 10000000L) return 8;\r\n\t\t\tif (l >= 1000000L) return 7;\r\n\t\t\tif (l >= 100000L) return 6;\r\n\t\t\tif (l >= 10000L) return 5;\r\n\t\t\tif (l >= 1000L) return 4;\r\n\t\t\tif (l >= 100L) return 3;\r\n\t\t\tif (l >= 10L) return 2;\r\n\t\t\treturn 1;\r\n\t\t}\r\n\r\n\t\tpublic FastWriter write(long x)\r\n\t\t{\r\n\t\t\tif(x == Long.MIN_VALUE){\r\n\t\t\t\treturn write(\"\" + x);\r\n\t\t\t}\r\n\t\t\tif(ptr + 21 >= BUF_SIZE)innerflush();\r\n\t\t\tif(x < 0){\r\n\t\t\t\twrite((byte)'-');\r\n\t\t\t\tx = -x;\r\n\t\t\t}\r\n\t\t\tint d = countDigits(x);\r\n\t\t\tfor(int i = ptr + d - 1;i >= ptr;i--){\r\n\t\t\t\tbuf[i] = (byte)('0'+x%10);\r\n\t\t\t\tx /= 10;\r\n\t\t\t}\r\n\t\t\tptr += d;\r\n\t\t\treturn this;\r\n\t\t}\r\n\r\n\t\tpublic FastWriter write(double x, int precision)\r\n\t\t{\r\n\t\t\tif(x < 0){\r\n\t\t\t\twrite('-');\r\n\t\t\t\tx = -x;\r\n\t\t\t}\r\n\t\t\tx += Math.pow(10, -precision)/2;\r\n\t\t\t//\t\tif(x < 0){ x = 0; }\r\n\t\t\twrite((long)x).write(\".\");\r\n\t\t\tx -= (long)x;\r\n\t\t\tfor(int i = 0;i < precision;i++){\r\n\t\t\t\tx *= 10;\r\n\t\t\t\twrite((char)('0'+(int)x));\r\n\t\t\t\tx -= (int)x;\r\n\t\t\t}\r\n\t\t\treturn this;\r\n\t\t}\r\n\r\n\t\tpublic FastWriter writeln(char c){\r\n\t\t\treturn write(c).writeln();\r\n\t\t}\r\n\r\n\t\tpublic FastWriter writeln(int x){\r\n\t\t\treturn write(x).writeln();\r\n\t\t}\r\n\r\n\t\tpublic FastWriter writeln(long x){\r\n\t\t\treturn write(x).writeln();\r\n\t\t}\r\n\r\n\t\tpublic FastWriter writeln(double x, int precision){\r\n\t\t\treturn write(x, precision).writeln();\r\n\t\t}\r\n\r\n\t\tpublic FastWriter write(int... xs)\r\n\t\t{\r\n\t\t\tboolean first = true;\r\n\t\t\tfor(int x : xs) {\r\n\t\t\t\tif (!first) write(' ');\r\n\t\t\t\tfirst = false;\r\n\t\t\t\twrite(x);\r\n\t\t\t}\r\n\t\t\treturn this;\r\n\t\t}\r\n\r\n\t\tpublic FastWriter write(long... xs)\r\n\t\t{\r\n\t\t\tboolean first = true;\r\n\t\t\tfor(long x : xs) {\r\n\t\t\t\tif (!first) write(' ');\r\n\t\t\t\tfirst = false;\r\n\t\t\t\twrite(x);\r\n\t\t\t}\r\n\t\t\treturn this;\r\n\t\t}\r\n\r\n\t\tpublic FastWriter writeln()\r\n\t\t{\r\n\t\t\treturn write((byte)'\\n');\r\n\t\t}\r\n\r\n\t\tpublic FastWriter writeln(int... xs)\r\n\t\t{\r\n\t\t\treturn write(xs).writeln();\r\n\t\t}\r\n\r\n\t\tpublic FastWriter writeln(long... xs)\r\n\t\t{\r\n\t\t\treturn write(xs).writeln();\r\n\t\t}\r\n\r\n\t\tpublic FastWriter writeln(char[] line)\r\n\t\t{\r\n\t\t\treturn write(line).writeln();\r\n\t\t}\r\n\r\n\t\tpublic FastWriter writeln(char[]... map)\r\n\t\t{\r\n\t\t\tfor(char[] line : map)write(line).writeln();\r\n\t\t\treturn this;\r\n\t\t}\r\n\r\n\t\tpublic FastWriter writeln(String s)\r\n\t\t{\r\n\t\t\treturn write(s).writeln();\r\n\t\t}\r\n\r\n\t\tprivate void innerflush()\r\n\t\t{\r\n\t\t\ttry {\r\n\t\t\t\tout.write(buf, 0, ptr);\r\n\t\t\t\tptr = 0;\r\n\t\t\t} catch (IOException e) {\r\n\t\t\t\tthrow new RuntimeException(\"innerflush\");\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tpublic void flush()\r\n\t\t{\r\n\t\t\tinnerflush();\r\n\t\t\ttry {\r\n\t\t\t\tout.flush();\r\n\t\t\t} catch (IOException e) {\r\n\t\t\t\tthrow new RuntimeException(\"flush\");\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tpublic FastWriter print(byte b) { return write(b); }\r\n\t\tpublic FastWriter print(char c) { return write(c); }\r\n\t\tpublic FastWriter print(char[] s) { return write(s); }\r\n\t\tpublic FastWriter print(String s) { return write(s); }\r\n\t\tpublic FastWriter print(int x) { return write(x); }\r\n\t\tpublic FastWriter print(long x) { return write(x); }\r\n\t\tpublic FastWriter print(double x, int precision) { return write(x, precision); }\r\n\t\tpublic FastWriter println(char c){ return writeln(c); }\r\n\t\tpublic FastWriter println(int x){ return writeln(x); }\r\n\t\tpublic FastWriter println(long x){ return writeln(x); }\r\n\t\tpublic FastWriter println(double x, int precision){ return writeln(x, precision); }\r\n\t\tpublic FastWriter print(int... xs) { return write(xs); }\r\n\t\tpublic FastWriter print(long... xs) { return write(xs); }\r\n\t\tpublic FastWriter println(int... xs) { return writeln(xs); }\r\n\t\tpublic FastWriter println(long... xs) { return writeln(xs); }\r\n\t\tpublic FastWriter println(char[] line) { return writeln(line); }\r\n\t\tpublic FastWriter println(char[]... map) { return writeln(map); }\r\n\t\tpublic FastWriter println(String s) { return writeln(s); }\r\n\t\tpublic FastWriter println() { return writeln(); }\r\n\t}\r\n\r\n\tpublic void trnz(int... o)\r\n\t{\r\n\t\tfor(int i = 0;i < o.length;i++)if(o[i] != 0)System.out.print(i+\":\"+o[i]+\" \");\r\n\t\tSystem.out.println();\r\n\t}\r\n\r\n\t// print ids which are 1\r\n\tpublic void trt(long... o)\r\n\t{\r\n\t\tQueue stands = new ArrayDeque<>();\r\n\t\tfor(int i = 0;i < o.length;i++){\r\n\t\t\tfor(long x = o[i];x != 0;x &= x-1)stands.add(i<<6|Long.numberOfTrailingZeros(x));\r\n\t\t}\r\n\t\tSystem.out.println(stands);\r\n\t}\r\n\r\n\tpublic void tf(boolean... r)\r\n\t{\r\n\t\tfor(boolean x : r)System.out.print(x?'#':'.');\r\n\t\tSystem.out.println();\r\n\t}\r\n\r\n\tpublic void tf(boolean[]... b)\r\n\t{\r\n\t\tfor(boolean[] r : b) {\r\n\t\t\tfor(boolean x : r)System.out.print(x?'#':'.');\r\n\t\t\tSystem.out.println();\r\n\t\t}\r\n\t\tSystem.out.println();\r\n\t}\r\n\r\n\tpublic void tf(long[]... b)\r\n\t{\r\n\t\tif(INPUT.length() != 0) {\r\n\t\t\tfor (long[] r : b) {\r\n\t\t\t\tfor (long x : r) {\r\n\t\t\t\t\tfor (int i = 0; i < 64; i++) {\r\n\t\t\t\t\t\tSystem.out.print(x << ~i < 0 ? '#' : '.');\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tSystem.out.println();\r\n\t\t\t}\r\n\t\t\tSystem.out.println();\r\n\t\t}\r\n\t}\r\n\r\n\tpublic void tf(long... b)\r\n\t{\r\n\t\tif(INPUT.length() != 0) {\r\n\t\t\tfor (long x : b) {\r\n\t\t\t\tfor (int i = 0; i < 64; i++) {\r\n\t\t\t\t\tSystem.out.print(x << ~i < 0 ? '#' : '.');\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tSystem.out.println();\r\n\t\t}\r\n\t}\r\n\r\n\tprivate boolean oj = System.getProperty(\"ONLINE_JUDGE\") != null;\r\n\tprivate void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "6162af4562bae6c38ce9c0ee3d9a3600", "src_uid": "711d15e11016d0164fb2b0c3756e4857", "apr_id": "23397f7f6e39745096bbf05cf5a02f2c", "difficulty": 2700, "tags": ["dp", "matrices", "data structures", "string suffix structures", "brute force", "strings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.947652733118971, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 9, "bug_source_code": "\r\nimport java.io.BufferedOutputStream;\r\nimport java.io.BufferedReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.io.PrintWriter;\r\nimport java.util.ArrayList;\r\nimport java.util.Arrays;\r\nimport java.util.Collections;\r\nimport java.util.HashMap;\r\nimport java.util.StringTokenizer;\r\nimport java.util.function.Supplier;\r\nimport java.util.stream.Collectors;\r\n\r\npublic class cf {\r\n\r\n\t//-----------PrintWriter for faster output---------------------------------\r\n public static PrintWriter out;\r\n public static int cnt;\r\n //-----------MyScanner class for faster input----------\r\n public static class MyScanner {\r\n BufferedReader br;\r\n StringTokenizer st;\r\n \r\n public MyScanner() {\r\n br = new BufferedReader(new InputStreamReader(System.in));\r\n }\r\n \r\n String next() {\r\n while (st == null || !st.hasMoreElements()) {\r\n try {\r\n st = new StringTokenizer(br.readLine());\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n }\r\n return st.nextToken();\r\n }\r\n \r\n int nextInt() {\r\n return Integer.parseInt(next());\r\n }\r\n \r\n long nextLong() {\r\n return Long.parseLong(next());\r\n }\r\n \r\n double nextDouble() {\r\n return Double.parseDouble(next());\r\n }\r\n \r\n String nextLine(){\r\n String str = \"\";\r\n try {\r\n str = br.readLine();\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n return str;\r\n }\r\n\t }\r\n \r\n static boolean isPrime(int n)\r\n{\r\n // Corner cases\r\n if (n <= 1)\r\n return false;\r\n if (n <= 3)\r\n return true;\r\n\r\n // This is checked so that we can skip\r\n // middle five numbers in below loop\r\n if (n % 2 == 0 || n % 3 == 0)\r\n return false;\r\n\r\n for (int i = 5; i * i <= n; i = i + 6)\r\n if (n % i == 0 || n % (i + 2) == 0)\r\n return false;\r\n\r\n return true;\r\n}\r\n public static int reverseBits(int n)\r\n {\r\n int rev = 0;\r\n \r\n // traversing bits of 'n'\r\n // from the right\r\n while (n > 0)\r\n {\r\n // bitwise left shift\r\n // 'rev' by 1\r\n rev <<= 1;\r\n \r\n // if current bit is '1'\r\n if ((int)(n & 1) == 1)\r\n rev ^= 1;\r\n \r\n // bitwise right shift\r\n //'n' by 1\r\n n >>= 1;\r\n }\r\n // required number\r\n return rev;\r\n }\r\n\r\n\tpublic static void main(String[] args) {\r\n\t\t// TODO Auto-generated method stub\r\n\t\t\r\n\t\tMyScanner sc = new MyScanner();\r\n out = new PrintWriter(new BufferedOutputStream(System.out));\r\n\t\tStringBuilder sb = new StringBuilder();\r\n\t\tint t=sc.nextInt();\r\n//\t\twhile(t-->0)\r\n//\t\t{\r\n//\t\t\tint n=sc.nextInt();\r\n//\t\t\tArrayList x1=new ArrayList();\r\n//\t\t\tArrayList x2=new ArrayList();\r\n//\t\r\n//\t\t\tArrayList x3=new ArrayList();\r\n//\t\t\tfor(int i=0;i=0)\r\n//\t\t\t\t{\r\n//\t\t\t\t\tl++;\r\n//\t\t\t\t\tr--;\r\n//\t\t\t\t\tans++;\r\n//\t\t\t\t}\r\n//\t\t\t\telse\r\n//\t\t\t\t{\r\n//\t\t\t\t\tl++;\r\n//\t\t\t\t}\r\n//\t\t\t}\r\n//\t\t\tout.println(ans);\r\n//\t\t}\r\n\t\tArrayList x=new ArrayList();\r\n\t\tx.add((long) 3);\r\n\t\tx.add((long) 5);\r\n\t\tlong k=5;\r\n\t\tk=k+2;\r\n\t\twhile(x.size()<=t)\r\n\t\t{\r\n\t\t\tx.add(k);\r\n\t\t\tx.add(k+1);\r\n\t\t\tx.add(k+2);\r\n\t\t\tk=k+4;\r\n\t\t}\r\n\t\tCollections.sort(x);\r\n\t\tout.println(x.get(t-1));\r\n\t\tout.close();\r\n\t}\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "a1fdf170a192223cdf4126f331dad80c", "src_uid": "d0a8604b78ba19ab769fd1ec90a72e4e", "apr_id": "358d3a083f3ebfd0e8c3a8d9b6ace843", "difficulty": 1500, "tags": ["geometry", "math", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8998091603053435, "equal_cnt": 11, "replace_cnt": 5, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "/*\r\n * To change this license header, choose License Headers in Project Properties.\r\n * To change this template file, choose Tools | Templates\r\n * and open the template in the editor.\r\n */\r\n//package solution1;\r\n\r\nimport java.io.*;\r\nimport java.util.*;\r\n\r\n/**\r\n *\r\n * @author Beaudelaire HOUNDO\r\n */\r\npublic class Solution1 {\r\n public static long solve(long n){\r\n long ans=0;\r\n if(n==1){\r\n ans=3;\r\n }\r\n if(n==2){\r\n ans=5;\r\n }\r\n if(n==3){\r\n ans=7;\r\n }\r\n if(n>3){\r\n long current=7;\r\n for(int i=4;i<=n;i++){\r\n if(i%3==0){\r\n current+=2;\r\n }else{\r\n current+=1;\r\n }\r\n \r\n }\r\n ans=current;\r\n }\r\n \r\n return ans;\r\n }\r\n\r\n /**\r\n * @param args the command line arguments\r\n */\r\n public static void main(String[] args) {\r\n // TODO code application logic here\r\n Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));\r\n ArrayList A= new ArrayList();\r\n ArrayList B= new ArrayList();\r\n //Scanner in= new Scanner(System.in);\r\n //int t=in.nextInt();\r\n //for(int i=0;i inp, int n, int target){\n Collections.sort(inp);\n Collections.reverse(inp);\n int res = 0;\n int num = n;\n for(int i = 0;i0;i++){\n int curr = inp.get(i);\n int times = target/curr;\n if(target%curr != 0)\n times++;\n if(times*curr<=target)\n times++;\n if(times>num)\n return res;\n num = num-times;\n res++;\n }\n return res;\n }\n\n public static void main(String args[]) throws java.lang.Exception{\n Scanner in;\n try{\n in = new Scanner(new FileReader(\"./input.txt\"));\n }\n catch(Exception e){\n in = new Scanner(System.in);\n }\n int n = in.nextInt();\n\n long st = 3;\n if(n == 1){\n System.out.println(3);\n return;\n }\n int t = 0;\n int flag = 0;\n for(int i = 2;i<=n;i++){\n if(flag == 1){\n st++;\n flag = 0;\n t++;\n }\n else if(t<2){\n st = st+2;\n t++;\n }\n else{\n st++;\n t = 0;\n flag = 1;\n }\n //System.out.println(i+\" \"+st);\n }\n System.out.println(st);\n }\n}\n", "lang": "Java 11", "bug_code_uid": "cce3934896e7d85d7cdcd2f8b47d6555", "src_uid": "d0a8604b78ba19ab769fd1ec90a72e4e", "apr_id": "a39ffaca6d46182a298214cf8d14840c", "difficulty": 1500, "tags": ["geometry", "math", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8427947598253275, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "import java.util.Scanner;\r\n\r\npublic class Class1 {\r\n\tpublic static void main(String[] args){\r\n\t\tScanner scan = new Scanner(System.in);\r\n\t\tint a = scan.nextInt();\r\n\t\tSystem.out.println(2*a+1);\r\n\t}\r\n}", "lang": "Java 8", "bug_code_uid": "71ec2e1fdd51662054d271ddbdfc0a57", "src_uid": "d0a8604b78ba19ab769fd1ec90a72e4e", "apr_id": "443748aa7d11e17aceac73b45d2abb27", "difficulty": 1500, "tags": ["geometry", "math", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8082999292619665, "equal_cnt": 22, "replace_cnt": 10, "delete_cnt": 0, "insert_cnt": 11, "fix_ops_cnt": 21, "bug_source_code": "/*\r\n Goal: Become better in CP!\r\n Key: Consistency and Discipline\r\n Desire: SDE @ Google USA\r\n Motto: Do what i Love <=> Love what i do\r\n If you don't use your brain 100%, it deteriorates gradually\r\n*/\r\n\r\nimport java.util.*;\r\nimport java.io.*;\r\nimport java.math.*;\r\n\r\npublic class Code {\r\n\r\n static StringBuffer str=new StringBuffer();\r\n static BufferedReader bf;\r\n static PrintWriter pw;\r\n static long n;\r\n static long d;\r\n static long p[];\r\n\r\n static long solve(int te) throws Exception{\r\n if(n==1) return 3;\r\n if(n==2) return 5;\r\n if(n==3) return 7;\r\n if(n==4) return 8;\r\n if(n==5) return 9;\r\n if(n==6) return 11;\r\n if(n==7) return 12;\r\n if(n==8) return 13;\r\n\r\n long tn=n-(n+3)/4-3;\r\n long pn=n;\r\n while(tn Love what i do\r\n If you don't use your brain 100%, it deteriorates gradually\r\n*/\r\n\r\nimport java.util.*;\r\nimport java.io.*;\r\nimport java.math.*;\r\n\r\npublic class Code {\r\n\r\n static StringBuffer str=new StringBuffer();\r\n static BufferedReader bf;\r\n static PrintWriter pw;\r\n static long n;\r\n\r\n static void solve(int te) throws Exception{\r\n if(n==1) return 3;\r\n return 4 + (4*n-3)/3;\r\n }\r\n \r\n public static void main(String[] args) throws java.lang.Exception {\r\n boolean lenv=false;\r\n if(lenv){\r\n bf = new BufferedReader(\r\n new FileReader(\"input.txt\"));\r\n pw=new PrintWriter(new\r\n BufferedWriter(new FileWriter(\"output.txt\")));\r\n }else{\r\n bf = new BufferedReader(new InputStreamReader(System.in));\r\n pw = new PrintWriter(new OutputStreamWriter(System.out));\r\n }\r\n \r\n // int q1 = Integer.parseInt(bf.readLine().trim());\r\n // for(int te=1;te<=q1;te++) {\r\n // String s[]=bf.readLine().trim().split(\"\\\\s+\");\r\n n=Long.parseLong(bf.readLine().trim());\r\n solve(1);\r\n // }\r\n pw.print(str);\r\n pw.flush();\r\n // System.out.println(str);\r\n }\r\n}", "lang": "Java 8", "bug_code_uid": "a4ae8d6f853f0da3a1773771d991f76a", "src_uid": "d0a8604b78ba19ab769fd1ec90a72e4e", "apr_id": "95da48317f7006dfc6c173f549f24592", "difficulty": 1500, "tags": ["geometry", "math", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9318746892093486, "equal_cnt": 16, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 7, "fix_ops_cnt": 15, "bug_source_code": "import java.io.BufferedReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.util.StringTokenizer;\r\n\r\npublic class bubblestrike {\r\n public static void main(String[] args) throws IOException {\r\n BufferedReader f = new BufferedReader(new InputStreamReader(System.in));\r\n StringTokenizer st = new StringTokenizer(f.readLine());\r\n int x = Integer.parseInt(st.nextToken());\r\n double prob = Double.parseDouble(st.nextToken());\r\n int pos = x;\r\n for(int a = x; a>=1; a/=2){\r\n while (check(pos-a,x-(pos-a),prob)){\r\n pos-=a;\r\n }\r\n }\r\n System.out.println(pos);\r\n\r\n }\r\n public static boolean check (int good, int bad, double proba){\r\n double g=good+0.0;\r\n double b=bad+0.0;\r\n double ans = (0.25*b*(b-1.0)+(g*(g-1)*(g-2)/6.0)+b*0.5*(g)*(g-1))/((g+b)*(g+b-1)*(g+b-2)/6.0);\r\n \r\n return ans >=proba;\r\n }\r\n}\r\n", "lang": "Java 8", "bug_code_uid": "fb30c04a13c0dd3eb6446712aa9b750f", "src_uid": "788ed59a964264bd0e755e155a37e14d", "apr_id": "dcf882456335242a85fa431c95594189", "difficulty": 2000, "tags": ["probabilities", "math", "combinatorics", "ternary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9991445680068435, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\r\nimport java.io.*;\r\n\r\npublic class _1599_C {\r\n public static void main(String[] args) throws IOException {\r\n BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\r\n PrintWriter out = new PrintWriter(System.out);\r\n StringTokenizer line = new StringTokenizer(in.readLine());\r\n int n = Integer.parseInt(line.nextToken());\r\n double p = Double.parseDouble(line.nextToken());\r\n int total = choose_three(n);\r\n for(int i = 1; i <= n; i++) {\r\n double prob = 0;\r\n double p1 = (double)i * choose_two(n - i) / total;\r\n double p2 = (double)choose_two(i) * (n - i) / total;\r\n double p3 = (double)choose_three(i) / total;\r\n prob = p1 / 2 + p2 + p3;\r\n if(prob >= p) {\r\n out.println(i);\r\n break;\r\n }\r\n }\r\n in.close();\r\n out.close();\r\n }\r\n static int choose_two(int n) {\r\n if(n < 2) return 0;\r\n return n * (n - 1) / 2;\r\n }\r\n static int choose_three(int n) {\r\n if(n < 3) return 0;\r\n return n * (n - 1) * (n - 2) / 6;\r\n }\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "daf12a6c55a10c9c6dfd366d563c3dae", "src_uid": "788ed59a964264bd0e755e155a37e14d", "apr_id": "5dadc7c998f54e5d2284a0fb9659c7a1", "difficulty": 2000, "tags": ["probabilities", "math", "combinatorics", "ternary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9993853718500307, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*; \nimport java.text.*; \nimport java.util.*; \nimport java.math.*;\npublic class C { \n public static void main(String[] args) throws Exception {\n new C().run();\n } \n public void run() throws Exception { \n FastScanner f = new FastScanner(); \n PrintWriter out = new PrintWriter(System.out); \n int n = f.nextInt();\n double d = f.nextDouble();\n for(int i = 1; i <= n; i++) {\n double prob = 1.5 * i * (n-i) * (n-i-1) / n / (n-1) / (n-2);\n prob += 3.0 * i * (i-1) * (n-i) / n / (n-1) / (n-2);\n prob += 1.0 * i * (i-1) * (i-2) / n / (n-1) / (n-2);\n if(prob + 1e-8 >= d) {\n out.println(i);\n break;\n }\n }\n///\n out.flush();\n\t}\n///\n\tstatic class FastScanner {\n\t\tpublic BufferedReader reader;\n\t\tpublic StringTokenizer tokenizer;\n\t\tpublic FastScanner() {\n\t\t\treader = new BufferedReader(new InputStreamReader(System.in), 32768);\n\t\t\ttokenizer = null;\n\t\t}\n\t\tpublic String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn tokenizer.nextToken();\n\t\t}\n\t\tpublic int nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\t\tpublic long nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\t\tpublic double nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\t\tpublic String nextLine() {\n\t\t\ttry {\n\t\t\t\treturn reader.readLine();\n\t\t\t} catch(IOException e) {\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t}\n\t}\n}\n", "lang": "Java 11", "bug_code_uid": "0a77d812f4bf81180ea5e0df9304d007", "src_uid": "788ed59a964264bd0e755e155a37e14d", "apr_id": "9973ad7ac3f9278d94ac025a567e3f48", "difficulty": 2000, "tags": ["probabilities", "math", "combinatorics", "ternary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9329647546648238, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 8, "bug_source_code": "import java.util.*;\r\npublic class Main\r\n{\r\n\tpublic static void main(String[] args) {\r\n\t\tScanner sc=new Scanner(System.in);\r\n\t\tString s=sc.next();\r\n\t\tchar a[]=new char[26];\r\n\t\tint iii=0;\r\n\t\tfor(char al='A';al<='Z';al++){\r\n\t\t a[iii]=al;\r\n\t\t iii++;\r\n\t\t}\r\n\t\tint len=s.length();\r\n\t\tboolean f=true;\r\n\t\tint pos1=0,pos2=0,pos3=0;\r\n\t\tfor(int i=0;i0) {\r\n\t\t\tString a = sc.next();\r\n\t\t\t\r\n\t\t\tif(a.length()==1 || a.length()==2) {\r\n\t\t\t\tout.println(\"NO\");\r\n\t\t\t\tcontinue;\r\n\t\t\t} else {\r\n\t\t\t\tfor(int i = 2;i1 || (Math.abs((a.charAt(i)-64)-Math.abs(a.charAt(i-1)-64+a.charAt(i-2)-64)%26)==0)) {\r\n\t\t\t\t\t\tout.println(\"NO\");\r\n\t\t\t\t\t\tout.close();\r\n\t\t\t\t\t\tSystem.exit(0);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tout.println(\"YES\");\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tout.close();\r\n\t}\r\n\tstatic class FastReader {\r\n\t\t\r\n\t\tStringTokenizer st;\r\n\t\tBufferedReader br;\r\n\t\t\r\n\t\tpublic FastReader() {\r\n\t\t\tbr = new BufferedReader(\r\n\t\t\t\t\tnew InputStreamReader(System.in));\r\n\t\t}\r\n\t\t\r\n\t\tString next() {\r\n\t\t\twhile(st==null || !st.hasMoreElements()) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\r\n\t\t\t\t} catch (IOException e) {\r\n\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn st.nextToken();\r\n\t\t}\r\n\t\t\r\n\t\tint nextInt() {\r\n\t\t\treturn Integer.parseInt(next());\r\n\t\t}\r\n\t\t\r\n\t\tlong nextLong() {\r\n\t\t\treturn Long.parseLong(next());\r\n\t\t}\r\n\t\t\r\n\t\tdouble nextDouble() { \r\n\t\t\treturn Double.parseDouble(next()); \r\n\t\t} \r\n\t\t\r\n\t\tString nextLine() {\r\n\t\t\tString s = \"\";\r\n\t\t\twhile(st==null || st.hasMoreElements()) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\ts = br.readLine();\r\n\t\t\t\t} catch (IOException e) {\r\n\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn s;\r\n\t\t}\r\n\t}\r\n}\r\n", "lang": "Java 8", "bug_code_uid": "f5e325daad5c4cc21fb7e9e558365541", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "a4c2ad5d37242803a292faa48a7652c2", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9834983498349835, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*;\nimport java.io.*;\n\npublic class Main {\n\n\n public static class Pair implements Comparable < Pair > {\n int d;\n int i;\n Pair(int d, int i) {\n this.d = d;\n this.i = i;\n }\n public int compareTo(Pair o) {\n return this.d - o.d;\n }\n\n }\n\n public static class SegmentTree {\n long[] st;\n long[] lazy;\n int n;\n\n SegmentTree(long[] arr, int n) {\n this.n = n;\n st = new long[4 * n];\n lazy = new long[4 * n];\n\n construct(arr, 0, n - 1, 0);\n\n\n }\n\n public long construct(long[] arr, int si, int ei, int node) {\n if (si == ei) {\n st[node] = arr[si];\n return arr[si];\n }\n\n int mid = (si + ei) / 2;\n\n long left = construct(arr, si, mid, 2 * node + 1);\n long right = construct(arr, mid + 1, ei, 2 * node + 2);\n\n\n st[node] = left + right;\n\n\n return st[node];\n }\n\n public long get(int l, int r) {\n return get(0, n - 1, l, r, 0);\n }\n\n public long get(int si, int ei, int l, int r, int node) {\n if (r < si || l > ei)\n return 0;\n\n if (lazy[node] != 0) {\n st[node] += lazy[node] * (ei - si + 1);\n\n if (si != ei) {\n lazy[2 * node + 1] += lazy[node];\n lazy[2 * node + 2] += lazy[node];\n }\n lazy[node] = 0;\n }\n\n if (l <= si && r >= ei)\n return st[node];\n\n int mid = (si + ei) / 2;\n\n return get(si, mid, l, r, 2 * node + 1) + get(mid + 1, ei, l, r, 2 * node + 2);\n }\n\n public void update(int index, int value) {\n update(0, n - 1, index, 0, value);\n }\n\n public void update(int si, int ei, int index, int node, int val) {\n if (si == ei) {\n st[node] = val;\n return;\n }\n int mid = (si + ei) / 2;\n\n\n if (index <= mid) {\n update(si, mid, index, 2 * node + 1, val);\n } else {\n update(mid + 1, ei, index, 2 * node + 2, val);\n }\n\n\n st[node] = st[2 * node + 1] + st[2 * node + 2];\n }\n\n public void rangeUpdate(int l, int r, int val) {\n rangeUpdate(0, n - 1, l, r, 0, val);\n }\n\n public void rangeUpdate(int si, int ei, int l, int r, int node, int val) {\n if (r < si || l > ei)\n return;\n\n if (lazy[node] != 0) {\n st[node] += lazy[node] * (ei - si + 1);\n\n if (si != ei) {\n lazy[2 * node + 1] += lazy[node];\n lazy[2 * node + 2] += lazy[node];\n }\n lazy[node] = 0;\n }\n\n if (l <= si && r >= ei) {\n st[node] += val * (ei - si + 1);\n if (si != ei) {\n lazy[2 * node + 1] += val;\n lazy[2 * node + 2] += val;\n }\n\n return;\n }\n\n int mid = (si + ei) / 2;\n\n rangeUpdate(si, mid, l, r, 2 * node + 1, val);\n rangeUpdate(mid + 1, ei, l, r, 2 * node + 2, val);\n\n st[node] = st[2 * node + 1] + st[2 * node + 2];\n }\n }\n\n\n static class Reader {\n\n final private int BUFFER_SIZE = 1 << 16;\n private DataInputStream din;\n private byte[] buffer;\n private int bufferPointer, bytesRead;\n\n public Reader() {\n din = new DataInputStream(System.in);\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }\n\n public Reader(String file_name) throws IOException {\n din = new DataInputStream(\n new FileInputStream(file_name));\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }\n\n public String readLine() throws IOException {\n byte[] buf = new byte[64]; // line length\n int cnt = 0, c;\n while ((c = read()) != -1) {\n if (c == '\\n') {\n if (cnt != 0) {\n break;\n } else {\n continue;\n }\n }\n buf[cnt++] = (byte)c;\n }\n return new String(buf, 0, cnt);\n }\n\n public int nextInt() throws IOException {\n int ret = 0;\n byte c = read();\n while (c <= ' ') {\n c = read();\n }\n boolean neg = (c == '-');\n if (neg)\n c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n\n if (neg)\n return -ret;\n return ret;\n }\n\n public long nextLong() throws IOException {\n long ret = 0;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (neg)\n return -ret;\n return ret;\n }\n\n public double nextDouble() throws IOException {\n double ret = 0, div = 1;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n\n if (c == '.') {\n while ((c = read()) >= '0' && c <= '9') {\n ret += (c - '0') / (div *= 10);\n }\n }\n\n if (neg)\n return -ret;\n return ret;\n }\n\n private void fillBuffer() throws IOException {\n bytesRead = din.read(buffer, bufferPointer = 0,\n BUFFER_SIZE);\n if (bytesRead == -1)\n buffer[0] = -1;\n }\n\n private byte read() throws IOException {\n if (bufferPointer == bytesRead)\n fillBuffer();\n return buffer[bufferPointer++];\n }\n\n public void close() throws IOException {\n if (din == null)\n return;\n din.close();\n }\n }\n public static void main(String[] args) throws IOException {\n\n if (System.getProperty(\"ONLINE_JUDGE\") == null) {\n try {\n System.setIn(new FileInputStream(new File(\"input.txt\")));\n System.setOut(new PrintStream(new File(\"output.txt\")));\n } catch (Exception e) {\n }\n }\n\n Reader sc = new Reader();\n\n int tc = 1;\n\n StringBuilder sb = new StringBuilder();\n\n\n\n\n while (tc-- > 0) {\n sb.append(\"YES\");\n\n\n }\n\n System.out.println(sb);\n\n\n\n }\n\n public static int get(int[] dsu, int x) {\n\n if (dsu[x] == x)\n return x;\n\n int k = get(dsu, dsu[x]);\n\n dsu[x] = k;\n\n return k;\n\n }\n\n\n\n\n\n static int gcd(int a, int b) {\n // Everything divides 0\n if (a == 0)\n return b;\n if (b == 0)\n return a;\n\n // base case\n if (a == b)\n return a;\n\n // a is greater\n if (a > b)\n return gcd(a - b, b);\n return gcd(a, b - a);\n }\n\n public static int Xor(int n) {\n if (n % 4 == 0)\n return n;\n\n // If n%4 gives remainder 1\n if (n % 4 == 1)\n return 1;\n\n // If n%4 gives remainder 2\n if (n % 4 == 2)\n return n + 1;\n\n // If n%4 gives remainder 3\n return 0;\n }\n\n\n\n\n\n\n public static long pow(long a, long b, long mod) {\n long res = 1;\n while (b > 0) {\n if ((b & 1) > 0)\n res = (res * a) % mod;\n b = b >> 1;\n a = ((a % mod) * (a % mod)) % mod;\n }\n\n return (res % mod + mod) % mod;\n }\n\n\n\n\n\n\n public static double digit(long num) {\n return Math.floor(Math.log10(num) + 1);\n }\n\n\n\n\n public static boolean isPos(int idx, long[] arr, long[] diff) {\n if (idx == 0) {\n for (int i = 0; i <= Math.min(arr[0], arr[1]); i++) {\n diff[idx] = i;\n arr[0] -= i;\n arr[1] -= i;\n if (isPos(idx + 1, arr, diff)) {\n return true;\n }\n arr[0] += i;\n arr[1] += i;\n }\n } else if (idx == 1) {\n if (arr[2] - arr[1] >= 0) {\n long k = arr[1];\n diff[idx] = k;\n arr[1] = 0;\n arr[2] -= k;\n if (isPos(idx + 1, arr, diff)) {\n return true;\n }\n arr[1] = k;\n arr[2] += k;\n\n } else\n return false;\n\n } else {\n if (arr[2] == arr[0] && arr[1] == 0) {\n diff[2] = arr[2];\n return true;\n } else {\n return false;\n }\n }\n\n return false;\n }\n\n public static boolean isPal(String s) {\n\n for (int i = 0; i < s.length(); i++) {\n if (s.charAt(i) != s.charAt(s.length() - 1 - i))\n return false;\n }\n\n return true;\n }\n\n\n\n\n\n static int upperBound(ArrayList arr, long key) {\n int mid, N = arr.size();\n\n // Initialise starting index and\n // ending index\n int low = 0;\n int high = N;\n\n // Till low is less than high\n while (low < high && low != N) {\n // Find the index of the middle element\n mid = low + (high - low) / 2;\n\n // If key is greater than or equal\n // to arr[mid], then find in\n // right subarray\n if (key >= arr.get(mid)) {\n low = mid + 1;\n }\n\n // If key is less than arr[mid]\n // then find in left subarray\n else {\n high = mid;\n }\n }\n\n // If key is greater than last element which is\n // array[n-1] then upper bound\n // does not exists in the array\n return low;\n }\n\n static int lowerBound(ArrayList array, long key) {\n // Initialize starting index and\n // ending index\n int low = 0, high = array.size();\n int mid;\n\n // Till high does not crosses low\n while (low < high) {\n\n // Find the index of the middle element\n mid = low + (high - low) / 2;\n\n // If key is less than or equal\n // to array[mid], then find in\n // left subarray\n if (key <= array.get(mid)) {\n high = mid;\n }\n\n // If key is greater than array[mid],\n // then find in right subarray\n else {\n\n low = mid + 1;\n }\n }\n\n // If key is greater than last element which is\n // array[n-1] then lower bound\n // does not exists in the array\n if (low < array.size() && array.get(low) < key) {\n low++;\n }\n\n\n\n // Returning the lower_bound index\n return low;\n }\n\n}\n\n\n\n\n", "lang": "Java 8", "bug_code_uid": "191dd1a3e6e8c16a3abd081c1dee2522", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "965fe688670ae2ade926747b10be50b1", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.3783783783783784, "equal_cnt": 12, "replace_cnt": 10, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 12, "bug_source_code": "import java.util.*;\npublic class Main {\n public static void main(String[] args) {\n int prob = Math.random() > 0.5 ? 1 : 0;\n if (prob == 1) {\n System.out.println(\"YES\");\n } else {\n System.out.println(\"NO\");\n } \n }\n}", "lang": "Java 8", "bug_code_uid": "112ed2642499966cf58c3697a04c4a54", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "316e9ea20ed9b823afb0878a3a665ed5", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.45937300063979525, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "import java.io.BufferedReader;\r\nimport java.io.InputStreamReader;\r\n\r\npublic class B {\r\n public static void main(String[] args) throws Exception {\r\n BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));\r\n StringBuilder sb = new StringBuilder();\r\n int t = 1;\r\n while (t-- > 0) {\r\n int num = Integer.parseInt(buffer.readLine());\r\n sb.append((int) Math.sqrt(num)).append(\"\\n\");\r\n }\r\n System.out.println(sb);\r\n }\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "016225fa51b78ecf615a2833360a3da8", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "ca3c1b88160c9d9833ff5d35a98ba487", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9312714776632303, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\nimport java.util.Scanner;\r\nimport java.util.Vector;\r\n\r\npublic class codeforce {\r\n\tstatic Scanner sc = new Scanner(System.in);\r\n\tstatic Vector ve = new Vector<>();\r\n\tstatic List list = new ArrayList();\r\n\tpublic static void main(String[] args) {\r\n\t\tb1505C();\r\n\t}\r\n\tpublic static void b1505C() {\r\n\t\tString a = sc.next();\r\n\t\tchar[] s = a.toCharArray();\r\n\t\tif((s[0] - 'A' + s[1] - 'A') == s[2] - 'A' || a.length() < 2) System.out.println(\"YES\");\r\n\t\telse System.out.println(\"NO\");\r\n\t}\r\n}", "lang": "Java 11", "bug_code_uid": "be1989a9291d2be084ec7ced686e12ef", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "06c40f1ee3bbcd156d7b0c0dac48a08c", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9899318922120225, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*;\r\nimport java.lang.*;\r\nimport java.io.*;\r\n \r\n \r\npublic class C\r\n \r\n{\r\n class Pair, T extends Comparable> implements Comparable> {\r\n S first;\r\n T second;\r\n \r\n Pair(S f, T s) {\r\n first = f;\r\n second = s;\r\n }\r\n\r\n @Override\r\n public int compareTo(Pair o) {\r\n int t = first.compareTo(o.first);\r\n if (t == 0) return second.compareTo(o.second);\r\n return t;\r\n }\r\n \r\n @Override\r\n public int hashCode() {\r\n return (31 + first.hashCode()) * 31 + second.hashCode();\r\n }\r\n \r\n @Override\r\n public boolean equals(Object o) {\r\n if (!(o instanceof Pair)) return false;\r\n if (o == this) return true;\r\n Pair p = (Pair) o;\r\n return first.equals(p.first) && second.equals(p.second);\r\n }\r\n \r\n @Override\r\n public String toString() {\r\n return \"Pair{\" + first + \", \" + second + \"}\";\r\n }\r\n }\r\n static class FastReader \r\n { \r\n BufferedReader br; \r\n StringTokenizer st; \r\n \r\n public FastReader() \r\n { \r\n br = new BufferedReader(new\r\n InputStreamReader(System.in)); \r\n } \r\n \r\n String next() \r\n { \r\n while (st == null || !st.hasMoreElements()) \r\n { \r\n try\r\n { \r\n st = new StringTokenizer(br.readLine()); \r\n } \r\n catch (IOException e) \r\n { \r\n e.printStackTrace(); \r\n } \r\n } \r\n return st.nextToken(); \r\n } \r\n \r\n int nextInt() \r\n { \r\n return Integer.parseInt(next()); \r\n } \r\n \r\n long nextLong() \r\n { \r\n return Long.parseLong(next()); \r\n } \r\n \r\n double nextDouble() \r\n { \r\n return Double.parseDouble(next()); \r\n } \r\n \r\n String nextLine() \r\n { \r\n String str = \"\"; \r\n try\r\n { \r\n str = br.readLine(); \r\n } \r\n catch (IOException e) \r\n { \r\n e.printStackTrace(); \r\n } \r\n return str; \r\n } \r\n } \r\n public static void main (String[] args) throws java.lang.Exception\r\n {\r\n try {\r\n System.setIn(new FileInputStream(\"input.txt\"));\r\n System.setOut(new PrintStream(new FileOutputStream(\"output.txt\")));\r\n } catch (Exception e) {\r\n System.err.println(\"Error\");\r\n }\r\n \r\n FastReader sc = new FastReader();\r\n int t =sc.nextInt();\r\n PrintWriter out=new PrintWriter(System.out);\r\n while(t-->0){\r\n solve(sc,out);\r\n }\r\n out.close();\r\n }\r\n static void solve(FastReader sc,PrintWriter out) {\r\n char s[] = sc.next().toCharArray();\r\n if(s.length<3){\r\n out.println(\"YES\");\r\n }\r\n else{\r\n for(int i=2;i0) {\r\n//\t \tint n=fs.nextInt();\r\n//\t \t int arr[]=fs.readArray(n);\r\n//\t \t //Map map=new HashMap<>();\r\n//\t \t int min=Integer.MAX_VALUE;\r\n//\t \t for(int i=0;i1) {\r\n//\t \t\t// System.out.println(\"here\");\r\n//\t \t\t ans=1;\r\n//\t \t\t ans= (((cnt*(cnt-1))%mod)*fact(n-2))%mod;\r\n//\t \t }\r\n//\t \t \r\n//\t \t out.println(ans);\r\n//\t }\r\n\t out.close();\r\n }\r\n\t\r\n\tstatic long fact(long n) {\r\n\t\tlong res=1;\r\n\t\tfor(int i=2;i<=n;i++) {\r\n\t\t\tres*=i;\r\n\t\t\tres%=mod;\r\n\t\t}\r\n\t\treturn res;\r\n\t}\r\n\tstatic int gcd(int a,int b) {\r\n\t\tif(b==0) return a;\r\n\t\treturn gcd(b,a%b);\r\n\t}\r\n static void sort(int[] a) {\r\n\t\t//suffle\r\n\t\tint n=a.length;\r\n\t\tRandom r=new Random();\r\n\t\tfor (int i=0; i= numberOfChars) {\n currentChar = 0;\n try {\n numberOfChars = stream.read(buffer);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numberOfChars <= 0)\n return -1;\n }\n return buffer[currentChar++];\n }\n\n public boolean isSpace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public int readInt() {\n int c = read();\n while (isSpace(c))\n c = read();\n\n byte sign = 1;\n if (c == '-') {\n sign = -1;\n c = read();\n }\n\n int result = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n result *= 10;\n result += (c - '0');\n c = read();\n }\n while (!isSpace(c));\n return sign * result;\n }\n\n public long readLong() {\n int c = read();\n while (isSpace(c))\n c = read();\n\n byte sign = 1;\n if (c == '-') {\n sign = -1;\n c = read();\n }\n\n long result = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n result *= 10;\n result += (c - '0');\n c = read();\n }\n while (!isSpace(c));\n\n return sign * result;\n }\n\n public double readDouble() {\n int c = read();\n while (isSpace(c))\n c = read();\n\n byte sign = 1;\n\n if (c == '-') {\n sign = -1;\n c = read();\n }\n\n double result = 0.0;\n\n while (!isSpace(c) && c != '.') {\n if (c == 'e' || c == 'E')\n return result * Math.pow(10, readInt());\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n result *= 10;\n result += (c - '0');\n c = read();\n }\n if (c == '.') {\n c = read();\n double m = 1;\n while (!isSpace(c)) {\n if (c == 'e' || c == 'E')\n return result * Math.pow(10, readInt());\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n m /= 10;\n result += (c - '0') * m;\n c = read();\n }\n }\n return result * sign;\n }\n\n public String readString() {\n int c = read();\n while (isSpace(c))\n c = read();\n StringBuilder result = new StringBuilder();\n do {\n result.appendCodePoint(c);\n c = read();\n }\n while (!isSpace(c));\n\n return result.toString();\n }\n}", "lang": "Java 11", "bug_code_uid": "0a8f2025de3ca6a6f42845e3845909c1", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "42a4ff27061cf9b77e6697a6e627e454", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9917533166009322, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package Codeforces;\r\n\r\nimport java.io.BufferedReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.util.StringTokenizer;\r\n\r\npublic class AprilFoolConetst {\r\n\r\n\tpublic static void main(String[] args) {\r\n\t\t// TODO Auto-generated method stub\r\n\t\tFastScanner fs = new FastScanner();\r\n\t\tchar[] line = fs.next().toCharArray();\r\n\t\tif (line.length <= 2) {\r\n\t\t\tSystem.out.println(\"YES\");\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tint[] fib_no = new int[line.length];\r\n\t\tfib_no[0] = line[0] - 'A';\r\n\t\tfib_no[1] = line[1] - 'A';\r\n\t\tfor(int i = 2; i < line.length; i++) {\r\n\t\t\tif((line[i]-'A') != (((line[i-1]-'A')+(line[i-2]-'A'))%26)) {\r\n\t\t\t\tSystem.out.println(\"NO\");\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\t\tSystem.out.println(\"YES\");\r\n\t\t\r\n\r\n\t}\r\n\tstatic class FastScanner{\r\n\t\tBufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\r\n\t\tStringTokenizer s = new StringTokenizer(\"\");\r\n\t\tpublic String next() {\r\n\t\t\twhile(!s.hasMoreElements()) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\ts = new StringTokenizer(bf.readLine());\r\n\t\t\t\t\t\r\n\t\t\t\t}catch(IOException e) {\r\n\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\treturn s.nextToken();\r\n\t\t}\r\n\t\tpublic int nextInt() {\r\n\t\t\treturn Integer.parseInt(next());\r\n\t\t}\r\n\t\tpublic int[] readArray(int n) {\r\n\t\t\tint[] a = new int[n];\r\n\t\t\tfor(int i = 0; i < a.length; i++) a[i] = nextInt();\r\n\t\t\treturn a;\r\n\t\t}\r\n\t\tpublic long nextLong() {\r\n\t\t\treturn Long.parseLong(next());\r\n\t\t}\r\n\t\t\r\n\t}\r\n\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "11db34b0a151e4b321c9b83b46d44fc0", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "823596e8e507424b237bf00158f896dc", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8715083798882681, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "import java.util.HashMap;\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tString s = scan.nextLine();\n\t\tfib(s);\n\t}\n\t\n\tpublic static void fib(String s) {\n\t\tif (s.length() == 1 || s.length() == 2) {\n\t\t\tSystem.out.println(\"TRUE\");\n\t\t}\n\t\telse {\n\t\t\tfor (int i = 2; i < s.length(); i++) {\n\t\t\t\tif ((s.charAt(i-2)-'A' + s.charAt(i-1)-'A')%26 != s.charAt(i)-'A') {\n\t\t\t\t\tSystem.out.println(\"FALSE\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(\"TRUE\");\n\t\t}\n\t\t\n\t}\n}\n", "lang": "Java 11", "bug_code_uid": "5c7adfe171f15e755bc0dedc4394a53f", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "02ae993eac8d97cf124e6c481d07b7ab", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.1921598770176787, "equal_cnt": 28, "replace_cnt": 23, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 28, "bug_source_code": "import java.io.*;\nimport java.util.StringTokenizer;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\n\npublic class B_DMCA {\n private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n private static StringTokenizer st;\n\n private static int readInt() throws IOException {\n while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());\n return Integer.parseInt(st.nextToken());\n }\n\n public static void main(String[] args) throws IOException {\n System.out.println(digitSum(readInt()));\n }\n\n private static int digitSum(int n) {\n int s = 0;\n while (n > 0) {\n s += n % 10;\n n /= 10;\n }\n return s;\n }\n}\n", "lang": "Java 11", "bug_code_uid": "385a4bf1dabcb47b322c0f2afff0fb76", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "apr_id": "785e6a32bf085e474bdd5f55023bbbdc", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9994374648415526, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\r\n\r\nimport java.io.*;\r\n\r\npublic class Main implements Runnable {\r\n\r\n public static void main(String[] args) {\r\n new Thread(null, new Main(), \"whatever\", 1 << 26).start();\r\n }\r\n\r\n private Scanner sc;\r\n private StringBuilder sb;\r\n\r\n public void run() {\r\n sc = new Scanner(System.in);\r\n // sb=new StringBuilder();\r\n // int t = sc.nextInt();\r\n // while (t-- > 0) {\r\n solve();\r\n // }\r\n }\r\n\r\n public void solve() {\r\n String s=sc.next().toLowerCase();\r\n if(s.length()<=2){\r\n System.out.println(\"YES\");\r\n return;\r\n }\r\n int ppch,pch,ch;\r\n ppch=s.charAt(0)-'a';\r\n pch=s.charAt(1)-'a';\r\n for(int i=2;i